@silurus/ooxml 0.74.6 → 0.75.0
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.
- package/README.md +105 -6
- package/dist/bounded-raw-part-cache-BTfZD_Sz.js +1248 -0
- package/dist/{docx-DftZMp7R.js → document-pull-client-H80_E10V.js} +11165 -11517
- package/dist/docx-BX0mJqS1.js +1274 -0
- package/dist/docx.mjs +6 -3
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/duotone-bitmap-by-path-Dv5Ikbzl.js +28 -0
- package/dist/find-cursor-Dc5iM6s7.js +815 -0
- package/dist/highlight-rect-cCvVU-MW.js +48 -0
- package/dist/hyperlink-D85FexTa.js +27 -0
- package/dist/index.mjs +4 -4
- package/dist/{highlight-rect-IjFkGg4X.js → line-distribute-DkLgIa7B.js} +37 -84
- package/dist/{find-cursor-DtgyGs5V.js → line-metrics-qwIyTk7Q.js} +1169 -3641
- package/dist/math.mjs +1 -1
- package/dist/node.mjs +998 -0
- package/dist/pptx-BEYjiTnZ.js +822 -0
- package/dist/pptx-CXgyi7wu.js +1705 -0
- package/dist/pptx.mjs +7 -3
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/preload-BEouWnlI.js +132 -0
- package/dist/render-C0wMf5eT.js +71 -0
- package/dist/render-worker-host-CLdOlxFu.js +27 -0
- package/dist/render-worker-host-DZ4u0RFs.js +27 -0
- package/dist/render-worker-host-s3J-mWBP.js +27 -0
- package/dist/renderer-CwzTv9hH.js +5225 -0
- package/dist/resource-measurement-6aReN3K0.js +93 -0
- package/dist/slide-pull-client-D_T0AIoX.js +175 -0
- package/dist/svg-image-by-path-C1M3N2pT.js +1623 -0
- package/dist/transfer-3QEJrsJa.js +6 -0
- package/dist/types/docx.d.ts +290 -105
- package/dist/types/index.d.ts +399 -142
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +4855 -0
- package/dist/types/pptx.d.ts +431 -245
- package/dist/types/xlsx.d.ts +320 -120
- package/dist/visible-index-CKvgpUrf.js +17 -0
- package/dist/worksheet-pull-worker-DCei8u-4.js +347 -0
- package/dist/{xlsx-BqMHvfsE.js → xlsx-DJyPlzjB.js} +1499 -1284
- package/dist/xlsx.mjs +7 -3
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +12 -2
- package/dist/pptx-qbadwIv4.js +0 -6761
- package/dist/render-worker-host-Bcm9j4-H.js +0 -27
- package/dist/render-worker-host-BqSTDaYt.js +0 -27
- package/dist/render-worker-host-C523QxVw.js +0 -27
- package/dist/visible-index-C3_3gBg-.js +0 -50
- /package/dist/{mathjax-BPjQ2C_j.js → mathjax-Dqo857oC.js} +0 -0
package/dist/pptx.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { M as e, N as t } from "./bounded-raw-part-cache-BTfZD_Sz.js";
|
|
2
|
+
import { p as n } from "./find-cursor-Dc5iM6s7.js";
|
|
3
|
+
import { f as r, p as i } from "./svg-image-by-path-C1M3N2pT.js";
|
|
4
|
+
import { t as a } from "./renderer-CwzTv9hH.js";
|
|
5
|
+
import { a as o, i as s, n as c, o as l, r as u } from "./pptx-CXgyi7wu.js";
|
|
6
|
+
import { r as d } from "./hyperlink-D85FexTa.js";
|
|
7
|
+
export { r as OoxmlDecodedImageLimitError, e as OoxmlError, t as OoxmlResourceLimitError, s as PptxPresentation, c as PptxScrollViewer, u as PptxViewer, n as autoResize, o as buildPptxHighlightLayer, l as buildPptxTextLayer, i as isOoxmlDecodedImageLimitError, d as openExternalHyperlink, a as renderSlide };
|
package/dist/pptx_parser_bg.wasm
CHANGED
|
Binary file
|
|
@@ -0,0 +1,132 @@
|
|
|
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);
|
|
5
|
+
if (i && i.set === n) return i.refs++, {
|
|
6
|
+
face: i.face,
|
|
7
|
+
isNew: !1
|
|
8
|
+
};
|
|
9
|
+
let a = r();
|
|
10
|
+
return e.set(t, {
|
|
11
|
+
face: a,
|
|
12
|
+
set: n,
|
|
13
|
+
refs: 1
|
|
14
|
+
}), {
|
|
15
|
+
face: a,
|
|
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) if (n.face === r) {
|
|
24
|
+
if (n.refs--, n.refs <= 0) {
|
|
25
|
+
try {
|
|
26
|
+
n.set.delete(r);
|
|
27
|
+
} catch {}
|
|
28
|
+
e.delete(t);
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region packages/core/src/fonts/preload.ts
|
|
36
|
+
var r = 15e3;
|
|
37
|
+
function i(e) {
|
|
38
|
+
return Promise.race([e, new Promise((e) => setTimeout(e, r))]);
|
|
39
|
+
}
|
|
40
|
+
var a = /* @__PURE__ */ new Map();
|
|
41
|
+
function o(e) {
|
|
42
|
+
let t = [], n = /@font-face\s*\{([^}]*)\}/g, r;
|
|
43
|
+
for (; r = n.exec(e);) {
|
|
44
|
+
let e = r[1], n = (t) => e.match(RegExp(`(?:^|;|\\n)\\s*${t}\\s*:\\s*([^;]+)`, "i"))?.[1].trim(), i = n("font-family"), a = n("src");
|
|
45
|
+
if (!i || !a) continue;
|
|
46
|
+
let o = {}, s = n("font-style");
|
|
47
|
+
s && (o.style = s);
|
|
48
|
+
let c = n("font-weight");
|
|
49
|
+
c && (o.weight = c);
|
|
50
|
+
let l = n("font-stretch");
|
|
51
|
+
l && (o.stretch = l);
|
|
52
|
+
let u = n("unicode-range");
|
|
53
|
+
u && (o.unicodeRange = u), t.push({
|
|
54
|
+
family: i.replace(/^['"]|['"]$/g, ""),
|
|
55
|
+
src: a,
|
|
56
|
+
descriptors: o
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return t;
|
|
60
|
+
}
|
|
61
|
+
function s() {
|
|
62
|
+
return typeof document < "u" && document && document.fonts ? document.fonts : typeof self < "u" && self && "fonts" in self ? self.fonts : null;
|
|
63
|
+
}
|
|
64
|
+
function c(e, t) {
|
|
65
|
+
let n = t.descriptors;
|
|
66
|
+
return [
|
|
67
|
+
"gfonts",
|
|
68
|
+
e,
|
|
69
|
+
t.family.toLowerCase(),
|
|
70
|
+
n.style ?? "",
|
|
71
|
+
n.weight ?? "",
|
|
72
|
+
n.stretch ?? "",
|
|
73
|
+
n.unicodeRange ?? "",
|
|
74
|
+
t.src
|
|
75
|
+
].join("|");
|
|
76
|
+
}
|
|
77
|
+
async function l(e, n) {
|
|
78
|
+
let r = s();
|
|
79
|
+
if (!r || typeof FontFace > "u" || typeof fetch > "u") return [];
|
|
80
|
+
let l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set();
|
|
81
|
+
for (let t of e) {
|
|
82
|
+
if (!t) continue;
|
|
83
|
+
let e = t.toLowerCase();
|
|
84
|
+
if (l.has(e)) continue;
|
|
85
|
+
l.add(e);
|
|
86
|
+
let r = n[e];
|
|
87
|
+
if (!r) continue;
|
|
88
|
+
d.add(r.url);
|
|
89
|
+
let i = (r.loadFamily ?? t).toLowerCase();
|
|
90
|
+
u.add(i);
|
|
91
|
+
let a = f.get(r.url);
|
|
92
|
+
a || (a = /* @__PURE__ */ new Set(), f.set(r.url, a)), a.add(i);
|
|
93
|
+
}
|
|
94
|
+
if (u.size === 0) return [];
|
|
95
|
+
let m = await i(Promise.all([...d].map(async (e) => {
|
|
96
|
+
let t = a.get(e);
|
|
97
|
+
if (t) return {
|
|
98
|
+
url: e,
|
|
99
|
+
rules: await t
|
|
100
|
+
};
|
|
101
|
+
let n = (async () => {
|
|
102
|
+
try {
|
|
103
|
+
let t = await fetch(e);
|
|
104
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
105
|
+
return o(await t.text());
|
|
106
|
+
} catch {
|
|
107
|
+
a.delete(e);
|
|
108
|
+
for (let t of f.get(e) ?? []) p.add(t);
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
})();
|
|
112
|
+
return a.set(e, n), {
|
|
113
|
+
url: e,
|
|
114
|
+
rules: await n
|
|
115
|
+
};
|
|
116
|
+
}))), h = [], g = [];
|
|
117
|
+
for (let e of Array.isArray(m) ? m : []) for (let n of e.rules) {
|
|
118
|
+
let { face: i, isNew: a } = t(c(e.url, n), r, () => {
|
|
119
|
+
let e = new FontFace(n.family, n.src, n.descriptors);
|
|
120
|
+
return r.add(e), e;
|
|
121
|
+
});
|
|
122
|
+
h.push(i), a && g.push(i);
|
|
123
|
+
}
|
|
124
|
+
return g.length > 0 && await i(Promise.allSettled(g.map((e) => e.load())).then((e) => (e.forEach((e, t) => {
|
|
125
|
+
e.status === "rejected" && p.add(g[t].family.replace(/['"]/g, "").toLowerCase());
|
|
126
|
+
}), r.ready))), p.size > 0 && console.warn(`[ooxml] failed to preload web font(s): ${[...p].join(", ")}; falling back to system fonts (text may shift or differ).`), h;
|
|
127
|
+
}
|
|
128
|
+
function u(e) {
|
|
129
|
+
n(e);
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { n as a, i, l as n, t as o, u as r, s as t };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { t as e } from "./chunk-DmhlhrBa.js";
|
|
2
|
+
//#region packages/node/src/render.ts
|
|
3
|
+
var t = /* @__PURE__ */ e({
|
|
4
|
+
installImageBitmapShim: () => i,
|
|
5
|
+
installOffscreenCanvasShim: () => r,
|
|
6
|
+
makeSourceBufferFetchImage: () => o,
|
|
7
|
+
renderSlideNode: () => s,
|
|
8
|
+
withNodeCanvasRuntime: () => a
|
|
9
|
+
}), n = Promise.resolve();
|
|
10
|
+
function r(e) {
|
|
11
|
+
let t = globalThis, n = t.OffscreenCanvas, r = Object.prototype.hasOwnProperty.call(globalThis, "OffscreenCanvas");
|
|
12
|
+
if (n !== void 0) return () => {};
|
|
13
|
+
class i {
|
|
14
|
+
constructor(t, n) {
|
|
15
|
+
return e.createCanvas(t, n);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return t.OffscreenCanvas = i, () => {
|
|
19
|
+
r ? t.OffscreenCanvas = n : delete t.OffscreenCanvas;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function i(e) {
|
|
23
|
+
let t = globalThis, n = t.createImageBitmap;
|
|
24
|
+
return t.createImageBitmap = async (t) => {
|
|
25
|
+
if (t && typeof t.getContext == "function") return t;
|
|
26
|
+
let n;
|
|
27
|
+
if (t instanceof Uint8Array || t instanceof ArrayBuffer) n = t;
|
|
28
|
+
else if (typeof t.arrayBuffer == "function") n = await t.arrayBuffer();
|
|
29
|
+
else throw Error("createImageBitmap shim: unsupported source type");
|
|
30
|
+
return e.loadImage(n);
|
|
31
|
+
}, () => {
|
|
32
|
+
t.createImageBitmap = n;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function a(e, t) {
|
|
36
|
+
let a = async () => {
|
|
37
|
+
let n = typeof globalThis.createImageBitmap == "function" ? () => void 0 : i(e), a = r(e);
|
|
38
|
+
try {
|
|
39
|
+
return await t();
|
|
40
|
+
} finally {
|
|
41
|
+
a(), n();
|
|
42
|
+
}
|
|
43
|
+
}, o = n.then(a, a);
|
|
44
|
+
return n = o.then(() => void 0, () => void 0), o;
|
|
45
|
+
}
|
|
46
|
+
function o(e, t) {
|
|
47
|
+
return async (n, r) => {
|
|
48
|
+
let { extractImage: i } = await import("./pptx-BEYjiTnZ.js").then((e) => e.a), a = i(e, n, t);
|
|
49
|
+
return new Blob([new Uint8Array(a).slice()], { type: r });
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async function s(e, t, n, r = {}) {
|
|
53
|
+
let { renderSlide: i } = await import("./renderer-CwzTv9hH.js").then((e) => e.n), s = t.slides[n];
|
|
54
|
+
if (!s) throw Error(`Slide index ${n} out of range`);
|
|
55
|
+
let c = r.width ?? 960, l = r.dpr ?? 2, u = r.fetchImage ?? (r.sourceBuffer ? o(r.sourceBuffer, r.maxZipEntryBytes) : async () => new Blob([])), d = async () => {
|
|
56
|
+
await i(e, s, t.slideWidth, t.slideHeight, {
|
|
57
|
+
width: c,
|
|
58
|
+
dpr: l,
|
|
59
|
+
defaultTextColor: t.defaultTextColor,
|
|
60
|
+
majorFont: t.majorFont,
|
|
61
|
+
minorFont: t.minorFont,
|
|
62
|
+
hlinkColor: t.hlinkColor ?? null,
|
|
63
|
+
fetchMedia: r.fetchMedia ?? (async () => new Blob([])),
|
|
64
|
+
fetchImage: u,
|
|
65
|
+
skipMediaControls: !0
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
await (r.factory ? a(r.factory, d) : d());
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { t as a, s as i, r as n, a as o, o as r, i as t };
|