@silurus/ooxml 0.86.0 → 0.86.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 (36) hide show
  1. package/dist/assets/render-worker-D21h5TGR.js +10 -0
  2. package/dist/assets/render-worker-Dsfekaht.js +11 -0
  3. package/dist/assets/{render-worker-CB4DxjXg.js → render-worker-DxU7IrKo.js} +18 -18
  4. package/dist/bounded-raw-part-cache-BfbSxRIL.js +119 -0
  5. package/dist/{canvas-viewer-mechanics-B3A7KLLi.js → canvas-viewer-mechanics-DN5SqWGS.js} +329 -192
  6. package/dist/{comment-ui-runtime-ssI6IE39.js → comment-ui-runtime-lXwVOgjW.js} +1 -1
  7. package/dist/{document-pull-client-xZrA2IjM.js → document-pull-client-uopDjRde.js} +4501 -4456
  8. package/dist/{docx-DzDiGvqe.js → docx-wPzeF76A.js} +492 -307
  9. package/dist/docx.mjs +6 -6
  10. package/dist/docx_parser_bg.wasm +0 -0
  11. package/dist/{dom-interaction-boundary-DK1JLkrz.js → dom-interaction-boundary-CswB9Tzi.js} +60 -57
  12. package/dist/{hyperlink-enyPbflR.js → hyperlink-BR1NCO7S.js} +934 -885
  13. package/dist/index.mjs +4 -4
  14. package/dist/line-distribute-IsUGfHXm.js +1023 -0
  15. package/dist/node.mjs +272 -272
  16. package/dist/{pptx-D_U62nl-.js → pptx-BxJ_RBSY.js} +169 -161
  17. package/dist/pptx.mjs +5 -5
  18. package/dist/pptx_parser_bg.wasm +0 -0
  19. package/dist/{render-DSn0d35X.js → render-DEiun_AH.js} +1 -1
  20. package/dist/{render-worker-host-CO0UYoQh.js → render-worker-host-BEfLZvSL.js} +1 -1
  21. package/dist/{render-worker-host-CbYDBg7U.js → render-worker-host-Ba6Fchqr.js} +1 -1
  22. package/dist/{render-worker-host-BHz9vjxB.js → render-worker-host-C3xwtHnv.js} +1 -1
  23. package/dist/{resource-measurement-Do07ZRcR.js → resource-measurement-CclArDRs.js} +9 -9
  24. package/dist/{session-C1GYhr6n.js → session-BuJL_xcp.js} +87 -87
  25. package/dist/{slide-pull-client-DuEaUxPw.js → slide-pull-client-Ck8wfRT_.js} +977 -903
  26. package/dist/types/docx.d.ts +1 -2
  27. package/dist/types/index.d.ts +1 -2
  28. package/dist/{worksheet-pull-client-eDiHHEG2.js → worksheet-pull-client-CAvuf22q.js} +78 -78
  29. package/dist/{xlsx-CMHmYTHP.js → xlsx-Bblm5r1h.js} +574 -574
  30. package/dist/xlsx.mjs +5 -5
  31. package/package.json +1 -1
  32. package/dist/assets/render-worker-BCGnuBLj.js +0 -10
  33. package/dist/assets/render-worker-CHW0F0n6.js +0 -11
  34. package/dist/bounded-raw-part-cache-DVx3Camo.js +0 -256
  35. package/dist/line-distribute-BFB575d6.js +0 -1023
  36. /package/dist/{comment-occurrence-Dhdplprg.js → comment-occurrence-CqejEuts.js} +0 -0
@@ -1,256 +0,0 @@
1
- //#region packages/core/src/fonts/font-registry.ts
2
- var e = /* @__PURE__ */ new Map();
3
- function t(t, n, r) {
4
- let i = e.get(t), a = i?.get(n);
5
- if (a) return a.refs++, {
6
- face: a.face,
7
- isNew: !1
8
- };
9
- let o = r(), s = i ?? /* @__PURE__ */ new Map();
10
- return s.set(n, {
11
- face: o,
12
- set: n,
13
- refs: 1
14
- }), e.set(t, s), {
15
- face: o,
16
- isNew: !0
17
- };
18
- }
19
- function n(t) {
20
- let n = /* @__PURE__ */ new Set();
21
- for (let r of t) if (!n.has(r)) {
22
- n.add(r);
23
- for (let [t, n] of e) {
24
- let i = !1;
25
- for (let [a, o] of n) if (o.face === r) {
26
- if (i = !0, o.refs--, o.refs <= 0) {
27
- try {
28
- o.set.delete(r);
29
- } catch {}
30
- n.delete(a), n.size === 0 && e.delete(t);
31
- }
32
- break;
33
- }
34
- if (i) break;
35
- }
36
- }
37
- }
38
- //#endregion
39
- //#region packages/core/src/fonts/preload.ts
40
- var r = 15e3;
41
- function i(e) {
42
- return Promise.race([e, new Promise((e) => setTimeout(e, r))]);
43
- }
44
- var a = /* @__PURE__ */ new Map();
45
- function o(e) {
46
- let t = [], n = /@font-face\s*\{([^}]*)\}/g, r;
47
- for (; r = n.exec(e);) {
48
- let e = r[1], n = (t) => e.match(RegExp(`(?:^|;|\\n)\\s*${t}\\s*:\\s*([^;]+)`, "i"))?.[1].trim(), i = n("font-family"), a = n("src");
49
- if (!i || !a) continue;
50
- let o = {}, s = n("font-style");
51
- s && (o.style = s);
52
- let c = n("font-weight");
53
- c && (o.weight = c);
54
- let l = n("font-stretch");
55
- l && (o.stretch = l);
56
- let u = n("unicode-range");
57
- u && (o.unicodeRange = u), t.push({
58
- family: i.replace(/^['"]|['"]$/g, ""),
59
- src: a,
60
- descriptors: o
61
- });
62
- }
63
- return t;
64
- }
65
- function s() {
66
- return typeof document < "u" && document && document.fonts ? document.fonts : typeof self < "u" && self && "fonts" in self ? self.fonts : null;
67
- }
68
- function c(e, t) {
69
- let n = t.descriptors;
70
- return [
71
- "gfonts",
72
- e,
73
- t.family.toLowerCase(),
74
- n.style ?? "",
75
- n.weight ?? "",
76
- n.stretch ?? "",
77
- n.unicodeRange ?? "",
78
- t.src
79
- ].join("|");
80
- }
81
- async function l(e, n, r = s()) {
82
- let l = r;
83
- if (!l || typeof FontFace > "u" || typeof fetch > "u") return [];
84
- let u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set();
85
- for (let t of e) {
86
- if (!t) continue;
87
- let e = t.trim();
88
- if (!e) continue;
89
- let r = e.toLowerCase();
90
- if (u.has(r)) continue;
91
- u.add(r);
92
- let i = n[r];
93
- if (!i) continue;
94
- f.add(i.url);
95
- let a = (i.loadFamily ?? e).toLowerCase();
96
- d.add(a);
97
- let o = p.get(i.url);
98
- o || (o = /* @__PURE__ */ new Set(), p.set(i.url, o)), o.add(a);
99
- }
100
- if (d.size === 0) return [];
101
- let h = await i(Promise.all([...f].map(async (e) => {
102
- let t = a.get(e);
103
- if (t) return {
104
- url: e,
105
- rules: await t
106
- };
107
- let n = (async () => {
108
- try {
109
- let t = await fetch(e);
110
- if (!t.ok) throw Error(`HTTP ${t.status}`);
111
- return o(await t.text());
112
- } catch {
113
- a.delete(e);
114
- for (let t of p.get(e) ?? []) m.add(t);
115
- return [];
116
- }
117
- })();
118
- return a.set(e, n), {
119
- url: e,
120
- rules: await n
121
- };
122
- }))), g = [], _ = [];
123
- for (let e of Array.isArray(h) ? h : []) for (let n of e.rules) {
124
- let { face: r, isNew: i } = t(c(e.url, n), l, () => {
125
- let e = new FontFace(n.family, n.src, n.descriptors);
126
- return l.add(e), e;
127
- });
128
- g.push(r), i && _.push(r);
129
- }
130
- return _.length > 0 && await i(Promise.allSettled(_.map((e) => e.load())).then((e) => (e.forEach((e, t) => {
131
- e.status === "rejected" && m.add(_[t].family.replace(/['"]/g, "").toLowerCase());
132
- }), l.ready))), m.size > 0 && console.warn(`[ooxml] failed to preload web font(s): ${[...m].join(", ")}; falling back to system fonts (text may shift or differ).`), g;
133
- }
134
- function u(e) {
135
- n(e);
136
- }
137
- //#endregion
138
- //#region packages/core/src/internal/bounded-async-lru-cache.ts
139
- function d(e, t) {
140
- if (!Number.isSafeInteger(e) || e <= 0) throw TypeError(`${t} must be a positive safe integer`);
141
- }
142
- function f(e) {
143
- if (!Number.isSafeInteger(e) || e < 0) throw TypeError("cache entry weight must be a non-negative safe integer");
144
- }
145
- var p = class {
146
- #e;
147
- #t;
148
- #n;
149
- #r;
150
- #i = /* @__PURE__ */ new Map();
151
- #a = /* @__PURE__ */ new Map();
152
- #o = 0;
153
- constructor(e) {
154
- d(e.maxEntries, "maxEntries"), d(e.maxWeight, "maxWeight"), this.#e = e.maxEntries, this.#t = e.maxWeight, this.#n = e.measure, this.#r = e.onRemove;
155
- }
156
- get usage() {
157
- return {
158
- entries: this.#i.size,
159
- weight: this.#o,
160
- pending: this.#a.size
161
- };
162
- }
163
- has(e) {
164
- return this.#i.has(e);
165
- }
166
- get(e) {
167
- let t = this.#i.get(e);
168
- if (t !== void 0) return this.#i.delete(e), this.#i.set(e, t), t.value;
169
- }
170
- getOrLoad(e, t) {
171
- let n = this.get(e);
172
- if (n !== void 0 || this.#i.has(e)) return Promise.resolve(n);
173
- let r = this.#a.get(e);
174
- if (r !== void 0) return r.promise;
175
- let i = {}, a = Promise.resolve().then(t).then((t) => this.#c(e, i, t), (t) => {
176
- throw this.#s(e, i), t;
177
- });
178
- return this.#a.set(e, {
179
- token: i,
180
- promise: a
181
- }), a;
182
- }
183
- delete(e) {
184
- let t = this.#a.delete(e), n = this.#i.get(e);
185
- return n === void 0 ? t : (this.#i.delete(e), this.#o -= n.weight, this.#l(n.value, e, "deleted"), !0);
186
- }
187
- clear() {
188
- this.#a.clear();
189
- let e = [...this.#i];
190
- this.#i.clear(), this.#o = 0;
191
- for (let [t, n] of e) this.#l(n.value, t, "cleared");
192
- }
193
- #s(e, t) {
194
- this.#a.get(e)?.token === t && this.#a.delete(e);
195
- }
196
- #c(e, t, n) {
197
- if (this.#a.get(e)?.token !== t) return n;
198
- let r;
199
- try {
200
- r = this.#n(n), f(r);
201
- } catch (n) {
202
- throw this.#s(e, t), n;
203
- }
204
- if (this.#a.get(e)?.token !== t || (this.#a.delete(e), r > this.#t)) return n;
205
- let i = [];
206
- for (; this.#i.size >= this.#e || r > this.#t - this.#o;) {
207
- let e = this.#i.entries().next().value;
208
- if (e === void 0) break;
209
- let [t, n] = e;
210
- this.#i.delete(t), this.#o -= n.weight, i.push([t, n]);
211
- }
212
- this.#i.set(e, {
213
- value: n,
214
- weight: r
215
- }), this.#o += r;
216
- for (let [e, t] of i) this.#l(t.value, e, "evicted");
217
- return n;
218
- }
219
- #l(e, t, n) {
220
- try {
221
- this.#r?.(e, t, n);
222
- } catch {}
223
- }
224
- }, m = class {
225
- #e;
226
- constructor(e) {
227
- this.#e = new p({
228
- maxEntries: e.maxEntries,
229
- maxWeight: e.maxBytes,
230
- measure: (e) => e.size
231
- });
232
- }
233
- get usage() {
234
- let e = this.#e.usage;
235
- return {
236
- entries: e.entries,
237
- bytes: e.weight,
238
- pending: e.pending
239
- };
240
- }
241
- async get(e, t, n) {
242
- if (typeof e != "string" || e.length === 0) throw TypeError("raw package part path must be a non-empty string");
243
- if (typeof t != "string") throw TypeError("raw package part MIME type must be a string");
244
- let r = await this.#e.getOrLoad(e, async () => {
245
- let e = await n();
246
- if (!(e instanceof Blob)) throw TypeError("raw package part loader must return a Blob");
247
- return e;
248
- });
249
- return t === "" || r.type === t ? r : r.slice(0, r.size, t);
250
- }
251
- clear() {
252
- this.#e.clear();
253
- }
254
- };
255
- //#endregion
256
- export { u as a, t as c, l as i, p as n, i as o, s as r, n as s, m as t };