pptx-ts 3.7.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -269
- package/dist/autopage-odPz7zZO.js +536 -0
- package/dist/autopage-odPz7zZO.js.map +1 -0
- package/dist/binary-string-CKVAYI3M.js +24 -0
- package/dist/binary-string-CKVAYI3M.js.map +1 -0
- package/dist/body-insets-Dw_BeWD_.js +54 -0
- package/dist/body-insets-Dw_BeWD_.js.map +1 -0
- package/dist/browser.d.ts +29 -9
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +41 -14
- package/dist/browser.js.map +1 -1
- package/dist/clip-Bl01BPcN.d.ts +67 -0
- package/dist/clip-Bl01BPcN.d.ts.map +1 -0
- package/dist/diagnostics-D8ot4Ei7.d.ts +244 -0
- package/dist/diagnostics-D8ot4Ei7.d.ts.map +1 -0
- package/dist/embedded-fonts-DarT9aoa.d.ts +20 -0
- package/dist/embedded-fonts-DarT9aoa.d.ts.map +1 -0
- package/dist/entry-compose-DCnvBZz2.d.ts +1046 -0
- package/dist/entry-compose-DCnvBZz2.d.ts.map +1 -0
- package/dist/{enums-CvRYniUA.d.ts → enums-BUKTUB6V.d.ts} +21 -13
- package/dist/{enums-CvRYniUA.d.ts.map → enums-BUKTUB6V.d.ts.map} +1 -1
- package/dist/{errors-Bvln0H-7.js → errors-C4oENPcu.js} +92 -2
- package/dist/errors-C4oENPcu.js.map +1 -0
- package/dist/families.d.ts +260 -0
- package/dist/families.d.ts.map +1 -0
- package/dist/families.js +57 -0
- package/dist/families.js.map +1 -0
- package/dist/{fit-BKs0zxMI.js → fit-Cb7naFj6.js} +249 -167
- package/dist/fit-Cb7naFj6.js.map +1 -0
- package/dist/font-metrics-v5fn7s7e.d.ts +613 -0
- package/dist/font-metrics-v5fn7s7e.d.ts.map +1 -0
- package/dist/grid-DikTjFey.js +187 -0
- package/dist/grid-DikTjFey.js.map +1 -0
- package/dist/{html-dom-B0I0QSbU.js → html-dom-Iuog2wdK.js} +121 -91
- package/dist/html-dom-Iuog2wdK.js.map +1 -0
- package/dist/html.d.ts +6 -6
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +7 -6
- package/dist/html.js.map +1 -1
- package/dist/image-size-CvN2iCA4.js +1611 -0
- package/dist/image-size-CvN2iCA4.js.map +1 -0
- package/dist/index.d.ts +24 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +40 -31
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +40 -48
- package/dist/inspect.js.map +1 -1
- package/dist/math.d.ts +7 -5
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +16 -7
- package/dist/math.js.map +1 -1
- package/dist/measure.d.ts +12 -225
- package/dist/measure.d.ts.map +1 -1
- package/dist/measure.js +3 -3
- package/dist/node.d.ts +22 -8
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +27 -7
- package/dist/node.js.map +1 -1
- package/dist/notes-Dh12JAbn.js +3264 -0
- package/dist/notes-Dh12JAbn.js.map +1 -0
- package/dist/options-internal-WqgMf720.js +43 -0
- package/dist/options-internal-WqgMf720.js.map +1 -0
- package/dist/{package-CaOLXSNi.d.ts → package-J49Ck6S2.d.ts} +27 -12
- package/dist/package-J49Ck6S2.d.ts.map +1 -0
- package/dist/playbtn-CUqQdoDf.js +22 -0
- package/dist/playbtn-CUqQdoDf.js.map +1 -0
- package/dist/{slide-ZqAdVvHV.d.ts → pres-C6qgOFAa.d.ts} +1021 -1423
- package/dist/pres-C6qgOFAa.d.ts.map +1 -0
- package/dist/{presentation-DrJtj3-C.js → presentation-DGYlAWhl.js} +3208 -2727
- package/dist/presentation-DGYlAWhl.js.map +1 -0
- package/dist/{presentation-types-CDjScsev.d.ts → presentation-types-8jLQHI4M.d.ts} +1070 -683
- package/dist/presentation-types-8jLQHI4M.d.ts.map +1 -0
- package/dist/read.d.ts +9 -9
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +4 -4
- package/dist/script.d.ts +80 -66
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +2399 -1139
- package/dist/script.js.map +1 -1
- package/dist/{shapes-BemroU-z.js → shapes-re0KyQk_.js} +2807 -1609
- package/dist/shapes-re0KyQk_.js.map +1 -0
- package/dist/slide-Dx2ZeVZ6.d.ts +1256 -0
- package/dist/slide-Dx2ZeVZ6.d.ts.map +1 -0
- package/dist/slide-size-BalTjFuv.js +88 -0
- package/dist/slide-size-BalTjFuv.js.map +1 -0
- package/dist/{units-internal-Dg95w_YD.js → table-cell-margins-EVg0EwxT.js} +235 -273
- package/dist/table-cell-margins-EVg0EwxT.js.map +1 -0
- package/dist/table-dom-BTDP3lEP.js +21 -0
- package/dist/table-dom-BTDP3lEP.js.map +1 -0
- package/dist/text-KnLOtEEu.js +3980 -0
- package/dist/text-KnLOtEEu.js.map +1 -0
- package/dist/text-anchor-CrYXAfUu.js +176 -0
- package/dist/text-anchor-CrYXAfUu.js.map +1 -0
- package/dist/transition-speed-kUEWDWTx.js +14 -0
- package/dist/transition-speed-kUEWDWTx.js.map +1 -0
- package/dist/units-internal-XJlf-hOl.js +649 -0
- package/dist/units-internal-XJlf-hOl.js.map +1 -0
- package/dist/zip-C0leZZMj.d.ts +67 -0
- package/dist/zip-C0leZZMj.d.ts.map +1 -0
- package/dist/zip-CKd8ihcf.js +177 -0
- package/dist/zip-CKd8ihcf.js.map +1 -0
- package/dist/zip.d.ts +3 -68
- package/dist/zip.js +3 -163
- package/dist/zoom-cX9sllpH.js +8865 -0
- package/dist/zoom-cX9sllpH.js.map +1 -0
- package/package.json +106 -19
- package/skills/ts-pptx-upstream/SKILL.md +58 -57
- package/dist/autopage-DkjYZUFD.js +0 -423
- package/dist/autopage-DkjYZUFD.js.map +0 -1
- package/dist/diagnostics-DfBdDHre.d.ts +0 -829
- package/dist/diagnostics-DfBdDHre.d.ts.map +0 -1
- package/dist/errors-Bvln0H-7.js.map +0 -1
- package/dist/errors-PflMPWBn.d.ts +0 -182
- package/dist/errors-PflMPWBn.d.ts.map +0 -1
- package/dist/fit-BKs0zxMI.js.map +0 -1
- package/dist/html-dom-B0I0QSbU.js.map +0 -1
- package/dist/namespaces-BVnNu7sg.js +0 -666
- package/dist/namespaces-BVnNu7sg.js.map +0 -1
- package/dist/notes-CJFJaG6M.js +0 -1724
- package/dist/notes-CJFJaG6M.js.map +0 -1
- package/dist/package-CaOLXSNi.d.ts.map +0 -1
- package/dist/pres-BcBR3CSM.d.ts +0 -202
- package/dist/pres-BcBR3CSM.d.ts.map +0 -1
- package/dist/presentation-DrJtj3-C.js.map +0 -1
- package/dist/presentation-types-CDjScsev.d.ts.map +0 -1
- package/dist/shapes-BemroU-z.js.map +0 -1
- package/dist/slide-ZqAdVvHV.d.ts.map +0 -1
- package/dist/text-B8SLEaZx.js +0 -11327
- package/dist/text-B8SLEaZx.js.map +0 -1
- package/dist/units-1kRzYShk.js +0 -231
- package/dist/units-1kRzYShk.js.map +0 -1
- package/dist/units-internal-Dg95w_YD.js.map +0 -1
- package/dist/zip.d.ts.map +0 -1
- package/dist/zip.js.map +0 -1
|
@@ -0,0 +1,1256 @@
|
|
|
1
|
+
import { d as SHAPE_NAME, h as TableStyle, i as CHART_NAME, m as SlideObjectType } from "./enums-BUKTUB6V.js";
|
|
2
|
+
import { Ct as CommonObjectDescriptor, Dt as CommentProps, Et as PlaceholderProps, Gt as ImageBaseProps, Ht as TextPropsOptions, I as FillOption, It as TextBaseProps, Kt as ImageProps, N as BorderProps, O as PositionProps, P as ConnectorProps, Q as ChartOpts, R as HyperlinkProps, Rt as TextFitShrinkProps, S as HexColor, T as Margin, Tt as ObjectNameProps, Vt as TextProps, Yt as OleObjectProps, Z as ChartMulti, _ as DataOrPathRequiredProps, bn as TextHorzOverflowType, f as BackgroundOption, fn as LightRigDirection, g as DataOrPathProps, h as Coord, hn as PresetMaterialType, kt as NotesProps, m as Color, nn as ShapeProps, on as BevelPresetType, pn as LightRigType, qt as MediaProps, vn as TEXT_AUTONUM_SCHEMES, wt as ObjectLockProps, x as HAlign, xt as OptsChartData, yn as TRANSITION_TYPES } from "./pres-C6qgOFAa.js";
|
|
3
|
+
//#region src/types/table.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A `<table>` element, from whatever DOM implementation the caller has.
|
|
6
|
+
*
|
|
7
|
+
* Deliberately *not* `lib.dom`'s `Element`. `lib.dom`'s types are built for a browser, and a
|
|
8
|
+
* non-browser DOM's element type — happy-dom's, jsdom's — declares its own members and does
|
|
9
|
+
* not satisfy them, so demanding `Element` would reject from TypeScript exactly the
|
|
10
|
+
* implementations `pptx-ts/html` exists to accept. Requiring the three members the conversion
|
|
11
|
+
* actually calls keeps a mistyped argument an error while letting every real DOM through.
|
|
12
|
+
*/
|
|
13
|
+
interface TableToSlidesElement {
|
|
14
|
+
getAttribute: (name: string) => string | null;
|
|
15
|
+
querySelector: (selectors: string) => unknown;
|
|
16
|
+
querySelectorAll: (selectors: string) => unknown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The one thing `tableToSlides` asks a document for. Structural for the same reason
|
|
20
|
+
* {@link TableToSlidesElement} is.
|
|
21
|
+
*/
|
|
22
|
+
interface TableToSlidesDocument {
|
|
23
|
+
getElementById: (elementId: string) => TableToSlidesElement | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Options for `tableToSlides`. The conversion computes its own column widths, always pages, and
|
|
27
|
+
* repeats every `<thead>` row, so `colW`, `autoPage` and `autoPageHeaderRows` are not options here.
|
|
28
|
+
*/
|
|
29
|
+
interface TableToSlidesProps extends Omit<TableProps, 'autoPage' | 'colW' | 'autoPageHeaderRows'> {
|
|
30
|
+
/**
|
|
31
|
+
* Add an image to slide(s) created during autopaging
|
|
32
|
+
* - `image` prop requires either `path` or `data`
|
|
33
|
+
* - see `DataOrPathProps` for details on `image` props
|
|
34
|
+
* - see `PositionProps` for details on `options` props
|
|
35
|
+
*/
|
|
36
|
+
addImage?: {
|
|
37
|
+
image: DataOrPathProps;
|
|
38
|
+
options: PositionProps;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Add a shape to slide(s) created during autopaging
|
|
42
|
+
*/
|
|
43
|
+
addShape?: {
|
|
44
|
+
shapeName: SHAPE_NAME;
|
|
45
|
+
options: ShapeProps;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Add a table to slide(s) created during autopaging
|
|
49
|
+
*/
|
|
50
|
+
addTable?: {
|
|
51
|
+
rows: TableRow[];
|
|
52
|
+
options: TableProps;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Add a text object to slide(s) created during autopaging
|
|
56
|
+
*/
|
|
57
|
+
addText?: {
|
|
58
|
+
text: TextProps[];
|
|
59
|
+
options: TextPropsOptions;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Auto-paging character weight
|
|
63
|
+
* - adjusts how many characters are used before lines wrap
|
|
64
|
+
* - range: -1.0 to 1.0
|
|
65
|
+
* @default 0.0
|
|
66
|
+
* @example 0.5 // lines are longer (increases the number of characters that can fit on a given line)
|
|
67
|
+
*/
|
|
68
|
+
autoPageCharWeight?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Auto-paging line weight
|
|
71
|
+
* - adjusts how many lines are used before slides wrap
|
|
72
|
+
* - range: -1.0 to 1.0
|
|
73
|
+
* @default 0.0
|
|
74
|
+
* @example 0.5 // each line is priced taller, so fewer lines fit on a slide before the table pages
|
|
75
|
+
*/
|
|
76
|
+
autoPageLineWeight?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Whether to repeat head row(s) on new tables created by autopaging
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
autoPageRepeatHeader?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The `y` location to use on subsequent slides created by autopaging
|
|
84
|
+
* @default (top margin of Slide)
|
|
85
|
+
*/
|
|
86
|
+
autoPageSlideStartY?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Document to resolve a table *id* against.
|
|
89
|
+
* - only consulted when the table is identified by string id; passing the element itself
|
|
90
|
+
* needs no document, since one is reached through the element's `ownerDocument`
|
|
91
|
+
* - defaults to the global `document`, which is what a browser caller gets
|
|
92
|
+
* - supply this to convert a table outside a browser (any DOM implementation will do)
|
|
93
|
+
*/
|
|
94
|
+
document?: TableToSlidesDocument;
|
|
95
|
+
/**
|
|
96
|
+
* Title of the slide master to use for the auto-paged slides (the `title` passed to
|
|
97
|
+
* `defineSlideMaster`). Matches the `masterTitle` option of `addSlide`.
|
|
98
|
+
* - define a master slide to have your auto-paged slides carry a corporate design, etc.
|
|
99
|
+
*/
|
|
100
|
+
masterTitle?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Slide margin
|
|
103
|
+
* - this margin will be across all slides created by auto-paging
|
|
104
|
+
*/
|
|
105
|
+
slideMargin?: Margin;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A table cell's corner-to-corner rules (`a:tcPr/a:lnTlToBr` / `a:lnBlToTr`) — the
|
|
109
|
+
* "Diagonal Down Border" / "Diagonal Up Border" of PowerPoint's border gallery.
|
|
110
|
+
*
|
|
111
|
+
* Deliberately its own object rather than two more entries on {@link TableCellProps.border}'s
|
|
112
|
+
* tuple: widening that tuple to six would break every existing caller for a construct almost
|
|
113
|
+
* no deck uses, and the two diagonals are not edges — they do not participate in the
|
|
114
|
+
* perimeter, and they are not inherited by a merged region's covered cells.
|
|
115
|
+
*
|
|
116
|
+
* @example diagonal: { tlToBr: { type:'solid', color:'C00000', width:1 } } // strike a cell out
|
|
117
|
+
* @example diagonal: { tlToBr: { type:'solid' }, blToTr: { type:'solid' } } // an X across the cell
|
|
118
|
+
*/
|
|
119
|
+
interface TableCellDiagonals {
|
|
120
|
+
/** Top-left to bottom-right (`╲`, `a:lnTlToBr`). */
|
|
121
|
+
tlToBr?: BorderProps;
|
|
122
|
+
/** Bottom-left to top-right (`╱`, `a:lnBlToTr`). */
|
|
123
|
+
blToTr?: BorderProps;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A cell's 3-D bevel (`a:tcPr/a:cell3D`).
|
|
127
|
+
*
|
|
128
|
+
* A minimal surface over `CT_Cell3D`, which is a required `a:bevel` plus an optional
|
|
129
|
+
* `a:lightRig`. PowerPoint's table UI exposes no control for it — it reaches a deck through a
|
|
130
|
+
* theme's table style or through another producer — so this exists to author and reproduce
|
|
131
|
+
* one, not as a general 3-D model.
|
|
132
|
+
*/
|
|
133
|
+
interface TableCell3DProps {
|
|
134
|
+
/**
|
|
135
|
+
* The bevel's preset shape (`a:bevel/@prst`).
|
|
136
|
+
* @default 'circle'
|
|
137
|
+
*/
|
|
138
|
+
preset?: BevelPresetType;
|
|
139
|
+
/**
|
|
140
|
+
* Bevel width in points (`a:bevel/@w`; the attribute is EMU).
|
|
141
|
+
* @default 6 // 76200 EMU
|
|
142
|
+
*/
|
|
143
|
+
width?: number;
|
|
144
|
+
/**
|
|
145
|
+
* Bevel height in points (`a:bevel/@h`; the attribute is EMU).
|
|
146
|
+
* @default 6 // 76200 EMU
|
|
147
|
+
*/
|
|
148
|
+
height?: number;
|
|
149
|
+
/**
|
|
150
|
+
* Surface material (`a:cell3D/@prstMaterial`), which decides how the bevel takes light.
|
|
151
|
+
* @default 'plastic'
|
|
152
|
+
*/
|
|
153
|
+
material?: PresetMaterialType;
|
|
154
|
+
/**
|
|
155
|
+
* Scene lighting (`a:cell3D/a:lightRig`). Both fields are required by the schema, so
|
|
156
|
+
* either give both or omit the whole object and let the renderer light the bevel.
|
|
157
|
+
* @example lightRig: { rig: 'threePt', dir: 't' }
|
|
158
|
+
*/
|
|
159
|
+
lightRig?: {
|
|
160
|
+
rig: LightRigType;
|
|
161
|
+
dir: LightRigDirection;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
interface TableCellProps extends TextBaseProps {
|
|
165
|
+
/**
|
|
166
|
+
* Strikethrough, as {@link TextPropsOptions.strike} takes it on a text run. On a cell it applies
|
|
167
|
+
* to every run that states none; on a run inside a cell's `text`, to that run.
|
|
168
|
+
*/
|
|
169
|
+
strike?: NonNullable<TextPropsOptions['strike']>;
|
|
170
|
+
/**
|
|
171
|
+
* Baseline shift, as {@link TextPropsOptions.baseline} takes it on a text run: above zero raises
|
|
172
|
+
* the text, below zero lowers it. On a cell it applies to every run that states none.
|
|
173
|
+
*/
|
|
174
|
+
baseline?: NonNullable<TextPropsOptions['baseline']>;
|
|
175
|
+
/** Outline level of the paragraph a run starts, as {@link TextPropsOptions.indentLevel}. */
|
|
176
|
+
indentLevel?: NonNullable<TextPropsOptions['indentLevel']>;
|
|
177
|
+
/** Line spacing in points, as {@link TextPropsOptions.lineSpacing}. */
|
|
178
|
+
lineSpacing?: NonNullable<TextPropsOptions['lineSpacing']>;
|
|
179
|
+
/** Line spacing as a multiple of single spacing, as {@link TextPropsOptions.lineSpacingMultiple}. */
|
|
180
|
+
lineSpacingMultiple?: NonNullable<TextPropsOptions['lineSpacingMultiple']>;
|
|
181
|
+
/** Space before the paragraph in points, as {@link TextPropsOptions.paraSpaceBefore}. */
|
|
182
|
+
paraSpaceBefore?: NonNullable<TextPropsOptions['paraSpaceBefore']>;
|
|
183
|
+
/** Space after the paragraph in points, as {@link TextPropsOptions.paraSpaceAfter}. */
|
|
184
|
+
paraSpaceAfter?: NonNullable<TextPropsOptions['paraSpaceAfter']>;
|
|
185
|
+
/**
|
|
186
|
+
* Auto-paging character weight
|
|
187
|
+
* - adjusts how many characters are used before lines wrap
|
|
188
|
+
* - range: -1.0 to 1.0
|
|
189
|
+
* @default 0.0
|
|
190
|
+
* @example 0.5 // lines are longer (increases the number of characters that can fit on a given line)
|
|
191
|
+
*/
|
|
192
|
+
autoPageCharWeight?: number;
|
|
193
|
+
/**
|
|
194
|
+
* The cell's four edge borders (`a:tcPr/a:lnT|lnR|lnB|lnL`).
|
|
195
|
+
* - a single `BorderProps` is broadcast to all four sides
|
|
196
|
+
* - an array is read in **TRBL** order (`[top, right, bottom, left]`)
|
|
197
|
+
*
|
|
198
|
+
* Overrides the table-level {@link TableProps.border} default entirely — the two do not
|
|
199
|
+
* merge per side. A `null` entry is a hole: that edge is left out of `a:tcPr` and keeps
|
|
200
|
+
* inheriting from the table style, while `{ type: 'none' }` writes an explicit no-line
|
|
201
|
+
* that overrides it. For the two corner-to-corner rules see {@link diagonal}; for the
|
|
202
|
+
* table's outside edge see {@link TableProps.outerBorder}.
|
|
203
|
+
*/
|
|
204
|
+
border?: BorderProps | [BorderProps | null, BorderProps | null, BorderProps | null, BorderProps | null];
|
|
205
|
+
/**
|
|
206
|
+
* The cell's corner-to-corner rules — PowerPoint's "Diagonal Down/Up Border".
|
|
207
|
+
*
|
|
208
|
+
* Kept off {@link border}'s tuple on purpose: see {@link TableCellDiagonals}. A diagonal
|
|
209
|
+
* on a merged cell is one stroke across the whole region, so only the span origin carries
|
|
210
|
+
* it — the covered cells inherit the origin's *edges* but never its diagonals.
|
|
211
|
+
* @example diagonal: { tlToBr: { type:'solid', color:'C00000' } } // strike the cell out
|
|
212
|
+
*/
|
|
213
|
+
diagonal?: TableCellDiagonals;
|
|
214
|
+
/**
|
|
215
|
+
* Centre the cell's whole text **block** horizontally within the cell
|
|
216
|
+
* (`a:tcPr/@anchorCtr`), independent of each paragraph's own `align`.
|
|
217
|
+
*
|
|
218
|
+
* The two do different things and compose: `align` decides where each line sits inside
|
|
219
|
+
* the text block, `anchorCtr` decides where that block sits inside the cell. With
|
|
220
|
+
* left-aligned text in a wide cell, `anchorCtr: true` centres the ragged-right column of
|
|
221
|
+
* lines as a unit while keeping their left edges flush with each other.
|
|
222
|
+
*
|
|
223
|
+
* `false` is the schema default, so it emits nothing — the same reasoning as
|
|
224
|
+
* `horzOverflow: 'clip'`.
|
|
225
|
+
* @default false
|
|
226
|
+
*/
|
|
227
|
+
anchorCtr?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* A 3-D bevel on the cell (`a:tcPr/a:cell3D`). Niche: PowerPoint's table UI has no
|
|
230
|
+
* control for it, so it reaches a deck from a theme or another producer, and this exists
|
|
231
|
+
* to author and reproduce one. See {@link TableCell3DProps}.
|
|
232
|
+
*/
|
|
233
|
+
cell3D?: TableCell3DProps;
|
|
234
|
+
/**
|
|
235
|
+
* Cell colspan
|
|
236
|
+
*/
|
|
237
|
+
colspan?: number;
|
|
238
|
+
/**
|
|
239
|
+
* Cell fill — a solid color, or a picture that fills the cell (`a:blipFill` in
|
|
240
|
+
* the cell's `a:tcPr`, stretched to the cell box). A picture fill embeds the
|
|
241
|
+
* image as slide media; identical sources are embedded once. Raster only —
|
|
242
|
+
* an SVG source warns and is ignored, matching shape fills. A bare {@link Color} is
|
|
243
|
+
* shorthand for a solid fill ({@link FillOption}).
|
|
244
|
+
* @example 'FF0000' // hex color (red), shorthand for { color:'FF0000' }
|
|
245
|
+
* @example { color:'FF0000' } // hex color (red)
|
|
246
|
+
* @example { color:'0088CC', transparency:50 } // hex color, 50% transparent
|
|
247
|
+
* @example { color:SchemeColor.accent1 } // theme color Accent1
|
|
248
|
+
* @example { type:'image', image:{ path:'logo.png' } } // picture fill
|
|
249
|
+
* @example { image:{ data:'image/png;base64,…' } } // picture fill, `type` inferred
|
|
250
|
+
*/
|
|
251
|
+
fill?: FillOption;
|
|
252
|
+
/**
|
|
253
|
+
* What happens to a **single glyph** wider than the cell's text width (`a:tcPr/@horzOverflow`).
|
|
254
|
+
* - `'clip'` (PowerPoint's default) cuts the glyph off at the cell edge
|
|
255
|
+
* - `'overflow'` lets it draw past the edge, over whatever is beside it
|
|
256
|
+
*
|
|
257
|
+
* This is **not** a text-wrap switch, despite the name. Lines always wrap to the column
|
|
258
|
+
* width; only an individual character too wide to fit on a line by itself is affected, so
|
|
259
|
+
* it matters for oversized display type, wide CJK/emoji glyphs, and icon fonts in a narrow
|
|
260
|
+
* column. PowerPoint has no per-cell no-wrap at all — `wrap="none"` on a cell's `a:bodyPr`
|
|
261
|
+
* is discarded on the next save (probe:
|
|
262
|
+
* `test/read/fixtures/authoring/probe-table-cell-wrap.ps1`).
|
|
263
|
+
* `'clip'` is written as asked but is the schema default, so PowerPoint drops the
|
|
264
|
+
* attribute again the first time it saves the deck — the visible result is the same
|
|
265
|
+
* either way, and leaving this unset emits nothing at all.
|
|
266
|
+
* @default (unset — PowerPoint clips)
|
|
267
|
+
* @example 'overflow' // a 60pt glyph in a 0.5in column draws whole instead of being cut
|
|
268
|
+
*/
|
|
269
|
+
horzOverflow?: TextHorzOverflowType;
|
|
270
|
+
hyperlink?: HyperlinkProps;
|
|
271
|
+
/**
|
|
272
|
+
* Cell margin (inches), in `[top, right, bottom, left]` order
|
|
273
|
+
* @default [0.05, 0.1, 0.05, 0.1]
|
|
274
|
+
*/
|
|
275
|
+
margin?: Margin;
|
|
276
|
+
/**
|
|
277
|
+
* Cell rowspan
|
|
278
|
+
*/
|
|
279
|
+
rowspan?: number;
|
|
280
|
+
/**
|
|
281
|
+
* Shrink cell text to fit when it would overflow the cell's fixed height.
|
|
282
|
+
* - `'shrink'` measures the wrapped text and bakes a **reduced literal font size**
|
|
283
|
+
* onto the cell's runs so the text fits — PowerPoint does not support text
|
|
284
|
+
* autofit (`normAutofit`) inside table cells, so there is no font-scale flag to
|
|
285
|
+
* set; the size itself is lowered, which both PowerPoint and LibreOffice render
|
|
286
|
+
* identically with no edit/resize.
|
|
287
|
+
* - Requires the cell font registered via {@link TsPptx.registerFontMetrics}. With no
|
|
288
|
+
* metrics registered at all it is a silent no-op (the cell keeps its authored size); once
|
|
289
|
+
* any face is registered, an unregistered face is estimated and warns once per write.
|
|
290
|
+
* - Only triggers when the cell's row has a **fixed** height that the text exceeds.
|
|
291
|
+
* With auto-height rows (no `rowH`/`h`), the row simply grows, so nothing shrinks.
|
|
292
|
+
* - Only `'shrink'` is acted on for cells. `'resize'` and the object form are ignored
|
|
293
|
+
* here: a table row already auto-grows to fit its tallest cell (the cell equivalent
|
|
294
|
+
* of `spAutoFit`), so there is nothing to bake. (The wider union is shared with
|
|
295
|
+
* {@link TextPropsOptions.fit} so table-level `fit` can cascade to cells.)
|
|
296
|
+
* @example 'shrink' // measured when the cell font is registered; else no-op
|
|
297
|
+
*/
|
|
298
|
+
fit?: 'none' | 'shrink' | 'resize' | TextFitShrinkProps;
|
|
299
|
+
}
|
|
300
|
+
interface TableProps extends PositionProps, TextBaseProps, ObjectNameProps {
|
|
301
|
+
/**
|
|
302
|
+
* Name of a table/content placeholder defined on the slide layout/master to bind this table to.
|
|
303
|
+
* - when it matches a layout/master placeholder, the table's `<p:graphicFrame>` emits that
|
|
304
|
+
* placeholder's `<p:ph>` (idx/type) so PowerPoint treats the table as filling the placeholder
|
|
305
|
+
* (e.g. a "Title and Content" content placeholder)
|
|
306
|
+
* - the table also inherits the placeholder's position/size for any of x/y/w/h left unset
|
|
307
|
+
* @example 'body' // bind to the layout placeholder named 'body'
|
|
308
|
+
*/
|
|
309
|
+
placeholder?: string;
|
|
310
|
+
/**
|
|
311
|
+
* Whether to enable auto-paging
|
|
312
|
+
* - auto-paging creates new slides as content overflows a slide
|
|
313
|
+
* @default false
|
|
314
|
+
*/
|
|
315
|
+
autoPage?: boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Auto-paging character weight
|
|
318
|
+
* - adjusts how many characters are used before lines wrap
|
|
319
|
+
* - range: -1.0 to 1.0
|
|
320
|
+
* @default 0.0
|
|
321
|
+
* @example 0.5 // lines are longer (increases the number of characters that can fit on a given line)
|
|
322
|
+
*/
|
|
323
|
+
autoPageCharWeight?: number;
|
|
324
|
+
/**
|
|
325
|
+
* Auto-paging line weight
|
|
326
|
+
* - adjusts how many lines are used before slides wrap
|
|
327
|
+
* - range: -1.0 to 1.0
|
|
328
|
+
* @default 0.0
|
|
329
|
+
* @example 0.5 // each line is priced taller, so fewer lines fit on a slide before the table pages
|
|
330
|
+
*/
|
|
331
|
+
autoPageLineWeight?: number;
|
|
332
|
+
/**
|
|
333
|
+
* Whether table header row(s) should be repeated on each new slide creating by autoPage.
|
|
334
|
+
* Use `autoPageHeaderRows` to designate how many rows comprise the table header (1+).
|
|
335
|
+
* @default false
|
|
336
|
+
*/
|
|
337
|
+
autoPageRepeatHeader?: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Number of rows that comprise table headers
|
|
340
|
+
* - required when `autoPageRepeatHeader` is set to true.
|
|
341
|
+
* - a whole number from 1 to the table's own row count; anything else is reported under
|
|
342
|
+
* `table/invalid-header-row-count` and falls back to `1`
|
|
343
|
+
* @example 2 - repeats the first two table rows on each new slide created
|
|
344
|
+
* @default 1
|
|
345
|
+
*/
|
|
346
|
+
autoPageHeaderRows?: number;
|
|
347
|
+
/**
|
|
348
|
+
* The `y` location to use on subsequent slides created by autopaging
|
|
349
|
+
* @default (top margin of Slide)
|
|
350
|
+
*/
|
|
351
|
+
autoPageSlideStartY?: number;
|
|
352
|
+
/**
|
|
353
|
+
* Slide margins (inches) this table is laid out against, overriding the master's.
|
|
354
|
+
*
|
|
355
|
+
* Steers the default table width, `fitColumns: 'shrink'`, and every page the auto-pager
|
|
356
|
+
* creates. It was declared on {@link TableToSlidesProps} only, while the pager read it on
|
|
357
|
+
* both paths — so from `addTable` it worked at run time and the type rejected it, and the
|
|
358
|
+
* table definer ignored it either way, which made "does my table respect `slideMargin`"
|
|
359
|
+
* depend on whether `autoPage` was on.
|
|
360
|
+
*/
|
|
361
|
+
slideMargin?: Margin;
|
|
362
|
+
/**
|
|
363
|
+
* Whether populated placeholders on the source slide (e.g. a title set via
|
|
364
|
+
* `addText(text, { placeholder })`) are copied onto each overflow slide created by autoPage.
|
|
365
|
+
* - new slides otherwise inherit only the layout's empty placeholders, so a title set on the
|
|
366
|
+
* first slide would not appear on continuation slides.
|
|
367
|
+
* @default false
|
|
368
|
+
*/
|
|
369
|
+
autoPagePlaceholder?: boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Default border for **every cell** in the table — not the table's outer perimeter.
|
|
372
|
+
*
|
|
373
|
+
* A single `BorderProps` is broadcast to all four sides of each cell; an array is read
|
|
374
|
+
* in TRBL order and applied to each cell's own four sides. So
|
|
375
|
+
* `border: [{type:'solid'}, {type:'none'}, {type:'solid'}, {type:'none'}]` gives *every*
|
|
376
|
+
* cell a top and bottom rule — a full set of horizontal grid lines, not a rule at the
|
|
377
|
+
* top and bottom of the table. A cell's own `options.border` overrides this entirely.
|
|
378
|
+
*
|
|
379
|
+
* A `null` entry is a hole — that edge inherits from the table style — where
|
|
380
|
+
* `{ type: 'none' }` writes an explicit no-line that overrides it. Authoring nothing at
|
|
381
|
+
* all depends on {@link tableStyle}: a styled table leaves every edge absent so the style
|
|
382
|
+
* paints its grid, and a table with no style takes four no-fill sides, which is what keeps
|
|
383
|
+
* it clear of PowerPoint's no-style black hairline grid.
|
|
384
|
+
*
|
|
385
|
+
* For the perimeter, use {@link outerBorder}, which applies only to the cells on the
|
|
386
|
+
* table's outside edge. The two compose: `border` draws the interior grid and
|
|
387
|
+
* `outerBorder` overrides the edges it reaches.
|
|
388
|
+
* @example border: { type:'solid', color:'D9D9D9', width:0.5 } // full grid
|
|
389
|
+
* @example border: [{type:'solid'}, {type:'none'}, {type:'solid'}, {type:'none'}] // horizontal rules only
|
|
390
|
+
*/
|
|
391
|
+
border?: BorderProps | [BorderProps | null, BorderProps | null, BorderProps | null, BorderProps | null];
|
|
392
|
+
/**
|
|
393
|
+
* Border for the table's outer perimeter only — the top edge of the first row, the
|
|
394
|
+
* bottom edge of the last row, the left edge of the first column and the right edge of
|
|
395
|
+
* the last column.
|
|
396
|
+
*
|
|
397
|
+
* A single `BorderProps` is used for all four perimeter sides; an array is read in TRBL
|
|
398
|
+
* order, so `outerBorder: [box, box, box, box]` boxes the table and
|
|
399
|
+
* `outerBorder: [rule, undefined, rule, undefined]` rules only above and below it.
|
|
400
|
+
* An `undefined`/omitted entry leaves that side to whatever {@link border} (or the cell's
|
|
401
|
+
* own `options.border`) already put there.
|
|
402
|
+
*
|
|
403
|
+
* Applied **after** every other border source, so it wins on the sides it touches and
|
|
404
|
+
* leaves the interior alone — the "outline the table, no interior grid" case is
|
|
405
|
+
* `outerBorder` with no `border` at all. Merged cells are handled: a span's covered cells
|
|
406
|
+
* inherit the origin's borders, so a colspan straddling the last column still gets the
|
|
407
|
+
* right-hand rule.
|
|
408
|
+
* @example outerBorder: { type:'solid', color:'1A2B3C', width:1 } // box the table
|
|
409
|
+
* @example outerBorder: [{type:'solid'}, undefined, {type:'solid'}, undefined] // rules above and below
|
|
410
|
+
*/
|
|
411
|
+
outerBorder?: BorderProps | [BorderProps?, BorderProps?, BorderProps?, BorderProps?];
|
|
412
|
+
/**
|
|
413
|
+
* Width of table columns (inches)
|
|
414
|
+
* - single value is applied to every column equally based upon `w`
|
|
415
|
+
* - array of values in applied to each column in order
|
|
416
|
+
* @default columns of equal width based upon `w`
|
|
417
|
+
*/
|
|
418
|
+
colW?: number | number[];
|
|
419
|
+
/**
|
|
420
|
+
* Shrink columns proportionally so a too-wide table fits the slide.
|
|
421
|
+
* - `'shrink'`: if the total column width exceeds the space available between
|
|
422
|
+
* the table's `x` and the right slide margin, scale every column down by the
|
|
423
|
+
* same factor so the whole table fits. Columns that already fit are untouched.
|
|
424
|
+
* - applies to an explicit `colW` array (the common "too many columns" case) and
|
|
425
|
+
* to a `w` wider than the slide; never grows columns and never enforces a
|
|
426
|
+
* minimum width, so a very high column count can still become thin.
|
|
427
|
+
* - opt-in: explicit widths are otherwise emitted as-is and may run off the slide.
|
|
428
|
+
* @default undefined (no scaling)
|
|
429
|
+
*/
|
|
430
|
+
fitColumns?: 'shrink';
|
|
431
|
+
/**
|
|
432
|
+
* Table-level text-fit policy, cascaded to every cell that does not set its own
|
|
433
|
+
* {@link TableCellProps.fit}.
|
|
434
|
+
* - `'shrink'`: each cell whose row has a **fixed** height that its wrapped text
|
|
435
|
+
* would exceed gets a reduced literal font size baked onto its runs so the text
|
|
436
|
+
* fits (see {@link TableCellProps.fit} for the full semantics and the font-metrics
|
|
437
|
+
* requirement). Cells that set their own `fit` win over this table default.
|
|
438
|
+
* - `'none'` / `'resize'` / the object form are accepted for parity with
|
|
439
|
+
* {@link TextPropsOptions.fit} but only `'shrink'` is acted on for table cells.
|
|
440
|
+
* @default undefined (cells keep their authored size)
|
|
441
|
+
* @example 'shrink'
|
|
442
|
+
*/
|
|
443
|
+
fit?: 'none' | 'shrink' | 'resize' | TextFitShrinkProps;
|
|
444
|
+
/**
|
|
445
|
+
* Mark the first row as a header row.
|
|
446
|
+
* Emits `firstRow="1"` on `<a:tblPr>`, activating the first-row style region of
|
|
447
|
+
* the table style and satisfying the PowerPoint accessibility checker's "table header" rule.
|
|
448
|
+
* @default false
|
|
449
|
+
*/
|
|
450
|
+
hasHeader?: boolean;
|
|
451
|
+
/**
|
|
452
|
+
* Mark the last row as a footer row.
|
|
453
|
+
* Emits `lastRow="1"` on `<a:tblPr>`, activating the last-row style region.
|
|
454
|
+
* Requires `tableStyle` to have a visible effect.
|
|
455
|
+
* @default false
|
|
456
|
+
*/
|
|
457
|
+
hasFooter?: boolean;
|
|
458
|
+
/**
|
|
459
|
+
* Enable alternating row (band) shading.
|
|
460
|
+
* Emits `bandRow="1"` on `<a:tblPr>`, activating band1H/band2H style regions.
|
|
461
|
+
* Requires `tableStyle` to have a visible effect.
|
|
462
|
+
* @default false
|
|
463
|
+
*/
|
|
464
|
+
hasBandedRows?: boolean;
|
|
465
|
+
/**
|
|
466
|
+
* Enable alternating column (band) shading.
|
|
467
|
+
* Emits `bandCol="1"` on `<a:tblPr>`, activating band1V/band2V style regions.
|
|
468
|
+
* Requires `tableStyle` to have a visible effect.
|
|
469
|
+
* @default false
|
|
470
|
+
*/
|
|
471
|
+
hasBandedColumns?: boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Apply special styling to the first column.
|
|
474
|
+
* Emits `firstCol="1"` on `<a:tblPr>`, activating the firstCol style region.
|
|
475
|
+
* Requires `tableStyle` to have a visible effect.
|
|
476
|
+
* @default false
|
|
477
|
+
*/
|
|
478
|
+
hasFirstColumn?: boolean;
|
|
479
|
+
/**
|
|
480
|
+
* Apply special styling to the last column.
|
|
481
|
+
* Emits `lastCol="1"` on `<a:tblPr>`, activating the lastCol style region.
|
|
482
|
+
* Requires `tableStyle` to have a visible effect.
|
|
483
|
+
* @default false
|
|
484
|
+
*/
|
|
485
|
+
hasLastColumn?: boolean;
|
|
486
|
+
/**
|
|
487
|
+
* Lay the table out right-to-left.
|
|
488
|
+
* Emits `rtl="1"` on `<a:tblPr>`, which mirrors the column order so the first
|
|
489
|
+
* column renders on the right — the correct layout for RTL scripts (Arabic, Hebrew).
|
|
490
|
+
* This controls only the table/column direction; per-cell text direction is set
|
|
491
|
+
* with each cell's `rtlMode` option.
|
|
492
|
+
* @default false
|
|
493
|
+
*/
|
|
494
|
+
rtl?: boolean;
|
|
495
|
+
/**
|
|
496
|
+
* Table style to apply: a built-in style as a `TableStyle` member, or any other style GUID in
|
|
497
|
+
* braces, such as the id a table read back from a deck names.
|
|
498
|
+
* Emits `<a:tableStyleId>` inside `<a:tblPr>` with that GUID.
|
|
499
|
+
* Style flags (`hasHeader`, `hasFooter`, `hasBandedRows`, etc.) select which
|
|
500
|
+
* regions of the chosen style are activated; they have no visible effect without
|
|
501
|
+
* a `tableStyle` set.
|
|
502
|
+
*
|
|
503
|
+
* **Only a built-in GUID renders.** PowerPoint resolves `<a:tableStyleId>` against
|
|
504
|
+
* its own table-style gallery and never reads a style definition out of the package,
|
|
505
|
+
* so a GUID it does not recognise leaves the table with PowerPoint's no-style look —
|
|
506
|
+
* a black hairline grid. For brand colours use direct formatting instead:
|
|
507
|
+
* `headerRow`, `columns[i]`, the table-level {@link border} / {@link fill}, or per-cell
|
|
508
|
+
* options. See `docs/tables.md` → "Apply a built-in table style".
|
|
509
|
+
*
|
|
510
|
+
* @example tableStyle: TableStyle.MEDIUM_STYLE_2_ACCENT_1 // import { TableStyle } from 'pptx-ts'
|
|
511
|
+
*/
|
|
512
|
+
tableStyle?: TableStyle | `{${string}}`;
|
|
513
|
+
/**
|
|
514
|
+
* Inline styling for the header (first) row, applied as direct per-cell formatting.
|
|
515
|
+
*
|
|
516
|
+
* This is how a header is styled distinctly from the body: each property is merged
|
|
517
|
+
* onto every cell of row 0 (`fill`, `color`, `bold`, `align`, `border`, etc.).
|
|
518
|
+
*
|
|
519
|
+
* Precedence (highest wins), matching how PowerPoint resolves styling — direct cell
|
|
520
|
+
* formatting overrides a table-style region:
|
|
521
|
+
* 1. explicit per-cell `options` on a row-0 cell
|
|
522
|
+
* 2. this `headerRow`
|
|
523
|
+
* 3. the `firstRow` region of a built-in `tableStyle`
|
|
524
|
+
* 4. the library's per-cell defaults
|
|
525
|
+
*
|
|
526
|
+
* Setting `headerRow` also implies `hasHeader: true` (emits `firstRow="1"` for the
|
|
527
|
+
* accessibility "table header" marker) unless `hasHeader` is explicitly set to `false`.
|
|
528
|
+
* @example headerRow: { fill: { color:'1A2B3C' }, color:'FFFFFF', bold:true, align:'center' }
|
|
529
|
+
*/
|
|
530
|
+
headerRow?: TableCellProps;
|
|
531
|
+
/**
|
|
532
|
+
* Per-column default cell styling, applied as direct per-cell formatting.
|
|
533
|
+
*
|
|
534
|
+
* `columns[i]` is merged onto every cell that starts in column `i` (`fill`, `color`,
|
|
535
|
+
* `bold`, `align`, `valign`, `border`, `margin`, …), so a wide **colored** matrix —
|
|
536
|
+
* per-column fills, maturity-gradient headers — does not require hand-writing a fill
|
|
537
|
+
* onto every cell. Entries may be sparse (`columns[2]` alone styles only column 2);
|
|
538
|
+
* an `undefined`/omitted entry leaves that column untouched. The whole option is
|
|
539
|
+
* optional and degrades cleanly to today's text-on-white when not given.
|
|
540
|
+
*
|
|
541
|
+
* Precedence (highest wins), matching how PowerPoint resolves styling — direct cell
|
|
542
|
+
* formatting overrides a table-style region:
|
|
543
|
+
* 1. explicit per-cell `options`
|
|
544
|
+
* 2. `headerRow` (row 0 only)
|
|
545
|
+
* 3. this `columns[colIdx]`
|
|
546
|
+
* 4. a built-in `tableStyle` / the library's per-cell defaults
|
|
547
|
+
*
|
|
548
|
+
* The merge is property-level, so a header cell keeps `headerRow`'s typography **and**
|
|
549
|
+
* takes its column's `fill` when they set different properties. For a graduated header
|
|
550
|
+
* band, put shared header typography (bold/white/centered, **no fill**) in `headerRow`
|
|
551
|
+
* and let each `columns[i].fill` supply that column's fill.
|
|
552
|
+
*
|
|
553
|
+
* Column index is the grid column a cell starts in, counting each cell's `colspan`
|
|
554
|
+
* (default 1) and the `rowspan`s carried down from earlier rows, so merged cells map to
|
|
555
|
+
* the correct column.
|
|
556
|
+
*
|
|
557
|
+
* There is deliberately no built-in "group bracket" annotation. Label a span of columns
|
|
558
|
+
* by composing existing primitives: `addShape('rightBrace', …)` (or `'bracePair'`) plus
|
|
559
|
+
* `addText`, positioned from the table's `x` and `colW` (a span's `x`/`w` is the running
|
|
560
|
+
* sum of the preceding/covered column widths).
|
|
561
|
+
*
|
|
562
|
+
* @example columns: [{}, { fill: { color:'E8F0FE' } }, { fill: { color:'C6DAFC' } }] // per-column solid fills
|
|
563
|
+
* @example // gradient header: shared typography on headerRow, graduated fills per column
|
|
564
|
+
* headerRow: { color:'FFFFFF', bold:true, align:'center' },
|
|
565
|
+
* columns: [{}, { fill:{color:'BBD3FB'} }, { fill:{color:'89AEF6'} }, { fill:{color:'4B7BE5'} }]
|
|
566
|
+
*/
|
|
567
|
+
columns?: TableCellProps[];
|
|
568
|
+
/**
|
|
569
|
+
* Default cell background — **stamped onto every cell**, not painted behind the table.
|
|
570
|
+
*
|
|
571
|
+
* Each cell that does not set its own `options.fill` (or take one from `headerRow` /
|
|
572
|
+
* `columns[i]`) gets this as its own `a:tcPr` fill. A picture fill is embedded once and
|
|
573
|
+
* shared by every cell that inherits it.
|
|
574
|
+
*
|
|
575
|
+
* Visually this is usually what you want, but it is not what a source deck contains, and
|
|
576
|
+
* it has one real consequence: because every cell ends up explicitly filled, a cell that
|
|
577
|
+
* later gets its own fill has nothing to fall back to. For a genuine table background —
|
|
578
|
+
* one `a:tblPr` fill that cells sit on top of — use {@link tableFill}. A bare
|
|
579
|
+
* {@link Color} is shorthand for a solid fill ({@link FillOption}).
|
|
580
|
+
* @example 'FF0000' // hex color (red), shorthand for { color:'FF0000' }
|
|
581
|
+
* @example { color:'FF0000' } // hex color (red)
|
|
582
|
+
* @example { color:'0088CC', transparency:50 } // hex color, 50% transparent
|
|
583
|
+
* @example { color:SchemeColor.accent1 } // theme color Accent1
|
|
584
|
+
* @example { type:'image', image:{ path:'watermark.png' } } // picture fill
|
|
585
|
+
*/
|
|
586
|
+
fill?: FillOption;
|
|
587
|
+
/**
|
|
588
|
+
* The table's own background (`a:tblPr` fill) — one fill behind the whole table that
|
|
589
|
+
* every cell sits on top of.
|
|
590
|
+
*
|
|
591
|
+
* The counterpart to {@link fill}, and the difference is where the paint lands rather
|
|
592
|
+
* than how it looks: `fill` copies a colour onto every cell, while this writes a single
|
|
593
|
+
* fill on the table itself. That matters when a cell is meant to be transparent — with
|
|
594
|
+
* `tableFill`, an unfilled cell shows the table background through; with `fill` there is
|
|
595
|
+
* no such thing as an unfilled cell. It is also what a deck read back from PowerPoint
|
|
596
|
+
* actually carries, so a replica reproduces the source's structure rather than an
|
|
597
|
+
* equivalent-looking flattening of it.
|
|
598
|
+
*
|
|
599
|
+
* Takes the same {@link FillOption} a cell does — solid, gradient, pattern or picture,
|
|
600
|
+
* or a bare {@link Color} as shorthand for a solid fill.
|
|
601
|
+
* @example 'F2F2F2' // shorthand for { color:'F2F2F2' }
|
|
602
|
+
* @example { color:'F2F2F2' } // a light background behind the whole table
|
|
603
|
+
* @example { type:'image', image:{ path:'watermark.png' } } // one watermark, not one per cell
|
|
604
|
+
*/
|
|
605
|
+
tableFill?: FillOption;
|
|
606
|
+
/**
|
|
607
|
+
* Cell margin (inches)
|
|
608
|
+
* - affects all table cells, is superceded by cell options
|
|
609
|
+
*/
|
|
610
|
+
margin?: Margin;
|
|
611
|
+
/**
|
|
612
|
+
* Height of table rows (inches)
|
|
613
|
+
* - single value is applied to every row equally based upon `h`
|
|
614
|
+
* - array of values in applied to each row in order
|
|
615
|
+
*
|
|
616
|
+
* An entry pins its row only when it is a **number greater than zero**. `0`, a negative
|
|
617
|
+
* value and anything that does not read as a finite number are not heights, so they do
|
|
618
|
+
* not pin: the row is sized from the table's `h` instead, or grows to fit if there is
|
|
619
|
+
* none, and a `table/invalid-row-height` diagnostic says so. A *missing* array slot, or
|
|
620
|
+
* `null` in it, is different and is silent — that is how an auto-height row is spelled.
|
|
621
|
+
*
|
|
622
|
+
* The reading is shared by everything that answers a question about row height: the
|
|
623
|
+
* emitted `<a:tr h>`, the export-time measured-fit pass, the auto-pager, and
|
|
624
|
+
* `pptx.tableLayout()`. A prediction that disagreed with what the export bakes would be
|
|
625
|
+
* worse than no prediction (`docs/contributing/design/text-fit.md`).
|
|
626
|
+
* @default rows of equal height based upon `h`
|
|
627
|
+
*/
|
|
628
|
+
rowH?: number | Array<number | null>;
|
|
629
|
+
/**
|
|
630
|
+
* DEV-ONLY diagnostic flag: when `true`, logs a verbose trace of the auto-paging
|
|
631
|
+
* calculations to the console. Intended for debugging table layout only; leave unset
|
|
632
|
+
* in production. Inherited by {@link TableToSlidesProps}.
|
|
633
|
+
* @default false
|
|
634
|
+
*/
|
|
635
|
+
verbose?: boolean;
|
|
636
|
+
}
|
|
637
|
+
interface TableCell {
|
|
638
|
+
/**
|
|
639
|
+
* Cell content: a plain string, or an array of `TableCell` runs for mixed formatting.
|
|
640
|
+
* (A `number` is still coerced to a string at runtime for plain-JS callers, but is no
|
|
641
|
+
* longer part of the type — pass `String(n)` from TypeScript.)
|
|
642
|
+
*/
|
|
643
|
+
text?: string | TableCell[];
|
|
644
|
+
options?: TableCellProps;
|
|
645
|
+
}
|
|
646
|
+
interface TableRowSlide {
|
|
647
|
+
rows: TableRow[];
|
|
648
|
+
/**
|
|
649
|
+
* Per-row height (inches) aligned 1:1 with `rows`, derived from the original `rowH` array.
|
|
650
|
+
* Auto-paging splits/reorders rows across slides and inserts repeated headers, so the caller's
|
|
651
|
+
* `rowH[i]` (keyed by *original* row index) can no longer be applied by physical row index on
|
|
652
|
+
* each generated slide. This carries each output row's resolved height so a configured height
|
|
653
|
+
* follows its source row instead of being re-applied to whatever lands at that index.
|
|
654
|
+
* Entries are `undefined` where no explicit height was configured (auto-distributed height).
|
|
655
|
+
*/
|
|
656
|
+
rowH?: Array<number | undefined>;
|
|
657
|
+
/**
|
|
658
|
+
* Where this page's table starts, in inches from the top of the slide: the top the pager budgeted
|
|
659
|
+
* the page's height from.
|
|
660
|
+
*
|
|
661
|
+
* A continuation page starts at `autoPageSlideStartY` when stated, else at the top margin, or at
|
|
662
|
+
* the table's own `y` when that is higher. Placing the table anywhere else puts it where it was
|
|
663
|
+
* not measured, so the callers place every page after the first here rather than re-deriving
|
|
664
|
+
* the rule.
|
|
665
|
+
*/
|
|
666
|
+
y?: number;
|
|
667
|
+
/**
|
|
668
|
+
* The column grid (inches) the pager measured this page against, one entry per grid column.
|
|
669
|
+
*
|
|
670
|
+
* The pager resolves `colW` — normalizing a short array, and distributing the usable width
|
|
671
|
+
* when the caller gave none — and the emitted table has to use the same grid, or the widths
|
|
672
|
+
* the text was wrapped to are not the widths it is drawn in. This carried it by writing
|
|
673
|
+
* back onto the options bag it was handed, which made a reused bag change the next call's
|
|
674
|
+
* output; it rides out here instead.
|
|
675
|
+
*/
|
|
676
|
+
colW?: number[];
|
|
677
|
+
}
|
|
678
|
+
type TableRow = TableCell[];
|
|
679
|
+
//#endregion
|
|
680
|
+
//#region src/types/animation.d.ts
|
|
681
|
+
/**
|
|
682
|
+
* Base ECMA-376 slide-transition type (`p:transition`'s single type child). Each
|
|
683
|
+
* maps to a `<p:TYPE/>` element; type-specific variants (e.g. direction) go in
|
|
684
|
+
* {@link TransitionProps.variant}. Modern PowerPoint-only transitions (Morph,
|
|
685
|
+
* Vortex, …) live in the `p14`/`p15`/`p159` namespaces and are out of authoring
|
|
686
|
+
* scope for now. See `docs/animations-and-transitions.md`.
|
|
687
|
+
*/
|
|
688
|
+
type TransitionType = (typeof TRANSITION_TYPES)[number];
|
|
689
|
+
/**
|
|
690
|
+
* Slide-show transition applied between slides (`p:transition`). Assign to
|
|
691
|
+
* {@link Slide.transition}. Setting `durationMs` emits PowerPoint's
|
|
692
|
+
* `mc:AlternateContent` form (a `p14` Choice carrying `p14:dur` plus a base
|
|
693
|
+
* `mc:Fallback`); otherwise only the coarse `speed` bucket is written.
|
|
694
|
+
* @example slide.transition = { type: 'push', durationMs: 1250, variant: { dir: 'd' } }
|
|
695
|
+
*/
|
|
696
|
+
interface TransitionProps {
|
|
697
|
+
/** Transition type (the `<p:TYPE/>` element), e.g. `fade`, `push`, `wipe`, `cut`, `dissolve`. */
|
|
698
|
+
type: TransitionType;
|
|
699
|
+
/** Exact duration in milliseconds (`p14:dur`); emits the `mc:AlternateContent` form. */
|
|
700
|
+
durationMs?: number;
|
|
701
|
+
/** Coarse speed bucket (`spd`); derived from `durationMs` when omitted, else defaults to `fast`. */
|
|
702
|
+
speed?: 'slow' | 'med' | 'fast';
|
|
703
|
+
/** Advance on mouse click (`advClick`). @default true */
|
|
704
|
+
advanceOnClick?: boolean;
|
|
705
|
+
/** Auto-advance after this many milliseconds (`advTm`). */
|
|
706
|
+
advanceAfterMs?: number;
|
|
707
|
+
/** Type-specific variant attributes, e.g. `{ dir: 'd' }` for push, `{ spokes: '2' }` for wheel. */
|
|
708
|
+
variant?: Record<string, string>;
|
|
709
|
+
/** Sound played with the transition (`p:sndAc`): a start sound (embedded WAV) or the stop-previous form. */
|
|
710
|
+
sound?: TransitionSoundProps;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* A transition sound (`p:sndAc`). Either a **start sound** — an embedded WAV played
|
|
714
|
+
* when the transition runs (`p:stSnd` → `p:snd`), optionally looped — or the
|
|
715
|
+
* **stop-previous** form (`p:endSnd`) that silences a still-playing transition
|
|
716
|
+
* sound. Built-in PowerPoint sounds embed identically to a custom file, so there is
|
|
717
|
+
* no separate built-in path: supply the WAV bytes via `data` or `path`.
|
|
718
|
+
* See `docs/animations-and-transitions.md`.
|
|
719
|
+
*/
|
|
720
|
+
interface TransitionSoundProps {
|
|
721
|
+
/** Embedded sound bytes as a base64 data URI (e.g. `data:audio/wav;base64,…`) or raw base64. */
|
|
722
|
+
data?: string;
|
|
723
|
+
/** Path to a sound file, read at export time (alternative to `data`). */
|
|
724
|
+
path?: string;
|
|
725
|
+
/** Display name emitted on `<p:snd @name>` (e.g. `ding.wav`); defaults to the file name. */
|
|
726
|
+
name?: string;
|
|
727
|
+
/** Loop the sound until the next sound starts (`<p:stSnd loop="1">`). @default false */
|
|
728
|
+
loop?: boolean;
|
|
729
|
+
/** Emit the stop-previous form (`<p:endSnd/>`) instead of a start sound. Mutually exclusive with `data`/`path`. */
|
|
730
|
+
stopPrevious?: boolean;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* A preset build-animation effect. The supported set is fixed (each is a verbatim
|
|
734
|
+
* template captured from PowerPoint); adding one means adding a fixture + template,
|
|
735
|
+
* not a new code path. See `docs/contributing/design/animations.md`.
|
|
736
|
+
*/
|
|
737
|
+
type PresetEffect = 'fadeIn' | 'flyIn' | 'appear' | 'wipe' | 'grow' | 'spin' | 'fadeOut' | 'flyOut';
|
|
738
|
+
/** When a build-animation effect starts relative to the preceding one. */
|
|
739
|
+
type AnimationTrigger = 'onClick' | 'withPrevious' | 'afterPrevious';
|
|
740
|
+
/**
|
|
741
|
+
* A preset build animation on a shape (entrance/emphasis/exit), added via
|
|
742
|
+
* {@link Slide.addAnimation}. Target the shape by its 0-based add order
|
|
743
|
+
* (`shapeIndex`) or by `objectName`. Effects play in the order added, grouped
|
|
744
|
+
* into click steps by `trigger`.
|
|
745
|
+
*/
|
|
746
|
+
interface AnimationProps {
|
|
747
|
+
/** The preset effect to play. */
|
|
748
|
+
preset: PresetEffect;
|
|
749
|
+
/**
|
|
750
|
+
* 0-based add order of the target SHAPE on the slide.
|
|
751
|
+
*
|
|
752
|
+
* Counts the top-level objects that draw something, so an `addNotes` (or a hyperlink
|
|
753
|
+
* definition) between two shapes does not shift the shapes after it. Use `objectName` to
|
|
754
|
+
* target a shape inside a group; an index past the last shape warns and drops the effect.
|
|
755
|
+
*/
|
|
756
|
+
shapeIndex?: number;
|
|
757
|
+
/**
|
|
758
|
+
* Target shape by its `objectName` (alternative to `shapeIndex`). Any shape on the slide,
|
|
759
|
+
* including one inside a group; an unresolved name warns and drops the effect.
|
|
760
|
+
*/
|
|
761
|
+
objectName?: string;
|
|
762
|
+
/** Trigger relative to the previous effect. @default 'onClick' */
|
|
763
|
+
trigger?: AnimationTrigger;
|
|
764
|
+
/** Effect duration in milliseconds; preset-specific default when omitted. */
|
|
765
|
+
durationMs?: number;
|
|
766
|
+
}
|
|
767
|
+
//#endregion
|
|
768
|
+
//#region src/types/master.d.ts
|
|
769
|
+
interface SlideNumberProps extends PositionProps, TextBaseProps {
|
|
770
|
+
/**
|
|
771
|
+
* margin (inches) — text-frame internal margin; a value `>= 1` warns as a likely legacy points value
|
|
772
|
+
*/
|
|
773
|
+
margin?: Margin;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* A chart on a slide master, as a key-tagged descriptor.
|
|
777
|
+
*
|
|
778
|
+
* `options` is the spelling every sibling descriptor uses (`shape.options`, `text.options`).
|
|
779
|
+
* A second, undocumented `opts` alias used to sit beside it and *win* when both were given,
|
|
780
|
+
* so a caller who set the documented one and left a stray `opts` behind got the stray.
|
|
781
|
+
*/
|
|
782
|
+
interface SlideMasterChartProps {
|
|
783
|
+
type: CHART_NAME | ChartMulti[];
|
|
784
|
+
data: OptsChartData[];
|
|
785
|
+
options?: ChartOpts;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* One object on a slide master, as a key-tagged descriptor.
|
|
789
|
+
*
|
|
790
|
+
* The six descriptors it shares with a group child are {@link CommonObjectDescriptor}; the two
|
|
791
|
+
* below are the master's own — a chart, which a group cannot hold, and a placeholder, which is
|
|
792
|
+
* the whole point of a master.
|
|
793
|
+
*/
|
|
794
|
+
type SlideMasterObject = CommonObjectDescriptor | {
|
|
795
|
+
chart: SlideMasterChartProps;
|
|
796
|
+
} | {
|
|
797
|
+
placeholder: {
|
|
798
|
+
options: PlaceholderProps;
|
|
799
|
+
/**
|
|
800
|
+
* Text to be shown in placeholder (shown until user focuses textbox or adds text)
|
|
801
|
+
* - Leave blank to have powerpoint show default phrase (ex: "Click to add title")
|
|
802
|
+
*/
|
|
803
|
+
text?: string;
|
|
804
|
+
};
|
|
805
|
+
};
|
|
806
|
+
/**
|
|
807
|
+
* Bullet configuration for one slide-master text-style level (`a:buChar`/`a:buAutoNum`/`a:buNone`).
|
|
808
|
+
* A focused subset of the run-level bullet model — picture bullets and per-glyph sizing are not
|
|
809
|
+
* supported in master defaults (those require slide rels). Set `bullet: false` to suppress the
|
|
810
|
+
* level's bullet entirely.
|
|
811
|
+
*/
|
|
812
|
+
interface MasterBulletProps {
|
|
813
|
+
/** `'bullet'` emits a character bullet (`a:buChar`); `'number'` emits an auto-number (`a:buAutoNum`). @default 'bullet' */
|
|
814
|
+
type?: 'bullet' | 'number';
|
|
815
|
+
/** Bullet character (unicode code point hex), e.g. `'2022'` for •. Used when `type` is `'bullet'`. */
|
|
816
|
+
characterCode?: string;
|
|
817
|
+
/** Glyph font typeface for the bullet character (`a:buFont`), e.g. `'Arial'` or `'Wingdings'`. */
|
|
818
|
+
fontFace?: string;
|
|
819
|
+
/** Auto-number scheme (`a:buAutoNum@type`) when `type` is `'number'`, e.g. `'arabicPeriod'`. @default 'arabicPeriod' */
|
|
820
|
+
numberType?: (typeof TEXT_AUTONUM_SCHEMES)[number];
|
|
821
|
+
/** Starting value for auto-numbered bullets (`a:buAutoNum@startAt`). @default 1 */
|
|
822
|
+
numberStartAt?: number;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Styling for one paragraph level (`a:lvlNpPr`) of a slide-master text style. Every field is
|
|
826
|
+
* optional; an unset field keeps PowerPoint's built-in default for that level. Configure via
|
|
827
|
+
* {@link SlideMasterProps.textStyles}.
|
|
828
|
+
*/
|
|
829
|
+
interface MasterTextStyleLevel {
|
|
830
|
+
/** Font size in points (`a:defRPr@sz`), e.g. `24`. */
|
|
831
|
+
fontSize?: number;
|
|
832
|
+
/** Font face (`a:defRPr/a:latin@typeface`). Unset keeps the theme font (`+mn-lt`/`+mj-lt`). */
|
|
833
|
+
fontFace?: string;
|
|
834
|
+
/** Text color — hex (`'C00000'`) or theme slot (`'tx1'`) — emitted as `a:defRPr/a:solidFill`. */
|
|
835
|
+
color?: Color;
|
|
836
|
+
/** Bold text (`a:defRPr@b`). */
|
|
837
|
+
bold?: boolean;
|
|
838
|
+
/** Italic text (`a:defRPr@i`). */
|
|
839
|
+
italic?: boolean;
|
|
840
|
+
/** Horizontal alignment (`a:lvlNpPr@algn`). */
|
|
841
|
+
align?: HAlign;
|
|
842
|
+
/** Left margin in inches (`a:lvlNpPr@marL`); for a hanging bullet this is the text indent. */
|
|
843
|
+
marginLeft?: number;
|
|
844
|
+
/** First-line indent in inches (`a:lvlNpPr@indent`); negative produces a hanging bullet. */
|
|
845
|
+
indent?: number;
|
|
846
|
+
/** Bullet config: `false` emits `a:buNone`; an object configures a char/number bullet. Unset keeps the level default. */
|
|
847
|
+
bullet?: boolean | MasterBulletProps;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Per-level slide-master text styles, written to `slideMaster1.xml`'s `<p:txStyles>`.
|
|
851
|
+
* Because a deck has a single shared slide master, these styles are **deck-wide**: when set on more
|
|
852
|
+
* than one `defineSlideMaster()` call the last value for each group (`title`/`body`/`other`) wins.
|
|
853
|
+
*/
|
|
854
|
+
interface MasterTextStyleProps {
|
|
855
|
+
/** Title placeholder style (`p:titleStyle`, single level). */
|
|
856
|
+
title?: MasterTextStyleLevel;
|
|
857
|
+
/** Body placeholder per-level styles (`p:bodyStyle`, levels 1–9; index 0 is `lvl1`). */
|
|
858
|
+
body?: MasterTextStyleLevel[];
|
|
859
|
+
/** Other/default placeholder per-level styles (`p:otherStyle`, levels 1–9). */
|
|
860
|
+
other?: MasterTextStyleLevel[];
|
|
861
|
+
}
|
|
862
|
+
interface SlideMasterProps {
|
|
863
|
+
/**
|
|
864
|
+
* Unique name for this master
|
|
865
|
+
*/
|
|
866
|
+
title: string;
|
|
867
|
+
background?: BackgroundOption;
|
|
868
|
+
margin?: Margin;
|
|
869
|
+
slideNumber?: SlideNumberProps;
|
|
870
|
+
objects?: SlideMasterObject[];
|
|
871
|
+
/**
|
|
872
|
+
* Per-level master text styles (title / body / other) written to the shared slide master's
|
|
873
|
+
* `<p:txStyles>`. Configure nested bullet character, font size, color, alignment, and indent
|
|
874
|
+
* for each of the nine list levels. Deck-wide (see {@link MasterTextStyleProps}).
|
|
875
|
+
* @example textStyles: { body: [{ fontSize: 24, color: 'C00000', bullet: { characterCode: '25AA' } }] }
|
|
876
|
+
*/
|
|
877
|
+
textStyles?: MasterTextStyleProps;
|
|
878
|
+
}
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region src/types/model3d.d.ts
|
|
881
|
+
/** A point or direction in the model's 3D scene, in metres. */
|
|
882
|
+
interface Model3dPoint {
|
|
883
|
+
x: number;
|
|
884
|
+
y: number;
|
|
885
|
+
z: number;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Camera override for `addModel3d()`, mapping onto `am3d:camera`.
|
|
889
|
+
*
|
|
890
|
+
* The defaults are what PowerPoint itself wrote for a 2×2×2 cube, and they are correct for any
|
|
891
|
+
* model whose bounding box is roughly cubic **once `meterPerModelUnit` is right** — the camera is
|
|
892
|
+
* expressed in metres, so the scale is what actually decides framing.
|
|
893
|
+
*
|
|
894
|
+
* PowerPoint's own rule, measured against three models: it normalizes the model's largest
|
|
895
|
+
* bounding-box extent to 1 metre and then places the camera at
|
|
896
|
+
*
|
|
897
|
+
* ```
|
|
898
|
+
* pos.z = |halfExtents / maxExtent| / sin(fov / 2)
|
|
899
|
+
* ```
|
|
900
|
+
*
|
|
901
|
+
* looking at the origin. A caller who knows their model's bounding box can reproduce that
|
|
902
|
+
* exactly; a caller who does not should at least set `meterPerModelUnit` to `1 / maxExtent`.
|
|
903
|
+
*/
|
|
904
|
+
interface Model3dCameraProps {
|
|
905
|
+
/**
|
|
906
|
+
* Camera position in metres (`am3d:camera/am3d:pos`).
|
|
907
|
+
* @default { x: 0, y: 0, z: 2.2630334 }
|
|
908
|
+
*/
|
|
909
|
+
pos?: Model3dPoint;
|
|
910
|
+
/**
|
|
911
|
+
* Point the camera aims at, in metres (`am3d:camera/am3d:lookAt`).
|
|
912
|
+
* @default { x: 0, y: 0, z: 0 }
|
|
913
|
+
*/
|
|
914
|
+
lookAt?: Model3dPoint;
|
|
915
|
+
/**
|
|
916
|
+
* Camera "up" direction (`am3d:camera/am3d:up`). Need not be normalized.
|
|
917
|
+
* @default { x: 0, y: 1, z: 0 }
|
|
918
|
+
*/
|
|
919
|
+
up?: Model3dPoint;
|
|
920
|
+
/**
|
|
921
|
+
* Vertical field of view in **degrees** (`am3d:perspective@fov`).
|
|
922
|
+
* - range: greater than 0 and less than 180
|
|
923
|
+
* @default 45
|
|
924
|
+
*/
|
|
925
|
+
fov?: number;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Add an embedded 3D model (PowerPoint's Insert ▸ 3D Models) to a slide.
|
|
929
|
+
*
|
|
930
|
+
* The `.glb` bytes travel inside the `.pptx` (in `ppt/media/`), so PowerPoint 2019+ renders and
|
|
931
|
+
* lets the viewer orbit the model. Requires either `data` or `path`. Linked (non-embedded)
|
|
932
|
+
* models are not supported.
|
|
933
|
+
*/
|
|
934
|
+
interface Model3dBaseProps extends PositionProps, ObjectNameProps {
|
|
935
|
+
/**
|
|
936
|
+
* Picture of the model shown wherever the live 3D view is unavailable — a raster image `path`
|
|
937
|
+
* (Node/local) or base64 `data:` URI.
|
|
938
|
+
* - the library cannot render a 3D scene, so when this is omitted a neutral gray placeholder is
|
|
939
|
+
* embedded; PowerPoint 2019+ draws the live model on screen, in exports and in print, but older
|
|
940
|
+
* PowerPoint and applications without a 3D renderer show exactly what is here
|
|
941
|
+
* - supply a real render whenever the deck is meant to read correctly outside PowerPoint
|
|
942
|
+
* @example { path: 'assets/engine-render.png' }
|
|
943
|
+
*/
|
|
944
|
+
preview?: {
|
|
945
|
+
path?: string;
|
|
946
|
+
data?: string;
|
|
947
|
+
};
|
|
948
|
+
/**
|
|
949
|
+
* Camera override. Omitted, ts-pptx emits the camera PowerPoint wrote for a 2×2×2 cube.
|
|
950
|
+
* @see {@link Model3dCameraProps} for the framing formula and when this matters.
|
|
951
|
+
*/
|
|
952
|
+
camera?: Model3dCameraProps;
|
|
953
|
+
/**
|
|
954
|
+
* Metres per model unit (`am3d:trans/am3d:meterPerModelUnit`) — the scale that decides how
|
|
955
|
+
* large the model is in the scene the {@link camera} looks at.
|
|
956
|
+
*
|
|
957
|
+
* This is the single override most models need. PowerPoint sets it to `1 / maxExtent`, where
|
|
958
|
+
* `maxExtent` is the model's largest bounding-box dimension in model units, which normalizes
|
|
959
|
+
* every model to 1 metre across. ts-pptx does not parse the `.glb`, so it cannot measure that
|
|
960
|
+
* — it defaults to `0.5`, correct for a model 2 units across. A model 100 units across left at
|
|
961
|
+
* the default is a 50-metre object with the camera 2.26 metres from its centre, i.e. the
|
|
962
|
+
* viewer is inside it.
|
|
963
|
+
* - range: greater than 0
|
|
964
|
+
* @default 0.5
|
|
965
|
+
* @example 1 / 100 // a model whose largest bounding-box dimension is 100 units
|
|
966
|
+
*/
|
|
967
|
+
meterPerModelUnit?: number;
|
|
968
|
+
/**
|
|
969
|
+
* Alt text (`p:cNvPr@descr`) — what a screen reader announces for the model.
|
|
970
|
+
*/
|
|
971
|
+
altText?: string;
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Options for `slide.addModel3d()`. Requires either `data` (base64, with or without a
|
|
975
|
+
* `data:...;base64,` header) or `path` (a local/remote `.glb` read at export time).
|
|
976
|
+
*
|
|
977
|
+
* Sizing note: `w`/`h` default to 4 × 3 inches rather than being measured. A 3D model has no
|
|
978
|
+
* intrinsic aspect ratio, and the library never opens the payload.
|
|
979
|
+
*/
|
|
980
|
+
type Model3dProps = Model3dBaseProps & DataOrPathRequiredProps;
|
|
981
|
+
//#endregion
|
|
982
|
+
//#region src/types/zoom.d.ts
|
|
983
|
+
/** Options shared by all three zoom kinds. */
|
|
984
|
+
interface ZoomBaseProps extends PositionProps {
|
|
985
|
+
/** Object name (PowerPoint selection-pane label). Auto-named (e.g. `Slide Zoom 3`) when omitted. */
|
|
986
|
+
objectName?: string;
|
|
987
|
+
/**
|
|
988
|
+
* Ship a caller-supplied thumbnail instead of the gray placeholder — a raster image `path`
|
|
989
|
+
* (Node/local) or base64 `data:` URI. Shown as-authored (not auto-refreshed by PowerPoint).
|
|
990
|
+
*/
|
|
991
|
+
coverImage?: {
|
|
992
|
+
path?: string;
|
|
993
|
+
data?: string;
|
|
994
|
+
};
|
|
995
|
+
/**
|
|
996
|
+
* After the zoom animates to its target, return to this (parent) slide when the target's
|
|
997
|
+
* content finishes. Maps to `zmPr@returnToParent`. Default `false`.
|
|
998
|
+
*/
|
|
999
|
+
returnToParent?: boolean;
|
|
1000
|
+
/** Zoom transition duration in milliseconds (`zmPr@transitionDur`). Default `1000`. */
|
|
1001
|
+
transitionDur?: number;
|
|
1002
|
+
/**
|
|
1003
|
+
* Object lock flags ({@link ObjectLockProps}), as `objectLock` on every other object type.
|
|
1004
|
+
*
|
|
1005
|
+
* A zoom is a `p:graphicFrame`, so these land on its `a:graphicFrameLocks` and the flags that
|
|
1006
|
+
* apply are the graphic-frame ones (`noGrp`, `noDrilldown`, `noSelect`, `noChangeAspect`,
|
|
1007
|
+
* `noMove`, `noResize`); a picture-only flag warns and is dropped, as everywhere else. The
|
|
1008
|
+
* `mc:Fallback` picture keeps its own fixed lock set — it is what pre-2016 consumers draw, and
|
|
1009
|
+
* folding a graphic-frame flag set onto a `a:picLocks` element would warn about every flag the
|
|
1010
|
+
* two element types do not share.
|
|
1011
|
+
*
|
|
1012
|
+
* `noChangeAspect` is on by default (a zoom tile mirrors its target slide's aspect); pass it
|
|
1013
|
+
* `false` to lift it.
|
|
1014
|
+
* @example { noMove: true, noResize: true } // pin the tile in place
|
|
1015
|
+
*/
|
|
1016
|
+
objectLock?: ObjectLockProps;
|
|
1017
|
+
}
|
|
1018
|
+
/** Slide Zoom: a tile that zooms to a single target slide. */
|
|
1019
|
+
interface SlideZoomProps extends ZoomBaseProps {
|
|
1020
|
+
/** Target slide — a `Slide` returned by `addSlide()`, or its 1-based slide number. */
|
|
1021
|
+
target: Slide | number;
|
|
1022
|
+
}
|
|
1023
|
+
/** Section Zoom: a tile that zooms to the start of a named section. */
|
|
1024
|
+
interface SectionZoomProps extends ZoomBaseProps {
|
|
1025
|
+
/** Title of the target section (as passed to `addSection({ title })`). */
|
|
1026
|
+
sectionTitle: string;
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Summary Zoom: a grid of tiles, one per section, that navigates to each section's start.
|
|
1030
|
+
* The section containing the host slide is excluded (a summary does not link to itself).
|
|
1031
|
+
*/
|
|
1032
|
+
type SummaryZoomProps = ZoomBaseProps;
|
|
1033
|
+
//#endregion
|
|
1034
|
+
//#region src/types/slide.d.ts
|
|
1035
|
+
/**
|
|
1036
|
+
* A child object that can be placed inside a group via `slide.addGroup()`.
|
|
1037
|
+
*
|
|
1038
|
+
* The six descriptors it shares with `SlideMasterObject` are {@link CommonObjectDescriptor};
|
|
1039
|
+
* `group` is the group's own, and the master's `chart` and `placeholder` are deliberately not
|
|
1040
|
+
* here. A `group` child nests another group (an identity child
|
|
1041
|
+
* coordinate space is kept at every depth, so descendants keep their slide-absolute
|
|
1042
|
+
* coordinates). Charts, media, tables, and placeholders are intentionally excluded (see
|
|
1043
|
+
* `addGroup`); passing one logs a warning and skips it.
|
|
1044
|
+
*/
|
|
1045
|
+
type GroupChildProps = CommonObjectDescriptor | {
|
|
1046
|
+
group: {
|
|
1047
|
+
children: GroupChildProps[];
|
|
1048
|
+
options?: GroupProps;
|
|
1049
|
+
};
|
|
1050
|
+
};
|
|
1051
|
+
/**
|
|
1052
|
+
* Options for `slide.addGroup()`.
|
|
1053
|
+
*
|
|
1054
|
+
* The group keeps an identity child coordinate space (`chOff/chExt == off/ext`) at every depth:
|
|
1055
|
+
* children — including nested groups — keep their slide-absolute `x/y/w/h`. A consequence worth
|
|
1056
|
+
* knowing: a group's own frame never moves or scales its children, it only places the selection
|
|
1057
|
+
* handle and the rotate pivot.
|
|
1058
|
+
*
|
|
1059
|
+
* The frame is all-or-nothing. Pass all four of `x/y/w/h` to set it explicitly, or none to have it
|
|
1060
|
+
* auto-computed as the bounding box of the children. A partial frame is ambiguous, so it warns and
|
|
1061
|
+
* falls back to auto-bounds on every axis.
|
|
1062
|
+
*/
|
|
1063
|
+
interface GroupProps extends PositionProps, ObjectNameProps {
|
|
1064
|
+
/** Rotation in degrees (applied to the whole group) */
|
|
1065
|
+
rotate?: number;
|
|
1066
|
+
/** Flip the group horizontally */
|
|
1067
|
+
flipH?: boolean;
|
|
1068
|
+
/** Flip the group vertically */
|
|
1069
|
+
flipV?: boolean;
|
|
1070
|
+
}
|
|
1071
|
+
interface ObjectOptions extends ImageBaseProps, PositionProps, ShapeProps, TableCellProps, TextPropsOptions {
|
|
1072
|
+
cx?: Coord;
|
|
1073
|
+
cy?: Coord;
|
|
1074
|
+
margin?: Margin;
|
|
1075
|
+
colW?: number | number[];
|
|
1076
|
+
rowH?: number | Array<number | null>;
|
|
1077
|
+
hasHeader?: boolean;
|
|
1078
|
+
hasFooter?: boolean;
|
|
1079
|
+
hasBandedRows?: boolean;
|
|
1080
|
+
hasBandedColumns?: boolean;
|
|
1081
|
+
hasFirstColumn?: boolean;
|
|
1082
|
+
hasLastColumn?: boolean;
|
|
1083
|
+
rtl?: boolean;
|
|
1084
|
+
tableStyle?: TableStyle | `{${string}}`;
|
|
1085
|
+
/**
|
|
1086
|
+
* Table perimeter border. `addTableDefinition` normalizes it to a 4-tuple (TRBL, sides
|
|
1087
|
+
* left unset as `undefined`) before it reaches the emitter, so the serializer never has
|
|
1088
|
+
* to re-handle the single-`BorderProps` form.
|
|
1089
|
+
*/
|
|
1090
|
+
outerBorder?: TableProps['outerBorder'];
|
|
1091
|
+
/** Table background (`a:tblPr` fill), as distinct from `fill`, which is stamped onto each cell. */
|
|
1092
|
+
tableFill?: TableProps['tableFill'];
|
|
1093
|
+
}
|
|
1094
|
+
interface SlideLayout {
|
|
1095
|
+
background?: BackgroundOption | undefined;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* One authored object on a slide, as {@link Slide.objects} reports it: what it is and how it is
|
|
1099
|
+
* addressed, not how it is drawn. It is a snapshot taken when the getter ran, not a live handle —
|
|
1100
|
+
* nothing on it writes back, and a later `addShape`/`groupObjects` leaves it describing the slide
|
|
1101
|
+
* as it was.
|
|
1102
|
+
*
|
|
1103
|
+
* The point of it is composition. A slide assembled by independent renderers arrives with objects
|
|
1104
|
+
* whose descriptors nobody kept, and the only durable handle on them is the `objectName` each one
|
|
1105
|
+
* was authored with; without a way to enumerate those, a consumer that wants to act on what is
|
|
1106
|
+
* already there has to either make every renderer surrender its internals or keep a parallel
|
|
1107
|
+
* ledger of what it added — and a ledger is wrong the moment a renderer adds an object it did not
|
|
1108
|
+
* announce.
|
|
1109
|
+
*/
|
|
1110
|
+
interface SlideObjectInfo {
|
|
1111
|
+
/** What kind of object this is — the same value the object was authored as. */
|
|
1112
|
+
readonly type: SlideObjectType;
|
|
1113
|
+
/**
|
|
1114
|
+
* Selection Pane name, in the spelling the caller passed to `objectName`, so it can be handed
|
|
1115
|
+
* straight back to `groupObjects()` or to an animation or connector reference.
|
|
1116
|
+
*
|
|
1117
|
+
* Always a string: an object authored without a name still gets the generated `Shape 3` /
|
|
1118
|
+
* `Text 1` / `Group 2` identity PowerPoint shows in the Selection Pane, and that name addresses
|
|
1119
|
+
* it just as well. The two are indistinguishable here on purpose — nothing downstream of
|
|
1120
|
+
* authoring records which is which, and a consumer that cares can tell them apart by the
|
|
1121
|
+
* naming convention it chose for its own objects.
|
|
1122
|
+
*/
|
|
1123
|
+
readonly objectName: string;
|
|
1124
|
+
/** True when the object occupies a layout placeholder, which grouping refuses on top of kind. */
|
|
1125
|
+
readonly isPlaceholder: boolean;
|
|
1126
|
+
/**
|
|
1127
|
+
* Whether `groupObjects()` would accept this object on kind alone. It cannot speak for the
|
|
1128
|
+
* *selection* — an unresolved, duplicated or ambiguous name still throws — so it answers "is
|
|
1129
|
+
* this object groupable", never "will this call succeed".
|
|
1130
|
+
*/
|
|
1131
|
+
readonly canGroup: boolean;
|
|
1132
|
+
/**
|
|
1133
|
+
* Children, when `type` is `group`; empty otherwise. Ordered bottom-to-top like
|
|
1134
|
+
* {@link Slide.objects} itself, and nested to whatever depth the groups nest.
|
|
1135
|
+
*/
|
|
1136
|
+
readonly children: readonly SlideObjectInfo[];
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* A slide as the authoring API presents it.
|
|
1140
|
+
*
|
|
1141
|
+
* The four settable properties (`transition`, `background`, `color`, `slideNumber`) admit an
|
|
1142
|
+
* explicit `undefined`, which is not the loophole it looks like under
|
|
1143
|
+
* `exactOptionalPropertyTypes`: `SlideBuilder` implements them as accessor pairs, so the property
|
|
1144
|
+
* is *always* present on a real slide and its getter answers `undefined` when nothing is set.
|
|
1145
|
+
* There is no absent state for the declaration to describe. Writing one is also how the setters
|
|
1146
|
+
* are cleared — `slide.transition = undefined` removes the `p:transition` — and an interface that
|
|
1147
|
+
* could not express the value its own setter takes would be describing a different type.
|
|
1148
|
+
*/
|
|
1149
|
+
interface Slide {
|
|
1150
|
+
addChart(data: OptsChartData[], options: ChartOpts & {
|
|
1151
|
+
type: CHART_NAME;
|
|
1152
|
+
}): Slide;
|
|
1153
|
+
addChart(charts: ChartMulti[], options?: ChartOpts): Slide;
|
|
1154
|
+
addConnector: (options: ConnectorProps) => Slide;
|
|
1155
|
+
addImage: (options: ImageProps) => Slide;
|
|
1156
|
+
addMedia: (options: MediaProps) => Slide;
|
|
1157
|
+
/** Embed a 3D model (Insert ▸ 3D Models) — a `.glb` PowerPoint 2019+ renders live. */
|
|
1158
|
+
addModel3d: (options: Model3dProps) => Slide;
|
|
1159
|
+
/** Embed an OLE object (Insert ▸ Object) whose bytes travel inside the `.pptx`. */
|
|
1160
|
+
addOleObject: (options: OleObjectProps) => Slide;
|
|
1161
|
+
addComment: (options: CommentProps) => Slide;
|
|
1162
|
+
addNotes: (notes: string | NotesProps | NotesProps[]) => Slide;
|
|
1163
|
+
addShape: (shapeName: SHAPE_NAME, options?: ShapeProps) => Slide;
|
|
1164
|
+
addTable: (tableRows: TableRow[], options?: TableProps) => Slide;
|
|
1165
|
+
addText: (text: string | number | TextProps[], options?: TextPropsOptions) => Slide;
|
|
1166
|
+
addAnimation: (options: AnimationProps) => Slide;
|
|
1167
|
+
/** Group child object descriptors into a single PowerPoint group (`<p:grpSp>`). */
|
|
1168
|
+
addGroup: (children: GroupChildProps[], options?: GroupProps) => Slide;
|
|
1169
|
+
/** Group objects already on this slide, addressed by their `objectName`, into a single group. */
|
|
1170
|
+
groupObjects: (objectNames: string[], options?: GroupProps) => Slide;
|
|
1171
|
+
/**
|
|
1172
|
+
* Add a Slide Zoom — a clickable tile that zooms to a single target slide (Insert ▸ Zoom).
|
|
1173
|
+
* @example slide.addSlideZoom({ target: intro, x: 1, y: 1, w: 3, h: 1.7 })
|
|
1174
|
+
*/
|
|
1175
|
+
addSlideZoom: (options: SlideZoomProps) => Slide;
|
|
1176
|
+
/**
|
|
1177
|
+
* Add a Section Zoom — a clickable tile that zooms to the start of a named section.
|
|
1178
|
+
* @example slide.addSectionZoom({ sectionTitle: 'Results', x: 1, y: 1, w: 3, h: 1.7 })
|
|
1179
|
+
*/
|
|
1180
|
+
addSectionZoom: (options: SectionZoomProps) => Slide;
|
|
1181
|
+
/**
|
|
1182
|
+
* Add a Summary Zoom — a grid of tiles, one per section (excluding this slide's own section).
|
|
1183
|
+
* @example slide.addSummaryZoom({ x: 0.5, y: 1.5, w: 11, h: 4.5 })
|
|
1184
|
+
*/
|
|
1185
|
+
addSummaryZoom: (options: SummaryZoomProps) => Slide;
|
|
1186
|
+
/**
|
|
1187
|
+
* The objects authored on this slide so far, bottom-to-top in z-order — the read-back half of
|
|
1188
|
+
* `groupObjects()`, which addresses those same objects by name but until now gave no way to
|
|
1189
|
+
* learn the names.
|
|
1190
|
+
*
|
|
1191
|
+
* A fresh snapshot on every access, and inert: it describes the slide, and writing to it does
|
|
1192
|
+
* nothing. To act on what it reports, call the authoring API with the names it hands you.
|
|
1193
|
+
* @example
|
|
1194
|
+
* const cards = slide.objects.filter((o) => o.canGroup && o.objectName?.startsWith('card:'))
|
|
1195
|
+
* slide.groupObjects(cards.map((o) => o.objectName), { objectName: 'Cards' })
|
|
1196
|
+
*/
|
|
1197
|
+
readonly objects: readonly SlideObjectInfo[];
|
|
1198
|
+
/**
|
|
1199
|
+
* Every continuation slide this slide's auto-paging tables have spilled onto, in call order.
|
|
1200
|
+
*
|
|
1201
|
+
* Across calls, and each slide once: a slide can carry several `addTable`s, each appends what
|
|
1202
|
+
* it spilled onto, and a later table lands on an earlier one's continuations rather than making
|
|
1203
|
+
* its own. So this names all of them rather than only the most recent table's.
|
|
1204
|
+
* @example
|
|
1205
|
+
* slide.addTable(rows, { autoPage: true })
|
|
1206
|
+
* for (const made of slide.newAutoPagedSlides) made.addText('continued', { x: 0.5, y: 0.2 })
|
|
1207
|
+
*/
|
|
1208
|
+
readonly newAutoPagedSlides?: Slide[];
|
|
1209
|
+
/**
|
|
1210
|
+
* Slide-show transition played when advancing to this slide (`p:transition`).
|
|
1211
|
+
* @example slide.transition = { type: 'fade', durationMs: 1500 }
|
|
1212
|
+
*/
|
|
1213
|
+
transition?: TransitionProps | undefined;
|
|
1214
|
+
/**
|
|
1215
|
+
* Slide width in inches, resolved from the active presentation layout.
|
|
1216
|
+
* Use for coordinate math instead of hard-coding layout dimensions.
|
|
1217
|
+
* @example slide.addText('Centered', { x: 0, w: slide.width, align: 'center' })
|
|
1218
|
+
*/
|
|
1219
|
+
readonly width?: number;
|
|
1220
|
+
/**
|
|
1221
|
+
* Slide height in inches, resolved from the active presentation layout.
|
|
1222
|
+
*/
|
|
1223
|
+
readonly height?: number;
|
|
1224
|
+
/**
|
|
1225
|
+
* Background color or image (`color` | `path` | `data`)
|
|
1226
|
+
* @example { color: 'FF3399' } - hex color
|
|
1227
|
+
* @example { color: 'FF3399', transparency:50 } - hex color with 50% transparency
|
|
1228
|
+
* @example { path: 'https://onedrives.com/myimg.png` } - retrieve image via URL
|
|
1229
|
+
* @example { path: '/home/user/images/myimg.png` } - retrieve image via local path
|
|
1230
|
+
* @example { data: 'image/png;base64,iVtDaDrF[...]=' } - base64 string
|
|
1231
|
+
*/
|
|
1232
|
+
background?: BackgroundOption | undefined;
|
|
1233
|
+
/**
|
|
1234
|
+
* Default text color (hex format)
|
|
1235
|
+
* @example 'FF3399'
|
|
1236
|
+
* @default '000000' (DEF_FONT_COLOR)
|
|
1237
|
+
*/
|
|
1238
|
+
color?: HexColor | undefined;
|
|
1239
|
+
/**
|
|
1240
|
+
* Whether slide is hidden
|
|
1241
|
+
* @default false
|
|
1242
|
+
*/
|
|
1243
|
+
hidden?: boolean;
|
|
1244
|
+
/**
|
|
1245
|
+
* Slide number options
|
|
1246
|
+
*/
|
|
1247
|
+
slideNumber?: SlideNumberProps | undefined;
|
|
1248
|
+
}
|
|
1249
|
+
interface AddSlideProps {
|
|
1250
|
+
/** Title of the slide master to use for the new slide (the `title` passed to {@link SlideMasterProps} via `defineSlideMaster`). */
|
|
1251
|
+
masterTitle?: string;
|
|
1252
|
+
sectionTitle?: string;
|
|
1253
|
+
}
|
|
1254
|
+
//#endregion
|
|
1255
|
+
export { TableCellDiagonals as A, AnimationTrigger as C, TransitionType as D, TransitionSoundProps as E, TableToSlidesDocument as F, TableToSlidesElement as I, TableToSlidesProps as L, TableProps as M, TableRow as N, TableCell as O, TableRowSlide as P, AnimationProps as S, TransitionProps as T, MasterTextStyleProps as _, Slide as a, SlideMasterProps as b, SectionZoomProps as c, ZoomBaseProps as d, Model3dCameraProps as f, MasterTextStyleLevel as g, MasterBulletProps as h, ObjectOptions as i, TableCellProps as j, TableCell3DProps as k, SlideZoomProps as l, Model3dProps as m, GroupChildProps as n, SlideLayout as o, Model3dPoint as p, GroupProps as r, SlideObjectInfo as s, AddSlideProps as t, SummaryZoomProps as u, SlideMasterChartProps as v, PresetEffect as w, SlideNumberProps as x, SlideMasterObject as y };
|
|
1256
|
+
//# sourceMappingURL=slide-Dx2ZeVZ6.d.ts.map
|