Node API
Node renders a draggable node element and owns (or adopts) a core NodeMirror.
| Prop | Meaning |
|---|---|
id | Stable domain identity; minted when omitted — supply it for persistence |
nodeObject | Adopt an existing NodeMirror instead of creating one |
x, y, width, height | World geometry; changed props resynchronize the object |
minWidth, minHeight | Resize floor |
metadata | SnapLineMetadata attached to the node |
callbacks | NodeCallbacks object (drag, selection, resize, lines, and resolveNewLine payload seeding) |
onGeometryCommit | Convenience callback; batched final geometry for persistence |
onSizeChange | Convenience callback for resize events |
edgePan | Pan the camera when dragging near the viewport edge (default true) |
LineSvelteComponent | Custom line renderer used for this node’s outgoing lines (defaults to Line) |
className | Class for the outer node element |
elementProps | Framework-native attributes and events for the outer node element |
children | Node content; Connector children register against this node |
getNodeObject() returns the underlying NodeMirror. A supplied nodeObject is not destroyed on unmount.
Resizing is opt-in by composition: render a ResizeRegion descendant for
each direction you support. The region is the real DOM hit area; position,
dimensions, cursor, visuals, and native hover events are application-owned.
Convenience callbacks compose with their callbacks-object equivalents rather
than replacing them. During a live pointer gesture, core writes retained
element geometry directly; the batched onGeometryCommit reports final
values for application persistence.
The rendered element carries data-snapline-type="node" and data-selected / data-snapline-state="focus" | "idle" for styling.