@silurus/ooxml 0.84.0 → 0.85.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 +36 -13
- package/dist/assets/render-worker-BRKOyWVH.js +24 -0
- package/dist/assets/render-worker-DnU-PxZ1.js +10 -0
- package/dist/assets/render-worker-NZPOUOTU.js +11 -0
- package/dist/{canvas-viewer-mechanics-CIfhCgYA.js → canvas-viewer-mechanics-C-yTGbFC.js} +308 -234
- package/dist/chart-ex.mjs +270 -270
- package/dist/{comment-ui-runtime-CdMMApEN.js → comment-ui-runtime-CAbpuWi_.js} +4 -4
- package/dist/{comment-ui-runtime-C5qimVMD.js → comment-ui-runtime-DAKBCpsM.js} +5 -5
- package/dist/comment-ui-runtime-DTaaZdXC.js +2 -0
- package/dist/{comments-BAlAyIhb.js → comments-Brfxa3hQ.js} +1 -1
- package/dist/{document-pull-client-DeHUdQhH.js → document-pull-client-BdYrjAep.js} +4679 -4359
- package/dist/{docx-CbU51aPR.js → docx-qK0Qmyey.js} +315 -300
- package/dist/docx.mjs +7 -6
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{dom-interaction-boundary-DS6BVyHA.js → dom-interaction-boundary-CMDDgICk.js} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/line-distribute-CiKeWjBF.js +1023 -0
- package/dist/{line-metrics-CXyjyYd5.js → line-metrics-u87yCAfV.js} +2182 -705
- package/dist/math.mjs +2 -2
- package/dist/node.mjs +404 -394
- package/dist/pixel-budget-Dgjw269h.js +37 -0
- package/dist/{plot-area-frame-DuXZzovH.js → plot-area-frame-D5hEOgkJ.js} +691 -1418
- package/dist/{pptx-C17oBD8Z.js → pptx-DxZwhOWr.js} +250 -221
- package/dist/pptx.mjs +7 -6
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/raster-target-whZhvVMt.js +87 -0
- package/dist/region-map.mjs +5 -5
- package/dist/{render-CVeGktZG.js → render-DrAAZWwH.js} +9 -6
- package/dist/{render-worker-host-BWdhjVH_.js → render-worker-host-CHlwYJdK.js} +1 -1
- package/dist/{render-worker-host-CZi7Mn5v.js → render-worker-host-GZ7ez-l3.js} +1 -1
- package/dist/{render-worker-host-CbaQivE7.js → render-worker-host-XDMsyVsv.js} +1 -1
- package/dist/{renderer-Bmky2yBc.js → renderer-XFSCOT6m.js} +1937 -1936
- package/dist/resource-measurement-6uR3Huao.js +150 -0
- package/dist/{session-Cl0RVnMs.js → session-DoPwA4gv.js} +79 -79
- package/dist/{slide-pull-client-BS0EeZo2.js → slide-pull-client-8i8C4VyD.js} +1054 -824
- package/dist/{three-d-B7LsKeOS.js → three-d-YYghQndN.js} +109 -110
- package/dist/three-d.mjs +726 -726
- package/dist/tiff.mjs +664 -78
- package/dist/types/chart-ex.d.ts +2 -2
- package/dist/types/docx.d.ts +29 -13
- package/dist/types/index.d.ts +43 -21
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +11 -7
- package/dist/types/pptx.d.ts +34 -15
- package/dist/types/region-map.d.ts +2 -2
- package/dist/types/three-d.d.ts +2 -2
- package/dist/types/tiff.d.ts +13 -3
- package/dist/types/xlsx.d.ts +30 -13
- package/dist/{worksheet-pull-client-B0zfEVau.js → worksheet-pull-client-Btydoxto.js} +47 -47
- package/dist/{xlsx-FyKAiNo-.js → xlsx-57OZsbD9.js} +1395 -1196
- package/dist/xlsx.mjs +7 -6
- package/package.json +2 -2
- package/dist/assets/render-worker-BZd4-U4w.js +0 -10
- package/dist/assets/render-worker-CiEWCh_T.js +0 -11
- package/dist/assets/render-worker-Cpmy3GDF.js +0 -24
- package/dist/comment-ui-runtime-aPzHfV_A.js +0 -2
- package/dist/line-distribute-MqInuujx.js +0 -1003
- package/dist/resource-measurement-esyGbzAF.js +0 -120
- package/dist/tiff-contract-Xjn3qXqK.js +0 -69
- /package/dist/{comment-occurrence-C34fWs_F.js → comment-occurrence-tj54AXXB.js} +0 -0
- /package/dist/{highlight-rect-MaCt0om0.js → highlight-rect-DBcYVJDv.js} +0 -0
- /package/dist/{mathjax-DPEX346v.js → mathjax-DS69BmJd.js} +0 -0
- /package/dist/{read-only-comment-decoration-BYCXoSdC.js → read-only-comment-decoration-Mv_SAiHy.js} +0 -0
- /package/dist/{read-only-comment-margin-C7b3l0ro.js → read-only-comment-margin-Cqu-Ir0C.js} +0 -0
- /package/dist/{renderer-module-contract-C6sYZvTV.js → renderer-module-contract-Cu-GKuPd.js} +0 -0
- /package/dist/{source-key-DORuuFb-.js → source-key-BkBB3X82.js} +0 -0
- /package/dist/{transfer-vNOFQuvv.js → transfer-mIj7E7NB.js} +0 -0
- /package/dist/{visible-index-DwJzuGmJ.js → visible-index-DPoQYSDt.js} +0 -0
package/README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
> [!NOTE]
|
|
1
2
|
> **This entire codebase — Rust parsers, TypeScript renderers, tests, and tooling — is implemented by AI coding agents, primarily [Claude](https://claude.ai) and [Codex](https://openai.com/codex/)**, through iterative prompting. No human-written application code exists in this repository.
|
|
2
3
|
|
|
3
4
|
<details>
|
|
@@ -187,8 +188,9 @@ format graph. The built-in modules work in both main and worker modes. Without `
|
|
|
187
188
|
ChartEx families show the standard unsupported-chart placeholder. Without
|
|
188
189
|
`threeD`, 3-D chart groups
|
|
189
190
|
fall back to their canonical 2-D family. Without `regionMap`, Region Maps show
|
|
190
|
-
the standard unsupported-chart placeholder. Without `tiff`, TIFF
|
|
191
|
-
|
|
191
|
+
the standard unsupported-chart placeholder. Without `tiff`, recognized TIFF
|
|
192
|
+
parts report a render error instead of relying on the browser decoder or being
|
|
193
|
+
silently omitted. The code-size boundary applies to
|
|
192
194
|
the default main-mode application graph. The separately loaded render-worker
|
|
193
195
|
asset stays self-contained for broad bundler compatibility and therefore
|
|
194
196
|
contains its built-in optional renderer implementations.
|
|
@@ -219,11 +221,15 @@ represent safely. The specification/Office evidence boundary for automatic
|
|
|
219
221
|
chart behavior is documented in
|
|
220
222
|
[Chart compatibility evidence and scope](docs/chart-compatibility-evidence.md).
|
|
221
223
|
|
|
222
|
-
The
|
|
223
|
-
|
|
224
|
-
|
|
224
|
+
The bounded TIFF 6.0 codec decodes the first IFD/page of stripped, top-left
|
|
225
|
+
images in the uncompressed bilevel, 8-bit grayscale, RGB, RGBA and process-CMYK
|
|
226
|
+
classes, plus 1-bit CCITT Group 4. Unsupported or malformed first-page classes
|
|
227
|
+
fail with a diagnostic render error. It is not a general-purpose TIFF library,
|
|
228
|
+
but as a small
|
|
225
229
|
by-product the same `tiff.render()` method can provide a simple preview of a
|
|
226
|
-
supported standalone TIFF file.
|
|
230
|
+
supported standalone TIFF file. Its optional `TiffRenderOptions` argument can
|
|
231
|
+
request a bounded display-sized bitmap; the Office viewers supply those targets
|
|
232
|
+
automatically for layout-backed image paints. Try Yours and the VS Code extension enable
|
|
227
233
|
every first-party optional module; library applications can choose only the entries they need.
|
|
228
234
|
See [Production decisions](https://ooxml.silurus.dev/production/) for the full
|
|
229
235
|
module list and [Bundle size](https://ooxml.silurus.dev/bundle-size/) for current
|
|
@@ -686,8 +692,8 @@ file without uploading it.
|
|
|
686
692
|
| | Charts (embedded DrawingML `c:chart` — bar / line / area / pie / doughnut / radar / scatter, via the shared core chart renderer; data labels honour `dLblPos`, §21.2.2.48) | ✅ |
|
|
687
693
|
| | ChartEx (waterfall / histogram / Pareto / funnel / box & whisker / treemap / sunburst) | ✅ opt-in |
|
|
688
694
|
| | Math equations (OMML `m:oMath` / `m:oMathPara`, rendered via MathJax — opt-in `@silurus/ooxml/math`) | ✅ |
|
|
689
|
-
| | Images (inline and anchored, with text wrap) | ✅ |
|
|
690
|
-
| | TIFF images (opt-in `@silurus/ooxml/tiff`;
|
|
695
|
+
| | Images (inline and anchored, with text wrap and adaptive display-sized decoding for oversized rasters) | ✅ |
|
|
696
|
+
| | TIFF images (opt-in `@silurus/ooxml/tiff`; bounded bilevel, grayscale, RGB(A), process-CMYK and CCITT Group 4) | ✅ |
|
|
691
697
|
| | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, raster fallback) | ✅ |
|
|
692
698
|
| | 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 | ✅ |
|
|
693
699
|
| | 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 | ✅ |
|
|
@@ -740,8 +746,8 @@ file without uploading it.
|
|
|
740
746
|
| | Row / column sizing (custom widths and heights) | ✅ |
|
|
741
747
|
| | Hidden rows / columns | ✅ |
|
|
742
748
|
| | Row / column outline grouping (`outlineLevel` / `collapsed` §18.3.1.73 / .13, `<outlinePr>` — gutter brackets, +/− collapse, numbered level buttons; view-only) | ✅ |
|
|
743
|
-
| **Elements** | Images (`<xdr:twoCellAnchor
|
|
744
|
-
| | TIFF images (opt-in `@silurus/ooxml/tiff`;
|
|
749
|
+
| **Elements** | Images (`<xdr:twoCellAnchor>`, with adaptive display-sized decoding for oversized rasters) | ✅ |
|
|
750
|
+
| | TIFF images (opt-in `@silurus/ooxml/tiff`; bounded bilevel, grayscale, RGB(A), process-CMYK and CCITT Group 4) | ✅ |
|
|
745
751
|
| | 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) | ✅ |
|
|
746
752
|
| | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, raster fallback) | ✅ |
|
|
747
753
|
| | Drawing shapes / text boxes (`xdr:sp`, `xdr:txBody` — 186 preset geometries via the shared engine, with `avLst` adjust handles) | ✅ |
|
|
@@ -788,8 +794,8 @@ file without uploading it.
|
|
|
788
794
|
| | Markdown export (`PptxPresentation.toMarkdown()` — title slides → headings, body → nested bullets, notes / comments collated) | ✅ |
|
|
789
795
|
| | Animations / transitions | ❌ Not planned |
|
|
790
796
|
| **Element types** | Shapes (`sp`) | ✅ |
|
|
791
|
-
| | Pictures (`pic
|
|
792
|
-
| | TIFF images (opt-in `@silurus/ooxml/tiff`;
|
|
797
|
+
| | Pictures (`pic`, with adaptive display-sized decoding for oversized rasters) | ✅ |
|
|
798
|
+
| | TIFF images (opt-in `@silurus/ooxml/tiff`; bounded bilevel, grayscale, RGB(A), process-CMYK and CCITT Group 4) | ✅ |
|
|
793
799
|
| | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, PNG fallback) | ✅ |
|
|
794
800
|
| | Groups (`grpSp`) with nested transforms | ✅ |
|
|
795
801
|
| | Connectors (`cxnSp`) | ✅ |
|
|
@@ -952,6 +958,11 @@ Stable failures can be narrowed without parsing message strings:
|
|
|
952
958
|
(`code === 'ooxml-decoded-image-limit'`) — a raster crossed an image pixel or
|
|
953
959
|
active decoded-byte ceiling. Its `metric`, `limit`, and `observed` properties
|
|
954
960
|
are stable.
|
|
961
|
+
- `TiffDecodeError` (`code === 'ooxml-tiff-decode'`) — a recognized TIFF part
|
|
962
|
+
is malformed, uses a class the configured codec does not support, or fails
|
|
963
|
+
during bitmap handoff. Its message is diagnostic rather than a stable subtype.
|
|
964
|
+
Omitting the optional TIFF codec is not an error; the affected image is shown
|
|
965
|
+
as an unavailable-image placeholder while the rest of the document renders.
|
|
955
966
|
- An otherwise ordinary `Error` may carry `code === 'parser-crashed'` for a
|
|
956
967
|
recognized WASM trap. This does not mean “OOM”: panic, allocation failure,
|
|
957
968
|
stack overflow, and other traps can be indistinguishable at the current WASM
|
|
@@ -967,6 +978,7 @@ import {
|
|
|
967
978
|
OoxmlDecodedImageLimitError,
|
|
968
979
|
OoxmlError,
|
|
969
980
|
OoxmlResourceLimitError,
|
|
981
|
+
TiffDecodeError,
|
|
970
982
|
} from '@silurus/ooxml/docx';
|
|
971
983
|
|
|
972
984
|
const viewer = new DocxViewer(canvas, {
|
|
@@ -977,6 +989,8 @@ const viewer = new DocxViewer(canvas, {
|
|
|
977
989
|
showTooLargeMessage({ limit, observed });
|
|
978
990
|
} else if (error instanceof OoxmlDecodedImageLimitError) {
|
|
979
991
|
showImageTooLargeMessage(error);
|
|
992
|
+
} else if (error instanceof TiffDecodeError) {
|
|
993
|
+
showUnsupportedImageMessage();
|
|
980
994
|
} else if (error instanceof OoxmlError) {
|
|
981
995
|
handleContainerError(error.code);
|
|
982
996
|
} else {
|
|
@@ -1035,7 +1049,16 @@ try {
|
|
|
1035
1049
|
|
|
1036
1050
|
The report is content-free by construction: it does not include source URLs, filenames, package paths, document text, passwords, or raw error messages. It still contains document-derived sizes, counts, and timings, so applications remain responsible for consent, retention, and telemetry policy. The initial browser callback covers the underlying document/workbook/presentation factory and does not wait for a Viewer's first canvas paint; use `getResourceMetrics()` for the latest observed package counters. Bounded Node sessions accept both `onResourceMetrics` and `debug`. DOCX/PPTX report successful terminal metrics when their one-pass stream completes or the session is explicitly closed; XLSX reports success when the reusable workbook session is explicitly closed. Open-time and session-operation failures report immediately.
|
|
1037
1051
|
|
|
1038
|
-
Image decoding
|
|
1052
|
+
Image decoding uses a separate adaptive resource policy shared by all three formats. Target-resizable rasters—browser-decodable formats and TIFF when its optional codec is configured—keep their native decode while the complete visible paint fits the default 128 MiB decoded budget and the per-surface ceilings, preserving established output. When native ownership would cross either boundary, the renderer decodes those rasters at the current canvas/DPR requirement instead of retaining source pixels the paint cannot show. If even those display targets exceed the aggregate budget, it applies one uniform quality reduction across them; a later zoom requests a sharper cache variant. Image-bearing paints for the same loaded document are serialized so overlapping paints cannot each consume the full budget, while the admitted paint still runs up to two decodes concurrently. Formats or sources that cannot be decoder-resized remain on their format-specific path under the hard surface ceilings. Applications with a known environment can override the aggregate budget on Viewer or per-render options:
|
|
1053
|
+
```ts
|
|
1054
|
+
new PptxViewer(canvas, {
|
|
1055
|
+
imageResources: {
|
|
1056
|
+
decodedByteBudget: 256 * 1024 * 1024,
|
|
1057
|
+
strategy: 'adaptive', // or 'strict' to reject instead of reducing quality
|
|
1058
|
+
},
|
|
1059
|
+
});
|
|
1060
|
+
```
|
|
1061
|
+
`decodedByteBudget` accepts a positive safe integer from 4 bytes through 512 MiB. This configures planned and retained decoded RGBA ownership; it does not measure browser decoder intermediates or disable the encoded-source, per-axis, or per-surface hard safety ceilings. A strict aggregate crossing or any hard-ceiling crossing rejects with `OoxmlDecodedImageLimitError` (`code === 'ooxml-decoded-image-limit'`) instead of silently omitting the image.
|
|
1039
1062
|
|
|
1040
1063
|
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.
|
|
1041
1064
|
|