/** * Renderer-agnostic, side-effect-free drawing primitives for `lr-graph`'s `renderer="canvas"` * scale path -- a plain 2D-canvas replacement for the per-node/per-link SVG DOM. Every value here * is already resolved (colors, fonts, world-space positions) by the caller; nothing in this module * touches `getComputedStyle()`, custom elements, or Lit -- it's a pure function library over a * `CanvasRenderingContext2D`, kept independent of `graph.class.ts` so it stays trivially testable * against a bare detached ``. */ export interface CanvasCamera{k:number;x:number;y:number;}interface CanvasHull{d:string;fill:string;}interface CanvasLink{x1:number;y1:number;x2:number;y2:number;color:string;width:number;dash?:readonly number[];directed?:boolean;selected?:boolean;dimmed?:boolean;}interface CanvasEdgeLabel{x:number;y:number;text:string;}interface CanvasNode{x:number;y:number;r:number;shape:'circle'|'square'|'diamond';fill:string;selected?:boolean;dimmed?:boolean;}interface CanvasNodeLabel{x:number;y:number;text:string;}interface CanvasRing{x:number;y:number;r:number;}interface CanvasFocusLink{x1:number;y1:number;x2:number;y2:number;width:number;}interface CanvasFocusHull{d:string;} /** A "+" expand badge to draw at a node's diagonally-upper-right edge -- `x`/`y`/`r` are the * owning node's own world-space center and radius, mirroring `graph.class.ts`'s SVG * `[part="expand-indicator"]` `` placement so the badge lands at * the identical offset in either renderer. */ interface CanvasExpandIndicator{x:number;y:number;r:number;}export interface CanvasScene{hulls:CanvasHull[];links:CanvasLink[];edgeLabels:CanvasEdgeLabel[];nodes:CanvasNode[];nodeLabels:CanvasNodeLabel[]; /** Optional -- absent/`undefined` (an older caller that predates the "+" badge, or any of this * module's own test-only scene literals) draws zero badges, the same backward-compatible * default `hullOpacity` already follows. */ expandIndicators?:CanvasExpandIndicator[];focusHalo?:CanvasRing;keyboardFocusRing?:CanvasRing;keyboardFocusLink?:CanvasFocusLink;keyboardFocusHull?:CanvasFocusHull;showNodeLabels:boolean;haloColor:string;selectedColor:string;dimmedOpacity?:number; /** Hull fill+stroke opacity -- resolved from `--lr-graph-hull-opacity` by the caller (same * finite/clamp guard as `dimmedOpacity`); falls back to the SVG renderer's own CSS default * (`0.12`) when unset. */ hullOpacity?:number;labelColor:string;labelHaloColor:string; /** `[part="expand-indicator"] circle`'s resolved `fill` (`--lr-color-surface`). Optional -- * only read when `expandIndicators` is non-empty, so a caller with no badges to draw doesn't * need to supply it. */ expandBadgeFill?:string; /** `[part="expand-indicator"] circle`'s resolved `stroke` (`--lr-color-border-strong`); the "+" * cross itself reuses `labelColor` (`--lr-color-text`), matching the SVG `path`'s stroke. * Optional for the same reason as `expandBadgeFill`. */ expandBadgeStroke?:string;font:string;} /** * Draws one full frame: hulls -> links (+arrowheads) -> edge labels (halo then fill) -> nodes * (+selection stroke) -> node labels -> focus halo -> keyboard focus ring. `ctx` is expected to * already have the caller's own DPR scale applied; this function applies `camera` (pan/zoom) on * top via `ctx.transform()`, scoped to a `save()`/`restore()` pair so it never leaks into the * caller's own transform state. */ export declare function drawGraphScene(ctx:CanvasRenderingContext2D,camera:CanvasCamera,scene:CanvasScene):void; /** `0` (`rgb(0,0,0)`, a cleared/transparent canvas's default readback) is reserved for "no hit" -- * every real pick index is offset by +1 so index 0 (the first drawn item) never collides with it. */ export declare function indexToPickColor(index:number):string;export declare function pickColorToIndex(r:number,g:number,b:number):number;export interface PickableHull{d:string;}export interface PickableLink{x1:number;y1:number;x2:number;y2:number;width:number;}export interface PickableNode{x:number;y:number;r:number;shape:CanvasNode['shape'];} /** * Draws the offscreen, same-camera-transform picking canvas: same z-order as `drawGraphScene` * (hulls -> links -> nodes, so overlap resolution matches the visible scene -- later draws * overwrite earlier pixels, giving "topmost wins"), each item filled with its * `indexToPickColor(pickIndex)` (a flat 0-based index across hulls-then-links-then-nodes, the * caller's responsibility to keep in sync with the same ordering it fed to `drawGraphScene`). * Picking geometry is drawn slightly fat (a caller typically pads node radius/link width a couple * of px) for touch/pointer comfort. `imageSmoothingEnabled = false` so only exact color matches * map back to an item -- no anti-aliased edge pixel is ever misread as a different item's color. */ export declare function drawPickingScene(ctx:CanvasRenderingContext2D,camera:CanvasCamera,scene:{hulls:PickableHull[];links:PickableLink[];nodes:PickableNode[];}):void;export{};