@silurus/ooxml 0.88.0 → 0.89.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 (127) hide show
  1. package/README.md +118 -23
  2. package/THIRD_PARTY_NOTICES.md +8 -7
  3. package/dist/abort-VrnK7mdP.js +10 -0
  4. package/dist/assets/render-worker-C5G_Nr_A.js +35 -0
  5. package/dist/assets/render-worker-DQfWdNsm.js +16 -0
  6. package/dist/assets/render-worker-Ds7LjwU-.js +15 -0
  7. package/dist/{hyperlink-Cxzhet30.js → bounded-raw-part-cache-CsnNptAy.js} +4937 -7458
  8. package/dist/bundled-asset-url-E2nXURF9.js +15 -0
  9. package/dist/canvas-viewer-mechanics-BZ8QCrRi.js +675 -0
  10. package/dist/cfb-guard-dNeUiANF.js +528 -0
  11. package/dist/chart-ex.mjs +667 -663
  12. package/dist/comment-overlay-controller-CBvQx-En.js +994 -0
  13. package/dist/comment-ui-runtime-B7ZvovcS.js +2 -0
  14. package/dist/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-BKidRH36.js} +5 -5
  15. package/dist/{comment-ui-runtime-CWGqn5Vr.js → comment-ui-runtime-C47QoDUy.js} +5 -5
  16. package/dist/delimited-text-worker-host-CikWU6_m.js +27 -0
  17. package/dist/document-model-source-MzFPrxt0.js +249 -0
  18. package/dist/document-pull-client-BoJeuURD.js +35941 -0
  19. package/dist/document-pull-worker-CaP8XESP.js +104 -0
  20. package/dist/docx-BN70UhvX.js +495 -0
  21. package/dist/docx-BRRtSvk3.js +3563 -0
  22. package/dist/docx-model-source-CTO9iw_W.js +98 -0
  23. package/dist/docx-source-worker.mjs +455 -0
  24. package/dist/docx.mjs +7 -7
  25. package/dist/docx_parser_bg.wasm +0 -0
  26. package/dist/drawingml-shape-CHmq8kpM.js +310 -0
  27. package/dist/duotone-DN8P4aXe.js +126 -0
  28. package/dist/emf-CGFQIz6c.js +1790 -0
  29. package/dist/font-preload-demand-Dmy31xt-.js +2058 -0
  30. package/dist/grid-geometry-C3IG20ut.js +384 -0
  31. package/dist/host-layout-DVMw8hDY.js +56 -0
  32. package/dist/host-layout-measure-DsuQ2UJs.js +7 -0
  33. package/dist/in-process-pull-transport-DuXcPZng.js +29 -0
  34. package/dist/index.mjs +4 -4
  35. package/dist/internal-companion.mjs +12 -0
  36. package/dist/line-distribute-Bu8psjGd.js +2799 -0
  37. package/dist/math.mjs +2 -2
  38. package/dist/mathjax-stix2.js +10 -10
  39. package/dist/model-source-kz_NkZqT.js +179 -0
  40. package/dist/model-source-s5hRpk4w.js +61 -0
  41. package/dist/model-source-session-6fuaqbGs.js +71 -0
  42. package/dist/model-source-session-DqrR4XHR.js +85 -0
  43. package/dist/model-source-session-cPJSF_Ak.js +58 -0
  44. package/dist/node.mjs +7 -1327
  45. package/dist/{pixel-budget-9P63Bsk5.js → pixel-budget-BpTYrepD.js} +13 -10
  46. package/dist/plot-area-frame-Bs_j4uu7.js +41811 -0
  47. package/dist/pptx-CaJ6ILnw.js +183 -0
  48. package/dist/pptx-_BOGcBym.js +2936 -0
  49. package/dist/pptx-model-source-B_9afw9R.js +37 -0
  50. package/dist/pptx-source-worker.mjs +446 -0
  51. package/dist/pptx.mjs +8 -7
  52. package/dist/pptx_parser_bg.wasm +0 -0
  53. package/dist/presentation-model-source-CGHLyX32.js +77 -0
  54. package/dist/raster-target-YQ4G6rxo.js +42 -0
  55. package/dist/region-map.mjs +117 -153
  56. package/dist/{render-D3iqVKCo.js → render-CzbDzRKa.js} +3 -3
  57. package/dist/{render-worker-host-B5wQfB7U.js → render-worker-host-B1u6BOUd.js} +1 -1
  58. package/dist/{render-worker-host-D4123J27.js → render-worker-host-C-EECo68.js} +1 -1
  59. package/dist/{render-worker-host-Di3LxLc0.js → render-worker-host-DDqZTCVf.js} +1 -1
  60. package/dist/renderer-CD2cvVAF.js +5823 -0
  61. package/dist/renderer-DRoeb14O.js +5170 -0
  62. package/dist/resource-measurement-Dhhm7P_l.js +772 -0
  63. package/dist/session-XPmC0CUd.js +656 -0
  64. package/dist/slide-pull-client-tq7U_fYg.js +6485 -0
  65. package/dist/three-d-BKwNPAP4.js +878 -0
  66. package/dist/three-d.mjs +925 -910
  67. package/dist/{raster-target-ojDdQizC.js → tiff-contract-C6M3QcPp.js} +1 -42
  68. package/dist/tiff.mjs +401 -248
  69. package/dist/types/chart-ex.d.ts +149 -2
  70. package/dist/types/docx.d.ts +333 -96
  71. package/dist/types/index.d.ts +566 -301
  72. package/dist/types/internal-companion.d.ts +11 -0
  73. package/dist/types/math.d.ts +1 -1
  74. package/dist/types/node.d.ts +422 -9
  75. package/dist/types/pptx.d.ts +302 -95
  76. package/dist/types/region-map.d.ts +149 -2
  77. package/dist/types/three-d.d.ts +149 -2
  78. package/dist/types/tiff.d.ts +1 -1
  79. package/dist/types/xlsx.d.ts +343 -132
  80. package/dist/wasm-loader-rlgHmcSv.js +35 -0
  81. package/dist/wasm-runtime-generation-D6TKZdNb.js +97 -0
  82. package/dist/workbook-model-source-BIGrfZy6.js +94 -0
  83. package/dist/worker-source-DrwhR9fw.js +22 -0
  84. package/dist/worker-source-SbudzjYL.js +22 -0
  85. package/dist/worker-source-UAi3GNcM.js +22 -0
  86. package/dist/worksheet-pull-client-ClvPO_Jf.js +579 -0
  87. package/dist/xlsx-CsmREBaZ.js +5819 -0
  88. package/dist/xlsx-DmHfeNNp.js +534 -0
  89. package/dist/xlsx-model-source-D1flORqy.js +309 -0
  90. package/dist/xlsx-source-worker.mjs +525 -0
  91. package/dist/xlsx.mjs +8 -7
  92. package/dist/xlsx_parser_bg.wasm +0 -0
  93. package/package.json +42 -16
  94. package/dist/assets/render-worker-1uPAxMZr.js +0 -31
  95. package/dist/assets/render-worker-BlvJybji.js +0 -10
  96. package/dist/assets/render-worker-CzmiJfFL.js +0 -11
  97. package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
  98. package/dist/canvas-viewer-mechanics-DbLz0rYW.js +0 -1384
  99. package/dist/cjk-fallback-bLI3z70h.js +0 -46
  100. package/dist/comment-occurrence-C8Y2uoVr.js +0 -6
  101. package/dist/comment-ui-runtime-BsK8pmUT.js +0 -2
  102. package/dist/comments-Diid5ujN.js +0 -246
  103. package/dist/delimited-text-worker-host-BVY-Ecni.js +0 -27
  104. package/dist/document-pull-client-B9PTM-pL.js +0 -27280
  105. package/dist/docx-BF9WXrYH.js +0 -3103
  106. package/dist/dom-interaction-boundary-Cnm8DSBN.js +0 -223
  107. package/dist/highlight-rect-C5hkRqUr.js +0 -13
  108. package/dist/line-distribute-D1WNHKz_.js +0 -1023
  109. package/dist/line-metrics-B60C86uh.js +0 -60
  110. package/dist/plot-area-frame-DLTYKHNP.js +0 -4354
  111. package/dist/pptx-DkyYBYoL.js +0 -3065
  112. package/dist/renderer-B4GZb5We.js +0 -6492
  113. package/dist/resource-measurement-SHQCbkh2.js +0 -150
  114. package/dist/session-BGq81gRQ.js +0 -743
  115. package/dist/slide-pull-client-DiPnm240.js +0 -6253
  116. package/dist/source-key-DIJG8BA0.js +0 -42
  117. package/dist/three-d-DJBl8g8M.js +0 -1162
  118. package/dist/transfer-p6iCC2R7.js +0 -6
  119. package/dist/units-BzZ0gAxs.js +0 -4
  120. package/dist/worksheet-pull-client-BM8ywvbu.js +0 -458
  121. package/dist/xlsx-C9NVjgaV.js +0 -8484
  122. /package/dist/{chunk-DmhlhrBa.js → chunk-Dy4uBu1J.js} +0 -0
  123. /package/dist/{mathjax-DoyWZbSp.js → mathjax-BhwN6ilc.js} +0 -0
  124. /package/dist/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-PidH0wnP.js} +0 -0
  125. /package/dist/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-B52rDVKo.js} +0 -0
  126. /package/dist/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-CWM7jv6d.js} +0 -0
  127. /package/dist/{visible-index-BgiHEc1z.js → visible-index-FeVA0mGE.js} +0 -0
@@ -0,0 +1,525 @@
1
+ //#region packages/core/src/internal/abort.ts
2
+ function e(e) {
3
+ let t = Error(e);
4
+ return t.name = "AbortError", t;
5
+ }
6
+ function t(t, n) {
7
+ if (t?.aborted) throw e(n);
8
+ }
9
+ //#endregion
10
+ //#region packages/core/src/source/model-source.ts
11
+ var n = "model source load was aborted", r = "ooxml-model-source-module/v2", i = new Set([
12
+ "docx",
13
+ "xlsx",
14
+ "pptx"
15
+ ]), a = new Set([
16
+ "http:",
17
+ "https:",
18
+ "file:",
19
+ "blob:"
20
+ ]), o = [
21
+ "protocol",
22
+ "target",
23
+ "moduleUrl",
24
+ "config"
25
+ ], s = 8192, c = 32, l = 8192, u = 16, d = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
26
+ function f(e) {
27
+ if (!(e instanceof Uint8Array)) throw TypeError("model source archive must return Uint8Array bytes");
28
+ let t = new Uint8Array(e.byteLength);
29
+ return t.set(e), t.buffer;
30
+ }
31
+ function p(e, t) {
32
+ if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("model source module descriptor must be an object");
33
+ let n = Reflect.ownKeys(e);
34
+ if (n.length !== o.length || o.some((e) => !n.includes(e))) throw TypeError("model source module descriptor has unknown or missing fields");
35
+ let c = Object.getOwnPropertyDescriptors(e);
36
+ if (o.some((e) => !c[e]?.enumerable || !("value" in c[e]))) throw TypeError("model source module descriptor fields must be data properties");
37
+ let l = c.protocol.value, u = c.target.value, d = c.moduleUrl.value;
38
+ if (l !== "ooxml-model-source-module/v2") throw TypeError("unsupported model source module protocol");
39
+ if (typeof u != "string" || !i.has(u)) throw TypeError("unsupported model source target");
40
+ if (t !== void 0 && u !== t) throw TypeError(`a ${u} model source module cannot load ${t} input`);
41
+ if (typeof d != "string" || d.length === 0 || d.length > s || d.trim() !== d) throw TypeError("model source moduleUrl must be a nonempty absolute URL");
42
+ let f;
43
+ try {
44
+ f = new URL(d);
45
+ } catch {
46
+ throw TypeError("model source moduleUrl must be a nonempty absolute URL");
47
+ }
48
+ if (!a.has(f.protocol)) throw TypeError("model source moduleUrl protocol is unsupported");
49
+ return Object.freeze({
50
+ protocol: r,
51
+ target: u,
52
+ moduleUrl: d,
53
+ config: m(c.config.value)
54
+ });
55
+ }
56
+ function m(e) {
57
+ if (!b(e)) throw TypeError("model source config must be a plain object");
58
+ let t = Reflect.ownKeys(e);
59
+ if (t.length > c) throw RangeError(`model source config accepts at most ${c} entries`);
60
+ let n = {};
61
+ for (let r of t) {
62
+ if (typeof r != "string" || !d.test(r)) throw TypeError("model source config keys must be short identifiers");
63
+ let t = Object.getOwnPropertyDescriptor(e, r);
64
+ if (!t?.enumerable || !("value" in t)) throw TypeError("model source config entries must be data properties");
65
+ let i = t.value;
66
+ if (typeof i == "string") {
67
+ if (i.length > l) throw RangeError("model source config string is too long");
68
+ } else if (typeof i == "number") {
69
+ if (!Number.isFinite(i)) throw TypeError("model source config numbers must be finite");
70
+ } else if (typeof i != "boolean" && i !== null) throw TypeError("model source config values must be strings, numbers, booleans or null");
71
+ n[r] = i;
72
+ }
73
+ return Object.freeze(n);
74
+ }
75
+ async function h(e, r, i, a, o = []) {
76
+ let s = p(e);
77
+ t(a, n);
78
+ let c = await import(
79
+ /* @vite-ignore */
80
+ s.moduleUrl
81
+ ), l = typeof c == "object" && c ? c.openModelSource : void 0;
82
+ if (typeof l != "function") throw TypeError("model source module must export openModelSource()");
83
+ t(a, n);
84
+ let u = await l(r, s.config, a, o);
85
+ if (typeof u != "object" || !u) throw TypeError("openModelSource() must return an object");
86
+ let d = u, f = d.close;
87
+ if (typeof f != "function") throw TypeError("an opened model source must provide close()");
88
+ let m = !1, h = () => {
89
+ m || (m = !0, f.call(u));
90
+ };
91
+ try {
92
+ let e = i(d.archive), r = g(d.viewDefaults);
93
+ return t(a, n), Object.freeze({
94
+ archive: e,
95
+ viewDefaults: r,
96
+ close: h
97
+ });
98
+ } catch (e) {
99
+ try {
100
+ h();
101
+ } catch {}
102
+ throw e;
103
+ }
104
+ }
105
+ function g(e) {
106
+ if (e === void 0) return Object.freeze({});
107
+ if (!b(e)) throw TypeError("model source viewDefaults must be a plain object");
108
+ let t = Reflect.ownKeys(e);
109
+ if (t.length > u) throw RangeError("model source viewDefaults has too many entries");
110
+ let n = {};
111
+ for (let r of t) {
112
+ let t = typeof r == "string" ? Object.getOwnPropertyDescriptor(e, r) : void 0;
113
+ if (typeof r != "string" || !d.test(r) || !t?.enumerable || !("value" in t) || typeof t.value != "boolean") throw TypeError("model source viewDefaults entries must be boolean data properties");
114
+ n[r] = t.value;
115
+ }
116
+ return Object.freeze(n);
117
+ }
118
+ function _(e, t, n) {
119
+ if (typeof e != "object" && typeof e != "function" || e === null) throw TypeError(`${t} model source archive must be an object`);
120
+ for (let r of n) if (typeof e[r] != "function") throw TypeError(`${t} model source archive must implement ${r}()`);
121
+ }
122
+ function v(e, t) {
123
+ return (typeof e == "object" || typeof e == "function") && e !== null && typeof e[t] == "function";
124
+ }
125
+ function y(e) {
126
+ return /* @__PURE__ */ Error(`${e} is unsupported for this source`);
127
+ }
128
+ function b(e) {
129
+ if (typeof e != "object" || !e || Array.isArray(e)) return !1;
130
+ let t = Object.getPrototypeOf(e);
131
+ return t === Object.prototype || t === null;
132
+ }
133
+ //#endregion
134
+ //#region packages/core/src/errors/ooxml-error.ts
135
+ var x = class e extends Error {
136
+ code = "ooxml-resource-limit";
137
+ details;
138
+ constructor(t, n) {
139
+ super(t), this.name = "OoxmlResourceLimitError";
140
+ let r = n.violation, i = Object.freeze({
141
+ format: r.format,
142
+ operation: r.operation,
143
+ resource: r.resource,
144
+ metric: r.metric,
145
+ ...r.part === void 0 ? {} : { part: r.part },
146
+ limit: r.limit,
147
+ observed: r.observed,
148
+ configurable: r.configurable,
149
+ usage: Object.freeze({
150
+ archiveEntryCount: r.usage.archiveEntryCount,
151
+ declaredInflatedBytes: r.usage.declaredInflatedBytes,
152
+ ...r.usage.largestInflatedEntryBytes === void 0 ? {} : { largestInflatedEntryBytes: r.usage.largestInflatedEntryBytes },
153
+ distinctInflatedBytes: r.usage.distinctInflatedBytes,
154
+ operationInflatedBytes: r.usage.operationInflatedBytes
155
+ })
156
+ });
157
+ this.details = Object.freeze({
158
+ stage: n.stage,
159
+ violation: i
160
+ }), Object.setPrototypeOf(this, e.prototype);
161
+ }
162
+ }, S = "OOXML_RESOURCE_LIMIT:", C = 128, ee = 256, w = 4096;
163
+ function T(e) {
164
+ return typeof e == "number" && Number.isSafeInteger(e) && e >= 0;
165
+ }
166
+ function E(e) {
167
+ if (!e || typeof e != "object" || Array.isArray(e)) return !1;
168
+ let t = e;
169
+ return T(t.archiveEntryCount) && T(t.declaredInflatedBytes) && (t.largestInflatedEntryBytes === void 0 || T(t.largestInflatedEntryBytes)) && T(t.distinctInflatedBytes) && T(t.operationInflatedBytes);
170
+ }
171
+ function D(e) {
172
+ return e === "docx" || e === "xlsx" || e === "pptx";
173
+ }
174
+ function O(e) {
175
+ return e === "container" || e === "decompression" || e === "parsing" || e === "serialization" || e === "layout" || e === "rendering" || e === "worker";
176
+ }
177
+ function k(e, t) {
178
+ return typeof e == "string" && e.length > 0 && e.length <= t && !/[\u0000-\u001f\u007f]/u.test(e);
179
+ }
180
+ function A(e) {
181
+ return k(e, C) && /^[a-z0-9][a-z0-9-]*$/u.test(e);
182
+ }
183
+ function j(e) {
184
+ return !k(e, w) || e.startsWith("/") || e.startsWith("\\") || e.includes("\\") || e.includes("?") || e.includes("#") || e.includes("://") || /^[a-z]:/iu.test(e) ? !1 : e.split("/").every((e) => e !== "" && e !== "." && e !== "..");
185
+ }
186
+ var M = new Map([
187
+ ["archive-entry:declared-inflated-bytes", {
188
+ stage: "container",
189
+ part: "required"
190
+ }],
191
+ ["archive-entry:actual-inflated-bytes", {
192
+ stage: "decompression",
193
+ part: "required"
194
+ }],
195
+ ["archive:entry-count", {
196
+ stage: "container",
197
+ part: "forbidden"
198
+ }],
199
+ ["archive:central-directory-bytes", {
200
+ stage: "container",
201
+ part: "forbidden",
202
+ configurable: !1
203
+ }],
204
+ ["archive:distinct-inflated-bytes", {
205
+ stage: "decompression",
206
+ part: "required"
207
+ }],
208
+ ["xml-event:bytes", {
209
+ stage: "parsing",
210
+ part: "optional",
211
+ configurable: !1
212
+ }],
213
+ ["xml-context:bytes", {
214
+ stage: "parsing",
215
+ part: "optional",
216
+ configurable: !1
217
+ }],
218
+ ["image-effect:work", {
219
+ stage: "parsing",
220
+ part: "forbidden",
221
+ configurable: !1
222
+ }],
223
+ ["chartex-allocation:elements", {
224
+ stage: "parsing",
225
+ part: "forbidden",
226
+ configurable: !1
227
+ }],
228
+ ["chartex-allocation:bytes", {
229
+ stage: "parsing",
230
+ part: "forbidden",
231
+ configurable: !1
232
+ }],
233
+ ["chart-cache:points", {
234
+ stage: "parsing",
235
+ part: "forbidden",
236
+ configurable: !1
237
+ }],
238
+ ["numbering-marker:bytes", {
239
+ stage: "parsing",
240
+ part: "forbidden",
241
+ configurable: !1
242
+ }],
243
+ ["chart-style-formats:entries", {
244
+ stage: "parsing",
245
+ part: "required",
246
+ configurable: !1
247
+ }],
248
+ ["chart-custom-number-formats:entries", {
249
+ stage: "parsing",
250
+ part: "required",
251
+ configurable: !1
252
+ }],
253
+ ["chart-number-format-bytes:bytes", {
254
+ stage: "parsing",
255
+ part: "required",
256
+ configurable: !1
257
+ }],
258
+ ["xml-tree:depth", {
259
+ stage: "parsing",
260
+ part: "optional",
261
+ configurable: !1
262
+ }],
263
+ ["worksheet-row:projected-bytes", {
264
+ stage: "parsing",
265
+ part: "optional",
266
+ configurable: !1
267
+ }],
268
+ ["worksheet-shell:projected-bytes", {
269
+ stage: "parsing",
270
+ part: "optional",
271
+ configurable: !1
272
+ }],
273
+ ["theme-style-reparse:bytes", {
274
+ stage: "parsing",
275
+ part: "forbidden",
276
+ configurable: !1
277
+ }],
278
+ ["style-inheritance:depth", {
279
+ stage: "parsing",
280
+ part: "required",
281
+ configurable: !1
282
+ }],
283
+ ["complex-field:depth", {
284
+ stage: "parsing",
285
+ part: "forbidden",
286
+ configurable: !1
287
+ }]
288
+ ]), N = new Set([...M.keys()].map((e) => e.slice(0, e.indexOf(":")))), P = new Set([...M.keys()].map((e) => e.slice(e.indexOf(":") + 1)));
289
+ function F(e) {
290
+ if (!e || typeof e != "object" || Array.isArray(e)) return !1;
291
+ let t = e;
292
+ return !D(t.format) || !k(t.operation, ee) || !A(t.resource) || !A(t.metric) || !T(t.limit) || !T(t.observed) || typeof t.configurable != "boolean" || !E(t.usage) ? !1 : !("part" in t) || j(t.part);
293
+ }
294
+ function I(e) {
295
+ if (!e || typeof e != "object" || Array.isArray(e)) return !1;
296
+ let t = e;
297
+ if (!O(t.stage) || !F(t.violation)) return !1;
298
+ let n = t.violation, r = M.get(`${n.resource}:${n.metric}`);
299
+ return r ? t.stage !== r.stage || r.configurable === !1 && n.configurable !== !1 ? !1 : r.part === "required" ? n.part !== void 0 : r.part === "forbidden" ? n.part === void 0 : !0 : !(N.has(n.resource) && P.has(n.metric));
300
+ }
301
+ function L(e) {
302
+ let t = e.violation;
303
+ return `OOXML resource limit exceeded${t.part ? ` for ${t.part}` : ""} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`;
304
+ }
305
+ function R(e) {
306
+ let t = e instanceof Error ? e.message : String(e);
307
+ if (!t.startsWith(S)) return;
308
+ let n;
309
+ try {
310
+ n = JSON.parse(t.slice(21));
311
+ } catch {
312
+ return;
313
+ }
314
+ if (!n || typeof n != "object") return;
315
+ let r = n;
316
+ if (!(r.code !== "ooxml-resource-limit" || !I(r.details))) return new x(L(r.details), r.details);
317
+ }
318
+ function z(e) {
319
+ try {
320
+ return e();
321
+ } catch (e) {
322
+ throw e instanceof x || typeof e != "string" && !(e instanceof Error) ? e : R(e) ?? e;
323
+ }
324
+ }
325
+ //#endregion
326
+ //#region packages/core/src/worker/wasm-guard.ts
327
+ function te(e) {
328
+ let t = globalThis.WebAssembly?.RuntimeError;
329
+ return t && e instanceof t || e instanceof RangeError ? !0 : e instanceof Error ? e.name === "RuntimeError" || e.name === "CompileError" || e.name === "LinkError" || e.name === "InternalError" || e.name === "OOMError" : !1;
330
+ }
331
+ //#endregion
332
+ //#region packages/core/src/source/worker-model-source.ts
333
+ function B(e, t) {
334
+ return new Proxy(e, { get(e, n) {
335
+ if (n === t) return (...n) => new Uint8Array(f(Reflect.apply(e[t], e, n)));
336
+ let r = Reflect.get(e, n);
337
+ return typeof r == "function" ? r.bind(e) : r;
338
+ } });
339
+ }
340
+ function V(e, t) {
341
+ try {
342
+ return z(e);
343
+ } catch (e) {
344
+ if (te(e)) try {
345
+ t();
346
+ } catch {}
347
+ throw e;
348
+ }
349
+ }
350
+ //#endregion
351
+ //#region packages/xlsx/src/internal/host-layout.ts
352
+ var H = "xlsx-host-layout-request", U = 4096, W = 255, G = 65535 / 20, K = 4096;
353
+ function q(e) {
354
+ if (!(e instanceof Uint8Array) || e.byteLength > U) throw RangeError("XLSX host layout request byte budget exceeded");
355
+ let t;
356
+ try {
357
+ t = JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(e));
358
+ } catch {
359
+ throw TypeError("invalid XLSX host layout request");
360
+ }
361
+ return t === null ? null : J(t);
362
+ }
363
+ function J(e) {
364
+ if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("invalid XLSX host layout font");
365
+ let t = Object.keys(e), n = [
366
+ "family",
367
+ "sizePt",
368
+ "bold",
369
+ "italic"
370
+ ];
371
+ if (t.length !== n.length || !n.every((t) => Object.hasOwn(e, t))) throw TypeError("invalid XLSX host layout font");
372
+ let { family: r, sizePt: i, bold: a, italic: o } = e;
373
+ if (typeof r != "string" || r.length === 0 || r.length > W || typeof i != "number" || !Number.isFinite(i) || i <= 0 || i > G || typeof a != "boolean" || typeof o != "boolean") throw TypeError("invalid XLSX host layout font");
374
+ return Object.freeze({
375
+ family: r,
376
+ sizePt: i,
377
+ bold: a,
378
+ italic: o
379
+ });
380
+ }
381
+ function Y(e) {
382
+ return typeof e == "number" && Number.isInteger(e) && e >= 1 && e <= K ? e : void 0;
383
+ }
384
+ async function X(e, t) {
385
+ if (typeof e.host_layout_request != "function") return;
386
+ if (typeof e.configure_host_layout != "function") throw TypeError("XLSX model source archive must implement configure_host_layout()");
387
+ let n = q(e.host_layout_request()), r = n ? Y(await t(n)) : void 0;
388
+ return e.configure_host_layout(r), r;
389
+ }
390
+ var Z = 1;
391
+ function Q(e, t) {
392
+ let n = Z++;
393
+ return new Promise((r) => {
394
+ let i = (t) => {
395
+ let a = t.data;
396
+ !$(a) || a.requestId !== n || (e.removeEventListener("message", i), r(Y(a.maximumDigitWidth)));
397
+ };
398
+ e.addEventListener("message", i);
399
+ try {
400
+ e.postMessage({
401
+ type: H,
402
+ requestId: n,
403
+ font: t
404
+ });
405
+ } catch {
406
+ e.removeEventListener("message", i), r(void 0);
407
+ }
408
+ });
409
+ }
410
+ function $(e) {
411
+ return typeof e == "object" && !!e && e.type === "xlsx-host-layout-result" && typeof e.requestId == "number";
412
+ }
413
+ //#endregion
414
+ //#region packages/xlsx/src/internal/worker-worksheet-source.ts
415
+ var ne = [
416
+ "open_sheet_cursor",
417
+ "pull_sheet_cursor",
418
+ "sheet_cursor_pull_finished",
419
+ "acknowledge_sheet_cursor_terminal",
420
+ "cancel_sheet_cursor",
421
+ "close_sheet_cursor",
422
+ "assert_healthy",
423
+ "parse",
424
+ "extract_image"
425
+ ];
426
+ function re(e) {
427
+ return _(e, "XLSX", ne), e;
428
+ }
429
+ function ie(e) {
430
+ let [t] = Object.keys(e);
431
+ if (t !== void 0) throw TypeError(`unsupported XLSX model source view default: ${t}`);
432
+ }
433
+ var ae = (e, t, n) => h(e, t, re, void 0, n), oe = class {
434
+ ooxmlHost;
435
+ openSource;
436
+ modelSource;
437
+ measuredMaximumDigitWidth;
438
+ copyBytes(e) {
439
+ return f(e);
440
+ }
441
+ isHostLayoutResult(e) {
442
+ return $(e);
443
+ }
444
+ requestHostLayoutFromPage(e, t) {
445
+ return Q(e, t);
446
+ }
447
+ extractImage(e) {
448
+ return this.execute((t) => this.copyBytes(t.extract_image(e)));
449
+ }
450
+ constructor(e, t = ae) {
451
+ this.ooxmlHost = e, this.openSource = t;
452
+ }
453
+ get kind() {
454
+ return this.modelSource ? "model-source" : "ooxml";
455
+ }
456
+ async openModelSource(e, t, n, r = []) {
457
+ if (this.modelSource || this.ooxmlHost.archive) throw Error("Workbook source already loaded");
458
+ let i = await this.openSource(t, e, r);
459
+ try {
460
+ if (ie(i.viewDefaults), this.modelSource || this.ooxmlHost.archive) throw Error("Workbook source open was superseded");
461
+ } catch (e) {
462
+ try {
463
+ i.close();
464
+ } catch {}
465
+ throw e;
466
+ }
467
+ let a = B(i.archive, "pull_sheet_cursor"), o = {
468
+ archive: i.archive,
469
+ transferArchive: a,
470
+ close: i.close
471
+ };
472
+ this.modelSource = o;
473
+ try {
474
+ if (this.measuredMaximumDigitWidth = await X(i.archive, n), this.modelSource !== o) throw Error("Workbook source open was superseded");
475
+ } catch (e) {
476
+ if (this.modelSource === o) try {
477
+ this.closeModelSource();
478
+ } catch {}
479
+ throw e;
480
+ }
481
+ }
482
+ get maximumDigitWidth() {
483
+ return this.measuredMaximumDigitWidth;
484
+ }
485
+ cursor() {
486
+ return this.modelSource?.archive ?? this.ooxmlHost.archive;
487
+ }
488
+ execute(e) {
489
+ let t = this.modelSource;
490
+ if (!t) {
491
+ let t = this.ooxmlHost.archive;
492
+ if (!t) throw Error("Workbook not loaded");
493
+ return this.ooxmlHost.run(() => e(t));
494
+ }
495
+ return V(() => e(t.transferArchive), () => {
496
+ this.modelSource === t && this.closeModelSource();
497
+ });
498
+ }
499
+ resourceUsage() {
500
+ let e = this.modelSource;
501
+ if (e) return v(e.archive, "resource_usage") ? this.execute(() => e.archive.resource_usage()) : void 0;
502
+ let t = this.ooxml();
503
+ return this.ooxmlHost.run(() => t.resource_usage());
504
+ }
505
+ toMarkdown() {
506
+ let e = this.modelSource;
507
+ if (e) {
508
+ if (!v(e.archive, "to_markdown")) throw y("Markdown conversion");
509
+ return this.execute(() => e.archive.to_markdown());
510
+ }
511
+ let t = this.ooxml();
512
+ return this.ooxmlHost.run(() => t.to_markdown());
513
+ }
514
+ closeModelSource() {
515
+ let e = this.modelSource;
516
+ this.modelSource = void 0, this.measuredMaximumDigitWidth = void 0, e?.close();
517
+ }
518
+ ooxml() {
519
+ let e = this.ooxmlHost.archive;
520
+ if (!e) throw Error("Workbook not loaded");
521
+ return e;
522
+ }
523
+ };
524
+ //#endregion
525
+ export { oe as WorkerWorksheetSourceOwner };
package/dist/xlsx.mjs CHANGED
@@ -1,7 +1,8 @@
1
- import { ln as e, r as t, un as n } from "./hyperlink-Cxzhet30.js";
2
- import { T as r } from "./canvas-viewer-mechanics-DbLz0rYW.js";
3
- import { l as i, s as a } from "./pixel-budget-9P63Bsk5.js";
4
- import { i as o, s } from "./raster-target-ojDdQizC.js";
5
- import { a as c, i as l, n as u, o as d, r as f, s as p } from "./xlsx-C9NVjgaV.js";
6
- import { i as m } from "./worksheet-pull-client-BM8ywvbu.js";
7
- export { l as MAX_SELECTION_AREAS, c as MAX_SELECTION_CONTEXT_CELLS, d as MAX_SELECTION_CONTEXT_TEXT_CHARACTERS, a as OoxmlDecodedImageLimitError, e as OoxmlError, n as OoxmlResourceLimitError, o as TiffDecodeError, u as XlsxSheetViewer, f as XlsxViewer, p as XlsxWorkbook, r as autoResize, i as isOoxmlDecodedImageLimitError, s as isTiffDecodeError, t as openExternalHyperlink, m as resolveSharedStrings };
1
+ import { vo as e, yo as t } from "./plot-area-frame-Bs_j4uu7.js";
2
+ import { u as n } from "./bounded-raw-part-cache-CsnNptAy.js";
3
+ import { f as r, u as i } from "./pixel-budget-BpTYrepD.js";
4
+ import { i as a, t as o } from "./tiff-contract-C6M3QcPp.js";
5
+ import { D as s } from "./canvas-viewer-mechanics-BZ8QCrRi.js";
6
+ import { a as c } from "./worksheet-pull-client-ClvPO_Jf.js";
7
+ import { a as l, i as u, n as d, o as f, r as p, s as m } from "./xlsx-CsmREBaZ.js";
8
+ export { u as MAX_SELECTION_AREAS, l as MAX_SELECTION_CONTEXT_CELLS, f as MAX_SELECTION_CONTEXT_TEXT_CHARACTERS, i as OoxmlDecodedImageLimitError, e as OoxmlError, t as OoxmlResourceLimitError, o as TiffDecodeError, d as XlsxSheetViewer, p as XlsxViewer, m as XlsxWorkbook, s as autoResize, r as isOoxmlDecodedImageLimitError, a as isTiffDecodeError, n as openExternalHyperlink, c as resolveSharedStrings };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silurus/ooxml",
3
- "version": "0.88.0",
3
+ "version": "0.89.1",
4
4
  "description": "Browser-based OOXML viewer (docx/xlsx/pptx) — Rust/WASM parser + Canvas renderer",
5
5
  "license": "MIT",
6
6
  "author": "Yuki Yokotani <silurus.dev@gmail.com>",
@@ -87,20 +87,26 @@
87
87
  "types": "./dist/types/node.d.ts",
88
88
  "import": "./dist/node.mjs",
89
89
  "default": "./dist/node.mjs"
90
+ },
91
+ "./internal/companion": {
92
+ "types": "./dist/types/internal-companion.d.ts",
93
+ "import": "./dist/internal-companion.mjs",
94
+ "default": "./dist/internal-companion.mjs"
90
95
  }
91
96
  },
92
97
  "devDependencies": {
93
98
  "@ast-grep/cli": "^0.43.0",
94
- "@playwright/test": "^1.59.1",
99
+ "@babel/parser": "7.29.2",
95
100
  "@chromatic-com/storybook": "^5.1.2",
101
+ "@playwright/test": "^1.59.1",
96
102
  "@storybook/addon-a11y": "^10.3.5",
97
103
  "@storybook/addon-docs": "^10.3.5",
98
104
  "@storybook/html-vite": "^10.3.5",
99
105
  "@types/node": "^25.6.0",
100
106
  "mathjax": "^3.2.2",
101
107
  "pngjs": "^7.0.0",
102
- "rolldown-plugin-dts": "^0.28.0",
103
108
  "rolldown": "^1.2.0",
109
+ "rolldown-plugin-dts": "^0.28.0",
104
110
  "storybook": "^10.3.5",
105
111
  "typescript": "^7.0.2",
106
112
  "typescript-compiler-api": "npm:@typescript/typescript6@^6.0.2",
@@ -110,36 +116,47 @@
110
116
  "vitest": "^4.1.4"
111
117
  },
112
118
  "scripts": {
113
- "build": "vite build && node scripts/bundle-declarations.mjs",
114
- "build:runtime": "vite build --mode runtime",
119
+ "build": "vite build && node scripts/build-model-source-sidecars.mjs && node scripts/bundle-declarations.mjs && pnpm build:legacy",
120
+ "build:runtime": "vite build --mode runtime && node scripts/build-model-source-sidecars.mjs",
115
121
  "build:packages": "pnpm -r build",
116
- "build:packages:ci": "pnpm --filter @silurus/ooxml-docx --filter @silurus/ooxml-pptx --filter @silurus/ooxml-xlsx --filter @silurus/ooxml-markdown --filter @silurus/ooxml-site -r --workspace-concurrency=1 build:ci",
117
- "typecheck": "tsc --build && pnpm --filter @silurus/ooxml-markdown --filter @silurus/ooxml-node --filter ./packages/vscode-extension typecheck",
122
+ "build:packages:ci": "pnpm --filter @silurus/ooxml-core --filter @silurus/ooxml-docx --filter @silurus/ooxml-pptx --filter @silurus/ooxml-xlsx --filter @silurus/ooxml-markdown --filter @silurus/ooxml-site -r --workspace-concurrency=1 build",
123
+ "typecheck": "tsc --build && pnpm --filter @silurus/ooxml-markdown --filter @silurus/ooxml-node --filter @silurus/ooxml-legacy-office --filter ./packages/vscode-extension typecheck",
118
124
  "storybook": "storybook dev -p 6006",
119
125
  "build-storybook": "storybook build",
120
- "build:wasm": "pnpm --filter @silurus/ooxml-docx wasm && pnpm --filter @silurus/ooxml-xlsx wasm && pnpm --filter @silurus/ooxml-pptx wasm",
121
- "vrt": "pnpm -r --workspace-concurrency=1 vrt",
122
- "vrt:snapshot": "pnpm -r --workspace-concurrency=1 vrt:snapshot",
123
- "vrt:private": "pnpm -r --workspace-concurrency=1 --if-present vrt:private",
124
- "vrt:private:snapshot": "pnpm -r --workspace-concurrency=1 --if-present vrt:private:snapshot",
125
- "vrt:fidelity": "pnpm -r --workspace-concurrency=1 vrt:fidelity",
126
+ "build:wasm": "pnpm --filter @silurus/ooxml-docx wasm && pnpm --filter @silurus/ooxml-xlsx wasm && pnpm --filter @silurus/ooxml-pptx wasm && pnpm build:wasm:legacy-doc && pnpm build:wasm:legacy-ppt && pnpm build:wasm:legacy-xls",
127
+ "build:wasm:legacy-doc": "pnpm --filter @silurus/ooxml-legacy-office wasm:direct-doc",
128
+ "build:wasm:legacy-ppt": "pnpm --filter @silurus/ooxml-legacy-office wasm:direct-ppt",
129
+ "build:wasm:legacy-xls": "pnpm --filter @silurus/ooxml-legacy-office wasm:direct-xls",
130
+ "vrt": "pnpm -r --workspace-concurrency=1 --no-bail vrt",
131
+ "vrt:snapshot": "pnpm -r --workspace-concurrency=1 --no-bail vrt:snapshot",
132
+ "vrt:private": "pnpm -r --workspace-concurrency=1 --no-bail --if-present vrt:private",
133
+ "vrt:private:snapshot": "pnpm -r --workspace-concurrency=1 --no-bail --if-present vrt:private:snapshot",
134
+ "vrt:fidelity": "pnpm -r --workspace-concurrency=1 --no-bail vrt:fidelity",
126
135
  "vrt:worker": "pnpm --workspace-concurrency=1 --filter @silurus/ooxml-pptx --filter @silurus/ooxml-docx --filter @silurus/ooxml-xlsx vrt:worker",
127
136
  "smoke": "playwright test --config tests/smoke/playwright.config.ts layouts raster-decode",
137
+ "screenshots:readme": "playwright test --config tests/smoke/playwright.config.ts readme-screenshots --project=chrome",
138
+ "test:pattern-browser": "playwright test --config tests/patterns/playwright.config.ts",
128
139
  "test:site-runtime": "playwright test --config tests/site-dist/playwright.config.ts",
129
- "test": "vitest run && node --test tests/visual/private-corpus.test.mjs",
140
+ "test": "vitest run && node --test tests/visual/private-corpus.test.mjs scripts/companion-release.test.mjs scripts/check-relative-wasm-urls.test.mjs packages/docx/tests/visual/stable-canvas-render.test.mjs 'packages/legacy-office/tools/*.test.mjs'",
141
+ "test:python": "uv run --no-project --with python-docx==1.2.0 --with lxml==6.1.3 --with fonttools==4.67.0 python scripts/run-python-tests.py",
130
142
  "bench:layout": "vitest bench --run packages/docx/src/layout/layout.bench.ts",
131
143
  "bench:progressive": "OOXML_DOCX_PROGRESSIVE_BENCH=1 vitest run --disableConsoleIntercept packages/docx/src/layout/progressive-timing.test.ts",
132
- "check:no-inline-wasm": "node scripts/check-no-inline-wasm.mjs dist",
144
+ "check:no-inline-wasm": "node scripts/check-no-inline-wasm.mjs dist && node scripts/check-no-inline-wasm.mjs packages/legacy-office/dist",
145
+ "check:relative-wasm-urls": "node scripts/check-relative-wasm-urls.mjs",
133
146
  "check:production-render-workers": "node scripts/check-production-render-workers.mjs dist",
134
147
  "test:production-render-workers": "playwright test --config tests/worker-dist/playwright.config.ts",
135
148
  "check:optional-three-d": "node scripts/check-optional-three-d.mjs dist",
136
149
  "check:optional-region-map": "node scripts/check-optional-region-map.mjs dist",
137
150
  "check:optional-chart-ex": "node scripts/check-optional-chart-ex.mjs dist",
138
151
  "check:optional-tiff": "node scripts/check-optional-tiff.mjs dist",
152
+ "check:optional-legacy-doc": "node scripts/check-optional-legacy-source.mjs doc packages/legacy-office/dist",
153
+ "check:optional-legacy-ppt": "node scripts/check-optional-legacy-source.mjs ppt packages/legacy-office/dist",
154
+ "check:optional-legacy-xls": "node scripts/check-optional-legacy-source.mjs xls packages/legacy-office/dist",
139
155
  "lint": "ast-grep scan",
140
156
  "lint:test": "ast-grep test --skip-snapshot-tests",
141
157
  "test:docx-boundaries": "node --test scripts/check-docx-layout-boundaries.test.mjs",
142
158
  "test:docx-compatibility": "node --test scripts/check-docx-compatibility-evidence.test.mjs",
159
+ "test:docx-compatibility-build": "node --test scripts/docx-compatibility-build.test.mjs",
143
160
  "test:docx-public-api": "node --test scripts/check-public-api.test.mjs",
144
161
  "generate:resource-policy": "node scripts/generate-ooxml-resource-policy.mjs --write",
145
162
  "check:resource-policy": "node scripts/generate-ooxml-resource-policy.mjs",
@@ -150,6 +167,15 @@
150
167
  "check:viewer-api-symmetry": "node scripts/check-viewer-api-symmetry.mjs",
151
168
  "check:public-type-exports": "node scripts/check-public-type-exports.mjs",
152
169
  "check:docx-compatibility": "node scripts/check-docx-compatibility-evidence.mjs",
153
- "test:docx-package-build": "node --test scripts/check-docx-package-build.test.mjs"
170
+ "test:docx-package-build": "node --test scripts/check-docx-package-build.test.mjs",
171
+ "check:legacy-wasm-exports": "node scripts/check-legacy-wasm-exports.mjs packages/legacy-office/dist",
172
+ "check:core-legacy-boundary": "node scripts/check-core-legacy-boundary.mjs",
173
+ "check:model-source-lazy-graph": "node scripts/check-model-source-lazy-graph.mjs",
174
+ "check:model-source-lazy-runtime": "node scripts/check-model-source-lazy-runtime.mjs",
175
+ "check:model-source-ooxml-path": "node scripts/check-model-source-ooxml-path.mjs",
176
+ "build:legacy": "pnpm --filter @silurus/ooxml-legacy-office build",
177
+ "sync:versions": "node scripts/sync-companion-version.mjs --write",
178
+ "check:versions": "node scripts/sync-companion-version.mjs",
179
+ "test:packed-packages": "node scripts/check-packed-packages.mjs"
154
180
  }
155
181
  }