Skip to content
D
Documentation

Models — interfaces

reference
8 min readUpdated

Interfaces

Import these from @grafloria/engine.

Interfaces

ChangeEntry

ts
interface ChangeEntry

Properties

NameTypeDefaultDescription
timestampnumber
propertystring
oldValueany
newValueany

CollapsedState

The reversible snapshot captured when a group collapses. Stored (serialized) on the group so a collapsed diagram round-trips and can be expanded losslessly after a save/load — not just within one session.

ts
interface CollapsedState

Properties

NameTypeDefaultDescription
proxyNodeIdstringThe hidden placeholder node that presents the group as a node endpoint.
savedGeometry?{ position: { x: number; y: number }; size?: { width: number; height: number; depth: number }; bounds?: GroupRect; }The group's exact geometry before it shrank (restored verbatim on expand).
savedPositionsRecord<string, { x: number; y: number }>Member (node) world positions at collapse time (restored on expand).
hiddenNodesArray<{ nodeId: string; prevVisible: boolean }>Members whose visibility we toggled, with their prior visible value.
removedLinksany[]Serialized links removed at collapse time (internal links + the parallel boundary links that were aggregated away). Re-created verbatim on expand.
proxyLinksArray<{ linkId: string; end: 'source' | 'target'; originalPortId: string; originalNodeId?: string; aggregatedCount: number; }>Boundary links that SURVIVED as proxy links: one per (external endpoint) bundle, re-pointed to the placeholder node. Records the original endpoint so expand can restore it, plus how many raw edges it now represents.

DiagramLoadOptions

ts
interface DiagramLoadOptions

Properties

NameTypeDefaultDescription
validate?'off' | 'warn' | 'strict'Structural integrity policy for the incoming document: - 'off' (default) skip validation - 'warn' validate and console.warn a one-line summary with the report - 'strict' validate and throw DiagramValidationError on any error

FitToContentsOptions

Options for {@link GroupModel.fitToContents}.

ts
interface FitToContentsOptions

Properties

NameTypeDefaultDescription
mode?GroupFitModeOverride the group's stored {@link GroupModel.fitMode} for this call.
deepRecursive?booleanDeep-recursive fit: fit every descendant group first (deepest first) so a parent fits around already-fitted children. Requires a diagram.

GroupRect

A resolved rectangle (all four sides present).

ts
interface GroupRect

Properties

NameTypeDefaultDescription
xnumber
ynumber
widthnumber
heightnumber

LaneConfig

Swimlanes & pools as a GENERIC banded group (not BPMN-named). A pool group tiles its child lane groups into bands along one axis; each lane is an ordinary group (so drop-to-assign, membership, constraints all reuse the existing machinery). This is intrinsic band config that round-trips.

ts
interface LaneConfig

Properties

NameTypeDefaultDescription
role'pool' | 'lane''pool' owns the band grid; 'lane' is one band inside a pool.
orientation'horizontal' | 'vertical'Band axis. 'horizontal' → lanes are rows stacked along Y (each spans the pool width). 'vertical' → lanes are columns along X (each spans the height). Set on the pool; lanes carry a copy for convenience.
laneOrder?string[]Pool only: ordered child lane group ids (band order).
headerSize?numberPool only: title-band thickness reserved along the main axis start (left for horizontal pools, top for vertical pools).
weight?numberLane only: relative cross-axis size when not fixed (default 1).
fixedSize?numberLane only: absolute cross-axis size (pins the band, overrides weight).

MembershipLeaf

ts
interface MembershipLeaf

Properties

NameTypeDefaultDescription
fieldstringDot-free key looked up on the node's data map.
op'eq' | 'ne' | 'in' | 'nin' | 'gt' | 'gte' | 'lt' | 'lte' | 'exists' | 'matches'
value?unknownComparison operand (array for in/nin; regex source string for matches).

NearestPortHit

What {@link DiagramModel.findNearestPort} found.

ts
interface NearestPortHit

Properties

NameTypeDefaultDescription
portPortModel
nodeNodeModel
distancenumberDistance from the query point to the port, in world units.

NearestPortOptions

Options for {@link DiagramModel.findNearestPort}.

ts
interface NearestPortOptions

Properties

NameTypeDefaultDescription
radius?numberMaximum distance, in world units (default {@link DEFAULT_PORT_SNAP_RADIUS}).
filter?(port: PortModel, node: NodeModel) => booleanConsider only the ports this accepts (e.g. valid targets for the dragged link).
portPosition?(port: PortModel, node: NodeModel) => PointWhere a port actually IS. Defaults to the bounding-box edge midpoint. Callers inside a renderer must pass the SHAPE-AWARE resolver (portWorldPosition) — see the note on findNearestPort.

SerializedDiagram

Also has every member of SerializedEntity, listed on its own entry.

ts
interface SerializedDiagram extends SerializedEntity

Properties

NameTypeDefaultDescription
schemaVersion?numberDocument schema version (shape of THIS payload), distinct from the per-entity mutation counter version. Absent on pre-versioning documents, which are treated as schemaVersion 1 and migrated on load.
namestring
nodesSerializedNode[]
linksSerializedLink[]
groupsSerializedGroup[]
strokes?SerializedStroke[]Freehand ink.
viewport{ x: number; y: number; width: number; // Phase 0.5 - Viewport-aware layout height: number; // Phase 0.5 - Viewport-aware layout zoom: number; }
comments?CommentRegisterTreeAnchored comment threads. Document data, saved with the document — a comment that does not survive a save is a comment that does not exist.

SerializedGroup

Also has every member of SerializedEntity, listed on its own entry.

ts
interface SerializedGroup extends SerializedEntity

Properties

NameTypeDefaultDescription
namestring
membersstring[]
isCollapsedboolean
bounds?{ x: number; y: number; width: number; height: number }
layoutType?LayoutType
layoutConfig?LayoutConfig
position?{ x: number; y: number }
size?{ width: number; height: number; depth: number }
parentGroupId?string
padding?GroupPadding
headerHeight?number
zIndex?number
fitMode?GroupFitMode
constrainChildren?boolean
collapsedState?CollapsedState
subgraphLayout?SubgraphGroupConfig
laneConfig?LaneConfig
membershipRule?MembershipRule
capacity?number

Also has every member of SerializedEntity, listed on its own entry.

ts
interface SerializedLink extends SerializedEntity

Properties

NameTypeDefaultDescription
sourcePortIdstring
targetPortIdstring
sourceNodeId?string
targetNodeId?string
pathType'direct' | 'orthogonal' | 'smooth' | 'bezier'
router?LinkRouterNameExplicit routing geometry; absent = derived from pathType.
connector?LinkConnectorNameExplicit polyline rendering; absent = derived from pathType.
pointsPoint[]
segmentsPathSegment[]
labelsLinkLabel[]
state'default' | 'selected' | 'hovered' | 'highlighted'
stylePartial<LinkStyle>
dataRecord<string, any>

SerializedNode

Also has every member of SerializedEntity, listed on its own entry.

ts
interface SerializedNode extends SerializedEntity

Properties

NameTypeDefaultDescription
positionPoint
sizeSize
rotationnumber
scalePoint
typestring
systemType?string
definitionId?string
parentId?string
childrenstring[]
portsSerializedPort[]
stateNodeState
behaviorNodeBehavior
stylePartial<NodeStyle>
dataRecord<string, any>
positionMode?PositioningMode
transformOrigin?Point
zIndex?numberModel-level stacking order. OMITTED when the node never set one, so every document written before this field existed round-trips byte-for-byte and no schema migration is needed — absence means "unset", not 0.
flexConfig?FlexItemConfig
gridConfig?GridItemConfig
portRenderingConfig?any
dragHandlerConfig?any
connectionGroup?string

SerializedStroke

Also has every member of SerializedEntity, listed on its own entry.

ts
interface SerializedStroke extends SerializedEntity

Properties

NameTypeDefaultDescription
type'stroke'
pointsStrokePoint[]
styleStrokeStyle
label?stringAn author-supplied name. THE ENTIRE ACCESSIBILITY STORY LIVES ON THIS FIELD — see the a11y note on the renderer's ink layer. Absent for anonymous ink, which is the normal case and is rendered aria-hidden.

StrokePoint

One sample from the pointer.

pressure is 0..1 and OPTIONAL — a mouse does not have any. It is stored only when the device actually reported a varying one (see {@link hasPressure}), because a field that is always 0.5 is noise on the wire and a lie in the model.

It is not decoration: the renderer builds a variable-width outline from it. A pressure that does not change the picture would be exactly the "machinery wired to nothing" this project has shipped in all nine previous waves.

ts
interface StrokePoint

Properties

NameTypeDefaultDescription
xnumber
ynumber
pressure?number0..1. Absent when the device did not report a meaningful one.

StrokeStyle

How the ink looks. Flat and JSON-safe — this crosses the wire as an op payload.

ts
interface StrokeStyle

Properties

NameTypeDefaultDescription
colorstringAny CSS colour.
widthnumberNominal width in WORLD units (so ink zooms with the diagram, like everything else).
opacity?number0..1. Highlighter ink is translucent; a pen is not.

SubgraphGroupConfig

A group's own compound-layout configuration — the subset of the GroupInfo layout contract that is intrinsic to the group and round-trips.

ts
interface SubgraphGroupConfig

Properties

NameTypeDefaultDescription
algorithm?'dagre' | 'elk' | 'grid' | 'inherit' | (string & {})Algorithm for THIS group's contents. 'inherit' uses the parent/default.
fixed?booleanPinned: neither laid out internally nor moved by the parent layout.
layoutOptions?Record<string, unknown>Opaque options forwarded to the chosen layout adapter.

Was this page helpful?

Models — interfaces — Grafloria