import { type ArrangeShortcutBinding, type CanvasArrangeAction, type CanvasArrangeControllerOptions, type GuideLine } from '@pixerate/editor/canvas'; import type { CanvasNode } from './types.js'; type CoreOptions = CanvasArrangeControllerOptions; export interface CreateCanvasArrangeOptions extends Omit { getNodes: () => TNode[]; setNodes: (nodes: TNode[]) => void; onGuidesChange?: (guides: GuideLine[]) => void; } /** * Headless Svelte 5 rune for Freeform-style arrangement: align, distribute, make same size, * lock / unlock, layer order and smart guides with snap-to-shape while dragging. * * Actions act on `getSelectedIds()` (default: selected nodes) when called without ids and * are recorded as single undoable steps when a `HistoryManager` is passed as `history`. * * Wire snapping to SvelteFlow with `onnodedragstart={() => arrange.beginDrag()}`, * `onnodedrag={({ nodes }) => arrange.drag(nodes.map((n) => n.id))}` and * `onnodedragstop={() => arrange.endDrag()}`, and render `arrange.guides` with * ``. Snap resizes with ``. */ export declare function createCanvasArrange(options: CreateCanvasArrangeOptions): { guides: GuideLine[]; /** * Resize snapping for SvelteFlow's `` / ``: * ``. The resizer writes the raw size * to the nodes after `onResize`, so snapping runs a microtask later and writes the * snapped box back. Locked nodes snap back to their starting box. */ resizerHandlers(id: string): { onResizeStart: () => void; onResize: () => void; onResizeEnd: () => void; }; apply: (name: string, updates: import("@pixerate/editor/canvas").CanvasNodeUpdate[]) => import("@pixerate/editor/canvas").CanvasNodeUpdate[]; align(edge: import("@pixerate/editor/canvas").AlignEdge, ids?: Iterable, alignOptions?: import("@pixerate/editor/canvas").AlignNodesOptions): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; distribute(axis: import("@pixerate/editor/canvas").DistributeAxis, mode?: import("@pixerate/editor/canvas").DistributeMode, ids?: Iterable, distributeOptions?: import("@pixerate/editor/canvas").DistributeNodesOptions): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; matchSize(dimension: import("@pixerate/editor/canvas").SizeDimension, ids?: Iterable, sizeOptions?: import("@pixerate/editor/canvas").MatchSizeOptions): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; reorder(operation: import("@pixerate/editor/canvas").ZOrderOperation, ids?: Iterable): import("@pixerate/editor/canvas").CanvasNodeUpdate[]; bringForward: (ids?: Iterable) => import("@pixerate/editor/canvas").CanvasNodeUpdate[]; sendBackward: (ids?: Iterable) => import("@pixerate/editor/canvas").CanvasNodeUpdate[]; bringToFront: (ids?: Iterable) => import("@pixerate/editor/canvas").CanvasNodeUpdate[]; sendToBack: (ids?: Iterable) => import("@pixerate/editor/canvas").CanvasNodeUpdate[]; lock: (ids?: Iterable) => string[]; unlock: (ids?: Iterable) => string[]; toggleLock(ids?: Iterable): string[]; isLocked: (id: string) => boolean; combineShapes(operation: import("@pixerate/editor/canvas").ShapeOperation, ids?: Iterable, combineOptions?: import("@pixerate/editor/canvas").CombineShapeNodesOptions): import("@pixerate/editor/canvas").CombineShapeNodesResult; unite: (ids?: Iterable, o?: import("@pixerate/editor/canvas").CombineShapeNodesOptions) => import("@pixerate/editor/canvas").CombineShapeNodesResult; intersect: (ids?: Iterable, o?: import("@pixerate/editor/canvas").CombineShapeNodesOptions) => import("@pixerate/editor/canvas").CombineShapeNodesResult; subtract: (ids?: Iterable, o?: import("@pixerate/editor/canvas").CombineShapeNodesOptions) => import("@pixerate/editor/canvas").CombineShapeNodesResult; exclude: (ids?: Iterable, o?: import("@pixerate/editor/canvas").CombineShapeNodesOptions) => import("@pixerate/editor/canvas").CombineShapeNodesResult; divide: (ids?: Iterable, o?: import("@pixerate/editor/canvas").CombineShapeNodesOptions) => import("@pixerate/editor/canvas").CombineShapeNodesResult; canCombineShapes: (ids?: Iterable) => boolean; offsetShapes(distance: number, ids?: Iterable, offsetOptions?: import("@pixerate/editor/canvas").OffsetShapeNodesOptions): import("@pixerate/editor/canvas").ShapePathEditResult; canOffsetShapes: (ids?: Iterable) => boolean; outlineStroke(ids?: Iterable, outlineOptions?: import("@pixerate/editor/canvas").OutlineShapeStrokesOptions): import("@pixerate/editor/canvas").ShapePathEditResult; canOutlineStroke: (ids?: Iterable) => boolean; runAction(action: CanvasArrangeAction): boolean; beginDrag(ids?: Iterable): void; drag(ids?: Iterable): import("@pixerate/editor/canvas").SnapNodeDragResult | null; snapPositionChanges(changes: TChange[]): TChange[]; beginResize(id: string): void; resize(id: string, handle?: import("@pixerate/editor/canvas").ResizeHandle): import("@pixerate/editor/canvas").SnapNodeResizeResult | null; endResize(): void; snapResizeChanges(changes: TChange[]): TChange[]; endDrag(): void; }; export type CanvasArrange = ReturnType>; export interface CanvasArrangeShortcutsOptions { arrange: { runAction: (action: CanvasArrangeAction) => boolean; }; /** Scenes controller for PageDown / PageUp (next / previous scene). */ scenes?: { next: () => unknown; previous: () => unknown; }; targetElement?: HTMLElement | Window; bindings?: readonly ArrangeShortcutBinding[]; } /** * Attaches the arrange keyboard shortcuts (see `DEFAULT_ARRANGE_SHORTCUTS`). Shortcuts are * ignored while typing in inputs, textareas, contenteditable or ProseMirror editors. * * @returns A cleanup function removing the listener. */ export declare function createCanvasArrangeShortcuts(options: CanvasArrangeShortcutsOptions): () => void; export {};