pptx-react-viewer 1.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 +982 -0
- package/dist/PowerPointViewer-K2URyPlJ.d.mts +522 -0
- package/dist/PowerPointViewer-K2URyPlJ.d.ts +522 -0
- package/dist/index.d.mts +71 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +121771 -0
- package/dist/index.mjs +121737 -0
- package/dist/pptx-viewer.css +2 -0
- package/dist/viewer/index.d.mts +267 -0
- package/dist/viewer/index.d.ts +267 -0
- package/dist/viewer/index.js +121947 -0
- package/dist/viewer/index.mjs +121908 -0
- package/node_modules/emf-converter/README.md +629 -0
- package/node_modules/emf-converter/dist/index.d.mts +86 -0
- package/node_modules/emf-converter/dist/index.d.ts +86 -0
- package/node_modules/emf-converter/dist/index.js +4199 -0
- package/node_modules/emf-converter/dist/index.mjs +4195 -0
- package/node_modules/emf-converter/package.json +42 -0
- package/node_modules/mtx-decompressor/README.md +271 -0
- package/node_modules/mtx-decompressor/dist/index.d.mts +83 -0
- package/node_modules/mtx-decompressor/dist/index.d.ts +83 -0
- package/node_modules/mtx-decompressor/dist/index.js +1510 -0
- package/node_modules/mtx-decompressor/dist/index.mjs +1506 -0
- package/node_modules/mtx-decompressor/package.json +37 -0
- package/node_modules/pptx-viewer-core/README.md +1294 -0
- package/node_modules/pptx-viewer-core/dist/SvgExporter-BZJguJbp.d.ts +557 -0
- package/node_modules/pptx-viewer-core/dist/SvgExporter-DqcmwxFu.d.mts +557 -0
- package/node_modules/pptx-viewer-core/dist/cli/index.d.mts +150 -0
- package/node_modules/pptx-viewer-core/dist/cli/index.d.ts +150 -0
- package/node_modules/pptx-viewer-core/dist/cli/index.js +39790 -0
- package/node_modules/pptx-viewer-core/dist/cli/index.mjs +39757 -0
- package/node_modules/pptx-viewer-core/dist/converter/index.d.mts +48 -0
- package/node_modules/pptx-viewer-core/dist/converter/index.d.ts +48 -0
- package/node_modules/pptx-viewer-core/dist/converter/index.js +3676 -0
- package/node_modules/pptx-viewer-core/dist/converter/index.mjs +3664 -0
- package/node_modules/pptx-viewer-core/dist/index.d.mts +10796 -0
- package/node_modules/pptx-viewer-core/dist/index.d.ts +10796 -0
- package/node_modules/pptx-viewer-core/dist/index.js +49658 -0
- package/node_modules/pptx-viewer-core/dist/index.mjs +49270 -0
- package/node_modules/pptx-viewer-core/dist/presentation-Bo7cMMCe.d.mts +4558 -0
- package/node_modules/pptx-viewer-core/dist/presentation-Bo7cMMCe.d.ts +4558 -0
- package/node_modules/pptx-viewer-core/dist/text-operations-Bo-WG-Z8.d.mts +134 -0
- package/node_modules/pptx-viewer-core/dist/text-operations-D0f1jred.d.ts +134 -0
- package/node_modules/pptx-viewer-core/package.json +61 -0
- package/package.json +89 -0
|
@@ -0,0 +1,4558 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared value types used across the entire PPTX editor type system.
|
|
3
|
+
*
|
|
4
|
+
* Contains primitive enums, small interfaces, and the XML object alias
|
|
5
|
+
* that almost every other type file imports.
|
|
6
|
+
*
|
|
7
|
+
* @module pptx-types/common
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Underline style tokens from OOXML `a:rPr/@u`.
|
|
11
|
+
*
|
|
12
|
+
* These map directly to the OpenXML `ST_TextUnderlineType` simple type.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const style: UnderlineStyle = "wavy";
|
|
17
|
+
* // => "wavy" — one of: sng | dbl | heavy | dotted | dash | wavy | none | ...
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
type UnderlineStyle = 'sng' | 'dbl' | 'heavy' | 'dotted' | 'dottedHeavy' | 'dash' | 'dashHeavy' | 'dashLong' | 'dashLongHeavy' | 'dotDash' | 'dotDashHeavy' | 'dotDotDash' | 'dotDotDashHeavy' | 'wavy' | 'wavyHeavy' | 'wavyDbl' | 'none';
|
|
21
|
+
/**
|
|
22
|
+
* Connector connection point reference — links a connector endpoint to a
|
|
23
|
+
* specific shape on the slide.
|
|
24
|
+
*
|
|
25
|
+
* When both `shapeId` and `connectionSiteIndex` are set, the connector
|
|
26
|
+
* end snaps to that shapes’s connection site and “follows” the shape when
|
|
27
|
+
* it is moved.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const start: ConnectorConnectionPoint = {
|
|
32
|
+
* shapeId: "shape_1",
|
|
33
|
+
* connectionSiteIndex: 2,
|
|
34
|
+
* };
|
|
35
|
+
* // => { shapeId: "shape_1", connectionSiteIndex: 2 } satisfies ConnectorConnectionPoint
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
interface ConnectorConnectionPoint {
|
|
39
|
+
/** ID of the shape this connector endpoint is attached to. */
|
|
40
|
+
shapeId?: string;
|
|
41
|
+
/** Connection site index on the target shape (0-based). */
|
|
42
|
+
connectionSiteIndex?: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Arrow head types for connector start/end.
|
|
46
|
+
*
|
|
47
|
+
* Maps to `a:headEnd/@type` and `a:tailEnd/@type` in OOXML.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const arrow: ConnectorArrowType = "triangle";
|
|
52
|
+
* // => "triangle" — one of: none | triangle | stealth | diamond | oval | arrow
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
type ConnectorArrowType = 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
|
|
56
|
+
/**
|
|
57
|
+
* Stroke dash pattern types for lines and shape outlines.
|
|
58
|
+
*
|
|
59
|
+
* Maps to `a:ln/a:prstDash/@val` in OOXML. Use `"custom"` for
|
|
60
|
+
* user-defined dash/space arrays.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const dash: StrokeDashType = "dashDot";
|
|
65
|
+
* // => "dashDot" — one of: solid | dot | dash | lgDash | dashDot | custom | ...
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
type StrokeDashType = 'solid' | 'dot' | 'dash' | 'lgDash' | 'dashDot' | 'lgDashDot' | 'lgDashDotDot' | 'sysDot' | 'sysDash' | 'sysDashDot' | 'sysDashDotDot' | 'custom';
|
|
69
|
+
/**
|
|
70
|
+
* Shadow effect properties for a single shadow layer.
|
|
71
|
+
*
|
|
72
|
+
* Represents parsed values from an `<a:outerShdw>` node. Multiple instances
|
|
73
|
+
* can be stored in {@link ShapeStyle.shadows} for compound shadow effects.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const shadow: ShadowEffect = {
|
|
78
|
+
* color: "#000000",
|
|
79
|
+
* opacity: 0.4,
|
|
80
|
+
* blur: 6,
|
|
81
|
+
* angle: 315,
|
|
82
|
+
* distance: 4,
|
|
83
|
+
* };
|
|
84
|
+
* // => { color: "#000000", opacity: 0.4, blur: 6, angle: 315, distance: 4 } satisfies ShadowEffect
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
interface ShadowEffect {
|
|
88
|
+
/** Shadow color as hex string. */
|
|
89
|
+
color: string;
|
|
90
|
+
/** Shadow opacity (0-1). */
|
|
91
|
+
opacity: number;
|
|
92
|
+
/** Blur radius in pixels. */
|
|
93
|
+
blur: number;
|
|
94
|
+
/** Shadow angle in degrees (0-360). */
|
|
95
|
+
angle: number;
|
|
96
|
+
/** Shadow distance in pixels. */
|
|
97
|
+
distance: number;
|
|
98
|
+
/** Whether shadow rotates with shape. */
|
|
99
|
+
rotateWithShape?: boolean;
|
|
100
|
+
}
|
|
101
|
+
type XmlObject = Record<string, any>;
|
|
102
|
+
/**
|
|
103
|
+
* Discriminant values for the `type` field on {@link PptxElement}.
|
|
104
|
+
*
|
|
105
|
+
* Narrow on this type to access variant-specific properties.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* function isImage(el: PptxElement): el is ImagePptxElement {
|
|
110
|
+
* return el.type === "image";
|
|
111
|
+
* }
|
|
112
|
+
* // => type guard narrowing PptxElement to ImagePptxElement
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
type PptxElementType = 'text' | 'shape' | 'connector' | 'image' | 'picture' | 'chart' | 'table' | 'smartArt' | 'ole' | 'media' | 'group' | 'ink' | 'zoom' | 'unknown';
|
|
116
|
+
/**
|
|
117
|
+
* Shape lock attributes from `p:cNvSpPr / a:spLocks`.
|
|
118
|
+
*
|
|
119
|
+
* When a flag is `true` the corresponding user interaction is disabled
|
|
120
|
+
* in the editor (e.g. `noRotation` prevents free rotation of the shape).
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* const locks: PptxShapeLocks = { noMove: true, noResize: true };
|
|
125
|
+
* // => { noMove: true, noResize: true } satisfies PptxShapeLocks
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
interface PptxShapeLocks {
|
|
129
|
+
noGrouping?: boolean;
|
|
130
|
+
noRotation?: boolean;
|
|
131
|
+
noMove?: boolean;
|
|
132
|
+
noResize?: boolean;
|
|
133
|
+
noTextEdit?: boolean;
|
|
134
|
+
noSelect?: boolean;
|
|
135
|
+
noChangeAspect?: boolean;
|
|
136
|
+
noEditPoints?: boolean;
|
|
137
|
+
noAdjustHandles?: boolean;
|
|
138
|
+
noChangeArrowheads?: boolean;
|
|
139
|
+
noChangeShapeType?: boolean;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* A drawing guide parsed from OOXML extension lists.
|
|
143
|
+
*
|
|
144
|
+
* Slide-level and presentation-level guides are shown as thin coloured
|
|
145
|
+
* lines that help users align elements.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* const guide: PptxDrawingGuide = {
|
|
150
|
+
* id: "g1",
|
|
151
|
+
* orientation: "horz",
|
|
152
|
+
* positionEmu: 457200,
|
|
153
|
+
* color: "#FF0000",
|
|
154
|
+
* };
|
|
155
|
+
* // => { id: "g1", orientation: "horz", positionEmu: 457200, color: "#FF0000" } satisfies PptxDrawingGuide
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
interface PptxDrawingGuide {
|
|
159
|
+
/** Unique identifier (from `@_id` attribute or generated). */
|
|
160
|
+
id: string;
|
|
161
|
+
/** Orientation: horizontal or vertical. */
|
|
162
|
+
orientation: 'horz' | 'vert';
|
|
163
|
+
/** Position in EMU (converted from pos attribute). */
|
|
164
|
+
positionEmu: number;
|
|
165
|
+
/** Optional guide colour as hex string (e.g. "#FF0000"). */
|
|
166
|
+
color?: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 3-D effect properties, text warp (WordArt) presets, and scene/shape bevel
|
|
171
|
+
* definitions parsed from OOXML `a:sp3d`, `a:scene3d`, and `a:bodyPr/a:prstTxWarp`.
|
|
172
|
+
*
|
|
173
|
+
* @module pptx-types/three-d
|
|
174
|
+
*/
|
|
175
|
+
/**
|
|
176
|
+
* Bevel preset type tokens from OOXML `a:bevelT/@prst` / `a:bevelB/@prst`.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* const bevel: BevelPresetType = "circle";
|
|
181
|
+
* // => "circle" — one of: "circle" | "relaxedInset" | "cross" | "coolSlant" | "angle" | …
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
type BevelPresetType = 'circle' | 'relaxedInset' | 'cross' | 'coolSlant' | 'angle' | 'softRound' | 'convex' | 'slope' | 'divot' | 'riblet' | 'hardEdge' | 'artDeco' | 'none';
|
|
185
|
+
/**
|
|
186
|
+
* Material preset type tokens from OOXML `a:sp3d/@prstMaterial`.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* const mat: MaterialPresetType = "plastic";
|
|
191
|
+
* // => "plastic" — one of: "matte" | "warmMatte" | "plastic" | "metal" | "dkEdge" | …
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
type MaterialPresetType = 'matte' | 'warmMatte' | 'plastic' | 'metal' | 'dkEdge' | 'softEdge' | 'flat' | 'softmetal' | 'clear' | 'powder' | 'translucentPowder';
|
|
195
|
+
/**
|
|
196
|
+
* 3D text body extrusion/bevel from `a:bodyPr/a:sp3d`.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* const text3d: Text3DStyle = {
|
|
201
|
+
* extrusionHeight: 57150,
|
|
202
|
+
* presetMaterial: "plastic",
|
|
203
|
+
* bevelTopType: "circle",
|
|
204
|
+
* bevelTopWidth: 25400,
|
|
205
|
+
* bevelTopHeight: 25400,
|
|
206
|
+
* };
|
|
207
|
+
* // => satisfies Text3DStyle
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
interface Text3DStyle {
|
|
211
|
+
/** Extrusion height (depth) in EMU. */
|
|
212
|
+
extrusionHeight?: number;
|
|
213
|
+
/** Extrusion colour as hex string. */
|
|
214
|
+
extrusionColor?: string;
|
|
215
|
+
/** Preset material, e.g. "matte", "plastic", "metal". */
|
|
216
|
+
presetMaterial?: MaterialPresetType;
|
|
217
|
+
/** Top bevel preset type. */
|
|
218
|
+
bevelTopType?: BevelPresetType;
|
|
219
|
+
/** Top bevel width in EMU. */
|
|
220
|
+
bevelTopWidth?: number;
|
|
221
|
+
/** Top bevel height in EMU. */
|
|
222
|
+
bevelTopHeight?: number;
|
|
223
|
+
/** Bottom bevel preset type. */
|
|
224
|
+
bevelBottomType?: BevelPresetType;
|
|
225
|
+
/** Bottom bevel width in EMU. */
|
|
226
|
+
bevelBottomWidth?: number;
|
|
227
|
+
/** Bottom bevel height in EMU. */
|
|
228
|
+
bevelBottomHeight?: number;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 3D scene/camera properties from `a:scene3d`.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* const scene: Pptx3DScene = {
|
|
236
|
+
* cameraPreset: "perspectiveFront",
|
|
237
|
+
* lightRigType: "threePt",
|
|
238
|
+
* lightRigDirection: "t",
|
|
239
|
+
* };
|
|
240
|
+
* // => satisfies Pptx3DScene
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
interface Pptx3DScene {
|
|
244
|
+
/** Camera preset type, e.g. "orthographicFront", "perspectiveFront". */
|
|
245
|
+
cameraPreset?: string;
|
|
246
|
+
/** Camera rotation around X axis in 1/60000 degrees. */
|
|
247
|
+
cameraRotX?: number;
|
|
248
|
+
/** Camera rotation around Y axis in 1/60000 degrees. */
|
|
249
|
+
cameraRotY?: number;
|
|
250
|
+
/** Camera rotation around Z axis in 1/60000 degrees. */
|
|
251
|
+
cameraRotZ?: number;
|
|
252
|
+
/** Light rig type, e.g. "threePt", "balanced", "harsh". */
|
|
253
|
+
lightRigType?: string;
|
|
254
|
+
/** Light rig direction, e.g. "t", "b", "l", "r", "tl". */
|
|
255
|
+
lightRigDirection?: string;
|
|
256
|
+
/** Whether a 3D backdrop plane is present (`a:backdrop`). */
|
|
257
|
+
hasBackdrop?: boolean;
|
|
258
|
+
/** Backdrop plane anchor X in EMU. */
|
|
259
|
+
backdropAnchorX?: number;
|
|
260
|
+
/** Backdrop plane anchor Y in EMU. */
|
|
261
|
+
backdropAnchorY?: number;
|
|
262
|
+
/** Backdrop plane anchor Z in EMU. */
|
|
263
|
+
backdropAnchorZ?: number;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* 3D shape extrusion/bevel from `a:sp3d`.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* const shape3d: Pptx3DShape = {
|
|
271
|
+
* extrusionHeight: 76200,
|
|
272
|
+
* extrusionColor: "#4F81BD",
|
|
273
|
+
* presetMaterial: "metal",
|
|
274
|
+
* bevelTopType: "circle",
|
|
275
|
+
* bevelTopWidth: 12700,
|
|
276
|
+
* bevelTopHeight: 12700,
|
|
277
|
+
* };
|
|
278
|
+
* // => satisfies Pptx3DShape
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
interface Pptx3DShape {
|
|
282
|
+
/** Extrusion height in EMU. */
|
|
283
|
+
extrusionHeight?: number;
|
|
284
|
+
/** Extrusion colour. */
|
|
285
|
+
extrusionColor?: string;
|
|
286
|
+
/** Contour width in EMU. */
|
|
287
|
+
contourWidth?: number;
|
|
288
|
+
/** Contour colour. */
|
|
289
|
+
contourColor?: string;
|
|
290
|
+
/** Preset material, e.g. "matte", "warmMatte", "metal". */
|
|
291
|
+
presetMaterial?: string;
|
|
292
|
+
/** Top bevel type, e.g. "circle", "relaxedInset". */
|
|
293
|
+
bevelTopType?: string;
|
|
294
|
+
/** Top bevel width in EMU. */
|
|
295
|
+
bevelTopWidth?: number;
|
|
296
|
+
/** Top bevel height in EMU. */
|
|
297
|
+
bevelTopHeight?: number;
|
|
298
|
+
/** Bottom bevel type, e.g. "circle", "relaxedInset". */
|
|
299
|
+
bevelBottomType?: string;
|
|
300
|
+
/** Bottom bevel width in EMU. */
|
|
301
|
+
bevelBottomWidth?: number;
|
|
302
|
+
/** Bottom bevel height in EMU. */
|
|
303
|
+
bevelBottomHeight?: number;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Known OOXML preset text warp types (WordArt transforms).
|
|
307
|
+
*
|
|
308
|
+
* Falls back to `string` for unknown presets not yet catalogued.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```ts
|
|
312
|
+
* const warp: PptxTextWarpPreset = "textArchUp";
|
|
313
|
+
* // => "textArchUp" — one of: "textNoShape" | "textPlain" | "textStop" | "textArchUp" | …
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
type PptxTextWarpPreset = 'textNoShape' | 'textPlain' | 'textStop' | 'textTriangle' | 'textTriangleInverted' | 'textChevron' | 'textChevronInverted' | 'textRingInside' | 'textRingOutside' | 'textArchUp' | 'textArchDown' | 'textCircle' | 'textButton' | 'textArchUpPour' | 'textArchDownPour' | 'textCirclePour' | 'textButtonPour' | 'textCurveUp' | 'textCurveDown' | 'textCanUp' | 'textCanDown' | 'textWave1' | 'textWave2' | 'textWave4' | 'textDoubleWave1' | 'textInflate' | 'textDeflate' | 'textInflateBottom' | 'textDeflateBottom' | 'textInflateTop' | 'textDeflateTop' | 'textFadeRight' | 'textFadeLeft' | 'textFadeUp' | 'textFadeDown' | 'textSlantUp' | 'textSlantDown' | 'textCascadeUp' | 'textCascadeDown' | 'textDeflateInflate' | 'textDeflateInflateDeflate' | string;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Text-related types: rich text styles, bullet metadata, and text segments.
|
|
320
|
+
*
|
|
321
|
+
* These types model the contents of `<a:r>`, `<a:rPr>`, `<a:pPr>`,
|
|
322
|
+
* and `<a:bodyPr>` nodes from the OpenXML Drawing namespace.
|
|
323
|
+
*
|
|
324
|
+
* @module pptx-types/text
|
|
325
|
+
*/
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Rich text style properties for a text run or paragraph.
|
|
329
|
+
*
|
|
330
|
+
* Combines character-level formatting (font, bold, colour …),
|
|
331
|
+
* paragraph-level controls (alignment, spacing, indentation), and
|
|
332
|
+
* body-level properties (autofit, insets, text direction). All
|
|
333
|
+
* fields are optional — unset properties inherit from layout/master
|
|
334
|
+
* placeholders or theme defaults.
|
|
335
|
+
*
|
|
336
|
+
* @remarks
|
|
337
|
+
* Font sizes are stored in **points**. Spatial measurements (insets,
|
|
338
|
+
* margins) are in **pixels** (pre-converted from EMU during parsing).
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* const heading: TextStyle = {
|
|
343
|
+
* fontFamily: "Montserrat",
|
|
344
|
+
* fontSize: 36,
|
|
345
|
+
* bold: true,
|
|
346
|
+
* color: "#1A1A2E",
|
|
347
|
+
* align: "center",
|
|
348
|
+
* lineSpacing: 1.15,
|
|
349
|
+
* };
|
|
350
|
+
*
|
|
351
|
+
* const body: TextStyle = {
|
|
352
|
+
* fontFamily: "Open Sans",
|
|
353
|
+
* fontSize: 14,
|
|
354
|
+
* color: "#444444",
|
|
355
|
+
* align: "left",
|
|
356
|
+
* paragraphSpacingAfter: 8,
|
|
357
|
+
* };
|
|
358
|
+
* // => both satisfy the TextStyle interface
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
interface TextStyle {
|
|
362
|
+
fontFamily?: string;
|
|
363
|
+
fontSize?: number;
|
|
364
|
+
/** When true, renderer should shrink text to fit the shape bounds. */
|
|
365
|
+
autoFit?: boolean;
|
|
366
|
+
/** Explicit autofit mode from OOXML body properties.
|
|
367
|
+
* - 'shrink': `a:spAutoFit` — shrink text on overflow
|
|
368
|
+
* - 'normal': `a:normAutofit` — normal auto-fit (with optional fontScale)
|
|
369
|
+
* - 'none': `a:noAutofit` — explicitly no auto-fit (text overflows)
|
|
370
|
+
* - undefined: no autofit element present (inherit from layout/master)
|
|
371
|
+
*/
|
|
372
|
+
autoFitMode?: 'shrink' | 'normal' | 'none';
|
|
373
|
+
/** Font scale percentage for normAutofit (e.g. 0.9 = 90%). Only meaningful when autoFit is true. */
|
|
374
|
+
autoFitFontScale?: number;
|
|
375
|
+
/** Line spacing reduction for normAutofit (e.g. 0.2 = reduce by 20%). Only meaningful when autoFit is true. */
|
|
376
|
+
autoFitLineSpacingReduction?: number;
|
|
377
|
+
bold?: boolean;
|
|
378
|
+
italic?: boolean;
|
|
379
|
+
underline?: boolean;
|
|
380
|
+
/** Specific underline style (e.g. "sng", "dbl", "wavy"). Falls back to "sng" when `underline` is true. */
|
|
381
|
+
underlineStyle?: UnderlineStyle;
|
|
382
|
+
/** Underline colour as hex string (`a:uFill` / `a:uLn`). When absent, inherits text colour. */
|
|
383
|
+
underlineColor?: string;
|
|
384
|
+
strikethrough?: boolean;
|
|
385
|
+
/** Specific strike type: single or double from `a:rPr/@strike`. */
|
|
386
|
+
strikeType?: 'sngStrike' | 'dblStrike';
|
|
387
|
+
/** Text outline width in px (`a:rPr > a:ln/@w` in EMU). */
|
|
388
|
+
textOutlineWidth?: number;
|
|
389
|
+
/** Text outline colour as hex string (`a:rPr > a:ln > a:solidFill`). */
|
|
390
|
+
textOutlineColor?: string;
|
|
391
|
+
/** When true, the text body has no fill (`a:rPr > a:noFill`), producing hollow/outline-only text. */
|
|
392
|
+
textFillNone?: boolean;
|
|
393
|
+
/** Superscript/subscript baseline shift as percentage (`a:rPr/@baseline`). Positive = super, negative = sub. */
|
|
394
|
+
baseline?: number;
|
|
395
|
+
/** Character spacing in hundredths of a point (`a:rPr/@spc`). */
|
|
396
|
+
characterSpacing?: number;
|
|
397
|
+
/** Kerning threshold in hundredths of a point (`a:rPr/@kern`). 0 = none. */
|
|
398
|
+
kerning?: number;
|
|
399
|
+
/** Text highlight colour as hex string (`a:highlight`). */
|
|
400
|
+
highlightColor?: string;
|
|
401
|
+
/** Text-level gradient fill CSS string (from `a:rPr > a:gradFill`). */
|
|
402
|
+
textFillGradient?: string;
|
|
403
|
+
/** Structured gradient stops for text fill round-trip serialization. */
|
|
404
|
+
textFillGradientStops?: Array<{
|
|
405
|
+
color: string;
|
|
406
|
+
position: number;
|
|
407
|
+
opacity?: number;
|
|
408
|
+
}>;
|
|
409
|
+
/** Gradient angle in degrees for text fill round-trip. */
|
|
410
|
+
textFillGradientAngle?: number;
|
|
411
|
+
/** Gradient type for text fill round-trip ('linear' | 'radial'). */
|
|
412
|
+
textFillGradientType?: 'linear' | 'radial';
|
|
413
|
+
/** Text-level pattern fill preset (from `a:rPr > a:pattFill`). */
|
|
414
|
+
textFillPattern?: string;
|
|
415
|
+
/** Text-level pattern foreground colour. */
|
|
416
|
+
textFillPatternForeground?: string;
|
|
417
|
+
/** Text-level pattern background colour. */
|
|
418
|
+
textFillPatternBackground?: string;
|
|
419
|
+
hyperlink?: string;
|
|
420
|
+
/** Relationship ID for the hyperlink (`a:hlinkClick/@r:id`) — preserved for round-trip serialization. */
|
|
421
|
+
hyperlinkRId?: string;
|
|
422
|
+
/** Hyperlink tooltip text (`a:hlinkClick/@tooltip`). */
|
|
423
|
+
hyperlinkTooltip?: string;
|
|
424
|
+
/** Hyperlink action type (`a:hlinkClick/@action`). */
|
|
425
|
+
hyperlinkAction?: string;
|
|
426
|
+
/** Whether the hyperlink target is an internal slide jump (targetSlideIndex style). */
|
|
427
|
+
hyperlinkTargetSlideIndex?: number;
|
|
428
|
+
color?: string;
|
|
429
|
+
align?: 'left' | 'center' | 'right' | 'justify' | 'justLow' | 'dist' | 'thaiDist';
|
|
430
|
+
vAlign?: 'top' | 'middle' | 'bottom';
|
|
431
|
+
/** Right-to-left paragraph/run direction (`a:pPr/@rtl`, `a:rPr/@rtl`). */
|
|
432
|
+
rtl?: boolean;
|
|
433
|
+
/** Body text direction (`a:bodyPr/@vert`).
|
|
434
|
+
*
|
|
435
|
+
* Values map to OOXML `a:bodyPr/@vert` attribute values:
|
|
436
|
+
* - `"horizontal"` — default horizontal text (`horz`)
|
|
437
|
+
* - `"vertical"` — standard vertical text, right-to-left columns (`vert`)
|
|
438
|
+
* - `"vertical270"` — text rotated 270 degrees (`vert270`)
|
|
439
|
+
* - `"eaVert"` — East Asian vertical text with CJK glyphs upright (`eaVert`)
|
|
440
|
+
* - `"wordArtVert"` — WordArt vertical, each character upright stacked (`wordArtVert`)
|
|
441
|
+
* - `"wordArtVertRtl"` — WordArt vertical, right-to-left direction (`wordArtVertRtl`)
|
|
442
|
+
* - `"mongolianVert"` — Mongolian vertical text, left-to-right columns (`mongolianVert`)
|
|
443
|
+
*/
|
|
444
|
+
textDirection?: 'horizontal' | 'vertical' | 'vertical270' | 'eaVert' | 'wordArtVert' | 'wordArtVertRtl' | 'mongolianVert';
|
|
445
|
+
/** Body column count (`a:bodyPr/@numCol`). */
|
|
446
|
+
columnCount?: number;
|
|
447
|
+
/** Column spacing in px (`a:bodyPr/@spcCol` in EMU). */
|
|
448
|
+
columnSpacing?: number;
|
|
449
|
+
/** Horizontal overflow mode from `a:bodyPr/@hOverflow`. */
|
|
450
|
+
hOverflow?: 'overflow' | 'clip';
|
|
451
|
+
/** Vertical overflow mode from `a:bodyPr/@vertOverflow`. */
|
|
452
|
+
vertOverflow?: 'overflow' | 'clip' | 'ellipsis';
|
|
453
|
+
/** Body text left inset in px (`a:bodyPr/@lIns` in EMU). */
|
|
454
|
+
bodyInsetLeft?: number;
|
|
455
|
+
/** Body text top inset in px (`a:bodyPr/@tIns` in EMU). */
|
|
456
|
+
bodyInsetTop?: number;
|
|
457
|
+
/** Body text right inset in px (`a:bodyPr/@rIns` in EMU). */
|
|
458
|
+
bodyInsetRight?: number;
|
|
459
|
+
/** Body text bottom inset in px (`a:bodyPr/@bIns` in EMU). */
|
|
460
|
+
bodyInsetBottom?: number;
|
|
461
|
+
/** Paragraph spacing before in px. */
|
|
462
|
+
paragraphSpacingBefore?: number;
|
|
463
|
+
/** Paragraph spacing after in px. */
|
|
464
|
+
paragraphSpacingAfter?: number;
|
|
465
|
+
/** Line spacing multiplier (e.g. 1.2 = 120%). Used when mode is proportional (spcPct). */
|
|
466
|
+
lineSpacing?: number;
|
|
467
|
+
/** Exact line spacing in points (from `a:lnSpc > a:spcPts`). Takes priority over `lineSpacing` when set. */
|
|
468
|
+
lineSpacingExactPt?: number;
|
|
469
|
+
/** Paragraph left margin in px (`a:pPr/@marL` in EMU). */
|
|
470
|
+
paragraphMarginLeft?: number;
|
|
471
|
+
/** Paragraph right margin in px (`a:pPr/@marR` in EMU). */
|
|
472
|
+
paragraphMarginRight?: number;
|
|
473
|
+
/** Paragraph first-line indent in px (`a:pPr/@indent` in EMU). */
|
|
474
|
+
paragraphIndent?: number;
|
|
475
|
+
/** Tab stop positions and alignments (`a:pPr/a:tabLst/a:tab`). */
|
|
476
|
+
tabStops?: Array<{
|
|
477
|
+
position: number;
|
|
478
|
+
align: 'l' | 'ctr' | 'r' | 'dec';
|
|
479
|
+
leader?: 'none' | 'dot' | 'hyphen' | 'underscore';
|
|
480
|
+
}>;
|
|
481
|
+
/** Body text wrapping mode from `a:bodyPr/@wrap`. */
|
|
482
|
+
textWrap?: 'square' | 'none';
|
|
483
|
+
/** Preset text warp type from `a:bodyPr/a:prstTxWarp`. */
|
|
484
|
+
textWarpPreset?: PptxTextWarpPreset;
|
|
485
|
+
/** Primary adjustment value for text warp (from `a:prstTxWarp/a:avLst/a:gd` with name "adj").
|
|
486
|
+
* Stored as raw OOXML 1/60000th units (e.g. 50000 = default for many presets). */
|
|
487
|
+
textWarpAdj?: number;
|
|
488
|
+
/** Secondary adjustment value for text warp (from `a:prstTxWarp/a:avLst/a:gd` with name "adj2").
|
|
489
|
+
* Stored as raw OOXML 1/60000th units. */
|
|
490
|
+
textWarpAdj2?: number;
|
|
491
|
+
/** Text capitalization style from `a:rPr/@cap`. */
|
|
492
|
+
textCaps?: 'all' | 'small' | 'none';
|
|
493
|
+
/** Symbol font family from `a:sym`. */
|
|
494
|
+
symbolFont?: string;
|
|
495
|
+
/** East Asian font family from `a:ea`. */
|
|
496
|
+
eastAsiaFont?: string;
|
|
497
|
+
/** Complex Script font family from `a:cs`. */
|
|
498
|
+
complexScriptFont?: string;
|
|
499
|
+
/** Text language from `a:rPr/@lang`. */
|
|
500
|
+
language?: string;
|
|
501
|
+
/** Hyperlink mouse-over target from `a:hlinkMouseOver`. */
|
|
502
|
+
hyperlinkMouseOver?: string;
|
|
503
|
+
/** Hyperlink invalidUrl attribute (`a:hlinkClick/@invalidUrl`). */
|
|
504
|
+
hyperlinkInvalidUrl?: string;
|
|
505
|
+
/** Hyperlink target frame (`a:hlinkClick/@tgtFrame`). */
|
|
506
|
+
hyperlinkTargetFrame?: string;
|
|
507
|
+
/** Whether hyperlink history is tracked (`a:hlinkClick/@history`). */
|
|
508
|
+
hyperlinkHistory?: boolean;
|
|
509
|
+
/** Whether hyperlink uses highlight-click effect (`a:hlinkClick/@highlightClick`). */
|
|
510
|
+
hyperlinkHighlightClick?: boolean;
|
|
511
|
+
/** Whether hyperlink ends a sound (`a:hlinkClick/@endSnd`). */
|
|
512
|
+
hyperlinkEndSound?: boolean;
|
|
513
|
+
/** Kumimoji (ideographic text combining) flag for vertical CJK text (`a:rPr/@kumimoji`). */
|
|
514
|
+
kumimoji?: boolean;
|
|
515
|
+
/** Normalize height flag (`a:rPr/@normalizeH`). */
|
|
516
|
+
normalizeHeight?: boolean;
|
|
517
|
+
/** No proofing flag (`a:rPr/@noProof`). */
|
|
518
|
+
noProof?: boolean;
|
|
519
|
+
/** Dirty flag indicating run has been edited (`a:rPr/@dirty`). */
|
|
520
|
+
dirty?: boolean;
|
|
521
|
+
/** Error flag indicating spelling error (`a:rPr/@err`). */
|
|
522
|
+
spellingError?: boolean;
|
|
523
|
+
/** Smart tag clean flag (`a:rPr/@smtClean`). */
|
|
524
|
+
smartTagClean?: boolean;
|
|
525
|
+
/** Bookmark link target (`a:rPr/@bmk`). */
|
|
526
|
+
bookmark?: string;
|
|
527
|
+
/** Default tab size in px (`a:pPr/@defTabSz` in EMU). */
|
|
528
|
+
defaultTabSize?: number;
|
|
529
|
+
/** East Asian line break flag (`a:pPr/@eaLnBrk`). */
|
|
530
|
+
eaLineBreak?: boolean;
|
|
531
|
+
/** Latin line break flag (`a:pPr/@latinLnBrk`). */
|
|
532
|
+
latinLineBreak?: boolean;
|
|
533
|
+
/** Font alignment (`a:pPr/@fontAlgn`): 'auto' | 'base' | 'ctr' | 't' | 'b'. */
|
|
534
|
+
fontAlignment?: string;
|
|
535
|
+
/** Hanging punctuation flag (`a:pPr/@hangingPunct`). */
|
|
536
|
+
hangingPunctuation?: boolean;
|
|
537
|
+
/** Whether to space first and last paragraph from body edges (`a:bodyPr/@spcFirstLastPara`). */
|
|
538
|
+
spaceFirstLastParagraph?: boolean;
|
|
539
|
+
/** Right-to-left column flow (`a:bodyPr/@rtlCol`). */
|
|
540
|
+
rtlColumns?: boolean;
|
|
541
|
+
/** Whether text originates from WordArt (`a:bodyPr/@fromWordArt`). */
|
|
542
|
+
fromWordArt?: boolean;
|
|
543
|
+
/** Whether text anchoring is centered (`a:bodyPr/@anchorCtr`). */
|
|
544
|
+
anchorCenter?: boolean;
|
|
545
|
+
/** Force anti-aliasing (`a:bodyPr/@forceAA`). */
|
|
546
|
+
forceAntiAlias?: boolean;
|
|
547
|
+
/** Upright text in 3D views (`a:bodyPr/@upright`). */
|
|
548
|
+
upright?: boolean;
|
|
549
|
+
/** Compatible line spacing flag (`a:bodyPr/@compatLnSpc`). */
|
|
550
|
+
compatibleLineSpacing?: boolean;
|
|
551
|
+
/** Text shadow colour as hex string (`a:outerShdw`). */
|
|
552
|
+
textShadowColor?: string;
|
|
553
|
+
/** Text shadow blur radius in px. */
|
|
554
|
+
textShadowBlur?: number;
|
|
555
|
+
/** Text shadow horizontal offset in px. */
|
|
556
|
+
textShadowOffsetX?: number;
|
|
557
|
+
/** Text shadow vertical offset in px. */
|
|
558
|
+
textShadowOffsetY?: number;
|
|
559
|
+
/** Text shadow opacity (0-1). */
|
|
560
|
+
textShadowOpacity?: number;
|
|
561
|
+
/** Text inner shadow colour (`a:innerShdw`). */
|
|
562
|
+
textInnerShadowColor?: string;
|
|
563
|
+
/** Text inner shadow opacity (0-1). */
|
|
564
|
+
textInnerShadowOpacity?: number;
|
|
565
|
+
/** Text inner shadow blur radius in px. */
|
|
566
|
+
textInnerShadowBlur?: number;
|
|
567
|
+
/** Text inner shadow horizontal offset in px. */
|
|
568
|
+
textInnerShadowOffsetX?: number;
|
|
569
|
+
/** Text inner shadow vertical offset in px. */
|
|
570
|
+
textInnerShadowOffsetY?: number;
|
|
571
|
+
/** Preset shadow type from `a:prstShdw/@prst` (e.g. "shdw1"..."shdw20"). */
|
|
572
|
+
textPresetShadowName?: string;
|
|
573
|
+
/** Preset shadow colour as hex string. */
|
|
574
|
+
textPresetShadowColor?: string;
|
|
575
|
+
/** Preset shadow opacity (0-1). */
|
|
576
|
+
textPresetShadowOpacity?: number;
|
|
577
|
+
/** Preset shadow distance in px. */
|
|
578
|
+
textPresetShadowDistance?: number;
|
|
579
|
+
/** Preset shadow direction in degrees. */
|
|
580
|
+
textPresetShadowDirection?: number;
|
|
581
|
+
/** Text blur effect radius in px (`a:blur`). */
|
|
582
|
+
textBlurRadius?: number;
|
|
583
|
+
/** Text alpha modulation fixed (0-100) from `a:alphaModFix`. */
|
|
584
|
+
textAlphaModFix?: number;
|
|
585
|
+
/** Text alpha modulation from `a:alphaMod` (0-100 percentage). */
|
|
586
|
+
textAlphaMod?: number;
|
|
587
|
+
/** Text hue shift in degrees from `a:hsl/@hue`. */
|
|
588
|
+
textHslHue?: number;
|
|
589
|
+
/** Text saturation adjustment from `a:hsl/@sat`. */
|
|
590
|
+
textHslSaturation?: number;
|
|
591
|
+
/** Text luminance adjustment from `a:hsl/@lum`. */
|
|
592
|
+
textHslLuminance?: number;
|
|
593
|
+
/** Text colour change from colour as hex string (`a:clrChange`). */
|
|
594
|
+
textClrChangeFrom?: string;
|
|
595
|
+
/** Text colour change to colour as hex string. */
|
|
596
|
+
textClrChangeTo?: string;
|
|
597
|
+
/** Text duotone colour pair (`a:duotone`). */
|
|
598
|
+
textDuotone?: {
|
|
599
|
+
color1: string;
|
|
600
|
+
color2: string;
|
|
601
|
+
};
|
|
602
|
+
/** Text glow colour as hex string (`a:glow`). */
|
|
603
|
+
textGlowColor?: string;
|
|
604
|
+
/** Text glow radius in px. */
|
|
605
|
+
textGlowRadius?: number;
|
|
606
|
+
/** Text glow opacity (0-1). */
|
|
607
|
+
textGlowOpacity?: number;
|
|
608
|
+
/** Text reflection enabled flag. */
|
|
609
|
+
textReflection?: boolean;
|
|
610
|
+
/** Text reflection blur radius in px. */
|
|
611
|
+
textReflectionBlur?: number;
|
|
612
|
+
/** Text reflection start opacity (0-1). */
|
|
613
|
+
textReflectionStartOpacity?: number;
|
|
614
|
+
/** Text reflection end opacity (0-1). */
|
|
615
|
+
textReflectionEndOpacity?: number;
|
|
616
|
+
/** Text reflection offset distance in px. */
|
|
617
|
+
textReflectionOffset?: number;
|
|
618
|
+
/** 3D extrusion/bevel settings on the text body. */
|
|
619
|
+
text3d?: Text3DStyle;
|
|
620
|
+
/** 3D scene (camera + light rig) settings on the text body (`a:bodyPr/a:scene3d`). */
|
|
621
|
+
textBodyScene3d?: Pptx3DScene;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Structured bullet metadata attached to the first {@link TextSegment}
|
|
625
|
+
* of each paragraph.
|
|
626
|
+
*
|
|
627
|
+
* Describes how the paragraph bullet should render: character bullets
|
|
628
|
+
* (`char`), auto-numbered lists (`autoNumType`), or picture bullets
|
|
629
|
+
* (`imageRelId` / `imageDataUrl`). Set `none: true` when `a:buNone`
|
|
630
|
+
* explicitly suppresses the bullet.
|
|
631
|
+
*
|
|
632
|
+
* @example
|
|
633
|
+
* ```ts
|
|
634
|
+
* // Simple character bullet:
|
|
635
|
+
* const bullet: BulletInfo = { char: "•", color: "#333333" };
|
|
636
|
+
*
|
|
637
|
+
* // Auto-numbered list starting at 1:
|
|
638
|
+
* const numbered: BulletInfo = {
|
|
639
|
+
* autoNumType: "arabicPeriod",
|
|
640
|
+
* autoNumStartAt: 1,
|
|
641
|
+
* };
|
|
642
|
+
* // => { char: "•", color: "#333333" } and { autoNumType: "arabicPeriod", autoNumStartAt: 1 }
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
interface BulletInfo {
|
|
646
|
+
/** Bullet character (e.g. "•", "-", "»") from `a:buChar`. */
|
|
647
|
+
char?: string;
|
|
648
|
+
/** Auto-numbering type (e.g. "arabicPeriod", "romanUcPeriod") from `a:buAutoNum`. */
|
|
649
|
+
autoNumType?: string;
|
|
650
|
+
/** Auto-numbering start value. */
|
|
651
|
+
autoNumStartAt?: number;
|
|
652
|
+
/** Zero-based paragraph index within the text body (for auto-numbering). */
|
|
653
|
+
paragraphIndex?: number;
|
|
654
|
+
/** Bullet font family from `a:buFont`. */
|
|
655
|
+
fontFamily?: string;
|
|
656
|
+
/** Bullet size as percentage of text font size from `a:buSzPct`. */
|
|
657
|
+
sizePercent?: number;
|
|
658
|
+
/** Bullet size in points from `a:buSzPts`. */
|
|
659
|
+
sizePts?: number;
|
|
660
|
+
/** Bullet color as hex string from `a:buClr`. */
|
|
661
|
+
color?: string;
|
|
662
|
+
/** True when `a:buNone` explicitly suppresses bullets. */
|
|
663
|
+
none?: boolean;
|
|
664
|
+
/** Picture bullet: relationship ID from `a:buBlip` → `a:blip[@r:embed]`. */
|
|
665
|
+
imageRelId?: string;
|
|
666
|
+
/** Picture bullet: data URL of the embedded image. */
|
|
667
|
+
imageDataUrl?: string;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* A single text run within a paragraph.
|
|
671
|
+
*
|
|
672
|
+
* A text body is decomposed into an array of `TextSegment` objects,
|
|
673
|
+
* each with its own style. Paragraph breaks are represented as
|
|
674
|
+
* segments with `isParagraphBreak: true`.
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```ts
|
|
678
|
+
* const segments: TextSegment[] = [
|
|
679
|
+
* { text: "Bold intro ", style: { bold: true, fontSize: 16 } },
|
|
680
|
+
* { text: "and normal text.", style: { fontSize: 16 } },
|
|
681
|
+
* { text: "", style: {}, isParagraphBreak: true },
|
|
682
|
+
* { text: "Second paragraph.", style: { fontSize: 14 } },
|
|
683
|
+
* ];
|
|
684
|
+
* // => 4 segments: 2 styled runs, 1 paragraph break, 1 normal run
|
|
685
|
+
* ```
|
|
686
|
+
*/
|
|
687
|
+
interface TextSegment {
|
|
688
|
+
text: string;
|
|
689
|
+
style: TextStyle;
|
|
690
|
+
/** When this segment originated from an `a:fld` element, stores the field type (e.g. "slidenum", "datetime"). */
|
|
691
|
+
fieldType?: string;
|
|
692
|
+
/** When this segment originated from an `a:fld` element, stores the field GUID. */
|
|
693
|
+
fieldGuid?: string;
|
|
694
|
+
/** Raw OMML XML node for equation segments (from `a14:m` / `m:oMathPara`). */
|
|
695
|
+
equationXml?: Record<string, unknown>;
|
|
696
|
+
/**
|
|
697
|
+
* Optional equation number for numbered equations (e.g. "(1)", "(2.3)").
|
|
698
|
+
* When present, the equation is rendered centered with the number right-aligned.
|
|
699
|
+
*/
|
|
700
|
+
equationNumber?: string;
|
|
701
|
+
/** Whether this segment represents a paragraph break rather than renderable text. */
|
|
702
|
+
isParagraphBreak?: boolean;
|
|
703
|
+
/** Structured bullet info for the first segment of a paragraph. */
|
|
704
|
+
bulletInfo?: BulletInfo;
|
|
705
|
+
/**
|
|
706
|
+
* Phonetic annotation text from `a:ruby > a:rt` (e.g. furigana, pinyin).
|
|
707
|
+
* When present, the renderer should wrap the base text with an HTML `<ruby>` tag.
|
|
708
|
+
*/
|
|
709
|
+
rubyText?: string;
|
|
710
|
+
/**
|
|
711
|
+
* Ruby text alignment from `a:rubyPr > @val` attribute.
|
|
712
|
+
* Values: "ctr" (center), "l" (left), "r" (right), "dist" (distribute), "distCat", "distLetter".
|
|
713
|
+
* @default "ctr"
|
|
714
|
+
*/
|
|
715
|
+
rubyAlignment?: string;
|
|
716
|
+
/**
|
|
717
|
+
* Ruby text font size as a percentage of the base text font size
|
|
718
|
+
* from `a:rubyPr/@hps` (half-point size) or inferred from rt run font size.
|
|
719
|
+
* Stored in **points** for consistency with `TextStyle.fontSize`.
|
|
720
|
+
*/
|
|
721
|
+
rubyFontSize?: number;
|
|
722
|
+
/**
|
|
723
|
+
* Style for the ruby (phonetic) text run, parsed from `a:rt > a:r > a:rPr`.
|
|
724
|
+
* Used by the renderer to apply font family, colour, etc. to the `<rt>` element.
|
|
725
|
+
*/
|
|
726
|
+
rubyStyle?: TextStyle;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Shape visual styling types: fill, stroke, effects, and connectors.
|
|
731
|
+
*
|
|
732
|
+
* {@link ShapeStyle} is the main type attached to any element that has
|
|
733
|
+
* visible geometry (shapes, connectors, images). It covers:
|
|
734
|
+
* - **Fill**: solid, gradient, pattern, image, and theme fills
|
|
735
|
+
* - **Stroke**: colour, width, dash pattern, line join/cap
|
|
736
|
+
* - **Effects**: shadow, glow, soft-edge, reflection, blur
|
|
737
|
+
* - **Connectors**: arrow-head types and connection points
|
|
738
|
+
* - **3-D**: scene camera and shape extrusion/bevel
|
|
739
|
+
*
|
|
740
|
+
* All spatial values are stored in **pixels** (pre-converted from EMU).
|
|
741
|
+
* Opacity values are normalised to the 0–1 range.
|
|
742
|
+
*
|
|
743
|
+
* @module pptx-types/shape-style
|
|
744
|
+
*/
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Comprehensive visual style for a shape, connector, or image element.
|
|
748
|
+
*
|
|
749
|
+
* All fields are optional. When absent, the element inherits from theme
|
|
750
|
+
* or layout defaults. The interface models both simple styling (solid fill +
|
|
751
|
+
* basic stroke) and advanced effects (multiple shadow layers, gradient
|
|
752
|
+
* fills, 3-D extrusion).
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```ts
|
|
756
|
+
* // Simple blue filled shape with a thin black outline:
|
|
757
|
+
* const simple: ShapeStyle = {
|
|
758
|
+
* fillColor: "#0055AA",
|
|
759
|
+
* fillMode: "solid",
|
|
760
|
+
* strokeColor: "#000000",
|
|
761
|
+
* strokeWidth: 1,
|
|
762
|
+
* };
|
|
763
|
+
*
|
|
764
|
+
* // Gradient fill with a soft shadow:
|
|
765
|
+
* const fancy: ShapeStyle = {
|
|
766
|
+
* fillMode: "gradient",
|
|
767
|
+
* fillGradientType: "linear",
|
|
768
|
+
* fillGradientAngle: 135,
|
|
769
|
+
* fillGradientStops: [
|
|
770
|
+
* { color: "#FF6B6B", position: 0 },
|
|
771
|
+
* { color: "#556270", position: 1 },
|
|
772
|
+
* ],
|
|
773
|
+
* shadowColor: "#000000",
|
|
774
|
+
* shadowBlur: 10,
|
|
775
|
+
* shadowOffsetX: 4,
|
|
776
|
+
* shadowOffsetY: 4,
|
|
777
|
+
* shadowOpacity: 0.3,
|
|
778
|
+
* };
|
|
779
|
+
* // => both satisfy the ShapeStyle interface
|
|
780
|
+
* ```
|
|
781
|
+
*/
|
|
782
|
+
interface ShapeStyle {
|
|
783
|
+
fillColor?: string;
|
|
784
|
+
fillGradient?: string;
|
|
785
|
+
fillMode?: 'solid' | 'gradient' | 'pattern' | 'none' | 'image' | 'theme' | 'group';
|
|
786
|
+
fillPatternPreset?: string;
|
|
787
|
+
fillPatternBackgroundColor?: string;
|
|
788
|
+
/** Raw XML node for pattern fill foreground colour (preserves color transforms). */
|
|
789
|
+
fillPatternFgClrXml?: XmlObject;
|
|
790
|
+
/** Raw XML node for pattern fill background colour (preserves color transforms). */
|
|
791
|
+
fillPatternBgClrXml?: XmlObject;
|
|
792
|
+
/** Data-URI or URL for image fill (when fillMode === "image"). */
|
|
793
|
+
fillImageUrl?: string;
|
|
794
|
+
/** How the image is sized within the shape: stretch to fill, or tile/repeat. */
|
|
795
|
+
fillImageMode?: 'stretch' | 'tile';
|
|
796
|
+
fillGradientStops?: Array<{
|
|
797
|
+
color: string;
|
|
798
|
+
position: number;
|
|
799
|
+
opacity?: number;
|
|
800
|
+
/** Raw XML colour node preserved for round-trip (e.g. a:schemeClr with transforms). */
|
|
801
|
+
originalColorXml?: XmlObject;
|
|
802
|
+
}>;
|
|
803
|
+
fillGradientAngle?: number;
|
|
804
|
+
fillGradientType?: 'linear' | 'radial';
|
|
805
|
+
/** Path gradient sub-type from `a:path/@path` (e.g. "circle", "rect", "shape"). */
|
|
806
|
+
fillGradientPathType?: 'circle' | 'rect' | 'shape';
|
|
807
|
+
/** Focal point for path (radial) gradients, derived from `a:fillToRect`.
|
|
808
|
+
* Values are 0..1 fractions relative to shape bounds. */
|
|
809
|
+
fillGradientFocalPoint?: {
|
|
810
|
+
x: number;
|
|
811
|
+
y: number;
|
|
812
|
+
};
|
|
813
|
+
/** Raw fillToRect LTRB values (0..1 fractions) from `a:fillToRect`.
|
|
814
|
+
* Defines the inner rectangle where the gradient reaches its final stop.
|
|
815
|
+
* l/t are insets from left/top edges; r/b are insets from right/bottom edges. */
|
|
816
|
+
fillGradientFillToRect?: {
|
|
817
|
+
l: number;
|
|
818
|
+
t: number;
|
|
819
|
+
r: number;
|
|
820
|
+
b: number;
|
|
821
|
+
};
|
|
822
|
+
fillOpacity?: number;
|
|
823
|
+
strokeColor?: string;
|
|
824
|
+
strokeWidth?: number;
|
|
825
|
+
strokeOpacity?: number;
|
|
826
|
+
strokeDash?: StrokeDashType;
|
|
827
|
+
/** Line join style (`a:ln/@join`): round, bevel, or miter. */
|
|
828
|
+
lineJoin?: 'round' | 'bevel' | 'miter';
|
|
829
|
+
/** Line cap style (`a:ln/@cap`): flat, rnd, or sq. */
|
|
830
|
+
lineCap?: 'flat' | 'rnd' | 'sq';
|
|
831
|
+
/** Compound line type (`a:ln/@cmpd`). */
|
|
832
|
+
compoundLine?: 'sng' | 'dbl' | 'thickThin' | 'thinThick' | 'tri';
|
|
833
|
+
shadowColor?: string;
|
|
834
|
+
shadowBlur?: number;
|
|
835
|
+
shadowOffsetX?: number;
|
|
836
|
+
shadowOffsetY?: number;
|
|
837
|
+
shadowOpacity?: number;
|
|
838
|
+
/** Preset shadow name from `a:prstShdw/@prst` (e.g. "shdw1"..."shdw20"). */
|
|
839
|
+
presetShadowName?: string;
|
|
840
|
+
/** Shadow angle in degrees (0-360). Parsed from `@_dir` (60000ths of a degree). */
|
|
841
|
+
shadowAngle?: number;
|
|
842
|
+
/** Shadow distance in pixels. Parsed from `@_dist` (EMUs). */
|
|
843
|
+
shadowDistance?: number;
|
|
844
|
+
/** Whether shadow rotates with shape. Parsed from `@_rotWithShape`. */
|
|
845
|
+
shadowRotateWithShape?: boolean;
|
|
846
|
+
/** Multiple shadow layers (for advanced effects). */
|
|
847
|
+
shadows?: ShadowEffect[];
|
|
848
|
+
glowColor?: string;
|
|
849
|
+
glowRadius?: number;
|
|
850
|
+
glowOpacity?: number;
|
|
851
|
+
softEdgeRadius?: number;
|
|
852
|
+
/** Inner shadow colour (`a:innerShdw`). */
|
|
853
|
+
innerShadowColor?: string;
|
|
854
|
+
/** Inner shadow opacity (0-1). */
|
|
855
|
+
innerShadowOpacity?: number;
|
|
856
|
+
/** Inner shadow blur radius in px. */
|
|
857
|
+
innerShadowBlur?: number;
|
|
858
|
+
/** Inner shadow horizontal offset in px. */
|
|
859
|
+
innerShadowOffsetX?: number;
|
|
860
|
+
/** Inner shadow vertical offset in px. */
|
|
861
|
+
innerShadowOffsetY?: number;
|
|
862
|
+
/** Reflection effect — distance from shape bottom in px. */
|
|
863
|
+
reflectionBlurRadius?: number;
|
|
864
|
+
/** Reflection start opacity (0-1). */
|
|
865
|
+
reflectionStartOpacity?: number;
|
|
866
|
+
/** Reflection end opacity (0-1). */
|
|
867
|
+
reflectionEndOpacity?: number;
|
|
868
|
+
/** Reflection end position (0-1 fraction of shape height). */
|
|
869
|
+
reflectionEndPosition?: number;
|
|
870
|
+
/** Reflection direction in degrees. */
|
|
871
|
+
reflectionDirection?: number;
|
|
872
|
+
/** Reflection rotation in degrees (`a:reflection/@rot` in 60000ths). */
|
|
873
|
+
reflectionRotation?: number;
|
|
874
|
+
/** Reflection distance in px. */
|
|
875
|
+
reflectionDistance?: number;
|
|
876
|
+
/** Standalone blur effect radius in px (`a:effectLst > a:blur`). */
|
|
877
|
+
blurRadius?: number;
|
|
878
|
+
/** Whether the blur effect grows the bounds of the shape (`a:blur/@grow`). */
|
|
879
|
+
blurGrow?: boolean;
|
|
880
|
+
connectorStartArrow?: ConnectorArrowType;
|
|
881
|
+
/** Start arrow width size ('sm' | 'med' | 'lg'). */
|
|
882
|
+
connectorStartArrowWidth?: 'sm' | 'med' | 'lg';
|
|
883
|
+
/** Start arrow length size ('sm' | 'med' | 'lg'). */
|
|
884
|
+
connectorStartArrowLength?: 'sm' | 'med' | 'lg';
|
|
885
|
+
connectorEndArrow?: ConnectorArrowType;
|
|
886
|
+
/** End arrow width size ('sm' | 'med' | 'lg'). */
|
|
887
|
+
connectorEndArrowWidth?: 'sm' | 'med' | 'lg';
|
|
888
|
+
/** End arrow length size ('sm' | 'med' | 'lg'). */
|
|
889
|
+
connectorEndArrowLength?: 'sm' | 'med' | 'lg';
|
|
890
|
+
/** Connection point for the start of a connector. */
|
|
891
|
+
connectorStartConnection?: ConnectorConnectionPoint;
|
|
892
|
+
/** Connection point for the end of a connector. */
|
|
893
|
+
connectorEndConnection?: ConnectorConnectionPoint;
|
|
894
|
+
/** Custom dash segments array (`a:custDash/a:ds`). Each entry has dash length and space length in EMU. */
|
|
895
|
+
customDashSegments?: Array<{
|
|
896
|
+
dash: number;
|
|
897
|
+
space: number;
|
|
898
|
+
}>;
|
|
899
|
+
/** 3D scene/camera settings from `a:scene3d`. */
|
|
900
|
+
scene3d?: Pptx3DScene;
|
|
901
|
+
/** 3D shape extrusion/bevel from `a:sp3d`. */
|
|
902
|
+
shape3d?: Pptx3DShape;
|
|
903
|
+
/** Line-level shadow colour from `a:ln/a:effectLst/a:outerShdw`. */
|
|
904
|
+
lineShadowColor?: string;
|
|
905
|
+
/** Line-level shadow opacity (0-1). */
|
|
906
|
+
lineShadowOpacity?: number;
|
|
907
|
+
/** Line-level shadow blur radius in px. */
|
|
908
|
+
lineShadowBlur?: number;
|
|
909
|
+
/** Line-level shadow horizontal offset in px. */
|
|
910
|
+
lineShadowOffsetX?: number;
|
|
911
|
+
/** Line-level shadow vertical offset in px. */
|
|
912
|
+
lineShadowOffsetY?: number;
|
|
913
|
+
/** Line-level glow colour from `a:ln/a:effectLst/a:glow`. */
|
|
914
|
+
lineGlowColor?: string;
|
|
915
|
+
/** Line-level glow radius in px. */
|
|
916
|
+
lineGlowRadius?: number;
|
|
917
|
+
/** Line-level glow opacity (0-1). */
|
|
918
|
+
lineGlowOpacity?: number;
|
|
919
|
+
/** Raw `a:effectDag` XML node preserved for round-trip serialisation. */
|
|
920
|
+
effectDagXml?: XmlObject;
|
|
921
|
+
/** Grayscale flag from effectDag `a:grayscl`. */
|
|
922
|
+
dagGrayscale?: boolean;
|
|
923
|
+
/** Bi-level threshold (0-100) from effectDag `a:biLevel`. */
|
|
924
|
+
dagBiLevel?: number;
|
|
925
|
+
/** Brightness adjustment (-100 to 100) from effectDag `a:lum/@bright`. */
|
|
926
|
+
dagLumBrightness?: number;
|
|
927
|
+
/** Contrast adjustment (-100 to 100) from effectDag `a:lum/@contrast`. */
|
|
928
|
+
dagLumContrast?: number;
|
|
929
|
+
/** Hue rotation in degrees (0-360) from effectDag `a:hsl/@hue`. */
|
|
930
|
+
dagHslHue?: number;
|
|
931
|
+
/** Saturation adjustment from effectDag `a:hsl/@sat`. */
|
|
932
|
+
dagHslSaturation?: number;
|
|
933
|
+
/** Luminance adjustment from effectDag `a:hsl/@lum`. */
|
|
934
|
+
dagHslLuminance?: number;
|
|
935
|
+
/** Alpha modulation fixed (0-100) from effectDag `a:alphaModFix`. */
|
|
936
|
+
dagAlphaModFix?: number;
|
|
937
|
+
/** Tint hue in degrees from effectDag `a:tint/@hue`. */
|
|
938
|
+
dagTintHue?: number;
|
|
939
|
+
/** Tint amount (0-100) from effectDag `a:tint/@amt`. */
|
|
940
|
+
dagTintAmount?: number;
|
|
941
|
+
/** Duotone colour pair from effectDag `a:duotone`. */
|
|
942
|
+
dagDuotone?: {
|
|
943
|
+
color1: string;
|
|
944
|
+
color2: string;
|
|
945
|
+
};
|
|
946
|
+
/** Fill overlay blend mode from effectDag `a:fillOverlay/@blend`. */
|
|
947
|
+
dagFillOverlayBlend?: 'over' | 'mult' | 'screen' | 'darken' | 'lighten';
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Image types: effects, crop shapes, and properties shared by image/picture
|
|
952
|
+
* elements.
|
|
953
|
+
*
|
|
954
|
+
* @module pptx-types/image
|
|
955
|
+
*/
|
|
956
|
+
/**
|
|
957
|
+
* Image recolour/adjustment properties parsed from blip extensions.
|
|
958
|
+
*
|
|
959
|
+
* These effects are stored in the OpenXML `<a:blip>` extension list
|
|
960
|
+
* and applied non-destructively to the original image data.
|
|
961
|
+
*
|
|
962
|
+
* @example
|
|
963
|
+
* ```ts
|
|
964
|
+
* const fx: PptxImageEffects = {
|
|
965
|
+
* brightness: 20,
|
|
966
|
+
* contrast: -10,
|
|
967
|
+
* grayscale: true,
|
|
968
|
+
* };
|
|
969
|
+
* // => { brightness: 20, contrast: -10, grayscale: true } satisfies PptxImageEffects
|
|
970
|
+
* ```
|
|
971
|
+
*/
|
|
972
|
+
interface PptxImageEffects {
|
|
973
|
+
/** Brightness adjustment (-100 to 100). */
|
|
974
|
+
brightness?: number;
|
|
975
|
+
/** Contrast adjustment (-100 to 100). */
|
|
976
|
+
contrast?: number;
|
|
977
|
+
/** Duotone colour pair. */
|
|
978
|
+
duotone?: {
|
|
979
|
+
color1: string;
|
|
980
|
+
color2: string;
|
|
981
|
+
};
|
|
982
|
+
/** Grayscale flag. */
|
|
983
|
+
grayscale?: boolean;
|
|
984
|
+
/** Saturation adjustment (-100 to 100). */
|
|
985
|
+
saturation?: number;
|
|
986
|
+
/** Color wash overlay. */
|
|
987
|
+
colorWash?: {
|
|
988
|
+
color: string;
|
|
989
|
+
opacity: number;
|
|
990
|
+
};
|
|
991
|
+
/** Artistic effect name (blur, pencilGrayscale, paintStrokes, etc.). */
|
|
992
|
+
artisticEffect?: string;
|
|
993
|
+
/** Artistic effect radius/amount. */
|
|
994
|
+
artisticRadius?: number;
|
|
995
|
+
/** Alpha modulation fixed — overall opacity (0-100, where 100 = fully opaque). */
|
|
996
|
+
alphaModFix?: number;
|
|
997
|
+
/** Bi-level threshold — converts to 1-bit black/white (0-100). */
|
|
998
|
+
biLevel?: number;
|
|
999
|
+
/** Colour change — swap one colour range for another (used for transparency keying). */
|
|
1000
|
+
clrChange?: {
|
|
1001
|
+
clrFrom: string;
|
|
1002
|
+
clrTo: string;
|
|
1003
|
+
/** Whether the target colour is fully transparent (alpha = 0). */
|
|
1004
|
+
clrToTransparent?: boolean;
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Shape names used for crop-to-shape (CSS `clip-path` equivalent).
|
|
1009
|
+
*
|
|
1010
|
+
* @example
|
|
1011
|
+
* ```ts
|
|
1012
|
+
* const shape: PptxCropShape = "ellipse";
|
|
1013
|
+
* // => "ellipse" — one of: none | ellipse | roundedRect | triangle | diamond | pentagon | hexagon | star
|
|
1014
|
+
* ```
|
|
1015
|
+
*/
|
|
1016
|
+
type PptxCropShape = 'none' | 'ellipse' | 'roundedRect' | 'triangle' | 'diamond' | 'pentagon' | 'hexagon' | 'star';
|
|
1017
|
+
/**
|
|
1018
|
+
* Image content mixin — present on image and picture elements.
|
|
1019
|
+
*
|
|
1020
|
+
* Contains the decoded image data (base64 data URL or archive path),
|
|
1021
|
+
* alt text, crop insets, tiling settings, and image effects.
|
|
1022
|
+
*
|
|
1023
|
+
* @example
|
|
1024
|
+
* ```ts
|
|
1025
|
+
* const props: PptxImageProperties = {
|
|
1026
|
+
* imagePath: "ppt/media/image1.png",
|
|
1027
|
+
* altText: "Company logo",
|
|
1028
|
+
* cropLeft: 0.05,
|
|
1029
|
+
* cropRight: 0.05,
|
|
1030
|
+
* };
|
|
1031
|
+
* // => { imagePath: "ppt/media/image1.png", altText: "Company logo", cropLeft: 0.05, cropRight: 0.05 }
|
|
1032
|
+
* ```
|
|
1033
|
+
*/
|
|
1034
|
+
interface PptxImageProperties {
|
|
1035
|
+
/** Base64 data-URL for the decoded image. */
|
|
1036
|
+
imageData?: string;
|
|
1037
|
+
/** Path within the PPTX ZIP archive. */
|
|
1038
|
+
imagePath?: string;
|
|
1039
|
+
/** Base64 data-URL for an SVG variant (from blip extension asvg:svgBlip). Preferred over raster when available. */
|
|
1040
|
+
svgData?: string;
|
|
1041
|
+
/** Path to the SVG file within the PPTX ZIP archive. */
|
|
1042
|
+
svgPath?: string;
|
|
1043
|
+
/** Alt text / description from `p:cNvPr/@descr`. */
|
|
1044
|
+
altText?: string;
|
|
1045
|
+
/** Crop from left edge as 0..1 fraction (OOXML `a:srcRect/@l`). */
|
|
1046
|
+
cropLeft?: number;
|
|
1047
|
+
/** Crop from top edge as 0..1 fraction (OOXML `a:srcRect/@t`). */
|
|
1048
|
+
cropTop?: number;
|
|
1049
|
+
/** Crop from right edge as 0..1 fraction (OOXML `a:srcRect/@r`). */
|
|
1050
|
+
cropRight?: number;
|
|
1051
|
+
/** Crop from bottom edge as 0..1 fraction (OOXML `a:srcRect/@b`). */
|
|
1052
|
+
cropBottom?: number;
|
|
1053
|
+
/** Image tiling offset X in px. */
|
|
1054
|
+
tileOffsetX?: number;
|
|
1055
|
+
/** Image tiling offset Y in px. */
|
|
1056
|
+
tileOffsetY?: number;
|
|
1057
|
+
/** Image tiling scale X as percentage (100 = 100%). */
|
|
1058
|
+
tileScaleX?: number;
|
|
1059
|
+
/** Image tiling scale Y as percentage (100 = 100%). */
|
|
1060
|
+
tileScaleY?: number;
|
|
1061
|
+
/** Image tiling flip mode. */
|
|
1062
|
+
tileFlip?: 'none' | 'x' | 'y' | 'xy';
|
|
1063
|
+
/** Image tiling alignment. */
|
|
1064
|
+
tileAlignment?: string;
|
|
1065
|
+
/** Image recolour/artistic effect properties. */
|
|
1066
|
+
imageEffects?: PptxImageEffects;
|
|
1067
|
+
/** Crop-to-shape — CSS clip-path shape name. */
|
|
1068
|
+
cropShape?: PptxCropShape;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Geometry types: adjustment handles, custom geometry points, segments,
|
|
1073
|
+
* paths, and custom path properties.
|
|
1074
|
+
*
|
|
1075
|
+
* @module pptx-types/geometry
|
|
1076
|
+
*/
|
|
1077
|
+
/**
|
|
1078
|
+
* Defines an adjustment handle position for a shape geometry.
|
|
1079
|
+
*
|
|
1080
|
+
* Adjustment handles allow users to interactively reshape preset shapes
|
|
1081
|
+
* (e.g. rounding a rectangle corner or adjusting arrow head width).
|
|
1082
|
+
*
|
|
1083
|
+
* @example
|
|
1084
|
+
* ```ts
|
|
1085
|
+
* const handle: GeometryAdjustmentHandle = {
|
|
1086
|
+
* guideName: "adj",
|
|
1087
|
+
* xFraction: 0.25,
|
|
1088
|
+
* minValue: 0,
|
|
1089
|
+
* maxValue: 50000,
|
|
1090
|
+
* };
|
|
1091
|
+
* // => satisfies GeometryAdjustmentHandle
|
|
1092
|
+
* ```
|
|
1093
|
+
*/
|
|
1094
|
+
interface GeometryAdjustmentHandle {
|
|
1095
|
+
/** Name of the adjustment guide this handle controls (e.g. "adj", "adj1"). */
|
|
1096
|
+
guideName: string;
|
|
1097
|
+
/** X position as a fraction of shape width (0..1), or undefined if the handle only moves vertically. */
|
|
1098
|
+
xFraction?: number;
|
|
1099
|
+
/** Y position as a fraction of shape height (0..1), or undefined if the handle only moves horizontally. */
|
|
1100
|
+
yFraction?: number;
|
|
1101
|
+
/** Minimum allowed value for the adjustment guide. */
|
|
1102
|
+
minValue?: number;
|
|
1103
|
+
/** Maximum allowed value for the adjustment guide. */
|
|
1104
|
+
maxValue?: number;
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* A single point in a custom geometry path.
|
|
1108
|
+
*
|
|
1109
|
+
* @example
|
|
1110
|
+
* ```ts
|
|
1111
|
+
* const pt: CustomGeometryPoint = { x: 100, y: 200 };
|
|
1112
|
+
* // => satisfies CustomGeometryPoint
|
|
1113
|
+
* ```
|
|
1114
|
+
*/
|
|
1115
|
+
interface CustomGeometryPoint {
|
|
1116
|
+
x: number;
|
|
1117
|
+
y: number;
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* A segment within a custom geometry path.
|
|
1121
|
+
*
|
|
1122
|
+
* Discriminated union over `type` — can be a moveTo, lineTo,
|
|
1123
|
+
* cubic Bézier, quadratic Bézier, or close command.
|
|
1124
|
+
*
|
|
1125
|
+
* @example
|
|
1126
|
+
* ```ts
|
|
1127
|
+
* const segments: CustomGeometrySegment[] = [
|
|
1128
|
+
* { type: "moveTo", pt: { x: 0, y: 0 } },
|
|
1129
|
+
* { type: "lineTo", pt: { x: 100, y: 0 } },
|
|
1130
|
+
* { type: "lineTo", pt: { x: 100, y: 100 } },
|
|
1131
|
+
* { type: "close" },
|
|
1132
|
+
* ];
|
|
1133
|
+
* // => satisfies CustomGeometrySegment[]
|
|
1134
|
+
* ```
|
|
1135
|
+
*/
|
|
1136
|
+
type CustomGeometrySegment = {
|
|
1137
|
+
type: 'moveTo';
|
|
1138
|
+
pt: CustomGeometryPoint;
|
|
1139
|
+
} | {
|
|
1140
|
+
type: 'lineTo';
|
|
1141
|
+
pt: CustomGeometryPoint;
|
|
1142
|
+
} | {
|
|
1143
|
+
type: 'cubicBezTo';
|
|
1144
|
+
pts: [CustomGeometryPoint, CustomGeometryPoint, CustomGeometryPoint];
|
|
1145
|
+
} | {
|
|
1146
|
+
type: 'quadBezTo';
|
|
1147
|
+
pts: [CustomGeometryPoint, CustomGeometryPoint];
|
|
1148
|
+
} | {
|
|
1149
|
+
type: 'arcTo';
|
|
1150
|
+
/** Horizontal radius of the ellipse. */
|
|
1151
|
+
wR: number;
|
|
1152
|
+
/** Vertical radius of the ellipse. */
|
|
1153
|
+
hR: number;
|
|
1154
|
+
/** Start angle in 60000ths of a degree. */
|
|
1155
|
+
stAng: number;
|
|
1156
|
+
/** Sweep angle in 60000ths of a degree. */
|
|
1157
|
+
swAng: number;
|
|
1158
|
+
} | {
|
|
1159
|
+
type: 'close';
|
|
1160
|
+
};
|
|
1161
|
+
/**
|
|
1162
|
+
* A single sub-path in a custom geometry definition (maps to one `a:path`).
|
|
1163
|
+
*
|
|
1164
|
+
* @example
|
|
1165
|
+
* ```ts
|
|
1166
|
+
* const path: CustomGeometryPath = {
|
|
1167
|
+
* width: 100,
|
|
1168
|
+
* height: 100,
|
|
1169
|
+
* segments: [
|
|
1170
|
+
* { type: "moveTo", pt: { x: 0, y: 0 } },
|
|
1171
|
+
* { type: "lineTo", pt: { x: 100, y: 100 } },
|
|
1172
|
+
* ],
|
|
1173
|
+
* };
|
|
1174
|
+
* // => satisfies CustomGeometryPath
|
|
1175
|
+
* ```
|
|
1176
|
+
*/
|
|
1177
|
+
interface CustomGeometryPath {
|
|
1178
|
+
/** Coordinate-space width for this sub-path. */
|
|
1179
|
+
width: number;
|
|
1180
|
+
/** Coordinate-space height for this sub-path. */
|
|
1181
|
+
height: number;
|
|
1182
|
+
/** Ordered list of drawing segments. */
|
|
1183
|
+
segments: CustomGeometrySegment[];
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Custom (non-preset) geometry path — only on shapes and pictures.
|
|
1187
|
+
*
|
|
1188
|
+
* Contains SVG path data and/or structured custom geometry paths
|
|
1189
|
+
* parsed from `a:custGeom/a:pathLst`.
|
|
1190
|
+
*
|
|
1191
|
+
* @example
|
|
1192
|
+
* ```ts
|
|
1193
|
+
* const custom: PptxCustomPathProperties = {
|
|
1194
|
+
* pathData: "M 0 0 L 100 0 L 100 100 Z",
|
|
1195
|
+
* pathWidth: 100,
|
|
1196
|
+
* pathHeight: 100,
|
|
1197
|
+
* };
|
|
1198
|
+
* // => satisfies PptxCustomPathProperties
|
|
1199
|
+
* ```
|
|
1200
|
+
*/
|
|
1201
|
+
interface PptxCustomPathProperties {
|
|
1202
|
+
/** SVG path data for custom shapes. */
|
|
1203
|
+
pathData?: string;
|
|
1204
|
+
/** Coordinate-space width for the custom path. */
|
|
1205
|
+
pathWidth?: number;
|
|
1206
|
+
/** Coordinate-space height for the custom path. */
|
|
1207
|
+
pathHeight?: number;
|
|
1208
|
+
/** Structured custom geometry paths for editing (maps to a:custGeom/a:pathLst). */
|
|
1209
|
+
customGeometryPaths?: CustomGeometryPath[];
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
/**
|
|
1213
|
+
* Chart types: chart categories, series data, style metadata, data tables,
|
|
1214
|
+
* trendlines, error bars, and the composite `PptxChartData`.
|
|
1215
|
+
*
|
|
1216
|
+
* @module pptx-types/chart
|
|
1217
|
+
*/
|
|
1218
|
+
/**
|
|
1219
|
+
* Supported chart type discriminators.
|
|
1220
|
+
*
|
|
1221
|
+
* @example
|
|
1222
|
+
* ```ts
|
|
1223
|
+
* const type: PptxChartType = "bar";
|
|
1224
|
+
* // => "bar" — one of: "bar" | "line" | "pie" | "doughnut" | "area" | "scatter" | …
|
|
1225
|
+
* ```
|
|
1226
|
+
*/
|
|
1227
|
+
type PptxChartType = 'bar' | 'line' | 'pie' | 'doughnut' | 'area' | 'scatter' | 'bubble' | 'radar' | 'stock' | 'bar3D' | 'line3D' | 'pie3D' | 'area3D' | 'surface' | 'histogram' | 'waterfall' | 'funnel' | 'treemap' | 'sunburst' | 'boxWhisker' | 'regionMap' | 'combo' | 'unknown';
|
|
1228
|
+
/**
|
|
1229
|
+
* Supported trendline regression types.
|
|
1230
|
+
*
|
|
1231
|
+
* @example
|
|
1232
|
+
* ```ts
|
|
1233
|
+
* const type: PptxChartTrendlineType = "linear";
|
|
1234
|
+
* // => "linear" — one of: "linear" | "exponential" | "logarithmic" | "polynomial" | "power" | "movingAvg"
|
|
1235
|
+
* ```
|
|
1236
|
+
*/
|
|
1237
|
+
type PptxChartTrendlineType = 'linear' | 'exponential' | 'logarithmic' | 'polynomial' | 'power' | 'movingAvg';
|
|
1238
|
+
/**
|
|
1239
|
+
* Configuration for a chart trendline (regression line).
|
|
1240
|
+
*
|
|
1241
|
+
* @example
|
|
1242
|
+
* ```ts
|
|
1243
|
+
* const trendline: PptxChartTrendline = {
|
|
1244
|
+
* trendlineType: "linear",
|
|
1245
|
+
* displayEq: true,
|
|
1246
|
+
* displayRSq: true,
|
|
1247
|
+
* color: "#FF0000",
|
|
1248
|
+
* };
|
|
1249
|
+
* // => satisfies PptxChartTrendline
|
|
1250
|
+
* ```
|
|
1251
|
+
*/
|
|
1252
|
+
interface PptxChartTrendline {
|
|
1253
|
+
trendlineType: PptxChartTrendlineType;
|
|
1254
|
+
order?: number;
|
|
1255
|
+
period?: number;
|
|
1256
|
+
forward?: number;
|
|
1257
|
+
backward?: number;
|
|
1258
|
+
intercept?: number;
|
|
1259
|
+
displayRSq?: boolean;
|
|
1260
|
+
displayEq?: boolean;
|
|
1261
|
+
color?: string;
|
|
1262
|
+
}
|
|
1263
|
+
/** Error-bar direction axis. */
|
|
1264
|
+
type PptxChartErrBarDir = 'x' | 'y';
|
|
1265
|
+
/** Error-bar display type (both sides, negative only, or positive only). */
|
|
1266
|
+
type PptxChartErrBarType = 'both' | 'minus' | 'plus';
|
|
1267
|
+
/**
|
|
1268
|
+
* How the error-bar value is calculated.
|
|
1269
|
+
*
|
|
1270
|
+
* @example
|
|
1271
|
+
* ```ts
|
|
1272
|
+
* const valType: PptxChartErrValType = "percentage";
|
|
1273
|
+
* // => "percentage" — one of: "cust" | "fixedVal" | "percentage" | "stdDev" | "stdErr"
|
|
1274
|
+
* ```
|
|
1275
|
+
*/
|
|
1276
|
+
type PptxChartErrValType = 'cust' | 'fixedVal' | 'percentage' | 'stdDev' | 'stdErr';
|
|
1277
|
+
/**
|
|
1278
|
+
* Error bars for a chart series.
|
|
1279
|
+
*
|
|
1280
|
+
* @example
|
|
1281
|
+
* ```ts
|
|
1282
|
+
* const bars: PptxChartErrBars = {
|
|
1283
|
+
* direction: "y",
|
|
1284
|
+
* barType: "both",
|
|
1285
|
+
* valType: "percentage",
|
|
1286
|
+
* val: 5,
|
|
1287
|
+
* };
|
|
1288
|
+
* // => satisfies PptxChartErrBars
|
|
1289
|
+
* ```
|
|
1290
|
+
*/
|
|
1291
|
+
interface PptxChartErrBars {
|
|
1292
|
+
direction: PptxChartErrBarDir;
|
|
1293
|
+
barType: PptxChartErrBarType;
|
|
1294
|
+
valType: PptxChartErrValType;
|
|
1295
|
+
val?: number;
|
|
1296
|
+
customPlus?: number[];
|
|
1297
|
+
customMinus?: number[];
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Visibility flags for the chart data table (axes + legend keys).
|
|
1301
|
+
*
|
|
1302
|
+
* @example
|
|
1303
|
+
* ```ts
|
|
1304
|
+
* const dt: PptxChartDataTable = {
|
|
1305
|
+
* showHorzBorder: true,
|
|
1306
|
+
* showVertBorder: true,
|
|
1307
|
+
* showOutline: true,
|
|
1308
|
+
* showKeys: true,
|
|
1309
|
+
* };
|
|
1310
|
+
* // => satisfies PptxChartDataTable
|
|
1311
|
+
* ```
|
|
1312
|
+
*/
|
|
1313
|
+
interface PptxChartDataTable {
|
|
1314
|
+
showHorzBorder?: boolean;
|
|
1315
|
+
showVertBorder?: boolean;
|
|
1316
|
+
showOutline?: boolean;
|
|
1317
|
+
showKeys?: boolean;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Line appearance for chart helper lines (drop lines, hi-low lines).
|
|
1321
|
+
*
|
|
1322
|
+
* @example
|
|
1323
|
+
* ```ts
|
|
1324
|
+
* const style: PptxChartLineStyle = {
|
|
1325
|
+
* color: "#AAAAAA",
|
|
1326
|
+
* width: 1,
|
|
1327
|
+
* dashStyle: "dash",
|
|
1328
|
+
* };
|
|
1329
|
+
* // => satisfies PptxChartLineStyle
|
|
1330
|
+
* ```
|
|
1331
|
+
*/
|
|
1332
|
+
interface PptxChartLineStyle {
|
|
1333
|
+
color?: string;
|
|
1334
|
+
width?: number;
|
|
1335
|
+
dashStyle?: string;
|
|
1336
|
+
}
|
|
1337
|
+
/** Marker symbol types for line/scatter chart data points. */
|
|
1338
|
+
type PptxChartMarkerSymbol = 'circle' | 'dash' | 'diamond' | 'dot' | 'none' | 'picture' | 'plus' | 'square' | 'star' | 'triangle' | 'x' | 'auto';
|
|
1339
|
+
/** Shape properties extracted from c:spPr for chart formatting. */
|
|
1340
|
+
interface PptxChartShapeProps {
|
|
1341
|
+
fillColor?: string;
|
|
1342
|
+
strokeColor?: string;
|
|
1343
|
+
strokeWidth?: number;
|
|
1344
|
+
}
|
|
1345
|
+
/** Marker appearance on a chart series or data point. */
|
|
1346
|
+
interface PptxChartMarker {
|
|
1347
|
+
symbol: PptxChartMarkerSymbol;
|
|
1348
|
+
size?: number;
|
|
1349
|
+
spPr?: PptxChartShapeProps;
|
|
1350
|
+
}
|
|
1351
|
+
/** Per-data-point formatting override (c:dPt). */
|
|
1352
|
+
interface PptxChartDataPoint {
|
|
1353
|
+
idx: number;
|
|
1354
|
+
spPr?: PptxChartShapeProps;
|
|
1355
|
+
explosion?: number;
|
|
1356
|
+
invertIfNegative?: boolean;
|
|
1357
|
+
marker?: PptxChartMarker;
|
|
1358
|
+
}
|
|
1359
|
+
/** Individual data label override (c:dLbl). */
|
|
1360
|
+
interface PptxChartDataLabel {
|
|
1361
|
+
idx: number;
|
|
1362
|
+
showVal?: boolean;
|
|
1363
|
+
showCatName?: boolean;
|
|
1364
|
+
showSerName?: boolean;
|
|
1365
|
+
showPercent?: boolean;
|
|
1366
|
+
showLegendKey?: boolean;
|
|
1367
|
+
showBubbleSize?: boolean;
|
|
1368
|
+
position?: string;
|
|
1369
|
+
text?: string;
|
|
1370
|
+
}
|
|
1371
|
+
/** Axis number format. */
|
|
1372
|
+
interface PptxChartAxisNumFmt {
|
|
1373
|
+
formatCode: string;
|
|
1374
|
+
sourceLinked?: boolean;
|
|
1375
|
+
}
|
|
1376
|
+
/** Axis formatting for category, value, or date axes. */
|
|
1377
|
+
interface PptxChartAxisFormatting {
|
|
1378
|
+
axisType: 'catAx' | 'valAx' | 'dateAx' | 'serAx';
|
|
1379
|
+
/** Axis position: "b" (bottom), "l" (left), "r" (right), "t" (top). */
|
|
1380
|
+
axPos?: 'b' | 'l' | 'r' | 't';
|
|
1381
|
+
/** Unique axis identifier (c:axId/@val) used to link series to axes. */
|
|
1382
|
+
axisId?: number;
|
|
1383
|
+
/** Cross-axis identifier — the axis this axis crosses. */
|
|
1384
|
+
crossAxisId?: number;
|
|
1385
|
+
numFmt?: PptxChartAxisNumFmt;
|
|
1386
|
+
titleText?: string;
|
|
1387
|
+
spPr?: PptxChartShapeProps;
|
|
1388
|
+
fontFamily?: string;
|
|
1389
|
+
fontSize?: number;
|
|
1390
|
+
fontBold?: boolean;
|
|
1391
|
+
fontColor?: string;
|
|
1392
|
+
majorGridlinesSpPr?: PptxChartShapeProps;
|
|
1393
|
+
minorGridlinesSpPr?: PptxChartShapeProps;
|
|
1394
|
+
/** Minimum axis value override (c:min/@val). */
|
|
1395
|
+
min?: number;
|
|
1396
|
+
/** Maximum axis value override (c:max/@val). */
|
|
1397
|
+
max?: number;
|
|
1398
|
+
/** Whether the axis is deleted/hidden (c:delete/@val). */
|
|
1399
|
+
deleted?: boolean;
|
|
1400
|
+
/**
|
|
1401
|
+
* Display units for value axis (c:dispUnits/c:builtInUnit/@val).
|
|
1402
|
+
* When set to 'custom', the actual divisor is in {@link displayUnitsValue}.
|
|
1403
|
+
*/
|
|
1404
|
+
displayUnits?: 'hundreds' | 'thousands' | 'tenThousands' | 'hundredThousands' | 'millions' | 'tenMillions' | 'hundredMillions' | 'billions' | 'trillions' | 'custom';
|
|
1405
|
+
/** Custom display unit divisor value (c:dispUnits/c:custUnit/@val). Only used when displayUnits is 'custom'. */
|
|
1406
|
+
displayUnitsValue?: number;
|
|
1407
|
+
/** Display units label text (c:dispUnits/c:dispUnitsLbl). Overrides the built-in default label when present. */
|
|
1408
|
+
displayUnitsLabel?: string;
|
|
1409
|
+
/** Whether logarithmic scaling is enabled (presence of c:scaling/c:logBase). */
|
|
1410
|
+
logScale?: boolean;
|
|
1411
|
+
/** Logarithmic base value (c:scaling/c:logBase/@val), typically 10 or e. */
|
|
1412
|
+
logBase?: number;
|
|
1413
|
+
}
|
|
1414
|
+
/** 3D wall or floor element formatting. */
|
|
1415
|
+
interface PptxChart3DSurface {
|
|
1416
|
+
thickness?: number;
|
|
1417
|
+
spPr?: PptxChartShapeProps;
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* A single data series within a chart.
|
|
1421
|
+
*
|
|
1422
|
+
* @example
|
|
1423
|
+
* ```ts
|
|
1424
|
+
* const series: PptxChartSeries = {
|
|
1425
|
+
* name: "Revenue",
|
|
1426
|
+
* values: [100, 120, 140],
|
|
1427
|
+
* color: "#4F81BD",
|
|
1428
|
+
* trendlines: [{ trendlineType: "linear" }],
|
|
1429
|
+
* };
|
|
1430
|
+
* // => satisfies PptxChartSeries
|
|
1431
|
+
* ```
|
|
1432
|
+
*/
|
|
1433
|
+
interface PptxChartSeries {
|
|
1434
|
+
name: string;
|
|
1435
|
+
values: number[];
|
|
1436
|
+
color?: string;
|
|
1437
|
+
trendlines?: PptxChartTrendline[];
|
|
1438
|
+
errBars?: PptxChartErrBars[];
|
|
1439
|
+
dataPoints?: PptxChartDataPoint[];
|
|
1440
|
+
marker?: PptxChartMarker;
|
|
1441
|
+
dataLabels?: PptxChartDataLabel[];
|
|
1442
|
+
explosion?: number;
|
|
1443
|
+
/** Axis ID this series is plotted against (links to PptxChartAxisFormatting.axisId). */
|
|
1444
|
+
axisId?: number;
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Style / formatting metadata for a chart.
|
|
1448
|
+
*
|
|
1449
|
+
* @example
|
|
1450
|
+
* ```ts
|
|
1451
|
+
* const style: PptxChartStyle = {
|
|
1452
|
+
* styleId: 2,
|
|
1453
|
+
* hasLegend: true,
|
|
1454
|
+
* legendPosition: "b",
|
|
1455
|
+
* hasDataLabels: true,
|
|
1456
|
+
* };
|
|
1457
|
+
* // => satisfies PptxChartStyle
|
|
1458
|
+
* ```
|
|
1459
|
+
*/
|
|
1460
|
+
interface PptxChartStyle {
|
|
1461
|
+
/** Chart style index from `c:style/@val`. */
|
|
1462
|
+
styleId?: number;
|
|
1463
|
+
/** Whether the chart has a visible legend. */
|
|
1464
|
+
hasLegend?: boolean;
|
|
1465
|
+
/** Legend position (t, b, l, r, tr). */
|
|
1466
|
+
legendPosition?: string;
|
|
1467
|
+
/** Whether the chart has a title. */
|
|
1468
|
+
hasTitle?: boolean;
|
|
1469
|
+
/** Whether gridlines are visible. */
|
|
1470
|
+
hasGridlines?: boolean;
|
|
1471
|
+
/** Whether data labels are shown. */
|
|
1472
|
+
hasDataLabels?: boolean;
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* External data source reference for a chart (c:externalData).
|
|
1476
|
+
*
|
|
1477
|
+
* Charts can reference an external Excel workbook via a relationship ID
|
|
1478
|
+
* that points to an external file (TargetMode="External"). The
|
|
1479
|
+
* `autoUpdate` flag indicates whether the chart should refresh its
|
|
1480
|
+
* cached data from the external source on open.
|
|
1481
|
+
*
|
|
1482
|
+
* @example
|
|
1483
|
+
* ```ts
|
|
1484
|
+
* const ext: PptxExternalData = {
|
|
1485
|
+
* relId: "rId2",
|
|
1486
|
+
* targetPath: "file:///C:/Data/budget.xlsx",
|
|
1487
|
+
* autoUpdate: true,
|
|
1488
|
+
* };
|
|
1489
|
+
* // => satisfies PptxExternalData
|
|
1490
|
+
* ```
|
|
1491
|
+
*/
|
|
1492
|
+
interface PptxExternalData {
|
|
1493
|
+
/** Relationship ID referencing the external data source in the chart .rels. */
|
|
1494
|
+
relId: string;
|
|
1495
|
+
/** Resolved external file path or URL from the relationship target. */
|
|
1496
|
+
targetPath?: string;
|
|
1497
|
+
/** Whether to auto-update data from the external source on open. */
|
|
1498
|
+
autoUpdate?: boolean;
|
|
1499
|
+
/** Raw binary data of the embedded xlsx workbook (from ppt/embeddings/). */
|
|
1500
|
+
embeddedWorkbookData?: Uint8Array;
|
|
1501
|
+
}
|
|
1502
|
+
/** Parsed data extracted from an embedded xlsx workbook. */
|
|
1503
|
+
interface PptxEmbeddedWorkbookData {
|
|
1504
|
+
/** Category labels from the first column/row. */
|
|
1505
|
+
categories: string[];
|
|
1506
|
+
/** Data series extracted from worksheet cells. */
|
|
1507
|
+
series: Array<{
|
|
1508
|
+
name: string;
|
|
1509
|
+
values: number[];
|
|
1510
|
+
}>;
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* Complete parsed chart data for a {@link ChartPptxElement}.
|
|
1514
|
+
*
|
|
1515
|
+
* @example
|
|
1516
|
+
* ```ts
|
|
1517
|
+
* const chart: PptxChartData = {
|
|
1518
|
+
* title: "Q4 Sales",
|
|
1519
|
+
* chartType: "bar",
|
|
1520
|
+
* categories: ["Jan", "Feb", "Mar"],
|
|
1521
|
+
* series: [
|
|
1522
|
+
* { name: "Revenue", values: [100, 120, 140] },
|
|
1523
|
+
* ],
|
|
1524
|
+
* grouping: "clustered",
|
|
1525
|
+
* style: { hasLegend: true, legendPosition: "b" },
|
|
1526
|
+
* };
|
|
1527
|
+
* // => satisfies PptxChartData
|
|
1528
|
+
* ```
|
|
1529
|
+
*/
|
|
1530
|
+
interface PptxChartData {
|
|
1531
|
+
title?: string;
|
|
1532
|
+
chartType: PptxChartType;
|
|
1533
|
+
categories: string[];
|
|
1534
|
+
series: PptxChartSeries[];
|
|
1535
|
+
/** Chart style/formatting metadata. */
|
|
1536
|
+
style?: PptxChartStyle;
|
|
1537
|
+
/** Grouping mode for bar/area/line charts: 'clustered' | 'stacked' | 'percentStacked' */
|
|
1538
|
+
grouping?: 'clustered' | 'stacked' | 'percentStacked';
|
|
1539
|
+
/** Internal: path to the chart XML part in the PPTX archive (for round-trip save). */
|
|
1540
|
+
chartPartPath?: string;
|
|
1541
|
+
/** Internal: relationship ID linking the graphic frame to the chart part. */
|
|
1542
|
+
chartRelationshipId?: string;
|
|
1543
|
+
dataTable?: PptxChartDataTable;
|
|
1544
|
+
dropLines?: PptxChartLineStyle;
|
|
1545
|
+
hiLowLines?: PptxChartLineStyle;
|
|
1546
|
+
axes?: PptxChartAxisFormatting[];
|
|
1547
|
+
floor?: PptxChart3DSurface;
|
|
1548
|
+
sideWall?: PptxChart3DSurface;
|
|
1549
|
+
backWall?: PptxChart3DSurface;
|
|
1550
|
+
/** External data source reference (c:externalData) linking to an external workbook. */
|
|
1551
|
+
externalData?: PptxExternalData;
|
|
1552
|
+
/**
|
|
1553
|
+
* Parsed data from the embedded xlsx workbook (from ppt/embeddings/).
|
|
1554
|
+
*
|
|
1555
|
+
* When a chart references an embedded Excel workbook via `c:externalData`,
|
|
1556
|
+
* the xlsx is parsed to extract categories and series. This data serves as
|
|
1557
|
+
* a fallback when the chart XML's cached series data is empty or incomplete.
|
|
1558
|
+
*/
|
|
1559
|
+
embeddedWorkbookData?: PptxEmbeddedWorkbookData;
|
|
1560
|
+
/**
|
|
1561
|
+
* Pivot table data source reference (c:pivotSource).
|
|
1562
|
+
*
|
|
1563
|
+
* When present, the chart's data originates from a PivotTable.
|
|
1564
|
+
* The chart still renders using its cached series data; this field
|
|
1565
|
+
* is metadata about the data origin, preserved for round-trip fidelity.
|
|
1566
|
+
*/
|
|
1567
|
+
pivotSource?: {
|
|
1568
|
+
/** Pivot table reference name, e.g. "[workbook.xlsx]Sheet1!PivotTable1". */
|
|
1569
|
+
name: string;
|
|
1570
|
+
/** Format identifier from c:fmtId/@val. */
|
|
1571
|
+
formatId?: number;
|
|
1572
|
+
};
|
|
1573
|
+
/**
|
|
1574
|
+
* Whether only visible cells are plotted (c:plotVisOnly).
|
|
1575
|
+
* When `true` (the default), hidden cells are excluded from the chart.
|
|
1576
|
+
* When `false`, hidden data IS plotted.
|
|
1577
|
+
*/
|
|
1578
|
+
plotVisibleOnly?: boolean;
|
|
1579
|
+
/**
|
|
1580
|
+
* Color palette extracted from the chart's Office 2013+ color style part
|
|
1581
|
+
* (`chartColorStyle*.xml`). When present, this palette takes priority over
|
|
1582
|
+
* the `c:style/@val`-derived palette in `getChartStylePalette`.
|
|
1583
|
+
*
|
|
1584
|
+
* Each entry is a resolved hex colour string (e.g. `"#4472C4"`).
|
|
1585
|
+
*/
|
|
1586
|
+
colorPalette?: string[];
|
|
1587
|
+
/**
|
|
1588
|
+
* Color cycling method from the chart color style part's `meth` attribute.
|
|
1589
|
+
*
|
|
1590
|
+
* - `"cycle"` — repeat the palette colours in order (default)
|
|
1591
|
+
* - `"withinLinear"` — gradient within each series
|
|
1592
|
+
* - `"acrossLinear"` — gradient across series
|
|
1593
|
+
*/
|
|
1594
|
+
colorMethod?: 'cycle' | 'withinLinear' | 'acrossLinear';
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* SmartArt types: layout categories, layout presets, colour schemes,
|
|
1599
|
+
* data-model nodes/connections, drawing shapes, chrome, and the composite
|
|
1600
|
+
* `PptxSmartArtData`.
|
|
1601
|
+
*
|
|
1602
|
+
* @module pptx-types/smart-art
|
|
1603
|
+
*/
|
|
1604
|
+
/**
|
|
1605
|
+
* Resolved SmartArt layout category.
|
|
1606
|
+
*
|
|
1607
|
+
* @example
|
|
1608
|
+
* ```ts
|
|
1609
|
+
* const cat: SmartArtLayoutType = "hierarchy";
|
|
1610
|
+
* // => "hierarchy" — one of: "list" | "process" | "cycle" | "hierarchy" | "relationship" | …
|
|
1611
|
+
* ```
|
|
1612
|
+
*/
|
|
1613
|
+
type SmartArtLayoutType = 'list' | 'process' | 'cycle' | 'hierarchy' | 'relationship' | 'matrix' | 'pyramid' | 'funnel' | 'gear' | 'target' | 'timeline' | 'venn' | 'chevron' | 'bending' | 'unknown';
|
|
1614
|
+
/**
|
|
1615
|
+
* Named SmartArt layout presets for creation (subset of PowerPoint layouts).
|
|
1616
|
+
*
|
|
1617
|
+
* @example
|
|
1618
|
+
* ```ts
|
|
1619
|
+
* const layout: SmartArtLayout = "hierarchy";
|
|
1620
|
+
* // => "hierarchy" — one of: "basicBlockList" | "alternatingHexagons" | "hierarchy" | …
|
|
1621
|
+
* ```
|
|
1622
|
+
*/
|
|
1623
|
+
type SmartArtLayout = 'basicBlockList' | 'alternatingHexagons' | 'basicChevronProcess' | 'basicCycle' | 'basicPie' | 'basicRadial' | 'basicVenn' | 'continuousBlockProcess' | 'convergingRadial' | 'hierarchy' | 'horizontalBulletList' | 'linearVenn' | 'segmentedProcess' | 'stackedList' | 'tableList' | 'trapezoidList' | 'upwardArrow' | 'basicFunnel' | 'basicTarget' | 'interlockingGears' | 'basicTimeline' | 'basicMatrix' | 'basicPyramid' | 'invertedPyramid' | 'bendingProcess' | 'stepDownProcess' | 'alternatingFlow' | 'descendingProcess' | 'pictureAccentList' | 'verticalBlockList' | 'groupedList' | 'pyramidList' | 'horizontalPictureList' | 'accentProcess' | 'verticalChevronList';
|
|
1624
|
+
/**
|
|
1625
|
+
* SmartArt colour scheme presets.
|
|
1626
|
+
*
|
|
1627
|
+
* @example
|
|
1628
|
+
* ```ts
|
|
1629
|
+
* const scheme: SmartArtColorScheme = "colorful1";
|
|
1630
|
+
* // => "colorful1" — one of: "colorful1" | "colorful2" | "colorful3" | "monochromatic1" | "monochromatic2"
|
|
1631
|
+
* ```
|
|
1632
|
+
*/
|
|
1633
|
+
type SmartArtColorScheme = 'colorful1' | 'colorful2' | 'colorful3' | 'monochromatic1' | 'monochromatic2';
|
|
1634
|
+
/**
|
|
1635
|
+
* SmartArt visual style intensity.
|
|
1636
|
+
*
|
|
1637
|
+
* @example
|
|
1638
|
+
* ```ts
|
|
1639
|
+
* const style: SmartArtStyle = "moderate";
|
|
1640
|
+
* // => "moderate" — one of: "flat" | "moderate" | "intense"
|
|
1641
|
+
* ```
|
|
1642
|
+
*/
|
|
1643
|
+
type SmartArtStyle = 'flat' | 'moderate' | 'intense';
|
|
1644
|
+
/**
|
|
1645
|
+
* A single node in the SmartArt data model.
|
|
1646
|
+
*
|
|
1647
|
+
* @example
|
|
1648
|
+
* ```ts
|
|
1649
|
+
* const node: PptxSmartArtNode = {
|
|
1650
|
+
* id: "1",
|
|
1651
|
+
* text: "CEO",
|
|
1652
|
+
* children: [
|
|
1653
|
+
* { id: "2", text: "VP Marketing", parentId: "1" },
|
|
1654
|
+
* { id: "3", text: "VP Engineering", parentId: "1" },
|
|
1655
|
+
* ],
|
|
1656
|
+
* };
|
|
1657
|
+
* // => satisfies PptxSmartArtNode
|
|
1658
|
+
* ```
|
|
1659
|
+
*/
|
|
1660
|
+
interface PptxSmartArtNode {
|
|
1661
|
+
id: string;
|
|
1662
|
+
text: string;
|
|
1663
|
+
parentId?: string;
|
|
1664
|
+
children?: PptxSmartArtNode[];
|
|
1665
|
+
/** Node type from `@_type` attribute (e.g. "doc", "node", "asst", "pres"). */
|
|
1666
|
+
nodeType?: string;
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* A connection between two SmartArt data-model nodes.
|
|
1670
|
+
*
|
|
1671
|
+
* @example
|
|
1672
|
+
* ```ts
|
|
1673
|
+
* const conn: PptxSmartArtConnection = {
|
|
1674
|
+
* sourceId: "1",
|
|
1675
|
+
* destId: "2",
|
|
1676
|
+
* type: "parOf",
|
|
1677
|
+
* };
|
|
1678
|
+
* // => satisfies PptxSmartArtConnection
|
|
1679
|
+
* ```
|
|
1680
|
+
*/
|
|
1681
|
+
interface PptxSmartArtConnection {
|
|
1682
|
+
/** Model ID of the source node. */
|
|
1683
|
+
sourceId: string;
|
|
1684
|
+
/** Model ID of the destination node. */
|
|
1685
|
+
destId: string;
|
|
1686
|
+
/** Connection type (e.g. "parOf", "presOf", "sibTrans"). */
|
|
1687
|
+
type?: string;
|
|
1688
|
+
/** Source index for ordering sibling connections. */
|
|
1689
|
+
srcOrd?: number;
|
|
1690
|
+
/** Destination index for ordering. */
|
|
1691
|
+
destOrd?: number;
|
|
1692
|
+
}
|
|
1693
|
+
/**
|
|
1694
|
+
* A pre-computed shape from `ppt/diagrams/drawing*.xml`.
|
|
1695
|
+
*
|
|
1696
|
+
* @example
|
|
1697
|
+
* ```ts
|
|
1698
|
+
* const shape: PptxSmartArtDrawingShape = {
|
|
1699
|
+
* id: "s1",
|
|
1700
|
+
* shapeType: "roundRect",
|
|
1701
|
+
* x: 100, y: 50, width: 200, height: 80,
|
|
1702
|
+
* fillColor: "#4F81BD",
|
|
1703
|
+
* text: "CEO",
|
|
1704
|
+
* };
|
|
1705
|
+
* // => satisfies PptxSmartArtDrawingShape
|
|
1706
|
+
* ```
|
|
1707
|
+
*/
|
|
1708
|
+
interface PptxSmartArtDrawingShape {
|
|
1709
|
+
/** Shape ID within the drawing. */
|
|
1710
|
+
id: string;
|
|
1711
|
+
/** Preset geometry type (e.g. "roundRect", "ellipse"). */
|
|
1712
|
+
shapeType?: string;
|
|
1713
|
+
/** Position and size in EMU-based pixels. */
|
|
1714
|
+
x: number;
|
|
1715
|
+
y: number;
|
|
1716
|
+
width: number;
|
|
1717
|
+
height: number;
|
|
1718
|
+
/** Rotation in degrees. */
|
|
1719
|
+
rotation?: number;
|
|
1720
|
+
/** Skew along the X axis in degrees. */
|
|
1721
|
+
skewX?: number;
|
|
1722
|
+
/** Skew along the Y axis in degrees. */
|
|
1723
|
+
skewY?: number;
|
|
1724
|
+
/** Solid fill colour (hex). */
|
|
1725
|
+
fillColor?: string;
|
|
1726
|
+
/** Stroke colour (hex). */
|
|
1727
|
+
strokeColor?: string;
|
|
1728
|
+
/** Stroke width in points. */
|
|
1729
|
+
strokeWidth?: number;
|
|
1730
|
+
/** Text content of the shape. */
|
|
1731
|
+
text?: string;
|
|
1732
|
+
/** Font size in points. */
|
|
1733
|
+
fontSize?: number;
|
|
1734
|
+
/** Font colour (hex). */
|
|
1735
|
+
fontColor?: string;
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* Background / outline extracted from `dgm:bg` and `dgm:whole`.
|
|
1739
|
+
*
|
|
1740
|
+
* @example
|
|
1741
|
+
* ```ts
|
|
1742
|
+
* const chrome: PptxSmartArtChrome = {
|
|
1743
|
+
* backgroundColor: "#F0F0F0",
|
|
1744
|
+
* outlineColor: "#333333",
|
|
1745
|
+
* outlineWidth: 1,
|
|
1746
|
+
* };
|
|
1747
|
+
* // => satisfies PptxSmartArtChrome
|
|
1748
|
+
* ```
|
|
1749
|
+
*/
|
|
1750
|
+
interface PptxSmartArtChrome {
|
|
1751
|
+
/** Background fill colour (hex). */
|
|
1752
|
+
backgroundColor?: string;
|
|
1753
|
+
/** Outline stroke colour (hex). */
|
|
1754
|
+
outlineColor?: string;
|
|
1755
|
+
/** Outline stroke width in points. */
|
|
1756
|
+
outlineWidth?: number;
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Colour transform entry from `ppt/diagrams/colors*.xml`.
|
|
1760
|
+
*
|
|
1761
|
+
* @example
|
|
1762
|
+
* ```ts
|
|
1763
|
+
* const transform: PptxSmartArtColorTransform = {
|
|
1764
|
+
* name: "Colorful - Accent Colors",
|
|
1765
|
+
* fillColors: ["#4F81BD", "#C0504D", "#9BBB59"],
|
|
1766
|
+
* lineColors: ["#385D8A", "#8C3836", "#71893F"],
|
|
1767
|
+
* };
|
|
1768
|
+
* // => satisfies PptxSmartArtColorTransform
|
|
1769
|
+
* ```
|
|
1770
|
+
*/
|
|
1771
|
+
interface PptxSmartArtColorTransform {
|
|
1772
|
+
/** Colour scheme name / title. */
|
|
1773
|
+
name?: string;
|
|
1774
|
+
/** Ordered list of fill colours (hex) for each node. */
|
|
1775
|
+
fillColors: string[];
|
|
1776
|
+
/** Ordered list of line colours (hex). */
|
|
1777
|
+
lineColors: string[];
|
|
1778
|
+
}
|
|
1779
|
+
/**
|
|
1780
|
+
* Style entry from `ppt/diagrams/quickStyles*.xml`.
|
|
1781
|
+
*
|
|
1782
|
+
* @example
|
|
1783
|
+
* ```ts
|
|
1784
|
+
* const qs: PptxSmartArtQuickStyle = {
|
|
1785
|
+
* name: "Moderate Effect",
|
|
1786
|
+
* effectIntensity: "moderate",
|
|
1787
|
+
* };
|
|
1788
|
+
* // => satisfies PptxSmartArtQuickStyle
|
|
1789
|
+
* ```
|
|
1790
|
+
*/
|
|
1791
|
+
interface PptxSmartArtQuickStyle {
|
|
1792
|
+
/** Style name / title. */
|
|
1793
|
+
name?: string;
|
|
1794
|
+
/** Effect intensity identifier (e.g. "subtle", "moderate", "intense"). */
|
|
1795
|
+
effectIntensity?: string;
|
|
1796
|
+
}
|
|
1797
|
+
/**
|
|
1798
|
+
* Complete parsed SmartArt data for a {@link SmartArtPptxElement}.
|
|
1799
|
+
*
|
|
1800
|
+
* @example
|
|
1801
|
+
* ```ts
|
|
1802
|
+
* const data: PptxSmartArtData = {
|
|
1803
|
+
* resolvedLayoutType: "hierarchy",
|
|
1804
|
+
* layout: "hierarchy",
|
|
1805
|
+
* colorScheme: "colorful1",
|
|
1806
|
+
* style: "moderate",
|
|
1807
|
+
* nodes: [
|
|
1808
|
+
* { id: "1", text: "CEO", children: [
|
|
1809
|
+
* { id: "2", text: "VP Marketing", parentId: "1" },
|
|
1810
|
+
* ]},
|
|
1811
|
+
* ],
|
|
1812
|
+
* };
|
|
1813
|
+
* // => satisfies PptxSmartArtData
|
|
1814
|
+
* ```
|
|
1815
|
+
*/
|
|
1816
|
+
interface PptxSmartArtData {
|
|
1817
|
+
layoutType?: string;
|
|
1818
|
+
resolvedLayoutType?: SmartArtLayoutType;
|
|
1819
|
+
/** Named layout preset (used when creating new SmartArt). */
|
|
1820
|
+
layout?: SmartArtLayout;
|
|
1821
|
+
/** Colour scheme for the SmartArt graphic. */
|
|
1822
|
+
colorScheme?: SmartArtColorScheme;
|
|
1823
|
+
/** Visual style intensity. */
|
|
1824
|
+
style?: SmartArtStyle;
|
|
1825
|
+
nodes: PptxSmartArtNode[];
|
|
1826
|
+
/** Connections between data-model nodes. */
|
|
1827
|
+
connections?: PptxSmartArtConnection[];
|
|
1828
|
+
/** Pre-computed shapes from `ppt/diagrams/drawing*.xml`. */
|
|
1829
|
+
drawingShapes?: PptxSmartArtDrawingShape[];
|
|
1830
|
+
/** Background and outline chrome from `dgm:bg` / `dgm:whole`. */
|
|
1831
|
+
chrome?: PptxSmartArtChrome;
|
|
1832
|
+
/** Colour transform from `ppt/diagrams/colors*.xml`. */
|
|
1833
|
+
colorTransform?: PptxSmartArtColorTransform;
|
|
1834
|
+
/** Quick style from `ppt/diagrams/quickStyles*.xml`. */
|
|
1835
|
+
quickStyle?: PptxSmartArtQuickStyle;
|
|
1836
|
+
/** Relationship ID for the diagram data part (for round-trip save). */
|
|
1837
|
+
dataRelId?: string;
|
|
1838
|
+
/** Relationship ID for the drawing part. */
|
|
1839
|
+
drawingRelId?: string;
|
|
1840
|
+
/** Relationship ID for the colours part. */
|
|
1841
|
+
colorsRelId?: string;
|
|
1842
|
+
/** Relationship ID for the quick-styles part. */
|
|
1843
|
+
styleRelId?: string;
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
/**
|
|
1847
|
+
* Table types: cell styling, cell data, rows, table data, and the parsed
|
|
1848
|
+
* table style map from `ppt/tableStyles.xml`.
|
|
1849
|
+
*
|
|
1850
|
+
* @module pptx-types/table
|
|
1851
|
+
*/
|
|
1852
|
+
/**
|
|
1853
|
+
* Per-cell visual style for a table cell.
|
|
1854
|
+
*
|
|
1855
|
+
* All fields are optional — unset values inherit from the table style.
|
|
1856
|
+
*
|
|
1857
|
+
* @example
|
|
1858
|
+
* ```ts
|
|
1859
|
+
* const header: PptxTableCellStyle = {
|
|
1860
|
+
* bold: true,
|
|
1861
|
+
* fontSize: 14,
|
|
1862
|
+
* color: "#FFFFFF",
|
|
1863
|
+
* backgroundColor: "#0055AA",
|
|
1864
|
+
* align: "center",
|
|
1865
|
+
* };
|
|
1866
|
+
* // => satisfies PptxTableCellStyle
|
|
1867
|
+
* ```
|
|
1868
|
+
*/
|
|
1869
|
+
interface PptxTableCellStyle {
|
|
1870
|
+
fontSize?: number;
|
|
1871
|
+
bold?: boolean;
|
|
1872
|
+
italic?: boolean;
|
|
1873
|
+
underline?: boolean;
|
|
1874
|
+
color?: string;
|
|
1875
|
+
backgroundColor?: string;
|
|
1876
|
+
borderColor?: string;
|
|
1877
|
+
/** Top border width in px. */
|
|
1878
|
+
borderTopWidth?: number;
|
|
1879
|
+
/** Bottom border width in px. */
|
|
1880
|
+
borderBottomWidth?: number;
|
|
1881
|
+
/** Left border width in px. */
|
|
1882
|
+
borderLeftWidth?: number;
|
|
1883
|
+
/** Right border width in px. */
|
|
1884
|
+
borderRightWidth?: number;
|
|
1885
|
+
/** Top border color as hex. */
|
|
1886
|
+
borderTopColor?: string;
|
|
1887
|
+
/** Bottom border color as hex. */
|
|
1888
|
+
borderBottomColor?: string;
|
|
1889
|
+
/** Left border color as hex. */
|
|
1890
|
+
borderLeftColor?: string;
|
|
1891
|
+
/** Right border color as hex. */
|
|
1892
|
+
borderRightColor?: string;
|
|
1893
|
+
align?: 'left' | 'center' | 'right' | 'justify';
|
|
1894
|
+
vAlign?: 'top' | 'middle' | 'bottom';
|
|
1895
|
+
/** Text direction from `a:tcPr/@vert`. */
|
|
1896
|
+
textDirection?: 'vertical' | 'vertical270' | 'eaVert' | 'wordArtVert' | 'wordArtVertRtl' | 'mongolianVert';
|
|
1897
|
+
/** Cell left margin in px (from a:tcPr > a:tcMar > a:marL). */
|
|
1898
|
+
marginLeft?: number;
|
|
1899
|
+
/** Cell right margin in px. */
|
|
1900
|
+
marginRight?: number;
|
|
1901
|
+
/** Cell top margin in px. */
|
|
1902
|
+
marginTop?: number;
|
|
1903
|
+
/** Cell bottom margin in px. */
|
|
1904
|
+
marginBottom?: number;
|
|
1905
|
+
/** Diagonal border top-left to bottom-right color. */
|
|
1906
|
+
borderDiagDownColor?: string;
|
|
1907
|
+
/** Diagonal border top-left to bottom-right width in px. */
|
|
1908
|
+
borderDiagDownWidth?: number;
|
|
1909
|
+
/** Diagonal border bottom-left to top-right color. */
|
|
1910
|
+
borderDiagUpColor?: string;
|
|
1911
|
+
/** Diagonal border bottom-left to top-right width in px. */
|
|
1912
|
+
borderDiagUpWidth?: number;
|
|
1913
|
+
/** Table cell border dash style (legacy single value). */
|
|
1914
|
+
borderDash?: string;
|
|
1915
|
+
/** Per-edge border dash styles. */
|
|
1916
|
+
borderTopDash?: string;
|
|
1917
|
+
borderBottomDash?: string;
|
|
1918
|
+
borderLeftDash?: string;
|
|
1919
|
+
borderRightDash?: string;
|
|
1920
|
+
/** Cell text shadow colour. */
|
|
1921
|
+
textShadowColor?: string;
|
|
1922
|
+
/** Cell text shadow blur radius in px. */
|
|
1923
|
+
textShadowBlur?: number;
|
|
1924
|
+
/** Cell text shadow horizontal offset in px. */
|
|
1925
|
+
textShadowOffsetX?: number;
|
|
1926
|
+
/** Cell text shadow vertical offset in px. */
|
|
1927
|
+
textShadowOffsetY?: number;
|
|
1928
|
+
/** Cell text shadow opacity (0-1). */
|
|
1929
|
+
textShadowOpacity?: number;
|
|
1930
|
+
/** Cell text glow colour. */
|
|
1931
|
+
textGlowColor?: string;
|
|
1932
|
+
/** Cell text glow radius in px. */
|
|
1933
|
+
textGlowRadius?: number;
|
|
1934
|
+
/** Cell text glow opacity (0-1). */
|
|
1935
|
+
textGlowOpacity?: number;
|
|
1936
|
+
/** Cell fill mode: solid, gradient, pattern, or none. */
|
|
1937
|
+
fillMode?: 'solid' | 'gradient' | 'pattern' | 'none';
|
|
1938
|
+
/** Gradient fill stops (colours with positions). */
|
|
1939
|
+
gradientFillStops?: Array<{
|
|
1940
|
+
color: string;
|
|
1941
|
+
position: number;
|
|
1942
|
+
opacity?: number;
|
|
1943
|
+
}>;
|
|
1944
|
+
/** Gradient angle in degrees. */
|
|
1945
|
+
gradientFillAngle?: number;
|
|
1946
|
+
/** Gradient type: linear or radial. */
|
|
1947
|
+
gradientFillType?: 'linear' | 'radial';
|
|
1948
|
+
/** Path gradient sub-type. */
|
|
1949
|
+
gradientFillPathType?: 'circle' | 'rect' | 'shape';
|
|
1950
|
+
/** Focal point for radial gradients (0–1 fractions). */
|
|
1951
|
+
gradientFillFocalPoint?: {
|
|
1952
|
+
x: number;
|
|
1953
|
+
y: number;
|
|
1954
|
+
};
|
|
1955
|
+
/** Raw fillToRect LTRB values (0–1 fractions) for gradient sizing. */
|
|
1956
|
+
gradientFillFillToRect?: {
|
|
1957
|
+
l: number;
|
|
1958
|
+
t: number;
|
|
1959
|
+
r: number;
|
|
1960
|
+
b: number;
|
|
1961
|
+
};
|
|
1962
|
+
/** Pre-computed CSS gradient string for rendering. */
|
|
1963
|
+
gradientFillCss?: string;
|
|
1964
|
+
/** Pattern fill preset name (e.g. "ltDnDiag"). */
|
|
1965
|
+
patternFillPreset?: string;
|
|
1966
|
+
/** Pattern fill foreground colour. */
|
|
1967
|
+
patternFillForeground?: string;
|
|
1968
|
+
/** Pattern fill background colour. */
|
|
1969
|
+
patternFillBackground?: string;
|
|
1970
|
+
}
|
|
1971
|
+
/**
|
|
1972
|
+
* A single table cell with text content, optional style, and merge info.
|
|
1973
|
+
*
|
|
1974
|
+
* @example
|
|
1975
|
+
* ```ts
|
|
1976
|
+
* const cell: PptxTableCell = {
|
|
1977
|
+
* text: "$1.5M",
|
|
1978
|
+
* style: { bold: true, align: "right" },
|
|
1979
|
+
* gridSpan: 1,
|
|
1980
|
+
* };
|
|
1981
|
+
* // => satisfies PptxTableCell
|
|
1982
|
+
* ```
|
|
1983
|
+
*/
|
|
1984
|
+
interface PptxTableCell {
|
|
1985
|
+
text: string;
|
|
1986
|
+
style?: PptxTableCellStyle;
|
|
1987
|
+
/** Column span (defaults to 1). */
|
|
1988
|
+
gridSpan?: number;
|
|
1989
|
+
/** Row span (defaults to 1). */
|
|
1990
|
+
rowSpan?: number;
|
|
1991
|
+
/** Whether this cell is merged vertically with the cell above. */
|
|
1992
|
+
vMerge?: boolean;
|
|
1993
|
+
/** Whether this cell is horizontally merged with the cell to the left (gridSpan continuation). */
|
|
1994
|
+
hMerge?: boolean;
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* A single table row with an optional height and an array of cells.
|
|
1998
|
+
*
|
|
1999
|
+
* @example
|
|
2000
|
+
* ```ts
|
|
2001
|
+
* const row: PptxTableRow = {
|
|
2002
|
+
* height: 40,
|
|
2003
|
+
* cells: [
|
|
2004
|
+
* { text: "Name" },
|
|
2005
|
+
* { text: "Score" },
|
|
2006
|
+
* ],
|
|
2007
|
+
* };
|
|
2008
|
+
* // => satisfies PptxTableRow
|
|
2009
|
+
* ```
|
|
2010
|
+
*/
|
|
2011
|
+
interface PptxTableRow {
|
|
2012
|
+
/** Row height in px. */
|
|
2013
|
+
height?: number;
|
|
2014
|
+
cells: PptxTableCell[];
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Complete parsed table data for a {@link TablePptxElement}.
|
|
2018
|
+
*
|
|
2019
|
+
* Includes row/cell data, column widths, banding flags, and the applied
|
|
2020
|
+
* table style ID.
|
|
2021
|
+
*
|
|
2022
|
+
* @example
|
|
2023
|
+
* ```ts
|
|
2024
|
+
* const data: PptxTableData = {
|
|
2025
|
+
* rows: [
|
|
2026
|
+
* { cells: [{ text: "Product" }, { text: "Revenue" }] },
|
|
2027
|
+
* { cells: [{ text: "Widget A" }, { text: "$3.4M" }] },
|
|
2028
|
+
* ],
|
|
2029
|
+
* columnWidths: [0.6, 0.4],
|
|
2030
|
+
* firstRowHeader: true,
|
|
2031
|
+
* bandedRows: true,
|
|
2032
|
+
* };
|
|
2033
|
+
* // => satisfies PptxTableData
|
|
2034
|
+
* ```
|
|
2035
|
+
*/
|
|
2036
|
+
interface PptxTableData {
|
|
2037
|
+
rows: PptxTableRow[];
|
|
2038
|
+
/** Column widths as proportion of total (summing to 1). */
|
|
2039
|
+
columnWidths: number[];
|
|
2040
|
+
/** Whether the table has banded rows. */
|
|
2041
|
+
bandedRows?: boolean;
|
|
2042
|
+
/** Whether the first row is a header. */
|
|
2043
|
+
firstRowHeader?: boolean;
|
|
2044
|
+
/** Whether banded columns are enabled. */
|
|
2045
|
+
bandedColumns?: boolean;
|
|
2046
|
+
/** Whether the last row is styled as a total row. */
|
|
2047
|
+
lastRow?: boolean;
|
|
2048
|
+
/** Whether the first column is styled as a header column. */
|
|
2049
|
+
firstCol?: boolean;
|
|
2050
|
+
/** Whether the last column is styled specially. */
|
|
2051
|
+
lastCol?: boolean;
|
|
2052
|
+
/** Table style ID from `a:tblPr/a:tblStyle@val` or `a:tblPr@tblStyle`. */
|
|
2053
|
+
tableStyleId?: string;
|
|
2054
|
+
/** Number of rows per banding group (default 1). */
|
|
2055
|
+
bandRowCycle?: number;
|
|
2056
|
+
/** Number of columns per banding group (default 1). */
|
|
2057
|
+
bandColCycle?: number;
|
|
2058
|
+
}
|
|
2059
|
+
/**
|
|
2060
|
+
* A single fill reference within a table style section.
|
|
2061
|
+
*
|
|
2062
|
+
* @example
|
|
2063
|
+
* ```ts
|
|
2064
|
+
* const fill: ParsedTableStyleFill = {
|
|
2065
|
+
* schemeColor: "accent1",
|
|
2066
|
+
* tint: 40000, // 40% tint
|
|
2067
|
+
* };
|
|
2068
|
+
* // => satisfies ParsedTableStyleFill
|
|
2069
|
+
* ```
|
|
2070
|
+
*/
|
|
2071
|
+
interface ParsedTableStyleFill {
|
|
2072
|
+
/** Theme colour key (e.g. `accent1`, `dk1`). */
|
|
2073
|
+
schemeColor: string;
|
|
2074
|
+
/** Tint value (0-100 000). */
|
|
2075
|
+
tint?: number;
|
|
2076
|
+
/** Shade value (0-100 000). */
|
|
2077
|
+
shade?: number;
|
|
2078
|
+
}
|
|
2079
|
+
/**
|
|
2080
|
+
* A single entry in the parsed table style map.
|
|
2081
|
+
*
|
|
2082
|
+
* Contains fill colours for whole-table, banded rows/columns, first/last
|
|
2083
|
+
* row, and first/last column sections.
|
|
2084
|
+
*
|
|
2085
|
+
* @example
|
|
2086
|
+
* ```ts
|
|
2087
|
+
* const entry: ParsedTableStyleEntry = {
|
|
2088
|
+
* styleId: "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}",
|
|
2089
|
+
* styleName: "Medium Style 2 - Accent 1",
|
|
2090
|
+
* accentKey: "accent1",
|
|
2091
|
+
* wholeTblFill: { schemeColor: "accent1", tint: 20000 },
|
|
2092
|
+
* band1HFill: { schemeColor: "accent1", tint: 40000 },
|
|
2093
|
+
* firstRowFill: { schemeColor: "accent1" },
|
|
2094
|
+
* };
|
|
2095
|
+
* // => satisfies ParsedTableStyleEntry
|
|
2096
|
+
* ```
|
|
2097
|
+
*/
|
|
2098
|
+
/** Text properties from a:tcTxStyle in a table style section. */
|
|
2099
|
+
interface ParsedTableStyleText {
|
|
2100
|
+
/** Font bold. */
|
|
2101
|
+
bold?: boolean;
|
|
2102
|
+
/** Font italic. */
|
|
2103
|
+
italic?: boolean;
|
|
2104
|
+
/** Font colour as theme scheme key. */
|
|
2105
|
+
fontSchemeColor?: string;
|
|
2106
|
+
/** Font colour tint (0-100 000). */
|
|
2107
|
+
fontTint?: number;
|
|
2108
|
+
/** Font colour shade (0-100 000). */
|
|
2109
|
+
fontShade?: number;
|
|
2110
|
+
}
|
|
2111
|
+
interface ParsedTableStyleEntry {
|
|
2112
|
+
styleId: string;
|
|
2113
|
+
styleName?: string;
|
|
2114
|
+
/** Dominant accent key derived from fills (e.g. `accent1`). */
|
|
2115
|
+
accentKey?: string;
|
|
2116
|
+
wholeTblFill?: ParsedTableStyleFill;
|
|
2117
|
+
band1HFill?: ParsedTableStyleFill;
|
|
2118
|
+
band2HFill?: ParsedTableStyleFill;
|
|
2119
|
+
band1VFill?: ParsedTableStyleFill;
|
|
2120
|
+
band2VFill?: ParsedTableStyleFill;
|
|
2121
|
+
firstRowFill?: ParsedTableStyleFill;
|
|
2122
|
+
lastRowFill?: ParsedTableStyleFill;
|
|
2123
|
+
firstColFill?: ParsedTableStyleFill;
|
|
2124
|
+
lastColFill?: ParsedTableStyleFill;
|
|
2125
|
+
/** Per-role text styling from a:tcTxStyle. */
|
|
2126
|
+
wholeTblText?: ParsedTableStyleText;
|
|
2127
|
+
firstRowText?: ParsedTableStyleText;
|
|
2128
|
+
lastRowText?: ParsedTableStyleText;
|
|
2129
|
+
firstColText?: ParsedTableStyleText;
|
|
2130
|
+
lastColText?: ParsedTableStyleText;
|
|
2131
|
+
band1HText?: ParsedTableStyleText;
|
|
2132
|
+
band2HText?: ParsedTableStyleText;
|
|
2133
|
+
band1VText?: ParsedTableStyleText;
|
|
2134
|
+
band2VText?: ParsedTableStyleText;
|
|
2135
|
+
}
|
|
2136
|
+
/**
|
|
2137
|
+
* Map of GUID → table style entry.
|
|
2138
|
+
*
|
|
2139
|
+
* Parsed from `ppt/tableStyles.xml` and indexed by the style GUID
|
|
2140
|
+
* referenced in `a:tblPr@tblStyle`.
|
|
2141
|
+
*
|
|
2142
|
+
* @example
|
|
2143
|
+
* ```ts
|
|
2144
|
+
* const styles: ParsedTableStyleMap = {
|
|
2145
|
+
* "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}": {
|
|
2146
|
+
* styleId: "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}",
|
|
2147
|
+
* styleName: "Medium Style 2 - Accent 1",
|
|
2148
|
+
* accentKey: "accent1",
|
|
2149
|
+
* },
|
|
2150
|
+
* };
|
|
2151
|
+
* // => satisfies ParsedTableStyleMap
|
|
2152
|
+
* ```
|
|
2153
|
+
*/
|
|
2154
|
+
type ParsedTableStyleMap = Record<string, ParsedTableStyleEntry>;
|
|
2155
|
+
|
|
2156
|
+
/**
|
|
2157
|
+
* Slide transition types and the {@link PptxSlideTransition} data structure.
|
|
2158
|
+
*
|
|
2159
|
+
* Represents the `<p:transition>` element on each slide, including
|
|
2160
|
+
* transition type, duration, direction, and advance timing.
|
|
2161
|
+
*
|
|
2162
|
+
* @module pptx-types/transition
|
|
2163
|
+
*/
|
|
2164
|
+
|
|
2165
|
+
/**
|
|
2166
|
+
* Available slide transition effects.
|
|
2167
|
+
*
|
|
2168
|
+
* Maps to the OOXML child element names under `<p:transition>` / `<p14:transition>`.
|
|
2169
|
+
*
|
|
2170
|
+
* @example
|
|
2171
|
+
* ```ts
|
|
2172
|
+
* const t: PptxTransitionType = "morph";
|
|
2173
|
+
* // => "morph" — one of 40+ transition effects
|
|
2174
|
+
* ```
|
|
2175
|
+
*/
|
|
2176
|
+
type PptxTransitionType = 'none' | 'cut' | 'fade' | 'push' | 'wipe' | 'split' | 'randomBar' | 'blinds' | 'checker' | 'circle' | 'comb' | 'cover' | 'diamond' | 'dissolve' | 'plus' | 'pull' | 'random' | 'strips' | 'uncover' | 'wedge' | 'wheel' | 'zoom' | 'newsflash' | 'morph' | 'conveyor' | 'doors' | 'ferris' | 'flash' | 'flythrough' | 'gallery' | 'glitter' | 'honeycomb' | 'pan' | 'prism' | 'reveal' | 'ripple' | 'shred' | 'switch' | 'vortex' | 'warp' | 'wheelReverse' | 'window';
|
|
2177
|
+
/** Cardinal direction tokens from OOXML transition `@_dir`. */
|
|
2178
|
+
type PptxTransitionDirection4 = 'l' | 'r' | 'u' | 'd';
|
|
2179
|
+
/** 8-way direction tokens (cardinal + diagonal) for cover/uncover. */
|
|
2180
|
+
type PptxTransitionDirection8 = PptxTransitionDirection4 | 'lu' | 'ld' | 'ru' | 'rd';
|
|
2181
|
+
/** Strip direction tokens from OOXML. */
|
|
2182
|
+
type PptxStripDirection = 'lu' | 'ld' | 'ru' | 'rd';
|
|
2183
|
+
/** Split orientation from OOXML `@_orient`. */
|
|
2184
|
+
type PptxSplitOrientation = 'horz' | 'vert';
|
|
2185
|
+
/** Split in/out direction from OOXML `@_dir`. */
|
|
2186
|
+
type PptxSplitDirection = 'in' | 'out';
|
|
2187
|
+
/** Valid direction sets per transition type. */
|
|
2188
|
+
declare const TRANSITION_VALID_DIRECTIONS: Readonly<Partial<Record<PptxTransitionType, readonly string[]>>>;
|
|
2189
|
+
/**
|
|
2190
|
+
* Slide transition configuration.
|
|
2191
|
+
*
|
|
2192
|
+
* @example
|
|
2193
|
+
* ```ts
|
|
2194
|
+
* const transition: PptxSlideTransition = {
|
|
2195
|
+
* type: "fade",
|
|
2196
|
+
* durationMs: 700,
|
|
2197
|
+
* advanceOnClick: true,
|
|
2198
|
+
* advanceAfterMs: 5000,
|
|
2199
|
+
* };
|
|
2200
|
+
* // => { type: "fade", durationMs: 700, advanceOnClick: true, advanceAfterMs: 5000 }
|
|
2201
|
+
* ```
|
|
2202
|
+
*/
|
|
2203
|
+
interface PptxSlideTransition {
|
|
2204
|
+
type: PptxTransitionType;
|
|
2205
|
+
durationMs?: number;
|
|
2206
|
+
direction?: string;
|
|
2207
|
+
advanceOnClick?: boolean;
|
|
2208
|
+
advanceAfterMs?: number;
|
|
2209
|
+
/** Number of spokes for wheel transition (1-8). */
|
|
2210
|
+
spokes?: number;
|
|
2211
|
+
/** Pattern type for shred transition. */
|
|
2212
|
+
pattern?: string;
|
|
2213
|
+
/** Through-black flag for blinds/checker (OOXML `@_thruBlk`). */
|
|
2214
|
+
thruBlk?: boolean;
|
|
2215
|
+
/** Split orientation (horz/vert) parsed from `@_orient`. */
|
|
2216
|
+
orient?: PptxSplitOrientation;
|
|
2217
|
+
/** Relationship ID of transition sound from `p:sndAc/p:stSnd/@r:embed` when present. */
|
|
2218
|
+
soundRId?: string;
|
|
2219
|
+
/** Resolved transition sound media path within the package. */
|
|
2220
|
+
soundPath?: string;
|
|
2221
|
+
/** Human-readable sound file name (extracted from soundPath). */
|
|
2222
|
+
soundFileName?: string;
|
|
2223
|
+
/** Preserved sound-action XML node from `p:sndAc` for lossless round-trip. */
|
|
2224
|
+
rawSoundAction?: XmlObject;
|
|
2225
|
+
/** Preserved extension-list XML node from `p:extLst` within the transition for lossless round-trip. */
|
|
2226
|
+
rawExtLst?: XmlObject;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
/**
|
|
2230
|
+
* Animation types: presets, triggers, timing, native parsed animation data,
|
|
2231
|
+
* and the high-level {@link PptxElementAnimation} associated with each element.
|
|
2232
|
+
*
|
|
2233
|
+
* @module pptx-types/animation
|
|
2234
|
+
*/
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* Built-in animation preset names used for entrance, exit, and emphasis effects.
|
|
2238
|
+
*
|
|
2239
|
+
* @example
|
|
2240
|
+
* ```ts
|
|
2241
|
+
* const preset: PptxAnimationPreset = "fadeIn";
|
|
2242
|
+
* // => "fadeIn" — one of: none | fadeIn | flyIn | zoomIn | fadeOut | flyOut | zoomOut | spin | pulse | ...
|
|
2243
|
+
* ```
|
|
2244
|
+
*/
|
|
2245
|
+
type PptxAnimationPreset = 'none' | 'appear' | 'fadeIn' | 'flyIn' | 'zoomIn' | 'bounceIn' | 'wipeIn' | 'splitIn' | 'dissolveIn' | 'wheelIn' | 'blindsIn' | 'boxIn' | 'floatIn' | 'riseUp' | 'swivel' | 'expandIn' | 'checkerboardIn' | 'flashIn' | 'peekIn' | 'randomBarsIn' | 'spinnerIn' | 'growTurnIn' | 'fadeOut' | 'flyOut' | 'zoomOut' | 'bounceOut' | 'wipeOut' | 'shrinkOut' | 'dissolveOut' | 'disappear' | 'spin' | 'pulse' | 'colorWave' | 'bounce' | 'flash' | 'growShrink' | 'teeter' | 'transparency' | 'boldFlash' | 'wave';
|
|
2246
|
+
/** Animation timing curve. */
|
|
2247
|
+
type PptxAnimationTimingCurve = 'ease' | 'ease-in' | 'ease-out' | 'linear';
|
|
2248
|
+
/** Repeat mode for animations. */
|
|
2249
|
+
type PptxAnimationRepeatMode = 'untilNextClick' | 'untilEndOfSlide';
|
|
2250
|
+
/** Animation trigger type from OOXML `p:cTn`. */
|
|
2251
|
+
type PptxAnimationTrigger = 'onClick' | 'onShapeClick' | 'onHover' | 'afterPrevious' | 'withPrevious' | 'afterDelay';
|
|
2252
|
+
/**
|
|
2253
|
+
* Parsed native animation record from `p:timing / p:tnLst`.
|
|
2254
|
+
*
|
|
2255
|
+
* Represents a single animation node in the OOXML timing tree,
|
|
2256
|
+
* including motion paths, scale transforms, and text build settings.
|
|
2257
|
+
*
|
|
2258
|
+
* @example
|
|
2259
|
+
* ```ts
|
|
2260
|
+
* const anim: PptxNativeAnimation = {
|
|
2261
|
+
* targetId: "shape_1",
|
|
2262
|
+
* presetClass: "entr",
|
|
2263
|
+
* presetId: 10,
|
|
2264
|
+
* trigger: "afterPrevious",
|
|
2265
|
+
* durationMs: 500,
|
|
2266
|
+
* };
|
|
2267
|
+
* // => { targetId: "shape_1", presetClass: "entr", presetId: 10, trigger: "afterPrevious", durationMs: 500 }
|
|
2268
|
+
* ```
|
|
2269
|
+
*/
|
|
2270
|
+
interface PptxNativeAnimation {
|
|
2271
|
+
/** Target element/shape ID. */
|
|
2272
|
+
targetId?: string;
|
|
2273
|
+
/** Trigger type. */
|
|
2274
|
+
trigger?: PptxAnimationTrigger;
|
|
2275
|
+
/** Shape ID that triggers this animation when clicked (interactive sequence). */
|
|
2276
|
+
triggerShapeId?: string;
|
|
2277
|
+
/** Effect preset class (entr, exit, emph, path). */
|
|
2278
|
+
presetClass?: 'entr' | 'exit' | 'emph' | 'path';
|
|
2279
|
+
/** Effect preset sub-type identifier. */
|
|
2280
|
+
presetId?: number;
|
|
2281
|
+
/** Duration in milliseconds. */
|
|
2282
|
+
durationMs?: number;
|
|
2283
|
+
/** Delay in milliseconds. */
|
|
2284
|
+
delayMs?: number;
|
|
2285
|
+
/** Trigger delay in milliseconds (for afterDelay). */
|
|
2286
|
+
triggerDelayMs?: number;
|
|
2287
|
+
/** SVG path string for motion path animations (`p:animMotion/@path`). */
|
|
2288
|
+
motionPath?: string;
|
|
2289
|
+
/** Motion origin: "layout" or "parent". */
|
|
2290
|
+
motionOrigin?: string;
|
|
2291
|
+
/** Whether the element auto-rotates to follow the motion path tangent (`p:animMotion/@rAng` = "0"). */
|
|
2292
|
+
motionPathRotateAuto?: boolean;
|
|
2293
|
+
/** Rotation angle in degrees for `p:animRot` (converted from 60000ths). */
|
|
2294
|
+
rotationBy?: number;
|
|
2295
|
+
/** X scale factor (percentage / 100) for `p:animScale`. */
|
|
2296
|
+
scaleByX?: number;
|
|
2297
|
+
/** Y scale factor (percentage / 100) for `p:animScale`. */
|
|
2298
|
+
scaleByY?: number;
|
|
2299
|
+
/** Repeat count (e.g. `2`, `Infinity` for indefinite). */
|
|
2300
|
+
repeatCount?: number;
|
|
2301
|
+
/** Whether the animation plays in reverse after completion. */
|
|
2302
|
+
autoReverse?: boolean;
|
|
2303
|
+
/** Text build type from `p:bldP/@build` in `p:bldLst`. */
|
|
2304
|
+
buildType?: PptxTextBuildType;
|
|
2305
|
+
/** Build level for multi-level lists from `p:bldP/@bldLvl`. */
|
|
2306
|
+
buildLevel?: number;
|
|
2307
|
+
/** Group ID linking a `p:bldP` entry to its timing animation node. */
|
|
2308
|
+
groupId?: string;
|
|
2309
|
+
/** Sound relationship ID to play when animation triggers (`p:stSnd`). */
|
|
2310
|
+
soundRId?: string;
|
|
2311
|
+
/** Resolved sound file path from relationship. */
|
|
2312
|
+
soundPath?: string;
|
|
2313
|
+
/** Whether to stop any currently playing sound (`p:endSnd`). */
|
|
2314
|
+
stopSound?: boolean;
|
|
2315
|
+
/** Structured start conditions parsed from `p:stCondLst`. */
|
|
2316
|
+
startConditions?: AnimationCondition[];
|
|
2317
|
+
/** Structured end conditions parsed from `p:endCondLst`. */
|
|
2318
|
+
endConditions?: AnimationCondition[];
|
|
2319
|
+
/** Preserved raw `p:endCondLst` XML node for lossless round-trip. */
|
|
2320
|
+
rawEndCondLst?: XmlObject;
|
|
2321
|
+
/** Color animation data from `p:animClr`. */
|
|
2322
|
+
colorAnimation?: PptxColorAnimation;
|
|
2323
|
+
/** Text-level target: character range or paragraph range from `p:txEl`. */
|
|
2324
|
+
textTarget?: PptxTextAnimationTarget;
|
|
2325
|
+
/** Whether this animation is inside an exclusive container (`p:excl`). */
|
|
2326
|
+
exclusive?: boolean;
|
|
2327
|
+
/** Command type from `p:cmd` (@_type: call/evt/verb). */
|
|
2328
|
+
commandType?: string;
|
|
2329
|
+
/** Command string from `p:cmd` (@_cmd). */
|
|
2330
|
+
commandString?: string;
|
|
2331
|
+
/** Iteration configuration from `p:iterate`. */
|
|
2332
|
+
iterate?: PptxAnimationIterate;
|
|
2333
|
+
}
|
|
2334
|
+
/** Color animation data parsed from `p:animClr`. */
|
|
2335
|
+
interface PptxColorAnimation {
|
|
2336
|
+
/** Color interpolation space: "hsl" or "rgb". */
|
|
2337
|
+
colorSpace: 'hsl' | 'rgb';
|
|
2338
|
+
/** Direction for HSL interpolation: "cw" (clockwise) or "ccw". */
|
|
2339
|
+
direction?: 'cw' | 'ccw';
|
|
2340
|
+
/** Starting color as hex string. */
|
|
2341
|
+
fromColor?: string;
|
|
2342
|
+
/** Ending color as hex string. */
|
|
2343
|
+
toColor?: string;
|
|
2344
|
+
/** Color delta (for "by" animations) as hex string. */
|
|
2345
|
+
byColor?: string;
|
|
2346
|
+
/**
|
|
2347
|
+
* Target attribute from `p:attrNameLst` (e.g. "fillcolor", "style.color",
|
|
2348
|
+
* "stroke.color"). Used to determine which CSS property to animate.
|
|
2349
|
+
*/
|
|
2350
|
+
targetAttribute?: string;
|
|
2351
|
+
}
|
|
2352
|
+
/** Text-level animation target from `p:txEl`. */
|
|
2353
|
+
interface PptxTextAnimationTarget {
|
|
2354
|
+
/** Target type: character range or paragraph range. */
|
|
2355
|
+
type: 'charRg' | 'pRg';
|
|
2356
|
+
/** Start index (0-based). */
|
|
2357
|
+
start: number;
|
|
2358
|
+
/** End index (exclusive). */
|
|
2359
|
+
end: number;
|
|
2360
|
+
}
|
|
2361
|
+
/**
|
|
2362
|
+
* Event types for animation conditions from `p:cond/@evt`.
|
|
2363
|
+
*
|
|
2364
|
+
* These map directly to OOXML condition event attribute values
|
|
2365
|
+
* (ISO/IEC 29500-1 S19.5.28 CT_TLTimeCondition).
|
|
2366
|
+
*/
|
|
2367
|
+
type AnimationConditionEvent = 'onBegin' | 'onEnd' | 'begin' | 'end' | 'onClick' | 'onMouseOver' | 'onMouseOut' | 'onNext' | 'onPrev' | 'onStopAudio';
|
|
2368
|
+
/**
|
|
2369
|
+
* Structured representation of a single OOXML animation condition
|
|
2370
|
+
* from `p:cond` elements inside `p:stCondLst` or `p:endCondLst`.
|
|
2371
|
+
*
|
|
2372
|
+
* Conditions control when an animation starts or ends, and can reference
|
|
2373
|
+
* events, time delays, and target time node IDs.
|
|
2374
|
+
*
|
|
2375
|
+
* @example
|
|
2376
|
+
* ```ts
|
|
2377
|
+
* const cond: AnimationCondition = {
|
|
2378
|
+
* event: "onClick",
|
|
2379
|
+
* delay: 0,
|
|
2380
|
+
* targetShapeId: "shape_5",
|
|
2381
|
+
* };
|
|
2382
|
+
* ```
|
|
2383
|
+
*/
|
|
2384
|
+
interface AnimationCondition {
|
|
2385
|
+
/** Event that triggers the condition. */
|
|
2386
|
+
event?: AnimationConditionEvent;
|
|
2387
|
+
/** Delay in milliseconds (from `@_delay`). "indefinite" is represented as -1. */
|
|
2388
|
+
delay?: number;
|
|
2389
|
+
/** Target time node ID reference (from `@_tn`). */
|
|
2390
|
+
targetTimeNodeId?: number;
|
|
2391
|
+
/** Target shape ID from `p:tgtEl/p:spTgt/@spid`. */
|
|
2392
|
+
targetShapeId?: string;
|
|
2393
|
+
/** Whether the condition targets a slide (from `p:tgtEl/p:sldTgt`). */
|
|
2394
|
+
targetSlide?: boolean;
|
|
2395
|
+
}
|
|
2396
|
+
/** Iteration configuration from `p:iterate`. */
|
|
2397
|
+
interface PptxAnimationIterate {
|
|
2398
|
+
/** Iteration type: el (element), lt (letter), wd (word). */
|
|
2399
|
+
type: 'el' | 'lt' | 'wd';
|
|
2400
|
+
/** Whether to iterate backwards. */
|
|
2401
|
+
backwards?: boolean;
|
|
2402
|
+
/** Timing interval (percentage of total duration, in 1000ths). */
|
|
2403
|
+
tmPct?: number;
|
|
2404
|
+
/** Absolute timing interval in ms. */
|
|
2405
|
+
tmAbs?: number;
|
|
2406
|
+
}
|
|
2407
|
+
/** Build type for text build (paragraph/word/letter) animations from `p:bldP/@build`. */
|
|
2408
|
+
type PptxTextBuildType = 'allAtOnce' | 'byParagraph' | 'byWord' | 'byChar';
|
|
2409
|
+
/** Direction for fly-in / fly-out / wipe effects. */
|
|
2410
|
+
type PptxAnimationDirection = 'fromLeft' | 'fromRight' | 'fromTop' | 'fromBottom' | 'fromTopLeft' | 'fromTopRight' | 'fromBottomLeft' | 'fromBottomRight';
|
|
2411
|
+
/** Sequence mode for paragraph-level animations. */
|
|
2412
|
+
type PptxAnimationSequence = 'asOne' | 'byParagraph' | 'byWord' | 'byLetter';
|
|
2413
|
+
/** Behavior after animation finishes. */
|
|
2414
|
+
type PptxAfterAnimationAction = 'none' | 'hideOnNextClick' | 'hideAfterAnimation' | 'dimToColor';
|
|
2415
|
+
/**
|
|
2416
|
+
* High-level animation data associated with a slide element.
|
|
2417
|
+
*
|
|
2418
|
+
* Combines entrance, exit, and emphasis presets with timing and
|
|
2419
|
+
* trigger configuration. Used by the editor’s animation panel
|
|
2420
|
+
* and the `setPptxElementAnimation` tool.
|
|
2421
|
+
*
|
|
2422
|
+
* @example
|
|
2423
|
+
* ```ts
|
|
2424
|
+
* const anim: PptxElementAnimation = {
|
|
2425
|
+
* elementId: "title_1",
|
|
2426
|
+
* entrance: "fadeIn",
|
|
2427
|
+
* durationMs: 600,
|
|
2428
|
+
* order: 1,
|
|
2429
|
+
* trigger: "afterPrevious",
|
|
2430
|
+
* };
|
|
2431
|
+
* // => { elementId: "title_1", entrance: "fadeIn", durationMs: 600, order: 1, trigger: "afterPrevious" }
|
|
2432
|
+
* ```
|
|
2433
|
+
*/
|
|
2434
|
+
interface PptxElementAnimation {
|
|
2435
|
+
elementId: string;
|
|
2436
|
+
entrance?: PptxAnimationPreset;
|
|
2437
|
+
exit?: PptxAnimationPreset;
|
|
2438
|
+
emphasis?: PptxAnimationPreset;
|
|
2439
|
+
durationMs?: number;
|
|
2440
|
+
delayMs?: number;
|
|
2441
|
+
order?: number;
|
|
2442
|
+
trigger?: PptxAnimationTrigger;
|
|
2443
|
+
/** Shape ID that triggers this animation when clicked (interactive sequence). */
|
|
2444
|
+
triggerShapeId?: string;
|
|
2445
|
+
timingCurve?: PptxAnimationTimingCurve;
|
|
2446
|
+
repeatCount?: number;
|
|
2447
|
+
repeatMode?: PptxAnimationRepeatMode;
|
|
2448
|
+
/** Direction for directional effects (fly in/out, wipe, etc.). */
|
|
2449
|
+
direction?: PptxAnimationDirection;
|
|
2450
|
+
/** Sequence mode — animate as one object or by paragraph/word/letter. */
|
|
2451
|
+
sequence?: PptxAnimationSequence;
|
|
2452
|
+
/** What happens after the animation finishes playing. */
|
|
2453
|
+
afterAnimation?: PptxAfterAnimationAction;
|
|
2454
|
+
/** Dim-to color hex (used when afterAnimation is "dimToColor"). */
|
|
2455
|
+
afterAnimationColor?: string;
|
|
2456
|
+
/** SVG motion path string for custom motion path animations. */
|
|
2457
|
+
motionPath?: string;
|
|
2458
|
+
/** Sound relationship ID to play when animation triggers (`p:stSnd`). */
|
|
2459
|
+
soundRId?: string;
|
|
2460
|
+
/** Resolved sound file path from relationship. */
|
|
2461
|
+
soundPath?: string;
|
|
2462
|
+
/** Whether to stop any currently playing sound (`p:endSnd`). */
|
|
2463
|
+
stopSound?: boolean;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
/**
|
|
2467
|
+
* Media types: audio/video discriminator, bookmarks, runtime metadata,
|
|
2468
|
+
* and caption/subtitle tracks.
|
|
2469
|
+
*
|
|
2470
|
+
* @module pptx-types/media
|
|
2471
|
+
*/
|
|
2472
|
+
/**
|
|
2473
|
+
* Discriminator for embedded media element types.
|
|
2474
|
+
*
|
|
2475
|
+
* @example
|
|
2476
|
+
* ```ts
|
|
2477
|
+
* const kind: PptxMediaType = "video";
|
|
2478
|
+
* // => "video" — one of: "video" | "audio" | "unknown"
|
|
2479
|
+
* ```
|
|
2480
|
+
*/
|
|
2481
|
+
type PptxMediaType = 'video' | 'audio' | 'unknown';
|
|
2482
|
+
/**
|
|
2483
|
+
* A named bookmark within a media clip timeline.
|
|
2484
|
+
*
|
|
2485
|
+
* @example
|
|
2486
|
+
* ```ts
|
|
2487
|
+
* const bm: MediaBookmark = {
|
|
2488
|
+
* id: "bm1",
|
|
2489
|
+
* time: 12.5,
|
|
2490
|
+
* label: "Intro ends",
|
|
2491
|
+
* };
|
|
2492
|
+
* // => satisfies MediaBookmark
|
|
2493
|
+
* ```
|
|
2494
|
+
*/
|
|
2495
|
+
interface MediaBookmark {
|
|
2496
|
+
id: string;
|
|
2497
|
+
/** Position in seconds from the start of the clip. */
|
|
2498
|
+
time: number;
|
|
2499
|
+
/** User-visible label for this bookmark. */
|
|
2500
|
+
label: string;
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* Runtime-extracted metadata about a media clip (populated from HTMLMediaElement).
|
|
2504
|
+
*
|
|
2505
|
+
* @example
|
|
2506
|
+
* ```ts
|
|
2507
|
+
* const meta: MediaMetadata = {
|
|
2508
|
+
* duration: 120.5,
|
|
2509
|
+
* videoWidth: 1920,
|
|
2510
|
+
* videoHeight: 1080,
|
|
2511
|
+
* codecInfo: "video/mp4; codecs=\"avc1.640028\"",
|
|
2512
|
+
* };
|
|
2513
|
+
* // => satisfies MediaMetadata
|
|
2514
|
+
* ```
|
|
2515
|
+
*/
|
|
2516
|
+
interface MediaMetadata {
|
|
2517
|
+
/** Duration in seconds. */
|
|
2518
|
+
duration?: number;
|
|
2519
|
+
/** Video width in pixels (video only). */
|
|
2520
|
+
videoWidth?: number;
|
|
2521
|
+
/** Video height in pixels (video only). */
|
|
2522
|
+
videoHeight?: number;
|
|
2523
|
+
/** MIME type / codec string reported by the browser. */
|
|
2524
|
+
codecInfo?: string;
|
|
2525
|
+
}
|
|
2526
|
+
/**
|
|
2527
|
+
* A closed-caption / subtitle track associated with a media element.
|
|
2528
|
+
*
|
|
2529
|
+
* @example
|
|
2530
|
+
* ```ts
|
|
2531
|
+
* const track: MediaCaptionTrack = {
|
|
2532
|
+
* id: "t1",
|
|
2533
|
+
* label: "English",
|
|
2534
|
+
* language: "en",
|
|
2535
|
+
* kind: "subtitles",
|
|
2536
|
+
* isDefault: true,
|
|
2537
|
+
* };
|
|
2538
|
+
* // => satisfies MediaCaptionTrack
|
|
2539
|
+
* ```
|
|
2540
|
+
*/
|
|
2541
|
+
interface MediaCaptionTrack {
|
|
2542
|
+
/** Unique ID for this track. */
|
|
2543
|
+
id: string;
|
|
2544
|
+
/** Human-readable label (e.g. "English", "Spanish"). */
|
|
2545
|
+
label: string;
|
|
2546
|
+
/** BCP-47 language code (e.g. "en", "es"). */
|
|
2547
|
+
language: string;
|
|
2548
|
+
/** Track kind: subtitles, captions, or descriptions. */
|
|
2549
|
+
kind: 'subtitles' | 'captions' | 'descriptions';
|
|
2550
|
+
/** Data URL or path to the VTT/SRT content within the PPTX archive. */
|
|
2551
|
+
src?: string;
|
|
2552
|
+
/** Inline VTT content (for embedded captions). */
|
|
2553
|
+
content?: string;
|
|
2554
|
+
/** Whether this track is the default/active one. */
|
|
2555
|
+
isDefault?: boolean;
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
/**
|
|
2559
|
+
* Action types: hyperlinks, slide jumps, macros, and action buttons.
|
|
2560
|
+
*
|
|
2561
|
+
* @module pptx-types/actions
|
|
2562
|
+
*/
|
|
2563
|
+
/**
|
|
2564
|
+
* A parsed shape-level action from `a:hlinkClick` or `a:hlinkHover`.
|
|
2565
|
+
*
|
|
2566
|
+
* @example
|
|
2567
|
+
* ```ts
|
|
2568
|
+
* const link: PptxAction = {
|
|
2569
|
+
* url: "https://example.com",
|
|
2570
|
+
* tooltip: "Visit Example",
|
|
2571
|
+
* highlightClick: true,
|
|
2572
|
+
* };
|
|
2573
|
+
*
|
|
2574
|
+
* const slideJump: PptxAction = {
|
|
2575
|
+
* action: "ppaction://hlinksldjump",
|
|
2576
|
+
* targetSlideIndex: 3,
|
|
2577
|
+
* };
|
|
2578
|
+
* // => satisfies PptxAction
|
|
2579
|
+
* ```
|
|
2580
|
+
*/
|
|
2581
|
+
interface PptxAction {
|
|
2582
|
+
/** Relationship ID referencing the action target. */
|
|
2583
|
+
rId?: string;
|
|
2584
|
+
/** OOXML action string (e.g. `ppaction://hlinksldjump`). */
|
|
2585
|
+
action?: string;
|
|
2586
|
+
/** Tooltip text shown on hover. */
|
|
2587
|
+
tooltip?: string;
|
|
2588
|
+
/** Whether the shape should highlight on click. */
|
|
2589
|
+
highlightClick?: boolean;
|
|
2590
|
+
/** Resolved URL or file path from the slide relationship map. */
|
|
2591
|
+
url?: string;
|
|
2592
|
+
/** Zero-based index into the slides array for internal slide jumps. */
|
|
2593
|
+
targetSlideIndex?: number;
|
|
2594
|
+
/** Relationship ID of an optional click sound (`a:snd/@r:embed`). */
|
|
2595
|
+
soundRId?: string;
|
|
2596
|
+
/** Resolved media target path for the optional click sound. */
|
|
2597
|
+
soundPath?: string;
|
|
2598
|
+
}
|
|
2599
|
+
/**
|
|
2600
|
+
* High-level action type for the action settings UI.
|
|
2601
|
+
* Maps to OOXML `ppaction://` verbs + external URLs.
|
|
2602
|
+
*
|
|
2603
|
+
* @example
|
|
2604
|
+
* ```ts
|
|
2605
|
+
* const type: ElementActionType = "slide";
|
|
2606
|
+
* // => "slide" — one of: "none" | "url" | "slide" | "firstSlide" | "lastSlide" | "prevSlide" | "nextSlide" | "endShow"
|
|
2607
|
+
* ```
|
|
2608
|
+
*/
|
|
2609
|
+
type ElementActionType = 'none' | 'url' | 'slide' | 'firstSlide' | 'lastSlide' | 'prevSlide' | 'nextSlide' | 'endShow';
|
|
2610
|
+
/**
|
|
2611
|
+
* User-facing action configuration stored on an element.
|
|
2612
|
+
* This is a convenience wrapper around the lower-level `PptxAction` that maps
|
|
2613
|
+
* to/from OOXML hyperlink/action attributes.
|
|
2614
|
+
*
|
|
2615
|
+
* @example
|
|
2616
|
+
* ```ts
|
|
2617
|
+
* const action: ElementAction = {
|
|
2618
|
+
* trigger: "click",
|
|
2619
|
+
* type: "url",
|
|
2620
|
+
* url: "https://example.com",
|
|
2621
|
+
* };
|
|
2622
|
+
*
|
|
2623
|
+
* const jumpToSlide: ElementAction = {
|
|
2624
|
+
* trigger: "click",
|
|
2625
|
+
* type: "slide",
|
|
2626
|
+
* slideIndex: 5,
|
|
2627
|
+
* };
|
|
2628
|
+
* // => satisfies ElementAction
|
|
2629
|
+
* ```
|
|
2630
|
+
*/
|
|
2631
|
+
interface ElementAction {
|
|
2632
|
+
/** When the action fires. */
|
|
2633
|
+
trigger: 'click' | 'hover';
|
|
2634
|
+
/** What kind of action to perform. */
|
|
2635
|
+
type: ElementActionType;
|
|
2636
|
+
/** External URL (for 'url' type). */
|
|
2637
|
+
url?: string;
|
|
2638
|
+
/** Zero-based slide index (for 'slide' type). */
|
|
2639
|
+
slideIndex?: number;
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* Preset action button definition (OOXML built-in action button shapes).
|
|
2643
|
+
*
|
|
2644
|
+
* @example
|
|
2645
|
+
* ```ts
|
|
2646
|
+
* const btn: ActionButtonPreset = {
|
|
2647
|
+
* shapeType: "actionButtonBackPrevious",
|
|
2648
|
+
* label: "Back",
|
|
2649
|
+
* defaultAction: "prevSlide",
|
|
2650
|
+
* iconPath: "M 0 0 L 10 5 L 0 10 Z",
|
|
2651
|
+
* };
|
|
2652
|
+
* // => satisfies ActionButtonPreset
|
|
2653
|
+
* ```
|
|
2654
|
+
*/
|
|
2655
|
+
interface ActionButtonPreset {
|
|
2656
|
+
/** OOXML preset geometry name (e.g. 'actionButtonBackPrevious'). */
|
|
2657
|
+
shapeType: string;
|
|
2658
|
+
/** Human-readable label. */
|
|
2659
|
+
label: string;
|
|
2660
|
+
/** Default action type pre-configured on the button. */
|
|
2661
|
+
defaultAction: ElementActionType;
|
|
2662
|
+
/** SVG path data for the icon rendered inside the button. */
|
|
2663
|
+
iconPath: string;
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
/**
|
|
2667
|
+
* Metadata types: slide comments, compatibility warnings, tags,
|
|
2668
|
+
* custom properties, core/app document properties.
|
|
2669
|
+
*
|
|
2670
|
+
* @module pptx-types/metadata
|
|
2671
|
+
*/
|
|
2672
|
+
/**
|
|
2673
|
+
* A slide comment — may be a legacy positional comment or a modern
|
|
2674
|
+
* threaded comment with replies.
|
|
2675
|
+
*
|
|
2676
|
+
* @example
|
|
2677
|
+
* ```ts
|
|
2678
|
+
* const comment: PptxComment = {
|
|
2679
|
+
* id: "c1",
|
|
2680
|
+
* text: "Please update this chart.",
|
|
2681
|
+
* author: "Alice",
|
|
2682
|
+
* createdAt: "2024-06-01T10:00:00Z",
|
|
2683
|
+
* resolved: false,
|
|
2684
|
+
* };
|
|
2685
|
+
* // => satisfies PptxComment
|
|
2686
|
+
* ```
|
|
2687
|
+
*/
|
|
2688
|
+
interface PptxComment {
|
|
2689
|
+
id: string;
|
|
2690
|
+
text: string;
|
|
2691
|
+
/** Optional parent comment id for reply threading metadata. */
|
|
2692
|
+
parentId?: string;
|
|
2693
|
+
author?: string;
|
|
2694
|
+
createdAt?: string;
|
|
2695
|
+
x?: number;
|
|
2696
|
+
y?: number;
|
|
2697
|
+
/** Whether this comment has been resolved/marked done. */
|
|
2698
|
+
resolved?: boolean;
|
|
2699
|
+
/** Modern threaded comment support (p15:threadingInfo). */
|
|
2700
|
+
threadId?: string;
|
|
2701
|
+
/** Replies to this comment (for modern threaded comments). */
|
|
2702
|
+
replies?: PptxComment[];
|
|
2703
|
+
/** ID of the element this comment is associated with (if any). */
|
|
2704
|
+
elementId?: string;
|
|
2705
|
+
}
|
|
2706
|
+
/**
|
|
2707
|
+
* A comment author from `ppt/commentAuthors.xml`.
|
|
2708
|
+
*
|
|
2709
|
+
* Stores all attributes needed for lossless round-trip serialization
|
|
2710
|
+
* of the `p:cmAuthor` element (id, name, initials, lastIdx, clrIdx).
|
|
2711
|
+
*
|
|
2712
|
+
* @see ECMA-376 Part 1, §19.4.2 (cmAuthor)
|
|
2713
|
+
*
|
|
2714
|
+
* @example
|
|
2715
|
+
* ```ts
|
|
2716
|
+
* const author: PptxCommentAuthor = {
|
|
2717
|
+
* id: "0",
|
|
2718
|
+
* name: "John Doe",
|
|
2719
|
+
* initials: "JD",
|
|
2720
|
+
* lastIdx: 3,
|
|
2721
|
+
* clrIdx: 0,
|
|
2722
|
+
* };
|
|
2723
|
+
* // => satisfies PptxCommentAuthor
|
|
2724
|
+
* ```
|
|
2725
|
+
*/
|
|
2726
|
+
interface PptxCommentAuthor {
|
|
2727
|
+
/** Unique numeric author identifier (`@_id`). */
|
|
2728
|
+
id: string;
|
|
2729
|
+
/** Author display name (`@_name`). */
|
|
2730
|
+
name: string;
|
|
2731
|
+
/** Author initials (`@_initials`). */
|
|
2732
|
+
initials: string;
|
|
2733
|
+
/** Last comment index used by this author (`@_lastIdx`). */
|
|
2734
|
+
lastIdx: number;
|
|
2735
|
+
/** Colour index assigned to this author (`@_clrIdx`). */
|
|
2736
|
+
clrIdx: number;
|
|
2737
|
+
}
|
|
2738
|
+
/**
|
|
2739
|
+
* A compatibility warning generated during parse or save when the
|
|
2740
|
+
* file uses features not fully supported by the editor.
|
|
2741
|
+
*
|
|
2742
|
+
* @example
|
|
2743
|
+
* ```ts
|
|
2744
|
+
* const warning: PptxCompatibilityWarning = {
|
|
2745
|
+
* code: "UNSUPPORTED_3D",
|
|
2746
|
+
* message: "3D rotation effects may not render accurately.",
|
|
2747
|
+
* severity: "warning",
|
|
2748
|
+
* scope: "element",
|
|
2749
|
+
* slideId: "slide-1",
|
|
2750
|
+
* elementId: "elem-42",
|
|
2751
|
+
* };
|
|
2752
|
+
* // => satisfies PptxCompatibilityWarning
|
|
2753
|
+
* ```
|
|
2754
|
+
*/
|
|
2755
|
+
interface PptxCompatibilityWarning {
|
|
2756
|
+
code: string;
|
|
2757
|
+
message: string;
|
|
2758
|
+
severity: 'info' | 'warning';
|
|
2759
|
+
scope: 'presentation' | 'slide' | 'element' | 'save';
|
|
2760
|
+
slideId?: string;
|
|
2761
|
+
elementId?: string;
|
|
2762
|
+
xmlPath?: string;
|
|
2763
|
+
}
|
|
2764
|
+
/**
|
|
2765
|
+
* A single name–value tag from `ppt/tags/*.xml`.
|
|
2766
|
+
*
|
|
2767
|
+
* @example
|
|
2768
|
+
* ```ts
|
|
2769
|
+
* const tag: PptxTag = { name: "CUSTOM_ID", value: "12345" };
|
|
2770
|
+
* // => satisfies PptxTag
|
|
2771
|
+
* ```
|
|
2772
|
+
*/
|
|
2773
|
+
interface PptxTag {
|
|
2774
|
+
name: string;
|
|
2775
|
+
value: string;
|
|
2776
|
+
}
|
|
2777
|
+
/**
|
|
2778
|
+
* A collection of tags from a single tags XML part.
|
|
2779
|
+
*
|
|
2780
|
+
* @example
|
|
2781
|
+
* ```ts
|
|
2782
|
+
* const coll: PptxTagCollection = {
|
|
2783
|
+
* path: "ppt/tags/tag1.xml",
|
|
2784
|
+
* tags: [{ name: "CUSTOM_ID", value: "12345" }],
|
|
2785
|
+
* };
|
|
2786
|
+
* // => satisfies PptxTagCollection
|
|
2787
|
+
* ```
|
|
2788
|
+
*/
|
|
2789
|
+
interface PptxTagCollection {
|
|
2790
|
+
/** File path within the PPTX archive. */
|
|
2791
|
+
path: string;
|
|
2792
|
+
/** Tags in this collection. */
|
|
2793
|
+
tags: PptxTag[];
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* A custom document property from `docProps/custom.xml`.
|
|
2797
|
+
*
|
|
2798
|
+
* @example
|
|
2799
|
+
* ```ts
|
|
2800
|
+
* const prop: PptxCustomProperty = {
|
|
2801
|
+
* name: "Project",
|
|
2802
|
+
* value: "pptx",
|
|
2803
|
+
* type: "lpwstr",
|
|
2804
|
+
* };
|
|
2805
|
+
* // => satisfies PptxCustomProperty
|
|
2806
|
+
* ```
|
|
2807
|
+
*/
|
|
2808
|
+
interface PptxCustomProperty {
|
|
2809
|
+
/** Property name. */
|
|
2810
|
+
name: string;
|
|
2811
|
+
/** Property value (always stringified). */
|
|
2812
|
+
value: string;
|
|
2813
|
+
/** Original VT type (e.g. "lpwstr", "i4", "bool", "filetime"). */
|
|
2814
|
+
type: string;
|
|
2815
|
+
}
|
|
2816
|
+
/**
|
|
2817
|
+
* Core document properties from `docProps/core.xml` (Dublin Core + OOXML).
|
|
2818
|
+
*
|
|
2819
|
+
* @example
|
|
2820
|
+
* ```ts
|
|
2821
|
+
* const core: PptxCoreProperties = {
|
|
2822
|
+
* title: "Q4 Business Review",
|
|
2823
|
+
* creator: "Alice",
|
|
2824
|
+
* created: "2024-01-15T08:00:00Z",
|
|
2825
|
+
* modified: "2024-06-01T12:30:00Z",
|
|
2826
|
+
* lastModifiedBy: "Bob",
|
|
2827
|
+
* };
|
|
2828
|
+
* // => satisfies PptxCoreProperties
|
|
2829
|
+
* ```
|
|
2830
|
+
*/
|
|
2831
|
+
interface PptxCoreProperties {
|
|
2832
|
+
/** dc:title */
|
|
2833
|
+
title?: string;
|
|
2834
|
+
/** dc:subject */
|
|
2835
|
+
subject?: string;
|
|
2836
|
+
/** dc:creator */
|
|
2837
|
+
creator?: string;
|
|
2838
|
+
/** cp:keywords */
|
|
2839
|
+
keywords?: string;
|
|
2840
|
+
/** dc:description */
|
|
2841
|
+
description?: string;
|
|
2842
|
+
/** cp:lastModifiedBy */
|
|
2843
|
+
lastModifiedBy?: string;
|
|
2844
|
+
/** cp:revision */
|
|
2845
|
+
revision?: string;
|
|
2846
|
+
/** dcterms:created (ISO 8601) */
|
|
2847
|
+
created?: string;
|
|
2848
|
+
/** dcterms:modified (ISO 8601) */
|
|
2849
|
+
modified?: string;
|
|
2850
|
+
/** cp:category */
|
|
2851
|
+
category?: string;
|
|
2852
|
+
/** cp:contentStatus */
|
|
2853
|
+
contentStatus?: string;
|
|
2854
|
+
}
|
|
2855
|
+
/**
|
|
2856
|
+
* Extended (application) properties from `docProps/app.xml`.
|
|
2857
|
+
*
|
|
2858
|
+
* @example
|
|
2859
|
+
* ```ts
|
|
2860
|
+
* const app: PptxAppProperties = {
|
|
2861
|
+
* application: "Microsoft Office PowerPoint",
|
|
2862
|
+
* appVersion: "16.0000",
|
|
2863
|
+
* slides: 24,
|
|
2864
|
+
* words: 1500,
|
|
2865
|
+
* company: "Acme Corp",
|
|
2866
|
+
* };
|
|
2867
|
+
* // => satisfies PptxAppProperties
|
|
2868
|
+
* ```
|
|
2869
|
+
*/
|
|
2870
|
+
interface PptxAppProperties {
|
|
2871
|
+
/** Application name (e.g. "Microsoft Office PowerPoint"). */
|
|
2872
|
+
application?: string;
|
|
2873
|
+
/** Application version string. */
|
|
2874
|
+
appVersion?: string;
|
|
2875
|
+
/** Presentation format (e.g. "On-screen Show (16:9)"). */
|
|
2876
|
+
presentationFormat?: string;
|
|
2877
|
+
/** Total number of slides. */
|
|
2878
|
+
slides?: number;
|
|
2879
|
+
/** Number of hidden slides. */
|
|
2880
|
+
hiddenSlides?: number;
|
|
2881
|
+
/** Number of notes slides. */
|
|
2882
|
+
notes?: number;
|
|
2883
|
+
/** Total editing time in minutes. */
|
|
2884
|
+
totalTime?: number;
|
|
2885
|
+
/** Number of words. */
|
|
2886
|
+
words?: number;
|
|
2887
|
+
/** Number of paragraphs. */
|
|
2888
|
+
paragraphs?: number;
|
|
2889
|
+
/** Company name. */
|
|
2890
|
+
company?: string;
|
|
2891
|
+
/** Manager name. */
|
|
2892
|
+
manager?: string;
|
|
2893
|
+
/** Template name. */
|
|
2894
|
+
template?: string;
|
|
2895
|
+
/** Hyperlink base URL. */
|
|
2896
|
+
hyperlinkBase?: string;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
/**
|
|
2900
|
+
* Base and mixin interfaces for all PPTX slide elements, plus
|
|
2901
|
+
* placeholder inheritance types.
|
|
2902
|
+
*
|
|
2903
|
+
* Every concrete element variant (text, shape, image …) extends
|
|
2904
|
+
* {@link PptxElementBase}. Text-bearing elements also mix in
|
|
2905
|
+
* {@link PptxTextProperties}, and shapes / connectors / images add
|
|
2906
|
+
* {@link PptxShapeProperties}.
|
|
2907
|
+
*
|
|
2908
|
+
* @module pptx-types/element-base
|
|
2909
|
+
*/
|
|
2910
|
+
|
|
2911
|
+
/**
|
|
2912
|
+
* Properties shared by **every** element on a slide.
|
|
2913
|
+
*
|
|
2914
|
+
* Position and size are in pixels (converted from EMU at parse time).
|
|
2915
|
+
* Optional properties apply to subsets of elements or may be absent in
|
|
2916
|
+
* the original OOXML.
|
|
2917
|
+
*
|
|
2918
|
+
* @example
|
|
2919
|
+
* ```ts
|
|
2920
|
+
* const base: PptxElementBase = {
|
|
2921
|
+
* id: "el_001",
|
|
2922
|
+
* x: 100, y: 50,
|
|
2923
|
+
* width: 400, height: 200,
|
|
2924
|
+
* rotation: 15,
|
|
2925
|
+
* opacity: 0.9,
|
|
2926
|
+
* };
|
|
2927
|
+
* // => satisfies PptxElementBase
|
|
2928
|
+
* ```
|
|
2929
|
+
*/
|
|
2930
|
+
interface PptxElementBase {
|
|
2931
|
+
id: string;
|
|
2932
|
+
x: number;
|
|
2933
|
+
y: number;
|
|
2934
|
+
width: number;
|
|
2935
|
+
height: number;
|
|
2936
|
+
rotation?: number;
|
|
2937
|
+
/** Skew along the X axis in degrees (parsed from `@_skewX` in 1/60000ths of a degree). */
|
|
2938
|
+
skewX?: number;
|
|
2939
|
+
/** Skew along the Y axis in degrees (parsed from `@_skewY` in 1/60000ths of a degree). */
|
|
2940
|
+
skewY?: number;
|
|
2941
|
+
flipHorizontal?: boolean;
|
|
2942
|
+
flipVertical?: boolean;
|
|
2943
|
+
/** Whether this element is hidden (used by the Elements Panel visibility toggle). */
|
|
2944
|
+
hidden?: boolean;
|
|
2945
|
+
/** Element-level opacity (0-1). */
|
|
2946
|
+
opacity?: number;
|
|
2947
|
+
rawXml?: XmlObject;
|
|
2948
|
+
/** Shape-level click action (from `a:hlinkClick` on `p:cNvPr`). */
|
|
2949
|
+
actionClick?: PptxAction;
|
|
2950
|
+
/** Shape-level hover action (from `a:hlinkHover` on `p:cNvPr`). */
|
|
2951
|
+
actionHover?: PptxAction;
|
|
2952
|
+
/** Shape lock attributes parsed from `p:cNvSpPr/a:spLocks`. */
|
|
2953
|
+
locks?: PptxShapeLocks;
|
|
2954
|
+
}
|
|
2955
|
+
/**
|
|
2956
|
+
* Text content mixin — present on text boxes and shapes.
|
|
2957
|
+
*
|
|
2958
|
+
* Shapes can contain text overlaid on the shape geometry, so both
|
|
2959
|
+
* `TextPptxElement` and `ShapePptxElement` extend this interface.
|
|
2960
|
+
*
|
|
2961
|
+
* @example
|
|
2962
|
+
* ```ts
|
|
2963
|
+
* const props: PptxTextProperties = {
|
|
2964
|
+
* text: "Hello World",
|
|
2965
|
+
* textStyle: { fontSize: 24, bold: true, color: "#333333" },
|
|
2966
|
+
* };
|
|
2967
|
+
* // => satisfies PptxTextProperties
|
|
2968
|
+
* ```
|
|
2969
|
+
*/
|
|
2970
|
+
interface PptxTextProperties {
|
|
2971
|
+
text?: string;
|
|
2972
|
+
textStyle?: TextStyle;
|
|
2973
|
+
/** Rich text segments with individual styling. */
|
|
2974
|
+
textSegments?: TextSegment[];
|
|
2975
|
+
/** Per-paragraph indentation (marginLeft, indent) for multi-level bullet support. */
|
|
2976
|
+
paragraphIndents?: Array<{
|
|
2977
|
+
marginLeft?: number;
|
|
2978
|
+
indent?: number;
|
|
2979
|
+
}>;
|
|
2980
|
+
/** Placeholder prompt text inherited from layout/master (e.g. "Click to add title"). Shown as a greyed-out hint when the shape has no user-entered text. */
|
|
2981
|
+
promptText?: string;
|
|
2982
|
+
/** Linked text box chain ID from `a:bodyPr > a:linkedTxbx/@id` or `a:txbx > a:linkedTxbx/@id`. Text overflows from one linked frame to the next. */
|
|
2983
|
+
linkedTxbxId?: number;
|
|
2984
|
+
/** Sequence number within a linked text box chain (0-based). */
|
|
2985
|
+
linkedTxbxSeq?: number;
|
|
2986
|
+
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Shape styling & geometry mixin — present on shapes, connectors, and images.
|
|
2989
|
+
*
|
|
2990
|
+
* @example
|
|
2991
|
+
* ```ts
|
|
2992
|
+
* const props: PptxShapeProperties = {
|
|
2993
|
+
* shapeType: "roundRect",
|
|
2994
|
+
* shapeStyle: { fillColor: "#0055AA", strokeWidth: 2 },
|
|
2995
|
+
* shapeAdjustments: { adj: 16667 },
|
|
2996
|
+
* };
|
|
2997
|
+
* // => satisfies PptxShapeProperties
|
|
2998
|
+
* ```
|
|
2999
|
+
*/
|
|
3000
|
+
interface PptxShapeProperties {
|
|
3001
|
+
shapeStyle?: ShapeStyle;
|
|
3002
|
+
/** Preset geometry name, e.g. "rect", "ellipse", "roundRect". */
|
|
3003
|
+
shapeType?: string;
|
|
3004
|
+
/** Geometry adjustment values, e.g. `{ adj: 16667 }`. */
|
|
3005
|
+
shapeAdjustments?: Record<string, number>;
|
|
3006
|
+
/** Adjustment handles for interactive shape modification (yellow diamond handles). */
|
|
3007
|
+
adjustmentHandles?: GeometryAdjustmentHandle[];
|
|
3008
|
+
}
|
|
3009
|
+
/**
|
|
3010
|
+
* Text styling for a single indent level (0–8) inside a placeholder’s
|
|
3011
|
+
* `a:lstStyle`.
|
|
3012
|
+
*
|
|
3013
|
+
* Used during placeholder inheritance to fill in defaults for font,
|
|
3014
|
+
* bullet, and spacing properties the slide element does not override.
|
|
3015
|
+
*
|
|
3016
|
+
* @example
|
|
3017
|
+
* ```ts
|
|
3018
|
+
* const level0: PlaceholderTextLevelStyle = {
|
|
3019
|
+
* fontSize: 32,
|
|
3020
|
+
* bold: true,
|
|
3021
|
+
* bulletChar: "•",
|
|
3022
|
+
* };
|
|
3023
|
+
* // => satisfies PlaceholderTextLevelStyle
|
|
3024
|
+
* ```
|
|
3025
|
+
*/
|
|
3026
|
+
interface PlaceholderTextLevelStyle {
|
|
3027
|
+
fontFamily?: string;
|
|
3028
|
+
fontSize?: number;
|
|
3029
|
+
bold?: boolean;
|
|
3030
|
+
italic?: boolean;
|
|
3031
|
+
color?: string;
|
|
3032
|
+
bulletChar?: string;
|
|
3033
|
+
bulletAutoNumType?: string;
|
|
3034
|
+
bulletFontFamily?: string;
|
|
3035
|
+
bulletSizePercent?: number;
|
|
3036
|
+
/** Bullet colour from `a:buClr` as hex string. */
|
|
3037
|
+
bulletColor?: string;
|
|
3038
|
+
/** Bullet size in points from `a:buSzPts`. */
|
|
3039
|
+
bulletSizePts?: number;
|
|
3040
|
+
/** True when `a:buNone` is present at this level. */
|
|
3041
|
+
bulletNone?: boolean;
|
|
3042
|
+
marginLeft?: number;
|
|
3043
|
+
indent?: number;
|
|
3044
|
+
alignment?: string;
|
|
3045
|
+
lineSpacing?: number;
|
|
3046
|
+
lineSpacingExactPt?: number;
|
|
3047
|
+
spaceBefore?: number;
|
|
3048
|
+
spaceAfter?: number;
|
|
3049
|
+
}
|
|
3050
|
+
/**
|
|
3051
|
+
* Pre-parsed placeholder defaults extracted from a layout or master shape
|
|
3052
|
+
* that carries a `<p:ph>` element.
|
|
3053
|
+
*
|
|
3054
|
+
* Used to fill in inherited text styles, bullet definitions, font sizes,
|
|
3055
|
+
* and body properties that the slide shape does not explicitly override.
|
|
3056
|
+
*
|
|
3057
|
+
* @example
|
|
3058
|
+
* ```ts
|
|
3059
|
+
* const defaults: PlaceholderDefaults = {
|
|
3060
|
+
* type: "title",
|
|
3061
|
+
* levelStyles: {
|
|
3062
|
+
* 0: { fontSize: 36, bold: true, alignment: "left" },
|
|
3063
|
+
* },
|
|
3064
|
+
* };
|
|
3065
|
+
* // => satisfies PlaceholderDefaults
|
|
3066
|
+
* ```
|
|
3067
|
+
*/
|
|
3068
|
+
interface PlaceholderDefaults {
|
|
3069
|
+
/** Placeholder type: 'title', 'body', 'ctrTitle', 'subTitle', 'dt', 'ftr', 'sldNum', etc. */
|
|
3070
|
+
type: string;
|
|
3071
|
+
/** Placeholder index (when present). */
|
|
3072
|
+
idx?: number;
|
|
3073
|
+
bodyInsetLeft?: number;
|
|
3074
|
+
bodyInsetTop?: number;
|
|
3075
|
+
bodyInsetRight?: number;
|
|
3076
|
+
bodyInsetBottom?: number;
|
|
3077
|
+
textAnchor?: string;
|
|
3078
|
+
autoFit?: boolean;
|
|
3079
|
+
/** Explicit autofit mode from OOXML body properties. See {@link TextStyle.autoFitMode}. */
|
|
3080
|
+
autoFitMode?: 'shrink' | 'normal' | 'none';
|
|
3081
|
+
/** Font scale percentage for normAutofit (e.g. 0.9 = 90%). Only meaningful when autoFit is true. */
|
|
3082
|
+
autoFitFontScale?: number;
|
|
3083
|
+
/** Line spacing reduction for normAutofit (e.g. 0.2 = reduce by 20%). Only meaningful when autoFit is true. */
|
|
3084
|
+
autoFitLineSpacingReduction?: number;
|
|
3085
|
+
textWrap?: string;
|
|
3086
|
+
/** Level-specific text styles keyed 0-8. */
|
|
3087
|
+
levelStyles?: Record<number, PlaceholderTextLevelStyle>;
|
|
3088
|
+
/** Prompt text extracted from the layout/master placeholder (e.g. "Click to add title"). */
|
|
3089
|
+
promptText?: string;
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
/**
|
|
3093
|
+
* Concrete element types (one per `type` discriminant) and the
|
|
3094
|
+
* {@link PptxElement} discriminated union.
|
|
3095
|
+
*
|
|
3096
|
+
* Narrow on `element.type` to access variant-specific properties:
|
|
3097
|
+
* ```ts
|
|
3098
|
+
* if (element.type === "image") {
|
|
3099
|
+
* console.log(element.imageData); // ImagePptxElement-only
|
|
3100
|
+
* }
|
|
3101
|
+
* ```
|
|
3102
|
+
*
|
|
3103
|
+
* @module pptx-types/elements
|
|
3104
|
+
*/
|
|
3105
|
+
|
|
3106
|
+
/**
|
|
3107
|
+
* A text box — a plain rectangle containing text, typically with no
|
|
3108
|
+
* visible fill or stroke.
|
|
3109
|
+
*
|
|
3110
|
+
* @example
|
|
3111
|
+
* ```ts
|
|
3112
|
+
* const title: TextPptxElement = {
|
|
3113
|
+
* type: "text",
|
|
3114
|
+
* id: "txt_1", x: 50, y: 30, width: 800, height: 60,
|
|
3115
|
+
* text: "Welcome",
|
|
3116
|
+
* textStyle: { fontSize: 36, bold: true },
|
|
3117
|
+
* };
|
|
3118
|
+
* // => satisfies TextPptxElement
|
|
3119
|
+
* ```
|
|
3120
|
+
*/
|
|
3121
|
+
interface TextPptxElement extends PptxElementBase, PptxTextProperties, PptxShapeProperties {
|
|
3122
|
+
type: 'text';
|
|
3123
|
+
}
|
|
3124
|
+
/**
|
|
3125
|
+
* A shape — may contain text and custom geometry (preset or freeform).
|
|
3126
|
+
*
|
|
3127
|
+
* @example
|
|
3128
|
+
* ```ts
|
|
3129
|
+
* const rect: ShapePptxElement = {
|
|
3130
|
+
* type: "shape",
|
|
3131
|
+
* id: "shp_1", x: 100, y: 200, width: 300, height: 150,
|
|
3132
|
+
* shapeType: "roundRect",
|
|
3133
|
+
* shapeStyle: { fillColor: "#00AA55" },
|
|
3134
|
+
* text: "OK",
|
|
3135
|
+
* };
|
|
3136
|
+
* // => satisfies ShapePptxElement
|
|
3137
|
+
* ```
|
|
3138
|
+
*/
|
|
3139
|
+
interface ShapePptxElement extends PptxElementBase, PptxTextProperties, PptxShapeProperties, PptxCustomPathProperties {
|
|
3140
|
+
type: 'shape';
|
|
3141
|
+
}
|
|
3142
|
+
/**
|
|
3143
|
+
* A connector (straight, bent, or curved line between shapes).
|
|
3144
|
+
*
|
|
3145
|
+
* Connector endpoints can snap to specific shapes via
|
|
3146
|
+
* `shapeStyle.connectorStartConnection` / `connectorEndConnection`.
|
|
3147
|
+
*
|
|
3148
|
+
* @example
|
|
3149
|
+
* ```ts
|
|
3150
|
+
* const line: ConnectorPptxElement = {
|
|
3151
|
+
* type: "connector",
|
|
3152
|
+
* id: "cxn_1", x: 100, y: 100, width: 200, height: 0,
|
|
3153
|
+
* shapeStyle: {
|
|
3154
|
+
* strokeColor: "#333",
|
|
3155
|
+
* connectorEndArrow: "triangle",
|
|
3156
|
+
* },
|
|
3157
|
+
* };
|
|
3158
|
+
* // => satisfies ConnectorPptxElement
|
|
3159
|
+
* ```
|
|
3160
|
+
*/
|
|
3161
|
+
interface ConnectorPptxElement extends PptxElementBase, PptxTextProperties, PptxShapeProperties {
|
|
3162
|
+
type: 'connector';
|
|
3163
|
+
}
|
|
3164
|
+
/**
|
|
3165
|
+
* An image element from an OOXML `<p:pic>` node with `type: "image"`.
|
|
3166
|
+
*
|
|
3167
|
+
* @example
|
|
3168
|
+
* ```ts
|
|
3169
|
+
* const img: ImagePptxElement = {
|
|
3170
|
+
* type: "image",
|
|
3171
|
+
* id: "img_1", x: 0, y: 0, width: 960, height: 540,
|
|
3172
|
+
* imagePath: "ppt/media/image1.png",
|
|
3173
|
+
* altText: "Background scenery",
|
|
3174
|
+
* };
|
|
3175
|
+
* // => satisfies ImagePptxElement
|
|
3176
|
+
* ```
|
|
3177
|
+
*/
|
|
3178
|
+
interface ImagePptxElement extends PptxElementBase, PptxShapeProperties, PptxCustomPathProperties, PptxImageProperties {
|
|
3179
|
+
type: 'image';
|
|
3180
|
+
}
|
|
3181
|
+
/**
|
|
3182
|
+
* A picture element from an OOXML `<p:pic>` node with `type: "picture"`.
|
|
3183
|
+
*
|
|
3184
|
+
* Functionally identical to {@link ImagePptxElement} but distinguished by
|
|
3185
|
+
* the `type` discriminant for semantic clarity.
|
|
3186
|
+
*/
|
|
3187
|
+
interface PicturePptxElement extends PptxElementBase, PptxShapeProperties, PptxCustomPathProperties, PptxImageProperties {
|
|
3188
|
+
type: 'picture';
|
|
3189
|
+
}
|
|
3190
|
+
/**
|
|
3191
|
+
* A table embedded via a `<p:graphicFrame>`.
|
|
3192
|
+
*
|
|
3193
|
+
* @example
|
|
3194
|
+
* ```ts
|
|
3195
|
+
* const tbl: TablePptxElement = {
|
|
3196
|
+
* type: "table",
|
|
3197
|
+
* id: "tbl_1", x: 50, y: 200, width: 860, height: 300,
|
|
3198
|
+
* tableData: {
|
|
3199
|
+
* rows: [
|
|
3200
|
+
* { cells: [{ text: "Name" }, { text: "Score" }] },
|
|
3201
|
+
* { cells: [{ text: "Alice" }, { text: "95" }] },
|
|
3202
|
+
* ],
|
|
3203
|
+
* },
|
|
3204
|
+
* };
|
|
3205
|
+
* // => satisfies TablePptxElement
|
|
3206
|
+
* ```
|
|
3207
|
+
*/
|
|
3208
|
+
interface TablePptxElement extends PptxElementBase {
|
|
3209
|
+
type: 'table';
|
|
3210
|
+
/** Parsed table cell data for editing. */
|
|
3211
|
+
tableData?: PptxTableData;
|
|
3212
|
+
}
|
|
3213
|
+
/**
|
|
3214
|
+
* A chart embedded via a `<p:graphicFrame>`.
|
|
3215
|
+
*
|
|
3216
|
+
* Chart data is parsed from the related `chartN.xml` / `chartExN.xml`
|
|
3217
|
+
* parts inside the PPTX archive.
|
|
3218
|
+
*/
|
|
3219
|
+
interface ChartPptxElement extends PptxElementBase {
|
|
3220
|
+
type: 'chart';
|
|
3221
|
+
chartData?: PptxChartData;
|
|
3222
|
+
}
|
|
3223
|
+
/**
|
|
3224
|
+
* A SmartArt diagram embedded via a `<p:graphicFrame>`.
|
|
3225
|
+
*
|
|
3226
|
+
* SmartArt data is extracted from `dgm:dataModel` parts. The editor
|
|
3227
|
+
* renders a simplified view; full editing is not supported.
|
|
3228
|
+
*/
|
|
3229
|
+
interface SmartArtPptxElement extends PptxElementBase {
|
|
3230
|
+
type: 'smartArt';
|
|
3231
|
+
smartArtData?: PptxSmartArtData;
|
|
3232
|
+
}
|
|
3233
|
+
/**
|
|
3234
|
+
* Recognised OLE object application types derived from `progId` / `clsId`.
|
|
3235
|
+
*
|
|
3236
|
+
* Used to show type-specific icons and previews in the editor.
|
|
3237
|
+
*/
|
|
3238
|
+
type OleObjectType = 'excel' | 'word' | 'pdf' | 'visio' | 'mathtype' | 'package' | 'unknown';
|
|
3239
|
+
/**
|
|
3240
|
+
* An OLE (Object Linking and Embedding) object.
|
|
3241
|
+
*
|
|
3242
|
+
* OLE objects can be embedded Excel sheets, Word documents, PDFs, Visio
|
|
3243
|
+
* diagrams, MathType equations, or generic "packages". They carry a
|
|
3244
|
+
* preview image for display and optional binary data for extraction.
|
|
3245
|
+
*
|
|
3246
|
+
* @example
|
|
3247
|
+
* ```ts
|
|
3248
|
+
* const ole: OlePptxElement = {
|
|
3249
|
+
* type: "ole",
|
|
3250
|
+
* id: "ole_1", x: 100, y: 200, width: 400, height: 300,
|
|
3251
|
+
* oleObjectType: "excel",
|
|
3252
|
+
* oleProgId: "Excel.Sheet.12",
|
|
3253
|
+
* fileName: "budget.xlsx",
|
|
3254
|
+
* };
|
|
3255
|
+
* // => satisfies OlePptxElement
|
|
3256
|
+
* ```
|
|
3257
|
+
*/
|
|
3258
|
+
interface OlePptxElement extends PptxElementBase {
|
|
3259
|
+
type: 'ole';
|
|
3260
|
+
oleTarget?: string;
|
|
3261
|
+
oleProgId?: string;
|
|
3262
|
+
oleName?: string;
|
|
3263
|
+
/** CLSID of the OLE object (from `@_classid`). */
|
|
3264
|
+
oleClsId?: string;
|
|
3265
|
+
/** Detected application type (excel, word, pdf, etc.). */
|
|
3266
|
+
oleObjectType?: OleObjectType;
|
|
3267
|
+
/** File extension for the embedded binary (e.g. "xlsx", "docx"). */
|
|
3268
|
+
oleFileExtension?: string;
|
|
3269
|
+
/** Original file name when available. */
|
|
3270
|
+
fileName?: string;
|
|
3271
|
+
/** Whether this is a linked (vs. embedded) object. */
|
|
3272
|
+
isLinked?: boolean;
|
|
3273
|
+
/** External file path for linked OLE objects (TargetMode="External"). */
|
|
3274
|
+
externalPath?: string;
|
|
3275
|
+
/** Data-URL or path for the OLE preview image. */
|
|
3276
|
+
previewImage?: string;
|
|
3277
|
+
/** Decoded preview image as a data-URL. */
|
|
3278
|
+
previewImageData?: string;
|
|
3279
|
+
}
|
|
3280
|
+
/**
|
|
3281
|
+
* An audio or video media element.
|
|
3282
|
+
*
|
|
3283
|
+
* Media elements reference files inside the PPTX archive
|
|
3284
|
+
* (`mediaPath`) and may include trim points, poster frames, and
|
|
3285
|
+
* playback settings for presentation mode.
|
|
3286
|
+
*
|
|
3287
|
+
* @example
|
|
3288
|
+
* ```ts
|
|
3289
|
+
* const video: MediaPptxElement = {
|
|
3290
|
+
* type: "media",
|
|
3291
|
+
* id: "vid_1", x: 50, y: 100, width: 640, height: 360,
|
|
3292
|
+
* mediaType: "video",
|
|
3293
|
+
* mediaPath: "ppt/media/media1.mp4",
|
|
3294
|
+
* autoPlay: true,
|
|
3295
|
+
* volume: 0.8,
|
|
3296
|
+
* };
|
|
3297
|
+
* // => satisfies MediaPptxElement
|
|
3298
|
+
* ```
|
|
3299
|
+
*/
|
|
3300
|
+
interface MediaPptxElement extends PptxElementBase {
|
|
3301
|
+
type: 'media';
|
|
3302
|
+
mediaType?: PptxMediaType;
|
|
3303
|
+
mediaPath?: string;
|
|
3304
|
+
mediaData?: string;
|
|
3305
|
+
mediaMimeType?: string;
|
|
3306
|
+
/** Trim start in milliseconds (from p:cMediaNode p:cTn @st). */
|
|
3307
|
+
trimStartMs?: number;
|
|
3308
|
+
/** Trim end in milliseconds (from p:cMediaNode p:cTn @end). */
|
|
3309
|
+
trimEndMs?: number;
|
|
3310
|
+
/** Path to the poster/preview image inside the ZIP. */
|
|
3311
|
+
posterFramePath?: string;
|
|
3312
|
+
/** Base64 data-URL for the poster frame image. */
|
|
3313
|
+
posterFrameData?: string;
|
|
3314
|
+
/** Whether media should play full-screen during presentation. */
|
|
3315
|
+
fullScreen?: boolean;
|
|
3316
|
+
/** Whether media should loop continuously. */
|
|
3317
|
+
loop?: boolean;
|
|
3318
|
+
/** Fade-in duration in seconds. */
|
|
3319
|
+
fadeInDuration?: number;
|
|
3320
|
+
/** Fade-out duration in seconds. */
|
|
3321
|
+
fadeOutDuration?: number;
|
|
3322
|
+
/** Playback volume (0 to 1). */
|
|
3323
|
+
volume?: number;
|
|
3324
|
+
/** Whether media auto-plays on slide entry. */
|
|
3325
|
+
autoPlay?: boolean;
|
|
3326
|
+
/** Whether audio continues playing across slide transitions (presentation mode). */
|
|
3327
|
+
playAcrossSlides?: boolean;
|
|
3328
|
+
/** Hide the element when media is not actively playing. */
|
|
3329
|
+
hideWhenNotPlaying?: boolean;
|
|
3330
|
+
/** Named time bookmarks within the clip. */
|
|
3331
|
+
bookmarks?: MediaBookmark[];
|
|
3332
|
+
/** Playback speed multiplier (1 = normal, 2 = double, 0.5 = half). */
|
|
3333
|
+
playbackSpeed?: number;
|
|
3334
|
+
/** Runtime-extracted metadata (duration, resolution, codec). */
|
|
3335
|
+
metadata?: MediaMetadata;
|
|
3336
|
+
/** Closed caption / subtitle tracks. */
|
|
3337
|
+
captionTracks?: MediaCaptionTrack[];
|
|
3338
|
+
/** Whether the media source is missing/broken (file not found in archive). */
|
|
3339
|
+
mediaMissing?: boolean;
|
|
3340
|
+
}
|
|
3341
|
+
/**
|
|
3342
|
+
* A group container that holds child elements.
|
|
3343
|
+
*
|
|
3344
|
+
* Children inherit the group’s transform, so moving/resizing the group
|
|
3345
|
+
* affects all children proportionally.
|
|
3346
|
+
*
|
|
3347
|
+
* @example
|
|
3348
|
+
* ```ts
|
|
3349
|
+
* const group: GroupPptxElement = {
|
|
3350
|
+
* type: "group",
|
|
3351
|
+
* id: "grp_1", x: 0, y: 0, width: 960, height: 540,
|
|
3352
|
+
* children: [textEl, shapeEl],
|
|
3353
|
+
* };
|
|
3354
|
+
* // => satisfies GroupPptxElement
|
|
3355
|
+
* ```
|
|
3356
|
+
*/
|
|
3357
|
+
interface GroupPptxElement extends PptxElementBase {
|
|
3358
|
+
type: 'group';
|
|
3359
|
+
/** Child elements contained within this group. */
|
|
3360
|
+
children: PptxElement[];
|
|
3361
|
+
/** Fill style extracted from the group's `p:grpSpPr`, used for `a:grpFill` inheritance. */
|
|
3362
|
+
groupFill?: ShapeStyle;
|
|
3363
|
+
}
|
|
3364
|
+
/**
|
|
3365
|
+
* A freehand ink / drawing stroke captured with a stylus or mouse.
|
|
3366
|
+
*
|
|
3367
|
+
* Ink strokes are stored as SVG path data strings. Each path may
|
|
3368
|
+
* have independent colour, width, and opacity.
|
|
3369
|
+
*/
|
|
3370
|
+
interface InkPptxElement extends PptxElementBase {
|
|
3371
|
+
type: 'ink';
|
|
3372
|
+
/** SVG path data for ink strokes. */
|
|
3373
|
+
inkPaths: string[];
|
|
3374
|
+
/** Per-path stroke colours. */
|
|
3375
|
+
inkColors?: string[];
|
|
3376
|
+
/** Per-path stroke widths. */
|
|
3377
|
+
inkWidths?: number[];
|
|
3378
|
+
/** Per-path opacities (0-1). */
|
|
3379
|
+
inkOpacities?: number[];
|
|
3380
|
+
/** Drawing tool used: pen, highlighter, or eraser. */
|
|
3381
|
+
inkTool?: 'pen' | 'highlighter' | 'eraser';
|
|
3382
|
+
/**
|
|
3383
|
+
* Per-path arrays of per-point pressure values (0-1).
|
|
3384
|
+
*
|
|
3385
|
+
* Each entry corresponds to the path at the same index in `inkPaths`.
|
|
3386
|
+
* Each inner array contains one pressure value per sampled point along
|
|
3387
|
+
* the stroke. When present, the renderer uses these values to produce
|
|
3388
|
+
* variable-width strokes that reflect stylus/pen pressure.
|
|
3389
|
+
*/
|
|
3390
|
+
inkPointPressures?: number[][];
|
|
3391
|
+
}
|
|
3392
|
+
/**
|
|
3393
|
+
* A single ink stroke within a {@link ContentPartPptxElement}.
|
|
3394
|
+
*/
|
|
3395
|
+
interface ContentPartInkStroke {
|
|
3396
|
+
path: string;
|
|
3397
|
+
color: string;
|
|
3398
|
+
width: number;
|
|
3399
|
+
opacity: number;
|
|
3400
|
+
/**
|
|
3401
|
+
* Per-point pressure values (0-1) for this stroke.
|
|
3402
|
+
*
|
|
3403
|
+
* When present, the renderer uses these values to produce
|
|
3404
|
+
* variable-width strokes that reflect stylus/pen pressure.
|
|
3405
|
+
*/
|
|
3406
|
+
pressures?: number[];
|
|
3407
|
+
}
|
|
3408
|
+
/**
|
|
3409
|
+
* A content-part element wrapped in `mc:AlternateContent`.
|
|
3410
|
+
*
|
|
3411
|
+
* Typically contains ink strokes from modern PowerPoint pen/highlighter.
|
|
3412
|
+
*/
|
|
3413
|
+
interface ContentPartPptxElement extends PptxElementBase {
|
|
3414
|
+
type: 'contentPart';
|
|
3415
|
+
/** Ink strokes contained in this content part. */
|
|
3416
|
+
inkStrokes?: ContentPartInkStroke[];
|
|
3417
|
+
}
|
|
3418
|
+
/**
|
|
3419
|
+
* A Slide Zoom or Section Zoom element (PowerPoint Zoom Object).
|
|
3420
|
+
*
|
|
3421
|
+
* Zoom elements display a live thumbnail of the target slide and
|
|
3422
|
+
* navigate to it on click during presentation mode.
|
|
3423
|
+
*
|
|
3424
|
+
* @example
|
|
3425
|
+
* ```ts
|
|
3426
|
+
* const zoom: ZoomPptxElement = {
|
|
3427
|
+
* type: "zoom",
|
|
3428
|
+
* id: "zm_1", x: 300, y: 200, width: 200, height: 120,
|
|
3429
|
+
* zoomType: "slide",
|
|
3430
|
+
* targetSlideIndex: 5,
|
|
3431
|
+
* };
|
|
3432
|
+
* // => satisfies ZoomPptxElement
|
|
3433
|
+
* ```
|
|
3434
|
+
*/
|
|
3435
|
+
interface ZoomPptxElement extends PptxElementBase, PptxImageProperties {
|
|
3436
|
+
type: 'zoom';
|
|
3437
|
+
/** Type of zoom: slide-level or section-level. */
|
|
3438
|
+
zoomType: 'slide' | 'section';
|
|
3439
|
+
/** Zero-based index of the target slide. */
|
|
3440
|
+
targetSlideIndex: number;
|
|
3441
|
+
/** Section ID for section zoom. */
|
|
3442
|
+
targetSectionId?: string;
|
|
3443
|
+
}
|
|
3444
|
+
/**
|
|
3445
|
+
* A 3D model object embedded via `p16:model3D` inside an
|
|
3446
|
+
* `mc:AlternateContent` block (PowerPoint 365+).
|
|
3447
|
+
*
|
|
3448
|
+
* The element carries the path to the `.glb`/`.gltf` binary inside
|
|
3449
|
+
* the ZIP and a poster/fallback image for rendering in viewers that
|
|
3450
|
+
* do not support interactive 3D.
|
|
3451
|
+
*/
|
|
3452
|
+
interface Model3DPptxElement extends PptxElementBase, PptxImageProperties {
|
|
3453
|
+
type: 'model3d';
|
|
3454
|
+
/** Path to the 3D model file inside the ZIP. */
|
|
3455
|
+
modelPath?: string;
|
|
3456
|
+
/** Base64 data URL of the 3D model binary. */
|
|
3457
|
+
modelData?: string;
|
|
3458
|
+
/** MIME type of the model (e.g. "model/gltf-binary"). */
|
|
3459
|
+
modelMimeType?: string;
|
|
3460
|
+
/** Poster/preview image shown when 3D rendering is unavailable. */
|
|
3461
|
+
posterImage?: string;
|
|
3462
|
+
}
|
|
3463
|
+
/** An element whose type is not recognised by the parser. */
|
|
3464
|
+
interface UnknownPptxElement extends PptxElementBase {
|
|
3465
|
+
type: 'unknown';
|
|
3466
|
+
}
|
|
3467
|
+
/**
|
|
3468
|
+
* A single element on a PPTX slide.
|
|
3469
|
+
*
|
|
3470
|
+
* This is a **discriminated union** — narrow on `element.type` to access
|
|
3471
|
+
* variant-specific properties like `imageData` (image/picture), `pathData`
|
|
3472
|
+
* (shape), or `textSegments` (text/shape).
|
|
3473
|
+
*/
|
|
3474
|
+
type PptxElement = TextPptxElement | ShapePptxElement | ConnectorPptxElement | ImagePptxElement | PicturePptxElement | TablePptxElement | ChartPptxElement | SmartArtPptxElement | OlePptxElement | MediaPptxElement | GroupPptxElement | InkPptxElement | ContentPartPptxElement | ZoomPptxElement | Model3DPptxElement | UnknownPptxElement;
|
|
3475
|
+
/** Elements that can contain text content (text boxes, shapes, and connectors). */
|
|
3476
|
+
type PptxElementWithText = TextPptxElement | ShapePptxElement | ConnectorPptxElement;
|
|
3477
|
+
/** Elements that carry shape styling (fill, stroke, geometry). */
|
|
3478
|
+
type PptxElementWithShapeStyle = TextPptxElement | ShapePptxElement | ConnectorPptxElement | ImagePptxElement | PicturePptxElement;
|
|
3479
|
+
/** Elements that hold raster image data. */
|
|
3480
|
+
type PptxImageLikeElement = ImagePptxElement | PicturePptxElement;
|
|
3481
|
+
|
|
3482
|
+
/**
|
|
3483
|
+
* Theme object model — colour scheme, font scheme, and format scheme
|
|
3484
|
+
* parsed from `ppt/theme/theme1.xml`.
|
|
3485
|
+
*
|
|
3486
|
+
* The colour scheme provides the 12 canonical OOXML colour slots.
|
|
3487
|
+
* The font scheme defines major (heading) and minor (body) typefaces.
|
|
3488
|
+
* The format scheme holds fill, line, and effect style matrices at
|
|
3489
|
+
* three intensity levels (subtle, moderate, intense).
|
|
3490
|
+
*
|
|
3491
|
+
* @module pptx-types/theme
|
|
3492
|
+
*/
|
|
3493
|
+
/**
|
|
3494
|
+
* The 12 OOXML theme colour scheme keys in canonical order.
|
|
3495
|
+
*
|
|
3496
|
+
* @example
|
|
3497
|
+
* ```ts
|
|
3498
|
+
* for (const key of THEME_COLOR_SCHEME_KEYS) {
|
|
3499
|
+
* console.log(key, theme.colorScheme?.[key]);
|
|
3500
|
+
* }
|
|
3501
|
+
* // => e.g. "dk1 #000000", "lt1 #FFFFFF", "accent1 #4F81BD", …
|
|
3502
|
+
* ```
|
|
3503
|
+
*/
|
|
3504
|
+
declare const THEME_COLOR_SCHEME_KEYS: readonly ["dk1", "lt1", "dk2", "lt2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6", "hlink", "folHlink"];
|
|
3505
|
+
/**
|
|
3506
|
+
* Resolved hex values for the 12 theme colour slots.
|
|
3507
|
+
*
|
|
3508
|
+
* @example
|
|
3509
|
+
* ```ts
|
|
3510
|
+
* const scheme: PptxThemeColorScheme = {
|
|
3511
|
+
* dk1: "#000000", lt1: "#FFFFFF",
|
|
3512
|
+
* dk2: "#1F497D", lt2: "#EEECE1",
|
|
3513
|
+
* accent1: "#4F81BD", accent2: "#C0504D",
|
|
3514
|
+
* accent3: "#9BBB59", accent4: "#8064A2",
|
|
3515
|
+
* accent5: "#4BACC6", accent6: "#F79646",
|
|
3516
|
+
* hlink: "#0000FF", folHlink: "#800080",
|
|
3517
|
+
* };
|
|
3518
|
+
* // => satisfies PptxThemeColorScheme
|
|
3519
|
+
* ```
|
|
3520
|
+
*/
|
|
3521
|
+
interface PptxThemeColorScheme {
|
|
3522
|
+
dk1: string;
|
|
3523
|
+
lt1: string;
|
|
3524
|
+
dk2: string;
|
|
3525
|
+
lt2: string;
|
|
3526
|
+
accent1: string;
|
|
3527
|
+
accent2: string;
|
|
3528
|
+
accent3: string;
|
|
3529
|
+
accent4: string;
|
|
3530
|
+
accent5: string;
|
|
3531
|
+
accent6: string;
|
|
3532
|
+
hlink: string;
|
|
3533
|
+
folHlink: string;
|
|
3534
|
+
}
|
|
3535
|
+
/**
|
|
3536
|
+
* A font-family triplet for major or minor theme fonts.
|
|
3537
|
+
*
|
|
3538
|
+
* Supports Latin, East Asian, and Complex Script font families.
|
|
3539
|
+
*
|
|
3540
|
+
* @example
|
|
3541
|
+
* ```ts
|
|
3542
|
+
* const fonts: PptxThemeFontGroup = {
|
|
3543
|
+
* latin: "Calibri Light",
|
|
3544
|
+
* eastAsia: "MS PGothic",
|
|
3545
|
+
* complexScript: "Arial",
|
|
3546
|
+
* };
|
|
3547
|
+
* // => satisfies PptxThemeFontGroup
|
|
3548
|
+
* ```
|
|
3549
|
+
*/
|
|
3550
|
+
interface PptxThemeFontGroup {
|
|
3551
|
+
latin?: string;
|
|
3552
|
+
eastAsia?: string;
|
|
3553
|
+
complexScript?: string;
|
|
3554
|
+
}
|
|
3555
|
+
/**
|
|
3556
|
+
* Theme font scheme — major (headings) and minor (body) font families.
|
|
3557
|
+
*
|
|
3558
|
+
* @example
|
|
3559
|
+
* ```ts
|
|
3560
|
+
* const scheme: PptxThemeFontScheme = {
|
|
3561
|
+
* majorFont: { latin: "Calibri Light" },
|
|
3562
|
+
* minorFont: { latin: "Calibri", eastAsia: "MS PGothic" },
|
|
3563
|
+
* };
|
|
3564
|
+
* // => satisfies PptxThemeFontScheme
|
|
3565
|
+
* ```
|
|
3566
|
+
*/
|
|
3567
|
+
interface PptxThemeFontScheme {
|
|
3568
|
+
majorFont?: PptxThemeFontGroup;
|
|
3569
|
+
minorFont?: PptxThemeFontGroup;
|
|
3570
|
+
}
|
|
3571
|
+
/**
|
|
3572
|
+
* A single fill style entry from the theme format scheme.
|
|
3573
|
+
* Each entry is one of: solid, gradient, pattern, or no fill.
|
|
3574
|
+
* The raw XML node is also stored so that `phClr` substitution can happen
|
|
3575
|
+
* at resolution time.
|
|
3576
|
+
*
|
|
3577
|
+
* @example
|
|
3578
|
+
* ```ts
|
|
3579
|
+
* const solidFill: PptxThemeFillStyle = {
|
|
3580
|
+
* kind: "solid",
|
|
3581
|
+
* color: "#4F81BD",
|
|
3582
|
+
* opacity: 1,
|
|
3583
|
+
* };
|
|
3584
|
+
*
|
|
3585
|
+
* const gradientFill: PptxThemeFillStyle = {
|
|
3586
|
+
* kind: "gradient",
|
|
3587
|
+
* gradientAngle: 90,
|
|
3588
|
+
* gradientType: "linear",
|
|
3589
|
+
* gradientStops: [
|
|
3590
|
+
* { color: "#4F81BD", position: 0 },
|
|
3591
|
+
* { color: "#1F497D", position: 1 },
|
|
3592
|
+
* ],
|
|
3593
|
+
* };
|
|
3594
|
+
* // => satisfies PptxThemeFillStyle
|
|
3595
|
+
* ```
|
|
3596
|
+
*/
|
|
3597
|
+
interface PptxThemeFillStyle {
|
|
3598
|
+
/** Discriminator for the fill type. */
|
|
3599
|
+
kind: 'solid' | 'gradient' | 'pattern' | 'none';
|
|
3600
|
+
/** Pre-resolved colour (may be `undefined` when `phClr`-dependent). */
|
|
3601
|
+
color?: string;
|
|
3602
|
+
opacity?: number;
|
|
3603
|
+
/** Gradient-specific fields (only present when `kind === "gradient"`). */
|
|
3604
|
+
gradientStops?: Array<{
|
|
3605
|
+
color: string;
|
|
3606
|
+
position: number;
|
|
3607
|
+
opacity?: number;
|
|
3608
|
+
}>;
|
|
3609
|
+
gradientAngle?: number;
|
|
3610
|
+
gradientType?: 'linear' | 'radial';
|
|
3611
|
+
gradientCss?: string;
|
|
3612
|
+
/** Pattern-specific fields (only present when `kind === "pattern"`). */
|
|
3613
|
+
patternPreset?: string;
|
|
3614
|
+
patternBackgroundColor?: string;
|
|
3615
|
+
/** Raw XML node preserved for `phClr` re-resolution. */
|
|
3616
|
+
rawNode?: unknown;
|
|
3617
|
+
}
|
|
3618
|
+
/**
|
|
3619
|
+
* A single line style entry from `a:lnStyleLst`.
|
|
3620
|
+
* Provides width, dash, join, cap, and optional fill colour.
|
|
3621
|
+
*
|
|
3622
|
+
* @example
|
|
3623
|
+
* ```ts
|
|
3624
|
+
* const line: PptxThemeLineStyle = {
|
|
3625
|
+
* width: 1.5,
|
|
3626
|
+
* color: "#4F81BD",
|
|
3627
|
+
* dash: "solid",
|
|
3628
|
+
* lineJoin: "round",
|
|
3629
|
+
* lineCap: "flat",
|
|
3630
|
+
* };
|
|
3631
|
+
* // => satisfies PptxThemeLineStyle
|
|
3632
|
+
* ```
|
|
3633
|
+
*/
|
|
3634
|
+
interface PptxThemeLineStyle {
|
|
3635
|
+
/** Line width in pixels (converted from EMU). */
|
|
3636
|
+
width?: number;
|
|
3637
|
+
color?: string;
|
|
3638
|
+
opacity?: number;
|
|
3639
|
+
dash?: string;
|
|
3640
|
+
lineJoin?: 'round' | 'bevel' | 'miter';
|
|
3641
|
+
lineCap?: 'flat' | 'rnd' | 'sq';
|
|
3642
|
+
compoundLine?: 'sng' | 'dbl' | 'thickThin' | 'thinThick' | 'tri';
|
|
3643
|
+
/** Raw XML node preserved for `phClr` re-resolution. */
|
|
3644
|
+
rawNode?: unknown;
|
|
3645
|
+
}
|
|
3646
|
+
/**
|
|
3647
|
+
* A single effect style entry from `a:effectStyleLst`.
|
|
3648
|
+
* Each entry may define shadow, glow, soft-edge, reflection, blur,
|
|
3649
|
+
* and optionally a 3-D scene/shape.
|
|
3650
|
+
*
|
|
3651
|
+
* @example
|
|
3652
|
+
* ```ts
|
|
3653
|
+
* const dropShadow: PptxThemeEffectStyle = {
|
|
3654
|
+
* shadowColor: "#000000",
|
|
3655
|
+
* shadowBlur: 4,
|
|
3656
|
+
* shadowOffsetX: 2,
|
|
3657
|
+
* shadowOffsetY: 3,
|
|
3658
|
+
* shadowOpacity: 0.4,
|
|
3659
|
+
* };
|
|
3660
|
+
* // => satisfies PptxThemeEffectStyle
|
|
3661
|
+
* ```
|
|
3662
|
+
*/
|
|
3663
|
+
interface PptxThemeEffectStyle {
|
|
3664
|
+
shadowColor?: string;
|
|
3665
|
+
shadowBlur?: number;
|
|
3666
|
+
shadowOffsetX?: number;
|
|
3667
|
+
shadowOffsetY?: number;
|
|
3668
|
+
shadowOpacity?: number;
|
|
3669
|
+
glowColor?: string;
|
|
3670
|
+
glowRadius?: number;
|
|
3671
|
+
glowOpacity?: number;
|
|
3672
|
+
softEdgeRadius?: number;
|
|
3673
|
+
innerShadowColor?: string;
|
|
3674
|
+
innerShadowOpacity?: number;
|
|
3675
|
+
innerShadowBlur?: number;
|
|
3676
|
+
innerShadowOffsetX?: number;
|
|
3677
|
+
innerShadowOffsetY?: number;
|
|
3678
|
+
reflectionBlurRadius?: number;
|
|
3679
|
+
reflectionStartOpacity?: number;
|
|
3680
|
+
reflectionEndOpacity?: number;
|
|
3681
|
+
reflectionEndPosition?: number;
|
|
3682
|
+
reflectionDirection?: number;
|
|
3683
|
+
reflectionRotation?: number;
|
|
3684
|
+
reflectionDistance?: number;
|
|
3685
|
+
/** 3D scene/camera from `a:scene3d` on the effect style (idx 3 typically). */
|
|
3686
|
+
scene3d?: Pptx3DScene;
|
|
3687
|
+
/** 3D shape extrusion/bevel from `a:sp3d` on the effect style (idx 3 typically). */
|
|
3688
|
+
shape3d?: Pptx3DShape;
|
|
3689
|
+
/** Raw XML node preserved for `phClr` re-resolution. */
|
|
3690
|
+
rawNode?: unknown;
|
|
3691
|
+
}
|
|
3692
|
+
/**
|
|
3693
|
+
* The full parsed format scheme from `a:fmtScheme` inside `a:themeElements`.
|
|
3694
|
+
* Contains three fill style lists and one line/effect style list each,
|
|
3695
|
+
* at three intensity levels: subtle (idx 1), moderate (idx 2), intense (idx 3).
|
|
3696
|
+
*
|
|
3697
|
+
* OOXML reference indices:
|
|
3698
|
+
* - fillStyleLst: idx 1-3 (used by `a:fillRef @idx` 1-3)
|
|
3699
|
+
* - lnStyleLst: idx 1-3 (used by `a:lnRef @idx` 1-3)
|
|
3700
|
+
* - effectStyleLst: idx 1-3 (used by `a:effectRef @idx` 1-3)
|
|
3701
|
+
* - bgFillStyleLst: idx 1-3 (used by `a:fillRef @idx` 1001-1003)
|
|
3702
|
+
*
|
|
3703
|
+
* @example
|
|
3704
|
+
* ```ts
|
|
3705
|
+
* const fmt: PptxThemeFormatScheme = {
|
|
3706
|
+
* name: "Office",
|
|
3707
|
+
* fillStyles: [solidFill, gradientFill, intenseFill],
|
|
3708
|
+
* lineStyles: [thinLine, mediumLine, thickLine],
|
|
3709
|
+
* effectStyles: [subtle, moderate, intense],
|
|
3710
|
+
* backgroundFillStyles: [solidBg, gradientBg, intenseBg],
|
|
3711
|
+
* };
|
|
3712
|
+
* // => satisfies PptxThemeFormatScheme
|
|
3713
|
+
* ```
|
|
3714
|
+
*/
|
|
3715
|
+
interface PptxThemeFormatScheme {
|
|
3716
|
+
/** The `@name` attribute of the format scheme. */
|
|
3717
|
+
name?: string;
|
|
3718
|
+
/** Fill styles at indices 1-3 (subtle, moderate, intense). */
|
|
3719
|
+
fillStyles: PptxThemeFillStyle[];
|
|
3720
|
+
/** Line styles at indices 1-3. */
|
|
3721
|
+
lineStyles: PptxThemeLineStyle[];
|
|
3722
|
+
/** Effect styles at indices 1-3. */
|
|
3723
|
+
effectStyles: PptxThemeEffectStyle[];
|
|
3724
|
+
/** Background fill styles at indices 1-3 (referenced via idx 1001-1003). */
|
|
3725
|
+
backgroundFillStyles: PptxThemeFillStyle[];
|
|
3726
|
+
}
|
|
3727
|
+
/**
|
|
3728
|
+
* Full parsed theme object available to renderers.
|
|
3729
|
+
*
|
|
3730
|
+
* @example
|
|
3731
|
+
* ```ts
|
|
3732
|
+
* const theme: PptxTheme = {
|
|
3733
|
+
* name: "Office Theme",
|
|
3734
|
+
* colorScheme: { dk1: "#000", lt1: "#FFF", /* … *\/ },
|
|
3735
|
+
* fontScheme: {
|
|
3736
|
+
* majorFont: { latin: "Calibri Light" },
|
|
3737
|
+
* minorFont: { latin: "Calibri" },
|
|
3738
|
+
* },
|
|
3739
|
+
* };
|
|
3740
|
+
* // => satisfies PptxTheme
|
|
3741
|
+
* ```
|
|
3742
|
+
*/
|
|
3743
|
+
interface PptxTheme {
|
|
3744
|
+
/** Theme name from `a:theme @name`. */
|
|
3745
|
+
name?: string;
|
|
3746
|
+
/** Resolved colour scheme. */
|
|
3747
|
+
colorScheme?: PptxThemeColorScheme;
|
|
3748
|
+
/** Resolved font scheme. */
|
|
3749
|
+
fontScheme?: PptxThemeFontScheme;
|
|
3750
|
+
/** Format scheme — fill, line, effect and background fill style matrices. */
|
|
3751
|
+
formatScheme?: PptxThemeFormatScheme;
|
|
3752
|
+
}
|
|
3753
|
+
|
|
3754
|
+
/**
|
|
3755
|
+
* Master and layout types: notes master, handout master, slide master,
|
|
3756
|
+
* slide layout, and theme options.
|
|
3757
|
+
*
|
|
3758
|
+
* @module pptx-types/masters
|
|
3759
|
+
*/
|
|
3760
|
+
|
|
3761
|
+
/**
|
|
3762
|
+
* Parsed notes master from `ppt/notesMasters/notesMaster1.xml`.
|
|
3763
|
+
*
|
|
3764
|
+
* @example
|
|
3765
|
+
* ```ts
|
|
3766
|
+
* const notes: PptxNotesMaster = {
|
|
3767
|
+
* path: "ppt/notesMasters/notesMaster1.xml",
|
|
3768
|
+
* backgroundColor: "#FFFFFF",
|
|
3769
|
+
* placeholders: [{ type: "body" }, { type: "sldImg" }],
|
|
3770
|
+
* };
|
|
3771
|
+
* // => satisfies PptxNotesMaster
|
|
3772
|
+
* ```
|
|
3773
|
+
*/
|
|
3774
|
+
interface PptxNotesMaster {
|
|
3775
|
+
/** File path within the PPTX archive. */
|
|
3776
|
+
path: string;
|
|
3777
|
+
/** Background colour of the notes master. */
|
|
3778
|
+
backgroundColor?: string;
|
|
3779
|
+
/** Background image data URL. */
|
|
3780
|
+
backgroundImage?: string;
|
|
3781
|
+
/** Placeholder shapes found on the notes master. */
|
|
3782
|
+
placeholders?: Array<{
|
|
3783
|
+
type: string;
|
|
3784
|
+
idx?: string;
|
|
3785
|
+
}>;
|
|
3786
|
+
/** Editable elements on the notes master (header, footer, date, page number, slide image, notes body). */
|
|
3787
|
+
elements?: PptxElement[];
|
|
3788
|
+
}
|
|
3789
|
+
/**
|
|
3790
|
+
* Parsed handout master from `ppt/handoutMasters/handoutMaster1.xml`.
|
|
3791
|
+
*
|
|
3792
|
+
* @example
|
|
3793
|
+
* ```ts
|
|
3794
|
+
* const handout: PptxHandoutMaster = {
|
|
3795
|
+
* path: "ppt/handoutMasters/handoutMaster1.xml",
|
|
3796
|
+
* slidesPerPage: 6,
|
|
3797
|
+
* };
|
|
3798
|
+
* // => satisfies PptxHandoutMaster
|
|
3799
|
+
* ```
|
|
3800
|
+
*/
|
|
3801
|
+
interface PptxHandoutMaster {
|
|
3802
|
+
/** File path within the PPTX archive. */
|
|
3803
|
+
path: string;
|
|
3804
|
+
/** Background colour of the handout master. */
|
|
3805
|
+
backgroundColor?: string;
|
|
3806
|
+
/** Background image data URL. */
|
|
3807
|
+
backgroundImage?: string;
|
|
3808
|
+
/** Placeholder shapes found on the handout master. */
|
|
3809
|
+
placeholders?: Array<{
|
|
3810
|
+
type: string;
|
|
3811
|
+
idx?: string;
|
|
3812
|
+
}>;
|
|
3813
|
+
/** Editable elements on the handout master (header, footer, date, page number, slide placeholders). */
|
|
3814
|
+
elements?: PptxElement[];
|
|
3815
|
+
/** Number of slides per page for handout print layout (1, 2, 3, 4, 6, or 9). */
|
|
3816
|
+
slidesPerPage?: number;
|
|
3817
|
+
}
|
|
3818
|
+
/**
|
|
3819
|
+
* Active tab within the master view sidebar.
|
|
3820
|
+
*
|
|
3821
|
+
* @example
|
|
3822
|
+
* ```ts
|
|
3823
|
+
* const tab: MasterViewTab = "slides";
|
|
3824
|
+
* // => "slides" — one of: "slides" | "notes" | "handout"
|
|
3825
|
+
* ```
|
|
3826
|
+
*/
|
|
3827
|
+
type MasterViewTab = 'slides' | 'notes' | 'handout';
|
|
3828
|
+
/**
|
|
3829
|
+
* Structured slide master data.
|
|
3830
|
+
*
|
|
3831
|
+
* @example
|
|
3832
|
+
* ```ts
|
|
3833
|
+
* const master: PptxSlideMaster = {
|
|
3834
|
+
* path: "ppt/slideMasters/slideMaster1.xml",
|
|
3835
|
+
* name: "Office Theme",
|
|
3836
|
+
* backgroundColor: "#FFFFFF",
|
|
3837
|
+
* themePath: "ppt/theme/theme1.xml",
|
|
3838
|
+
* };
|
|
3839
|
+
* // => satisfies PptxSlideMaster
|
|
3840
|
+
* ```
|
|
3841
|
+
*/
|
|
3842
|
+
interface PptxSlideMaster {
|
|
3843
|
+
/** File path within the PPTX archive. */
|
|
3844
|
+
path: string;
|
|
3845
|
+
/** Human-readable name if available. */
|
|
3846
|
+
name?: string;
|
|
3847
|
+
/** Background colour of the slide master. */
|
|
3848
|
+
backgroundColor?: string;
|
|
3849
|
+
/** Background image data URL for the slide master. */
|
|
3850
|
+
backgroundImage?: string;
|
|
3851
|
+
/** Theme file path this master references. */
|
|
3852
|
+
themePath?: string;
|
|
3853
|
+
/** Layout paths associated with this master. */
|
|
3854
|
+
layoutPaths?: string[];
|
|
3855
|
+
/** Placeholder shapes on the master. */
|
|
3856
|
+
placeholders?: Array<{
|
|
3857
|
+
type: string;
|
|
3858
|
+
idx?: string;
|
|
3859
|
+
}>;
|
|
3860
|
+
/** Parsed element shapes on the master slide (for master view rendering). */
|
|
3861
|
+
elements?: PptxElement[];
|
|
3862
|
+
/** Parsed slide layout objects associated with this master. */
|
|
3863
|
+
layouts?: PptxSlideLayout[];
|
|
3864
|
+
/** Text styles from `p:txStyles` — title, body, and other text defaults. */
|
|
3865
|
+
txStyles?: PptxMasterTextStyles;
|
|
3866
|
+
}
|
|
3867
|
+
/**
|
|
3868
|
+
* Per-level paragraph properties for a text style category.
|
|
3869
|
+
* Each entry maps a 0-based level index to its style defaults.
|
|
3870
|
+
*/
|
|
3871
|
+
type PptxTextStyleLevels = Record<number, PlaceholderTextLevelStyle>;
|
|
3872
|
+
/**
|
|
3873
|
+
* Text styles parsed from `p:txStyles` on a slide master.
|
|
3874
|
+
* Provides cascading defaults for title, body, and other text.
|
|
3875
|
+
*/
|
|
3876
|
+
interface PptxMasterTextStyles {
|
|
3877
|
+
/** Title text style (`p:titleStyle`). */
|
|
3878
|
+
titleStyle?: PptxTextStyleLevels;
|
|
3879
|
+
/** Body text style (`p:bodyStyle`). */
|
|
3880
|
+
bodyStyle?: PptxTextStyleLevels;
|
|
3881
|
+
/** Other text style (`p:otherStyle`). */
|
|
3882
|
+
otherStyle?: PptxTextStyleLevels;
|
|
3883
|
+
}
|
|
3884
|
+
/**
|
|
3885
|
+
* A slide layout associated with a slide master.
|
|
3886
|
+
*
|
|
3887
|
+
* @example
|
|
3888
|
+
* ```ts
|
|
3889
|
+
* const layout: PptxSlideLayout = {
|
|
3890
|
+
* path: "ppt/slideLayouts/slideLayout2.xml",
|
|
3891
|
+
* name: "Title and Content",
|
|
3892
|
+
* };
|
|
3893
|
+
* // => satisfies PptxSlideLayout
|
|
3894
|
+
* ```
|
|
3895
|
+
*/
|
|
3896
|
+
interface PptxSlideLayout {
|
|
3897
|
+
/** File path within the PPTX archive. */
|
|
3898
|
+
path: string;
|
|
3899
|
+
/** Human-readable layout name. */
|
|
3900
|
+
name?: string;
|
|
3901
|
+
/** Background colour of the layout. */
|
|
3902
|
+
backgroundColor?: string;
|
|
3903
|
+
/** Background image data URL for the layout. */
|
|
3904
|
+
backgroundImage?: string;
|
|
3905
|
+
/** Parsed element shapes on the layout. */
|
|
3906
|
+
elements?: PptxElement[];
|
|
3907
|
+
/** Placeholder shapes on the layout. */
|
|
3908
|
+
placeholders?: Array<{
|
|
3909
|
+
type: string;
|
|
3910
|
+
idx?: string;
|
|
3911
|
+
}>;
|
|
3912
|
+
/** Matching name attribute for layout identification (`@matchingName`). */
|
|
3913
|
+
matchingName?: string;
|
|
3914
|
+
/** Whether the layout is marked as preserved (prevent deletion, `@preserve`). */
|
|
3915
|
+
preserve?: boolean;
|
|
3916
|
+
/** Whether master placeholder animations should play (`@showMasterPhAnim`). */
|
|
3917
|
+
showMasterPhAnim?: boolean;
|
|
3918
|
+
/** Whether this layout is user-drawn (`@userDrawn`). */
|
|
3919
|
+
userDrawn?: boolean;
|
|
3920
|
+
/** Colour map override from `p:clrMapOvr`. */
|
|
3921
|
+
clrMapOverride?: Record<string, string>;
|
|
3922
|
+
}
|
|
3923
|
+
/**
|
|
3924
|
+
* A theme part available in the presentation package.
|
|
3925
|
+
*
|
|
3926
|
+
* @example
|
|
3927
|
+
* ```ts
|
|
3928
|
+
* const opt: PptxThemeOption = {
|
|
3929
|
+
* path: "ppt/theme/theme1.xml",
|
|
3930
|
+
* name: "Office Theme",
|
|
3931
|
+
* };
|
|
3932
|
+
* // => satisfies PptxThemeOption
|
|
3933
|
+
* ```
|
|
3934
|
+
*/
|
|
3935
|
+
interface PptxThemeOption {
|
|
3936
|
+
/** File path within the PPTX archive (e.g. `ppt/theme/theme2.xml`). */
|
|
3937
|
+
path: string;
|
|
3938
|
+
/** Human-readable theme name from `a:theme/@name`, when present. */
|
|
3939
|
+
name?: string;
|
|
3940
|
+
}
|
|
3941
|
+
|
|
3942
|
+
/**
|
|
3943
|
+
* View properties types parsed from `ppt/viewProps.xml`.
|
|
3944
|
+
*
|
|
3945
|
+
* Models the `p:viewPr` element and its child views:
|
|
3946
|
+
* normalViewPr, slideViewPr, outlineViewPr, notesTextViewPr,
|
|
3947
|
+
* sorterViewPr, notesViewPr.
|
|
3948
|
+
*
|
|
3949
|
+
* @module pptx-types/view-properties
|
|
3950
|
+
*/
|
|
3951
|
+
/**
|
|
3952
|
+
* Scale factor for a view (numerator / denominator percentage).
|
|
3953
|
+
*/
|
|
3954
|
+
interface PptxViewScale {
|
|
3955
|
+
/** Numerator of the scale percentage (e.g. 100 for 100%). */
|
|
3956
|
+
n: number;
|
|
3957
|
+
/** Denominator of the scale percentage (e.g. 100 for 100%). */
|
|
3958
|
+
d: number;
|
|
3959
|
+
}
|
|
3960
|
+
/**
|
|
3961
|
+
* Origin point for a view (x, y in twips or EMU).
|
|
3962
|
+
*/
|
|
3963
|
+
interface PptxViewOrigin {
|
|
3964
|
+
x: number;
|
|
3965
|
+
y: number;
|
|
3966
|
+
}
|
|
3967
|
+
/**
|
|
3968
|
+
* Restored region dimensions for normal view splitter.
|
|
3969
|
+
* Represents `p:restoredLeft` or `p:restoredTop`.
|
|
3970
|
+
*/
|
|
3971
|
+
interface PptxRestoredRegion {
|
|
3972
|
+
/** Size as a percentage of the available space (thousandths of a percent). */
|
|
3973
|
+
sz: number;
|
|
3974
|
+
/** Whether auto-adjust is enabled. */
|
|
3975
|
+
autoAdjust?: boolean;
|
|
3976
|
+
}
|
|
3977
|
+
/**
|
|
3978
|
+
* Normal view properties (`p:normalViewPr`).
|
|
3979
|
+
* Controls the splitter positions in normal (editing) view.
|
|
3980
|
+
*/
|
|
3981
|
+
interface PptxNormalViewProperties {
|
|
3982
|
+
/** Whether to show outline icons in the slide panel. */
|
|
3983
|
+
showOutlineIcons?: boolean;
|
|
3984
|
+
/** Whether the outline/slide panel is snapped closed. */
|
|
3985
|
+
snapVertSplitter?: boolean;
|
|
3986
|
+
/** Vertical splitter bar state: 'minimized' | 'maximized' | 'restored'. */
|
|
3987
|
+
vertBarState?: string;
|
|
3988
|
+
/** Horizontal splitter bar state. */
|
|
3989
|
+
horzBarState?: string;
|
|
3990
|
+
/** Whether to prefer single-slide view in the panel. */
|
|
3991
|
+
preferSingleView?: boolean;
|
|
3992
|
+
/** Restored left region (slide panel width). */
|
|
3993
|
+
restoredLeft?: PptxRestoredRegion;
|
|
3994
|
+
/** Restored top region (notes panel height). */
|
|
3995
|
+
restoredTop?: PptxRestoredRegion;
|
|
3996
|
+
}
|
|
3997
|
+
/**
|
|
3998
|
+
* Common slide view properties shared by slideViewPr, outlineViewPr,
|
|
3999
|
+
* notesTextViewPr, and notesViewPr.
|
|
4000
|
+
*/
|
|
4001
|
+
interface PptxCommonSlideViewProperties {
|
|
4002
|
+
/** Whether snap-to-grid is enabled. */
|
|
4003
|
+
snapToGrid?: boolean;
|
|
4004
|
+
/** Whether snap-to-objects is enabled. */
|
|
4005
|
+
snapToObjects?: boolean;
|
|
4006
|
+
/** Whether drawing guides are shown. */
|
|
4007
|
+
showGuides?: boolean;
|
|
4008
|
+
/** View origin (scroll position). */
|
|
4009
|
+
origin?: PptxViewOrigin;
|
|
4010
|
+
/** View scale. */
|
|
4011
|
+
scale?: PptxViewScale;
|
|
4012
|
+
}
|
|
4013
|
+
/**
|
|
4014
|
+
* Full view properties from `ppt/viewProps.xml`.
|
|
4015
|
+
*/
|
|
4016
|
+
interface PptxViewProperties {
|
|
4017
|
+
/** Last used view type (`p:viewPr/@lastView`). */
|
|
4018
|
+
lastView?: string;
|
|
4019
|
+
/** Whether comments are shown (`p:viewPr/@showComments`). */
|
|
4020
|
+
showComments?: boolean;
|
|
4021
|
+
/** Normal view properties (splitter positions). */
|
|
4022
|
+
normalViewPr?: PptxNormalViewProperties;
|
|
4023
|
+
/** Slide view properties. */
|
|
4024
|
+
slideViewPr?: PptxCommonSlideViewProperties;
|
|
4025
|
+
/** Outline view properties. */
|
|
4026
|
+
outlineViewPr?: PptxCommonSlideViewProperties;
|
|
4027
|
+
/** Notes text view properties. */
|
|
4028
|
+
notesTextViewPr?: PptxCommonSlideViewProperties;
|
|
4029
|
+
/** Sorter view scale. */
|
|
4030
|
+
sorterViewPr?: {
|
|
4031
|
+
scale?: PptxViewScale;
|
|
4032
|
+
};
|
|
4033
|
+
/** Notes view properties. */
|
|
4034
|
+
notesViewPr?: PptxCommonSlideViewProperties;
|
|
4035
|
+
/** Raw XML preserved for lossless round-trip of unparsed attributes. */
|
|
4036
|
+
rawXml?: Record<string, unknown>;
|
|
4037
|
+
}
|
|
4038
|
+
|
|
4039
|
+
/**
|
|
4040
|
+
* Top-level presentation types: slides, canvas dimensions, export options,
|
|
4041
|
+
* and the root {@link PptxData} structure returned by `PptxHandlerCore.load()`.
|
|
4042
|
+
*
|
|
4043
|
+
* @module pptx-types/presentation
|
|
4044
|
+
*/
|
|
4045
|
+
|
|
4046
|
+
/**
|
|
4047
|
+
* A customer data reference from `p:custDataLst / p:custData`.
|
|
4048
|
+
*
|
|
4049
|
+
* Enterprise add-ins and integrations store custom data parts in the
|
|
4050
|
+
* package and reference them via relationship IDs in the slide or
|
|
4051
|
+
* presentation XML.
|
|
4052
|
+
*
|
|
4053
|
+
* @see ECMA-376 Part 1, §19.2.1.3 (custDataLst), §19.3.1.6 (custData)
|
|
4054
|
+
*/
|
|
4055
|
+
interface PptxCustomerData {
|
|
4056
|
+
/** Resolved part path inside the package (e.g. `ppt/customerData/item1.xml`). */
|
|
4057
|
+
id: string;
|
|
4058
|
+
/** Relationship ID referencing the custom data part. */
|
|
4059
|
+
relId: string;
|
|
4060
|
+
/** Raw string content of the custom data part (if resolvable). */
|
|
4061
|
+
data?: string;
|
|
4062
|
+
}
|
|
4063
|
+
/**
|
|
4064
|
+
* An ActiveX control reference from `p:controls / p:control`.
|
|
4065
|
+
*
|
|
4066
|
+
* ActiveX form controls (buttons, text boxes, check boxes, combo boxes, etc.)
|
|
4067
|
+
* are embedded via OLE parts and referenced by relationship ID in the slide XML.
|
|
4068
|
+
*
|
|
4069
|
+
* @see ECMA-376 Part 1, §19.3.1.3 (controls), §19.3.1.2 (control)
|
|
4070
|
+
*/
|
|
4071
|
+
interface PptxActiveXControl {
|
|
4072
|
+
/** Relationship ID referencing the ActiveX binary part. */
|
|
4073
|
+
relId: string;
|
|
4074
|
+
/** Control name from @name attribute. */
|
|
4075
|
+
name?: string;
|
|
4076
|
+
/** Shape ID this control is linked to (from @spid). */
|
|
4077
|
+
shapeId?: string;
|
|
4078
|
+
/** Raw XML for round-trip preservation. */
|
|
4079
|
+
rawXml?: XmlObject;
|
|
4080
|
+
}
|
|
4081
|
+
/**
|
|
4082
|
+
* A single slide in a parsed PPTX presentation.
|
|
4083
|
+
*
|
|
4084
|
+
* Contains the element tree, background settings, notes, comments,
|
|
4085
|
+
* transition / animation data, and metadata like layout path and section.
|
|
4086
|
+
*
|
|
4087
|
+
* @example
|
|
4088
|
+
* ```ts
|
|
4089
|
+
* const slide: PptxSlide = {
|
|
4090
|
+
* id: "slide1",
|
|
4091
|
+
* rId: "rId2",
|
|
4092
|
+
* slideNumber: 1,
|
|
4093
|
+
* elements: [titleTextBox, subtitleTextBox],
|
|
4094
|
+
* backgroundColor: "#FFFFFF",
|
|
4095
|
+
* notes: "Remember to mention quarterly goals.",
|
|
4096
|
+
* };
|
|
4097
|
+
* // => satisfies PptxSlide
|
|
4098
|
+
* ```
|
|
4099
|
+
*/
|
|
4100
|
+
interface PptxSlide {
|
|
4101
|
+
id: string;
|
|
4102
|
+
rId: string;
|
|
4103
|
+
sourceSlideId?: string;
|
|
4104
|
+
layoutPath?: string;
|
|
4105
|
+
layoutName?: string;
|
|
4106
|
+
slideNumber: number;
|
|
4107
|
+
hidden?: boolean;
|
|
4108
|
+
sectionName?: string;
|
|
4109
|
+
sectionId?: string;
|
|
4110
|
+
elements: PptxElement[];
|
|
4111
|
+
backgroundColor?: string;
|
|
4112
|
+
backgroundImage?: string;
|
|
4113
|
+
backgroundGradient?: string;
|
|
4114
|
+
transition?: PptxSlideTransition;
|
|
4115
|
+
animations?: PptxElementAnimation[];
|
|
4116
|
+
/** Native OOXML animation data parsed from `p:timing`. */
|
|
4117
|
+
nativeAnimations?: PptxNativeAnimation[];
|
|
4118
|
+
/** Preserved raw `p:timing` XML for lossless round-trip of native animations. */
|
|
4119
|
+
rawTiming?: XmlObject;
|
|
4120
|
+
notes?: string;
|
|
4121
|
+
/** Rich text segments for the slide notes (preserves formatting). */
|
|
4122
|
+
notesSegments?: TextSegment[];
|
|
4123
|
+
comments?: PptxComment[];
|
|
4124
|
+
warnings?: PptxCompatibilityWarning[];
|
|
4125
|
+
rawXml?: XmlObject;
|
|
4126
|
+
/** Per-slide colour map override parsed from `p:clrMapOvr`. */
|
|
4127
|
+
clrMapOverride?: Record<string, string>;
|
|
4128
|
+
/** Whether background animations should play (`p:bg/@showAnimation`). */
|
|
4129
|
+
backgroundShowAnimation?: boolean;
|
|
4130
|
+
/** Whether master slide shapes should be shown on this slide (`p:sld/@showMasterSp`). */
|
|
4131
|
+
showMasterShapes?: boolean;
|
|
4132
|
+
/** Drawing guides parsed from slide extension list. */
|
|
4133
|
+
guides?: PptxDrawingGuide[];
|
|
4134
|
+
/** When explicitly `false`, the slide is unmodified and save can skip re-serialization. */
|
|
4135
|
+
isDirty?: boolean;
|
|
4136
|
+
/** Customer data references from `p:custDataLst` on this slide. */
|
|
4137
|
+
customerData?: PptxCustomerData[];
|
|
4138
|
+
/** ActiveX control references from `p:controls` on this slide. */
|
|
4139
|
+
activeXControls?: PptxActiveXControl[];
|
|
4140
|
+
}
|
|
4141
|
+
/**
|
|
4142
|
+
* A slide layout available in the loaded presentation.
|
|
4143
|
+
*
|
|
4144
|
+
* Each entry maps to a `<p:sldLayout>` inside `ppt/slideLayouts/`.
|
|
4145
|
+
*
|
|
4146
|
+
* @example
|
|
4147
|
+
* ```ts
|
|
4148
|
+
* const layout: PptxLayoutOption = {
|
|
4149
|
+
* path: "ppt/slideLayouts/slideLayout2.xml",
|
|
4150
|
+
* name: "Title and Content",
|
|
4151
|
+
* };
|
|
4152
|
+
* // => satisfies PptxLayoutOption
|
|
4153
|
+
* ```
|
|
4154
|
+
*/
|
|
4155
|
+
interface PptxLayoutOption {
|
|
4156
|
+
path: string;
|
|
4157
|
+
name: string;
|
|
4158
|
+
/** Standard layout type from `p:sldLayout/@type` (e.g. "obj", "twoColTx", "blank"). */
|
|
4159
|
+
type?: string;
|
|
4160
|
+
}
|
|
4161
|
+
/**
|
|
4162
|
+
* Header, footer, date-time, and slide-number placeholders.
|
|
4163
|
+
*
|
|
4164
|
+
* Parsed from `ppt/presProps.xml` and individual slide layouts.
|
|
4165
|
+
*
|
|
4166
|
+
* @example
|
|
4167
|
+
* ```ts
|
|
4168
|
+
* const hf: PptxHeaderFooter = {
|
|
4169
|
+
* hasFooter: true,
|
|
4170
|
+
* footerText: "Confidential",
|
|
4171
|
+
* hasSlideNumber: true,
|
|
4172
|
+
* };
|
|
4173
|
+
* // => satisfies PptxHeaderFooter
|
|
4174
|
+
* ```
|
|
4175
|
+
*/
|
|
4176
|
+
interface PptxHeaderFooter {
|
|
4177
|
+
hasHeader?: boolean;
|
|
4178
|
+
headerText?: string;
|
|
4179
|
+
hasFooter?: boolean;
|
|
4180
|
+
footerText?: string;
|
|
4181
|
+
hasDateTime?: boolean;
|
|
4182
|
+
dateTimeText?: string;
|
|
4183
|
+
dateTimeAuto?: boolean;
|
|
4184
|
+
/** OOXML date format pattern (e.g. "M/d/yyyy", "dddd, MMMM dd, yyyy"). */
|
|
4185
|
+
dateFormat?: string;
|
|
4186
|
+
hasSlideNumber?: boolean;
|
|
4187
|
+
}
|
|
4188
|
+
/**
|
|
4189
|
+
* Presentation-level properties parsed from `presentationPr.xml`.
|
|
4190
|
+
*
|
|
4191
|
+
* Controls slideshow behaviour, print settings, custom colours, and grid.
|
|
4192
|
+
*
|
|
4193
|
+
* @example
|
|
4194
|
+
* ```ts
|
|
4195
|
+
* const props: PptxPresentationProperties = {
|
|
4196
|
+
* showType: "presented",
|
|
4197
|
+
* loopContinuously: false,
|
|
4198
|
+
* advanceMode: "useTimings",
|
|
4199
|
+
* };
|
|
4200
|
+
* // => satisfies PptxPresentationProperties
|
|
4201
|
+
* ```
|
|
4202
|
+
*/
|
|
4203
|
+
interface PptxPresentationProperties {
|
|
4204
|
+
/** Show type: presented, browsed, kiosk. */
|
|
4205
|
+
showType?: 'presented' | 'browsed' | 'kiosk';
|
|
4206
|
+
/** Whether to loop the slideshow continuously. */
|
|
4207
|
+
loopContinuously?: boolean;
|
|
4208
|
+
/** Whether to show without narration. */
|
|
4209
|
+
showWithNarration?: boolean;
|
|
4210
|
+
/** Whether to show without animation. */
|
|
4211
|
+
showWithAnimation?: boolean;
|
|
4212
|
+
/** Advance slides mode: manual click or use stored timings. */
|
|
4213
|
+
advanceMode?: 'manual' | 'useTimings';
|
|
4214
|
+
/** Show slides: 'all', a custom show id, or a from-to range. */
|
|
4215
|
+
showSlidesMode?: 'all' | 'customShow' | 'range';
|
|
4216
|
+
/** Custom show id to use when showSlidesMode is 'customShow'. */
|
|
4217
|
+
showSlidesCustomShowId?: string;
|
|
4218
|
+
/** Slide range start (1-based) when showSlidesMode is 'range'. */
|
|
4219
|
+
showSlidesFrom?: number;
|
|
4220
|
+
/** Slide range end (1-based) when showSlidesMode is 'range'. */
|
|
4221
|
+
showSlidesTo?: number;
|
|
4222
|
+
/** Whether to show subtitles/captions during presentation mode. */
|
|
4223
|
+
showSubtitles?: boolean;
|
|
4224
|
+
/** Print settings: slides per page. */
|
|
4225
|
+
printSlidesPerPage?: number;
|
|
4226
|
+
/** Print settings: frame slides. */
|
|
4227
|
+
printFrameSlides?: boolean;
|
|
4228
|
+
/** Print settings: colour mode (from `p:prnPr/@clrMode`). */
|
|
4229
|
+
printColorMode?: 'clr' | 'gray' | 'bw';
|
|
4230
|
+
/** Most-recently-used colours from the presentation palette. */
|
|
4231
|
+
mruColors?: string[];
|
|
4232
|
+
/** Grid spacing in EMUs (cx, cy). Default is 914400 / 8 = 114300. */
|
|
4233
|
+
gridSpacing?: {
|
|
4234
|
+
cx: number;
|
|
4235
|
+
cy: number;
|
|
4236
|
+
};
|
|
4237
|
+
/** Pen colour for presentation mode annotations (from `p:showPr/p:penClr`). */
|
|
4238
|
+
penColor?: string;
|
|
4239
|
+
/** Kiosk auto-restart interval in milliseconds (from `p:kiosk/@restart`). Only meaningful when showType is "kiosk". */
|
|
4240
|
+
kioskRestartTime?: number;
|
|
4241
|
+
}
|
|
4242
|
+
/**
|
|
4243
|
+
* A named custom slide show (`p:custShowLst / p:custShow`).
|
|
4244
|
+
*
|
|
4245
|
+
* Custom shows define ordered subsets of slides that can be presented
|
|
4246
|
+
* independently of the full deck.
|
|
4247
|
+
*
|
|
4248
|
+
* @example
|
|
4249
|
+
* ```ts
|
|
4250
|
+
* const show: PptxCustomShow = {
|
|
4251
|
+
* name: "Executive Summary",
|
|
4252
|
+
* id: "0",
|
|
4253
|
+
* slideRIds: ["rId2", "rId5", "rId8"],
|
|
4254
|
+
* };
|
|
4255
|
+
* // => satisfies PptxCustomShow
|
|
4256
|
+
* ```
|
|
4257
|
+
*/
|
|
4258
|
+
interface PptxCustomShow {
|
|
4259
|
+
/** Custom show name. */
|
|
4260
|
+
name: string;
|
|
4261
|
+
/** Custom show id. */
|
|
4262
|
+
id: string;
|
|
4263
|
+
/** Ordered list of slide relationship IDs included in this custom show. */
|
|
4264
|
+
slideRIds: string[];
|
|
4265
|
+
}
|
|
4266
|
+
/**
|
|
4267
|
+
* An ordered section in the presentation (from `p:sectionLst` / `p14:sectionLst`).
|
|
4268
|
+
*
|
|
4269
|
+
* Sections group consecutive slides under a named heading (visible
|
|
4270
|
+
* in the PowerPoint slide sorter).
|
|
4271
|
+
*
|
|
4272
|
+
* @example
|
|
4273
|
+
* ```ts
|
|
4274
|
+
* const section: PptxSection = {
|
|
4275
|
+
* id: "sec_1",
|
|
4276
|
+
* name: "Introduction",
|
|
4277
|
+
* slideIds: ["256", "257"],
|
|
4278
|
+
* };
|
|
4279
|
+
* // => satisfies PptxSection
|
|
4280
|
+
* ```
|
|
4281
|
+
*/
|
|
4282
|
+
interface PptxSection {
|
|
4283
|
+
/** Section unique identifier (GUID or synthetic). */
|
|
4284
|
+
id: string;
|
|
4285
|
+
/** Human-readable section name. */
|
|
4286
|
+
name: string;
|
|
4287
|
+
/** Ordered list of numeric slide IDs that belong to this section. */
|
|
4288
|
+
slideIds: string[];
|
|
4289
|
+
/** Whether the section is collapsed in the slide sorter (from p15:sectionPr). */
|
|
4290
|
+
collapsed?: boolean;
|
|
4291
|
+
/** Section highlight color hex (from p15:sectionPr/@clr). */
|
|
4292
|
+
color?: string;
|
|
4293
|
+
}
|
|
4294
|
+
/**
|
|
4295
|
+
* Write-protection hash data parsed from `p:modifyVerifier` in `presentation.xml`.
|
|
4296
|
+
*
|
|
4297
|
+
* When present, the presentation is marked as "read-only recommended" or
|
|
4298
|
+
* write-protected with a password hash. The hash parameters follow the
|
|
4299
|
+
* ECMA-376 Part 1, section 19.2.1.22 specification.
|
|
4300
|
+
*
|
|
4301
|
+
* @example
|
|
4302
|
+
* ```ts
|
|
4303
|
+
* const verifier: PptxModifyVerifier = {
|
|
4304
|
+
* algorithmName: "SHA-512",
|
|
4305
|
+
* hashData: "base64EncodedHash==",
|
|
4306
|
+
* saltData: "base64EncodedSalt==",
|
|
4307
|
+
* spinValue: 100000,
|
|
4308
|
+
* };
|
|
4309
|
+
* // => satisfies PptxModifyVerifier
|
|
4310
|
+
* ```
|
|
4311
|
+
*/
|
|
4312
|
+
interface PptxModifyVerifier {
|
|
4313
|
+
/** Hash algorithm name (e.g. "SHA-512", "SHA-1"). */
|
|
4314
|
+
algorithmName?: string;
|
|
4315
|
+
/** Base64-encoded hash value. */
|
|
4316
|
+
hashData?: string;
|
|
4317
|
+
/** Base64-encoded salt value. */
|
|
4318
|
+
saltData?: string;
|
|
4319
|
+
/** Number of hash iterations (spin count). */
|
|
4320
|
+
spinValue?: number;
|
|
4321
|
+
/** Legacy algorithm ID extension. */
|
|
4322
|
+
algIdExt?: string;
|
|
4323
|
+
/** Legacy algorithm ID. */
|
|
4324
|
+
cryptAlgorithmSid?: number;
|
|
4325
|
+
/** Cryptographic algorithm type (e.g. "typeAny"). */
|
|
4326
|
+
cryptAlgorithmType?: string;
|
|
4327
|
+
/** Cryptographic provider name. */
|
|
4328
|
+
cryptProvider?: string;
|
|
4329
|
+
/** Cryptographic provider type (e.g. "providerTypeRsaFull"). */
|
|
4330
|
+
cryptProviderType?: string;
|
|
4331
|
+
/** Cryptographic algorithm class (e.g. "hash"). */
|
|
4332
|
+
cryptAlgorithmClass?: string;
|
|
4333
|
+
}
|
|
4334
|
+
/**
|
|
4335
|
+
* Photo album metadata from `p:photoAlbum` in `presentation.xml`.
|
|
4336
|
+
*
|
|
4337
|
+
* Stores settings for presentations created via Insert > Photo Album.
|
|
4338
|
+
*
|
|
4339
|
+
* @see ECMA-376 Part 1, §19.2.1.27
|
|
4340
|
+
*/
|
|
4341
|
+
interface PptxPhotoAlbum {
|
|
4342
|
+
/** Whether photos are displayed in black-and-white. */
|
|
4343
|
+
bw?: boolean;
|
|
4344
|
+
/** Whether captions are shown below each photo. */
|
|
4345
|
+
showCaptions?: boolean;
|
|
4346
|
+
/** Photo album layout (e.g. "1pic", "2pic", "4pic", "fitToSlide"). */
|
|
4347
|
+
layout?: string;
|
|
4348
|
+
/** Frame style applied to each photo (e.g. "frameStyle1"). */
|
|
4349
|
+
frame?: string;
|
|
4350
|
+
}
|
|
4351
|
+
/**
|
|
4352
|
+
* East Asian line-break (kinsoku) settings from `p:kinsoku` in `presentation.xml`.
|
|
4353
|
+
*
|
|
4354
|
+
* Defines forbidden start/end characters for a given language so that
|
|
4355
|
+
* line-breaking follows East Asian typographic rules.
|
|
4356
|
+
*
|
|
4357
|
+
* @see ECMA-376 Part 1, §19.2.1.17
|
|
4358
|
+
*/
|
|
4359
|
+
interface PptxKinsoku {
|
|
4360
|
+
/** Language code (e.g. "ja-JP", "zh-CN"). */
|
|
4361
|
+
lang?: string;
|
|
4362
|
+
/** Characters that cannot begin a line. */
|
|
4363
|
+
invalStChars?: string;
|
|
4364
|
+
/** Characters that cannot end a line. */
|
|
4365
|
+
invalEndChars?: string;
|
|
4366
|
+
}
|
|
4367
|
+
/**
|
|
4368
|
+
* Root data structure returned by {@link PptxHandlerCore.load}.
|
|
4369
|
+
*
|
|
4370
|
+
* Contains every slide, canvas dimensions, theme data, layout options,
|
|
4371
|
+
* metadata, and optional features (custom shows, sections, macros,
|
|
4372
|
+
* digital signatures, embedded fonts).
|
|
4373
|
+
*
|
|
4374
|
+
* @example
|
|
4375
|
+
* ```ts
|
|
4376
|
+
* const data: PptxData = await handler.load(buffer);
|
|
4377
|
+
* console.log(`${data.slides.length} slides, ${data.width}×${data.height}`);
|
|
4378
|
+
* // => e.g. "24 slides, 960×540"
|
|
4379
|
+
* ```
|
|
4380
|
+
*/
|
|
4381
|
+
interface PptxData {
|
|
4382
|
+
slides: PptxSlide[];
|
|
4383
|
+
width: number;
|
|
4384
|
+
height: number;
|
|
4385
|
+
/** Slide width in EMU (for save round-trip). */
|
|
4386
|
+
widthEmu?: number;
|
|
4387
|
+
/** Slide height in EMU (for save round-trip). */
|
|
4388
|
+
heightEmu?: number;
|
|
4389
|
+
/** Slide size type from `p:sldSz/@type` (e.g. "screen4x3", "screen16x9", "custom"). */
|
|
4390
|
+
slideSizeType?: string;
|
|
4391
|
+
/** Notes page width in EMU (from `p:notesSz`). */
|
|
4392
|
+
notesWidthEmu?: number;
|
|
4393
|
+
/** Notes page height in EMU (from `p:notesSz`). */
|
|
4394
|
+
notesHeightEmu?: number;
|
|
4395
|
+
layoutOptions?: PptxLayoutOption[];
|
|
4396
|
+
headerFooter?: PptxHeaderFooter;
|
|
4397
|
+
/** Presentation-level properties parsed from `presentationPr.xml`. */
|
|
4398
|
+
presentationProperties?: PptxPresentationProperties;
|
|
4399
|
+
/** Named custom slide shows from `p:custShowLst`. */
|
|
4400
|
+
customShows?: PptxCustomShow[];
|
|
4401
|
+
/** Ordered presentation sections from `p:sectionLst` / `p14:sectionLst`. */
|
|
4402
|
+
sections?: PptxSection[];
|
|
4403
|
+
warnings?: PptxCompatibilityWarning[];
|
|
4404
|
+
/** Map of theme colour scheme keys to resolved hex values. */
|
|
4405
|
+
themeColorMap?: Record<string, string>;
|
|
4406
|
+
/** Full parsed theme object with colours, fonts, and name. */
|
|
4407
|
+
theme?: PptxTheme;
|
|
4408
|
+
/** Available theme parts discovered in `ppt/theme/`. */
|
|
4409
|
+
themeOptions?: PptxThemeOption[];
|
|
4410
|
+
/** Parsed table style definitions from `ppt/tableStyles.xml`. */
|
|
4411
|
+
tableStyleMap?: ParsedTableStyleMap;
|
|
4412
|
+
/** Whether the presentation is password-protected. */
|
|
4413
|
+
isPasswordProtected?: boolean;
|
|
4414
|
+
/** Embedded font data (name + binary data URL) extracted from the presentation. */
|
|
4415
|
+
embeddedFonts?: PptxEmbeddedFont[];
|
|
4416
|
+
/** Most-recently-used colour list from presentation properties. */
|
|
4417
|
+
mruColors?: string[];
|
|
4418
|
+
/** Parsed notes master data if present in the PPTX. */
|
|
4419
|
+
notesMaster?: PptxNotesMaster;
|
|
4420
|
+
/** Parsed handout master data if present in the PPTX. */
|
|
4421
|
+
handoutMaster?: PptxHandoutMaster;
|
|
4422
|
+
/** Structured slide master data for each master in the presentation. */
|
|
4423
|
+
slideMasters?: PptxSlideMaster[];
|
|
4424
|
+
/** Parsed tag collections attached to the presentation or slides. */
|
|
4425
|
+
tags?: PptxTagCollection[];
|
|
4426
|
+
/** Custom document properties from `docProps/custom.xml`. */
|
|
4427
|
+
customProperties?: PptxCustomProperty[];
|
|
4428
|
+
/** Core document properties from `docProps/core.xml`. */
|
|
4429
|
+
coreProperties?: PptxCoreProperties;
|
|
4430
|
+
/** Extended (application) properties from `docProps/app.xml`. */
|
|
4431
|
+
appProperties?: PptxAppProperties;
|
|
4432
|
+
/** Whether the presentation contains VBA macros (is a .pptm file). */
|
|
4433
|
+
hasMacros?: boolean;
|
|
4434
|
+
/** Whether the presentation contains digital signatures (`_xmlsignatures/` parts). */
|
|
4435
|
+
hasDigitalSignatures?: boolean;
|
|
4436
|
+
/** Number of digital signatures found. */
|
|
4437
|
+
digitalSignatureCount?: number;
|
|
4438
|
+
/** Presentation-level drawing guides from `p:extLst`. */
|
|
4439
|
+
presentationGuides?: PptxDrawingGuide[];
|
|
4440
|
+
/** View properties from `ppt/viewProps.xml`. */
|
|
4441
|
+
viewProperties?: PptxViewProperties;
|
|
4442
|
+
/** Write-protection verifier from `p:modifyVerifier` in `presentation.xml`. */
|
|
4443
|
+
modifyVerifier?: PptxModifyVerifier;
|
|
4444
|
+
/** Photo album metadata from `p:photoAlbum` in `presentation.xml`. */
|
|
4445
|
+
photoAlbum?: PptxPhotoAlbum;
|
|
4446
|
+
/** East Asian line-break settings from `p:kinsoku` in `presentation.xml`. */
|
|
4447
|
+
kinsoku?: PptxKinsoku;
|
|
4448
|
+
/** Custom XML data parts from `customXml/` in the OPC package. */
|
|
4449
|
+
customXmlParts?: PptxCustomXmlPart[];
|
|
4450
|
+
/** Customer data references from `p:custDataLst` in `presentation.xml`. */
|
|
4451
|
+
customerData?: PptxCustomerData[];
|
|
4452
|
+
/** Thumbnail image binary data from `docProps/thumbnail.{jpeg,png}`. */
|
|
4453
|
+
thumbnailData?: Uint8Array;
|
|
4454
|
+
/** Comment authors parsed from `ppt/commentAuthors.xml` for round-trip preservation. */
|
|
4455
|
+
commentAuthors?: PptxCommentAuthor[];
|
|
4456
|
+
/**
|
|
4457
|
+
* OOXML conformance class of the loaded file.
|
|
4458
|
+
* - `'strict'` -- ISO/IEC 29500 Strict (uses `purl.oclc.org` namespace URIs)
|
|
4459
|
+
* - `'transitional'` -- ECMA-376 Transitional (uses `schemas.openxmlformats.org` URIs)
|
|
4460
|
+
*
|
|
4461
|
+
* When saving, if the save option `conformance` is `'preserve'` (default),
|
|
4462
|
+
* the file will be saved using the same conformance class as the original.
|
|
4463
|
+
*/
|
|
4464
|
+
conformance?: 'strict' | 'transitional';
|
|
4465
|
+
}
|
|
4466
|
+
/**
|
|
4467
|
+
* Target format for slide export.
|
|
4468
|
+
*
|
|
4469
|
+
* @see {@link PptxExportOptions}
|
|
4470
|
+
*/
|
|
4471
|
+
type PptxExportFormat = 'pdf' | 'png' | 'svg';
|
|
4472
|
+
/**
|
|
4473
|
+
* Options controlling slide export to raster or vector formats.
|
|
4474
|
+
*
|
|
4475
|
+
* @example
|
|
4476
|
+
* ```ts
|
|
4477
|
+
* const opts: PptxExportOptions = {
|
|
4478
|
+
* format: "png",
|
|
4479
|
+
* slideIndices: [0, 2, 4],
|
|
4480
|
+
* dpi: 300,
|
|
4481
|
+
* };
|
|
4482
|
+
* // => satisfies PptxExportOptions
|
|
4483
|
+
* ```
|
|
4484
|
+
*/
|
|
4485
|
+
interface PptxExportOptions {
|
|
4486
|
+
/** Target format. */
|
|
4487
|
+
format: PptxExportFormat;
|
|
4488
|
+
/** Slide indices to export (0-based). If omitted, all slides are exported. */
|
|
4489
|
+
slideIndices?: number[];
|
|
4490
|
+
/** Output width in pixels (for PNG). Height is derived from aspect ratio. */
|
|
4491
|
+
width?: number;
|
|
4492
|
+
/** DPI for raster export (default 150). */
|
|
4493
|
+
dpi?: number;
|
|
4494
|
+
/** Whether to include hidden slides. */
|
|
4495
|
+
includeHidden?: boolean;
|
|
4496
|
+
}
|
|
4497
|
+
/**
|
|
4498
|
+
* Embedded font data extracted from a PPTX file.
|
|
4499
|
+
*
|
|
4500
|
+
* Used to register `@font-face` rules so the renderer can display
|
|
4501
|
+
* the correct typeface even when the system font is missing.
|
|
4502
|
+
*
|
|
4503
|
+
* @example
|
|
4504
|
+
* ```ts
|
|
4505
|
+
* const font: PptxEmbeddedFont = {
|
|
4506
|
+
* name: "CustomSans",
|
|
4507
|
+
* dataUrl: "data:font/truetype;base64,AAEAK...",
|
|
4508
|
+
* format: "truetype",
|
|
4509
|
+
* };
|
|
4510
|
+
* // => satisfies PptxEmbeddedFont
|
|
4511
|
+
* ```
|
|
4512
|
+
*/
|
|
4513
|
+
/**
|
|
4514
|
+
* A single Custom XML Data Part stored in `customXml/` within the OPC package.
|
|
4515
|
+
*
|
|
4516
|
+
* These parts are used by add-ins, data-binding, and enterprise templates
|
|
4517
|
+
* to store structured data alongside the presentation.
|
|
4518
|
+
*
|
|
4519
|
+
* @see ECMA-376 Part 1, §15.2.5
|
|
4520
|
+
*/
|
|
4521
|
+
interface PptxCustomXmlPart {
|
|
4522
|
+
/** Item number (e.g. "1" for `customXml/item1.xml`). */
|
|
4523
|
+
id: string;
|
|
4524
|
+
/** Raw XML string content of the custom XML item. */
|
|
4525
|
+
data: string;
|
|
4526
|
+
/** Schema target namespace URI from `itemProps` (ds:schemaRef/@ds:uri). */
|
|
4527
|
+
schemaUri?: string;
|
|
4528
|
+
/** Raw XML string content of the associated `itemProps` file. */
|
|
4529
|
+
properties?: string;
|
|
4530
|
+
/** Raw XML string content of the OPC relationship file (`customXml/_rels/item{id}.xml.rels`). */
|
|
4531
|
+
rels?: string;
|
|
4532
|
+
}
|
|
4533
|
+
interface PptxEmbeddedFont {
|
|
4534
|
+
name: string;
|
|
4535
|
+
dataUrl: string;
|
|
4536
|
+
bold?: boolean;
|
|
4537
|
+
italic?: boolean;
|
|
4538
|
+
/** CSS font format hint (e.g. "truetype", "opentype"). */
|
|
4539
|
+
format?: 'truetype' | 'opentype' | 'woff' | 'woff2';
|
|
4540
|
+
/**
|
|
4541
|
+
* Deobfuscated (clear-text) font binary data preserved from load
|
|
4542
|
+
* for round-trip re-embedding on save. When present, the save
|
|
4543
|
+
* pipeline will re-obfuscate and write this data back into the ZIP.
|
|
4544
|
+
*/
|
|
4545
|
+
rawFontData?: Uint8Array;
|
|
4546
|
+
/**
|
|
4547
|
+
* Original ZIP path of the font part (e.g. `ppt/fonts/{GUID}.fntdata`).
|
|
4548
|
+
* Preserved from load for round-trip.
|
|
4549
|
+
*/
|
|
4550
|
+
partPath?: string;
|
|
4551
|
+
/**
|
|
4552
|
+
* The GUID used for obfuscation, either from the `fontKey` attribute
|
|
4553
|
+
* or extracted from the part path. Preserved from load for round-trip.
|
|
4554
|
+
*/
|
|
4555
|
+
fontGuid?: string;
|
|
4556
|
+
}
|
|
4557
|
+
|
|
4558
|
+
export { type OleObjectType as $, type PptxTagCollection as A, type PptxPhotoAlbum as B, type ConnectorPptxElement as C, type PptxKinsoku as D, type PptxModifyVerifier as E, type PptxViewProperties as F, type PptxEmbeddedFont as G, type PptxExportOptions as H, type InkPptxElement as I, type PptxThemeFormatScheme as J, type TextSegment as K, type PptxComment as L, type PptxSlideTransition as M, type PptxElementAnimation as N, type PptxNativeAnimation as O, type PptxElement as P, type PptxCustomerData as Q, type PptxActiveXControl as R, type ShapePptxElement as S, type TextPptxElement as T, type AnimationCondition as U, type ShapeStyle as V, type TextStyle as W, type XmlObject as X, type ElementAction as Y, type ZoomPptxElement as Z, type PptxAction as _, type PptxElementWithShapeStyle as a, type ParsedTableStyleEntry as a$, type PptxSmartArtNode as a0, type SmartArtLayoutType as a1, type PptxSmartArtDrawingShape as a2, type PptxChartDataTable as a3, type PptxChartLineStyle as a4, type PptxChartErrBars as a5, type PptxChartTrendline as a6, type PptxChartMarker as a7, type PptxChartDataLabel as a8, type PptxChartDataPoint as a9, type PptxShapeLocks as aA, type PptxThemeFillStyle as aB, type PptxThemeLineStyle as aC, type PptxThemeEffectStyle as aD, type PptxSmartArtChrome as aE, type PptxSmartArtColorTransform as aF, type PptxSmartArtQuickStyle as aG, type PptxExternalData as aH, type CustomGeometryPoint as aI, type CustomGeometryPath as aJ, type ChartPptxElement as aK, type ImagePptxElement as aL, type TablePptxElement as aM, type ActionButtonPreset as aN, type AnimationConditionEvent as aO, type BevelPresetType as aP, type ConnectorConnectionPoint as aQ, type ContentPartInkStroke as aR, type ContentPartPptxElement as aS, type CustomGeometrySegment as aT, type ElementActionType as aU, type MasterViewTab as aV, type MaterialPresetType as aW, type MediaCaptionTrack as aX, type MediaMetadata as aY, type Model3DPptxElement as aZ, type OlePptxElement as a_, type PptxChartShapeProps as aa, type PptxChart3DSurface as ab, type PptxChartAxisFormatting as ac, type PptxEmbeddedWorkbookData as ad, type PptxDrawingGuide as ae, type PptxCustomXmlPart as af, type PptxCommentAuthor as ag, type MediaPptxElement as ah, type PptxTableData as ai, type PptxTheme as aj, type ParsedTableStyleMap as ak, type PptxSlideMaster as al, type PptxThemeOption as am, type PlaceholderDefaults as an, type ParsedTableStyleFill as ao, type ParsedTableStyleText as ap, type PptxImageEffects as aq, type MediaBookmark as ar, type PptxChartStyle as as, type GroupPptxElement as at, type PlaceholderTextLevelStyle as au, type PptxTableCellStyle as av, type PptxChartSeries as aw, type SmartArtPptxElement as ax, type GeometryAdjustmentHandle as ay, type BulletInfo as az, type PptxElementWithText as b, type PicturePptxElement as b0, type Pptx3DScene as b1, type Pptx3DShape as b2, type PptxAfterAnimationAction as b3, type PptxAnimationDirection as b4, type PptxAnimationIterate as b5, type PptxAnimationRepeatMode as b6, type PptxAnimationSequence as b7, type PptxAnimationTimingCurve as b8, type PptxChartAxisNumFmt as b9, type PptxTextAnimationTarget as bA, type PptxTextBuildType as bB, type PptxTextProperties as bC, type PptxTextStyleLevels as bD, type PptxTextWarpPreset as bE, type PptxThemeFontGroup as bF, type PptxTransitionDirection4 as bG, type PptxTransitionDirection8 as bH, type PptxViewOrigin as bI, type PptxViewScale as bJ, type ShadowEffect as bK, type SmartArtColorScheme as bL, type SmartArtLayout as bM, type SmartArtStyle as bN, THEME_COLOR_SCHEME_KEYS as bO, TRANSITION_VALID_DIRECTIONS as bP, type Text3DStyle as bQ, type UnderlineStyle as bR, type UnknownPptxElement as bS, type PptxChartErrBarDir as ba, type PptxChartErrBarType as bb, type PptxChartErrValType as bc, type PptxChartMarkerSymbol as bd, type PptxChartTrendlineType as be, type PptxColorAnimation as bf, type PptxCommonSlideViewProperties as bg, type PptxCropShape as bh, type PptxCustomPathProperties as bi, type PptxElementBase as bj, type PptxElementType as bk, type PptxExportFormat as bl, type PptxImageProperties as bm, type PptxMasterTextStyles as bn, type PptxMediaType as bo, type PptxNormalViewProperties as bp, type PptxRestoredRegion as bq, type PptxShapeProperties as br, type PptxSlideLayout as bs, type PptxSmartArtConnection as bt, type PptxSplitDirection as bu, type PptxSplitOrientation as bv, type PptxStripDirection as bw, type PptxTableCell as bx, type PptxTableRow as by, type PptxTag as bz, type PptxImageLikeElement as c, type PptxThemeColorScheme as d, type PptxThemeFontScheme as e, type PptxAnimationPreset as f, type PptxAnimationTrigger as g, type StrokeDashType as h, type ConnectorArrowType as i, type PptxTransitionType as j, type PptxChartType as k, type PptxSlide as l, type PptxData as m, type PptxCompatibilityWarning as n, type PptxLayoutOption as o, type PptxChartData as p, type PptxSmartArtData as q, type PptxHeaderFooter as r, type PptxPresentationProperties as s, type PptxCustomShow as t, type PptxSection as u, type PptxCoreProperties as v, type PptxAppProperties as w, type PptxCustomProperty as x, type PptxNotesMaster as y, type PptxHandoutMaster as z };
|