react-advanced-odontogram 2.5.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -279,6 +279,25 @@ export declare function CariesCard(): JSX_2.Element;
279
279
  * `DiagnosisKey`/`DX_CODES`. */
280
280
  declare type CaseConditionKey = "jawSizeAnomaly" | "jawBaseAnomaly" | "archRelationAnomaly" | "toothPositionAnomaly" | "malocclusionUnspecified" | "dentofacialFunctional" | "tmjDisorder" | "odontogenicCyst" | "nonOdontogenicCyst" | "jawCystOther" | "oralCystOther" | "salivaryAtrophy" | "salivaryHypertrophy" | "sialadenitis" | "salivaryAbscess" | "salivaryFistula" | "sialolithiasis" | "mucocele" | "salivarySecretion" | "recurrentAphthae" | "stomatitisOther" | "oralCellulitis" | "oralMucositis" | "anodontia" | "hereditaryStructure" | "lipDisease" | "leukoplakia" | "mucosalLesionOther";
281
281
 
282
+ /**
283
+ * The "Case / regional diagnoses" pop-up. Moved out of the perio-status sidebar
284
+ * (`PerioSidebar`) into its own dialog, opened from the "Diagnoses" button next
285
+ * to the Odontogram / Periodontal-status view toggle. Mirrors `CreditsModal`'s
286
+ * dialog contract: `role="dialog"` + `aria-modal`, Escape closes, backdrop click
287
+ * closes, focus is trapped while open and returned to the opener on close.
288
+ *
289
+ * Owns its own `caseConds` state + a single `onStateChange` subscription (like
290
+ * `PerioSidebar` did), so it stays live while open. Rows are code-first and
291
+ * code-sorted (`getCaseConditions` sorts by ICD-10); the add-picker options are
292
+ * code-first (`{icd10} {label}`) and code-sorted too.
293
+ */
294
+ export declare function CaseDiagnosesModal({ open, t, onClose, }: {
295
+ open: boolean;
296
+ /** Translation function — the `t` from `useI18n`. */
297
+ t: (key: string, params?: Record<string, string | number>) => string;
298
+ onClose: () => void;
299
+ }): JSX_2.Element;
300
+
282
301
  declare type ChartMode = "status" | "plan";
283
302
 
284
303
  /** Remove the stored entry for the active (or default) key. */
@@ -313,8 +332,30 @@ declare interface CodingPack {
313
332
  code: string;
314
333
  display: string;
315
334
  }>>;
335
+ /** DX-8: translation-pack displays keyed by a REFINED WHO code (e.g. `K02.1`)
336
+ * that `refineWho` may emit instead of the key's flat code. Falls back to
337
+ * `displays[key]` when absent. */
338
+ refinedDisplays?: Record<string, string>;
316
339
  }
317
340
 
341
+ /**
342
+ * Compare two EXPORTED exams of the same mouth — `before` as charted then,
343
+ * `after` as charted now.
344
+ *
345
+ * `getPlanChanges()` diffs the two charts of ONE exam (what the clinician plans
346
+ * to change); this diffs one chart across TWO exams (what actually changed
347
+ * since last time), which is the question a recall appointment asks. A host
348
+ * keeping a timeline of exports holds both payloads; nothing else is needed.
349
+ *
350
+ * Pure and read-only: it never touches the live charts, so it can be called
351
+ * while the clinician is working, and the active chart is irrelevant to the
352
+ * result. Each payload is hydrated under ITS OWN version rule (the same one
353
+ * `importStatus()` applies), so an old export compares faithfully. Tolerant of
354
+ * a malformed or empty payload — an unreadable tooth compares as the clinical
355
+ * default rather than throwing.
356
+ */
357
+ export declare function compareExams(before: Any, after: Any): ExamComparison;
358
+
318
359
  /**
319
360
  * Tear down the odontogram engine: clear all DOM elements built by the engine,
320
361
  * unsubscribe from i18n changes, and reset internal state. After this call,
@@ -338,6 +379,23 @@ export declare function disablePersistence(): void;
338
379
  */
339
380
  export declare function enablePersistence(options?: PersistenceOptions): void;
340
381
 
382
+ /** What {@link compareExams} answers: the same mouth, charted twice. */
383
+ export declare interface ExamComparison {
384
+ /** Axis-level changes, exactly the shape and labels `getPlanChanges()` uses —
385
+ * `from` is the earlier exam, `to` the later one. */
386
+ changes: PlanChange[];
387
+ /** The periodontal measurements, where the change is numeric rather than a
388
+ * label: per-site probing depth and attachment level, and what moved by a
389
+ * clinically meaningful amount. */
390
+ perio: PerioExamComparison;
391
+ /** The 2017 classification of each exam (derived, with the clinician's own
392
+ * per-axis overrides applied), so a stage or grade that moved is visible. */
393
+ classification: {
394
+ from: FinalPerioClassification;
395
+ to: FinalPerioClassification;
396
+ };
397
+ }
398
+
341
399
  /**
342
400
  * Export the current odontogram as an HL7 FHIR R4 collection Bundle (JSON).
343
401
  * @param options - Optional subject reference (e.g. "Patient/123"); when
@@ -355,7 +413,7 @@ export declare function exportImage(format?: "png" | "jpg"): Promise<void>;
355
413
  /**
356
414
  * Assemble a printable PDF report (jsPDF-native — vector text + raster chart
357
415
  * PNGs, no svg2pdf.js). Gathers all `data` (SVG→PNG
358
- * rasterization via {@link rasterizeSvgToPng}, summary/classification text,
416
+ * rasterization via `rasterizeSvgToPng`, summary/classification text,
359
417
  * `hasAnyPerioData()`), drives the export-progress overlay, then hands off
360
418
  * to the PURE `assemblePdf()` (`src/perioPdf.ts`), which decides section
361
419
  * layout from `opts`/`data` alone.
@@ -370,7 +428,7 @@ export declare function exportImage(format?: "png" | "jpg"): Promise<void>;
370
428
  export declare function exportPdf(opts: PdfExportOptions): Promise<void>;
371
429
 
372
430
  /** Export the full perio chart as PNG/JPG (SVG → canvas @2×, via the
373
- * shared {@link rasterizeSvgToCanvas} raster core). */
431
+ * shared `rasterizeSvgToCanvas` raster core). */
374
432
  export declare function exportPerioImage(format?: "png" | "jpg"): Promise<void>;
375
433
 
376
434
  /** Export the full perio chart as a standalone vector SVG file. */
@@ -409,11 +467,24 @@ export declare type FillingComplexity = "complex" | "simple";
409
467
 
410
468
  export declare function FillingsCard(): JSX_2.Element;
411
469
 
470
+ /** The final (override ?? derived) classification for one axis each — see
471
+ * `getPerioClassification()` in odontogram.ts for the live-state
472
+ * equivalent this mirrors. */
473
+ /** The final periodontal classification of a serialized payload — derived,
474
+ * then overridden per axis by whatever the clinician pinned in `case`.
475
+ * Exported because the exam comparison reports it for both exams. */
476
+ declare interface FinalPerioClassification {
477
+ diagnosis: PerioDiagnosis;
478
+ stage: PerioStage;
479
+ grade: PerioGrade;
480
+ extent: PerioExtent;
481
+ }
482
+
412
483
  /** Formats a tooth number for display using the active numbering system AND
413
- * the milktooth display-remap ({@link getDisplayedToothNumber}) — the exact
484
+ * the milktooth display-remap (`getDisplayedToothNumber`) — the exact
414
485
  * same formatting {@link getOdontogramSummary} uses for every tooth number
415
486
  * it prints (permanent/missing lists, per-section entries, implants). Exported
416
- * so the "What changes" box in App.tsx can label a {@link PlanChange.toothNo}
487
+ * so the "What changes" box in App.tsx can label a `PlanChange.toothNo`
417
488
  * identically, without duplicating the numbering/milktooth logic. */
418
489
  export declare function formatToothLabel(toothNo: number): string;
419
490
 
@@ -475,6 +546,13 @@ export declare function getIcdasEnabled(): boolean;
475
546
  */
476
547
  export declare function getNotesEnabled(): boolean;
477
548
 
549
+ /**
550
+ * Switch the displayed tooth numbering system and re-render all tooth labels.
551
+ * @param system - The target {@link NumberingSystem}.
552
+ */
553
+ /** The numbering system currently displayed. Defaults to `"FDI"`. */
554
+ export declare function getNumberingSystem(): NumberingSystem;
555
+
478
556
  export declare function getOdontogramSummary(): OdontogramSummary;
479
557
 
480
558
  export declare function getPdfSettings(): PdfSettings;
@@ -490,7 +568,7 @@ export declare function getPerioViewMode(): PerioViewMode;
490
568
 
491
569
  /**
492
570
  * Compare the "status" chart against the "plan" chart, tooth by tooth and
493
- * axis by axis (see {@link DIFF_AXES}), and report every axis whose label
571
+ * axis by axis (see `DIFF_AXES`), and report every axis whose label
494
572
  * differs. Pure and read-only: never mutates either chart, never touches the
495
573
  * DOM, never renders — a `parity.test.ts`-safe addition.
496
574
  *
@@ -533,8 +611,33 @@ export declare function getReadOnly(): boolean;
533
611
 
534
612
  export declare function getRootCariesMode(): RootCariesMode;
535
613
 
614
+ /** Current tooth-number size. Defaults to `"normal"`. */
615
+ export declare function getScreenToothNumberSize(): ScreenToothNumberSize;
616
+
617
+ /** Current inter-tooth spacing. Defaults to `"normal"`. */
618
+ export declare function getScreenToothSpacing(): ScreenToothSpacing;
619
+
536
620
  export declare function getSecondaryCariesMode(): SecondaryCariesMode;
537
621
 
622
+ /**
623
+ * The currently selected teeth, as FDI numbers, in the order they were added to
624
+ * the selection. Empty when nothing is selected.
625
+ *
626
+ * Returns a fresh array — changing it never touches the selection. Every
627
+ * selection change fires {@link onStateChange}, so a host can follow the
628
+ * selection by re-reading this in its listener (to price a treatment for the
629
+ * selected teeth, for example).
630
+ *
631
+ * Contributed in a downstream fork (sofia-cluadette/React-Advanced-Odontogram).
632
+ */
633
+ export declare function getSelectedTeeth(): number[];
634
+
635
+ /** Current selection-ring border style. Defaults to `"dashed"`. */
636
+ export declare function getSelectionBorderStyle(): SelectionBorderStyle;
637
+
638
+ /** Current selection-ring colour as `#rrggbb`. Defaults to `"#3b7bff"`. */
639
+ export declare function getSelectionColor(): string;
640
+
538
641
  export declare function getSnomedEnabled(): boolean;
539
642
 
540
643
  /**
@@ -595,12 +698,15 @@ export declare function getSurfaceNotation(): SurfaceNotation;
595
698
  export declare function getToothAnatomy(): ToothAnatomy;
596
699
 
597
700
  /** A tooth's EFFECTIVE coded diagnoses (derived − suppressed + added), reused
598
- * by both the tooltip ({@link getStateSummary}) and the whole-mouth summary
701
+ * by both the tooltip (`getStateSummary`) and the whole-mouth summary
599
702
  * ({@link getOdontogramSummary}). Reads the ACTIVE chart's tooth state (so
600
703
  * it's transparently Status/Plan dual-state aware, like every other per-tooth
601
704
  * getter). A tooth with no state (never touched) has no diagnoses. */
602
705
  export declare function getToothDiagnoses(toothNo: number): ToothDiagnosis[];
603
706
 
707
+ /** Whether the tooth-information panel is shown. Defaults to `true`. */
708
+ export declare function getToothInfoVisible(): boolean;
709
+
604
710
  /**
605
711
  * Get a human-readable summary of all active states for a tooth.
606
712
  * Useful for building custom tooltip or info-panel UIs.
@@ -610,6 +716,9 @@ export declare function getToothDiagnoses(toothNo: number): ToothDiagnosis[];
610
716
  */
611
717
  export declare function getToothStateSummary(toothNo: number): string[];
612
718
 
719
+ /** Templates refused so far (and why). A profile whose artwork is not loaded yet reports when it loads. */
720
+ export declare function getToothTemplateRejections(): readonly TemplateRejection[];
721
+
613
722
  export declare function getWearDetailLevel(): ToothDetailLevel;
614
723
 
615
724
  /** True iff ANY periodontal axis has been charted anywhere in the mouth. Used
@@ -653,6 +762,10 @@ export declare function isPersistenceEnabled(): boolean;
653
762
  * | zh | Chinese (Simplified) |
654
763
  * | ar | Arabic (RTL — UI mirrors, dental/perio charts pinned LTR) |
655
764
  * | fr | French |
765
+ *
766
+ * The strings themselves live one file per language in `./locales/`. Only
767
+ * English is bundled statically; every other language is a separate chunk
768
+ * fetched the first time it is selected (see `./loader.ts`).
656
769
  */
657
770
  declare type Language = "hu" | "en" | "de" | "es" | "it" | "sk" | "pl" | "ru" | "pt-br" | "zh" | "ar" | "fr";
658
771
 
@@ -717,8 +830,14 @@ export declare type OdontogramPlugin = {
717
830
  * Owns all odontogram shell state, effects, and handlers and provides them to
718
831
  * composed surfaces + modals. Renders only the `.odontogram-root` wrapper around
719
832
  * `children` — no extra DOM node.
833
+ *
834
+ * Holds its first render until the requested `language` has loaded: every UI
835
+ * language but English is a lazily fetched chunk, and mounting before it
836
+ * arrives would paint the whole chart in the English fallback and then repaint
837
+ * it — a visible flash of the wrong language on every page load. English (and
838
+ * any language already loaded) renders on the very first pass, as before.
720
839
  */
721
- export declare function OdontogramProvider({ children, language, onLanguageChange, numberingSystem, onNumberingChange, darkMode, onDarkModeChange, themeConfig, plugins, readOnly: readOnlyProp, enableNotes, enableIcdas, pulpDetailLevel, secondaryCariesMode, rootCariesMode, radiographicDepthMode, cariesDepthEnabled, wearDetailLevel, discolorationDetailLevel, surfaceNotation, showStatusCard: showStatusCardProp, showOrthoCard: showOrthoCardProp, fillingComplexity, onFillingComplexityChange, fillingDefectEnabled: fillingDefectEnabledProp, onFillingDefectEnabledChange, fillingMaterialAvailability, onFillingMaterialAvailabilityChange, fissureSealingEnabled: fissureSealingEnabledProp, onFissureSealingEnabledChange, }: OdontogramProviderProps): JSX_2.Element;
840
+ export declare function OdontogramProvider(props: OdontogramProviderProps): JSX_2.Element;
722
841
 
723
842
  /**
724
843
  * Props for {@link OdontogramProvider} — the full former `OdontogramShell`
@@ -750,6 +869,11 @@ declare type OdontogramProviderProps = {
750
869
  * overlays and per-tooth custom state. See {@link OdontogramPlugin}.
751
870
  */
752
871
  plugins?: OdontogramPlugin[];
872
+ /**
873
+ * Tooth drawings (SVG text) that replace the factory ones, per anatomy profile. The markup is vetted and a refused template keeps the
874
+ * factory one; see {@link ToothTemplateOverrides} and `getToothTemplateRejections()`. Omitted (the default): the factory artwork.
875
+ */
876
+ toothTemplates?: ToothTemplateOverrides;
753
877
  /**
754
878
  * When true, disables all interactions (click, touch, keyboard).
755
879
  * Useful for print/report/view modes.
@@ -832,7 +956,7 @@ declare type OdontogramProviderProps = {
832
956
  /**
833
957
  * Filling-complexity level for the Fillings card: `"simple"` (one material
834
958
  * per tooth, no per-surface picker) or `"complex"` (per-surface materials,
835
- * default). Contrast with {@link settings.panels} — this one mirrors the
959
+ * default). Contrast with `settings.panels` — this one mirrors the
836
960
  * `fillingComplexity` engine flag (Settings → Fillings). When provided, the
837
961
  * value overrides the engine/UI default; when omitted, whatever the engine
838
962
  * holds (module default or a prior `setFillingComplexity` call) stays put.
@@ -876,6 +1000,20 @@ declare type OdontogramProviderProps = {
876
1000
  fissureSealingEnabled?: boolean;
877
1001
  /** See {@link onFillingComplexityChange} — the fissure-sealing toggle's counterpart. */
878
1002
  onFissureSealingEnabledChange?: (enabled: boolean) => void;
1003
+ /**
1004
+ * Inter-tooth spacing of the on-screen grid (Settings → Odontogram). Mirrors
1005
+ * the `screenToothSpacing` engine flag; same controlled/standalone contract
1006
+ * as {@link fillingComplexity}.
1007
+ */
1008
+ screenToothSpacing?: ScreenToothSpacing;
1009
+ /** Tooth-number size of the on-screen grid; same contract as {@link screenToothSpacing}. */
1010
+ screenToothNumberSize?: ScreenToothNumberSize;
1011
+ /** Selection-ring colour as `#rrggbb`; same contract as {@link screenToothSpacing}. */
1012
+ selectionColor?: string;
1013
+ /** Selection-ring border style; same contract as {@link screenToothSpacing}. */
1014
+ selectionBorderStyle?: SelectionBorderStyle;
1015
+ /** Whether the tooth-information panel is shown; same contract as {@link screenToothSpacing}. */
1016
+ toothInfo?: boolean;
879
1017
  /** The composed UI (surfaces + shell layout). */
880
1018
  children?: ReactNode;
881
1019
  };
@@ -924,28 +1062,6 @@ export declare type OdontogramSummarySection = {
924
1062
  emptyText: string;
925
1063
  };
926
1064
 
927
- /**
928
- * Theme configuration for the Odontogram component.
929
- *
930
- * Allows host applications to override the default color palette without
931
- * modifying CSS files. All properties are optional — only the provided
932
- * values are overridden; the rest fall back to the built-in defaults.
933
- *
934
- * Colors are applied as CSS custom properties (`--odon-*`) on the
935
- * component root element, so they work regardless of whether the host
936
- * uses Tailwind CSS or plain CSS.
937
- *
938
- * @example
939
- * ```tsx
940
- * const myTheme: OdontogramThemeConfig = {
941
- * colors: {
942
- * accent: '#e74c3c',
943
- * background: '#fafafa',
944
- * },
945
- * };
946
- * <App themeConfig={myTheme} />
947
- * ```
948
- */
949
1065
  export declare type OdontogramThemeConfig = {
950
1066
  colors?: {
951
1067
  /** Primary background. Default: `#f3f6fb` (light) / `#0f172a` (dark). */
@@ -965,6 +1081,135 @@ export declare type OdontogramThemeConfig = {
965
1081
  /** Secondary accent (success, selected states). Default: `#12b981`. */
966
1082
  accent2?: string;
967
1083
  };
1084
+ /**
1085
+ * Tooth-artwork colours.
1086
+ *
1087
+ * The drawings carry their colours as palette tokens with today's colour as
1088
+ * the fallback (`fill: var(--odon-tooth-body, #ebebeb)`), so an omitted
1089
+ * key leaves that surface exactly as drawn. Setting a key recolours that
1090
+ * surface across BOTH anatomy profiles at once, even where the classic and
1091
+ * measured artwork happen to be drawn in different shades.
1092
+ *
1093
+ * This is a curated subset. Every token — including the gradient stops and
1094
+ * the per-material restoration colours — can be set by name through
1095
+ * {@link OdontogramThemeConfig.tokens}.
1096
+ */
1097
+ tooth?: {
1098
+ /** The tooth's own silhouette — crown AND root — and every broken or
1099
+ * prepared variant of it.
1100
+ *
1101
+ * In the `classic` profile this is the whole tooth: those drawings are one
1102
+ * shape, with no inner structure. In `measured` it is the outer shell —
1103
+ * enamel over the crown, cementum over the root — around `dentin` below,
1104
+ * which takes this colour unless it is set. Setting only `body` therefore
1105
+ * looks the same in both profiles. */
1106
+ body?: string;
1107
+ /** The dentin core inside the crown and root (`measured` profile only —
1108
+ * the classic drawings have no enamel/dentin boundary to colour).
1109
+ *
1110
+ * Unset, it follows `body`, so the boundary is invisible until you ask
1111
+ * for it. The occlusal view has no core: nothing of the dentin shows from
1112
+ * above. */
1113
+ dentin?: string;
1114
+ /** Crown and root outline. */
1115
+ outline?: string;
1116
+ /** The width of that outline, as a CSS length in SVG user units
1117
+ * (`"1"`, `"1.4"`, `"0.75"`). Not a colour — it is here because it is
1118
+ * the other half of `outline` above.
1119
+ *
1120
+ * It rides every layer that is the tooth's own silhouette, so the
1121
+ * contour keeps one thickness whatever the tooth is charted as: a
1122
+ * natural or deciduous crown, a root remnant, a prepared crown, a tooth
1123
+ * under the gum, any of the seven fracture states, or the occlusal
1124
+ * projection — whose tiles sit in the same chart grid as the side views
1125
+ * and therefore widen with them. The occlusal grooves are deliberately
1126
+ * not included and stay hairlines.
1127
+ *
1128
+ * Unset, the drawings declare no width at all and stroke at the SVG
1129
+ * initial value of `1`. */
1130
+ outlineWidth?: string;
1131
+ /** Crown sheen (the "beauty" layer). */
1132
+ highlight?: string;
1133
+ /** The deciduous tooth's silhouette. */
1134
+ milktoothBody?: string;
1135
+ /** Deciduous crown sheen. */
1136
+ milktoothHighlight?: string;
1137
+ /** Occlusal cusp field. */
1138
+ cusp?: string;
1139
+ /** Occlusal fissure lines. */
1140
+ groove?: string;
1141
+ /** Healthy pulp chamber. */
1142
+ pulpHealthy?: string;
1143
+ /** Inflamed pulp. */
1144
+ pulpInflamed?: string;
1145
+ /** Gingiva. */
1146
+ gum?: string;
1147
+ /** Alveolar bone. */
1148
+ bone?: string;
1149
+ /** Caries body. */
1150
+ caries?: string;
1151
+ /** Caries outline. */
1152
+ cariesOutline?: string;
1153
+ /** Bruxism wear facet. */
1154
+ wear?: string;
1155
+ /** Calculus deposit. */
1156
+ calculus?: string;
1157
+ /** Restoration outline. */
1158
+ restorationOutline?: string;
1159
+ /** Dark structural outline. */
1160
+ outlineDark?: string;
1161
+ };
1162
+ /**
1163
+ * Any palette token by its full CSS custom-property name, for the surfaces
1164
+ * {@link OdontogramThemeConfig.tooth} does not name — the per-material
1165
+ * restoration colours (`--odon-rest-gold`, `--odon-fill-composite`, …) and
1166
+ * the e.max / metal-ceramic gradient stops.
1167
+ *
1168
+ * Keys must start with `--odon-`; anything else is ignored, so this cannot
1169
+ * be used to set unrelated custom properties on the host's element.
1170
+ *
1171
+ * Not every token is a colour. `--odon-implant-tint` is a **CSS filter**
1172
+ * over the implant fixture as a whole: the drawing's ~65 metal greys encode
1173
+ * a light source, so they are deliberately not themable one by one, and a
1174
+ * filter shifts them together instead of flattening the shading. It is
1175
+ * `none` unless set, and it does not touch the peri-implant bone-loss
1176
+ * overlay, which sits outside the filtered group.
1177
+ *
1178
+ * `--odon-implant-fill` is the **flat** counterpart of that tint, for a
1179
+ * palette that wants one solid colour rather than shaded metal. It is a
1180
+ * colour, and it replaces the fill of every shape in the fixture at once.
1181
+ * Each of those shapes falls back to the grey it is drawn in, so unset it
1182
+ * changes nothing at all — there is no single default to state. The two
1183
+ * compose: the fill flattens the fixture, the filter then shifts it. It
1184
+ * leaves the peri-implant bone-loss overlay alone for the same reason the
1185
+ * tint does, and the occlusal screw-hole rims keep their outline, because
1186
+ * only `fill` is affected.
1187
+ *
1188
+ * @example
1189
+ * { tokens: { "--odon-rest-gold": "#d4af37", "--odon-fill-composite": "#eae0c8" } }
1190
+ * @example
1191
+ * { tokens: { "--odon-implant-tint": "hue-rotate(205deg) saturate(.85)" } }
1192
+ * @example
1193
+ * { tokens: { "--odon-implant-fill": "#8fa6b8" } }
1194
+ */
1195
+ tokens?: Record<string, string>;
1196
+ /**
1197
+ * The tooth-selection highlight.
1198
+ *
1199
+ * Selection is an interaction state, not artwork — it is drawn by the chart
1200
+ * around a tile, not by any tooth drawing — but hosts look for it here when
1201
+ * they are deciding "what colour is everything". It is applied through the
1202
+ * existing session setters (`setSelectionColor` / `setSelectionBorderStyle`),
1203
+ * so it is NOT a CSS custom property and does not appear on the themed
1204
+ * element.
1205
+ *
1206
+ * The dedicated `selectionColor` / `selectionBorderStyle` props on the
1207
+ * provider are the more specific control and win when both are given.
1208
+ */
1209
+ selection?: {
1210
+ color?: string;
1211
+ borderStyle?: SelectionBorderStyle;
1212
+ };
968
1213
  };
969
1214
 
970
1215
  /** A grouped dentition overview: category columns (only non-empty ones) ×
@@ -1036,7 +1281,10 @@ export declare type OdontogramUiContextValue = {
1036
1281
 
1037
1282
  /**
1038
1283
  * Subscribe to odontogram state changes. The callback runs after any tooth
1039
- * state edit, the edentulous toggle, or an import.
1284
+ * state edit, the edentulous toggle, an import, or a change to a session
1285
+ * setting (numbering system, notes, ICDAS, caries/pulp/wear/discoloration
1286
+ * detail, surface notation, fillings, perio display) — so a host that
1287
+ * persists the doctor's preferences can react to the settings modal too.
1040
1288
  *
1041
1289
  * @param cb - Callback invoked on each change.
1042
1290
  * @returns An unsubscribe function.
@@ -1097,9 +1345,12 @@ declare type PdfPerioFontSize = "small" | "normal" | "xlarge";
1097
1345
  declare type PdfPerioLabelPlacement = "center" | "edge";
1098
1346
 
1099
1347
  declare interface PdfSettings {
1100
- /** Placeholder patient name when the case has none (default "John Doe"). */
1348
+ /** Optional placeholder patient name, printed when the case has none. Empty
1349
+ * by default: the report then prints "not specified" (`pdf.field.notSpecified`)
1350
+ * rather than inventing a name. */
1101
1351
  defaultName: string;
1102
- /** Placeholder DOB (ISO `YYYY-MM-DD`) when the case has none. */
1352
+ /** Optional placeholder DOB (ISO `YYYY-MM-DD`), printed when the case has
1353
+ * none. Empty by default, as above. No age is ever derived from it. */
1103
1354
  defaultDob: string;
1104
1355
  /** Show the patient's age (in parentheses) after the DOB. */
1105
1356
  showAge: boolean;
@@ -1192,12 +1443,64 @@ export declare function PerioChart({ open, onClose, inline, }: {
1192
1443
  inline?: boolean;
1193
1444
  }): JSX_2.Element;
1194
1445
 
1446
+ declare type PerioDiagnosis = "health" | "gingivitis" | "periodontitis";
1447
+
1448
+ /** Whole-mouth figures for one exam — the subset of `getPerioSummary()` that
1449
+ * can be derived from a payload alone. */
1450
+ export declare interface PerioExamAggregate {
1451
+ chartedSites: number;
1452
+ bleedingSites: number;
1453
+ /** Bleeding sites ÷ charted sites, as a percentage with one decimal. */
1454
+ bopPercent: number;
1455
+ maxPd: number | null;
1456
+ worstCal: number | null;
1457
+ }
1458
+
1459
+ export declare interface PerioExamComparison {
1460
+ from: PerioExamAggregate;
1461
+ to: PerioExamAggregate;
1462
+ /** Every site whose probing depth or attachment level moved at all, including
1463
+ * sites charted in only one of the two exams. Tooth order is the clinical
1464
+ * `ALL_TEETH` order; sites follow `PERIO_SITES`. */
1465
+ changed: PerioSiteDelta[];
1466
+ /** Sites charted in BOTH exams whose attachment worsened by at least
1467
+ * {@link PROGRESSION_MM} — the clinically meaningful subset of `changed`. */
1468
+ attachmentLoss: PerioSiteDelta[];
1469
+ /** …and improved by at least as much. */
1470
+ attachmentGain: PerioSiteDelta[];
1471
+ /** Sites charted in both whose POCKET deepened by at least {@link PROGRESSION_MM}. */
1472
+ deepened: PerioSiteDelta[];
1473
+ /** Sites charted now but not then, and the other way round. */
1474
+ newlyCharted: number;
1475
+ noLongerCharted: number;
1476
+ }
1477
+
1478
+ declare type PerioExtent = "na" | "localized" | "generalized" | "molar-incisor";
1479
+
1480
+ declare type PerioGrade = "A" | "B" | "C" | "indeterminate";
1481
+
1195
1482
  /** How perio-chart index row labels are rendered. */
1196
1483
  export declare type PerioIndexNameMode = "translated" | "canonical";
1197
1484
 
1198
1485
  /** The 16 toggleable periodontal index rows the Dental Chart can show/hide. */
1199
1486
  export declare type PerioRowId = "plaque" | "bop" | "cal" | "gm" | "pd" | "furcation" | "mobility" | "cej" | "rootConcavity" | "pi" | "gi" | "mpi" | "mbi" | "kg" | "gt" | "miller";
1200
1487
 
1488
+ export declare function PerioSidebar(): JSX_2.Element;
1489
+
1490
+ /** One site, measured in both exams (or in only one of them). */
1491
+ export declare interface PerioSiteDelta {
1492
+ toothNo: number;
1493
+ site: string;
1494
+ /** Probing depth in mm, or `null` when the site was not charted in that exam. */
1495
+ pdFrom: number | null;
1496
+ pdTo: number | null;
1497
+ /** Clinical attachment level (pd + gm) in mm, or `null` when not charted. */
1498
+ calFrom: number | null;
1499
+ calTo: number | null;
1500
+ }
1501
+
1502
+ declare type PerioStage = "na" | "I" | "II" | "III" | "IV" | "indeterminate";
1503
+
1201
1504
  export declare type PerioViewMode = "toggle" | "popup";
1202
1505
 
1203
1506
  export declare type PersistenceOptions = {
@@ -1227,6 +1530,15 @@ declare type PlanChange = {
1227
1530
  */
1228
1531
  export declare type PluginLayer = "base" | "restoration" | "overlay";
1229
1532
 
1533
+ /**
1534
+ * Millimetres of change that count as real movement rather than measurement
1535
+ * noise. Probing is reproducible to about ±1 mm between visits and examiners,
1536
+ * so 2 mm is the threshold the periodontal literature uses for attachment
1537
+ * loss/gain — and the one the 2017 classification's own progression reasoning
1538
+ * rests on. Exported so a caller can report on its own threshold instead.
1539
+ */
1540
+ export declare const PROGRESSION_MM = 2;
1541
+
1230
1542
  export declare type PulpDetailLevel = "simple" | "aae" | "latin";
1231
1543
 
1232
1544
  export declare type RadiographicDepthMode = "off" | "threeLevel" | "detailed";
@@ -1302,25 +1614,16 @@ export declare type RootPerioOption = {
1302
1614
  label: string;
1303
1615
  };
1304
1616
 
1305
- declare type ScreenToothNumberSize = "small" | "normal" | "xlarge";
1617
+ /** Tooth-number font size in the live grid. */
1618
+ export declare type ScreenToothNumberSize = "small" | "normal" | "xlarge";
1306
1619
 
1307
- /**
1308
- * The full set of live setting values + change handlers the modal drives.
1309
- *
1310
- * Every field maps 1:1 to an existing App-level piece of state / module
1311
- * accessor — the modal never owns behavior, it only surfaces the controls.
1312
- * New settings are added here and wired into a tab's `render()`.
1313
- */
1314
- /** On-screen odontogram layout controls (distinct from the PDF/export
1315
- * equivalents). Spacing = inter-tooth gap in the live grid; number size = the
1316
- * tooth-number font size. Session-only, pure CSS via data-attributes on the
1317
- * grid. */
1318
- declare type ScreenToothSpacing = "wide" | "normal" | "close";
1620
+ /** Inter-tooth gap in the live grid. */
1621
+ export declare type ScreenToothSpacing = "wide" | "normal" | "close";
1319
1622
 
1320
1623
  export declare type SecondaryCariesMode = "simple" | "standard" | "full";
1321
1624
 
1322
1625
  /** Selection-ring border style (default dashed). */
1323
- declare type SelectionBorderStyle = "solid" | "dashed" | "dotted";
1626
+ export declare type SelectionBorderStyle = "solid" | "dashed" | "dotted";
1324
1627
 
1325
1628
  /** Apical (AAE) diagnosis on the current selection — clears the periapical
1326
1629
  * lesion subtype unless the diagnosis is (a)symptomatic apical periodontitis. */
@@ -1353,7 +1656,7 @@ export declare function setCariesSurfaceForSelection(id: string, on: boolean): v
1353
1656
  /**
1354
1657
  * Switch the active chart between "status" (current findings) and "plan"
1355
1658
  * (proposed treatment). The first time "plan" is entered, it is deep-cloned
1356
- * from "status" (see {@link cloneChart}); later switches reuse the existing
1659
+ * from "status" (see `cloneChart`); later switches reuse the existing
1357
1660
  * plan chart untouched. Re-renders every tooth from the newly active chart
1358
1661
  * via the SAME full-repaint mechanism `importStatus()` uses, so no new
1359
1662
  * render path is introduced and SVG output stays byte-identical to the
@@ -1393,7 +1696,7 @@ export declare function setDiscolorationToggleForSelection(on: boolean): void;
1393
1696
  * validates `key` against {@link TOOTH_LEVEL_DX_KEYS} and `mode` against
1394
1697
  * {@link VALID_DX_OVERRIDE_VALUE} (or `null`, which clears any existing
1395
1698
  * override for `key`); anything else is a silent no-op. Routed through
1396
- * {@link gateToothEditBatch} directly (not `applyToSelected`) since
1699
+ * `gateToothEditBatch` directly (not `applyToSelected`) since
1397
1700
  * `dxOverrides` has no SVG/DOM side effect to re-render per tooth. */
1398
1701
  export declare function setDxOverrideForSelection(key: string, mode: "add" | "suppress" | null): void;
1399
1702
 
@@ -1464,10 +1767,6 @@ export declare function setModForSelection(id: string, on: boolean): void;
1464
1767
  */
1465
1768
  export declare function setNotesEnabled(value: boolean): void;
1466
1769
 
1467
- /**
1468
- * Switch the displayed tooth numbering system and re-render all tooth labels.
1469
- * @param system - The target {@link NumberingSystem}.
1470
- */
1471
1770
  export declare function setNumberingSystem(system: NumberingSystem): void;
1472
1771
 
1473
1772
  /** Toggle visibility of occlusal-view tiles (premolars and molars). */
@@ -1554,8 +1853,20 @@ export declare function setRootCariesForSelection(value: string): void;
1554
1853
 
1555
1854
  export declare function setRootCariesMode(value: RootCariesMode): void;
1556
1855
 
1856
+ /** Set the tooth-number size. Sanitizes to the literal set; no-op (does not notify) if unchanged. */
1857
+ export declare function setScreenToothNumberSize(value: ScreenToothNumberSize): void;
1858
+
1859
+ /** Set the inter-tooth spacing. Sanitizes to the literal set; no-op (does not notify) if unchanged. */
1860
+ export declare function setScreenToothSpacing(value: ScreenToothSpacing): void;
1861
+
1557
1862
  export declare function setSecondaryCariesMode(value: SecondaryCariesMode): void;
1558
1863
 
1864
+ /** Set the selection-ring border style. Sanitizes to the literal set; no-op (does not notify) if unchanged. */
1865
+ export declare function setSelectionBorderStyle(value: SelectionBorderStyle): void;
1866
+
1867
+ /** Set the selection-ring colour. Anything but a `#rrggbb` hex is ignored; no-op (does not notify) if unchanged. */
1868
+ export declare function setSelectionColor(value: string): void;
1869
+
1559
1870
  /** Toggle visibility of the bone/gum base layer on all teeth. */
1560
1871
  export declare function setShowBase(on: Any): void;
1561
1872
 
@@ -1649,11 +1960,30 @@ declare type SettingsState = {
1649
1960
  onPdfSettings: (patch: Partial<PdfSettings>) => void;
1650
1961
  };
1651
1962
 
1652
- /** Switch the tooth-anatomy profile. No-op (does not notify) if unchanged.
1653
- * Invalidates the perio-chart template cache so that chart re-parses the new
1654
- * profile's templates on its next load (the odontogram grid is rebuilt by the
1655
- * caller via `rebuildGrid()`). */
1656
- export declare function setToothAnatomy(v: ToothAnatomy): void;
1963
+ /** Switch the tooth-anatomy profile, and rebuild the chart onto it.
1964
+ *
1965
+ * ASYNC since 2.7.0: the measured artwork is code-split, so selecting it first
1966
+ * awaits its chunk — the profile is always loaded before the flag flips, which
1967
+ * keeps `activeAnatomyProfile()` synchronous for every render path. The grid is
1968
+ * then rebuilt HERE (a no-op until `initOdontogram()`), so the pre-2.7.0
1969
+ * `setToothAnatomy(v); rebuildGrid();` idiom stays correct without awaiting:
1970
+ * the caller's own rebuild may run early on the old profile, and this one puts
1971
+ * the grid right once the profile is in place.
1972
+ *
1973
+ * No-op (does not notify) when the profile is already selected or already on
1974
+ * its way in. Never rejects: a chunk that fails to load is reported on the
1975
+ * console and leaves the current profile selected, so an un-awaited call can
1976
+ * never raise an unhandled rejection in a host app. Also invalidates the
1977
+ * perio-chart template cache so that chart re-parses the new profile's
1978
+ * templates on its next load.
1979
+ *
1980
+ * `notifyStateChange()` fires only AFTER the rebuild, so a subscriber (the
1981
+ * React context mirrors this flag into `data-anatomy`) can never style a grid
1982
+ * that is still drawn on the other profile. */
1983
+ export declare function setToothAnatomy(v: ToothAnatomy): Promise<void>;
1984
+
1985
+ /** Show or hide the tooth-information panel. No-op (does not notify) if unchanged. */
1986
+ export declare function setToothInfoVisible(value: boolean): void;
1657
1987
 
1658
1988
  /** Base tooth picker on the current selection — wraps the exact `#toothSelect`
1659
1989
  * closure `wireControls()` bound (the `defaultState()` reset with the milk-block
@@ -1661,6 +1991,11 @@ export declare function setToothAnatomy(v: ToothAnatomy): void;
1661
1991
  * `setEdentulous(false)` when the base is not "none"). */
1662
1992
  export declare function setToothSelectionForSelection(value: string): void;
1663
1993
 
1994
+ /** Replace the factory tooth drawings with host-supplied SVG, per anatomy profile (see `anatomy/templateOverrides.ts`: the markup is vetted,
1995
+ * a refused template is reported by `getToothTemplateRejections()` and the factory one stays). Pass `null` to go back to the factory artwork.
1996
+ * Invalidates the perio-chart template cache; the grid is rebuilt by the caller (`OdontogramProvider`'s `toothTemplates` prop does it). */
1997
+ export declare function setToothTemplateOverrides(overrides: ToothTemplateOverrides | null): void;
1998
+
1664
1999
  /** Cervical wear type on the current selection (complex-mode select). */
1665
2000
  export declare function setWearCervicalForSelection(value: string): void;
1666
2001
 
@@ -1716,6 +2051,13 @@ export declare type SurfaceIndicator = {
1716
2051
 
1717
2052
  export declare type SurfaceNotation = "simple" | "full";
1718
2053
 
2054
+ export declare type TemplateRejection = {
2055
+ profile: "classic" | "measured";
2056
+ set: keyof ToothTemplateSet;
2057
+ key: number;
2058
+ reason: string;
2059
+ };
2060
+
1719
2061
  /** Selectable tooth-anatomy profiles. Stage A: only `classic` is realized;
1720
2062
  * `measured` is accepted but falls back to the classic profile (harmless). */
1721
2063
  export declare type ToothAnatomy = "classic" | "measured";
@@ -1755,6 +2097,18 @@ declare interface ToothTableCell {
1755
2097
  * shown bold-italic in a warning colour). */
1756
2098
  declare type ToothTableStatus = "empty" | "content" | "problem";
1757
2099
 
2100
+ export declare type ToothTemplateOverrides = Partial<Record<"classic" | "measured", ToothTemplateSet>>;
2101
+
2102
+ /** The four template maps of a profile that a host may replace. Keys are the template numbers of THAT profile;
2103
+ * the `primary*` maps are the deciduous artwork of a profile that has it (`measured`), keyed by the permanent
2104
+ * FDI position the milk tooth occupies. */
2105
+ export declare type ToothTemplateSet = {
2106
+ templates?: Record<number, string>;
2107
+ templatesOccl?: Record<number, string>;
2108
+ primaryTemplates?: Record<number, string>;
2109
+ primaryTemplatesOccl?: Record<number, string>;
2110
+ };
2111
+
1758
2112
  /** The translate function surfaced by {@link useI18n}. */
1759
2113
  declare type TranslateFn = ReturnType<typeof useI18n>["t"];
1760
2114