Node API
Core NodeMirror configuration, callbacks, resize constants, and data attributes.
NodeMirror owns a node’s position, selection, resize behavior, and
connectors. Construct it with new NodeMirror(engine, parent, config), assign
its committed element, then call remeasureDomGeometry().
NodeConfig accepts id (stable domain identity — minted when omitted;
supply it for persistence), resizable, minWidth, minHeight, resizeHandles, resizeHandleThickness, resizeCursors, metadata, callbacks, and edgePan.
NodeCallbacks covers drag (canStartDrag, resolveDragPosition, onDragStart, onDrag), selection (resolveSelectionMode, onSelectionChange), resize (onResizeHandleChange, onSizeChange), lines
(onLinesChanged), and the batched onGeometryChanged used for
persistence.
Resize constants
| Export | Value |
|---|---|
RESIZE_HANDLES | The eight handles "n" \| "ne" \| "e" \| "se" \| "s" \| "sw" \| "w" \| "nw" |
DEFAULT_RESIZE_CURSORS | Per-handle CSS cursor map |
DEFAULT_RESIZE_HANDLE_THICKNESS | 14 (pixels) |
Data attributes
Selection state is written to the element as data-selected="true" | "false" and data-snapline-state="focus" | "idle" — style either without extra
callbacks. Adapters additionally stamp data-snapline-type="node".
Enumerate nodes with getNodes(engine) or query(engine).nodes(); look one
up by domain id with query(engine).node(id).