react-advanced-odontogram 2.1.0 → 2.3.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
- # 🦷 React Odontogram Modul
1
+ # 🦷 React Advanced Odontogram
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.3.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";
@@ -65,16 +71,14 @@ Per-site probing depth, gingival margin, bleeding on probing (+ suppuration) at
65
71
  - 🔍 Multi-surface caries & fillings (ICDAS / CARS severity, root & radiographic caries), endo & AAE pulp diagnosis, apical diagnosis, peri-implant status, wear, discoloration, orthodontics
66
72
  - 🩺 Full periodontal module (see above) + 2017 classification
67
73
  - 🔗 **HL7 FHIR R4** export/import; JSON export/import with migrations
68
- - 🖼️ 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
74
+ - 🖼️ PNG / JPG / SVG chart export and a customizable, **multilingual PDF report** (jsPDF, lazy-loaded) — colour themes, a grouped dentition-summary table, a periodontal chart/description, and bundled Unicode fonts so every UI language (incl. Hungarian accents, Cyrillic, Arabic RTL and Chinese) renders correctly
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;
@@ -202,15 +243,10 @@ export declare function getIcdasEnabled(): boolean;
202
243
  */
203
244
  export declare function getNotesEnabled(): boolean;
204
245
 
205
- /**
206
- * Build a human-readable, localized summary of the current odontogram state:
207
- * tooth counts, present/missing lists, and caries / fillings / endo /
208
- * prosthetics / periodontal sections. Numbers respect the active numbering
209
- * system. Intended for the optional "tooth information" panel; call
210
- * {@link onStateChange} to refresh it on edits.
211
- */
212
246
  export declare function getOdontogramSummary(): OdontogramSummary;
213
247
 
248
+ export declare function getPdfSettings(): PdfSettings;
249
+
214
250
  /** Current perio index-name display mode. Defaults to `"translated"`. */
215
251
  export declare function getPerioIndexNameMode(): PerioIndexNameMode;
216
252
 
@@ -220,6 +256,31 @@ export declare function getPerioRowVisibility(): Record<PerioRowId, boolean>;
220
256
  /** Current perio-chart housing mode. Defaults to `"toggle"`. */
221
257
  export declare function getPerioViewMode(): PerioViewMode;
222
258
 
259
+ /**
260
+ * Compare the "status" chart against the "plan" chart, tooth by tooth and
261
+ * axis by axis (see {@link DIFF_AXES}), and report every axis whose label
262
+ * differs. Pure and read-only: never mutates either chart, never touches the
263
+ * DOM, never renders — a `parity.test.ts`-safe addition.
264
+ *
265
+ * Returns `[]` whenever the plan chart hasn't been initialized yet (no plan
266
+ * exists to diff against). A tooth absent from either chart resolves via
267
+ * `defaultState()`, so a status-only or plan-only tooth still diffs correctly
268
+ * against the clinical default rather than throwing.
269
+ *
270
+ * Iterates the fixed `ALL_TEETH` list (not chart key insertion order), so
271
+ * results are always grouped by tooth in the same stable clinical order the
272
+ * rest of the app already uses (quadrant-by-quadrant); within a tooth,
273
+ * entries follow `DIFF_AXES` order.
274
+ */
275
+ export declare function getPlanChanges(): PlanChange[];
276
+
277
+ /**
278
+ * Export the PLAN chart's payload alone: same shape as the status export
279
+ * (`{version, globals, teeth}`), but `teeth` is collected from `charts.plan`.
280
+ * `globals` are shared app-level settings, not owned by either chart.
281
+ */
282
+ export declare function getPlanChart(): Any;
283
+
223
284
  /**
224
285
  * Get a plugin's custom state for a specific tooth.
225
286
  *
@@ -242,6 +303,12 @@ export declare function getRootCariesMode(): RootCariesMode;
242
303
 
243
304
  export declare function getSecondaryCariesMode(): SecondaryCariesMode;
244
305
 
306
+ /**
307
+ * Export the STATUS chart's payload — identical to exportStatus()'s JSON
308
+ * (status-primary; unaffected by the current chart mode).
309
+ */
310
+ export declare function getStatusChart(): Any;
311
+
245
312
  export declare function getSurfaceNotation(): SurfaceNotation;
246
313
 
247
314
  /**
@@ -255,9 +322,27 @@ export declare function getToothStateSummary(toothNo: number): string[];
255
322
 
256
323
  export declare function getWearDetailLevel(): ToothDetailLevel;
257
324
 
325
+ /** UI-3b: true iff ANY periodontal axis has been charted anywhere in the
326
+ * mouth. Used to auto-skip the perio section of an export and to disable the
327
+ * perio image-export menu items on a blank chart. Derived entirely from
328
+ * `getPerioSummary()` — no new traversal. */
329
+ export declare function hasAnyPerioData(): boolean;
330
+
331
+ export declare function importStatus(data: Any): void;
332
+
333
+ /**
334
+ * Initialise the odontogram engine: wire up DOM controls, build the SVG tooth
335
+ * grid, and start listening for i18n changes. Safe to call multiple times
336
+ * (subsequent calls are no-ops).
337
+ */
338
+ export declare function initOdontogram(): Promise<void>;
339
+
258
340
  /** Whether a status-vs-plan divergence confirm is awaiting the user's choice. */
259
341
  export declare function isDualStateConfirmPending(): boolean;
260
342
 
343
+ /** Whether the perio-chart overlay is currently open. */
344
+ export declare function isPerioOverlayOpen(): boolean;
345
+
261
346
  /**
262
347
  * Supported UI languages.
263
348
  *
@@ -274,8 +359,9 @@ export declare function isDualStateConfirmPending(): boolean;
274
359
  * | pt-br | Portuguese (Brazil) |
275
360
  * | zh | Chinese (Simplified) |
276
361
  * | ar | Arabic (RTL — UI mirrors, dental/perio charts pinned LTR) |
362
+ * | fr | French |
277
363
  */
278
- declare type Language = "hu" | "en" | "de" | "es" | "it" | "sk" | "pl" | "ru" | "pt-br" | "zh" | "ar";
364
+ declare type Language = "hu" | "en" | "de" | "es" | "it" | "sk" | "pl" | "ru" | "pt-br" | "zh" | "ar" | "fr";
279
365
 
280
366
  /**
281
367
  * Supported tooth numbering systems.
@@ -337,6 +423,13 @@ export declare type OdontogramSummary = {
337
423
  overview: string;
338
424
  permanentList: string | null;
339
425
  missingList: string | null;
426
+ /** 2.2.3 (round 2): grouped dentition table (replaces the flat permanent/
427
+ * missing lists in the panel + PDF; the lists stay for back-compat). */
428
+ toothTable: OdontogramToothTable;
429
+ /** 2.2.3 (round 2): true when any odontogram-markable periodontal finding
430
+ * (inflammation, mobility, calculus, …) exists — drives showing the perio
431
+ * summary line in the PDF's odontogram section even with no perio module. */
432
+ periodontalHasFindings: boolean;
340
433
  sections: OdontogramSummarySection[];
341
434
  /** Implants heading + list — only present when at least one implant exists. */
342
435
  implants: {
@@ -351,6 +444,13 @@ export declare type OdontogramSummary = {
351
444
  * list. The "What changes" box in App.tsx renders from this field only
352
445
  * when it's non-empty. */
353
446
  plannedChanges: PlanChange[];
447
+ /** 2.2.1: per-tooth free-text notes — one "&lt;tooth&gt;: &lt;note&gt;" line per tooth
448
+ * that carries a note (gated on the notes-enabled setting, like the tooltip).
449
+ * `null` when no tooth has a note, so the panel/PDF omit the section entirely. */
450
+ individualNotes: {
451
+ heading: string;
452
+ items: string[];
453
+ } | null;
354
454
  };
355
455
 
356
456
  /** One heading + its per-tooth entries in the tooth-information summary. */
@@ -405,6 +505,23 @@ export declare type OdontogramThemeConfig = {
405
505
  };
406
506
  };
407
507
 
508
+ /** A grouped dentition overview: category columns (only non-empty ones) ×
509
+ * anatomical group rows (whole mouth / jaw / quadrant / sextant), each cell a
510
+ * list of that group's teeth of that category, tagged with a status. */
511
+ declare interface OdontogramToothTable {
512
+ columns: {
513
+ key: string;
514
+ label: string;
515
+ }[];
516
+ rows: {
517
+ key: string;
518
+ label: string;
519
+ cells: Record<string, ToothTableCell[]>;
520
+ }[];
521
+ /** Localized note explaining the bold / bold-italic emphasis. */
522
+ legend: string;
523
+ }
524
+
408
525
  /**
409
526
  * Subscribe to odontogram state changes. The callback runs after any tooth
410
527
  * state edit, the edentulous toggle, or an import.
@@ -414,6 +531,100 @@ export declare type OdontogramThemeConfig = {
414
531
  */
415
532
  export declare function onStateChange(cb: () => void): () => void;
416
533
 
534
+ /** Open the perio-chart overlay. No-op (still notifies) if already open. */
535
+ export declare function openPerioOverlay(): void;
536
+
537
+ declare type PdfBorderThickness = "thin" | "medium" | "thick";
538
+
539
+ /** 2.2.3: selectable report colour themes — the default "blue" reproduces the
540
+ * 2.2.2 look; the other three are distinct but equally calm/medical. */
541
+ declare type PdfColorTheme = "blue" | "teal" | "amber" | "slate";
542
+
543
+ declare type PdfDateFormat = "iso" | "dmy" | "mdy";
544
+
545
+ /** UI-3b Task 6/7: which PDF sections the user opted into. The perio
546
+ * sections are additionally auto-skipped whenever `data.hasPerio` is false
547
+ * (see {@link assemblePdf}), regardless of these flags — a blank perio
548
+ * chart never gets an empty "Periodontal status" page. */
549
+ declare interface PdfExportOptions {
550
+ patientData: boolean;
551
+ /** 2.2.1: the odontogram chart IMAGE. Split out of the former combined
552
+ * `odontogram` flag so the chart and its prose description are independently
553
+ * selectable in the export dialog. */
554
+ odontogramChart: boolean;
555
+ /** 2.2.1: the whole-mouth odontogram summary PROSE (was bundled with the
556
+ * chart image under the old `odontogram` flag). */
557
+ odontogramDescription: boolean;
558
+ /** 2.2.1: the per-tooth "Individual notes" section — omitted whenever no
559
+ * tooth carries a note (`data.individualNotes` empty), regardless of this
560
+ * flag. */
561
+ individualNotes: boolean;
562
+ perioStatus: boolean;
563
+ perioDescription: boolean;
564
+ }
565
+
566
+ declare type PdfPerioFontSize = "small" | "normal" | "xlarge";
567
+
568
+ declare type PdfPerioLabelPlacement = "center" | "edge";
569
+
570
+ declare interface PdfSettings {
571
+ /** Placeholder patient name when the case has none (default "John Doe"). */
572
+ defaultName: string;
573
+ /** Placeholder DOB (ISO `YYYY-MM-DD`) when the case has none. */
574
+ defaultDob: string;
575
+ /** Show the patient's age (in parentheses) after the DOB. */
576
+ showAge: boolean;
577
+ /** Date order for DOB / exam date / generation timestamp. */
578
+ dateFormat: PdfDateFormat;
579
+ /** Report colour theme. */
580
+ colorTheme: PdfColorTheme;
581
+ /** Show the bone/gum base layer on the dental chart. */
582
+ showBone: boolean;
583
+ /** Show the healthy-pulp layer on the dental chart. */
584
+ showHealthyPulp: boolean;
585
+ /** How close the teeth sit — closer spacing yields a taller chart image. */
586
+ toothSpacing: PdfToothSpacing;
587
+ /** Draw a frame around the dental-chart image. */
588
+ border: boolean;
589
+ borderThickness: PdfBorderThickness;
590
+ /** Frame colour (CSS hex, default black). */
591
+ borderColor: string;
592
+ /** Tooth-number label size. */
593
+ toothNumberSize: PdfToothNumberSize;
594
+ /** Include the whole-mouth prose description of the chart. */
595
+ includeOdontogramText: boolean;
596
+ /** Include the tabular findings/prosthetic summary. */
597
+ includeOdontogramTable: boolean;
598
+ /** Perio-chart tooth spacing (closer → taller chart image). */
599
+ perioToothSpacing: PdfToothSpacing;
600
+ /** Show numeric rows that have no charted value anywhere. */
601
+ perioShowEmptyRows: boolean;
602
+ /** Buccal / Lingual-Palatal band-label placement. */
603
+ perioLabelPlacement: PdfPerioLabelPlacement;
604
+ /** Perio-chart row/label font size. */
605
+ perioFontSize: PdfPerioFontSize;
606
+ /** Include the periodontal metrics + classification table. */
607
+ includePerioTable: boolean;
608
+ /** Include the abbreviation glossary. */
609
+ includePerioAbbrev: boolean;
610
+ /** Show the medical disclaimer at the bottom of the report. */
611
+ showDisclaimer: boolean;
612
+ /** Custom disclaimer text; empty = use the localized default. Editable only
613
+ * while `showDisclaimer` is on. */
614
+ disclaimerText: string;
615
+ /** Show the generation / version / attribution stamp. */
616
+ showGenerator: boolean;
617
+ /** How the dentition overview table is grouped (also drives the on-screen
618
+ * Tooth-information panel table). */
619
+ summaryGrouping: PdfSummaryGrouping;
620
+ }
621
+
622
+ declare type PdfSummaryGrouping = "whole" | "jaw" | "quadrant" | "sextant";
623
+
624
+ declare type PdfToothNumberSize = "small" | "normal" | "xlarge";
625
+
626
+ declare type PdfToothSpacing = "wide" | "medium" | "close";
627
+
417
628
  /**
418
629
  * Full-screen perio-chart overlay (periodontal-arc sub-project P2). Task 1
419
630
  * shipped the shell (dialog contract, open/close API) with an empty
@@ -503,6 +714,20 @@ export declare type SecondaryCariesMode = "simple" | "standard" | "full";
503
714
 
504
715
  export declare function setCariesDepthEnabled(value: boolean): void;
505
716
 
717
+ /**
718
+ * Switch the active chart between "status" (current findings) and "plan"
719
+ * (proposed treatment). The first time "plan" is entered, it is deep-cloned
720
+ * from "status" (see {@link cloneChart}); later switches reuse the existing
721
+ * plan chart untouched. Re-renders every tooth from the newly active chart
722
+ * via the SAME full-repaint mechanism `importStatus()` uses, so no new
723
+ * render path is introduced and SVG output stays byte-identical to the
724
+ * single-chart render (parity is unaffected — only WHICH chart is active
725
+ * changes, never how a chart renders).
726
+ *
727
+ * @param mode - "status" or "plan"; any other value is ignored.
728
+ */
729
+ export declare function setChartMode(mode: ChartMode): void;
730
+
506
731
  export declare function setDiscolorationDetailLevel(value: ToothDetailLevel): void;
507
732
 
508
733
  /** Toggle visibility of the healthy-pulp layer on all teeth. */
@@ -522,9 +747,17 @@ export declare function setImportFormat(format: "status" | "fhir"): void;
522
747
  */
523
748
  export declare function setNotesEnabled(value: boolean): void;
524
749
 
750
+ /**
751
+ * Switch the displayed tooth numbering system and re-render all tooth labels.
752
+ * @param system - The target {@link NumberingSystem}.
753
+ */
754
+ export declare function setNumberingSystem(system: NumberingSystem): void;
755
+
525
756
  /** Toggle visibility of occlusal-view tiles (premolars and molars). */
526
757
  export declare function setOcclusalVisible(on: Any): void;
527
758
 
759
+ export declare function setPdfSettings(patch: Partial<PdfSettings>): void;
760
+
528
761
  /** Switch the perio index-name display mode. No-op (still notifies) if unchanged. */
529
762
  export declare function setPerioIndexNameMode(mode: PerioIndexNameMode): void;
530
763
 
@@ -534,6 +767,16 @@ export declare function setPerioRowVisibility(id: PerioRowId, visible: boolean):
534
767
  /** Switch the perio-chart housing mode. No-op (still notifies) if unchanged. */
535
768
  export declare function setPerioViewMode(mode: PerioViewMode): void;
536
769
 
770
+ /**
771
+ * Hydrate `payload.teeth` into the PLAN chart ONLY (status is left
772
+ * untouched), mirroring the per-tooth hydrate importStatus() performs for
773
+ * the status chart. Marks the plan chart initialized. Repaints the DOM only
774
+ * when PLAN is the currently active chart mode — hydrating a chart that
775
+ * isn't on screen must not visibly disturb whatever IS on screen (mirrors
776
+ * setChartMode()'s own full-repaint-on-activation behavior).
777
+ */
778
+ export declare function setPlanChart(payload: Any): void;
779
+
537
780
  /**
538
781
  * Set a plugin's custom state for a specific tooth. Triggers SVG re-render
539
782
  * for that tooth and updates the tooltip.
@@ -578,4 +821,16 @@ export declare type SurfaceNotation = "simple" | "full";
578
821
 
579
822
  export declare type ToothDetailLevel = "simple" | "complex";
580
823
 
824
+ declare interface ToothTableCell {
825
+ toothNo: number;
826
+ label: string;
827
+ status: ToothTableStatus;
828
+ }
829
+
830
+ /** 2.2.3 (round 2): per-tooth status in the grouped dentition table — `empty`
831
+ * (nothing charted), `content` (has some finding/treatment — shown bold/accent),
832
+ * `problem` (caries / root inflammation / diagnosis / wear / discoloration —
833
+ * shown bold-italic in a warning colour). */
834
+ declare type ToothTableStatus = "empty" | "content" | "problem";
835
+
581
836
  export { }
@@ -0,0 +1,83 @@
1
+ const c = {
2
+ 1569: [65152],
3
+ 1570: [65153, 65154],
4
+ 1571: [65155, 65156],
5
+ 1572: [65157, 65158],
6
+ 1573: [65159, 65160],
7
+ 1574: [65161, 65162, 65163, 65164],
8
+ 1575: [65165, 65166],
9
+ 1576: [65167, 65168, 65169, 65170],
10
+ 1577: [65171, 65172],
11
+ 1578: [65173, 65174, 65175, 65176],
12
+ 1579: [65177, 65178, 65179, 65180],
13
+ 1580: [65181, 65182, 65183, 65184],
14
+ 1581: [65185, 65186, 65187, 65188],
15
+ 1582: [65189, 65190, 65191, 65192],
16
+ 1583: [65193, 65194],
17
+ 1584: [65195, 65196],
18
+ 1585: [65197, 65198],
19
+ 1586: [65199, 65200],
20
+ 1587: [65201, 65202, 65203, 65204],
21
+ 1588: [65205, 65206, 65207, 65208],
22
+ 1589: [65209, 65210, 65211, 65212],
23
+ 1590: [65213, 65214, 65215, 65216],
24
+ 1591: [65217, 65218, 65219, 65220],
25
+ 1592: [65221, 65222, 65223, 65224],
26
+ 1593: [65225, 65226, 65227, 65228],
27
+ 1594: [65229, 65230, 65231, 65232],
28
+ 1601: [65233, 65234, 65235, 65236],
29
+ 1602: [65237, 65238, 65239, 65240],
30
+ 1603: [65241, 65242, 65243, 65244],
31
+ 1604: [65245, 65246, 65247, 65248],
32
+ 1605: [65249, 65250, 65251, 65252],
33
+ 1606: [65253, 65254, 65255, 65256],
34
+ 1607: [65257, 65258, 65259, 65260],
35
+ 1608: [65261, 65262],
36
+ 1609: [65263, 65264],
37
+ 1610: [65265, 65266, 65267, 65268]
38
+ }, F = (t) => t in c, g = (t) => t >= 1536 && t <= 1791 || t >= 64336 && t <= 65023 || t >= 65136 && t <= 65279;
39
+ function d(t) {
40
+ for (const r of t) if (g(r.codePointAt(0))) return !0;
41
+ return !1;
42
+ }
43
+ function P(t) {
44
+ const r = t.map((n) => n.codePointAt(0)), o = (n) => (c[n]?.length ?? 0) === 4, e = (n) => (c[n]?.length ?? 0) >= 2;
45
+ return t.map((n, s) => {
46
+ const a = r[s], f = c[a];
47
+ if (!f) return n;
48
+ const l = s > 0 ? r[s - 1] : 0, u = s < r.length - 1 ? r[s + 1] : 0, h = F(l) && o(l) && e(a), m = o(a) && F(u) && e(u);
49
+ let i = 0;
50
+ h && m ? i = 3 : h ? i = 1 : m && (i = 2);
51
+ const A = f[i] ?? f[0];
52
+ return String.fromCodePoint(A);
53
+ });
54
+ }
55
+ function p(t) {
56
+ const r = [];
57
+ for (const o of t) {
58
+ const e = g(o.codePointAt(0)), n = r[r.length - 1];
59
+ !n || n.rtl !== e ? r.push({ rtl: e, chars: [o] }) : n.chars.push(o);
60
+ }
61
+ return r.reverse().map((o) => o.rtl ? o.chars.reverse().join("") : o.chars.join("")).join("");
62
+ }
63
+ function j(t) {
64
+ if (!t || !d(t)) return t;
65
+ const r = Array.from(t);
66
+ return p(P(r));
67
+ }
68
+ async function b(t) {
69
+ if (t === "ar") {
70
+ const { registerArabicFont: e, PDF_FONT_ARABIC: n } = await import("./notoArabic-En58EmGw.js");
71
+ return { family: n, register: e, transform: j };
72
+ }
73
+ if (t === "zh") {
74
+ const { registerCjkFont: e, PDF_FONT_CJK: n } = await import("./notoSC-G1i3iX-D.js");
75
+ return { family: n, register: e, transform: (s) => s };
76
+ }
77
+ const { registerRobotoFont: r, PDF_FONT_FAMILY: o } = await import("./roboto-Bywi16HJ.js");
78
+ return { family: o, register: r, transform: (e) => e };
79
+ }
80
+ export {
81
+ b as loadPdfFont
82
+ };
83
+ //# sourceMappingURL=loader-BN_gLe6T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader-BN_gLe6T.js","sources":["../src/fonts/arabicShaper.ts","../src/fonts/loader.ts"],"sourcesContent":["// Part of React Advanced Odontogram - https://github.com/ZoliQua/React-Odontogram-Modul\n// Created by Zoltan Dul (https://github.com/ZoliQua) 2025-2026\n//\n// Round 2 (phase 2): Arabic text shaping for the PDF report. jsPDF applies NO\n// OpenType layout (GSUB/GPOS), so it draws Arabic base letters in their\n// disconnected ISOLATED forms, left-to-right — unreadable. `shapeArabic()`\n// pre-processes a string into what jsPDF must be handed directly:\n// 1. contextual joining — map each Arabic letter to its isolated/initial/\n// medial/final Presentation-Forms-B glyph based on its neighbours, and\n// 2. a SIMPLIFIED bidi reorder — reverse RTL runs (and the run order) so a\n// left-drawn line reads right-to-left, while Latin/digit runs keep order.\n//\n// This is a pragmatic shaper for the report's mostly-pure-Arabic labels, NOT a\n// full Unicode Bidirectional Algorithm: complex mixed-direction lines (Arabic\n// interleaved with Latin abbreviations/numbers) may not be perfectly ordered.\n// Lam-alef ligatures and tashkeel (combining marks) are not composed.\n\n/** base Arabic codepoint -> its Presentation-Forms-B glyphs.\n * length 4 = dual-joining [isolated, final, initial, medial];\n * length 2 = right-joining [isolated, final] (never connects to the NEXT letter);\n * length 1 = non-joining [isolated]. */\nconst FORMS: Record<number, number[]> = {\n 0x0621: [0xFE80],\n 0x0622: [0xFE81, 0xFE82],\n 0x0623: [0xFE83, 0xFE84],\n 0x0624: [0xFE85, 0xFE86],\n 0x0625: [0xFE87, 0xFE88],\n 0x0626: [0xFE89, 0xFE8A, 0xFE8B, 0xFE8C],\n 0x0627: [0xFE8D, 0xFE8E],\n 0x0628: [0xFE8F, 0xFE90, 0xFE91, 0xFE92],\n 0x0629: [0xFE93, 0xFE94],\n 0x062A: [0xFE95, 0xFE96, 0xFE97, 0xFE98],\n 0x062B: [0xFE99, 0xFE9A, 0xFE9B, 0xFE9C],\n 0x062C: [0xFE9D, 0xFE9E, 0xFE9F, 0xFEA0],\n 0x062D: [0xFEA1, 0xFEA2, 0xFEA3, 0xFEA4],\n 0x062E: [0xFEA5, 0xFEA6, 0xFEA7, 0xFEA8],\n 0x062F: [0xFEA9, 0xFEAA],\n 0x0630: [0xFEAB, 0xFEAC],\n 0x0631: [0xFEAD, 0xFEAE],\n 0x0632: [0xFEAF, 0xFEB0],\n 0x0633: [0xFEB1, 0xFEB2, 0xFEB3, 0xFEB4],\n 0x0634: [0xFEB5, 0xFEB6, 0xFEB7, 0xFEB8],\n 0x0635: [0xFEB9, 0xFEBA, 0xFEBB, 0xFEBC],\n 0x0636: [0xFEBD, 0xFEBE, 0xFEBF, 0xFEC0],\n 0x0637: [0xFEC1, 0xFEC2, 0xFEC3, 0xFEC4],\n 0x0638: [0xFEC5, 0xFEC6, 0xFEC7, 0xFEC8],\n 0x0639: [0xFEC9, 0xFECA, 0xFECB, 0xFECC],\n 0x063A: [0xFECD, 0xFECE, 0xFECF, 0xFED0],\n 0x0641: [0xFED1, 0xFED2, 0xFED3, 0xFED4],\n 0x0642: [0xFED5, 0xFED6, 0xFED7, 0xFED8],\n 0x0643: [0xFED9, 0xFEDA, 0xFEDB, 0xFEDC],\n 0x0644: [0xFEDD, 0xFEDE, 0xFEDF, 0xFEE0],\n 0x0645: [0xFEE1, 0xFEE2, 0xFEE3, 0xFEE4],\n 0x0646: [0xFEE5, 0xFEE6, 0xFEE7, 0xFEE8],\n 0x0647: [0xFEE9, 0xFEEA, 0xFEEB, 0xFEEC],\n 0x0648: [0xFEED, 0xFEEE],\n 0x0649: [0xFEEF, 0xFEF0],\n 0x064A: [0xFEF1, 0xFEF2, 0xFEF3, 0xFEF4],\n};\n\nconst isArabicLetter = (cp: number) => cp in FORMS;\n/** Any RTL-script codepoint (base Arabic block or a Presentation-Forms glyph). */\nconst isRtl = (cp: number) =>\n (cp >= 0x0600 && cp <= 0x06FF) || (cp >= 0xFB50 && cp <= 0xFDFF) || (cp >= 0xFE70 && cp <= 0xFEFF);\n\n/** True if the string contains any Arabic-script character worth shaping. */\nexport function hasArabic(s: string): boolean {\n for (const ch of s) if (isRtl(ch.codePointAt(0)!)) return true;\n return false;\n}\n\n/** Step 1: contextual joining — replace each Arabic letter with its correct\n * positional Presentation-Forms-B glyph. Non-Arabic characters pass through. */\nfunction joinForms(chars: string[]): string[] {\n const cps = chars.map((c) => c.codePointAt(0)!);\n const dual = (cp: number) => (FORMS[cp]?.length ?? 0) === 4; // can join to the NEXT letter\n const canBack = (cp: number) => (FORMS[cp]?.length ?? 0) >= 2; // can take a final/medial form\n return chars.map((ch, i) => {\n const cp = cps[i];\n const f = FORMS[cp];\n if (!f) return ch;\n const prevCp = i > 0 ? cps[i - 1] : 0;\n const nextCp = i < cps.length - 1 ? cps[i + 1] : 0;\n const joinPrev = isArabicLetter(prevCp) && dual(prevCp) && canBack(cp);\n const joinNext = dual(cp) && isArabicLetter(nextCp) && canBack(nextCp);\n let idx = 0; // isolated\n if (joinPrev && joinNext) idx = 3; // medial\n else if (joinPrev) idx = 1; // final\n else if (joinNext) idx = 2; // initial\n const glyph = f[idx] ?? f[0];\n return String.fromCodePoint(glyph);\n });\n}\n\n/** Step 2: simplified bidi — reverse the sequence of runs, and reverse the\n * characters WITHIN each RTL run, while Latin/digit runs keep their order. */\nfunction bidiReorder(shaped: string[]): string {\n type Run = { rtl: boolean; chars: string[] };\n const runs: Run[] = [];\n for (const ch of shaped) {\n const rtl = isRtl(ch.codePointAt(0)!);\n const last = runs[runs.length - 1];\n if (!last || last.rtl !== rtl) runs.push({ rtl, chars: [ch] });\n else last.chars.push(ch);\n }\n return runs\n .reverse()\n .map((r) => (r.rtl ? r.chars.reverse().join(\"\") : r.chars.join(\"\")))\n .join(\"\");\n}\n\n/**\n * Shape + reorder an Arabic string for direct rendering by jsPDF's `doc.text`.\n * Returns the input unchanged when it contains no Arabic script, so it is safe\n * to apply to every string (Latin/Cyrillic/CJK/numbers pass through untouched).\n */\nexport function shapeArabic(input: string): string {\n if (!input || !hasArabic(input)) return input;\n const chars = Array.from(input);\n return bidiReorder(joinForms(chars));\n}\n","// Part of React Advanced Odontogram - https://github.com/ZoliQua/React-Odontogram-Modul\n// Created by Zoltan Dul (https://github.com/ZoliQua) 2025-2026\n//\n// Round 2 (phase 2): language-aware PDF font loader. Picks the right embedded\n// Unicode font for the active UI language and returns a descriptor the export\n// path uses: the jsPDF family name, a registration fn, and a per-string text\n// transform (Arabic shaping; identity otherwise). Each font module is loaded via\n// a DYNAMIC import so only the font for the language actually being exported is\n// pulled in — the fonts stay code-split out of the main bundle (they are still\n// bundled in the package = fully offline, never fetched from the network).\nimport type { FontRegistrable } from \"./roboto\";\nimport { shapeArabic } from \"./arabicShaper\";\n\nexport interface PdfFont {\n /** jsPDF family name to pass to `doc.setFont(family, style)`. */\n family: string;\n /** Register the font's VFS + styles on a jsPDF doc; false if unsupported. */\n register: (doc: FontRegistrable) => boolean;\n /** Per-string transform applied before `doc.text` (Arabic shaping; else identity). */\n transform: (s: string) => string;\n}\n\n/** Load + describe the PDF font for `lang` (the active UI language code). */\nexport async function loadPdfFont(lang: string): Promise<PdfFont> {\n if (lang === \"ar\") {\n const { registerArabicFont, PDF_FONT_ARABIC } = await import(\"./notoArabic\");\n return { family: PDF_FONT_ARABIC, register: registerArabicFont, transform: shapeArabic };\n }\n if (lang === \"zh\") {\n const { registerCjkFont, PDF_FONT_CJK } = await import(\"./notoSC\");\n return { family: PDF_FONT_CJK, register: registerCjkFont, transform: (s) => s };\n }\n // hu, en, de, es, it, sk, pl, ru, pt-br, fr — Latin + Cyrillic.\n const { registerRobotoFont, PDF_FONT_FAMILY } = await import(\"./roboto\");\n return { family: PDF_FONT_FAMILY, register: registerRobotoFont, transform: (s) => s };\n}\n"],"names":["FORMS","isArabicLetter","cp","isRtl","hasArabic","s","ch","joinForms","chars","cps","c","dual","canBack","i","prevCp","nextCp","joinPrev","joinNext","idx","glyph","bidiReorder","shaped","runs","rtl","last","r","shapeArabic","input","loadPdfFont","lang","registerArabicFont","PDF_FONT_ARABIC","registerCjkFont","PDF_FONT_CJK","registerRobotoFont","PDF_FONT_FAMILY"],"mappings":"AAqBA,MAAMA,IAAkC;AAAA,EACtC,MAAQ,CAAC,KAAM;AAAA,EACf,MAAQ,CAAC,OAAQ,KAAM;AAAA,EACvB,MAAQ,CAAC,OAAQ,KAAM;AAAA,EACvB,MAAQ,CAAC,OAAQ,KAAM;AAAA,EACvB,MAAQ,CAAC,OAAQ,KAAM;AAAA,EACvB,MAAQ,CAAC,OAAQ,OAAQ,OAAQ,KAAM;AAAA,EACvC,MAAQ,CAAC,OAAQ,KAAM;AAAA,EACvB,MAAQ,CAAC,OAAQ,OAAQ,OAAQ,KAAM;AAAA,EACvC,MAAQ,CAAC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