/** * Bind declarative hooks on an inline excaliplant SVG. * @module browser/hooks */ export type State = "base" | "hover" | "click"; export type HookEventDetail = { id: string | undefined; classes: string[]; type: "hover" | "click"; active: boolean; elementId: string; sourceElementId?: string; clickMode?: "button"; }; export type Hook = { id: string | undefined; classes: string[]; hovered: boolean; selected: boolean; pressed: number; button: boolean; state: State; parts: Part[]; representative: Part | null; parent: string | null; clickFromChildren: boolean; }; export type Part = { hook: Hook; element: Element; id: string; variants: Map; link: Element | null; }; /** * Subscribe to an author hook ID (`#id`) or class (`.class`) on a bound SVG. * @param {SVGSVGElement} svg * @param {string} selector A single ID or class selector. * @param {(event: CustomEvent) => void} listener * @returns {() => void} Remove this subscription. * @public */ export declare function onHook(svg: SVGSVGElement, selector: string, listener: (event: CustomEvent) => void): () => void; /** * Enable pointer and keyboard hooks on an inline SVG rendered with * `{ interactive: true }`. Each interaction dispatches a bubbling * `excaliplant:hook` CustomEvent with a {@link HookEventDetail} payload. * Toggle selection and button presses take visual precedence over hover. * A click forwarded to an enclosing hook includes the original primitive's * ID as `sourceElementId`. * * @param {SVGSVGElement} svg * @returns {() => void} Remove the listeners and restore the default visuals. * @public */ export declare function bindHooks(svg: SVGSVGElement): () => void;