import { type CanvasDrawControllerOptions, type FreehandStroke, type FreehandStrokeStyle, type FreehandTool } from '@pixerate/editor/canvas'; import type { CanvasNode } from './types.js'; type CoreOptions = CanvasDrawControllerOptions; export interface CreateCanvasDrawOptions extends Omit { getNodes: () => TNode[]; setNodes: (nodes: TNode[]) => void; onToolChange?: (tool: FreehandTool) => void; onStyleChange?: (style: FreehandStrokeStyle) => void; onActiveStrokeChange?: (stroke: FreehandStroke | null) => void; } /** * Headless Svelte 5 rune managing freehand drawing tools (pen, highlighter, eraser) on a canvas. */ export declare function createCanvasDraw(options: CreateCanvasDrawOptions): { readonly tool: FreehandTool; setTool: (tool: FreehandTool) => void; readonly style: FreehandStrokeStyle; setStyle: (style: Partial) => void; readonly activeStroke: FreehandStroke | null; readonly isDrawing: boolean; startStroke: (point: import("@pixerate/editor/canvas").Point, pen?: import("@pixerate/editor/canvas").FreehandPenSample) => void; continueStroke: (point: import("@pixerate/editor/canvas").Point, pen?: import("@pixerate/editor/canvas").FreehandPenSample) => void; endStroke: () => any; cancelStroke: () => void; eraseAt: (point: import("@pixerate/editor/canvas").Point, radius?: number) => any[]; /** Draws a whole stroke at once (agents, code); validates the brush first. One undo step. */ drawStroke: (input: import("@pixerate/editor/canvas").DrawStrokeInput) => Promise>; /** A node's box in canvas coordinates (lets gesture commands such as `canvas.circle` take `{ nodeId }`). */ nodeBounds: (id: string) => { x: number; y: number; width: number; height: number; } | undefined; /** The dry paint presets `style.brush` accepts (loads the paint engine). */ listBrushes: () => Promise; /** * Picks a brush (`null`: plain pen) with its size, and its default colour unless `keepColour`. * Resolves to the preset; rejects for a brush the canvas can't paint. */ selectBrush: (id: string | null, choice?: { keepColour?: boolean; }) => Promise; readonly colorScheme: "light" | "dark"; /** * Sets the colour scheme that picks the side of a brush's light / dark default colour; a * stroke colour taken from one (`selectBrush`) follows. */ setColorScheme(scheme: "light" | "dark"): void; /** "Keep my colour": choosing a brush keeps the stroke colour. */ readonly colorLocked: boolean; /** Locks the stroke colour ("Keep my colour"): `selectBrush` then keeps it. */ setColorLocked: (locked: boolean) => void; /** What the brush picker is set to (brush, colour, scheme, lock), read now; `canvas.selectBrush` returns it. */ brushSettings: () => import("@pixerate/editor/canvas").CanvasBrushChoice; }; export type CanvasDraw = ReturnType>; export {};