react-advanced-odontogram 2.4.0 → 2.7.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
@@ -1,132 +1,303 @@
1
+ import { Bundle } from 'fhir/r4';
1
2
  import { JSX as JSX_2 } from 'react/jsx-runtime';
3
+ import { ReactNode } from 'react';
4
+ import { Resource } from 'fhir/r4';
2
5
 
3
6
  /** User accepted the divergence: run the deferred edit (status only — the plan
4
7
  * stays as planned), then notify (post-edit refresh + close the modal). No-op
5
8
  * when nothing is pending. */
6
9
  export declare function acceptDualStateConfirm(): void;
7
10
 
8
- declare type Any = any;
11
+ export declare type ActiveCaries = {
12
+ surfaces: ActiveCariesSurface[];
13
+ subcrownChecked: boolean;
14
+ subcrownDisabled: boolean;
15
+ subcrownLabel: string;
16
+ cariesActiveDepth: number;
17
+ rootCariesDisplay: string;
18
+ cariesDepthVisible: boolean;
19
+ rootCariesVisible: boolean;
20
+ cariesSectionVisible: boolean;
21
+ };
9
22
 
10
- declare function App({ language, onLanguageChange, numberingSystem, onNumberingChange, darkMode, onDarkModeChange, themeConfig, plugins, readOnly: readOnlyProp, enableNotes, enableIcdas, pulpDetailLevel, secondaryCariesMode, rootCariesMode, radiographicDepthMode, cariesDepthEnabled, wearDetailLevel, discolorationDetailLevel, surfaceNotation, showStatusCard: showStatusCardProp, showOrthoCard: showOrthoCardProp, }: AppProps): JSX_2.Element;
11
- export { App as OdontogramShell }
12
- export default App;
23
+ /** One caries surface-cross cell's fully-resolved render state. */
24
+ export declare type ActiveCariesSurface = {
25
+ value: string;
26
+ surface: string;
27
+ pos: string;
28
+ letter: string;
29
+ label: string;
30
+ checked: boolean;
31
+ disabled: boolean;
32
+ depth: string;
33
+ icdas: number;
34
+ isIcdas: boolean;
35
+ radio: string | null;
36
+ };
37
+
38
+ /** The active-tooth diagnoses card view-model (return shape of
39
+ * {@link getActiveDiagnoses}). */
40
+ export declare type ActiveDiagnoses = {
41
+ visible: boolean;
42
+ rows: ActiveDiagnosisRow[];
43
+ addableKeys: {
44
+ key: string;
45
+ icd10: string;
46
+ }[];
47
+ };
48
+
49
+ /** One row in the active-tooth diagnoses card: a RAW rule-derived key (whether
50
+ * or not it's currently suppressed) or a key the user explicitly ADDED that no
51
+ * rule would have derived. */
52
+ export declare type ActiveDiagnosisRow = {
53
+ key: string;
54
+ icd10: string;
55
+ source: "derived" | "added";
56
+ suppressed: boolean;
57
+ };
58
+
59
+ export declare type ActiveFillings = {
60
+ surfaces: ActiveFillingSurface[];
61
+ fillingMaterial: string;
62
+ fillingOptions: {
63
+ value: string;
64
+ label: string;
65
+ }[];
66
+ surfaceGridVisible: boolean;
67
+ defectDisabled: boolean;
68
+ simpleMode: boolean;
69
+ simpleRowVisible: boolean;
70
+ simpleToggleChecked: boolean;
71
+ simpleDefectRowVisible: boolean;
72
+ simpleDefectValue: string;
73
+ simpleDefectOptions: {
74
+ value: string;
75
+ label: string;
76
+ }[];
77
+ fissureSealing: boolean;
78
+ fissureRowVisible: boolean;
79
+ fillingSectionVisible: boolean;
80
+ subcariesSummary: string;
81
+ defectSummary: string;
82
+ };
83
+
84
+ /** One filling-surface cell's fully-resolved render state (mirrors the DOM the
85
+ * imperative `buildSurfaceCross` + `syncFillingSubcariesIndicator` +
86
+ * `syncFillingDefectIndicator` produced for `#fillingSurfaceChecks`). */
87
+ export declare type ActiveFillingSurface = {
88
+ value: string;
89
+ surface: string;
90
+ pos: string;
91
+ letter: string;
92
+ label: string;
93
+ labelId: string;
94
+ checked: boolean;
95
+ material: string;
96
+ hasSubcaries: boolean;
97
+ subDepth: string;
98
+ subIcdas: number;
99
+ isIcdas: boolean;
100
+ hasDefect: boolean;
101
+ defectValue: string | null;
102
+ };
103
+
104
+ export declare type ActiveOrtho = {
105
+ appliance: string;
106
+ drift: string;
107
+ vertical: string;
108
+ rotation: boolean;
109
+ visible: boolean;
110
+ };
111
+
112
+ export declare type ActiveRootPerio = {
113
+ sectionVisible: boolean;
114
+ rootBlockVisible: boolean;
115
+ perioBlockVisible: boolean;
116
+ pulpEndoValue: string;
117
+ pulpEndoNoneOption: RootPerioOption | null;
118
+ pulpEndoGroups: RootPerioOptGroup[];
119
+ pulpEndoDisabled: boolean;
120
+ apicalDxValue: string;
121
+ apicalDxOptions: RootPerioOption[];
122
+ apicalDxDisabled: boolean;
123
+ apicalDxRowVisible: boolean;
124
+ periapicalTypeValue: string;
125
+ periapicalTypeOptions: RootPerioOption[];
126
+ periapicalRowVisible: boolean;
127
+ resorptionValue: string;
128
+ resorptionOptions: RootPerioOption[];
129
+ resorptionDisabled: boolean;
130
+ resorptionRowVisible: boolean;
131
+ endoResectionChecked: boolean;
132
+ endoResectionDisabled: boolean;
133
+ parapulpalPinChecked: boolean;
134
+ parapulpalPinDisabled: boolean;
135
+ mobilityValue: string;
136
+ mobilityOptions: RootPerioOption[];
137
+ mobilityDisabled: boolean;
138
+ mobilityRowVisible: boolean;
139
+ perioRowVisible: boolean;
140
+ mods: ActiveRootPerioMod[];
141
+ calculusChecked: boolean;
142
+ calculusRowVisible: boolean;
143
+ periImplantValue: string;
144
+ periImplantOptions: RootPerioOption[];
145
+ periImplantRowVisible: boolean;
146
+ };
147
+
148
+ /** One `#modsChecks` checkbox's fully-resolved render state. `hiddenClass`
149
+ * reproduces the `.hidden` class the sub-syncs toggled on the wrapping
150
+ * `<label>`; `styleHidden` reproduces the `style.display:none` the
151
+ * `setDisabled()`→`syncControlLabelVisibility()` path applied. */
152
+ export declare type ActiveRootPerioMod = {
153
+ value: string;
154
+ label: string;
155
+ checked: boolean;
156
+ disabled: boolean;
157
+ hiddenClass: boolean;
158
+ styleHidden: boolean;
159
+ };
160
+
161
+ export declare type ActiveToothDetails = {
162
+ toothSelectValue: string;
163
+ toothSelectOptions: ToothDetailsOption[];
164
+ substrateValue: string;
165
+ substrateOptions: ToothDetailsOption[];
166
+ substrateRowVisible: boolean;
167
+ extractionWoundChecked: boolean;
168
+ extractionRowVisible: boolean;
169
+ missingClosedChecked: boolean;
170
+ missingClosedRowVisible: boolean;
171
+ restorationValue: string;
172
+ restorationOptions: ToothDetailsOption[];
173
+ restorationRowVisible: boolean;
174
+ crownLeakageChecked: boolean;
175
+ crownLeakageRowVisible: boolean;
176
+ brokenMesialChecked: boolean;
177
+ brokenIncisalChecked: boolean;
178
+ brokenDistalChecked: boolean;
179
+ brokenCrownRowVisible: boolean;
180
+ contactMesialChecked: boolean;
181
+ contactDistalChecked: boolean;
182
+ contactPointRowVisible: boolean;
183
+ bruxismRowVisible: boolean;
184
+ wearSimple: boolean;
185
+ wearEdgeValue: string;
186
+ wearEdgeOptions: ToothDetailsOption[];
187
+ wearEdgeToggleChecked: boolean;
188
+ wearCervicalValue: string;
189
+ wearCervicalOptions: ToothDetailsOption[];
190
+ wearCervicalToggleChecked: boolean;
191
+ discolorationRowVisible: boolean;
192
+ discoSimple: boolean;
193
+ discolorationValue: string;
194
+ discolorationOptions: ToothDetailsOption[];
195
+ discolorationToggleChecked: boolean;
196
+ crownActionsRowVisible: boolean;
197
+ bridgePillarChecked: boolean;
198
+ bridgePillarRowVisible: boolean;
199
+ extractionPlanChecked: boolean;
200
+ extractionPlanRowVisible: boolean;
201
+ extractionPlanParent: ExtractionPlanParent;
202
+ crownReplaceChecked: boolean;
203
+ crownReplaceRowVisible: boolean;
204
+ crownNeededChecked: boolean;
205
+ crownNeededRowVisible: boolean;
206
+ };
207
+
208
+ /** Add a tooth-level diagnosis by writing its chart axis on the selection — a
209
+ * real finding (glyph + derived + exported), through the same DS-1-gated,
210
+ * repainting path as the clinical controls. Prototype-safe key guard; a
211
+ * non-reverse-mappable key (e.g. `caries`) is a silent no-op. */
212
+ export declare function addDiagnosisToSelection(key: string): void;
213
+
214
+ declare type Any = any;
13
215
 
14
216
  /**
15
- * Props for the main Odontogram application component.
217
+ * Root React component for the Odontogram Editor (aka `OdontogramShell`).
218
+ *
219
+ * Renders the full dental chart UI: top bar with language/numbering/dark-mode
220
+ * controls, the SVG tooth grid, and the right-hand control panel for setting
221
+ * tooth states (caries, fillings, crowns, endo, inflammation, etc.).
222
+ *
223
+ * Since the composable-UI refactor (design/composable-ui.md, Tier 1) this is a
224
+ * THIN composition: it mounts {@link OdontogramProvider} (which owns all state,
225
+ * effects and handlers) and lays out the four surface components + the
226
+ * shell-managed perio bits and modals in the default arrangement. The default
227
+ * composition renders byte-identical DOM to the pre-refactor shell (frozen by
228
+ * `src/__tests__/parity/shell-dom.test.tsx`). A host can instead compose the
229
+ * exported surfaces under its own wrappers inside an `OdontogramProvider`.
16
230
  *
17
- * All props are optional — when omitted, the component operates in
18
- * **standalone** mode with internal state. When provided, the component
19
- * operates in **controlled** mode and delegates state to the parent.
231
+ * @example
232
+ * ```tsx
233
+ * // Standalone usage
234
+ * <App />
235
+ *
236
+ * // Controlled by a host application
237
+ * <App
238
+ * language="en"
239
+ * onLanguageChange={setLang}
240
+ * numberingSystem="FDI"
241
+ * onNumberingChange={setNumbering}
242
+ * darkMode={isDark}
243
+ * onDarkModeChange={setDark}
244
+ * />
245
+ * ```
20
246
  */
21
- declare type AppProps = {
22
- /** Override the UI language (controlled mode). */
23
- language?: Language;
24
- /** Callback when the user changes the language. */
25
- onLanguageChange?: (lang: Language) => void;
26
- /** Override the tooth numbering system (controlled mode). */
27
- numberingSystem?: NumberingSystem;
28
- /** Callback when the user changes the numbering system. */
29
- onNumberingChange?: (system: NumberingSystem) => void;
30
- /** Override dark mode state (controlled mode). */
31
- darkMode?: boolean;
32
- /** Callback when the user toggles dark mode. */
33
- onDarkModeChange?: (dark: boolean) => void;
34
- /**
35
- * Custom theme configuration. Overrides the default color palette via
36
- * CSS custom properties (`--odon-*`). See {@link OdontogramThemeConfig}.
37
- */
38
- themeConfig?: OdontogramThemeConfig;
39
- /**
40
- * Custom SVG plugins for extending the odontogram with additional visual
41
- * overlays and per-tooth custom state. See {@link OdontogramPlugin}.
42
- */
43
- plugins?: OdontogramPlugin[];
44
- /**
45
- * When true, disables all interactions (click, touch, keyboard).
46
- * Useful for print/report/view modes.
47
- */
48
- readOnly?: boolean;
49
- /**
50
- * When true, enables per-tooth notes. Double-click a tooth to add/edit a note.
51
- * Notes are shown in hover tooltips and included in JSON export/import.
52
- */
53
- enableNotes?: boolean;
54
- /**
55
- * Enable ICDAS II per-surface caries scoring (0–6). When enabled, the depth
56
- * selector/popup expose ICDAS codes 1–6 and the surface indicator shows a
57
- * numeric badge; otherwise the 3-level scale is used.
58
- */
59
- enableIcdas?: boolean;
60
- /**
61
- * Pulp-diagnosis detail level for the pulp control:
62
- * `"simple"` (healthy / pulpitis), `"aae"` (4 AAE pulp diagnoses, default) or
63
- * `"latin"` (9 practical-Latin subtypes). A stored value round-trips at every
64
- * level; the level only governs how the pulp control presents it.
65
- */
66
- pulpDetailLevel?: PulpDetailLevel;
67
- /**
68
- * Secondary-caries (CARS) granularity for the per-surface score picker:
69
- * `"simple"` ([0,3]), `"standard"` ([0,1,3,6], default) or `"full"` ([0..6]).
70
- * A stored score round-trips at every mode; the mode only governs the offered
71
- * option list. (The mode UI lives in the Settings modal; this prop is the
72
- * controlled entry point.)
73
- */
74
- secondaryCariesMode?: SecondaryCariesMode;
75
- /**
76
- * Root-caries granularity for the per-tooth picker: `"simple"` (none /
77
- * present, default) or `"severity"` (the full none/active/arrested/
78
- * active-cavitated enum). Non-collapsing across modes.
79
- */
80
- rootCariesMode?: RootCariesMode;
81
- /**
82
- * Radiographic-depth granularity for the per-surface picker: `"off"`
83
- * (hidden, default), `"threeLevel"` (superficial/middle/deep) or `"detailed"`
84
- * (E1..D3). When off, the per-surface radiographic badge is not shown.
85
- */
86
- radiographicDepthMode?: RadiographicDepthMode;
87
- /**
88
- * Whether the visual caries-depth encoding (per-surface depth picker + the
89
- * opacity/contour depth tier in the render) is active. Default `true`; set
90
- * `false` to render caried surfaces at the SVG default with no depth tier.
91
- */
92
- cariesDepthEnabled?: boolean;
93
- /**
94
- * Detail level for the per-tooth wear control: `"simple"` (yes/no toggle for
95
- * attrition) or `"complex"` (wear type per edge and cervix, default).
96
- */
97
- wearDetailLevel?: ToothDetailLevel;
98
- /**
99
- * Detail level for the per-tooth discoloration control: `"simple"` (yes/no
100
- * toggle) or `"complex"` (choose the discoloration cause, default).
101
- */
102
- discolorationDetailLevel?: ToothDetailLevel;
103
- /**
104
- * Surface-notation mode for caries/filling surface letters + captions:
105
- * `"full"` (default) makes them position-aware (incisal on an anterior
106
- * tooth, labial on an anterior buccal surface, palatal on an upper lingual
107
- * surface) or `"simple"` (always the tooth-independent B/O/L set).
108
- */
109
- surfaceNotation?: SurfaceNotation;
110
- /**
111
- * Whether the Statuses panel (`#statusCard`) is shown. Default `true`. The
112
- * panel visibility is a settings-driven wrapper around the section — the
113
- * section's own imperative collapse/expand behavior is unaffected.
114
- */
115
- showStatusCard?: boolean;
116
- /**
117
- * Whether the Orthodontics panel (`#orthoCard`) is shown. Default `true`.
118
- * Composes with the panel's own imperative ortho-eligibility gate (hidden
119
- * when no selected tooth is ortho-eligible) — both must be satisfied for
120
- * the panel to render.
121
- */
122
- showOrthoCard?: boolean;
123
- };
247
+ declare function App(props: Omit<OdontogramProviderProps, "children">): JSX_2.Element;
248
+ export { App as OdontogramShell }
249
+ export default App;
250
+
251
+ /** Apply the MIXED dentition preset — see {@link applyPrimaryDentition}; gated
252
+ * STRUCTURAL edit with per-tooth no-op signaling and the `edentulous` flip
253
+ * inside the gated closure. */
254
+ export declare function applyMixedDentition(): void;
255
+
256
+ /** Apply the PRIMARY (deciduous) dentition preset — a STRUCTURAL
257
+ * interactive edit (not a reset), routed through the batch gate. `targetFor`
258
+ * is the state each tooth ends up in; only teeth that actually change are
259
+ * passed to the gate so unchanged teeth are not marked plan-edited / mirrored
260
+ * (per-tooth no-op signaling). Uninitialized plan stays a pure passthrough.
261
+ * The `edentulous` flip + button state live INSIDE the gated closure so on the
262
+ * deferred-confirm path they take effect only on Accept — otherwise Cancel
263
+ * would leave `edentulous` flipped while every tooth
264
+ * is untouched (flag/teeth mismatch). `notifyStateChange()` moves inside too so
265
+ * the whole-mouth refresh fires when the batch actually applies. */
266
+ export declare function applyPrimaryDentition(): void;
267
+
268
+ export declare function applyStatusExtra(option: Any): void;
124
269
 
125
270
  /** User cancelled: do NOT apply the edit; re-sync the active tooth's controls
126
271
  * from stored state so the control the user just changed snaps back (no stale
127
272
  * UI), then notify (refresh + close the modal). No-op when nothing is pending. */
128
273
  export declare function cancelDualStateConfirm(): void;
129
274
 
275
+ export declare function CariesCard(): JSX_2.Element;
276
+
277
+ /** Case-level (whole-mouth / regional) dental diagnosis identifiers — authored
278
+ * on the case, not derived from a tooth. Separate from the tooth-level
279
+ * `DiagnosisKey`/`DX_CODES`. */
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
+
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
+
130
301
  declare type ChartMode = "status" | "plan";
131
302
 
132
303
  /** Remove the stored entry for the active (or default) key. */
@@ -141,6 +312,50 @@ export declare function clearSelection(): void;
141
312
  /** Close the perio-chart overlay. No-op (still notifies) if already closed. */
142
313
  export declare function closePerioOverlay(): void;
143
314
 
315
+ /**
316
+ * A national code overlay. `translation` packs keep the WHO codes and only
317
+ * localize the display (cheap: BNO-10, MKCH-10, and the dental chapter of
318
+ * ICD-10-GM/CIM-10). `modification` packs remap the code itself (US ICD-10-CM,
319
+ * added in DX-5).
320
+ */
321
+ declare interface CodingPack {
322
+ id: string;
323
+ system: string;
324
+ kind: "translation" | "modification";
325
+ displays?: Partial<Record<DiagnosisKey, string>>;
326
+ caseDisplays?: Partial<Record<CaseConditionKey, string>>;
327
+ codes?: Partial<Record<DiagnosisKey, {
328
+ code: string;
329
+ display: string;
330
+ }>>;
331
+ caseCodes?: Partial<Record<CaseConditionKey, {
332
+ code: string;
333
+ display: string;
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>;
339
+ }
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
+
144
359
  /**
145
360
  * Tear down the odontogram engine: clear all DOM elements built by the engine,
146
361
  * unsubscribe from i18n changes, and reset internal state. After this call,
@@ -148,6 +363,11 @@ export declare function closePerioOverlay(): void;
148
363
  */
149
364
  export declare function destroyOdontogram(): void;
150
365
 
366
+ export declare function DiagnosesCard(): JSX_2.Element;
367
+
368
+ /** Internal dental-diagnosis identifiers. Extended per DX sub-project. */
369
+ declare type DiagnosisKey = "caries" | "periodontitis" | "gingivitis" | "cariesCementum" | "cariesArrested" | "pulpitis" | "pulpNecrosis" | "apicalPeriodontitisAcute" | "apicalPeriodontitisChronic" | "radicularCyst" | "periapicalAbscess" | "periapicalAbscessSinus" | "condensingOsteitis" | "resorption" | "attrition" | "abrasion" | "erosion" | "abfraction" | "calculus" | "fluorosis" | "tetracyclineStain" | "postEruptiveColour" | "toothLoss" | "retainedRoot" | "toothFracture" | "periImplantMucositis" | "periImplantitis";
370
+
151
371
  /** Stop persisting. The stored entry is left in place (see clearPersistedState).
152
372
  * A pending debounced save is flushed first so the last edit isn't lost. */
153
373
  export declare function disablePersistence(): void;
@@ -159,12 +379,29 @@ export declare function disablePersistence(): void;
159
379
  */
160
380
  export declare function enablePersistence(options?: PersistenceOptions): void;
161
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
+
162
399
  /**
163
400
  * Export the current odontogram as an HL7 FHIR R4 collection Bundle (JSON).
164
401
  * @param options - Optional subject reference (e.g. "Patient/123"); when
165
402
  * omitted a placeholder Patient is embedded.
166
403
  */
167
- export declare function exportFhir(options?: FhirExportOptions): void;
404
+ export declare function exportFhir(options?: FhirExportOptions): Bundle<Resource>;
168
405
 
169
406
  /**
170
407
  * Export the odontogram as PNG or JPG. Renders the serialized SVG via the
@@ -176,7 +413,7 @@ export declare function exportImage(format?: "png" | "jpg"): Promise<void>;
176
413
  /**
177
414
  * Assemble a printable PDF report (jsPDF-native — vector text + raster chart
178
415
  * PNGs, no svg2pdf.js). Gathers all `data` (SVG→PNG
179
- * rasterization via {@link rasterizeSvgToPng}, summary/classification text,
416
+ * rasterization via `rasterizeSvgToPng`, summary/classification text,
180
417
  * `hasAnyPerioData()`), drives the export-progress overlay, then hands off
181
418
  * to the PURE `assemblePdf()` (`src/perioPdf.ts`), which decides section
182
419
  * layout from `opts`/`data` alone.
@@ -191,7 +428,7 @@ export declare function exportImage(format?: "png" | "jpg"): Promise<void>;
191
428
  export declare function exportPdf(opts: PdfExportOptions): Promise<void>;
192
429
 
193
430
  /** Export the full perio chart as PNG/JPG (SVG → canvas @2×, via the
194
- * shared {@link rasterizeSvgToCanvas} raster core). */
431
+ * shared `rasterizeSvgToCanvas` raster core). */
195
432
  export declare function exportPerioImage(format?: "png" | "jpg"): Promise<void>;
196
433
 
197
434
  /** Export the full perio chart as a standalone vector SVG file. */
@@ -201,6 +438,8 @@ export declare function exportStatus(): void;
201
438
 
202
439
  export declare function exportSvg(): Promise<void>;
203
440
 
441
+ export declare type ExtractionPlanParent = "brokenCrownRow" | "bruxismRow" | "crownActionsRow";
442
+
204
443
  /** Options for buildFhirBundle / exportFhir. */
205
444
  export declare interface FhirExportOptions {
206
445
  /**
@@ -209,23 +448,89 @@ export declare interface FhirExportOptions {
209
448
  * referenced by every Observation.
210
449
  */
211
450
  subject?: string;
451
+ /** Active national diagnosis coding pack (adds a second coding to each
452
+ * Condition). Resolved and passed by the export entry point. */
453
+ codingPack?: CodingPack;
454
+ /** Emit a SNOMED CT coding on each Condition when true (DX-6 overlay). Set
455
+ * from the `snomedEnabled` session flag by the export entry point. */
456
+ snomed?: boolean;
457
+ /** Embed the engine's own `CodeSystem` resource in the Bundle (default `true`)
458
+ * so validators can resolve the LOCAL_SYSTEM codes from the Bundle itself.
459
+ * Pass `false` for a leaner Bundle when the consumer already hosts the
460
+ * published `fhir/CodeSystem-odontogram.json`. */
461
+ includeCodeSystem?: boolean;
462
+ }
463
+
464
+ /** Fillings card complexity — "complex" = per-surface grid (default), "simple"
465
+ * = one filled/not-filled toggle for the whole tooth. */
466
+ export declare type FillingComplexity = "complex" | "simple";
467
+
468
+ export declare function FillingsCard(): JSX_2.Element;
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;
212
481
  }
213
482
 
214
483
  /** Formats a tooth number for display using the active numbering system AND
215
- * the milktooth display-remap ({@link getDisplayedToothNumber}) — the exact
484
+ * the milktooth display-remap (`getDisplayedToothNumber`) — the exact
216
485
  * same formatting {@link getOdontogramSummary} uses for every tooth number
217
486
  * it prints (permanent/missing lists, per-section entries, implants). Exported
218
- * 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`
219
488
  * identically, without duplicating the numbering/milktooth logic. */
220
489
  export declare function formatToothLabel(toothNo: number): string;
221
490
 
491
+ export declare function getActiveCaries(): ActiveCaries;
492
+
493
+ /** The active-tooth diagnoses card view-model — mirrors `getActiveRootPerio`'s
494
+ * active-tooth guard shape. `rows` covers the RAW derived set (each tagged
495
+ * `suppressed` per the tooth's `dxOverrides`) plus any `add`-mode override key
496
+ * that no rule derived; `addableKeys` is every other tooth-level diagnosis key
497
+ * not already covered by a row, for an "add a diagnosis" picker. Localized
498
+ * labels are resolved by the CARD via `t("dx."+key)` — this returns raw keys +
499
+ * codes only. `visible` is false (empty rows/addableKeys) with no active tooth
500
+ * or on a tooth that isn't naturally present (missing/implant/under-gum/
501
+ * extraction-socket — the same gate `deriveDentalDiagnoses` itself applies). */
502
+ export declare function getActiveDiagnoses(): ActiveDiagnoses;
503
+
504
+ export declare function getActiveFillings(): ActiveFillings;
505
+
506
+ export declare function getActiveOrtho(): ActiveOrtho | null;
507
+
508
+ export declare function getActiveRootPerio(): ActiveRootPerio;
509
+
510
+ export declare function getActiveToothDetails(): ActiveToothDetails;
511
+
222
512
  export declare function getCariesDepthEnabled(): boolean;
223
513
 
514
+ export declare function getCariesDepthOptions(): Array<{
515
+ value: number;
516
+ label: string;
517
+ title?: string;
518
+ }>;
519
+
224
520
  /** Current active chart mode ("status" | "plan"). */
225
521
  export declare function getChartMode(): ChartMode;
226
522
 
523
+ export declare function getDiagnosisCodingPack(): string;
524
+
227
525
  export declare function getDiscolorationDetailLevel(): ToothDetailLevel;
228
526
 
527
+ /** Read the whole-mouth edentulous flag. Backs the declarative Statuses card's
528
+ * `#btnEdentulous` `aria-pressed` via `useEngineState(getEdentulous)`, replacing
529
+ * the former imperative `setToggleButton($("#btnEdentulous"), …)` syncs — every
530
+ * path that flips `edentulous` fires `notifyStateChange()`, so the React button
531
+ * re-reads this and re-renders. */
532
+ export declare function getEdentulous(): boolean;
533
+
229
534
  export declare function getFillingComplexity(): "complex" | "simple";
230
535
 
231
536
  export declare function getFillingDefectEnabled(): boolean;
@@ -241,6 +546,13 @@ export declare function getIcdasEnabled(): boolean;
241
546
  */
242
547
  export declare function getNotesEnabled(): boolean;
243
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
+
244
556
  export declare function getOdontogramSummary(): OdontogramSummary;
245
557
 
246
558
  export declare function getPdfSettings(): PdfSettings;
@@ -256,7 +568,7 @@ export declare function getPerioViewMode(): PerioViewMode;
256
568
 
257
569
  /**
258
570
  * Compare the "status" chart against the "plan" chart, tooth by tooth and
259
- * 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
260
572
  * differs. Pure and read-only: never mutates either chart, never touches the
261
573
  * DOM, never renders — a `parity.test.ts`-safe addition.
262
574
  *
@@ -299,16 +611,102 @@ export declare function getReadOnly(): boolean;
299
611
 
300
612
  export declare function getRootCariesMode(): RootCariesMode;
301
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
+
302
620
  export declare function getSecondaryCariesMode(): SecondaryCariesMode;
303
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
+
641
+ export declare function getSnomedEnabled(): boolean;
642
+
304
643
  /**
305
644
  * Export the STATUS chart's payload — identical to exportStatus()'s JSON
306
645
  * (status-primary; unaffected by the current chart mode).
307
646
  */
308
647
  export declare function getStatusChart(): Any;
309
648
 
649
+ export declare function getStatusExtras(): ({
650
+ label: string;
651
+ id: string;
652
+ labelKey: string;
653
+ type: string;
654
+ teeth: number[];
655
+ material: string;
656
+ arch?: undefined;
657
+ missingMaterial?: undefined;
658
+ implants?: undefined;
659
+ missing?: undefined;
660
+ } | {
661
+ label: string;
662
+ id: string;
663
+ labelKey: string;
664
+ type: string;
665
+ arch: string;
666
+ material: string;
667
+ missingMaterial: string;
668
+ teeth?: undefined;
669
+ implants?: undefined;
670
+ missing?: undefined;
671
+ } | {
672
+ label: string;
673
+ id: string;
674
+ labelKey: string;
675
+ type: string;
676
+ arch: string;
677
+ teeth?: undefined;
678
+ material?: undefined;
679
+ missingMaterial?: undefined;
680
+ implants?: undefined;
681
+ missing?: undefined;
682
+ } | {
683
+ label: string;
684
+ id: string;
685
+ labelKey: string;
686
+ type: string;
687
+ arch: string;
688
+ implants: number[];
689
+ missing: number[];
690
+ teeth?: undefined;
691
+ material?: undefined;
692
+ missingMaterial?: undefined;
693
+ })[];
694
+
310
695
  export declare function getSurfaceNotation(): SurfaceNotation;
311
696
 
697
+ /** Current tooth-anatomy profile selector. Defaults to `"classic"`. */
698
+ export declare function getToothAnatomy(): ToothAnatomy;
699
+
700
+ /** A tooth's EFFECTIVE coded diagnoses (derived − suppressed + added), reused
701
+ * by both the tooltip (`getStateSummary`) and the whole-mouth summary
702
+ * ({@link getOdontogramSummary}). Reads the ACTIVE chart's tooth state (so
703
+ * it's transparently Status/Plan dual-state aware, like every other per-tooth
704
+ * getter). A tooth with no state (never touched) has no diagnoses. */
705
+ export declare function getToothDiagnoses(toothNo: number): ToothDiagnosis[];
706
+
707
+ /** Whether the tooth-information panel is shown. Defaults to `true`. */
708
+ export declare function getToothInfoVisible(): boolean;
709
+
312
710
  /**
313
711
  * Get a human-readable summary of all active states for a tooth.
314
712
  * Useful for building custom tooltip or info-panel UIs.
@@ -361,6 +759,10 @@ export declare function isPersistenceEnabled(): boolean;
361
759
  * | zh | Chinese (Simplified) |
362
760
  * | ar | Arabic (RTL — UI mirrors, dental/perio charts pinned LTR) |
363
761
  * | fr | French |
762
+ *
763
+ * The strings themselves live one file per language in `./locales/`. Only
764
+ * English is bundled statically; every other language is a separate chunk
765
+ * fetched the first time it is selected (see `./loader.ts`).
364
766
  */
365
767
  declare type Language = "hu" | "en" | "de" | "es" | "it" | "sk" | "pl" | "ru" | "pt-br" | "zh" | "ar" | "fr";
366
768
 
@@ -372,6 +774,8 @@ declare type Language = "hu" | "en" | "de" | "es" | "it" | "sk" | "pl" | "ru" |
372
774
  */
373
775
  declare type NumberingSystem = "FDI" | "UNIVERSAL" | "PALMER";
374
776
 
777
+ export declare function OdontogramChartSurface(): JSX_2.Element;
778
+
375
779
  /**
376
780
  * Custom SVG plugin definition for the Odontogram engine.
377
781
  *
@@ -419,6 +823,193 @@ export declare type OdontogramPlugin = {
419
823
  panelSection?: "custom";
420
824
  };
421
825
 
826
+ /**
827
+ * Owns all odontogram shell state, effects, and handlers and provides them to
828
+ * composed surfaces + modals. Renders only the `.odontogram-root` wrapper around
829
+ * `children` — no extra DOM node.
830
+ *
831
+ * Holds its first render until the requested `language` has loaded: every UI
832
+ * language but English is a lazily fetched chunk, and mounting before it
833
+ * arrives would paint the whole chart in the English fallback and then repaint
834
+ * it — a visible flash of the wrong language on every page load. English (and
835
+ * any language already loaded) renders on the very first pass, as before.
836
+ */
837
+ export declare function OdontogramProvider(props: OdontogramProviderProps): JSX_2.Element;
838
+
839
+ /**
840
+ * Props for {@link OdontogramProvider} — the full former `OdontogramShell`
841
+ * (`App`) props surface plus the composed `children`. All state/behavior props
842
+ * are optional: when omitted the provider operates in **standalone** mode with
843
+ * internal state; when provided it operates in **controlled** mode and delegates
844
+ * state to the parent.
845
+ */
846
+ declare type OdontogramProviderProps = {
847
+ /** Override the UI language (controlled mode). */
848
+ language?: Language;
849
+ /** Callback when the user changes the language. */
850
+ onLanguageChange?: (lang: Language) => void;
851
+ /** Override the tooth numbering system (controlled mode). */
852
+ numberingSystem?: NumberingSystem;
853
+ /** Callback when the user changes the numbering system. */
854
+ onNumberingChange?: (system: NumberingSystem) => void;
855
+ /** Override dark mode state (controlled mode). */
856
+ darkMode?: boolean;
857
+ /** Callback when the user toggles dark mode. */
858
+ onDarkModeChange?: (dark: boolean) => void;
859
+ /**
860
+ * Custom theme configuration. Overrides the default color palette via
861
+ * CSS custom properties (`--odon-*`). See {@link OdontogramThemeConfig}.
862
+ */
863
+ themeConfig?: OdontogramThemeConfig;
864
+ /**
865
+ * Custom SVG plugins for extending the odontogram with additional visual
866
+ * overlays and per-tooth custom state. See {@link OdontogramPlugin}.
867
+ */
868
+ plugins?: OdontogramPlugin[];
869
+ /**
870
+ * When true, disables all interactions (click, touch, keyboard).
871
+ * Useful for print/report/view modes.
872
+ */
873
+ readOnly?: boolean;
874
+ /**
875
+ * When true, enables per-tooth notes. Double-click a tooth to add/edit a note.
876
+ * Notes are shown in hover tooltips and included in JSON export/import.
877
+ */
878
+ enableNotes?: boolean;
879
+ /**
880
+ * Enable ICDAS II per-surface caries scoring (0–6). When enabled, the depth
881
+ * selector/popup expose ICDAS codes 1–6 and the surface indicator shows a
882
+ * numeric badge; otherwise the 3-level scale is used.
883
+ */
884
+ enableIcdas?: boolean;
885
+ /**
886
+ * Pulp-diagnosis detail level for the pulp control:
887
+ * `"simple"` (healthy / pulpitis), `"aae"` (4 AAE pulp diagnoses, default) or
888
+ * `"latin"` (9 practical-Latin subtypes). A stored value round-trips at every
889
+ * level; the level only governs how the pulp control presents it.
890
+ */
891
+ pulpDetailLevel?: PulpDetailLevel;
892
+ /**
893
+ * Secondary-caries (CARS) granularity for the per-surface score picker:
894
+ * `"simple"` ([0,3]), `"standard"` ([0,1,3,6], default) or `"full"` ([0..6]).
895
+ * A stored score round-trips at every mode; the mode only governs the offered
896
+ * option list. (The mode UI lives in the Settings modal; this prop is the
897
+ * controlled entry point.)
898
+ */
899
+ secondaryCariesMode?: SecondaryCariesMode;
900
+ /**
901
+ * Root-caries granularity for the per-tooth picker: `"simple"` (none /
902
+ * present, default) or `"severity"` (the full none/active/arrested/
903
+ * active-cavitated enum). Non-collapsing across modes.
904
+ */
905
+ rootCariesMode?: RootCariesMode;
906
+ /**
907
+ * Radiographic-depth granularity for the per-surface picker: `"off"`
908
+ * (hidden, default), `"threeLevel"` (superficial/middle/deep) or `"detailed"`
909
+ * (E1..D3). When off, the per-surface radiographic badge is not shown.
910
+ */
911
+ radiographicDepthMode?: RadiographicDepthMode;
912
+ /**
913
+ * Whether the visual caries-depth encoding (per-surface depth picker + the
914
+ * opacity/contour depth tier in the render) is active. Default `true`; set
915
+ * `false` to render caried surfaces at the SVG default with no depth tier.
916
+ */
917
+ cariesDepthEnabled?: boolean;
918
+ /**
919
+ * Detail level for the per-tooth wear control: `"simple"` (yes/no toggle for
920
+ * attrition) or `"complex"` (wear type per edge and cervix, default).
921
+ */
922
+ wearDetailLevel?: ToothDetailLevel;
923
+ /**
924
+ * Detail level for the per-tooth discoloration control: `"simple"` (yes/no
925
+ * toggle) or `"complex"` (choose the discoloration cause, default).
926
+ */
927
+ discolorationDetailLevel?: ToothDetailLevel;
928
+ /**
929
+ * Surface-notation mode for caries/filling surface letters + captions:
930
+ * `"full"` (default) makes them position-aware (incisal on an anterior
931
+ * tooth, labial on an anterior buccal surface, palatal on an upper lingual
932
+ * surface) or `"simple"` (always the tooth-independent B/O/L set).
933
+ */
934
+ surfaceNotation?: SurfaceNotation;
935
+ /**
936
+ * Whether the Statuses panel (`#statusCard`) is shown. Default `true`. The
937
+ * panel visibility is a settings-driven wrapper around the section — the
938
+ * section's own imperative collapse/expand behavior is unaffected.
939
+ */
940
+ showStatusCard?: boolean;
941
+ /**
942
+ * Whether the Orthodontics panel (`#orthoCard`) is shown. Default `true`.
943
+ * Composes with the panel's own imperative ortho-eligibility gate (hidden
944
+ * when no selected tooth is ortho-eligible) — both must be satisfied for
945
+ * the panel to render.
946
+ */
947
+ showOrthoCard?: boolean;
948
+ /**
949
+ * Filling-complexity level for the Fillings card: `"simple"` (one material
950
+ * per tooth, no per-surface picker) or `"complex"` (per-surface materials,
951
+ * default). Contrast with `settings.panels` — this one mirrors the
952
+ * `fillingComplexity` engine flag (Settings → Fillings). When provided, the
953
+ * value overrides the engine/UI default; when omitted, whatever the engine
954
+ * holds (module default or a prior `setFillingComplexity` call) stays put.
955
+ */
956
+ fillingComplexity?: FillingComplexity;
957
+ /**
958
+ * Called after the user changes the filling-complexity level in the
959
+ * Settings modal: `(value: FillingComplexity) => void`. Not fired for
960
+ * prop-driven restores. The write-back counterpart of {@link fillingComplexity}.
961
+ */
962
+ onFillingComplexityChange?: (value: FillingComplexity) => void;
963
+ /**
964
+ * Whether filling-defect findings are enabled on the Fillings card. Default
965
+ * `true`. Mirrors the `fillingDefectEnabled` engine flag (Settings →
966
+ * Fillings); same controlled/standalone contract as {@link fillingComplexity}.
967
+ */
968
+ fillingDefectEnabled?: boolean;
969
+ /** See {@link onFillingComplexityChange} — the defect toggle's counterpart. */
970
+ onFillingDefectEnabledChange?: (enabled: boolean) => void;
971
+ /**
972
+ * Available filling materials as a `Record<material, boolean>` over
973
+ * `"amalgam" | "composite" | "gic" | "temporary"` (unknown keys are
974
+ * ignored). Default: all four available. Mirrors the `fillingMaterialAvail`
975
+ * engine map (Settings → Fillings). Hosts may pass an inline literal — the
976
+ * sync effect keys on a canonical serialized form, so re-renders with
977
+ * identical content do not re-fire.
978
+ */
979
+ fillingMaterialAvailability?: Record<string, boolean>;
980
+ /**
981
+ * Called after the user toggles a material in the Settings modal:
982
+ * `(material: string, enabled: boolean) => void` — per-material, mirroring
983
+ * the engine's `setFillingMaterialAvailability` setter (no whole-record
984
+ * change ever happens). Not fired for prop-driven restores.
985
+ */
986
+ onFillingMaterialAvailabilityChange?: (material: string, enabled: boolean) => void;
987
+ /**
988
+ * Whether fissure-sealing is offered on the Fillings card. Default `true`.
989
+ * Mirrors the `fissureSealingEnabled` engine flag (Settings → Fillings);
990
+ * same controlled/standalone contract as {@link fillingComplexity}.
991
+ */
992
+ fissureSealingEnabled?: boolean;
993
+ /** See {@link onFillingComplexityChange} — the fissure-sealing toggle's counterpart. */
994
+ onFissureSealingEnabledChange?: (enabled: boolean) => void;
995
+ /**
996
+ * Inter-tooth spacing of the on-screen grid (Settings → Odontogram). Mirrors
997
+ * the `screenToothSpacing` engine flag; same controlled/standalone contract
998
+ * as {@link fillingComplexity}.
999
+ */
1000
+ screenToothSpacing?: ScreenToothSpacing;
1001
+ /** Tooth-number size of the on-screen grid; same contract as {@link screenToothSpacing}. */
1002
+ screenToothNumberSize?: ScreenToothNumberSize;
1003
+ /** Selection-ring colour as `#rrggbb`; same contract as {@link screenToothSpacing}. */
1004
+ selectionColor?: string;
1005
+ /** Selection-ring border style; same contract as {@link screenToothSpacing}. */
1006
+ selectionBorderStyle?: SelectionBorderStyle;
1007
+ /** Whether the tooth-information panel is shown; same contract as {@link screenToothSpacing}. */
1008
+ toothInfo?: boolean;
1009
+ /** The composed UI (surfaces + shell layout). */
1010
+ children?: ReactNode;
1011
+ };
1012
+
422
1013
  /** Structured, already-localized textual summary of the whole odontogram. */
423
1014
  export declare type OdontogramSummary = {
424
1015
  overview: string;
@@ -463,28 +1054,6 @@ export declare type OdontogramSummarySection = {
463
1054
  emptyText: string;
464
1055
  };
465
1056
 
466
- /**
467
- * Theme configuration for the Odontogram component.
468
- *
469
- * Allows host applications to override the default color palette without
470
- * modifying CSS files. All properties are optional — only the provided
471
- * values are overridden; the rest fall back to the built-in defaults.
472
- *
473
- * Colors are applied as CSS custom properties (`--odon-*`) on the
474
- * component root element, so they work regardless of whether the host
475
- * uses Tailwind CSS or plain CSS.
476
- *
477
- * @example
478
- * ```tsx
479
- * const myTheme: OdontogramThemeConfig = {
480
- * colors: {
481
- * accent: '#e74c3c',
482
- * background: '#fafafa',
483
- * },
484
- * };
485
- * <App themeConfig={myTheme} />
486
- * ```
487
- */
488
1057
  export declare type OdontogramThemeConfig = {
489
1058
  colors?: {
490
1059
  /** Primary background. Default: `#f3f6fb` (light) / `#0f172a` (dark). */
@@ -504,6 +1073,99 @@ export declare type OdontogramThemeConfig = {
504
1073
  /** Secondary accent (success, selected states). Default: `#12b981`. */
505
1074
  accent2?: string;
506
1075
  };
1076
+ /**
1077
+ * Tooth-artwork colours.
1078
+ *
1079
+ * The drawings carry their colours as palette tokens with today's colour as
1080
+ * the fallback (`fill: var(--odon-tooth-body, #ebebeb)`), so an omitted
1081
+ * key leaves that surface exactly as drawn. Setting a key recolours that
1082
+ * surface across BOTH anatomy profiles at once, even where the classic and
1083
+ * measured artwork happen to be drawn in different shades.
1084
+ *
1085
+ * This is a curated subset. Every token — including the gradient stops and
1086
+ * the per-material restoration colours — can be set by name through
1087
+ * {@link OdontogramThemeConfig.tokens}.
1088
+ */
1089
+ tooth?: {
1090
+ /** The tooth's own silhouette — crown AND root — and every broken or
1091
+ * prepared variant of it.
1092
+ *
1093
+ * In the `classic` profile this is the whole tooth: those drawings are one
1094
+ * shape, with no inner structure. In `measured` it is the outer shell —
1095
+ * enamel over the crown, cementum over the root — around `dentin` below,
1096
+ * which takes this colour unless it is set. Setting only `body` therefore
1097
+ * looks the same in both profiles. */
1098
+ body?: string;
1099
+ /** The dentin core inside the crown and root (`measured` profile only —
1100
+ * the classic drawings have no enamel/dentin boundary to colour).
1101
+ *
1102
+ * Unset, it follows `body`, so the boundary is invisible until you ask
1103
+ * for it. The occlusal view has no core: nothing of the dentin shows from
1104
+ * above. */
1105
+ dentin?: string;
1106
+ /** Crown and root outline. */
1107
+ outline?: string;
1108
+ /** Crown sheen (the "beauty" layer). */
1109
+ highlight?: string;
1110
+ /** The deciduous tooth's silhouette. */
1111
+ milktoothBody?: string;
1112
+ /** Deciduous crown sheen. */
1113
+ milktoothHighlight?: string;
1114
+ /** Occlusal cusp field. */
1115
+ cusp?: string;
1116
+ /** Occlusal fissure lines. */
1117
+ groove?: string;
1118
+ /** Healthy pulp chamber. */
1119
+ pulpHealthy?: string;
1120
+ /** Inflamed pulp. */
1121
+ pulpInflamed?: string;
1122
+ /** Gingiva. */
1123
+ gum?: string;
1124
+ /** Alveolar bone. */
1125
+ bone?: string;
1126
+ /** Caries body. */
1127
+ caries?: string;
1128
+ /** Caries outline. */
1129
+ cariesOutline?: string;
1130
+ /** Bruxism wear facet. */
1131
+ wear?: string;
1132
+ /** Calculus deposit. */
1133
+ calculus?: string;
1134
+ /** Restoration outline. */
1135
+ restorationOutline?: string;
1136
+ /** Dark structural outline. */
1137
+ outlineDark?: string;
1138
+ };
1139
+ /**
1140
+ * Any palette token by its full CSS custom-property name, for the surfaces
1141
+ * {@link OdontogramThemeConfig.tooth} does not name — the per-material
1142
+ * restoration colours (`--odon-rest-gold`, `--odon-fill-composite`, …) and
1143
+ * the e.max / metal-ceramic gradient stops.
1144
+ *
1145
+ * Keys must start with `--odon-`; anything else is ignored, so this cannot
1146
+ * be used to set unrelated custom properties on the host's element.
1147
+ *
1148
+ * @example
1149
+ * { tokens: { "--odon-rest-gold": "#d4af37", "--odon-fill-composite": "#eae0c8" } }
1150
+ */
1151
+ tokens?: Record<string, string>;
1152
+ /**
1153
+ * The tooth-selection highlight.
1154
+ *
1155
+ * Selection is an interaction state, not artwork — it is drawn by the chart
1156
+ * around a tile, not by any tooth drawing — but hosts look for it here when
1157
+ * they are deciding "what colour is everything". It is applied through the
1158
+ * existing session setters (`setSelectionColor` / `setSelectionBorderStyle`),
1159
+ * so it is NOT a CSS custom property and does not appear on the themed
1160
+ * element.
1161
+ *
1162
+ * The dedicated `selectionColor` / `selectionBorderStyle` props on the
1163
+ * provider are the more specific control and win when both are given.
1164
+ */
1165
+ selection?: {
1166
+ color?: string;
1167
+ borderStyle?: SelectionBorderStyle;
1168
+ };
507
1169
  };
508
1170
 
509
1171
  /** A grouped dentition overview: category columns (only non-empty ones) ×
@@ -523,18 +1185,91 @@ declare interface OdontogramToothTable {
523
1185
  legend: string;
524
1186
  }
525
1187
 
1188
+ export declare function OdontogramTopbar(): JSX_2.Element;
1189
+
1190
+ /**
1191
+ * Everything the surface components and shell-managed modals consume. Cross-cutting
1192
+ * state read across ≥2 regions/modals lives here; strictly region-local state
1193
+ * (the header dropdown open flags + outside-click effect) stays inside its surface.
1194
+ */
1195
+ export declare type OdontogramUiContextValue = {
1196
+ t: TranslateFn;
1197
+ lang: Language;
1198
+ setLang: (lang: Language) => void;
1199
+ isDark: boolean;
1200
+ toggleDark: () => void;
1201
+ currentNumbering: NumberingSystem;
1202
+ setNumbering: (next: NumberingSystem) => void;
1203
+ viewMode: PerioViewMode;
1204
+ activeView: "odontogram" | "dentalChart";
1205
+ setActiveView: (view: "odontogram" | "dentalChart") => void;
1206
+ isPerioView: boolean;
1207
+ perioChartAvailable: boolean;
1208
+ perioOpen: boolean;
1209
+ confirmOpen: boolean;
1210
+ hasPerio: boolean;
1211
+ exportPngOn: boolean;
1212
+ exportJpgOn: boolean;
1213
+ exportSvgOn: boolean;
1214
+ exportPdfOn: boolean;
1215
+ importStatusOn: boolean;
1216
+ importFhirOn: boolean;
1217
+ summary: OdontogramSummary | null;
1218
+ toothInfoOn: boolean;
1219
+ screenSpacing: ScreenToothSpacing;
1220
+ screenNumberSize: ScreenToothNumberSize;
1221
+ selectionColor: string;
1222
+ selectionBorderStyle: SelectionBorderStyle;
1223
+ toothAnatomy: ToothAnatomy;
1224
+ planModeAvailable: boolean;
1225
+ showStatusCard: boolean;
1226
+ showOrthoCard: boolean;
1227
+ settingsState: SettingsState;
1228
+ settingsOpen: boolean;
1229
+ setSettingsOpen: (open: boolean) => void;
1230
+ pdfOpen: boolean;
1231
+ setPdfOpen: (open: boolean) => void;
1232
+ creditsOpen: boolean;
1233
+ setCreditsOpen: (open: boolean) => void;
1234
+ caseDxOpen: boolean;
1235
+ setCaseDxOpen: (open: boolean) => void;
1236
+ };
1237
+
526
1238
  /**
527
1239
  * Subscribe to odontogram state changes. The callback runs after any tooth
528
- * state edit, the edentulous toggle, or an import.
1240
+ * state edit, the edentulous toggle, an import, or a change to a session
1241
+ * setting (numbering system, notes, ICDAS, caries/pulp/wear/discoloration
1242
+ * detail, surface notation, fillings, perio display) — so a host that
1243
+ * persists the doctor's preferences can react to the settings modal too.
529
1244
  *
530
1245
  * @param cb - Callback invoked on each change.
531
1246
  * @returns An unsubscribe function.
532
1247
  */
533
1248
  export declare function onStateChange(cb: () => void): () => void;
534
1249
 
1250
+ /** Public entry point for the declarative `CariesCard`'s per-surface `.surf-depth`
1251
+ * indicator click: opens the contextual severity popup for `surface`, anchored
1252
+ * to `anchor`, on the currently-active tooth — the exact call `wireControls()`
1253
+ * made (`showCariesDepthPopup(surface, ind, activeTooth)`). Kept as a thin
1254
+ * wrapper so the popup overlay itself stays imperative (module-private state:
1255
+ * `activeTooth` / `applyToSelected`). */
1256
+ export declare function openCariesDepthPopup(surface: string, anchor: HTMLElement): void;
1257
+
1258
+ /** Public entry point for the declarative `FillingsCard`'s per-surface LEFT-side
1259
+ * `.surf-defect` indicator click: opens the contextual filling-defect popup for
1260
+ * `surface`, anchored to `anchor`, on the currently-active tooth — the exact
1261
+ * call `wireControls()` made (`showFillingDefectPopup(surface, ind,
1262
+ * activeTooth)`). Thin wrapper so the popup itself stays imperative. */
1263
+ export declare function openFillingDefectPopup(surface: string, anchor: HTMLElement): void;
1264
+
535
1265
  /** Open the perio-chart overlay. No-op (still notifies) if already open. */
536
1266
  export declare function openPerioOverlay(): void;
537
1267
 
1268
+ export declare function OrthodonticsCard(): JSX_2.Element;
1269
+
1270
+ /** Parameter map for template placeholders (`{{key}}`). */
1271
+ declare type Params = Record<string, string | number>;
1272
+
538
1273
  declare type PdfBorderThickness = "thin" | "medium" | "thick";
539
1274
 
540
1275
  /** Selectable report colour themes — the default is "blue"; the other three are
@@ -566,9 +1301,12 @@ declare type PdfPerioFontSize = "small" | "normal" | "xlarge";
566
1301
  declare type PdfPerioLabelPlacement = "center" | "edge";
567
1302
 
568
1303
  declare interface PdfSettings {
569
- /** Placeholder patient name when the case has none (default "John Doe"). */
1304
+ /** Optional placeholder patient name, printed when the case has none. Empty
1305
+ * by default: the report then prints "not specified" (`pdf.field.notSpecified`)
1306
+ * rather than inventing a name. */
570
1307
  defaultName: string;
571
- /** Placeholder DOB (ISO `YYYY-MM-DD`) when the case has none. */
1308
+ /** Optional placeholder DOB (ISO `YYYY-MM-DD`), printed when the case has
1309
+ * none. Empty by default, as above. No age is ever derived from it. */
572
1310
  defaultDob: string;
573
1311
  /** Show the patient's age (in parentheses) after the DOB. */
574
1312
  showAge: boolean;
@@ -661,12 +1399,64 @@ export declare function PerioChart({ open, onClose, inline, }: {
661
1399
  inline?: boolean;
662
1400
  }): JSX_2.Element;
663
1401
 
1402
+ declare type PerioDiagnosis = "health" | "gingivitis" | "periodontitis";
1403
+
1404
+ /** Whole-mouth figures for one exam — the subset of `getPerioSummary()` that
1405
+ * can be derived from a payload alone. */
1406
+ export declare interface PerioExamAggregate {
1407
+ chartedSites: number;
1408
+ bleedingSites: number;
1409
+ /** Bleeding sites ÷ charted sites, as a percentage with one decimal. */
1410
+ bopPercent: number;
1411
+ maxPd: number | null;
1412
+ worstCal: number | null;
1413
+ }
1414
+
1415
+ export declare interface PerioExamComparison {
1416
+ from: PerioExamAggregate;
1417
+ to: PerioExamAggregate;
1418
+ /** Every site whose probing depth or attachment level moved at all, including
1419
+ * sites charted in only one of the two exams. Tooth order is the clinical
1420
+ * `ALL_TEETH` order; sites follow `PERIO_SITES`. */
1421
+ changed: PerioSiteDelta[];
1422
+ /** Sites charted in BOTH exams whose attachment worsened by at least
1423
+ * {@link PROGRESSION_MM} — the clinically meaningful subset of `changed`. */
1424
+ attachmentLoss: PerioSiteDelta[];
1425
+ /** …and improved by at least as much. */
1426
+ attachmentGain: PerioSiteDelta[];
1427
+ /** Sites charted in both whose POCKET deepened by at least {@link PROGRESSION_MM}. */
1428
+ deepened: PerioSiteDelta[];
1429
+ /** Sites charted now but not then, and the other way round. */
1430
+ newlyCharted: number;
1431
+ noLongerCharted: number;
1432
+ }
1433
+
1434
+ declare type PerioExtent = "na" | "localized" | "generalized" | "molar-incisor";
1435
+
1436
+ declare type PerioGrade = "A" | "B" | "C" | "indeterminate";
1437
+
664
1438
  /** How perio-chart index row labels are rendered. */
665
1439
  export declare type PerioIndexNameMode = "translated" | "canonical";
666
1440
 
667
1441
  /** The 16 toggleable periodontal index rows the Dental Chart can show/hide. */
668
1442
  export declare type PerioRowId = "plaque" | "bop" | "cal" | "gm" | "pd" | "furcation" | "mobility" | "cej" | "rootConcavity" | "pi" | "gi" | "mpi" | "mbi" | "kg" | "gt" | "miller";
669
1443
 
1444
+ export declare function PerioSidebar(): JSX_2.Element;
1445
+
1446
+ /** One site, measured in both exams (or in only one of them). */
1447
+ export declare interface PerioSiteDelta {
1448
+ toothNo: number;
1449
+ site: string;
1450
+ /** Probing depth in mm, or `null` when the site was not charted in that exam. */
1451
+ pdFrom: number | null;
1452
+ pdTo: number | null;
1453
+ /** Clinical attachment level (pd + gm) in mm, or `null` when not charted. */
1454
+ calFrom: number | null;
1455
+ calTo: number | null;
1456
+ }
1457
+
1458
+ declare type PerioStage = "na" | "I" | "II" | "III" | "IV" | "indeterminate";
1459
+
670
1460
  export declare type PerioViewMode = "toggle" | "popup";
671
1461
 
672
1462
  export declare type PersistenceOptions = {
@@ -696,10 +1486,28 @@ declare type PlanChange = {
696
1486
  */
697
1487
  export declare type PluginLayer = "base" | "restoration" | "overlay";
698
1488
 
1489
+ /**
1490
+ * Millimetres of change that count as real movement rather than measurement
1491
+ * noise. Probing is reproducible to about ±1 mm between visits and examiners,
1492
+ * so 2 mm is the threshold the periodontal literature uses for attachment
1493
+ * loss/gain — and the one the 2017 classification's own progression reasoning
1494
+ * rests on. Exported so a caller can report on its own threshold instead.
1495
+ */
1496
+ export declare const PROGRESSION_MM = 2;
1497
+
699
1498
  export declare type PulpDetailLevel = "simple" | "aae" | "latin";
700
1499
 
701
1500
  export declare type RadiographicDepthMode = "off" | "threeLevel" | "detailed";
702
1501
 
1502
+ /**
1503
+ * Rebuild the SVG tooth grid after the chart column remounts (composable-UI
1504
+ * Tier 2). Preserves the current selection/active tooth across buildGrid()'s
1505
+ * internal reset, clears+rebuilds the four grid element maps, and bumps
1506
+ * `initToken` so any in-flight/toggle-spam build supersedes cleanly. No-op
1507
+ * before init or if a newer build/teardown supersedes this one mid-await.
1508
+ */
1509
+ export declare function rebuildGrid(): Promise<void>;
1510
+
703
1511
  /**
704
1512
  * Register one or more custom SVG plugins. Plugins can inject visual overlays
705
1513
  * into the tooth SVG and maintain per-tooth custom state included in export/import.
@@ -708,16 +1516,103 @@ export declare type RadiographicDepthMode = "off" | "threeLevel" | "detailed";
708
1516
  */
709
1517
  export declare function registerPlugins(plugins: OdontogramPlugin[]): void;
710
1518
 
1519
+ /** Remove a tooth-level diagnosis from the current selection: clears the
1520
+ * underlying chart axis (so the glyph disappears too, through the repainting
1521
+ * apply path) AND drops any coded-layer override (add/suppress) for the key.
1522
+ * The card's delete (×) uses this — the full inverse of
1523
+ * {@link addDiagnosisToSelection}, extended to `caries` (clears the surfaces)
1524
+ * so every listed diagnosis is fully removable. Prototype-safe key guard. */
1525
+ export declare function removeDiagnosisFromSelection(key: string): void;
1526
+
1527
+ /** Reset the WHOLE mouth to a blank slate — the exact closure the imperative
1528
+ * `#btnResetAll` handler used, now called directly from the declarative Statuses
1529
+ * card's onClick. Clears the edentulous flag + case-level metadata, resets every
1530
+ * tooth to `defaultState()`, re-syncs the active tooth's controls, and notifies
1531
+ * once at the end so the mounted case-metadata/Statuses subscribers re-read the
1532
+ * cleared state. */
1533
+ export declare function resetMouth(): void;
1534
+
1535
+ /** Reset the whole current selection to `defaultState()` — the exact closure the
1536
+ * imperative `#btnResetTooth` handler used, now called from the declarative card
1537
+ * title button's onClick. */
1538
+ export declare function resetTooth(): void;
1539
+
1540
+ /**
1541
+ * Re-run control wiring after a controls surface remounts (composable-UI Tier 2).
1542
+ * `wireControls()` is idempotent per-element (bindOnce + populated-container
1543
+ * guards), so this wires ONLY the freshly-mounted nodes and leaves still-mounted
1544
+ * ones untouched; the trailing syncControlsFromState() re-derives the active
1545
+ * tooth's per-tooth option lists/values on the (possibly new) select nodes.
1546
+ * No-op before init (the provider's own init effect does the first wiring).
1547
+ */
1548
+ export declare function rewireControls(): void;
1549
+
711
1550
  export declare type RootCariesMode = "simple" | "severity";
712
1551
 
1552
+ /** Root-caries options at a given mode (defaults to the module setting).
1553
+ * simple -> none / present (present writes the canonical "active-cavitated"
1554
+ * enum — the most-severe value, so simple-mode "present" renders at full
1555
+ * opacity); severity -> the full rootCaries enum. Pure. */
1556
+ export declare function rootCariesOptions(mode?: RootCariesMode): {
1557
+ value: string;
1558
+ label: string;
1559
+ }[];
1560
+
1561
+ export declare function RootPeriodontiumCard(): JSX_2.Element;
1562
+
1563
+ export declare type RootPerioOptGroup = {
1564
+ label: string;
1565
+ options: RootPerioOption[];
1566
+ };
1567
+
1568
+ export declare type RootPerioOption = {
1569
+ value: string;
1570
+ label: string;
1571
+ };
1572
+
1573
+ /** Tooth-number font size in the live grid. */
1574
+ export declare type ScreenToothNumberSize = "small" | "normal" | "xlarge";
1575
+
1576
+ /** Inter-tooth gap in the live grid. */
1577
+ export declare type ScreenToothSpacing = "wide" | "normal" | "close";
1578
+
713
1579
  export declare type SecondaryCariesMode = "simple" | "standard" | "full";
714
1580
 
1581
+ /** Selection-ring border style (default dashed). */
1582
+ export declare type SelectionBorderStyle = "solid" | "dashed" | "dotted";
1583
+
1584
+ /** Apical (AAE) diagnosis on the current selection — clears the periapical
1585
+ * lesion subtype unless the diagnosis is (a)symptomatic apical periodontitis. */
1586
+ export declare function setApicalDxForSelection(value: string): void;
1587
+
1588
+ /** Bridge-abutment toggle on the current selection. */
1589
+ export declare function setBridgePillarForSelection(on: boolean): void;
1590
+
1591
+ /** Broken distal corner toggle on the current selection. */
1592
+ export declare function setBrokenDistalForSelection(on: boolean): void;
1593
+
1594
+ /** Broken incisal corner toggle on the current selection. */
1595
+ export declare function setBrokenIncisalForSelection(on: boolean): void;
1596
+
1597
+ /** Broken mesial corner toggle on the current selection. */
1598
+ export declare function setBrokenMesialForSelection(on: boolean): void;
1599
+
1600
+ /** Calculus toggle on the current selection. */
1601
+ export declare function setCalculusForSelection(on: boolean): void;
1602
+
1603
+ /** Set the default (active) caries depth for newly-tapped surfaces. */
1604
+ export declare function setCariesActiveDepthForSelection(value: number): void;
1605
+
715
1606
  export declare function setCariesDepthEnabled(value: boolean): void;
716
1607
 
1608
+ /** Toggle one caries surface (or the subcrown) on the current selection —
1609
+ * wraps the exact `cariesOnToggle` closure `wireControls()` bound. */
1610
+ export declare function setCariesSurfaceForSelection(id: string, on: boolean): void;
1611
+
717
1612
  /**
718
1613
  * Switch the active chart between "status" (current findings) and "plan"
719
1614
  * (proposed treatment). The first time "plan" is entered, it is deep-cloned
720
- * from "status" (see {@link cloneChart}); later switches reuse the existing
1615
+ * from "status" (see `cloneChart`); later switches reuse the existing
721
1616
  * plan chart untouched. Re-renders every tooth from the newly active chart
722
1617
  * via the SAME full-repaint mechanism `importStatus()` uses, so no new
723
1618
  * render path is introduced and SVG output stays byte-identical to the
@@ -728,16 +1623,79 @@ export declare function setCariesDepthEnabled(value: boolean): void;
728
1623
  */
729
1624
  export declare function setChartMode(mode: ChartMode): void;
730
1625
 
1626
+ /** Distal contact-loss toggle on the current selection. */
1627
+ export declare function setContactDistalForSelection(on: boolean): void;
1628
+
1629
+ /** Mesial contact-loss toggle on the current selection. */
1630
+ export declare function setContactMesialForSelection(on: boolean): void;
1631
+
1632
+ /** Crown marginal-leakage toggle on the current selection. */
1633
+ export declare function setCrownLeakageForSelection(on: boolean): void;
1634
+
1635
+ /** Crown-needed toggle on the current selection. */
1636
+ export declare function setCrownNeededForSelection(on: boolean): void;
1637
+
1638
+ /** Crown-replacement toggle on the current selection. */
1639
+ export declare function setCrownReplaceForSelection(on: boolean): void;
1640
+
1641
+ export declare function setDiagnosisCodingPack(id: string): void;
1642
+
731
1643
  export declare function setDiscolorationDetailLevel(value: ToothDetailLevel): void;
732
1644
 
1645
+ /** Discoloration cause on the current selection (complex-mode select). */
1646
+ export declare function setDiscolorationForSelection(value: string): void;
1647
+
1648
+ /** Discoloration simple-mode toggle (other / none) on the selection. */
1649
+ export declare function setDiscolorationToggleForSelection(on: boolean): void;
1650
+
1651
+ /** Add/suppress/clear one coded diagnosis on the current selection —
1652
+ * validates `key` against {@link TOOTH_LEVEL_DX_KEYS} and `mode` against
1653
+ * {@link VALID_DX_OVERRIDE_VALUE} (or `null`, which clears any existing
1654
+ * override for `key`); anything else is a silent no-op. Routed through
1655
+ * `gateToothEditBatch` directly (not `applyToSelected`) since
1656
+ * `dxOverrides` has no SVG/DOM side effect to re-render per tooth. */
1657
+ export declare function setDxOverrideForSelection(key: string, mode: "add" | "suppress" | null): void;
1658
+
1659
+ export declare function setEdentulous(on: Any): void;
1660
+
1661
+ /** Apicoectomy (resected tooth) toggle on the current selection. */
1662
+ export declare function setEndoResectionForSelection(on: boolean): void;
1663
+
1664
+ /** Planned-extraction toggle on the current selection. */
1665
+ export declare function setExtractionPlanForSelection(on: boolean): void;
1666
+
1667
+ /** Extraction-wound toggle on the current selection. */
1668
+ export declare function setExtractionWoundForSelection(on: boolean): void;
1669
+
733
1670
  export declare function setFillingComplexity(v: "complex" | "simple"): void;
734
1671
 
735
1672
  export declare function setFillingDefectEnabled(v: boolean): void;
736
1673
 
737
1674
  export declare function setFillingMaterialAvailability(material: string, v: boolean): void;
738
1675
 
1676
+ /** Set the active filling material on the current selection — wraps the exact
1677
+ * `#fillingSelect` closure `wireControls()` bound (clearing "none" removes any
1678
+ * orphaned per-surface fillings). */
1679
+ export declare function setFillingMaterialForSelection(mat: string): void;
1680
+
1681
+ /** Simple-mode filling-defect select — applies a defect to EVERY filled surface.
1682
+ * Wraps the `#fillingSimpleDefectSelect` closure. */
1683
+ export declare function setFillingSimpleDefectForSelection(value: string): void;
1684
+
1685
+ /** Simple-mode filled/not-filled toggle — applies the current material to ALL
1686
+ * surfaces (or clears them). Wraps the `#fillingSimpleToggle` closure. */
1687
+ export declare function setFillingSimpleToggleForSelection(on: boolean): void;
1688
+
1689
+ /** Toggle one filling surface on the current selection — wraps the exact
1690
+ * `buildSurfaceCross($("#fillingSurfaceChecks"), …)` closure. */
1691
+ export declare function setFillingSurfaceForSelection(surf: string, on: boolean): void;
1692
+
739
1693
  export declare function setFissureSealingEnabled(v: boolean): void;
740
1694
 
1695
+ /** Fissure-sealing toggle on the current selection. Wraps the `#fissureSealing`
1696
+ * closure. */
1697
+ export declare function setFissureSealingForSelection(on: boolean): void;
1698
+
741
1699
  /** Toggle visibility of the healthy-pulp layer on all teeth. */
742
1700
  export declare function setHealthyPulpVisible(on: Any): void;
743
1701
 
@@ -746,6 +1704,16 @@ export declare function setIcdasEnabled(value: boolean): void;
746
1704
  /** Set which parser the next file import uses. Defaults back to "status" after each import. */
747
1705
  export declare function setImportFormat(format: "status" | "fhir"): void;
748
1706
 
1707
+ /** Closed-gap toggle on the current selection. */
1708
+ export declare function setMissingClosedForSelection(on: boolean): void;
1709
+
1710
+ /** Tooth mobility grade on the current selection. */
1711
+ export declare function setMobilityForSelection(value: string): void;
1712
+
1713
+ /** Toggle one `#modsChecks` modifier (parodontal / inflammation) on the current
1714
+ * selection — wraps the exact set add/delete closure `wireControls()` bound. */
1715
+ export declare function setModForSelection(id: string, on: boolean): void;
1716
+
749
1717
  /**
750
1718
  * Enable or disable per-tooth notes. When enabled, double-clicking a tooth
751
1719
  * opens a note editor popover, and notes are shown in hover tooltips with
@@ -755,17 +1723,30 @@ export declare function setImportFormat(format: "status" | "fhir"): void;
755
1723
  */
756
1724
  export declare function setNotesEnabled(value: boolean): void;
757
1725
 
758
- /**
759
- * Switch the displayed tooth numbering system and re-render all tooth labels.
760
- * @param system - The target {@link NumberingSystem}.
761
- */
762
1726
  export declare function setNumberingSystem(system: NumberingSystem): void;
763
1727
 
764
1728
  /** Toggle visibility of occlusal-view tiles (premolars and molars). */
765
1729
  export declare function setOcclusalVisible(on: Any): void;
766
1730
 
1731
+ export declare function setOrthoApplianceForSelection(value: string): void;
1732
+
1733
+ export declare function setOrthoDriftForSelection(value: string): void;
1734
+
1735
+ export declare function setOrthoRotationForSelection(on: boolean): void;
1736
+
1737
+ export declare function setOrthoVerticalForSelection(value: string): void;
1738
+
1739
+ /** Parapulpal pin toggle on the current selection. */
1740
+ export declare function setParapulpalPinForSelection(on: boolean): void;
1741
+
767
1742
  export declare function setPdfSettings(patch: Partial<PdfSettings>): void;
768
1743
 
1744
+ /** Periapical lesion subtype on the current selection. */
1745
+ export declare function setPeriapicalTypeForSelection(value: string): void;
1746
+
1747
+ /** Peri-implant status on the current selection. */
1748
+ export declare function setPeriImplantForSelection(value: string): void;
1749
+
769
1750
  /** Switch the perio index-name display mode. No-op (does not notify) if unchanged. */
770
1751
  export declare function setPerioIndexNameMode(mode: PerioIndexNameMode): void;
771
1752
 
@@ -797,6 +1778,11 @@ export declare function setPluginState(toothNo: number, pluginId: string, value:
797
1778
 
798
1779
  export declare function setPulpDetailLevel(value: PulpDetailLevel): void;
799
1780
 
1781
+ /** Merged pulp/endo selection on the current selection — wraps the exact
1782
+ * `pulpEndoOnSelect` closure `wireControls()` bound (incl. the endo↔pulpDx
1783
+ * mutual-exclusion normalization). */
1784
+ export declare function setPulpEndoForSelection(value: string): void;
1785
+
800
1786
  export declare function setRadiographicDepthMode(value: RadiographicDepthMode): void;
801
1787
 
802
1788
  /**
@@ -808,27 +1794,241 @@ export declare function setRadiographicDepthMode(value: RadiographicDepthMode):
808
1794
  */
809
1795
  export declare function setReadOnly(value: boolean): void;
810
1796
 
1797
+ /** Root resorption type on the current selection. */
1798
+ export declare function setResorptionForSelection(value: string): void;
1799
+
1800
+ /** Combined restoration dropdown on the current selection — wraps the exact
1801
+ * `#restorationSelect` closure (`applyRestorationSelection` decode of
1802
+ * `${type}|${material}` / `prosthesis|<value>` + the trailing
1803
+ * `setEdentulous(false)`). */
1804
+ export declare function setRestorationForSelection(value: string): void;
1805
+
1806
+ /** Set the per-tooth root-caries value (the picker already emits the canonical
1807
+ * enum value; simple-mode "present" maps to "active-cavitated"). */
1808
+ export declare function setRootCariesForSelection(value: string): void;
1809
+
811
1810
  export declare function setRootCariesMode(value: RootCariesMode): void;
812
1811
 
1812
+ /** Set the tooth-number size. Sanitizes to the literal set; no-op (does not notify) if unchanged. */
1813
+ export declare function setScreenToothNumberSize(value: ScreenToothNumberSize): void;
1814
+
1815
+ /** Set the inter-tooth spacing. Sanitizes to the literal set; no-op (does not notify) if unchanged. */
1816
+ export declare function setScreenToothSpacing(value: ScreenToothSpacing): void;
1817
+
813
1818
  export declare function setSecondaryCariesMode(value: SecondaryCariesMode): void;
814
1819
 
1820
+ /** Set the selection-ring border style. Sanitizes to the literal set; no-op (does not notify) if unchanged. */
1821
+ export declare function setSelectionBorderStyle(value: SelectionBorderStyle): void;
1822
+
1823
+ /** Set the selection-ring colour. Anything but a `#rrggbb` hex is ignored; no-op (does not notify) if unchanged. */
1824
+ export declare function setSelectionColor(value: string): void;
1825
+
815
1826
  /** Toggle visibility of the bone/gum base layer on all teeth. */
816
1827
  export declare function setShowBase(on: Any): void;
817
1828
 
1829
+ export declare function setSnomedEnabled(v: boolean): void;
1830
+
1831
+ /** Substrate (natural / radix / broken / crown-prep) on the current selection —
1832
+ * wraps the exact `#substrateSelect` closure (broken-part + crown-needed clears
1833
+ * and the trailing `setEdentulous(false)`). */
1834
+ export declare function setSubstrateForSelection(value: string): void;
1835
+
818
1836
  export declare function setSurfaceNotation(value: SurfaceNotation): void;
819
1837
 
1838
+ declare type SettingsState = {
1839
+ numbering: NumberingSystem;
1840
+ onNumbering: (value: NumberingSystem) => void;
1841
+ language: Language;
1842
+ onLanguage: (value: Language) => void;
1843
+ isDark: boolean;
1844
+ onToggleDark: () => void;
1845
+ toothInfo: boolean;
1846
+ onToothInfo: (value: boolean) => void;
1847
+ exportPng: boolean;
1848
+ onExportPng: (value: boolean) => void;
1849
+ exportJpg: boolean;
1850
+ onExportJpg: (value: boolean) => void;
1851
+ exportSvg: boolean;
1852
+ onExportSvg: (value: boolean) => void;
1853
+ exportPdf: boolean;
1854
+ onExportPdf: (value: boolean) => void;
1855
+ importStatus: boolean;
1856
+ onImportStatus: (value: boolean) => void;
1857
+ importFhir: boolean;
1858
+ onImportFhir: (value: boolean) => void;
1859
+ codingPack: string;
1860
+ onDiagnosisCodingPack: (value: string) => void;
1861
+ snomedEnabled: boolean;
1862
+ onSnomedEnabled: (value: boolean) => void;
1863
+ secondaryCariesMode: SecondaryCariesMode;
1864
+ onSecondaryCariesMode: (value: SecondaryCariesMode) => void;
1865
+ icdas: boolean;
1866
+ onIcdas: (value: boolean) => void;
1867
+ cariesDepth: boolean;
1868
+ onCariesDepth: (value: boolean) => void;
1869
+ rootCariesMode: RootCariesMode;
1870
+ onRootCariesMode: (value: RootCariesMode) => void;
1871
+ radiographicDepthMode: RadiographicDepthMode;
1872
+ onRadiographicDepthMode: (value: RadiographicDepthMode) => void;
1873
+ selectionColor: string;
1874
+ onSelectionColor: (value: string) => void;
1875
+ selectionBorderStyle: SelectionBorderStyle;
1876
+ onSelectionBorderStyle: (value: SelectionBorderStyle) => void;
1877
+ pulpLevel: PulpDetailLevel;
1878
+ onPulpLevel: (value: PulpDetailLevel) => void;
1879
+ wearDetailLevel: ToothDetailLevel;
1880
+ onWearDetailLevel: (value: ToothDetailLevel) => void;
1881
+ discolorationDetailLevel: ToothDetailLevel;
1882
+ onDiscolorationDetailLevel: (value: ToothDetailLevel) => void;
1883
+ surfaceNotation: SurfaceNotation;
1884
+ onSurfaceNotation: (value: SurfaceNotation) => void;
1885
+ notes: boolean;
1886
+ onNotes: (value: boolean) => void;
1887
+ planModeAvailable: boolean;
1888
+ onPlanModeAvailable: (value: boolean) => void;
1889
+ screenToothSpacing: ScreenToothSpacing;
1890
+ onScreenToothSpacing: (value: ScreenToothSpacing) => void;
1891
+ screenToothNumberSize: ScreenToothNumberSize;
1892
+ onScreenToothNumberSize: (value: ScreenToothNumberSize) => void;
1893
+ toothAnatomy: ToothAnatomy;
1894
+ onToothAnatomy: (value: ToothAnatomy) => void;
1895
+ showStatusCard: boolean;
1896
+ onShowStatusCard: (value: boolean) => void;
1897
+ showOrthoCard: boolean;
1898
+ onShowOrthoCard: (value: boolean) => void;
1899
+ perioChartAvailable: boolean;
1900
+ onPerioChartAvailable: (value: boolean) => void;
1901
+ perioViewMode: PerioViewMode;
1902
+ onPerioViewMode: (value: PerioViewMode) => void;
1903
+ perioRowVisibility: Record<PerioRowId, boolean>;
1904
+ onPerioRowVisibility: (id: PerioRowId, visible: boolean) => void;
1905
+ perioIndexNameMode: PerioIndexNameMode;
1906
+ onPerioIndexNameMode: (value: PerioIndexNameMode) => void;
1907
+ fillingDefectEnabled: boolean;
1908
+ onFillingDefectEnabled: (value: boolean) => void;
1909
+ fillingComplexity: FillingComplexity;
1910
+ onFillingComplexity: (value: FillingComplexity) => void;
1911
+ fillingMaterials: Record<string, boolean>;
1912
+ onFillingMaterial: (material: string, value: boolean) => void;
1913
+ fissureSealingEnabled: boolean;
1914
+ onFissureSealingEnabled: (value: boolean) => void;
1915
+ pdfSettings: PdfSettings;
1916
+ onPdfSettings: (patch: Partial<PdfSettings>) => void;
1917
+ };
1918
+
1919
+ /** Switch the tooth-anatomy profile, and rebuild the chart onto it.
1920
+ *
1921
+ * ASYNC since 2.7.0: the measured artwork is code-split, so selecting it first
1922
+ * awaits its chunk — the profile is always loaded before the flag flips, which
1923
+ * keeps `activeAnatomyProfile()` synchronous for every render path. The grid is
1924
+ * then rebuilt HERE (a no-op until `initOdontogram()`), so the pre-2.7.0
1925
+ * `setToothAnatomy(v); rebuildGrid();` idiom stays correct without awaiting:
1926
+ * the caller's own rebuild may run early on the old profile, and this one puts
1927
+ * the grid right once the profile is in place.
1928
+ *
1929
+ * No-op (does not notify) when the profile is already selected or already on
1930
+ * its way in. Never rejects: a chunk that fails to load is reported on the
1931
+ * console and leaves the current profile selected, so an un-awaited call can
1932
+ * never raise an unhandled rejection in a host app. Also invalidates the
1933
+ * perio-chart template cache so that chart re-parses the new profile's
1934
+ * templates on its next load.
1935
+ *
1936
+ * `notifyStateChange()` fires only AFTER the rebuild, so a subscriber (the
1937
+ * React context mirrors this flag into `data-anatomy`) can never style a grid
1938
+ * that is still drawn on the other profile. */
1939
+ export declare function setToothAnatomy(v: ToothAnatomy): Promise<void>;
1940
+
1941
+ /** Show or hide the tooth-information panel. No-op (does not notify) if unchanged. */
1942
+ export declare function setToothInfoVisible(value: boolean): void;
1943
+
1944
+ /** Base tooth picker on the current selection — wraps the exact `#toothSelect`
1945
+ * closure `wireControls()` bound (the `defaultState()` reset with the milk-block
1946
+ * guard + the extraction/caries/endo/filling clears, and the trailing
1947
+ * `setEdentulous(false)` when the base is not "none"). */
1948
+ export declare function setToothSelectionForSelection(value: string): void;
1949
+
1950
+ /** Cervical wear type on the current selection (complex-mode select). */
1951
+ export declare function setWearCervicalForSelection(value: string): void;
1952
+
1953
+ /** Cervical wear simple-mode toggle (abrasion / none) on the selection. */
1954
+ export declare function setWearCervicalToggleForSelection(on: boolean): void;
1955
+
820
1956
  export declare function setWearDetailLevel(value: ToothDetailLevel): void;
821
1957
 
1958
+ /** Incisal/occlusal wear type on the current selection (complex-mode select). */
1959
+ export declare function setWearEdgeForSelection(value: string): void;
1960
+
1961
+ /** Incisal/occlusal wear simple-mode toggle (attrition / none) on the selection. */
1962
+ export declare function setWearEdgeToggleForSelection(on: boolean): void;
1963
+
822
1964
  /** Toggle visibility of wisdom teeth (18, 28, 38, 48). */
823
1965
  export declare function setWisdomVisible(on: Any): void;
824
1966
 
825
- /** Start the 12-step interactive intro tour. */
1967
+ /** Start the interactive intro tour. */
826
1968
  export declare function startIntroTour(): void;
827
1969
 
1970
+ export declare function StatusesCard(): JSX_2.Element;
1971
+
1972
+ /** One surface-cross cell's fully-resolved render state. */
1973
+ export declare type SurfaceCell = {
1974
+ value: string;
1975
+ pos: string;
1976
+ letter: string;
1977
+ label: string;
1978
+ labelId: string;
1979
+ checked: boolean;
1980
+ disabled: boolean;
1981
+ onToggle: (checked: boolean) => void;
1982
+ indicators?: SurfaceIndicator[];
1983
+ attrs?: Record<string, string>;
1984
+ };
1985
+
1986
+ export declare function SurfaceCross({ cells }: {
1987
+ cells: SurfaceCell[];
1988
+ }): JSX_2.Element;
1989
+
1990
+ /** One injected per-cell indicator span (e.g. the `.surf-depth` severity popup
1991
+ * affordance). `side` decides whether it renders before the checkbox (left) or
1992
+ * after the caption (right), matching the imperative insert order. */
1993
+ export declare type SurfaceIndicator = {
1994
+ key: string;
1995
+ className: string;
1996
+ title: string;
1997
+ side: "left" | "right";
1998
+ attrs?: Record<string, string>;
1999
+ children?: ReactNode;
2000
+ onClick?: (anchor: HTMLElement) => void;
2001
+ };
2002
+
828
2003
  export declare type SurfaceNotation = "simple" | "full";
829
2004
 
2005
+ /** Selectable tooth-anatomy profiles. Stage A: only `classic` is realized;
2006
+ * `measured` is accepted but falls back to the classic profile (harmless). */
2007
+ export declare type ToothAnatomy = "classic" | "measured";
2008
+
2009
+ export declare function ToothControlsSurface(): JSX_2.Element;
2010
+
830
2011
  export declare type ToothDetailLevel = "simple" | "complex";
831
2012
 
2013
+ export declare function ToothDetailsCard(): JSX_2.Element;
2014
+
2015
+ export declare type ToothDetailsOption = {
2016
+ value: string;
2017
+ label: string;
2018
+ disabled?: boolean;
2019
+ };
2020
+
2021
+ /** One EFFECTIVE coded diagnosis on a tooth (after `dxOverrides` are applied):
2022
+ * a rule-derived finding not suppressed, or an explicitly added one. */
2023
+ export declare type ToothDiagnosis = {
2024
+ key: DiagnosisKey;
2025
+ icd10: string | null;
2026
+ icd10Display: string;
2027
+ source: "derived" | "added";
2028
+ };
2029
+
2030
+ export declare function ToothInfoSurface(): JSX_2.Element;
2031
+
832
2032
  declare interface ToothTableCell {
833
2033
  toothNo: number;
834
2034
  label: string;
@@ -841,4 +2041,33 @@ declare interface ToothTableCell {
841
2041
  * shown bold-italic in a warning colour). */
842
2042
  declare type ToothTableStatus = "empty" | "content" | "problem";
843
2043
 
2044
+ /** The translate function surfaced by {@link useI18n}. */
2045
+ declare type TranslateFn = ReturnType<typeof useI18n>["t"];
2046
+
2047
+ export declare function useEngineState<T>(read: () => T): T;
2048
+
2049
+ /**
2050
+ * React hook for i18n. Supports both **controlled** mode (parent provides
2051
+ * `language` prop) and **standalone** mode (internal state).
2052
+ *
2053
+ * @param options - Optional controlled-mode props.
2054
+ * @returns `{ lang, setLang, t }` — current language, setter, and scoped translate function.
2055
+ */
2056
+ declare function useI18n(options?: UseI18nOptions): {
2057
+ lang: Language;
2058
+ setLang: (next: Language) => void;
2059
+ t: (key: string, params?: Params) => string;
2060
+ };
2061
+
2062
+ declare type UseI18nOptions = {
2063
+ language?: Language;
2064
+ onLanguageChange?: (lang: Language) => void;
2065
+ };
2066
+
2067
+ /**
2068
+ * Read the shared odontogram UI context. Throws when used outside an
2069
+ * {@link OdontogramProvider}, so a misplaced surface fails loudly at mount.
2070
+ */
2071
+ export declare function useOdontogramUi(): OdontogramUiContextValue;
2072
+
844
2073
  export { }