@silurus/ooxml 0.82.1 → 0.83.1

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 (42) hide show
  1. package/README.md +74 -5
  2. package/dist/assets/render-worker-4GSYWsM3.js +11 -0
  3. package/dist/assets/{render-worker-Cy-QsDge.js → render-worker-DwFpY197.js} +4 -4
  4. package/dist/{canvas-viewer-mechanics-CS_qbr6T.js → canvas-viewer-mechanics-h07vpVOQ.js} +42 -2
  5. package/dist/{comment-ui-runtime-C1RV_3iu.js → comment-ui-runtime-BelHJt73.js} +2 -2
  6. package/dist/{comment-ui-runtime-DgCZpPR0.js → comment-ui-runtime-DD5a3x3k.js} +2 -2
  7. package/dist/{comments-Cf9W7r3M.js → comments-AAaNnQTi.js} +7 -2
  8. package/dist/{document-pull-client-B1WOjA0z.js → document-pull-client-DSx36ZsB.js} +4519 -3952
  9. package/dist/docx-BF-WKW73.js +2784 -0
  10. package/dist/docx.mjs +6 -6
  11. package/dist/docx_parser_bg.wasm +0 -0
  12. package/dist/dom-interaction-boundary-CepOlXt6.js +217 -0
  13. package/dist/index.mjs +4 -4
  14. package/dist/line-distribute-D7A_wnJg.js +1003 -0
  15. package/dist/{line-metrics-B3syvDn2.js → line-metrics-Bpn7OeZD.js} +616 -616
  16. package/dist/node.mjs +308 -308
  17. package/dist/pptx-CA-Q09yW.js +3010 -0
  18. package/dist/pptx.mjs +5 -5
  19. package/dist/pptx_parser_bg.wasm +0 -0
  20. package/dist/{render-BC8p7vZQ.js → render-DtbFbO5c.js} +1 -1
  21. package/dist/{render-worker-host-BNnXCtAu.js → render-worker-host-D1jcACJV.js} +1 -1
  22. package/dist/{render-worker-host-DhnkTyjj.js → render-worker-host-DCLyw6UR.js} +1 -1
  23. package/dist/{resource-measurement-CsW4_eYt.js → resource-measurement-DuiFWzam.js} +3 -3
  24. package/dist/{session-Da7LEQUB.js → session-CxT-t0BX.js} +107 -94
  25. package/dist/{slide-pull-client-Bg9DusLX.js → slide-pull-client-B9rcJdO4.js} +1190 -937
  26. package/dist/types/docx.d.ts +103 -8
  27. package/dist/types/index.d.ts +195 -13
  28. package/dist/types/node.d.ts +2 -2
  29. package/dist/types/pptx.d.ts +100 -5
  30. package/dist/types/xlsx.d.ts +2 -2
  31. package/dist/{worksheet-pull-client-CYtwXP5D.js → worksheet-pull-client-DyFsDF4A.js} +32 -32
  32. package/dist/{xlsx-DMWeXT-c.js → xlsx-BibrHQ52.js} +476 -476
  33. package/dist/xlsx.mjs +5 -5
  34. package/dist/xlsx_parser_bg.wasm +0 -0
  35. package/package.json +3 -1
  36. package/dist/assets/render-worker-aHayzR7v.js +0 -11
  37. package/dist/docx-HoZXZUPA.js +0 -2162
  38. package/dist/dom-interaction-boundary-C8F6HO5x.js +0 -119
  39. package/dist/line-distribute-iXsUCIH-.js +0 -1003
  40. package/dist/pptx-DEUP4Yq5.js +0 -2432
  41. /package/dist/{comment-occurrence-C34fWs_F.js → comment-occurrence-X54si2ob.js} +0 -0
  42. /package/dist/{highlight-rect-MaCt0om0.js → highlight-rect-Hes0z_Mj.js} +0 -0
package/dist/docx.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { Jt as e, Yt as t, a as n } from "./line-metrics-B3syvDn2.js";
2
- import { w as r } from "./canvas-viewer-mechanics-CS_qbr6T.js";
3
- import { a as i, c as a, i as o, l as s, n as c, o as l, r as u, s as d } from "./docx-HoZXZUPA.js";
4
- import { cn as f, ln as p } from "./plot-area-frame-DHV02PJU.js";
5
- import { n as m, r as h } from "./comments-Cf9W7r3M.js";
6
- export { a as DocxDocument, u as DocxScrollViewer, o as DocxViewer, f as OoxmlDecodedImageLimitError, e as OoxmlError, t as OoxmlResourceLimitError, r as autoResize, l as buildDocxHighlightLayer, d as buildDocxTextLayer, p as isOoxmlDecodedImageLimitError, c as noteText, n as openExternalHyperlink, i as readDocxTextSelectionContext, m as resolveCommentAnchorRuns, h as resolveDocxCommentThreads, s as resolveRevisionAnchorRuns };
1
+ import { Qt as e, Zt as t, a as n } from "./line-metrics-Bpn7OeZD.js";
2
+ import { w as r } from "./canvas-viewer-mechanics-h07vpVOQ.js";
3
+ import { cn as i, ln as a } from "./plot-area-frame-DHV02PJU.js";
4
+ import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p } from "./docx-BF-WKW73.js";
5
+ import { n as m, r as h } from "./comments-AAaNnQTi.js";
6
+ export { s as DocxDocument, f as DocxScrollViewer, c as DocxViewer, i as OoxmlDecodedImageLimitError, t as OoxmlError, e as OoxmlResourceLimitError, r as autoResize, d as buildDocxHighlightLayer, p as buildDocxTextLayer, a as isOoxmlDecodedImageLimitError, u as noteText, n as openExternalHyperlink, o as readDocxTextSelectionContext, m as resolveCommentAnchorRuns, h as resolveDocxCommentThreads, l as resolveRevisionAnchorRuns };
Binary file
@@ -0,0 +1,217 @@
1
+ import { Lt as e } from "./line-metrics-Bpn7OeZD.js";
2
+ import { c as t, o as n, r, s as i } from "./bounded-raw-part-cache-C6ro6Ezf.js";
3
+ //#region packages/core/src/fonts/embedded.ts
4
+ function a(e, t) {
5
+ let n = o(t), r = e.slice(), i = Math.min(32, r.length);
6
+ for (let e = 0; e < i; e++) r[e] ^= n[e % 16];
7
+ return r;
8
+ }
9
+ function o(e) {
10
+ let t = e.replace(/[{}\-\s]/g, "");
11
+ if (t.length !== 32 || /[^0-9a-fA-F]/.test(t)) throw Error(`invalid fontKey GUID: ${e}`);
12
+ let n = new Uint8Array(16);
13
+ for (let e = 0; e < 16; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
14
+ return n.reverse();
15
+ }
16
+ function s(e, t, n, r) {
17
+ let i = 2166136261;
18
+ for (let e = 0; e < r.length; e++) i ^= r[e], i = Math.imul(i, 16777619);
19
+ return `${e}|${t}|${n}|${r.length}|${(i >>> 0).toString(16)}`;
20
+ }
21
+ async function c(o, c = e) {
22
+ let l = r();
23
+ if (!l || typeof FontFace > "u") return [];
24
+ let u = [], d = /* @__PURE__ */ new Set(), f = [];
25
+ for (let e of o) try {
26
+ if (e.bytes.length === 0 || e.bytes.length > c) {
27
+ f.push(e.family);
28
+ continue;
29
+ }
30
+ let n = e.odttf ? a(e.bytes, e.fontKey ?? "") : e.bytes, r = `embedded:${s(e.family, e.weight, e.style, n)}`;
31
+ if (d.has(r)) continue;
32
+ d.add(r);
33
+ let { face: i } = t(r, l, () => {
34
+ let t = n.buffer.slice(n.byteOffset, n.byteOffset + n.byteLength), r = new FontFace(e.family, t, {
35
+ weight: e.weight,
36
+ style: e.style
37
+ });
38
+ return l.add(r), r;
39
+ });
40
+ u.push(i);
41
+ } catch {
42
+ f.push(e.family);
43
+ }
44
+ let p = u;
45
+ if (u.length > 0) {
46
+ let e = await n(Promise.allSettled(u.map((e) => Promise.resolve().then(() => e.load()))));
47
+ Array.isArray(e) ? (p = [], e.forEach((e, t) => {
48
+ let n = u[t];
49
+ e.status === "fulfilled" ? p.push(n) : (f.push(n.family), i([n]));
50
+ }), await n(l.ready)) : (f.push(...u.map((e) => e.family)), i(u), p = []);
51
+ }
52
+ return f.length > 0 && console.warn(`[ooxml] failed to register embedded font(s): ${[...new Set(f)].join(", ")}; falling back to substitute fonts (text may shift or differ).`), p;
53
+ }
54
+ function l(e) {
55
+ i(e);
56
+ }
57
+ //#endregion
58
+ //#region packages/core/src/layout/virtual-scroll.ts
59
+ function u(e, t, n) {
60
+ return e < t ? t : e > n ? n : e;
61
+ }
62
+ function d(e, t, n) {
63
+ let r = e.length;
64
+ if (r === 0) return {
65
+ offsets: [],
66
+ totalHeight: 0
67
+ };
68
+ let i = n?.leading ?? 0, a = n?.trailing ?? 0, o = Array(r), s = 0;
69
+ for (let n = 0; n < r; n++) o[n] = i + s + n * t, s += e[n];
70
+ return {
71
+ offsets: o,
72
+ totalHeight: i + s + (r - 1) * t + a
73
+ };
74
+ }
75
+ function f(e, t, n, r) {
76
+ let i = e.offsets, a = i.length;
77
+ if (a === 0) return {
78
+ start: 0,
79
+ end: -1,
80
+ topIndex: 0,
81
+ offsets: i,
82
+ totalHeight: 0
83
+ };
84
+ let o = 0, s = a;
85
+ for (; o < s;) {
86
+ let e = o + s >>> 1;
87
+ i[e] <= t ? o = e + 1 : s = e;
88
+ }
89
+ let c = u(o - 1, 0, a - 1), l = t + n;
90
+ for (o = 0, s = a; o < s;) {
91
+ let e = o + s >>> 1;
92
+ i[e] < l ? o = e + 1 : s = e;
93
+ }
94
+ let d = u(o - 1, 0, a - 1);
95
+ return {
96
+ start: u(c - r, 0, a - 1),
97
+ end: u(d + r, 0, a - 1),
98
+ topIndex: c,
99
+ offsets: i,
100
+ totalHeight: e.totalHeight
101
+ };
102
+ }
103
+ function p(e, t, n, r, i, a, o) {
104
+ if (e === 0) return {
105
+ start: 0,
106
+ end: -1,
107
+ topIndex: 0,
108
+ totalHeight: 0
109
+ };
110
+ let s = o?.leading ?? 0, c = o?.trailing ?? 0, l = t + n, d = u(r < s ? 0 : l > 0 ? Math.floor((r - s) / l) : e - 1, 0, e - 1), f = r + i, p = u(f <= s ? 0 : l > 0 ? Math.ceil((f - s) / l) - 1 : e - 1, 0, e - 1);
111
+ return {
112
+ start: u(d - a, 0, e - 1),
113
+ end: u(p + a, 0, e - 1),
114
+ topIndex: d,
115
+ totalHeight: s + e * t + (e - 1) * n + c
116
+ };
117
+ }
118
+ //#endregion
119
+ //#region packages/core/src/internal/progressive-layout-lifecycle.ts
120
+ var m = class {
121
+ state = Object.freeze({ status: "complete" });
122
+ get complete() {
123
+ return this.state.status === "complete";
124
+ }
125
+ get settled() {
126
+ return this.state.status !== "pending";
127
+ }
128
+ begin() {
129
+ this.state = Object.freeze({ status: "pending" });
130
+ }
131
+ succeed() {
132
+ this.state = Object.freeze({ status: "complete" });
133
+ }
134
+ fail(e) {
135
+ let t = e instanceof Error ? e : Error(String(e));
136
+ return this.state = Object.freeze({
137
+ status: "failed",
138
+ error: t
139
+ }), t;
140
+ }
141
+ throwIfFailed() {
142
+ if (this.state.status === "failed") throw this.state.error;
143
+ }
144
+ }, h = class {
145
+ failed = /* @__PURE__ */ new WeakMap();
146
+ notify(e, t, ...n) {
147
+ if (!(!t || this.failed.get(t)?.has(e))) try {
148
+ let r = t(...n);
149
+ r && typeof r.then == "function" && Promise.resolve(r).catch((n) => this.reportOnce(e, t, n));
150
+ } catch (n) {
151
+ this.reportOnce(e, t, n);
152
+ }
153
+ }
154
+ reportOnce(e, t, n) {
155
+ let r = this.failed.get(t) ?? /* @__PURE__ */ new Set();
156
+ if (r.has(e)) return;
157
+ r.add(e), this.failed.has(t) || this.failed.set(t, r);
158
+ let i = n instanceof Error ? n : Error(String(n));
159
+ console.error(`[ooxml] ${e} callback failed and was disabled:`, i);
160
+ }
161
+ }, g = 65536;
162
+ function _(e, t) {
163
+ let n = Math.min(e.length, t);
164
+ if (n > 0 && n < e.length) {
165
+ let t = e.charCodeAt(n - 1), r = e.charCodeAt(n);
166
+ t >= 55296 && t <= 56319 && r >= 56320 && r <= 57343 && n--;
167
+ }
168
+ return e.slice(0, n);
169
+ }
170
+ function v(e) {
171
+ if (e !== void 0 && (!Number.isFinite(e) || e < 0)) throw RangeError("maxTextCharacters must be a finite non-negative number.");
172
+ return Math.min(g, Math.floor(e ?? 65536));
173
+ }
174
+ function y(e, t, n) {
175
+ let r = v(n), i = 0, a = !1, o = (e) => {
176
+ let t = _(e.text, Math.max(0, r - i));
177
+ return i += t.length, t.length < e.text.length && (a = !0), {
178
+ ...e,
179
+ text: t
180
+ };
181
+ }, s = Object.freeze({
182
+ root: Object.freeze(o(e)),
183
+ replies: Object.freeze(t.map((e) => Object.freeze(o(e))))
184
+ });
185
+ return Object.freeze({
186
+ thread: s,
187
+ truncated: a,
188
+ textCharacters: i,
189
+ maxTextCharacters: r
190
+ });
191
+ }
192
+ //#endregion
193
+ //#region packages/core/src/internal/dom-interaction-boundary.ts
194
+ function b(e, t) {
195
+ return e.dataset?.[t] !== void 0;
196
+ }
197
+ function x(e, t, n) {
198
+ let r = typeof e.composedPath == "function" ? e.composedPath() : [];
199
+ if (r.length > 0) {
200
+ let e = !1;
201
+ for (let i of r) {
202
+ if (i === t) return e;
203
+ b(i, n) && (e = !0);
204
+ }
205
+ }
206
+ let i = e.target;
207
+ if (!i || !t.contains(i)) return !1;
208
+ let a = i;
209
+ for (; a;) {
210
+ if (b(a, n)) return !0;
211
+ if (a === t) break;
212
+ a = a.parentElement;
213
+ }
214
+ return !1;
215
+ }
216
+ //#endregion
217
+ export { p as a, c, m as i, l, y as n, f as o, h as r, d as s, x as t };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./docx-HoZXZUPA.js";
2
- import { t } from "./xlsx-DMWeXT-c.js";
3
- import { t as n } from "./pptx-DEUP4Yq5.js";
4
- export { e as docx, n as pptx, t as xlsx };
1
+ import { t as e } from "./xlsx-BibrHQ52.js";
2
+ import { t } from "./pptx-CA-Q09yW.js";
3
+ import { t as n } from "./docx-BF-WKW73.js";
4
+ export { n as docx, t as pptx, e as xlsx };