import type { DiagramDef, GridPos, NodeDef } from '../types.js'; /** Default node diameter as fraction of cell size */ export declare const DEFAULT_NODE_SIZE = 0.45; /** Default cell size when DiagramDef.cellSize is omitted */ export declare const DEFAULT_CELL_SIZE = 256; /** * Resolve a node's diameter fraction: explicit `size` wins, otherwise * `DEFAULT_NODE_SIZE * (sizeScale ?? 1)`. */ export declare function resolveNodeSizeFrac(node: NodeDef): number; /** * Resolved grid metrics in pixel units. * * - `cellSize` is the per-cell pixel size in the SVG coordinate space. * - `width` / `height` are the full canvas dimensions (cellSize × columns * plus 2× padding, similarly for rows). The canvas is rectangular when * cols ≠ rows; the old square-canvas constraint is gone. * - `offsetX` / `offsetY` are where column 0 / row 0 start (= padding). */ export interface GridLayout { /** Canvas width in px (= cellSize * columns + 2 * padding) */ width: number; /** Canvas height in px */ height: number; /** Padding in px on each side */ padding: number; /** Cell size in px */ cellSize: number; /** Pixel offset of column 0's left edge */ offsetX: number; /** Pixel offset of row 0's top edge */ offsetY: number; /** Number of columns */ columns: number; /** Number of rows */ rows: number; } export declare function computeLayout(def: DiagramDef): GridLayout; /** * Convert a (canonical, 0-based) grid position to pixel center * coordinates. Callers pass the already-normalized `GridPos`, not a * raw `GridPosInput`. */ export declare function gridToPixel(layout: GridLayout, pos: GridPos): { x: number; y: number; }; /** Convert a fractional grid coordinate to pixel */ export declare function gridFracToPixel(layout: GridLayout, col: number, row: number): { x: number; y: number; }; /** Get pixel rect for a grid span (top-left corner + width/height) */ export declare function gridSpanToRect(layout: GridLayout, from: GridPos, to: GridPos, inset?: number): { x: number; y: number; width: number; height: number; }; //# sourceMappingURL=grid.d.ts.map