react-advanced-odontogram 2.1.0 → 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.
package/README.md CHANGED
@@ -1,16 +1,21 @@
1
1
  # 🦷 React Odontogram Modul
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/react-advanced-odontogram?style=for-the-badge&logo=npm&color=CB3837)](https://www.npmjs.com/package/react-advanced-odontogram)
4
- [![Version](https://img.shields.io/badge/version-2.1.0-green?style=for-the-badge)](https://github.com/ZoliQua/React-Odontogram-Modul/releases)
4
+ [![Version](https://img.shields.io/badge/version-2.2.0-green?style=for-the-badge)](https://github.com/ZoliQua/React-Odontogram-Modul/releases)
5
5
  [![License](https://img.shields.io/badge/license-MIT-orange?style=for-the-badge)](https://github.com/ZoliQua/React-Odontogram-Modul/blob/main/LICENSE)
6
6
  [![DOI](https://raw.githubusercontent.com/ZoliQua/React-Odontogram-Modul/main/src/assets/zenodo.21156787.svg)](https://doi.org/10.5281/zenodo.21156787)
7
7
 
8
8
  [![React](https://img.shields.io/badge/React-18%20%7C%2019-61DAFB?style=for-the-badge&logo=react)](https://reactjs.org/)
9
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-5-3178C6?style=for-the-badge&logo=typescript)](https://www.typescriptlang.org/)
10
10
 
11
- An interactive, SVG-based **dental odontogram (dental chart) editor** for **React + TypeScript** — with a full **periodontal charting module**, multi-surface caries/restorations, endodontic/prosthetic states, FDI/Universal/Palmer numbering, **HL7 FHIR R4** export/import, optional ICDAS scoring, and an 11-language UI.
11
+ **📖 Full documentation is available per language:**
12
12
 
13
- 🔗 **Live demo:** https://react-advanced-odontogram.vercel.app/ · 📚 **API docs:** https://zoliqua.github.io/React-Odontogram-Modul/
13
+ 🇬🇧 [English](lang/README-en.md) · 🇩🇪 [Deutsch](lang/README-de.md) · 🇪🇸 [Español](lang/README-es.md) · 🇫🇷 [Français](lang/README-fr.md) · 🇮🇹 [Italiano](lang/README-it.md) · 🇭🇺 [Magyar](lang/README-hu.md) · 🇵🇱 [Polski](lang/README-pl.md) · 🇧🇷 [Português (BR)](lang/README-pt-br.md) · 🇸🇰 [Slovenčina](lang/README-sk.md) · 🇷🇺 [Русский](lang/README-ru.md) · 🇸🇦 [العربية](lang/README-ar.md) · 🇨🇳 [简体中文](lang/README-zh.md)
14
+
15
+ An interactive, SVG-based **dental odontogram (dental chart) editor** for **React + TypeScript** — with a full **periodontal charting module**, multi-surface caries/restorations, endodontic/prosthetic states, FDI/Universal/Palmer numbering, **HL7 FHIR R4** export/import, optional ICDAS scoring, and a 12-language UI.
16
+
17
+ 🔗 **Live demo:** https://react-odontogram-modul.vercel.app/ \
18
+ 📚 **API docs:** https://zoliqua.github.io/React-Odontogram-Modul/
14
19
 
15
20
  ![Odontogram editor preview](https://raw.githubusercontent.com/ZoliQua/React-Odontogram-Modul/main/lang/screenshot_en_odontogram.png)
16
21
 
@@ -44,6 +49,7 @@ import {
44
49
  OdontogramShell, // also the default export
45
50
  PerioChart, // standalone periodontal chart
46
51
  getOdontogramSummary,
52
+ exportStatus, importStatus, // JSON state serialization / hydration
47
53
  exportFhir, exportSvg, exportImage,
48
54
  setReadOnly, startIntroTour,
49
55
  } from "react-advanced-odontogram";
@@ -66,15 +72,13 @@ Per-site probing depth, gingival margin, bleeding on probing (+ suppuration) at
66
72
  - 🩺 Full periodontal module (see above) + 2017 classification
67
73
  - 🔗 **HL7 FHIR R4** export/import; JSON export/import with migrations
68
74
  - 🖼️ PNG / JPG / SVG chart export and a **PDF report** (jsPDF, lazy-loaded)
69
- - 🔢 FDI / Universal / Palmer numbering · 🌐 11 UI languages (HU/EN/DE/ES/IT/SK/PL/RU/PT-BR/AR/ZH, Arabic RTL) · 🎨 theming via `--odon-*` CSS variables · 🧩 plugin system · ⌨️ keyboard accessibility
75
+ - 🔢 FDI / Universal / Palmer numbering · 🌐 12 UI languages (HU/EN/DE/ES/IT/SK/PL/RU/PT-BR/AR/ZH/FR, Arabic RTL) · 🎨 theming via `--odon-*` CSS variables · 🧩 plugin system · ⌨️ keyboard accessibility
70
76
 
71
77
  ## 📖 Documentation
72
78
 
73
- Full documentation is available per language:
74
-
75
- 🇬🇧 [English](lang/README-en.md) · 🇪🇸 [Español](lang/README-es.md) · 🇩🇪 [Deutsch](lang/README-de.md) · 🇭🇺 [Magyar](lang/README-hu.md) · 🇮🇹 [Italiano](lang/README-it.md) · 🇸🇰 [Slovenčina](lang/README-sk.md) · 🇵🇱 [Polski](lang/README-pl.md) · 🇷🇺 [Русский](lang/README-ru.md) · 🇧🇷 [Português (BR)](lang/README-pt-br.md) · 🇸🇦 [العربية](lang/README-ar.md) · 🇨🇳 [简体中文](lang/README-zh.md)
79
+ Per-language guides are linked at the top of this file. Full API reference (TypeDoc):
76
80
 
77
- 📚 **API reference (TypeDoc):** https://zoliqua.github.io/React-Odontogram-Modul/
81
+ 📚 **https://zoliqua.github.io/React-Odontogram-Modul/**
78
82
 
79
83
  ## 📄 License & citation
80
84
 
package/dist/index.d.ts CHANGED
@@ -150,12 +150,24 @@ declare type AppProps = {
150
150
  * UI), then notify (refresh + close the modal). No-op when nothing is pending. */
151
151
  export declare function cancelDualStateConfirm(): void;
152
152
 
153
+ declare type ChartMode = "status" | "plan";
154
+
153
155
  /**
154
156
  * Clear the current tooth selection and reset the active tooth. Useful when
155
157
  * switching to view or quote-builder mode from the host application.
156
158
  */
157
159
  export declare function clearSelection(): void;
158
160
 
161
+ /** Close the perio-chart overlay. No-op (still notifies) if already closed. */
162
+ export declare function closePerioOverlay(): void;
163
+
164
+ /**
165
+ * Tear down the odontogram engine: clear all DOM elements built by the engine,
166
+ * unsubscribe from i18n changes, and reset internal state. After this call,
167
+ * {@link initOdontogram} may be called again to re-initialise.
168
+ */
169
+ export declare function destroyOdontogram(): void;
170
+
159
171
  /**
160
172
  * Export the current odontogram as an HL7 FHIR R4 collection Bundle (JSON).
161
173
  * @param options - Optional subject reference (e.g. "Patient/123"); when
@@ -170,6 +182,32 @@ export declare function exportFhir(options?: FhirExportOptions): void;
170
182
  */
171
183
  export declare function exportImage(format?: "png" | "jpg"): Promise<void>;
172
184
 
185
+ /**
186
+ * UI-3b Task 6: assemble a printable PDF report (jsPDF-native — vector text
187
+ * + raster chart PNGs, no svg2pdf.js). Gathers all `data` (SVG→PNG
188
+ * rasterization via {@link rasterizeSvgToPng}, summary/classification text,
189
+ * `hasAnyPerioData()`), drives the export-progress overlay, then hands off
190
+ * to the PURE `assemblePdf()` (`src/perioPdf.ts`), which decides section
191
+ * layout from `opts`/`data` alone.
192
+ *
193
+ * jsPDF-in-jsdom note: constructing a real `jsPDF` instance depends on
194
+ * browser canvas/font internals jsdom doesn't fully provide, so this
195
+ * wrapper is NOT unit-tested directly — `assemblePdf`'s section-gating IS
196
+ * thoroughly unit-tested with an injectable fake doc (see
197
+ * `ui3b-export-pdf.test.ts`). This wrapper's own raster→layout→save path is
198
+ * a browser-verify item (see the task report).
199
+ */
200
+ export declare function exportPdf(opts: PdfExportOptions): Promise<void>;
201
+
202
+ /** UI-3b: export the full perio chart as PNG/JPG (SVG → canvas @2×, via the
203
+ * shared {@link rasterizeSvgToCanvas} raster core). */
204
+ export declare function exportPerioImage(format?: "png" | "jpg"): Promise<void>;
205
+
206
+ /** UI-3b: export the full perio chart as a standalone vector SVG file. */
207
+ export declare function exportPerioSvg(): Promise<void>;
208
+
209
+ export declare function exportStatus(): void;
210
+
173
211
  /** Export the odontogram as a downloadable, scalable SVG file. */
174
212
  export declare function exportSvg(): Promise<void>;
175
213
 
@@ -193,6 +231,9 @@ export declare function formatToothLabel(toothNo: number): string;
193
231
 
194
232
  export declare function getCariesDepthEnabled(): boolean;
195
233
 
234
+ /** Current active chart mode ("status" | "plan"). */
235
+ export declare function getChartMode(): ChartMode;
236
+
196
237
  export declare function getDiscolorationDetailLevel(): ToothDetailLevel;
197
238
 
198
239
  export declare function getIcdasEnabled(): boolean;
@@ -220,6 +261,31 @@ export declare function getPerioRowVisibility(): Record<PerioRowId, boolean>;
220
261
  /** Current perio-chart housing mode. Defaults to `"toggle"`. */
221
262
  export declare function getPerioViewMode(): PerioViewMode;
222
263
 
264
+ /**
265
+ * Compare the "status" chart against the "plan" chart, tooth by tooth and
266
+ * axis by axis (see {@link DIFF_AXES}), and report every axis whose label
267
+ * differs. Pure and read-only: never mutates either chart, never touches the
268
+ * DOM, never renders — a `parity.test.ts`-safe addition.
269
+ *
270
+ * Returns `[]` whenever the plan chart hasn't been initialized yet (no plan
271
+ * exists to diff against). A tooth absent from either chart resolves via
272
+ * `defaultState()`, so a status-only or plan-only tooth still diffs correctly
273
+ * against the clinical default rather than throwing.
274
+ *
275
+ * Iterates the fixed `ALL_TEETH` list (not chart key insertion order), so
276
+ * results are always grouped by tooth in the same stable clinical order the
277
+ * rest of the app already uses (quadrant-by-quadrant); within a tooth,
278
+ * entries follow `DIFF_AXES` order.
279
+ */
280
+ export declare function getPlanChanges(): PlanChange[];
281
+
282
+ /**
283
+ * Export the PLAN chart's payload alone: same shape as the status export
284
+ * (`{version, globals, teeth}`), but `teeth` is collected from `charts.plan`.
285
+ * `globals` are shared app-level settings, not owned by either chart.
286
+ */
287
+ export declare function getPlanChart(): Any;
288
+
223
289
  /**
224
290
  * Get a plugin's custom state for a specific tooth.
225
291
  *
@@ -242,6 +308,12 @@ export declare function getRootCariesMode(): RootCariesMode;
242
308
 
243
309
  export declare function getSecondaryCariesMode(): SecondaryCariesMode;
244
310
 
311
+ /**
312
+ * Export the STATUS chart's payload — identical to exportStatus()'s JSON
313
+ * (status-primary; unaffected by the current chart mode).
314
+ */
315
+ export declare function getStatusChart(): Any;
316
+
245
317
  export declare function getSurfaceNotation(): SurfaceNotation;
246
318
 
247
319
  /**
@@ -255,9 +327,27 @@ export declare function getToothStateSummary(toothNo: number): string[];
255
327
 
256
328
  export declare function getWearDetailLevel(): ToothDetailLevel;
257
329
 
330
+ /** UI-3b: true iff ANY periodontal axis has been charted anywhere in the
331
+ * mouth. Used to auto-skip the perio section of an export and to disable the
332
+ * perio image-export menu items on a blank chart. Derived entirely from
333
+ * `getPerioSummary()` — no new traversal. */
334
+ export declare function hasAnyPerioData(): boolean;
335
+
336
+ export declare function importStatus(data: Any): void;
337
+
338
+ /**
339
+ * Initialise the odontogram engine: wire up DOM controls, build the SVG tooth
340
+ * grid, and start listening for i18n changes. Safe to call multiple times
341
+ * (subsequent calls are no-ops).
342
+ */
343
+ export declare function initOdontogram(): Promise<void>;
344
+
258
345
  /** Whether a status-vs-plan divergence confirm is awaiting the user's choice. */
259
346
  export declare function isDualStateConfirmPending(): boolean;
260
347
 
348
+ /** Whether the perio-chart overlay is currently open. */
349
+ export declare function isPerioOverlayOpen(): boolean;
350
+
261
351
  /**
262
352
  * Supported UI languages.
263
353
  *
@@ -274,8 +364,9 @@ export declare function isDualStateConfirmPending(): boolean;
274
364
  * | pt-br | Portuguese (Brazil) |
275
365
  * | zh | Chinese (Simplified) |
276
366
  * | ar | Arabic (RTL — UI mirrors, dental/perio charts pinned LTR) |
367
+ * | fr | French |
277
368
  */
278
- declare type Language = "hu" | "en" | "de" | "es" | "it" | "sk" | "pl" | "ru" | "pt-br" | "zh" | "ar";
369
+ declare type Language = "hu" | "en" | "de" | "es" | "it" | "sk" | "pl" | "ru" | "pt-br" | "zh" | "ar" | "fr";
279
370
 
280
371
  /**
281
372
  * Supported tooth numbering systems.
@@ -414,6 +505,20 @@ export declare type OdontogramThemeConfig = {
414
505
  */
415
506
  export declare function onStateChange(cb: () => void): () => void;
416
507
 
508
+ /** Open the perio-chart overlay. No-op (still notifies) if already open. */
509
+ export declare function openPerioOverlay(): void;
510
+
511
+ /** UI-3b Task 6/7: which PDF sections the user opted into. The perio
512
+ * sections are additionally auto-skipped whenever `data.hasPerio` is false
513
+ * (see {@link assemblePdf}), regardless of these flags — a blank perio
514
+ * chart never gets an empty "Periodontal status" page. */
515
+ declare interface PdfExportOptions {
516
+ patientData: boolean;
517
+ odontogram: boolean;
518
+ perioStatus: boolean;
519
+ perioDescription: boolean;
520
+ }
521
+
417
522
  /**
418
523
  * Full-screen perio-chart overlay (periodontal-arc sub-project P2). Task 1
419
524
  * shipped the shell (dialog contract, open/close API) with an empty
@@ -503,6 +608,20 @@ export declare type SecondaryCariesMode = "simple" | "standard" | "full";
503
608
 
504
609
  export declare function setCariesDepthEnabled(value: boolean): void;
505
610
 
611
+ /**
612
+ * Switch the active chart between "status" (current findings) and "plan"
613
+ * (proposed treatment). The first time "plan" is entered, it is deep-cloned
614
+ * from "status" (see {@link cloneChart}); later switches reuse the existing
615
+ * plan chart untouched. Re-renders every tooth from the newly active chart
616
+ * via the SAME full-repaint mechanism `importStatus()` uses, so no new
617
+ * render path is introduced and SVG output stays byte-identical to the
618
+ * single-chart render (parity is unaffected — only WHICH chart is active
619
+ * changes, never how a chart renders).
620
+ *
621
+ * @param mode - "status" or "plan"; any other value is ignored.
622
+ */
623
+ export declare function setChartMode(mode: ChartMode): void;
624
+
506
625
  export declare function setDiscolorationDetailLevel(value: ToothDetailLevel): void;
507
626
 
508
627
  /** Toggle visibility of the healthy-pulp layer on all teeth. */
@@ -522,6 +641,12 @@ export declare function setImportFormat(format: "status" | "fhir"): void;
522
641
  */
523
642
  export declare function setNotesEnabled(value: boolean): void;
524
643
 
644
+ /**
645
+ * Switch the displayed tooth numbering system and re-render all tooth labels.
646
+ * @param system - The target {@link NumberingSystem}.
647
+ */
648
+ export declare function setNumberingSystem(system: NumberingSystem): void;
649
+
525
650
  /** Toggle visibility of occlusal-view tiles (premolars and molars). */
526
651
  export declare function setOcclusalVisible(on: Any): void;
527
652
 
@@ -534,6 +659,16 @@ export declare function setPerioRowVisibility(id: PerioRowId, visible: boolean):
534
659
  /** Switch the perio-chart housing mode. No-op (still notifies) if unchanged. */
535
660
  export declare function setPerioViewMode(mode: PerioViewMode): void;
536
661
 
662
+ /**
663
+ * Hydrate `payload.teeth` into the PLAN chart ONLY (status is left
664
+ * untouched), mirroring the per-tooth hydrate importStatus() performs for
665
+ * the status chart. Marks the plan chart initialized. Repaints the DOM only
666
+ * when PLAN is the currently active chart mode — hydrating a chart that
667
+ * isn't on screen must not visibly disturb whatever IS on screen (mirrors
668
+ * setChartMode()'s own full-repaint-on-activation behavior).
669
+ */
670
+ export declare function setPlanChart(payload: Any): void;
671
+
537
672
  /**
538
673
  * Set a plugin's custom state for a specific tooth. Triggers SVG re-render
539
674
  * for that tooth and updates the tooltip.