@quirekit/pptx-editor 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1589 @@
1
+ import { AnimationDirection, AnimationEffect, AnimationShape, AnimationStartCondition, AnimationTextBuild, MediaPlayback, PresentationData, SlideAnimationStep, SlideData } from "@quirekit/office-kit-pptx";
2
+ import { CommandDescriptor } from "@quirekit/extension-authoring";
3
+ //#region src/commands/geometry/types.d.ts
4
+ /** A point in frame fractions: 0 is the frame's left or top edge, 1 its right or bottom edge. */
5
+ interface PptxPathPoint {
6
+ /** Horizontal position. */
7
+ readonly x: number;
8
+ /** Vertical position. */
9
+ readonly y: number;
10
+ }
11
+ /** One vertex of an editable path with the handles of the curves meeting at it. */
12
+ interface PptxPathNode extends PptxPathPoint {
13
+ /** Control point of the curve arriving at the node, or null for a straight arrival. */
14
+ in: PptxPathPoint | null;
15
+ /** Control point of the curve leaving the node, or null for a straight departure. */
16
+ out: PptxPathPoint | null;
17
+ }
18
+ /** One drawing path of a shape: its subpaths keep their grouping so filled holes stay holes. */
19
+ interface PptxEditablePath {
20
+ /** How the path is filled. */
21
+ readonly fill: string;
22
+ /** Whether the path is outlined. */
23
+ readonly stroke: boolean;
24
+ /** Runs of nodes, each open or closed. */
25
+ readonly subpaths: {
26
+ nodes: PptxPathNode[];
27
+ closed: boolean;
28
+ }[];
29
+ }
30
+ //#endregion
31
+ //#region src/commands/insert.d.ts
32
+ /** Chart kinds the insert menu offers. */
33
+ declare const pptxInsertChartKinds: readonly ["column", "bar", "line", "pie", "doughnut", "area", "scatter", "radar"];
34
+ /** A chart kind the insert menu offers. */
35
+ type PptxInsertChartKind = (typeof pptxInsertChartKinds)[number];
36
+ //#endregion
37
+ //#region src/commands/table/format/style.d.ts
38
+ /** Which parts of a table its style emphasises: header and total rows, first and last columns, and banding. */
39
+ interface PptxTableStyleOptions {
40
+ /** Header row. */
41
+ readonly firstRow: boolean;
42
+ /** Total row. */
43
+ readonly lastRow: boolean;
44
+ /** First column. */
45
+ readonly firstCol: boolean;
46
+ /** Last column. */
47
+ readonly lastCol: boolean;
48
+ /** Banded rows. */
49
+ readonly bandRow: boolean;
50
+ /** Banded columns. */
51
+ readonly bandCol: boolean;
52
+ }
53
+ //#endregion
54
+ //#region src/commands/table/types.d.ts
55
+ /** A rectangle of table cells, counted from 0 on the table grid. */
56
+ interface PptxCellRange {
57
+ /** First row. */
58
+ readonly row: number;
59
+ /** First column. */
60
+ readonly column: number;
61
+ /** Rows covered, at least 1. */
62
+ readonly rows: number;
63
+ /** Columns covered, at least 1. */
64
+ readonly columns: number;
65
+ }
66
+ /** Which edges of a cell range a border preset draws or clears. */
67
+ /** `diagonalDown` and `diagonalUp` draw a slash header line across each cell; `none` also clears them. */
68
+ type PptxCellBorderPreset = "all" | "outside" | "inside" | "top" | "bottom" | "left" | "right" | "insideHorizontal" | "insideVertical" | "diagonalDown" | "diagonalUp" | "none";
69
+ /** Dash patterns a border can take, as DrawingML names them. */
70
+ declare const pptxLineDashes: readonly ["solid", "dot", "dash", "lgDash", "dashDot", "sysDash", "sysDot"];
71
+ /** A border's dash pattern. */
72
+ type PptxLineDash = (typeof pptxLineDashes)[number];
73
+ /** Line a border preset draws with. */
74
+ interface PptxBorderPen {
75
+ /** Colour as `#RRGGBB`. */
76
+ readonly color: string;
77
+ /** Width in points. */
78
+ readonly width: number;
79
+ /** Dash pattern; solid when left out. */
80
+ readonly dash?: PptxLineDash;
81
+ }
82
+ /** Inner margins of cells in EMU; sides left out keep theirs. */
83
+ interface PptxCellMargins {
84
+ /** Left margin. */
85
+ readonly left?: number;
86
+ /** Right margin. */
87
+ readonly right?: number;
88
+ /** Top margin. */
89
+ readonly top?: number;
90
+ /** Bottom margin. */
91
+ readonly bottom?: number;
92
+ }
93
+ /** One segment of a table's grid: the part of a row or column line beside one cell. */
94
+ interface PptxGridEdge {
95
+ /** `row` for a horizontal line between rows, `column` for a vertical line between columns. */
96
+ readonly axis: "row" | "column";
97
+ /** Line index from 0, the table's top or left edge, to the row or column count, its bottom or right edge. */
98
+ readonly line: number;
99
+ /** Column of a horizontal segment, or row of a vertical one. */
100
+ readonly index: number;
101
+ }
102
+ /** A quick calculation over picked number cells. */
103
+ type PptxQuickCalc = "sum" | "average" | "max" | "min";
104
+ /** Horizontal alignment of cell text. */
105
+ type PptxCellAlignment = "left" | "center" | "right" | "justify";
106
+ /** How cell text runs: horizontal, East Asian vertical columns, or every line turned 90° or 270°. */
107
+ type PptxCellTextDirection = "horz" | "eaVert" | "vert" | "vert270";
108
+ /** Vertical placement of cell text. */
109
+ type PptxCellAnchor = "top" | "center" | "bottom";
110
+ /** Target of a command on table cells. */
111
+ interface PptxCellTarget {
112
+ /** Slide part name. */
113
+ readonly slide: string;
114
+ /** Table shape id. */
115
+ readonly shape: number;
116
+ /** Cells it acts on; it grows to cover the merged cells it touches. */
117
+ readonly range: PptxCellRange;
118
+ }
119
+ declare module "../../command/types" {
120
+ interface PptxCommandRegistry {
121
+ /** Inserts as many rows as `count` above or below a row; they take its height and cell format. */
122
+ insertTableRows: (options: {
123
+ slide: string;
124
+ shape: number;
125
+ row: number;
126
+ count: number;
127
+ side: "above" | "below";
128
+ }) => PptxCommand;
129
+ /** Inserts as many columns as `count` left or right of a column; they take its width and cell format, and the table widens. */
130
+ insertTableColumns: (options: {
131
+ slide: string;
132
+ shape: number;
133
+ column: number;
134
+ count: number;
135
+ side: "left" | "right";
136
+ }) => PptxCommand;
137
+ /** Removes rows; fails when it would remove them all. */
138
+ deleteTableRows: (options: {
139
+ slide: string;
140
+ shape: number;
141
+ row: number;
142
+ count: number;
143
+ }) => PptxCommand;
144
+ /** Removes columns and narrows the table; fails when it would remove them all. */
145
+ deleteTableColumns: (options: {
146
+ slide: string;
147
+ shape: number;
148
+ column: number;
149
+ count: number;
150
+ }) => PptxCommand;
151
+ /** Merges a range into one cell holding the text of all of them. */
152
+ mergeTableCells: (options: PptxCellTarget) => PptxCommand;
153
+ /** Splits the merged cells of a range back, or splits one plain cell into rows and columns. */
154
+ splitTableCells: (options: PptxCellTarget & {
155
+ rows?: number;
156
+ columns?: number;
157
+ }) => PptxCommand;
158
+ /** Fills cells with a colour, removes their fill with `none`, or gives them back the table style's with null. */
159
+ setTableCellsFill: (options: PptxCellTarget & {
160
+ color: string | null;
161
+ }) => PptxCommand;
162
+ /** Draws or clears the edges of a range a preset names; without a pen the preset draws a 1 pt black line. */
163
+ setTableCellsBorders: (options: PptxCellTarget & {
164
+ preset: PptxCellBorderPreset;
165
+ pen?: PptxBorderPen;
166
+ }) => PptxCommand;
167
+ /** Sets the slash header lines of cells: down, up, both or neither; without a pen they are 1 pt black. */
168
+ setTableCellsDiagonals: (options: PptxCellTarget & {
169
+ down: boolean;
170
+ up: boolean;
171
+ pen?: PptxBorderPen;
172
+ }) => PptxCommand;
173
+ /** Aligns the text of cells horizontally. */
174
+ setTableCellsAlignment: (options: PptxCellTarget & {
175
+ align: PptxCellAlignment;
176
+ }) => PptxCommand;
177
+ /** Places the text of cells at their top, middle or bottom. */
178
+ setTableCellsAnchor: (options: PptxCellTarget & {
179
+ anchor: PptxCellAnchor;
180
+ }) => PptxCommand;
181
+ /** Sets inner margins of cells, in EMU. */
182
+ setTableCellsMargins: (options: PptxCellTarget & {
183
+ margins: PptxCellMargins;
184
+ }) => PptxCommand;
185
+ /** Fills the table's own background behind its cells with a colour, leaves it empty with `none`, or gives it back to the table style with null. */
186
+ setTableBackground: (options: {
187
+ slide: string;
188
+ shape: number;
189
+ color: string | null;
190
+ }) => PptxCommand;
191
+ /** Removes the fills and borders set on cells themselves, so the table style shows through. */
192
+ clearTableCellsFormat: (options: PptxCellTarget) => PptxCommand;
193
+ /** Empties the text of cells, keeping their format. */
194
+ clearTableCells: (options: PptxCellTarget) => PptxCommand;
195
+ /** Sums, averages or finds the largest or smallest number of picked cells: per column into the row below, or for one row into the cell to its right, adding that row or column when the table ends. */
196
+ calculateTableCells: (options: PptxCellTarget & {
197
+ op: PptxQuickCalc;
198
+ }) => PptxCommand;
199
+ /** Erases grid segments as the table eraser does: inside segments merge the cells beside them, others lose their line. */
200
+ eraseTableEdges: (options: {
201
+ slide: string;
202
+ shape: number;
203
+ edges: readonly PptxGridEdge[];
204
+ }) => PptxCommand;
205
+ /** Draws grid segments with a pen, or erases them to no line with null, as one undo step. */
206
+ setTableEdges: (options: {
207
+ slide: string;
208
+ shape: number;
209
+ edges: readonly PptxGridEdge[];
210
+ pen: PptxBorderPen | null;
211
+ }) => PptxCommand;
212
+ /** Writes an in-place rich text edit of one cell, as one undo step. */
213
+ editTableCellText: (options: {
214
+ slide: string;
215
+ shape: number;
216
+ row: number;
217
+ column: number;
218
+ edit: PptxTextEdit;
219
+ }) => PptxCommand;
220
+ /** Writes rows of cell texts from a cell on, as copied from a spreadsheet; cells past the table's edge are dropped. */
221
+ setTableCellsText: (options: {
222
+ slide: string;
223
+ shape: number;
224
+ row: number;
225
+ column: number;
226
+ texts: readonly (readonly string[])[];
227
+ }) => PptxCommand;
228
+ /** Formats all the text of cells, such as its font and size. */
229
+ setTableCellsTextFormat: (options: PptxCellTarget & {
230
+ format: PptxTextFormat;
231
+ }) => PptxCommand;
232
+ /** Runs the text of cells horizontally or vertically. */
233
+ setTableCellsTextDirection: (options: PptxCellTarget & {
234
+ direction: PptxCellTextDirection;
235
+ }) => PptxCommand;
236
+ /** Sets the drawn height of rows, in EMU; the table grows or shrinks with them. */
237
+ setTableRowHeight: (options: {
238
+ slide: string;
239
+ shape: number;
240
+ row: number;
241
+ count: number;
242
+ height: number;
243
+ }) => PptxCommand;
244
+ /** Sets the drawn width of columns, in EMU; the table grows or shrinks with them. */
245
+ setTableColumnWidth: (options: {
246
+ slide: string;
247
+ shape: number;
248
+ column: number;
249
+ count: number;
250
+ width: number;
251
+ }) => PptxCommand;
252
+ /** Gives rows the same height, keeping their total. */
253
+ distributeTableRows: (options: {
254
+ slide: string;
255
+ shape: number;
256
+ row: number;
257
+ count: number;
258
+ }) => PptxCommand;
259
+ /** Gives columns the same width, keeping their total. */
260
+ distributeTableColumns: (options: {
261
+ slide: string;
262
+ shape: number;
263
+ column: number;
264
+ count: number;
265
+ }) => PptxCommand;
266
+ /** Moves and sizes a table, scaling its rows and columns to the new size so every app draws it the same, as one undo step. */
267
+ setTableFrame: (options: {
268
+ slide: string;
269
+ shape: number;
270
+ x: number;
271
+ y: number;
272
+ width: number;
273
+ height: number;
274
+ }) => PptxCommand;
275
+ /** Adds a table copied from a spreadsheet with its merged cells, fills, text format and sizes, as one undo step. */
276
+ addPastedTable: (options: {
277
+ slide: string;
278
+ table: PptxPastedTable;
279
+ x: number;
280
+ y: number;
281
+ width: number;
282
+ height: number;
283
+ }) => PptxCommand;
284
+ /** Pastes a table copied from a spreadsheet into a table from a cell on, with its merged cells, fills and text format; cells past the edge are dropped. */
285
+ pasteTableCells: (options: {
286
+ slide: string;
287
+ shape: number;
288
+ row: number;
289
+ column: number;
290
+ table: PptxPastedTable;
291
+ }) => PptxCommand;
292
+ }
293
+ }
294
+ /** One cell of a table copied from a spreadsheet, at the top left of the cells it spans. */
295
+ interface PptxPastedCell {
296
+ /** Row, from 0. */
297
+ readonly row: number;
298
+ /** Column, from 0. */
299
+ readonly column: number;
300
+ /** Rows it spans. */
301
+ readonly rows: number;
302
+ /** Columns it spans. */
303
+ readonly columns: number;
304
+ /** Text; line breaks part paragraphs. */
305
+ readonly text: string;
306
+ /** Background as `#RRGGBB`, if it had one. */
307
+ readonly fill?: string;
308
+ /** Text format it showed. */
309
+ readonly format?: PptxTextFormat;
310
+ /** Horizontal alignment it showed. */
311
+ readonly align?: PptxCellAlignment;
312
+ }
313
+ /** A table copied from a spreadsheet. */
314
+ interface PptxPastedTable {
315
+ /** Rows. */
316
+ readonly rows: number;
317
+ /** Columns. */
318
+ readonly columns: number;
319
+ /** Cells that hold text or format, each at the top left of what it spans. */
320
+ readonly cells: readonly PptxPastedCell[];
321
+ /** Column widths in EMU as the spreadsheet showed them, when known. */
322
+ readonly columnWidths?: readonly number[];
323
+ /** Row heights in EMU as the spreadsheet showed them, when known. */
324
+ readonly rowHeights?: readonly number[];
325
+ }
326
+ //#endregion
327
+ //#region src/view/layout/types.d.ts
328
+ /** An axis-aligned rectangle in slide EMU. */
329
+ interface PptxLayoutRect {
330
+ /** Left edge. */
331
+ readonly x: number;
332
+ /** Top edge. */
333
+ readonly y: number;
334
+ /** Width. */
335
+ readonly width: number;
336
+ /** Height. */
337
+ readonly height: number;
338
+ }
339
+ /** Kind of layout problem. */
340
+ type PptxLayoutProblemKind = "overflow" | "overlap" | "outside-container" | "off-slide" | "crosses-line";
341
+ /** A layout defect: text running out of its box, content covering content, or leaving its card or the slide. */
342
+ interface PptxLayoutProblem {
343
+ /** Problem kind. */
344
+ readonly kind: PptxLayoutProblemKind;
345
+ /** Shapes involved: the text or content first, then what it overlaps, leaves or is crossed by. */
346
+ readonly shapes: readonly number[];
347
+ /** How far it runs over, in EMU: past the edge, the depth of the overlap, or the length of line inside the text. */
348
+ readonly amount: number;
349
+ }
350
+ /** Checks slides through a probe and keeps each slide's result while nothing it is drawn from changed. */
351
+ interface PptxLayoutChecker {
352
+ /** @param presentation - Deck. @param slide - Slide. @returns Its layout problems, measuring it now when they are not kept. */
353
+ check(presentation: PresentationData, slide: SlideData): readonly PptxLayoutProblem[];
354
+ /** @param presentation - Deck. @param slide - Slide. @returns Its kept layout problems, or undefined when it has changed since. */
355
+ peek(presentation: PresentationData, slide: SlideData): readonly PptxLayoutProblem[] | undefined;
356
+ /** @param presentation - Deck. @param slide - Slide. @returns Where its text was drawn when measured, or undefined when it has changed since. */
357
+ text(presentation: PresentationData, slide: SlideData): ReadonlyMap<number, PptxLayoutRect> | undefined;
358
+ /**
359
+ * Measures every slide whose result is not kept, one slide per task, so the page stays responsive.
360
+ * @param presentation - Deck.
361
+ * @returns Settles once every slide has a kept result.
362
+ */
363
+ settle(presentation: PresentationData): Promise<void>;
364
+ }
365
+ //#endregion
366
+ //#region src/commands/motion/types.d.ts
367
+ /** Transition effects offered for writing; the slide show plays each of them. */
368
+ declare const pptxTransitionEffects: readonly ["none", "fade", "cut", "push", "pan", "wipe", "cover", "pull", "reveal", "flip", "split", "zoom", "warp", "flythrough", "doors", "window", "blinds", "checker", "comb", "randomBar", "strips", "newsflash", "flash", "dissolve", "circle", "diamond", "plus", "wedge", "wheel", "random"];
369
+ /** Transition effect a slide is given. */
370
+ type PptxTransitionEffect = (typeof pptxTransitionEffects)[number];
371
+ /** Side a sliding transition enters from. */
372
+ type PptxTransitionSide = "left" | "right" | "top" | "bottom";
373
+ /** A slide transition as the editor writes it. */
374
+ interface PptxTransition {
375
+ /** Effect. */
376
+ readonly effect: PptxTransitionEffect;
377
+ /** Side push, wipe, cover and pull enter from. */
378
+ readonly from?: PptxTransitionSide | undefined;
379
+ /** Whether split and zoom open out of the centre (`out`) or close in on it (`in`). */
380
+ readonly inOut?: "in" | "out" | undefined;
381
+ /** Axis a split runs along. */
382
+ readonly orientation?: "horz" | "vert" | undefined;
383
+ /** Direction token of the other effects as the file writes it, such as `horz`, `lu` or `l`; their default when left out. */
384
+ readonly direction?: string | undefined;
385
+ /** Whether a fade or cut goes through black. */
386
+ readonly thruBlack?: boolean | undefined;
387
+ /** Spokes of a wheel. */
388
+ readonly spokes?: number | undefined;
389
+ /** Effect length in milliseconds. */
390
+ readonly durationMs?: number | undefined;
391
+ /** Whether a click advances; defaults to true. */
392
+ readonly advanceOnClick?: boolean | undefined;
393
+ /** Milliseconds after which the show advances by itself, or undefined for clicks only. */
394
+ readonly advanceAfterMs?: number | undefined;
395
+ }
396
+ /** One animation effect as the editor writes it. */
397
+ interface PptxAnimation {
398
+ /** Preset effect. */
399
+ readonly effect: AnimationEffect;
400
+ /** Edge a fly or wipe comes from or leaves by; only for effects that take one. */
401
+ readonly direction?: AnimationDirection;
402
+ /** Shape a `shapeIn` or `shapeOut` opens or closes through. */
403
+ readonly shape?: AnimationShape;
404
+ /** What starts the effect; defaults to a click. */
405
+ readonly start?: AnimationStartCondition;
406
+ /** Effect length in milliseconds; the preset's own when left out. */
407
+ readonly durationMs?: number;
408
+ /** Wait after the start condition, in milliseconds. */
409
+ readonly delayMs?: number;
410
+ /** How the shape's text enters: as one object, all paragraphs at once, or one paragraph a click. */
411
+ readonly build?: AnimationTextBuild;
412
+ }
413
+ /** Changes to one existing animation effect; values left out stay. */
414
+ type PptxAnimationPatch = Partial<PptxAnimation>;
415
+ //#endregion
416
+ //#region src/command/types.d.ts
417
+ /** What a described deck command acts on. */
418
+ type PptxCommandTarget = "document" | "slide" | "shape" | "text";
419
+ /** State a command reads and edits; one command chain shares it. */
420
+ interface PptxCommandProps {
421
+ /** Live presentation, including earlier commands of the same chain. */
422
+ readonly presentation: PresentationData;
423
+ /** False when the caller only asks whether the command applies; the command must not edit then. */
424
+ readonly dispatch: boolean;
425
+ }
426
+ /** One edit step: returns false when it does not apply, leaving the presentation unchanged. */
427
+ type PptxCommand$1 = (props: PptxCommandProps) => boolean;
428
+ /** Targeting facts handed to a described command's adapter by an AI engine. */
429
+ interface PptxCommandAgentContext {
430
+ /** Live presentation, including earlier operations of the same edit. */
431
+ readonly presentation: PresentationData;
432
+ /** Slide part name of a slide, shape or text target; null for the document. */
433
+ readonly slide: string | null;
434
+ /** Shape id of a shape or text target; null otherwise. For a group target, its first shape. */
435
+ readonly shape: number | null;
436
+ /** Every shape of a group target (a unit of items or one item), for commands that declare `group`. */
437
+ readonly shapes?: readonly number[] | undefined;
438
+ /** Exact targeted text, or null. */
439
+ readonly text: string | null;
440
+ /** Value returned by the command's `prepare`, when it declares one. */
441
+ readonly prepared: unknown;
442
+ /** Line icons by name, once loaded, for commands that draw icons. */
443
+ readonly icons?: Readonly<Record<string, readonly (readonly [string, Readonly<Record<string, string>>])[]>> | undefined;
444
+ /** Whether the host generates pictures from a description, for commands that place them. */
445
+ readonly pictures?: boolean | undefined;
446
+ }
447
+ /** Agent-facing facts of a deck command; a description alone grants no execution. */
448
+ interface PptxCommandDescriptor extends CommandDescriptor<PptxCommandAgentContext, PptxCommandTarget> {
449
+ /** Shape kinds a shape or text target must be, such as `table` or `chart`. */
450
+ readonly kinds?: readonly PptxShapeKind[] | undefined;
451
+ /** Whether a shape target may be a group of shapes that the command acts on together. */
452
+ readonly group?: boolean | undefined;
453
+ /** Whether the command only records a plan or a choice beside the slides and never changes what they show. */
454
+ readonly planning?: boolean | undefined;
455
+ }
456
+ /** Content kind of a shape as commands and AI views classify it. */
457
+ type PptxShapeKind = "text" | "picture" | "table" | "chart" | "group" | "connector" | "media" | "other";
458
+ /** Edge or centre line shapes are aligned to. */
459
+ type PptxAlignEdge = "left" | "center" | "right" | "top" | "middle" | "bottom";
460
+ /** Text format applied to a whole shape; fields left out stay as they are. */
461
+ interface PptxTextFormat {
462
+ /** Font size in points. */
463
+ readonly size?: number;
464
+ /** Baseline offset as a fraction of the font size: positive raises superscript, negative lowers subscript, 0 is normal. */
465
+ readonly baseline?: number;
466
+ /** Bold. */
467
+ readonly bold?: boolean;
468
+ /** Italic. */
469
+ readonly italic?: boolean;
470
+ /** Single underline. */
471
+ readonly underline?: boolean;
472
+ /** Text color as `#RRGGBB`, or null for the theme color. */
473
+ readonly color?: string | null;
474
+ /** Font family for Latin and East Asian text. */
475
+ readonly font?: string;
476
+ /** Strikethrough. */
477
+ readonly strike?: boolean;
478
+ /** Text highlight as `#RRGGBB`, or null for none. */
479
+ readonly highlight?: string | null;
480
+ }
481
+ /** Range of a shape's text in offsets of `getShapeText`, paragraphs counting as one character. */
482
+ interface PptxTextRange {
483
+ /** Start offset. */
484
+ readonly start: number;
485
+ /** End offset. */
486
+ readonly end: number;
487
+ }
488
+ /** Autonumber schemes the slide renderer draws: Arabic, Roman and Latin letters with a period, a parenthesis or both. */
489
+ declare const pptxNumberSchemes: readonly ["arabicPeriod", "arabicParenR", "arabicParenBoth", "arabicPlain", "romanUcPeriod", "romanLcPeriod", "romanUcParenR", "romanLcParenR", "romanUcParenBoth", "romanLcParenBoth", "alphaUcPeriod", "alphaLcPeriod", "alphaUcParenR", "alphaLcParenR", "alphaUcParenBoth", "alphaLcParenBoth"];
490
+ /** Autonumber scheme of a numbered paragraph. */
491
+ type PptxNumberScheme = (typeof pptxNumberSchemes)[number];
492
+ /** List marker of paragraphs: a bullet character, an autonumber scheme, or none. */
493
+ type PptxListStyle = {
494
+ readonly kind: "bullet";
495
+ readonly char: string;
496
+ } | {
497
+ readonly kind: "number";
498
+ readonly scheme: PptxNumberScheme;
499
+ } | {
500
+ readonly kind: "none";
501
+ };
502
+ /** Paragraph alignment. */
503
+ type PptxTextAlignment = "left" | "center" | "right" | "justify";
504
+ /** One piece of text written by an in-place edit: text, a new paragraph, or a line break. */
505
+ type PptxTextToken = {
506
+ readonly kind: "text";
507
+ readonly text: string;
508
+ } | {
509
+ readonly kind: "paragraph";
510
+ } | {
511
+ readonly kind: "break";
512
+ };
513
+ /** Result of editing a shape's text in place, in offsets of its text as `getShapeText` reads it. */
514
+ interface PptxTextEdit$1 {
515
+ /** Replaced range of the text before the edit, or null when the text did not change. */
516
+ readonly replace: {
517
+ readonly start: number;
518
+ readonly end: number;
519
+ readonly tokens: readonly PptxTextToken[];
520
+ } | null;
521
+ /** Formats applied to ranges of the text after the edit, in the order the user applied them. */
522
+ readonly formats: readonly {
523
+ readonly start: number;
524
+ readonly end: number;
525
+ readonly format: PptxTextFormat;
526
+ }[];
527
+ /** New alignment per paragraph after the edit, or null where it did not change. */
528
+ readonly aligns: readonly (PptxTextAlignment | null)[];
529
+ }
530
+ /** Typed command registry; each entry is a factory taking one options argument. */
531
+ interface PptxCommandRegistry {
532
+ /** Adds a slide after a position, with an optional title and body. */
533
+ addSlide: (options: {
534
+ after?: number;
535
+ title?: string;
536
+ body?: string;
537
+ }) => PptxCommand$1;
538
+ /** Copies a slide and places the copy right after it. */
539
+ duplicateSlide: (options: {
540
+ slide: string;
541
+ }) => PptxCommand$1;
542
+ /** Moves a slide to a position counted from 0. */
543
+ moveSlide: (options: {
544
+ slide: string;
545
+ to: number;
546
+ }) => PptxCommand$1;
547
+ /** Removes a slide. */
548
+ deleteSlide: (options: {
549
+ slide: string;
550
+ }) => PptxCommand$1;
551
+ /** Shows or hides a slide in the slide show. */
552
+ setSlideHidden: (options: {
553
+ slide: string;
554
+ hidden: boolean;
555
+ }) => PptxCommand$1;
556
+ /** Replaces a slide's speaker notes. */
557
+ setSlideNotes: (options: {
558
+ slide: string;
559
+ notes: string;
560
+ }) => PptxCommand$1;
561
+ /** Replaces a shape's text, keeping its first paragraph and run formatting. */
562
+ setShapeText: (options: {
563
+ slide: string;
564
+ shape: number;
565
+ text: string;
566
+ }) => PptxCommand$1;
567
+ /** Writes an in-place rich text edit: the changed text, then formats and alignments. */
568
+ editShapeText: (options: {
569
+ slide: string;
570
+ shape: number;
571
+ edit: PptxTextEdit$1;
572
+ }) => PptxCommand$1;
573
+ /** Replaces one exact occurrence of text inside a shape, keeping the surrounding formatting. */
574
+ replaceShapeText: (options: {
575
+ slide: string;
576
+ shape: number;
577
+ find: string;
578
+ replace: string;
579
+ occurrence?: number;
580
+ }) => PptxCommand$1;
581
+ /** Moves and resizes a shape, in EMU. */
582
+ setShapeBounds: (options: {
583
+ slide: string;
584
+ shape: number;
585
+ shapes?: readonly number[];
586
+ x?: number;
587
+ y?: number;
588
+ width?: number;
589
+ height?: number;
590
+ }) => PptxCommand$1;
591
+ /** Moves shapes by an offset in EMU, keeping their sizes. */
592
+ moveShapes: (options: {
593
+ slide: string;
594
+ shapes: readonly number[];
595
+ dx: number;
596
+ dy: number;
597
+ }) => PptxCommand$1;
598
+ /** Removes a shape. */
599
+ deleteShape: (options: {
600
+ slide: string;
601
+ shape: number;
602
+ }) => PptxCommand$1;
603
+ /** Adds a text box, in EMU. */
604
+ addTextBox: (options: {
605
+ slide: string;
606
+ text: string;
607
+ x: number;
608
+ y: number;
609
+ width: number;
610
+ height: number;
611
+ vertical?: boolean;
612
+ }) => PptxCommand$1;
613
+ /** Adds a table of the given cell texts, in EMU. */
614
+ addTable: (options: {
615
+ slide: string;
616
+ rows: readonly (readonly string[])[];
617
+ x: number;
618
+ y: number;
619
+ width: number;
620
+ height: number;
621
+ }) => PptxCommand$1;
622
+ /** Adds a picture from image bytes, in EMU. */
623
+ addPicture: (options: {
624
+ slide: string;
625
+ bytes: Uint8Array;
626
+ x: number;
627
+ y: number;
628
+ width: number;
629
+ height: number;
630
+ name?: string;
631
+ }) => PptxCommand$1;
632
+ /** Replaces the text of a table cell, counted from 0. */
633
+ setTableCellText: (options: {
634
+ slide: string;
635
+ shape: number;
636
+ row: number;
637
+ column: number;
638
+ text: string;
639
+ }) => PptxCommand$1;
640
+ /** Sets the format of all the text in shapes. */
641
+ setTextFormat: (options: {
642
+ slide: string;
643
+ shapes: readonly number[];
644
+ format: PptxTextFormat;
645
+ }) => PptxCommand$1;
646
+ /** Aligns every paragraph of shapes. */
647
+ setTextAlignment: (options: {
648
+ slide: string;
649
+ shapes: readonly number[];
650
+ align: PptxTextAlignment;
651
+ }) => PptxCommand$1;
652
+ /** Places the text of shapes at the top, middle or bottom of their boxes. */
653
+ setTextAnchor: (options: {
654
+ slide: string;
655
+ shapes: readonly number[];
656
+ anchor: "top" | "center" | "bottom";
657
+ }) => PptxCommand$1;
658
+ /** Lays the text of shapes out horizontally, in vertical columns, rotated a quarter turn either way, or stacked. */
659
+ setTextDirection: (options: {
660
+ slide: string;
661
+ shapes: readonly number[];
662
+ direction: PptxTextDirection;
663
+ }) => PptxCommand$1;
664
+ /** Sets or removes bullets of the paragraphs a range touches, or of all paragraphs. */
665
+ setParagraphBullets: (options: {
666
+ slide: string;
667
+ shapes: readonly number[];
668
+ style: PptxListStyle;
669
+ range?: PptxTextRange;
670
+ }) => PptxCommand$1;
671
+ /** Moves the paragraphs a range touches, or all paragraphs, one list level deeper or back. */
672
+ changeListLevel: (options: {
673
+ slide: string;
674
+ shapes: readonly number[];
675
+ offset: 1 | -1;
676
+ range?: PptxTextRange;
677
+ }) => PptxCommand$1;
678
+ /** Sets the line spacing of the paragraphs a range touches, or of all paragraphs. */
679
+ setLineSpacing: (options: {
680
+ slide: string;
681
+ shapes: readonly number[];
682
+ multiple: number;
683
+ range?: PptxTextRange;
684
+ }) => PptxCommand$1;
685
+ /** Adds a preset shape, in EMU. */
686
+ addShape: (options: {
687
+ slide: string;
688
+ preset: string;
689
+ x: number;
690
+ y: number;
691
+ width: number;
692
+ height: number;
693
+ text?: string;
694
+ }) => PptxCommand$1;
695
+ /** Fills shapes with a colour, or removes their fill with null. */
696
+ setShapeFill: (options: {
697
+ slide: string;
698
+ shapes: readonly number[];
699
+ color: string | null;
700
+ }) => PptxCommand$1;
701
+ /** Sets the outline of shapes: a colour and a width in points, or none with a null colour. */
702
+ setShapeOutline: (options: {
703
+ slide: string;
704
+ shapes: readonly number[];
705
+ color: string | null;
706
+ width?: number;
707
+ }) => PptxCommand$1;
708
+ /** Copies shapes on their slide, offset down and to the right. */
709
+ duplicateShapes: (options: {
710
+ slide: string;
711
+ shapes: readonly number[];
712
+ offset: number;
713
+ }) => PptxCommand$1;
714
+ /** Copies shapes from a deck, possibly another one, onto a slide, offset in EMU. */
715
+ pasteShapes: (options: {
716
+ slide: string;
717
+ source: import("@quirekit/office-kit-pptx").PresentationData;
718
+ sourceSlide: string;
719
+ shapes: readonly number[];
720
+ offset: number;
721
+ }) => PptxCommand$1;
722
+ /** Fills a slide's background with a colour. */
723
+ setSlideBackground: (options: {
724
+ slide: string;
725
+ color: string;
726
+ }) => PptxCommand$1;
727
+ /** Changes the stacking order of shapes. */
728
+ arrangeShapes: (options: {
729
+ slide: string;
730
+ shapes: readonly number[];
731
+ order: "front" | "back" | "forward" | "backward";
732
+ }) => PptxCommand$1;
733
+ /** Sets or removes the transition of slides. */
734
+ setSlideTransition: (options: {
735
+ slides: readonly string[];
736
+ transition: PptxTransition;
737
+ }) => PptxCommand$1;
738
+ /** Adds an animation effect to shapes; the second and later shapes run with the first. */
739
+ addShapeAnimation: (options: {
740
+ slide: string;
741
+ shapes: readonly number[];
742
+ animation: PptxAnimation;
743
+ }) => PptxCommand$1;
744
+ /** Removes every animation effect of a shape. */
745
+ clearShapeAnimations: (options: {
746
+ slide: string;
747
+ shape: number;
748
+ }) => PptxCommand$1;
749
+ /** Changes one animation effect by its id. */
750
+ updateAnimation: (options: {
751
+ slide: string;
752
+ id: number;
753
+ patch: PptxAnimationPatch;
754
+ }) => PptxCommand$1;
755
+ /** Removes one animation effect by its id. */
756
+ removeAnimation: (options: {
757
+ slide: string;
758
+ id: number;
759
+ }) => PptxCommand$1;
760
+ /** Moves one animation effect to a position in the slide's click order. */
761
+ moveAnimation: (options: {
762
+ slide: string;
763
+ id: number;
764
+ index: number;
765
+ }) => PptxCommand$1;
766
+ /** Aligns shapes to an edge or centre line: of the slide for one shape, of the shapes together otherwise. */
767
+ alignShapes: (options: {
768
+ slide: string;
769
+ shapes: readonly number[];
770
+ edge: PptxAlignEdge;
771
+ }) => PptxCommand$1;
772
+ /** Spaces shapes evenly along an axis: within the span they cover together, or across the slide for one shape. */
773
+ distributeShapes: (options: {
774
+ slide: string;
775
+ shapes: readonly number[];
776
+ axis: "horizontal" | "vertical";
777
+ }) => PptxCommand$1;
778
+ /** Combines shapes of one level into a group, in their stacking order. */
779
+ groupShapes: (options: {
780
+ slide: string;
781
+ shapes: readonly number[];
782
+ }) => PptxCommand$1;
783
+ /** Splits groups back into their members, which keep where they are drawn. */
784
+ ungroupShapes: (options: {
785
+ slide: string;
786
+ shapes: readonly number[];
787
+ }) => PptxCommand$1;
788
+ /** Turns shapes about their centres to an angle, or by an amount, in clockwise degrees as the slide shows them. */
789
+ rotateShapes: (options: {
790
+ slide: string;
791
+ shapes: readonly number[];
792
+ to?: number;
793
+ by?: number;
794
+ }) => PptxCommand$1;
795
+ /** Mirrors shapes about their centres. */
796
+ flipShapes: (options: {
797
+ slide: string;
798
+ shapes: readonly number[];
799
+ axis: "horizontal" | "vertical";
800
+ }) => PptxCommand$1;
801
+ /** Draws a freeform through points on the slide, in EMU: a filled outline when closed, a line when open. */
802
+ addFreeform: (options: {
803
+ slide: string;
804
+ points: readonly PptxPathPoint[];
805
+ closed: boolean;
806
+ smooth: boolean;
807
+ }) => PptxCommand$1;
808
+ /** Replaces a drawn shape's outline with edited paths in fractions of its frame; the frame grows or shrinks to the nodes. */
809
+ setShapePaths: (options: {
810
+ slide: string;
811
+ shape: number;
812
+ paths: readonly PptxEditablePath[];
813
+ }) => PptxCommand$1;
814
+ /** Inserts a chart with sample data, in EMU. */
815
+ addChart: (options: {
816
+ slide: string;
817
+ kind: PptxInsertChartKind;
818
+ x: number;
819
+ y: number;
820
+ width: number;
821
+ height: number;
822
+ data?: {
823
+ readonly categories: readonly string[];
824
+ readonly series: readonly {
825
+ readonly name: string;
826
+ readonly values: readonly number[];
827
+ }[];
828
+ };
829
+ }) => PptxCommand$1;
830
+ /** Embeds an audio or video clip, in EMU; fails for a container the file format cannot carry. */
831
+ addMedia: (options: {
832
+ slide: string;
833
+ kind: "audio" | "video";
834
+ bytes: Uint8Array;
835
+ x: number;
836
+ y: number;
837
+ width: number;
838
+ height: number;
839
+ name?: string;
840
+ }) => PptxCommand$1;
841
+ /** Places a picture an editor drew, carrying its source inside the PNG, in EMU. */
842
+ addEditablePicture: (options: {
843
+ slide: string;
844
+ png: Uint8Array;
845
+ source: import("@quirekit/media").QuireMediaEditableSource;
846
+ name: string;
847
+ x: number;
848
+ y: number;
849
+ width: number;
850
+ height: number;
851
+ }) => PptxCommand$1;
852
+ /** Replaces an editor-drawn picture with a new rendering and source; the height follows the new aspect ratio. */
853
+ setEditablePicture: (options: {
854
+ slide: string;
855
+ shape: number;
856
+ png: Uint8Array;
857
+ source: import("@quirekit/media").QuireMediaEditableSource;
858
+ aspect: number;
859
+ }) => PptxCommand$1;
860
+ /** Inserts a display equation written in LaTeX in a new text box, in EMU; fails for LaTeX outside the supported grammar. */
861
+ addEquation: (options: {
862
+ slide: string;
863
+ latex: string;
864
+ x: number;
865
+ y: number;
866
+ width: number;
867
+ height: number;
868
+ }) => PptxCommand$1;
869
+ /** Rewrites the equation of an equation box from LaTeX. */
870
+ setEquation: (options: {
871
+ slide: string;
872
+ shape: number;
873
+ latex: string;
874
+ }) => PptxCommand$1;
875
+ /** Links objects to a web or mail address that opens when clicked in the slide show, or removes the link with null. */
876
+ setShapeLink: (options: {
877
+ slide: string;
878
+ shapes: readonly number[];
879
+ url: string | null;
880
+ }) => PptxCommand$1;
881
+ /** Applies a built-in table style, by GUID. */
882
+ setTableStyle: (options: {
883
+ slide: string;
884
+ shape: number;
885
+ style: string;
886
+ }) => PptxCommand$1;
887
+ /** Turns the parts a table style emphasises on or off; parts left out keep theirs. */
888
+ setTableStyleOptions: (options: {
889
+ slide: string;
890
+ shape: number;
891
+ options: Partial<PptxTableStyleOptions>;
892
+ }) => PptxCommand$1;
893
+ /** Sets adjust values of a preset shape, such as a rounded rectangle's corner; values left out keep theirs. */
894
+ setShapeAdjustments: (options: {
895
+ slide: string;
896
+ shape: number;
897
+ values: Readonly<Record<string, number>>;
898
+ }) => PptxCommand$1;
899
+ /** Applies a layout of the deck to a slide, by name. */
900
+ setSlideLayout: (options: {
901
+ slide: string;
902
+ layout: string;
903
+ }) => PptxCommand$1;
904
+ /** Replaces a chart's categories and series values. */
905
+ setChartData: (options: {
906
+ slide: string;
907
+ shape: number;
908
+ categories: readonly string[];
909
+ series: readonly {
910
+ name: string;
911
+ values: readonly (number | null)[];
912
+ }[];
913
+ }) => PptxCommand$1;
914
+ }
915
+ /** Name of a registered command. */
916
+ type PptxCommandName = keyof PptxCommandRegistry;
917
+ /** Single-command entry: each call runs one command as one undoable edit and reports whether it applied. */
918
+ type PptxCommands = { readonly [Name in PptxCommandName]: (...args: Parameters<PptxCommandRegistry[Name]>) => boolean };
919
+ /** Chained entry: queued commands share one presentation and become one undoable edit on `run()`. */
920
+ type PptxChain = { readonly [Name in PptxCommandName]: (...args: Parameters<PptxCommandRegistry[Name]>) => PptxChain } & {
921
+ /** @returns Whether every queued command applied; when one does not, nothing is kept. */run(): boolean;
922
+ };
923
+ /** How a shape's text runs: horizontal, East Asian vertical columns, every line turned 90° or 270°, or stacked letters. */
924
+ type PptxTextDirection = "horz" | "eaVert" | "vert" | "vert270" | "wordArtVert";
925
+ //#endregion
926
+ //#region src/show/timeline/types.d.ts
927
+ /** What a behaviour points at: a whole shape, or a range of its paragraphs. */
928
+ interface PptxTimelineTarget {
929
+ /** Shape id. */
930
+ readonly shape: number;
931
+ /** First and last paragraph counted from 0, or null for the whole shape. */
932
+ readonly paragraphs: readonly [number, number] | null;
933
+ }
934
+ /** One key time of an `anim` behaviour. */
935
+ interface PptxTimelineKey {
936
+ /** Position in the behaviour's simple duration, 0–1. */
937
+ readonly time: number;
938
+ /** A number, or a formula over the shape's geometry such as `#ppt_x` or `0-#ppt_w/2`. */
939
+ readonly value: number | string;
940
+ /** Formula the value is put through, with `$` standing for it. */
941
+ readonly formula: string | null;
942
+ }
943
+ /** What one behaviour changes, as PresentationML states it. */
944
+ type PptxTimelineEffect = /** `p:set` of `style.visibility`. */{
945
+ readonly kind: "visibility";
946
+ readonly visible: boolean;
947
+ } /** `p:animEffect`: a reveal or conceal by a named filter such as `fade` or `wipe(left)`. */ | {
948
+ readonly kind: "filter";
949
+ readonly filter: string;
950
+ readonly entering: boolean;
951
+ } /** `p:animMotion` along a path in fractions of the slide, relative to where the shape is laid out. */ | {
952
+ readonly kind: "motion";
953
+ readonly path: string;
954
+ } /** `p:animScale` by a factor per axis, multiplying what the shape already shows. */ | {
955
+ readonly kind: "scale";
956
+ readonly by: readonly [number, number];
957
+ } /** `p:animRot` by degrees, added to what the shape already shows. */ | {
958
+ readonly kind: "rotate";
959
+ readonly by: number;
960
+ } /** `p:anim` or `p:set` of one attribute over key times; from/to values become two keys. */ | {
961
+ readonly kind: "anim";
962
+ readonly attribute: PptxTimelineAttribute;
963
+ readonly keys: readonly PptxTimelineKey[];
964
+ readonly discrete: boolean;
965
+ };
966
+ /** Attributes an `anim` behaviour can drive: the shape's centre, size, turn and opacity. */
967
+ type PptxTimelineAttribute = "ppt_x" | "ppt_y" | "ppt_w" | "ppt_h" | "r" | "style.opacity";
968
+ /**
969
+ * One clock between a click group and a behaviour that changes how time runs: easing, reversal, repeats or
970
+ * playing backwards. Containers that only delay their children add no clock of their own.
971
+ */
972
+ interface PptxTimeFrame {
973
+ /** Start on the clock of the frame outside it, or of the click group for the outermost one, in ms. */
974
+ readonly begin: number;
975
+ /** Simple duration in ms; Infinity for an open-ended one. */
976
+ readonly simple: number;
977
+ /** Share of the simple duration spent speeding up. */
978
+ readonly accel: number;
979
+ /** Share of the simple duration spent slowing down. */
980
+ readonly decel: number;
981
+ /** Whether each repeat plays forward and back. */
982
+ readonly autoReverse: boolean;
983
+ /** Whether it plays backwards. */
984
+ readonly reversed: boolean;
985
+ /** Times it repeats; Infinity until something ends it. */
986
+ readonly repeat: number;
987
+ }
988
+ /** A behaviour placed on the clock of its click group. */
989
+ interface PptxScheduledBehavior {
990
+ /** What it changes. */
991
+ readonly effect: PptxTimelineEffect;
992
+ /** What it points at. */
993
+ readonly target: PptxTimelineTarget;
994
+ /** Clocks from the click group down to the behaviour's own, which is last. */
995
+ readonly frames: readonly PptxTimeFrame[];
996
+ /** Milliseconds from the start of its click group to its start. */
997
+ readonly begin: number;
998
+ /** Milliseconds from the start of its click group to its end; Infinity for an open-ended one. */
999
+ readonly end: number;
1000
+ /** Whether its value stays once it ends. */
1001
+ readonly hold: boolean;
1002
+ /** Class of the effect it belongs to: `entr`, `exit`, `emph`, `path` or null. */
1003
+ readonly presetClass: string | null;
1004
+ /** Order in the document, which decides between behaviours that start together. */
1005
+ readonly order: number;
1006
+ }
1007
+ /** One click group of a slide's main sequence. */
1008
+ interface PptxTimelineStop {
1009
+ /** Whether it starts by itself as the slide opens rather than on a click. */
1010
+ readonly auto: boolean;
1011
+ /** Behaviours in start order. */
1012
+ readonly behaviors: readonly PptxScheduledBehavior[];
1013
+ /** Milliseconds until its last behaviour that ends has ended. */
1014
+ readonly length: number;
1015
+ }
1016
+ /** A slide's main sequence ready to play. */
1017
+ interface PptxTimeline {
1018
+ /** Click groups in order. */
1019
+ readonly stops: readonly PptxTimelineStop[];
1020
+ /** Targets, by `targetKey`, that start hidden because their first entrance or exit is an entrance. */
1021
+ readonly hiddenAtStart: ReadonlySet<string>;
1022
+ }
1023
+ //#endregion
1024
+ //#region src/commands/slide-show/types.d.ts
1025
+ /** Which slides a show presents. */
1026
+ type PptxShowRange = {
1027
+ readonly kind: "all";
1028
+ } | {
1029
+ readonly kind: "range";
1030
+ readonly start: number;
1031
+ readonly end: number;
1032
+ } | {
1033
+ readonly kind: "customShow";
1034
+ readonly id: number;
1035
+ };
1036
+ /** Deck-wide slide show settings as the show settings dialog edits them. */
1037
+ interface PptxShowSettings {
1038
+ /** `present` for a presenter-driven show, `kiosk` for one that runs by itself at a booth. */
1039
+ readonly mode: "present" | "kiosk";
1040
+ /** Whether the show starts over after its last slide until Esc; a kiosk show always loops. */
1041
+ readonly loop: boolean;
1042
+ /** Slides presented; range numbers count slides from 1 in deck order. */
1043
+ readonly slides: PptxShowRange;
1044
+ /** Whether slides advance by their saved timings; false advances by click only. */
1045
+ readonly useTimings: boolean;
1046
+ }
1047
+ /** A named slide sequence. */
1048
+ interface PptxCustomShow {
1049
+ /** Stable id, or undefined for a show not yet in the deck. */
1050
+ readonly id?: number | undefined;
1051
+ /** Name shown in lists. */
1052
+ readonly name: string;
1053
+ /** Slide part names in show order; a slide may repeat. */
1054
+ readonly slides: readonly string[];
1055
+ }
1056
+ /** One pen or highlighter stroke kept as a drawn shape. */
1057
+ interface PptxInkShape {
1058
+ /** Points the stroke passes, in EMU on the slide. */
1059
+ readonly points: readonly {
1060
+ readonly x: number;
1061
+ readonly y: number;
1062
+ }[];
1063
+ /** Stroke colour as `#RRGGBB`. */
1064
+ readonly color: string;
1065
+ /** Stroke width in EMU. */
1066
+ readonly width: number;
1067
+ /** Opacity from 0 to 1; highlighters are translucent. */
1068
+ readonly opacity: number;
1069
+ }
1070
+ /** Ink of one slide. */
1071
+ interface PptxSlideInk {
1072
+ /** Slide part name. */
1073
+ readonly slide: string;
1074
+ /** Strokes in drawing order. */
1075
+ readonly strokes: readonly PptxInkShape[];
1076
+ }
1077
+ /** Rehearsed time of one slide. */
1078
+ interface PptxSlideTiming {
1079
+ /** Slide part name. */
1080
+ readonly slide: string;
1081
+ /** Milliseconds the slide stays on screen before the show advances. */
1082
+ readonly ms: number;
1083
+ }
1084
+ /** Summary properties of a deck as the properties dialog edits them. */
1085
+ interface PptxDocumentProperties {
1086
+ /** Title. */
1087
+ readonly title: string;
1088
+ /** Subject. */
1089
+ readonly subject: string;
1090
+ /** Author. */
1091
+ readonly creator: string;
1092
+ /** Keywords. */
1093
+ readonly keywords: string;
1094
+ /** Comments. */
1095
+ readonly description: string;
1096
+ }
1097
+ /** How a clip plays, as the media tools edit it; fields left out stay as they are. */
1098
+ interface PptxMediaPlayback {
1099
+ /** Starts with the slide instead of waiting for a click. */
1100
+ readonly autoplay?: boolean;
1101
+ /** Milliseconds after the slide starts before automatic playback. */
1102
+ readonly delayMs?: number;
1103
+ /** Plays again from the beginning until the slide moves on. */
1104
+ readonly loop?: boolean;
1105
+ /** Volume from 0 to 1. */
1106
+ readonly volume?: number;
1107
+ /** Plays without sound. */
1108
+ readonly muted?: boolean;
1109
+ /** Video only: fills the screen while it plays. */
1110
+ readonly fullScreen?: boolean;
1111
+ /** Hides the clip while it is not playing; an audio clip is hidden for the whole show. */
1112
+ readonly hideWhenStopped?: boolean;
1113
+ /** Slides the clip keeps playing across, 1 to 999; 999 plays to the end of the show. */
1114
+ readonly slideCount?: number;
1115
+ /** Returns to the beginning once it has played. */
1116
+ readonly rewindAfterPlaying?: boolean;
1117
+ /** Milliseconds cut from the start and the end of the clip. */
1118
+ readonly trim?: {
1119
+ readonly startMs: number;
1120
+ readonly endMs: number;
1121
+ };
1122
+ /** Milliseconds the sound fades in at the start and out at the end. */
1123
+ readonly fade?: {
1124
+ readonly inMs: number;
1125
+ readonly outMs: number;
1126
+ };
1127
+ }
1128
+ declare module "../../command/types" {
1129
+ interface PptxCommandRegistry {
1130
+ /** Writes the deck's slide show settings: show type, loop, slide range and how slides advance. */
1131
+ setShowSettings: (options: {
1132
+ settings: PptxShowSettings;
1133
+ }) => PptxCommand;
1134
+ /** Replaces the deck's custom shows; a show left out is deleted, and a deleted show the settings presented falls back to all slides. */
1135
+ setCustomShows: (options: {
1136
+ shows: readonly PptxCustomShow[];
1137
+ }) => PptxCommand;
1138
+ /** Keeps slide show ink as freeform shapes on their slides. */
1139
+ addInkShapes: (options: {
1140
+ slides: readonly PptxSlideInk[];
1141
+ }) => PptxCommand;
1142
+ /** Writes rehearsed timings as each slide's automatic advance and makes the show use them. */
1143
+ setSlideTimings: (options: {
1144
+ timings: readonly PptxSlideTiming[];
1145
+ }) => PptxCommand;
1146
+ /** Changes how an audio or video clip plays: start, delay, loop, volume, full screen, hiding, slides it plays across, rewinding, trim and fades. */
1147
+ setMediaPlayback: (options: {
1148
+ slide: string;
1149
+ shape: number;
1150
+ playback: PptxMediaPlayback;
1151
+ }) => PptxCommand;
1152
+ /** Removes media and other parts nothing in the deck uses any more. */
1153
+ compactMedia: (options: Record<string, never>) => PptxCommand;
1154
+ /** Writes the deck's title, subject, author, keywords and comments; empty text removes a field. */
1155
+ setDocumentProperties: (options: {
1156
+ properties: Partial<PptxDocumentProperties>;
1157
+ }) => PptxCommand;
1158
+ }
1159
+ } //# sourceMappingURL=types.d.ts.map
1160
+ //#endregion
1161
+ //#region src/show/types.d.ts
1162
+ /** How a show runs, read from the deck's show settings. */
1163
+ interface PptxSlideShowSettings {
1164
+ /** Whether the show runs by itself at a booth: clicks do not advance and it loops. */
1165
+ readonly kiosk: boolean;
1166
+ /** Whether the show starts over after its last slide until Esc. */
1167
+ readonly loop: boolean;
1168
+ /** Whether slides advance by their saved timings. */
1169
+ readonly useTimings: boolean;
1170
+ }
1171
+ /** Slides a show presented at one time, kept while a custom show takes over; opaque to callers. */
1172
+ interface PptxShowSequence {
1173
+ /** Marks the sequence as the deck's own. */
1174
+ readonly kind: "sequence";
1175
+ }
1176
+ /** Visible slides of one deck version, rendered on demand for a slide show. */
1177
+ interface PptxSlideShowDeck {
1178
+ /** Number of slides the show presents. */
1179
+ readonly count: number;
1180
+ /** Slide part names in show order, matching the editor's slide identity; a custom show may repeat one. */
1181
+ readonly parts: readonly string[];
1182
+ /** Slide numbers counted from 1 in deck order, per show position. */
1183
+ readonly numbers: readonly number[];
1184
+ /** Slide size in EMU. */
1185
+ readonly size: {
1186
+ readonly width: number;
1187
+ readonly height: number;
1188
+ };
1189
+ /** How the show runs. */
1190
+ readonly settings: PptxSlideShowSettings;
1191
+ /**
1192
+ * @param index - Show position counted from 0.
1193
+ * @returns The slide's speaker notes.
1194
+ */
1195
+ notes(index: number): string;
1196
+ /**
1197
+ * Replaces a slide's notes in the show's own copy, so views of the running show read the new text.
1198
+ * @param index - Show position.
1199
+ * @param text - New notes.
1200
+ */
1201
+ writeNotes(index: number, text: string): void;
1202
+ /**
1203
+ * Brings in the slide after the one at a position when that slide is hidden, as presentation apps' H key does.
1204
+ * @param index - Show position.
1205
+ * @returns Show position of the hidden slide, or -1 when the next slide is not hidden.
1206
+ */
1207
+ nextHidden(index: number): number;
1208
+ /**
1209
+ * @param index - Show position counted from 0.
1210
+ * @returns The audio and video clips on the slide.
1211
+ */
1212
+ media(index: number): readonly PptxShowMedia[];
1213
+ /**
1214
+ * @param index - Show position counted from 0.
1215
+ * @returns The sound the slide's transition plays, an order to stop the sound before, or null.
1216
+ */
1217
+ sound(index: number): PptxShowSound | null;
1218
+ /**
1219
+ * Brings a slide into the show by its deck number, as a link to a hidden slide does: it joins the
1220
+ * show where it stands in the deck, which moves the positions after it on by one.
1221
+ * @param number - Slide number counted from 1 in deck order, hidden slides included.
1222
+ * @returns Its show position, or -1 when the deck has no such slide.
1223
+ */
1224
+ reveal(number: number): number;
1225
+ /**
1226
+ * Presents other slides from now on, as a link to a custom show does.
1227
+ * @param slides - Slides to present.
1228
+ * @returns What the show presented before, to restore when the custom show returns.
1229
+ */
1230
+ switchTo(slides: PptxShowRange): PptxShowSequence;
1231
+ /** @param sequence - Slides the show presented before a custom show took over. */
1232
+ restore(sequence: PptxShowSequence): void;
1233
+ /**
1234
+ * @param index - Show position counted from 0.
1235
+ * @returns The slide as a self-contained SVG document string.
1236
+ */
1237
+ render(index: number): string;
1238
+ /**
1239
+ * @param index - Show position counted from 0.
1240
+ * @returns How the slide comes on screen and when the show leaves it.
1241
+ */
1242
+ transition(index: number): PptxSlideShowTransition;
1243
+ /**
1244
+ * @param index - Show position counted from 0.
1245
+ * @returns The slide's animation effects in click order, with repeats and rewinds applied.
1246
+ */
1247
+ animations(index: number): readonly SlideAnimationStep[];
1248
+ /**
1249
+ * @param index - Show position counted from 0.
1250
+ * @returns Effects played by clicks on trigger shapes, per shape.
1251
+ */
1252
+ triggers(index: number): PptxShowEffects["triggers"];
1253
+ /**
1254
+ * @param index - Show position counted from 0.
1255
+ * @returns The slide's main sequence read from its time tree, which the show plays behaviour by behaviour.
1256
+ */
1257
+ timeline?(index: number): PptxTimeline;
1258
+ }
1259
+ /** Transition of a slide in the show, with how the show advances from it. */
1260
+ interface PptxSlideShowTransition extends PptxTransitionPlayback {
1261
+ /** Whether a click advances. */
1262
+ readonly advanceOnClick: boolean;
1263
+ /** Milliseconds after which the show advances by itself, or undefined. */
1264
+ readonly advanceAfterMs?: number | undefined;
1265
+ }
1266
+ /** What the pointer does in a show. */
1267
+ type PptxShowTool = "pointer" | "laser" | "spotlight" | "magnifier" | "pen" | "highlighter" | "eraser";
1268
+ /** Colour a blanked show covers the slide with. */
1269
+ type PptxShowBlank = "black" | "white";
1270
+ /** What a show leaves behind for the deck once it ends. */
1271
+ interface PptxSlideShowResult {
1272
+ /** Ink drawn on each slide, in EMU; empty when nothing was drawn or all of it was erased. */
1273
+ readonly ink: readonly PptxSlideInk[];
1274
+ /** Rehearsed time per slide, or null when the show was not rehearsed. */
1275
+ readonly timings: readonly PptxSlideTiming[] | null;
1276
+ }
1277
+ /** Clock of a rehearsed show. */
1278
+ interface PptxRehearsal {
1279
+ /** Whether the clock is paused. */
1280
+ readonly paused: boolean;
1281
+ /** @returns Milliseconds the current slide has been on screen. */
1282
+ slideMs(): number;
1283
+ /** @returns Milliseconds the whole rehearsal has taken. */
1284
+ totalMs(): number;
1285
+ /** Pauses or resumes the clock. */
1286
+ toggle(): void;
1287
+ /** Restarts the current slide's time. */
1288
+ repeat(): void;
1289
+ }
1290
+ /** A running slide show. */
1291
+ interface PptxSlideShow {
1292
+ /** Show position counted from 0. */
1293
+ readonly index: number;
1294
+ /** Slides presented. */
1295
+ readonly deck: PptxSlideShowDeck;
1296
+ /** Full-screen element; controls placed inside it stay visible in full screen. */
1297
+ readonly surface: HTMLElement;
1298
+ /** What the pointer does. */
1299
+ readonly tool: PptxShowTool;
1300
+ /** Colour of the ink tool in hand, or of the pen. */
1301
+ readonly inkColor: string;
1302
+ /** Colour covering the slide, or null when it shows. */
1303
+ readonly blank: PptxShowBlank | null;
1304
+ /** Whether any slide carries ink. */
1305
+ readonly hasInk: boolean;
1306
+ /** Click stops of the current slide's animations: how many have played and how many there are; the next click plays one while some remain. */
1307
+ readonly animation: {
1308
+ readonly played: number;
1309
+ readonly total: number;
1310
+ };
1311
+ /** Clock of a rehearsed show, or null. */
1312
+ readonly rehearsal: PptxRehearsal | null;
1313
+ /** Whether the show stays in the browser window, as the reading view does. */
1314
+ readonly windowed: boolean;
1315
+ /** Milliseconds since the show started. */
1316
+ elapsedMs(): number;
1317
+ /** Resolves once the show has ended, by the viewer or by `close()`, with its ink and timings. */
1318
+ readonly closed: Promise<PptxSlideShowResult>;
1319
+ /** @param index - Show position to present; clamped to the deck. */
1320
+ go(index: number): void;
1321
+ /** Plays the next animation step or moves to the next slide. */
1322
+ next(): void;
1323
+ /** Steps one animation back or returns to the previous slide. */
1324
+ previous(): void;
1325
+ /** @param tool - What the pointer does from now on. */
1326
+ setTool(tool: PptxShowTool): void;
1327
+ /** @param color - Colour of the ink tool in hand as `#RRGGBB`; without one in hand the pen takes it. */
1328
+ setInkColor(color: string): void;
1329
+ /** @param scope - Erases the ink of the current slide, or of every slide. */
1330
+ clearInk(scope?: "slide" | "all"): void;
1331
+ /** @param blank - Colour to cover the slide with, or null to show it. */
1332
+ setBlank(blank: PptxShowBlank | null): void;
1333
+ /**
1334
+ * Runs a show key pressed elsewhere, such as in the presenter view.
1335
+ * @param event - Key press.
1336
+ * @returns Whether it was a show key.
1337
+ */
1338
+ handleKey(event: Pick<KeyboardEvent, "key" | "ctrlKey" | "metaKey" | "altKey">): boolean;
1339
+ /** @param listener - Called after the slide, tool or blank changes. @returns Detaches it. */
1340
+ subscribe(listener: () => void): () => void;
1341
+ /**
1342
+ * Keeps the show covering the page when the browser leaves full screen by itself within the next second, as
1343
+ * browsers do when the page opens another window; any later exit ends the show.
1344
+ */
1345
+ expectWindowed(): void;
1346
+ /** Whether slides that advance by their timings wait until resumed. */
1347
+ readonly paused: boolean;
1348
+ /** @param paused - Holds automatic advancing, or resumes it; a rehearsal clock pauses with it. */
1349
+ setPaused(paused: boolean): void;
1350
+ /** Whether the ink drawn in the show is shown. */
1351
+ readonly inkVisible: boolean;
1352
+ /** @param visible - Shows or hides the ink without erasing it. */
1353
+ setInkVisible(visible: boolean): void;
1354
+ /** Returns to the slide shown before the current one. */
1355
+ goLastViewed(): void;
1356
+ /** Ends the show and removes its surface. */
1357
+ close(): void;
1358
+ }
1359
+ /** A transition as the player runs it. */
1360
+ interface PptxTransitionPlayback {
1361
+ /** Effect name; effects the player does not draw fade. */
1362
+ readonly effect: string;
1363
+ /** Side sliding effects enter from. */
1364
+ readonly from?: PptxTransitionSide | undefined;
1365
+ /** Whether split and zoom open out (`out`) or close in (`in`). */
1366
+ readonly inOut?: "in" | "out" | undefined;
1367
+ /** Axis of a split. */
1368
+ readonly orientation?: "horz" | "vert" | undefined;
1369
+ /**
1370
+ * Direction token as the file writes it, for effects whose direction is not a side: `horz` or
1371
+ * `vert` for blinds, checker, comb, random bars, doors and window, and a corner (`lu`, `ru`,
1372
+ * `ld`, `rd`) for strips. Side tokens name the way the slide moves, so `l` enters from the right.
1373
+ */
1374
+ readonly direction?: string | undefined;
1375
+ /** Spokes of a wheel; four when left out. */
1376
+ readonly spokes?: number | undefined;
1377
+ /** Whether a fade or cut passes through black. */
1378
+ readonly thruBlack?: boolean | undefined;
1379
+ /** Length in milliseconds. */
1380
+ readonly durationMs: number;
1381
+ }
1382
+ /** An audio or video clip on a slide of the show. */
1383
+ interface PptxShowMedia {
1384
+ /** Shape id of the clip's picture. */
1385
+ readonly shape: number;
1386
+ /** Audio or video; online clips play as video. */
1387
+ readonly kind: "audio" | "video";
1388
+ /** Embedded bytes with their media type, or the address of a linked clip. */
1389
+ readonly source: {
1390
+ readonly bytes: Uint8Array;
1391
+ readonly type: string;
1392
+ } | {
1393
+ readonly url: string;
1394
+ };
1395
+ /** How the clip plays, or null for the file defaults: on click, once. */
1396
+ readonly playback: MediaPlayback | null;
1397
+ /** Unrotated frame of the picture in fractions of the slide. */
1398
+ readonly box: {
1399
+ readonly x: number;
1400
+ readonly y: number;
1401
+ readonly width: number;
1402
+ readonly height: number;
1403
+ };
1404
+ }
1405
+ /** Sound of a slide transition. */
1406
+ type PptxShowSound = {
1407
+ readonly kind: "stop";
1408
+ } | {
1409
+ readonly kind: "play";
1410
+ readonly bytes: Uint8Array;
1411
+ readonly loop: boolean;
1412
+ readonly name: string;
1413
+ };
1414
+ /** A slide's effects as the show plays them. */
1415
+ interface PptxShowEffects {
1416
+ /** Effects of the slide's own click sequence. */
1417
+ readonly main: readonly SlideAnimationStep[];
1418
+ /** Effects each trigger shape's clicks play, one click group after another. */
1419
+ readonly triggers: readonly {
1420
+ readonly shape: number;
1421
+ readonly steps: readonly SlideAnimationStep[];
1422
+ }[];
1423
+ }
1424
+ //#endregion
1425
+ //#region src/types.d.ts
1426
+ /** Optional file opened when the workspace first mounts. */
1427
+ interface PptxEditorInitialDocument {
1428
+ /** File name shown in the title bar and used for downloads. */
1429
+ readonly name: string;
1430
+ /**
1431
+ * Loads the initial deck, falling back to a new presentation when unavailable.
1432
+ * @param signal - Aborted when another file opens or the editor is destroyed.
1433
+ * @returns Deck bytes, or undefined to start with a new presentation.
1434
+ */
1435
+ readonly read: (signal: AbortSignal) => Promise<Uint8Array | undefined>;
1436
+ }
1437
+ /** How a request sent to the assistant runs. */
1438
+ interface PptxAskOptions {
1439
+ /** Whether it creates the deck, so its edits apply at once instead of waiting for review. */
1440
+ readonly create?: boolean | undefined;
1441
+ }
1442
+ /** One version the host is asked to store. */
1443
+ interface PptxEditorSaveRequest {
1444
+ /** File name the session knows the deck by. */
1445
+ readonly name: string;
1446
+ /** Complete deck as `.pptx` bytes. */
1447
+ readonly bytes: Uint8Array;
1448
+ }
1449
+ /** Host configuration for one mounted PPTX editor. */
1450
+ interface PptxEditorOptions {
1451
+ /** License key supplied by the host. Null selects evaluation mode. */
1452
+ readonly licenseKey?: string | null;
1453
+ /** Initial file. Without a file the editor opens a new presentation. */
1454
+ readonly initialDocument?: PptxEditorInitialDocument;
1455
+ /**
1456
+ * Stores a version on the host. Without it, saving downloads a copy and counts as saved.
1457
+ * @param request - Name and bytes of the version.
1458
+ * @returns Whether the host stored it; false keeps the deck marked as changed so the user can retry.
1459
+ */
1460
+ readonly save?: (request: PptxEditorSaveRequest) => Promise<boolean>;
1461
+ /** Saves shortly after each edit through `save`; ignored without it. */
1462
+ readonly autoSave?: boolean;
1463
+ /** @param session - Session of the open deck, or undefined after destruction. */
1464
+ readonly onSessionChange?: (session: PptxEditorSession | undefined) => void;
1465
+ /** Side panels, such as the assistant from `@quirekit/pptx-editor/ai`. */
1466
+ readonly panels?: readonly PptxEditorPanel[] | undefined;
1467
+ }
1468
+ /** Where an observed change came from: the user, a command call, the AI assistant, undo or redo, or another file. */
1469
+ type PptxChangeSource = "user" | "command" | "agent" | "history" | "file";
1470
+ /**
1471
+ * Where a panel is shown: beside the slide, widened, or over the main area with the slide previewed beside it, still
1472
+ * editable.
1473
+ */
1474
+ type PptxEditorPanelLayout = "side" | "wide" | "page";
1475
+ /** What a side panel plugin receives when it mounts. */
1476
+ interface PptxEditorPanelContext {
1477
+ /** Session of the open deck. */
1478
+ readonly session: PptxEditorSession;
1479
+ /** Document the editor is mounted in. */
1480
+ readonly ownerDocument: Document;
1481
+ /** @param part - Slide part name. @returns The editor's drawing of the slide, from the cache the slide list and stage share. */
1482
+ readonly renderSlide?: (part: string) => string;
1483
+ /**
1484
+ * @param part - Slide part name.
1485
+ * @param width - Picture width in pixels.
1486
+ * @returns The slide drawn as the show draws it, as PNG bytes.
1487
+ */
1488
+ readonly pictureSlide?: (part: string, width: number) => Promise<Uint8Array>;
1489
+ /** Closes the panel. */
1490
+ close(): void;
1491
+ /** @param layout - Layout to show the panel in, one of the panel's `layouts`; the editor reports it back with `layout`. */
1492
+ setLayout(layout: PptxEditorPanelLayout): void;
1493
+ }
1494
+ /** Mounted content of a side panel. */
1495
+ interface PptxEditorPanelMount {
1496
+ /** Element placed in the side panel. */
1497
+ readonly element: HTMLElement;
1498
+ /**
1499
+ * Sends a request to an assistant panel as if the person typed it.
1500
+ * @param text - Request text.
1501
+ * @param options - How the request runs.
1502
+ * @returns Whether it was sent or queued.
1503
+ */
1504
+ ask?(text: string, options?: PptxAskOptions): Promise<boolean>;
1505
+ /** @param layout - Layout the editor now shows the panel in; it returns to the side when the panel closes. */
1506
+ layout?(layout: PptxEditorPanelLayout): void;
1507
+ /** Releases the content. */
1508
+ destroy(): void;
1509
+ }
1510
+ /** A side panel beside the slide, such as the AI assistant. */
1511
+ interface PptxEditorPanel {
1512
+ /** Stable identity. */
1513
+ readonly id: string;
1514
+ /** Button and panel name. */
1515
+ readonly label: string;
1516
+ /** Icon of the panel's rail button, named by the label in its tooltip; a panel icon when left out. */
1517
+ readonly icon?: string | undefined;
1518
+ /** Open the panel when the editor mounts. */
1519
+ readonly defaultOpen?: boolean | undefined;
1520
+ /** Layouts the panel can be shown in; default the side only. */
1521
+ readonly layouts?: readonly PptxEditorPanelLayout[] | undefined;
1522
+ /** Whether the panel is the deck's assistant, which views of the editor can send requests to, such as confirming a storyline. */
1523
+ readonly assistant?: boolean | undefined;
1524
+ /** @param context - Session and panel controls. @returns Mounted content, created on first open and kept while the editor lives. */
1525
+ mount(context: PptxEditorPanelContext): PptxEditorPanelMount;
1526
+ }
1527
+ /** Event the session reports to its host. */
1528
+ type PptxEditorEvent = {
1529
+ /** The deck kept an edit, an undo or redo, or another file was opened. */readonly type: "change"; /** Origin of the change. */
1530
+ readonly source: PptxChangeSource;
1531
+ } | {
1532
+ /** The deck gained unsaved changes, or they were saved. */readonly type: "dirty"; /** Whether changes are waiting to be saved. */
1533
+ readonly dirty: boolean;
1534
+ };
1535
+ /** Shape the user has selected, named so that it stays valid while slides move. */
1536
+ interface PptxShapeReference {
1537
+ /** Slide part name, such as `/ppt/slides/slide3.xml`. */
1538
+ readonly slide: string;
1539
+ /** Slide position counted from 0 when the selection was read. */
1540
+ readonly slideIndex: number;
1541
+ /** Shape id inside the slide. */
1542
+ readonly shape: number;
1543
+ /** Shape name, for people. */
1544
+ readonly name: string;
1545
+ }
1546
+ /** Open deck as the host and its first-party features see it. */
1547
+ interface PptxEditorSession {
1548
+ /** Resolves once the first deck is open and shown. */
1549
+ readonly ready: Promise<void>;
1550
+ /** @returns File name the session knows the deck by. */
1551
+ name(): string;
1552
+ /** @returns Whether the deck has changes the host has not stored. */
1553
+ isDirty(): boolean;
1554
+ /** @returns Shapes the user has selected. */
1555
+ selection(): readonly PptxShapeReference[];
1556
+ /** @returns The deck as it is now; it does not save or mark it saved. */
1557
+ snapshot(): Promise<Uint8Array>;
1558
+ /**
1559
+ * Opens another deck in place of the current one.
1560
+ * @param name - File name.
1561
+ * @param bytes - Deck bytes.
1562
+ * @returns Whether the deck could be read and opened.
1563
+ */
1564
+ open(name: string, bytes: Uint8Array): Promise<boolean>;
1565
+ /** Replaces the deck with a new presentation of one title slide. */
1566
+ createDocument(): Promise<void>;
1567
+ /** @param name - File name to keep the deck under; `.pptx` is added when missing. */
1568
+ rename(name: string): void;
1569
+ /** @returns Whether a step was undone. */
1570
+ undo(): Promise<boolean>;
1571
+ /** @returns Whether a step was redone. */
1572
+ redo(): Promise<boolean>;
1573
+ /** @returns Whether the current version is stored afterwards. */
1574
+ save(): Promise<boolean>;
1575
+ /** Typed commands; each call is one undoable edit. */
1576
+ readonly commands: PptxCommands;
1577
+ /** @returns A chain whose commands run as one undoable edit. */
1578
+ chain(): PptxChain;
1579
+ /**
1580
+ * Presents the deck from a slide, by default the one holding the selection.
1581
+ * @param start - Slide position counted from 0.
1582
+ * @returns The running show.
1583
+ */
1584
+ present(start?: number): Promise<PptxSlideShow>;
1585
+ /** @param listener - Receives every event. @returns Detaches it. */
1586
+ subscribe(listener: (event: PptxEditorEvent) => void): () => void;
1587
+ }
1588
+ //#endregion
1589
+ export { PptxCommandName as _, PptxEditorOptions as a, PptxShapeKind as b, PptxEditorPanelLayout as c, PptxEditorSession as d, PptxShapeReference as f, PptxCommandDescriptor as g, PptxCommandAgentContext as h, PptxEditorInitialDocument as i, PptxEditorPanelMount as l, PptxChain as m, PptxChangeSource as n, PptxEditorPanel as o, PptxSlideShow as p, PptxEditorEvent as r, PptxEditorPanelContext as s, PptxAskOptions as t, PptxEditorSaveRequest as u, PptxCommandRegistry as v, PptxLayoutChecker as x, PptxCommands as y };