@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
@@ -1,12 +1,12 @@
1
1
  import { t as e } from "./chunk-DmhlhrBa.js";
2
- import { B as t, R as n, W as r, Xt as i, a, et as o, on as s, pt as c, sn as l, ut as u, vt as d, z as f } from "./line-metrics-u87yCAfV.js";
3
- import { C as p, D as m, E as h, S as g, T as _, _ as v, a as y, b, c as x, d as ee, f as te, g as ne, h as re, i as S, l as C, m as ie, n as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as fe, w as pe, x as me, y as he } from "./canvas-viewer-mechanics-C-yTGbFC.js";
2
+ import { B as t, R as n, W as r, Zt as i, a, cn as o, et as s, pt as c, sn as l, ut as u, vt as d, z as f } from "./line-metrics-BGtFM-ec.js";
3
+ import { C as p, D as m, E as h, S as g, T as _, _ as v, a as y, b, c as x, d as ee, f as te, g as ne, h as re, i as S, l as C, m as ie, n as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as fe, w as pe, x as me, y as he } from "./canvas-viewer-mechanics-CDNMJ-Yz.js";
4
4
  import { a as ge, i as _e, t as ve } from "./bounded-raw-part-cache-C6ro6Ezf.js";
5
- import { c as ye, i as be, l as xe, n as Se, o as w, r as Ce, s as we, t as Te } from "./dom-interaction-boundary-CMDDgICk.js";
6
- import { A as Ee, C as T, D as E, E as De, O as D, S as Oe, T as O, _ as ke, a as Ae, b as je, c as Me, d as Ne, f as Pe, g as Fe, h as Ie, j as Le, k as Re, l as ze, m as Be, n as k, o as Ve, p as He, s as Ue, t as A, v as We, w as Ge, x as Ke, y as qe } from "./document-pull-client-BdYrjAep.js";
5
+ import { c as ye, i as be, l as xe, n as Se, o as w, r as Ce, s as we, t as Te } from "./dom-interaction-boundary-CDGegIB5.js";
6
+ import { A as Ee, C as T, D as E, E as De, O as D, S as Oe, T as O, _ as ke, a as Ae, b as je, c as Me, d as Ne, f as Pe, g as Fe, h as Ie, j as Le, k as Re, l as ze, m as Be, n as k, o as Ve, p as He, s as Ue, t as A, v as We, w as Ge, x as Ke, y as qe } from "./document-pull-client-BssAk95w.js";
7
7
  import { l as Je, s as Ye } from "./pixel-budget-Dgjw269h.js";
8
8
  import { a as j } from "./units-EJdC96r6.js";
9
- import { i as Xe, s as Ze } from "./raster-target-whZhvVMt.js";
9
+ import { i as Xe, s as Ze } from "./raster-target-ojDdQizC.js";
10
10
  import { n as Qe } from "./renderer-module-contract-Cu-GKuPd.js";
11
11
  import { n as $e, t as M } from "./highlight-rect-DBcYVJDv.js";
12
12
  import { o as N } from "./source-key-BkBB3X82.js";
@@ -553,7 +553,7 @@ var J = class e {
553
553
  t = await e.arrayBuffer();
554
554
  } else t = r;
555
555
  t = m(await h(t, i.password)), c.setSourceBytes(t.byteLength), c.checkpoint("container ready");
556
- let n = s === "worker" ? (await import("./render-worker-host-GZ7ez-l3.js")).createRenderWorker() : new at(), l = s === "worker" ? Qe(i) : void 0, u = s === "worker" && !!i.progressiveLayout, d;
556
+ let n = s === "worker" ? (await import("./render-worker-host-BAXcBGq3.js")).createRenderWorker() : new at(), l = s === "worker" ? Qe(i) : void 0, u = s === "worker" && !!i.progressiveLayout, d;
557
557
  try {
558
558
  d = new e(n, s, o, i.wasmUrl), d._metrics = c;
559
559
  let r = E(d), f = O(i.currentDate, r.defaultCurrentDateMs, i.showTrackedChanges === !0);
@@ -1021,7 +1021,7 @@ var J = class e {
1021
1021
  async renderPageToBitmap(e, t = {}) {
1022
1022
  let { onTextRun: n, ...r } = t, i = {
1023
1023
  ...this._withActiveView(r),
1024
- dpr: r.dpr ?? o()
1024
+ dpr: r.dpr ?? s()
1025
1025
  };
1026
1026
  if (this._mode === "worker") {
1027
1027
  let t = await this._bridge.request((t) => ({
@@ -1810,7 +1810,6 @@ var cn = class e {
1810
1810
  _lastReportedLayoutComplete = null;
1811
1811
  _layoutUnsubscribe = null;
1812
1812
  _presentedPageCount = 0;
1813
- _pendingLayoutPublication = null;
1814
1813
  _scrollListener = null;
1815
1814
  _selectionChangeListener = null;
1816
1815
  _selectionContextKey = "null";
@@ -1942,7 +1941,7 @@ var cn = class e {
1942
1941
  });
1943
1942
  }
1944
1943
  _bindLayoutDocument(e) {
1945
- this._unbindLayoutDocument(), this._layoutViewPublicationGeneration = 0, this._presentedPageCount = e.pageCount, this._pendingLayoutPublication = null;
1944
+ this._unbindLayoutDocument(), this._layoutViewPublicationGeneration = 0, this._presentedPageCount = e.pageCount;
1946
1945
  let t = zt(e, (t) => this._onLayoutViewPublication(e, t), (e) => this._reportRenderError(e)), n = !0, r = Ft(e, () => ({
1947
1946
  pageCount: e.pageCount,
1948
1947
  exact: e.layoutComplete,
@@ -1959,7 +1958,7 @@ var cn = class e {
1959
1958
  };
1960
1959
  }
1961
1960
  _unbindLayoutDocument() {
1962
- this._layoutUnsubscribe?.(), this._layoutUnsubscribe = null, this._presentedPageCount = 0, this._pendingLayoutPublication = null;
1961
+ this._layoutUnsubscribe?.(), this._layoutUnsubscribe = null, this._presentedPageCount = 0;
1963
1962
  }
1964
1963
  _onLayoutPublication(e, t) {
1965
1964
  if (!(this._destroyed || e !== this._doc)) {
@@ -1967,19 +1966,11 @@ var cn = class e {
1967
1966
  this._errorRouter.reportBackground(t.error, this._opts.onLayoutComplete !== void 0);
1968
1967
  return;
1969
1968
  }
1970
- if (this._find.invalidate(), this._refreshCommentSurface(), !t.complete) {
1971
- if (this._pendingLayoutPublication = t, this._lastRange && this._emitVisiblePageChange(this._lastRange), this._presentedPageCount === 0 || t.pageCount < this._presentedPageCount) {
1972
- this._pendingLayoutPublication = null, this._applyLayoutPublication(t);
1973
- return;
1974
- }
1975
- this._revealPendingLayoutAtPresentedTail();
1976
- return;
1977
- }
1978
- this._pendingLayoutPublication = null, this._applyLayoutPublication(t);
1969
+ this._find.invalidate(), this._refreshCommentSurface(), this._applyLayoutPublication(t);
1979
1970
  }
1980
1971
  }
1981
1972
  _onLayoutViewPublication(e, t) {
1982
- this._destroyed || e !== this._doc || t.generation <= this._layoutViewPublicationGeneration || (this._layoutViewPublicationGeneration = t.generation, t.requester !== this && (this._layoutViewGeneration++, this._showTrackedChanges = t.view.showTrackedChanges, this._currentDate = t.view.currentDate, this._find.invalidate(), this._pendingLayoutPublication = null, this._applyLayoutPublication({
1973
+ this._destroyed || e !== this._doc || t.generation <= this._layoutViewPublicationGeneration || (this._layoutViewPublicationGeneration = t.generation, t.requester !== this && (this._layoutViewGeneration++, this._showTrackedChanges = t.view.showTrackedChanges, this._currentDate = t.view.currentDate, this._find.invalidate(), this._applyLayoutPublication({
1983
1974
  pageCount: e.pageCount,
1984
1975
  exact: !0,
1985
1976
  complete: e.layoutComplete
@@ -1996,14 +1987,6 @@ var cn = class e {
1996
1987
  this._presentedPageCount = e.pageCount, this._renderEpoch++, this.relayout();
1997
1988
  for (let [e, n] of t) e >= this._presentedPageCount || this._slots.get(e) !== n || this._refreshSlotAtomically(e, n);
1998
1989
  }
1999
- _revealPendingLayoutAtPresentedTail() {
2000
- let e = this._pendingLayoutPublication;
2001
- !e || this._presentedPageCount === 0 || w(this._scrollGeometry, this._scrollHost.scrollTop, this._scrollHost.clientHeight, 0).end < this._presentedPageCount - 1 || (this._pendingLayoutPublication = null, this._applyLayoutPublication(e));
2002
- }
2003
- _revealPendingLayoutThroughPage(e) {
2004
- let t = this._pendingLayoutPublication;
2005
- !t || e < this._presentedPageCount || (this._pendingLayoutPublication = null, this._applyLayoutPublication(t));
2006
- }
2007
1990
  _pageWidthPx(e) {
2008
1991
  return this._doc.pageSize(e).widthPt * j * this._scale;
2009
1992
  }
@@ -2051,11 +2034,20 @@ var cn = class e {
2051
2034
  let t = this._commentZoom(), n = `calc(100% + ${nn * t}px)`;
2052
2035
  e.style.left = this._commentSide() === "right" ? n : "", e.style.right = this._commentSide() === "left" ? n : "", e.style.width = `${280 * t}px`, e.style.fontSize = `${rn}px`, e.dataset.ooxmlCommentZoom = String(t);
2053
2036
  }
2037
+ _widestPageWidthPt() {
2038
+ if (!this._doc) return 0;
2039
+ let e = 0, t = this._presentedPageCount || this._doc.pageCount;
2040
+ for (let n = 0; n < t; n++) {
2041
+ let t = this._doc.pageSize(n).widthPt;
2042
+ t > e && (e = t);
2043
+ }
2044
+ return e;
2045
+ }
2054
2046
  _baseScale() {
2055
2047
  if (!this._doc || this._doc.pageCount === 0) return 0;
2056
2048
  let e = this._fitWidthPx();
2057
2049
  if (e <= 0) return 0;
2058
- let t = this._doc.pageSize(0).widthPt;
2050
+ let t = this._widestPageWidthPt();
2059
2051
  return t <= 0 ? 0 : e / (t * j);
2060
2052
  }
2061
2053
  relayout() {
@@ -2063,7 +2055,13 @@ var cn = class e {
2063
2055
  }
2064
2056
  _relayout(e) {
2065
2057
  if (this._doc) {
2066
- if (this._doc.layoutComplete !== !1 && this._pendingLayoutPublication === null && (this._presentedPageCount = this._doc.pageCount), !this._scaleEstablished) {
2058
+ if (this._doc.layoutComplete !== !1 && (this._presentedPageCount = this._doc.pageCount), this._scaleEstablished) {
2059
+ let e = this._baseScale();
2060
+ if (e > 0 && e !== this._prevBase) {
2061
+ let t = this._prevBase > 0 ? this._scale / this._prevBase : 1;
2062
+ this._prevBase = e, this.setScale(e * t);
2063
+ }
2064
+ } else {
2067
2065
  let e = this._baseScale();
2068
2066
  if (e > 0) {
2069
2067
  if (this._scale = e, this._prevBase = e, this._lastFitWidth = this._fitWidthPx(), this._scaleEstablished = !0, this._pendingScale !== null) {
@@ -2126,7 +2124,7 @@ var cn = class e {
2126
2124
  this._spacer.style.width = `${n + r + e + t}px`, a !== 0 && (this._reviewOriginPx = i, this._scrollHost.style["--ooxml-review-origin-x"] = `${i}px`, this._scrollHost.scrollLeft = o);
2127
2125
  }
2128
2126
  _onScroll() {
2129
- !this._doc || !this._scaleEstablished || (this._revealPendingLayoutAtPresentedTail(), this._mountVisible(void 0, !1));
2127
+ !this._doc || !this._scaleEstablished || this._mountVisible(void 0, !1);
2130
2128
  }
2131
2129
  _mountVisible(e, t = !0) {
2132
2130
  if (!this._doc || this._doc.pageCount === 0) return;
@@ -2302,7 +2300,7 @@ var cn = class e {
2302
2300
  }
2303
2301
  }
2304
2302
  setScale(e) {
2305
- let t = this._opts.zoomMin ?? .1, n = this._opts.zoomMax ?? 4, r = Math.min(n, Math.max(t, e)), i = this._pendingZoomAnchor;
2303
+ let t = this._effectiveZoomMin(), n = this._opts.zoomMax ?? 4, r = Math.min(n, Math.max(t, e)), i = this._pendingZoomAnchor;
2306
2304
  if (this._pendingZoomAnchor = null, !this._doc || this._doc.pageCount === 0 || !this._scaleEstablished) {
2307
2305
  this._pendingScale = r;
2308
2306
  return;
@@ -2328,7 +2326,11 @@ var cn = class e {
2328
2326
  this.setScale(fe(this.getScale()));
2329
2327
  }
2330
2328
  zoomOut() {
2331
- this.setScale(he(this.getScale()));
2329
+ this.setScale(he(this.getScale(), this._effectiveZoomMin()));
2330
+ }
2331
+ _effectiveZoomMin() {
2332
+ let e = this._opts.zoomMin ?? .1;
2333
+ return this._scaleEstablished && this._prevBase > 0 ? Math.min(e, this._prevBase) : e;
2332
2334
  }
2333
2335
  fitWidth() {
2334
2336
  this._fit("width");
@@ -2339,7 +2341,7 @@ var cn = class e {
2339
2341
  _fit(e) {
2340
2342
  if (!this._doc || this._doc.pageCount === 0) return;
2341
2343
  let t = this._doc.pageSize(0), n = v({
2342
- contentWidth: t.widthPt * j,
2344
+ contentWidth: (e === "width" ? this._widestPageWidthPt() : t.widthPt) * j,
2343
2345
  contentHeight: t.heightPt * j,
2344
2346
  containerWidth: this._fitWidthPx(),
2345
2347
  containerHeight: this._scrollHost.clientHeight
@@ -2427,7 +2429,7 @@ var cn = class e {
2427
2429
  (!n || await K(n, {
2428
2430
  showTrackedChanges: e,
2429
2431
  currentDate: this._currentDate
2430
- }, this)) && (this._destroyed || t !== this._layoutViewGeneration || n !== this._doc || (this._showTrackedChanges = e, this._find.invalidate(), this._pendingLayoutPublication = null, this._applyLayoutPublication({
2432
+ }, this)) && (this._destroyed || t !== this._layoutViewGeneration || n !== this._doc || (this._showTrackedChanges = e, this._find.invalidate(), this._applyLayoutPublication({
2431
2433
  pageCount: n?.pageCount ?? 0,
2432
2434
  exact: !0,
2433
2435
  complete: n?.layoutComplete !== !1
@@ -2435,16 +2437,13 @@ var cn = class e {
2435
2437
  }
2436
2438
  scrollToPage(e, t) {
2437
2439
  if (!this._doc || this._doc.pageCount === 0 || !this._scaleEstablished) return;
2438
- let n = Math.max(0, Math.min(e, this._doc.pageCount - 1));
2439
- this._revealPendingLayoutThroughPage(n);
2440
- let r = w(this._scrollGeometry, 0, this._scrollHost.clientHeight, this._overscan()), i = r.offsets[n] ?? 0, a = Math.max(0, r.totalHeight - this._scrollHost.clientHeight), o = Math.min(a, Math.max(0, i)), s = this._scrollHost;
2440
+ let n = Math.max(0, Math.min(e, this._doc.pageCount - 1)), r = w(this._scrollGeometry, 0, this._scrollHost.clientHeight, this._overscan()), i = r.offsets[n] ?? 0, a = Math.max(0, r.totalHeight - this._scrollHost.clientHeight), o = Math.min(a, Math.max(0, i)), s = this._scrollHost;
2441
2441
  typeof s.scrollTo == "function" ? s.scrollTo({
2442
2442
  top: o,
2443
2443
  behavior: t?.behavior ?? "auto"
2444
2444
  }) : this._scrollHost.scrollTop = o, this._mountVisible();
2445
2445
  }
2446
2446
  _scrollToPageTarget(e, t, n) {
2447
- this._revealPendingLayoutThroughPage(e);
2448
2447
  let r = w(this._scrollGeometry, 0, this._scrollHost.clientHeight, this._overscan()), i = this._pageWidthPx(e), { left: a } = this._padH(), o = Math.max(a, (this._scrollHost.clientWidth - i) / 2) + this._reviewOriginPx, s = Math.max(0, r.totalHeight - this._scrollHost.clientHeight), c = this._spacer.offsetWidth || Number.parseFloat(this._spacer.style.width) || 0, l = Math.max(0, c - this._scrollHost.clientWidth), u = Math.min(s, Math.max(0, (r.offsets[e] ?? 0) + t.y + t.h / 2 - this._scrollHost.clientHeight / 2)), d = Math.min(l, Math.max(0, o + t.x + t.w / 2 - this._scrollHost.clientWidth / 2)), f = this._scrollHost;
2449
2448
  typeof f.scrollTo == "function" ? f.scrollTo({
2450
2449
  top: u,
@@ -2782,8 +2781,8 @@ var un = /* @__PURE__ */ e({
2782
2781
  DocxScrollViewer: () => cn,
2783
2782
  DocxViewer: () => $t,
2784
2783
  OoxmlDecodedImageLimitError: () => Ye,
2785
- OoxmlError: () => s,
2786
- OoxmlResourceLimitError: () => l,
2784
+ OoxmlError: () => l,
2785
+ OoxmlResourceLimitError: () => o,
2787
2786
  TiffDecodeError: () => Xe,
2788
2787
  autoResize: () => _,
2789
2788
  buildDocxHighlightLayer: () => Z,
package/dist/docx.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { a as e, on as t, sn as n } from "./line-metrics-u87yCAfV.js";
2
- import { T as r } from "./canvas-viewer-mechanics-C-yTGbFC.js";
1
+ import { a as e, cn as t, sn as n } from "./line-metrics-BGtFM-ec.js";
2
+ import { T as r } from "./canvas-viewer-mechanics-CDNMJ-Yz.js";
3
3
  import { l as i, s as a } from "./pixel-budget-Dgjw269h.js";
4
- import { i as o, s } from "./raster-target-whZhvVMt.js";
5
- import { a as c, c as l, i as u, l as d, n as f, o as p, r as m, s as h } from "./docx-qK0Qmyey.js";
4
+ import { i as o, s } from "./raster-target-ojDdQizC.js";
5
+ import { a as c, c as l, i as u, l as d, n as f, o as p, r as m, s as h } from "./docx-BY7oyoml.js";
6
6
  import { n as g, r as _ } from "./comments-Brfxa3hQ.js";
7
- export { l as DocxDocument, m as DocxScrollViewer, u as DocxViewer, a as OoxmlDecodedImageLimitError, t as OoxmlError, n as OoxmlResourceLimitError, o as TiffDecodeError, r as autoResize, p as buildDocxHighlightLayer, h as buildDocxTextLayer, i as isOoxmlDecodedImageLimitError, s as isTiffDecodeError, f as noteText, e as openExternalHyperlink, c as readDocxTextSelectionContext, g as resolveCommentAnchorRuns, _ as resolveDocxCommentThreads, d as resolveRevisionAnchorRuns };
7
+ export { l as DocxDocument, m as DocxScrollViewer, u as DocxViewer, a as OoxmlDecodedImageLimitError, n as OoxmlError, t as OoxmlResourceLimitError, o as TiffDecodeError, r as autoResize, p as buildDocxHighlightLayer, h as buildDocxTextLayer, i as isOoxmlDecodedImageLimitError, s as isTiffDecodeError, f as noteText, e as openExternalHyperlink, c as readDocxTextSelectionContext, g as resolveCommentAnchorRuns, _ as resolveDocxCommentThreads, d as resolveRevisionAnchorRuns };
@@ -1,4 +1,4 @@
1
- import { Kt as e } from "./line-metrics-u87yCAfV.js";
1
+ import { qt as e } from "./line-metrics-BGtFM-ec.js";
2
2
  import { c as t, o as n, r, s as i } from "./bounded-raw-part-cache-C6ro6Ezf.js";
3
3
  //#region packages/core/src/fonts/embedded.ts
4
4
  function a(e, t) {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./xlsx-57OZsbD9.js";
2
- import { t } from "./pptx-DxZwhOWr.js";
3
- import { t as n } from "./docx-qK0Qmyey.js";
1
+ import { t as e } from "./xlsx-DSU6pV1O.js";
2
+ import { t } from "./pptx-C4z96sAA.js";
3
+ import { t as n } from "./docx-BY7oyoml.js";
4
4
  export { n as docx, t as pptx, e as xlsx };