/** * Frame resolution — collapses a frame-tagged DiagramDef into a flat, * frame-less DiagramDef for a specific frame number. * * Frames are *tags*, not timesteps. Given: * * icon :user @A1 tabler/user "User" * icon [2] :user @A1 tabler/user "User login" # overrides label at f=2 * icon [2] :new @B1 tabler/user "Newcomer" # only exists at f=2 * icon [3-5] :user @A1 tabler/filled/user "Session" # overrides icon + label f=3..5 * * resolveFrame(def, 2) yields: * * - :user with label "User login" (base + f=2 override, later wins) * - :new at B1 with label "Newcomer" * * resolveFrame(def, 1) yields just the base :user; :new is absent. * * Matching rules: * - `frames === undefined` → always matches (base declaration) * - `frames` as number → single frame * - `frames` as array → each item is a single frame or `[min,max]` range * - Ranges are inclusive; `max` may be `Infinity` (gg's `[N-]`) * * Id merge (nodes + connectors): declarations sharing an id within the * matched set are deep-merged in declaration order — later wins per * field. Anonymous declarations (notes, regions, anonymous icons / * connectors) are kept as distinct entries. * * `doc [N] { … }` blocks arrive as `def.frameOverrides`; resolveFrame * deep-merges each matching override's settings onto the base * scalars / theme. * * Pure: the input def is not mutated. */ import type { DiagramDef, FrameSpec, FrameRange } from './types.js'; /** * Collapse any user-facing `FrameSpec` into an array of `[min, max]` * ranges. Returns `undefined` when `spec` is `undefined` (which means * "always matches"). Throws on malformed input (negative range, etc.). */ export declare function normalizeFrameSpec(spec: FrameSpec | undefined): FrameRange[] | undefined; /** Does `spec` include frame number `n`? `undefined` spec matches all frames. */ export declare function frameMatches(spec: FrameSpec | undefined, n: number): boolean; /** * Parse the contents of a `.gg` frame-spec bracket into canonical form. * * Accepted inputs (just the inside, already stripped of `[` / `]`): * "2" → 2 * "2, 3" → [2, 3] * "2-5" → [[2, 5]] * "2, 3-5, 7" → [2, [3,5], 7] * "5-" → [[5, Infinity]] * * Returns `{ spec }` on success or `{ error }` with a human-readable message. */ export declare function parseGgFrameSpec(body: string): { spec?: FrameSpec; error?: string; }; /** * Materialise the DiagramDef for a single frame number. Objects * tagged with a non-matching frame spec are dropped; matching objects * with the same id are merged. */ export declare function resolveFrame(def: DiagramDef, frame: number): DiagramDef; /** * Does this def use frames anywhere? Useful for skipping resolveFrame * entirely on diagrams that never opted in. */ export declare function hasFrames(def: DiagramDef): boolean; //# sourceMappingURL=frame.d.ts.map