pptx-svelte-viewer 4.1.6 → 4.3.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/CHANGELOG.md +38 -0
- package/dist/{AiChatPanel-C4TquPtV.js → AiChatPanel-6uxswiBd.js} +6 -6
- package/dist/{export-CKRGg8D0.js → export-CVIAWQ_T.js} +13054 -13068
- package/dist/i18n/de.cjs +2 -2
- package/dist/i18n/de.mjs +2 -2
- package/dist/i18n/es.cjs +2 -2
- package/dist/i18n/es.mjs +2 -2
- package/dist/i18n/fr.cjs +2 -2
- package/dist/i18n/fr.mjs +2 -2
- package/dist/i18n/zh-CN.cjs +2 -2
- package/dist/i18n/zh-CN.mjs +2 -2
- package/dist/i18n.js +1 -1
- package/dist/index.d.ts +278 -3
- package/dist/index.js +38 -38
- package/dist/internals.d.ts +230 -2
- package/dist/internals.js +21 -21
- package/dist/pptx-svelte-viewer.css +1 -1
- package/dist/{transition-overlay-DIPxa90i.js → transition-overlay-BmUNA9xJ.js} +60119 -51929
- package/dist/{translator-D7duxy6A.js → translator-BZ6HUBWJ.js} +2 -2
- package/dist/viewer/index.d.ts +357 -23
- package/dist/viewer/index.js +6 -6
- package/package.json +1 -1
- package/dist/canvas_emf-converter-CKs-EBwD.js +0 -5
- package/dist/smartart-3d-D1MLYTBe.js +0 -290
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
import { AmbientLight as U, BufferGeometry as V, CanvasTexture as Z, Color as E, DirectionalLight as C, EdgesGeometry as X, Euler as _, ExtrudeGeometry as j, Group as q, Line as J, LineBasicMaterial as B, LineSegments as K, LinearFilter as A, Mesh as Y, MeshBasicMaterial as Q, MeshStandardMaterial as tt, PerspectiveCamera as et, PlaneGeometry as nt, RepeatWrapping as ot, SRGBColorSpace as it, Scene as at, Shape as st, Vector3 as $, WebGLRenderer as rt } from "./three.module-BP1MPwgf.js";
|
|
2
|
-
import { OrbitControls as lt } from "./OrbitControls-Dj3MmTu8.js";
|
|
3
|
-
var F = 4, H = 0.86;
|
|
4
|
-
function ct(e, t, n) {
|
|
5
|
-
const o = t.split(/\s+/u).filter(Boolean);
|
|
6
|
-
if (o.length === 0) return [];
|
|
7
|
-
const s = [];
|
|
8
|
-
let i = o[0];
|
|
9
|
-
for (let a = 1; a < o.length; a++) {
|
|
10
|
-
const r = `${i} ${o[a]}`;
|
|
11
|
-
e.measureText(r).width <= n ? i = r : (s.push(i), i = o[a]);
|
|
12
|
-
}
|
|
13
|
-
return s.push(i), s;
|
|
14
|
-
}
|
|
15
|
-
function ft(e, t) {
|
|
16
|
-
const n = t?.bold === void 0 ? "600" : t.bold ? "700" : "400", o = t?.italic ? "italic " : "", s = typeof t?.fontScale == "number" && Number.isFinite(t.fontScale) && t.fontScale > 0 ? t.fontScale : 1;
|
|
17
|
-
return {
|
|
18
|
-
weight: n,
|
|
19
|
-
italic: o,
|
|
20
|
-
color: t?.color ?? e,
|
|
21
|
-
scale: s
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function dt(e, t, n, o, s, i) {
|
|
25
|
-
if (typeof document > "u" || !e.trim() || o <= 0 || s <= 0) return null;
|
|
26
|
-
const { weight: a, italic: r, color: c, scale: h } = ft(t, i), v = o * H, w = s * H, f = document.createElement("canvas");
|
|
27
|
-
f.width = Math.max(8, Math.round(v * F)), f.height = Math.max(8, Math.round(w * F));
|
|
28
|
-
const l = f.getContext("2d");
|
|
29
|
-
if (!l) return null;
|
|
30
|
-
const M = "system-ui, -apple-system, Segoe UI, Roboto, sans-serif", g = f.width * 0.94, m = (y) => `${r}${a} ${y}px ${M}`;
|
|
31
|
-
let p = Math.max(6, n) * h * F, b = [];
|
|
32
|
-
for (let y = 0; y < 12; y++) {
|
|
33
|
-
l.font = m(p), b = ct(l, e, g);
|
|
34
|
-
const x = p * 1.2;
|
|
35
|
-
if (b.length * x <= f.height * 0.96 || p <= 6 * F) break;
|
|
36
|
-
p *= 0.88;
|
|
37
|
-
}
|
|
38
|
-
l.clearRect(0, 0, f.width, f.height), l.fillStyle = c, l.textAlign = "center", l.textBaseline = "middle", l.font = m(p);
|
|
39
|
-
const d = p * 1.2, L = b.length * d, S = f.height / 2 - L / 2 + d / 2;
|
|
40
|
-
for (let y = 0; y < b.length; y++) {
|
|
41
|
-
const x = S + y * d;
|
|
42
|
-
if (l.fillText(b[y], f.width / 2, x), i?.underline) {
|
|
43
|
-
const z = l.measureText(b[y]).width;
|
|
44
|
-
l.strokeStyle = c, l.lineWidth = Math.max(1, p * 0.06), l.beginPath(), l.moveTo(f.width / 2 - z / 2, x + p * 0.32), l.lineTo(f.width / 2 + z / 2, x + p * 0.32), l.stroke();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const u = new Z(f);
|
|
48
|
-
return u.colorSpace = it, u.minFilter = A, u.magFilter = A, u.flipY = !1, u.premultiplyAlpha = !1, u.wrapT = ot, u.repeat.set(1, -1), u.offset.set(0, 1), u.needsUpdate = !0, {
|
|
49
|
-
texture: u,
|
|
50
|
-
worldWidth: v,
|
|
51
|
-
worldHeight: w
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function ht(e) {
|
|
55
|
-
const t = new st();
|
|
56
|
-
e.outline.forEach((o, s) => {
|
|
57
|
-
s === 0 ? t.moveTo(o.x, o.y) : t.lineTo(o.x, o.y);
|
|
58
|
-
}), t.closePath();
|
|
59
|
-
const n = e.bevel > 0;
|
|
60
|
-
return new j(t, {
|
|
61
|
-
depth: e.depth,
|
|
62
|
-
bevelEnabled: n,
|
|
63
|
-
bevelThickness: e.bevel,
|
|
64
|
-
bevelSize: e.bevel,
|
|
65
|
-
bevelSegments: 2,
|
|
66
|
-
curveSegments: e.rounded ? 24 : 1,
|
|
67
|
-
steps: 1
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function pt(e, t, n) {
|
|
71
|
-
const o = ht(n), s = new tt({
|
|
72
|
-
color: new E(n.fill),
|
|
73
|
-
metalness: 0.12,
|
|
74
|
-
roughness: 0.52,
|
|
75
|
-
transparent: n.opacity < 1,
|
|
76
|
-
opacity: n.opacity
|
|
77
|
-
}), i = new Y(o, s);
|
|
78
|
-
if (i.position.set(n.position.x, n.position.y, n.position.z), i.rotation.set(n.rotation.x, n.rotation.y, n.rotation.z), e.add(i), t.push(o, s), n.strokeWidth > 0) {
|
|
79
|
-
const a = new X(o, 30), r = new B({ color: new E(n.stroke) }), c = new K(a, r);
|
|
80
|
-
c.position.copy(i.position), c.rotation.copy(i.rotation), e.add(c), t.push(a, r);
|
|
81
|
-
}
|
|
82
|
-
return o;
|
|
83
|
-
}
|
|
84
|
-
function W(e, t) {
|
|
85
|
-
if (!e.text) return null;
|
|
86
|
-
const n = dt(e.text, e.textColor, e.fontSize, e.halfWidth * 2, e.halfHeight * 2, t);
|
|
87
|
-
if (!n) return null;
|
|
88
|
-
const o = new nt(n.worldWidth, n.worldHeight), s = new Q({
|
|
89
|
-
map: n.texture,
|
|
90
|
-
transparent: !0,
|
|
91
|
-
depthWrite: !1,
|
|
92
|
-
depthTest: !1,
|
|
93
|
-
side: 2
|
|
94
|
-
}), i = new Y(o, s);
|
|
95
|
-
i.renderOrder = 1;
|
|
96
|
-
const a = new _(e.rotation.x, e.rotation.y, e.rotation.z), r = new $(0, 0, e.depth + e.bevel + 0.4).applyEuler(a);
|
|
97
|
-
return i.position.set(e.position.x + r.x, e.position.y + r.y, e.position.z + r.z), i.rotation.copy(a), {
|
|
98
|
-
plane: i,
|
|
99
|
-
disposables: [
|
|
100
|
-
o,
|
|
101
|
-
s,
|
|
102
|
-
n.texture
|
|
103
|
-
]
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function ut(e, t, n) {
|
|
107
|
-
for (const o of n.connectors) {
|
|
108
|
-
if (o.points.length < 2) continue;
|
|
109
|
-
const s = new V().setFromPoints(o.points.map((a) => new $(a.x, a.y, a.z))), i = new B({
|
|
110
|
-
color: new E(o.color),
|
|
111
|
-
transparent: !0,
|
|
112
|
-
opacity: 0.7
|
|
113
|
-
});
|
|
114
|
-
e.add(new J(s, i)), t.push(s, i);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
function D(e, t) {
|
|
118
|
-
t.plane && e.remove(t.plane);
|
|
119
|
-
for (const n of t.disposables) n.dispose();
|
|
120
|
-
t.plane = null, t.disposables = [];
|
|
121
|
-
}
|
|
122
|
-
function xt(e, t) {
|
|
123
|
-
const n = new q(), o = [], s = e.meshes.map((i) => {
|
|
124
|
-
pt(n, o, i);
|
|
125
|
-
const a = W(i, t);
|
|
126
|
-
return a && n.add(a.plane), {
|
|
127
|
-
node: i,
|
|
128
|
-
plane: a?.plane ?? null,
|
|
129
|
-
disposables: a?.disposables ?? []
|
|
130
|
-
};
|
|
131
|
-
});
|
|
132
|
-
return ut(n, o, e), {
|
|
133
|
-
group: n,
|
|
134
|
-
setTextStyle(i) {
|
|
135
|
-
for (const a of s) {
|
|
136
|
-
D(n, a);
|
|
137
|
-
const r = W(a.node, i);
|
|
138
|
-
r && (n.add(r.plane), a.plane = r.plane, a.disposables = r.disposables);
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
forEachLabelPlane(i) {
|
|
142
|
-
for (const a of s) a.plane && i(a.plane);
|
|
143
|
-
},
|
|
144
|
-
dispose() {
|
|
145
|
-
for (const i of o) i.dispose();
|
|
146
|
-
for (const i of s) D(n, i);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
var I = 42;
|
|
151
|
-
function yt(e, t) {
|
|
152
|
-
const n = t.halfWidth + t.bevel, o = t.halfHeight + t.bevel, s = t.depth / 2 + t.bevel, i = t.position.z + t.depth / 2, a = Math.cos(t.rotation.y), r = Math.sin(t.rotation.y), c = Math.abs(n * a) + Math.abs(s * r), h = Math.abs(n * r) + Math.abs(s * a);
|
|
153
|
-
e(t.position.x, t.position.y, i, c, o, h);
|
|
154
|
-
}
|
|
155
|
-
function bt(e) {
|
|
156
|
-
let t = 1 / 0, n = 1 / 0, o = 1 / 0, s = -1 / 0, i = -1 / 0, a = -1 / 0;
|
|
157
|
-
const r = (c, h, v, w, f, l) => {
|
|
158
|
-
t = Math.min(t, c - w), n = Math.min(n, h - f), o = Math.min(o, v - l), s = Math.max(s, c + w), i = Math.max(i, h + f), a = Math.max(a, v + l);
|
|
159
|
-
};
|
|
160
|
-
for (const c of e.meshes) yt(r, c);
|
|
161
|
-
for (const c of e.connectors) for (const h of c.points) r(h.x, h.y, h.z, 1, 1, 1);
|
|
162
|
-
if (!Number.isFinite(t)) {
|
|
163
|
-
const c = e.bounds.width / 2 || 1, h = e.bounds.height / 2 || 1;
|
|
164
|
-
return {
|
|
165
|
-
cx: 0,
|
|
166
|
-
cy: 0,
|
|
167
|
-
cz: 0,
|
|
168
|
-
radius: Math.max(c, h),
|
|
169
|
-
halfW: c,
|
|
170
|
-
halfH: h,
|
|
171
|
-
halfD: 1
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
return {
|
|
175
|
-
cx: (t + s) / 2,
|
|
176
|
-
cy: (n + i) / 2,
|
|
177
|
-
cz: (o + a) / 2,
|
|
178
|
-
radius: 0.5 * Math.hypot(s - t, i - n, a - o) || 1,
|
|
179
|
-
halfW: (s - t) / 2,
|
|
180
|
-
halfH: (i - n) / 2,
|
|
181
|
-
halfD: (a - o) / 2
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
function wt(e, t) {
|
|
185
|
-
const n = I * Math.PI / 180, o = 2 * Math.atan(Math.tan(n / 2) * t);
|
|
186
|
-
return e / Math.sin(Math.min(n, o) / 2) * 1.1;
|
|
187
|
-
}
|
|
188
|
-
var Mt = 0.92;
|
|
189
|
-
function G(e, t, n) {
|
|
190
|
-
const { cx: o, cy: s, cz: i, radius: a } = e, r = St(t, a, n);
|
|
191
|
-
return {
|
|
192
|
-
position: [
|
|
193
|
-
o + a * 0.25,
|
|
194
|
-
s + r,
|
|
195
|
-
i + n
|
|
196
|
-
],
|
|
197
|
-
target: [
|
|
198
|
-
o,
|
|
199
|
-
s,
|
|
200
|
-
i
|
|
201
|
-
],
|
|
202
|
-
dist: n
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
function gt(e, t, n) {
|
|
206
|
-
const o = I * Math.PI / 180, s = Math.tan(o / 2), i = s * n, [a, r, c] = t.position, [h, v, w] = t.target;
|
|
207
|
-
let f = h - a, l = v - r, M = w - c;
|
|
208
|
-
const g = Math.hypot(f, l, M) || 1;
|
|
209
|
-
f /= g, l /= g, M /= g;
|
|
210
|
-
let m = -M, p = f;
|
|
211
|
-
const b = Math.hypot(m, p) || 1;
|
|
212
|
-
m /= b, p /= b;
|
|
213
|
-
const d = -p * l, L = p * f - m * M, S = m * l;
|
|
214
|
-
let u = 0;
|
|
215
|
-
for (const y of [-1, 1]) for (const x of [-1, 1]) for (const z of [-1, 1]) {
|
|
216
|
-
const P = e.cx + y * e.halfW - a, R = e.cy + x * e.halfH - r, T = e.cz + z * e.halfD - c, k = P * f + R * l + T * M;
|
|
217
|
-
if (k <= 1e-6) return 1 / 0;
|
|
218
|
-
const O = Math.abs(P * m + T * p) / (k * i), N = Math.abs(P * d + R * L + T * S) / (k * s);
|
|
219
|
-
u = Math.max(u, O, N);
|
|
220
|
-
}
|
|
221
|
-
return u;
|
|
222
|
-
}
|
|
223
|
-
function vt(e, t, n) {
|
|
224
|
-
let o = wt(e.radius, n), s = G(e, t, o);
|
|
225
|
-
for (let i = 0; i < 8; i++) {
|
|
226
|
-
const a = gt(e, s, n);
|
|
227
|
-
if (!Number.isFinite(a)) o *= 2;
|
|
228
|
-
else {
|
|
229
|
-
const r = a / Mt;
|
|
230
|
-
if (Math.abs(r - 1) < 0.01) break;
|
|
231
|
-
o *= r;
|
|
232
|
-
}
|
|
233
|
-
s = G(e, t, o);
|
|
234
|
-
}
|
|
235
|
-
return s;
|
|
236
|
-
}
|
|
237
|
-
var mt = 34;
|
|
238
|
-
function St(e, t, n) {
|
|
239
|
-
return e === "cycle" || e === "radial" ? n * Math.tan(mt * Math.PI / 180) : t * 0.3;
|
|
240
|
-
}
|
|
241
|
-
function zt(e, t) {
|
|
242
|
-
e.forEachLabelPlane((n) => {
|
|
243
|
-
const o = t.position.x - n.position.x, s = t.position.z - n.position.z;
|
|
244
|
-
n.rotation.set(0, Math.atan2(o, s), 0);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
function Pt(e, t, n, o, s = {}) {
|
|
248
|
-
const i = new rt({
|
|
249
|
-
canvas: e,
|
|
250
|
-
antialias: !0,
|
|
251
|
-
alpha: !s.background
|
|
252
|
-
});
|
|
253
|
-
i.setPixelRatio(Math.min(typeof window > "u" ? 1 : window.devicePixelRatio || 1, s.maxPixelRatio ?? 2)), i.setSize(n, o, !1);
|
|
254
|
-
const a = new at();
|
|
255
|
-
s.background && (a.background = new E(s.background));
|
|
256
|
-
const r = bt(t), { cx: c, cy: h, cz: v, radius: w } = r, f = n / Math.max(1, o), l = vt(r, t.family, f), { dist: M } = l, g = new et(I, f, 0.1, M * 8 + w * 4);
|
|
257
|
-
g.position.set(...l.position), g.lookAt(...l.target), a.add(new U(16777215, 0.62));
|
|
258
|
-
const m = new C(16777215, 0.95);
|
|
259
|
-
m.position.set(c + w, h + w * 1.4, v + M), a.add(m);
|
|
260
|
-
const p = new C(16777215, 0.3);
|
|
261
|
-
p.position.set(c - w, h - w * 0.6, v + M * 0.6), a.add(p);
|
|
262
|
-
const b = xt(t, s.textStyle);
|
|
263
|
-
a.add(b.group);
|
|
264
|
-
let d = null;
|
|
265
|
-
const L = (x) => {
|
|
266
|
-
x && !d ? (d = new lt(g, e), d.enablePan = !1, d.target.set(c, h, v), d.minDistance = M * 0.4, d.maxDistance = M * 3, d.update()) : !x && d && (d.dispose(), d = null), d && (d.autoRotate = !!s.autoRotate, d.autoRotateSpeed = 1.2);
|
|
267
|
-
};
|
|
268
|
-
L(!!s.interactive);
|
|
269
|
-
let S = 0, u = !1;
|
|
270
|
-
const y = () => {
|
|
271
|
-
u || (S = requestAnimationFrame(y), zt(b, g), d?.update(), i.render(a, g));
|
|
272
|
-
};
|
|
273
|
-
return S = requestAnimationFrame(y), {
|
|
274
|
-
resize(x, z) {
|
|
275
|
-
g.aspect = x / Math.max(1, z), g.updateProjectionMatrix(), i.setSize(x, z, !1);
|
|
276
|
-
},
|
|
277
|
-
setInteractive(x) {
|
|
278
|
-
L(x);
|
|
279
|
-
},
|
|
280
|
-
setTextStyle(x) {
|
|
281
|
-
b.setTextStyle(x);
|
|
282
|
-
},
|
|
283
|
-
dispose() {
|
|
284
|
-
u = !0, cancelAnimationFrame(S), d?.dispose(), b.dispose(), i.dispose();
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
export {
|
|
289
|
-
Pt as mountSmartArt3D
|
|
290
|
-
};
|