Svelte API
Wrap components in Engine from @snap-engine/asset-base/svelte.
| Component | Important props |
|---|---|
Node | id, nodeObject, x, y, width, height, resize configuration, callbacks, onGeometryCommit, onSizeChange, edgePan, metadata, LineSvelteComponent, className, elementProps |
Connector | id, name, rules, custom-root snippet, surfaceStrategies, colliderRadius, metadata, callbacks |
Line | line, SVG presentation |
Select | callbacks, className |
Group | Node geometry plus title, headerContent, canContain, membership callbacks |
Placement | controller, cancellation options, preview snippet |
ControlledGraph | onLineChangeRequest (returns the next LineRecord[]), onDiagnosticsChanged |
getNodeObject() exposes the underlying object from Node and Group; Connector.object() exposes its connector; Select.getSelectObject() exposes its RectSelectController. Supplied objects are not destroyed
when the component unmounts.
Give Connector a child snippet to use a custom HTML or SVG input root. Apply
the supplied action to one element; an SVG path with pointer-events="stroke" can make a whole node border draggable without a
headless input route. LineRecord.payload stays opaque to the adapter and is
available to custom LineSvelteComponent renderers through LineMirror.
Custom renderers register line.bindGeometryWriter(...) on mount and mutate
retained SVG, Canvas, or graphics refs directly.
Connector callbacks, metadata, policy, surface strategies, collider radius,
and edge-pan behavior are reactive. name and connectorObject are
construction-time identities.
Changed geometry props resynchronize the object deliberately. During a live
pointer gesture core writes retained element geometry directly; the batched onGeometryCommit reports final values for application persistence.