/** * Data-driven shape dispatcher for the drawio SVG preview (GH-481). * * Pure (no React, no DOM): given a cell's parsed style + absolute box, returns a * list of SVG primitive descriptors plus the text-inset box for the label. The * renderer maps each descriptor to a JSX element. Keyed on `style.shape` and the * boolean style flags drawio emits (`rounded`, `rhombus`, `ellipse`, …); unknown * shapes fall back to a plain rect so rendering is always graceful. */ export type ShapeStyle = Record; export type ShapeBox = { x: number; y: number; width: number; height: number; }; export type ShapeFill = { fill: string; stroke: string; strokeWidth: number; fontColor: string; /** SVG `stroke-dasharray` when the shape border is dashed/dotted. */ dashArray?: string; }; /** A single SVG primitive to draw, in absolute diagram coordinates. */ export type ShapePrimitive = { kind: 'rect'; x: number; y: number; width: number; height: number; rx?: number; } | { kind: 'ellipse'; cx: number; cy: number; rx: number; ry: number; } | { kind: 'polygon'; points: string; } | { kind: 'path'; d: string; } | { kind: 'line'; x1: number; y1: number; x2: number; y2: number; }; export type RenderedShape = { /** Primitives to paint, in order (first = body, later = decorations). */ primitives: ShapePrimitive[]; /** Box the label text should be laid out within (already inset for the shape). */ textBox: ShapeBox; /** When true, the shape rendered as a recognized non-rect figure. */ matched: boolean; }; export declare function resolveFill(style: ShapeStyle): ShapeFill; /** Identify the drawio shape key from style flags + the `shape=` attribute. */ export declare function shapeKind(style: ShapeStyle): string; /** * Dispatch a cell to its shape builder. `rounded=1` rectangles and any unknown * shape fall back to a rect (graceful), with the corner radius applied for rounded. */ export declare function buildShape(style: ShapeStyle, box: ShapeBox): RenderedShape;