@silurus/ooxml 0.82.0 → 0.83.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 (45) hide show
  1. package/README.md +72 -3
  2. package/dist/assets/{render-worker-7-Zr7fSw.js → render-worker-Bu31cf1J.js} +4 -4
  3. package/dist/assets/render-worker-DuztdEcX.js +11 -0
  4. package/dist/{canvas-viewer-mechanics-CS_qbr6T.js → canvas-viewer-mechanics-h07vpVOQ.js} +42 -2
  5. package/dist/{comment-ui-runtime-BAe30Ct9.js → comment-ui-runtime-BelHJt73.js} +3 -3
  6. package/dist/{comment-ui-runtime-BUCj4hWn.js → comment-ui-runtime-DD5a3x3k.js} +3 -3
  7. package/dist/comment-ui-runtime-DTGN3Vyy.js +2 -0
  8. package/dist/{comments-Cf9W7r3M.js → comments-AAaNnQTi.js} +7 -2
  9. package/dist/{document-pull-client-BCgmytqI.js → document-pull-client-BAhqoTmm.js} +4509 -3953
  10. package/dist/docx-Dg73PGgC.js +2707 -0
  11. package/dist/docx.mjs +6 -6
  12. package/dist/docx_parser_bg.wasm +0 -0
  13. package/dist/dom-interaction-boundary-CepOlXt6.js +217 -0
  14. package/dist/index.mjs +4 -4
  15. package/dist/line-distribute-D7A_wnJg.js +1003 -0
  16. package/dist/{line-metrics-B3syvDn2.js → line-metrics-Bpn7OeZD.js} +616 -616
  17. package/dist/node.mjs +308 -308
  18. package/dist/pptx-BcUCETmQ.js +2990 -0
  19. package/dist/pptx.mjs +5 -5
  20. package/dist/pptx_parser_bg.wasm +0 -0
  21. package/dist/{read-only-comment-margin-Dn2y55W6.js → read-only-comment-margin-DrUX-YrP.js} +1 -1
  22. package/dist/{render-CenWM4g1.js → render-CL-7V3E8.js} +1 -1
  23. package/dist/{render-worker-host-BNENN3qP.js → render-worker-host-DDZo0feh.js} +1 -1
  24. package/dist/{render-worker-host-BmH3kGSj.js → render-worker-host-FJ19-fUI.js} +1 -1
  25. package/dist/{resource-measurement-CsW4_eYt.js → resource-measurement-DuiFWzam.js} +3 -3
  26. package/dist/{session-Cky_swUj.js → session-BjydZEDF.js} +107 -94
  27. package/dist/{slide-pull-client-CqTVFb3W.js → slide-pull-client-CwvvncPA.js} +1199 -970
  28. package/dist/types/docx.d.ts +99 -7
  29. package/dist/types/index.d.ts +189 -12
  30. package/dist/types/node.d.ts +385 -379
  31. package/dist/types/pptx.d.ts +96 -5
  32. package/dist/types/xlsx.d.ts +4 -2
  33. package/dist/{worksheet-pull-client-CYtwXP5D.js → worksheet-pull-client-DyFsDF4A.js} +32 -32
  34. package/dist/{xlsx-DlV37-0j.js → xlsx-BibrHQ52.js} +477 -477
  35. package/dist/xlsx.mjs +5 -5
  36. package/dist/xlsx_parser_bg.wasm +0 -0
  37. package/package.json +4 -1
  38. package/dist/assets/render-worker-B5gsW6b5.js +0 -11
  39. package/dist/comment-ui-runtime-F4a3te6p.js +0 -2
  40. package/dist/docx-wokGKYfi.js +0 -2162
  41. package/dist/dom-interaction-boundary-C8F6HO5x.js +0 -119
  42. package/dist/line-distribute-iXsUCIH-.js +0 -1003
  43. package/dist/pptx-DU8L8I2T.js +0 -2432
  44. /package/dist/{comment-occurrence-C34fWs_F.js → comment-occurrence-X54si2ob.js} +0 -0
  45. /package/dist/{highlight-rect-MaCt0om0.js → highlight-rect-Hes0z_Mj.js} +0 -0
package/README.md CHANGED
@@ -448,6 +448,73 @@ document.destroy(); // release it yourself when every pane is gone
448
448
  `PptxViewer` and `PptxScrollViewer` use `fromPresentation(...)`; `XlsxViewer`
449
449
  and `XlsxSheetViewer` use `fromWorkbook(...)`.
450
450
 
451
+ ### Progressive DOCX layout
452
+
453
+ For a large DOCX file, set `progressiveLayout: true` to resolve `load()` when the
454
+ opening pages are paintable while the same paginator continues in the background.
455
+ It is available on `DocxViewer`, `DocxScrollViewer`, and `DocxDocument.load()` in
456
+ both render modes. Pair it with `mode: 'worker'` when the remaining layout and
457
+ paint work should also stay off the UI thread.
458
+
459
+ ```typescript
460
+ import { DocxScrollViewer } from '@silurus/ooxml/docx';
461
+
462
+ const container = document.querySelector('#document') as HTMLElement;
463
+ const pager = document.querySelector('#pager') as HTMLElement;
464
+
465
+ const viewer = new DocxScrollViewer(container, {
466
+ progressiveLayout: true,
467
+ mode: 'worker',
468
+ onVisiblePageChange(pageIndex, availablePages, layoutComplete) {
469
+ pager.textContent =
470
+ `Page ${pageIndex + 1} of ${availablePages}${layoutComplete ? '' : '…'}`;
471
+ pager.setAttribute('aria-busy', String(!layoutComplete));
472
+ },
473
+ });
474
+
475
+ await viewer.load('/document.docx');
476
+
477
+ // Print, export, and final-page-count UI need the converged layout.
478
+ await viewer.waitUntilLayoutComplete();
479
+ console.log('Final page count:', viewer.pageCount);
480
+ ```
481
+
482
+ While `layoutComplete` is false, `pageCount` and the callback's `total` argument
483
+ mean pages available so far, not the final total. The page callbacks fire again
484
+ when that count grows, even if the visible page does not change. Await
485
+ `waitUntilLayoutComplete()` before printing, exporting, or snapshotting a final count.
486
+ In-document `NUMPAGES` fields are repainted with their authoritative value after
487
+ pagination converges. See the [progressive layout guide](https://ooxml.silurus.dev/docx#progressive-layout)
488
+ and [DOCX API reference](https://ooxml.silurus.dev/api/docx).
489
+
490
+ ### Progressive PPTX layout
491
+
492
+ PPTX exposes the same progressive lifecycle on `PptxViewer`,
493
+ `PptxScrollViewer`, and `PptxPresentation.load()`:
494
+
495
+ ```typescript
496
+ import { PptxScrollViewer } from '@silurus/ooxml/pptx';
497
+
498
+ const viewer = new PptxScrollViewer(container, {
499
+ progressiveLayout: true,
500
+ mode: 'worker',
501
+ onVisibleSlideChange(slideIndex, slideCount, layoutComplete) {
502
+ pager.textContent = `Slide ${slideIndex + 1} of ${slideCount}`;
503
+ pager.setAttribute('aria-busy', String(!layoutComplete));
504
+ },
505
+ });
506
+
507
+ await viewer.load('/presentation.pptx');
508
+ await viewer.waitUntilLayoutComplete();
509
+ ```
510
+
511
+ Unlike DOCX pagination, a PPTX bootstrap already provides the final slide list
512
+ and uniform dimensions. `slideCount` and the ScrollViewer's scroll extent are
513
+ therefore stable from first paint; `availableSlideCount` grows as the paintable
514
+ opening prefix is prepared. Scrolling ahead shows a loading state without
515
+ changing the scrollbar length. See the [PPTX progressive layout guide](https://ooxml.silurus.dev/pptx#progressive-layout)
516
+ and [PPTX API reference](https://ooxml.silurus.dev/api/pptx).
517
+
451
518
  For presentations, `enableMediaPlayback: true` makes embedded audio and video
452
519
  interactive inside the real viewport plus `mediaOverscan` slides. Other mounted
453
520
  slides remain static and selectable, avoiding offscreen media blobs and
@@ -455,8 +522,10 @@ animation loops.
455
522
 
456
523
  Both viewers also expose `relayout()` (force a re-fit when the container resizes
457
524
  in a way a `ResizeObserver` cannot see — e.g. a late web-font load),
458
- `onVisiblePageChange` / `onVisibleSlideChange` (fires when the top-most visible
459
- page/slide changes), and `onError` (async per-page render failures are routed
525
+ `onVisiblePageChange` (fires when the top-most visible page, provisional DOCX
526
+ page count, or completion state changes), `onVisibleSlideChange` (fires when the
527
+ top-most visible slide or PPTX completion state changes; its slide count is
528
+ final from first paint), and `onError` (async per-page render failures are routed
460
529
  here instead of crashing the scroll loop). The parse/render knobs from the
461
530
  headless engines (`mode`, `useGoogleFonts`, `resourceLimits`, the deprecated
462
531
  `maxZipEntryBytes` alias, `math`, `dpr`) are accepted too.
@@ -613,7 +682,7 @@ file without uploading it.
613
682
  | | Page-number formats (`w:pgNumType` restart / format §17.6.12; PAGE `\*` switches — decimal / roman / letter / hex / ordinal-dash / hebrew2 / koreanLegal, §17.18.59) | ✅ |
614
683
  | | Field date/time pictures (`TIME` / `DATE` field `\@` format, §17.16.5.72 / .16) | ✅ |
615
684
  | | `w:snapToGrid` opt-out of the document grid (§17.3.1.32) | ✅ |
616
- | | Track changes (§17.13.5 `w:ins` / `w:del` / `w:moveFrom` / `w:moveTo`) — body-story revision records are available as data; rendering projects the accepted final state, with deletions and moved-away text hidden | ✅ |
685
+ | | Track changes (§17.13.5 `w:ins` / `w:del` / `w:moveFrom` / `w:moveTo`) — the default render is the FINAL state (deletions and moved-away text hidden); the opt-in markup view (`showTrackedChanges`) draws author-coloured underline / strikethrough plus margin change bars, and body-story revision records are available as data | ✅ |
617
686
  | | Comments (§17.13.4) — opt-in margin balloons (`comments: true`): commented ranges tinted, threaded replies via `commentsExtended.xml`, resolved threads hidden, click-to-select stacking; also available as data (`doc.comments`, `doc.commentAnchorRanges()`) | ✅ |
618
687
  | | Markdown export (`DocxDocument.toMarkdown()` — headings, lists, tables, footnotes / comments) | ✅ |
619
688
  | | Mail merge fields | ❌ Not planned |