import { type CanvasComponentsControllerOptions } from '@pixerate/editor/canvas'; import type { CanvasNode } from './types.js'; type CoreOptions = CanvasComponentsControllerOptions; export interface CreateCanvasComponentsOptions extends Omit { getNodes: () => TNode[]; setNodes: (nodes: TNode[]) => void; /** Called by `goToMainComponent` with the main (e.g. to pan the viewport to it). */ onReveal?: (node: TNode) => void; /** * Sync instances with their mains whenever the nodes `getNodes` reads change (default * `true`; needs `getNodes` to read reactive state). Otherwise call `sync()` after edits. */ autoSync?: boolean; } /** * Headless Svelte 5 rune for Figma-style components and instances on a SvelteFlow canvas. * After node changes it records edits inside instances as overrides and rebuilds the * instances of edited main components (keeping overrides). Its actions (`createComponent`, * `createInstance`, `combineAsVariants`, `detachInstance`, `resetOverrides`, `pushOverrides`, * `swapInstance`, `setInstanceProperties`, `restoreMainComponent`, …) are undoable steps with a * `history`, and each has a `can…` check returning `true` or the reason it can't run. Call * `destroy()` to stop the automatic sync. */ export declare function createCanvasComponents(options: CreateCanvasComponentsOptions): { /** Stops the automatic sync. */ destroy(): void; sync: () => any[]; syncAll(): any[]; createComponent(ids?: Iterable, createOptions?: Omit): import("@pixerate/editor/canvas").CanvasComponentResult; canCreateComponent: (ids?: Iterable) => string | true; combineAsVariants(ids?: Iterable, combineOptions?: { id?: string; name?: string; padding?: number; }): import("@pixerate/editor/canvas").CanvasComponentResult; canCombineAsVariants: (ids?: Iterable) => string | true; createInstance(componentId: string, createOptions?: Omit): import("@pixerate/editor/canvas").CanvasComponentResult; canCreateInstance(componentId?: string, parentId?: string): true | string; detachInstance(ids?: Iterable): import("@pixerate/editor/canvas").CanvasComponentResult; canDetachInstance(ids?: Iterable): true | string; resetOverrides(id?: string, group?: string): import("@pixerate/editor/canvas").CanvasComponentResult; canResetOverrides(id?: string): true | string; pushOverrides(id?: string): import("@pixerate/editor/canvas").CanvasComponentResult; canPushOverrides(id?: string): true | string; swapInstance(componentId: string, ids?: Iterable, swapOptions?: { keepTextOverridesOnly?: boolean; }): import("@pixerate/editor/canvas").CanvasComponentResult; canSwapInstance(componentId?: string, ids?: Iterable): true | string; setInstanceProperties(properties: Record, ids?: Iterable): import("@pixerate/editor/canvas").CanvasComponentResult; canSetInstanceProperties(ids?: Iterable): true | string; restoreMainComponent(id?: string): import("@pixerate/editor/canvas").CanvasComponentResult; canRestoreMainComponent(id?: string): true | string; setComponentProperty(componentId: string, name: string, def: import("@pixerate/editor/canvas").CanvasComponentPropertyDef | null, propertyOptions?: { newName?: string; }): import("@pixerate/editor/canvas").CanvasComponentResult; addVariant(setId?: string, variantOptions?: Omit): import("@pixerate/editor/canvas").CanvasComponentResult; canAddVariant(setId?: string, variantOptions?: Omit): true | string; removeVariant(variantId?: string): import("@pixerate/editor/canvas").CanvasComponentResult; canRemoveVariant(variantId?: string): true | string; setVariantProperties(values: Record, variantId?: string, variantOptions?: { defaultValue?: string; }): import("@pixerate/editor/canvas").CanvasComponentResult; canSetVariantProperties(values?: Record, variantId?: string): true | string; renameVariantProperty(name: string, newName: string, setId?: string): import("@pixerate/editor/canvas").CanvasComponentResult; canRenameVariantProperty(name?: string, newName?: string, setId?: string): true | string; renameVariantValue(property: string, value: string, newValue: string, setId?: string): import("@pixerate/editor/canvas").CanvasComponentResult; canRenameVariantValue(property?: string, value?: string, newValue?: string, setId?: string): true | string; bindComponentProperty(layerId: string, field: import("@pixerate/editor/canvas").CanvasComponentPropertyField, name: string | null): import("@pixerate/editor/canvas").CanvasComponentResult; goToMainComponent(id?: string): string | undefined; canGoToMainComponent(id?: string): true | string; list: () => { components: import("@pixerate/editor/canvas").CanvasComponentInfo[]; sets: import("@pixerate/editor/canvas").CanvasComponentSetInfo[]; }; inspect: (id?: string) => import("@pixerate/editor/canvas").CanvasInstanceInfo | undefined; rootInstanceOf: (id: string) => string | undefined; }; export type CanvasComponents = ReturnType; export {};