pptx-svelte-viewer 4.1.6 → 4.2.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.
@@ -5320,7 +5320,6 @@ interface PptxSmartArtNode {
5320
5320
  }
5321
5321
  //#endregion
5322
5322
  //#region src/core/types/smart-art-style-definition.d.ts
5323
- /** Editable metadata shared by DiagramML quick-style and color definitions. */
5324
5323
  interface PptxSmartArtDefinitionText {
5325
5324
  value: string;
5326
5325
  language?: string;
@@ -5420,6 +5419,17 @@ interface PptxSmartArtQuickStyle extends PptxSmartArtDefinitionMetadata {
5420
5419
  effectIntensity?: string;
5421
5420
  /** Ordered CT_StyleLabel metadata. Complex style payload remains preserved XML. */
5422
5421
  labels?: PptxSmartArtQuickStyleLabel[];
5422
+ /**
5423
+ * Whole-diagram 3D scene (camera preset/rotation/zoom/fov, light rig,
5424
+ * backdrop) from the quick style's own `dgm:styleDef/dgm:scene3d`, present
5425
+ * for the "Scene" quick styles (Brick, Flat, Metallic, Sunset, Bird's Eye
5426
+ * Scene). One camera renders the whole diagram; per-shape `a:scene3d` is
5427
+ * absent for those styles (see `PptxSmartArtDrawingShape.scene3d`). Each
5428
+ * `dgm:styleLbl` also carries its own per-label `dgm:scene3d`/`dgm:sp3d`,
5429
+ * but PowerPoint bakes those fully resolved onto each cached shape's own
5430
+ * `dsp:spPr/a:sp3d`, so only the diagram-level scene is exposed here.
5431
+ */
5432
+ scene3d?: Pptx3DScene;
5423
5433
  }
5424
5434
  //#endregion
5425
5435
  //#region src/core/types/smart-art.d.ts
@@ -5620,6 +5630,29 @@ interface PptxSmartArtDrawingShape extends PptxCustomPathProperties {
5620
5630
  textFrameY?: number;
5621
5631
  textFrameWidth?: number;
5622
5632
  textFrameHeight?: number;
5633
+ /**
5634
+ * 3D scene (camera/light rig/backdrop) from `dsp:spPr/a:scene3d`, when this
5635
+ * cached shape carries its own per-shape camera. Bevel quick styles
5636
+ * (Polished, Inset, Cartoon, Powder) cache one per shape (always
5637
+ * `orthographicFront`, so the 2D layout stays undistorted). Scene quick
5638
+ * styles (Brick, Flat, Metallic, Sunset, Bird's Eye) instead put ONE camera
5639
+ * on the whole diagram (see `PptxSmartArtQuickStyle.scene3d`) and leave this
5640
+ * undefined on every shape.
5641
+ */
5642
+ scene3d?: Pptx3DScene;
5643
+ /**
5644
+ * 3D extrusion/bevel/contour/material from `dsp:spPr/a:sp3d`. PowerPoint
5645
+ * caches this fully resolved (from the quick style's per-label `dgm:sp3d`)
5646
+ * on every shape for every non-flat quick style, bevel or scene alike.
5647
+ */
5648
+ shape3d?: Pptx3DShape;
5649
+ /**
5650
+ * Text-body 3D extrusion/bevel from `dsp:txBody/a:bodyPr/a:sp3d`. Rare:
5651
+ * present when a quick style extrudes the label text itself off the shape
5652
+ * face (e.g. Bird's Eye Scene: `extrusionH="28000"`), rather than only the
5653
+ * shape body.
5654
+ */
5655
+ text3d?: Text3DStyle;
5623
5656
  }
5624
5657
  /**
5625
5658
  * Presentation layout variables from `dgm:prSet/dgm:presLayoutVars` (data model)
@@ -11576,23 +11609,6 @@ interface ThemeCatalogEntry {
11576
11609
  theme: ViewerTheme | undefined;
11577
11610
  }
11578
11611
 
11579
- //#region src/render/animation-text-style-resolve.d.ts
11580
- /**
11581
- * Framework-neutral text-style override a font-style emphasis effect applies
11582
- * on top of its target's own authored per-run bold/italic/underline/size/
11583
- * colour. Every binding maps this onto its own text container so it OVERRIDES
11584
- * the runs' inline styles (the runs carry explicit inline styles of their
11585
- * own, so plain CSS inheritance cannot reach them).
11586
- */
11587
- interface TextStyleAnimationDescriptor {
11588
- bold?: boolean;
11589
- italic?: boolean;
11590
- underline?: boolean;
11591
- /** Relative multiplier against each run's own authored font size. */
11592
- fontScale?: number;
11593
- color?: string;
11594
- }
11595
-
11596
11612
  //#region src/render/collaboration-presence.d.ts
11597
11613
  /** Connection lifecycle states for the Yjs WebSocket provider. */
11598
11614
  type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'error';
@@ -12032,6 +12048,23 @@ type ElementBuildState = {
12032
12048
  mode: DiagramBuildMode;
12033
12049
  progress: number;
12034
12050
  };
12051
+ //#endregion
12052
+ //#region src/render/animation-text-style-resolve.d.ts
12053
+ /**
12054
+ * Framework-neutral text-style override a font-style emphasis effect applies
12055
+ * on top of its target's own authored per-run bold/italic/underline/size/
12056
+ * colour. Every binding maps this onto its own text container so it OVERRIDES
12057
+ * the runs' inline styles (the runs carry explicit inline styles of their
12058
+ * own, so plain CSS inheritance cannot reach them).
12059
+ */
12060
+ interface TextStyleAnimationDescriptor {
12061
+ bold?: boolean;
12062
+ italic?: boolean;
12063
+ underline?: boolean;
12064
+ /** Relative multiplier against each run's own authored font size. */
12065
+ fontScale?: number;
12066
+ color?: string;
12067
+ }
12035
12068
  /** Snapshot of a single element's animation state at a point in the timeline. */
12036
12069
  interface ElementAnimationState {
12037
12070
  /** Whether the element should be visible. */
@@ -13684,6 +13717,20 @@ interface RasterizeElementTilesResult {
13684
13717
  /** Every tile, row-major order. Exactly one entry when `tiled` is `false`. */
13685
13718
  tiles: RasterizedTile[];
13686
13719
  }
13720
+ //#endregion
13721
+ //#region src/web-components/select-value.d.ts
13722
+ /** Public DOM shape used by all bindings; the element is not a native select. */
13723
+ interface PptxUiSelectElement extends HTMLElement {
13724
+ value: string;
13725
+ disabled: boolean;
13726
+ readonly options: HTMLOptionElement[];
13727
+ selectedIndex: number;
13728
+ }
13729
+ declare global {
13730
+ interface HTMLElementTagNameMap {
13731
+ 'pptx-ui-select': PptxUiSelectElement;
13732
+ }
13733
+ }
13687
13734
 
13688
13735
  //#endregion
13689
13736
  //#region src/ai/change-diff.d.ts
@@ -17564,7 +17611,7 @@ interface ViewerStateBag {
17564
17611
  * MUST be called synchronously from a `.svelte` component's own script body
17565
17612
  * (top level, not inside a callback or after an `await`): it registers
17566
17613
  * `onMount` / `onDestroy` hooks and Svelte context (`setContext`) via
17567
- * `provideTranslator` / `provideSmartArt3D` / `provideRenderContext` /
17614
+ * `provideTranslator` / `provideRendering3DFlags` / `provideRenderContext` /
17568
17615
  * `provideInspectorDeck` / `provideFieldContext` (plus more inside the
17569
17616
  * clusters), all of which require an active component-initialisation
17570
17617
  * context. Svelte's lifecycle context stays active for the whole synchronous
@@ -1,5 +1,5 @@
1
- import { Uh as l, Wh as S } from "../transition-overlay-DIPxa90i.js";
2
- import { A as e, F as a, M as o, N as r, P as s, c as n, d, f as b, i as m, j as t, l as p, m as c, n as g, o as x, p as w, r as C, s as P, t as T, u as $ } from "../export-CKRGg8D0.js";
1
+ import { Nh as l, Ph as S } from "../transition-overlay-BcUomRXK.js";
2
+ import { A as e, I as a, M as o, N as r, P as s, c as n, d, f as b, i as m, j as t, l as p, m as c, n as g, o as x, p as P, r as w, s as C, t as T, u as $ } from "../export-DoyAdIHl.js";
3
3
  var y = a, A = s, V = o, f = t, u = e, R = r;
4
4
  export {
5
5
  f as CollaborationCursors,
@@ -9,18 +9,18 @@ export {
9
9
  u as RemoteSelectionOverlay,
10
10
  y as Ribbon,
11
11
  V as SlideCanvas,
12
- C as ViewerState,
12
+ w as ViewerState,
13
13
  A as ViewerToolbar,
14
14
  d as clampSlideIndex,
15
15
  c as createSvelteAiBridge,
16
16
  g as createViewerState,
17
17
  x as exportAllSlidesToSvg,
18
- P as exportAllSlidesToSvgBlobs,
18
+ C as exportAllSlidesToSvgBlobs,
19
19
  n as exportSlideAsSvg,
20
20
  p as exportSlideToSvg,
21
21
  $ as exportSlideToSvgBlob,
22
22
  b as fitScale,
23
- w as resolveNavigationKey,
23
+ P as resolveNavigationKey,
24
24
  l as zoomInPercent,
25
25
  S as zoomOutPercent
26
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-svelte-viewer",
3
- "version": "4.1.6",
3
+ "version": "4.2.0",
4
4
  "description": "Svelte 5 PowerPoint viewer and editor component: render, edit, present, and export PPTX slides in the browser.",
5
5
  "keywords": [
6
6
  "office",
@@ -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
- };