import { type CanvasAutoLayoutControllerOptions, type GuideLine, type PositionChangeLike } from '@pixerate/editor/canvas'; import type { CanvasNode } from './types.js'; type CoreOptions = CanvasAutoLayoutControllerOptions; export interface CreateCanvasAutoLayoutOptions extends Omit { getNodes: () => TNode[]; setNodes: (nodes: TNode[]) => void; onGuidesChange?: (guides: GuideLine[]) => void; } /** * Headless Svelte 5 rune for Figma-style auto layout on SvelteFlow sub-flows. Frames are * nodes with `data.layout`; their children (`parentId`) are stacked, wrapped or placed on a * grid, with hug / fill / fixed sizing, min / max, padding, alignment and constraints. * * Its actions (`addNode`, `removeNodes`, `resizeNode`, `moveChild`, `applyAutoLayout`) relayout * in the same undoable step when a `HistoryManager` is passed. Wire the flow's own edits with * `onnodedrag={({ targetNode }) => autoLayout.dragReorder(targetNode.id)}`, * `onnodedragstop={({ targetNode }) => autoLayout.endReorderDrag(targetNode.id)}`, * `ondelete={({ nodes }) => autoLayout.nodesDeleted(nodes)}`, * `` and call `autoLayout.measured(id)` when * a node's content size changes. Render `guides` (the drop marker) with ``. */ export declare function createCanvasAutoLayout(options: CreateCanvasAutoLayoutOptions): { guides: GuideLine[]; hasPending: boolean; /** Notes node changes (see the core controller) and flushes them on the next microtask. */ handleChanges(changes: TChange[]): TChange[]; /** For SvelteFlow's `ondelete`: relayouts the frames the deleted nodes left. */ nodesDeleted(removed: Iterable<{ id: string; parentId?: string; }>): void; /** Relayouts around node `id` after its measured (content) size changed. */ measured(id: string): void; /** * Handlers for SvelteFlow's ``: children follow their constraints and the * frames around the node relayout when the resize ends. */ resizerHandlers(id: string): { onResizeStart: () => void; onResizeEnd: () => void; }; applyAutoLayout(frameId?: string): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; layoutUpdates(ids: Iterable): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; relayout(ids: Iterable): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; addNode(node: any, addOptions?: { index?: number; }): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; removeNodes(ids: Iterable): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; resizeNode(id: string, size: { width?: number; height?: number; }): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; moveChild(childId: string, index: number): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; getInsertTarget(id: string, point?: import("@pixerate/editor/canvas").XYPosition): import("@pixerate/editor/canvas").AutoLayoutInsertTarget | undefined; beginReorderDrag(id: string): void; dragReorder(id: string, point?: import("@pixerate/editor/canvas").XYPosition): import("@pixerate/editor/canvas").AutoLayoutInsertTarget | undefined; endReorderDrag(id: string, point?: import("@pixerate/editor/canvas").XYPosition): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; noteChanges(changes: TChange[]): TChange[]; noteRemoved(removed: Iterable<{ id: string; parentId?: string; }>): void; flush(): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; isFrame: (id: string) => boolean; }; export type CanvasAutoLayout = ReturnType>; export {};