Diagram - Sequence Basics
Author participants, messages, stable occurrences and activation boundaries in an explicit Interaction.
#Usage
This component accepts an initial Sequence model and its page ID. Supply the records shown in a demo below. Copy the preset inspector files to the local import path and follow Setup for application styles and licensing.
<script setup lang="ts">
import { onBeforeUnmount } from 'vue';
import { Diagram, createDiagramStore, DiagramSymbolRegistry, type DiagramModel } from '@primeui/vue-diagram';
import { DiagramSequenceRoot, createDiagramSequenceModule, createDiagramSequenceSymbols } from '@primeui/vue-diagram/sequence';
import { DiagramSequenceInspectorUI } from './components/primeui/diagram/sequence';
const props = defineProps<{ model: DiagramModel; pageId: string }>();
const created = createDiagramStore(props.model, { notationModules: [createDiagramSequenceModule()] });
if (!created.ok) throw new Error(created.diagnostics.map((item) => item.message).join('; '));
const store = created.value;
const symbols = new DiagramSymbolRegistry();
for (const symbol of createDiagramSequenceSymbols()) symbols.register(symbol);
onBeforeUnmount(() => {
symbols.dispose();
store.dispose();
});
</script>
<template>
<Diagram.Root :store="store" :page-id="pageId" :symbols="symbols">
<DiagramSequenceRoot>
<Diagram.Viewport label="Sequence model" auto-fit style="height: 30rem" />
<DiagramSequenceInspectorUI />
</DiagramSequenceRoot>
</Diagram.Root>
</template>The model is read once during setup. For file loading or Reset, replace the store deliberately and dispose the previous caller-owned store. The root owns its session. The copied inspector follows selection and creates its own DiagramSequenceInspectorHost; a custom form uses that host with useDiagramSequenceInspector() in a child component. Its snapshots are readonly refs. Read .value in setup and use the documented actions to change drafts or selections. Mounting a form does not install the notation module.
Use Sequence to describe an exchange between participants. The sd frame is the
Interaction authority, separate from the page. Positions and heights are drawing
coordinates, not elapsed time. Each lifeline holds explicit local occurrence order;
there is no total Interaction order or execution engine.
#Start with a small exchange
Choose Focus submit, then use Edit selected element. Customer is an Actor
participant and Orders is an Object participant. Submit is a synchronous call;
accepted explicitly names that call in replyTo. Select a participant to edit its
name/type/profile or select a message to edit its description and endpoints. Undo
restores a complete edit. Read only keeps selection, Fit and inspection usable;
Restart example restores the original snapshot with empty history.
The fixture uses public editor actions to construct reciprocal identities and projected geometry, then returns the finished model for a fresh enabled store. Construction resources are disposed. The mounted example owns and disposes its store and registry when replaced/destroyed.
#Bind messages and activations to occurrences
The Process activation uses the submit receive and accepted send occurrences as its start and finish. Choose an asynchronous sort and Add asynchronous message. Add standalone activation creates an activation with its own execution-boundary occurrences. Each Add action offers one specimen at a deliberate position. Undo each addition independently, or Restart, to make that specimen available again. Try reply before call attempts a separate reply whose two occurrences precede submit. It rejects without changing the accepted reply, Process activation or model history. Try rotation rejects because Sequence records remain upright.
An activation is descriptive execution notation, not a running function. It names
one lifeline and stable start/finish IDs in one scope, with nondecreasing positions.
A standalone atomic activation may share one boundary ID for start and finish.
offset is a visible overlap lane from 0 through 8; overlapping/atomic executions
on the same lifeline require distinct offsets unless their scopes are mutually
exclusive alternative operands.
| Message sort | Descriptive meaning and supported reference rules |
|---|---|
synchCall | Synchronous call; a reply may explicitly reference this message. |
asynchCall | Asynchronous call with inert name/arguments; no operation signature resolution. |
asynchSignal | Asynchronous signal; no dispatch or signal-definition resolution. |
reply | May set replyTo to an actual synchronous call in the same Interaction. Missing binding is valid unfinished authoring and warns. |
create | Creates the target lifeline at the receive occurrence; cannot create itself. |
delete | Destroys the target lifeline at the receive occurrence. |
Every message has kind: 'message', interactionId, scopeId, sort, name,
arguments, reciprocal sendId/receiveId and optional replyTo. Arguments are
inert text, not evaluated values. A bound reply reverses the call's lifelines and
follows that call. Reply/call scopes cannot be mutually exclusive alt operands.
#Describe creation and destruction
Open creates Orders; its visible participant header belongs at that scoped creation. Close is its destruction. Move work message updates the same send/receive occurrences and arguments. Try message after destruction rejects a later event on the ended lifeline. Undo restores the former positions with the same identities.
Each lifeline has at most one creation and destruction in each enclosing scope. Creation receive is first locally; destruction is final locally. Other occurrences and activations fit the scoped lifetime and visible creation-header clearance. Sibling alt branches have independent local lifetimes, so a creation/destruction in one branch does not truncate another branch or the root lifeline authority.
Messages run horizontally or downward. A self-message uses two distinct ordered occurrences separated by at least 16 drawing units. Distinct occurrences on the same lifeline and scope have strictly increasing drawing positions. Generic connector geometry does not author these identities: use the semantic editor to change the message or its occurrences so labels, ports and routes agree.
#Identity and ownership reference
| Record | Required data and supported bounds |
|---|---|
| Sequence page | kind: 'page'; the page marker does not become the Interaction ID. |
interaction | name; root fixed sd frame at least 240×220 drawing units. |
participant | interactionId, root scopeId, name, typeName, profile: 'object' | 'actor', reciprocal lifelineId; at least name or type text is nonblank. Header column fits inside its Interaction. |
lifeline | Ownership, reciprocal participantId, ordered distinct occurrences IDs (up to 1000); authority remains at Interaction scope. |
occurrence | Ownership, lifelineId, finite position from 0 to 100000, independent portId, role: 'send' | 'receive', reciprocal messageId. |
executionOccurrence | Ownership, lifeline/position and reciprocal executionId; a boundary belongs to its explicit execution. |
execution | Ownership, name, lifelineId, startId, finishId, integer offset 0–8. Boundaries use the same lifeline and scope. |
Every owned record names an actual Interaction and its enclosing Interaction or
operand scope. Visual parent and layer/page agree with that semantic owner. A node
ID, a lifeline ID, an occurrence ID and its physical port ID are separate identities;
changing a friendly name must not allocate replacements. IDs use the 128-character
alphanumeric plus _ . : - syntax. Names/type text are at most 128 characters,
message arguments at most 512. Omit unset optional fields. Unknown properties,
unsupported versions or unresolved active payloads require explicit repair.
#Editing API and form ownership
| API | Purpose and defaults |
|---|---|
sequenceEnvelope, readDiagramSequence, validDiagramSequence, validateDiagramSequence, diagramSequenceWarnings | Version-1 semantics, supported reads, errors and separate completeness warnings. |
createDiagramSequencePage, createDiagramSequenceNode(id,pageId,layerId,data,bounds) | Construct portable page/node records. Factories do not allocate a complete semantic exchange or commit edits. |
projectDiagramSequence(model) | Canonical geometry from existing semantic identities; does not invent ownership. sequenceMessageText/sequenceMessageAppearance derive display text/markers. |
DIAGRAM_SEQUENCE_MESSAGE_SORTS | Exact six message sort choices shown above. |
DiagramSequenceEditor.createInteraction / updateInteraction | Create frame; update name and optional width/height. |
createParticipant(id,interactionId,name,typeName,profile,x,lifelineId?) | Creates participant and reciprocal lifeline together; default lifeline ID is id + ':lifeline'. updateParticipant edits name/type/profile and optional column X. |
createMessage(id,data,send,receive) | End inputs are { lifelineId, position }; generates id + ':send', id + ':receive' and distinct physical port IDs atomically. |
updateMessage(id,values,ends?) / updateOccurrence(id,position) | Preserve message/occurrence identity while changing sort/name/arguments/reply binding or positions. Values include the complete desired message description. |
createExecution / createStandaloneExecution / updateExecution | Bind existing occurrences or create owned boundaries; offset defaults 0. Standalone scope is optional and otherwise uses the lifeline's owner. |
remove(id) | Removes through the semantic owner: a message removes its occurrences, an execution its standalone boundaries; dependent references still have to remain valid. |
DiagramSequenceInspectorModel | Explicit entityId, selected semantic data/choices, draft values, readOnly, disabled, feedback, warnings; actions participant, interaction, message, execution, occurrence, remove, and fragment actions in the next guide. |
Semantic Sequence edits use the shared connection/notation operation path, including approval, veto and controlled acknowledgement, and produce one complete history operation. Undo/Redo recheck current permissions. A rejection preserves the graph; a noop adds no edit, and pending belongs to the live store/connection owner. Copied forms keep draft fields separate from saved records and reconcile them when ownership or selection changes.
See Sequence fragments for alt/loop, nested operand membership and self-contained reuse. Gates, found/lost messages, general ordering constraints, timed traces, arbitrary rotation and executable Interaction behavior are outside this profile.