import type { CSSProperties } from "react"; import type { ViewPort } from "react-zoomable-ui"; import type { CanvasThemeMode, GraphData } from "./types"; export type JsonInput = string | object; /** Normalize the `json` prop to a string, memoizing per object instance to avoid re-stringifying unchanged references. */ export declare const toJsonText: (json: JsonInput) => string; /** Compose the `className` applied to the canvas wrapper, stripping empty entries. */ export declare const buildCanvasClassName: (showGrid: boolean, userClassName?: string) => string; /** Project theme tokens onto CSS custom properties for the canvas wrapper, merging any caller-provided style on top. */ export declare const buildCanvasStyle: (theme: CanvasThemeMode, userStyle?: CSSProperties) => CSSProperties; /** Discriminated result of parsing JSON text into a graph. */ export type ParseJsonGraphResult = { kind: "ok"; graph: GraphData; syntaxErrorCount: number; } | { kind: "above-limit"; total: number; } | { kind: "error"; error: Error; }; /** Parse a JSON text into a graph, returning a discriminated result instead of throwing or touching React state. */ export declare const parseJsonGraph: (jsonText: string, maxRenderableNodes: number) => ParseJsonGraphResult; /** Build a map from edge id → target node id for O(1) lookups in edge renderers. */ export declare const buildEdgeTargetMap: (edges: GraphData["edges"]) => Map; /** Toggle reaflow's `dragging` class on the canvas div to suppress pointer events during long-press panning. */ export declare const setCanvasDragging: (container: HTMLElement | null, dragging: boolean) => void; /** Derive the graph's on-screen client rect. Measurement cascade: (1) union of each direct child of the reaflow content group's client rect — ground truth for whatever is actually painted; (2) `getBoundingClientRect()` on the content group itself — accurate for most shapes but under-reports curved-edge bulges on some browsers; (3) `getBBox()` projected through the group's `getScreenCTM()` — layout-based, works through `visibility: hidden`; (4) ELK layout box through the svg CTM — last-resort fallback before layout has geometry. The result is inflated by {@link GRAPH_FIT_PADDING_RATIO} on each side. */ export declare const computeGraphClientRect: (container: HTMLElement | null, layoutSize: { width: number; height: number; } | null) => DOMRect | null; /** Fit-to-center the graph inside the viewport using the derived content rect. No-op if the rect can't be computed — the caller is expected to retry on the next render. */ export declare const fitGraphToViewPort: (viewPort: ViewPort | null, container: HTMLElement | null, layoutSize: { width: number; height: number; } | null) => void; /** Center and zoom on the graph's root node with a 100px breathing margin. */ export declare const focusRootNode: (viewPort: ViewPort | null, container: HTMLElement | null) => void; /** Recenter the camera at its current center with a new absolute zoom factor. */ export declare const setViewPortZoom: (viewPort: ViewPort | null, zoomFactor: number) => void; /** Nudge the current zoom factor by `delta` while keeping the center fixed. */ export declare const adjustViewPortZoom: (viewPort: ViewPort | null, delta: number) => void; //# sourceMappingURL=canvasHelpers.d.ts.map