Svelte API

Svelte 5 SnapLine components, props, callbacks, and object access.

Wrap components in Engine from @snap-engine/asset-base-svelte.

ComponentImportant props
Nodeid, nodeObject, x, y, width, height, resize configuration, callbacks, onGeometryChanged, onSizeChange, edgePan, metadata, LineSvelteComponent, className, elementProps
Connectorid, name, rules, virtual, surfaceStrategies, colliderRadius, metadata, callbacks
Lineline, SVG presentation
Selectcallbacks, className
GroupNode geometry plus title, headerContent, canContain, membership callbacks
Placementcontroller, cancellation options, preview snippet
ControlledGraphlines (your LineRecords), onLineChangeRequest, 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.

A virtual connector renders no port element. Its source and target surfaces are resolved against the parent node, which is useful for whole-border diagram connections. 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. virtual can also be toggled without replacing the logical connector or its lines. 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 onGeometryChanged reports final values for application persistence.