@silurus/ooxml 0.87.0 → 0.89.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 (128) hide show
  1. package/README.md +118 -23
  2. package/THIRD_PARTY_NOTICES.md +7 -6
  3. package/dist/abort-VrnK7mdP.js +10 -0
  4. package/dist/assets/render-worker-CUOU6mL2.js +16 -0
  5. package/dist/assets/render-worker-DOqrFhSU.js +15 -0
  6. package/dist/assets/render-worker-DvWUdZUN.js +35 -0
  7. package/dist/bounded-raw-part-cache-B7JoC1CD.js +64586 -0
  8. package/dist/bundled-asset-url-E2nXURF9.js +15 -0
  9. package/dist/canvas-viewer-mechanics-DfQqRKkD.js +675 -0
  10. package/dist/cfb-guard-9QTRTg7f.js +528 -0
  11. package/dist/chart-ex.mjs +708 -739
  12. package/dist/comment-overlay-controller-B5_zGgG5.js +994 -0
  13. package/dist/comment-ui-runtime-B7ZvovcS.js +2 -0
  14. package/dist/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-D_sb2K6s.js} +5 -5
  15. package/dist/{comment-ui-runtime-BfE7MJZn.js → comment-ui-runtime-Jy-3goA9.js} +5 -5
  16. package/dist/delimited-text-worker-host-CikWU6_m.js +27 -0
  17. package/dist/document-model-source-BKNrXjAL.js +249 -0
  18. package/dist/document-pull-client-CxONDGbk.js +37833 -0
  19. package/dist/document-pull-worker-AMyXYpPq.js +104 -0
  20. package/dist/docx-D91ER1_S.js +495 -0
  21. package/dist/docx-DhDnKEI6.js +3563 -0
  22. package/dist/docx-model-source-CdrSt3hF.js +98 -0
  23. package/dist/docx-source-worker.mjs +455 -0
  24. package/dist/docx.mjs +7 -7
  25. package/dist/docx_parser_bg.wasm +0 -0
  26. package/dist/drawingml-shape-ChcGZNd8.js +310 -0
  27. package/dist/duotone-ekYik4ix.js +126 -0
  28. package/dist/emf-UT6I8rVi.js +1790 -0
  29. package/dist/font-preload-demand-CdJZUMCT.js +2058 -0
  30. package/dist/grid-geometry-uQOgViJU.js +384 -0
  31. package/dist/host-layout-DVMw8hDY.js +56 -0
  32. package/dist/host-layout-measure-CCEgaC_v.js +7 -0
  33. package/dist/in-process-pull-transport-DuXcPZng.js +29 -0
  34. package/dist/index.mjs +4 -4
  35. package/dist/internal-companion.mjs +12 -0
  36. package/dist/line-distribute-CPOV6csk.js +2716 -0
  37. package/dist/math.mjs +2 -2
  38. package/dist/mathjax-stix2.js +10 -10
  39. package/dist/model-source-DJGzDtGb.js +61 -0
  40. package/dist/model-source-kz_NkZqT.js +179 -0
  41. package/dist/model-source-session-Bu9CHFHc.js +71 -0
  42. package/dist/model-source-session-CDuijwv1.js +85 -0
  43. package/dist/model-source-session-sKpNiIJI.js +58 -0
  44. package/dist/node.mjs +7 -1327
  45. package/dist/{pixel-budget-Dgjw269h.js → pixel-budget-BpTYrepD.js} +13 -10
  46. package/dist/plot-area-frame-CaJFvZ7p.js +8502 -0
  47. package/dist/pptx-CDP9dZHe.js +2936 -0
  48. package/dist/pptx-C_uxLVKB.js +183 -0
  49. package/dist/pptx-model-source-O7LhpOjz.js +37 -0
  50. package/dist/pptx-source-worker.mjs +446 -0
  51. package/dist/pptx.mjs +8 -7
  52. package/dist/pptx_parser_bg.wasm +0 -0
  53. package/dist/presentation-model-source-tmROzteR.js +77 -0
  54. package/dist/raster-target-YQ4G6rxo.js +42 -0
  55. package/dist/region-map.mjs +114 -150
  56. package/dist/{render-8Zo7dnds.js → render-CJVglUHl.js} +3 -3
  57. package/dist/{render-worker-host-BfbnEChF.js → render-worker-host-BseIaVvm.js} +1 -1
  58. package/dist/{render-worker-host-DNL9dWRh.js → render-worker-host-CyxPU4JU.js} +1 -1
  59. package/dist/{render-worker-host-IkHrYOci.js → render-worker-host-aF6aWkC0.js} +1 -1
  60. package/dist/renderer-CkGLj0CC.js +5170 -0
  61. package/dist/renderer-Czw1cCC7.js +5823 -0
  62. package/dist/resource-measurement-mXw-WjMF.js +771 -0
  63. package/dist/session-Csv9maad.js +656 -0
  64. package/dist/slide-pull-client-DRZYwBTu.js +6515 -0
  65. package/dist/three-d-BK5siJgJ.js +878 -0
  66. package/dist/three-d.mjs +871 -764
  67. package/dist/{raster-target-ojDdQizC.js → tiff-contract-C6M3QcPp.js} +1 -42
  68. package/dist/tiff.mjs +401 -248
  69. package/dist/types/chart-ex.d.ts +289 -4
  70. package/dist/types/docx.d.ts +473 -98
  71. package/dist/types/index.d.ts +674 -303
  72. package/dist/types/internal-companion.d.ts +11 -0
  73. package/dist/types/math.d.ts +1 -1
  74. package/dist/types/node.d.ts +530 -11
  75. package/dist/types/pptx.d.ts +410 -97
  76. package/dist/types/region-map.d.ts +289 -4
  77. package/dist/types/three-d.d.ts +289 -4
  78. package/dist/types/tiff.d.ts +1 -1
  79. package/dist/types/xlsx.d.ts +483 -134
  80. package/dist/wasm-loader-rlgHmcSv.js +35 -0
  81. package/dist/wasm-runtime-generation-DX4y0Ecl.js +97 -0
  82. package/dist/workbook-model-source-BTC4ISTS.js +94 -0
  83. package/dist/worker-source-I1cIYBel.js +22 -0
  84. package/dist/worker-source-SbudzjYL.js +22 -0
  85. package/dist/worker-source-UAi3GNcM.js +22 -0
  86. package/dist/worksheet-pull-client-CkHgbtyM.js +579 -0
  87. package/dist/xlsx-CpSDPAEU.js +5809 -0
  88. package/dist/xlsx-D5569TPf.js +534 -0
  89. package/dist/xlsx-model-source-DPSkjFic.js +309 -0
  90. package/dist/xlsx-source-worker.mjs +525 -0
  91. package/dist/xlsx.mjs +8 -7
  92. package/dist/xlsx_parser_bg.wasm +0 -0
  93. package/package.json +42 -16
  94. package/dist/assets/render-worker-CeK_iqK3.js +0 -10
  95. package/dist/assets/render-worker-DusrDhPk.js +0 -11
  96. package/dist/assets/render-worker-n2ZG0lrQ.js +0 -31
  97. package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
  98. package/dist/canvas-viewer-mechanics-Cpk0YFvM.js +0 -1384
  99. package/dist/cjk-fallback-bLI3z70h.js +0 -46
  100. package/dist/comment-occurrence-C8Y2uoVr.js +0 -6
  101. package/dist/comment-ui-runtime-BsK8pmUT.js +0 -2
  102. package/dist/comments-Diid5ujN.js +0 -246
  103. package/dist/delimited-text-worker-host-BVY-Ecni.js +0 -27
  104. package/dist/document-pull-client-yKxI8aDH.js +0 -27251
  105. package/dist/docx-BkSRiy07.js +0 -2995
  106. package/dist/dom-interaction-boundary-CBUQJsIM.js +0 -223
  107. package/dist/highlight-rect-C5hkRqUr.js +0 -13
  108. package/dist/hyperlink-ArrU3ArU.js +0 -36447
  109. package/dist/line-distribute-Dtudnqhs.js +0 -1023
  110. package/dist/line-metrics-B60C86uh.js +0 -60
  111. package/dist/plot-area-frame-D5hEOgkJ.js +0 -2903
  112. package/dist/pptx-62MmVbYB.js +0 -3063
  113. package/dist/renderer-XFSCOT6m.js +0 -5857
  114. package/dist/resource-measurement-CJsgolre.js +0 -150
  115. package/dist/session-CrU8f8DI.js +0 -743
  116. package/dist/slide-pull-client-B9KA8bU6.js +0 -6253
  117. package/dist/source-key-DIJG8BA0.js +0 -42
  118. package/dist/three-d-YYghQndN.js +0 -1346
  119. package/dist/transfer-p6iCC2R7.js +0 -6
  120. package/dist/units-EJdC96r6.js +0 -4
  121. package/dist/worksheet-pull-client-eIcQ-xlD.js +0 -458
  122. package/dist/xlsx-CRcSzZNq.js +0 -8482
  123. /package/dist/{chunk-DmhlhrBa.js → chunk-Dy4uBu1J.js} +0 -0
  124. /package/dist/{mathjax-DoyWZbSp.js → mathjax-BhwN6ilc.js} +0 -0
  125. /package/dist/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-PidH0wnP.js} +0 -0
  126. /package/dist/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-B52rDVKo.js} +0 -0
  127. /package/dist/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-CWM7jv6d.js} +0 -0
  128. /package/dist/{visible-index-BgiHEc1z.js → visible-index-FeVA0mGE.js} +0 -0
package/README.md CHANGED
@@ -33,6 +33,8 @@ A browser-based viewer for Office Open XML documents that renders to an HTML Can
33
33
  The parsers are written in Rust and compiled to WebAssembly; the renderers use the Canvas 2D API.
34
34
  Each format also exposes a headless engine (`DocxDocument` / `XlsxWorkbook` / `PptxPresentation`) that renders into any caller-supplied canvas, so you can compose your own UI — scroll views, thumbnail grids, master-detail panes — instead of being locked into the built-in viewer. See the [live framework examples](https://ooxml.silurus.dev/frameworks/) for runnable React, Vue, Svelte, and Solid projects.
35
35
 
36
+ Optional, experimental [legacy Office add-on](https://ooxml.silurus.dev/legacy-office/) reads a supported subset of `.doc`, `.xls` and `.ppt` with the same viewers.
37
+
36
38
  ## Project scope: read-only viewing
37
39
 
38
40
  This project is intentionally a **read-only viewer**. Editing interfaces, mutation APIs, editable or lossless document models, saving / round-tripping, and partial editing of DOCX, XLSX, or PPTX files are out of scope. Read-only interactions such as selection, copy, search, shape IDs, hit testing, and annotation or external-tool integrations remain in scope, and editing-focused forks are welcome. See [#496](https://github.com/yukiyokotani/office-open-xml-viewer/issues/496) for the rationale.
@@ -174,15 +176,19 @@ await sheet.load('/report.dat', { format: 'delimited-text', delimiter: '|' });
174
176
 
175
177
  OMML equations (`m:oMath` / `m:oMathPara`) in `.docx`, `.pptx` and `.xlsx` are rendered with
176
178
  [MathJax](https://www.mathjax.org/) + [STIX Two Math](https://github.com/stipub/stixfonts).
177
- That engine is ~3 MB, so it is **opt-in**: import the `math` engine from the separate
179
+ That engine is ~4 MB, so it is **opt-in**: import the `math` engine from the separate
178
180
  `@silurus/ooxml/math` entry and pass it to the viewer. Pass it and equations render;
179
181
  omit it and the engine asset is not fetched or evaluated (equations are simply skipped;
180
- the on-demand render-worker asset retains a small loader). When you *do* pass it, the ~3 MB engine ships
182
+ the on-demand render-worker asset retains a small loader). When you *do* pass it, the ~4 MB engine ships
181
183
  as a **standalone asset file** next to the bundle rather than an inline data URL, and is
182
184
  fetched **on demand — only the first time a document actually contains an equation**, so
183
185
  equation-free documents never pay for it. It is fully self-contained: served from your own
184
186
  origin, no cross-origin requests.
185
187
 
188
+ Accented Latin letters use STIX Two Math paths in normal, italic, bold and bold-italic
189
+ equations. Less common Cyrillic, phonetic and dingbat characters use a system-font
190
+ fallback, so their appearance can vary by platform.
191
+
186
192
  ```typescript
187
193
  import { DocxViewer } from '@silurus/ooxml/docx';
188
194
  import { math } from '@silurus/ooxml/math';
@@ -200,6 +206,50 @@ per-render argument. (Excel stores "Insert > Equation" as OMML inside the shared
200
206
  DrawingML `<xdr:txBody>` grammar, so `XlsxViewer` renders equations embedded in
201
207
  shapes / text boxes the same way.)
202
208
 
209
+ ### Experimental legacy DOC, XLS, and PPT sources
210
+
211
+ Legacy binary Office files can be read directly into the ordinary document,
212
+ workbook and presentation models through the experimental
213
+ `@silurus/ooxml-legacy-office` add-on. Its readers are separate opt-in entries,
214
+ one per format, passed in like the other opt-in modules (`{ legacyDoc }`,
215
+ `{ legacyXls }` or `{ legacyPpt }`). Install matching versions of both packages:
216
+
217
+ ```sh
218
+ npm i @silurus/ooxml @silurus/ooxml-legacy-office
219
+ ```
220
+
221
+ Each entry exports a reader for the matching loader or viewer:
222
+
223
+ ```typescript
224
+ import { DocxViewer } from '@silurus/ooxml/docx';
225
+ import { legacyDoc } from '@silurus/ooxml-legacy-office/doc';
226
+
227
+ const canvas = document.querySelector('canvas') as HTMLCanvasElement;
228
+ const viewer = new DocxViewer(canvas, { legacyDoc });
229
+ await viewer.load(docOrDocxBytes);
230
+ ```
231
+
232
+ `legacyXls` (`@silurus/ooxml-legacy-office/xls`) and `legacyPpt`
233
+ (`@silurus/ooxml-legacy-office/ppt`) work the same way for XLSX and PPTX; for
234
+ custom asset URLs create the reader with `createLegacyDoc({ wasmUrl, moduleUrl })`
235
+ (likewise `createLegacyXls` and `createLegacyPpt`). A reader
236
+ claims only its own binary family; every other input takes the unchanged OOXML
237
+ path, and without a source a legacy file still rejects with the typed
238
+ `legacy-binary-format` error. Importing a reader fetches nothing: its
239
+ self-contained source module and WASM load in the parser worker (or in Node)
240
+ only when a claimed file is opened, and no OOXML package is generated. The
241
+ readers are narrow and experimental and reject unsupported content rather than
242
+ showing a partial document. They do not execute macros, fields, formulas, actions
243
+ or embedded objects. Claimed content outside the supported subset rejects with
244
+ `OoxmlError.code === 'unsupported-content'` (`details.format` names the source
245
+ format); offer conversion for that code. Resource limits, encryption and parser
246
+ crashes stay distinct from it; some native reader budgets surface as untyped
247
+ errors (see [Experimental legacy Office sources](docs/legacy-office-conversion.md)).
248
+ The package versions must match exactly; upgrade both together.
249
+ No migration is required without the add-on. See the [legacy Office guide](https://ooxml.silurus.dev/legacy-office/)
250
+ for viewer and Node examples, and [Experimental legacy Office sources](docs/legacy-office-conversion.md)
251
+ for the full support boundaries.
252
+
203
253
  ### Optional rendering modules
204
254
 
205
255
  Classic DrawingML 2-D chart families are included in every format entry.
@@ -245,10 +295,11 @@ chart behavior is documented in
245
295
  [Chart compatibility evidence and scope](docs/chart-compatibility-evidence.md).
246
296
 
247
297
  The bounded TIFF 6.0 codec decodes the first IFD/page of stripped, top-left
248
- images in the uncompressed bilevel, 8-bit grayscale, RGB, RGBA and process-CMYK
249
- classes, plus 1-bit CCITT Group 4. Unsupported or malformed first-page classes
250
- fail with a diagnostic render error. It is not a general-purpose TIFF library,
251
- but as a small
298
+ images in the bilevel, 8-bit grayscale, RGB, RGBA and process-CMYK classes,
299
+ uncompressed or LZW-compressed (8-bit classes optionally with the horizontal
300
+ differencing predictor), plus 1-bit CCITT Group 4. Unsupported or malformed
301
+ first-page classes fail with a diagnostic render error. It is not a
302
+ general-purpose TIFF library, but as a small
252
303
  by-product the same `tiff.render()` method can provide a simple preview of a
253
304
  supported standalone TIFF file. Its optional `TiffRenderOptions` argument can
254
305
  request a bounded display-sized bitmap; the Office viewers supply those targets
@@ -768,7 +819,7 @@ file without uploading it.
768
819
  | | ChartEx (waterfall / histogram / Pareto / funnel / box &amp; whisker / treemap / sunburst) | ✅ opt-in |
769
820
  | | Math equations (OMML `m:oMath` / `m:oMathPara`, rendered via MathJax — opt-in `@silurus/ooxml/math`) | ✅ |
770
821
  | | Images (inline and anchored, with text wrap and adaptive display-sized decoding for oversized rasters) | ✅ |
771
- | | TIFF images (opt-in `@silurus/ooxml/tiff`; bounded bilevel, grayscale, RGB(A), process-CMYK and CCITT Group 4) | ✅ |
822
+ | | TIFF images (opt-in `@silurus/ooxml/tiff`; bounded bilevel, grayscale, RGB(A) and process-CMYK, uncompressed or LZW, plus CCITT Group 4) | ✅ |
772
823
  | | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, raster fallback) | ✅ |
773
824
  | | Text boxes / drawing shapes (inline and anchored `wps:wsp` / `wps:txbx`, including solid, gradient, and image fills; `a:prstGeom` — 186 preset geometries via the shared engine; connector arrow heads `headEnd` / `tailEnd` (§20.1.8.3) and `prstDash` dash patterns (§20.1.8.48)). Text-box paragraphs run through the **same line-layout engine as body text**, so kinsoku 行頭/行末禁則 (§17.15.1.58–60), UAX#9 bidi (`w:bidi`, §17.3.1.6), justification (§17.18.44) and tab stops (§17.3.1.37) all apply inside a box | ✅ |
774
825
  | | WMF **and EMF** metafile images (legacy vector, incl. inside text boxes) — rasterized via a built-in player: window→viewport mapping (MS-EMF map modes, world transform), pens/brushes, poly/rect/ellipse, text-out, path clipping, and embedded DIB blits | ✅ |
@@ -800,7 +851,7 @@ file without uploading it.
800
851
  | **Workbook** | Multiple sheets, sheet names | ✅ |
801
852
  | | Sheet tab colors (`<sheetPr><tabColor>` — theme / tint / indexed / rgb) | ✅ |
802
853
  | **Cells** | Text, number, boolean, error values | ✅ |
803
- | | Formula results (from cached `<v>`) | ✅ |
854
+ | | Formula results (cached `<v>` only; formulas, including `TODAY()` / `NOW()`, are never recalculated) | ✅ |
804
855
  | | Dates (ECMA-376 date format codes) | ✅ |
805
856
  | | Rich text (per-run formatting) | ✅ |
806
857
  | | East-Asian furigana (`<rPh>` §18.4.6 + `<phoneticPr>` §18.4.3 — drawn when a cell opts in via `ph="1"`; row-level `<row ph>` inheritance) | ✅ |
@@ -822,7 +873,7 @@ file without uploading it.
822
873
  | | Hidden rows / columns | ✅ |
823
874
  | | Row / column outline grouping (`outlineLevel` / `collapsed` §18.3.1.73 / .13, `<outlinePr>` — gutter brackets, +/− collapse, numbered level buttons; view-only) | ✅ |
824
875
  | **Elements** | Images (`<xdr:twoCellAnchor>`, with adaptive display-sized decoding for oversized rasters) | ✅ |
825
- | | TIFF images (opt-in `@silurus/ooxml/tiff`; bounded bilevel, grayscale, RGB(A), process-CMYK and CCITT Group 4) | ✅ |
876
+ | | TIFF images (opt-in `@silurus/ooxml/tiff`; bounded bilevel, grayscale, RGB(A) and process-CMYK, uncompressed or LZW, plus CCITT Group 4) | ✅ |
826
877
  | | OLE embedded objects (`<oleObjects>` — the legacy VML `v:imagedata` preview keyed by `oleObject@shapeId` is drawn; an image-typed `objectPr` target is preferred when present, and the embedded app is not run) | ✅ |
827
878
  | | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, raster fallback) | ✅ |
828
879
  | | Drawing shapes / text boxes (`xdr:sp`, `xdr:txBody` — 186 preset geometries via the shared engine, with `avLst` adjust handles) | ✅ |
@@ -835,6 +886,7 @@ file without uploading it.
835
886
  | | Chart manual layout (`<c:title><c:layout>` and `<c:plotArea><c:layout>`) | ✅ |
836
887
  | | Sparklines (`x14:sparklineGroup` — line / column / win-loss, with markers and high/low/first/last/negative highlights) | ✅ |
837
888
  | **Advanced** | Conditional formatting (`cellIs`, `colorScale`, `dataBar`, `iconSet`, `top10`, `aboveAverage`) | ✅ |
889
+ | | Conditional-formatting formulas (`expression`, text / blanks / errors rules — partial evaluator over cached values; complete evaluation tracked in [#1547](https://github.com/yukiyokotani/office-open-xml-viewer/issues/1547)). A rule the evaluator cannot evaluate neither formats nor stops lower rules | ⚠️ Partial |
838
890
  | | Slicers (static, Office 2010 extension) | ✅ |
839
891
  | | Pivot tables (saved worksheet output renders unchanged; read-only metadata is exposed. Refresh, recalculation, filtering, restructuring, and interactivity are unsupported) | ⚠️ Partial |
840
892
  | | Cell comments / notes (classic `xl/commentsN.xml` + Office-365 threaded comments — red triangle indicator + author / text via the worksheet model; pointer or keyboard users can open the popup, with a polite screen-reader status) | ✅ |
@@ -870,7 +922,7 @@ file without uploading it.
870
922
  | | Animations / transitions | ❌ Not planned |
871
923
  | **Element types** | Shapes (`sp`) | ✅ |
872
924
  | | Pictures (`pic`, with adaptive display-sized decoding for oversized rasters) | ✅ |
873
- | | TIFF images (opt-in `@silurus/ooxml/tiff`; bounded bilevel, grayscale, RGB(A), process-CMYK and CCITT Group 4) | ✅ |
925
+ | | TIFF images (opt-in `@silurus/ooxml/tiff`; bounded bilevel, grayscale, RGB(A) and process-CMYK, uncompressed or LZW, plus CCITT Group 4) | ✅ |
874
926
  | | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, PNG fallback) | ✅ |
875
927
  | | Groups (`grpSp`) with nested transforms | ✅ |
876
928
  | | Connectors (`cxnSp`) | ✅ |
@@ -938,8 +990,9 @@ file without uploading it.
938
990
  | | Word wrap / no wrap | ✅ |
939
991
  | | Japanese kinsoku line breaking (`a:pPr@eaLnBrk`, §21.1.2.2.7 — 行頭/行末禁則, shared core engine) | ✅ |
940
992
  | | Multi-column text body (`numCol` / `spcCol` — balanced flow) | ✅ |
941
- | | Theme object-default inheritance (`<a:objectDefaults><a:txDef\|spDef>` bodyPr fallback) | ✅ |
993
+ | | Theme object defaults (`<a:objectDefaults>`) treated as new-object templates only, as PowerPoint does | ✅ |
942
994
  | **Tables** | Cells, rows, columns | ✅ |
995
+ | | Table background (`a:tblBg`, beneath cell fills; optional `TableElement.background: Fill` in parsed models) | ✅ |
943
996
  | | Cell merges (horizontal / vertical) | ✅ |
944
997
  | | Cell borders | ✅ |
945
998
  | | Cell fills (solid / gradient) | ✅ |
@@ -968,7 +1021,7 @@ file without uploading it.
968
1021
  - **[`packages/markdown/`](packages/markdown/)** — internal workspace adapter and `ooxml-md` development CLI for the same GitHub-flavoured Markdown projection exposed by each format model's `toMarkdown()` method.
969
1022
  - **[`packages/node/`](packages/node/)** — the implementation behind the public Node-only `@silurus/ooxml/node` subpath. Its canonical APIs are the explicitly owned, bounded `openPptxPresentation`, `openDocxDocument`, and `openXlsxWorkbook` sessions. Async `materializePptxPresentation`, `materializeDocxDocument`, `materializeXlsxWorkbookIndex`, `materializeXlsxWorksheet`, and `materializeXlsxWorkbook` are provided when a complete caller-owned graph is actually needed. Each `open*` call returns an explicit, idempotent `close()`-able session; PPTX streams `slides()`, DOCX completes format-required sequential pagination before streaming `pages()`, and XLSX parses its workbook index once before sequential `worksheetRows(sheetIndex)` streams reuse the retained archive. Useful for CI checks and headless rendering pipelines; canvas rendering accepts a user-supplied backend such as `skia-canvas` without making it a runtime dependency.
970
1023
  See the [0.75 to 0.76 migration guide](docs/migration-0.76.md) for every removed synchronous helper and its replacement.
971
- - **[`packages/vscode-extension/`](packages/vscode-extension/)** — VS Code extension (`ooxml-viewer`) that registers `CustomEditorProvider`s for `.docx`, `.xlsx`, and `.pptx`, and (opt-in) auto-installs and registers the `ooxml-mcp-server` for GitHub Copilot Chat in Agent mode, including active Viewer selection. Claude Code and Codex can configure the same binary separately for path-based file tools, but do not receive the active selection bridge. The preview is offline by default; an opt-in `ooxmlViewer.useGoogleFonts` setting (off, and force-disabled in untrusted workspaces) surfaces the library's metric-compatible font substitution, widening the webview CSP to the Google Fonts CDN only while enabled.
1024
+ - **[`packages/vscode-extension/`](packages/vscode-extension/)** — VS Code extension (`ooxml-viewer`) that registers `CustomEditorProvider`s for `.docx`, `.xlsx`, and `.pptx`, and (opt-in) auto-installs and registers the `ooxml-mcp-server` for GitHub Copilot Chat in Agent mode, including active Viewer selection. Claude Code and Codex can configure the same binary separately for path-based file tools, but do not receive the active selection bridge. The preview is offline by default; an opt-in `ooxmlViewer.useGoogleFonts` setting (off, and force-disabled in untrusted workspaces) loads optional webfont substitutes and script fallbacks, widening the webview CSP to the Google Fonts CDN only while enabled.
972
1025
  - **[`packages/mcp-server/`](packages/mcp-server/)** — Rust MCP server (`ooxml-mcp-server`) exposing the parsers as tools for AI agents (Claude, Copilot, Codex, etc.). Provides structured queries (`docx_get_structure`, `xlsx_get_cell_range`, `pptx_get_slide_structure`, …) so agents can inspect OOXML files without shelling out to `unzip`. Prebuilt binaries are attached to each [GitHub Release](https://github.com/yukiyokotani/office-open-xml-viewer/releases) for macOS / Linux / Windows; the VS Code extension downloads them on demand.
973
1026
 
974
1027
  ---
@@ -988,10 +1041,12 @@ pnpm storybook
988
1041
  # Type-check all packages
989
1042
  pnpm typecheck
990
1043
 
991
- # Run visual regression tests (local only — not run in CI)
1044
+ # Visual regression tests (local only — not run in CI). `pnpm vrt` compares
1045
+ # against a baseline checkout captured with `pnpm vrt:snapshot`; see AGENTS.md
1046
+ # for the required VRT_BASELINE_REVISION / VRT_BASELINE_CHECKOUT variables.
992
1047
  pnpm vrt
993
- # Adopt the current rendering as the new reference baseline
994
- UPDATE_REFS=1 pnpm vrt
1048
+ # Fidelity ratchet against the committed demo references
1049
+ pnpm vrt:fidelity
995
1050
 
996
1051
  # Build the library
997
1052
  pnpm build
@@ -1000,9 +1055,9 @@ pnpm build
1000
1055
  ### WASM build (individual packages)
1001
1056
 
1002
1057
  ```bash
1003
- cd packages/docx/parser && wasm-pack build --target web && cp pkg/docx_parser_bg.wasm pkg/docx_parser.js ../src/wasm/
1004
- cd packages/xlsx/parser && wasm-pack build --target web && cp pkg/xlsx_parser_bg.wasm pkg/xlsx_parser.js ../src/wasm/
1005
- cd packages/pptx/parser && wasm-pack build --target web && cp pkg/pptx_parser_bg.wasm pkg/pptx_parser.js ../src/wasm/
1058
+ pnpm --filter @silurus/ooxml-docx wasm
1059
+ pnpm --filter @silurus/ooxml-xlsx wasm
1060
+ pnpm --filter @silurus/ooxml-pptx wasm
1006
1061
  ```
1007
1062
 
1008
1063
  ## Error handling
@@ -1013,6 +1068,27 @@ Promise. This includes `viewer.load()` parsing and its initial render, whether
1013
1068
  or not the Viewer has an `onError(error)` callback. A failure is never delivered
1014
1069
  through both channels.
1015
1070
 
1071
+ All three formats use a module Web Worker for parsing, including the default
1072
+ `mode: 'main'`; the mode selects where rendering runs, not whether parsing uses
1073
+ a Worker. The supported browser setup requires a page with a normal,
1074
+ non-opaque origin where Worker loading is permitted. An iframe with
1075
+ `sandbox="allow-scripts"` but no `allow-same-origin` has an opaque origin. Worker
1076
+ loading may fail there depending on the browser and Worker script, so this
1077
+ embedding setup is not supported even if it happens to work in one browser.
1078
+ There is no classic-Worker or no-Worker fallback for this configuration.
1079
+
1080
+ For a regular iframe, omit `sandbox`. To retain sandbox restrictions, serve
1081
+ the viewer page from a dedicated origin distinct from the parent and use, for
1082
+ example,
1083
+ `<iframe sandbox="allow-scripts allow-same-origin" src="https://viewer.example.net/viewer.html"></iframe>`.
1084
+ Here `allow-same-origin` retains the **iframe page's** origin; it does not give
1085
+ the iframe the parent's origin. This separate-origin setup requires a `src`
1086
+ URL; `srcdoc` inherits the parent's origin when origin sandboxing is disabled.
1087
+ If module scripts or other resources are fetched across origins, configure
1088
+ CORS as required; the page's CSP must also allow its module Worker and required
1089
+ assets. The Worker error message includes an opaque-origin hint when the
1090
+ browser gives no detail, but it cannot identify every Worker failure.
1091
+
1016
1092
  Use `onError` for later Viewer-managed work that has no directly awaitable
1017
1093
  result, such as virtualized scroll-view rendering or embedded-media playback.
1018
1094
  Those failures are logged with `console.error` when the callback is omitted.
@@ -1022,9 +1098,13 @@ decode or playback failures after the presentation handle has been returned.
1022
1098
 
1023
1099
  Stable failures can be narrowed without parsing message strings:
1024
1100
 
1025
- - `OoxmlError` — container failures. Its `code` is `encrypted`,
1026
- `invalid-password`, `unsupported-encryption`, `legacy-binary-format`, or
1027
- `not-ooxml`.
1101
+ - `OoxmlError` — typed input and source failures. Its `code` is `encrypted`,
1102
+ `invalid-password`, `unsupported-encryption`, `legacy-binary-format`,
1103
+ `not-ooxml`, `unsupported-image-effect` (a picture-effect chain that is
1104
+ malformed or cannot be drawn), `invalid-numbering` (DOCX numbering that Word
1105
+ cannot open), or `unsupported-content`. For `unsupported-content`, offer conversion: the configured
1106
+ source cannot represent this input. Frozen `details` contain only its
1107
+ `format` identifier and `reason: 'source-subset'`.
1028
1108
  - `OoxmlResourceLimitError` (`code === 'ooxml-resource-limit'`) — a measured
1029
1109
  package or format resource crossed a configurable limit or hard ceiling.
1030
1110
  `details.violation` contains the resource, metric, limit, observed value, and
@@ -1097,7 +1177,6 @@ try {
1097
1177
  `maxArchiveEntryBytes` applies to every XML, text, image, media, and other package part that the parser reads. `maxTotalInflatedBytes` counts the largest amount actually read from each distinct part during the lifetime of the loaded package; reading the same part again does not consume that budget twice. `maxArchiveEntries` bounds central-directory entries before the ZIP library allocates its owned index. Set an individual field to `null` to disable that configurable budget. Internal hard safety ceilings still apply, so disabling a budget does not make arbitrary archives acceptable. Values other than `null` must be positive safe integers; byte fields are expressed in bytes and the entry field is a count.
1098
1178
 
1099
1179
  A violation rejects with `OoxmlResourceLimitError` (`code === 'ooxml-resource-limit'`). Its structured `details.violation` reports the resource, metric, limit, observed value, usage snapshot, and part name when a particular part caused the failure. The deprecated `maxZipEntryBytes` option remains as a compatibility alias for `resourceLimits.maxArchiveEntryBytes`, but is scheduled for removal in a future breaking release; new code should use `resourceLimits`.
1100
-
1101
1180
  Applications can collect the same data as a machine-readable `OoxmlResourceMetrics` report without enabling console output. This is useful for choosing limits from representative files in the application's own domain:
1102
1181
  ```ts
1103
1182
  new DocxViewer(canvas, {
@@ -1139,6 +1218,22 @@ try {
1139
1218
  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.
1140
1219
 
1141
1220
  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.
1221
+ - **Bounded XLSX worksheets.** Each XLSX worksheet model is checked against logical budgets. The defaults are 100,000 rows, 250,000 cell records, 32 MiB of owned UTF-8 string content, and 64 MiB of structural JSON. Override them with `xlsxWorksheetLimits` on `XlsxViewer`, `XlsxSheetViewer`, or `XlsxWorkbook.load(...)`:
1222
+ ```ts
1223
+ new XlsxViewer(container, {
1224
+ xlsxWorksheetLimits: { maxRows: 110000, maxCells: 300000 },
1225
+ });
1226
+ ```
1227
+ An omitted or `undefined` option, an empty object, and any omitted field use the defaults. Supplied fields (`maxRows`, `maxCells`, `maxOwnedUtf8Bytes`, `maxJsonBytes`) must be positive safe integers no greater than `Number.MAX_SAFE_INTEGER - 1`. `null` is invalid. The option is validated before any load effects and is snapshotted for each load. DOCX and PPTX ignore it.
1228
+
1229
+ Row and cell budgets count retained records. They do not count grid coordinates or unique indexes. `maxOwnedUtf8Bytes` counts every string owned by `Cell.value`, including typed-value discriminators and rich-text and phonetic strings, plus formula text. Shared strings are charged per cell after resolution.
1230
+
1231
+ `maxJsonBytes` covers the worksheet model and its covered ancillary data. Browser and Node builds measure the UTF-8 length of `JSON.stringify` over the assembled structure. The native Rust path measures its complete `serde_json` UTF-8 output, which is a separately documented boundary.
1232
+
1233
+ For each dimension, the aggregate derived worksheet cache uses the larger of its default and the worksheet limit. The cache defaults are 200,000 rows, 500,000 cells, 64 MiB owned, and 128 MiB JSON. Each renderer coordinate index independently allows `max(250000, maxCells)` entries, charged per unique key. Delimited-text parsing counts every parsed field, including blanks, against `maxCells`; its fixed 64 MiB input limit is separate. The non-retaining Node `worksheetRows` path keeps streaming semantics, so cumulative budgets apply only to models it materializes.
1234
+
1235
+ ZIP, input, wire, representation, and copy limits remain independent. Raising these budgets does not promise that a whole 251,000-cell selection can be copied to the clipboard. The budgets are logical counters, not physical memory measurements. Increasing them accepts additional out-of-memory risk; the library does not guarantee that an allocation failure can be caught. With unchanged defaults no migration is needed. The one exception: errors from these adjustable guards now report `configurable: true`, whether the default or an override applied. Hard-ceiling errors remain `configurable: false`.
1236
+
1142
1237
  - **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.
1143
1238
  - **XML parsing.** Uses `roxmltree`, which does not resolve external entities (XXE-safe by default).
1144
1239
  - **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:
@@ -1162,7 +1257,7 @@ tarball) for the full list and license texts. Highlights:
1162
1257
  (Apache License 2.0) — the equation-rendering engine behind the
1163
1258
  opt-in `@silurus/ooxml/math` entry described in
1164
1259
  [Rendering equations](#rendering-equations). It ships in the tarball as
1165
- a standalone ~3 MB asset but is never loaded by a consuming app unless
1260
+ a standalone ~4 MB asset but is never loaded by a consuming app unless
1166
1261
  that app imports `@silurus/ooxml/math` and the viewer is handed a
1167
1262
  document that actually contains an equation.
1168
1263
  - **Rust crate dependencies** of the WASM parsers (docx/pptx/xlsx) — all
@@ -1,7 +1,7 @@
1
1
  # Third-Party Notices
2
2
 
3
3
  `@silurus/ooxml` is MIT-licensed (see [LICENSE](./LICENSE)). It bundles the
4
- third-party components listed below, none of which are copyleft. This file
4
+ third-party components listed below. This file
5
5
  is included in the npm tarball so it travels with every install.
6
6
 
7
7
  ## JavaScript / bundled asset
@@ -23,7 +23,7 @@ claim.
23
23
 
24
24
  The optional equation-rendering engine (`@silurus/ooxml/math`, opt-in —
25
25
  see the [README's "Rendering equations" section](./README.md#rendering-equations))
26
- pre-bundles two Apache-2.0 packages into a single ~3 MB asset
26
+ pre-bundles two Apache-2.0 packages into a single ~4 MB asset
27
27
  (`packages/core/assets/mathjax-stix2.js`, built by
28
28
  [`packages/core/build/build-mathjax.mjs`](./packages/core/build/build-mathjax.mjs)).
29
29
  It ships in the npm tarball but is only fetched by a consuming app at
@@ -63,10 +63,11 @@ package — noted here for completeness only.
63
63
 
64
64
  ## Rust / WebAssembly
65
65
 
66
- The three parser crates (`docx-parser`, `pptx-parser`, `xlsx-parser`) and
67
- their shared `ooxml-common` crate compile to the `*_parser_bg.wasm` binaries
68
- shipped in `dist/`. Their `wasm32-unknown-unknown` dependency graph is
69
- identical across all three crates (verified with `cargo license
66
+ The three parser crates (`docx-parser`, `pptx-parser`, `xlsx-parser`), their
67
+ shared `ooxml-common` crate compile to the WASM binaries shipped in `dist/`.
68
+ The separate `@silurus/ooxml-legacy-office` companion ships its own readers and
69
+ notices. The parser crates' `wasm32-unknown-unknown` dependency graph is identical across all
70
+ three crates (verified with `cargo license
70
71
  --filter-platform wasm32-unknown-unknown`) and consists entirely of
71
72
  permissively-licensed crates — no copyleft (GPL/LGPL/AGPL) dependencies:
72
73
 
@@ -0,0 +1,10 @@
1
+ //#region packages/core/src/internal/abort.ts
2
+ function e(e) {
3
+ let t = Error(e);
4
+ return t.name = "AbortError", t;
5
+ }
6
+ function t(t, n) {
7
+ if (t?.aborted) throw e(n);
8
+ }
9
+ //#endregion
10
+ export { t as n, e as t };