import type { ScreenBox } from "./types.js"; /** Placement of an overlay relative to its anchor element's bounding box. */ export interface OverlayPosition { /** Distance (px) of the overlay's top edge below the element's top edge. */ top?: number; /** Distance (px) of the overlay's bottom edge above the element's bottom edge. */ bottom?: number; /** Distance (px) of the overlay's left edge right of the element's left edge. */ left?: number; /** Distance (px) of the overlay's right edge left of the element's right edge. */ right?: number; } /** Options for {@link OverlayManager.add}. */ export interface OverlayOptions { /** Where to anchor the overlay relative to the element. */ position: OverlayPosition; /** Overlay content — an HTML string or a pre-built element. */ html: string | HTMLElement; /** Zoom range in which the overlay is visible. */ show?: { minZoom?: number; maxZoom?: number; }; /** * Whether the overlay scales with zoom. `true` (default) scales 1:1 with the * diagram; `false` keeps a constant pixel size; an object clamps the scale. */ scale?: boolean | { min?: number; max?: number; }; /** Optional tag for bulk queries and removal. */ type?: string; } /** A registered overlay. */ export interface Overlay { readonly id: string; readonly element: string; readonly type?: string; readonly node: HTMLElement; } /** Filter for {@link OverlayManager.get} / {@link OverlayManager.remove}. */ export interface OverlayFilter { element?: string; type?: string; } /** The host hooks an {@link OverlayManager} needs from a canvas or editor. */ export interface OverlayHost { /** The (position: relative) host element to mount the overlay layer into. */ readonly hostEl: HTMLElement; /** Current zoom scale. */ getScale(): number; /** Element bounding box in screen pixels relative to the host, or `null`. */ getBBox(id: string): ScreenBox | null; /** Subscribes to viewport changes; returns an unsubscribe function. */ onViewportChange(cb: () => void): () => void; } /** * Manages HTML overlays anchored to diagram elements. Overlays live in a * dedicated absolutely-positioned layer above the SVG and are repositioned on * every viewport change from the element's screen bounding box. */ export declare class OverlayManager { private readonly _host; private readonly _layer; private readonly _overlays; private readonly _unsub; private _counter; constructor(_host: OverlayHost); /** Adds an overlay anchored to `elementId`. Returns its overlay id. */ add(elementId: string, opts: OverlayOptions): string; /** Removes an overlay by id, or all overlays matching a filter. */ remove(idOrFilter: string | OverlayFilter): void; /** Returns overlays matching a filter (all overlays when omitted). */ get(filter?: OverlayFilter): Overlay[]; /** Removes every overlay. */ clear(): void; /** Repositions all overlays from their elements' current bounding boxes. */ reposition(): void; /** Removes the overlay layer and unsubscribes from viewport changes. */ destroy(): void; private _repositionAll; private _position; private _scaleFactor; } //# sourceMappingURL=overlays.d.ts.map