Import these from @grafloria/engine.
Classes
ResizeNodeCommand
Also has every member of Command, listed on its own entry.
tsclass ResizeNodeCommand extends Command
Methods
constructor( private nodeId: string, newSize: Size, oldSize?: Size )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride canMergeWith(other: Command): boolean— Check if can merge with another commandoverride mergeWith(other: Command): Command— Merge with another commandoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
RotateNodeCommand
Also has every member of Command, listed on its own entry.
Rotate a node to an absolute angle (degrees), undoable.
Mirrors {@link ResizeNodeCommand }: oldRotation is captured on first execute
when the caller did not supply it, so a command built from a live gesture (the
model already sits at its final angle) still restores the pre-gesture angle.
tsclass RotateNodeCommand extends Command
Methods
constructor( private nodeId: string, newRotation: number, oldRotation?: number, options: RotateNodeCommandOptions = {} )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride canMergeWith(other: Command): boolean— Check if can merge with another commandoverride mergeWith(other: Command): Command— Merge with another commandoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SendNodeToBackCommand
Also has every member of Command, listed on its own entry.
Drop a node behind every other node in the diagram.
tsclass SendNodeToBackCommand extends NodeZOrderCommand
Methods
constructor(nodeId: string)override serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UIoverride execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undone
SetFlexItemCommand
Also has every member of Command, listed on its own entry.
tsclass SetFlexItemCommand extends Command
Methods
constructor( private nodeId: string, private flexConfig: FlexItemConfig )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetGridItemCommand
Also has every member of Command, listed on its own entry.
tsclass SetGridItemCommand extends Command
Methods
constructor( private nodeId: string, private gridConfig: GridItemConfig )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetLayoutCommand
Also has every member of Command, listed on its own entry.
tsclass SetLayoutCommand extends Command
Methods
constructor( private groupId: string, private layoutType: 'flexbox' | 'grid', private layoutConfig: LayoutConfig )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetLinkDisplayLabelCommand
Also has every member of Command, listed on its own entry.
Set a link's display label — the metadata.label dialect — undoable.
Links carry TWO label dialects: the POSITIONED labels[] collection
({@link SetLinkLabelCommand } edits those) and the canonical display label
every spec input writes (edges: [{ label: 'in stock' }] →
link.setLabel() → metadata.label, painted at the path's midpoint by the
SVG renderer). The second dialect had no command at all, so the label a
demo/e2e/user actually SEES on an edge could not be edited undoably — the
in-place editor only knew labels[], which that edge does not have. The exact twin of {@link SetNodeLabelCommand }, for the same reason.
tsclass SetLinkDisplayLabelCommand extends Command
Methods
constructor( private linkId: string, newLabel: string, oldLabel?: string )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride canMergeWith(): boolean— One editor session = one undo step.override serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetLinkLabelCommand
Also has every member of Command, listed on its own entry.
Set the text of one of a link's labels, undoable.
The inline label editor commits through this command, so an edge-label edit is one undo step like every other direct-manipulation edit.
tsclass SetLinkLabelCommand extends Command
Methods
constructor( private linkId: string, private labelIndex: number, newText: string, oldText?: string )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride canMergeWith(): boolean— One editor session = one undo step.override serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetLinkLabelsCommand
Also has every member of Command, listed on its own entry.
tsclass SetLinkLabelsCommand extends Command
Methods
constructor( private readonly linkId: string, private readonly labels: LinkLabel[] )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetLinkPathTypeCommand
Also has every member of Command, listed on its own entry.
tsclass SetLinkPathTypeCommand extends Command
Methods
constructor( private readonly linkId: string, private readonly pathType: LinkPathType )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetNodeDataCommand
Also has every member of Command, listed on its own entry.
tsclass SetNodeDataCommand extends Command
Methods
constructor( nodeId: string | readonly string[], private readonly data: Readonly<Record<string, unknown>> )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetNodeLabelCommand
Also has every member of Command, listed on its own entry.
Set a node's label text, undoable.
A node's label lives in metadata under label (that is what
SVGRenderer.renderNodeLabel reads), so this command is the metadata write
plus the dirty flag the renderer needs to repaint. It exists because in-place
text editing must be ONE undo step like every other direct manipulation —
before this, nothing in the command layer could touch a label.
tsclass SetNodeLabelCommand extends Command
Methods
constructor( private nodeId: string, newLabel: string, oldLabel?: string )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride canMergeWith(): boolean— Never merge: each committed edit (one editor session) is one undo step.override serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetNodeShapeConfigCommand
Also has every member of Command, listed on its own entry.
tsclass SetNodeShapeConfigCommand extends Command
Methods
constructor( private readonly nodeId: string, private readonly patch: Readonly<Record<string, unknown>> )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetNodeStyleCommand
Also has every member of Command, listed on its own entry.
tsclass SetNodeStyleCommand extends Command
Methods
constructor( nodeId: string | readonly string[], private readonly style: Partial<NodeStyle> )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
SetNodeZIndexCommand
Also has every member of Command, listed on its own entry.
Set a node's stacking index to an explicit value.
tsclass SetNodeZIndexCommand extends NodeZOrderCommand
Methods
constructor(nodeId: string, private zIndex: number)override canMergeWith(other: Command): boolean— Check if can merge with another commandoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UIoverride execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undone
SetParentCommand
Also has every member of Command, listed on its own entry.
tsclass SetParentCommand extends Command
Methods
constructor( private nodeId: string, private newParentId?: string )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
UpdateLinkStyleCommand
Also has every member of Command, listed on its own entry.
tsclass UpdateLinkStyleCommand extends Command
Methods
constructor( private readonly linkId: string, private readonly style: Partial<LinkStyle> )override execute(context: CommandContext): void— Execute the commandoverride undo(context: CommandContext): void— Undo the commandoverride canExecute(context: CommandContext): boolean— Check if command can be executedoverride canUndo(context: CommandContext): boolean— Check if command can be undoneoverride serialize(): SerializedCommand— Serialize commandoverride getDescription(): string— Get description for UI
Was this page helpful?