import { type NodeRectOptions } from '@pixerate/editor/canvas'; import type { CanvasNode } from './types.js'; export interface CreateCanvasMeasureOptions { getNodes: () => TNode[]; /** Ids measured from (default: nodes with `selected: true`). */ getSelectedIds?: () => string[]; /** Turns measuring off (default `true`). Read reactively. */ enabled?: boolean | (() => boolean); /** Measure only while Alt / Option is held (default `true`); `false` always measures. */ requireModifier?: boolean; rectOptions?: NodeRectOptions; } /** * Headless Svelte 5 rune for Alt-hover distance measuring: hold Alt / Option and hover a * node to see red distance lines with labels from the selection to it (or to the selection's * parent when hovering the selection or empty space). * * Wire it with `$effect(() => measure.listen())`, `onnodepointerenter={measure.onnodepointerenter}` * and `onnodepointerleave={measure.onnodepointerleave}` on ``, and render * `measure.guides` with `` (concatenate with `arrange.guides` to share one). */ export declare function createCanvasMeasure(options: CreateCanvasMeasureOptions): { /** Measuring lines (flow coordinates) for ``. */ readonly guides: import("@pixerate/editor/canvas").MeasureGuide[]; /** The box measured to (outline it), or `null`. */ readonly target: import("@pixerate/editor/canvas").Rect | null; /** Whether measuring is showing. */ readonly active: boolean; readonly hoveredId: string | null; setHovered(id: string | null): void; /** Sets the modifier state by hand (e.g. from a toolbar toggle). */ setModifier(held: boolean): void; onnodepointerenter: ({ node, event }: { node: { id: string; }; event?: { altKey?: boolean; }; }) => void; onnodepointerleave: ({ node }: { node: { id: string; }; }) => void; /** * Tracks the Alt key on `target` (default `window`) and resets it when the window * loses focus. Returns a cleanup function. */ listen(target?: HTMLElement | Window | null): () => void; }; export type CanvasMeasure = ReturnType;