import type { XYPosition } from '@xyflow/svelte'; import type { CanvasNode, CanvasDockingCallbacks, DockStrategy } from './types.js'; export type { DockStrategy }; export interface CreateCanvasDockingOptions extends CanvasDockingCallbacks { isDockTarget?: (target: TNode) => boolean; restorePositionOnDock?: boolean; onSave?: () => void; /** * Disambiguation strategy when multiple candidate dock targets intersect the dragged node. * - 'center-point': (Default) Resolves the target enclosing or closest to the dragged node's center. * - 'max-overlap': Resolves the target with the greatest overlapping area. * - 'pointer': Resolves the target enclosing or closest to the mouse/touch cursor. * - 'first': Resolves the first intersecting target (legacy behavior). */ dockStrategy?: DockStrategy; /** * Custom primary dock target resolution callback. If provided and returns a node, takes precedence. */ resolvePrimaryDockTarget?: (targets: TNode[], draggedNode: TNode, event?: MouseEvent | TouchEvent) => TNode | null; /** * When true (default), ensures only a single primary dock target is considered hovered at any time. * Transitioning across adjacent dock targets automatically fires onDockLeave on the previous target * and onDockHover on the new target. Set to false to allow concurrent multi-target hover. */ exclusiveHover?: boolean; } /** * Headless Svelte 5 rune managing canvas node dragging, docking intersection, and connection tracking. */ export declare function createCanvasDocking(options?: CreateCanvasDockingOptions): { readonly draggedNode: TNode | null; readonly draggedInitialPosition: XYPosition | null; readonly connectingHandle: string; readonly connectingNode: TNode | null; readonly isDragging: boolean; handleNodeDragStart: (params: { targetNode: TNode | null; event?: MouseEvent | TouchEvent; }) => void; handleNodeDrag: (params: { targetNode: TNode | null; event?: MouseEvent | TouchEvent; }, getIntersectingNodes: (node: TNode) => TNode[]) => void; handleNodeDragStop: (params: { targetNode: TNode | null; event?: MouseEvent | TouchEvent; }, getIntersectingNodes: (node: TNode) => TNode[], updateNodePosition?: (nodeId: string, position: XYPosition) => void) => void; handleConnectStart: (params: { nodeId: string | null; handleId?: string | null; handleType: "source" | "target" | null; }, getNode: (id: string) => TNode | undefined) => void; handleConnectEnd: () => void; reset: () => void; };