import { PathEl } from '../dom/index'; /** The 2D context surface the target drives — structural, so a real * CanvasRenderingContext2D, an OffscreenCanvasRenderingContext2D or a test * fake all satisfy it. Only what canvasTarget actually touches. */ export interface Canvas2DContext { canvas: { width: number; height: number; }; lineWidth: number; lineCap: string; lineJoin: string; strokeStyle: string | object; setTransform: (a: number, b: number, c: number, d: number, e: number, f: number) => void; clearRect: (x: number, y: number, w: number, h: number) => void; stroke: (path: object) => void; } /** Anything that can hand out a 2D context (an HTMLCanvasElement, an * OffscreenCanvas, or a fake in tests). */ export interface CanvasSurface { getContext: (contextId: '2d') => Canvas2DContext | null; } export interface CanvasTargetOptions { /** Grid the icon's coordinates live on (Lucide/Iconify default: "0 0 24 24"). * Used to map the geometry onto the backing store. */ viewBox?: string; /** Stroke width in grid units (Lucide's default is 2). */ strokeWidth?: number; /** Stroke color. Defaults to the canvas' computed CSS color when it is a * styled element; otherwise the context's current `strokeStyle` stands. */ color?: string; /** Clear the canvas before each frame. Turn off for manual compositing or * trails — every frame then draws on top of the last. Default true. */ clear?: boolean; /** Called after every drawn frame — the texture consumer's dirty signal * (e.g. re-upload the canvas with `texImage2D`, or blit it into a scene). */ onWrite?: () => void; } /** Adapts a canvas (or its 2D context) into a `PathEl` whose writes stroke * the morph's geometry onto the canvas, so * `createMorph(canvasTarget(canvas), icon)` animates pixels instead of an * inline ``. */ export declare function canvasTarget(surface: CanvasSurface | Canvas2DContext, opts?: CanvasTargetOptions): PathEl;