@silurus/ooxml 0.50.0 → 0.51.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 +8 -4
- package/dist/bridge-BFwyMqvY.js +228 -0
- package/dist/{docx-BmrIhf6p.js → docx-DtI9YHuK.js} +33 -33
- package/dist/docx.mjs +2 -2
- package/dist/index.mjs +3 -3
- package/dist/{pptx-DefKBJxp.js → pptx-BlOPRzOV.js} +114 -114
- package/dist/pptx.mjs +2 -2
- package/dist/{mathml-B58AKtQj.js → preset-D4KAeT8N.js} +1 -113
- package/dist/{renderer-CeHKK7PX.js → renderer-Brm7AGnm.js} +99 -99
- package/dist/types/index.d.ts +31 -2
- package/dist/types/xlsx.d.ts +164 -2
- package/dist/xlsx-DjYv5qgM.js +3444 -0
- package/dist/xlsx.mjs +2 -2
- package/package.json +1 -1
- package/dist/bridge-jB4wAQWt.js +0 -116
- package/dist/xlsx-BO-a3nOm.js +0 -3332
package/dist/docx.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as t, r as n } from "./docx-
|
|
1
|
+
import { r as e } from "./bridge-BFwyMqvY.js";
|
|
2
|
+
import { n as t, r as n } from "./docx-DtI9YHuK.js";
|
|
3
3
|
export { n as DocxDocument, t as DocxViewer, e as autoResize };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./xlsx-
|
|
2
|
-
import { t } from "./pptx-
|
|
3
|
-
import { t as n } from "./docx-
|
|
1
|
+
import { t as e } from "./xlsx-DjYv5qgM.js";
|
|
2
|
+
import { t } from "./pptx-BlOPRzOV.js";
|
|
3
|
+
import { t as n } from "./docx-DtI9YHuK.js";
|
|
4
4
|
export { n as docx, t as pptx, e as xlsx };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { a as
|
|
1
|
+
import { a as e, c as t, i as n, n as r, r as i, s as a, t as o } from "./bridge-BFwyMqvY.js";
|
|
2
|
+
import { t as s } from "./renderer-Brm7AGnm.js";
|
|
3
|
+
import { a as c, i as l, n as u, r as d, t as f } from "./preset-D4KAeT8N.js";
|
|
4
4
|
import { t as p } from "./mathjax-DWYWI9GF.js";
|
|
5
5
|
//#region packages/pptx/src/media-chrome.ts
|
|
6
6
|
function m(e, t, n, r, i, a) {
|
|
@@ -22144,12 +22144,12 @@ function O(e) {
|
|
|
22144
22144
|
function k(e, t) {
|
|
22145
22145
|
return e * t;
|
|
22146
22146
|
}
|
|
22147
|
-
var A =
|
|
22147
|
+
var A = d;
|
|
22148
22148
|
function j(e) {
|
|
22149
22149
|
return !e || e.fillType === "none" ? null : e.fillType === "solid" ? A(e.color) : e.fillType === "gradient" ? e.stops.length > 0 ? A(e.stops[0].color) : null : e.fillType === "pattern" ? A(e.fg) : null;
|
|
22150
22150
|
}
|
|
22151
22151
|
function M(e, t, n, r, i, a) {
|
|
22152
|
-
return
|
|
22152
|
+
return l(e, t, n, r, i, a);
|
|
22153
22153
|
}
|
|
22154
22154
|
function N(e, t, n, r, i, a, o) {
|
|
22155
22155
|
let s = Math.max(1, i * .05), c = o?.endsWith("Heavy") ?? !1 ? s * 1.8 : s, l = n + Math.max(2, c);
|
|
@@ -22242,9 +22242,9 @@ async function B(e, t) {
|
|
|
22242
22242
|
if (n.length !== 0) {
|
|
22243
22243
|
await t.loadMathJax();
|
|
22244
22244
|
for (let e of n) if (!P.has(e.nodes)) try {
|
|
22245
|
-
let n = await t.mathMLToSvg(
|
|
22245
|
+
let n = await t.mathMLToSvg(r(e.nodes, e.display)), i = await I(R(p(n.svg, "#000000"), n.widthEm, n.ascentEm + n.descentEm));
|
|
22246
22246
|
P.set(e.nodes, {
|
|
22247
|
-
img:
|
|
22247
|
+
img: i,
|
|
22248
22248
|
widthEm: n.widthEm,
|
|
22249
22249
|
ascentEm: n.ascentEm,
|
|
22250
22250
|
descentEm: n.descentEm,
|
|
@@ -22303,19 +22303,19 @@ function W(e, t, n, r, i) {
|
|
|
22303
22303
|
let c = ne[s.toLowerCase()];
|
|
22304
22304
|
return `${a}${o}${n}px "${s}", ${c ? `"${c}", ` : ""}${te(s)}`;
|
|
22305
22305
|
}
|
|
22306
|
-
function re(e, t,
|
|
22307
|
-
let c = (t.defaultFontSize ?? 18) *
|
|
22306
|
+
function re(e, t, r, i, a, o, s) {
|
|
22307
|
+
let c = (t.defaultFontSize ?? 18) * n * o;
|
|
22308
22308
|
for (let l of t.paragraphs) {
|
|
22309
|
-
let u = k(l.marL, o), d = k(l.marR, o), f = k(l.indent, o), p = Math.max(0, f), m =
|
|
22310
|
-
for (let
|
|
22311
|
-
if (
|
|
22312
|
-
let i =
|
|
22313
|
-
if (e.font = W(
|
|
22309
|
+
let u = k(l.marL, o), d = k(l.marR, o), f = k(l.indent, o), p = Math.max(0, f), m = r - i - a - u - d - p, h = 0;
|
|
22310
|
+
for (let r of l.runs) {
|
|
22311
|
+
if (r.type !== "text") continue;
|
|
22312
|
+
let i = r.fontSize == null ? l.defFontSize == null ? c : l.defFontSize * n * o : r.fontSize * n * o, a = H(r.fontFamily ?? l.defFontFamily ?? null, s);
|
|
22313
|
+
if (e.font = W(r.bold ?? l.defBold ?? t.defaultBold ?? !1, r.italic ?? l.defItalic ?? t.defaultItalic ?? !1, i, a, s), h += e.measureText(r.text).width, h > m) return !0;
|
|
22314
22314
|
}
|
|
22315
22315
|
}
|
|
22316
22316
|
return !1;
|
|
22317
22317
|
}
|
|
22318
|
-
function ie(e, t,
|
|
22318
|
+
function ie(e, t, r, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
22319
22319
|
themeMajorFont: null,
|
|
22320
22320
|
themeMinorFont: null
|
|
22321
22321
|
}) {
|
|
@@ -22368,8 +22368,8 @@ function ie(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
22368
22368
|
continue;
|
|
22369
22369
|
}
|
|
22370
22370
|
if (p.type === "math") {
|
|
22371
|
-
let e = P.get(p.nodes), t = p.fontSize == null ? i : p.fontSize *
|
|
22372
|
-
(p.display && h > 0 || h + s >
|
|
22371
|
+
let e = P.get(p.nodes), t = p.fontSize == null ? i : p.fontSize * n * o * u, s = e ? e.widthEm * t : 0, c = e ? e.ascentEm * t : 0, l = e ? e.descentEm * t : 0;
|
|
22372
|
+
(p.display && h > 0 || h + s > r && h > 0) && y(), m.segments.push({
|
|
22373
22373
|
text: "",
|
|
22374
22374
|
font: `${t}px sans-serif`,
|
|
22375
22375
|
sizePx: t,
|
|
@@ -22386,7 +22386,7 @@ function ie(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
22386
22386
|
}), h += s, p.display && y();
|
|
22387
22387
|
continue;
|
|
22388
22388
|
}
|
|
22389
|
-
let x = p.fontSize == null ? i : p.fontSize *
|
|
22389
|
+
let x = p.fontSize == null ? i : p.fontSize * n * o * u, S = H(p.fontFamily ?? t.defFontFamily ?? null, f), C = p.fontFamilyEa ? H(p.fontFamilyEa, f) : null, w;
|
|
22390
22390
|
w = p.color ? A(p.color) : p.hyperlink && f.themeHlinkColor ? A(f.themeHlinkColor) : a;
|
|
22391
22391
|
let T = p.bold ?? t.defBold ?? c, E = p.italic ?? t.defItalic ?? l, D = W(T, E, x, S, f), O = C ? W(T, E, x, C, f) : D;
|
|
22392
22392
|
e.font = D;
|
|
@@ -22394,15 +22394,15 @@ function ie(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
22394
22394
|
(j === "all" || j === "small") && (M = M.toUpperCase());
|
|
22395
22395
|
let N = p.fieldType === "slidenum" && d !== void 0 ? String(d) : M, F = p.underline || p.hyperlink !== void 0, I = {
|
|
22396
22396
|
strikeDouble: p.strikeDouble === !0,
|
|
22397
|
-
letterSpacingPx: p.letterSpacing == null ? 0 : p.letterSpacing *
|
|
22397
|
+
letterSpacingPx: p.letterSpacing == null ? 0 : p.letterSpacing * n * o,
|
|
22398
22398
|
underlineStyle: p.underlineStyle,
|
|
22399
22399
|
underlineColor: p.underlineColor ? A(p.underlineColor) : void 0,
|
|
22400
22400
|
shadow: p.shadow,
|
|
22401
22401
|
outline: p.outline
|
|
22402
22402
|
}, L = N.split(/(\s+)/);
|
|
22403
|
-
for (let
|
|
22404
|
-
if (!
|
|
22405
|
-
if (/^\t+$/.test(
|
|
22403
|
+
for (let n of L) {
|
|
22404
|
+
if (!n) continue;
|
|
22405
|
+
if (/^\t+$/.test(n)) {
|
|
22406
22406
|
let e = s + h, n = (t.tabStops ?? []).find((t) => k(t.pos, o) > e);
|
|
22407
22407
|
n ? (v = k(n.pos, o), n.algn === "r" || n.algn === "ctr" ? (_ = !0, m.tabStop = {
|
|
22408
22408
|
px: v,
|
|
@@ -22412,31 +22412,31 @@ function ie(e, t, n, i, a, o, s, c = !1, l = !1, u = 1, d, f = {
|
|
|
22412
22412
|
continue;
|
|
22413
22413
|
}
|
|
22414
22414
|
e.font = D;
|
|
22415
|
-
let i = e.measureText(
|
|
22415
|
+
let i = e.measureText(n).width, a = /^\s+$/.test(n);
|
|
22416
22416
|
if (_) {
|
|
22417
|
-
b(
|
|
22417
|
+
b(n, D, x, w, F, p.strikethrough, p.baseline ?? void 0, I);
|
|
22418
22418
|
continue;
|
|
22419
22419
|
}
|
|
22420
22420
|
let c = /[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF]/;
|
|
22421
|
-
if (c.test(
|
|
22422
|
-
for (let t of
|
|
22423
|
-
let
|
|
22424
|
-
e.font =
|
|
22421
|
+
if (c.test(n)) {
|
|
22422
|
+
for (let t of n) {
|
|
22423
|
+
let n = c.test(t) ? O : D;
|
|
22424
|
+
e.font = n;
|
|
22425
22425
|
let i = e.measureText(t).width;
|
|
22426
|
-
h + i >
|
|
22426
|
+
h + i > r && h > 0 && y(), b(t, n, x, w, F, p.strikethrough, p.baseline ?? void 0, I);
|
|
22427
22427
|
}
|
|
22428
22428
|
continue;
|
|
22429
22429
|
}
|
|
22430
|
-
if (h + i <=
|
|
22430
|
+
if (h + i <= r) b(n, D, x, w, F, p.strikethrough, p.baseline ?? void 0, I), a && (g = !0);
|
|
22431
22431
|
else if (a) h > 0 && y();
|
|
22432
|
-
else if (i >
|
|
22432
|
+
else if (i > r) {
|
|
22433
22433
|
h > 0 && y();
|
|
22434
|
-
for (let t of
|
|
22434
|
+
for (let t of n) {
|
|
22435
22435
|
e.font = D;
|
|
22436
|
-
let
|
|
22437
|
-
h +
|
|
22436
|
+
let n = e.measureText(t).width;
|
|
22437
|
+
h + n > r && h > 0 && y(), b(t, D, x, w, F, p.strikethrough, p.baseline ?? void 0, I);
|
|
22438
22438
|
}
|
|
22439
|
-
} else g && y(), b(
|
|
22439
|
+
} else g && y(), b(n, D, x, w, F, p.strikethrough, p.baseline ?? void 0, I);
|
|
22440
22440
|
}
|
|
22441
22441
|
}
|
|
22442
22442
|
return p.push(m), p;
|
|
@@ -22489,16 +22489,16 @@ function ce(e, t, n, r = "#000000", i, a = {
|
|
|
22489
22489
|
themeMajorFont: null,
|
|
22490
22490
|
themeMinorFont: null
|
|
22491
22491
|
}, o) {
|
|
22492
|
-
let s = k(t.x, n), c = k(t.y, n),
|
|
22493
|
-
if (
|
|
22494
|
-
if (t.stroke && (e.save(), X(e, t.stroke, n), e.beginPath(), e.moveTo(s, c), e.lineTo(s +
|
|
22495
|
-
let
|
|
22496
|
-
q(e, t.textBody, s, c,
|
|
22492
|
+
let s = k(t.x, n), c = k(t.y, n), l = k(t.width, n), u = k(t.height, n);
|
|
22493
|
+
if (u === 0 && t.textBody?.verticalAnchor === "b") {
|
|
22494
|
+
if (t.stroke && (e.save(), X(e, t.stroke, n), e.beginPath(), e.moveTo(s, c), e.lineTo(s + l, c), e.stroke(), e.restore()), t.textBody) {
|
|
22495
|
+
let d = t.defaultTextColor ? A(t.defaultTextColor) : null;
|
|
22496
|
+
q(e, t.textBody, s, c, l, u, n, d, t.rotation, t.flipH, t.flipV, r, i, a, o);
|
|
22497
22497
|
}
|
|
22498
22498
|
return;
|
|
22499
22499
|
}
|
|
22500
|
-
e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(s +
|
|
22501
|
-
let
|
|
22500
|
+
e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(s + l / 2, c + u / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(s + l / 2), -(c + u / 2)));
|
|
22501
|
+
let d = t.geometry.toLowerCase(), p = M(t.fill, e, s, c, l, u);
|
|
22502
22502
|
oe(e, t.shadow ?? null, n), t.shadow || G(e, t.glow ?? null, n);
|
|
22503
22503
|
let m = new Set([
|
|
22504
22504
|
"line",
|
|
@@ -22519,7 +22519,7 @@ function ce(e, t, n, r = "#000000", i, a = {
|
|
|
22519
22519
|
]), g = t.stroke ? () => {
|
|
22520
22520
|
X(e, t.stroke, n), e.stroke();
|
|
22521
22521
|
} : null;
|
|
22522
|
-
if (!t.custGeom &&
|
|
22522
|
+
if (!t.custGeom && d !== "arc" && S(d) ? E(e, d, s, c, l, u, [
|
|
22523
22523
|
t.adj,
|
|
22524
22524
|
t.adj2,
|
|
22525
22525
|
t.adj3,
|
|
@@ -22528,8 +22528,8 @@ function ce(e, t, n, r = "#000000", i, a = {
|
|
|
22528
22528
|
t.adj6,
|
|
22529
22529
|
t.adj7,
|
|
22530
22530
|
t.adj8
|
|
22531
|
-
], p, g, () => K(e)) : (e.beginPath(), t.custGeom && t.custGeom.length > 0 ? le(e, t.custGeom, s, c,
|
|
22532
|
-
let r = D(
|
|
22531
|
+
], p, g, () => K(e)) : (e.beginPath(), t.custGeom && t.custGeom.length > 0 ? le(e, t.custGeom, s, c, l, u) : f(e, d, s, c, l, u, t.adj, t.adj2, t.adj3, t.adj4), p && d !== "arc" && (e.fillStyle = p, d === "donut" || d === "smileyface" || d === "frame" ? e.fill("evenodd") : e.fill(), K(e)), g && g()), t.stroke && m.has(d)) {
|
|
22532
|
+
let r = D(d, s, c, l, u, [
|
|
22533
22533
|
t.adj,
|
|
22534
22534
|
t.adj2,
|
|
22535
22535
|
t.adj3,
|
|
@@ -22541,32 +22541,32 @@ function ce(e, t, n, r = "#000000", i, a = {
|
|
|
22541
22541
|
]);
|
|
22542
22542
|
if (r) {
|
|
22543
22543
|
let i = t.stroke.cmpd;
|
|
22544
|
-
i && (
|
|
22544
|
+
i && (d === "line" || d === "straightconnector1") && ge(e, r.start, r.end, t.stroke, i, n), t.stroke.tailEnd && Y(e, r.end.x, r.end.y, r.end.angle, t.stroke.tailEnd, t.stroke, n), t.stroke.headEnd && Y(e, r.start.x, r.start.y, r.start.angle, t.stroke.headEnd, t.stroke, n);
|
|
22545
22545
|
}
|
|
22546
|
-
} else if (t.stroke && h.has(
|
|
22547
|
-
let r = (t.adj2 ?? -8333) / 1e5, i = (t.adj ?? 18750) / 1e5, a = (t.adj4 ?? -38333) / 1e5, o = (t.adj3 ?? 112500) / 1e5,
|
|
22548
|
-
t.stroke.tailEnd && Y(e, p, m, h, t.stroke.tailEnd, t.stroke, n), t.stroke.headEnd && Y(e,
|
|
22546
|
+
} else if (t.stroke && h.has(d)) {
|
|
22547
|
+
let r = (t.adj2 ?? -8333) / 1e5, i = (t.adj ?? 18750) / 1e5, a = (t.adj4 ?? -38333) / 1e5, o = (t.adj3 ?? 112500) / 1e5, d = s + r * l, f = c + i * u, p = s + a * l, m = c + o * u, h = Math.atan2(m - f, p - d), g = h + Math.PI;
|
|
22548
|
+
t.stroke.tailEnd && Y(e, p, m, h, t.stroke.tailEnd, t.stroke, n), t.stroke.headEnd && Y(e, d, f, g, t.stroke.headEnd, t.stroke, n);
|
|
22549
22549
|
}
|
|
22550
22550
|
if (t.textBody) {
|
|
22551
|
-
let
|
|
22551
|
+
let f = t.defaultTextColor ? A(t.defaultTextColor) : null;
|
|
22552
22552
|
if (e.save(), t.flipH || t.flipV) {
|
|
22553
|
-
let n = s +
|
|
22553
|
+
let n = s + l / 2, r = c + u / 2;
|
|
22554
22554
|
e.translate(n, r), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-n, -r);
|
|
22555
22555
|
}
|
|
22556
|
-
let p = s, m = c, h =
|
|
22556
|
+
let p = s, m = c, h = l, g = u;
|
|
22557
22557
|
if (t.textRect) p = k(t.textRect.x, n), m = k(t.textRect.y, n), h = k(t.textRect.width, n), g = k(t.textRect.height, n);
|
|
22558
|
-
else if (
|
|
22559
|
-
let e =
|
|
22560
|
-
p = s + e, m = c + t, h =
|
|
22558
|
+
else if (d === "ellipse") {
|
|
22559
|
+
let e = l * (1 - 1 / Math.SQRT2) / 2, t = u * (1 - 1 / Math.SQRT2) / 2;
|
|
22560
|
+
p = s + e, m = c + t, h = l / Math.SQRT2, g = u / Math.SQRT2;
|
|
22561
22561
|
} else {
|
|
22562
|
-
let e = se(
|
|
22562
|
+
let e = se(d, s, c, l, u, t.adj, t.adj2);
|
|
22563
22563
|
e && (p = e.tx, m = e.ty, h = e.tw, g = e.th);
|
|
22564
22564
|
}
|
|
22565
|
-
q(e, t.textBody, p, m, h, g, n,
|
|
22565
|
+
q(e, t.textBody, p, m, h, g, n, f, t.rotation, !1, !1, r, i, a, o), e.restore();
|
|
22566
22566
|
}
|
|
22567
22567
|
e.restore();
|
|
22568
22568
|
}
|
|
22569
|
-
var le =
|
|
22569
|
+
var le = c;
|
|
22570
22570
|
function ue(e, t) {
|
|
22571
22571
|
let n = `${e}`, r = e >= 1 && e <= 26 ? String.fromCharCode(96 + e) : n, i = e >= 1 && e <= 26 ? String.fromCharCode(64 + e) : n, a = de(e).toLowerCase(), o = de(e), s = n.replace(/[0-9]/g, (e) => String.fromCharCode(65296 + (e.charCodeAt(0) - 48)));
|
|
22572
22572
|
switch (t) {
|
|
@@ -22628,36 +22628,36 @@ function de(e) {
|
|
|
22628
22628
|
for (let i = 0; i < t.length; i++) for (; e >= t[i];) r += n[i], e -= t[i];
|
|
22629
22629
|
return r;
|
|
22630
22630
|
}
|
|
22631
|
-
function q(e, t,
|
|
22631
|
+
function q(e, t, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000", p, m = {
|
|
22632
22632
|
themeMajorFont: null,
|
|
22633
22633
|
themeMinorFont: null
|
|
22634
22634
|
}, h) {
|
|
22635
22635
|
let g = t.vert === "vert" || t.vert === "eaVert", _ = t.vert === "vert270";
|
|
22636
22636
|
if (g || _) {
|
|
22637
|
-
let
|
|
22637
|
+
let n = r + a / 2, u = i + o / 2, d = g ? 90 : -90, v = h ? (e) => h({
|
|
22638
22638
|
...e,
|
|
22639
22639
|
inShapeX: e.inShapeX - o / 2 + a / 2,
|
|
22640
22640
|
inShapeY: e.inShapeY - a / 2 + o / 2,
|
|
22641
|
-
shapeX:
|
|
22641
|
+
shapeX: r,
|
|
22642
22642
|
shapeY: i,
|
|
22643
22643
|
shapeW: a,
|
|
22644
22644
|
shapeH: o,
|
|
22645
22645
|
rotation: l,
|
|
22646
22646
|
textBodyRotation: d
|
|
22647
22647
|
}) : void 0;
|
|
22648
|
-
e.save(), e.translate(
|
|
22648
|
+
e.save(), e.translate(n, u), e.rotate(_ ? -Math.PI / 2 : Math.PI / 2), q(e, {
|
|
22649
22649
|
...t,
|
|
22650
22650
|
vert: "horz"
|
|
22651
22651
|
}, -o / 2, -a / 2, o, a, s, c, 0, !1, !1, f, p, m, v), e.restore();
|
|
22652
22652
|
return;
|
|
22653
22653
|
}
|
|
22654
22654
|
let v = k(t.lIns, s), y = k(t.rIns, s), b = k(t.tIns, s), x = k(t.bIns, s), S = t.wrap !== "none", C = t.autoFit === "sp" ? S && re(e, t, a, v, y, s, m) : S, w = Math.max(1, t.numCol ?? 1), T = k(t.spcCol ?? 0, s), E = t.defaultBold ?? !1, D = t.defaultItalic ?? !1, O = c ?? f, j = (i) => {
|
|
22655
|
-
let o = (t.defaultFontSize ?? 18) *
|
|
22655
|
+
let o = (t.defaultFontSize ?? 18) * n * s * i, c = [], l = 0, u = /* @__PURE__ */ new Map();
|
|
22656
22656
|
for (let d = 0; d < t.paragraphs.length; d++) {
|
|
22657
|
-
let f = t.paragraphs[d], h = k(f.marL, s), g = k(f.marR, s), _ = k(f.indent, s), b = f.defFontSize == null ? o : f.defFontSize *
|
|
22657
|
+
let f = t.paragraphs[d], h = k(f.marL, s), g = k(f.marR, s), _ = k(f.indent, s), b = f.defFontSize == null ? o : f.defFontSize * n * s * i, x = f.defColor ? A(f.defColor) : O, S = f.bullet.type === "char" || f.bullet.type === "autoNum", j = (() => {
|
|
22658
22658
|
for (let e of f.runs) if (e.type === "text" && e.fontSize != null) return e.fontSize;
|
|
22659
22659
|
return null;
|
|
22660
|
-
})(), M = j == null ? b : j *
|
|
22660
|
+
})(), M = j == null ? b : j * n * s * i, N = (() => {
|
|
22661
22661
|
for (let e of f.runs) if (e.type === "text" && e.color) return e.color;
|
|
22662
22662
|
return null;
|
|
22663
22663
|
})(), P = N ? A(N) : x, F = "", I = W(!1, !1, M, "sans-serif", m), L = P;
|
|
@@ -22668,9 +22668,9 @@ function q(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
22668
22668
|
let e = f.bullet, t = f.lvl;
|
|
22669
22669
|
u.has(t) ? u.set(t, u.get(t) + 1) : u.set(t, e.startAt ?? 1), F = ue(u.get(t), e.numType), I = W(!1, !1, M, "sans-serif", m), L = P;
|
|
22670
22670
|
} else u.clear();
|
|
22671
|
-
let R = w > 1 ? (a - v - y - (w - 1) * T) / w : a - v - y, z =
|
|
22672
|
-
for (let
|
|
22673
|
-
let i = U[
|
|
22671
|
+
let R = w > 1 ? (a - v - y - (w - 1) * T) / w : a - v - y, z = r + v + h, B = r + v + h + _, V = R - h - g, U = ie(e, f, C ? V : Infinity, b, x, s, h, E, D, i, p, m), te = f.spaceBefore == null ? 0 : f.spaceBefore / 100 * n * s * i, ne = f.spaceAfter == null ? 0 : f.spaceAfter / 100 * n * s * i;
|
|
22672
|
+
for (let r = 0; r < U.length; r++) {
|
|
22673
|
+
let i = U[r], a = r === 0, o = r === U.length - 1, u = 0;
|
|
22674
22674
|
for (let e of i.segments) {
|
|
22675
22675
|
let t = e.math ? Math.max(e.sizePx, (e.math.ascent + e.math.descent) / 1.2) : e.sizePx;
|
|
22676
22676
|
t > u && (u = t);
|
|
@@ -22681,7 +22681,7 @@ function q(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
22681
22681
|
n > u && (u = n);
|
|
22682
22682
|
}
|
|
22683
22683
|
let p;
|
|
22684
|
-
p = f.spaceLine ? f.spaceLine.type === "pct" ? u * 1.2 * (f.spaceLine.val / 1e5) : f.spaceLine.val *
|
|
22684
|
+
p = f.spaceLine ? f.spaceLine.type === "pct" ? u * 1.2 * (f.spaceLine.val / 1e5) : f.spaceLine.val * n * s : u * 1.2, t.autoFit === "norm" && t.lnSpcReduction != null && (p *= 1 - t.lnSpcReduction);
|
|
22685
22685
|
let m = p + (o ? ne : 0), h = a && d > 0 ? te : 0, g = !S && a ? _ : 0;
|
|
22686
22686
|
c.push({
|
|
22687
22687
|
line: i,
|
|
@@ -22723,10 +22723,10 @@ function q(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
22723
22723
|
B = L === "ctr" ? R + b + (V - I) / 2 : L === "b" ? R + z - x - I : R + b, e.save(), e.textAlign = "left", e.textBaseline = "alphabetic";
|
|
22724
22724
|
let U = B, te = w > 1 ? (a - v - y - (w - 1) * T) / w + T : 0, ne = Math.max(0, z - b - x), ae = o === 0 || I <= ne + .5, oe = w > 1 && !ae ? Math.ceil(M.length / w) : M.length, G = 0, K = 0;
|
|
22725
22725
|
for (let t of M) {
|
|
22726
|
-
let { line:
|
|
22726
|
+
let { line: n, linePx: c, lineHeight: u, topGapPx: d, textXOffset: f, bulletLabel: p, bulletFont: m, bulletColor: g, alignment: _ } = t;
|
|
22727
22727
|
w > 1 && G < w - 1 && K >= oe && (G++, K = 0, B = U), B += d, K++;
|
|
22728
22728
|
let y = G * te, b = t.textX + y, x = t.bulletX + y, S = t.textMaxW, C = 0, T = u * .8;
|
|
22729
|
-
for (let t of
|
|
22729
|
+
for (let t of n.segments) {
|
|
22730
22730
|
if (t.math) {
|
|
22731
22731
|
C += t.math.width, T = Math.max(T, t.math.ascent);
|
|
22732
22732
|
continue;
|
|
@@ -22739,7 +22739,7 @@ function q(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
22739
22739
|
p && (e.font = m, e.fillStyle = g, e.fillText(p, x, E));
|
|
22740
22740
|
let D = b + f, O;
|
|
22741
22741
|
O = _ === "ctr" ? D + (S - f - C) / 2 : _ === "r" ? b + S - C : D;
|
|
22742
|
-
for (let t of
|
|
22742
|
+
for (let t of n.segments) {
|
|
22743
22743
|
if (t.math) {
|
|
22744
22744
|
let n = P.get(t.math.nodes), r = t.math.width, i = t.math.ascent + t.math.descent;
|
|
22745
22745
|
if (n && r > 0 && i > 0) {
|
|
@@ -22750,75 +22750,75 @@ function q(e, t, n, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
|
|
|
22750
22750
|
continue;
|
|
22751
22751
|
}
|
|
22752
22752
|
e.font = t.font, e.fillStyle = t.color;
|
|
22753
|
-
let
|
|
22753
|
+
let n = E + (t.baseline ? -(t.baseline / 1e5) * t.sizePx : 0), c = t.letterSpacingPx ?? 0, d = t.shadow;
|
|
22754
22754
|
if (d) {
|
|
22755
22755
|
let t = d.dir * Math.PI / 180, n = k(d.dist, s);
|
|
22756
22756
|
e.save(), e.shadowColor = A(d.color, d.alpha), e.shadowBlur = k(d.blur, s), e.shadowOffsetX = Math.cos(t) * n, e.shadowOffsetY = Math.sin(t) * n;
|
|
22757
22757
|
}
|
|
22758
22758
|
if (c > 0 && t.text.length > 1) {
|
|
22759
|
-
let
|
|
22760
|
-
for (let i of t.text) e.fillText(i,
|
|
22761
|
-
} else e.fillText(t.text, O,
|
|
22759
|
+
let r = O;
|
|
22760
|
+
for (let i of t.text) e.fillText(i, r, n), r += e.measureText(i).width + c;
|
|
22761
|
+
} else e.fillText(t.text, O, n);
|
|
22762
22762
|
d && e.restore();
|
|
22763
22763
|
let f = t.outline;
|
|
22764
22764
|
if (f && f.width > 0) {
|
|
22765
22765
|
if (e.save(), e.lineWidth = Math.max(.5, k(f.width, s)), e.strokeStyle = f.color ? `#${f.color}` : t.color, e.lineJoin = "round", c > 0 && t.text.length > 1) {
|
|
22766
|
-
let
|
|
22767
|
-
for (let i of t.text) e.strokeText(i,
|
|
22768
|
-
} else e.strokeText(t.text, O,
|
|
22766
|
+
let r = O;
|
|
22767
|
+
for (let i of t.text) e.strokeText(i, r, n), r += e.measureText(i).width + c;
|
|
22768
|
+
} else e.strokeText(t.text, O, n);
|
|
22769
22769
|
e.restore();
|
|
22770
22770
|
}
|
|
22771
22771
|
e.font = t.font;
|
|
22772
22772
|
let p = e.measureText(t.text).width + (c > 0 ? c * t.text.length : 0);
|
|
22773
22773
|
if (h && t.text && h({
|
|
22774
22774
|
text: t.text,
|
|
22775
|
-
inShapeX: O -
|
|
22775
|
+
inShapeX: O - r,
|
|
22776
22776
|
inShapeY: B - i,
|
|
22777
22777
|
w: p,
|
|
22778
22778
|
h: u,
|
|
22779
22779
|
fontSize: t.sizePx,
|
|
22780
22780
|
font: t.font,
|
|
22781
|
-
shapeX:
|
|
22781
|
+
shapeX: r,
|
|
22782
22782
|
shapeY: i,
|
|
22783
22783
|
shapeW: a,
|
|
22784
22784
|
shapeH: o,
|
|
22785
22785
|
rotation: l
|
|
22786
|
-
}), t.underline && N(e, O,
|
|
22787
|
-
let
|
|
22788
|
-
if (e.strokeStyle = t.color, e.lineWidth =
|
|
22789
|
-
let i =
|
|
22786
|
+
}), t.underline && N(e, O, n, p, t.sizePx, t.underlineColor ?? t.color, t.underlineStyle), t.strikethrough) {
|
|
22787
|
+
let r = Math.max(1, t.sizePx * .05);
|
|
22788
|
+
if (e.strokeStyle = t.color, e.lineWidth = r, e.setLineDash([]), t.strikeDouble) {
|
|
22789
|
+
let i = r * .9, a = n - t.sizePx * .32;
|
|
22790
22790
|
e.beginPath(), e.moveTo(O, a - i), e.lineTo(O + p, a - i), e.moveTo(O, a + i), e.lineTo(O + p, a + i), e.stroke();
|
|
22791
|
-
} else e.beginPath(), e.moveTo(O,
|
|
22791
|
+
} else e.beginPath(), e.moveTo(O, n - t.sizePx * .32), e.lineTo(O + p, n - t.sizePx * .32), e.stroke();
|
|
22792
22792
|
}
|
|
22793
22793
|
O += p;
|
|
22794
22794
|
}
|
|
22795
|
-
if (
|
|
22796
|
-
let t =
|
|
22797
|
-
for (let t of
|
|
22795
|
+
if (n.tabStop && n.tabStop.segments.length > 0) {
|
|
22796
|
+
let t = r + v + n.tabStop.px, s = 0;
|
|
22797
|
+
for (let t of n.tabStop.segments) {
|
|
22798
22798
|
e.font = t.font;
|
|
22799
22799
|
let n = t.letterSpacingPx ?? 0;
|
|
22800
22800
|
s += e.measureText(t.text).width + n * t.text.length;
|
|
22801
22801
|
}
|
|
22802
22802
|
let c;
|
|
22803
|
-
c =
|
|
22804
|
-
for (let t of
|
|
22803
|
+
c = n.tabStop.algn === "r" ? t - s : n.tabStop.algn === "ctr" ? t - s / 2 : t;
|
|
22804
|
+
for (let t of n.tabStop.segments) {
|
|
22805
22805
|
e.font = t.font, e.fillStyle = t.color;
|
|
22806
|
-
let
|
|
22807
|
-
if (
|
|
22808
|
-
let
|
|
22809
|
-
for (let i of t.text) e.fillText(i,
|
|
22806
|
+
let n = t.letterSpacingPx ?? 0;
|
|
22807
|
+
if (n > 0 && t.text.length > 1) {
|
|
22808
|
+
let r = c;
|
|
22809
|
+
for (let i of t.text) e.fillText(i, r, E), r += e.measureText(i).width + n;
|
|
22810
22810
|
} else e.fillText(t.text, c, E);
|
|
22811
22811
|
e.font = t.font;
|
|
22812
|
-
let s = e.measureText(t.text).width +
|
|
22812
|
+
let s = e.measureText(t.text).width + n * t.text.length;
|
|
22813
22813
|
h && t.text && h({
|
|
22814
22814
|
text: t.text,
|
|
22815
|
-
inShapeX: c -
|
|
22815
|
+
inShapeX: c - r,
|
|
22816
22816
|
inShapeY: B - i,
|
|
22817
22817
|
w: s,
|
|
22818
22818
|
h: u,
|
|
22819
22819
|
fontSize: t.sizePx,
|
|
22820
22820
|
font: t.font,
|
|
22821
|
-
shapeX:
|
|
22821
|
+
shapeX: r,
|
|
22822
22822
|
shapeY: i,
|
|
22823
22823
|
shapeW: a,
|
|
22824
22824
|
shapeH: o,
|
|
@@ -22944,7 +22944,7 @@ function Y(e, t, n, r, i, a, o) {
|
|
|
22944
22944
|
e.restore();
|
|
22945
22945
|
}
|
|
22946
22946
|
function X(e, t, n) {
|
|
22947
|
-
|
|
22947
|
+
u(e, t, n);
|
|
22948
22948
|
}
|
|
22949
22949
|
function _e(e, t, n, r, i = {
|
|
22950
22950
|
themeMajorFont: null,
|
|
@@ -22969,8 +22969,8 @@ function _e(e, t, n, r, i = {
|
|
|
22969
22969
|
l += d;
|
|
22970
22970
|
}
|
|
22971
22971
|
}
|
|
22972
|
-
async function ve(e, t,
|
|
22973
|
-
let c = a.width ?? ((e instanceof HTMLCanvasElement ? e.offsetWidth : 0) || 960), l = c /
|
|
22972
|
+
async function ve(e, t, r, i, a = {}, o) {
|
|
22973
|
+
let c = a.width ?? ((e instanceof HTMLCanvasElement ? e.offsetWidth : 0) || 960), l = c / r, u = Math.round(c), d = Math.round(i * l), f = a.dpr ?? (typeof window < "u" && window.devicePixelRatio || 1);
|
|
22974
22974
|
e.width = u * f, e.height = d * f, typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement && (e.style.width = `${u}px`, e.style.display || (e.style.display = "block"));
|
|
22975
22975
|
let p = e.getContext("2d");
|
|
22976
22976
|
if (!p) throw Error("Could not get 2D context");
|
|
@@ -22982,13 +22982,13 @@ async function ve(e, t, n, i, a = {}, s) {
|
|
|
22982
22982
|
};
|
|
22983
22983
|
ae(p, t.background, u, d), a.math && await B(t, a.math);
|
|
22984
22984
|
let h = a.defaultTextColor ? `#${a.defaultTextColor}` : "#000000", g = t.slideNumber;
|
|
22985
|
-
for (let e of t.elements) if (e.type === "shape") ce(p, e, l, h, g, m,
|
|
22985
|
+
for (let e of t.elements) if (e.type === "shape") ce(p, e, l, h, g, m, o);
|
|
22986
22986
|
else if (e.type === "picture") await me(p, e, l);
|
|
22987
22987
|
else if (e.type === "table") _e(p, e, l, g, m);
|
|
22988
22988
|
else if (e.type === "media") await he(p, e, l, a.fetchMedia, a.skipMediaControls);
|
|
22989
22989
|
else if (e.type === "chart") {
|
|
22990
|
-
let t =
|
|
22991
|
-
|
|
22990
|
+
let t = n * l;
|
|
22991
|
+
s(p, {
|
|
22992
22992
|
chartType: e.chartType,
|
|
22993
22993
|
title: e.title,
|
|
22994
22994
|
categories: e.categories,
|
|
@@ -23309,7 +23309,7 @@ var ze = "data:application/wasm;base64,AGFzbQEAAAAB8QIwYAJ/fwF/YAJ/fwBgA39/fwBgA
|
|
|
23309
23309
|
_workerReady = !1;
|
|
23310
23310
|
_workerReadyCallbacks = [];
|
|
23311
23311
|
constructor() {
|
|
23312
|
-
this._worker = new Re(), this._bridge = new
|
|
23312
|
+
this._worker = new Re(), this._bridge = new o(this._worker, {
|
|
23313
23313
|
correlate: (e) => "id" in e ? e.id : void 0,
|
|
23314
23314
|
toError: (e) => e.kind === "error" ? e.message : void 0,
|
|
23315
23315
|
onUnsolicited: (e) => {
|
|
@@ -23326,16 +23326,16 @@ var ze = "data:application/wasm;base64,AGFzbQEAAAAB8QIwYAJ/fwF/YAJ/fwBgA39/fwBgA
|
|
|
23326
23326
|
wasmUrl: e
|
|
23327
23327
|
});
|
|
23328
23328
|
}
|
|
23329
|
-
static async load(t,
|
|
23330
|
-
let
|
|
23329
|
+
static async load(t, n = {}) {
|
|
23330
|
+
let r = new e(), i;
|
|
23331
23331
|
if (typeof t == "string") {
|
|
23332
23332
|
let e = await fetch(t);
|
|
23333
23333
|
if (!e.ok) throw Error(`Failed to fetch: ${e.status} ${e.statusText}`);
|
|
23334
|
-
|
|
23335
|
-
} else
|
|
23336
|
-
await
|
|
23337
|
-
let o =
|
|
23338
|
-
return
|
|
23334
|
+
i = await e.arrayBuffer();
|
|
23335
|
+
} else i = t;
|
|
23336
|
+
await r._parse(i, n.maxZipEntryBytes);
|
|
23337
|
+
let o = r._presentation;
|
|
23338
|
+
return n.useGoogleFonts && o && await a([o.majorFont, o.minorFont], Be), r;
|
|
23339
23339
|
}
|
|
23340
23340
|
_waitForWorker() {
|
|
23341
23341
|
return this._workerReady ? Promise.resolve() : new Promise((e) => this._workerReadyCallbacks.push(e));
|
|
@@ -23510,10 +23510,10 @@ var ze = "data:application/wasm;base64,AGFzbQEAAAAB8QIwYAJ/fwF/YAJ/fwBgA39/fwBgA
|
|
|
23510
23510
|
destroy() {
|
|
23511
23511
|
this.handle?.dispose(), this.handle = null, this.engine?.destroy(), this.wrapper.remove();
|
|
23512
23512
|
}
|
|
23513
|
-
}, Ue = /* @__PURE__ */
|
|
23513
|
+
}, Ue = /* @__PURE__ */ t({
|
|
23514
23514
|
PptxPresentation: () => Ve,
|
|
23515
23515
|
PptxViewer: () => He,
|
|
23516
|
-
autoResize: () =>
|
|
23516
|
+
autoResize: () => i,
|
|
23517
23517
|
renderSlide: () => ve
|
|
23518
23518
|
});
|
|
23519
23519
|
//#endregion
|
package/dist/pptx.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as t, n, r } from "./pptx-
|
|
1
|
+
import { r as e } from "./bridge-BFwyMqvY.js";
|
|
2
|
+
import { i as t, n, r } from "./pptx-BlOPRzOV.js";
|
|
3
3
|
export { r as PptxPresentation, n as PptxViewer, e as autoResize, t as renderSlide };
|