/** * `data-anno-category` is a free-form string supplied by the SVG. * * The application never branches on category values — it treats every * annotation the same way. Categories are kept around because they're * useful for grouping and future filtering, but no code path here may * rely on a closed set. */ export type BoneCategory = string /** * Logical annotation as parsed from an SVG. All DOM elements sharing the * same `data-anno-id` are grouped into one Bone. `id` is the persisted * identifier surfaced in the report JSON contract * (`ObservationZone.boneId`); keep it stable across SVG renames. */ export interface Bone { id: string /** French label from data-anno-name-fr — may be empty for opens-detail-only triggers */ fr: string /** English label from data-anno-name-en — may be empty */ en: string /** Raw value from data-anno-category — opaque to the application */ category: BoneCategory /** Detail popup id from data-anno-opens-detail, if present */ opensDetail?: string /** * Free-form behavior hint from `data-anno-special`. * * Known values consumed by the application: * - `vertebral-precision`: clicking the zone opens VertebraPicker. * * Opaque to the parser; new values are accepted without code changes. */ special?: string /** All DOM elements carrying this annotation (used for colorization) */ els: Element[] } /** Visual state applied to SVG elements for multi-observation colorization. */ export type BoneState = 'current' | 'linked' | 'multi' | 'default' /** Error thrown when SVG violates the convention. */ export class SvgConventionError extends Error { constructor( message: string, public readonly boneId: string, public readonly missingAttribute: string, ) { super(message) this.name = 'SvgConventionError' } }