@silurus/ooxml 0.80.3 → 0.81.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 +57 -77
- package/dist/assets/render-worker-C2ACcLes.js +11 -0
- package/dist/assets/render-worker-Cx5uR77k.js +10 -0
- package/dist/assets/render-worker-DtU8oQZ7.js +24 -0
- package/dist/{canvas-viewer-mechanics-D-r6wHY_.js → canvas-viewer-mechanics-CqxKRGCp.js} +1 -1
- package/dist/chart-ex.mjs +1017 -0
- package/dist/{document-pull-client-vxk-Aomu.js → document-pull-client-Ux4a_ax8.js} +4540 -4412
- package/dist/{docx-DN0PRx2f.js → docx-SEyQ4gS-.js} +79 -75
- package/dist/docx.mjs +5 -4
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/index.mjs +3 -3
- package/dist/{line-distribute-Bvtp0Gt6.js → line-distribute-BBGvvwLt.js} +17 -16
- package/dist/{line-metrics-DdEJYxjx.js → line-metrics-Baz31mML.js} +663 -7488
- package/dist/math.mjs +2 -2
- package/dist/node.mjs +248 -247
- package/dist/plot-area-frame-Dg1VIpUU.js +3669 -0
- package/dist/{pptx-B-Laftl1.js → pptx-5lQrMvMR.js} +236 -232
- package/dist/pptx.mjs +6 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/region-map.mjs +102 -97
- package/dist/{render-CoqMHcbF.js → render-DEHjijQD.js} +1 -1
- package/dist/{render-worker-host-CYPhmBtX.js → render-worker-host-B1nbV_k7.js} +1 -1
- package/dist/{render-worker-host-GlLR1rtF.js → render-worker-host-Bze5M6k5.js} +1 -1
- package/dist/{render-worker-host-IuQFpoJM.js → render-worker-host-Dg_74V64.js} +1 -1
- package/dist/renderer-DuopJE1K.js +5855 -0
- package/dist/{renderer-module-contract-BNGz8HvO.js → renderer-module-contract-0bO_5SC0.js} +4 -3
- package/dist/{resource-measurement-CgMubiAI.js → resource-measurement-DRLp4nFt.js} +12 -11
- package/dist/{session-DkPblDiq.js → session-CNVc3VJ4.js} +8 -8
- package/dist/{slide-pull-client-m2blvngt.js → slide-pull-client-CzutXnGc.js} +888 -1082
- package/dist/three-d-BYiWCNlz.js +1345 -0
- package/dist/three-d.mjs +1238 -798
- package/dist/types/chart-ex.d.ts +949 -0
- package/dist/types/docx.d.ts +325 -18
- package/dist/types/index.d.ts +325 -26
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +303 -14
- package/dist/types/pptx.d.ts +314 -22
- package/dist/types/region-map.d.ts +318 -6
- package/dist/types/three-d.d.ts +318 -6
- package/dist/types/xlsx.d.ts +317 -18
- package/dist/{worksheet-pull-client-BntP6RiO.js → worksheet-pull-client-Cxj3Ej0s.js} +19 -19
- package/dist/{xlsx-DqMe7J2C.js → xlsx-Bl3TIEVu.js} +1313 -1279
- package/dist/xlsx.mjs +6 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +7 -1
- package/dist/assets/render-worker-CRaEOHkw.js +0 -9
- package/dist/assets/render-worker-DQGLj5Zv.js +0 -22
- package/dist/assets/render-worker-rnrSLmqL.js +0 -8
- package/dist/chart-number-format-qLhnk6hj.js +0 -475
- package/dist/three-d-C28kqDym.js +0 -1086
- /package/dist/{highlight-rect-BuX5rWP4.js → highlight-rect-BqcZMHUE.js} +0 -0
- /package/dist/{mathjax-DgAl7Yi5.js → mathjax-DJa-Q93p.js} +0 -0
- /package/dist/{transfer-CKZ79zFw.js → transfer-D0U6Uhn4.js} +0 -0
- /package/dist/{visible-index-BjesVGhg.js → visible-index-DbDuGMCE.js} +0 -0
package/README.md
CHANGED
|
@@ -76,39 +76,13 @@ pnpm add @silurus/ooxml
|
|
|
76
76
|
> new DocxViewer(canvas, { wasmUrl: 'https://cdn.example.com/docx_parser_bg.wasm' });
|
|
77
77
|
> ```
|
|
78
78
|
|
|
79
|
-
> **Bundle size note**: the package is ESM-only (`.mjs`). npm's *Unpacked
|
|
80
|
-
>
|
|
81
|
-
>
|
|
82
|
-
>
|
|
83
|
-
>
|
|
84
|
-
>
|
|
85
|
-
>
|
|
86
|
-
> | Imported entry | Reachable assets | gzip | Includes |
|
|
87
|
-
> |---|---:|---:|---|
|
|
88
|
-
> | `@silurus/ooxml/docx` | 4.0 MB | 1.2 MB | DOCX renderer, parser WASM, and lazy worker |
|
|
89
|
-
> | `@silurus/ooxml/xlsx` | 2.6 MB | 0.82 MB | XLSX renderer, parser WASM, and lazy worker |
|
|
90
|
-
> | `@silurus/ooxml/pptx` | 2.5 MB | 0.78 MB | PPTX renderer, parser WASM, and lazy worker |
|
|
91
|
-
> | `@silurus/ooxml/math` | 3.1 MB | 1.1 MB | Optional MathJax + STIX Two Math engine |
|
|
92
|
-
> | `@silurus/ooxml/three-d` | 92 KB | 27 KB | Optional model-space 3-D chart mesh and camera |
|
|
93
|
-
> | `@silurus/ooxml/region-map` | 236 KB | 66 KB | Optional offline Region Map renderer and fixed country geometry |
|
|
94
|
-
>
|
|
95
|
-
> These are production-artifact estimates, not initial-load figures: each row
|
|
96
|
-
> sums all assets reachable from that entry, including parser WASM and worker
|
|
97
|
-
> chunks loaded on demand. Exact output varies by bundler and compression. Import
|
|
98
|
-
> only the format you need (for example, `@silurus/ooxml/pptx`) so the other
|
|
99
|
-
> formats can be tree-shaken. The math engine is a **separate entry** whose
|
|
100
|
-
> main-thread chunk is a ~1 KB loader referencing the ~3 MB engine as a
|
|
101
|
-
> **sibling file**, not an inline data URL. The engine is fetched lazily, only
|
|
102
|
-
> when a document contains equations, and only if you imported
|
|
103
|
-
> `@silurus/ooxml/math` and passed it to a viewer (see
|
|
104
|
-
> [Rendering equations](#rendering-equations)). Never import the `math` entry
|
|
105
|
-
> and the loader chunk never enters your graph at all.
|
|
106
|
-
>
|
|
107
|
-
> The 3-D chart and Region Map renderers follow the same dependency-injection
|
|
108
|
-
> boundary: import and pass only the optional renderer modules an application
|
|
109
|
-
> needs. Their implementations are not eagerly loaded or evaluated in main
|
|
110
|
-
> mode. Worker mode fetches a self-contained render-worker asset that includes
|
|
111
|
-
> the worker-side built-ins, so consumer bundlers can copy it safely.
|
|
79
|
+
> **Bundle size note**: the package is ESM-only (`.mjs`). npm's *Unpacked Size*
|
|
80
|
+
> includes every entry and optional asset, so it is not the size of a
|
|
81
|
+
> format-specific application graph. See the current production measurements on
|
|
82
|
+
> the stable [Bundle size](https://ooxml.silurus.dev/bundle-size/) page. Import
|
|
83
|
+
> only the format and optional renderer entries your application needs. In main
|
|
84
|
+
> mode, MathJax, ChartEx, 3-D and Region Map implementations remain outside the
|
|
85
|
+
> graph unless imported; the separately loaded worker asset is self-contained.
|
|
112
86
|
|
|
113
87
|
---
|
|
114
88
|
|
|
@@ -209,22 +183,30 @@ shapes / text boxes the same way.)
|
|
|
209
183
|
|
|
210
184
|
### Optional chart renderers
|
|
211
185
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
186
|
+
Classic DrawingML 2-D chart families are included in every format entry.
|
|
187
|
+
Microsoft ChartEx, model-space 3-D charts and offline country-level Region Maps
|
|
188
|
+
are separate entries. Inject them once in the same load options object as
|
|
189
|
+
`math`; omitting a renderer keeps it out of the ordinary render path. The
|
|
190
|
+
built-in renderers work in both main and worker modes. Without `chartEx`,
|
|
191
|
+
ChartEx families show the standard unsupported-chart placeholder. Without
|
|
192
|
+
`threeD`, 3-D chart groups
|
|
216
193
|
fall back to their canonical 2-D family. Without `regionMap`, Region Maps show
|
|
217
|
-
the standard unsupported-chart placeholder.
|
|
194
|
+
the standard unsupported-chart placeholder. The code-size boundary applies to
|
|
195
|
+
the default main-mode application graph. The separately loaded render-worker
|
|
196
|
+
asset stays self-contained for broad bundler compatibility and therefore
|
|
197
|
+
contains its built-in optional renderer implementations.
|
|
218
198
|
|
|
219
199
|
```typescript
|
|
220
200
|
import { XlsxViewer } from '@silurus/ooxml/xlsx';
|
|
221
201
|
import { threeD } from '@silurus/ooxml/three-d';
|
|
222
202
|
import { regionMap } from '@silurus/ooxml/region-map';
|
|
203
|
+
import { chartEx } from '@silurus/ooxml/chart-ex';
|
|
223
204
|
|
|
224
205
|
const container = document.getElementById('xlsx-container') as HTMLElement;
|
|
225
206
|
const workbookViewer = new XlsxViewer(container, {
|
|
226
207
|
threeD,
|
|
227
208
|
regionMap,
|
|
209
|
+
chartEx,
|
|
228
210
|
mode: 'worker',
|
|
229
211
|
});
|
|
230
212
|
await workbookViewer.load('/workbook-with-advanced-charts.xlsx');
|
|
@@ -272,10 +254,10 @@ Notes:
|
|
|
272
254
|
- The canvas-target methods (`renderSlide(canvas)`, `renderPage(canvas)`,
|
|
273
255
|
`renderViewport(canvas)`) are unavailable in worker mode — use the `*ToBitmap`
|
|
274
256
|
variants instead.
|
|
275
|
-
- The built-in math, 3-D chart, and Region Map renderers work in both
|
|
276
|
-
through the same `math`, `threeD`, and `regionMap` options.
|
|
277
|
-
objects are main-realm code and therefore use the feature's
|
|
278
|
-
fallback in `mode: 'worker'`.
|
|
257
|
+
- The built-in math, ChartEx, 3-D chart, and Region Map renderers work in both
|
|
258
|
+
modes through the same `math`, `chartEx`, `threeD`, and `regionMap` options.
|
|
259
|
+
Custom renderer objects are main-realm code and therefore use the feature's
|
|
260
|
+
documented fallback in `mode: 'worker'`.
|
|
279
261
|
- A DOCX document that requires browser-only OpenType vertical-glyph selection
|
|
280
262
|
automatically uses effective main mode for correct shaping. Read
|
|
281
263
|
`document.mode` after loading when your integration needs to observe this
|
|
@@ -526,38 +508,33 @@ flowchart TB
|
|
|
526
508
|
end
|
|
527
509
|
|
|
528
510
|
subgraph browser["🌐 Runtime (Browser)"]
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
XB --> XR["renderer.ts\n〈Canvas 2D — main thread〉"]
|
|
541
|
-
end
|
|
542
|
-
subgraph pptx_pkg["@silurus/ooxml · pptx"]
|
|
543
|
-
PV["PptxViewer"] --> PP["PptxPresentation"]
|
|
544
|
-
PP --> PW["worker.ts\n〈Web Worker — parse only〉"]
|
|
545
|
-
PP --> PR["renderer.ts\n〈Canvas 2D — main thread〉"]
|
|
546
|
-
end
|
|
547
|
-
DR -. uses .-> CORE
|
|
548
|
-
XR -. uses .-> CORE
|
|
549
|
-
PR -. uses .-> CORE
|
|
511
|
+
VIEWER["DOCX / XLSX / PPTX Viewer"] --> ENGINE["format headless engine"]
|
|
512
|
+
ENGINE -->|mode: main| PARSE["parser worker\n〈WASM parse〉"]
|
|
513
|
+
PARSE --> MODEL["validated document model"]
|
|
514
|
+
MODEL --> MAIN["layout + Canvas paint\n〈main thread〉"]
|
|
515
|
+
ENGINE -->|mode: worker| RENDER_WORKER["render-worker.ts\n〈WASM parse + layout + paint〉"]
|
|
516
|
+
RENDER_WORKER --> BITMAP["ImageBitmap"]
|
|
517
|
+
MAIN --> CANVAS["<canvas>"]
|
|
518
|
+
BITMAP --> CANVAS
|
|
519
|
+
CORE["@silurus/ooxml-core\nshared layout and paint primitives"]
|
|
520
|
+
MAIN -. uses .-> CORE
|
|
521
|
+
RENDER_WORKER -. uses .-> CORE
|
|
550
522
|
end
|
|
551
523
|
|
|
552
|
-
docx_wasm -->
|
|
553
|
-
xlsx_wasm -->
|
|
554
|
-
pptx_wasm -->
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
524
|
+
docx_wasm --> PARSE
|
|
525
|
+
xlsx_wasm --> PARSE
|
|
526
|
+
pptx_wasm --> PARSE
|
|
527
|
+
docx_wasm --> RENDER_WORKER
|
|
528
|
+
xlsx_wasm --> RENDER_WORKER
|
|
529
|
+
pptx_wasm --> RENDER_WORKER
|
|
558
530
|
```
|
|
559
531
|
|
|
560
|
-
All three formats
|
|
532
|
+
All three formats use the same public mode boundary. In the default `main` mode,
|
|
533
|
+
WASM parsing runs in a Worker and the validated model is laid out and painted on
|
|
534
|
+
the main thread. In `worker` mode, parsing, layout and Canvas paint run in a
|
|
535
|
+
render Worker, which returns an `ImageBitmap` for presentation. Built-in optional
|
|
536
|
+
renderers use the same injection options in both modes. `@silurus/ooxml-core`
|
|
537
|
+
owns the layout, paint and type primitives shared by DOCX, XLSX and PPTX.
|
|
561
538
|
|
|
562
539
|
### Key files
|
|
563
540
|
|
|
@@ -566,10 +543,11 @@ All three formats follow the same shape: the worker parses the `.docx` / `.xlsx`
|
|
|
566
543
|
| `packages/docx/parser/src/lib.rs` | Rust WASM parser — DOCX ZIP → `Document` JSON |
|
|
567
544
|
| `packages/xlsx/parser/src/lib.rs` | Rust WASM parser — XLSX ZIP → `Workbook` JSON |
|
|
568
545
|
| `packages/pptx/parser/src/lib.rs` | Rust WASM parser — PPTX ZIP → `Presentation` JSON |
|
|
569
|
-
| `packages/docx/src/renderer.ts` | Canvas 2D rendering
|
|
570
|
-
| `packages/xlsx/src/renderer.ts` | Canvas 2D rendering
|
|
571
|
-
| `packages/pptx/src/renderer.ts` | Canvas 2D rendering
|
|
572
|
-
| `packages/*/src/worker.ts` |
|
|
546
|
+
| `packages/docx/src/renderer.ts` | DOCX Canvas 2D rendering and text layout |
|
|
547
|
+
| `packages/xlsx/src/renderer.ts` | XLSX Canvas 2D viewport rendering |
|
|
548
|
+
| `packages/pptx/src/renderer.ts` | PPTX Canvas 2D rendering |
|
|
549
|
+
| `packages/*/src/worker.ts` | Main-mode parser Worker entry |
|
|
550
|
+
| `packages/*/src/render-worker.ts` | Worker-mode parser, layout and Canvas paint entry |
|
|
573
551
|
| `packages/*/src/viewer.ts` | Public Viewer API — canvas lifecycle, navigation |
|
|
574
552
|
| `packages/core/src/index.ts` | Cross-format primitives — chart renderer, shape helpers, `autoResize`, shared types |
|
|
575
553
|
|
|
@@ -628,6 +606,7 @@ file without uploading it.
|
|
|
628
606
|
| | Table indent (`w:tblInd`, §17.4.50) | ✅ |
|
|
629
607
|
| | Right-to-left table column order (`w:bidiVisual`, §17.4.1) | ✅ |
|
|
630
608
|
| | 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) | ✅ |
|
|
609
|
+
| | ChartEx (waterfall / histogram / Pareto / funnel / box & whisker / treemap / sunburst) | ✅ opt-in |
|
|
631
610
|
| | Math equations (OMML `m:oMath` / `m:oMathPara`, rendered via MathJax — opt-in `@silurus/ooxml/math`) | ✅ |
|
|
632
611
|
| | Images (inline and anchored, with text wrap) | ✅ |
|
|
633
612
|
| | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, raster fallback) | ✅ |
|
|
@@ -687,6 +666,7 @@ file without uploading it.
|
|
|
687
666
|
| | Drawing shapes / text boxes (`xdr:sp`, `xdr:txBody` — 186 preset geometries via the shared engine, with `avLst` adjust handles) | ✅ |
|
|
688
667
|
| | Math equations in shapes (OMML `m:oMath` / `m:oMathPara` in `xdr:txBody`, incl. `a14:m` / `mc:AlternateContent`; rendered via MathJax — opt-in `@silurus/ooxml/math`) | ✅ |
|
|
689
668
|
| | Charts (bar, line, area, pie, doughnut, radar, scatter / bubble) | ✅ |
|
|
669
|
+
| | ChartEx (waterfall / histogram / Pareto / funnel / box & whisker / treemap / sunburst) | ✅ opt-in |
|
|
690
670
|
| | Chart markers (circle / square / diamond / triangle / x / plus / star / dot / dash, per-point `<c:dPt>` overrides; markers-only scatter series draw a marker legend key) | ✅ |
|
|
691
671
|
| | Chart data labels (`<c:dLbl>` per-point with CELLRANGE / VALUE / SERIESNAME / CATEGORYNAME field references, position `l`/`r`/`t`/`b`/`ctr`/`outEnd`) | ✅ |
|
|
692
672
|
| | Chart error bars (`<c:errBars>` X/Y direction, `cust` / `fixedVal` / `stdErr` / `stdDev` / `percentage`, dashed/styled lines) | ✅ |
|
|
@@ -732,12 +712,12 @@ file without uploading it.
|
|
|
732
712
|
| | Groups (`grpSp`) with nested transforms | ✅ |
|
|
733
713
|
| | Connectors (`cxnSp`) | ✅ |
|
|
734
714
|
| | Tables (`tbl` in `graphicFrame`) | ✅ |
|
|
735
|
-
| | Charts (bar, line, area, radar
|
|
715
|
+
| | Charts (bar, line, area, radar) | ✅ |
|
|
736
716
|
| | Charts (pie, doughnut) | ✅ |
|
|
737
717
|
| | Charts (scatter — `scatterStyle` marker / line / smooth variants) | ✅ |
|
|
738
718
|
| | Charts (bubble — `bubbleSize` per-point area scaling) | ✅ |
|
|
739
|
-
| | Charts (combo — bar
|
|
740
|
-
| |
|
|
719
|
+
| | Charts (ordered classic combo groups — observed bar/line/area, scatter/bubble, and stock/line combinations; unsupported mixes fail closed) | ✅ |
|
|
720
|
+
| | ChartEx (waterfall / histogram / Pareto / funnel / box & whisker / treemap / sunburst) | ✅ opt-in |
|
|
741
721
|
| | Charts (stock — high / low / close candlesticks) | ✅ |
|
|
742
722
|
| | SmartArt (renders the PowerPoint-saved drawing layout `dsp:drawing`, or a staged fallback to a text list when no drawing part is present; no native diagram layout engine) | ✅ |
|
|
743
723
|
| | OLE embedded objects (`p:oleObj` — the baked preview `p:pic` is drawn; the embedded app is not run) | ✅ |
|