react-advanced-odontogram 2.2.0 → 2.4.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,7 +1,7 @@
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.2.0-green?style=for-the-badge)](https://github.com/ZoliQua/React-Odontogram-Modul/releases)
4
+ [![Version](https://img.shields.io/badge/version-2.4.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
 
@@ -71,7 +71,7 @@ Per-site probing depth, gingival margin, bleeding on probing (+ suppuration) at
71
71
  - 🔍 Multi-surface caries & fillings (ICDAS / CARS severity, root & radiographic caries), endo & AAE pulp diagnosis, apical diagnosis, peri-implant status, wear, discoloration, orthodontics
72
72
  - 🩺 Full periodontal module (see above) + 2017 classification
73
73
  - 🔗 **HL7 FHIR R4** export/import; JSON export/import with migrations
74
- - 🖼️ PNG / JPG / SVG chart export and a **PDF report** (jsPDF, lazy-loaded)
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
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
76
76
 
77
77
  ## 📖 Documentation
package/dist/index.d.ts CHANGED
@@ -7,29 +7,6 @@ export declare function acceptDualStateConfirm(): void;
7
7
 
8
8
  declare type Any = any;
9
9
 
10
- /**
11
- * Root React component for the Odontogram Editor.
12
- *
13
- * Renders the full dental chart UI: top bar with language/numbering/dark-mode
14
- * controls, the SVG tooth grid, and the right-hand control panel for setting
15
- * tooth states (caries, fillings, crowns, endo, inflammation, etc.).
16
- *
17
- * @example
18
- * ```tsx
19
- * // Standalone usage
20
- * <App />
21
- *
22
- * // Controlled by a host application
23
- * <App
24
- * language="en"
25
- * onLanguageChange={setLang}
26
- * numberingSystem="FDI"
27
- * onNumberingChange={setNumbering}
28
- * darkMode={isDark}
29
- * onDarkModeChange={setDark}
30
- * />
31
- * ```
32
- */
33
10
  declare function App({ language, onLanguageChange, numberingSystem, onNumberingChange, darkMode, onDarkModeChange, themeConfig, plugins, readOnly: readOnlyProp, enableNotes, enableIcdas, pulpDetailLevel, secondaryCariesMode, rootCariesMode, radiographicDepthMode, cariesDepthEnabled, wearDetailLevel, discolorationDetailLevel, surfaceNotation, showStatusCard: showStatusCardProp, showOrthoCard: showOrthoCardProp, }: AppProps): JSX_2.Element;
34
11
  export { App as OdontogramShell }
35
12
  export default App;
@@ -152,6 +129,9 @@ export declare function cancelDualStateConfirm(): void;
152
129
 
153
130
  declare type ChartMode = "status" | "plan";
154
131
 
132
+ /** Remove the stored entry for the active (or default) key. */
133
+ export declare function clearPersistedState(): void;
134
+
155
135
  /**
156
136
  * Clear the current tooth selection and reset the active tooth. Useful when
157
137
  * switching to view or quote-builder mode from the host application.
@@ -168,6 +148,17 @@ export declare function closePerioOverlay(): void;
168
148
  */
169
149
  export declare function destroyOdontogram(): void;
170
150
 
151
+ /** Stop persisting. The stored entry is left in place (see clearPersistedState).
152
+ * A pending debounced save is flushed first so the last edit isn't lost. */
153
+ export declare function disablePersistence(): void;
154
+
155
+ /**
156
+ * Turn on localStorage persistence: restores a previously saved case (if any),
157
+ * then saves on every state change. Idempotent — calling again replaces the
158
+ * previous subscription and options. Call AFTER the odontogram has mounted.
159
+ */
160
+ export declare function enablePersistence(options?: PersistenceOptions): void;
161
+
171
162
  /**
172
163
  * Export the current odontogram as an HL7 FHIR R4 collection Bundle (JSON).
173
164
  * @param options - Optional subject reference (e.g. "Patient/123"); when
@@ -183,8 +174,8 @@ export declare function exportFhir(options?: FhirExportOptions): void;
183
174
  export declare function exportImage(format?: "png" | "jpg"): Promise<void>;
184
175
 
185
176
  /**
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
177
+ * Assemble a printable PDF report (jsPDF-native — vector text + raster chart
178
+ * PNGs, no svg2pdf.js). Gathers all `data` (SVG→PNG
188
179
  * rasterization via {@link rasterizeSvgToPng}, summary/classification text,
189
180
  * `hasAnyPerioData()`), drives the export-progress overlay, then hands off
190
181
  * to the PURE `assemblePdf()` (`src/perioPdf.ts`), which decides section
@@ -194,21 +185,20 @@ export declare function exportImage(format?: "png" | "jpg"): Promise<void>;
194
185
  * browser canvas/font internals jsdom doesn't fully provide, so this
195
186
  * wrapper is NOT unit-tested directly — `assemblePdf`'s section-gating IS
196
187
  * 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).
188
+ * `ui3b-export-pdf.test.ts`). This wrapper's own raster→layout→save path is a
189
+ * browser-verify item.
199
190
  */
200
191
  export declare function exportPdf(opts: PdfExportOptions): Promise<void>;
201
192
 
202
- /** UI-3b: export the full perio chart as PNG/JPG (SVG → canvas @2×, via the
193
+ /** Export the full perio chart as PNG/JPG (SVG → canvas @2×, via the
203
194
  * shared {@link rasterizeSvgToCanvas} raster core). */
204
195
  export declare function exportPerioImage(format?: "png" | "jpg"): Promise<void>;
205
196
 
206
- /** UI-3b: export the full perio chart as a standalone vector SVG file. */
197
+ /** Export the full perio chart as a standalone vector SVG file. */
207
198
  export declare function exportPerioSvg(): Promise<void>;
208
199
 
209
200
  export declare function exportStatus(): void;
210
201
 
211
- /** Export the odontogram as a downloadable, scalable SVG file. */
212
202
  export declare function exportSvg(): Promise<void>;
213
203
 
214
204
  /** Options for buildFhirBundle / exportFhir. */
@@ -236,6 +226,14 @@ export declare function getChartMode(): ChartMode;
236
226
 
237
227
  export declare function getDiscolorationDetailLevel(): ToothDetailLevel;
238
228
 
229
+ export declare function getFillingComplexity(): "complex" | "simple";
230
+
231
+ export declare function getFillingDefectEnabled(): boolean;
232
+
233
+ export declare function getFillingMaterialAvailability(): Record<string, boolean>;
234
+
235
+ export declare function getFissureSealingEnabled(): boolean;
236
+
239
237
  export declare function getIcdasEnabled(): boolean;
240
238
 
241
239
  /**
@@ -243,15 +241,10 @@ export declare function getIcdasEnabled(): boolean;
243
241
  */
244
242
  export declare function getNotesEnabled(): boolean;
245
243
 
246
- /**
247
- * Build a human-readable, localized summary of the current odontogram state:
248
- * tooth counts, present/missing lists, and caries / fillings / endo /
249
- * prosthetics / periodontal sections. Numbers respect the active numbering
250
- * system. Intended for the optional "tooth information" panel; call
251
- * {@link onStateChange} to refresh it on edits.
252
- */
253
244
  export declare function getOdontogramSummary(): OdontogramSummary;
254
245
 
246
+ export declare function getPdfSettings(): PdfSettings;
247
+
255
248
  /** Current perio index-name display mode. Defaults to `"translated"`. */
256
249
  export declare function getPerioIndexNameMode(): PerioIndexNameMode;
257
250
 
@@ -327,8 +320,8 @@ export declare function getToothStateSummary(toothNo: number): string[];
327
320
 
328
321
  export declare function getWearDetailLevel(): ToothDetailLevel;
329
322
 
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
323
+ /** True iff ANY periodontal axis has been charted anywhere in the mouth. Used
324
+ * to auto-skip the perio section of an export and to disable the
332
325
  * perio image-export menu items on a blank chart. Derived entirely from
333
326
  * `getPerioSummary()` — no new traversal. */
334
327
  export declare function hasAnyPerioData(): boolean;
@@ -348,6 +341,9 @@ export declare function isDualStateConfirmPending(): boolean;
348
341
  /** Whether the perio-chart overlay is currently open. */
349
342
  export declare function isPerioOverlayOpen(): boolean;
350
343
 
344
+ /** True while a state-change subscription is active. */
345
+ export declare function isPersistenceEnabled(): boolean;
346
+
351
347
  /**
352
348
  * Supported UI languages.
353
349
  *
@@ -428,6 +424,13 @@ export declare type OdontogramSummary = {
428
424
  overview: string;
429
425
  permanentList: string | null;
430
426
  missingList: string | null;
427
+ /** Grouped dentition table (the flat permanent/missing lists stay for
428
+ * back-compat). */
429
+ toothTable: OdontogramToothTable;
430
+ /** True when any odontogram-markable periodontal finding
431
+ * (inflammation, mobility, calculus, …) exists — drives showing the perio
432
+ * summary line in the PDF's odontogram section even with no perio module. */
433
+ periodontalHasFindings: boolean;
431
434
  sections: OdontogramSummarySection[];
432
435
  /** Implants heading + list — only present when at least one implant exists. */
433
436
  implants: {
@@ -436,12 +439,19 @@ export declare type OdontogramSummary = {
436
439
  } | null;
437
440
  periodontalTitle: string;
438
441
  periodontalText: string;
439
- /** R2-B Task 2: the status->plan diff (see {@link getPlanChanges}), verbatim.
442
+ /** The status->plan diff (see {@link getPlanChanges}), verbatim.
440
443
  * `[]` whenever the plan chart hasn't been initialized or plan === status —
441
444
  * a distinct field, not a section, since it's a diff rather than a status
442
445
  * list. The "What changes" box in App.tsx renders from this field only
443
446
  * when it's non-empty. */
444
447
  plannedChanges: PlanChange[];
448
+ /** Per-tooth free-text notes — one "&lt;tooth&gt;: &lt;note&gt;" line per tooth
449
+ * that carries a note (gated on the notes-enabled setting, like the tooltip).
450
+ * `null` when no tooth has a note, so the panel/PDF omit the section entirely. */
451
+ individualNotes: {
452
+ heading: string;
453
+ items: string[];
454
+ } | null;
445
455
  };
446
456
 
447
457
  /** One heading + its per-tooth entries in the tooth-information summary. */
@@ -496,6 +506,23 @@ export declare type OdontogramThemeConfig = {
496
506
  };
497
507
  };
498
508
 
509
+ /** A grouped dentition overview: category columns (only non-empty ones) ×
510
+ * anatomical group rows (whole mouth / jaw / quadrant / sextant), each cell a
511
+ * list of that group's teeth of that category, tagged with a status. */
512
+ declare interface OdontogramToothTable {
513
+ columns: {
514
+ key: string;
515
+ label: string;
516
+ }[];
517
+ rows: {
518
+ key: string;
519
+ label: string;
520
+ cells: Record<string, ToothTableCell[]>;
521
+ }[];
522
+ /** Localized note explaining the bold / bold-italic emphasis. */
523
+ legend: string;
524
+ }
525
+
499
526
  /**
500
527
  * Subscribe to odontogram state changes. The callback runs after any tooth
501
528
  * state edit, the edentulous toggle, or an import.
@@ -508,36 +535,108 @@ export declare function onStateChange(cb: () => void): () => void;
508
535
  /** Open the perio-chart overlay. No-op (still notifies) if already open. */
509
536
  export declare function openPerioOverlay(): void;
510
537
 
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. */
538
+ declare type PdfBorderThickness = "thin" | "medium" | "thick";
539
+
540
+ /** Selectable report colour themes — the default is "blue"; the other three are
541
+ * distinct but equally calm/medical. */
542
+ declare type PdfColorTheme = "blue" | "teal" | "amber" | "slate";
543
+
544
+ declare type PdfDateFormat = "iso" | "dmy" | "mdy";
545
+
546
+ /** Which PDF sections the user opted into. The perio sections are additionally
547
+ * auto-skipped whenever `data.hasPerio` is false (see {@link assemblePdf}),
548
+ * regardless of these flags — a blank perio chart never gets an empty
549
+ * "Periodontal status" page. */
515
550
  declare interface PdfExportOptions {
516
551
  patientData: boolean;
517
- odontogram: boolean;
552
+ /** The odontogram chart IMAGE — selectable independently of its prose
553
+ * description in the export dialog. */
554
+ odontogramChart: boolean;
555
+ /** The whole-mouth odontogram summary PROSE. */
556
+ odontogramDescription: boolean;
557
+ /** The per-tooth "Individual notes" section — omitted whenever no tooth
558
+ * carries a note (`data.individualNotes` empty), regardless of this flag. */
559
+ individualNotes: boolean;
518
560
  perioStatus: boolean;
519
561
  perioDescription: boolean;
520
562
  }
521
563
 
564
+ declare type PdfPerioFontSize = "small" | "normal" | "xlarge";
565
+
566
+ declare type PdfPerioLabelPlacement = "center" | "edge";
567
+
568
+ declare interface PdfSettings {
569
+ /** Placeholder patient name when the case has none (default "John Doe"). */
570
+ defaultName: string;
571
+ /** Placeholder DOB (ISO `YYYY-MM-DD`) when the case has none. */
572
+ defaultDob: string;
573
+ /** Show the patient's age (in parentheses) after the DOB. */
574
+ showAge: boolean;
575
+ /** Date order for DOB / exam date / generation timestamp. */
576
+ dateFormat: PdfDateFormat;
577
+ /** Report colour theme. */
578
+ colorTheme: PdfColorTheme;
579
+ /** Show the bone/gum base layer on the dental chart. */
580
+ showBone: boolean;
581
+ /** Show the healthy-pulp layer on the dental chart. */
582
+ showHealthyPulp: boolean;
583
+ /** How close the teeth sit — closer spacing yields a taller chart image. */
584
+ toothSpacing: PdfToothSpacing;
585
+ /** Draw a frame around the dental-chart image. */
586
+ border: boolean;
587
+ borderThickness: PdfBorderThickness;
588
+ /** Frame colour (CSS hex, default black). */
589
+ borderColor: string;
590
+ /** Tooth-number label size. */
591
+ toothNumberSize: PdfToothNumberSize;
592
+ /** Include the whole-mouth prose description of the chart. */
593
+ includeOdontogramText: boolean;
594
+ /** Include the tabular findings/prosthetic summary. */
595
+ includeOdontogramTable: boolean;
596
+ /** Perio-chart tooth spacing (closer → taller chart image). */
597
+ perioToothSpacing: PdfToothSpacing;
598
+ /** Show numeric rows that have no charted value anywhere. */
599
+ perioShowEmptyRows: boolean;
600
+ /** Buccal / Lingual-Palatal band-label placement. */
601
+ perioLabelPlacement: PdfPerioLabelPlacement;
602
+ /** Perio-chart row/label font size. */
603
+ perioFontSize: PdfPerioFontSize;
604
+ /** Include the periodontal metrics + classification table. */
605
+ includePerioTable: boolean;
606
+ /** Include the abbreviation glossary. */
607
+ includePerioAbbrev: boolean;
608
+ /** Show the medical disclaimer at the bottom of the report. */
609
+ showDisclaimer: boolean;
610
+ /** Custom disclaimer text; empty = use the localized default. Editable only
611
+ * while `showDisclaimer` is on. */
612
+ disclaimerText: string;
613
+ /** Show the generation / version / attribution stamp. */
614
+ showGenerator: boolean;
615
+ /** How the dentition overview table is grouped (also drives the on-screen
616
+ * Tooth-information panel table). */
617
+ summaryGrouping: PdfSummaryGrouping;
618
+ }
619
+
620
+ declare type PdfSummaryGrouping = "whole" | "jaw" | "quadrant" | "sextant";
621
+
622
+ declare type PdfToothNumberSize = "small" | "normal" | "xlarge";
623
+
624
+ declare type PdfToothSpacing = "wide" | "medium" | "close";
625
+
522
626
  /**
523
- * Full-screen perio-chart overlay (periodontal-arc sub-project P2). Task 1
524
- * shipped the shell (dialog contract, open/close API) with an empty
525
- * `#perioOverlayGrid` placeholder; THIS task (Task 2) fills it with the full-mouth
526
- * grid + a summary bar, bound to the P1 data core
527
- * (`setPerioSite`/`getToothPerio`/`getToothCal`/`getPerioSummary`/
528
- * `getPerioChart`). Keyboard auto-advance between cells is Task 3 — plain
529
- * `change` listeners are enough here.
530
- *
531
- * The 32-tooth x 6-site grid (~450+ interactive cells) is built with plain
532
- * DOM (`buildArch`), NOT JSX/React state, and updated via targeted
533
- * `syncToothCells` calls rather than a full React re-render (R3 perf) — see
534
- * `syncOneTooth`/`fullResync` below. Only the compact summary bar is
535
- * React-controlled (`useState`), since re-rendering ~4 numbers on every edit
536
- * is cheap. `suppressResyncRef` prevents the grid's own edits from ALSO
627
+ * Full-mouth perio-chart. The 32-tooth x 6-site grid (~450+ interactive
628
+ * cells) is built with plain DOM (`buildArch`), NOT JSX/React state, and
629
+ * updated via targeted `syncToothCells` calls rather than a full React
630
+ * re-render — see `syncOneTooth`/`fullResync` below. Only the compact summary
631
+ * bar is React-controlled (`useState`), since re-rendering ~4 numbers on every
632
+ * edit is cheap. `suppressResyncRef` prevents the grid's own edits from ALSO
537
633
  * triggering a redundant full resync via the `onStateChange` subscription
538
- * (setPerioSite/setToothMobility both fire it synchronously) — external
539
- * edits (dual-state chart-mode switch, or another consumer editing perio
540
- * data while the overlay is open) still trigger the full resync normally.
634
+ * (setPerioSite/setToothMobility both fire it synchronously) — external edits
635
+ * (dual-state chart-mode switch, or another consumer editing perio data while
636
+ * the overlay is open) still trigger the full resync normally. All writes go
637
+ * through the data core (`setPerioSite`/`getToothPerio`/`getToothCal`/
638
+ * `getPerioSummary`/`getPerioChart`); keyboard auto-advance between cells is
639
+ * handled by `handleGridKeyDown`.
541
640
  *
542
641
  * Layers OVER the odontogram, which it never unmounts: `position: fixed`,
543
642
  * full-screen, high z-index (`.perio-overlay` in `index.css`). Mirrors
@@ -546,17 +645,15 @@ declare interface PdfExportOptions {
546
645
  * single element (`#perioOverlay` itself is the dialog; there is no separate
547
646
  * backdrop element, unlike `SettingsModal`).
548
647
  *
549
- * **"Dental Chart" graphical redesign, Task 1 (presentation only):** the
550
- * optional `inline` prop selects a second chrome for the SAME body (grid +
648
+ * The optional `inline` prop selects a second chrome for the SAME body (grid +
551
649
  * summary bar) — a plain panel (`#perioInlinePanel`) meant to fill the chart
552
650
  * area in place of the hidden-but-mounted odontogram, instead of the
553
651
  * fixed-position modal dialog. `open`/`onClose` are the MODAL chrome's
554
652
  * contract and are ignored when `inline` is true (the caller controls
555
- * mount/unmount of an inline instance directly via conditional rendering,
556
- * the same way any other React content area would be swapped) — there is
557
- * nothing to "close" in an embedded panel. Dialog-only concerns (focus
558
- * trap/restore, Esc-to-close, backdrop click, `role="dialog"`) do not apply
559
- * to the inline chrome at all.
653
+ * mount/unmount of an inline instance directly via conditional rendering) —
654
+ * there is nothing to "close" in an embedded panel. Dialog-only concerns
655
+ * (focus trap/restore, Esc-to-close, backdrop click, `role="dialog"`) do not
656
+ * apply to the inline chrome at all.
560
657
  */
561
658
  export declare function PerioChart({ open, onClose, inline, }: {
562
659
  open?: boolean;
@@ -572,6 +669,15 @@ export declare type PerioRowId = "plaque" | "bop" | "cal" | "gm" | "pd" | "furca
572
669
 
573
670
  export declare type PerioViewMode = "toggle" | "popup";
574
671
 
672
+ export declare type PersistenceOptions = {
673
+ /** localStorage key. Default: "react-advanced-odontogram". */
674
+ key?: string;
675
+ /** Persist the plan chart too (payload's `plan` field). Default: false. */
676
+ includePlan?: boolean;
677
+ /** Called on any storage/parse error instead of console.warn. */
678
+ onError?: (err: Error) => void;
679
+ };
680
+
575
681
  declare type PlanChange = {
576
682
  toothNo: number;
577
683
  axis: string;
@@ -624,6 +730,14 @@ export declare function setChartMode(mode: ChartMode): void;
624
730
 
625
731
  export declare function setDiscolorationDetailLevel(value: ToothDetailLevel): void;
626
732
 
733
+ export declare function setFillingComplexity(v: "complex" | "simple"): void;
734
+
735
+ export declare function setFillingDefectEnabled(v: boolean): void;
736
+
737
+ export declare function setFillingMaterialAvailability(material: string, v: boolean): void;
738
+
739
+ export declare function setFissureSealingEnabled(v: boolean): void;
740
+
627
741
  /** Toggle visibility of the healthy-pulp layer on all teeth. */
628
742
  export declare function setHealthyPulpVisible(on: Any): void;
629
743
 
@@ -650,13 +764,15 @@ export declare function setNumberingSystem(system: NumberingSystem): void;
650
764
  /** Toggle visibility of occlusal-view tiles (premolars and molars). */
651
765
  export declare function setOcclusalVisible(on: Any): void;
652
766
 
653
- /** Switch the perio index-name display mode. No-op (still notifies) if unchanged. */
767
+ export declare function setPdfSettings(patch: Partial<PdfSettings>): void;
768
+
769
+ /** Switch the perio index-name display mode. No-op (does not notify) if unchanged. */
654
770
  export declare function setPerioIndexNameMode(mode: PerioIndexNameMode): void;
655
771
 
656
- /** Show/hide one perio-chart index row. No-op (still notifies) if unchanged. */
772
+ /** Show/hide one perio-chart index row. No-op (does not notify) if unchanged. */
657
773
  export declare function setPerioRowVisibility(id: PerioRowId, visible: boolean): void;
658
774
 
659
- /** Switch the perio-chart housing mode. No-op (still notifies) if unchanged. */
775
+ /** Switch the perio-chart housing mode. No-op (does not notify) if unchanged. */
660
776
  export declare function setPerioViewMode(mode: PerioViewMode): void;
661
777
 
662
778
  /**
@@ -713,4 +829,16 @@ export declare type SurfaceNotation = "simple" | "full";
713
829
 
714
830
  export declare type ToothDetailLevel = "simple" | "complex";
715
831
 
832
+ declare interface ToothTableCell {
833
+ toothNo: number;
834
+ label: string;
835
+ status: ToothTableStatus;
836
+ }
837
+
838
+ /** Per-tooth status in the grouped dentition table — `empty`
839
+ * (nothing charted), `content` (has some finding/treatment — shown bold/accent),
840
+ * `problem` (caries / root inflammation / diagnosis / wear / discoloration —
841
+ * shown bold-italic in a warning colour). */
842
+ declare type ToothTableStatus = "empty" | "content" | "problem";
843
+
716
844
  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// 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// Language-aware PDF font loader. Picks the right embedded Unicode font for the\n// active UI language and returns a descriptor the export path uses: the jsPDF\n// family name, a registration fn, and a per-string text transform (Arabic\n// shaping; identity otherwise). Each font module is loaded via a dynamic import\n// so only the font for the language actually being exported is pulled in — the\n// fonts stay code-split out of the main bundle (they are still bundled in the\n// 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,OAAQ,KAAM;AAAA,EACvB,MAAQ,CAAC,OAAQ,OAAQ,OAAQ,KAAM;AAAA,EACvC,MAAQ,CAAC,OAAQ,OAAQ,OAAQ,KAAM;AAAA,EACvC,MAAQ,CAAC,OAAQ,OAAQ,OAAQ,KAAM;AAAA,EACvC,MAAQ,CAAC,OAAQ,OAAQ,OAAQ,KAAM;AAAA,EACvC,MAAQ,CAAC,OAAQ,OAAQ,OAAQ,KAAM;AAAA,EACvC,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,OAAQ,OAAQ,KAAM;AAAA,EACvC,MAAQ,CAAC,OAAQ,OAAQ,OAAQ,KAAM;AAAA,EACvC,MAAQ,CAAC,OAAQ,OAAQ,OAAQ,KAAM;AAAA,EACvC,MAAQ,CA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