@silurus/ooxml 0.86.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +42 -2
  2. package/dist/assets/render-worker-CeK_iqK3.js +10 -0
  3. package/dist/assets/render-worker-DusrDhPk.js +11 -0
  4. package/dist/assets/render-worker-n2ZG0lrQ.js +31 -0
  5. package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +119 -0
  6. package/dist/{canvas-viewer-mechanics-B3A7KLLi.js → canvas-viewer-mechanics-Cpk0YFvM.js} +301 -155
  7. package/dist/chart-ex.mjs +1 -1
  8. package/dist/cjk-fallback-bLI3z70h.js +46 -0
  9. package/dist/{comment-ui-runtime-ssI6IE39.js → comment-ui-runtime-BfE7MJZn.js} +4 -4
  10. package/dist/comment-ui-runtime-BsK8pmUT.js +2 -0
  11. package/dist/{comment-ui-runtime-DEtgcmj7.js → comment-ui-runtime-DcJOYlw-.js} +5 -5
  12. package/dist/{comments-CAn2A_Xh.js → comments-Diid5ujN.js} +1 -1
  13. package/dist/{document-pull-client-xZrA2IjM.js → document-pull-client-yKxI8aDH.js} +4326 -4238
  14. package/dist/{docx-DzDiGvqe.js → docx-BkSRiy07.js} +541 -349
  15. package/dist/docx.mjs +7 -7
  16. package/dist/docx_parser_bg.wasm +0 -0
  17. package/dist/{dom-interaction-boundary-DK1JLkrz.js → dom-interaction-boundary-CBUQJsIM.js} +63 -57
  18. package/dist/{hyperlink-enyPbflR.js → hyperlink-ArrU3ArU.js} +1014 -951
  19. package/dist/index.mjs +4 -4
  20. package/dist/line-distribute-Dtudnqhs.js +1023 -0
  21. package/dist/math.mjs +2 -2
  22. package/dist/node.mjs +380 -376
  23. package/dist/{pptx-D_U62nl-.js → pptx-62MmVbYB.js} +462 -447
  24. package/dist/pptx.mjs +7 -7
  25. package/dist/pptx_parser_bg.wasm +0 -0
  26. package/dist/region-map.mjs +1 -1
  27. package/dist/{render-DSn0d35X.js → render-8Zo7dnds.js} +31 -29
  28. package/dist/{render-worker-host-CbYDBg7U.js → render-worker-host-BfbnEChF.js} +1 -1
  29. package/dist/{render-worker-host-CO0UYoQh.js → render-worker-host-DNL9dWRh.js} +1 -1
  30. package/dist/{render-worker-host-BHz9vjxB.js → render-worker-host-IkHrYOci.js} +1 -1
  31. package/dist/{resource-measurement-Do07ZRcR.js → resource-measurement-CJsgolre.js} +9 -9
  32. package/dist/{session-C1GYhr6n.js → session-CrU8f8DI.js} +91 -91
  33. package/dist/{slide-pull-client-DuEaUxPw.js → slide-pull-client-B9KA8bU6.js} +1069 -966
  34. package/dist/three-d.mjs +1 -1
  35. package/dist/tiff.mjs +1 -1
  36. package/dist/types/chart-ex.d.ts +2 -2
  37. package/dist/types/docx.d.ts +15 -12
  38. package/dist/types/index.d.ts +23 -18
  39. package/dist/types/math.d.ts +1 -1
  40. package/dist/types/node.d.ts +12 -6
  41. package/dist/types/pptx.d.ts +15 -11
  42. package/dist/types/region-map.d.ts +2 -2
  43. package/dist/types/three-d.d.ts +2 -2
  44. package/dist/types/tiff.d.ts +1 -1
  45. package/dist/types/xlsx.d.ts +15 -11
  46. package/dist/{worksheet-pull-client-eDiHHEG2.js → worksheet-pull-client-eIcQ-xlD.js} +65 -65
  47. package/dist/{xlsx-CMHmYTHP.js → xlsx-CRcSzZNq.js} +1656 -1630
  48. package/dist/xlsx.mjs +4 -4
  49. package/dist/xlsx_parser_bg.wasm +0 -0
  50. package/package.json +1 -1
  51. package/dist/assets/render-worker-BCGnuBLj.js +0 -10
  52. package/dist/assets/render-worker-CB4DxjXg.js +0 -31
  53. package/dist/assets/render-worker-CHW0F0n6.js +0 -11
  54. package/dist/bounded-raw-part-cache-DVx3Camo.js +0 -256
  55. package/dist/comment-ui-runtime-TLHustXJ.js +0 -2
  56. package/dist/line-distribute-BFB575d6.js +0 -1023
  57. /package/dist/{comment-occurrence-Dhdplprg.js → comment-occurrence-C8Y2uoVr.js} +0 -0
  58. /package/dist/{delimited-text-worker-host-DcHj_JZt.js → delimited-text-worker-host-BVY-Ecni.js} +0 -0
  59. /package/dist/{highlight-rect-FuUSmL3a.js → highlight-rect-C5hkRqUr.js} +0 -0
  60. /package/dist/{line-metrics-CBbw80Ko.js → line-metrics-B60C86uh.js} +0 -0
  61. /package/dist/{mathjax-DS69BmJd.js → mathjax-DoyWZbSp.js} +0 -0
  62. /package/dist/{read-only-comment-decoration-BTnWEeo5.js → read-only-comment-decoration-Dz7eTQ4d.js} +0 -0
  63. /package/dist/{read-only-comment-margin-plStyGfE.js → read-only-comment-margin-DkgzASAl.js} +0 -0
  64. /package/dist/{renderer-module-contract-Cu-GKuPd.js → renderer-module-contract-D91rkYHH.js} +0 -0
  65. /package/dist/{source-key-Ktb1GRE5.js → source-key-DIJG8BA0.js} +0 -0
  66. /package/dist/{transfer-mIj7E7NB.js → transfer-p6iCC2R7.js} +0 -0
  67. /package/dist/{visible-index-DPoQYSDt.js → visible-index-BgiHEc1z.js} +0 -0
package/README.md CHANGED
@@ -573,9 +573,49 @@ page count, or completion state changes), `onVisibleSlideChange` (fires when the
573
573
  top-most visible slide or PPTX completion state changes; its slide count is
574
574
  final from first paint), and `onError` (async per-page render failures are routed
575
575
  here instead of crashing the scroll loop). The parse/render knobs from the
576
- headless engines (`mode`, `useGoogleFonts`, `resourceLimits`, the deprecated
576
+ headless engines (`mode`, `useGoogleFonts`, `cjkFallback`, `resourceLimits`, the deprecated
577
577
  `maxZipEntryBytes` alias, `math`, `dpr`) are accepted too.
578
578
 
579
+ ### CJK fallback region
580
+
581
+ All document engines and viewers accept `cjkFallback: 'auto' | 'sc' | 'tc' | 'hk' | 'jp' | 'kr'`.
582
+ The same Unicode Han character can have different regional glyph shapes. This
583
+ option chooses which regional fallback family is tried first when Han text
584
+ reaches font fallback and the document has not already identified a region. It
585
+ does not replace the document's requested font.
586
+
587
+ ```ts
588
+ const viewer = new DocxViewer(canvas, { cjkFallback: 'sc' });
589
+ ```
590
+
591
+ Omitting the option is equivalent to `'auto'`: at load time, resolve the first
592
+ usable CJK language from `<html lang>`, then `navigator.languages` in order,
593
+ then `navigator.language`. If none is available, use `'jp'`. For Chinese,
594
+ explicit Hans/Hant maps to SC/TC and takes precedence over region; without an
595
+ explicit script, HK/MO maps to HK and TW maps to TC. Bare `zh` maps to SC.
596
+ Japanese and Korean map to JP and KR.
597
+ The resolved preference is shared with workers and remains fixed for that load.
598
+
599
+ The requested font remains first. Recognized regional CJK font names, an East
600
+ Asian run language where the format provides one, and unambiguous Kana or
601
+ Hangul can determine the region before `cjkFallback` is consulted. Text without
602
+ Han keeps its existing font route. For example, `cjkFallback: 'sc'` selects SC
603
+ for otherwise unqualified Han text, but a Meiryo run or text containing Kana
604
+ continues to select JP.
605
+
606
+ No migration is required. Set an explicit region when the fallback choice must
607
+ not depend on the browser locale, server, or Node host. This makes the regional
608
+ choice deterministic; it does not by itself guarantee pixel-identical output
609
+ across machines because the available fonts still matter. `cjkFallback` does
610
+ not download fonts. Use `useGoogleFonts: true` or provide local/self-hosted
611
+ fallback fonts when the same fallback faces must be available everywhere.
612
+
613
+ HK retains the existing sans-only webfont support. This option covers document
614
+ text, spreadsheet cells/shapes, and slide text; embedded chart and equation
615
+ renderers retain their own font policies. XLSX automatic script inference uses
616
+ the shared-string table; inline cell strings and shape text do not contribute
617
+ to that workbook-level inference.
618
+
579
619
  ### Markdown export
580
620
 
581
621
  Every headless engine can produce a best-effort, text-focused GitHub-flavoured
@@ -1099,7 +1139,7 @@ try {
1099
1139
  The package counters and raster-image guards are deterministic admission limits, not exact JavaScript/WASM process-memory accounting. XML trees, document models, canvas backing stores, browser decoder overhead, renderer state, and browser-managed SVG/vector parse or decoded storage can still require several times the measured input. SVG has no portable decoded-byte measure or explicit browser release primitive; the library count-bounds its cache and revokes owned object URLs, but cannot charge it as RGBA bytes. The defaults therefore reduce risk but cannot promise that an OOM is impossible on every device. Running parse and render work in `mode: 'worker'` can contain many failures away from the main UI thread, but a Worker is not a separate operating-system process or a strict memory sandbox.
1100
1140
 
1101
1141
  A measured limit crossing is reported as `OoxmlResourceLimitError`. A residual WASM failure that reaches a recognized trap-shaped boundary is reported conservatively as `parser-crashed`, not `parser-oom`: with the current aborting Rust/WASM boundary, panic, allocation failure, explicit `unreachable`, and stack overflow can lose their distinct causes and converge on the same generic runtime error. Inferring OOM from an exception class or message would misclassify some parser defects as large-file failures. Reliable OOM classification would require preserving a structured cause before the trap across every relevant allocation path; it cannot be recovered from the generic trap afterward. The WebAssembly JavaScript embedding also permits implementation-defined stack/OOM failures, including an indistinguishable plain `Error` or process termination, so converting and poisoning every engine-level failure cannot be guaranteed.
1102
- - **No network by default.** The library does not send telemetry or analytics, and does not contact third-party services unless you ask it to. In particular, theme webfonts, Office font metric substitutes (Carlito/Caladea), and the script fallback fonts are **not** loaded from Google Fonts unless you pass `useGoogleFonts: true` to the relevant `Viewer` / `load(...)` options — supported uniformly by `DocxViewer`, `PptxViewer`, `XlsxViewer`, and `XlsxSheetViewer`. When enabled, fonts for non-Latin scripts are supplied on demand from Noto families so text does not fall back to tofu: Arabic (Noto Naskh/Sans Arabic), CJK (Noto Sans/Serif KR · SC · TC · JP, picked per document language so shared Han glyphs take the right shapes), Cyrillic (Noto Sans/Serif), Hebrew (Noto Sans/Serif Hebrew, RTL), Thai (Noto Sans Thai) and Devanagari (Noto Sans Devanagari). No font binaries ship in the bundle. Enabling this option causes the end-user's browser to send an HTTP request (IP and User-Agent) to `fonts.googleapis.com`, which may have GDPR implications for your application — consider self-hosting the required fonts via `@font-face` instead.
1142
+ - **No network by default.** The library does not send telemetry or analytics, and does not contact third-party services unless you ask it to. In particular, theme webfonts, Office font metric substitutes (Carlito/Caladea), and the script fallback fonts are **not** loaded from Google Fonts unless you pass `useGoogleFonts: true` to the relevant `Viewer` / `load(...)` options — supported uniformly by `DocxViewer`, `PptxViewer`, `XlsxViewer`, and `XlsxSheetViewer`. When enabled, fonts for non-Latin scripts are supplied on demand from Noto families so text does not fall back to tofu: Arabic (Noto Naskh/Sans Arabic), CJK (Noto Sans/Serif KR · SC · TC · JP, plus Noto Sans HK, picked per document language so shared Han glyphs take the right shapes), Cyrillic (Noto Sans/Serif), Hebrew (Noto Sans/Serif Hebrew, RTL), Thai (Noto Sans Thai) and Devanagari (Noto Sans Devanagari). No font binaries ship in the bundle. This sends the end-user's IP and User-Agent to `fonts.googleapis.com`, which may have GDPR implications.
1103
1143
  - **XML parsing.** Uses `roxmltree`, which does not resolve external entities (XXE-safe by default).
1104
1144
  - **Encrypted OOXML ([MS-OFFCRYPTO] Agile Encryption).** Password-protected `.docx` / `.xlsx` / `.pptx` files are OLE2/CFB containers, not ZIPs. Pass `password` to `load(...)` and the file is decrypted **client-side** via WebCrypto — no bytes and no password leave the browser:
1105
1145
  ```ts