Skip to content
D
Documentation

Commands — interfaces

reference
2 min readUpdated

Interfaces

Import these from @grafloria/engine.

Interfaces

CommandContext

ts
interface CommandContext

Properties

NameTypeDefaultDescription
diagramany
eventBusany
store?any
engine?any

CommandHistoryEntry

ts
interface CommandHistoryEntry

Properties

NameTypeDefaultDescription
commandCommand
timestampnumber
durationnumber
successbooleanHistory only ever records commands that EXECUTED successfully, so this is always true and error is never set. Both fields survive purely for API compatibility — a command that throws (or fails strict validation) no longer enters history at all, because canUndo()/undo() never consulted these flags and would happily "undo" a mutation that never happened.
error?Error

CutCommandOptions

ts
interface CutCommandOptions

Properties

NameTypeDefaultDescription
includeGroups?booleanInclude groups containing selected nodes in the clipboard payload (default: false)
includeLinks?booleanInclude links between copied nodes in the clipboard payload (default: true)
deleteChildren?booleanDelete child nodes recursively (default: true)
deleteLinks?booleanDelete links connected to the deleted nodes (default: true)

GroupFrameMove

One (nested) group frame's move.

ts
interface GroupFrameMove

Properties

NameTypeDefaultDescription
groupIdstring
fromGroupFrameSnapshot
toGroupFrameSnapshot

GroupFrameSnapshot

A group frame's restorable geometry (matches GroupModel.restoreGeometry).

ts
interface GroupFrameSnapshot

Properties

NameTypeDefaultDescription
position{ x: number; y: number }
size?{ width: number; height: number; depth: number }
bounds?{ x: number; y: number; width: number; height: number }

GroupNodeMove

One member node's absolute move.

ts
interface GroupNodeMove

Properties

NameTypeDefaultDescription
nodeIdstring
fromPoint
toPoint

MacroStep

ts
interface MacroStep

Properties

NameTypeDefaultDescription
commandCommand
delay?number

MoveNodeCommandOptions

ts
interface MoveNodeCommandOptions

Properties

NameTypeDefaultDescription
mergeable?booleanWhether CommandManager may MERGE this move into the previous one for the same node (default: true, preserving the historic behaviour).

RotateNodeCommandOptions

ts
interface RotateNodeCommandOptions

Properties

NameTypeDefaultDescription
mergeable?booleanWhether CommandManager may MERGE this rotation into the previous one for the same node (default: false).

SerializedCommand

ts
interface SerializedCommand

Properties

NameTypeDefaultDescription
idstring
namestring
timestampnumber
dataany

Was this page helpful?

Commands — interfaces — Grafloria