react-advanced-odontogram 2.0.2 → 2.2.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.
Files changed (41) hide show
  1. package/README.md +38 -1335
  2. package/dist/index.d.ts +716 -4
  3. package/dist/odontogram.js +3209 -2398
  4. package/dist/odontogram.js.map +1 -1
  5. package/package.json +7 -8
  6. package/dist/App.d.ts +0 -148
  7. package/dist/DualStateConfirm.d.ts +0 -25
  8. package/dist/ExportOptionsModal.d.ts +0 -26
  9. package/dist/PerioChart.d.ts +0 -67
  10. package/dist/PerioSidebar.d.ts +0 -1
  11. package/dist/SettingsModal.d.ts +0 -84
  12. package/dist/bridgeOverlay.d.ts +0 -116
  13. package/dist/fhir/codesystems.d.ts +0 -51
  14. package/dist/fhir/fieldMappings.d.ts +0 -35
  15. package/dist/fhir/fromFhir.d.ts +0 -7
  16. package/dist/fhir/primitives.d.ts +0 -16
  17. package/dist/fhir/toFhir.d.ts +0 -20
  18. package/dist/fhir/toFhirPerio.d.ts +0 -70
  19. package/dist/fhir/types.d.ts +0 -108
  20. package/dist/i18n/translations.d.ts +0 -27
  21. package/dist/i18n/useI18n.d.ts +0 -39
  22. package/dist/odontogram.d.ts +0 -1214
  23. package/dist/perioClassification.d.ts +0 -90
  24. package/dist/perioExport.d.ts +0 -13
  25. package/dist/perioGraphic.d.ts +0 -496
  26. package/dist/perioIndexNames.d.ts +0 -29
  27. package/dist/perioPdf.d.ts +0 -77
  28. package/dist/plugin.d.ts +0 -63
  29. package/dist/registry/axes.d.ts +0 -9
  30. package/dist/registry/fhir.d.ts +0 -3
  31. package/dist/registry/fromFhir.d.ts +0 -3
  32. package/dist/registry/restorations.d.ts +0 -26
  33. package/dist/registry/svgActivate.d.ts +0 -15
  34. package/dist/registry/svgLayers.d.ts +0 -14
  35. package/dist/registry/types.d.ts +0 -70
  36. package/dist/registry/uiOptions.d.ts +0 -17
  37. package/dist/registry/validate.d.ts +0 -4
  38. package/dist/status_extras.d.ts +0 -58
  39. package/dist/theme.d.ts +0 -51
  40. package/dist/tour.d.ts +0 -9
  41. package/dist/utils/numbering.d.ts +0 -23
@@ -1,1214 +0,0 @@
1
- import { type NumberingSystem } from "./utils/numbering";
2
- import { type OdontogramPlugin } from "./plugin";
3
- import type { FhirExportOptions } from "./fhir/types";
4
- import { type PerioClassification, type PerioDerivationInput } from "./perioClassification";
5
- import { type PdfExportOptions } from "./perioPdf";
6
- export declare const TEMPLATES: {
7
- 11: string;
8
- 13: string;
9
- 14: string;
10
- 16: string;
11
- };
12
- export declare const TOOTH_TEMPLATE: Map<number, {
13
- tpl: number;
14
- rot: number;
15
- mirror: boolean;
16
- }>;
17
- export declare function isAnteriorTooth(toothNo: number): boolean;
18
- export declare function isUpperTooth(toothNo: number): boolean;
19
- export declare function furcationEntrances(toothNo: number): string[];
20
- type Any = any;
21
- export declare const PERIO_SITES: readonly ["MB", "B", "DB", "ML", "L", "DL"];
22
- export type PerioSite = typeof PERIO_SITES[number];
23
- export type ChartMode = "status" | "plan";
24
- type CaseMeta = {
25
- age: number | null;
26
- smokingStatus: "unknown" | "never" | "former" | "current";
27
- cigarettesPerDay: number | null;
28
- diabetesStatus: "unknown" | "none" | "present";
29
- hba1c: number | null;
30
- toothLossPerio: number | null;
31
- maxRblPercent: number | null;
32
- /** P4b Task 2: per-axis clinician overrides for the 2017 World Workshop
33
- * periodontal classification (`getPerioClassification()`). Each is either
34
- * a valid enum value for that axis or `null` (not overridden — the
35
- * derived value from `derivePerioClassification` wins). Shared caseMeta
36
- * fields exactly like the rest of this object — NOT DS-1 gated. */
37
- diagnosisOverride: string | null;
38
- stageOverride: string | null;
39
- gradeOverride: string | null;
40
- extentOverride: string | null;
41
- /** UI-3b: PDF-report identity — patient display name + exam date (ISO
42
- * `YYYY-MM-DD`). Additive caseMeta fields; NOT emitted to FHIR. */
43
- patientName: string | null;
44
- examDate: string | null;
45
- };
46
- /** Current shared case-level metadata (age/smoking/diabetes/HbA1c/perio
47
- * summary stats). Not part of the status/plan dual-state — chart-independent. */
48
- export declare function getCaseMeta(): CaseMeta;
49
- export declare function setCaseAge(v: number | null): void;
50
- export declare function setCigarettesPerDay(v: number | null): void;
51
- export declare function setToothLossPerio(v: number | null): void;
52
- export declare function setMaxRblPercent(v: number | null): void;
53
- export declare function setHba1c(v: number | null): void;
54
- export declare function setSmokingStatus(v: string): void;
55
- export declare function setDiabetesStatus(v: string): void;
56
- /** P4b Task 2: per-axis classification override setters. Each accepts either
57
- * a valid enum value for that axis (see `VALID_DIAGNOSIS`/`VALID_STAGE`/
58
- * `VALID_GRADE`/`VALID_EXTENT`) OR `null` (clears the override, reverting
59
- * that axis to the derived value). An invalid non-null value is a silent
60
- * no-op — mirrors `setSmokingStatus`/`setDiabetesStatus` above. Shared
61
- * caseMeta fields, NOT DS-1 gated (same as every other caseMeta setter). */
62
- export declare function setDiagnosisOverride(v: string | null): void;
63
- export declare function setStageOverride(v: string | null): void;
64
- export declare function setGradeOverride(v: string | null): void;
65
- export declare function setExtentOverride(v: string | null): void;
66
- /** UI-3b Task 1: patient display name + exam date setters. Mirror the
67
- * existing caseMeta setter pattern — trim, `null`-clears, malformed
68
- * exam-date values are a silent no-op (mirrors `setSmokingStatus`). */
69
- export declare function setPatientName(v: string | null): void;
70
- export declare function setExamDate(v: string | null): void;
71
- export declare function resetCaseMeta(): void;
72
- /** Current active chart mode ("status" | "plan"). */
73
- export declare function getChartMode(): ChartMode;
74
- /** Whether a status-vs-plan divergence confirm is awaiting the user's choice. */
75
- export declare function isDualStateConfirmPending(): boolean;
76
- /** User accepted the divergence: run the deferred edit (status only — the plan
77
- * stays as planned), then notify (post-edit refresh + close the modal). No-op
78
- * when nothing is pending. */
79
- export declare function acceptDualStateConfirm(): void;
80
- /** User cancelled: do NOT apply the edit; re-sync the active tooth's controls
81
- * from stored state so the control the user just changed snaps back (no stale
82
- * UI), then notify (refresh + close the modal). No-op when nothing is pending. */
83
- export declare function cancelDualStateConfirm(): void;
84
- /**
85
- * Switch the active chart between "status" (current findings) and "plan"
86
- * (proposed treatment). The first time "plan" is entered, it is deep-cloned
87
- * from "status" (see {@link cloneChart}); later switches reuse the existing
88
- * plan chart untouched. Re-renders every tooth from the newly active chart
89
- * via the SAME full-repaint mechanism `importStatus()` uses, so no new
90
- * render path is introduced and SVG output stays byte-identical to the
91
- * single-chart render (parity is unaffected — only WHICH chart is active
92
- * changes, never how a chart renders).
93
- *
94
- * @param mode - "status" or "plan"; any other value is ignored.
95
- */
96
- export declare function setChartMode(mode: ChartMode): void;
97
- export declare function setIcdasEnabled(value: boolean): void;
98
- export declare function getIcdasEnabled(): boolean;
99
- export declare function setPulpDetailLevel(value: PulpDetailLevel): void;
100
- export declare function getPulpDetailLevel(): PulpDetailLevel;
101
- export type ToothDetailLevel = "simple" | "complex";
102
- export declare function setWearDetailLevel(value: ToothDetailLevel): void;
103
- export declare function getWearDetailLevel(): ToothDetailLevel;
104
- export declare function setDiscolorationDetailLevel(value: ToothDetailLevel): void;
105
- export declare function getDiscolorationDetailLevel(): ToothDetailLevel;
106
- export type SurfaceNotation = "simple" | "full";
107
- export declare function setSurfaceNotation(value: SurfaceNotation): void;
108
- export declare function getSurfaceNotation(): SurfaceNotation;
109
- export type SecondaryCariesMode = "simple" | "standard" | "full";
110
- export type RootCariesMode = "simple" | "severity";
111
- export type RadiographicDepthMode = "off" | "threeLevel" | "detailed";
112
- export declare function setSecondaryCariesMode(value: SecondaryCariesMode): void;
113
- export declare function getSecondaryCariesMode(): SecondaryCariesMode;
114
- export declare function setRootCariesMode(value: RootCariesMode): void;
115
- export declare function getRootCariesMode(): RootCariesMode;
116
- export declare function setRadiographicDepthMode(value: RadiographicDepthMode): void;
117
- export declare function getRadiographicDepthMode(): RadiographicDepthMode;
118
- export declare function setCariesDepthEnabled(value: boolean): void;
119
- export declare function getCariesDepthEnabled(): boolean;
120
- /**
121
- * Subscribe to odontogram state changes. The callback runs after any tooth
122
- * state edit, the edentulous toggle, or an import.
123
- *
124
- * @param cb - Callback invoked on each change.
125
- * @returns An unsubscribe function.
126
- */
127
- export declare function onStateChange(cb: () => void): () => void;
128
- /**
129
- * Render surface toggles in an anatomical cross/plus layout:
130
- * buccal (top), mesial (left), occlusal (center), distal (right), lingual (bottom).
131
- * Each item: { value, labelKey?, label?, letter, pos }. `pos` is one of
132
- * buccal|mesial|occlusal|distal|lingual and drives grid placement via a CSS class.
133
- * Keeps a hidden checkbox input (value=item.value) so existing state-sync works.
134
- */
135
- export declare function buildSurfaceCross(container: Any, items: Any, onToggle: Any): void;
136
- /** TEST-ONLY: apply {@link syncInflammationModVisibility} to a hand-built
137
- * `#modsChecks` DOM fragment, without requiring a live initOdontogram(). Not
138
- * part of the public API. */
139
- export declare function __syncInflammationModVisibilityForTest(container: Element, toothSelection: string): void;
140
- /** TEST-ONLY: apply {@link syncPeriImplantVisibility} to hand-built DOM
141
- * fragments, without requiring a live initOdontogram(). Not part of the
142
- * public API. */
143
- export declare function __syncPeriImplantVisibilityForTest(periImplantRow: Element | null, modsContainer: Element | null, toothSelection: string): void;
144
- export declare function __perioRowHiddenForTest(s: Record<string, unknown>): boolean;
145
- export declare function __restorationRowHiddenForTest(s: Record<string, unknown>): boolean;
146
- /** TEST-ONLY: apply a combined restoration-dropdown value to a state object,
147
- * exactly as the #restorationSelect change handler does. Not part of the public API. */
148
- export declare function __applyRestorationSelectionForTest(s: Record<string, unknown>, value: string): void;
149
- export declare function __mobilityRowHiddenForTest(s: Record<string, unknown>): boolean;
150
- export declare function __mobilityDisabledForTest(s: Record<string, unknown>): boolean;
151
- export declare function icdasTier(code: number): 1 | 2 | 3;
152
- export declare function threeLevelToIcdas(level: string): number;
153
- export declare function icdasToThreeLevel(code: number): string;
154
- /** CARS-score options for the per-surface secondary-caries picker at a given
155
- * granularity mode (defaults to the module setting). simple -> [0,3];
156
- * standard -> [0,1,3,6]; full -> [0..6]. Score 0 clears the surface. Pure. */
157
- export declare function secondaryCariesOptions(mode?: SecondaryCariesMode): {
158
- value: number;
159
- label: string;
160
- }[];
161
- /** Root-caries options at a given mode (defaults to the module setting).
162
- * simple -> none / present (present writes the canonical "active-cavitated"
163
- * enum — SP6 Task 3: the most-severe value, so simple-mode "present" renders
164
- * at full opacity); severity -> the full rootCaries enum. Pure. */
165
- export declare function rootCariesOptions(mode?: RootCariesMode): {
166
- value: string;
167
- label: string;
168
- }[];
169
- /** The rootCaries option value to SHOW for a stored value at a given mode
170
- * (display-only collapse; never mutates state). simple buckets every non-none
171
- * severity into the single "present" (=active-cavitated) option — matching the
172
- * canonical value rootCariesOptions("simple") now writes (SP6 Task 3) — so the
173
- * select's selected option always matches one of its own values; severity
174
- * shows it verbatim. Mirrors pulpDisplayValue. */
175
- export declare function rootCariesDisplayValue(mode: RootCariesMode, stored: string): string;
176
- /** Radiographic-depth options at a given mode (defaults to the module setting).
177
- * off -> [] (the control is hidden); threeLevel -> none + superficial/middle/
178
- * deep buckets (writing the representative E1/D1/D3 codes); detailed -> the
179
- * full none/E1/E2/D1/D2/D3 scale. "none" clears the surface. Pure. */
180
- export declare function radiographicDepthOptions(mode?: RadiographicDepthMode): {
181
- value: string;
182
- label: string;
183
- }[];
184
- /** Set/clear a per-surface CARS secondary-caries score on `map` (score 0
185
- * clears). Extracted so the surface-write path is unit-testable without the
186
- * DOM. */
187
- export declare function applySecondaryCariesScore(map: Map<string, number>, surface: string, score: number): void;
188
- /** SP6 Task 2: the recurrent (secondary) caries transition on a FILLED surface.
189
- * The CARS group of the contextual popup drives the caries state-machine on a
190
- * surface that carries a filling:
191
- * - score 0 (Sound) → remove the caries from the surface (revert to a plain
192
- * filling) and clear its severity;
193
- * - score > 0 → add the caries to the surface (becomes recurrent /
194
- * `subcaries-{surface}`) and store the CARS value as its severity.
195
- * Guarded on the filling actually being present, so a CARS score never lands
196
- * on a surface without a filling (that would be primary caries, authored via
197
- * the depth group instead). Mutates `state.caries` (Set of `caries-{surface}`)
198
- * and `state.cariesSeverity` (Map surface→0..6). Extracted so the two
199
- * transitions are unit-testable without the DOM. */
200
- export declare function applyRecurrentCariesScore(state: {
201
- caries: Set<string>;
202
- cariesSeverity: Map<string, number>;
203
- fillingSurfaceMaterials: Map<string, string>;
204
- }, surface: string, score: number): void;
205
- /** Set/clear a per-surface radiographic-depth value on `map` ("none"/empty
206
- * clears). Extracted for unit-testing the surface-write path. */
207
- export declare function applyRadiographicDepth(map: Map<string, string>, surface: string, value: string): void;
208
- /** Set/clear a per-surface filling-defect value on `map` ("none"/empty clears).
209
- * Extracted for unit-testing the surface-write path. */
210
- export declare function applyFillingDefect(map: Map<string, string>, surface: string, value: string): void;
211
- export type PulpDetailLevel = "simple" | "aae" | "latin";
212
- export declare const PULP_LATIN_PARENT: Record<string, string>;
213
- /** Option {value,labelKey} list for the pulp control at a given detail level.
214
- * simple -> 2 (healthy / pulpitis); aae -> the 4 pulpDx values; latin -> the 9
215
- * pulpLatin subtypes. The "latin" branch consults `ClinicalAxis.flag`
216
- * (`isAxisFlagSatisfied` — the first consumer of the registry feature-flag
217
- * gate). Pure; reads no module state. */
218
- export declare function pulpSelectOptionValues(level: PulpDetailLevel): {
219
- value: string;
220
- labelKey: string;
221
- }[];
222
- /** Maps a pulp-control selection to the {pulpDx,pulpLatin} it writes. At "latin"
223
- * the selected Latin value sets `pulpLatin` and its parent `pulpDx`; at
224
- * "simple"/"aae" the value is a `pulpDx` and `pulpLatin` is cleared to "none". */
225
- /** SP7: the periapical lesion subtype (granuloma / cyst) is a refinement of
226
- * apical periodontitis, so its row (#periapicalTypeRow) shows only when the
227
- * apical diagnosis is symptomatic or asymptomatic apical periodontitis. Other
228
- * apicalDx values (abscess forms, condensing osteitis, normal) carry no
229
- * granuloma/cyst refinement. Non-present teeth keep apicalDx="normal" (their
230
- * glyph is driven by mods.inflammation in the render, unchanged) so the row is
231
- * hidden for them — subtype authoring on implant/missing is deferred to the
232
- * peri-implantitis sub-project. */
233
- export declare function periapicalRowVisible(state: Any): boolean;
234
- export declare function pulpSelectionToState(level: PulpDetailLevel, value: string): {
235
- pulpDx: string;
236
- pulpLatin: string;
237
- };
238
- /** The option value to SHOW for a stored state at a given level (display-only
239
- * collapse; never mutates state). latin -> stored pulpLatin (or a representative
240
- * for pulpDx when only pulpDx is set); aae -> pulpDx; simple -> healthy vs. the
241
- * single pulpitis bucket. */
242
- export declare function pulpDisplayValue(level: PulpDetailLevel, state: {
243
- pulpDx?: string;
244
- pulpLatin?: string;
245
- }): string;
246
- export declare function isEndoValue(value: string): boolean;
247
- export declare function pulpEndoDisplayValue(state: Any): string;
248
- export declare function buildPulpEndoSelect(sel: Any, isMilktooth: boolean, selected: string): void;
249
- export declare function pulpEndoOnSelect(s: Any, value: string): void;
250
- export declare function __wearRowAllowedForTest(s: Record<string, unknown>): boolean;
251
- export declare function __discolorationAllowedForTest(s: Record<string, unknown>): boolean;
252
- export declare function __discolorationRowAllowedForTest(s: Record<string, unknown>): boolean;
253
- export declare function __orthoAllowedForTest(s: Record<string, unknown>): boolean;
254
- export declare function __orthoCardAllowedForTest(s: Record<string, unknown>): boolean;
255
- /** TEST-ONLY: apply a #periImplantSelect value to a state object, exactly as
256
- * the change handler does. Not part of the public API. */
257
- export declare function __applyPeriImplantSelectionForTest(s: Record<string, unknown>, value: string): void;
258
- /** TEST-ONLY: invoke `applyProposedStyling` directly on a detached, already-
259
- * painted svg node (as returned by `__parseSvgForTest` + `__renderActiveLayersOnNode`),
260
- * without requiring a live grid (`toothSvgRoot`/`applyStateToSvg` needs
261
- * registered DOM roots — see addTile()). Reads the module's live
262
- * `charts`/`chartMode`/`planInitialized`, exactly as the real
263
- * `applyStateToSvg` roots loop does. Not part of the public API. */
264
- export declare function __applyProposedStylingForTest(toothNo: Any, svg: Any): void;
265
- /** TEST-ONLY: render `serialized` state onto a fresh copy of `rawSvgText` and return the
266
- * in-document-order active-layer fingerprint (id + opacity + class per element). Used by
267
- * the SP2 parity harness; not part of the public API. */
268
- export declare function __renderActiveLayers(rawSvgText: string, toothNo: number, serialized: Record<string, unknown>): {
269
- id: string;
270
- opacity: string;
271
- cls: string;
272
- }[];
273
- /** TEST-ONLY: parse `rawSvgText` once (same prep `__renderActiveLayers` does —
274
- * strip display:none to data-active, seed missing data-active defaults) and
275
- * return the live parsed element. Pair with `__renderActiveLayersOnNode` to
276
- * render multiple states onto the SAME node, reproducing how the live app
277
- * reuses one persistent SVG DOM node per tooth across renders (unlike
278
- * `__renderActiveLayers`, which re-parses a fresh node every call and so
279
- * cannot catch a render that fails to reset state a prior render left
280
- * behind). Not part of the public API. */
281
- export declare function __parseSvgForTest(rawSvgText: string): Any;
282
- /** TEST-ONLY: hydrate `serialized` and render it onto an already-parsed `svg`
283
- * node (as returned by `__parseSvgForTest`), reusing that SAME node — see
284
- * `__parseSvgForTest` for why this matters. Returns the in-document-order
285
- * active-layer fingerprint, same shape as `__renderActiveLayers`. Not part
286
- * of the public API. */
287
- export declare function __renderActiveLayersOnNode(svg: Any, toothNo: number, serialized: Record<string, unknown>): {
288
- id: string;
289
- opacity: string;
290
- cls: string;
291
- }[];
292
- /** TEST-ONLY: hydrate `raw` and store it as `toothNo`'s state directly in the
293
- * module-level state map, bypassing all DOM/UI wiring (no initOdontogram()
294
- * required). Lets summary/warning getters be exercised without a live SVG grid.
295
- * Not part of the public API. */
296
- export declare function __setToothStateForTest(toothNo: number, raw: Record<string, unknown>, version?: string): void;
297
- /** TEST-ONLY: read back a tooth's current state as a plain object (Sets/Maps
298
- * converted to arrays/objects for easy assertions). Not part of the public API. */
299
- export declare function __getToothStateForTest(toothNo: number): Record<string, unknown> | undefined;
300
- /** TEST-ONLY (R2-A Task 1 seam, kept until T2's public getStatusChart()
301
- * supersedes it): read back a tooth's state from the STATUS chart
302
- * regardless of which chart is currently active. Not part of the public API. */
303
- export declare function __getStatusStateForTest(toothNo: number): Record<string, unknown> | undefined;
304
- /** TEST-ONLY (R2-A Task 1 seam, kept until T2's public getPlanChart()
305
- * supersedes it): read back a tooth's state from the PLAN chart regardless
306
- * of which chart is currently active. Not part of the public API. */
307
- export declare function __getPlanStateForTest(toothNo: number): Record<string, unknown> | undefined;
308
- /** TEST-ONLY (R2-A Task 1 seam): fully reset the dual-chart container —
309
- * clears BOTH charts, drops `planInitialized`, and returns to "status"
310
- * mode — without requiring a live DOM/initToken the way destroyOdontogram()
311
- * does. Lets each test in a suite start from a clean slate instead of
312
- * leaking `planInitialized`/chart contents across tests in the same module
313
- * instance. Not part of the public API. */
314
- export declare function __resetChartStateForTest(): void;
315
- /** TEST-ONLY (DS-1 Task 2 seam): set the active tooth (and lazily vivify its
316
- * state) so a control-revert test can exercise `revertActiveControls()`
317
- * against a real active tooth without going through the DOM tooth grid. Not
318
- * part of the public API. */
319
- export declare function __setActiveToothForTest(toothNo: number | null): void;
320
- /** TEST-ONLY (DS-1 Task 1 seam): snapshot of the teeth currently flagged as
321
- * plan-edited (a COPY — mutating it never touches module state). Not part of
322
- * the public API. */
323
- export declare function __planEditedTeethForTest(): number[];
324
- /** TEST-ONLY (DS-1 Task 1 seam): invoke {@link mirrorStatusToPlan} directly so
325
- * the deep-copy behavior can be exercised without going through the gate. Not
326
- * part of the public API. */
327
- export declare function __mirrorStatusToPlanForTest(toothNo: number): void;
328
- /** TEST-ONLY (DS-1 review-fix seam): drive {@link setEdentulous} directly so the
329
- * gated whole-mouth structural edit can be exercised without a live DOM/
330
- * initOdontogram() token. Not part of the public API. */
331
- export declare function __setEdentulousForTest(on: boolean): void;
332
- /** TEST-ONLY (DS-1 review-fix seam): drive the single-tooth reset through the
333
- * same code path as the zoom-popover / context-menu reset buttons, without a
334
- * live DOM/initOdontogram() token. Not part of the public API. */
335
- export declare function __resetToothForTest(toothNo: number): void;
336
- /** TEST-ONLY (DS-1 review-fix seam): drive the multi-tooth (selection) reset
337
- * through the same code path as the "Reset selected teeth" button, without a
338
- * live DOM/initOdontogram() token. Not part of the public API. */
339
- export declare function __resetTeethForTest(toothNos: number[]): void;
340
- /** TEST-ONLY (DS-1 review-fix seam): drive a dentition preset through the same
341
- * code path as the #btnPrimaryDentition / #btnMixedDentition buttons, without a
342
- * live DOM/initOdontogram() token. Not part of the public API. */
343
- export declare function __applyDentitionPresetForTest(kind: "primary" | "mixed"): void;
344
- /** TEST-ONLY: set the module-level `showHealthyPulp` flag directly, without the
345
- * DOM/all-teeth side effects `setHealthyPulpVisible` performs (button toggle
346
- * state, re-rendering every tooth in `ALL_TEETH`) — needed so `__renderActiveLayers`
347
- * callers can exercise both the "healthy pulp shown" and "hidden" render paths
348
- * in isolation. Not part of the public API. */
349
- export declare function __setShowHealthyPulpForTest(on: boolean): void;
350
- /** TEST-ONLY: run the clinical-consistency warning checks against a plain state
351
- * object (no DOM/SVG involved). Not part of the public API. */
352
- export declare function __getStateWarnings(state: Any): string[];
353
- /** TEST-ONLY: apply `syncSurfaceDepthIndicator`'s per-surface indicator-attribute
354
- * logic (ICDAS `data-depth`/`data-icdas` badge + SP5 Task 4 `data-radio`) to a
355
- * single hand-built `.surface-cell` element, without requiring a live grid /
356
- * `initOdontogram()` (which needs real SVG-asset fetches). Not part of the
357
- * public API. */
358
- export declare function __syncSurfaceDepthIndicatorForTest(cell: Element, state: Record<string, unknown>): void;
359
- /** TEST-ONLY sibling of {@link __syncSurfaceDepthIndicatorForTest} for the
360
- * filling-surface recurrent-caries indicator. Not part of the public API. */
361
- export declare function __syncFillingSubcariesIndicatorForTest(cell: Element, state: Record<string, unknown>): void;
362
- /** TEST-ONLY sibling of {@link __syncFillingSubcariesIndicatorForTest} for the
363
- * filling-defect indicator. Not part of the public API. */
364
- export declare function __syncFillingDefectIndicatorForTest(cell: Element, state: Record<string, unknown>): void;
365
- /** A minimal shape covering what {@link subcariesLettersForTooth} and
366
- * {@link computeFillingSubcariesSummaryLine} read from a tooth state. */
367
- type SubcariesStateLike = {
368
- caries?: Set<string>;
369
- fillingSurfaceMaterials?: Map<string, string>;
370
- } | undefined | null;
371
- /** SP6 Task 4 (§7): the recurrent ("sub") caries surfaces on ONE tooth — a
372
- * surface carries BOTH caries and a filling (`state.caries` has
373
- * `caries-{surface}` AND `state.fillingSurfaceMaterials` has `{surface}`).
374
- * Returns the surfaces' letters, in the codebase's existing anatomical order
375
- * (`SUMMARY_SURFACE_ORDER`: B, M, O, D, L), concatenated with no separator
376
- * (e.g. "MOD", "B"); "" when the tooth has no recurrent-caries surface.
377
- * On an anterior tooth (§8) the occlusal/incisal surface's letter is "I"
378
- * instead of "O" (the stored value is still plain "occlusal"). Pure and
379
- * exported for direct unit testing. */
380
- export declare function subcariesLettersForTooth(toothNo: number, state: SubcariesStateLike): string;
381
- /** SP6 Task 4 (§7): the "Fillings and restorative" panel's informational
382
- * subcaries-summary line — one entry per SELECTED tooth that has recurrent
383
- * caries (see {@link subcariesLettersForTooth}), in `ALL_TEETH` order, styled
384
- * "{FDI} ({letters})" and joined with ", ". Uses the singular phrasing
385
- * (`filling.subcariesSummarySingle`) for exactly one such tooth, the plural
386
- * (`filling.subcariesSummaryMultiple`) for more than one, and returns "" (no
387
- * line — purely informational, hidden when empty) when none of the selected
388
- * teeth have a recurrent-caries surface.
389
- *
390
- * Pure/testable: takes the selected tooth numbers and a state lookup instead
391
- * of reading the module's `selectedTeeth`/`toothState` globals directly. */
392
- export declare function computeFillingSubcariesSummaryLine(selectedToothNos: Iterable<number>, getState: (toothNo: number) => SubcariesStateLike): string;
393
- /** A minimal shape covering what {@link fillingDefectLettersForTooth} and
394
- * {@link computeFillingDefectSummaryLine} read from a tooth state. */
395
- type FillingDefectStateLike = {
396
- fillingDefect?: Map<string, string>;
397
- fillingSurfaceMaterials?: Map<string, string>;
398
- restorationType?: string;
399
- } | undefined | null;
400
- /** SP16 Task 1: the filling-defect surfaces on ONE tooth, parallel to
401
- * {@link subcariesLettersForTooth} — a surface carries a defect when it is
402
- * BOTH present in `fillingSurfaceMaterials` AND has a non-"none"
403
- * `fillingDefect` entry, gated the SAME way the existing whole-mouth
404
- * filling-defect summary is (`restorationType === "none"`, i.e. defects are
405
- * suppressed under a crown/bridge — see the `defects` derivation in
406
- * {@link getOdontogramSummary}). Returns the surfaces' letters in
407
- * `SUMMARY_SURFACE_ORDER`, concatenated with no separator; "" when the tooth
408
- * has no defect surface (or no state). Pure and exported for direct unit
409
- * testing. */
410
- export declare function fillingDefectLettersForTooth(toothNo: number, state: FillingDefectStateLike): string;
411
- /** SP16 Task 1: the "Fillings and restorative" panel's informational
412
- * filling-defect-summary line, parallel to {@link computeFillingSubcariesSummaryLine}
413
- * — one entry per SELECTED tooth that has a filling-defect surface (see
414
- * {@link fillingDefectLettersForTooth}), in `ALL_TEETH` order, styled
415
- * "{FDI} ({letters})" and joined with ", ". Uses the singular phrasing
416
- * (`filling.fillingDefectSummarySingle`) for exactly one such tooth, the
417
- * plural (`filling.fillingDefectSummaryMultiple`) for more than one, and
418
- * returns "" (no line — purely informational, hidden when empty) when none
419
- * of the selected teeth have a defect surface.
420
- *
421
- * Pure/testable: takes the selected tooth numbers and a state lookup instead
422
- * of reading the module's `selectedTeeth`/`toothState` globals directly. */
423
- export declare function computeFillingDefectSummaryLine(selectedToothNos: Iterable<number>, getState: (toothNo: number) => FillingDefectStateLike): string;
424
- /** TEST-ONLY: apply {@link syncToothDetailControls} to a hand-built DOM
425
- * fragment (the wear/discoloration select+toggle labels and checkboxes),
426
- * without requiring a live initOdontogram(). Mirrors
427
- * __syncInflammationModVisibilityForTest. Not part of the public API. */
428
- export declare function __syncToothDetailControlsForTest(state: Record<string, unknown>): void;
429
- /** TEST-ONLY: apply {@link syncPerioRow} to a hand-built #perioRow DOM
430
- * fragment for a given `toothNo`, without requiring a live initOdontogram()
431
- * or a real `activeTooth`. Mirrors __syncToothDetailControlsForTest /
432
- * __syncInflammationModVisibilityForTest. Not part of the public API. */
433
- export declare function __syncPerioRowForTest(state: Record<string, unknown>, toothNo: number): void;
434
- /** TEST-ONLY: apply {@link buildPerioGrid} to a hand-built container, without
435
- * requiring a live initOdontogram() (there is no full-DOM mount harness for
436
- * the tooth panel — see sp14-ortho-ui.test.ts's header comment). Lets a test
437
- * verify the real grid-building DOM shape (ids/data-attributes/types) that
438
- * production wireControls() builds once at init. Not part of the public API. */
439
- export declare function __buildPerioGridForTest(container: Element): void;
440
- /** Popup to author a single caries surface on the selected teeth. Beyond the
441
- * original visual caries-depth (ICDAS/3-level) picker it now offers, in the
442
- * SAME anchored popup (SP5 Task 5): a per-surface secondary-caries CARS-score
443
- * picker and — only when `radiographicDepthMode !== "off"` — a per-surface
444
- * radiographic-depth picker. Each group's option list follows its granularity
445
- * mode; the depth group itself is hidden when `cariesDepthEnabled` is off. */
446
- /** SP16 Task 2: resolves the DISPLAY LETTER for a caries/filling surface,
447
- * respecting the `surfaceNotation` setting ("full", default) and — in full
448
- * mode — the tooth's arch (upper/lower) and anterior/posterior position.
449
- *
450
- * FULL: occlusal -> "I" (incisal) on an anterior tooth, else "O" (occlusal);
451
- * buccal -> "L" (labial) on an anterior tooth, else "B" (buccal); lingual ->
452
- * "P" (palatal) on an upper tooth, else "L" (lingual) — on a LOWER ANTERIOR
453
- * tooth this means BOTH buccal(labial) and lingual(lingual) letter as "L"
454
- * (ratified: position in the surface-cross and the caption disambiguate; a
455
- * "(L, L)"-style summary is inherently ambiguous, which is accepted).
456
- * mesial -> "M", distal -> "D", subcrown -> "SC" always.
457
- *
458
- * SIMPLE: always the tooth-independent B/M/O/D/L/SC set, regardless of
459
- * position. Exported so both {@link summarySurfaceLetter} and the live
460
- * surface-cross UI (buildSurfaceCross/refreshCheckLabels) share one source
461
- * of truth. */
462
- export declare function surfaceLetter(surface: string, toothNo?: number | null): string;
463
- /** Maps a caries surface identifier to its existing i18n surface-label key,
464
- * so the popup header can read e.g. "Caries details – Buccal". Falls back to
465
- * the raw surface string for any (unexpected) unmapped value.
466
- *
467
- * SP6 Task 4 (§8): when `toothNo` is given and is an anterior tooth
468
- * (incisor/canine), the "occlusal" surface DISPLAYS as "incisal"
469
- * (`surface.incisal`) instead of `surface.occlusal` — the stored surface
470
- * value is unaffected, this only changes which i18n key the label resolves
471
- * to.
472
- *
473
- * SP16 Task 2: extended to be arch/anterior-aware for ALL of
474
- * occlusal/buccal/lingual, gated on the `surfaceNotation` setting. In
475
- * "full" mode (default): occlusal -> incisal (anterior), buccal -> labial
476
- * (anterior), lingual -> palatal (upper) / lingual (lower, a NEW key
477
- * separate from the combined `surface.lingualPalatal`). In "simple" mode
478
- * the generic, tooth-independent keys are always used
479
- * (buccal/occlusal/lingualPalatal). Exported so it can be unit-tested
480
- * directly. */
481
- export declare function surfaceLabelKey(surface: string, toothNo?: number | null): string;
482
- /** Toggle visibility of wisdom teeth (18, 28, 38, 48). */
483
- declare function setWisdomVisible(on: Any): void;
484
- /** Toggle visibility of the bone/gum base layer on all teeth. */
485
- declare function setShowBase(on: Any): void;
486
- /** Toggle visibility of occlusal-view tiles (premolars and molars). */
487
- declare function setOcclusalVisible(on: Any): void;
488
- /** Toggle visibility of the healthy-pulp layer on all teeth. */
489
- declare function setHealthyPulpVisible(on: Any): void;
490
- export declare const VALID_TOOTH_SELECTION: Set<string>;
491
- export declare const VALID_ENDO: Set<string>;
492
- export declare const VALID_FILLING_MATERIAL: Set<string>;
493
- export declare const VALID_PROSTHESIS: Set<string>;
494
- export declare const VALID_MOBILITY: Set<string>;
495
- export declare const VALID_TOOTH_SUBSTRATE: Set<string>;
496
- export declare const VALID_RESTORATION_TYPE: Set<string>;
497
- export declare const VALID_RESTORATION_MATERIAL: Set<string>;
498
- export declare const VALID_MODS: Set<string>;
499
- export declare const VALID_PERIAPICAL_TYPE: Set<string>;
500
- export declare const VALID_CARIES: Set<string>;
501
- export declare const VALID_PULP_DX: Set<string>;
502
- export declare const VALID_PULP_LATIN: Set<string>;
503
- export declare const VALID_APICAL_DX: Set<string>;
504
- export declare const VALID_RESORPTION_TYPE: Set<string>;
505
- export declare const VALID_WEAR_EDGE: Set<string>;
506
- export declare const VALID_WEAR_CERVICAL: Set<string>;
507
- export declare const VALID_DISCOLORATION: Set<string>;
508
- export declare const VALID_ORTHO_APPLIANCE: Set<string>;
509
- export declare const VALID_ORTHO_DRIFT: Set<string>;
510
- export declare const VALID_ORTHO_VERTICAL: Set<string>;
511
- export declare const VALID_FILLING_SURFACES: Set<string>;
512
- export declare const VALID_ROOT_CARIES: Set<string>;
513
- export declare const VALID_PERI_IMPLANT: Set<string>;
514
- export declare const VALID_CEJ_VISIBILITY: Set<string>;
515
- export declare const VALID_ROOT_CONCAVITY: Set<string>;
516
- export declare const VALID_GINGIVAL_THICKNESS: Set<string>;
517
- export declare const VALID_MILLER_CLASS: Set<string>;
518
- export declare const VALID_CARS: Set<number>;
519
- export declare const VALID_CARIES_SEVERITY: Set<number>;
520
- export declare const VALID_RADIOGRAPHIC_DEPTH: Set<string>;
521
- export declare const VALID_FILLING_DEFECT: Set<string>;
522
- export declare const VALID_FILLING_DEFECT_SET: Set<string>;
523
- export declare const VALID_FURCATION_ENTRANCE: Set<string>;
524
- export declare const VALID_FURCATION_GRADE: Set<number>;
525
- export declare const VALID_PLAQUE_SURFACE: Set<string>;
526
- /** TEST-ONLY: collect the full export payload ({version, globals, teeth[,
527
- * plan]}) exactly as exportStatus()/exportFhir() would serialize it.
528
- * Not part of the public API. */
529
- export declare function __collectExportPayloadForTest(): Any;
530
- /**
531
- * Export the STATUS chart's payload — identical to exportStatus()'s JSON
532
- * (status-primary; unaffected by the current chart mode).
533
- */
534
- export declare function getStatusChart(): Any;
535
- /**
536
- * Export the PLAN chart's payload alone: same shape as the status export
537
- * (`{version, globals, teeth}`), but `teeth` is collected from `charts.plan`.
538
- * `globals` are shared app-level settings, not owned by either chart.
539
- */
540
- export declare function getPlanChart(): Any;
541
- /**
542
- * Hydrate `payload.teeth` into the PLAN chart ONLY (status is left
543
- * untouched), mirroring the per-tooth hydrate importStatus() performs for
544
- * the status chart. Marks the plan chart initialized. Repaints the DOM only
545
- * when PLAN is the currently active chart mode — hydrating a chart that
546
- * isn't on screen must not visibly disturb whatever IS on screen (mirrors
547
- * setChartMode()'s own full-repaint-on-activation behavior).
548
- */
549
- export declare function setPlanChart(payload: Any): void;
550
- export type PlanChange = {
551
- toothNo: number;
552
- axis: string;
553
- from: string;
554
- to: string;
555
- };
556
- /**
557
- * Compare the "status" chart against the "plan" chart, tooth by tooth and
558
- * axis by axis (see {@link DIFF_AXES}), and report every axis whose label
559
- * differs. Pure and read-only: never mutates either chart, never touches the
560
- * DOM, never renders — a `parity.test.ts`-safe addition.
561
- *
562
- * Returns `[]` whenever the plan chart hasn't been initialized yet (no plan
563
- * exists to diff against). A tooth absent from either chart resolves via
564
- * `defaultState()`, so a status-only or plan-only tooth still diffs correctly
565
- * against the clinical default rather than throwing.
566
- *
567
- * Iterates the fixed `ALL_TEETH` list (not chart key insertion order), so
568
- * results are always grouped by tooth in the same stable clinical order the
569
- * rest of the app already uses (quadrant-by-quadrant); within a tooth,
570
- * entries follow `DIFF_AXES` order.
571
- */
572
- export declare function getPlanChanges(): PlanChange[];
573
- type PerioSitePatch = {
574
- pd?: number | null;
575
- gm?: number;
576
- bop?: boolean;
577
- sup?: boolean;
578
- };
579
- type PlainPerio = {
580
- pd: Record<string, number>;
581
- gm: Record<string, number>;
582
- bop: string[];
583
- sup: string[];
584
- };
585
- /**
586
- * Set/clear one perio site's reading(s) on the active chart's tooth.
587
- *
588
- * - `pd` is the CHARTING key. `null`/`undefined`/any value `< 1` UN-CHARTS
589
- * the site — it is removed from `pd`, `gm`, `bop`, AND `sup` in one atomic
590
- * step (never leaves an orphaned gm/bop/sup behind). A non-integer `pd`
591
- * (e.g. 6.5) is instead REJECTED outright: the whole call is a no-op and
592
- * state stays unchanged (no partial write). A valid integer `pd` is
593
- * clamped to 1–15.
594
- * - `gm`/`bop`/`sup` only ever apply to an ALREADY-charted site (this call's
595
- * own `pd`, or a previously-charted one) — supplying them for a site with
596
- * no charted `pd` is a silent no-op, preserving the "absence = not
597
- * charted" invariant. `gm` is clamped to −10…+20; a non-integer `gm` is
598
- * rejected (that one field is left unset/unchanged, the rest of the patch
599
- * still applies).
600
- * - An unrecognized `site` (not one of {@link PERIO_SITES}) is a silent no-op.
601
- *
602
- * Fires {@link onStateChange} listeners (via `notifyStateChange()`) whenever
603
- * it actually mutates state; never on a rejected/no-op call.
604
- */
605
- export declare function setPerioSite(toothNo: number, site: string, patch: PerioSitePatch): void;
606
- /** Read a tooth's perio sub-record from the active chart as a PLAIN object
607
- * (Maps/Sets converted to a fresh Record/Array each call — safe to mutate,
608
- * never aliases live state). A tooth with no charted sites (or never
609
- * touched at all) returns the empty-but-defined shape, never `undefined`. */
610
- export declare function getToothPerio(toothNo: number): PlainPerio;
611
- /**
612
- * Set/clear one furcation entrance's Glickman grade on the active chart's
613
- * tooth.
614
- *
615
- * - `entrance` must be one of {@link furcationEntrances}(toothNo) for THIS
616
- * tooth (position-gated — e.g. "lingual" is rejected on an upper molar,
617
- * which only ever offers mesial/distal/buccal). Any other entrance,
618
- * including one valid for a different tooth position, is a silent no-op.
619
- * - `grade` must be an integer 1-4 (Glickman I-IV) to set/overwrite the
620
- * entrance; `null`/`undefined` clears it; anything else (non-integer,
621
- * out-of-range) is a silent no-op — state stays unchanged.
622
- *
623
- * Fires {@link notifyStateChange} whenever it actually mutates state; never
624
- * on a rejected/no-op call.
625
- */
626
- export declare function setFurcation(toothNo: number, entrance: string, grade: number | null | undefined): void;
627
- /** Read a tooth's furcation sub-record from the active chart as a PLAIN
628
- * object (entrance -> grade), safe to mutate, never aliases live state. A
629
- * tooth with no graded entrance (or never touched at all) returns `{}`. */
630
- export declare function getToothFurcation(toothNo: number): Record<string, number>;
631
- /**
632
- * Set/clear one O'Leary plaque-index surface's presence on the active
633
- * chart's tooth.
634
- *
635
- * - `surface` must be one of {@link VALID_PLAQUE_SURFACE} (mesial/distal/
636
- * buccal/lingual — the SAME fixed set for every tooth, no per-tooth-
637
- * position gating like furcation's entrances). Any other value is a
638
- * silent no-op.
639
- * - `present` truthy adds the surface to the set (plaque present); falsy
640
- * removes it (clean/not recorded).
641
- *
642
- * Fires {@link notifyStateChange} whenever it actually mutates state; never
643
- * on a rejected/no-op call.
644
- */
645
- export declare function setPlaque(toothNo: number, surface: string, present: boolean): void;
646
- /** Read a tooth's plaque sub-record from the active chart as a PLAIN array
647
- * of present surfaces, safe to mutate, never aliases live state. A tooth
648
- * with no plaque surface (or never touched at all) returns `[]`. */
649
- export declare function getToothPlaque(toothNo: number): string[];
650
- /** Read a tooth's Silness-Löe Plaque Index grade on one surface from the
651
- * active chart. Grade 0 (default) means healthy/absent — never distinct
652
- * from "never charted". */
653
- export declare function getPlaqueIndex(toothNo: number, surface: string): 0 | 1 | 2 | 3;
654
- /** Set/clear a tooth's Silness-Löe Plaque Index grade on one surface on the
655
- * active chart. See {@link setSurfaceGrade} for validation/no-op semantics. */
656
- export declare function setPlaqueIndex(toothNo: number, surface: string, grade: number): void;
657
- /** Read a tooth's Löe-Silness Gingival Index grade on one surface from the
658
- * active chart. Grade 0 (default) means healthy/absent — never distinct
659
- * from "never charted". */
660
- export declare function getGingivalIndex(toothNo: number, surface: string): 0 | 1 | 2 | 3;
661
- /** Set/clear a tooth's Löe-Silness Gingival Index grade on one surface on the
662
- * active chart. See {@link setSurfaceGrade} for validation/no-op semantics. */
663
- export declare function setGingivalIndex(toothNo: number, surface: string, grade: number): void;
664
- /** Read a tooth's Mombelli modified Plaque Index grade on one surface from
665
- * the active chart. Grade 0 (default) means healthy/absent — never distinct
666
- * from "never charted". Implant-only in practice (see setter), but the
667
- * getter itself is unconditional (mirrors PI/GI/every other graded axis). */
668
- export declare function getPeriImplantPlaque(toothNo: number, surface: string): 0 | 1 | 2 | 3;
669
- /** Set/clear a tooth's Mombelli modified Plaque Index grade on one surface on
670
- * the active chart. Silent no-op unless the tooth is an implant
671
- * (`toothSelection === "implant"`) — see `setSurfaceGrade` for the guard. */
672
- export declare function setPeriImplantPlaque(toothNo: number, surface: string, grade: number): void;
673
- /** Read a tooth's Mombelli modified sulcus Bleeding Index grade on one
674
- * surface from the active chart. Grade 0 (default) means healthy/absent —
675
- * never distinct from "never charted". */
676
- export declare function getPeriImplantBleeding(toothNo: number, surface: string): 0 | 1 | 2 | 3;
677
- /** Set/clear a tooth's Mombelli modified sulcus Bleeding Index grade on one
678
- * surface on the active chart. Silent no-op unless the tooth is an implant
679
- * (`toothSelection === "implant"`) — see `setSurfaceGrade` for the guard. */
680
- export declare function setPeriImplantBleeding(toothNo: number, surface: string, grade: number): void;
681
- /** Read a tooth's keratinized gingiva width (mm) from the active chart.
682
- * `null` means not charted. */
683
- export declare function getKeratinizedWidth(toothNo: number): number | null;
684
- /**
685
- * Set/clear a tooth's keratinized gingiva width (mm) on the active chart.
686
- *
687
- * - `mm === null` explicitly clears it (not charted).
688
- * - Any other value is clamped to an integer 0-15 via {@link clampKg}.
689
- * - A non-finite number (e.g. `NaN` from a bad keystroke) is a silent no-op
690
- * — it must NOT clear an existing value, unlike an explicit `null`.
691
- *
692
- * Fires {@link notifyStateChange} whenever it actually mutates state; never
693
- * on a rejected/no-op call — `gateToothEdit`'s `applyFn` returns `false` for
694
- * a no-op so the DS-1 protocol never marks/mirrors a tooth that didn't change.
695
- */
696
- export declare function setKeratinizedWidth(toothNo: number, mm: number | null): void;
697
- /**
698
- * Set a tooth's CEJ-visibility on the active chart. `value` must be one of
699
- * {@link VALID_CEJ_VISIBILITY} (none | detectable | not-detectable); anything
700
- * else is a silent no-op (state unchanged). Fires {@link notifyStateChange}
701
- * only when it actually changes state; never on a rejected/no-op call.
702
- */
703
- export declare function setCejVisibility(toothNo: number, value: string): void;
704
- /** Read a tooth's CEJ-visibility from the active chart. A tooth never touched
705
- * (or with the default) returns "none". */
706
- export declare function getCejVisibility(toothNo: number): string;
707
- /**
708
- * Set a tooth's root-concavity on the active chart. `value` must be one of
709
- * {@link VALID_ROOT_CONCAVITY} (none | mild | deep); anything else is a silent
710
- * no-op (state unchanged). Fires {@link notifyStateChange} only when it
711
- * actually changes state; never on a rejected/no-op call.
712
- */
713
- export declare function setRootConcavity(toothNo: number, value: string): void;
714
- /** Read a tooth's root-concavity from the active chart. A tooth never touched
715
- * (or with the default) returns "none". */
716
- export declare function getRootConcavity(toothNo: number): string;
717
- /**
718
- * Set a tooth's gingival-thickness on the active chart. `value` must be one
719
- * of {@link VALID_GINGIVAL_THICKNESS} (unknown | thin | medium | thick);
720
- * anything else is a silent no-op (state unchanged). Fires
721
- * {@link notifyStateChange} only when it actually changes state; never on a
722
- * rejected/no-op call.
723
- */
724
- export declare function setGingivalThickness(toothNo: number, value: string): void;
725
- /** Read a tooth's gingival-thickness from the active chart. A tooth never
726
- * touched (or with the default) returns "unknown". */
727
- export declare function getGingivalThickness(toothNo: number): string;
728
- /**
729
- * Set a tooth's Miller recession class on the active chart. `value` must be
730
- * one of {@link VALID_MILLER_CLASS} (none | i | ii | iii | iv); anything else
731
- * is a silent no-op (state unchanged). Fires {@link notifyStateChange} only
732
- * when it actually changes state; never on a rejected/no-op call.
733
- */
734
- export declare function setMillerClass(toothNo: number, value: string): void;
735
- /** Read a tooth's Miller recession class from the active chart. A tooth never
736
- * touched (or with the default) returns "none". */
737
- export declare function getMillerClass(toothNo: number): string;
738
- /** Derive Clinical Attachment Level (CAL = pd + gm, gm signed and defaulting
739
- * to 0) for every CHARTED site of a tooth on the active chart. CAL is never
740
- * stored — this is the single source of truth for it. A site absent from
741
- * `pd` (not charted) has NO entry in the returned Map (not a 0). */
742
- export declare function getToothCal(toothNo: number): Map<string, number>;
743
- /** Cairo (2011) gingival-recession TYPE — RT1/RT2/RT3 — or `"none"`. */
744
- export type RecessionType = "none" | "rt1" | "rt2" | "rt3";
745
- /**
746
- * SP-perio PG-C Task 1: the Cairo 2011 recession-TYPE classification,
747
- * DERIVED purely from the already-charted per-site CAL ({@link getToothCal})
748
- * plus the buccal gingival margin (`perio.gm.get("B")`) — never stored, no
749
- * new state/payload/FHIR axis (parity byte-identical). Pure + read-only:
750
- * this is the single source of truth for a tooth's RT, mirroring how
751
- * {@link getToothCal} is the single source of truth for CAL.
752
- *
753
- * Cairo classifies BUCCAL recession by comparing it to the WORSE (deeper) of
754
- * the two adjacent interproximal (mesio-/disto-buccal) attachment losses:
755
- * - `"none"`: no buccal recession — `gm.B` is <= 0 (the margin is at/
756
- * coronal to the CEJ, i.e. a pseudopocket, not recession) OR the buccal
757
- * site simply isn't charted (`gm.B` undefined). Absence is treated the
758
- * same as "no recession", not "unknown", since RT is a display-only
759
- * derivation with no "uncharted" state of its own to represent.
760
- * - `"rt1"`: buccal recession present, but the interproximal CAL
761
- * (`max(CAL[MB], CAL[DB])`) is below {@link CAIRO_RT1_INTERPROX_THRESHOLD_MM}
762
- * — essentially no interproximal attachment/papilla loss. An uncharted
763
- * MB/DB site contributes `0` to that max (the most conservative/least
764
- * severe reading), so "buccal recession + nothing charted
765
- * interproximally" also reads as RT1.
766
- * - `"rt2"`: interproximal CAL loss is <= the buccal CAL loss — the
767
- * papilla still reaches (or nearly reaches) the contact point.
768
- * - `"rt3"`: interproximal CAL loss EXCEEDS the buccal CAL loss — severe
769
- * papilla loss, apical to the buccal margin.
770
- */
771
- export declare function getToothRecessionType(toothNo: number): RecessionType;
772
- /**
773
- * Whole-mouth periodontal summary over the active chart: total charted
774
- * sites, how many bled on probing, the derived %BOP, and the single worst
775
- * (deepest) CAL reading with the tooth it's on, plus the deepest raw pocket
776
- * depth recorded anywhere. `%BOP = bleedingSites / chartedSites` — a site
777
- * flagged `bop` without ever being charted can't exist (see setPerioSite()),
778
- * so this ratio can never exceed 100%. Returns zeros/nulls (never `NaN`)
779
- * when nothing has been charted anywhere.
780
- *
781
- * `maxFurcation` (SP-perio P2b Task 2): the single highest Glickman grade
782
- * (1-4) recorded on ANY furcation entrance anywhere in the mouth, `null`
783
- * when nothing has been graded. Deliberately its own pass over `ALL_TEETH`
784
- * (not folded into the pd-site loop above) since a tooth can carry furcation
785
- * data independently of whether it has any charted perio site.
786
- *
787
- * `plaquePercent` (SP-perio P2b Task 3): whole-mouth O'Leary Plaque Index —
788
- * `(total plaque surfaces charted across present teeth) / (present-teeth *
789
- * 4) * 100`, one decimal (same rounding as `bopPercent` above), `0` when
790
- * there are no present teeth (NOT `null` — matches `bopPercent`'s
791
- * zero-not-null convention, unlike `avgPd`/`avgCal`). "Present" here means a
792
- * REAL tooth in the mouth — `toothSelection` is neither `"none"` (missing)
793
- * nor `"implant"` — deliberately the SAME predicate `isToothPresent()` uses
794
- * (O'Leary is a tooth-focused index: a missing tooth has no surfaces to
795
- * chart, an implant has no natural tooth surface). This is intentionally
796
- * looser than `perioRowHidden()` (which additionally excludes under-gum/
797
- * extraction-socket teeth, since THOSE have no probeable periodontal
798
- * pocket) — an under-gum or extraction-socket "tooth" still occupies a slot
799
- * in the arch and can carry visible/recorded plaque on the socket/gum
800
- * surface, so it still counts toward the denominator here. Deliberately its
801
- * own pass over `ALL_TEETH` (not folded into the pd-site loop above) since a
802
- * tooth can carry plaque data independently of whether it has any charted
803
- * perio site, mirroring `maxFurcation` above. A tooth never touched at all
804
- * (no entry in the active chart map) is skipped entirely, same convention
805
- * `maxFurcation`'s loop and `getOdontogramSummary()` use.
806
- *
807
- * SP-perio PG-D Task 5 additions (own pass over `ALL_TEETH`, same "absence =
808
- * not charted" convention as `maxFurcation`/`plaquePercent` above):
809
- * - `piScore`/`giScore`: mean of ALL charted PI/GI surface grades across
810
- * the whole mouth (sum of grades / number of CHARTED surfaces, one
811
- * decimal) — `null` when nothing is charted anywhere (mirrors
812
- * `avgPd`/`avgCal`'s null-when-none, NOT `bopPercent`/`plaquePercent`'s
813
- * zero-when-none, since a 0 mean would misleadingly read as "all
814
- * surfaces charted healthy").
815
- * - `kgDeficientTeeth`: count of teeth with a charted `kg` narrower than
816
- * 2mm (`kg != null && kg < 2`) — an uncharted tooth (`kg === null`) is
817
- * never counted.
818
- * - `gtDistribution`/`millerDistribution`: per-value counts across the
819
- * whole mouth, excluding the "not charted" skip value (`unknown`/
820
- * `none` respectively) — mirrors how `maxFurcation`'s loop only counts
821
- * graded entrances.
822
- *
823
- * SP-perio PG-E Task 3 addition (own pass, same convention):
824
- * - `mpiScore`/`mbiScore`: mean of ALL charted mPI/mBI surface grades
825
- * across implant teeth (sum of grades / number of CHARTED surfaces, one
826
- * decimal) — `null` when nothing is charted anywhere, mirrors
827
- * `piScore`/`giScore` exactly. mPI/mBI are implant-only axes (the setter
828
- * is a no-op on a non-implant tooth), so guarding the accumulator on
829
- * `s.toothSelection === "implant"` is belt-and-suspenders — a
830
- * non-implant tooth's `mpi`/`mbi` maps can never be non-empty — but
831
- * makes the implant-only intent explicit at the read site too.
832
- */
833
- export declare function getPerioSummary(): {
834
- chartedSites: number;
835
- bleedingSites: number;
836
- bopPercent: number;
837
- worstCal: number | null;
838
- worstCalTooth: number | null;
839
- maxPd: number | null;
840
- avgPd: number | null;
841
- avgCal: number | null;
842
- maxFurcation: number | null;
843
- plaquePercent: number;
844
- piScore: number | null;
845
- giScore: number | null;
846
- kgDeficientTeeth: number;
847
- gtDistribution: {
848
- thin: number;
849
- medium: number;
850
- thick: number;
851
- };
852
- millerDistribution: {
853
- i: number;
854
- ii: number;
855
- iii: number;
856
- iv: number;
857
- };
858
- mpiScore: number | null;
859
- mbiScore: number | null;
860
- };
861
- /** UI-3b: true iff ANY periodontal axis has been charted anywhere in the
862
- * mouth. Used to auto-skip the perio section of an export and to disable the
863
- * perio image-export menu items on a blank chart. Derived entirely from
864
- * `getPerioSummary()` — no new traversal. */
865
- export declare function hasAnyPerioData(): boolean;
866
- /** Per-tooth perio for every tooth on the active chart that has at least one
867
- * charted site (an uncharted tooth is OMITTED, not present with empty
868
- * maps — mirrors the same "absence = not charted" convention the payload's
869
- * `perio` key follows). Keyed by tooth number (FDI), stringified (plain
870
- * object keys are always strings), each value shaped like
871
- * {@link getToothPerio}'s return. */
872
- export declare function getPerioChart(): Record<string, PlainPerio>;
873
- /**
874
- * SP-perio P4b Task 1: state adapter for the pure 2017 periodontal
875
- * classification derivation core (`derivePerioClassification` in
876
- * `perioClassification.ts`). Reduces the active chart's per-tooth CAL/PD +
877
- * the P4a case metadata into the pure {@link PerioDerivationInput} struct —
878
- * this is the ONLY place engine state is read for classification purposes;
879
- * `derivePerioClassification` itself never touches `toothState`/`caseMeta`
880
- * directly, so it stays callable from an arbitrary serialized snapshot (the
881
- * later FHIR Condition builder feeds it that way, not live module state).
882
- *
883
- * Per tooth: `interdentalCal` = worst (max) CAL over the 4 approximal sites
884
- * (MB/DB/ML/DL); `buccalOralCal` = worst (max) CAL over the 2 mid sites
885
- * (B/L); `maxPd` = worst (max) raw PD over any of the 6 sites (from
886
- * `s.perio.pd` directly, NOT derived CAL); `present` mirrors
887
- * `isToothPresent()`. A tooth never touched at all (no chart entry) reads
888
- * as present with all-zero perio fields — the same "never touched -> default
889
- * state" convention every other per-tooth read in this file uses.
890
- */
891
- export declare function buildDerivationInputFromState(): PerioDerivationInput;
892
- /** Final result of {@link getPerioClassification} — one axis result per axis,
893
- * each either the clinician's override (when set) or the pure-derived value,
894
- * plus the raw derivation and an `overridden` flag per axis so callers (T3's
895
- * FHIR evidence, T4's UI) can tell which. */
896
- export interface PerioClassificationResult {
897
- diagnosis: string;
898
- stage: string;
899
- grade: string;
900
- extent: string;
901
- derived: PerioClassification;
902
- overridden: {
903
- diagnosis: boolean;
904
- stage: boolean;
905
- grade: boolean;
906
- extent: boolean;
907
- };
908
- }
909
- /**
910
- * SP-perio P4b Task 2: the final periodontal classification — per-axis
911
- * clinician override (`caseMeta.<axis>Override`) when set, else the pure
912
- * `derivePerioClassification` result (fed via `buildDerivationInputFromState`,
913
- * the same state adapter T1 built). Overrides never feed back into the
914
- * derivation itself — `derived` is always the untouched computed value, so
915
- * callers can always see both what the engine computed and what the
916
- * clinician actually chose.
917
- */
918
- export declare function getPerioClassification(): PerioClassificationResult;
919
- export type PerioCellCoord = {
920
- toothNo: number;
921
- site: PerioSite;
922
- row: "pd" | "gm";
923
- };
924
- /**
925
- * Pure charting-order helper for the full-mouth perio grid's keyboard
926
- * auto-advance (PerioChart.tsx) — given the cell just charted, returns the
927
- * NEXT cell in charting order (see the order table comment above), or
928
- * `null` at the very end (last lingual gm site of the last tooth in the
929
- * arch order). An unrecognized `cur` (a site string not in {@link PERIO_SITES}
930
- * or a `row` other than "pd"/"gm") also returns `null`. Never mutates
931
- * state — a plain-object round trip, trivially unit-testable in isolation.
932
- */
933
- export declare function nextPerioCell(cur: {
934
- toothNo: number;
935
- site: string;
936
- row: "pd" | "gm";
937
- }): PerioCellCoord | null;
938
- /** Reverse of {@link nextPerioCell} — the grid's Left-arrow / previous-cell
939
- * step. `null` for an unrecognized `cur` or at the very first cell. */
940
- export declare function prevPerioCell(cur: {
941
- toothNo: number;
942
- site: string;
943
- row: "pd" | "gm";
944
- }): PerioCellCoord | null;
945
- /** Whether tooth `toothNo`'s periodontal probing sites are chartable on the
946
- * active chart — the SAME gate {@link perioRowHidden} applies to the
947
- * tooth-info panel's `#perioRow` (missing/implant/under-gum/extraction-
948
- * socket teeth have no probing site to chart). The full-mouth perio-chart
949
- * overlay grid (P2 Task 2) disables a tooth's entire column (site cells +
950
- * mobility cell) on this same predicate — a tooth never touched (no stored
951
- * state yet) reads as present/chartable, mirroring every other per-tooth
952
- * default read here. */
953
- export declare function isPerioRowHidden(toothNo: number): boolean;
954
- /** Whether tooth `toothNo` is an implant on the ACTIVE chart (status/plan
955
- * aware, reading the SAME `toothState` the perio number rows read). The
956
- * graphical Dental Chart (`PerioChart` / `perioGraphic.ts`) uses this to draw
957
- * the implant fixture artwork (`#implant-base`) in place of the natural
958
- * `#tooth-base` for an implant tooth — a read-only presentation concern,
959
- * outside the tooth-info panel, so like `isPerioRowHidden`/`getToothMobility`
960
- * above it needs a small public read since it can't reach `toothState`
961
- * directly. A never-touched tooth defaults to non-implant. */
962
- export declare function isToothImplant(toothNo: number): boolean;
963
- /** Read tooth `toothNo`'s Miller mobility grade from the active chart
964
- * ("none" for a never-touched tooth, matching {@link defaultState}). */
965
- export declare function getToothMobility(toothNo: number): string;
966
- /**
967
- * Set tooth `toothNo`'s Miller mobility grade on the active chart from
968
- * OUTSIDE the tooth-info panel. The panel's own `#mobilitySelect` writes
969
- * mobility through `applyToSelected()`, which applies to the bulk
970
- * `selectedTeeth` set — unusable here, since the full-mouth perio-chart
971
- * overlay grid (P2 Task 2) edits one specific tooth at a time that is not
972
- * necessarily `activeTooth` or selected on the base chart. This reuses the
973
- * EXACT SAME mutation + render + notify steps that path takes
974
- * (`applyStateToSvg`, `updateToothTileNumber`, re-syncing the panel when
975
- * `toothNo` happens to be the active tooth, `notifyStateChange`) — no new
976
- * mobility derivation or render logic, just a single-tooth entry point into
977
- * it. Lazily initializes a never-touched tooth's state first, exactly like
978
- * `setPerioSite` does. An unrecognized `value` (not in {@link VALID_MOBILITY})
979
- * is a silent no-op, exactly like every other per-tooth enum setter here.
980
- */
981
- export declare function setToothMobility(toothNo: number, value: string): void;
982
- /** Open the perio-chart overlay. No-op (still notifies) if already open. */
983
- export declare function openPerioOverlay(): void;
984
- /** Close the perio-chart overlay. No-op (still notifies) if already closed. */
985
- export declare function closePerioOverlay(): void;
986
- /** Whether the perio-chart overlay is currently open. */
987
- export declare function isPerioOverlayOpen(): boolean;
988
- export type PerioViewMode = "toggle" | "popup";
989
- /** Current perio-chart housing mode. Defaults to `"toggle"`. */
990
- export declare function getPerioViewMode(): PerioViewMode;
991
- /** Switch the perio-chart housing mode. No-op (still notifies) if unchanged. */
992
- export declare function setPerioViewMode(mode: PerioViewMode): void;
993
- /** The 16 toggleable periodontal index rows the Dental Chart can show/hide. */
994
- export type PerioRowId = "plaque" | "bop" | "cal" | "gm" | "pd" | "furcation" | "mobility" | "cej" | "rootConcavity" | "pi" | "gi" | "mpi" | "mbi" | "kg" | "gt" | "miller";
995
- /** Current per-index perio-chart row visibility. Defaults to all-visible. */
996
- export declare function getPerioRowVisibility(): Record<PerioRowId, boolean>;
997
- /** Show/hide one perio-chart index row. No-op (still notifies) if unchanged. */
998
- export declare function setPerioRowVisibility(id: PerioRowId, visible: boolean): void;
999
- /** How perio-chart index row labels are rendered. */
1000
- export type PerioIndexNameMode = "translated" | "canonical";
1001
- /** Current perio index-name display mode. Defaults to `"translated"`. */
1002
- export declare function getPerioIndexNameMode(): PerioIndexNameMode;
1003
- /** Switch the perio index-name display mode. No-op (still notifies) if unchanged. */
1004
- export declare function setPerioIndexNameMode(mode: PerioIndexNameMode): void;
1005
- export type PerioOverlayLayer = "none" | "pd" | "cal" | "gr" | "cairo" | "kg" | "plaque" | "pi" | "gi" | "mpi" | "mbi" | "bop" | "pd5" | "pd6";
1006
- /** Current Dental Chart overlay layer. Defaults to `"none"`. */
1007
- export declare function getPerioOverlayLayer(): PerioOverlayLayer;
1008
- /** Select the Dental Chart overlay layer. Always notifies (so the overlay
1009
- * redraws + the switcher's active state updates) even when unchanged. */
1010
- export declare function setPerioOverlayLayer(layer: PerioOverlayLayer): void;
1011
- /**
1012
- * Prune a cloned SVG subtree to match what is actually visible on screen.
1013
- * Walks the live `original` and its `clone` in parallel and drops clone nodes
1014
- * whose original element is hidden (display:none / visibility:hidden / opacity 0),
1015
- * so the exported SVG reflects the current layer state without needing the
1016
- * engine's CSS rules embedded.
1017
- */
1018
- export declare function pruneHiddenClone(original: Element, clone: Element): void;
1019
- /**
1020
- * Prefix every id and id-reference inside a cloned subtree so that combining
1021
- * many tiles (cloned from a few shared templates) into one SVG document does
1022
- * not cause id collisions (gradients, clipPaths, etc.).
1023
- */
1024
- export declare function namespaceIds(root: Element, prefix: string): void;
1025
- /**
1026
- * Serialize the on-screen odontogram tooth grid into a single, self-contained
1027
- * SVG string (vector, no rasterization). Each tooth SVG is placed as a nested
1028
- * `<svg>` at its laid-out position; tooth number labels are emitted as `<text>`.
1029
- * Returns null if the grid is not present.
1030
- */
1031
- export declare function buildOdontogramSvg(): {
1032
- xml: string;
1033
- width: number;
1034
- height: number;
1035
- } | null;
1036
- /** Export the odontogram as a downloadable, scalable SVG file. */
1037
- export declare function exportSvg(): Promise<void>;
1038
- /**
1039
- * Export the odontogram as PNG or JPG. Renders the serialized SVG via the
1040
- * browser's native rasterizer (Image → canvas) — much faster than the previous
1041
- * html2canvas DOM rasterization, and sharper.
1042
- */
1043
- export declare function exportImage(format?: "png" | "jpg"): Promise<void>;
1044
- /** UI-3b: export the full perio chart as a standalone vector SVG file. */
1045
- export declare function exportPerioSvg(): Promise<void>;
1046
- /** UI-3b: export the full perio chart as PNG/JPG (SVG → canvas @2×, via the
1047
- * shared {@link rasterizeSvgToCanvas} raster core). */
1048
- export declare function exportPerioImage(format?: "png" | "jpg"): Promise<void>;
1049
- /**
1050
- * UI-3b Task 6: assemble a printable PDF report (jsPDF-native — vector text
1051
- * + raster chart PNGs, no svg2pdf.js). Gathers all `data` (SVG→PNG
1052
- * rasterization via {@link rasterizeSvgToPng}, summary/classification text,
1053
- * `hasAnyPerioData()`), drives the export-progress overlay, then hands off
1054
- * to the PURE `assemblePdf()` (`src/perioPdf.ts`), which decides section
1055
- * layout from `opts`/`data` alone.
1056
- *
1057
- * jsPDF-in-jsdom note: constructing a real `jsPDF` instance depends on
1058
- * browser canvas/font internals jsdom doesn't fully provide, so this
1059
- * wrapper is NOT unit-tested directly — `assemblePdf`'s section-gating IS
1060
- * thoroughly unit-tested with an injectable fake doc (see
1061
- * `ui3b-export-pdf.test.ts`). This wrapper's own raster→layout→save path is
1062
- * a browser-verify item (see the task report).
1063
- */
1064
- export declare function exportPdf(opts: PdfExportOptions): Promise<void>;
1065
- /**
1066
- * Export the current odontogram as an HL7 FHIR R4 collection Bundle (JSON).
1067
- * @param options - Optional subject reference (e.g. "Patient/123"); when
1068
- * omitted a placeholder Patient is embedded.
1069
- */
1070
- export declare function exportFhir(options?: FhirExportOptions): void;
1071
- /** TEST-ONLY (R2-A Task 2 seam): exercise the DATA-ONLY import hydrate
1072
- * (status-primary teeth + conditional plan restore + planInitialized),
1073
- * without requiring a live DOM/initOdontogram() token. Not part of the
1074
- * public API. */
1075
- export declare function __hydrateImportedChartsForTest(data: Any): void;
1076
- /** TEST-ONLY (whole-branch review fix seam): exercise the DATA-ONLY half of
1077
- * the import path's chart-mode fix — `hydrateImportedCharts()` followed by
1078
- * the new `resetActiveChartToStatusAfterImport()` step `importStatus()`
1079
- * now runs — without requiring a live DOM/initOdontogram() token.
1080
- * `importStatus()`'s own DOM-dependent UI-sync tail (`updateSelectionUI()`
1081
- * -> `syncControlsFromState()`) assumes a live control-panel DOM and is out
1082
- * of scope for this seam, same as `__hydrateImportedChartsForTest`. Not
1083
- * part of the public API. */
1084
- export declare function __importStatusForTest(data: Any): void;
1085
- /** Import a FHIR R4 Bundle (object or JSON string) produced by this module. */
1086
- export declare function importFhirBundle(input: Any): void;
1087
- /** TEST-ONLY: apply a clinical status-extra preset (span/arch-bridge/removable/
1088
- * bar-denture) directly against the module-level state map. Not part of the
1089
- * public API. */
1090
- export declare function __applyStatusExtraForTest(option: Any): void;
1091
- /** Set which parser the next file import uses. Defaults back to "status" after each import. */
1092
- export declare function setImportFormat(format: "status" | "fhir"): void;
1093
- /**
1094
- * Switch the displayed tooth numbering system and re-render all tooth labels.
1095
- * @param system - The target {@link NumberingSystem}.
1096
- */
1097
- export declare function setNumberingSystem(system: NumberingSystem): void;
1098
- /**
1099
- * Initialise the odontogram engine: wire up DOM controls, build the SVG tooth
1100
- * grid, and start listening for i18n changes. Safe to call multiple times
1101
- * (subsequent calls are no-ops).
1102
- */
1103
- export declare function initOdontogram(): Promise<void>;
1104
- /**
1105
- * Tear down the odontogram engine: clear all DOM elements built by the engine,
1106
- * unsubscribe from i18n changes, and reset internal state. After this call,
1107
- * {@link initOdontogram} may be called again to re-initialise.
1108
- */
1109
- export declare function destroyOdontogram(): void;
1110
- /**
1111
- * Clear the current tooth selection and reset the active tooth. Useful when
1112
- * switching to view or quote-builder mode from the host application.
1113
- */
1114
- export declare function clearSelection(): void;
1115
- /**
1116
- * Register one or more custom SVG plugins. Plugins can inject visual overlays
1117
- * into the tooth SVG and maintain per-tooth custom state included in export/import.
1118
- *
1119
- * @param plugins - Array of {@link OdontogramPlugin} definitions.
1120
- */
1121
- export declare function registerPlugins(plugins: OdontogramPlugin[]): void;
1122
- /**
1123
- * Set a plugin's custom state for a specific tooth. Triggers SVG re-render
1124
- * for that tooth and updates the tooltip.
1125
- *
1126
- * @param toothNo - The FDI tooth number (11–48).
1127
- * @param pluginId - The plugin's unique identifier.
1128
- * @param value - The custom state value (any JSON-serializable value, or `undefined` to clear).
1129
- */
1130
- export declare function setPluginState(toothNo: number, pluginId: string, value: unknown): void;
1131
- /**
1132
- * Get a plugin's custom state for a specific tooth.
1133
- *
1134
- * @param toothNo - The FDI tooth number (11–48).
1135
- * @param pluginId - The plugin's unique identifier.
1136
- * @returns The custom state value, or `undefined` if not set.
1137
- */
1138
- export declare function getPluginState(toothNo: number, pluginId: string): unknown;
1139
- /**
1140
- * Get a human-readable summary of all active states for a tooth.
1141
- * Useful for building custom tooltip or info-panel UIs.
1142
- *
1143
- * @param toothNo - The FDI tooth number (11–48).
1144
- * @returns Array of localized state description strings.
1145
- */
1146
- export declare function getToothStateSummary(toothNo: number): string[];
1147
- /** One heading + its per-tooth entries in the tooth-information summary. */
1148
- export type OdontogramSummarySection = {
1149
- key: "caries" | "fillings" | "endo" | "diagnoses" | "wear" | "discoloration" | "orthodontics" | "prosthetics";
1150
- heading: string;
1151
- items: string[];
1152
- /** Localized "no such tooth" sentence, shown when `items` is empty. */
1153
- emptyText: string;
1154
- };
1155
- /** Structured, already-localized textual summary of the whole odontogram. */
1156
- export type OdontogramSummary = {
1157
- overview: string;
1158
- permanentList: string | null;
1159
- missingList: string | null;
1160
- sections: OdontogramSummarySection[];
1161
- /** Implants heading + list — only present when at least one implant exists. */
1162
- implants: {
1163
- heading: string;
1164
- text: string;
1165
- } | null;
1166
- periodontalTitle: string;
1167
- periodontalText: string;
1168
- /** R2-B Task 2: the status->plan diff (see {@link getPlanChanges}), verbatim.
1169
- * `[]` whenever the plan chart hasn't been initialized or plan === status —
1170
- * a distinct field, not a section, since it's a diff rather than a status
1171
- * list. The "What changes" box in App.tsx renders from this field only
1172
- * when it's non-empty. */
1173
- plannedChanges: PlanChange[];
1174
- };
1175
- /** Formats a tooth number for display using the active numbering system AND
1176
- * the milktooth display-remap ({@link getDisplayedToothNumber}) — the exact
1177
- * same formatting {@link getOdontogramSummary} uses for every tooth number
1178
- * it prints (permanent/missing lists, per-section entries, implants). Exported
1179
- * so the "What changes" box in App.tsx can label a {@link PlanChange.toothNo}
1180
- * identically, without duplicating the numbering/milktooth logic. */
1181
- export declare function formatToothLabel(toothNo: number): string;
1182
- /**
1183
- * Build a human-readable, localized summary of the current odontogram state:
1184
- * tooth counts, present/missing lists, and caries / fillings / endo /
1185
- * prosthetics / periodontal sections. Numbers respect the active numbering
1186
- * system. Intended for the optional "tooth information" panel; call
1187
- * {@link onStateChange} to refresh it on edits.
1188
- */
1189
- export declare function getOdontogramSummary(): OdontogramSummary;
1190
- /**
1191
- * Enable or disable read-only mode. When read-only, all click, touch, and
1192
- * keyboard interactions are disabled. The control panel is dimmed and
1193
- * non-interactive. Useful for print/report views.
1194
- *
1195
- * @param value - `true` to enable read-only mode, `false` to disable.
1196
- */
1197
- export declare function setReadOnly(value: boolean): void;
1198
- /**
1199
- * Get the current read-only mode state.
1200
- */
1201
- export declare function getReadOnly(): boolean;
1202
- /**
1203
- * Enable or disable per-tooth notes. When enabled, double-clicking a tooth
1204
- * opens a note editor popover, and notes are shown in hover tooltips with
1205
- * a badge indicator.
1206
- *
1207
- * @param value - `true` to enable notes, `false` to disable.
1208
- */
1209
- export declare function setNotesEnabled(value: boolean): void;
1210
- /**
1211
- * Get the current notes-enabled state.
1212
- */
1213
- export declare function getNotesEnabled(): boolean;
1214
- export { setOcclusalVisible, setWisdomVisible, setShowBase, setHealthyPulpVisible };