pptx-svelte-viewer 0.5.1 → 0.6.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.
Files changed (238) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +9 -6
  3. package/dist/{component-B4CAjgjO.js → component-NIMULjW3.js} +20911 -16737
  4. package/dist/i18n/context.d.ts +20 -0
  5. package/dist/i18n/context.d.ts.map +1 -0
  6. package/dist/i18n/index.d.ts +4 -0
  7. package/dist/i18n/index.d.ts.map +1 -0
  8. package/dist/i18n/translator.d.ts +30 -0
  9. package/dist/i18n/translator.d.ts.map +1 -0
  10. package/dist/i18n.d.ts +56 -62
  11. package/dist/i18n.d.ts.map +1 -0
  12. package/dist/index.d.ts +765 -605
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +1 -1
  15. package/dist/theme/index.d.ts +8 -0
  16. package/dist/theme/index.d.ts.map +1 -0
  17. package/dist/viewer/collab/collaboration-dialogs.svelte.d.ts +31 -0
  18. package/dist/viewer/collab/collaboration-dialogs.svelte.d.ts.map +1 -0
  19. package/dist/viewer/collab/collaboration-presence-effects.svelte.d.ts +9 -0
  20. package/dist/viewer/collab/collaboration-presence-effects.svelte.d.ts.map +1 -0
  21. package/dist/viewer/collab/collaboration-presence.svelte.d.ts +20 -0
  22. package/dist/viewer/collab/collaboration-presence.svelte.d.ts.map +1 -0
  23. package/dist/viewer/collab/collaboration-provider.d.ts +35 -0
  24. package/dist/viewer/collab/collaboration-provider.d.ts.map +1 -0
  25. package/dist/viewer/collab/collaboration-remote-sync.d.ts +12 -0
  26. package/dist/viewer/collab/collaboration-remote-sync.d.ts.map +1 -0
  27. package/dist/viewer/collab/collaboration-session.d.ts +24 -0
  28. package/dist/viewer/collab/collaboration-session.d.ts.map +1 -0
  29. package/dist/viewer/collab/collaboration-status.d.ts +14 -0
  30. package/dist/viewer/collab/collaboration-status.d.ts.map +1 -0
  31. package/dist/viewer/collab/collaboration.svelte.d.ts +55 -0
  32. package/dist/viewer/collab/collaboration.svelte.d.ts.map +1 -0
  33. package/dist/viewer/collab/components/props.d.ts +79 -0
  34. package/dist/viewer/collab/components/props.d.ts.map +1 -0
  35. package/dist/viewer/collab/components/share-helpers.d.ts +29 -0
  36. package/dist/viewer/collab/components/share-helpers.d.ts.map +1 -0
  37. package/dist/viewer/collab/index.d.ts +15 -0
  38. package/dist/viewer/collab/index.d.ts.map +1 -0
  39. package/dist/viewer/component.d.ts +13 -0
  40. package/dist/viewer/component.d.ts.map +1 -0
  41. package/dist/viewer/components/index.d.ts +7 -0
  42. package/dist/viewer/components/index.d.ts.map +1 -0
  43. package/dist/viewer/components/props.d.ts +185 -0
  44. package/dist/viewer/components/props.d.ts.map +1 -0
  45. package/dist/viewer/components/ribbon/animations/animation-categories.d.ts +10 -0
  46. package/dist/viewer/components/ribbon/animations/animation-categories.d.ts.map +1 -0
  47. package/dist/viewer/components/ribbon/design/theme-swatches.d.ts +16 -0
  48. package/dist/viewer/components/ribbon/design/theme-swatches.d.ts.map +1 -0
  49. package/dist/viewer/components/ribbon/insert/shape-glyphs.d.ts +8 -0
  50. package/dist/viewer/components/ribbon/insert/shape-glyphs.d.ts.map +1 -0
  51. package/dist/viewer/components/ribbon/ribbon-tabs.d.ts +17 -0
  52. package/dist/viewer/components/ribbon/ribbon-tabs.d.ts.map +1 -0
  53. package/dist/viewer/components/ribbon/ribbon-types.d.ts +67 -0
  54. package/dist/viewer/components/ribbon/ribbon-types.d.ts.map +1 -0
  55. package/dist/viewer/components/ribbon/transitions/transition-presets.d.ts +10 -0
  56. package/dist/viewer/components/ribbon/transitions/transition-presets.d.ts.map +1 -0
  57. package/dist/viewer/editor/editing-api.d.ts +20 -0
  58. package/dist/viewer/editor/editing-api.d.ts.map +1 -0
  59. package/dist/viewer/editor/editor-animation-controller.d.ts +25 -0
  60. package/dist/viewer/editor/editor-animation-controller.d.ts.map +1 -0
  61. package/dist/viewer/editor/editor-arrange-controller.d.ts +24 -0
  62. package/dist/viewer/editor/editor-arrange-controller.d.ts.map +1 -0
  63. package/dist/viewer/editor/editor-arrange-ops.d.ts +28 -0
  64. package/dist/viewer/editor/editor-arrange-ops.d.ts.map +1 -0
  65. package/dist/viewer/editor/editor-background-controller.d.ts +21 -0
  66. package/dist/viewer/editor/editor-background-controller.d.ts.map +1 -0
  67. package/dist/viewer/editor/editor-clipboard-controller.d.ts +18 -0
  68. package/dist/viewer/editor/editor-clipboard-controller.d.ts.map +1 -0
  69. package/dist/viewer/editor/editor-clipboard.d.ts +20 -0
  70. package/dist/viewer/editor/editor-clipboard.d.ts.map +1 -0
  71. package/dist/viewer/editor/editor-controller-geometry.d.ts +8 -0
  72. package/dist/viewer/editor/editor-controller-geometry.d.ts.map +1 -0
  73. package/dist/viewer/editor/editor-controller.svelte.d.ts +43 -0
  74. package/dist/viewer/editor/editor-controller.svelte.d.ts.map +1 -0
  75. package/dist/viewer/editor/editor-element-controller.d.ts +21 -0
  76. package/dist/viewer/editor/editor-element-controller.d.ts.map +1 -0
  77. package/dist/viewer/editor/editor-equation-controller.svelte.d.ts +12 -0
  78. package/dist/viewer/editor/editor-equation-controller.svelte.d.ts.map +1 -0
  79. package/dist/viewer/editor/editor-find-replace.svelte.d.ts +39 -0
  80. package/dist/viewer/editor/editor-find-replace.svelte.d.ts.map +1 -0
  81. package/dist/viewer/editor/editor-format-mutations.d.ts +39 -0
  82. package/dist/viewer/editor/editor-format-mutations.d.ts.map +1 -0
  83. package/dist/viewer/editor/editor-format-painter-controller.svelte.d.ts +13 -0
  84. package/dist/viewer/editor/editor-format-painter-controller.svelte.d.ts.map +1 -0
  85. package/dist/viewer/editor/editor-geometry.d.ts +29 -0
  86. package/dist/viewer/editor/editor-geometry.d.ts.map +1 -0
  87. package/dist/viewer/editor/editor-gestures.d.ts +48 -0
  88. package/dist/viewer/editor/editor-gestures.d.ts.map +1 -0
  89. package/dist/viewer/editor/editor-ink-controller.svelte.d.ts +59 -0
  90. package/dist/viewer/editor/editor-ink-controller.svelte.d.ts.map +1 -0
  91. package/dist/viewer/editor/editor-ink-gesture.d.ts +37 -0
  92. package/dist/viewer/editor/editor-ink-gesture.d.ts.map +1 -0
  93. package/dist/viewer/editor/editor-insert-action-button.d.ts +13 -0
  94. package/dist/viewer/editor/editor-insert-action-button.d.ts.map +1 -0
  95. package/dist/viewer/editor/editor-insert-chart.d.ts +10 -0
  96. package/dist/viewer/editor/editor-insert-chart.d.ts.map +1 -0
  97. package/dist/viewer/editor/editor-insert-equation.d.ts +5 -0
  98. package/dist/viewer/editor/editor-insert-equation.d.ts.map +1 -0
  99. package/dist/viewer/editor/editor-insert-field.d.ts +17 -0
  100. package/dist/viewer/editor/editor-insert-field.d.ts.map +1 -0
  101. package/dist/viewer/editor/editor-insert-media.d.ts +10 -0
  102. package/dist/viewer/editor/editor-insert-media.d.ts.map +1 -0
  103. package/dist/viewer/editor/editor-insert-smart-art.d.ts +8 -0
  104. package/dist/viewer/editor/editor-insert-smart-art.d.ts.map +1 -0
  105. package/dist/viewer/editor/editor-insert.d.ts +40 -0
  106. package/dist/viewer/editor/editor-insert.d.ts.map +1 -0
  107. package/dist/viewer/editor/editor-keyboard.d.ts +31 -0
  108. package/dist/viewer/editor/editor-keyboard.d.ts.map +1 -0
  109. package/dist/viewer/editor/editor-master-controller.d.ts +17 -0
  110. package/dist/viewer/editor/editor-master-controller.d.ts.map +1 -0
  111. package/dist/viewer/editor/editor-mutations.d.ts +59 -0
  112. package/dist/viewer/editor/editor-mutations.d.ts.map +1 -0
  113. package/dist/viewer/editor/editor-paragraph-mutations.d.ts +10 -0
  114. package/dist/viewer/editor/editor-paragraph-mutations.d.ts.map +1 -0
  115. package/dist/viewer/editor/editor-selection-gestures.d.ts +24 -0
  116. package/dist/viewer/editor/editor-selection-gestures.d.ts.map +1 -0
  117. package/dist/viewer/editor/editor-selection.svelte.d.ts +32 -0
  118. package/dist/viewer/editor/editor-selection.svelte.d.ts.map +1 -0
  119. package/dist/viewer/editor/editor-slide-ops.d.ts +23 -0
  120. package/dist/viewer/editor/editor-slide-ops.d.ts.map +1 -0
  121. package/dist/viewer/editor/editor-slides-controller.d.ts +22 -0
  122. package/dist/viewer/editor/editor-slides-controller.d.ts.map +1 -0
  123. package/dist/viewer/editor/editor-state.svelte.d.ts +102 -0
  124. package/dist/viewer/editor/editor-state.svelte.d.ts.map +1 -0
  125. package/dist/viewer/editor/editor-template-controller.d.ts +12 -0
  126. package/dist/viewer/editor/editor-template-controller.d.ts.map +1 -0
  127. package/dist/viewer/editor/editor-text-extra-mutations.d.ts +18 -0
  128. package/dist/viewer/editor/editor-text-extra-mutations.d.ts.map +1 -0
  129. package/dist/viewer/editor/editor-transition-controller.d.ts +22 -0
  130. package/dist/viewer/editor/editor-transition-controller.d.ts.map +1 -0
  131. package/dist/viewer/editor/editor-zorder.d.ts +16 -0
  132. package/dist/viewer/editor/editor-zorder.d.ts.map +1 -0
  133. package/dist/viewer/editor/element-hit.d.ts +17 -0
  134. package/dist/viewer/editor/element-hit.d.ts.map +1 -0
  135. package/dist/viewer/editor/index.d.ts +45 -0
  136. package/dist/viewer/editor/index.d.ts.map +1 -0
  137. package/dist/viewer/editor/inline-text.d.ts +36 -0
  138. package/dist/viewer/editor/inline-text.d.ts.map +1 -0
  139. package/dist/viewer/editor/types.d.ts +12 -0
  140. package/dist/viewer/editor/types.d.ts.map +1 -0
  141. package/dist/viewer/export/export-controller.svelte.d.ts +77 -0
  142. package/dist/viewer/export/export-controller.svelte.d.ts.map +1 -0
  143. package/dist/viewer/export/export-gif.d.ts +42 -0
  144. package/dist/viewer/export/export-gif.d.ts.map +1 -0
  145. package/dist/viewer/export/export-print.d.ts +55 -0
  146. package/dist/viewer/export/export-print.d.ts.map +1 -0
  147. package/dist/viewer/export/export-ui.svelte.d.ts +45 -0
  148. package/dist/viewer/export/export-ui.svelte.d.ts.map +1 -0
  149. package/dist/viewer/export/export-video.d.ts +56 -0
  150. package/dist/viewer/export/export-video.d.ts.map +1 -0
  151. package/dist/viewer/export/export-wiring.svelte.d.ts +35 -0
  152. package/dist/viewer/export/export-wiring.svelte.d.ts.map +1 -0
  153. package/dist/viewer/export/exporting-api.d.ts +19 -0
  154. package/dist/viewer/export/exporting-api.d.ts.map +1 -0
  155. package/dist/viewer/export/index.d.ts +16 -0
  156. package/dist/viewer/export/index.d.ts.map +1 -0
  157. package/dist/viewer/export/rasterize-slide.d.ts +44 -0
  158. package/dist/viewer/export/rasterize-slide.d.ts.map +1 -0
  159. package/dist/viewer/export/render-to-canvas.d.ts +15 -0
  160. package/dist/viewer/export/render-to-canvas.d.ts.map +1 -0
  161. package/dist/viewer/index.d.ts +7536 -7597
  162. package/dist/viewer/index.d.ts.map +1 -0
  163. package/dist/viewer/index.js +1 -1
  164. package/dist/viewer/master/master-view.d.ts +7 -0
  165. package/dist/viewer/master/master-view.d.ts.map +1 -0
  166. package/dist/viewer/presentation/animation-playback.svelte.d.ts +57 -0
  167. package/dist/viewer/presentation/animation-playback.svelte.d.ts.map +1 -0
  168. package/dist/viewer/presentation/apply-animation-styles.d.ts +8 -0
  169. package/dist/viewer/presentation/apply-animation-styles.d.ts.map +1 -0
  170. package/dist/viewer/presentation/index.d.ts +10 -0
  171. package/dist/viewer/presentation/index.d.ts.map +1 -0
  172. package/dist/viewer/presentation/keyframes.d.ts +3 -0
  173. package/dist/viewer/presentation/keyframes.d.ts.map +1 -0
  174. package/dist/viewer/presentation/presentation-controller.svelte.d.ts +69 -0
  175. package/dist/viewer/presentation/presentation-controller.svelte.d.ts.map +1 -0
  176. package/dist/viewer/presentation/presentation-effects.svelte.d.ts +31 -0
  177. package/dist/viewer/presentation/presentation-effects.svelte.d.ts.map +1 -0
  178. package/dist/viewer/render/chart-view.d.ts +35 -0
  179. package/dist/viewer/render/chart-view.d.ts.map +1 -0
  180. package/dist/viewer/render/contentpart-view.d.ts +24 -0
  181. package/dist/viewer/render/contentpart-view.d.ts.map +1 -0
  182. package/dist/viewer/render/index.d.ts +25 -0
  183. package/dist/viewer/render/index.d.ts.map +1 -0
  184. package/dist/viewer/render/ink-view.d.ts +25 -0
  185. package/dist/viewer/render/ink-view.d.ts.map +1 -0
  186. package/dist/viewer/render/media-view.d.ts +17 -0
  187. package/dist/viewer/render/media-view.d.ts.map +1 -0
  188. package/dist/viewer/render/model3d-view.d.ts +16 -0
  189. package/dist/viewer/render/model3d-view.d.ts.map +1 -0
  190. package/dist/viewer/render/ole-view.d.ts +44 -0
  191. package/dist/viewer/render/ole-view.d.ts.map +1 -0
  192. package/dist/viewer/render/smart-art-3d-view.d.ts +18 -0
  193. package/dist/viewer/render/smart-art-3d-view.d.ts.map +1 -0
  194. package/dist/viewer/render/smartart-view.d.ts +54 -0
  195. package/dist/viewer/render/smartart-view.d.ts.map +1 -0
  196. package/dist/viewer/render/table-view.d.ts +39 -0
  197. package/dist/viewer/render/table-view.d.ts.map +1 -0
  198. package/dist/viewer/render/zoom-view.d.ts +18 -0
  199. package/dist/viewer/render/zoom-view.d.ts.map +1 -0
  200. package/dist/viewer/state/autosave.svelte.d.ts +61 -0
  201. package/dist/viewer/state/autosave.svelte.d.ts.map +1 -0
  202. package/dist/viewer/state/fullscreen.d.ts +16 -0
  203. package/dist/viewer/state/fullscreen.d.ts.map +1 -0
  204. package/dist/viewer/state/index.d.ts +9 -0
  205. package/dist/viewer/state/index.d.ts.map +1 -0
  206. package/dist/viewer/state/layout-state.svelte.d.ts +30 -0
  207. package/dist/viewer/state/layout-state.svelte.d.ts.map +1 -0
  208. package/dist/viewer/state/loader-helpers.d.ts +27 -0
  209. package/dist/viewer/state/loader-helpers.d.ts.map +1 -0
  210. package/dist/viewer/state/navigation.d.ts +26 -0
  211. package/dist/viewer/state/navigation.d.ts.map +1 -0
  212. package/dist/viewer/state/presentation-loader.svelte.d.ts +41 -0
  213. package/dist/viewer/state/presentation-loader.svelte.d.ts.map +1 -0
  214. package/dist/viewer/state/render-context.d.ts +9 -0
  215. package/dist/viewer/state/render-context.d.ts.map +1 -0
  216. package/dist/viewer/state/smart-art-3d-context.d.ts +22 -0
  217. package/dist/viewer/state/smart-art-3d-context.d.ts.map +1 -0
  218. package/dist/viewer/state/viewer-effects.svelte.d.ts +31 -0
  219. package/dist/viewer/state/viewer-effects.svelte.d.ts.map +1 -0
  220. package/dist/viewer/state/viewer-state.svelte.d.ts +36 -0
  221. package/dist/viewer/state/viewer-state.svelte.d.ts.map +1 -0
  222. package/dist/viewer/state/viewport-handlers.d.ts +24 -0
  223. package/dist/viewer/state/viewport-handlers.d.ts.map +1 -0
  224. package/dist/viewer/style/connector-label.d.ts +13 -0
  225. package/dist/viewer/style/connector-label.d.ts.map +1 -0
  226. package/dist/viewer/style/css.d.ts +13 -0
  227. package/dist/viewer/style/css.d.ts.map +1 -0
  228. package/dist/viewer/style/element-style.d.ts +26 -0
  229. package/dist/viewer/style/element-style.d.ts.map +1 -0
  230. package/dist/viewer/style/index.d.ts +5 -0
  231. package/dist/viewer/style/index.d.ts.map +1 -0
  232. package/dist/viewer/style/merge-3d.d.ts +10 -0
  233. package/dist/viewer/style/merge-3d.d.ts.map +1 -0
  234. package/dist/viewer/style/text-style.d.ts +4 -0
  235. package/dist/viewer/style/text-style.d.ts.map +1 -0
  236. package/dist/viewer/types.d.ts +189 -0
  237. package/dist/viewer/types.d.ts.map +1 -0
  238. package/package.json +6 -4
package/dist/index.d.ts CHANGED
@@ -1,605 +1,765 @@
1
- import { Component } from 'svelte';
2
-
3
- export declare interface AutosaveRecord {
4
- key: string;
5
- data: Uint8Array;
6
- timestamp: number;
7
- size: number;
8
- }
9
-
10
- /**
11
- * autosave.svelte.ts: debounced crash-recovery autosave for the Svelte viewer.
12
- *
13
- * A runes port that fuses the two shared semantics the other bindings use:
14
- * - React's persistence target: each successful save writes the serialized
15
- * `.pptx` bytes to the shared IndexedDB recovery store
16
- * (`saveAutosaveSnapshot`, keyed by `filePath`), so a host can offer
17
- * restore-on-load with `getAutosaveSnapshot` / `listAutosaveSnapshots`
18
- * (both re-exported from this package). This binding does NOT auto-restore;
19
- * matching React/Vue, recovery is a host concern.
20
- * - Vue's debounce-on-edit trigger: an edit marks the document dirty and
21
- * (re)arms a debounce timer instead of polling on a fixed interval.
22
- *
23
- * The controller registers its own edit-watching `$effect` in the constructor,
24
- * so the SFC only has to construct it once during setup and read its reactive
25
- * `status` / `isDirty` for the toolbar indicator.
26
- */
27
- /**
28
- * Autosave status, surfaced for the toolbar status pill.
29
- *
30
- * - `idle` : nothing has been saved yet (or no edits since mount).
31
- * - `disabled` : autosave is inactive (off, not editable, or no file path).
32
- * - `saving` : a save is currently in flight.
33
- * - `saved` : the most recent save succeeded.
34
- * - `error` : the most recent save threw.
35
- */
36
- export declare type AutosaveStatus = 'idle' | 'disabled' | 'saving' | 'saved' | 'error';
37
-
38
- /**
39
- * Framework-agnostic public types shared by the viewer bindings.
40
- *
41
- * These were duplicated in the React (`types-ui.ts`) and Vue (`viewer/types.ts`)
42
- * packages; this is the canonical copy. Each binding layers its own
43
- * framework-specific prop/event/handle types on top of these.
44
- */
45
-
46
- /** Canvas dimensions in pixels. */
47
- export declare interface CanvasSize {
48
- width: number;
49
- height: number;
50
- }
51
-
52
- /**
53
- * Real-time collaboration configuration.
54
- *
55
- * The same shape is accepted by the React, Vue, and Angular bindings.
56
- */
57
- export declare interface CollaborationConfig {
58
- /** Unique identifier for the collaboration room (alphanumeric, hyphens, underscores). */
59
- roomId: string;
60
- /**
61
- * WebSocket server URL for the Yjs provider (e.g. "wss://collab.example.com").
62
- * Ignored (may be empty) when `transport` is `'webrtc'`.
63
- */
64
- serverUrl: string;
65
- /** Transport to use. Defaults to `'websocket'`. */
66
- transport?: CollaborationTransport;
67
- /**
68
- * WebRTC signaling server URLs (only used when `transport` is `'webrtc'`).
69
- * Defaults to y-webrtc's built-in public signaling list. Same-browser tabs
70
- * sync via BroadcastChannel regardless of signaling availability.
71
- */
72
- signaling?: string[];
73
- /** Display name for the local user. */
74
- userName: string;
75
- /** Avatar URL for the local user (optional). */
76
- userAvatar?: string;
77
- /** Hex colour for the local user's cursor/presence indicator. */
78
- userColor?: string;
79
- /** Optional authentication token sent with the WebSocket handshake. */
80
- authToken?: string;
81
- /** Role in the session; defaults to `'collaborator'`. */
82
- role?: CollaborationRole;
83
- /**
84
- * Elected-writer write-back callback (Area 3 of the C3 hardening plan).
85
- *
86
- * When the local user has `role: 'owner'`, the binding debounces changes and
87
- * serializes the current Y.Doc state to a PPTX byte array, then calls this
88
- * callback so the host can persist the snapshot. Only one writer (the owner)
89
- * does this; other collaborators never trigger write-back, eliminating the
90
- * last-save-wins problem.
91
- */
92
- onWriteBack?: (bytes: Uint8Array) => void;
93
- /**
94
- * Debounce delay (ms) between the last Y.Doc change and the write-back
95
- * invocation. Defaults to 5000 ms. Set to 0 to write back on every change
96
- * (not recommended for large documents).
97
- */
98
- writeBackDebounceMs?: number;
99
- }
100
-
101
- /** Collaboration role within a session. */
102
- export declare type CollaborationRole = 'owner' | 'collaborator' | 'viewer';
103
-
104
- /**
105
- * Collaboration transport.
106
- *
107
- * - `'websocket'` (default): y-websocket against `serverUrl`.
108
- * - `'webrtc'`: y-webrtc peer-to-peer; needs no document server. Peers meet
109
- * through the `signaling` servers (WebRTC signaling only, no document data)
110
- * and same-browser tabs additionally sync via BroadcastChannel even without
111
- * any signaling server, which makes this mode usable from static hosting.
112
- */
113
- export declare type CollaborationTransport = 'websocket' | 'webrtc';
114
-
115
- /**
116
- * Build the complete set of CSS custom properties with all defaults.
117
- * Useful for generating a full fallback stylesheet.
118
- */
119
- export declare function defaultCssVars(): Record<string, string>;
120
-
121
- /** Default border-radius. */
122
- export declare const defaultRadius = "0.5rem";
123
-
124
- /**
125
- * Default dark-theme color values.
126
- *
127
- * These correspond to the built-in dark UI of the PowerPoint viewer and
128
- * use Tailwind's gray palette as the neutral scale with indigo as the
129
- * primary accent.
130
- */
131
- export declare const defaultThemeColors: ViewerThemeColors;
132
-
133
- /**
134
- * Delete an autosave snapshot by file path.
135
- */
136
- export declare function deleteAutosaveSnapshot(filePath: string): Promise<boolean>;
137
-
138
- /**
139
- * Animated-GIF export capture/encode pipeline. All the pure logic is shared:
140
- * `planGifFrames` derives the per-slide frame delays (default duration +
141
- * per-slide overrides), `clampGifDimensions` bounds the output size, and
142
- * `encodeGif` (median-cut quantisation + LZW GIF89a) produces the bytes with
143
- * each frame carrying its own plan delay. This module only owns the
144
- * DOM-adjacent glue: rasterising each slide via the injected capture callback
145
- * and normalising every frame onto a uniform-size canvas before pixel
146
- * extraction. Blob download is left to the caller (`ExportController`).
147
- */
148
- /** Options for the animated-GIF export. */
149
- export declare interface ExportGifOptions {
150
- /** Duration each slide is shown, in milliseconds. Default 2000. */
151
- slideDurationMs?: number;
152
- /** Per-slide duration overrides in milliseconds (index maps to slide index). */
153
- slideTimingsMs?: number[];
154
- /**
155
- * Longest allowed output side in pixels; frames are scaled down
156
- * proportionally. Default 960 (GIF encoding cost grows with pixel count:
157
- * every pixel is matched against a 256-colour palette per frame).
158
- */
159
- maxDimension?: number;
160
- /** Capture-phase progress callback: `(currentSlide, totalSlides)`. */
161
- onProgress?: ExportProgress;
162
- /** Abort the export early; checked before each slide capture. */
163
- signal?: AbortSignal;
164
- }
165
-
166
- /** Options for the multi-slide PDF export (progress + cooperative cancel). */
167
- export declare interface ExportPdfOptions {
168
- /** Capture-phase progress callback: `(currentSlide, totalSlides)`. */
169
- onProgress?: ExportProgress;
170
- /** Abort the export early; the loop checks this between slides. */
171
- signal?: AbortSignal;
172
- }
173
-
174
- /** Per-slide progress callback: `(currentSlideIndex, totalSlides)`. */
175
- declare type ExportProgress = (current: number, total: number) => void;
176
-
177
- /**
178
- * Video (WebM) export driven by the shared `video-plan` maths: segment timing
179
- * comes from `planVideoSegments` (default duration + per-slide overrides +
180
- * fps -> frame count), the frame pacing from `fpsToFrameIntervalMs`, and the
181
- * recorder MIME type from `pickSupportedMimeType(WEBM_MIME_CANDIDATES)`. This
182
- * module owns the browser glue only: rasterise every slide first (capture
183
- * phase), then replay each canvas onto a recording canvas whose
184
- * `captureStream()` feeds a `MediaRecorder` (recording phase). Mirrors
185
- * React's `exportAllSlidesAsVideo`, minus the live-stage slide flipping (the
186
- * injected rasteriser renders off-screen instead).
187
- */
188
- /** Options for the WebM video export. */
189
- export declare interface ExportVideoOptions {
190
- /** Duration each slide is shown, in milliseconds. Default 3000. */
191
- slideDurationMs?: number;
192
- /** Per-slide duration overrides in milliseconds (index maps to slide index). */
193
- slideTimingsMs?: number[];
194
- /** Recording frame rate. Default 30. */
195
- fps?: number;
196
- /** Recorder bitrate. Default 5,000,000 (5 Mbps). */
197
- videoBitsPerSecond?: number;
198
- /** Capture-phase progress callback: `(currentSlide, totalSlides)`. */
199
- onProgress?: ExportProgress;
200
- /** Recording-phase progress callback: `(currentSlide, totalSlides)`. */
201
- onRecordProgress?: ExportProgress;
202
- /** Abort the export early; checked between slides and between frames. */
203
- signal?: AbortSignal;
204
- }
205
-
206
- /**
207
- * Retrieve a single autosave snapshot by file path.
208
- * Returns undefined when no snapshot exists.
209
- */
210
- export declare function getAutosaveSnapshot(filePath: string): Promise<AutosaveRecord | undefined>;
211
-
212
- /**
213
- * Pure handout layout calculations, shared by every binding's print path.
214
- *
215
- * Handles distributing slides across pages, computing grid dimensions, and
216
- * positioning cells within A4 page space. No DOM/framework dependency: callers
217
- * render the resulting rectangles however their view layer prefers.
218
- */
219
- /** Supported slides-per-page values. */
220
- declare type HandoutSlidesPerPage = 1 | 2 | 3 | 4 | 6 | 9;
221
-
222
- /**
223
- * List all autosave snapshots (without the heavy `data` blob).
224
- * Useful for showing a recovery picker on app start.
225
- */
226
- export declare function listAutosaveSnapshots(): Promise<Array<{
227
- key: string;
228
- timestamp: number;
229
- size: number;
230
- }>>;
231
-
232
- /**
233
- * Explicitly-typed public export of the viewer component.
234
- *
235
- * `svelte-check` types the `.svelte` import precisely, but the plain
236
- * TypeScript pass that emits the published declaration files resolves
237
- * `.svelte` modules through a loose ambient shim (`src/shims-svelte.d.ts`).
238
- * Re-exporting through this annotated constant keeps the published `.d.ts`
239
- * fully typed regardless of which compiler produced it.
240
- */
241
- export declare const PowerPointViewer: Component<PowerPointViewerProps, PowerPointViewerApi>;
242
-
243
- /**
244
- * Imperative editing API exposed on the `<PowerPointViewer>` component
245
- * instance (via `bind:this`). Mirrors the vanilla binding's `EditorController`
246
- * surface subset the host drives directly.
247
- */
248
- export declare interface PowerPointViewerApi {
249
- /** Undo the last committed edit. */
250
- undo(): void;
251
- /** Redo the last undone edit. */
252
- redo(): void;
253
- /** Whether an undo step is available (snapshot; not reactive). */
254
- canUndo(): boolean;
255
- /** Whether a redo step is available (snapshot; not reactive). */
256
- canRedo(): boolean;
257
- /** Delete the selected element (no-op when nothing is selected). */
258
- deleteSelected(): void;
259
- /** The selected top-level element id, or null. */
260
- getSelectedElementId(): string | null;
261
- /** Serialize the edited slides to `.pptx` bytes via the core handler. */
262
- save(): Promise<Uint8Array>;
263
- /** Save + trigger a browser download of the `.pptx` (default name). */
264
- downloadPptx(fileName?: string): Promise<void>;
265
- /**
266
- * Export a slide as a PNG download (defaults to the current slide). Renders
267
- * the slide off-screen at scale 1 and rasterises it with `html2canvas-pro`
268
- * (dynamically imported), so the first call pays a one-time load cost.
269
- */
270
- exportSlidePng(index?: number): Promise<void>;
271
- /**
272
- * Export every slide as a multi-page PDF download (one slide per page).
273
- * `jspdf` is dynamically imported on first use.
274
- */
275
- exportPdf(options?: ExportPdfOptions): Promise<void>;
276
- /**
277
- * Export every slide as an animated GIF download. Per-slide frame delays
278
- * come from the shared frame plan: a default `slideDurationMs` (2000) with
279
- * optional per-slide `slideTimingsMs` overrides. Supports `onProgress` and
280
- * an `AbortSignal`, like {@link exportPdf}.
281
- */
282
- exportGif(options?: ExportGifOptions): Promise<void>;
283
- /**
284
- * Export every slide as a WebM video download (canvas capture stream +
285
- * `MediaRecorder`; codec picked from the shared WebM candidates). Timing
286
- * follows the shared video plan (`slideDurationMs` default 3000, per-slide
287
- * `slideTimingsMs`, `fps` default 30). Supports capture/recording progress
288
- * callbacks and an `AbortSignal`.
289
- */
290
- exportVideo(options?: ExportVideoOptions): Promise<void>;
291
- /**
292
- * Assemble the shared print document (slides / handouts / notes / outline,
293
- * slide range + colour mode) and open the browser print dialog. The default
294
- * print surface is a hidden same-origin iframe, so no popup window is
295
- * involved; a custom `window.open`-based opener (injectable at the
296
- * controller level) is subject to popup blockers, in which case the promise
297
- * resolves `false`. Resolves `true` once the print surface opened.
298
- */
299
- print(options?: PrintOptions): Promise<boolean>;
300
- }
301
-
302
- /** Props for `<PowerPointViewer>`. */
303
- export declare interface PowerPointViewerProps {
304
- /** PowerPoint content as `Uint8Array` (or `ArrayBuffer`). */
305
- source: Uint8Array | ArrayBuffer | null | undefined;
306
- /**
307
- * Theme configuration for customising the viewer's appearance. Accepts
308
- * partial color overrides, a custom border-radius, and arbitrary CSS
309
- * custom properties. Unset values fall back to the built-in defaults.
310
- */
311
- theme?: ViewerTheme;
312
- /** UI locale (BCP 47). English ships built in; register others via `pptx-svelte-viewer/i18n`. */
313
- locale?: string;
314
- /** Slide shown after load (0-based, clamped). Default 0. */
315
- initialSlide?: number;
316
- /** Show the thumbnail sidebar. Default true. */
317
- showThumbnails?: boolean;
318
- /** Show the navigation/zoom toolbar. Default true. */
319
- showToolbar?: boolean;
320
- /**
321
- * Show the speaker-notes panel and its toolbar toggle. Default true. The
322
- * panel is plain-text only and reads the active slide's notes; pass
323
- * `onnotesupdate` to make it editable (omitting it renders read-only).
324
- */
325
- showNotes?: boolean;
326
- /**
327
- * Opt in to the experimental Three.js (WebGL) SmartArt renderer for
328
- * `smartArt` elements, in place of the default SVG renderer. Requires the
329
- * optional `three` peer dependency; when it is unavailable, or a diagram
330
- * has no renderable nodes, or the WebGL mount fails, the SVG renderer is
331
- * used automatically. Default false.
332
- */
333
- smartArt3D?: boolean;
334
- /**
335
- * Enable in-place editing: click to select an element, drag to move, use the
336
- * 8 handles to resize (Shift locks aspect) and the rotate handle to rotate,
337
- * double-click text/shapes to edit their text, and the keyboard for
338
- * delete/duplicate/nudge/undo/redo. Adds an Undo/Redo/Save/Download group to
339
- * the toolbar. Default false (read-only viewer).
340
- */
341
- editable?: boolean;
342
- /** Optional class name applied to the root element. */
343
- class?: string;
344
- /** Fired after a presentation finishes loading. */
345
- onload?: (detail: ViewerLoadDetail) => void;
346
- /** Fired when a load fails (message is human-readable). */
347
- onerror?: (message: string) => void;
348
- /** Fired when the active slide changes (0-based index). */
349
- onslidechange?: (index: number) => void;
350
- /**
351
- * Fired with the committed plain-text speaker notes when the user edits
352
- * the notes panel (on `change` / `blur`). This binding has no built-in
353
- * slide-mutation channel, so the host is responsible for writing the text
354
- * back onto its own copy of the slide; omit this to render the notes
355
- * panel read-only.
356
- */
357
- onnotesupdate?: (notes: string) => void;
358
- /**
359
- * Fired after every committed editing mutation (move / resize / rotate /
360
- * delete / duplicate / nudge / inline text / notes) when `editable`. Use it
361
- * to track the dirty state or mirror edits into host state.
362
- */
363
- onchange?: () => void;
364
- /**
365
- * Enable debounced crash-recovery autosave. On each edit (when `editable`)
366
- * the current slides are serialized to `.pptx` bytes and written to the
367
- * shared IndexedDB recovery store (keyed by {@link filePath}), and
368
- * `onautosave` is fired with the bytes. Requires `filePath`; without one the
369
- * autosave indicator reads "disabled". This binding does not auto-restore on
370
- * load; recovery is a host concern (see the re-exported `getAutosaveSnapshot`
371
- * / `listAutosaveSnapshots` helpers). Default false.
372
- */
373
- autosave?: boolean;
374
- /**
375
- * IndexedDB record key for autosave (typically the open file's name/path).
376
- * Autosave is inert until this is set.
377
- */
378
- filePath?: string;
379
- /** Autosave debounce window in milliseconds. Default 2000. */
380
- autosaveIntervalMs?: number;
381
- /** Fired with the serialized `.pptx` bytes after each successful autosave. */
382
- onautosave?: (bytes: Uint8Array) => void;
383
- /**
384
- * Real-time collaboration configuration. When provided, the viewer connects
385
- * to the room (y-websocket or serverless y-webrtc), publishes local edits
386
- * granularly, and applies remote peers' edits into the editable slides.
387
- * Clearing it (undefined) tears the session down. A `viewer` role makes the
388
- * local user read-only. Remote cursors/presence render via the built-in
389
- * Share/Broadcast toolbar buttons; see `collab/collaboration.svelte.ts` and
390
- * `collab/components/`.
391
- */
392
- collaboration?: CollaborationConfig;
393
- /** Fired when a collaboration session starts (with the resolved config). */
394
- onstartcollaboration?: (config: CollaborationConfig) => void;
395
- /** Fired when a collaboration session stops. */
396
- onstopcollaboration?: () => void;
397
- /**
398
- * Prefilled values for the built-in Share dialog's form (room id, display
399
- * name, server URL). The Broadcast dialog reuses `serverUrl` from this same
400
- * object. Purely a starting point; the user can still edit every field.
401
- */
402
- shareDefaults?: {
403
- roomId?: string;
404
- userName?: string;
405
- serverUrl?: string;
406
- };
407
- }
408
-
409
- /** Colour mode for the printed output. */
410
- declare type PrintColorMode = 'color' | 'grayscale' | 'blackAndWhite';
411
-
412
- /**
413
- * Print flow: assemble the shared print document (slides / notes / handouts /
414
- * outline) and hand it to a print surface. All the pure logic is shared and
415
- * DOMPurify-hardened: `validatePrintSettings` normalises the caller's partial
416
- * settings, `computeSlideIndices` / `computeColorFilter` resolve the range and
417
- * colour mode, the `build*Html` helpers produce the escaped body markup, and
418
- * `buildPrintHtmlDocument` sanitises + assembles the final document. This
419
- * module (the Svelte counterpart of Vue's `usePrint`) only rasterises the
420
- * selected slides and opens the print surface.
421
- *
422
- * **Print surface / popup-blocker caveats:** the default opener renders the
423
- * document into a hidden same-origin `<iframe srcdoc>` and calls
424
- * `contentWindow.print()`, so no popup window is involved and popup blockers
425
- * cannot interfere (`document.write` is avoided too). A host that prefers a
426
- * visible print window can inject its own {@link OpenPrintWindow} via the
427
- * controller deps; note that a `window.open`-based opener only succeeds inside
428
- * a user gesture (a click handler) and returns `null` under popup blockers,
429
- * in which case it should report `false` so the flow resolves `false` and the
430
- * host can surface "allow popups for this site" guidance.
431
- */
432
- /** Options for the print flow: any subset of the shared print settings. */
433
- export declare type PrintOptions = Partial<PrintSettings>;
434
-
435
- /** Page orientation for the printed output. */
436
- declare type PrintOrientation = 'portrait' | 'landscape';
437
-
438
- /** Resolved print settings emitted on confirm. */
439
- declare interface PrintSettings {
440
- printWhat: PrintWhat;
441
- orientation: PrintOrientation;
442
- colorMode: PrintColorMode;
443
- frameSlides: boolean;
444
- slidesPerPage: HandoutSlidesPerPage;
445
- slideRange: PrintSlideRange;
446
- customRangeFrom: number;
447
- customRangeTo: number;
448
- }
449
-
450
- /** Slide range mode. */
451
- declare type PrintSlideRange = 'all' | 'current' | 'custom';
452
-
453
- /**
454
- * Pure print helpers shared by every binding's print path: settings validation,
455
- * slide-range / colour-filter resolution, page-count estimation, HTML markup
456
- * builders, escaping, and the full print-document assembler.
457
- *
458
- * No DOM side effects and no `window.print()`: everything is deterministic and
459
- * the binding writes the returned HTML string into a print window. The handout
460
- * grid geometry lives in `handout-layout`; this module reuses it.
461
- *
462
- * ng-packagr constraint honoured here (the Angular binding inlines this source
463
- * and compiles it through ng-packagr): NO `String.prototype.replaceAll`
464
- * (`escapeHtml` uses `.split(x).join(y)` instead).
465
- */
466
-
467
- /** What to print. */
468
- declare type PrintWhat = 'slides' | 'handouts' | 'notes' | 'outline';
469
-
470
- /**
471
- * Register (or extend) the dictionary for a locale. Later registrations are
472
- * merged over earlier ones, so hosts can override individual keys.
473
- */
474
- export declare function registerTranslations(locale: string, dictionary: TranslationDictionary): void;
475
-
476
- /**
477
- * Convert a `ViewerTheme` into a flat `Record<string, string>` of CSS
478
- * custom properties (including the `--` prefix) ready to be spread onto
479
- * a `style` attribute.
480
- *
481
- * Only properties that differ from the built-in defaults are emitted when
482
- * `omitDefaults` is true (the default).
483
- */
484
- export declare function themeToCssVars(theme: ViewerTheme | undefined, omitDefaults?: boolean): Record<string, string>;
485
-
486
- /**
487
- * Minimal, dependency-free translation layer for the Svelte binding.
488
- *
489
- * The canonical English dictionary lives in `pptx-viewer-shared/i18n` (shared
490
- * with the React, Vue, and Angular bindings, which each plug it into their
491
- * framework's i18n library). Svelte has no blessed i18n runtime, so this
492
- * module implements the small subset the viewer needs: dictionary lookup by
493
- * locale with English fallback, `{{name}}` interpolation, and the shared
494
- * `keyToLabel` humanised fallback for missing keys.
495
- */
496
- /** A flat dictionary of dotted `pptx.*` keys to display strings. */
497
- export declare type TranslationDictionary = Record<string, string>;
498
-
499
- /** Translate `key`, interpolating `{{name}}` placeholders from `params`. */
500
- export declare type Translator = (key: string, params?: Record<string, string | number>) => string;
501
-
502
- /** Dark "presenter" palette: the presenter room with the lights down. */
503
- export declare const vermilionDarkColors: ViewerThemeColors;
504
-
505
- /** Dark vermilion theme, ready for the viewer's `theme` prop. */
506
- export declare const vermilionDarkTheme: ViewerTheme;
507
-
508
- /** Light "paper" palette: a projection screen in a bright room. */
509
- export declare const vermilionLightColors: ViewerThemeColors;
510
-
511
- /** Light vermilion theme, ready for the viewer's `theme` prop. */
512
- export declare const vermilionLightTheme: ViewerTheme;
513
-
514
- /** Shared border-radius for the vermilion presets (slightly sharper than the default). */
515
- export declare const vermilionRadius = "0.375rem";
516
-
517
- /** Payload for the `onload` callback. */
518
- export declare interface ViewerLoadDetail {
519
- /** Number of slides in the loaded presentation. */
520
- slideCount: number;
521
- /** Slide canvas size in pixels. */
522
- canvasSize: CanvasSize;
523
- }
524
-
525
- /**
526
- * Full viewer theme configuration.
527
- *
528
- * Every property is optional — unset values fall back to the built-in
529
- * dark theme defaults.
530
- */
531
- export declare interface ViewerTheme {
532
- /** Semantic UI colors. Each key maps to a `--pptx-<key>` CSS custom property. */
533
- colors?: Partial<ViewerThemeColors>;
534
- /** Base border-radius value (e.g. `"0.5rem"`, `"8px"`). */
535
- radius?: string;
536
- /**
537
- * Escape hatch: arbitrary CSS custom properties to set on the viewer
538
- * root element. Keys should include the `--` prefix.
539
- *
540
- * @example
541
- * ```ts
542
- * { "--my-custom-shadow": "0 4px 12px rgba(0,0,0,0.5)" }
543
- * ```
544
- */
545
- cssVars?: Record<string, string>;
546
- }
547
-
548
- /**
549
- * Theme configuration types for the PowerPoint viewer.
550
- *
551
- * All color values accept any valid CSS color string:
552
- * hex (`#6366f1`), rgb (`rgb(99 102 241)`), hsl (`hsl(239 84% 67%)`),
553
- * oklch (`oklch(0.585 0.233 277)`), named colors, etc.
554
- *
555
- * Framework-agnostic — shared by the React, Vue, and Angular bindings.
556
- */
557
- /**
558
- * Semantic color tokens for the viewer UI.
559
- *
560
- * These map to CSS custom properties (`--pptx-<token>`) and drive all
561
- * UI component colors. The naming follows the shadcn/ui convention so
562
- * that Tailwind + shadcn users get a familiar experience.
563
- */
564
- export declare interface ViewerThemeColors {
565
- /** Page / root background */
566
- background: string;
567
- /** Default text color */
568
- foreground: string;
569
- /** Card / panel surface */
570
- card: string;
571
- /** Text on card surfaces */
572
- cardForeground: string;
573
- /** Popover / dropdown surface */
574
- popover: string;
575
- /** Text inside popovers */
576
- popoverForeground: string;
577
- /** Primary action color (buttons, active indicators) */
578
- primary: string;
579
- /** Text on primary-colored backgrounds */
580
- primaryForeground: string;
581
- /** Secondary / subdued action color */
582
- secondary: string;
583
- /** Text on secondary backgrounds */
584
- secondaryForeground: string;
585
- /** Muted / disabled surface */
586
- muted: string;
587
- /** Text on muted surfaces (also used for secondary text) */
588
- mutedForeground: string;
589
- /** Accent / hover-highlight surface */
590
- accent: string;
591
- /** Text on accent surfaces */
592
- accentForeground: string;
593
- /** Destructive / danger action color */
594
- destructive: string;
595
- /** Text on destructive backgrounds */
596
- destructiveForeground: string;
597
- /** Default border color */
598
- border: string;
599
- /** Input field border color */
600
- input: string;
601
- /** Focus ring color */
602
- ring: string;
603
- }
604
-
605
- export { }
1
+ import { Component } from 'svelte';
2
+
3
+ /**
4
+ * Theme configuration types for the PowerPoint viewer.
5
+ *
6
+ * All color values accept any valid CSS color string:
7
+ * hex (`#6366f1`), rgb (`rgb(99 102 241)`), hsl (`hsl(239 84% 67%)`),
8
+ * oklch (`oklch(0.585 0.233 277)`), named colors, etc.
9
+ *
10
+ * Framework-agnostic — shared by the React, Vue, and Angular bindings.
11
+ */
12
+ /**
13
+ * Semantic color tokens for the viewer UI.
14
+ *
15
+ * These map to CSS custom properties (`--pptx-<token>`) and drive all
16
+ * UI component colors. The naming follows the shadcn/ui convention so
17
+ * that Tailwind + shadcn users get a familiar experience.
18
+ */
19
+ interface ViewerThemeColors {
20
+ /** Page / root background */
21
+ background: string;
22
+ /** Default text color */
23
+ foreground: string;
24
+ /** Card / panel surface */
25
+ card: string;
26
+ /** Text on card surfaces */
27
+ cardForeground: string;
28
+ /** Popover / dropdown surface */
29
+ popover: string;
30
+ /** Text inside popovers */
31
+ popoverForeground: string;
32
+ /** Primary action color (buttons, active indicators) */
33
+ primary: string;
34
+ /** Text on primary-colored backgrounds */
35
+ primaryForeground: string;
36
+ /** Secondary / subdued action color */
37
+ secondary: string;
38
+ /** Text on secondary backgrounds */
39
+ secondaryForeground: string;
40
+ /** Muted / disabled surface */
41
+ muted: string;
42
+ /** Text on muted surfaces (also used for secondary text) */
43
+ mutedForeground: string;
44
+ /** Accent / hover-highlight surface */
45
+ accent: string;
46
+ /** Text on accent surfaces */
47
+ accentForeground: string;
48
+ /** Destructive / danger action color */
49
+ destructive: string;
50
+ /** Text on destructive backgrounds */
51
+ destructiveForeground: string;
52
+ /** Default border color */
53
+ border: string;
54
+ /** Input field border color */
55
+ input: string;
56
+ /** Focus ring color */
57
+ ring: string;
58
+ }
59
+ /**
60
+ * Full viewer theme configuration.
61
+ *
62
+ * Every property is optional unset values fall back to the built-in
63
+ * dark theme defaults.
64
+ */
65
+ interface ViewerTheme {
66
+ /** Semantic UI colors. Each key maps to a `--pptx-<key>` CSS custom property. */
67
+ colors?: Partial<ViewerThemeColors>;
68
+ /** Base border-radius value (e.g. `"0.5rem"`, `"8px"`). */
69
+ radius?: string;
70
+ /**
71
+ * Escape hatch: arbitrary CSS custom properties to set on the viewer
72
+ * root element. Keys should include the `--` prefix.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * { "--my-custom-shadow": "0 4px 12px rgba(0,0,0,0.5)" }
77
+ * ```
78
+ */
79
+ cssVars?: Record<string, string>;
80
+ }
81
+
82
+ /**
83
+ * Default dark-theme color values.
84
+ *
85
+ * These correspond to the built-in dark UI of the PowerPoint viewer and
86
+ * use Tailwind's gray palette as the neutral scale with indigo as the
87
+ * primary accent.
88
+ */
89
+ declare const defaultThemeColors: ViewerThemeColors;
90
+ /** Default border-radius. */
91
+ declare const defaultRadius = "0.5rem";
92
+
93
+ /**
94
+ * Convert a `ViewerTheme` into a flat `Record<string, string>` of CSS
95
+ * custom properties (including the `--` prefix) ready to be spread onto
96
+ * a `style` attribute.
97
+ *
98
+ * Only properties that differ from the built-in defaults are emitted when
99
+ * `omitDefaults` is true (the default).
100
+ */
101
+ declare function themeToCssVars(theme: ViewerTheme | undefined, omitDefaults?: boolean): Record<string, string>;
102
+ /**
103
+ * Build the complete set of CSS custom properties with all defaults.
104
+ * Useful for generating a full fallback stylesheet.
105
+ */
106
+ declare function defaultCssVars(): Record<string, string>;
107
+
108
+ /**
109
+ * Built-in "vermilion" theme presets.
110
+ *
111
+ * These mirror the pptx-viewer brand used on the documentation site:
112
+ * a warm paper canvas in light mode, a dimmed presenter room in dark
113
+ * mode, and the vermilion accent in both. Pass one to the viewer's
114
+ * `theme` prop (React/Vue) or `provideViewerTheme` (Angular), or spread
115
+ * the color objects to derive your own variant.
116
+ */
117
+ /** Light "paper" palette: a projection screen in a bright room. */
118
+ declare const vermilionLightColors: ViewerThemeColors;
119
+ /** Dark "presenter" palette: the presenter room with the lights down. */
120
+ declare const vermilionDarkColors: ViewerThemeColors;
121
+ /** Shared border-radius for the vermilion presets (slightly sharper than the default). */
122
+ declare const vermilionRadius = "0.375rem";
123
+ /** Light vermilion theme, ready for the viewer's `theme` prop. */
124
+ declare const vermilionLightTheme: ViewerTheme;
125
+ /** Dark vermilion theme, ready for the viewer's `theme` prop. */
126
+ declare const vermilionDarkTheme: ViewerTheme;
127
+
128
+ /**
129
+ * Strongly-typed parsed XML node from fast-xml-parser.
130
+ *
131
+ * The parser is configured with `attributeNamePrefix: '@_'`,
132
+ * `parseAttributeValue: false`, and `parseTagValue: false`, so attribute and
133
+ * text values are always strings at runtime. This type encodes that:
134
+ *
135
+ * - **Attributes** — keys matching `` `@_${string}` `` return
136
+ * `string | undefined` directly.
137
+ * - **Text content** — `#text` returns `string | undefined`.
138
+ * - **Child elements** — any other string key returns
139
+ * `XmlObject | XmlObject[] | string | undefined`. The union reflects that
140
+ * fast-xml-parser may emit an object (single child), an array (repeated
141
+ * children), or a bare string (text-only element collapsed by the parser).
142
+ *
143
+ * For traversal, prefer the helpers in {@link ./../utils/xml-access}
144
+ * `xmlChild` / `xmlChildren` / `xmlAttr` / `xmlText` / `xmlPath` — which
145
+ * narrow the union and normalize the single-vs-array duality. Direct
146
+ * indexing works for attributes (typed as string) but chained child access
147
+ * (`obj['p:spPr']?.['a:xfrm']`) requires the helpers or a narrowing cast
148
+ * because TypeScript cannot index into the `XmlObject[] | string` part of
149
+ * the union.
150
+ */
151
+ interface XmlObject {
152
+ /** Attributes (`@_`-prefixed keys) are always strings at runtime. */
153
+ [attr: `@_${string}`]: string | undefined;
154
+ /** Element text content surfaces under `#text` when present. */
155
+ '#text'?: string;
156
+ /**
157
+ * Child elements keyed by their (namespaced) tag name. fast-xml-parser
158
+ * emits a single object for unique elements, an array for repeated ones,
159
+ * and a bare string for elements collapsed to their text content. Use
160
+ * the helpers in `utils/xml-access` to narrow this union.
161
+ */
162
+ [child: string]: XmlObject | XmlObject[] | string | undefined;
163
+ }
164
+
165
+ /**
166
+ * Image types: effects, crop shapes, and properties shared by image/picture
167
+ * elements.
168
+ *
169
+ * @module pptx-types/image
170
+ */
171
+ /**
172
+ * Blend mode for `a:blend` container nodes inside an `a:effectDag` (CT_BlendEffect).
173
+ *
174
+ * Per ECMA-376 §20.1.8.10, valid values are: `darken`, `lighten`, `mult`,
175
+ * `over`, `screen`.
176
+ */
177
+ type EffectDagBlendMode = 'darken' | 'lighten' | 'mult' | 'over' | 'screen';
178
+ /**
179
+ * Container node kind inside an `a:effectDag` (CT_EffectContainer @type).
180
+ *
181
+ * Per ECMA-376 §20.1.8.20, `sib` (sibling) draws each child independently
182
+ * over the same source; `tree` (tree) chains effects so each sees the output
183
+ * of its siblings.
184
+ */
185
+ type EffectDagContainerType = 'sib' | 'tree';
186
+ /**
187
+ * Typed model of the directed-acyclic effect graph stored in `a:effectDag`.
188
+ *
189
+ * The four "structural" container/transform nodes are typed; any other inner
190
+ * effect (e.g. `a:outerShdw`, `a:glow`, `a:alphaInv`) is preserved verbatim
191
+ * as a raw XML object via the {@link EffectDagRawLeaf} variant so we never
192
+ * have to recurse into the full effect taxonomy.
193
+ *
194
+ * @example
195
+ * ```ts
196
+ * // <a:effectDag>
197
+ * // <a:cont type="sib">
198
+ * // <a:blend blend="mult"><a:cont type="tree" /></a:blend>
199
+ * // </a:cont>
200
+ * // </a:effectDag>
201
+ * const dag: EffectDagContainer = {
202
+ * kind: "cont",
203
+ * type: "sib",
204
+ * children: [{
205
+ * kind: "blend",
206
+ * mode: "mult",
207
+ * container: { kind: "cont", type: "tree", children: [] },
208
+ * }],
209
+ * };
210
+ * ```
211
+ */
212
+ type EffectDagNode = EffectDagContainer | EffectDagBlend | EffectDagXfrm | EffectDagRelOff | EffectDagRawLeaf;
213
+ /** `a:cont` CT_EffectContainer. Recursive; mirrors the top-level `effectDag`. */
214
+ interface EffectDagContainer {
215
+ kind: 'cont';
216
+ /** `@type` `sib` or `tree`. */
217
+ type: EffectDagContainerType;
218
+ /** Optional `@name` attribute. */
219
+ name?: string;
220
+ /** Ordered children. */
221
+ children: EffectDagNode[];
222
+ }
223
+ /** `a:blend` CT_BlendEffect. Always wraps a single `a:cont` child. */
224
+ interface EffectDagBlend {
225
+ kind: 'blend';
226
+ /** `@blend` attribute. */
227
+ mode: EffectDagBlendMode;
228
+ /** Required child `a:cont` container. */
229
+ container: EffectDagContainer;
230
+ }
231
+ /** `a:xfrmEffect` — CT_TransformEffect. Affine transform with no children. */
232
+ interface EffectDagXfrm {
233
+ kind: 'xfrmEffect';
234
+ /** Horizontal scale, percentage * 1000 (e.g. 100000 = 100%). */
235
+ sx?: number;
236
+ /** Vertical scale, percentage * 1000. */
237
+ sy?: number;
238
+ /** Horizontal skew, degrees * 60000. */
239
+ kx?: number;
240
+ /** Vertical skew, degrees * 60000. */
241
+ ky?: number;
242
+ /** Horizontal translation in EMU. */
243
+ tx?: number;
244
+ /** Vertical translation in EMU. */
245
+ ty?: number;
246
+ }
247
+ /** `a:relOff` — CT_RelativeOffsetEffect. Relative offset in 1000ths of a percent. */
248
+ interface EffectDagRelOff {
249
+ kind: 'relOff';
250
+ /** Horizontal offset, percentage * 1000. */
251
+ tx?: number;
252
+ /** Vertical offset, percentage * 1000. */
253
+ ty?: number;
254
+ }
255
+ /**
256
+ * Catch-all leaf preserving any non-container effect (e.g. `a:outerShdw`,
257
+ * `a:glow`, `a:alphaInv`) as raw XML. Re-emitted verbatim on save.
258
+ */
259
+ interface EffectDagRawLeaf {
260
+ kind: 'raw';
261
+ /** Local element name without the `a:` prefix (e.g. `outerShdw`, `glow`). */
262
+ tag: string;
263
+ /** Raw XML object captured at load preserved verbatim on save. */
264
+ xml: Record<string, unknown>;
265
+ }
266
+ declare module "./index" {
267
+ interface TextStyle {
268
+ /**
269
+ * Raw `a:effectDag` XML node from `a:rPr`, preserved verbatim for
270
+ * round-trip serialisation. Mirrors the shape-level
271
+ * {@link import('./shape-style').ShapeStyle.effectDagXml} field.
272
+ */
273
+ textEffectDagXml?: XmlObject;
274
+ /**
275
+ * Typed effect graph parsed from `textEffectDagXml`. The four structural
276
+ * container nodes (`a:cont`, `a:blend`, `a:xfrmEffect`, `a:relOff`) are
277
+ * fully typed; any other leaf effect is captured as
278
+ * {@link EffectDagRawLeaf} so we never have to recurse into the full
279
+ * effect taxonomy.
280
+ */
281
+ textEffectDagTree?: EffectDagContainer;
282
+ }
283
+ }
284
+ declare module "./index" {
285
+ interface ShapeStyle {
286
+ /**
287
+ * Typed effect graph parsed from {@link ShapeStyle.effectDagXml}. The four
288
+ * structural container nodes (`a:cont`, `a:blend`, `a:xfrmEffect`,
289
+ * `a:relOff`) are fully typed; any other leaf effect (e.g. `a:outerShdw`,
290
+ * `a:glow`, `a:alphaInv`) is captured as {@link EffectDagRawLeaf} so we
291
+ * never have to recurse into the full effect taxonomy.
292
+ */
293
+ effectDagTree?: EffectDagContainer;
294
+ }
295
+ }
296
+
297
+ /**
298
+ * Framework-agnostic public types shared by the viewer bindings.
299
+ *
300
+ * These were duplicated in the React (`types-ui.ts`) and Vue (`viewer/types.ts`)
301
+ * packages; this is the canonical copy. Each binding layers its own
302
+ * framework-specific prop/event/handle types on top of these.
303
+ */
304
+
305
+ /** Canvas dimensions in pixels. */
306
+ interface CanvasSize {
307
+ width: number;
308
+ height: number;
309
+ }
310
+ /** Collaboration role within a session. */
311
+ type CollaborationRole = 'owner' | 'collaborator' | 'viewer';
312
+ /**
313
+ * Collaboration transport.
314
+ *
315
+ * - `'websocket'` (default): y-websocket against `serverUrl`.
316
+ * - `'webrtc'`: y-webrtc peer-to-peer; needs no document server. Peers meet
317
+ * through the `signaling` servers (WebRTC signaling only, no document data)
318
+ * and same-browser tabs additionally sync via BroadcastChannel even without
319
+ * any signaling server, which makes this mode usable from static hosting.
320
+ */
321
+ type CollaborationTransport = 'websocket' | 'webrtc';
322
+ /**
323
+ * Real-time collaboration configuration.
324
+ *
325
+ * The same shape is accepted by the React, Vue, and Angular bindings.
326
+ */
327
+ interface CollaborationConfig {
328
+ /** Unique identifier for the collaboration room (alphanumeric, hyphens, underscores). */
329
+ roomId: string;
330
+ /**
331
+ * WebSocket server URL for the Yjs provider (e.g. "wss://collab.example.com").
332
+ * Ignored (may be empty) when `transport` is `'webrtc'`.
333
+ */
334
+ serverUrl: string;
335
+ /** Transport to use. Defaults to `'websocket'`. */
336
+ transport?: CollaborationTransport;
337
+ /**
338
+ * WebRTC signaling server URLs (only used when `transport` is `'webrtc'`).
339
+ * Defaults to y-webrtc's built-in public signaling list. Same-browser tabs
340
+ * sync via BroadcastChannel regardless of signaling availability.
341
+ */
342
+ signaling?: string[];
343
+ /** Display name for the local user. */
344
+ userName: string;
345
+ /** Avatar URL for the local user (optional). */
346
+ userAvatar?: string;
347
+ /** Hex colour for the local user's cursor/presence indicator. */
348
+ userColor?: string;
349
+ /** Optional authentication token sent with the WebSocket handshake. */
350
+ authToken?: string;
351
+ /** Role in the session; defaults to `'collaborator'`. */
352
+ role?: CollaborationRole;
353
+ /**
354
+ * Elected-writer write-back callback (Area 3 of the C3 hardening plan).
355
+ *
356
+ * When the local user has `role: 'owner'`, the binding debounces changes and
357
+ * serializes the current Y.Doc state to a PPTX byte array, then calls this
358
+ * callback so the host can persist the snapshot. Only one writer (the owner)
359
+ * does this; other collaborators never trigger write-back, eliminating the
360
+ * last-save-wins problem.
361
+ */
362
+ onWriteBack?: (bytes: Uint8Array) => void;
363
+ /**
364
+ * Debounce delay (ms) between the last Y.Doc change and the write-back
365
+ * invocation. Defaults to 5000 ms. Set to 0 to write back on every change
366
+ * (not recommended for large documents).
367
+ */
368
+ writeBackDebounceMs?: number;
369
+ }
370
+ interface AutosaveRecord {
371
+ key: string;
372
+ data: Uint8Array;
373
+ timestamp: number;
374
+ size: number;
375
+ }
376
+ /**
377
+ * Retrieve a single autosave snapshot by file path.
378
+ * Returns undefined when no snapshot exists.
379
+ */
380
+ declare function getAutosaveSnapshot(filePath: string): Promise<AutosaveRecord | undefined>;
381
+ /**
382
+ * List all autosave snapshots (without the heavy `data` blob).
383
+ * Useful for showing a recovery picker on app start.
384
+ */
385
+ declare function listAutosaveSnapshots(): Promise<Array<{
386
+ key: string;
387
+ timestamp: number;
388
+ size: number;
389
+ }>>;
390
+ /**
391
+ * Delete an autosave snapshot by file path.
392
+ */
393
+ declare function deleteAutosaveSnapshot(filePath: string): Promise<boolean>;
394
+
395
+ /**
396
+ * Pure handout layout calculations, shared by every binding's print path.
397
+ *
398
+ * Handles distributing slides across pages, computing grid dimensions, and
399
+ * positioning cells within A4 page space. No DOM/framework dependency: callers
400
+ * render the resulting rectangles however their view layer prefers.
401
+ */
402
+ /** Supported slides-per-page values. */
403
+ type HandoutSlidesPerPage = 1 | 2 | 3 | 4 | 6 | 9;
404
+
405
+ /**
406
+ * Pure print helpers shared by every binding's print path: settings validation,
407
+ * slide-range / colour-filter resolution, page-count estimation, HTML markup
408
+ * builders, escaping, and the full print-document assembler.
409
+ *
410
+ * No DOM side effects and no `window.print()`: everything is deterministic and
411
+ * the binding writes the returned HTML string into a print window. The handout
412
+ * grid geometry lives in `handout-layout`; this module reuses it.
413
+ *
414
+ * ng-packagr constraint honoured here (the Angular binding inlines this source
415
+ * and compiles it through ng-packagr): NO `String.prototype.replaceAll`
416
+ * (`escapeHtml` uses `.split(x).join(y)` instead).
417
+ */
418
+
419
+ /** What to print. */
420
+ type PrintWhat = 'slides' | 'handouts' | 'notes' | 'outline';
421
+ /** Page orientation for the printed output. */
422
+ type PrintOrientation = 'portrait' | 'landscape';
423
+ /** Colour mode for the printed output. */
424
+ type PrintColorMode = 'color' | 'grayscale' | 'blackAndWhite';
425
+ /** Slide range mode. */
426
+ type PrintSlideRange = 'all' | 'current' | 'custom';
427
+ /** Resolved print settings emitted on confirm. */
428
+ interface PrintSettings {
429
+ printWhat: PrintWhat;
430
+ orientation: PrintOrientation;
431
+ colorMode: PrintColorMode;
432
+ frameSlides: boolean;
433
+ slidesPerPage: HandoutSlidesPerPage;
434
+ slideRange: PrintSlideRange;
435
+ customRangeFrom: number;
436
+ customRangeTo: number;
437
+ }
438
+
439
+ /**
440
+ * Animated-GIF export capture/encode pipeline. All the pure logic is shared:
441
+ * `planGifFrames` derives the per-slide frame delays (default duration +
442
+ * per-slide overrides), `clampGifDimensions` bounds the output size, and
443
+ * `encodeGif` (median-cut quantisation + LZW GIF89a) produces the bytes with
444
+ * each frame carrying its own plan delay. This module only owns the
445
+ * DOM-adjacent glue: rasterising each slide via the injected capture callback
446
+ * and normalising every frame onto a uniform-size canvas before pixel
447
+ * extraction. Blob download is left to the caller (`ExportController`).
448
+ */
449
+ /** Options for the animated-GIF export. */
450
+ interface ExportGifOptions {
451
+ /** Duration each slide is shown, in milliseconds. Default 2000. */
452
+ slideDurationMs?: number;
453
+ /** Per-slide duration overrides in milliseconds (index maps to slide index). */
454
+ slideTimingsMs?: number[];
455
+ /**
456
+ * Longest allowed output side in pixels; frames are scaled down
457
+ * proportionally. Default 960 (GIF encoding cost grows with pixel count:
458
+ * every pixel is matched against a 256-colour palette per frame).
459
+ */
460
+ maxDimension?: number;
461
+ /** Capture-phase progress callback: `(currentSlide, totalSlides)`. */
462
+ onProgress?: ExportProgress;
463
+ /** Abort the export early; checked before each slide capture. */
464
+ signal?: AbortSignal;
465
+ }
466
+
467
+ /**
468
+ * Print flow: assemble the shared print document (slides / notes / handouts /
469
+ * outline) and hand it to a print surface. All the pure logic is shared and
470
+ * DOMPurify-hardened: `validatePrintSettings` normalises the caller's partial
471
+ * settings, `computeSlideIndices` / `computeColorFilter` resolve the range and
472
+ * colour mode, the `build*Html` helpers produce the escaped body markup, and
473
+ * `buildPrintHtmlDocument` sanitises + assembles the final document. This
474
+ * module (the Svelte counterpart of Vue's `usePrint`) only rasterises the
475
+ * selected slides and opens the print surface.
476
+ *
477
+ * **Print surface / popup-blocker caveats:** the default opener renders the
478
+ * document into a hidden same-origin `<iframe srcdoc>` and calls
479
+ * `contentWindow.print()`, so no popup window is involved and popup blockers
480
+ * cannot interfere (`document.write` is avoided too). A host that prefers a
481
+ * visible print window can inject its own {@link OpenPrintWindow} via the
482
+ * controller deps; note that a `window.open`-based opener only succeeds inside
483
+ * a user gesture (a click handler) and returns `null` under popup blockers,
484
+ * in which case it should report `false` so the flow resolves `false` and the
485
+ * host can surface "allow popups for this site" guidance.
486
+ */
487
+ /** Options for the print flow: any subset of the shared print settings. */
488
+ type PrintOptions = Partial<PrintSettings>;
489
+
490
+ /**
491
+ * Video (WebM) export driven by the shared `video-plan` maths: segment timing
492
+ * comes from `planVideoSegments` (default duration + per-slide overrides +
493
+ * fps -> frame count), the frame pacing from `fpsToFrameIntervalMs`, and the
494
+ * recorder MIME type from `pickSupportedMimeType(WEBM_MIME_CANDIDATES)`. This
495
+ * module owns the browser glue only: rasterise every slide first (capture
496
+ * phase), then replay each canvas onto a recording canvas whose
497
+ * `captureStream()` feeds a `MediaRecorder` (recording phase). Mirrors
498
+ * React's `exportAllSlidesAsVideo`, minus the live-stage slide flipping (the
499
+ * injected rasteriser renders off-screen instead).
500
+ */
501
+ /** Options for the WebM video export. */
502
+ interface ExportVideoOptions {
503
+ /** Duration each slide is shown, in milliseconds. Default 3000. */
504
+ slideDurationMs?: number;
505
+ /** Per-slide duration overrides in milliseconds (index maps to slide index). */
506
+ slideTimingsMs?: number[];
507
+ /** Recording frame rate. Default 30. */
508
+ fps?: number;
509
+ /** Recorder bitrate. Default 5,000,000 (5 Mbps). */
510
+ videoBitsPerSecond?: number;
511
+ /** Capture-phase progress callback: `(currentSlide, totalSlides)`. */
512
+ onProgress?: ExportProgress;
513
+ /** Recording-phase progress callback: `(currentSlide, totalSlides)`. */
514
+ onRecordProgress?: ExportProgress;
515
+ /** Abort the export early; checked between slides and between frames. */
516
+ signal?: AbortSignal;
517
+ }
518
+
519
+ /** Per-slide progress callback: `(currentSlideIndex, totalSlides)`. */
520
+ type ExportProgress = (current: number, total: number) => void;
521
+ /** Options for the multi-slide PDF export (progress + cooperative cancel). */
522
+ interface ExportPdfOptions {
523
+ /** Capture-phase progress callback: `(currentSlide, totalSlides)`. */
524
+ onProgress?: ExportProgress;
525
+ /** Abort the export early; the loop checks this between slides. */
526
+ signal?: AbortSignal;
527
+ }
528
+
529
+ /**
530
+ * Minimal, dependency-free translation layer for the Svelte binding.
531
+ *
532
+ * The canonical English dictionary lives in `pptx-viewer-shared/i18n` (shared
533
+ * with the React, Vue, and Angular bindings, which each plug it into their
534
+ * framework's i18n library). Svelte has no blessed i18n runtime, so this
535
+ * module implements the small subset the viewer needs: dictionary lookup by
536
+ * locale with English fallback, `{{name}}` interpolation, and the shared
537
+ * `keyToLabel` humanised fallback for missing keys.
538
+ */
539
+ /** A flat dictionary of dotted `pptx.*` keys to display strings. */
540
+ type TranslationDictionary = Record<string, string>;
541
+ /** Translate `key`, interpolating `{{name}}` placeholders from `params`. */
542
+ type Translator = (key: string, params?: Record<string, string | number>) => string;
543
+ /**
544
+ * Register (or extend) the dictionary for a locale. Later registrations are
545
+ * merged over earlier ones, so hosts can override individual keys.
546
+ */
547
+ declare function registerTranslations(locale: string, dictionary: TranslationDictionary): void;
548
+
549
+ /** Payload for the `onload` callback. */
550
+ interface ViewerLoadDetail {
551
+ /** Number of slides in the loaded presentation. */
552
+ slideCount: number;
553
+ /** Slide canvas size in pixels. */
554
+ canvasSize: CanvasSize;
555
+ }
556
+ /** Props for `<PowerPointViewer>`. */
557
+ interface PowerPointViewerProps {
558
+ /** PowerPoint content as `Uint8Array` (or `ArrayBuffer`). */
559
+ source: Uint8Array | ArrayBuffer | null | undefined;
560
+ /**
561
+ * Theme configuration for customising the viewer's appearance. Accepts
562
+ * partial color overrides, a custom border-radius, and arbitrary CSS
563
+ * custom properties. Unset values fall back to the built-in defaults.
564
+ */
565
+ theme?: ViewerTheme;
566
+ /** UI locale (BCP 47). English ships built in; register others via `pptx-svelte-viewer/i18n`. */
567
+ locale?: string;
568
+ /** Slide shown after load (0-based, clamped). Default 0. */
569
+ initialSlide?: number;
570
+ /** Show the thumbnail sidebar. Default true. */
571
+ showThumbnails?: boolean;
572
+ /** Show the navigation/zoom toolbar. Default true. */
573
+ showToolbar?: boolean;
574
+ /**
575
+ * Show the speaker-notes panel and its toolbar toggle. Default true. The
576
+ * panel is plain-text only and reads the active slide's notes; pass
577
+ * `onnotesupdate` to make it editable (omitting it renders read-only).
578
+ */
579
+ showNotes?: boolean;
580
+ /**
581
+ * Opt in to the experimental Three.js (WebGL) SmartArt renderer for
582
+ * `smartArt` elements, in place of the default SVG renderer. Requires the
583
+ * optional `three` peer dependency; when it is unavailable, or a diagram
584
+ * has no renderable nodes, or the WebGL mount fails, the SVG renderer is
585
+ * used automatically. Default false.
586
+ */
587
+ smartArt3D?: boolean;
588
+ /**
589
+ * Enable in-place editing: click to select an element, drag to move, use the
590
+ * 8 handles to resize (Shift locks aspect) and the rotate handle to rotate,
591
+ * double-click text/shapes to edit their text, and the keyboard for
592
+ * delete/duplicate/nudge/undo/redo. Adds an Undo/Redo/Save/Download group to
593
+ * the toolbar. Default false (read-only viewer).
594
+ */
595
+ editable?: boolean;
596
+ /** Optional class name applied to the root element. */
597
+ class?: string;
598
+ /** Optional display name shown in the desktop title bar. */
599
+ fileName?: string;
600
+ /** Fired after a presentation finishes loading. */
601
+ onload?: (detail: ViewerLoadDetail) => void;
602
+ /** Fired when a load fails (message is human-readable). */
603
+ onerror?: (message: string) => void;
604
+ /** Fired when the active slide changes (0-based index). */
605
+ onslidechange?: (index: number) => void;
606
+ /**
607
+ * Fired with the committed plain-text speaker notes when the user edits
608
+ * the notes panel (on `change` / `blur`). This binding has no built-in
609
+ * slide-mutation channel, so the host is responsible for writing the text
610
+ * back onto its own copy of the slide; omit this to render the notes
611
+ * panel read-only.
612
+ */
613
+ onnotesupdate?: (notes: string) => void;
614
+ /**
615
+ * Fired after every committed editing mutation (move / resize / rotate /
616
+ * delete / duplicate / nudge / inline text / notes) when `editable`. Use it
617
+ * to track the dirty state or mirror edits into host state.
618
+ */
619
+ onchange?: () => void;
620
+ /**
621
+ * Enable debounced crash-recovery autosave. On each edit (when `editable`)
622
+ * the current slides are serialized to `.pptx` bytes and written to the
623
+ * shared IndexedDB recovery store (keyed by {@link filePath}), and
624
+ * `onautosave` is fired with the bytes. Requires `filePath`; without one the
625
+ * autosave indicator reads "disabled". This binding does not auto-restore on
626
+ * load; recovery is a host concern (see the re-exported `getAutosaveSnapshot`
627
+ * / `listAutosaveSnapshots` helpers). Default false.
628
+ */
629
+ autosave?: boolean;
630
+ /** Fired when the desktop title bar toggles AutoSave for this viewer instance. */
631
+ onautosavetoggle?: (enabled: boolean) => void;
632
+ /**
633
+ * IndexedDB record key for autosave (typically the open file's name/path).
634
+ * Autosave is inert until this is set.
635
+ */
636
+ filePath?: string;
637
+ /** Autosave debounce window in milliseconds. Default 2000. */
638
+ autosaveIntervalMs?: number;
639
+ /** Fired with the serialized `.pptx` bytes after each successful autosave. */
640
+ onautosave?: (bytes: Uint8Array) => void;
641
+ /**
642
+ * Real-time collaboration configuration. When provided, the viewer connects
643
+ * to the room (y-websocket or serverless y-webrtc), publishes local edits
644
+ * granularly, and applies remote peers' edits into the editable slides.
645
+ * Clearing it (undefined) tears the session down. A `viewer` role makes the
646
+ * local user read-only. Remote cursors/presence render via the built-in
647
+ * Share/Broadcast toolbar buttons; see `collab/collaboration.svelte.ts` and
648
+ * `collab/components/`.
649
+ */
650
+ collaboration?: CollaborationConfig;
651
+ /** Fired when a collaboration session starts (with the resolved config). */
652
+ onstartcollaboration?: (config: CollaborationConfig) => void;
653
+ /** Fired when a collaboration session stops. */
654
+ onstopcollaboration?: () => void;
655
+ /**
656
+ * Prefilled values for the built-in Share dialog's form (room id, display
657
+ * name, server URL). The Broadcast dialog reuses `serverUrl` from this same
658
+ * object. Purely a starting point; the user can still edit every field.
659
+ */
660
+ shareDefaults?: {
661
+ roomId?: string;
662
+ userName?: string;
663
+ serverUrl?: string;
664
+ };
665
+ }
666
+ /**
667
+ * Imperative editing API exposed on the `<PowerPointViewer>` component
668
+ * instance (via `bind:this`). Mirrors the vanilla binding's `EditorController`
669
+ * surface subset the host drives directly.
670
+ */
671
+ interface PowerPointViewerApi {
672
+ /** Undo the last committed edit. */
673
+ undo(): void;
674
+ /** Redo the last undone edit. */
675
+ redo(): void;
676
+ /** Whether an undo step is available (snapshot; not reactive). */
677
+ canUndo(): boolean;
678
+ /** Whether a redo step is available (snapshot; not reactive). */
679
+ canRedo(): boolean;
680
+ /** Delete the selected element (no-op when nothing is selected). */
681
+ deleteSelected(): void;
682
+ /** The selected top-level element id, or null. */
683
+ getSelectedElementId(): string | null;
684
+ /** Serialize the edited slides to `.pptx` bytes via the core handler. */
685
+ save(): Promise<Uint8Array>;
686
+ /** Save + trigger a browser download of the `.pptx` (default name). */
687
+ downloadPptx(fileName?: string): Promise<void>;
688
+ /**
689
+ * Export a slide as a PNG download (defaults to the current slide). Renders
690
+ * the slide off-screen at scale 1 and rasterises it with `html2canvas-pro`
691
+ * (dynamically imported), so the first call pays a one-time load cost.
692
+ */
693
+ exportSlidePng(index?: number): Promise<void>;
694
+ /**
695
+ * Export every slide as a multi-page PDF download (one slide per page).
696
+ * `jspdf` is dynamically imported on first use.
697
+ */
698
+ exportPdf(options?: ExportPdfOptions): Promise<void>;
699
+ /**
700
+ * Export every slide as an animated GIF download. Per-slide frame delays
701
+ * come from the shared frame plan: a default `slideDurationMs` (2000) with
702
+ * optional per-slide `slideTimingsMs` overrides. Supports `onProgress` and
703
+ * an `AbortSignal`, like {@link exportPdf}.
704
+ */
705
+ exportGif(options?: ExportGifOptions): Promise<void>;
706
+ /**
707
+ * Export every slide as a WebM video download (canvas capture stream +
708
+ * `MediaRecorder`; codec picked from the shared WebM candidates). Timing
709
+ * follows the shared video plan (`slideDurationMs` default 3000, per-slide
710
+ * `slideTimingsMs`, `fps` default 30). Supports capture/recording progress
711
+ * callbacks and an `AbortSignal`.
712
+ */
713
+ exportVideo(options?: ExportVideoOptions): Promise<void>;
714
+ /**
715
+ * Assemble the shared print document (slides / handouts / notes / outline,
716
+ * slide range + colour mode) and open the browser print dialog. The default
717
+ * print surface is a hidden same-origin iframe, so no popup window is
718
+ * involved; a custom `window.open`-based opener (injectable at the
719
+ * controller level) is subject to popup blockers, in which case the promise
720
+ * resolves `false`. Resolves `true` once the print surface opened.
721
+ */
722
+ print(options?: PrintOptions): Promise<boolean>;
723
+ }
724
+
725
+ /**
726
+ * Explicitly-typed public export of the viewer component.
727
+ *
728
+ * `svelte-check` types the `.svelte` import precisely, but the plain
729
+ * TypeScript pass that emits the published declaration files resolves
730
+ * `.svelte` modules through a loose ambient shim (`src/shims-svelte.d.ts`).
731
+ * Re-exporting through this annotated constant keeps the published `.d.ts`
732
+ * fully typed regardless of which compiler produced it.
733
+ */
734
+ declare const PowerPointViewer: Component<PowerPointViewerProps, PowerPointViewerApi>;
735
+
736
+ /**
737
+ * autosave.svelte.ts: debounced crash-recovery autosave for the Svelte viewer.
738
+ *
739
+ * A runes port that fuses the two shared semantics the other bindings use:
740
+ * - React's persistence target: each successful save writes the serialized
741
+ * `.pptx` bytes to the shared IndexedDB recovery store
742
+ * (`saveAutosaveSnapshot`, keyed by `filePath`), so a host can offer
743
+ * restore-on-load with `getAutosaveSnapshot` / `listAutosaveSnapshots`
744
+ * (both re-exported from this package). This binding does NOT auto-restore;
745
+ * matching React/Vue, recovery is a host concern.
746
+ * - Vue's debounce-on-edit trigger: an edit marks the document dirty and
747
+ * (re)arms a debounce timer instead of polling on a fixed interval.
748
+ *
749
+ * The controller registers its own edit-watching `$effect` in the constructor,
750
+ * so the SFC only has to construct it once during setup and read its reactive
751
+ * `status` / `isDirty` for the toolbar indicator.
752
+ */
753
+ /**
754
+ * Autosave status, surfaced for the toolbar status pill.
755
+ *
756
+ * - `idle` : nothing has been saved yet (or no edits since mount).
757
+ * - `disabled` : autosave is inactive (off, not editable, or no file path).
758
+ * - `saving` : a save is currently in flight.
759
+ * - `saved` : the most recent save succeeded.
760
+ * - `error` : the most recent save threw.
761
+ */
762
+ type AutosaveStatus = 'idle' | 'disabled' | 'saving' | 'saved' | 'error';
763
+
764
+ export { PowerPointViewer, defaultCssVars, defaultRadius, defaultThemeColors, deleteAutosaveSnapshot, getAutosaveSnapshot, listAutosaveSnapshots, registerTranslations, themeToCssVars, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius };
765
+ export type { AutosaveRecord, AutosaveStatus, CanvasSize, CollaborationConfig, CollaborationRole, CollaborationTransport, ExportGifOptions, ExportPdfOptions, ExportVideoOptions, PowerPointViewerApi, PowerPointViewerProps, PrintOptions, TranslationDictionary, Translator, ViewerLoadDetail, ViewerTheme, ViewerThemeColors };