@silurus/ooxml 0.85.0 → 0.85.2

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 (40) hide show
  1. package/README.md +11 -7
  2. package/dist/assets/render-worker-CV9Mg4j9.js +10 -0
  3. package/dist/assets/{render-worker-BRKOyWVH.js → render-worker-DHP0rgcW.js} +16 -16
  4. package/dist/assets/render-worker-DdvOGyrn.js +11 -0
  5. package/dist/{canvas-viewer-mechanics-C-yTGbFC.js → canvas-viewer-mechanics-CDNMJ-Yz.js} +3 -3
  6. package/dist/{document-pull-client-BdYrjAep.js → document-pull-client-BssAk95w.js} +3877 -3867
  7. package/dist/{docx-qK0Qmyey.js → docx-BY7oyoml.js} +40 -41
  8. package/dist/docx.mjs +5 -5
  9. package/dist/{dom-interaction-boundary-CMDDgICk.js → dom-interaction-boundary-CDGegIB5.js} +1 -1
  10. package/dist/index.mjs +3 -3
  11. package/dist/line-distribute-BsV4MVZ2.js +1023 -0
  12. package/dist/{line-metrics-u87yCAfV.js → line-metrics-BGtFM-ec.js} +650 -607
  13. package/dist/node.mjs +30 -30
  14. package/dist/{pptx-DxZwhOWr.js → pptx-C4z96sAA.js} +29 -25
  15. package/dist/pptx.mjs +6 -6
  16. package/dist/pptx_parser_bg.wasm +0 -0
  17. package/dist/{raster-target-whZhvVMt.js → raster-target-ojDdQizC.js} +11 -7
  18. package/dist/{render-DrAAZWwH.js → render-Dxvwes39.js} +1 -1
  19. package/dist/{render-worker-host-GZ7ez-l3.js → render-worker-host-BAXcBGq3.js} +1 -1
  20. package/dist/{render-worker-host-CHlwYJdK.js → render-worker-host-CNKQ76tu.js} +1 -1
  21. package/dist/{render-worker-host-XDMsyVsv.js → render-worker-host-CXTCU4PO.js} +1 -1
  22. package/dist/{resource-measurement-6uR3Huao.js → resource-measurement-D41R-0Bl.js} +4 -4
  23. package/dist/{session-DoPwA4gv.js → session-BmP4lcEo.js} +6 -6
  24. package/dist/{slide-pull-client-8i8C4VyD.js → slide-pull-client-RTwQbJiy.js} +707 -697
  25. package/dist/tiff.mjs +1 -1
  26. package/dist/types/chart-ex.d.ts +2 -2
  27. package/dist/types/docx.d.ts +11 -11
  28. package/dist/types/index.d.ts +16 -15
  29. package/dist/types/node.d.ts +5 -5
  30. package/dist/types/pptx.d.ts +10 -8
  31. package/dist/types/region-map.d.ts +2 -2
  32. package/dist/types/three-d.d.ts +2 -2
  33. package/dist/types/xlsx.d.ts +9 -8
  34. package/dist/{worksheet-pull-client-Btydoxto.js → worksheet-pull-client-C9sC36Vu.js} +20 -20
  35. package/dist/{xlsx-57OZsbD9.js → xlsx-DSU6pV1O.js} +1214 -1208
  36. package/dist/xlsx.mjs +6 -6
  37. package/package.json +1 -1
  38. package/dist/assets/render-worker-DnU-PxZ1.js +0 -10
  39. package/dist/assets/render-worker-NZPOUOTU.js +0 -11
  40. package/dist/line-distribute-CiKeWjBF.js +0 -1023
package/README.md CHANGED
@@ -311,10 +311,11 @@ await viewer.load('/deck.pptx');
311
311
  ```
312
312
 
313
313
  The container must have a bounded height (e.g. `height: 100vh` or a flex child)
314
- so the viewer can size its scroll host to it. Base zoom fits the first page/slide
315
- width to the container width and re-fits on resize; a `0`-width container defers
316
- layout until it has width. Call `destroy()` to tear down (a self-loaded engine is
317
- destroyed with it; a borrowed one is not see below).
314
+ so the viewer can size its scroll host to it. Base zoom fits the widest available
315
+ DOCX page, or the PPTX slide width, to the container and re-fits on resize. A
316
+ progressively loaded DOCX re-fits if a wider page appears; a `0`-width container
317
+ defers layout until it has width. Call `destroy()` to tear down (a self-loaded
318
+ engine is destroyed with it; a borrowed one is not — see below).
318
319
 
319
320
  Pass `refitOnResize: false` when the viewport must not determine the document's
320
321
  physical display size. An explicit pre-load `setScale(1)` then keeps the same
@@ -343,7 +344,9 @@ sheet sits inside a uniform desk margin; pass `0` for a flush edge.
343
344
  bare-wheel still scrolls natively. Zoom is flicker-free — a rapid gesture shows a
344
345
  CSS preview and settles into a crisp re-render when it pauses. Bounds are the
345
346
  absolute scale factors `zoomMin` / `zoomMax` (default `0.1` / `4`), and
346
- `setScale(scale)` sets it programmatically. Pass `enableZoom: false` to disable.
347
+ `setScale(scale)` sets it programmatically. When fitting needs a scale below
348
+ `zoomMin`, that fitted scale becomes the effective minimum so users can zoom in
349
+ and still return to the original fit. Pass `enableZoom: false` to disable.
347
350
 
348
351
  **Text selection and find.** Pass `enableTextSelection: true` to overlay a
349
352
  transparent, selectable text layer per page/slide for native copy. It works in
@@ -1049,16 +1052,17 @@ try {
1049
1052
 
1050
1053
  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.
1051
1054
 
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:
1055
+ Image decoding uses a separate adaptive resource policy shared by all three formats. Ordinary browser-decodable rasters are assigned a geometry-weighted share of the default 128 MiB decoded budget before source extraction. Each source can then flow directly from extraction to decode: it keeps native resolution when it fits its share and otherwise uses up to a 2x canvas/DPR grid when that share has headroom, avoiding visibly soft 1x intermediates for small placed artwork. If the complete set of display grids itself exceeds the budget, adaptive mode reduces them by one uniform quality ratio. This avoids an all-paint inspection barrier without making display-sized downsampling the default. Natural-size consumers, pixel effects that require the authored grid, and formats that cannot be decoder-resized remain on their guarded format-specific paths under the hard surface ceilings. 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. Applications with a known environment can override the aggregate budget on Viewer or per-render options:
1053
1056
  ```ts
1054
1057
  new PptxViewer(canvas, {
1055
1058
  imageResources: {
1056
1059
  decodedByteBudget: 256 * 1024 * 1024,
1057
1060
  strategy: 'adaptive', // or 'strict' to reject instead of reducing quality
1061
+ resolution: 'native-if-fit', // or 'display' to minimize retained pixels
1058
1062
  },
1059
1063
  });
1060
1064
  ```
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.
1065
+ `resolution` defaults to `'native-if-fit'`. Use `'display'` when minimizing retained raster pixels is more important than preserving source-resolution sampling. `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.
1062
1066
 
1063
1067
  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.
1064
1068