@silurus/ooxml 0.76.0 → 0.76.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.
@@ -1,8 +1,8 @@
1
1
  import { t as e } from "./chunk-DmhlhrBa.js";
2
2
  import { B as t, Et as n, It as r, Lt as i, R as a, a as o, an as s, hn as c, ht as l, it as u, kt as d, mn as f, q as p, z as m } from "./line-metrics-BdCACYlq.js";
3
- import { _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as ee, i as S, l as te, m as C, n as ne, o as w, p as T, r as re, s as ie, t as E, u as ae, v as oe, x as se, y as ce } from "./canvas-viewer-mechanics-CwVSOYke.js";
3
+ import { _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as ee, i as S, l as te, m as C, n as ne, o as w, p as T, r as re, s as ie, t as ae, u as oe, v as E, x as se, y as ce } from "./canvas-viewer-mechanics-CwVSOYke.js";
4
4
  import { a as le, c as ue, i as de, o as fe, r as pe, s as me, t as he } from "./bounded-raw-part-cache-C6ro6Ezf.js";
5
- import { _ as D, a as ge, c as O, d as k, f as A, g as j, h as M, l as N, m as P, n as F, o as I, p as L, s as _e, t as R, v as z, y as ve } from "./document-pull-client-DQNen8c4.js";
5
+ import { _ as D, a as ge, c as O, d as k, f as A, g as j, h as M, l as N, m as P, n as F, o as I, p as L, s as _e, t as R, v as ve, y as z } from "./document-pull-client-B-3_7_YS.js";
6
6
  import { n as ye, r as B, t as V } from "./highlight-rect-CAkCWJ37.js";
7
7
  //#region packages/core/src/fonts/embedded.ts
8
8
  function be(e, t) {
@@ -128,7 +128,7 @@ var W = class e {
128
128
  _localMetricFontFaces = [];
129
129
  _fetchImage = (e, t) => this.getImage(e, t);
130
130
  constructor(e, t, n, r) {
131
- this._worker = e, this._mode = t, j(this, n), this._bridge = new oe(this._worker, {
131
+ this._worker = e, this._mode = t, j(this, n), this._bridge = new E(this._worker, {
132
132
  correlate: (e) => "protocol" in e && e.protocol === "ooxml-pull-v1" ? e.requestId : "id" in e ? e.id : void 0,
133
133
  toError: (e) => {
134
134
  if (!("protocol" in e || e.type !== "error")) return Object.assign(u(e), {
@@ -163,7 +163,7 @@ var W = class e {
163
163
  t = await e.arrayBuffer();
164
164
  } else t = n;
165
165
  t = se(await _(t, r.password)), c.setSourceBytes(t.byteLength), c.checkpoint("container ready");
166
- let a = s === "worker" ? (await import("./render-worker-host-DWLyqwI3.js")).createRenderWorker() : new Te(), l;
166
+ let a = s === "worker" ? (await import("./render-worker-host-Dpv-nKHY.js")).createRenderWorker() : new Te(), l;
167
167
  try {
168
168
  if (l = new e(a, s, o, r.wasmUrl), l._metrics = c, await l._parse(t, i.policy, s === "worker" ? !!r.useGoogleFonts : !1, r.workerTimeoutMs, (e) => c.observeUsage(e)), s === "worker" && l._mode === "main" && (c.setMode("main"), console.warn("[ooxml] mode: 'worker' fell back to main-thread rendering because this document requires DOM OpenType vertical glyph selection.")), r.math && l._mode === "worker" && console.warn("[ooxml] the math engine is unavailable in mode: 'worker'; equations will be skipped. Use mode: 'main' for documents with equations."), l._mode === "main" && r.useGoogleFonts && l._document && (l._googleFontFaces = await de(L(l._document), A)), l._mode === "main" && l._document?.embeddedFonts?.length) {
169
169
  let e = l;
@@ -225,7 +225,7 @@ var W = class e {
225
225
  }
226
226
  }
227
227
  destroy() {
228
- this._bridge.terminate(), this._document = null, this._source = null, this._meta = null, D(this).services = null, this._bookmarkPages = null, this._rawParts.clear(), this._embeddedFontFaces.length > 0 && (we(this._embeddedFontFaces), this._embeddedFontFaces = []), this._googleFontFaces.length > 0 && (le(this._googleFontFaces), this._googleFontFaces = []), this._localMetricFontFaces.length > 0 && (ve(this._localMetricFontFaces), this._localMetricFontFaces = []), d(this._fetchImage), n(this._fetchImage);
228
+ this._bridge.terminate(), this._document = null, this._source = null, this._meta = null, D(this).services = null, this._bookmarkPages = null, this._rawParts.clear(), this._embeddedFontFaces.length > 0 && (we(this._embeddedFontFaces), this._embeddedFontFaces = []), this._googleFontFaces.length > 0 && (le(this._googleFontFaces), this._googleFontFaces = []), this._localMetricFontFaces.length > 0 && (z(this._localMetricFontFaces), this._localMetricFontFaces = []), d(this._fetchImage), n(this._fetchImage);
229
229
  }
230
230
  async getImage(e, t) {
231
231
  return this._rawParts.get(e, t, () => this._bridge.request((t) => ({
@@ -286,7 +286,7 @@ var W = class e {
286
286
  if (!this._document) return null;
287
287
  let e = D(this).services;
288
288
  if (!e) throw Error("Document layout services are not initialized");
289
- let t = z(e);
289
+ let t = ve(e);
290
290
  if (!t) throw Error("Document layout variant store is not initialized");
291
291
  return t.defaultLayout;
292
292
  }
@@ -480,7 +480,7 @@ var J = class {
480
480
  let o = r === this._runsRevision ? i : new Map([...i, ...this._pageRuns]), s = [];
481
481
  for (let n = 0; n < a; n++) {
482
482
  let r = o.get(n) ?? [], i = te(r);
483
- for (let a of ae(i, e, t)) {
483
+ for (let a of oe(i, e, t)) {
484
484
  let e = a.slices.map((e) => r[e.runIndex].text.slice(e.start, e.end)).join("");
485
485
  s.push({
486
486
  page: n,
@@ -538,7 +538,7 @@ var J = class {
538
538
  this._borrowed = n !== void 0, this._mode = w("DocxViewer", t.mode, n), this._documentOwner = new g("DocxViewer", n ?? null, !1);
539
539
  let r = e.ownerDocument?.defaultView ?? (typeof window < "u" ? window : null);
540
540
  if (!r) throw Error("DocxViewer requires a canvas with an active Window");
541
- this._hostWindow = r, this._canvasMount = new E(e, {
541
+ this._hostWindow = r, this._canvasMount = new ae(e, {
542
542
  wrapperCssText: "position:relative;display:inline-block;vertical-align:top;",
543
543
  forceDisplayBlock: !0
544
544
  }), this._wrapper = this._canvasMount.wrapper, this._renderDispatcher = new S(e, this._mode === "worker"), this._errorRouter = new re("DocxViewer", t.onError);
@@ -1059,16 +1059,16 @@ var J = class {
1059
1059
  return;
1060
1060
  }
1061
1061
  if (r === this._scale) return;
1062
- let a = this._scale, o = i ? i.y : 0, s = this._range(), c = this._scrollHost.scrollTop + o, l = this._pageIndexAtOffset(s, c), u = this._heights[l] || 0, d = u > 0 ? (c - s.offsets[l]) / u : 0;
1063
- d = Math.min(1, Math.max(0, d));
1064
- let f = this._padH().left, p = this._scrollHost.scrollLeft || 0;
1062
+ let a = this._scale, o = i ? i.y : 0, s = this._range(), c = this._scrollHost.scrollTop, l = c + o, u = this._pageIndexAtOffset(s, l), d = this._heights[u] || 0, f = d > 0 ? (l - s.offsets[u]) / d : 0;
1063
+ f = Math.min(1, Math.max(0, f));
1064
+ let p = this._padH().left, m = this._scrollHost.scrollLeft || 0;
1065
1065
  this._renderEpoch++, this._scale = r, this._recomputeHeights();
1066
- let m = B(this._heights, this._gap(), 0, this._scrollHost.clientHeight, this._overscan(), this._pad());
1067
- this._spacer.style.height = `${m.totalHeight}px`, this._syncSpacerWidth();
1068
- let h = Math.max(0, m.totalHeight - this._scrollHost.clientHeight), g = (m.offsets[l] ?? 0) + d * (this._heights[l] || 0);
1069
- if (this._scrollHost.scrollTop = Math.min(h, Math.max(0, g - o)), i) {
1066
+ let h = B(this._heights, this._gap(), 0, this._scrollHost.clientHeight, this._overscan(), this._pad());
1067
+ this._spacer.style.height = `${h.totalHeight}px`, this._syncSpacerWidth();
1068
+ let g = Math.max(0, h.totalHeight - this._scrollHost.clientHeight), _ = (h.offsets[u] ?? 0) + f * (this._heights[u] || 0), v = l < (s.offsets[0] ?? 0) ? c : _ - o;
1069
+ if (this._scrollHost.scrollTop = Math.min(g, Math.max(0, v)), i) {
1070
1070
  let e = Math.max(0, (this._spacer.offsetWidth || 0) - this._scrollHost.clientWidth);
1071
- this._scrollHost.scrollLeft = ee(p, i.x - f, a, r, { maxScroll: e });
1071
+ this._scrollHost.scrollLeft = ee(m, i.x - p, a, r, { maxScroll: e });
1072
1072
  }
1073
1073
  this._previewVisible(), this._scheduleSettle(), this._opts.onScaleChange?.(r);
1074
1074
  }
package/dist/docx.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import { It as e, Lt as t, a as n, hn as r, mn as i } from "./line-metrics-BdCACYlq.js";
2
2
  import { y as a } from "./canvas-viewer-mechanics-CwVSOYke.js";
3
- import { a as o, i as s, n as c, o as l, r as u, s as d } from "./docx-DYRguRRi.js";
3
+ import { a as o, i as s, n as c, o as l, r as u, s as d } from "./docx-C6B98B4-.js";
4
4
  export { d as DocxDocument, u as DocxScrollViewer, s as DocxViewer, e as OoxmlDecodedImageLimitError, i as OoxmlError, r as OoxmlResourceLimitError, a as autoResize, o as buildDocxHighlightLayer, l as buildDocxTextLayer, t as isOoxmlDecodedImageLimitError, c as noteText, n as openExternalHyperlink };
Binary file
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./docx-DYRguRRi.js";
2
- import { t } from "./xlsx-BBmmZNQn.js";
3
- import { t as n } from "./pptx-B-EJp83T.js";
1
+ import { t as e } from "./docx-C6B98B4-.js";
2
+ import { t } from "./xlsx-EykJ9tPV.js";
3
+ import { t as n } from "./pptx-CKAk5e-J.js";
4
4
  export { e as docx, n as pptx, t as xlsx };
package/dist/node.mjs CHANGED
@@ -2,7 +2,7 @@ import { t as e } from "./chunk-DmhlhrBa.js";
2
2
  import { t } from "./slide-pull-client-WCuYCjio.js";
3
3
  import { B as n, Et as r, F as i, H as a, I as o, It as s, Lt as c, P as l, R as u, U as d, W as ee, at as f, hn as p, kt as m, ot as h, q as te, rt as g, st as ne } from "./line-metrics-BdCACYlq.js";
4
4
  import { t as re } from "./bounded-raw-part-cache-C6ro6Ezf.js";
5
- import { a as ie, c as ae, i as oe, l as se, r as ce, u as le } from "./document-pull-client-DQNen8c4.js";
5
+ import { a as ie, c as ae, i as oe, l as se, r as ce, u as le } from "./document-pull-client-B-3_7_YS.js";
6
6
  import { t as ue } from "./transfer-DCu4c2BL.js";
7
7
  import { a as de, c as fe, d as pe, l as me, o as he, r as ge, s as _e, t as ve, u as ye } from "./worksheet-pull-client-YzjJMOns.js";
8
8
  import { a as be, i as xe, n as Se, r as Ce } from "./session-B4Y54cbT.js";
@@ -1457,16 +1457,16 @@ var Ke = new URL("pptx_parser_bg.wasm", import.meta.url).href, Q = class e {
1457
1457
  return;
1458
1458
  }
1459
1459
  if (r === this._scale) return;
1460
- let a = this._scale, o = i ? i.y : 0, s = this._range(), c = this._scrollHost.scrollTop + o, l = this._slideIndexAtOffset(s, c), u = this._heights[l] || 0, d = u > 0 ? (c - s.offsets[l]) / u : 0;
1461
- d = Math.min(1, Math.max(0, d));
1462
- let f = this._padH().left, p = this._scrollHost.scrollLeft || 0;
1460
+ let a = this._scale, o = i ? i.y : 0, s = this._range(), c = this._scrollHost.scrollTop, l = c + o, u = this._slideIndexAtOffset(s, l), d = this._heights[u] || 0, f = d > 0 ? (l - s.offsets[u]) / d : 0;
1461
+ f = Math.min(1, Math.max(0, f));
1462
+ let p = this._padH().left, m = this._scrollHost.scrollLeft || 0;
1463
1463
  this._renderEpoch++, this._scale = r, this._recomputeHeights();
1464
- let m = M(this._heights, this._gap(), 0, this._scrollHost.clientHeight, this._overscan(), this._pad());
1465
- this._spacer.style.height = `${m.totalHeight}px`, this._syncSpacerWidth();
1466
- let h = Math.max(0, m.totalHeight - this._scrollHost.clientHeight), g = (m.offsets[l] ?? 0) + d * (this._heights[l] || 0);
1467
- if (this._scrollHost.scrollTop = Math.min(h, Math.max(0, g - o)), i) {
1464
+ let h = M(this._heights, this._gap(), 0, this._scrollHost.clientHeight, this._overscan(), this._pad());
1465
+ this._spacer.style.height = `${h.totalHeight}px`, this._syncSpacerWidth();
1466
+ let g = Math.max(0, h.totalHeight - this._scrollHost.clientHeight), _ = (h.offsets[u] ?? 0) + f * (this._heights[u] || 0), v = l < (s.offsets[0] ?? 0) ? c : _ - o;
1467
+ if (this._scrollHost.scrollTop = Math.min(g, Math.max(0, v)), i) {
1468
1468
  let e = Math.max(0, (this._spacer.offsetWidth || 0) - this._scrollHost.clientWidth);
1469
- this._scrollHost.scrollLeft = oe(p, i.x - f, a, r, { maxScroll: e });
1469
+ this._scrollHost.scrollLeft = oe(m, i.x - p, a, r, { maxScroll: e });
1470
1470
  }
1471
1471
  this._previewVisible(), this._scheduleSettle(), this._opts.onScaleChange?.(r);
1472
1472
  }
package/dist/pptx.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { c as e } from "./slide-pull-client-WCuYCjio.js";
2
2
  import { It as t, Lt as n, a as r, hn as i, mn as a } from "./line-metrics-BdCACYlq.js";
3
3
  import { y as o } from "./canvas-viewer-mechanics-CwVSOYke.js";
4
- import { a as s, i as c, n as l, o as u, r as d } from "./pptx-B-EJp83T.js";
4
+ import { a as s, i as c, n as l, o as u, r as d } from "./pptx-CKAk5e-J.js";
5
5
  export { t as OoxmlDecodedImageLimitError, a as OoxmlError, i as OoxmlResourceLimitError, c as PptxPresentation, l as PptxScrollViewer, d as PptxViewer, o as autoResize, s as buildPptxHighlightLayer, u as buildPptxTextLayer, n as isOoxmlDecodedImageLimitError, r as openExternalHyperlink, e as renderSlide };