pptx-react-viewer 1.16.2 → 1.17.1

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 (130) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{Model3DScene-DI6FSWDL.mjs → Model3DScene-QHDYQXL2.mjs} +2 -2
  3. package/dist/Model3DScene-QHDYQXL2.mjs.br +0 -0
  4. package/dist/Model3DScene-QHDYQXL2.mjs.gz +0 -0
  5. package/dist/{Model3DScene-PE7L24QK.js → Model3DScene-YA4F63DT.js} +3 -3
  6. package/dist/Model3DScene-YA4F63DT.js.br +0 -0
  7. package/dist/Model3DScene-YA4F63DT.js.gz +0 -0
  8. package/dist/PowerPointViewer-C4d7SKZf.d.ts +21 -0
  9. package/dist/PowerPointViewer-C4d7SKZf.d.ts.map +1 -0
  10. package/dist/{SurfaceChart3DScene-NMLG3BQK.mjs → SurfaceChart3DScene-GUAS2NWQ.mjs} +2 -2
  11. package/dist/SurfaceChart3DScene-GUAS2NWQ.mjs.br +0 -0
  12. package/dist/SurfaceChart3DScene-GUAS2NWQ.mjs.gz +0 -0
  13. package/dist/{SurfaceChart3DScene-AJLD3VW6.js → SurfaceChart3DScene-TGNJHTJQ.js} +3 -3
  14. package/dist/SurfaceChart3DScene-TGNJHTJQ.js.br +0 -0
  15. package/dist/SurfaceChart3DScene-TGNJHTJQ.js.gz +0 -0
  16. package/dist/{chunk-HJQZJ3VE.mjs → chunk-5CD34U2V.mjs} +1 -1
  17. package/dist/chunk-5CD34U2V.mjs.br +0 -0
  18. package/dist/chunk-5CD34U2V.mjs.gz +0 -0
  19. package/dist/{chunk-46HNHBHF.mjs → chunk-G22EWPLH.mjs} +134 -4
  20. package/dist/chunk-G22EWPLH.mjs.br +0 -0
  21. package/dist/chunk-G22EWPLH.mjs.gz +0 -0
  22. package/dist/{chunk-JBCVQFWI.mjs → chunk-HN7CPQUG.mjs} +5 -5
  23. package/dist/chunk-HN7CPQUG.mjs.br +0 -0
  24. package/dist/chunk-HN7CPQUG.mjs.gz +0 -0
  25. package/dist/{chunk-WGLJ32FW.js → chunk-IZXN663G.js} +1 -1
  26. package/dist/chunk-IZXN663G.js.br +0 -0
  27. package/dist/chunk-IZXN663G.js.gz +0 -0
  28. package/dist/{chunk-WMRS37KQ.js → chunk-JWS3RQKN.js} +160 -28
  29. package/dist/chunk-JWS3RQKN.js.br +0 -0
  30. package/dist/chunk-JWS3RQKN.js.gz +0 -0
  31. package/dist/{chunk-YAQOTVZT.js → chunk-MGLRKGCH.js} +146 -66
  32. package/dist/chunk-MGLRKGCH.js.br +0 -0
  33. package/dist/chunk-MGLRKGCH.js.gz +0 -0
  34. package/dist/{chunk-DZF4BNRP.mjs → chunk-PCQH2UBR.mjs} +230 -232
  35. package/dist/chunk-PCQH2UBR.mjs.br +0 -0
  36. package/dist/chunk-PCQH2UBR.mjs.gz +0 -0
  37. package/dist/{chunk-MZYQUURK.js → chunk-SXCO5HHN.js} +438 -438
  38. package/dist/chunk-SXCO5HHN.js.br +0 -0
  39. package/dist/chunk-SXCO5HHN.js.gz +0 -0
  40. package/dist/{chunk-VRASDGWX.js → chunk-WH7YXV3I.js} +1026 -1028
  41. package/dist/chunk-WH7YXV3I.js.br +0 -0
  42. package/dist/chunk-WH7YXV3I.js.gz +0 -0
  43. package/dist/{chunk-X7ILBQEY.mjs → chunk-XRYREYXC.mjs} +146 -66
  44. package/dist/chunk-XRYREYXC.mjs.br +0 -0
  45. package/dist/chunk-XRYREYXC.mjs.gz +0 -0
  46. package/dist/{dist-VMFNUFUX.js → dist-2ZAH7U6U.js} +507 -507
  47. package/dist/dist-2ZAH7U6U.js.br +0 -0
  48. package/dist/dist-2ZAH7U6U.js.gz +0 -0
  49. package/dist/{dist-JJ2NI2O3.mjs → dist-MXDC6YTS.mjs} +1 -1
  50. package/dist/dist-MXDC6YTS.mjs.br +0 -0
  51. package/dist/dist-MXDC6YTS.mjs.gz +0 -0
  52. package/dist/hooks-unstable.d.ts +9683 -1886
  53. package/dist/hooks-unstable.d.ts.map +1 -0
  54. package/dist/hooks-unstable.js +75 -75
  55. package/dist/hooks-unstable.js.br +0 -0
  56. package/dist/hooks-unstable.js.gz +0 -0
  57. package/dist/hooks-unstable.mjs +4 -4
  58. package/dist/hooks-unstable.mjs.br +0 -0
  59. package/dist/hooks-unstable.mjs.gz +0 -0
  60. package/dist/i18n.d.ts +27 -1
  61. package/dist/i18n.d.ts.map +1 -0
  62. package/dist/i18n.js +3 -3
  63. package/dist/i18n.js.br +1 -1
  64. package/dist/i18n.js.gz +0 -0
  65. package/dist/i18n.mjs +1 -1
  66. package/dist/i18n.mjs.br +0 -0
  67. package/dist/i18n.mjs.gz +0 -0
  68. package/dist/index-XGt7MZpa.d.ts +607 -0
  69. package/dist/index-XGt7MZpa.d.ts.map +1 -0
  70. package/dist/index.d.ts +4753 -10
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +19 -19
  73. package/dist/index.js.br +0 -0
  74. package/dist/index.js.gz +0 -0
  75. package/dist/index.mjs +5 -5
  76. package/dist/index.mjs.br +0 -0
  77. package/dist/index.mjs.gz +0 -0
  78. package/dist/types-BK7Nt13M.d.ts +483 -0
  79. package/dist/types-BK7Nt13M.d.ts.map +1 -0
  80. package/dist/viewer/index.d.ts +8008 -88
  81. package/dist/viewer/index.d.ts.map +1 -0
  82. package/dist/viewer/index.js +20 -20
  83. package/dist/viewer/index.js.br +0 -0
  84. package/dist/viewer/index.js.gz +0 -0
  85. package/dist/viewer/index.mjs +5 -5
  86. package/dist/viewer/index.mjs.br +0 -0
  87. package/dist/viewer/index.mjs.gz +0 -0
  88. package/package.json +6 -5
  89. package/dist/Model3DScene-DI6FSWDL.mjs.br +0 -0
  90. package/dist/Model3DScene-DI6FSWDL.mjs.gz +0 -0
  91. package/dist/Model3DScene-PE7L24QK.js.br +0 -0
  92. package/dist/Model3DScene-PE7L24QK.js.gz +0 -0
  93. package/dist/PowerPointViewer-BsaUH3ZT.d.ts +0 -26
  94. package/dist/PowerPointViewer-Nxku67uL.d.mts +0 -26
  95. package/dist/SurfaceChart3DScene-AJLD3VW6.js.br +0 -0
  96. package/dist/SurfaceChart3DScene-AJLD3VW6.js.gz +0 -0
  97. package/dist/SurfaceChart3DScene-NMLG3BQK.mjs.br +0 -0
  98. package/dist/SurfaceChart3DScene-NMLG3BQK.mjs.gz +0 -0
  99. package/dist/chunk-46HNHBHF.mjs.br +0 -0
  100. package/dist/chunk-46HNHBHF.mjs.gz +0 -0
  101. package/dist/chunk-DZF4BNRP.mjs.br +0 -0
  102. package/dist/chunk-DZF4BNRP.mjs.gz +0 -0
  103. package/dist/chunk-HJQZJ3VE.mjs.br +0 -0
  104. package/dist/chunk-HJQZJ3VE.mjs.gz +0 -0
  105. package/dist/chunk-JBCVQFWI.mjs.br +0 -0
  106. package/dist/chunk-JBCVQFWI.mjs.gz +0 -0
  107. package/dist/chunk-MZYQUURK.js.br +0 -0
  108. package/dist/chunk-MZYQUURK.js.gz +0 -0
  109. package/dist/chunk-VRASDGWX.js.br +0 -0
  110. package/dist/chunk-VRASDGWX.js.gz +0 -0
  111. package/dist/chunk-WGLJ32FW.js.br +0 -0
  112. package/dist/chunk-WGLJ32FW.js.gz +0 -0
  113. package/dist/chunk-WMRS37KQ.js.br +0 -0
  114. package/dist/chunk-WMRS37KQ.js.gz +0 -0
  115. package/dist/chunk-X7ILBQEY.mjs.br +0 -0
  116. package/dist/chunk-X7ILBQEY.mjs.gz +0 -0
  117. package/dist/chunk-YAQOTVZT.js.br +0 -0
  118. package/dist/chunk-YAQOTVZT.js.gz +0 -0
  119. package/dist/dist-JJ2NI2O3.mjs.br +0 -0
  120. package/dist/dist-JJ2NI2O3.mjs.gz +0 -0
  121. package/dist/dist-VMFNUFUX.js.br +0 -0
  122. package/dist/dist-VMFNUFUX.js.gz +0 -0
  123. package/dist/hooks-unstable.d.mts +0 -2300
  124. package/dist/i18n.d.mts +0 -1
  125. package/dist/index.d.mts +0 -46
  126. package/dist/types-ui-NG29h55h.d.mts +0 -712
  127. package/dist/types-ui-NG29h55h.d.ts +0 -712
  128. package/dist/usePresenterWindow-DToCijGy.d.ts +0 -1619
  129. package/dist/usePresenterWindow-DeTm-unp.d.mts +0 -1619
  130. package/dist/viewer/index.d.mts +0 -129
@@ -1,1619 +0,0 @@
1
- import { n, o, m, P, a, e, f, X, p, q, r, s, t, u, v, w, x, y, z, A, B, D, E, F, G, H, J, K, L, i, j, l, k, g, h } from './presentation-BfnrtJV1.js';
2
- import { RefObject } from 'react';
3
- import { e as CollaborationRole, C as CollaborationConfig } from './types-ui-NG29h55h.js';
4
- import { Awareness } from 'y-protocols/awareness';
5
- import { Doc } from 'yjs';
6
-
7
- /**
8
- * Built-in theme presets modelled after common PowerPoint themes.
9
- *
10
- * Each preset provides:
11
- * - A display name
12
- * - A 12-colour scheme (dk1, dk2, lt1, lt2, accent1-6, hlink, folHlink)
13
- * - A font scheme (major/heading + minor/body font families)
14
- *
15
- * These presets can be passed directly to
16
- * {@link PptxHandlerCore.switchTheme} or the React `useThemeSwitching` hook
17
- * to apply a complete theme in one step.
18
- *
19
- * @module pptx-types/theme-presets
20
- */
21
-
22
- /**
23
- * A complete theme preset that can be applied to a presentation.
24
- *
25
- * @example
26
- * ```ts
27
- * import { THEME_PRESETS } from "pptx-viewer-core";
28
- *
29
- * const office = THEME_PRESETS.find(p => p.id === "office");
30
- * await handler.switchTheme(office.colorScheme, office.fontScheme, office.name);
31
- * ```
32
- */
33
- interface PptxThemePreset {
34
- /** Unique identifier for the preset. */
35
- id: string;
36
- /** Human-readable display name. */
37
- name: string;
38
- /** The 12-colour scheme. */
39
- colorScheme: e;
40
- /** Heading and body font families. */
41
- fontScheme: f;
42
- }
43
-
44
- /**
45
- * SDK input types for the headless PPTX builder API.
46
- *
47
- * These types provide a simplified, ergonomic interface for creating
48
- * presentation elements programmatically. Internal types (PptxElement,
49
- * ShapeStyle, TextStyle) are the canonical model; these types are
50
- * convenience wrappers that get mapped to the internal model by
51
- * the builder functions.
52
- *
53
- * @module sdk/types
54
- */
55
-
56
- /** Position and size in pixels. Converted to EMU internally when needed. */
57
- interface ElementPosition {
58
- x: number;
59
- y: number;
60
- width: number;
61
- height: number;
62
- rotation?: number;
63
- }
64
- type FillInput = {
65
- type: 'solid';
66
- color: string;
67
- opacity?: number;
68
- } | {
69
- type: 'gradient';
70
- angle?: number;
71
- gradientType?: 'linear' | 'radial';
72
- stops: Array<{
73
- color: string;
74
- position: number;
75
- opacity?: number;
76
- }>;
77
- } | {
78
- type: 'pattern';
79
- preset: string;
80
- foreground?: string;
81
- background?: string;
82
- } | {
83
- type: 'image';
84
- url: string;
85
- mode?: 'stretch' | 'tile';
86
- } | {
87
- type: 'none';
88
- };
89
- interface StrokeInput {
90
- color?: string;
91
- width?: number;
92
- dash?: i;
93
- opacity?: number;
94
- join?: 'round' | 'bevel' | 'miter';
95
- cap?: 'flat' | 'rnd' | 'sq';
96
- }
97
- interface ShadowInput {
98
- color?: string;
99
- blur?: number;
100
- offsetX?: number;
101
- offsetY?: number;
102
- opacity?: number;
103
- }
104
- interface TextStyleInput {
105
- fontSize?: number;
106
- fontFamily?: string;
107
- bold?: boolean;
108
- italic?: boolean;
109
- underline?: boolean;
110
- strikethrough?: boolean;
111
- color?: string;
112
- alignment?: 'left' | 'center' | 'right' | 'justify';
113
- verticalAlignment?: 'top' | 'middle' | 'bottom';
114
- lineSpacing?: number;
115
- spaceBefore?: number;
116
- spaceAfter?: number;
117
- }
118
- interface TextSegmentInput {
119
- text: string;
120
- style?: Partial<TextStyleInput>;
121
- }
122
- interface TextOptions extends Partial<ElementPosition> {
123
- fontSize?: number;
124
- fontFamily?: string;
125
- bold?: boolean;
126
- italic?: boolean;
127
- underline?: boolean;
128
- strikethrough?: boolean;
129
- color?: string;
130
- alignment?: 'left' | 'center' | 'right' | 'justify';
131
- verticalAlignment?: 'top' | 'middle' | 'bottom';
132
- lineSpacing?: number;
133
- fill?: FillInput;
134
- stroke?: StrokeInput;
135
- shadow?: ShadowInput;
136
- opacity?: number;
137
- }
138
- interface ShapeOptions extends Partial<ElementPosition> {
139
- fill?: FillInput;
140
- stroke?: StrokeInput;
141
- text?: string;
142
- textStyle?: Partial<TextStyleInput>;
143
- adjustments?: Record<string, number>;
144
- shadow?: ShadowInput;
145
- opacity?: number;
146
- }
147
- interface ImageOptions extends Partial<ElementPosition> {
148
- altText?: string;
149
- cropLeft?: number;
150
- cropTop?: number;
151
- cropRight?: number;
152
- cropBottom?: number;
153
- opacity?: number;
154
- }
155
- interface TableInput {
156
- rows: TableRowInput[];
157
- columnWidths?: number[];
158
- style?: string;
159
- bandRows?: boolean;
160
- bandColumns?: boolean;
161
- firstRow?: boolean;
162
- lastRow?: boolean;
163
- firstCol?: boolean;
164
- lastCol?: boolean;
165
- }
166
- interface TableRowInput {
167
- cells: TableCellInput[];
168
- height?: number;
169
- }
170
- interface TableCellInput {
171
- text: string;
172
- style?: Partial<TextStyleInput>;
173
- fill?: FillInput;
174
- gridSpan?: number;
175
- rowSpan?: number;
176
- }
177
- interface TableOptions extends Partial<ElementPosition> {
178
- }
179
- interface ChartSeriesInput {
180
- name: string;
181
- values: number[];
182
- color?: string;
183
- }
184
- interface ChartInput {
185
- series: ChartSeriesInput[];
186
- categories: string[];
187
- title?: string;
188
- hasLegend?: boolean;
189
- legendPosition?: 't' | 'b' | 'l' | 'r' | 'tr';
190
- grouping?: 'clustered' | 'stacked' | 'percentStacked';
191
- }
192
- interface ChartOptions extends Partial<ElementPosition> {
193
- }
194
- interface ConnectorOptions extends Partial<ElementPosition> {
195
- type?: 'straight' | 'bent' | 'curved';
196
- stroke?: StrokeInput;
197
- startArrow?: j;
198
- endArrow?: j;
199
- from?: {
200
- elementId: string;
201
- site: number;
202
- };
203
- to?: {
204
- elementId: string;
205
- site: number;
206
- };
207
- }
208
- interface MediaOptions extends Partial<ElementPosition> {
209
- autoPlay?: boolean;
210
- loop?: boolean;
211
- volume?: number;
212
- trimStartMs?: number;
213
- trimEndMs?: number;
214
- posterFrame?: string;
215
- }
216
- interface GroupOptions extends Partial<ElementPosition> {
217
- }
218
- type BackgroundInput = {
219
- type: 'solid';
220
- color: string;
221
- } | {
222
- type: 'gradient';
223
- angle?: number;
224
- stops: Array<{
225
- color: string;
226
- position: number;
227
- }>;
228
- } | {
229
- type: 'image';
230
- source: string;
231
- };
232
- interface TransitionInput {
233
- type: k;
234
- duration?: number;
235
- direction?: string;
236
- advanceAfterMs?: number;
237
- }
238
- interface AnimationInput {
239
- preset: g;
240
- trigger?: h;
241
- duration?: number;
242
- delay?: number;
243
- }
244
- interface PresentationOptions {
245
- /** Slide width in EMU. Default: 12192000 (16:9 widescreen). */
246
- width?: number;
247
- /** Slide height in EMU. Default: 6858000 (16:9 widescreen). */
248
- height?: number;
249
- /** Theme configuration. */
250
- theme?: PresentationThemeInput;
251
- /** Presentation title (stored in docProps/core.xml). */
252
- title?: string;
253
- /** Presentation author. */
254
- creator?: string;
255
- /**
256
- * Number of blank slides to include in the initial presentation.
257
- * Default: 0 (no slides). Slides use the "Blank" layout.
258
- */
259
- initialSlideCount?: number;
260
- }
261
- interface PresentationThemeInput {
262
- name?: string;
263
- colors?: {
264
- dk1?: string;
265
- lt1?: string;
266
- dk2?: string;
267
- lt2?: string;
268
- accent1?: string;
269
- accent2?: string;
270
- accent3?: string;
271
- accent4?: string;
272
- accent5?: string;
273
- accent6?: string;
274
- hlink?: string;
275
- folHlink?: string;
276
- };
277
- fonts?: {
278
- majorFont?: string;
279
- minorFont?: string;
280
- };
281
- }
282
-
283
- /**
284
- * Fluent builder for constructing slides with elements.
285
- *
286
- * Provides a chainable API for adding elements, setting slide properties,
287
- * and building a complete {@link PptxSlide}.
288
- *
289
- * @module sdk/SlideBuilder
290
- */
291
-
292
- /**
293
- * Fluent builder for a single slide.
294
- *
295
- * @example
296
- * ```ts
297
- * const slide = new SlideBuilder(1)
298
- * .addText("Hello World", { fontSize: 36, bold: true, x: 100, y: 50 })
299
- * .addShape("roundRect", { fill: { type: "solid", color: "#4472C4" } })
300
- * .setNotes("Remember to mention key points")
301
- * .setBackground({ type: "solid", color: "#F5F5F5" })
302
- * .build();
303
- * ```
304
- */
305
- declare class SlideBuilder {
306
- private readonly slide;
307
- /**
308
- * @param slideNumber - 1-based slide number.
309
- * @param layoutPath - Optional layout archive path.
310
- * @param layoutName - Optional layout display name.
311
- */
312
- constructor(slideNumber: number, layoutPath?: string, layoutName?: string);
313
- /** Add a text box to the slide. */
314
- addText(text: string | TextSegmentInput[], options?: TextOptions): this;
315
- /** Add a shape to the slide. */
316
- addShape(shapeType: string, options?: ShapeOptions): this;
317
- /** Add a connector (line) to the slide. */
318
- addConnector(options?: ConnectorOptions): this;
319
- /** Add an image to the slide. */
320
- addImage(source: string, options?: ImageOptions): this;
321
- /** Add a table to the slide. */
322
- addTable(input: TableInput, options?: TableOptions): this;
323
- /** Add a chart to the slide. */
324
- addChart(chartType: l, input: ChartInput, options?: ChartOptions): this;
325
- /** Add a media element (video or audio) to the slide. */
326
- addMedia(mediaType: 'video' | 'audio', source: string, options?: MediaOptions): this;
327
- /** Add a group of elements to the slide. */
328
- addGroup(children: a[], options?: GroupOptions): this;
329
- /** Add a pre-built element directly. */
330
- addElement(element: a): this;
331
- /** Set slide background. */
332
- setBackground(bg: BackgroundInput): this;
333
- /** Set slide transition. */
334
- setTransition(input: TransitionInput): this;
335
- /** Add an animation to an element on this slide. */
336
- addAnimation(elementId: string, input: AnimationInput): this;
337
- /** Set speaker notes. */
338
- setNotes(text: string): this;
339
- /** Mark the slide as hidden. */
340
- setHidden(hidden: boolean): this;
341
- /** Assign the slide to a section. */
342
- setSection(name: string, id?: string): this;
343
- /**
344
- * Add a freeform shape from SVG path data.
345
- *
346
- * Creates a custom-geometry shape element using the provided SVG path
347
- * string and appends it to the slide's element list.
348
- *
349
- * @param pathData - An SVG path data string (e.g. `"M 0 0 L 100 50 L 50 100 Z"`).
350
- * @param options - Optional position, styling, and size overrides.
351
- * @returns The builder instance for chaining.
352
- *
353
- * @example
354
- * ```ts
355
- * new SlideBuilder(1)
356
- * .addFreeform("M 0 0 C 33 0 66 100 100 100", {
357
- * stroke: { color: "#FF0000", width: 2 },
358
- * })
359
- * .build();
360
- * ```
361
- */
362
- addFreeform(pathData: string, options?: ShapeOptions): this;
363
- /**
364
- * Add a pre-built element from any element builder (calls `.build()` for you).
365
- *
366
- * Accepts any object with a `build()` method that returns a {@link PptxElement},
367
- * such as {@link TextBuilder}, {@link ShapeBuilder}, {@link ImageBuilder}, etc.
368
- *
369
- * @param builder - An element builder with a `.build()` method.
370
- * @returns The builder instance for chaining.
371
- *
372
- * @example
373
- * ```ts
374
- * const title = TextBuilder.create("Hello").fontSize(36).bold();
375
- * new SlideBuilder(1).addBuilderElement(title).build();
376
- * ```
377
- */
378
- addBuilderElement(builder: {
379
- build(): a;
380
- }): this;
381
- /**
382
- * Remove an element by its ID.
383
- *
384
- * Filters out the element with the given ID from the slide's element list.
385
- * If no element matches, the slide is left unchanged.
386
- *
387
- * @param elementId - The unique ID of the element to remove.
388
- * @returns The builder instance for chaining.
389
- *
390
- * @example
391
- * ```ts
392
- * const slide = new SlideBuilder(1)
393
- * .addText("temp", { x: 0, y: 0 })
394
- * .removeElement("txt_abc123_1")
395
- * .build();
396
- * ```
397
- */
398
- removeElement(elementId: string): this;
399
- /**
400
- * Get the current list of elements on this slide.
401
- *
402
- * Returns a readonly view of the elements array. Useful for inspecting
403
- * what has been added so far during the build process.
404
- *
405
- * @returns A readonly array of the slide's current elements.
406
- *
407
- * @example
408
- * ```ts
409
- * const builder = new SlideBuilder(1).addText("Hi");
410
- * console.log(builder.getElements().length); // 1
411
- * ```
412
- */
413
- getElements(): readonly a[];
414
- /**
415
- * Get the number of elements on this slide.
416
- *
417
- * @returns The count of elements currently added to the slide.
418
- *
419
- * @example
420
- * ```ts
421
- * const builder = new SlideBuilder(1)
422
- * .addText("A").addText("B");
423
- * console.log(builder.elementCount); // 2
424
- * ```
425
- */
426
- get elementCount(): number;
427
- /**
428
- * Get the last added element (useful for getting its ID for animations).
429
- *
430
- * Returns `undefined` if the slide has no elements yet.
431
- *
432
- * @returns The most recently added element, or `undefined`.
433
- *
434
- * @example
435
- * ```ts
436
- * const builder = new SlideBuilder(1).addShape("rect");
437
- * const shape = builder.getLastElement();
438
- * if (shape) {
439
- * builder.addAnimation(shape.id, { preset: "fadeIn" });
440
- * }
441
- * ```
442
- */
443
- getLastElement(): a | undefined;
444
- /**
445
- * Set the slide name/title for organizational purposes.
446
- *
447
- * Stores an arbitrary name string on the slide object. This is useful
448
- * for labeling slides in tooling or custom workflows.
449
- *
450
- * @param name - The display name to assign to the slide.
451
- * @returns The builder instance for chaining.
452
- *
453
- * @example
454
- * ```ts
455
- * new SlideBuilder(1)
456
- * .setName("Introduction")
457
- * .addText("Welcome!")
458
- * .build();
459
- * ```
460
- */
461
- setName(name: string): this;
462
- /** Return the built {@link PptxSlide}. */
463
- build(): P;
464
- }
465
-
466
- /**
467
- * Factory for creating PPTX presentations from scratch.
468
- *
469
- * Generates a minimal valid OpenXML package (ZIP) containing all
470
- * required parts (presentation.xml, theme, slide master, layouts,
471
- * content types, relationships, and document properties). The
472
- * generated package is then loaded by {@link PptxHandler} so that
473
- * all existing editing and save operations work transparently.
474
- *
475
- * @module sdk/PresentationBuilder
476
- */
477
-
478
- /** Result returned by {@link PresentationBuilder.create}. */
479
- interface PresentationBuilderResult {
480
- /** Initialized handler ready for editing and saving. */
481
- handler: PptxHandler;
482
- /** Parsed presentation data. */
483
- data: m;
484
- /** Convenience slide builder factory. */
485
- createSlide: (layoutName?: string) => SlideBuilder;
486
- }
487
-
488
- /**
489
- * Fluent interface for navigating and mutating a {@link PptxData} structure.
490
- * Provides method-chaining access to slides, elements, and notes.
491
- */
492
- interface IPptxXmlBuilder {
493
- /** Navigate to a slide by zero-based index (Pascal-case alias). */
494
- Slides(index: number): PptxSlideBuilder;
495
- /** Navigate to a slide by zero-based index. */
496
- slide(index: number): PptxSlideBuilder;
497
- /** Navigate to a slide by zero-based index (plural alias). */
498
- slides(index: number): PptxSlideBuilder;
499
- /** Return the underlying presentation data. */
500
- project(): m;
501
- }
502
- /**
503
- * Root builder of the fluent PPTX editing API.
504
- *
505
- * Wraps a {@link PptxData} object and provides chainable accessors
506
- * to navigate into slides, elements, and notes for in-place mutation.
507
- */
508
- declare class PptxXmlBuilder implements IPptxXmlBuilder {
509
- /** The presentation data being mutated. */
510
- private readonly data;
511
- /** @param data - The presentation data to wrap. */
512
- constructor(data: m);
513
- /**
514
- * Factory method to create a builder from presentation data.
515
- * @param data - The presentation data to wrap.
516
- * @returns A new {@link PptxXmlBuilder} instance.
517
- */
518
- static from(data: m): PptxXmlBuilder;
519
- /** @inheritdoc */
520
- Slides(index: number): PptxSlideBuilder;
521
- /**
522
- * Navigate to a slide by zero-based index.
523
- * @param index - Zero-based slide index.
524
- * @returns A {@link PptxSlideBuilder} for the requested slide.
525
- * @throws Error if index is not an integer or is out of range.
526
- */
527
- slide(index: number): PptxSlideBuilder;
528
- /** @inheritdoc */
529
- slides(index: number): PptxSlideBuilder;
530
- /** Return the underlying {@link PptxData}. */
531
- project(): m;
532
- /** Pascal-case alias for {@link project}. */
533
- Project(): m;
534
- }
535
- /**
536
- * Fluent builder scoped to a single slide.
537
- * Provides navigation to the slide's elements and notes.
538
- */
539
- declare class PptxSlideBuilder {
540
- /** The slide being operated on. */
541
- private readonly slideValue;
542
- /** Reference back to the root builder for chaining. */
543
- private readonly rootBuilder;
544
- /**
545
- * @param slideValue - The slide data.
546
- * @param rootBuilder - The parent builder.
547
- */
548
- constructor(slideValue: P, rootBuilder: PptxXmlBuilder);
549
- /** Navigate to the slide's notes builder (getter). */
550
- get Notes(): PptxSlideNotesBuilder;
551
- /** Navigate to the slide's notes builder. */
552
- notes(): PptxSlideNotesBuilder;
553
- /** Navigate to the slide's elements builder. */
554
- elements(): PptxSlideElementsBuilder;
555
- /** Return the underlying slide data. */
556
- project(): P;
557
- /** Pascal-case alias for {@link project}. */
558
- Project(): P;
559
- /** Navigate back to the root builder. */
560
- done(): PptxXmlBuilder;
561
- /** Pascal-case alias for {@link done}. */
562
- Done(): PptxXmlBuilder;
563
- }
564
- /**
565
- * Fluent builder for manipulating the elements array of a single slide.
566
- * Supports adding, removing, and updating elements by ID.
567
- */
568
- declare class PptxSlideElementsBuilder {
569
- private readonly slideValue;
570
- private readonly slideBuilder;
571
- /**
572
- * @param slideValue - The slide whose elements are being modified.
573
- * @param slideBuilder - The parent slide builder for chaining.
574
- */
575
- constructor(slideValue: P, slideBuilder: PptxSlideBuilder);
576
- /**
577
- * Append an element to the slide's element list.
578
- * @param element - The element to add.
579
- * @returns This builder for chaining.
580
- */
581
- add(element: a): this;
582
- /**
583
- * Remove an element from the slide by its ID.
584
- * @param elementId - The ID of the element to remove.
585
- * @returns This builder for chaining.
586
- */
587
- removeById(elementId: string): this;
588
- /**
589
- * Update an element in-place by ID using a transform function.
590
- * @param elementId - The ID of the element to update.
591
- * @param updater - A function that receives the current element and returns the replacement.
592
- * @returns This builder for chaining.
593
- */
594
- updateById(elementId: string, updater: (current: a) => a): this;
595
- /** Return the current elements array. */
596
- project(): a[];
597
- /** Navigate back to the slide builder. */
598
- done(): PptxSlideBuilder;
599
- }
600
- /**
601
- * Fluent builder for manipulating speaker notes on a single slide.
602
- * Supports adding, setting, clearing, and retrieving notes text.
603
- */
604
- declare class PptxSlideNotesBuilder {
605
- private readonly slideValue;
606
- private readonly slideBuilder;
607
- /**
608
- * @param slideValue - The slide whose notes are being modified.
609
- * @param slideBuilder - The parent slide builder for chaining.
610
- */
611
- constructor(slideValue: P, slideBuilder: PptxSlideBuilder);
612
- /**
613
- * Append text to existing notes (separated by newline).
614
- * @param text - The text to append.
615
- * @returns This builder for chaining.
616
- */
617
- add(text: string): this;
618
- /** Pascal-case alias for {@link add}. */
619
- Add(text: string): this;
620
- /**
621
- * Replace all notes with the given text.
622
- * @param text - The replacement notes text. Empty string clears notes.
623
- * @returns This builder for chaining.
624
- */
625
- set(text: string): this;
626
- /** Pascal-case alias for {@link set}. */
627
- Set(text: string): this;
628
- /** Remove all notes from the slide. */
629
- clear(): this;
630
- /** Pascal-case alias for {@link clear}. */
631
- Clear(): this;
632
- /** Return the current notes text, or `undefined` if none. */
633
- get(): string | undefined;
634
- /** Pascal-case alias for {@link get}. */
635
- Get(): string | undefined;
636
- /** Navigate back to the slide builder. */
637
- done(): PptxSlideBuilder;
638
- /** Pascal-case alias for {@link done}. */
639
- Done(): PptxSlideBuilder;
640
- /**
641
- * Synchronize the `notesSegments` array from the plain-text notes string.
642
- * Splits text on newlines and creates corresponding {@link TextSegment} entries
643
- * with paragraph break markers between lines.
644
- */
645
- private syncSegmentsFromNotes;
646
- }
647
-
648
- interface PptxHandlerLoadOptions {
649
- eagerDecodeImages?: boolean;
650
- password?: string;
651
- /**
652
- * Maximum total uncompressed bytes accepted from the input ZIP archive.
653
- * Defaults to 500 MiB. When the sum of `_data.uncompressedSize` across
654
- * all archive entries exceeds this cap, `load()` rejects with a
655
- * {@link ZipBombError}. A hard cap of 65 536 archive entries also
656
- * applies.
657
- */
658
- maxUncompressedBytes?: number;
659
- /**
660
- * When `false` (default), relationship targets that resolve to
661
- * `http://` or `https://` URLs are dropped from rendered slides
662
- * (image, picture, background). Set to `true` to allow external image
663
- * URLs to flow through to `<img src>`.
664
- *
665
- * Disabled by default to mitigate SSRF / privacy-leak vectors in
666
- * server-side rendering and headless export pipelines.
667
- */
668
- allowExternalImages?: boolean;
669
- }
670
- /** Output format for the save pipeline. */
671
- type PptxSaveFormat = 'pptx' | 'ppsx' | 'pptm';
672
- interface PptxHandlerSaveOptions {
673
- headerFooter?: r;
674
- presentationProperties?: s;
675
- customShows?: t[];
676
- sections?: u[];
677
- coreProperties?: v;
678
- appProperties?: w;
679
- customProperties?: x[];
680
- /** Updated notes master data to save back to notesMaster1.xml. */
681
- notesMaster?: y;
682
- /** Updated handout master data to save back to handoutMaster1.xml. */
683
- handoutMaster?: z;
684
- /**
685
- * Updated slide masters to save back to ppt/slideMasters/slideMaster*.xml.
686
- * Each entry in the array applies typed mutations (clrMap, hf flags,
687
- * background) to the master at its `path`. Masters not listed here pass
688
- * through verbatim from the original load.
689
- */
690
- slideMasters?: A[];
691
- /**
692
- * Updated slide layouts to save back to ppt/slideLayouts/slideLayout*.xml.
693
- * Each entry applies typed mutations (clrMapOverride, attrs, hf flags,
694
- * background) to the layout at its `path`. Layouts not listed here pass
695
- * through verbatim from the original load.
696
- */
697
- slideLayouts?: B[];
698
- /** Updated tag collections to save back to ppt/tags/tag*.xml. */
699
- tags?: D[];
700
- /** Photo album metadata to save back to `p:photoAlbum`. */
701
- photoAlbum?: E;
702
- /** East Asian line-break settings to save back to `p:kinsoku`. */
703
- kinsoku?: F;
704
- /** Write-protection verifier. Set to `null` to remove, `undefined` to preserve existing. */
705
- modifyVerifier?: G | null;
706
- /** View properties to save back to ppt/viewProps.xml. */
707
- viewProperties?: H;
708
- /**
709
- * Table style edits to save back to `ppt/tableStyles.xml`. Pass the
710
- * `tableStyleMap` from `PptxData` (optionally with edited entries)
711
- * to persist user edits. The `def` GUID and any unmodelled XML are
712
- * preserved verbatim. Omitting the option round-trips the original
713
- * part untouched.
714
- */
715
- tableStyles?: J;
716
- /**
717
- * Target output format.
718
- * - `'pptx'` (default): Standard presentation.
719
- * - `'ppsx'`: Slide-show file (opens in presentation mode).
720
- * - `'pptm'`: Macro-enabled presentation (requires VBA data).
721
- */
722
- outputFormat?: PptxSaveFormat;
723
- /**
724
- * Embedded fonts to write back (or add) to the saved PPTX.
725
- *
726
- * Pass the `embeddedFonts` array from `PptxData` to preserve existing
727
- * embedded fonts during save. You can also add new fonts by including
728
- * entries with `rawFontData` populated.
729
- *
730
- * When omitted, the save pipeline will automatically re-embed any
731
- * fonts that were loaded from the original PPTX and have `rawFontData`
732
- * preserved (i.e. the default is lossless round-trip).
733
- */
734
- embeddedFonts?: K[];
735
- /**
736
- * OOXML conformance class for the saved output.
737
- * - `'preserve'` (default): use the same conformance as the loaded file.
738
- * - `'strict'`: force Strict Open XML (ISO/IEC 29500) namespace URIs.
739
- * - `'transitional'`: force Transitional (ECMA-376) namespace URIs.
740
- */
741
- conformance?: 'strict' | 'transitional' | 'preserve';
742
- }
743
- interface IPptxHandlerRuntime {
744
- /**
745
- * Release all resources held by this runtime (Blob URLs, caches, ZIP).
746
- * After calling, the runtime cannot be used further.
747
- */
748
- dispose(): void;
749
- /**
750
- * Revoke all Blob URLs created during image loading.
751
- */
752
- revokeBlobUrls(): void;
753
- getCompatibilityWarnings(): n[];
754
- getLayoutOptions(): o[];
755
- createXmlBuilder(data: m): PptxXmlBuilder;
756
- Builder(data: m): PptxXmlBuilder;
757
- setTemplateBackground(path: string, backgroundColor: string | undefined): void;
758
- setPresentationTheme(themePath: string, applyToAllMasters?: boolean): Promise<void>;
759
- getTemplateBackgroundColor(path: string): string | undefined;
760
- updateThemeColorScheme(colorScheme: e): Promise<void>;
761
- updateThemeFontScheme(fontScheme: f): Promise<void>;
762
- updateThemeName(name: string): Promise<void>;
763
- applyTheme(colorScheme: e, fontScheme: f, themeName?: string): Promise<void>;
764
- load(data: ArrayBuffer, options?: PptxHandlerLoadOptions): Promise<m>;
765
- getChartDataForGraphicFrame(slidePath: string, graphicFrame: X | undefined): Promise<p | undefined>;
766
- getSmartArtDataForGraphicFrame(slidePath: string, graphicFrame: X | undefined): Promise<q | undefined>;
767
- getImageData(imagePath: string): Promise<string | undefined>;
768
- /**
769
- * Extract a media file from the PPTX archive as an ArrayBuffer.
770
- * Returns undefined if the file is not found.
771
- */
772
- getMediaArrayBuffer(mediaPath: string): Promise<ArrayBuffer | undefined>;
773
- save(slides: P[], options?: PptxHandlerSaveOptions): Promise<Uint8Array>;
774
- exportSlides(slides: P[], options: L): Promise<Map<number, Uint8Array>>;
775
- /**
776
- * Get the available slide layouts for a specific slide, based on the
777
- * slide's master. Scans the slide master's relationships to find all
778
- * layouts that belong to it.
779
- *
780
- * @param slideIndex - Zero-based slide index.
781
- * @param slides - Current slides array.
782
- * @returns Array of layout options belonging to the same slide master.
783
- */
784
- getAvailableLayoutsForSlide(slideIndex: number, slides: P[]): Promise<o[]>;
785
- /**
786
- * Resolve the editable template (master + layout) elements a slide
787
- * inherits, each carrying a `master-` / `layout-` prefixed id. Excludes
788
- * placeholders; returns only decorative shapes/pictures/graphic frames.
789
- *
790
- * @param slideId - The slide's archive path (`PptxSlide.id`).
791
- */
792
- getTemplateElementsForSlide(slideId: string): Promise<a[]>;
793
- /**
794
- * Scan the loaded PPTX archive for all theme parts.
795
- */
796
- getAvailableThemes(): Promise<Array<{
797
- path: string;
798
- name?: string;
799
- }>>;
800
- /**
801
- * Apply a different layout to an existing slide by updating the slide's
802
- * relationship to point to the new layout and re-parsing layout
803
- * placeholders / background.
804
- *
805
- * @param slideIndex - Zero-based slide index.
806
- * @param layoutPath - Archive path of the target layout
807
- * (e.g. `ppt/slideLayouts/slideLayout2.xml`).
808
- * @param slides - Current slides array.
809
- * @returns The updated slide with new layout path, name, and background.
810
- */
811
- applyLayoutToSlide(slideIndex: number, layoutPath: string, slides: P[]): Promise<P>;
812
- }
813
-
814
- /**
815
- * Abstract factory contract for creating {@link IPptxHandlerRuntime}
816
- * instances.
817
- *
818
- * Implement this interface to supply a custom runtime (e.g. a
819
- * WASM-backed or test-double runtime) to {@link PptxHandlerCore}.
820
- */
821
- interface IPptxHandlerRuntimeFactory {
822
- /** Instantiate and return a new runtime implementation. */
823
- createRuntime(): IPptxHandlerRuntime;
824
- }
825
-
826
- /**
827
- * Type definitions for OOXML encryption and decryption.
828
- *
829
- * Contains all interfaces and type aliases used by the OOXML crypto modules.
830
- *
831
- * @module ooxml-crypto-types
832
- */
833
- /** Supported encryption algorithms. */
834
- type EncryptionAlgorithm = 'AES128' | 'AES256';
835
- /** Encryption options for creating encrypted files. */
836
- interface EncryptionOptions {
837
- /** The encryption algorithm to use (defaults to AES256). */
838
- algorithm?: EncryptionAlgorithm;
839
- /** Number of hash iterations for key derivation (defaults to 100000). Lower values speed up tests. */
840
- spinCount?: number;
841
- }
842
-
843
- /**
844
- * Dependency injection options for {@link PptxHandlerCore}.
845
- *
846
- * Provide either `runtime` (an already-constructed runtime) or
847
- * `runtimeFactory` (a factory that will be called once). When neither
848
- * is supplied the default runtime is created automatically.
849
- *
850
- * @example
851
- * ```ts
852
- * // Use the default runtime:
853
- * const core = new PptxHandlerCore();
854
- *
855
- * // Inject a custom runtime:
856
- * const core = new PptxHandlerCore({ runtime: myRuntime });
857
- *
858
- * // Supply a factory for lazy creation:
859
- * const core = new PptxHandlerCore({ runtimeFactory: myFactory });
860
- * // => PptxHandlerCore instance with injected runtime
861
- * ```
862
- */
863
- interface PptxHandlerCoreDependencies {
864
- runtime?: IPptxHandlerRuntime;
865
- runtimeFactory?: IPptxHandlerRuntimeFactory;
866
- }
867
- /**
868
- * Thin facade over the PPTX runtime implementation.
869
- *
870
- * All heavy parsing, serialisation, and XML manipulation is delegated to an
871
- * {@link IPptxHandlerRuntime}. This surface stays stable and small so that
872
- * callers remain decoupled from the runtime internals and host-specific
873
- * runtime swaps (e.g. WASM vs Node) can be done transparently.
874
- *
875
- * @remarks
876
- * - Constructed once per open document.
877
- * - Errors from encrypted files are caught at `load()` time via
878
- * {@link EncryptedFileError}.
879
- * - `PptxXmlBuilder` instances returned by `createXmlBuilder()` / `Builder()`
880
- * operate directly on the runtime’s in-memory ZIP.
881
- *
882
- * @example
883
- * ```ts
884
- * const handler = new PptxHandlerCore();
885
- * const data = await handler.load(arrayBuffer);
886
- * // ... mutate slides ...
887
- * const out = await handler.save(data.slides);
888
- * // => Uint8Array of the modified .pptx file
889
- * ```
890
- */
891
- declare class PptxHandlerCore {
892
- private readonly runtime;
893
- /**
894
- * Create a new handler, optionally injecting a custom runtime.
895
- *
896
- * Resolution order:
897
- * 1. `dependencies.runtime` — use as-is.
898
- * 2. `dependencies.runtimeFactory` — call `createRuntime()` once.
899
- * 3. Fall back to {@link createDefaultPptxHandlerRuntime}.
900
- *
901
- * @param dependencies - Optional runtime or factory override.
902
- *
903
- * @example
904
- * ```ts
905
- * const core = new PptxHandlerCore();
906
- * // => PptxHandlerCore instance with default runtime
907
- * ```
908
- */
909
- constructor(dependencies?: PptxHandlerCoreDependencies);
910
- /**
911
- * Release all resources held by this handler instance.
912
- *
913
- * Revokes every Blob URL created for images/media, clears all
914
- * in-memory caches, and releases the in-memory ZIP archive.
915
- *
916
- * Call this when the handler is no longer needed (e.g. component
917
- * unmount) to free memory immediately rather than waiting for GC.
918
- *
919
- * After calling `dispose()`, do not call any other methods — create
920
- * a new `PptxHandler` instance instead.
921
- */
922
- dispose(): void;
923
- /**
924
- * Return any compatibility warnings detected during the most recent load.
925
- *
926
- * Warnings indicate features the editor cannot fully represent (e.g.
927
- * SmartArt, 3-D effects, embedded OLE objects).
928
- *
929
- * @returns Array of {@link PptxCompatibilityWarning} objects.
930
- */
931
- getCompatibilityWarnings(): n[];
932
- /**
933
- * Get the slide layout options available in the loaded presentation.
934
- *
935
- * Each option maps to a `<p:sldLayout>` inside the PPTX archive.
936
- *
937
- * @returns Array of {@link PptxLayoutOption} entries.
938
- */
939
- getLayoutOptions(): o[];
940
- /**
941
- * Create a fluent XML builder scoped to the given presentation data.
942
- *
943
- * The builder provides a chainable API for constructing and inserting
944
- * OpenXML nodes directly into the runtime’s in-memory ZIP.
945
- *
946
- * @param data - The parsed {@link PptxData} to bind the builder to.
947
- * @returns A new {@link PptxXmlBuilder} instance.
948
- */
949
- createXmlBuilder(data: m): PptxXmlBuilder;
950
- /**
951
- * Shorthand alias for {@link createXmlBuilder}.
952
- *
953
- * @param data - Parsed presentation data.
954
- * @returns A {@link PptxXmlBuilder} instance.
955
- */
956
- Builder(data: m): PptxXmlBuilder;
957
- /**
958
- * Register a background image for a specific template layout path.
959
- *
960
- * @param path - The internal PPTX path (e.g. `ppt/slideLayouts/slideLayout1.xml`).
961
- * @param backgroundColor - Optional hex colour to render behind the image.
962
- */
963
- setTemplateBackground(path: string, backgroundColor: string | undefined): void;
964
- /**
965
- * Retrieve the background colour previously set for a template layout.
966
- *
967
- * @param path - The internal PPTX layout path.
968
- * @returns Hex colour string, or `undefined` if none was set.
969
- */
970
- getTemplateBackgroundColor(path: string): string | undefined;
971
- /**
972
- * Replace the presentation’s theme by loading an external `.thmx` file.
973
- *
974
- * @param themePath - Absolute or relative path to the `.thmx` file.
975
- * @param applyToAllMasters - Apply to every slide master (default `true`).
976
- *
977
- * @example
978
- * ```ts
979
- * await handler.setPresentationTheme("./themes/corporate.thmx");
980
- * // => void — theme XML replaced in the in-memory ZIP
981
- * ```
982
- */
983
- setPresentationTheme(themePath: string, applyToAllMasters?: boolean): Promise<void>;
984
- /**
985
- * Modify the theme’s colour scheme (accent colours, background, text, etc.).
986
- *
987
- * @param colorScheme - A {@link PptxThemeColorScheme} with hex colour values.
988
- *
989
- * @example
990
- * ```ts
991
- * await handler.updateThemeColorScheme({
992
- * dk1: "#1A1A2E", dk2: "#16213E",
993
- * lt1: "#FFFFFF", lt2: "#E8E8E8",
994
- * accent1: "#0F3460", accent2: "#533483",
995
- * accent3: "#E94560", accent4: "#F0A500",
996
- * });
997
- * // => void — colour scheme updated in the in-memory theme XML
998
- * ```
999
- */
1000
- updateThemeColorScheme(colorScheme: e): Promise<void>;
1001
- /**
1002
- * Update the theme’s font scheme (heading + body typefaces).
1003
- *
1004
- * @param fontScheme - A {@link PptxThemeFontScheme} with font family names.
1005
- *
1006
- * @example
1007
- * ```ts
1008
- * await handler.updateThemeFontScheme({
1009
- * majorFont: "Montserrat",
1010
- * minorFont: "Open Sans",
1011
- * });
1012
- * // => void — font scheme updated in the in-memory theme XML
1013
- * ```
1014
- */
1015
- updateThemeFontScheme(fontScheme: f): Promise<void>;
1016
- /**
1017
- * Rename the presentation theme.
1018
- *
1019
- * @param name - New display name for the theme.
1020
- */
1021
- updateThemeName(name: string): Promise<void>;
1022
- /**
1023
- * Apply a complete theme in one call (colour scheme + font scheme + optional name).
1024
- *
1025
- * This is a convenience wrapper over {@link updateThemeColorScheme},
1026
- * {@link updateThemeFontScheme}, and {@link updateThemeName}.
1027
- *
1028
- * @param colorScheme - Colour definitions.
1029
- * @param fontScheme - Font definitions.
1030
- * @param themeName - Optional theme display name.
1031
- *
1032
- * @example
1033
- * ```ts
1034
- * await handler.applyTheme(
1035
- * { dk1: "#000", lt1: "#FFF", accent1: "#0066CC", /* … *\/ },
1036
- * { majorFont: "Helvetica", minorFont: "Arial" },
1037
- * "Corporate 2025",
1038
- * );
1039
- * // => void — colour scheme, font scheme, and name applied atomically
1040
- * ```
1041
- */
1042
- applyTheme(colorScheme: e, fontScheme: f, themeName?: string): Promise<void>;
1043
- /**
1044
- * Switch the presentation's theme, updating both the underlying XML and
1045
- * re-resolving all element colours in-place.
1046
- *
1047
- * This is the high-level API for theme switching: it updates the theme
1048
- * data in the ZIP, then patches all resolved colours in the provided
1049
- * `PptxData` so that elements immediately reflect the new colour scheme
1050
- * without requiring a re-parse.
1051
- *
1052
- * @param data - The current parsed presentation data (mutated in-place for
1053
- * convenience, but a new `PptxData` object is also returned).
1054
- * @param colorScheme - New colour scheme (12 colours).
1055
- * @param fontScheme - Optional new font scheme.
1056
- * @param themeName - Optional theme display name.
1057
- * @returns The updated PptxData with re-resolved colours.
1058
- *
1059
- * @example
1060
- * ```ts
1061
- * import { THEME_PRESETS } from "pptx-viewer-core";
1062
- *
1063
- * const ion = THEME_PRESETS.find(p => p.id === "ion")!;
1064
- * const newData = await handler.switchTheme(
1065
- * data,
1066
- * ion.colorScheme,
1067
- * ion.fontScheme,
1068
- * ion.name,
1069
- * );
1070
- * // => PptxData with all colours updated to the Ion theme
1071
- * ```
1072
- */
1073
- switchTheme(data: m, colorScheme: e, fontScheme?: f, themeName?: string): Promise<m>;
1074
- /**
1075
- * Apply a built-in theme preset to the presentation.
1076
- *
1077
- * Convenience wrapper around {@link switchTheme} that accepts a
1078
- * {@link PptxThemePreset} directly.
1079
- *
1080
- * @param data - The current parsed presentation data.
1081
- * @param preset - One of the built-in presets from {@link THEME_PRESETS}.
1082
- * @returns The updated PptxData.
1083
- *
1084
- * @example
1085
- * ```ts
1086
- * import { THEME_PRESETS } from "pptx-viewer-core";
1087
- *
1088
- * const preset = THEME_PRESETS.find(p => p.id === "facet")!;
1089
- * const newData = await handler.switchThemePreset(data, preset);
1090
- * ```
1091
- */
1092
- switchThemePreset(data: m, preset: PptxThemePreset): Promise<m>;
1093
- /**
1094
- * Parse a PPTX file from an `ArrayBuffer` and return structured data.
1095
- *
1096
- * If the file is encrypted and a `password` is provided in `options`,
1097
- * the file will be decrypted before parsing. If no password is provided
1098
- * for an encrypted file, throws {@link EncryptedFileError}.
1099
- *
1100
- * @param data - Raw bytes of the `.pptx` file (may be encrypted OLE2).
1101
- * @param options - Optional load-time settings, including `password`.
1102
- * @returns Parsed {@link PptxData} containing slides, theme, layouts, etc.
1103
- *
1104
- * @example
1105
- * ```ts
1106
- * // Load an unencrypted file:
1107
- * const pptx = await handler.load(buf.buffer);
1108
- *
1109
- * // Load a password-protected file:
1110
- * const pptx = await handler.load(buf.buffer, { password: "secret" });
1111
- * console.log(`${pptx.slides.length} slides loaded`);
1112
- * ```
1113
- */
1114
- load(data: ArrayBuffer, options?: PptxHandlerLoadOptions): Promise<m>;
1115
- /**
1116
- * Extract chart data from a graphic-frame XML node.
1117
- *
1118
- * @param slidePath - Internal archive path of the slide (e.g. `ppt/slides/slide1.xml`).
1119
- * @param graphicFrame - Parsed XML object for the `<p:graphicFrame>` node.
1120
- * @returns Chart data, or `undefined` if the frame is not a chart.
1121
- */
1122
- getChartDataForGraphicFrame(slidePath: string, graphicFrame: X | undefined): Promise<p | undefined>;
1123
- /**
1124
- * Extract SmartArt data from a graphic-frame XML node.
1125
- *
1126
- * @param slidePath - Internal archive path of the slide.
1127
- * @param graphicFrame - Parsed XML object for the `<p:graphicFrame>` node.
1128
- * @returns SmartArt data, or `undefined` if the frame is not SmartArt.
1129
- */
1130
- getSmartArtDataForGraphicFrame(slidePath: string, graphicFrame: X | undefined): Promise<q | undefined>;
1131
- /**
1132
- * Get the base64-encoded data URL for an embedded image.
1133
- *
1134
- * @param imagePath - Archive-relative path (e.g. `ppt/media/image1.png`).
1135
- * @returns A `data:image/...;base64,...` string, or `undefined` if not found.
1136
- */
1137
- getImageData(imagePath: string): Promise<string | undefined>;
1138
- /**
1139
- * Extract a media file from the PPTX archive as an ArrayBuffer.
1140
- * Avoids the 33% base64 overhead of getImageData — prefer this for
1141
- * audio/video media that will be played via Blob URLs.
1142
- */
1143
- getMediaArrayBuffer(mediaPath: string): Promise<ArrayBuffer | undefined>;
1144
- /**
1145
- * Serialise current slides back into a PPTX byte array.
1146
- *
1147
- * @param slides - The (possibly mutated) slide array.
1148
- * @param options - Optional save-time settings (e.g. thumbnail generation).
1149
- * @returns `Uint8Array` of the complete `.pptx` file.
1150
- *
1151
- * @example
1152
- * ```ts
1153
- * const bytes = await handler.save(data.slides);
1154
- * await fs.writeFile("output.pptx", Buffer.from(bytes));
1155
- * // => Uint8Array written to disk as a valid .pptx file
1156
- * ```
1157
- */
1158
- save(slides: P[], options?: PptxHandlerSaveOptions): Promise<Uint8Array>;
1159
- /**
1160
- * Serialise slides and then encrypt the output with a password.
1161
- *
1162
- * This is a convenience method that calls {@link save} followed by
1163
- * {@link encryptPptx}. The result is an OLE2 container suitable for
1164
- * opening in Microsoft PowerPoint with a password prompt.
1165
- *
1166
- * @param slides - The (possibly mutated) slide array.
1167
- * @param password - The password to encrypt with.
1168
- * @param options - Optional save-time and encryption settings.
1169
- * @returns `Uint8Array` of the encrypted OLE2 file.
1170
- *
1171
- * @example
1172
- * ```ts
1173
- * const bytes = await handler.saveEncrypted(data.slides, "secret");
1174
- * await fs.writeFile("protected.pptx", Buffer.from(bytes));
1175
- * // => Encrypted OLE2 file requiring password to open
1176
- * ```
1177
- */
1178
- saveEncrypted(slides: P[], password: string, options?: PptxHandlerSaveOptions & {
1179
- encryption?: EncryptionOptions;
1180
- }): Promise<Uint8Array>;
1181
- /**
1182
- * Get the slide layouts available for a specific slide.
1183
- *
1184
- * Returns layouts belonging to the same slide master as the given slide.
1185
- * This is useful for building a layout picker UI scoped to the current
1186
- * slide's master.
1187
- *
1188
- * @param slideIndex - Zero-based slide index.
1189
- * @param slides - Current slides array.
1190
- * @returns Array of {@link PptxLayoutOption} entries for the slide's master.
1191
- *
1192
- * @example
1193
- * ```ts
1194
- * const layouts = await handler.getAvailableLayoutsForSlide(0, data.slides);
1195
- * console.log(layouts.map(l => l.name));
1196
- * // => ["Title Slide", "Title and Content", "Blank", ...]
1197
- * ```
1198
- */
1199
- getAvailableLayoutsForSlide(slideIndex: number, slides: P[]): Promise<o[]>;
1200
- /**
1201
- * Resolve the editable template (master + layout) elements a slide
1202
- * inherits, each carrying a `master-` / `layout-` prefixed id.
1203
- *
1204
- * This is the foundation for an "edit template/master" feature. The
1205
- * returned elements are the decorative master/layout shapes the loader
1206
- * already merges behind slide-authored content (master shapes behind,
1207
- * layout shapes on top); placeholders are excluded. The same elements are
1208
- * shared by every slide inheriting the layout/master, so editing one and
1209
- * saving updates the shared part.
1210
- *
1211
- * To persist an edit, keep the mutated template element inside the
1212
- * `slide.elements` array passed to {@link save}; the save writer reads
1213
- * template elements from there and writes their shape XML back into the
1214
- * owning layout/master `p:spTree`.
1215
- *
1216
- * @param slideId - The slide's archive path (the `PptxSlide.id`).
1217
- * @returns Master + layout elements with prefixed ids (may be empty).
1218
- *
1219
- * @example
1220
- * ```ts
1221
- * const templateEls = await handler.getTemplateElementsForSlide(slide.id);
1222
- * const logo = templateEls.find((e) => e.id.startsWith("master-"));
1223
- * if (logo) {
1224
- * logo.x += 10;
1225
- * slide.elements = [...slide.elements, logo];
1226
- * await handler.save(data.slides);
1227
- * }
1228
- * ```
1229
- */
1230
- getTemplateElementsForSlide(slideId: string): Promise<a[]>;
1231
- /**
1232
- * Apply a different layout to an existing slide.
1233
- *
1234
- * Updates the slide's relationship to point to the new layout and
1235
- * refreshes layout-derived properties (background, layout name).
1236
- * The slide's own content elements are preserved.
1237
- *
1238
- * @param slideIndex - Zero-based slide index.
1239
- * @param layoutPath - Archive path of the target layout
1240
- * (e.g. `ppt/slideLayouts/slideLayout2.xml`).
1241
- * @param slides - Current slides array (the slide at `slideIndex`
1242
- * is replaced in-place).
1243
- * @returns The updated {@link PptxSlide} with new layout metadata.
1244
- *
1245
- * @example
1246
- * ```ts
1247
- * const updated = await handler.applyLayoutToSlide(
1248
- * 0,
1249
- * "ppt/slideLayouts/slideLayout3.xml",
1250
- * data.slides,
1251
- * );
1252
- * console.log(updated.layoutName);
1253
- * // => "Two Content"
1254
- * ```
1255
- */
1256
- applyLayoutToSlide(slideIndex: number, layoutPath: string, slides: P[]): Promise<P>;
1257
- /**
1258
- * Scan the loaded PPTX archive for all theme parts (`ppt/theme/theme*.xml`)
1259
- * and return their paths and display names.
1260
- */
1261
- getAvailableThemes(): Promise<Array<{
1262
- path: string;
1263
- name?: string;
1264
- }>>;
1265
- /**
1266
- * Export selected slides as individual PPTX files.
1267
- *
1268
- * Each entry in the returned map is keyed by slide index and contains a
1269
- * standalone `Uint8Array` PPTX with only that slide.
1270
- *
1271
- * @param slides - Full slide array.
1272
- * @param options - Export options (slide indexes, format, etc.).
1273
- * @returns A `Map<slideIndex, Uint8Array>` of exported files.
1274
- *
1275
- * @example
1276
- * ```ts
1277
- * const exports = await handler.exportSlides(data.slides, {
1278
- * slideIndexes: [0, 2],
1279
- * });
1280
- * for (const [idx, bytes] of exports) {
1281
- * await fs.writeFile(`slide_${idx}.pptx`, Buffer.from(bytes));
1282
- * }
1283
- * // => Map<number, Uint8Array> — one standalone .pptx per exported slide
1284
- * ```
1285
- */
1286
- exportSlides(slides: P[], options: L): Promise<Map<number, Uint8Array>>;
1287
- }
1288
-
1289
- /**
1290
- * Public facade for the PPTX editor handler.
1291
- *
1292
- * The implementation lives in `PptxHandlerCore` so this surface can stay small,
1293
- * stable, and easy to replace with alternate implementations in the future.
1294
- */
1295
- declare class PptxHandler extends PptxHandlerCore {
1296
- /**
1297
- * Create a new blank PPTX presentation from scratch.
1298
- *
1299
- * This is a convenience static method that delegates to
1300
- * {@link PresentationBuilder.create}. The returned handler is fully
1301
- * initialized and ready for editing, adding slides, and saving.
1302
- *
1303
- * @param options - Optional slide dimensions, theme, and metadata.
1304
- * @returns Handler, parsed data, and a slide builder factory.
1305
- *
1306
- * @example
1307
- * ```ts
1308
- * const { handler, data, createSlide } = await PptxHandler.createBlank({
1309
- * title: "My Deck",
1310
- * theme: { colors: { accent1: "#FF6B6B" } },
1311
- * });
1312
- *
1313
- * data.slides.push(
1314
- * createSlide("Blank")
1315
- * .addText("Hello", { fontSize: 36 })
1316
- * .build()
1317
- * );
1318
- *
1319
- * const bytes = await handler.save(data.slides);
1320
- * ```
1321
- */
1322
- static createBlank(options?: PresentationOptions): Promise<PresentationBuilderResult>;
1323
- /**
1324
- * Create a new PPTX presentation from scratch.
1325
- *
1326
- * Alias for {@link createBlank}. Generates a valid minimal OpenXML
1327
- * package and returns a fully initialized handler ready for editing,
1328
- * adding slides, and saving.
1329
- *
1330
- * @param options - Optional slide dimensions, theme, metadata,
1331
- * and initial slide count.
1332
- * @returns Handler, parsed data, and a slide builder factory.
1333
- *
1334
- * @example
1335
- * ```ts
1336
- * const { handler, data, createSlide } = await PptxHandler.create({
1337
- * title: "Q4 Report",
1338
- * initialSlideCount: 3,
1339
- * theme: { colors: { accent1: "#FF6B6B" } },
1340
- * });
1341
- *
1342
- * // The presentation already has 3 blank slides
1343
- * console.log(data.slides.length); // => 3
1344
- *
1345
- * // Add more slides with content
1346
- * data.slides.push(
1347
- * createSlide("Blank")
1348
- * .addText("Hello", { fontSize: 36 })
1349
- * .build()
1350
- * );
1351
- *
1352
- * const bytes = await handler.save(data.slides);
1353
- * ```
1354
- */
1355
- static create(options?: PresentationOptions): Promise<PresentationBuilderResult>;
1356
- }
1357
- /** Supported merge shape operations (matching PowerPoint's Merge Shapes menu). */
1358
- type MergeShapeOperation = 'union' | 'intersect' | 'subtract' | 'fragment' | 'combine';
1359
-
1360
- /**
1361
- * Collaboration types: Shared type definitions for the real-time
1362
- * collaboration infrastructure (Yjs-backed CRDT sync, presence tracking,
1363
- * collaborative editing).
1364
- *
1365
- * @module collaboration/types
1366
- */
1367
-
1368
- /** Connection lifecycle states for the Yjs WebSocket provider. */
1369
- type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'error';
1370
- /**
1371
- * Presence data broadcast to other participants.
1372
- * Cursor position is relative to the slide canvas (0..canvasWidth, 0..canvasHeight).
1373
- */
1374
- interface UserPresence {
1375
- /** Unique client ID (assigned by Yjs awareness). */
1376
- clientId: number;
1377
- /** Sanitised display name. */
1378
- userName: string;
1379
- /** Optional avatar URL (validated). */
1380
- userAvatar?: string;
1381
- /** Hex colour for the user's cursor ring. */
1382
- userColor: string;
1383
- /** Slide index the user is currently viewing. */
1384
- activeSlideIndex: number;
1385
- /** Cursor X on the canvas (clamped to slide bounds). */
1386
- cursorX: number;
1387
- /** Cursor Y on the canvas (clamped to slide bounds). */
1388
- cursorY: number;
1389
- /** ISO timestamp of last update (for stale-presence cleanup). */
1390
- lastUpdated: string;
1391
- /** Optional currently selected element ID. */
1392
- selectedElementId?: string;
1393
- /** Role in the session (owner, viewer, or collaborator). */
1394
- role?: CollaborationRole;
1395
- }
1396
- /** Value exposed by `CollaborationContext`. */
1397
- interface CollaborationContextValue {
1398
- /** Current WebSocket connection status. */
1399
- status: ConnectionStatus;
1400
- /** Presence data for all remote users (excludes the local user). */
1401
- remoteUsers: UserPresence[];
1402
- /** Broadcast the local user's presence state. */
1403
- broadcastPresence: (update: Partial<Omit<UserPresence, 'clientId'>>) => void;
1404
- /** Total number of connected users (including local). */
1405
- connectedCount: number;
1406
- /** The collaboration config that was provided. */
1407
- config: CollaborationConfig;
1408
- /** The Yjs document (for document sync). */
1409
- doc: Doc | null;
1410
- /**
1411
- * Whether the provider completed its initial document sync (or the
1412
- * first-write grace period elapsed). Local doc writes are gated on this.
1413
- */
1414
- synced: boolean;
1415
- /** Manually retry the WebSocket connection after a timeout or error. */
1416
- retry: () => void;
1417
- }
1418
-
1419
- interface UseThemeSwitchingInput {
1420
- /** Ref to the PptxHandler instance. */
1421
- handlerRef: RefObject<PptxHandler | null>;
1422
- /** Current parsed presentation data (null when nothing is loaded). */
1423
- data: m | null;
1424
- /** Callback to update the presentation data after theme switch. */
1425
- onDataChange: (newData: m) => void;
1426
- /** Optional callback fired when theme switch completes successfully. */
1427
- onThemeChanged?: (preset: PptxThemePreset) => void;
1428
- }
1429
- interface ThemeSwitchingResult {
1430
- /** All available built-in theme presets. */
1431
- presets: readonly PptxThemePreset[];
1432
- /**
1433
- * Apply a theme preset to the current presentation.
1434
- * Updates both the in-memory ZIP and all resolved element colours.
1435
- */
1436
- switchToPreset: (preset: PptxThemePreset) => Promise<void>;
1437
- /**
1438
- * Apply a custom colour scheme (and optional font scheme) to the
1439
- * current presentation.
1440
- */
1441
- switchToCustom: (colorScheme: e, fontScheme?: f, themeName?: string) => Promise<void>;
1442
- /**
1443
- * Get the preset matching the current presentation theme (if any).
1444
- * Returns undefined if the current theme does not match a built-in preset.
1445
- */
1446
- currentPreset: PptxThemePreset | undefined;
1447
- }
1448
- /**
1449
- * React hook providing theme switching capabilities for the PowerPoint viewer.
1450
- *
1451
- * @example
1452
- * ```tsx
1453
- * const { presets, switchToPreset, currentPreset } = useThemeSwitching({
1454
- * handlerRef,
1455
- * data,
1456
- * onDataChange: setData,
1457
- * });
1458
- *
1459
- * return (
1460
- * <div>
1461
- * {presets.map(preset => (
1462
- * <button
1463
- * key={preset.id}
1464
- * onClick={() => switchToPreset(preset)}
1465
- * aria-pressed={preset.id === currentPreset?.id}
1466
- * >
1467
- * {preset.name}
1468
- * </button>
1469
- * ))}
1470
- * </div>
1471
- * );
1472
- * ```
1473
- */
1474
- declare function useThemeSwitching(input: UseThemeSwitchingInput): ThemeSwitchingResult;
1475
-
1476
- /**
1477
- * useYjsProvider: Manages the Yjs document and provider lifecycle.
1478
- *
1479
- * Creates a Y.Doc and connects via one of two transports:
1480
- * - `websocket` (default): WebSocketProvider against `config.serverUrl`.
1481
- * - `webrtc`: peer-to-peer WebrtcProvider (no document server); usable from
1482
- * static hosting. Same-browser tabs sync over BroadcastChannel.
1483
- * Exposes connection status and cleanup on unmount.
1484
- *
1485
- * This hook is intentionally thin: it only manages the transport layer.
1486
- * Application-level collaboration logic lives in useCollaborativeState
1487
- * and usePresenceTracking.
1488
- *
1489
- * @module collaboration/useYjsProvider
1490
- */
1491
-
1492
- interface UseYjsProviderInput {
1493
- /**
1494
- * Collaboration config, or `undefined` when collaboration is inactive. The
1495
- * hook is always called (React hook rules) but stays fully dormant, never
1496
- * opening a transport, while config is absent.
1497
- */
1498
- config?: CollaborationConfig;
1499
- }
1500
- interface UseYjsProviderResult {
1501
- /** Current WebSocket connection status. */
1502
- status: ConnectionStatus;
1503
- /** The Yjs awareness instance (null until connected). */
1504
- awareness: Awareness | null;
1505
- /** The Yjs document (null until initialised). */
1506
- doc: Doc | null;
1507
- /** Local awareness client ID. */
1508
- clientId: number | null;
1509
- /**
1510
- * Whether the provider completed its initial document sync. Local doc
1511
- * writes should be gated on this so a late joiner never seeds its
1512
- * bootstrap deck into a room whose content has not arrived yet. Websocket
1513
- * flips it on the provider's 'synced' event; webrtc flips it on peer sync
1514
- * or after {@link INITIAL_SYNC_GRACE_MS} (a lone fresh-room peer never
1515
- * receives a sync event).
1516
- */
1517
- synced: boolean;
1518
- /** Manually retry the connection after a timeout or error. */
1519
- retry: () => void;
1520
- }
1521
- /**
1522
- * Lazily loads `yjs` and `y-websocket`, creates a Y.Doc and
1523
- * WebSocketProvider, and tracks the connection lifecycle.
1524
- *
1525
- * If the connection does not succeed within {@link CONNECTION_TIMEOUT_MS},
1526
- * the provider is torn down and status moves to `'error'`. The consumer
1527
- * can call `retry()` to attempt a fresh connection.
1528
- *
1529
- * The Yjs packages are dynamically imported so they are fully
1530
- * tree-shaken when collaboration is not enabled.
1531
- */
1532
- declare function useYjsProvider({ config }: UseYjsProviderInput): UseYjsProviderResult;
1533
-
1534
- interface UsePresenceTrackingInput {
1535
- awareness: Awareness | null;
1536
- localClientId: number | null;
1537
- userName: string;
1538
- userColor: string;
1539
- userAvatar?: string;
1540
- /** Role in the session (broadcaster, viewer, or collaborator). */
1541
- role?: string;
1542
- canvasWidth: number;
1543
- canvasHeight: number;
1544
- }
1545
- interface UsePresenceTrackingResult {
1546
- /** Presence data for all remote users (excludes local). */
1547
- remoteUsers: UserPresence[];
1548
- /** Broadcast a partial presence update for the local user. */
1549
- broadcastPresence: (update: Partial<Omit<UserPresence, 'clientId'>>) => void;
1550
- }
1551
- declare function usePresenceTracking({ awareness, localClientId, userName, userColor, userAvatar, role, canvasWidth, canvasHeight, }: UsePresenceTrackingInput): UsePresenceTrackingResult;
1552
-
1553
- /**
1554
- * useCollaborativeState: Composes the Yjs provider and presence tracking
1555
- * into a single hook for the collaboration system.
1556
- *
1557
- * This is the primary hook consumed by the `CollaborationProvider` context.
1558
- * It orchestrates:
1559
- * - Yjs WebSocket connection lifecycle
1560
- * - Presence tracking (broadcast + receive)
1561
- * - Connection status
1562
- *
1563
- * @module collaboration/useCollaborativeState
1564
- */
1565
-
1566
- interface UseCollaborativeStateInput {
1567
- /**
1568
- * Collaboration config, or `undefined` when collaboration is inactive. The
1569
- * hook is always called so the surrounding provider keeps a stable React
1570
- * tree shape; it produces a dormant value (no transport, empty presence)
1571
- * while config is absent.
1572
- */
1573
- config?: CollaborationConfig;
1574
- canvasWidth: number;
1575
- canvasHeight: number;
1576
- }
1577
- declare function useCollaborativeState({ config, canvasWidth, canvasHeight, }: UseCollaborativeStateInput): CollaborationContextValue | null;
1578
-
1579
- interface UseCollaborativeHistoryInput {
1580
- /** The local user's client ID (from Yjs awareness). */
1581
- localClientId: number | null;
1582
- /** Standard history undo function. */
1583
- handleUndo: () => void;
1584
- /** Standard history redo function. */
1585
- handleRedo: () => void;
1586
- /** Whether undo is available. */
1587
- canUndo: boolean;
1588
- /** Whether redo is available. */
1589
- canRedo: boolean;
1590
- }
1591
- interface UseCollaborativeHistoryResult {
1592
- /** Undo the last local change. */
1593
- handleUndo: () => void;
1594
- /** Redo the last undone local change. */
1595
- handleRedo: () => void;
1596
- /** Whether undo is available. */
1597
- canUndo: boolean;
1598
- /** Whether redo is available. */
1599
- canRedo: boolean;
1600
- }
1601
- declare function useCollaborativeHistory({ localClientId: _localClientId, handleUndo, handleRedo, canUndo, canRedo, }: UseCollaborativeHistoryInput): UseCollaborativeHistoryResult;
1602
-
1603
- /** Returns true if the current page was opened as an audience tab. */
1604
- declare function isAudienceTab(): boolean;
1605
- interface UsePresenterWindowInput {
1606
- currentSlideIndex: number;
1607
- isPresenterMode: boolean;
1608
- /** Raw PPTX bytes to share with the audience tab via IndexedDB. */
1609
- content?: ArrayBuffer | Uint8Array | null;
1610
- }
1611
- interface UsePresenterWindowResult {
1612
- openAudienceWindow: () => boolean;
1613
- closeAudienceWindow: () => void;
1614
- isAudienceWindowOpen: () => boolean;
1615
- syncSlideToAudience: (slideIndex: number) => void;
1616
- }
1617
- declare function usePresenterWindow(input: UsePresenterWindowInput): UsePresenterWindowResult;
1618
-
1619
- export { type ConnectionStatus as C, type MergeShapeOperation as M, PptxHandler as P, type ThemeSwitchingResult as T, type UserPresence as U, type CollaborationContextValue as a, type UseCollaborativeHistoryResult as b, type UseCollaborativeStateInput as c, type UsePresenceTrackingResult as d, type UseThemeSwitchingInput as e, useCollaborativeState as f, usePresenceTracking as g, useThemeSwitching as h, isAudienceTab as i, useYjsProvider as j, type PptxSaveFormat as k, type UseCollaborativeHistoryInput as l, type UsePresenceTrackingInput as m, type UsePresenterWindowInput as n, type UsePresenterWindowResult as o, type UseYjsProviderInput as p, type UseYjsProviderResult as q, usePresenterWindow as r, useCollaborativeHistory as u };