/** * ECMA-376 ST_ShapeType preset geometry definitions table. * * Each entry encodes the canonical `presetShapeDefinitions.xml` data shipped by * Microsoft as part of the DrawingML reference implementation * (ISO/IEC 29500-1 §20.1.10.55 / §20.1.9 series): the default adjustment list * (`avLst`), the ordered guide list (`gdLst`), the text rectangle (`rect`), and * the path commands (`pathLst`) — all expressed using OOXML guide-formula * tokens, ready to be evaluated by `guide-formula-eval`. * * Naming note: the existing barrel already exports a `PresetShapeDefinition` * type (shape-picker metadata) and a `PRESET_SHAPE_DEFINITIONS` constant. To * avoid colliding with those public symbols, this module exports its analogues * as `PresetShapeGeometryDefinition` / `PRESET_SHAPE_GEOMETRY_TABLE`. * * # Adding a new preset * * 1. Open `presetShapeDefinitions.xml` (Microsoft Open Specifications) and * locate the `` block. * 2. Copy the `avLst` defaults into `avLst` here (each `a:gd` `name`/`val`). * 3. Copy each `a:gd` from `gdLst` into the `gdLst` array verbatim — the * `formula` field is the entire `@_fmla` string (operator first, operands * after) and `args` is the formula split by whitespace minus the operator. * Both are stored to keep the data introspectable; the evaluator uses the * `formula` string directly via `parseFormula`. * 4. Copy `` attributes into the `rect` field as raw token strings * (e.g. `'l'`, `'t'`, `'r'`, `'b'`). * 5. Copy each `a:path` into a `pathLst` entry, translating its child commands * into the `commands` discriminated union. All coordinate / radius / angle * arguments are raw token strings — they will be resolved against the guide * context by the evaluator. * * Only 30 high-impact presets are populated for the first cut. Additional * presets are tracked as future work; until they ship, the legacy * polygon-based clip-path table in `preset-shape-paths.ts` remains the * fallback for unknown names. */ /** * A single command inside a preset path. Coordinates / radii / angles are * stored as raw OOXML guide tokens (numeric literal strings or guide names) * and resolved at evaluation time. */ export type PresetPathCommand = { kind: 'moveTo'; x: string; y: string; } | { kind: 'lnTo'; x: string; y: string; } | { kind: 'arcTo'; wR: string; hR: string; stAng: string; swAng: string; } | { kind: 'quadBezTo'; x1: string; y1: string; x2: string; y2: string; } | { kind: 'cubicBezTo'; x1: string; y1: string; x2: string; y2: string; x3: string; y3: string; } | { kind: 'close'; }; /** A single sub-path, mirroring `` in OOXML. */ export interface PresetPath { /** Coordinate-space width (`@_w`); defaults to the shape width if absent. */ w?: number; /** Coordinate-space height (`@_h`); defaults to the shape height if absent. */ h?: number; /** `@_fill` attribute (`'none' | 'norm' | 'lighten' | ...`). */ fill?: string; /** `@_stroke` attribute. */ stroke?: boolean; /** `@_extrusionOk` attribute. */ extrusionOk?: boolean; /** Ordered command list. */ commands: PresetPathCommand[]; } /** A complete preset geometry (`` payload). */ export interface PresetShapeGeometryDefinition { /** ECMA-376 ST_ShapeType name, e.g. `"roundRect"`, `"blockArc"`. */ name: string; /** `avLst` defaults, e.g. `{ adj1: 16667 }`. */ avLst?: Record; /** `gdLst` formula list (ordered). */ gdLst?: Array<{ name: string; formula: string; args: string[]; }>; /** Text-bounds rectangle expressed as guide-formula tokens. */ rect?: { l: string; t: string; r: string; b: string; }; /** `pathLst` — at least one path. */ pathLst: PresetPath[]; } /** * Master table of populated preset geometries. Keyed by ECMA-376 ST_ShapeType * name (camelCase). Lookups are case-sensitive; callers should normalise * unknown casings (e.g. `'roundrect'` → `'roundRect'`) before consulting it. * * Inline definitions for ~30 shapes live above. Additional batches authored * by parallel agents are imported from sibling files and spread last so they * cannot accidentally shadow the inline canonical shapes. */ export declare const PRESET_SHAPE_GEOMETRY_TABLE: Record; //# sourceMappingURL=preset-shape-definitions-table.d.ts.map