react-advanced-odontogram 2.2.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,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.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
 
@@ -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
@@ -243,15 +243,10 @@ export declare function getIcdasEnabled(): boolean;
243
243
  */
244
244
  export declare function getNotesEnabled(): boolean;
245
245
 
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
246
  export declare function getOdontogramSummary(): OdontogramSummary;
254
247
 
248
+ export declare function getPdfSettings(): PdfSettings;
249
+
255
250
  /** Current perio index-name display mode. Defaults to `"translated"`. */
256
251
  export declare function getPerioIndexNameMode(): PerioIndexNameMode;
257
252
 
@@ -428,6 +423,13 @@ export declare type OdontogramSummary = {
428
423
  overview: string;
429
424
  permanentList: string | null;
430
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;
431
433
  sections: OdontogramSummarySection[];
432
434
  /** Implants heading + list โ€” only present when at least one implant exists. */
433
435
  implants: {
@@ -442,6 +444,13 @@ export declare type OdontogramSummary = {
442
444
  * list. The "What changes" box in App.tsx renders from this field only
443
445
  * when it's non-empty. */
444
446
  plannedChanges: PlanChange[];
447
+ /** 2.2.1: per-tooth free-text notes โ€” one "<tooth>: <note>" 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;
445
454
  };
446
455
 
447
456
  /** One heading + its per-tooth entries in the tooth-information summary. */
@@ -496,6 +505,23 @@ export declare type OdontogramThemeConfig = {
496
505
  };
497
506
  };
498
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
+
499
525
  /**
500
526
  * Subscribe to odontogram state changes. The callback runs after any tooth
501
527
  * state edit, the edentulous toggle, or an import.
@@ -508,17 +534,97 @@ export declare function onStateChange(cb: () => void): () => void;
508
534
  /** Open the perio-chart overlay. No-op (still notifies) if already open. */
509
535
  export declare function openPerioOverlay(): void;
510
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
+
511
545
  /** UI-3b Task 6/7: which PDF sections the user opted into. The perio
512
546
  * sections are additionally auto-skipped whenever `data.hasPerio` is false
513
547
  * (see {@link assemblePdf}), regardless of these flags โ€” a blank perio
514
548
  * chart never gets an empty "Periodontal status" page. */
515
549
  declare interface PdfExportOptions {
516
550
  patientData: boolean;
517
- odontogram: 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;
518
562
  perioStatus: boolean;
519
563
  perioDescription: boolean;
520
564
  }
521
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
+
522
628
  /**
523
629
  * Full-screen perio-chart overlay (periodontal-arc sub-project P2). Task 1
524
630
  * shipped the shell (dialog contract, open/close API) with an empty
@@ -650,6 +756,8 @@ export declare function setNumberingSystem(system: NumberingSystem): void;
650
756
  /** Toggle visibility of occlusal-view tiles (premolars and molars). */
651
757
  export declare function setOcclusalVisible(on: Any): void;
652
758
 
759
+ export declare function setPdfSettings(patch: Partial<PdfSettings>): void;
760
+
653
761
  /** Switch the perio index-name display mode. No-op (still notifies) if unchanged. */
654
762
  export declare function setPerioIndexNameMode(mode: PerioIndexNameMode): void;
655
763
 
@@ -713,4 +821,16 @@ export declare type SurfaceNotation = "simple" | "full";
713
821
 
714
822
  export declare type ToothDetailLevel = "simple" | "complex";
715
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
+
716
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"],"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