@shbernal/ts-pptx 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +238 -0
  3. package/dist/autopage-tmfjRzL4.js +420 -0
  4. package/dist/autopage-tmfjRzL4.js.map +1 -0
  5. package/dist/browser.d.ts +23 -0
  6. package/dist/browser.d.ts.map +1 -0
  7. package/dist/browser.js +103 -0
  8. package/dist/browser.js.map +1 -0
  9. package/dist/diagnostics-DYQC7xLV.js +0 -0
  10. package/dist/diagnostics-DYQC7xLV.js.map +1 -0
  11. package/dist/diagnostics-DzY9Tyfm.d.ts +693 -0
  12. package/dist/diagnostics-DzY9Tyfm.d.ts.map +1 -0
  13. package/dist/embedded-fonts-MaynAHa9.js +94 -0
  14. package/dist/embedded-fonts-MaynAHa9.js.map +1 -0
  15. package/dist/enums-D3aF4QGb.d.ts +452 -0
  16. package/dist/enums-D3aF4QGb.d.ts.map +1 -0
  17. package/dist/errors-DGE9zh3U.js +93 -0
  18. package/dist/errors-DGE9zh3U.js.map +1 -0
  19. package/dist/errors-DRLpOpgQ.d.ts +160 -0
  20. package/dist/errors-DRLpOpgQ.d.ts.map +1 -0
  21. package/dist/fit-CbxyHN69.js +0 -0
  22. package/dist/fit-CbxyHN69.js.map +1 -0
  23. package/dist/html-dom-wVa3TiG7.js +666 -0
  24. package/dist/html-dom-wVa3TiG7.js.map +1 -0
  25. package/dist/html.d.ts +26 -0
  26. package/dist/html.d.ts.map +1 -0
  27. package/dist/html.js +60 -0
  28. package/dist/html.js.map +1 -0
  29. package/dist/image-size-C5Z1sKof.js +252 -0
  30. package/dist/image-size-C5Z1sKof.js.map +1 -0
  31. package/dist/index.d.ts +24 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +75 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/inspect.d.ts +173 -0
  36. package/dist/inspect.d.ts.map +1 -0
  37. package/dist/inspect.js +285 -0
  38. package/dist/inspect.js.map +1 -0
  39. package/dist/math.d.ts +37 -0
  40. package/dist/math.d.ts.map +1 -0
  41. package/dist/math.js +106 -0
  42. package/dist/math.js.map +1 -0
  43. package/dist/measure.d.ts +223 -0
  44. package/dist/measure.d.ts.map +1 -0
  45. package/dist/measure.js +3 -0
  46. package/dist/node.d.ts +12 -0
  47. package/dist/node.d.ts.map +1 -0
  48. package/dist/node.js +60 -0
  49. package/dist/node.js.map +1 -0
  50. package/dist/package-CaOLXSNi.d.ts +193 -0
  51. package/dist/package-CaOLXSNi.d.ts.map +1 -0
  52. package/dist/pres-5x1bjCzk.d.ts +202 -0
  53. package/dist/pres-5x1bjCzk.d.ts.map +1 -0
  54. package/dist/presentation-B0JWdTN1.js +4286 -0
  55. package/dist/presentation-B0JWdTN1.js.map +1 -0
  56. package/dist/presentation-RGOiun5P.d.ts +3249 -0
  57. package/dist/presentation-RGOiun5P.d.ts.map +1 -0
  58. package/dist/presentation-types-BVw0EknS.d.ts +538 -0
  59. package/dist/presentation-types-BVw0EknS.d.ts.map +1 -0
  60. package/dist/read.d.ts +73 -0
  61. package/dist/read.d.ts.map +1 -0
  62. package/dist/read.js +4 -0
  63. package/dist/script.d.ts +553 -0
  64. package/dist/script.d.ts.map +1 -0
  65. package/dist/script.js +0 -0
  66. package/dist/script.js.map +1 -0
  67. package/dist/shapes-BZU8UTW2.js +5365 -0
  68. package/dist/shapes-BZU8UTW2.js.map +1 -0
  69. package/dist/slide-B6mDaM-P.d.ts +3396 -0
  70. package/dist/slide-B6mDaM-P.d.ts.map +1 -0
  71. package/dist/text-WRUbOy2r.js +11238 -0
  72. package/dist/text-WRUbOy2r.js.map +1 -0
  73. package/dist/units-B-JUKwCS.js +144 -0
  74. package/dist/units-B-JUKwCS.js.map +1 -0
  75. package/dist/units-internal-7JcMfYti.js +723 -0
  76. package/dist/units-internal-7JcMfYti.js.map +1 -0
  77. package/dist/zip.d.ts +68 -0
  78. package/dist/zip.d.ts.map +1 -0
  79. package/dist/zip.js +163 -0
  80. package/dist/zip.js.map +1 -0
  81. package/package.json +214 -0
@@ -0,0 +1,3249 @@
1
+ import { t as CustomPropertyValue } from "./pres-5x1bjCzk.js";
2
+ import { c as ImportSlideMastersOptions, d as LayoutHandle, f as SlideSize, l as ImportSlideOptions, o as FromTemplateOptions, p as SlideSource, r as EmbeddedFontInfo, s as ImportShapeOptions, t as AppendSlidesOptions, u as ImportedSlideMaster } from "./presentation-types-BVw0EknS.js";
3
+ import { a as Part, i as Relationships, n as OpcPackage, o as Element, t as OpcInput } from "./package-CaOLXSNi.js";
4
+ //#region src/read/oxml/theme.d.ts
5
+ /**
6
+ * The colour-resolution context: the two maps that turn a DrawingML colour
7
+ * reference into a literal hex — the effective colour map (token → `clrScheme`
8
+ * slot, honouring any slide `clrMapOvr`) and the resolved colour scheme (slot →
9
+ * 6-hex RGB). Shared by the read-model colour getters and {@link FlattenContext}.
10
+ */
11
+ interface ColorContext {
12
+ clrMap: Map<string, string>;
13
+ clrScheme: Map<string, string>;
14
+ }
15
+ /**
16
+ * Everything {@link flattenSlide} needs from the slide's source theme subgraph:
17
+ * the {@link ColorContext} maps plus the live `a:fmtScheme` element (for
18
+ * style-matrix resolution).
19
+ */
20
+ interface FlattenContext extends ColorContext {
21
+ fmtScheme: Element | null;
22
+ /**
23
+ * The slide's effective background inherited from the *source*
24
+ * `slideLayout`/`slideMaster` (the raw `p:bg` element), or `null` when the
25
+ * slide carries its own. Applied onto the slide before flattening so the
26
+ * background survives rebinding to the destination master. See
27
+ * {@link flattenSlide}.
28
+ */
29
+ inheritedBackground?: Element | null;
30
+ /**
31
+ * The source `slideLayout` root element, for resolving placeholder-inherited
32
+ * run colours (gap 1). Read-only — never mutated. `null`/absent disables the
33
+ * placeholder run-colour pass for the layout tier.
34
+ */
35
+ layoutRoot?: Element | null;
36
+ /**
37
+ * The source `slideMaster` root element, for resolving placeholder-inherited
38
+ * run colours via its placeholder `a:lstStyle` and `p:txStyles`. Read-only —
39
+ * never mutated.
40
+ */
41
+ masterRoot?: Element | null;
42
+ /**
43
+ * The theme's `a:fontScheme`, for resolving a `+mj-*`/`+mn-*` major/minor font
44
+ * token (the placeholder-inherited typeface chain bottoms out in one) to a
45
+ * literal face name via {@link resolveThemeFont}. `null`/absent leaves such a
46
+ * token unresolved.
47
+ */
48
+ fontScheme?: Element | null;
49
+ /**
50
+ * The notesMaster's `p:notesStyle` (a `CT_TextListStyle`), for resolving the
51
+ * character properties a *notes-body* run inherits when it sets none of its own.
52
+ * Only ever set on a notes context (see `resolveNotesColorContext`); on a slide
53
+ * context it is absent, so the slide placeholder chain (layout/master
54
+ * `a:lstStyle` → `p:txStyles`) is unaffected. It is the notes analogue of the
55
+ * master `p:txStyles` category style, keyed by level rather than placeholder
56
+ * type. Read-only — never mutated.
57
+ */
58
+ notesStyle?: Element | null;
59
+ /**
60
+ * The presentation's `p:defaultTextStyle` (a `CT_TextListStyle` from
61
+ * `presentation.xml`), keyed by level — PowerPoint's lowest-priority text
62
+ * fallback, applying to any run (placeholder or not) that resolves nothing
63
+ * above it. Only ever set on a *slide* context (see `resolveSlideColorContext`);
64
+ * absent on notes/master/layout contexts, so their chains are unaffected.
65
+ * Read-only — never mutated.
66
+ */
67
+ defaultTextStyle?: Element | null;
68
+ }
69
+ //#endregion
70
+ //#region src/read/api/theme-context.d.ts
71
+ /** Identifies a placeholder by its `p:ph` `type`/`idx` for inheritance lookups. */
72
+ interface PlaceholderRef {
73
+ type: string | null;
74
+ idx: string;
75
+ }
76
+ /** Which tier of the slide → layout → master chain a {@link ResolvedFrame} resolved from. */
77
+ type GeometrySource = 'own' | 'layout' | 'master';
78
+ /** A shape's effective position and size in EMU, tagged with where it resolved from. */
79
+ interface ResolvedFrame {
80
+ left: number;
81
+ top: number;
82
+ width: number;
83
+ height: number;
84
+ source: GeometrySource;
85
+ }
86
+ /**
87
+ * A DrawingML colour reference resolved against a slide's theme to a literal hex.
88
+ *
89
+ * `hex` is the **base** token colour and `transforms` reports the colour-transform
90
+ * children (`lumMod`/`lumOff`/`shade`/`tint`/`alpha`/…) in document order as
91
+ * `{ name, value }` pairs — both kept for traceability and for the
92
+ * `theme: 'preserve'` flatten path that re-emits the transforms verbatim.
93
+ *
94
+ * `effectiveHex` is the colour a renderer actually paints: `hex` with its
95
+ * `transforms` applied (see {@link applyColorTransforms}). Read this for the final
96
+ * rendered colour. `alpha` (0–1) is present only when an `alpha*` transform set an
97
+ * opacity.
98
+ */
99
+ interface ResolvedColor {
100
+ hex: string;
101
+ transforms: {
102
+ name: string;
103
+ value: string | null;
104
+ }[];
105
+ effectiveHex: string;
106
+ alpha?: number;
107
+ }
108
+ /**
109
+ * Resolve a DrawingML colour *element* (`a:srgbClr`/`a:schemeClr`/`a:sysClr`)
110
+ * against `ctx` into a full {@link ResolvedColor} — base hex, raw transform list,
111
+ * and the `effectiveHex`/`alpha` after applying those transforms. `null` when the
112
+ * element cannot be made literal (unmapped token, or a colour model we do not
113
+ * resolve). Shared by the solid-fill and gradient-stop colour reads.
114
+ */
115
+ declare function resolveColorElement(colorEl: Element | null, ctx: ColorContext): ResolvedColor | null;
116
+ /** A shape's resolved `p:style/a:fontRef` text tier: its colour and theme face. */
117
+ interface StyleFontRef {
118
+ /** The `a:fontRef` child colour (`a:schemeClr`/`a:srgbClr`/…) resolved through the theme, or `null` when it names none / cannot be made literal. */
119
+ color: ResolvedColor | null;
120
+ /** The face named by `a:fontRef/@idx` (`major`→`+mj-lt`, `minor`→`+mn-lt`) resolved through the theme `fontScheme`, or `null` for `idx="none"` / an unresolvable token. */
121
+ face: string | null;
122
+ }
123
+ //#endregion
124
+ //#region src/read/api/gradient.d.ts
125
+ /** One stop of a gradient fill (`a:gsLst/a:gs`), as read from a shape. */
126
+ interface GradientStop {
127
+ /** Stop offset along the gradient, 0–1 (from `@pos`, thousandths of a percent), or `null` if unset. */
128
+ position: number | null;
129
+ /** Explicit RGB colour as 6-hex (`a:srgbClr/@val`), or `null` when the stop uses a scheme colour. */
130
+ color: string | null;
131
+ /** Theme colour token (`a:schemeClr/@val`, e.g. `accent1`), or `null` when the stop uses an explicit colour. */
132
+ schemeColor: string | null;
133
+ /**
134
+ * The stop's colour resolved against the slide theme **with its colour
135
+ * transforms applied** — the final rendered hex (the gradient counterpart of
136
+ * {@link import('./theme-context.js').ResolvedColor.effectiveHex}). `null` when
137
+ * the colour cannot be made literal (an unmapped token, or a colour model we do
138
+ * not resolve).
139
+ */
140
+ effectiveHex: string | null;
141
+ /** The stop's opacity (0–1) when an `alpha*` transform set one, else `undefined`. */
142
+ alpha?: number;
143
+ }
144
+ /**
145
+ * A gradient fill (`a:gradFill`), as read from a container — the stops plus the
146
+ * geometry that a bare stop list omits. `linear` gradients carry an
147
+ * {@link GradientFill.angleDeg} (the `a:lin/@ang` direction); `radial`/`path`
148
+ * gradients carry a {@link GradientFill.path} shape (`a:path/@path`, e.g.
149
+ * `circle`). The angle is in **OOXML degrees** (clockwise from 3 o'clock), the
150
+ * same convention the write-side `GradientFillProps.angle` expects, so it
151
+ * round-trips directly.
152
+ */
153
+ interface GradientFill {
154
+ /** `linear` (`a:lin`) or `path` (`a:path`, i.e. radial/rectangular). `null` when neither child is present. */
155
+ kind: 'linear' | 'path' | null;
156
+ /** Linear direction in OOXML degrees (clockwise from 3 o'clock), or `null` for a path gradient / when unset. */
157
+ angleDeg: number | null;
158
+ /** Path-gradient shape (`a:path/@path`: `circle`/`rect`/`shape`), or `null` for a linear gradient. */
159
+ path: string | null;
160
+ /** The gradient stops in document order. */
161
+ stops: GradientStop[];
162
+ }
163
+ //#endregion
164
+ //#region src/read/api/picture-fill.d.ts
165
+ /** A rectangle expressed as per-edge fractions (`a:srcRect`/`a:fillRect`), `0.1` = 10 %. */
166
+ interface FillRect {
167
+ left: number;
168
+ top: number;
169
+ right: number;
170
+ bottom: number;
171
+ }
172
+ /**
173
+ * The tiling geometry of a tiled picture fill (`a:blipFill/a:tile`). Offsets stay
174
+ * in EMU (the attribute's own unit); scales are fractions (`1` = 100 %), matching
175
+ * the read API's convention elsewhere.
176
+ */
177
+ interface PictureFillTile {
178
+ /** Horizontal tile offset in EMU (`@tx`), `0` when unset. */
179
+ offsetXEmu: number;
180
+ /** Vertical tile offset in EMU (`@ty`), `0` when unset. */
181
+ offsetYEmu: number;
182
+ /** Horizontal tile scale as a fraction (`@sx`, thousandths of a percent), `1` when unset. */
183
+ scaleX: number;
184
+ /** Vertical tile scale as a fraction (`@sy`), `1` when unset. */
185
+ scaleY: number;
186
+ /** Tile mirroring (`@flip`: `none`/`x`/`y`/`xy`), or `null` when unset. */
187
+ flip: string | null;
188
+ /** Tile alignment within the surface (`@algn`, e.g. `tl`), or `null` when unset. */
189
+ align: string | null;
190
+ }
191
+ /**
192
+ * A picture (image) fill (`a:blipFill`) read from a fill-bearing container. The
193
+ * image itself is {@link relId} / {@link partName}; the rest is the geometry a
194
+ * faithful replica needs — {@link mode} (`stretch` or `tile`), the source crop
195
+ * {@link srcRect}, the destination inset {@link fillRect}, and {@link tile}.
196
+ *
197
+ * Rect fields follow the read API's fraction convention (see
198
+ * {@link import('./shapes.js').Picture.crop}): the raw attributes are
199
+ * thousandths of a percent and are divided by 100000, so `0.1` is 10 % and a
200
+ * negative value (a `fillRect` that bleeds past the edge) stays negative.
201
+ */
202
+ interface PictureFill {
203
+ /** Relationship id of the embedded image (`a:blip/@r:embed`), or `null` when the blip embeds none. */
204
+ relId: string | null;
205
+ /** Absolute partname of the embedded image, or `null` when it has no rel id / no resolvable target. */
206
+ partName: string | null;
207
+ /** `stretch` (`a:stretch`) or `tile` (`a:tile`); `null` when the fill states neither. */
208
+ mode: 'stretch' | 'tile' | null;
209
+ /** Source crop as per-edge fractions (`a:srcRect`), or `null` when absent. An explicit `<a:srcRect/>` reports zeros. */
210
+ srcRect: FillRect | null;
211
+ /** Stretch destination rect as per-edge fractions (`a:stretch/a:fillRect`), or `null` when absent. */
212
+ fillRect: FillRect | null;
213
+ /** Tiling geometry (`a:tile`), or `null` when the fill is not tiled. */
214
+ tile: PictureFillTile | null;
215
+ /** Blip opacity 0–1 (`a:blip/a:alphaModFix/@amt`), or `null` when the blip sets none. */
216
+ alpha: number | null;
217
+ /** DPI override the image is rendered at (`@dpi`), or `null` when unset. `0` means "use the image's own". */
218
+ dpi: number | null;
219
+ /** Whether the fill rotates with its shape (`@rotWithShape`), or `null` when unset. */
220
+ rotWithShape: boolean | null;
221
+ }
222
+ //#endregion
223
+ //#region src/read/api/slide-background.d.ts
224
+ /** Where a slide's effective background comes from in the slide → layout → master chain. */
225
+ type BackgroundSource = 'slide' | 'layout' | 'master';
226
+ /**
227
+ * An explicit background fill, decoded from a `p:bgPr` (or from a `p:bgRef`'s
228
+ * resolved `fmtScheme` entry). The source-less core of {@link SlideBackground}: the
229
+ * top-level variants add {@link BackgroundSource}, and it is what a `themeRef`'s
230
+ * {@link SlideBackground.resolvedFill} carries.
231
+ *
232
+ * The `image` variant keeps `relId`/`partName` at the top level — the fields
233
+ * callers already read — and adds the full {@link PictureFill} (stretch/tile
234
+ * geometry, crop, alpha) under `picture`.
235
+ */
236
+ type BackgroundFill = {
237
+ type: 'solid';
238
+ color: ResolvedColor | null;
239
+ } | {
240
+ type: 'gradient';
241
+ gradient: GradientFill;
242
+ } | {
243
+ type: 'image';
244
+ picture: PictureFill;
245
+ relId: string | null;
246
+ partName: string | null;
247
+ } | {
248
+ type: 'pattern';
249
+ preset: string | null;
250
+ foreground: ResolvedColor | null;
251
+ background: ResolvedColor | null;
252
+ } | {
253
+ type: 'none';
254
+ };
255
+ /**
256
+ * A slide's effective background (`p:cSld/p:bg`), as a discriminated union on
257
+ * `type`. Every variant carries {@link BackgroundSource}. `solid`/`gradient`/`image`
258
+ * are what the writer authors and round-trip faithfully; `pattern`/`themeRef` are
259
+ * read-only (imported decks) and `none` is an explicit `a:noFill`. A `themeRef`
260
+ * keeps its raw `idx` for fidelity and also exposes `resolvedFill` — the concrete
261
+ * fill that `idx` resolves to through the slide theme's `fmtScheme` (`null` when the
262
+ * theme/entry cannot be resolved).
263
+ */
264
+ type SlideBackground = {
265
+ type: 'solid';
266
+ source: BackgroundSource;
267
+ color: ResolvedColor | null;
268
+ } | {
269
+ type: 'gradient';
270
+ source: BackgroundSource;
271
+ gradient: GradientFill;
272
+ } | {
273
+ type: 'image';
274
+ source: BackgroundSource;
275
+ picture: PictureFill;
276
+ relId: string | null;
277
+ partName: string | null;
278
+ } | {
279
+ type: 'pattern';
280
+ source: BackgroundSource;
281
+ preset: string | null;
282
+ foreground: ResolvedColor | null;
283
+ background: ResolvedColor | null;
284
+ } | {
285
+ type: 'themeRef';
286
+ source: BackgroundSource;
287
+ idx: number | null;
288
+ color: ResolvedColor | null;
289
+ resolvedFill: BackgroundFill | null;
290
+ } | {
291
+ type: 'none';
292
+ source: BackgroundSource;
293
+ };
294
+ //#endregion
295
+ //#region src/read/api/shapes/oxml.d.ts
296
+ /**
297
+ * A shape's properties element (`p:spPr` / `p:grpSpPr`) paired with the schema
298
+ * successors for ordered insertion of its `a:solidFill` and `a:ln` children.
299
+ * `lnAfter` is `null` for kinds with no `a:ln` (group shapes).
300
+ */
301
+ interface ShapeProperties {
302
+ props: Element;
303
+ fillAfter: string[];
304
+ lnAfter: string[] | null;
305
+ }
306
+ //#endregion
307
+ //#region src/read/api/text.d.ts
308
+ /**
309
+ * What a {@link Run}'s text body needs to resolve an *inherited* run
310
+ * colour/size/face/bold: which placeholder the text lives in (or `null` for a
311
+ * non-placeholder shape, which still resolves its `p:style/a:fontRef` and the
312
+ * presentation `p:defaultTextStyle`), the slide theme context (with the
313
+ * layout/master roots) to resolve against, and the shape's resolved
314
+ * `p:style/a:fontRef` text tier. The owning slide's text body `a:lstStyle` is added
315
+ * per text frame. Absent only for text reached without a theme context (table cells).
316
+ */
317
+ interface PlaceholderTextContext {
318
+ ph: PlaceholderRef | null;
319
+ flatten: FlattenContext;
320
+ /** The shape's resolved `p:style/a:fontRef` colour + face tier, or `null` when it has none. */
321
+ fontRef?: StyleFontRef | null;
322
+ }
323
+ /**
324
+ * A run's click hyperlink (`a:rPr/a:hlinkClick`): a link on a span of text. A URL
325
+ * link carries an external {@link url}; a slide jump carries the internal
326
+ * {@link targetPartName} (the linked slide's part) alongside its `hlinksldjump`
327
+ * {@link action}. `tooltip` and `relId` are surfaced when present.
328
+ */
329
+ interface RunHyperlink {
330
+ /** External URL target (its `@r:id` resolves to a `TargetMode="External"` rel), or `null` for an internal/action-only link. */
331
+ url: string | null;
332
+ /** Absolute partname of an internal target (e.g. the slide a jump points at), or `null`. */
333
+ targetPartName: string | null;
334
+ /** Navigation action token (`@action`, e.g. `ppaction://hlinksldjump`), or `null` when absent/empty. */
335
+ action: string | null;
336
+ /** Tooltip text (`@tooltip`), or `null` when absent/empty. */
337
+ tooltip: string | null;
338
+ /** The relationship id (`@r:id`) backing the link, or `null` when the link is action-only. */
339
+ relId: string | null;
340
+ }
341
+ /**
342
+ * A paragraph's line spacing (`a:pPr/a:lnSpc`), in whichever of the two OOXML
343
+ * forms the file uses: an exact point height (`a:spcPts`) or a percentage of the
344
+ * single-line height (`a:spcPct` — e.g. `percent: 150` for 1.5× spacing).
345
+ */
346
+ type LineSpacing = {
347
+ type: 'points';
348
+ valuePt: number;
349
+ } | {
350
+ type: 'percent';
351
+ percent: number;
352
+ };
353
+ /** One text run (`a:r`): a span of text with uniform character formatting. */
354
+ declare class Run {
355
+ #private;
356
+ private readonly element;
357
+ private readonly part;
358
+ /** The owning slide's theme context (colour maps + `fontScheme`), for the `resolved*` getters; absent when the run was reached without one. */
359
+ private readonly themeContext?;
360
+ /**
361
+ * Resolves the colour this run inherits from its placeholder/list-style chain
362
+ * when it sets none of its own (item A). Built by the owning {@link Paragraph}
363
+ * for placeholder text; absent for non-placeholder runs. Called lazily.
364
+ */
365
+ private readonly inheritedColor?;
366
+ /**
367
+ * Resolves the point size this run inherits from the same chain when it sets no
368
+ * own `@sz`. Built by the owning {@link Paragraph} for placeholder text; absent
369
+ * for non-placeholder runs. Called lazily.
370
+ */
371
+ private readonly inheritedSize?;
372
+ /**
373
+ * Resolves the typeface this run inherits from the same chain (a `+mj-*`/`+mn-*`
374
+ * theme token already resolved to a literal face) when it sets no own `a:latin`.
375
+ * Built by the owning {@link Paragraph} for placeholder text; absent otherwise.
376
+ * Called lazily.
377
+ */
378
+ private readonly inheritedFace?;
379
+ /**
380
+ * Resolves whether this run inherits bold from the same chain when it sets no
381
+ * own `@b`. Built by the owning {@link Paragraph} for placeholder text; absent
382
+ * for non-placeholder runs. Called lazily.
383
+ */
384
+ private readonly inheritedBold?;
385
+ /**
386
+ * The owning part's relationships, used to resolve a run hyperlink's `@r:id`
387
+ * to its external URL or internal target partname. Absent when the run was
388
+ * reached without them (e.g. table-cell or notes text), in which case
389
+ * {@link hyperlink} still reports the raw `@r:id`/`@action`/`@tooltip`.
390
+ */
391
+ private readonly relationships?;
392
+ /**
393
+ * The owning shape's resolved `p:style/a:fontRef` colour + face tier — the
394
+ * fallback consulted for {@link resolvedColor}/{@link resolvedFontFace} just
395
+ * below the run's own `a:rPr` and above the placeholder/`p:defaultTextStyle`
396
+ * chain. Absent when the shape has no `p:style/a:fontRef`.
397
+ */
398
+ private readonly fontRef?;
399
+ constructor(element: Element, part: Part,
400
+ /** The owning slide's theme context (colour maps + `fontScheme`), for the `resolved*` getters; absent when the run was reached without one. */
401
+ themeContext?: FlattenContext | undefined,
402
+ /**
403
+ * Resolves the colour this run inherits from its placeholder/list-style chain
404
+ * when it sets none of its own (item A). Built by the owning {@link Paragraph}
405
+ * for placeholder text; absent for non-placeholder runs. Called lazily.
406
+ */
407
+ inheritedColor?: (() => ResolvedColor | null) | undefined,
408
+ /**
409
+ * Resolves the point size this run inherits from the same chain when it sets no
410
+ * own `@sz`. Built by the owning {@link Paragraph} for placeholder text; absent
411
+ * for non-placeholder runs. Called lazily.
412
+ */
413
+ inheritedSize?: (() => number | null) | undefined,
414
+ /**
415
+ * Resolves the typeface this run inherits from the same chain (a `+mj-*`/`+mn-*`
416
+ * theme token already resolved to a literal face) when it sets no own `a:latin`.
417
+ * Built by the owning {@link Paragraph} for placeholder text; absent otherwise.
418
+ * Called lazily.
419
+ */
420
+ inheritedFace?: (() => string | null) | undefined,
421
+ /**
422
+ * Resolves whether this run inherits bold from the same chain when it sets no
423
+ * own `@b`. Built by the owning {@link Paragraph} for placeholder text; absent
424
+ * for non-placeholder runs. Called lazily.
425
+ */
426
+ inheritedBold?: (() => boolean | null) | undefined,
427
+ /**
428
+ * The owning part's relationships, used to resolve a run hyperlink's `@r:id`
429
+ * to its external URL or internal target partname. Absent when the run was
430
+ * reached without them (e.g. table-cell or notes text), in which case
431
+ * {@link hyperlink} still reports the raw `@r:id`/`@action`/`@tooltip`.
432
+ */
433
+ relationships?: Relationships | undefined,
434
+ /**
435
+ * The owning shape's resolved `p:style/a:fontRef` colour + face tier — the
436
+ * fallback consulted for {@link resolvedColor}/{@link resolvedFontFace} just
437
+ * below the run's own `a:rPr` and above the placeholder/`p:defaultTextStyle`
438
+ * chain. Absent when the shape has no `p:style/a:fontRef`.
439
+ */
440
+ fontRef?: (StyleFontRef | null) | undefined);
441
+ /** The run's text (`a:t`), verbatim — whitespace is not normalized. */
442
+ get text(): string;
443
+ set text(value: string);
444
+ /** Font size in points (`a:rPr/@sz` is hundredths of a point), or `null` if unset. */
445
+ get fontSizePt(): number | null;
446
+ set fontSizePt(value: number | null);
447
+ /** Bold (`a:rPr/@b`), or `null` when unset (inherited from style). */
448
+ get bold(): boolean | null;
449
+ set bold(value: boolean | null);
450
+ /** Italic (`a:rPr/@i`), or `null` when unset (inherited from style). */
451
+ get italic(): boolean | null;
452
+ set italic(value: boolean | null);
453
+ /** Underline style token (`a:rPr/@u`, e.g. `sng`), or `null` when unset. */
454
+ get underline(): string | null;
455
+ set underline(value: string | null);
456
+ /**
457
+ * Strikethrough token (`a:rPr/@strike`: `noStrike` | `sngStrike` |
458
+ * `dblStrike`), or `null` when unset (inherited from the style). Surfaced as
459
+ * the raw token — `sngStrike` is the writer's single-strike value.
460
+ */
461
+ get strike(): string | null;
462
+ /**
463
+ * Capitalization token (`a:rPr/@cap`: `none` | `small` | `all`), or `null`
464
+ * when unset. `small` renders small-caps, `all` renders all-caps.
465
+ */
466
+ get caps(): string | null;
467
+ /**
468
+ * Baseline shift as a percentage of the font size (`a:rPr/@baseline`, stored
469
+ * in 1000ths of a percent): positive for superscript (the writer's default is
470
+ * `30`), negative for subscript (`-40`), or `null` when unset. Reported as the
471
+ * percentage (`@baseline` ÷ 1000).
472
+ */
473
+ get baselinePct(): number | null;
474
+ /**
475
+ * Character spacing (tracking) in points (`a:rPr/@spc`, authored in hundredths
476
+ * of a point), or `null` when unset. Negative tightens. The read counterpart of
477
+ * the write-side `charSpacing` option.
478
+ */
479
+ get charSpacingPt(): number | null;
480
+ /**
481
+ * The run's highlight colour (`a:rPr/a:highlight`), resolved to a literal hex
482
+ * through the owning slide's theme, or `null` when the run has no highlight
483
+ * (or a token colour cannot be made literal without a theme context). The
484
+ * writer authors highlights from a hex colour, so `effectiveHex` is that
485
+ * colour; imported decks may carry a theme token, resolved here when possible.
486
+ */
487
+ get highlight(): ResolvedColor | null;
488
+ /**
489
+ * The run's click hyperlink (`a:rPr/a:hlinkClick`), or `null` when the run
490
+ * carries none. A URL link resolves its `@r:id` to the external target
491
+ * ({@link RunHyperlink.url}); a slide jump resolves it to the linked slide's
492
+ * partname ({@link RunHyperlink.targetPartName}). When the run was reached
493
+ * without the owning part's relationships, only the raw `@r:id`/`@action`/
494
+ * `@tooltip` are reported (the target stays `null`).
495
+ */
496
+ get hyperlink(): RunHyperlink | null;
497
+ /** Latin typeface name (`a:rPr/a:latin/@typeface`), or `null` when unset. */
498
+ get fontName(): string | null;
499
+ set fontName(value: string | null);
500
+ /** Explicit RGB fill colour as a 6-hex string (`a:solidFill/a:srgbClr/@val`), or `null`. */
501
+ get color(): string | null;
502
+ set color(value: string | null);
503
+ /** Theme colour token when the fill is a scheme colour (`a:schemeClr/@val`, e.g. `accent2`), or `null`. */
504
+ get schemeColor(): string | null;
505
+ set schemeColor(value: string | null);
506
+ /**
507
+ * The colour this run effectively renders, resolved against the owning slide's
508
+ * theme to a literal hex. It is the run's own solid fill
509
+ * ({@link color}/{@link schemeColor}) when set; otherwise the shape's
510
+ * `p:style/a:fontRef` colour, then — for a run inside a placeholder — the colour
511
+ * it inherits from the placeholder/list-style chain (layout → master placeholder
512
+ * `a:lstStyle` → master `p:txStyles`), then the presentation's
513
+ * `p:defaultTextStyle`. `null` when the run sets no colour and inherits none, the
514
+ * colour cannot be made literal, or the run was reached without a theme context.
515
+ * The returned {@link ResolvedColor} carries `effectiveHex` — the base colour with
516
+ * its child transforms (`lumMod`/`shade`/…) applied — for the final rendered colour.
517
+ */
518
+ get resolvedColor(): ResolvedColor | null;
519
+ /**
520
+ * The point size this run effectively renders. It is the run's own `@sz`
521
+ * ({@link fontSizePt}) when set; otherwise, for a run inside a placeholder, the
522
+ * size it inherits from the placeholder/list-style chain (paragraph `a:defRPr` →
523
+ * slide `a:lstStyle` → layout → master placeholder `a:lstStyle` → master
524
+ * `p:txStyles`). `null` when the run sets no size and inherits none — the
525
+ * resolved counterpart of {@link fontSizePt}, which reports only the run's own value.
526
+ */
527
+ get resolvedSizePt(): number | null;
528
+ /**
529
+ * The typeface this run effectively renders, resolved to a literal face name. It
530
+ * is the run's own `a:latin` ({@link fontName}) when set; otherwise the face named
531
+ * by the shape's `p:style/a:fontRef` (`idx` → theme major/minor font), then — for a
532
+ * run inside a placeholder — the face it inherits from the placeholder/list-style
533
+ * chain, then the presentation's `p:defaultTextStyle`. A `+mj-*`/`+mn-*`
534
+ * major/minor theme-font token — on the run itself or reached through the chain —
535
+ * is resolved through the theme `fontScheme` to its concrete face. `null` when the
536
+ * run names no face and inherits none, or a token cannot be resolved — the resolved
537
+ * counterpart of {@link fontName}, which reports the raw `@typeface` (possibly a token).
538
+ */
539
+ get resolvedFontFace(): string | null;
540
+ /**
541
+ * Whether this run effectively renders bold. It is the run's own `@b`
542
+ * ({@link bold}) when set; otherwise, for a run inside a placeholder, the bold
543
+ * state it inherits from the placeholder/list-style chain (paragraph `a:defRPr` →
544
+ * slide `a:lstStyle` → layout → master placeholder `a:lstStyle` → master
545
+ * `p:txStyles`). `null` when the run sets no `@b` and inherits none — the
546
+ * resolved counterpart of {@link bold}, which reports only the run's own value.
547
+ */
548
+ get resolvedBold(): boolean | null;
549
+ /** Escape hatch: the underlying `a:r` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
550
+ get element_(): Element;
551
+ /** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
552
+ markDirty(): void;
553
+ }
554
+ /** One paragraph (`a:p`) of a text frame. */
555
+ declare class Paragraph {
556
+ #private;
557
+ private readonly element;
558
+ private readonly part;
559
+ /** The owning slide's theme context (colour maps + `fontScheme`), threaded to each {@link Run} for the `resolved*` getters. */
560
+ private readonly themeContext?;
561
+ /**
562
+ * Placeholder + slide-list-style context for resolving a placeholder-inherited
563
+ * run colour/size/face; absent for non-placeholder text. The owning
564
+ * {@link TextFrame} supplies the placeholder identity and the text body's
565
+ * `a:lstStyle`.
566
+ */
567
+ private readonly inherit?;
568
+ /** The owning part's relationships, threaded to each {@link Run} for hyperlink `@r:id` resolution; absent when reached without them. */
569
+ private readonly relationships?;
570
+ constructor(element: Element, part: Part,
571
+ /** The owning slide's theme context (colour maps + `fontScheme`), threaded to each {@link Run} for the `resolved*` getters. */
572
+ themeContext?: FlattenContext | undefined,
573
+ /**
574
+ * Placeholder + slide-list-style context for resolving a placeholder-inherited
575
+ * run colour/size/face; absent for non-placeholder text. The owning
576
+ * {@link TextFrame} supplies the placeholder identity and the text body's
577
+ * `a:lstStyle`.
578
+ */
579
+ inherit?: {
580
+ placeholder: PlaceholderTextContext;
581
+ slideLstStyle: Element | null;
582
+ } | undefined,
583
+ /** The owning part's relationships, threaded to each {@link Run} for hyperlink `@r:id` resolution; absent when reached without them. */
584
+ relationships?: Relationships | undefined);
585
+ /** The runs (`a:r`) in document order. Fields (`a:fld`) and breaks are not runs; see `text`. */
586
+ get runs(): Run[];
587
+ /** Indent level (`a:pPr/@lvl`), 0 when unset. */
588
+ get level(): number;
589
+ /**
590
+ * Horizontal alignment token (`a:pPr/@algn`: `l` | `ctr` | `r` | `just` |
591
+ * `dist` | `thaiDist`), or `null` when unset (inherited from the list style).
592
+ */
593
+ get align(): string | null;
594
+ /**
595
+ * Space before the paragraph in points (`a:pPr/a:spcBef/a:spcPts/@val` is
596
+ * hundredths of a point), or `null` when unset or expressed as a percentage
597
+ * (`a:spcPct`, which has no fixed point value).
598
+ */
599
+ get spaceBeforePt(): number | null;
600
+ /** Space after the paragraph in points; see {@link spaceBeforePt} for the percentage caveat. */
601
+ get spaceAfterPt(): number | null;
602
+ /**
603
+ * The paragraph's line spacing (`a:pPr/a:lnSpc`), as an exact point height
604
+ * (`a:spcPts`) or a percentage of the single-line height (`a:spcPct`), or
605
+ * `null` when unset (inherited from the list style). See {@link LineSpacing}.
606
+ */
607
+ get lineSpacing(): LineSpacing | null;
608
+ /** Left margin of the paragraph in points (`a:pPr/@marL` is EMU; 12700 EMU = 1pt), or `null` when unset. */
609
+ get marginLeftPt(): number | null;
610
+ /** First-line indent in points (`a:pPr/@indent` is EMU; negative for a hanging indent), or `null` when unset. */
611
+ get indentPt(): number | null;
612
+ /**
613
+ * Bullet description for this paragraph, derived from the `a:pPr` bullet
614
+ * children, or `null` when unset (inherited from the list style):
615
+ * - `'none'` — explicit `a:buNone` (bullet suppressed)
616
+ * - `'char:•'` — `a:buChar/@char` (the literal glyph follows the colon)
617
+ * - `'autoNum:arabicPeriod'` — `a:buAutoNum/@type` (auto-numbered)
618
+ */
619
+ get bullet(): string | null;
620
+ /**
621
+ * The paragraph's text: run (`a:r`) and field (`a:fld`) text concatenated in
622
+ * document order, with each line break (`a:br`) rendered as `\n`.
623
+ */
624
+ get text(): string;
625
+ /** Escape hatch: the underlying `a:p` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
626
+ get element_(): Element;
627
+ /** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
628
+ markDirty(): void;
629
+ }
630
+ /** A shape's text frame (`p:txBody`): an ordered list of paragraphs. */
631
+ /**
632
+ * A text frame's body properties (`a:bodyPr`), as read from a shape. Carries the
633
+ * inset/anchor/vertical-text settings that govern where text sits inside its box
634
+ * — the difference between a label that clears a left rail and one that overlaps
635
+ * it. Only **explicitly set** attributes are reported; an absent inset means the
636
+ * PowerPoint default (`lIns`/`rIns` = 0.1", `tIns`/`bIns` = 0.05").
637
+ */
638
+ interface BodyProperties {
639
+ /** Text direction (`@vert`: `horz`/`vert`/`vert270`/`eaVert`/`wordArtVert`…), or `null` when horizontal/unset. */
640
+ vert: string | null;
641
+ /** Vertical anchor (`@anchor`: `t`/`ctr`/`b`), or `null` when unset (defaults to top). */
642
+ anchor: string | null;
643
+ /** Wrap mode (`@wrap`: `square`/`none`), or `null` when unset. */
644
+ wrap: string | null;
645
+ /** Explicitly-set text insets in points (`@lIns`/`@rIns`/`@tIns`/`@bIns` ÷ 12700); a missing side uses the PowerPoint default. */
646
+ insetsPt: {
647
+ left?: number;
648
+ right?: number;
649
+ top?: number;
650
+ bottom?: number;
651
+ };
652
+ }
653
+ /**
654
+ * A text frame's vertical-autofit mode, read from its `a:bodyPr` autofit child:
655
+ * - `'none'` — `a:noAutofit`, or no autofit child at all (the box has a fixed
656
+ * size and text can overflow); write-side `fit: 'none'`.
657
+ * - `'normAutofit'`— `a:normAutofit` (shrink text to fit); write-side `fit: 'shrink'`.
658
+ * - `'spAutoFit'` — `a:spAutoFit` (resize the shape to fit text); write-side `fit: 'resize'`.
659
+ */
660
+ type AutofitMode = 'none' | 'normAutofit' | 'spAutoFit';
661
+ declare class TextFrame {
662
+ #private;
663
+ private readonly txBody;
664
+ private readonly part;
665
+ /** The owning slide's theme context (colour maps + `fontScheme`), threaded to each {@link Paragraph}/{@link Run} for the `resolved*` getters. */
666
+ private readonly themeContext?;
667
+ /**
668
+ * The placeholder this text body lives in, when any — enables
669
+ * placeholder-inherited run colour/size/face resolution. Absent for ordinary
670
+ * text boxes and table cells.
671
+ */
672
+ private readonly placeholder?;
673
+ /** The owning part's relationships, threaded to each {@link Paragraph}/{@link Run} for hyperlink `@r:id` resolution; absent when reached without them. */
674
+ private readonly relationships?;
675
+ constructor(txBody: Element, part: Part,
676
+ /** The owning slide's theme context (colour maps + `fontScheme`), threaded to each {@link Paragraph}/{@link Run} for the `resolved*` getters. */
677
+ themeContext?: FlattenContext | undefined,
678
+ /**
679
+ * The placeholder this text body lives in, when any — enables
680
+ * placeholder-inherited run colour/size/face resolution. Absent for ordinary
681
+ * text boxes and table cells.
682
+ */
683
+ placeholder?: PlaceholderTextContext | undefined,
684
+ /** The owning part's relationships, threaded to each {@link Paragraph}/{@link Run} for hyperlink `@r:id` resolution; absent when reached without them. */
685
+ relationships?: Relationships | undefined);
686
+ /** Paragraphs (`a:p`) in document order. */
687
+ get paragraphs(): Paragraph[];
688
+ /**
689
+ * The frame's body properties (`a:bodyPr`: insets, anchor, vertical text), or
690
+ * `null` when there is no `a:bodyPr`. Only explicitly-set insets are reported
691
+ * (a missing side is the PowerPoint default — see {@link BodyProperties}).
692
+ */
693
+ get bodyProperties(): BodyProperties | null;
694
+ /**
695
+ * The effective vertical anchor (`t`/`ctr`/`b`): the frame's own
696
+ * `a:bodyPr/@anchor` when set, else the anchor it inherits from its
697
+ * layout → master placeholder `a:bodyPr`. `null` when nothing in the chain sets
698
+ * one (PowerPoint then defaults to top). Unlike {@link bodyProperties}'s
699
+ * `anchor` (own attribute only), this surfaces the inherited anchor a
700
+ * placeholder title relies on — the difference between a top- and
701
+ * centre-anchored title that own-attribute reads alone cannot see.
702
+ */
703
+ get resolvedAnchor(): string | null;
704
+ /**
705
+ * The frame's vertical-autofit mode (`a:bodyPr` autofit child), or `null` when
706
+ * there is no `a:bodyPr`. A `bodyPr` with no autofit child — or an explicit
707
+ * `a:noAutofit` — reads `'none'`. See {@link AutofitMode}. This is the deep-model
708
+ * counterpart of `inspectPptx`'s per-shape `autofit`; unlike the shallow surface
709
+ * it hangs off the navigable text frame.
710
+ */
711
+ get autofit(): AutofitMode | null;
712
+ /**
713
+ * The baked shrink scale of a `normAutofit` frame as a percent (62.5 = 62.5%),
714
+ * or `null` when the frame has no `a:normAutofit` or bakes no scale. A bare
715
+ * `<a:normAutofit/>` (write-side `fit: 'shrink'`) carries no scale — PowerPoint
716
+ * computes it on edit and draws at 100% until then — so it too reads `null`; an
717
+ * explicit scale comes from `fit: { type: 'shrink', fontScale }`.
718
+ */
719
+ get autofitFontScale(): number | null;
720
+ /**
721
+ * The baked line-spacing reduction of a `normAutofit` frame as a percent
722
+ * (`a:normAutofit/@lnSpcReduction` ÷ 1000), or `null` when unset. The companion
723
+ * to {@link autofitFontScale} (write-side `fit: { type: 'shrink', lnSpcReduction }`).
724
+ */
725
+ get autofitLineSpaceReduction(): number | null;
726
+ /** All paragraph text joined by `\n` (mirrors python-pptx `TextFrame.text`). */
727
+ get text(): string;
728
+ /**
729
+ * Replace the frame's text with a single paragraph and run, preserving the
730
+ * character formatting (`a:rPr`) of the frame's first existing run when there
731
+ * is one. For multiple runs or per-run formatting, edit
732
+ * `paragraphs[].runs[]` directly.
733
+ */
734
+ set text(value: string);
735
+ /** Escape hatch: the underlying `p:txBody` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
736
+ get element_(): Element;
737
+ /** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
738
+ markDirty(): void;
739
+ }
740
+ //#endregion
741
+ //#region src/read/api/shapes/types.d.ts
742
+ /** Discriminator for the concrete `Shape` subclass. */
743
+ type ShapeType = 'autoShape' | 'picture' | 'connector' | 'graphicFrame' | 'group';
744
+ /** One end of a connector/line (`a:ln/a:headEnd` or `a:tailEnd`), as read from a shape. */
745
+ interface LineEnd {
746
+ /** Arrowhead type (`@type`: `none`/`triangle`/`stealth`/`diamond`/`oval`/`arrow`). */
747
+ type: string;
748
+ /** Width class (`@w`: `sm`/`med`/`lg`), or `null` when unset. */
749
+ width: string | null;
750
+ /** Length class (`@len`: `sm`/`med`/`lg`), or `null` when unset. */
751
+ length: string | null;
752
+ }
753
+ /** Both ends of a shape's line/border, when either carries an arrowhead. */
754
+ interface LineEnds {
755
+ head: LineEnd | null;
756
+ tail: LineEnd | null;
757
+ }
758
+ /**
759
+ * One bound end of a connector (`p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn` or `a:endCxn`),
760
+ * as read. A connector authored with `startShape`/`endShape` attaches each end to
761
+ * a shape by that shape's `p:cNvPr/@id` plus a connection-site index; an unbound
762
+ * end (the writer emits a bare `p:cNvCxnSpPr`) reports no site at all — see
763
+ * {@link Connector.startConnection}. This is the read counterpart of the write
764
+ * API's `startShape`/`startShapeIdx` split, which binds by `objectName` and
765
+ * resolves the name → id at serialize time.
766
+ */
767
+ interface ConnectionSite {
768
+ /** The bound shape's drawing id (`@id`, i.e. its `p:cNvPr/@id`). */
769
+ shapeId: number;
770
+ /** Connection-site index on the bound shape (`@idx`; 0-based, preset-dependent). */
771
+ siteIndex: number;
772
+ /**
773
+ * The bound shape resolved to a read-model shape via {@link Slide.shapeByIdDeep},
774
+ * which descends into groups — so a connector bound to a shape nested in a group
775
+ * resolves the same as one bound to a top-level shape. `null` only when no shape
776
+ * anywhere on the slide carries that id (a genuinely dangling binding), which is
777
+ * faithful degradation and does not throw.
778
+ */
779
+ boundShape: AnyShape | null;
780
+ }
781
+ /**
782
+ * A shape's outer drop shadow (`spPr/a:effectLst/a:outerShdw`), as read from a
783
+ * shape and resolved against the slide theme. Distances are in points (the EMU
784
+ * source ÷ 12700) and the direction in degrees (the `60000`ths source ÷ 60000),
785
+ * matching the write-side {@link ShadowProps} convention so it round-trips.
786
+ */
787
+ interface OuterShadow {
788
+ /** Effective shadow colour as 6-hex (theme-resolved, transforms applied), or `null`. */
789
+ color: string | null;
790
+ /** Theme colour token when the shadow colour was a scheme colour (e.g. `accent1`), else `undefined`. */
791
+ colorToken?: string;
792
+ /** Shadow opacity 0–1 (from the colour's `a:alpha`), or `undefined` when fully opaque. */
793
+ alpha?: number;
794
+ /** Blur radius in points (`@blurRad` ÷ 12700), or `undefined` when unset. */
795
+ blurPt?: number;
796
+ /** Offset distance in points (`@dist` ÷ 12700), or `undefined` when unset. */
797
+ offsetPt?: number;
798
+ /** Offset direction in degrees, clockwise from 3 o'clock (`@dir` ÷ 60000), or `undefined` when unset. */
799
+ angleDeg?: number;
800
+ }
801
+ /**
802
+ * A shape's inner shadow (`spPr/a:effectLst/a:innerShdw`), resolved against the
803
+ * slide theme. Identical fields to {@link OuterShadow} — CT_InnerShadowEffect
804
+ * carries the same `blurRad`/`dist`/`dir` + colour — but a distinct type so a
805
+ * consumer can tell an inset shadow from a drop shadow. Distances in points,
806
+ * direction in degrees, matching the write-side `shadow: { type: 'inner' }`.
807
+ */
808
+ interface InnerShadow {
809
+ /** Effective shadow colour as 6-hex (theme-resolved, transforms applied), or `null`. */
810
+ color: string | null;
811
+ /** Theme colour token when the shadow colour was a scheme colour (e.g. `accent1`), else `undefined`. */
812
+ colorToken?: string;
813
+ /** Shadow opacity 0–1 (from the colour's `a:alpha`), or `undefined` when fully opaque. */
814
+ alpha?: number;
815
+ /** Blur radius in points (`@blurRad` ÷ 12700), or `undefined` when unset. */
816
+ blurPt?: number;
817
+ /** Offset distance in points (`@dist` ÷ 12700), or `undefined` when unset. */
818
+ offsetPt?: number;
819
+ /** Offset direction in degrees, clockwise from 3 o'clock (`@dir` ÷ 60000), or `undefined` when unset. */
820
+ angleDeg?: number;
821
+ }
822
+ /**
823
+ * A shape's glow effect (`spPr/a:effectLst/a:glow`) — a coloured halo — resolved
824
+ * against the slide theme. The write-side text glow (`glow: { size, color,
825
+ * opacity }`) emits the same element, so {@link radiusPt} (`@rad` ÷ 12700) and the
826
+ * colour round-trip.
827
+ */
828
+ interface Glow {
829
+ /** Effective glow colour as 6-hex (theme-resolved, transforms applied), or `null`. */
830
+ color: string | null;
831
+ /** Theme colour token when the glow colour was a scheme colour (e.g. `accent1`), else `undefined`. */
832
+ colorToken?: string;
833
+ /** Glow opacity 0–1 (from the colour's `a:alpha`), or `undefined` when fully opaque. */
834
+ alpha?: number;
835
+ /** Glow radius in points (`@rad` ÷ 12700), or `undefined` when unset. */
836
+ radiusPt?: number;
837
+ }
838
+ /**
839
+ * A shape's reflection effect (`spPr/a:effectLst/a:reflection`) — a mirrored fade
840
+ * beneath the shape. This library's writer authors none, so this is a **read-only**
841
+ * surface: a consumer that finds one should carry the part verbatim rather than
842
+ * regenerate it. Only the attributes a faithful replica needs are decoded —
843
+ * distances in points (÷ 12700), directions in degrees (÷ 60000), and the start/end
844
+ * alpha and position pairs as 0–1 fractions (the `1000`ths-of-a-percent source
845
+ * ÷ 100000). All fields are optional; an attribute absent from the source is omitted.
846
+ */
847
+ interface Reflection {
848
+ /** Blur radius in points (`@blurRad` ÷ 12700). */
849
+ blurPt?: number;
850
+ /** Start opacity 0–1 (`@stA` ÷ 100000). */
851
+ startAlpha?: number;
852
+ /** Start position along the reflection 0–1 (`@stPos` ÷ 100000). */
853
+ startPos?: number;
854
+ /** End opacity 0–1 (`@endA` ÷ 100000). */
855
+ endAlpha?: number;
856
+ /** End position along the reflection 0–1 (`@endPos` ÷ 100000). */
857
+ endPos?: number;
858
+ /** Offset distance in points (`@dist` ÷ 12700). */
859
+ distPt?: number;
860
+ /** Offset direction in degrees (`@dir` ÷ 60000). */
861
+ angleDeg?: number;
862
+ /** Fade direction in degrees (`@fadeDir` ÷ 60000). */
863
+ fadeAngleDeg?: number;
864
+ }
865
+ /**
866
+ * A shape's soft-edge effect (`spPr/a:effectLst/a:softEdge`) — a feathered border.
867
+ * Like {@link Reflection}, the writer authors none, so carry it verbatim. `@rad`
868
+ * (the feather radius) ÷ 12700 → points.
869
+ */
870
+ interface SoftEdge {
871
+ /** Feather radius in points (`@rad` ÷ 12700). */
872
+ radiusPt: number;
873
+ }
874
+ /**
875
+ * A shape's pattern fill (`spPr/a:pattFill`) — a two-colour preset hatch. The
876
+ * write-side `fill: { type: 'pattern', pattern: { preset, fgColor, bgColor } }`
877
+ * emits the same element, so the {@link preset} name and both colours round-trip.
878
+ * Colours resolve against the slide theme (a scheme token → literal hex) the same
879
+ * way {@link Shape.resolvedFill} resolves a solid fill.
880
+ */
881
+ interface PatternFill {
882
+ /** Preset pattern name (`@prst`, e.g. `pct50`/`diagCross`/`ltUpDiag`), or `null` when unset. */
883
+ preset: string | null;
884
+ /** Foreground colour (`a:fgClr`) resolved against the theme, or `null`. */
885
+ foreground: ResolvedColor | null;
886
+ /** Background colour (`a:bgClr`) resolved against the theme, or `null`. */
887
+ background: ResolvedColor | null;
888
+ }
889
+ /**
890
+ * One segment of a custom-geometry path (`a:path`), as read from a shape. The
891
+ * command verbs mirror the write-side `GeometryPoint` DSL (`src/types/`)
892
+ * so a consumer can map a `GeometryCommand[]` to `GeometryPoint[]` one-to-one.
893
+ *
894
+ * Coordinates (`x`/`y`/`x1`…) are raw path-unit integers in the path's own
895
+ * `0..w` / `0..h` space (see {@link CustomGeometryPath.w}); they are not EMU and
896
+ * must be scaled by the consumer against the shape's box. `arcTo` angles are in
897
+ * **degrees** (the raw `60000`ths-of-a-degree values divided by 60000), matching
898
+ * the write DSL's degree input.
899
+ */
900
+ type GeometryCommand = {
901
+ cmd: 'moveTo';
902
+ x: number;
903
+ y: number;
904
+ } | {
905
+ cmd: 'lnTo';
906
+ x: number;
907
+ y: number;
908
+ } | {
909
+ cmd: 'cubicBezTo';
910
+ x1: number;
911
+ y1: number;
912
+ x2: number;
913
+ y2: number;
914
+ x: number;
915
+ y: number;
916
+ } | {
917
+ cmd: 'quadBezTo';
918
+ x1: number;
919
+ y1: number;
920
+ x: number;
921
+ y: number;
922
+ } | {
923
+ cmd: 'arcTo';
924
+ wR: number;
925
+ hR: number;
926
+ stAng: number;
927
+ swAng: number;
928
+ } | {
929
+ cmd: 'close';
930
+ };
931
+ /** One `<a:path>` of a custom geometry, with its path-unit viewport and render attrs. */
932
+ interface CustomGeometryPath {
933
+ /** Path-unit width (`a:path/@w`); the `x` denominator for this path's coords. Default `0`. */
934
+ w: number;
935
+ /** Path-unit height (`a:path/@h`); the `y` denominator for this path's coords. Default `0`. */
936
+ h: number;
937
+ /** Fill mode (`a:path/@fill`, `ST_PathFillMode`, e.g. `norm`/`none`/`lighten`). Default `norm`. */
938
+ fill: string;
939
+ /** Whether the path is stroked (`a:path/@stroke`). Default `true`. */
940
+ stroke: boolean;
941
+ /** The path's segments in document order — order *is* the geometry. */
942
+ commands: GeometryCommand[];
943
+ }
944
+ /**
945
+ * Custom freeform geometry (`spPr/a:custGeom/a:pathLst`), as read from a shape.
946
+ * Faithfully exposes every `a:path` rather than flattening to a single command
947
+ * list: the schema allows repeatable `a:path`, each with independent
948
+ * `fill`/`stroke`. Desktop PowerPoint's own freeforms only ever emit one
949
+ * `a:path` (a hole is one path with two `moveTo`…`close` contours), but
950
+ * multi-`a:path` input is schema-legal (e.g. SVG import) and preserved here.
951
+ */
952
+ interface CustomGeometry {
953
+ paths: CustomGeometryPath[];
954
+ }
955
+ /** A shape's resolved position and size in slide-absolute EMU. */
956
+ interface AbsoluteFrame {
957
+ left: number;
958
+ top: number;
959
+ width: number;
960
+ height: number;
961
+ /** Effective clockwise rotation in degrees after composing enclosing group rotations. */
962
+ rotation: number;
963
+ /** Effective horizontal flip after XOR-composing enclosing group flips. */
964
+ flipH: boolean;
965
+ /** Effective vertical flip after XOR-composing enclosing group flips. */
966
+ flipV: boolean;
967
+ }
968
+ /**
969
+ * A colour reference inside a picture recolour effect, split by colour model
970
+ * (mirrors {@link GradientStop}). At most one field is non-`null`.
971
+ */
972
+ interface RecolorColor {
973
+ /** Explicit RGB as 6-hex (`a:srgbClr/@val`), or `null`. */
974
+ color: string | null;
975
+ /** Theme colour token (`a:schemeClr/@val`, e.g. `accent1`), or `null`. */
976
+ schemeColor: string | null;
977
+ /** Preset colour name (`a:prstClr/@val`, e.g. `black`/`white` — the duotone icon-tint stops), or `null`. */
978
+ presetColor: string | null;
979
+ }
980
+ /**
981
+ * A picture's blip recolour effect (`p:blipFill/a:blip` recolour child), as read.
982
+ * A small discriminated union over the effects a faithful reader needs to
983
+ * reproduce a recoloured image. Colours use the same `color`/`schemeColor`/
984
+ * `presetColor` split as {@link GradientStop}, so theme tokens can resolve through
985
+ * {@link Slide.themeContext}. `threshold`/`amount` are 0–1 fractions.
986
+ */
987
+ type Recolor = {
988
+ kind: 'duotone';
989
+ stops: RecolorColor[];
990
+ } | {
991
+ kind: 'clrChange';
992
+ from: RecolorColor | null;
993
+ to: RecolorColor | null;
994
+ } | {
995
+ kind: 'grayscale';
996
+ } | {
997
+ kind: 'biLevel';
998
+ threshold: number | null;
999
+ } | {
1000
+ kind: 'alphaModFix';
1001
+ amount: number;
1002
+ };
1003
+ //#endregion
1004
+ //#region src/read/api/shapes/base.d.ts
1005
+ /** Common base for every shape in a slide's shape tree. */
1006
+ declare abstract class Shape {
1007
+ #private;
1008
+ protected readonly element: Element;
1009
+ readonly slide: Slide;
1010
+ constructor(element: Element, slide: Slide);
1011
+ /** Which concrete shape kind this is. */
1012
+ abstract readonly shapeType: ShapeType;
1013
+ /** The transform element (`a:xfrm` or `p:xfrm`) carrying this shape's geometry, or `null` if inherited. */
1014
+ protected abstract xfrm(): Element | null;
1015
+ /** The transform element, creating it (and its container) in document order if absent. */
1016
+ protected abstract getOrAddXfrm(): Element;
1017
+ /**
1018
+ * Mark the owning slide part dirty so `save()` reserializes it. Public
1019
+ * because {@link element_} hands out the live DOM node: the hatch and the
1020
+ * obligation that comes with it belong on the same object.
1021
+ */
1022
+ markDirty(): void;
1023
+ /** Drawing id (`p:cNvPr/@id`), or `null` if absent. */
1024
+ get id(): number | null;
1025
+ /** Shape name (`p:cNvPr/@name`), or `''` if unnamed. */
1026
+ get name(): string;
1027
+ /**
1028
+ * Whether the shape is explicitly hidden (`p:cNvPr/@hidden="1"`); `false` when
1029
+ * the attribute is unset. A hidden shape stays in the slide XML but is not
1030
+ * rendered — decks use it as a fallback layer (e.g. a duotone-recolour source
1031
+ * sitting behind the visible icon), so a faithful reader must distinguish it
1032
+ * from the drawn shapes.
1033
+ */
1034
+ get hidden(): boolean;
1035
+ /**
1036
+ * The shape's alt-text description (`p:cNvPr/@descr`), or `null` when unset.
1037
+ * This is the accessibility primitive a screen reader announces; an audit or
1038
+ * accessible-export tool reads it here. Distinct from {@link name}, which is
1039
+ * the authoring-time shape name and is never surfaced to assistive tech.
1040
+ */
1041
+ get description(): string | null;
1042
+ /**
1043
+ * Set (or clear, with `''`) the alt-text description. Requires the shape's
1044
+ * `p:cNvPr` to exist, which every well-formed shape carries.
1045
+ */
1046
+ set description(value: string);
1047
+ /**
1048
+ * The shape's alt-text title (`p:cNvPr/@title`), or `null` when unset. Modern
1049
+ * PowerPoint no longer exposes a separate title field (only description +
1050
+ * "mark as decorative"), so this is usually `null`; it survives on decks
1051
+ * authored by older PowerPoint or other producers that still write it.
1052
+ */
1053
+ get title(): string | null;
1054
+ /**
1055
+ * Whether the shape is flagged **decorative** (`p:cNvPr/a:extLst/a:ext`
1056
+ * uri `{C183D7F6-…}` / `adec:decorative@val`), PowerPoint's "Mark as
1057
+ * decorative" — a purely visual element assistive tech should skip. `false`
1058
+ * when the extension is absent. A decorative shape typically has no
1059
+ * {@link description}; the two are alternatives, not companions.
1060
+ */
1061
+ get isDecorative(): boolean;
1062
+ /** Left edge in EMU (`a:off/@x`), or `null` when the shape has no own transform. */
1063
+ get left(): number | null;
1064
+ set left(value: number);
1065
+ /** Top edge in EMU (`a:off/@y`), or `null` when the shape has no own transform. */
1066
+ get top(): number | null;
1067
+ set top(value: number);
1068
+ /** Width in EMU (`a:ext/@cx`), or `null` when the shape has no own transform. */
1069
+ get width(): number | null;
1070
+ set width(value: number);
1071
+ /** Height in EMU (`a:ext/@cy`), or `null` when the shape has no own transform. */
1072
+ get height(): number | null;
1073
+ set height(value: number);
1074
+ /**
1075
+ * This shape's effective position and size in EMU: its own `a:xfrm` when it has
1076
+ * one ({@link left}/{@link top}/{@link width}/{@link height}, tagged
1077
+ * `source: 'own'`); otherwise, for a placeholder, the geometry it inherits from
1078
+ * the matching layout placeholder, else the master's (tagged accordingly). A
1079
+ * non-placeholder shape with no own transform has nothing to inherit from and
1080
+ * reads `null`, as does a placeholder whose layout/master chain defines no
1081
+ * matching geometry either.
1082
+ *
1083
+ * The writer always emits an explicit `a:xfrm` on every placeholder it authors,
1084
+ * so `source` reads `'own'` for every authored deck; `'layout'`/`'master'` is
1085
+ * the case an *imported* deck exercises, when PowerPoint itself leaves a
1086
+ * placeholder's geometry to inherit.
1087
+ */
1088
+ get resolvedFrame(): ResolvedFrame | null;
1089
+ /**
1090
+ * Clockwise rotation in degrees (`a:xfrm/@rot` ÷ 60000), or `null` when the
1091
+ * shape has no own transform. A present xfrm with no `@rot` reads as `0`, so
1092
+ * — mirroring {@link left}/{@link top}/{@link width}/{@link height} — `null`
1093
+ * ("inherits layout geometry") stays distinct from `0` ("has a transform, not
1094
+ * rotated"). The value is faithful to the XML and not normalised to a signed
1095
+ * range, so a `@rot` past 360° (e.g. a negative angle stored as `19216344`)
1096
+ * reads back greater than 360. This is the shape's own orientation; use
1097
+ * {@link absoluteFrame} when you need the effective orientation after
1098
+ * enclosing group transforms are composed.
1099
+ */
1100
+ get rotation(): number | null;
1101
+ /**
1102
+ * Whether the shape is flipped horizontally (`a:xfrm/@flipH`); `false` when
1103
+ * unset or when the shape has no own transform. This is the shape's own
1104
+ * horizontal flip; use {@link absoluteFrame} for the effective value after
1105
+ * enclosing group transforms are composed.
1106
+ */
1107
+ get flipH(): boolean;
1108
+ /**
1109
+ * Whether the shape is flipped vertically (`a:xfrm/@flipV`); `false` when
1110
+ * unset or when the shape has no own transform. This is the shape's own
1111
+ * vertical flip; use {@link absoluteFrame} for the effective value after
1112
+ * enclosing group transforms are composed.
1113
+ */
1114
+ get flipV(): boolean;
1115
+ /**
1116
+ * This shape's position, size, and effective orientation in **slide-absolute**
1117
+ * EMU/degrees, composing every enclosing group transform.
1118
+ *
1119
+ * {@link left}/{@link top}/{@link width}/{@link height} report a group child's
1120
+ * geometry in its group's child coordinate space (`a:chOff`/`a:chExt`), which is
1121
+ * not directly placeable on the slide. This getter walks the `p:grpSp` ancestor
1122
+ * chain outward, mapping the box through each group's
1123
+ * `off + (p - chOff) * (ext / chExt)` transform, then composing group flips and
1124
+ * rotations about the group centre. For a shape already at slide level the box
1125
+ * equals its own `{ left, top, width, height }`, while `rotation`/`flipH`/`flipV`
1126
+ * equal the shape's own transform values.
1127
+ *
1128
+ * `null` when the shape (or any enclosing group) has no own transform, or a
1129
+ * group's `a:chExt` is degenerate (zero) — there is then no resolvable frame.
1130
+ *
1131
+ * A rotated shape's returned `left`/`top` remain PowerPoint's unrotated
1132
+ * placement box (the same box PowerPoint writes after Ungroup), with the
1133
+ * effective rotation exposed separately.
1134
+ */
1135
+ get absoluteFrame(): AbsoluteFrame | null;
1136
+ /** The shape's properties element (`p:spPr` / `p:grpSpPr`), or `null` when absent. */
1137
+ protected properties(): Element | null;
1138
+ /** Get-or-add the properties element in document order, with the successor
1139
+ * arrays for inserting its fill / line children. Subclasses override this
1140
+ * to point at `p:grpSpPr`, or to reject kinds with no properties element. */
1141
+ protected getOrAddProperties(): ShapeProperties;
1142
+ /** Whether a solid fill can be set on this shape kind. Pictures and graphic
1143
+ * frames opt out (they carry their own image / table-cell fill model). */
1144
+ protected get supportsFill(): boolean;
1145
+ /** Explicit RGB fill colour as a 6-hex string (`spPr/a:solidFill/a:srgbClr/@val`), or `null`. */
1146
+ get fillColor(): string | null;
1147
+ set fillColor(value: string | null);
1148
+ /** Theme colour token when the fill is a scheme colour (`a:solidFill/a:schemeClr/@val`, e.g. `accent2`), or `null`. */
1149
+ get fillSchemeColor(): string | null;
1150
+ set fillSchemeColor(value: string | null);
1151
+ /**
1152
+ * Set an explicit `<a:noFill/>` on the shape — a transparent surface. This is
1153
+ * distinct from clearing the fill (`fillColor = null`), which removes the
1154
+ * `a:solidFill` and lets the fill inherit from the shape's style/placeholder.
1155
+ */
1156
+ noFill(): void;
1157
+ /** Explicit RGB line/border colour (`spPr/a:ln/a:solidFill/a:srgbClr/@val`), or `null`. */
1158
+ get lineColor(): string | null;
1159
+ set lineColor(value: string | null);
1160
+ /** Theme colour token when the line is a scheme colour (`a:ln/a:solidFill/a:schemeClr/@val`), or `null`. */
1161
+ get lineSchemeColor(): string | null;
1162
+ set lineSchemeColor(value: string | null);
1163
+ /** Line/border width in points (`spPr/a:ln/@w` is EMU; 12700 EMU = 1pt), or `null` when unset. */
1164
+ get lineWidthPt(): number | null;
1165
+ /**
1166
+ * The line/border dash style (`spPr/a:ln/a:prstDash/@val`), e.g. `'dash'`,
1167
+ * `'lgDashDot'`, `'sysDot'`, or `null` when the line is solid/unset. A faithful
1168
+ * replica of dashed dividers and dashed card borders needs this — it is
1169
+ * otherwise invisible in {@link lineColor}/{@link lineWidthPt} alone.
1170
+ */
1171
+ get lineDash(): string | null;
1172
+ /**
1173
+ * `true` when the shape sets an explicit no-line (`spPr/a:ln/a:noFill`) — a
1174
+ * deliberately border-less shape. Distinct from simply having no `a:ln`
1175
+ * (an inherited line), which {@link resolvedLine} cannot tell apart: both
1176
+ * report `null`. A replica that relies on a shadow instead of a border needs
1177
+ * to know the border was explicitly suppressed.
1178
+ */
1179
+ get lineNoFill(): boolean;
1180
+ /**
1181
+ * Preset geometry name (`spPr/a:prstGeom/@prst`, e.g. `rect`), or `null` for
1182
+ * custom geometry or none. Not an auto-shape-only property: PowerPoint gives a
1183
+ * picture and a connector a preset geometry too (a `p:pic` is `rect` unless it
1184
+ * has been cropped to a shape), so it reads off whichever properties element
1185
+ * this kind carries. A group has no geometry of its own and reads `null`.
1186
+ */
1187
+ get presetGeometry(): string | null;
1188
+ /**
1189
+ * Preset-geometry adjustment values (`spPr/a:prstGeom/a:avLst/a:gd`) as a
1190
+ * name → formula map, e.g. `{ adj: 'val 16667' }`. Empty when the shape has no
1191
+ * adjust handles (or uses custom geometry). Pair with {@link presetGeometry}.
1192
+ */
1193
+ get adjustValues(): Record<string, string>;
1194
+ /**
1195
+ * Gradient fill stops (`spPr/a:gradFill/a:gsLst/a:gs`) in document order, or
1196
+ * `null` when the shape's fill is not a gradient. Each stop carries its
1197
+ * position (0–1, from `@pos` in thousandths of a percent) and either an
1198
+ * explicit `color` (hex) or a `schemeColor` token, mirroring the
1199
+ * {@link fillColor} / {@link fillSchemeColor} split for solid fills.
1200
+ */
1201
+ get gradientStops(): GradientStop[] | null;
1202
+ /**
1203
+ * The shape's gradient fill with its geometry (`spPr/a:gradFill`), or `null`
1204
+ * when the fill is not a gradient. Unlike {@link gradientStops} (stops only),
1205
+ * this also carries the linear {@link GradientFill.angleDeg} or the
1206
+ * {@link GradientFill.path} shape — the geometry a faithful replica needs and
1207
+ * which the bare stop list omits.
1208
+ */
1209
+ get gradientFill(): GradientFill | null;
1210
+ /**
1211
+ * The shape's line/border **gradient** stroke (`spPr/a:ln/a:gradFill`), or
1212
+ * `null` when the line is a solid, absent, or inherited border (see
1213
+ * {@link resolvedLine}). The line counterpart of {@link gradientFill}: a
1214
+ * gradient-stroked connector — common for faded process arrows in styled decks
1215
+ * — otherwise surfaces only its {@link lineWidthPt}, dropping the colour
1216
+ * entirely, so a replica cannot reproduce the stroke.
1217
+ */
1218
+ get lineGradient(): GradientFill | null;
1219
+ /**
1220
+ * The shape's line/connector arrowheads (`a:ln/a:headEnd` + `a:tailEnd`), or
1221
+ * `null` when neither end carries one. Essential for replicating connectors,
1222
+ * whose dot/arrow ends are otherwise invisible in the geometry.
1223
+ */
1224
+ get lineEnds(): LineEnds | null;
1225
+ /**
1226
+ * The shape's outer drop shadow (`spPr/a:effectLst/a:outerShdw`), resolved
1227
+ * against the slide theme, or `null` when the shape has no outer shadow. The
1228
+ * soft brand shadows the eye reads as "floating" panels live here and are
1229
+ * invisible in geometry/fill alone.
1230
+ */
1231
+ get shadow(): OuterShadow | null;
1232
+ /**
1233
+ * The shape's **inner** shadow (`spPr/a:effectLst/a:innerShdw`), resolved against
1234
+ * the slide theme, or `null` when the shape has no inner shadow. The inset
1235
+ * counterpart of {@link shadow}: the write-side `shadow: { type: 'inner' }`
1236
+ * emits it, and it is invisible in geometry/fill alone.
1237
+ */
1238
+ get innerShadow(): InnerShadow | null;
1239
+ /**
1240
+ * The shape's glow halo (`spPr/a:effectLst/a:glow`), resolved against the slide
1241
+ * theme, or `null` when the shape has no glow. Same element the write-side text
1242
+ * glow emits, so its {@link Glow.radiusPt} and colour round-trip.
1243
+ */
1244
+ get glow(): Glow | null;
1245
+ /**
1246
+ * The shape's reflection (`spPr/a:effectLst/a:reflection`), or `null` when it has
1247
+ * none. Read-only: this library authors no reflection, so a replica should carry
1248
+ * the part rather than regenerate it — see {@link Reflection}.
1249
+ */
1250
+ get reflection(): Reflection | null;
1251
+ /**
1252
+ * The shape's soft (feathered) edge (`spPr/a:effectLst/a:softEdge`), or `null`
1253
+ * when it has none. Read-only like {@link reflection}: carry, don't regenerate.
1254
+ */
1255
+ get softEdge(): SoftEdge | null;
1256
+ /**
1257
+ * The shape's pattern (hatch) fill (`spPr/a:pattFill`), or `null` when the fill
1258
+ * is not a pattern. Surfaces the {@link PatternFill.preset} name and both
1259
+ * colours resolved against the slide theme — the pattern counterpart of
1260
+ * {@link resolvedFill}, which reports `null` for a non-solid fill and so drops a
1261
+ * hatched surface entirely.
1262
+ */
1263
+ get patternFill(): PatternFill | null;
1264
+ /**
1265
+ * The shape's picture (image) fill (`spPr/a:blipFill`), or `null` when the fill
1266
+ * is not a picture. The image-fill counterpart of {@link patternFill}: a shape
1267
+ * whose *surface* is an image is not a {@link Picture} — it is an autoShape with
1268
+ * a blip fill — and {@link resolvedFill} reports `null` for one, so without this
1269
+ * an image-filled shape reads as unfilled. Carries the embedded image
1270
+ * ({@link PictureFill.relId}/{@link PictureFill.partName}) plus the stretch/tile
1271
+ * geometry.
1272
+ */
1273
+ get pictureFill(): PictureFill | null;
1274
+ /**
1275
+ * The shape's solid fill resolved against the slide's theme
1276
+ * ({@link Slide.themeContext}) to a literal hex — the resolved counterpart of
1277
+ * {@link fillColor}/{@link fillSchemeColor}, which report the raw reference.
1278
+ * `null` when the shape has no `a:solidFill` (a gradient/none/inherited fill)
1279
+ * or the colour cannot be made literal. The returned {@link ResolvedColor}
1280
+ * carries the base `hex` and raw transforms, and `effectiveHex` — the base with
1281
+ * its colour transforms (`lumMod`/`shade`/…) applied (read that for the final
1282
+ * rendered colour).
1283
+ *
1284
+ * When the shape carries no explicit `spPr` fill choice, this falls back to the
1285
+ * fill the shape inherits from its `p:style` `a:fillRef` (the theme style
1286
+ * matrix), resolved the same way the `theme: 'preserve'` flatten path bakes it.
1287
+ */
1288
+ get resolvedFill(): ResolvedColor | null;
1289
+ /**
1290
+ * The shape's line/border solid fill resolved against the slide's theme to a
1291
+ * literal hex — the resolved counterpart of {@link lineColor}/{@link lineSchemeColor}.
1292
+ * `null` when the shape has no `a:ln/a:solidFill` or it cannot be made literal.
1293
+ * Like {@link resolvedFill}, the result carries `effectiveHex` (the base colour
1294
+ * with its transforms applied) for the final rendered colour.
1295
+ *
1296
+ * When the shape carries no explicit `spPr/a:ln`, this falls back to the line
1297
+ * the shape inherits from its `p:style` `a:lnRef` (the theme style matrix).
1298
+ */
1299
+ get resolvedLine(): ResolvedColor | null;
1300
+ /** Whether this shape can hold text (only `p:sp` does in this read model). */
1301
+ get hasTextFrame(): boolean;
1302
+ /** The shape's text frame, or `null` when it cannot hold text. */
1303
+ get textFrame(): TextFrame | null;
1304
+ /** Convenience: the shape's full text, or `''` if it has none. */
1305
+ get text(): string;
1306
+ /**
1307
+ * Convenience: replace the shape's text with a single run, preserving the
1308
+ * first existing run's formatting (see {@link TextFrame.text}). Throws when the
1309
+ * shape has no text frame. For multiple runs or per-run formatting, edit
1310
+ * `textFrame.paragraphs[].runs[]` directly.
1311
+ */
1312
+ set text(value: string);
1313
+ /**
1314
+ * This shape's placeholder identity (`p:ph` `type`/`idx`), or `null` when it is
1315
+ * not a placeholder. Only `p:sp` shapes can be placeholders, so the base
1316
+ * implementation always returns `null`; {@link AutoShape} overrides it.
1317
+ */
1318
+ get placeholder(): PlaceholderRef | null;
1319
+ /**
1320
+ * Remove this shape from its parent (the slide's shape tree, or an enclosing
1321
+ * group) and mark the owning slide part dirty. The proxy is dead afterwards.
1322
+ */
1323
+ delete(): void;
1324
+ /** Escape hatch: the underlying shape element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
1325
+ get element_(): Element;
1326
+ }
1327
+ //#endregion
1328
+ //#region src/read/api/shapes/autoshape.d.ts
1329
+ /** An auto shape, text box, or placeholder (`p:sp`). The only kind that holds text. */
1330
+ declare class AutoShape extends Shape {
1331
+ readonly shapeType: "autoShape";
1332
+ protected xfrm(): Element | null;
1333
+ protected getOrAddXfrm(): Element;
1334
+ get hasTextFrame(): boolean;
1335
+ get textFrame(): TextFrame | null;
1336
+ /**
1337
+ * This shape's placeholder identity (`p:ph` `type`/`idx`), or `null` when it is
1338
+ * not a placeholder. `idx` defaults to `'0'` when the attribute is absent, as
1339
+ * PowerPoint does. Use {@link Slide.placeholder} to find a placeholder by type.
1340
+ */
1341
+ get placeholder(): PlaceholderRef | null;
1342
+ /**
1343
+ * Custom freeform geometry (`spPr/a:custGeom/a:pathLst`), or `null` when the
1344
+ * shape uses preset geometry / none. The faithful, multi-path counterpart of
1345
+ * {@link presetGeometry}: each `a:path` keeps its own path-unit viewport
1346
+ * (`w`/`h`) and ordered {@link GeometryCommand}s. Coordinates are raw path-unit
1347
+ * integers, not EMU — pair the path `w`/`h` with the shape's box size to map
1348
+ * them into slide space.
1349
+ */
1350
+ get customGeometry(): CustomGeometry | null;
1351
+ }
1352
+ //#endregion
1353
+ //#region src/read/api/shapes/picture.d.ts
1354
+ /** A picture (`p:pic`). */
1355
+ declare class Picture extends Shape {
1356
+ #private;
1357
+ readonly shapeType: "picture";
1358
+ protected xfrm(): Element | null;
1359
+ protected getOrAddXfrm(): Element;
1360
+ protected get supportsFill(): boolean;
1361
+ /** Relationship id of the embedded image (`p:blipFill/a:blip/@r:embed`), or `null`. */
1362
+ get imageRelId(): string | null;
1363
+ /**
1364
+ * Repoint the blip at a relationship id already present in the slide's
1365
+ * relationships, without minting a new media part. The caller owns ensuring
1366
+ * the id exists and targets an image; use {@link setImage} to add fresh bytes.
1367
+ */
1368
+ set imageRelId(value: string);
1369
+ /** Absolute partname of the embedded image, resolved via the slide's relationships, or `null`. */
1370
+ get imagePartName(): string | null;
1371
+ /**
1372
+ * Relationship id of the embedded **vector (SVG)** image, read from the
1373
+ * Microsoft SVG blip extension (`a:blip/a:extLst/a:ext/asvg:svgBlip/@r:embed`),
1374
+ * or `null` when the picture has no SVG. PowerPoint usually pairs this with a
1375
+ * raster fallback in `a:blip/@r:embed` ({@link imageRelId}), but some exporters
1376
+ * emit an SVG-only blip where `imageRelId` is absent and only this resolves —
1377
+ * so a reader that wants the real drawn art must consult both.
1378
+ */
1379
+ get svgRelId(): string | null;
1380
+ /** Absolute partname of the embedded SVG image, resolved via the slide's relationships, or `null`. */
1381
+ get svgPartName(): string | null;
1382
+ /**
1383
+ * Which drawable media this picture carries:
1384
+ * - `'raster'` — only a raster blip (`a:blip/@r:embed`);
1385
+ * - `'svg'` — only a vector blip (`asvg:svgBlip/@r:embed`, no raster). This
1386
+ * is what PowerPoint's *Insert → Icons* and a plain SVG insert produce;
1387
+ * - `'both'` — a raster fallback *and* an SVG (PowerPoint's usual pairing);
1388
+ * - `'none'` — a `p:pic` with no embedded blip at all (e.g. a linked image).
1389
+ *
1390
+ * Lets a caller distinguish an SVG-only picture — where {@link imagePartName}
1391
+ * is legitimately `null` — from a genuinely empty one, without two null checks.
1392
+ */
1393
+ get mediaKind(): 'raster' | 'svg' | 'both' | 'none';
1394
+ /**
1395
+ * Absolute partname of whichever part actually carries this picture's drawn
1396
+ * data — the raster part when present, otherwise the SVG part — or `null`
1397
+ * when the picture embeds neither. Use this when you just want "the bytes
1398
+ * this picture shows"; prefer {@link imagePartName} / {@link svgPartName}
1399
+ * (and {@link mediaKind}) when you need to know *which* kind it is. An
1400
+ * SVG-only picture returns its SVG part here even though `imagePartName` is
1401
+ * `null`.
1402
+ */
1403
+ get mediaPartName(): string | null;
1404
+ /**
1405
+ * The picture's crop as fractions of the *source image*, read from
1406
+ * `p:blipFill/a:srcRect` — `{ left, top, right, bottom }`, each the amount
1407
+ * trimmed off that edge (so `0.1` = 10 % cropped away, an uncropped edge is
1408
+ * `0`). `null` when there is no `a:srcRect` at all; an explicit
1409
+ * `{0,0,0,0}` crop still reports zeros, since its presence is meaningful.
1410
+ * The raw attributes are thousandths of a percent; this divides by 100000 to
1411
+ * match the fraction convention used elsewhere in the read API (see
1412
+ * {@link recolor}).
1413
+ */
1414
+ get crop(): {
1415
+ left: number;
1416
+ top: number;
1417
+ right: number;
1418
+ bottom: number;
1419
+ } | null;
1420
+ /**
1421
+ * The picture's blip recolour effect (`p:blipFill/a:blip` recolour child), or
1422
+ * `null` when the blip carries none. Recognises the effects a faithful reader
1423
+ * needs to reproduce a recoloured image: `a:duotone` (the two-stop icon-tint
1424
+ * trick), `a:clrChange`, `a:grayscl`, `a:biLevel`, and `a:alphaModFix`; the
1425
+ * first such effect in document order wins. Colours mirror the
1426
+ * {@link GradientStop} split (`color`/`schemeColor`/`presetColor`) so theme
1427
+ * tokens resolve through {@link Slide.themeContext}. `threshold`/`amount` are
1428
+ * 0–1 fractions. {@link hidden} (the duotone fallback-layer trick) reports the
1429
+ * *visibility* of a recolour source; this reports the *tint* itself.
1430
+ */
1431
+ get recolor(): Recolor | null;
1432
+ /**
1433
+ * Replace this picture's image with new bytes. Mints a fresh media part under
1434
+ * `/ppt/media/`, registers its content type, wires an `image` relationship
1435
+ * from the owning slide, and repoints the blip's `@r:embed` at it.
1436
+ *
1437
+ * Copy-on-write: the previous media part is never mutated or removed, so any
1438
+ * other picture sharing it (common after `importSlide`/dedup) is unaffected;
1439
+ * an orphaned old part is left in place for a later GC pass to prune.
1440
+ *
1441
+ * `contentType` is required (e.g. `image/png`); the bytes are not sniffed.
1442
+ * `extension` defaults from the content type.
1443
+ *
1444
+ * `fit` controls the picture's `a:srcRect` crop against its current frame
1445
+ * extent (`a:xfrm/a:ext`):
1446
+ * - omitted (default): geometry and crop are left untouched — the caller owns
1447
+ * sizing. Note an inherited `a:srcRect` was tuned to the *previous* image's
1448
+ * aspect ratio, so swapping in an image of a different ratio reuses a crop
1449
+ * that no longer fits and the result looks stretched; pass `fit` to refit.
1450
+ * - `'cover'`: fill the frame, cropping the overflowing axis (no distortion).
1451
+ * - `'contain'`: fit the whole image inside the frame, letterboxing the short
1452
+ * axis (no distortion).
1453
+ * - `'stretch'`: drop any crop so the full image is stretched to the frame.
1454
+ *
1455
+ * `'cover'`/`'contain'` measure the new bytes' natural size; if unmeasurable
1456
+ * (e.g. an unknown format) the crop is left as-is and a warning is emitted.
1457
+ */
1458
+ setImage(bytes: Uint8Array, options: {
1459
+ contentType: string;
1460
+ extension?: string;
1461
+ fit?: 'cover' | 'contain' | 'stretch';
1462
+ }): void;
1463
+ }
1464
+ //#endregion
1465
+ //#region src/read/api/shapes/connector.d.ts
1466
+ /** A connector / line (`p:cxnSp`). */
1467
+ declare class Connector extends Shape {
1468
+ #private;
1469
+ readonly shapeType: "connector";
1470
+ protected xfrm(): Element | null;
1471
+ protected getOrAddXfrm(): Element;
1472
+ /**
1473
+ * The connector's **start**-point shape binding (`p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn`),
1474
+ * or `null` when the start point is unbound (a bare `p:cNvCxnSpPr`, i.e. a
1475
+ * connector placed by static endpoint geometry). Mirrors the write API's
1476
+ * `startShape`/`startShapeIdx` split; see {@link endConnection} for the other end.
1477
+ */
1478
+ get startConnection(): ConnectionSite | null;
1479
+ /**
1480
+ * The connector's **end**-point shape binding (`p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn`),
1481
+ * or `null` when the end point is unbound. See {@link startConnection}.
1482
+ */
1483
+ get endConnection(): ConnectionSite | null;
1484
+ }
1485
+ //#endregion
1486
+ //#region src/read/api/chart.d.ts
1487
+ /** A chart axis number format (`c:numFmt`). */
1488
+ interface AxisNumberFormat {
1489
+ /** The format mask (`@formatCode`), e.g. `"General"`, `"0.0%"`. */
1490
+ formatCode: string | null;
1491
+ /** Whether the mask is linked to the source cell format (`@sourceLinked`). */
1492
+ sourceLinked: boolean | null;
1493
+ }
1494
+ /** A chart legend (`c:legend`). */
1495
+ interface ChartLegend {
1496
+ /** Legend position (`c:legendPos/@val`): `r`/`l`/`t`/`b`/`tr`. */
1497
+ position: string | null;
1498
+ /** Whether the legend overlays the plot area (`c:overlay/@val`). */
1499
+ overlay: boolean | null;
1500
+ }
1501
+ /** A chart's data-label settings (`c:dLbls`), read from the first plot group. */
1502
+ interface ChartDataLabels {
1503
+ /** Show the point value (`c:showVal`). */
1504
+ showValue: boolean | null;
1505
+ /** Show the series name (`c:showSerName`). */
1506
+ showSeriesName: boolean | null;
1507
+ /** Show the category name (`c:showCatName`). */
1508
+ showCategoryName: boolean | null;
1509
+ /** Show the percentage (`c:showPercent`). */
1510
+ showPercent: boolean | null;
1511
+ /** Show the legend key swatch (`c:showLegendKey`). */
1512
+ showLegendKey: boolean | null;
1513
+ /** Show the bubble size (`c:showBubbleSize`). */
1514
+ showBubbleSize: boolean | null;
1515
+ /** Show leader lines (`c:showLeaderLines`). */
1516
+ showLeaderLines: boolean | null;
1517
+ /** Label position (`c:dLblPos/@val`), or `null` when auto. */
1518
+ position: string | null;
1519
+ /** Label number format (`c:numFmt`), or `null` when absent. */
1520
+ numberFormat: AxisNumberFormat | null;
1521
+ }
1522
+ /** A series' solid fill (`c:ser/c:spPr`). */
1523
+ interface ChartFill {
1524
+ /** Literal fill colour (`a:srgbClr/@val`), or `null` for a scheme/no fill. */
1525
+ color: string | null;
1526
+ /** Raw scheme-colour token (`a:schemeClr/@val`), unresolved. */
1527
+ schemeColor: string | null;
1528
+ /** Whether the fill is explicitly suppressed (`a:noFill`). */
1529
+ noFill: boolean;
1530
+ }
1531
+ /** A series' line/stroke (`c:ser/c:spPr/a:ln`). */
1532
+ interface ChartLine {
1533
+ /** Stroke width in points (`@w`/12700), or `null` when unset. */
1534
+ widthPt: number | null;
1535
+ /** Dash style (`a:prstDash/@val`), or `null` when solid/unset. */
1536
+ dash: string | null;
1537
+ /** Literal stroke colour (`a:srgbClr/@val`), or `null`. */
1538
+ color: string | null;
1539
+ /** Raw scheme-colour token (`a:schemeClr/@val`), unresolved. */
1540
+ schemeColor: string | null;
1541
+ /** Whether the line is explicitly suppressed (`a:noFill`). */
1542
+ noFill: boolean;
1543
+ }
1544
+ /** A chart graphic-frame's chart, backed by its chart part. */
1545
+ declare class Chart {
1546
+ #private;
1547
+ /** The chart's OPC part (`/ppt/charts/chartN.xml`). */
1548
+ readonly part: Part;
1549
+ constructor(
1550
+ /** The chart's OPC part (`/ppt/charts/chartN.xml`). */
1551
+ part: Part);
1552
+ /** Partname of the chart part. */
1553
+ get partName(): string;
1554
+ /**
1555
+ * The chart-group type tokens present in the plot area, in document order
1556
+ * (e.g. `['line']`, `['bar']`, `['bar', 'line']` for a combo chart). Derived
1557
+ * from the plot-area element local names (`lineChart` → `line`).
1558
+ */
1559
+ get chartTypes(): string[];
1560
+ /** The first chart-group type, or `null` for an empty plot area. */
1561
+ get chartType(): string | null;
1562
+ /** The chart title (`c:chart/c:title` rich text), or `null` when absent/auto. */
1563
+ get title(): string | null;
1564
+ /**
1565
+ * The category/value/series axes (`c:catAx`/`c:valAx`/`c:dateAx`/`c:serAx`)
1566
+ * in plot-area document order. Empty for pie/doughnut charts (no axes).
1567
+ */
1568
+ get axes(): ChartAxis[];
1569
+ /** The category axis (`c:catAx`/`c:dateAx`), or `null` when the chart has none. */
1570
+ get categoryAxis(): ChartAxis | null;
1571
+ /** The (primary) value axis (`c:valAx`), or `null` when the chart has none. */
1572
+ get valueAxis(): ChartAxis | null;
1573
+ /** The legend (`c:chart/c:legend`) position + overlay, or `null` when hidden. */
1574
+ get legend(): ChartLegend | null;
1575
+ /**
1576
+ * The chart-level data-label settings, read from the first plot group's
1577
+ * aggregate `c:dLbls` (the group-wide block after the series). `null` when the
1578
+ * plot group carries no data-label block (e.g. pie via a different builder).
1579
+ */
1580
+ get dataLabels(): ChartDataLabels | null;
1581
+ /** The data series (`c:ser`) across all chart groups, in document order. */
1582
+ get series(): ChartSeries[];
1583
+ /**
1584
+ * Category labels, read from the first series' cached categories
1585
+ * (`c:cat`), as written. Empty when the chart has no category axis.
1586
+ */
1587
+ get categories(): (string | null)[];
1588
+ /** Escape hatch: the underlying `c:chartSpace` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
1589
+ get element_(): Element | null;
1590
+ /** Mark the chart part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
1591
+ markDirty(): void;
1592
+ }
1593
+ /**
1594
+ * One axis (`c:catAx`/`c:valAx`/`c:dateAx`/`c:serAx`) of a chart's plot area.
1595
+ * All four share the scaling/delete/position/tickmark structure; `kind`
1596
+ * distinguishes them.
1597
+ */
1598
+ declare class ChartAxis {
1599
+ #private;
1600
+ private readonly ax;
1601
+ /** The owning chart's OPC part, so {@link markDirty} can reach it from {@link element_}. */
1602
+ private readonly part;
1603
+ constructor(ax: Element,
1604
+ /** The owning chart's OPC part, so {@link markDirty} can reach it from {@link element_}. */
1605
+ part: Part);
1606
+ /** Axis kind derived from the element name: `cat`/`val`/`date`/`ser`. */
1607
+ get kind(): 'cat' | 'val' | 'date' | 'ser' | null;
1608
+ /** Axis id (`c:axId/@val`). */
1609
+ get id(): number | null;
1610
+ /** Scaling orientation (`c:scaling/c:orientation/@val`): `minMax`/`maxMin`. */
1611
+ get orientation(): string | null;
1612
+ /** Scale minimum (`c:scaling/c:min/@val`), or `null` when auto. */
1613
+ get min(): number | null;
1614
+ /** Scale maximum (`c:scaling/c:max/@val`), or `null` when auto. */
1615
+ get max(): number | null;
1616
+ /** Logarithmic scale base (`c:scaling/c:logBase/@val`), or `null` when linear. */
1617
+ get logBase(): number | null;
1618
+ /** Whether the axis is hidden (`c:delete/@val` = 1). */
1619
+ get hidden(): boolean;
1620
+ /** Axis position (`c:axPos/@val`): `b`/`l`/`r`/`t`. */
1621
+ get position(): string | null;
1622
+ /** Whether the axis draws major gridlines (`c:majorGridlines`). */
1623
+ get majorGridlines(): boolean;
1624
+ /** Whether the axis draws minor gridlines (`c:minorGridlines`). */
1625
+ get minorGridlines(): boolean;
1626
+ /** Axis title text (`c:title` rich text), or `null` when absent. */
1627
+ get title(): string | null;
1628
+ /** Axis number format (`c:numFmt`), or `null` when absent. */
1629
+ get numberFormat(): AxisNumberFormat | null;
1630
+ /** Major tick-mark style (`c:majorTickMark/@val`): `out`/`in`/`cross`/`none`. */
1631
+ get majorTickMark(): string | null;
1632
+ /** Minor tick-mark style (`c:minorTickMark/@val`). */
1633
+ get minorTickMark(): string | null;
1634
+ /** Tick-label position (`c:tickLblPos/@val`): `nextTo`/`high`/`low`/`none`. */
1635
+ get tickLabelPosition(): string | null;
1636
+ /** Major unit (`c:majorUnit/@val`), or `null` when auto. */
1637
+ get majorUnit(): number | null;
1638
+ /** Minor unit (`c:minorUnit/@val`), or `null` when auto. */
1639
+ get minorUnit(): number | null;
1640
+ /** Escape hatch: the underlying axis element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
1641
+ get element_(): Element;
1642
+ /** Mark the owning chart part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
1643
+ markDirty(): void;
1644
+ }
1645
+ /** One data series (`c:ser`) of a chart. */
1646
+ declare class ChartSeries {
1647
+ private readonly ser;
1648
+ /** The owning chart's OPC part, so {@link markDirty} can reach it from {@link element_}. */
1649
+ private readonly part;
1650
+ constructor(ser: Element,
1651
+ /** The owning chart's OPC part, so {@link markDirty} can reach it from {@link element_}. */
1652
+ part: Part);
1653
+ /**
1654
+ * Series fill (`c:spPr` solid fill / no-fill). `null` when the series carries
1655
+ * no `c:spPr` or its `c:spPr` declares no fill choice (inherits the theme).
1656
+ */
1657
+ get fill(): ChartFill | null;
1658
+ /**
1659
+ * Series line/stroke (`c:spPr/a:ln`) — width, dash, colour. `null` when the
1660
+ * series `c:spPr` has no `a:ln` (bar/area fills carry no line by default).
1661
+ */
1662
+ get line(): ChartLine | null;
1663
+ /** Series index (`c:idx/@val`), or `null` if absent. */
1664
+ get index(): number | null;
1665
+ /** Series name from the cached `c:tx`, or `null` when unnamed. */
1666
+ get name(): string | null;
1667
+ /** Cached numeric values (`c:val`); non-numeric or missing points are `null`. */
1668
+ get values(): (number | null)[];
1669
+ /** Cached category labels for this series (`c:cat`), as written. */
1670
+ get categories(): (string | null)[];
1671
+ /** Escape hatch: the underlying `c:ser` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
1672
+ get element_(): Element;
1673
+ /** Mark the owning chart part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
1674
+ markDirty(): void;
1675
+ }
1676
+ //#endregion
1677
+ //#region src/read/api/chartex.d.ts
1678
+ /** A chartEx legend (`cx:legend`) — a leaf element carrying position/alignment attributes. */
1679
+ interface ChartExLegend {
1680
+ /** Legend position (`@pos`): `t`/`b`/`l`/`r`. */
1681
+ position: string | null;
1682
+ /** Legend alignment along its edge (`@align`), e.g. `ctr`. */
1683
+ align: string | null;
1684
+ /** Whether the legend overlays the plot area (`@overlay`). */
1685
+ overlay: boolean | null;
1686
+ }
1687
+ /** A chartEx series' data-label toggles (`cx:dataLabels` + its `cx:visibility` child). */
1688
+ interface ChartExDataLabels {
1689
+ /** Label position (`@pos`), e.g. `outEnd`, or `null` when unset. */
1690
+ position: string | null;
1691
+ /** Show the point value (`cx:visibility/@value`). */
1692
+ value: boolean | null;
1693
+ /** Show the series name (`cx:visibility/@seriesName`). */
1694
+ seriesName: boolean | null;
1695
+ /** Show the category name (`cx:visibility/@categoryName`). */
1696
+ categoryName: boolean | null;
1697
+ }
1698
+ /** A chartEx graphic-frame's chart, backed by its `cx:chartSpace` part. */
1699
+ declare class ChartEx {
1700
+ #private;
1701
+ /** The chartEx chart's OPC part (`/ppt/charts/chartEx{N}.xml`). */
1702
+ readonly part: Part;
1703
+ constructor(
1704
+ /** The chartEx chart's OPC part (`/ppt/charts/chartEx{N}.xml`). */
1705
+ part: Part);
1706
+ /** Partname of the chartEx chart part. */
1707
+ get partName(): string;
1708
+ /**
1709
+ * The `cx:series/@layoutId` tokens in plot-area document order — the raw chartEx
1710
+ * layout names (`waterfall`, `funnel`, `treemap`, `sunburst`, `boxWhisker`,
1711
+ * `regionMap`, or `clusteredColumn`/`paretoLine` for histogram & pareto). This is
1712
+ * the OOXML truth: a histogram and a pareto both surface as `clusteredColumn`, so
1713
+ * the token does not always round-trip to the write-side `ChartType`.
1714
+ */
1715
+ get layoutIds(): string[];
1716
+ /** The first series' `@layoutId`, or `null` for an empty plot area. */
1717
+ get layoutId(): string | null;
1718
+ /** The chart title (`cx:chart/cx:title` rich text), or `null` when absent. */
1719
+ get title(): string | null;
1720
+ /** The legend (`cx:chart/cx:legend`) position/alignment, or `null` when hidden. */
1721
+ get legend(): ChartExLegend | null;
1722
+ /** The data series (`cx:plotAreaRegion/cx:series`) in document order. */
1723
+ get series(): ChartExSeries[];
1724
+ /** The plot-area axes (`cx:plotArea/cx:axis`) in document order. */
1725
+ get axes(): ChartExAxis[];
1726
+ /**
1727
+ * Category labels from the first series' cached leaf level (`cx:strDim`'s first
1728
+ * `cx:lvl`). Empty for a category-less layout (a histogram bins raw observations).
1729
+ */
1730
+ get categories(): (string | null)[];
1731
+ /** Escape hatch: the underlying `cx:chartSpace` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
1732
+ get element_(): Element | null;
1733
+ /** Mark the chartEx part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
1734
+ markDirty(): void;
1735
+ /**
1736
+ * The `cx:data` block a series' `cx:dataId` points at (`cx:chartData/cx:data[@id]`),
1737
+ * or `null` when the id is unset or unmatched.
1738
+ */
1739
+ dataElementById(id: number | null): Element | null;
1740
+ }
1741
+ /** One data series (`cx:series`) of a chartEx chart. */
1742
+ declare class ChartExSeries {
1743
+ private readonly ser;
1744
+ private readonly chart;
1745
+ constructor(ser: Element, chart: ChartEx);
1746
+ /** The layout token (`@layoutId`) that keys this series' geometry, e.g. `waterfall`. */
1747
+ get layoutId(): string | null;
1748
+ /** The deterministic series GUID (`@uniqueId`), or `null`. */
1749
+ get uniqueId(): string | null;
1750
+ /**
1751
+ * The owner series index (`@ownerIdx`) for a derived series (a `paretoLine`
1752
+ * derives its data from series 0), or `null` for a self-contained series.
1753
+ */
1754
+ get ownerIndex(): number | null;
1755
+ /** Series name from the cached `cx:tx/cx:txData/cx:v`, or `null` when unnamed. */
1756
+ get name(): string | null;
1757
+ /** The data-block id this series plots (`cx:dataId/@val`), or `null`. */
1758
+ get dataId(): number | null;
1759
+ /** Cached numeric values (`cx:numDim`); non-numeric or missing points are `null`. */
1760
+ get values(): (number | null)[];
1761
+ /**
1762
+ * Cached category labels (`cx:strDim`'s leaf `cx:lvl` — the first level, which
1763
+ * the writer emits leaf-first). Empty when the data block carries no `cx:strDim`.
1764
+ */
1765
+ get categories(): (string | null)[];
1766
+ /** The data-label toggles (`cx:dataLabels`), or `null` when the series shows none. */
1767
+ get dataLabels(): ChartExDataLabels | null;
1768
+ /** Escape hatch: the underlying `cx:series` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
1769
+ get element_(): Element;
1770
+ /** Mark the owning chartEx part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
1771
+ markDirty(): void;
1772
+ }
1773
+ /**
1774
+ * One axis (`cx:axis`) of a chartEx plot area. chartEx axes carry no `catAx`/`valAx`
1775
+ * element-name distinction; the kind is read from the scaling child
1776
+ * (`cx:catScaling` vs `cx:valScaling`).
1777
+ */
1778
+ declare class ChartExAxis {
1779
+ private readonly ax;
1780
+ /** The owning chartEx chart, so {@link markDirty} can reach its part from {@link element_}. */
1781
+ private readonly chart;
1782
+ constructor(ax: Element,
1783
+ /** The owning chartEx chart, so {@link markDirty} can reach its part from {@link element_}. */
1784
+ chart: ChartEx);
1785
+ /** Axis id (`@id`), the value a series' `cx:axisId` binds to. */
1786
+ get id(): number | null;
1787
+ /** Axis kind from its scaling child: `cat` (`cx:catScaling`) / `val` (`cx:valScaling`). */
1788
+ get kind(): 'cat' | 'val' | null;
1789
+ /**
1790
+ * Category-axis gap width (`cx:catScaling/@gapWidth`) as a fraction (1.0 = 100%,
1791
+ * the chartEx convention, unlike the classic integer percent), or `null`.
1792
+ */
1793
+ get gapWidth(): number | null;
1794
+ /** Value-axis scale minimum (`cx:valScaling/@min`), or `null` when auto. */
1795
+ get min(): number | null;
1796
+ /** Value-axis scale maximum (`cx:valScaling/@max`), or `null` when auto. */
1797
+ get max(): number | null;
1798
+ /** Whether the axis draws major gridlines (`cx:majorGridlines`). */
1799
+ get majorGridlines(): boolean;
1800
+ /** Whether the axis draws tick labels (`cx:tickLabels`). */
1801
+ get tickLabels(): boolean;
1802
+ /** Escape hatch: the underlying `cx:axis` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
1803
+ get element_(): Element;
1804
+ /** Mark the owning chartEx part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
1805
+ markDirty(): void;
1806
+ }
1807
+ //#endregion
1808
+ //#region src/read/api/table-style-resolve.d.ts
1809
+ /**
1810
+ * The `a:tblPr` condition flags that gate which style parts apply to a table.
1811
+ * `firstRow`/`bandRow` are the ones PowerPoint turns on by default; the rest are
1812
+ * off unless the author enabled the corresponding "Header Column" / "Total Row" /
1813
+ * "Banded Columns" toggle.
1814
+ */
1815
+ interface TableConditionFlags {
1816
+ firstRow: boolean;
1817
+ lastRow: boolean;
1818
+ firstCol: boolean;
1819
+ lastCol: boolean;
1820
+ bandRow: boolean;
1821
+ bandCol: boolean;
1822
+ }
1823
+ /** A table's resolved entry in `tableStyles.xml`: its GUID, display name, and raw element. */
1824
+ interface ResolvedTableStyle {
1825
+ /** The matched `@styleId` GUID (e.g. `{5C22544A-…}`). */
1826
+ styleId: string;
1827
+ /** The style's display name (`@styleName`, e.g. `Medium Style 2 - Accent 1`), or `null`. */
1828
+ name: string | null;
1829
+ /** Escape hatch: the underlying `a:tblStyle` element. After mutating it call {@link ResolvedTableStyle.markDirty}, or `save()` writes the original bytes. */
1830
+ element_: Element;
1831
+ /**
1832
+ * Mark `tableStyles.xml` dirty so `save()` reserializes it. Call after mutating
1833
+ * {@link ResolvedTableStyle.element_}. Note the part is deck-wide: an edit here
1834
+ * reaches every table bound to this style.
1835
+ */
1836
+ markDirty(): void;
1837
+ }
1838
+ //#endregion
1839
+ //#region src/read/api/table.d.ts
1840
+ /**
1841
+ * The context a cell needs to resolve its style-graph fill: the table's resolved
1842
+ * `a:tblStyle`, its condition flags, and the grid dimensions. Threaded from
1843
+ * {@link Table} down to each {@link TableCell} alongside the cell's own position.
1844
+ * `null` when the table references no resolvable style.
1845
+ */
1846
+ interface TableCellStyleContext {
1847
+ style: ResolvedTableStyle;
1848
+ flags: TableConditionFlags;
1849
+ rowCount: number;
1850
+ colCount: number;
1851
+ ctx: FlattenContext;
1852
+ }
1853
+ /**
1854
+ * One edge border of a table cell (`a:tcPr/a:lnL|lnR|lnT|lnB|lnTlToBr|lnBlToTr`).
1855
+ * Mirrors the `a:ln`-style decode used for shape strokes: {@link widthPt} from
1856
+ * `@w` (EMU → points), {@link dash} from `a:prstDash/@val`, and the stroke colour
1857
+ * split into a resolved {@link color} (literal hex) and the raw {@link schemeColor}
1858
+ * token — the cell-border counterpart of a shape's line accessors.
1859
+ */
1860
+ interface CellBorder {
1861
+ /** Border width in points (`@w` is EMU; 12700 EMU = 1pt), or `null` when unset. */
1862
+ widthPt: number | null;
1863
+ /** Dash style (`a:prstDash/@val`, e.g. `solid`/`sysDash`), or `null` when unset. */
1864
+ dash: string | null;
1865
+ /** The stroke colour resolved against the table theme to a literal hex (`effectiveHex`), or `null`. */
1866
+ color: string | null;
1867
+ /** Raw `schemeClr` token of the stroke (`a:solidFill/a:schemeClr/@val`), or `null` for an srgb/absent colour. */
1868
+ schemeColor: string | null;
1869
+ /** `true` when the edge is an explicit no-border (`a:noFill`) — a deliberately suppressed side. */
1870
+ noFill: boolean;
1871
+ }
1872
+ /**
1873
+ * A table cell's six possible borders, keyed by edge. Each side is `null` when the
1874
+ * cell defines no line for it; the diagonals ({@link tlToBr} `╲`, {@link blToTr} `╱`)
1875
+ * are rarely authored. The whole object is `null` when the cell carries no border
1876
+ * element at all (see {@link TableCell.borders}).
1877
+ */
1878
+ interface CellBorders {
1879
+ left: CellBorder | null;
1880
+ right: CellBorder | null;
1881
+ top: CellBorder | null;
1882
+ bottom: CellBorder | null;
1883
+ tlToBr: CellBorder | null;
1884
+ blToTr: CellBorder | null;
1885
+ }
1886
+ /** A table: a grid of rows and cells inside a graphic frame. */
1887
+ declare class Table {
1888
+ #private;
1889
+ private readonly tbl;
1890
+ private readonly part;
1891
+ /** The owning slide's theme colour context, threaded to each cell's text for `Run.resolvedColor`. */
1892
+ private readonly themeColors?;
1893
+ /** The deck package, for resolving `a:tableStyleId` against `tableStyles.xml` (style-graph cell fills). */
1894
+ private readonly opc?;
1895
+ /** The owning slide's relationships, for resolving a cell picture fill's `r:embed` to a partname. */
1896
+ private readonly rels?;
1897
+ constructor(tbl: Element, part: Part,
1898
+ /** The owning slide's theme colour context, threaded to each cell's text for `Run.resolvedColor`. */
1899
+ themeColors?: FlattenContext | undefined,
1900
+ /** The deck package, for resolving `a:tableStyleId` against `tableStyles.xml` (style-graph cell fills). */
1901
+ opc?: OpcPackage | undefined,
1902
+ /** The owning slide's relationships, for resolving a cell picture fill's `r:embed` to a partname. */
1903
+ rels?: Relationships | undefined);
1904
+ /** The table's rows (`a:tr`) in document (top-to-bottom) order. */
1905
+ get rows(): TableRow[];
1906
+ /**
1907
+ * The table's style graph entry (`styleId`, `name`, raw `a:tblStyle`) resolved
1908
+ * from the deck's `tableStyles.xml`, or `null` when the table names no
1909
+ * `a:tableStyleId`, the deck has no `tableStyles.xml`, or the id is a built-in
1910
+ * `[MS-OE376]` style the deck does not materialise. This is what supplies the
1911
+ * banded-row / header shading a cell with no own fill inherits — read the
1912
+ * resolved per-cell colour off {@link TableCell.resolvedFill}.
1913
+ */
1914
+ get resolvedStyle(): ResolvedTableStyle | null;
1915
+ /** Number of rows (`a:tr`). */
1916
+ get rowCount(): number;
1917
+ /** Number of grid columns (`a:tblGrid/a:gridCol`). */
1918
+ get columnCount(): number;
1919
+ /** Column widths in EMU (`a:gridCol/@w`), one per grid column. */
1920
+ get columnWidths(): (number | null)[];
1921
+ /**
1922
+ * The table's style GUID (`a:tblPr/a:tableStyleId` text), e.g.
1923
+ * `{5940675A-B579-460E-94D1-54222C63F5DA}`, or `null` when the table carries no
1924
+ * `a:tableStyleId`. This is the reference into `ppt/tableStyles.xml` (or a
1925
+ * built-in `[MS-OE376]` style) that supplies the banded-row / header shading the
1926
+ * `firstRow`/`bandRow` flags activate — without it a replica loses the whole
1927
+ * table style, so it is the read counterpart of the writer's `tableStyle` option.
1928
+ */
1929
+ get styleId(): string | null;
1930
+ /** Whether the first row is styled as a header (`a:tblPr/@firstRow`). */
1931
+ get firstRowHeader(): boolean;
1932
+ /** Whether rows are banded (`a:tblPr/@bandRow`). */
1933
+ get bandedRows(): boolean;
1934
+ /**
1935
+ * The cell at `(rowIndex, columnIndex)` (both zero-based), or `null` when out
1936
+ * of range. Column index counts `a:tc` elements in the row, so a cell that
1937
+ * spans columns (`gridSpan`) occupies a single index here.
1938
+ */
1939
+ cell(rowIndex: number, columnIndex: number): TableCell | null;
1940
+ /** Escape hatch: the underlying `a:tbl` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
1941
+ get element_(): Element;
1942
+ /** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
1943
+ markDirty(): void;
1944
+ }
1945
+ /** One table row (`a:tr`). */
1946
+ declare class TableRow {
1947
+ private readonly tr;
1948
+ private readonly part;
1949
+ /** The owning slide's theme colour context, threaded to each {@link TableCell}. */
1950
+ private readonly themeColors?;
1951
+ /** The table's style-resolution context, threaded to each cell for {@link TableCell.resolvedFill}. */
1952
+ private readonly style?;
1953
+ /** This row's zero-based index in the table, for style-graph banding/edge conditions. */
1954
+ private readonly rowIndex;
1955
+ /** The owning slide's relationships, threaded to each cell for {@link TableCell.pictureFill}. */
1956
+ private readonly rels?;
1957
+ constructor(tr: Element, part: Part,
1958
+ /** The owning slide's theme colour context, threaded to each {@link TableCell}. */
1959
+ themeColors?: FlattenContext | undefined,
1960
+ /** The table's style-resolution context, threaded to each cell for {@link TableCell.resolvedFill}. */
1961
+ style?: (TableCellStyleContext | null) | undefined,
1962
+ /** This row's zero-based index in the table, for style-graph banding/edge conditions. */
1963
+ rowIndex?: number,
1964
+ /** The owning slide's relationships, threaded to each cell for {@link TableCell.pictureFill}. */
1965
+ rels?: Relationships | undefined);
1966
+ /** The row's cells (`a:tc`) in left-to-right order. */
1967
+ get cells(): TableCell[];
1968
+ /** Row height in EMU (`a:tr/@h`), or `null` if unset. */
1969
+ get heightEmu(): number | null;
1970
+ /** Escape hatch: the underlying `a:tr` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
1971
+ get element_(): Element;
1972
+ /** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
1973
+ markDirty(): void;
1974
+ }
1975
+ /** One table cell (`a:tc`). */
1976
+ declare class TableCell {
1977
+ #private;
1978
+ private readonly tc;
1979
+ private readonly part;
1980
+ /** The owning slide's theme colour context, threaded to the cell's text for `Run.resolvedColor`. */
1981
+ private readonly themeColors?;
1982
+ /** The table's style-resolution context, for the {@link resolvedFill} style-graph fallback. */
1983
+ private readonly style?;
1984
+ /** This cell's zero-based row index in the table. */
1985
+ private readonly rowIndex;
1986
+ /** This cell's zero-based column index in its row. */
1987
+ private readonly colIndex;
1988
+ /** The owning slide's relationships, for resolving {@link pictureFill}'s `r:embed` to a partname. */
1989
+ private readonly rels?;
1990
+ constructor(tc: Element, part: Part,
1991
+ /** The owning slide's theme colour context, threaded to the cell's text for `Run.resolvedColor`. */
1992
+ themeColors?: FlattenContext | undefined,
1993
+ /** The table's style-resolution context, for the {@link resolvedFill} style-graph fallback. */
1994
+ style?: (TableCellStyleContext | null) | undefined,
1995
+ /** This cell's zero-based row index in the table. */
1996
+ rowIndex?: number,
1997
+ /** This cell's zero-based column index in its row. */
1998
+ colIndex?: number,
1999
+ /** The owning slide's relationships, for resolving {@link pictureFill}'s `r:embed` to a partname. */
2000
+ rels?: Relationships | undefined);
2001
+ /** The cell's text frame (`a:txBody`); `null` only if the cell has none (non-conformant). */
2002
+ get textFrame(): TextFrame | null;
2003
+ /** The cell's text, paragraphs joined by `\n`. */
2004
+ get text(): string;
2005
+ /**
2006
+ * Replace the cell's text with a single paragraph and run, preserving the
2007
+ * formatting (`a:rPr`) of the cell's first existing run when there is one.
2008
+ * For finer control (multiple runs, per-run formatting), edit
2009
+ * `textFrame.paragraphs[].runs[]` directly.
2010
+ */
2011
+ set text(value: string);
2012
+ /**
2013
+ * The cell's solid fill resolved against the table's theme colour context to a
2014
+ * literal hex — the table-cell counterpart of
2015
+ * {@link import('./shapes.js').AutoShape.resolvedFill}. The cell's own
2016
+ * `a:tcPr/a:solidFill` wins; when the cell defines none, this falls back to the
2017
+ * table **style** graph (the `firstRow`/banded/`wholeTbl` shading the
2018
+ * `a:tableStyleId` supplies — see {@link Table.resolvedStyle}), so a styled cell
2019
+ * with an empty `a:tcPr` reports the colour PowerPoint actually renders rather
2020
+ * than `null`.
2021
+ *
2022
+ * A cell that carries *some other* fill choice (`a:blipFill`/`a:gradFill`/
2023
+ * `a:pattFill`/`a:noFill`) overrides the style graph in PowerPoint, so this
2024
+ * reports `null` for one rather than falling through to the inherited shading —
2025
+ * the same guard {@link import('./shapes.js').AutoShape.resolvedFill} applies to
2026
+ * the style matrix. Read {@link pictureFill} for an image-filled cell. Also
2027
+ * `null` with no theme context, or when neither source yields a solid colour (an
2028
+ * unmapped token, an explicit style `a:noFill`). The returned
2029
+ * {@link ResolvedColor} carries `effectiveHex` (the base colour with its
2030
+ * `lumMod`/`lumOff`/… transforms applied) — read that for the final colour.
2031
+ */
2032
+ get resolvedFill(): ResolvedColor | null;
2033
+ /**
2034
+ * The cell's picture (image) fill (`a:tcPr/a:blipFill`), or `null` when the cell
2035
+ * is not image-filled. The cell counterpart of
2036
+ * {@link import('./shapes.js').AutoShape.pictureFill}: {@link resolvedFill}
2037
+ * decodes only solid colours, so without this an image-filled cell is
2038
+ * indistinguishable from an empty one. Carries the embedded image
2039
+ * ({@link PictureFill.relId}/{@link PictureFill.partName}) plus the stretch/tile
2040
+ * geometry; {@link PictureFill.partName} needs the owning slide's relationships,
2041
+ * which a {@link Table} built without them cannot supply.
2042
+ */
2043
+ get pictureFill(): PictureFill | null;
2044
+ /**
2045
+ * The raw `schemeClr` token of the cell's solid fill (`a:tcPr/a:solidFill/a:schemeClr/@val`),
2046
+ * e.g. `accent1`/`bg1`, or `null` when the fill is absent or an explicit `srgbClr`.
2047
+ * The resolved literal is {@link resolvedFill}; this is the unresolved reference.
2048
+ */
2049
+ get fillSchemeColor(): string | null;
2050
+ /**
2051
+ * The cell's edge borders (`a:tcPr/a:lnL|lnR|lnT|lnB|lnTlToBr|lnBlToTr`), or
2052
+ * `null` when the cell defines none. Each present edge decodes to a
2053
+ * {@link CellBorder} (width / dash / resolved + raw colour / suppressed flag);
2054
+ * absent edges are `null`. Cell borders are the biggest visible table gap — a
2055
+ * replica built only from geometry and fill draws every cell edge-to-edge with
2056
+ * no rule, so this surfaces the per-side stroke the writer's `border` option emits.
2057
+ */
2058
+ get borders(): CellBorders | null;
2059
+ /**
2060
+ * The cell's text direction (`a:tcPr/@vert`), e.g. `vert270` for a bottom-to-top
2061
+ * vertical label, or `null` for default horizontal text.
2062
+ */
2063
+ get verticalText(): string | null;
2064
+ /**
2065
+ * The cell's vertical text anchor (`a:tcPr/@anchor`): `t`/`ctr`/`b` (top/middle/
2066
+ * bottom), or `null` when unset (PowerPoint defaults to top).
2067
+ */
2068
+ get anchor(): string | null;
2069
+ /**
2070
+ * The cell's text insets in EMU (`a:tcPr/@marL`/`@marR`/`@marT`/`@marB`), or
2071
+ * `null` when the cell sets none. Each side is `null` when only some are set.
2072
+ */
2073
+ get marginsEmu(): {
2074
+ left: number | null;
2075
+ right: number | null;
2076
+ top: number | null;
2077
+ bottom: number | null;
2078
+ } | null;
2079
+ /** Number of grid columns this cell spans (`a:tc/@gridSpan`), default 1. */
2080
+ get gridSpan(): number;
2081
+ /** Number of rows this cell spans (`a:tc/@rowSpan`), default 1. */
2082
+ get rowSpan(): number;
2083
+ /** Whether this cell is a continuation of a merge (`@hMerge` or `@vMerge`), i.e. not the merge origin. */
2084
+ get isMergeContinuation(): boolean;
2085
+ /** Escape hatch: the underlying `a:tc` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
2086
+ get element_(): Element;
2087
+ /** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
2088
+ markDirty(): void;
2089
+ }
2090
+ //#endregion
2091
+ //#region src/read/api/shapes/graphic-frame.d.ts
2092
+ /** A graphic frame (`p:graphicFrame`) — host for tables and charts. */
2093
+ declare class GraphicFrame extends Shape {
2094
+ #private;
2095
+ readonly shapeType: "graphicFrame";
2096
+ protected xfrm(): Element | null;
2097
+ protected getOrAddXfrm(): Element;
2098
+ protected getOrAddProperties(): ShapeProperties;
2099
+ /** Whether this frame hosts a table (`a:graphicData/@uri` is the table URI). */
2100
+ get hasTable(): boolean;
2101
+ /** Whether this frame hosts a classic chart (`a:graphicData/@uri` is the chart URI). */
2102
+ get hasChart(): boolean;
2103
+ /** Whether this frame hosts a chartEx chart (`a:graphicData/@uri` is the chartEx URI). */
2104
+ get hasChartEx(): boolean;
2105
+ /** The hosted table, or `null` when this frame is not a table. */
2106
+ get table(): Table | null;
2107
+ /** The hosted chart, or `null` when this frame is not a chart or its part is missing. */
2108
+ get chart(): Chart | null;
2109
+ /**
2110
+ * The hosted chartEx chart (waterfall/funnel/treemap/…), or `null` when this
2111
+ * frame is not a chartEx chart or its part is missing. The reference child is
2112
+ * `cx:chart` (not the classic `c:chart`), carrying the MS `chartEx` rel id.
2113
+ */
2114
+ get chartEx(): ChartEx | null;
2115
+ }
2116
+ //#endregion
2117
+ //#region src/read/api/shapes.d.ts
2118
+ /**
2119
+ * A group shape (`p:grpSp`) — contains nested shapes.
2120
+ *
2121
+ * It is the one kind defined here rather than under `./shapes/`: its `shapes` getter recurses
2122
+ * through `buildShapes` below, so putting it in a sibling module would make the dispatch and the
2123
+ * group import each other.
2124
+ */
2125
+ declare class GroupShape extends Shape {
2126
+ #private;
2127
+ readonly shapeType: "group";
2128
+ protected xfrm(): Element | null;
2129
+ protected getOrAddXfrm(): Element;
2130
+ protected properties(): Element | null;
2131
+ protected getOrAddProperties(): ShapeProperties;
2132
+ /** The shapes nested directly inside this group, in document order. */
2133
+ get shapes(): AnyShape[];
2134
+ }
2135
+ /**
2136
+ * The concrete shape kinds as a discriminated union keyed on the
2137
+ * {@link Shape.shapeType} literal. The read API (`Slide.shapes`,
2138
+ * `Slide.shapeById`, `GroupShape.shapes`, `Presentation.importShape`, …) returns
2139
+ * this rather than the abstract {@link Shape} base, so a consumer can narrow to a
2140
+ * subtype by its discriminant and reach the subtype-only members — e.g.
2141
+ * `if (shape.shapeType === 'graphicFrame') shape.chart` or, equivalently, the
2142
+ * {@link isGraphicFrame} guard. The abstract {@link Shape} base is still exported
2143
+ * for the "common members only" case and for `instanceof` checks.
2144
+ */
2145
+ type AnyShape = AutoShape | Picture | Connector | GraphicFrame | GroupShape;
2146
+ /** Narrow a shape to an {@link AutoShape} (`p:sp` — auto shape, text box, or placeholder). */
2147
+ declare function isAutoShape(shape: Shape): shape is AutoShape;
2148
+ /** Narrow a shape to a {@link Picture} (`p:pic`). */
2149
+ declare function isPicture(shape: Shape): shape is Picture;
2150
+ /** Narrow a shape to a {@link Connector} (`p:cxnSp`). */
2151
+ declare function isConnector(shape: Shape): shape is Connector;
2152
+ /** Narrow a shape to a {@link GraphicFrame} (`p:graphicFrame` — table/chart host). */
2153
+ declare function isGraphicFrame(shape: Shape): shape is GraphicFrame;
2154
+ /** Narrow a shape to a {@link GroupShape} (`p:grpSp`). */
2155
+ declare function isGroupShape(shape: Shape): shape is GroupShape;
2156
+ //#endregion
2157
+ //#region src/read/api/notes.d.ts
2158
+ /**
2159
+ * One placeholder shape (`p:sp`) of a notes slide. A notes slide holds a fixed set:
2160
+ * the slide thumbnail (`type="sldImg"`), the notes body (`type="body"`), and the
2161
+ * slide number (`type="sldNum"`). Geometry getters read the placeholder's *own*
2162
+ * `a:xfrm` and are `null` when it inherits geometry from the notesMaster (the case
2163
+ * on an authored deck, whose `sldImg`/`sldNum` carry an empty `p:spPr`).
2164
+ */
2165
+ declare class NotesPlaceholder {
2166
+ #private;
2167
+ private readonly sp;
2168
+ private readonly part;
2169
+ /** The notes theme context (notesMaster → `theme2.xml`), threaded to {@link textFrame}. */
2170
+ private readonly themeContext;
2171
+ /** The notes part's relationships, threaded to {@link textFrame} for hyperlink resolution. */
2172
+ private readonly relationships;
2173
+ constructor(sp: Element, part: Part,
2174
+ /** The notes theme context (notesMaster → `theme2.xml`), threaded to {@link textFrame}. */
2175
+ themeContext: FlattenContext,
2176
+ /** The notes part's relationships, threaded to {@link textFrame} for hyperlink resolution. */
2177
+ relationships: Relationships);
2178
+ /** Placeholder type (`p:ph/@type`: `sldImg` | `body` | `sldNum`), or `null` when absent. */
2179
+ get type(): string | null;
2180
+ /** Placeholder index (`p:ph/@idx`), or `null` when unset. */
2181
+ get idx(): string | null;
2182
+ /** Shape name (`p:cNvPr/@name`), or `''` when unnamed. */
2183
+ get name(): string;
2184
+ /** Drawing id (`p:cNvPr/@id`), or `null` when absent. */
2185
+ get id(): number | null;
2186
+ /** Left edge in EMU (`a:off/@x`), or `null` when geometry is inherited (no own `a:xfrm`). */
2187
+ get left(): number | null;
2188
+ /** Top edge in EMU (`a:off/@y`), or `null` when geometry is inherited. */
2189
+ get top(): number | null;
2190
+ /** Width in EMU (`a:ext/@cx`), or `null` when geometry is inherited. */
2191
+ get width(): number | null;
2192
+ /** Height in EMU (`a:ext/@cy`), or `null` when geometry is inherited. */
2193
+ get height(): number | null;
2194
+ /**
2195
+ * The placeholder's text as a navigable {@link TextFrame} (`p:txBody`), or `null`
2196
+ * when it carries no text body (the `sldImg` thumbnail). The body placeholder's
2197
+ * runs round-trip a slide's authored notes; the `sldNum` placeholder's frame
2198
+ * holds the slide-number `a:fld`, whose value surfaces through `TextFrame.text`.
2199
+ */
2200
+ get textFrame(): TextFrame | null;
2201
+ /** The placeholder's flattened text (paragraphs joined by `\n`), or `''` when it has no text body. */
2202
+ get text(): string;
2203
+ /** Escape hatch: the underlying `p:sp` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
2204
+ get element_(): Element;
2205
+ /** Mark the owning notes-slide part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
2206
+ markDirty(): void;
2207
+ }
2208
+ /**
2209
+ * A slide's speaker-notes slide (`notesSlideN.xml`) as a modeled object — the deep
2210
+ * companion to {@link import('./slide.js').Slide.notesText}. Exposes the notes
2211
+ * shape tree as {@link NotesPlaceholder}s ({@link body}/{@link slideImage}/
2212
+ * {@link slideNumber}) plus the body {@link textFrame} the older getters flatten.
2213
+ *
2214
+ * The theme context (notesMaster → `theme2.xml`) is resolved once and shared across
2215
+ * every placeholder's text frame.
2216
+ */
2217
+ declare class NotesSlide {
2218
+ #private;
2219
+ private readonly opc;
2220
+ /** The notes slide's OPC part (`/ppt/notesSlides/notesSlideN.xml`). */
2221
+ readonly part: Part;
2222
+ constructor(opc: OpcPackage,
2223
+ /** The notes slide's OPC part (`/ppt/notesSlides/notesSlideN.xml`). */
2224
+ part: Part);
2225
+ /** Partname of the notes slide part. */
2226
+ get partName(): string;
2227
+ /**
2228
+ * The notes theme context, resolved through the notesMaster → `theme2.xml` chain
2229
+ * and cached. Backs {@link NotesPlaceholder.textFrame}'s `Run.resolvedColor`.
2230
+ */
2231
+ themeContext(): FlattenContext;
2232
+ /** The placeholders (`p:sp`) in the notes shape tree, in document order. */
2233
+ get placeholders(): NotesPlaceholder[];
2234
+ /** The notes body placeholder (`p:ph type="body"`), or `null` when the notes slide has none. */
2235
+ get body(): NotesPlaceholder | null;
2236
+ /** The slide-thumbnail placeholder (`p:ph type="sldImg"`), or `null` when absent. */
2237
+ get slideImage(): NotesPlaceholder | null;
2238
+ /** The slide-number placeholder (`p:ph type="sldNum"`, carrying the slide-number field), or `null`. */
2239
+ get slideNumber(): NotesPlaceholder | null;
2240
+ /** The notes body as a navigable {@link TextFrame}, or `null` when there is no body text frame. */
2241
+ get textFrame(): TextFrame | null;
2242
+ /** The notes body text flattened (paragraphs joined by `\n`), or `''` when the body is empty/absent. */
2243
+ get text(): string;
2244
+ }
2245
+ //#endregion
2246
+ //#region src/read/api/comments.d.ts
2247
+ /** One entry of the deck-wide comment-author registry (`p:cmAuthor`). */
2248
+ interface CommentAuthor {
2249
+ /** Author id (`@id`), referenced by each comment's `@authorId`. */
2250
+ id: number | null;
2251
+ /** Display name (`@name`). */
2252
+ name: string;
2253
+ /** Initials shown in the comment marker (`@initials`). */
2254
+ initials: string;
2255
+ /** Highest per-author comment index used (`@lastIdx`). */
2256
+ lastIdx: number | null;
2257
+ /** Author colour slot (`@clrIdx`). */
2258
+ clrIdx: number | null;
2259
+ }
2260
+ /** One legacy review comment (`p:cm`), with its author resolved via the registry. */
2261
+ interface Comment {
2262
+ /** Resolved author display name (via `@authorId` → `commentAuthors.xml`), or `null` when unresolved. */
2263
+ author: string | null;
2264
+ /** Resolved author initials, or `null` when unresolved. */
2265
+ authorInitials: string | null;
2266
+ /** The comment's `@authorId`, or `null` when absent/unparseable. */
2267
+ authorId: number | null;
2268
+ /** The comment's per-author 1-based index (`@idx`), or `null` when absent. */
2269
+ idx: number | null;
2270
+ /** The comment body text (`p:text`). */
2271
+ text: string;
2272
+ /** Marker X position in EMU (`p:pos/@x`), or `null` when absent. */
2273
+ x: number | null;
2274
+ /** Marker Y position in EMU (`p:pos/@y`), or `null` when absent. */
2275
+ y: number | null;
2276
+ /** Authored timestamp (`@dt`, ISO-8601 as written), or `null` when absent. */
2277
+ date: string | null;
2278
+ }
2279
+ /** One entry of the modern deck-wide author registry (`p188:author`). */
2280
+ interface ModernCommentAuthor {
2281
+ /** Author id (`@id`) — a GUID string like `{E8A64ABA-…}`, referenced by each comment's `@authorId`. */
2282
+ id: string | null;
2283
+ /** Display name (`@name`). */
2284
+ name: string;
2285
+ /** Initials (`@initials`). */
2286
+ initials: string;
2287
+ /** Account identifier (`@userId`, e.g. an email), or `null`. */
2288
+ userId: string | null;
2289
+ /** Identity provider (`@providerId`, e.g. `Windows Live`), or `null`. */
2290
+ providerId: string | null;
2291
+ }
2292
+ /** One modern comment or reply (`p188:cm` / `p188:reply`), with its author resolved via the registry. */
2293
+ interface ModernComment {
2294
+ /** The comment's own GUID id (`@id`), or `null` when absent. */
2295
+ id: string | null;
2296
+ /** Resolved author display name (via `@authorId` → `authors.xml`), or `null` when unresolved. */
2297
+ author: string | null;
2298
+ /** Resolved author initials, or `null` when unresolved. */
2299
+ authorInitials: string | null;
2300
+ /** The comment's `@authorId` GUID, or `null` when absent. */
2301
+ authorId: string | null;
2302
+ /** Creation timestamp (`@created`, ISO-8601 as written), or `null` when absent. */
2303
+ created: string | null;
2304
+ /** The comment body text; multiple paragraphs are joined with `\n`. */
2305
+ text: string;
2306
+ /** Marker X position in EMU (`p188:pos/@x`), or `null` (replies carry no position). */
2307
+ x: number | null;
2308
+ /** Marker Y position in EMU (`p188:pos/@y`), or `null` (replies carry no position). */
2309
+ y: number | null;
2310
+ /** Nested replies in thread order; each is itself a {@link ModernComment} with no further replies. */
2311
+ replies: ModernComment[];
2312
+ }
2313
+ /** Which comment schema a deck carries. `'none'` when it has neither part. */
2314
+ type CommentSchema = 'legacy' | 'modern' | 'none';
2315
+ //#endregion
2316
+ //#region src/read/api/tags.d.ts
2317
+ /** One programmatic tag (`p:tag`) — a name/value string pair. */
2318
+ interface Tag {
2319
+ /** The tag's `@name`. */
2320
+ name: string;
2321
+ /** The tag's `@val`. */
2322
+ val: string;
2323
+ }
2324
+ /**
2325
+ * Read every tag referenced by `ownerPartName` (a slide part or the presentation
2326
+ * part), resolving the owner's `tags` relationship(s) to their `ppt/tags/tagN.xml`
2327
+ * part(s) and flattening each part's `p:tag` children into `{ name, val }`. `[]`
2328
+ * when the owner references no tag part. Rel-driven rather than walking
2329
+ * `p:custDataLst`, so it is robust to element ordering in the owner.
2330
+ */
2331
+ declare function readTagsForPart(opc: OpcPackage, ownerPartName: string): Tag[];
2332
+ //#endregion
2333
+ //#region src/read/api/chrome.d.ts
2334
+ /** The 12 theme colour-scheme slots (`a:clrScheme` children), in schema order. */
2335
+ type ThemeColorSlot = 'dk1' | 'lt1' | 'dk2' | 'lt2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6' | 'hlink' | 'folHlink';
2336
+ /** The 12 colour-map tokens (`p:clrMap` attributes), each pointing at a {@link ThemeColorSlot}. */
2337
+ type ColorMapToken = 'bg1' | 'tx1' | 'bg2' | 'tx2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6' | 'hlink' | 'folHlink';
2338
+ /**
2339
+ * One theme font family (`a:majorFont` or `a:minorFont`): the primary Latin face
2340
+ * plus the East-Asian and complex-script faces. Each is `null` when the theme
2341
+ * leaves that slot empty (`typeface=""`, PowerPoint's default for `ea`/`cs`). The
2342
+ * per-script `<a:font>` fallback list is not decoded here.
2343
+ */
2344
+ interface ThemeFontFace {
2345
+ /** `<a:latin@typeface>` — the primary face (e.g. `Calibri Light`), or `null` when empty. */
2346
+ latin: string | null;
2347
+ /** `<a:ea@typeface>` — the East-Asian face, or `null` when empty. */
2348
+ ea: string | null;
2349
+ /** `<a:cs@typeface>` — the complex-script face, or `null` when empty. */
2350
+ cs: string | null;
2351
+ }
2352
+ /** A theme's `a:fontScheme`: its name plus the major (heading) and minor (body) font families. */
2353
+ interface ThemeFontScheme {
2354
+ /** `<a:fontScheme@name>` (e.g. `Office`), or `null` when unnamed. */
2355
+ name: string | null;
2356
+ /** The `a:majorFont` family — the heading (`+mj-*`) fonts. */
2357
+ major: ThemeFontFace;
2358
+ /** The `a:minorFont` family — the body (`+mn-*`) fonts. */
2359
+ minor: ThemeFontFace;
2360
+ }
2361
+ /**
2362
+ * A deck's theme part (`theme1.xml`) as a modeled object. Exposes the two property
2363
+ * tiers a slide resolves against: the {@link colorScheme} (the 12 `a:clrScheme`
2364
+ * slots as literal hex, `a:sysClr` resolved via its `lastClr`) and the
2365
+ * {@link fontScheme} (major/minor Latin/EA/CS faces). Reachable from
2366
+ * {@link SlideMaster.theme} and `Slide.theme`.
2367
+ */
2368
+ declare class Theme {
2369
+ #private;
2370
+ /** The theme's OPC part (`/ppt/theme/themeN.xml`). */
2371
+ readonly part: Part;
2372
+ constructor(
2373
+ /** The theme's OPC part (`/ppt/theme/themeN.xml`). */
2374
+ part: Part);
2375
+ /** Partname of the theme part. */
2376
+ get partName(): string;
2377
+ /** Theme name (`a:theme/@name`, e.g. `Office Theme`), or `null` when unnamed. */
2378
+ get name(): string | null;
2379
+ /** Colour-scheme name (`a:clrScheme/@name`, e.g. `Office`), or `null`. */
2380
+ get colorSchemeName(): string | null;
2381
+ /**
2382
+ * The theme colour scheme: the 12 {@link ThemeColorSlot}s resolved to a 6-hex RGB
2383
+ * (an `a:sysClr` slot resolves through its `lastClr`). A slot the theme does not
2384
+ * define reads `null`. Use {@link color} to look one slot up.
2385
+ */
2386
+ get colorScheme(): Record<ThemeColorSlot, string | null>;
2387
+ /** The 6-hex RGB of one colour-scheme slot, or `null` when the theme does not define it. */
2388
+ color(slot: ThemeColorSlot): string | null;
2389
+ /** The theme's `a:fontScheme` (major/minor font families), or `null` when the theme declares none. */
2390
+ get fontScheme(): ThemeFontScheme | null;
2391
+ /** Escape hatch: the underlying `a:theme` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
2392
+ get element_(): Element | null;
2393
+ /** Mark the theme part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
2394
+ markDirty(): void;
2395
+ }
2396
+ /**
2397
+ * One placeholder shape (`p:sp` with a `p:ph`) of a slide master or slide layout —
2398
+ * the definition a slide's placeholder of the same `type`/`idx` inherits geometry
2399
+ * and text style from. Geometry getters read the placeholder's *own* `a:xfrm`,
2400
+ * which a master/layout placeholder carries explicitly (so it round-trips, unlike a
2401
+ * notes placeholder's inherited geometry).
2402
+ */
2403
+ declare class Placeholder {
2404
+ #private;
2405
+ private readonly sp;
2406
+ private readonly part;
2407
+ /** The owning master/layout theme context, threaded to {@link textFrame}. */
2408
+ private readonly themeContext;
2409
+ /** The owning part's relationships, threaded to {@link textFrame} for hyperlink resolution. */
2410
+ private readonly relationships;
2411
+ constructor(sp: Element, part: Part,
2412
+ /** The owning master/layout theme context, threaded to {@link textFrame}. */
2413
+ themeContext: FlattenContext,
2414
+ /** The owning part's relationships, threaded to {@link textFrame} for hyperlink resolution. */
2415
+ relationships: Relationships);
2416
+ /** Placeholder type (`p:ph/@type`: `title` | `body` | `sldNum` | …), or `null` when absent (a body placeholder). */
2417
+ get type(): string | null;
2418
+ /** Placeholder index (`p:ph/@idx`), or `null` when unset. */
2419
+ get idx(): string | null;
2420
+ /** Shape name (`p:cNvPr/@name`), or `''` when unnamed. */
2421
+ get name(): string;
2422
+ /** Drawing id (`p:cNvPr/@id`), or `null` when absent. */
2423
+ get id(): number | null;
2424
+ /** Left edge in EMU (`a:off/@x`), or `null` when the placeholder carries no own `a:xfrm`. */
2425
+ get left(): number | null;
2426
+ /** Top edge in EMU (`a:off/@y`), or `null` when the placeholder carries no own `a:xfrm`. */
2427
+ get top(): number | null;
2428
+ /** Width in EMU (`a:ext/@cx`), or `null` when the placeholder carries no own `a:xfrm`. */
2429
+ get width(): number | null;
2430
+ /** Height in EMU (`a:ext/@cy`), or `null` when the placeholder carries no own `a:xfrm`. */
2431
+ get height(): number | null;
2432
+ /**
2433
+ * The placeholder's text as a navigable {@link TextFrame} (`p:txBody`), or `null`
2434
+ * when it carries no text body. Threaded with the owning master/layout theme
2435
+ * context so a run's own `schemeClr` resolves through `Run.resolvedColor`.
2436
+ */
2437
+ get textFrame(): TextFrame | null;
2438
+ /** Escape hatch: the underlying `p:sp` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
2439
+ get element_(): Element;
2440
+ /** Mark the owning master/layout part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
2441
+ markDirty(): void;
2442
+ }
2443
+ /**
2444
+ * A deck's slide master (`slideMasterN.xml`) as a modeled object. Exposes the
2445
+ * property tiers a bound slide inherits: the {@link colorMap} (token → theme slot),
2446
+ * its {@link theme}, its {@link placeholders} (with geometry), its own
2447
+ * {@link background}, and the {@link layouts} that build on it. Reachable from
2448
+ * {@link SlideLayout.master} and `Slide.master`.
2449
+ */
2450
+ declare class SlideMaster {
2451
+ #private;
2452
+ private readonly opc;
2453
+ /** The master's OPC part (`/ppt/slideMasters/slideMasterN.xml`). */
2454
+ readonly part: Part;
2455
+ constructor(opc: OpcPackage,
2456
+ /** The master's OPC part (`/ppt/slideMasters/slideMasterN.xml`). */
2457
+ part: Part);
2458
+ /** Partname of the master part. */
2459
+ get partName(): string;
2460
+ /** The master's authoring name (`p:cSld/@name`), or `''` when unnamed (the writer's default). */
2461
+ get name(): string;
2462
+ /** The master's theme (via its `theme` relationship), or `null` when absent. */
2463
+ get theme(): Theme | null;
2464
+ /**
2465
+ * The master's colour map (`p:clrMap`): each of the 12 {@link ColorMapToken}s
2466
+ * mapped to the {@link ThemeColorSlot} it resolves through. This is the indirection
2467
+ * that lets a slide's `schemeClr val="tx1"` reach a theme slot (e.g. `tx1` → `dk1`).
2468
+ * A token the map omits reads `null`.
2469
+ */
2470
+ get colorMap(): Record<ColorMapToken, string | null>;
2471
+ /** The master's placeholder shapes (`p:sp` carrying a `p:ph`), in document order. */
2472
+ get placeholders(): Placeholder[];
2473
+ /** The layouts built on this master (via `p:sldLayoutIdLst` → its relationships), in list order. */
2474
+ get layouts(): SlideLayout[];
2475
+ /**
2476
+ * The master's *own* background (`p:cSld/p:bg`), decoded, or `null` when it defines
2477
+ * none. Scoped to the master's own element — a slide's *effective* background,
2478
+ * resolved through the slide → layout → master chain, is `Slide.background`.
2479
+ */
2480
+ get background(): SlideBackground | null;
2481
+ /**
2482
+ * The master's colour/font context (its `p:clrMap` + theme), resolved once and
2483
+ * cached. Backs each {@link Placeholder}'s text frame.
2484
+ */
2485
+ themeContext(): FlattenContext;
2486
+ }
2487
+ /**
2488
+ * A deck's slide layout (`slideLayoutN.xml`) as a modeled object — the gallery entry
2489
+ * a slide binds to. Exposes its {@link name}, its {@link type} (import-only; the
2490
+ * writer authors none), its {@link master} (and, through it, the {@link theme}), its
2491
+ * {@link placeholders} (with geometry), and its own {@link background}. Reachable
2492
+ * from `Slide.layout` and {@link SlideMaster.layouts}.
2493
+ */
2494
+ declare class SlideLayout {
2495
+ #private;
2496
+ private readonly opc;
2497
+ /** The layout's OPC part (`/ppt/slideLayouts/slideLayoutN.xml`). */
2498
+ readonly part: Part;
2499
+ constructor(opc: OpcPackage,
2500
+ /** The layout's OPC part (`/ppt/slideLayouts/slideLayoutN.xml`). */
2501
+ part: Part);
2502
+ /** Partname of the layout part. */
2503
+ get partName(): string;
2504
+ /** The layout's authoring name (`p:cSld/@name`, e.g. `Title and Content`), or `''` when unnamed. */
2505
+ get name(): string;
2506
+ /**
2507
+ * The layout type (`p:sldLayout/@type`, e.g. `title` | `obj` | `blank`), or `null`
2508
+ * when the layout declares none. Import-only: the writer authors no `@type`, so an
2509
+ * authored deck reads `null`; an imported deck carries PowerPoint's value.
2510
+ */
2511
+ get type(): string | null;
2512
+ /** The master this layout is built on (via its `slideMaster` relationship), or `null` when absent. */
2513
+ get master(): SlideMaster | null;
2514
+ /** The theme this layout resolves against, via its {@link master}, or `null`. */
2515
+ get theme(): Theme | null;
2516
+ /** The layout's placeholder shapes (`p:sp` carrying a `p:ph`), in document order. */
2517
+ get placeholders(): Placeholder[];
2518
+ /**
2519
+ * The layout's *own* background (`p:cSld/p:bg`), decoded, or `null` when it defines
2520
+ * none. A layout usually authors one — an explicit fill (`p:bgPr`) or a
2521
+ * theme-indexed reference (`p:bgRef`). The slide's *effective* background is
2522
+ * `Slide.background`.
2523
+ */
2524
+ get background(): SlideBackground | null;
2525
+ /**
2526
+ * The layout's colour/font context (walked layout → master → theme), resolved once
2527
+ * and cached. Backs each {@link Placeholder}'s text frame.
2528
+ */
2529
+ themeContext(): FlattenContext;
2530
+ }
2531
+ //#endregion
2532
+ //#region src/read/api/transition.d.ts
2533
+ /** `ST_TransitionSpeed` — the coarse speed bucket (`spd`), default `fast`. */
2534
+ type TransitionSpeed = 'slow' | 'med' | 'fast';
2535
+ /** Decoded slide transition (`p:transition`), as returned by {@link Slide.transition}. */
2536
+ interface TransitionInfo {
2537
+ /**
2538
+ * The transition-type element's local name (e.g. `fade`, `push`, `wipe`,
2539
+ * `cut`, `dissolve`). Base ECMA-376 types use the `p` namespace; modern
2540
+ * PowerPoint types live in `p14`/`p15`/`p159` (see {@link namespace}).
2541
+ */
2542
+ type: string;
2543
+ /** The transition element's namespace prefix (`p` for base, else `p14`/`p15`/`p159`). */
2544
+ namespace: string;
2545
+ /** Coarse speed bucket; `fast` when `spd` is absent (its schema default). */
2546
+ speed: TransitionSpeed;
2547
+ /** Exact duration in milliseconds (`p14:dur`), or `null` when only a speed bucket is set. */
2548
+ durationMs: number | null;
2549
+ /** Whether the slide advances on click (`advClick`, default `true`). */
2550
+ advanceOnClick: boolean;
2551
+ /** Auto-advance delay in milliseconds (`advTm`), or `null` when not timed. */
2552
+ advanceAfterMs: number | null;
2553
+ /** Type-specific variant attributes (e.g. `{ dir: 'd' }` for push, `{ spokes: '2' }` for wheel). */
2554
+ variant: Record<string, string>;
2555
+ /** Transition sound (`p:sndAc`), or `null` when the transition is silent. */
2556
+ sound: TransitionSoundInfo | null;
2557
+ }
2558
+ /** Decoded transition sound (`p:sndAc`). A start sound (`p:stSnd`) or the stop-previous form (`p:endSnd`). */
2559
+ interface TransitionSoundInfo {
2560
+ /** `start` for an embedded start sound (`p:stSnd`), `stop` for the stop-previous form (`p:endSnd`). */
2561
+ form: 'start' | 'stop';
2562
+ /** Whether the start sound loops until the next sound (`p:stSnd @loop`). Always `false` for `stop`. */
2563
+ loop: boolean;
2564
+ /** Relationship id of the embedded WAV (`p:snd @r:embed`), or `null` (stop form / missing). */
2565
+ embedRid: string | null;
2566
+ /** Display name on `p:snd @name`, or `null`. */
2567
+ name: string | null;
2568
+ }
2569
+ /** Transition fields accepted by the {@link Slide.transition} setter. `speed` defaults are derived from `durationMs`. */
2570
+ interface TransitionInput {
2571
+ type: string;
2572
+ /** Namespace prefix for the type element; defaults to `p` (base ECMA-376). */
2573
+ namespace?: string;
2574
+ speed?: TransitionSpeed;
2575
+ durationMs?: number | null;
2576
+ advanceOnClick?: boolean;
2577
+ advanceAfterMs?: number | null;
2578
+ variant?: Record<string, string>;
2579
+ }
2580
+ //#endregion
2581
+ //#region src/read/api/slide.d.ts
2582
+ /** Options for {@link Slide.addTextBox}. Geometry is in EMU. */
2583
+ interface AddTextBoxOptions {
2584
+ /** Left edge in EMU (`a:off/@x`). */
2585
+ left: number;
2586
+ /** Top edge in EMU (`a:off/@y`). */
2587
+ top: number;
2588
+ /** Width in EMU (`a:ext/@cx`); must be positive. */
2589
+ width: number;
2590
+ /** Height in EMU (`a:ext/@cy`); must be positive. */
2591
+ height: number;
2592
+ /** Initial text; omitted/empty yields an empty paragraph. */
2593
+ text?: string;
2594
+ /** Shape name (`p:cNvPr/@name`); defaults to `TextBox <id>`. */
2595
+ name?: string;
2596
+ }
2597
+ /** Options for {@link Slide.addPicture}. Geometry is in EMU. */
2598
+ interface AddPictureOptions {
2599
+ /** Left edge in EMU (`a:off/@x`). */
2600
+ left: number;
2601
+ /** Top edge in EMU (`a:off/@y`). */
2602
+ top: number;
2603
+ /** Width in EMU (`a:ext/@cx`); must be positive. */
2604
+ width: number;
2605
+ /** Height in EMU (`a:ext/@cy`); must be positive. */
2606
+ height: number;
2607
+ /** Shape name (`p:cNvPr/@name`); defaults to `Picture <id>`. */
2608
+ name?: string;
2609
+ /**
2610
+ * Image file extension (e.g. `png`). When omitted it is sniffed from the
2611
+ * image's magic bytes; supply it (with `contentType`) for formats the
2612
+ * sniffer does not recognize.
2613
+ */
2614
+ extension?: string;
2615
+ /** MIME content type (e.g. `image/png`); sniffed alongside `extension` when omitted. */
2616
+ contentType?: string;
2617
+ }
2618
+ declare class Slide {
2619
+ #private;
2620
+ readonly presentation: Presentation;
2621
+ /** The slide's OPC part (`/ppt/slides/slideN.xml`). */
2622
+ readonly part: Part;
2623
+ /** The slide id from `p:sldIdLst` (`p:sldId/@id`). */
2624
+ readonly slideId: number;
2625
+ /** Zero-based position in presentation order. */
2626
+ readonly index: number;
2627
+ constructor(presentation: Presentation,
2628
+ /** The slide's OPC part (`/ppt/slides/slideN.xml`). */
2629
+ part: Part,
2630
+ /** The slide id from `p:sldIdLst` (`p:sldId/@id`). */
2631
+ slideId: number,
2632
+ /** Zero-based position in presentation order. */
2633
+ index: number);
2634
+ /** Partname of this slide's part. */
2635
+ get partName(): string;
2636
+ /**
2637
+ * Escape hatch: the underlying `p:sld` element. After mutating it call
2638
+ * {@link markDirty}, or `save()` writes the original bytes. Slide-level DOM
2639
+ * access is also reachable as `slide.part.dom`; this getter is the same node,
2640
+ * on the same rung of the ladder as `Shape.element_` and the rest.
2641
+ */
2642
+ get element_(): Element;
2643
+ /** Mark this slide's part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
2644
+ markDirty(): void;
2645
+ /** This slide part's relationships (image embeds, layout, hyperlinks, …). */
2646
+ get relationships(): Relationships;
2647
+ /**
2648
+ * The slide's resolved theme context (`clrMap` + `clrScheme` + the theme
2649
+ * `fmtScheme` + `fontScheme`, plus the layout/master roots), walked once from
2650
+ * slide → layout → master → theme and cached on this proxy. Backs the read-model
2651
+ * resolved getters ({@link Shape.resolvedFill}, `Run.resolvedColor`,
2652
+ * `Run.resolvedSizePt`, `Run.resolvedFontFace`) so a `schemeClr` token — including
2653
+ * one delivered through a shape's `p:style` `fillRef`/`lnRef` — resolves to a
2654
+ * literal hex, and a placeholder run's inherited size/typeface (a `+mj-*`/`+mn-*`
2655
+ * font token included) resolves to a literal value. The maps/roots are empty when
2656
+ * the theme chain is incomplete, in which case tokens simply stay unresolved.
2657
+ */
2658
+ themeContext(): FlattenContext;
2659
+ /** Authoring name of the slide (`p:cSld/@name`), or `null` if unnamed. */
2660
+ get name(): string | null;
2661
+ /**
2662
+ * Whether this slide is hidden (`p:sld/@show="0"`). The attribute is
2663
+ * `xsd:boolean` defaulting to `true`, so an absent attribute means shown.
2664
+ * Hidden slides are dropped from PowerPoint/LibreOffice presentations and
2665
+ * exported PDFs, so render order diverges from model order when any earlier
2666
+ * slide is hidden.
2667
+ */
2668
+ get hidden(): boolean;
2669
+ /**
2670
+ * Hide or show this slide. Hiding writes `p:sld/@show="0"`; showing removes
2671
+ * the attribute, restoring PowerPoint's canonical shown form (absent ⇒ shown).
2672
+ * Marks the slide part dirty.
2673
+ */
2674
+ set hidden(value: boolean);
2675
+ /**
2676
+ * The slide's show transition (`p:transition`), decoded into a typed model, or
2677
+ * `null` when the slide has none. Handles both PowerPoint forms: the bare
2678
+ * `<p:transition>` and the `mc:AlternateContent` wrapper that carries the exact
2679
+ * `p14:dur` duration (the `p14` Choice is preferred so `durationMs` is recovered).
2680
+ */
2681
+ get transition(): TransitionInfo | null;
2682
+ /**
2683
+ * Set or clear the slide's show transition. Assigning `null` removes it.
2684
+ * Writing a transition with `durationMs` emits the `mc:AlternateContent` form
2685
+ * (a `p14` Choice carrying `p14:dur` plus a base `mc:Fallback`); otherwise the
2686
+ * bare `<p:transition>` is written. The node is inserted at its schema slot —
2687
+ * after `p:clrMapOvr`, before `p:timing`/`p:extLst`. Marks the slide part dirty.
2688
+ */
2689
+ set transition(value: TransitionInput | null);
2690
+ /**
2691
+ * Whether the slide carries build animations (`p:timing` with a `<p:bldP>` or a
2692
+ * `presetID`-bearing time node). The animation tree itself is preserved opaquely;
2693
+ * see {@link animationSpids}.
2694
+ */
2695
+ get hasAnimations(): boolean;
2696
+ /**
2697
+ * @internal The sorted, de-duplicated set of shape ids (`spid`) referenced by
2698
+ * the slide's animations (`<p:spTgt spid>` and `<p:bldP spid>`). Exposed for the
2699
+ * import paths' spid-coherence checks.
2700
+ */
2701
+ animationSpids(): number[];
2702
+ /**
2703
+ * @internal Rewrite every animation `spid` per `mapping` (old → new), keeping
2704
+ * the opaque timing tree coherent when shape ids are reassigned. Marks the slide
2705
+ * part dirty only when a reference changed.
2706
+ */
2707
+ remapAnimationSpids(mapping: Map<number, number>): void;
2708
+ /**
2709
+ * @internal Remove the build animations targeting the given shape ids (their
2710
+ * `<p:bldP>` and effect nodes), so deleting a shape never leaves a dangling
2711
+ * `spid` reference. Marks the slide part dirty only when something was removed.
2712
+ */
2713
+ pruneAnimationSpids(spids: Iterable<number>): void;
2714
+ /**
2715
+ * Flatten the slide's build animations: remove the `<p:timing>` block so the
2716
+ * slide renders and edits as its final static state, with every shape shown at
2717
+ * once. Gated like {@link hasAnimations} — a `<p:timing>` that is purely a media
2718
+ * loop (no `<p:bldP>` or `presetID`) is preserved so media playback survives.
2719
+ * Marks the slide part dirty and returns `true` only when a timing block was
2720
+ * removed.
2721
+ *
2722
+ * This removes click-through staging only; it does not delete shapes. If a slide
2723
+ * animated alternating states over the same region, the flattened render shows
2724
+ * them all at once — keep that distinct from removing staged/duplicate shapes.
2725
+ */
2726
+ flattenAnimations(): boolean;
2727
+ /** Top-level shapes in the slide's shape tree, in document order. */
2728
+ get shapes(): AnyShape[];
2729
+ /**
2730
+ * All text on the slide, flattened in document order — the read-model
2731
+ * counterpart to {@link TextFrame.text} one level up. Every text-bearing shape
2732
+ * contributes its text, recursing into groups ({@link GroupShape}) and reading
2733
+ * table cells ({@link GraphicFrame.table}); text-free shapes (pictures,
2734
+ * connectors, empty boxes) contribute nothing. Blocks are joined by `\n`; within
2735
+ * a table, cells in a row are joined by `\t` and rows by `\n`.
2736
+ *
2737
+ * This is deliberately scoped to the slide's own shape tree. It does **not**
2738
+ * include speaker notes (read those via {@link notesText}) or chart data labels
2739
+ * (read those via {@link GraphicFrame.chart}); folding those in would force
2740
+ * ordering and separator choices a caller is better placed to make. Extract a
2741
+ * whole deck with `deck.slides.map((s) => s.text)`.
2742
+ */
2743
+ get text(): string;
2744
+ /**
2745
+ * The slide's speaker-note text — the companion to {@link text} for the notes
2746
+ * that {@link text} deliberately excludes. Delegates to {@link notesSlide}: finds
2747
+ * the notes body placeholder (`p:ph` `type="body"`) and flattens its text frame
2748
+ * the same way {@link TextFrame.text} does (paragraphs joined by `\n`).
2749
+ *
2750
+ * Returns `null` when the slide has **no notes slide part at all** — distinct
2751
+ * from `''`, which means a notes slide exists but its body is empty (PowerPoint
2752
+ * often attaches an empty notes slide to every slide). Only the body placeholder
2753
+ * is read; the slide-thumbnail (`sldImg`) and slide-number (`sldNum`)
2754
+ * placeholders a notes slide also carries are read via {@link notesSlide}.
2755
+ */
2756
+ get notesText(): string | null;
2757
+ /**
2758
+ * The slide's speaker-note body as a navigable {@link TextFrame} — the rich
2759
+ * companion to {@link notesText}, which flattens the same body to a plain string.
2760
+ * Walk `paragraphs → runs` to recover per-run formatting (bold/italic/underline,
2761
+ * colour, size, face) and any notes hyperlink that {@link notesText} discards.
2762
+ *
2763
+ * `null` when the slide has **no notes slide part** (the same boundary
2764
+ * {@link notesText} returns `null` at), and also when a notes part exists but
2765
+ * carries no body-placeholder text frame — there is then no frame to hand back
2766
+ * (whereas {@link notesText} reports `''` for that empty-body case). Convenience
2767
+ * for `notesSlide.textFrame`; see {@link notesSlide} for the whole modeled notes
2768
+ * slide (its `sldImg`/`sldNum` placeholders and their geometry).
2769
+ */
2770
+ get notesTextFrame(): TextFrame | null;
2771
+ /**
2772
+ * The slide's speaker-notes slide (`notesSlideN.xml`) as a modeled
2773
+ * {@link NotesSlide}, or `null` when the slide has no notes slide part. Beyond the
2774
+ * body text {@link notesText}/{@link notesTextFrame} surface, this exposes the
2775
+ * notes slide's three placeholders — the slide thumbnail (`slideImage`), the notes
2776
+ * body, and the slide-number field (`slideNumber`) — each with its geometry and
2777
+ * (where present) a navigable text frame.
2778
+ *
2779
+ * The writer authors all three placeholders but leaves `sldImg`/`sldNum` with an
2780
+ * empty `p:spPr`, so on an authored deck their geometry reads `null` while an
2781
+ * imported deck carries the notesMaster-derived geometry. The body text and the
2782
+ * slide-number field round-trip either way.
2783
+ */
2784
+ get notesSlide(): NotesSlide | null;
2785
+ /**
2786
+ * The slide layout this slide is bound to (`slideLayout` relationship), as a
2787
+ * modeled {@link SlideLayout}, or `null` when the slide has no layout. The layout
2788
+ * carries the placeholder geometry and background a slide inherits; walk on to
2789
+ * {@link master} and {@link theme} through it (`slide.layout.master.theme`).
2790
+ */
2791
+ get layout(): SlideLayout | null;
2792
+ /**
2793
+ * The slide master this slide resolves against, via its {@link layout}, as a
2794
+ * modeled {@link SlideMaster}, or `null` when the layout/master chain is broken.
2795
+ * The master owns the colour map (`schemeClr` token → theme slot) and the default
2796
+ * text styles a placeholder inherits.
2797
+ */
2798
+ get master(): SlideMaster | null;
2799
+ /**
2800
+ * The theme this slide resolves colour and font tokens against, via its
2801
+ * {@link layout} → {@link master} → theme, as a modeled {@link Theme}, or `null`.
2802
+ * Read its {@link Theme.colorScheme}/{@link Theme.fontScheme} to see the literal
2803
+ * palette and faces a `schemeClr`/`+mj-*` token resolves to.
2804
+ */
2805
+ get theme(): Theme | null;
2806
+ /**
2807
+ * The slide's **legacy** review comments (`p:cm` in its `comments/commentN.xml`
2808
+ * part), `[]` when it has none. Each {@link Comment} carries its body text, marker
2809
+ * position (EMU), timestamp, and its author resolved through the deck-wide
2810
+ * {@link Presentation.commentAuthors} registry (`@authorId` → name/initials). These
2811
+ * are the comments the writer authors via `slide.addComment(...)`; the 2018 modern
2812
+ * comment parts (`p188:cm`) are a separate schema, preserved but not decoded.
2813
+ */
2814
+ get comments(): Comment[];
2815
+ /**
2816
+ * The slide's **modern** (2018) review comments (`p188:cm` in its
2817
+ * `modernComment_*.xml` part), `[]` when it has none. Each {@link ModernComment}
2818
+ * carries its body text, `created` timestamp, marker position (EMU), its author
2819
+ * resolved through the deck-wide {@link Presentation.modernCommentAuthors}
2820
+ * registry (`@authorId` GUID → name/initials), and its reply thread nested under
2821
+ * `replies`. Read-only — the writer authors the legacy schema; see
2822
+ * {@link Presentation.commentSchema} to tell which schema a deck uses.
2823
+ */
2824
+ get modernComments(): ModernComment[];
2825
+ /**
2826
+ * The slide's programmatic tags (`p:custDataLst/p:tags` on the slide part,
2827
+ * resolved to `ppt/tags/tagN.xml`) as `{ name, val }` string pairs, `[]` when it
2828
+ * has none. Host/add-in metadata with no visible rendering and no writer —
2829
+ * read-only, preserved byte-for-byte on round-trip. Deck-level tags are
2830
+ * {@link Presentation.tags}.
2831
+ */
2832
+ get tags(): Tag[];
2833
+ /**
2834
+ * The slide's effective background (`p:cSld/p:bg`), decoded into a typed
2835
+ * {@link SlideBackground}. Resolved through the inheritance chain: the slide's
2836
+ * own `p:bg` wins; failing that the slideLayout's, then the slideMaster's — the
2837
+ * result's `source` records which supplied it. `null` when nothing in the chain
2838
+ * defines a background.
2839
+ *
2840
+ * Colour tokens resolve against this slide's theme; an image background's
2841
+ * `r:embed` resolves to an absolute part name through the *owning* part's
2842
+ * relationships (the layout's rels for a layout-inherited image, etc.). Solid,
2843
+ * gradient, and image backgrounds are the three the writer authors and so
2844
+ * round-trip faithfully; `pattern`/`themeRef` are read-only for imported decks.
2845
+ */
2846
+ get background(): SlideBackground | null;
2847
+ /**
2848
+ * The slide's own slide-number placeholder (`p:sp` with `p:ph type="sldNum"`,
2849
+ * carrying an `<a:fld type="slidenum">`), or `null` when the slide shows no slide
2850
+ * number of its own. This is the concrete shape the writer emits for
2851
+ * `pptx.setSlideNumber(...)` on a slide's layout; its geometry and run formatting
2852
+ * read off the returned {@link AutoShape} the same as any placeholder.
2853
+ *
2854
+ * Scoped to the slide's *own* shape tree — a slide number inherited purely from
2855
+ * the master's `p:hf`/placeholder (with no shape on the slide) is a master-level
2856
+ * concern this getter does not resolve.
2857
+ */
2858
+ get slideNumberPlaceholder(): AutoShape | null;
2859
+ /** The first top-level shape with the given drawing id (`p:cNvPr/@id`), or `undefined`. */
2860
+ shapeById(id: number): AnyShape | undefined;
2861
+ /**
2862
+ * The first shape *anywhere* in the slide's shape tree with the given drawing id
2863
+ * (`p:cNvPr/@id`), descending into groups — unlike {@link shapeById}, which scans
2864
+ * only top-level shapes. Walked pre-order (a group is visited before its children),
2865
+ * matching how the writer allocates ids. `undefined` when no shape carries that id.
2866
+ *
2867
+ * Drawing ids are unique within a slide, so the first match is the only match; the
2868
+ * pre-order walk just fixes a deterministic order. This backs the connector-binding
2869
+ * resolution ({@link import('./shapes.js').Connector.startConnection}), which must
2870
+ * resolve a binding into a group that top-level {@link shapeById} cannot see.
2871
+ */
2872
+ shapeByIdDeep(id: number): AnyShape | undefined;
2873
+ /** The first top-level shape with the given name (`p:cNvPr/@name`), or `undefined`. */
2874
+ shapeByName(name: string): AnyShape | undefined;
2875
+ /**
2876
+ * The first placeholder of the given type (`p:ph/@type`, e.g. `title`,
2877
+ * `ctrTitle`, `subTitle`, `body`), optionally narrowed by `idx`. Returns
2878
+ * `undefined` when none match. Only `p:sp` shapes can be placeholders, so the
2879
+ * result is an {@link AutoShape}.
2880
+ */
2881
+ placeholder(type: string, idx?: string): AutoShape | undefined;
2882
+ /**
2883
+ * Append a text box (`p:sp` with `txBox="1"`) to the slide's shape tree and
2884
+ * return it. Geometry is required (EMU); width and height must be positive.
2885
+ * Allocates a drawing id unique within the slide. Marks the slide part dirty.
2886
+ */
2887
+ addTextBox(options: AddTextBoxOptions): AutoShape;
2888
+ /**
2889
+ * Add a picture (`p:pic`) from raw image bytes and return it. Creates a media
2890
+ * part under `/ppt/media/`, registers its content type, wires an `image`
2891
+ * relationship from this slide, and appends the picture to the shape tree.
2892
+ * Geometry is required (EMU); width and height must be positive. The image
2893
+ * format is sniffed from the bytes unless `extension`/`contentType` are given.
2894
+ */
2895
+ addPicture(image: Uint8Array, options: AddPictureOptions): Picture;
2896
+ /**
2897
+ * @internal The slide's shape tree (`p:cSld/p:spTree`), or `null` if absent.
2898
+ * Exposed for cross-slide composition (`Presentation.importShape`).
2899
+ */
2900
+ shapeTree(): Element | null;
2901
+ /**
2902
+ * @internal The smallest drawing id (`p:cNvPr/@id`) not already used on this
2903
+ * slide. Exposed so `Presentation.importShape` can give a lifted shape (and its
2904
+ * group children) collision-free ids on the host.
2905
+ */
2906
+ nextShapeId(): number;
2907
+ }
2908
+ //#endregion
2909
+ //#region src/read/api/document-properties.d.ts
2910
+ /**
2911
+ * Decoded `docProps/core.xml`. Every field is optional (present only when the
2912
+ * element is). `created`/`modified`/`lastPrinted` are kept as the **raw W3CDTF
2913
+ * string** rather than parsed to `Date`, avoiding timezone round-trip loss and
2914
+ * matching the byte-preserve ethos of the read model.
2915
+ */
2916
+ interface CoreProperties {
2917
+ /** `dc:title`. */
2918
+ title?: string;
2919
+ /** `dc:subject`. */
2920
+ subject?: string;
2921
+ /** `dc:creator` (the write-side `pptx.author`). */
2922
+ creator?: string;
2923
+ /** `cp:keywords`. */
2924
+ keywords?: string;
2925
+ /** `dc:description`. */
2926
+ description?: string;
2927
+ /** `cp:lastModifiedBy`. */
2928
+ lastModifiedBy?: string;
2929
+ /** `cp:revision`. */
2930
+ revision?: string;
2931
+ /** `cp:category`. */
2932
+ category?: string;
2933
+ /** `cp:contentStatus`. */
2934
+ contentStatus?: string;
2935
+ /** `dcterms:created`, raw W3CDTF string. */
2936
+ created?: string;
2937
+ /** `dcterms:modified`, raw W3CDTF string. */
2938
+ modified?: string;
2939
+ /** `cp:lastPrinted`, raw W3CDTF string. */
2940
+ lastPrinted?: string;
2941
+ }
2942
+ /** One user-defined custom document property (`docProps/custom.xml`). */
2943
+ interface CustomProperty {
2944
+ /** The property's `@name`. */
2945
+ name: string;
2946
+ /** The decoded value, typed from its `vt:` child element. */
2947
+ value: CustomPropertyValue;
2948
+ }
2949
+ /**
2950
+ * Read the deck's core document properties from `/docProps/core.xml`, resolved
2951
+ * via the package-root `core-properties` relationship (fallback: the part's
2952
+ * content type). Missing part → `{}` (all fields undefined). Present-but-empty
2953
+ * elements decode to the empty string.
2954
+ */
2955
+ declare function readCoreProperties(opc: OpcPackage): CoreProperties;
2956
+ /**
2957
+ * Read the deck's user-defined custom properties from `/docProps/custom.xml`,
2958
+ * resolved via the package-root `custom-properties` relationship (fallback: the
2959
+ * part's content type). Each `<property name=...>` maps to `{ name, value }`,
2960
+ * with `value` typed from its single `vt:` child. Missing part → `[]`. A
2961
+ * `<property>` without a `@name` or without a `vt:` child is skipped.
2962
+ *
2963
+ * The `vt:` child and `<property>` element sit in namespaces outside the read
2964
+ * model's qname registry, so children are matched by local name rather than the
2965
+ * `firstChild`/`getElements` helpers.
2966
+ */
2967
+ declare function readCustomProperties(opc: OpcPackage): CustomProperty[];
2968
+ //#endregion
2969
+ //#region src/read/api/presentation.d.ts
2970
+ declare class Presentation {
2971
+ #private;
2972
+ readonly opc: OpcPackage;
2973
+ private constructor();
2974
+ /** Open a `.pptx` from bytes and wrap it as a navigable `Presentation`. */
2975
+ static load(input: OpcInput): Promise<Presentation>;
2976
+ /** Wrap an already-loaded OPC package (e.g. from the lower-level API). */
2977
+ static fromPackage(opc: OpcPackage): Presentation;
2978
+ /**
2979
+ * Open a PowerPoint template (`.pptx` or `.potx`) and return it as an empty
2980
+ * deck shell ready to author onto: its slide masters, layouts, and theme are
2981
+ * kept **byte-identical**, while any sample slides the template carried are
2982
+ * stripped so only the shared chrome remains.
2983
+ *
2984
+ * Use it to build a fresh deck on a corporate template without rebuilding the
2985
+ * masters in code: discover the bindable layouts with {@link layouts}, then
2986
+ * author slides with a generator sized to match the template and graft them in
2987
+ * with {@link appendSlides} (which enforces an equal slide size). Saving yields
2988
+ * an editable `.pptx` that reuses the template's authored chrome verbatim.
2989
+ *
2990
+ * ```ts
2991
+ * const deck = await Presentation.fromTemplate(templateBytes) // .pptx or .potx
2992
+ * deck.layouts().map(l => l.name) // discover layouts
2993
+ * await deck.appendSlides(pptx, { layout: 'Title and Content' })
2994
+ * const out = await deck.save() // editable .pptx
2995
+ * ```
2996
+ *
2997
+ * A `.potx` package declares its main part with the template content type; by
2998
+ * default that override is flipped to the editable presentation type so the
2999
+ * saved output opens as a normal deck. Pass `keepTemplateContentType: true` to
3000
+ * preserve the template type. A `.pptx` input needs no flip, and a template
3001
+ * that already carries zero slides makes the strip a no-op.
3002
+ */
3003
+ static fromTemplate(input: OpcInput, options?: FromTemplateOptions): Promise<Presentation>;
3004
+ /** The main presentation part (`/ppt/presentation.xml`), resolved via the package `officeDocument` relationship. */
3005
+ get presentationPart(): Part;
3006
+ /** The slides in presentation order (resolved from `p:sldIdLst` + the presentation's relationships). */
3007
+ get slides(): Slide[];
3008
+ /** Slide dimensions (`p:sldSz`), or `null` if the presentation declares none. */
3009
+ get slideSize(): SlideSize | null;
3010
+ /**
3011
+ * The deck's embedded font families (`p:embeddedFontLst` in `presentation.xml`),
3012
+ * `[]` when it embeds none. Each entry names the typeface and resolves every
3013
+ * embedded face's `r:id` to the absolute partname of its `.fntdata` binary — the
3014
+ * read counterpart to the write-side `pptx.embedFont` / `importSlide({ embedFonts })`
3015
+ * carry. An entry whose `p:font` has no `@typeface`, or a face whose `r:id` is
3016
+ * missing or dangling, is skipped (faithful degradation, no throw). Read-only.
3017
+ */
3018
+ get embeddedFonts(): EmbeddedFontInfo[];
3019
+ /**
3020
+ * The deck-wide **legacy** comment-author registry (`p:cmAuthorLst` in
3021
+ * `ppt/commentAuthors.xml`), `[]` when the deck has no comments. Each slide's
3022
+ * {@link Slide.comments} resolves its `@authorId` against this list. The 2018
3023
+ * modern comment authors (`ppt/authors.xml`) are a separate part, not decoded here.
3024
+ */
3025
+ get commentAuthors(): CommentAuthor[];
3026
+ /**
3027
+ * The deck-wide **modern** (2018) comment-author registry (`p188:authorLst` in
3028
+ * `ppt/authors.xml`), `[]` when the deck carries no modern comments. Unlike the
3029
+ * legacy {@link commentAuthors}, each entry is keyed by a GUID `id` (plus
3030
+ * `userId`/`providerId`); each slide's {@link Slide.modernComments} resolves its
3031
+ * `@authorId` against this list. Read-only — the writer emits legacy comments.
3032
+ */
3033
+ get modernCommentAuthors(): ModernCommentAuthor[];
3034
+ /**
3035
+ * Which comment schema this deck uses: `'modern'` when it carries any 2018
3036
+ * `modernComment_*` part (read via {@link Slide.modernComments} /
3037
+ * {@link modernCommentAuthors}), `'legacy'` when it carries classic
3038
+ * `commentN.xml` parts (read via {@link Slide.comments} / {@link commentAuthors}),
3039
+ * or `'none'`. The two schemas do not coexist in practice, so this tells a
3040
+ * consumer which accessor to read without probing both.
3041
+ */
3042
+ get commentSchema(): CommentSchema;
3043
+ /**
3044
+ * The deck's core document properties (`docProps/core.xml`): title, subject,
3045
+ * creator, keywords, revision, and the created/modified/lastPrinted timestamps
3046
+ * (kept as raw W3CDTF strings). `{}` when the deck carries no core-properties
3047
+ * part. The read counterpart of the write-side `pptx.title`/`subject`/`author`
3048
+ * (→ `creator`)/`revision` setters.
3049
+ */
3050
+ get coreProperties(): CoreProperties;
3051
+ /**
3052
+ * The deck's user-defined custom document properties (`docProps/custom.xml`) as
3053
+ * `{ name, value }` pairs, each value typed from its `vt:` element (string,
3054
+ * number, boolean, or a raw filetime string). `[]` when the deck carries no
3055
+ * custom-properties part. The read counterpart of `pptx.setCustomProperty(...)`.
3056
+ */
3057
+ get customProperties(): CustomProperty[];
3058
+ /**
3059
+ * The deck-level programmatic tags (`p:custDataLst/p:tags` on `presentation.xml`,
3060
+ * resolved to `ppt/tags/tagN.xml`) as `{ name, val }` string pairs, `[]` when the
3061
+ * deck carries none. These are add-in/host metadata with no visible rendering and
3062
+ * no writer — read-only, preserved byte-for-byte on round-trip. Per-slide tags are
3063
+ * {@link Slide.tags}.
3064
+ */
3065
+ get tags(): Tag[];
3066
+ /**
3067
+ * Duplicate the slide at `index` and insert the copy at `options.at` (deck
3068
+ * order; `0` = first), defaulting to appending at the end when `at` is omitted
3069
+ * or out of range. Returns the new slide. The new slide part copies the source
3070
+ * bytes verbatim and shares the source's relationship targets (layout, images,
3071
+ * …) by copying its `.rels`; a new presentation→slide relationship and a
3072
+ * `p:sldId` entry are wired up. Marks the presentation part dirty.
3073
+ *
3074
+ * Note: relationships are copied as-is, so a source slide that owns a
3075
+ * one-to-one part (e.g. a notes slide) would end up shared with the clone.
3076
+ */
3077
+ cloneSlide(index: number, options?: {
3078
+ at?: number;
3079
+ }): Slide;
3080
+ /**
3081
+ * Remove the slide at `index` (deck order) and return its former partname. The
3082
+ * `p:sldId` entry and the presentation→slide relationship are dropped, the slide
3083
+ * part and its `.rels` are deleted, and any part the slide *privately* owned
3084
+ * (its notes slide, slide-only media, charts/embeddings) that no remaining part
3085
+ * references is pruned too — recursively. Shared deck chrome (layout, master,
3086
+ * theme, …) is never pruned, so the deck stays renderable; removing every slide
3087
+ * leaves a valid master/layout-only package (a template shell).
3088
+ *
3089
+ * Untouched parts stay byte-identical, matching the package fidelity contract.
3090
+ * Throws when there is no slide at `index`.
3091
+ */
3092
+ removeSlide(index: number): string;
3093
+ /**
3094
+ * Append a copy of `source.slides[index]` to this presentation and return it.
3095
+ *
3096
+ * Unlike {@link cloneSlide} (same-deck duplicate), this copies a slide across
3097
+ * a package boundary: it brings the connected sub-graph the slide depends on —
3098
+ * its `slideLayout` → `slideMaster` → `theme`, plus any media, charts, and
3099
+ * embeddings — into this package under fresh partnames, rewriting every
3100
+ * partname, relationship id, and content-type registration so the result is a
3101
+ * self-consistent OPC package. Parts of this (target) package that are not
3102
+ * touched stay byte-identical, matching `cloneSlide`'s fidelity contract.
3103
+ *
3104
+ * Only the layout(s) actually used by imported slides are copied; the imported
3105
+ * master's `p:sldLayoutIdLst` is pruned to exactly those, mirroring how
3106
+ * PowerPoint's "Reuse Slides" brings a slide across. Parts shared by repeated
3107
+ * imports from the same source deck are copied once and reused.
3108
+ *
3109
+ * With `{ theme: 'preserve' }` the slide's source theme is instead *flattened*
3110
+ * into the slide XML and the slide is bound to this deck's existing
3111
+ * master/layout; with `{ theme: 'restyle' }` the slide is bound to this deck's
3112
+ * master/layout with its theme references left symbolic, so it re-brands to the
3113
+ * destination palette — see {@link ImportSlideOptions}.
3114
+ *
3115
+ * v1 limitations: by default the source slide size must equal this
3116
+ * presentation's — pass `{ rescale: 'fit' | 'stretch' }` to rescale the imported
3117
+ * geometry onto this deck's canvas instead (geometry only, not fonts/line
3118
+ * widths). Source notes are dropped unless you pass `{ importNotes: true }`.
3119
+ */
3120
+ importSlide(source: Presentation, index: number, options?: ImportSlideOptions): Slide;
3121
+ /**
3122
+ * Graft slide master(s) from another open package into this one and return what
3123
+ * was copied. Unlike {@link importSlide} — which brings a master across only as
3124
+ * the dependency of an imported *slide* and prunes it to the one layout that
3125
+ * slide uses — this copies a master together with its **whole** layout family
3126
+ * and attaches it to no slide: the master and its layouts land in this deck's
3127
+ * layout gallery (PowerPoint's *Insert ▸ New Slide* / *Layout* picker) without
3128
+ * changing any existing slide.
3129
+ *
3130
+ * It is the "ship a brand template's layouts into a generated deck" capability,
3131
+ * kept brand-agnostic here: the caller supplies the source `.pptx`. Each grafted
3132
+ * master is wired into `p:sldMasterIdLst` (so renderers treat it as active) and
3133
+ * its `p:sldLayoutIdLst` is rebuilt to list exactly the copied layouts; the
3134
+ * connected theme/media/tag parts come across under fresh partnames, and parts
3135
+ * shared with earlier imports from the same source are reused (the copy
3136
+ * registry), so a re-call is idempotent. Untouched parts of this package stay
3137
+ * byte-identical, matching {@link importSlide}'s fidelity contract.
3138
+ *
3139
+ * `options.masters` / `options.layouts` narrow what is grafted; by default every
3140
+ * master and every layout comes across. The source and destination slide sizes
3141
+ * must match unless `options.requireEqualSize` is `false` (see
3142
+ * {@link ImportSlideMastersOptions}).
3143
+ *
3144
+ * Presentation-level parts are carried only on request: embedded fonts via
3145
+ * `options.embedFonts` and table styles via `options.tableStyles`. By default a
3146
+ * grafted master is appended after the deck's existing masters; `options.primary`
3147
+ * moves the grafted masters to the front so the deck presents as their theme (see
3148
+ * {@link ImportSlideMastersOptions}). The v1 limitation mirroring
3149
+ * {@link importSlide} is that geometry is not rescaled.
3150
+ */
3151
+ importSlideMasters(source: Presentation, options?: ImportSlideMastersOptions): ImportedSlideMaster[];
3152
+ /**
3153
+ * The deck's slide masters, in `p:sldMasterIdLst` order, as modeled
3154
+ * {@link SlideMaster}s — the typed read model over the shared chrome (each
3155
+ * master's colour map, theme, placeholders, and the layouts built on it). Walk
3156
+ * `pres.masters()[i].layouts` for the rich layout model, or use {@link layouts}
3157
+ * for the flat {@link LayoutHandle} gallery {@link appendSlides} binds to.
3158
+ * Read-only: it copies nothing and leaves the package byte-identical.
3159
+ */
3160
+ masters(): SlideMaster[];
3161
+ /**
3162
+ * The deck's slide layouts, in master then layout order — the gallery a new
3163
+ * slide can bind to. Each {@link LayoutHandle} addresses one layout for
3164
+ * {@link appendSlides}; the `name` is its `p:cSld@name`. Read-only enumeration:
3165
+ * it copies nothing and leaves the package byte-identical.
3166
+ */
3167
+ layouts(): LayoutHandle[];
3168
+ /**
3169
+ * Append generator-produced slides onto this deck, binding each to an existing
3170
+ * layout, and return the new {@link Slide}s. This is the hybrid
3171
+ * "generate-onto-existing" path: the deck's masters, layouts, theme — and every
3172
+ * other untouched part — stay **byte-identical** (only `presentation.xml`, its
3173
+ * `.rels`, `[Content_Types].xml`, and the freshly-added slide/media parts
3174
+ * change), because the existing chrome is never regenerated.
3175
+ *
3176
+ * `source` is any slide producer (a `TsPptx` instance); its authored slides
3177
+ * are serialized via {@link SlideSource.extractSlides} and spliced in under
3178
+ * fresh partnames, with each slide's `slideLayout` relationship pointed at the
3179
+ * layout named by `options.layout` and its image/hyperlink relationships rebuilt
3180
+ * (preserving the body's relationship ids). Insert position follows
3181
+ * `options.at` (see {@link AppendSlidesOptions}).
3182
+ *
3183
+ * Charts and internal slide-to-slide hyperlinks are carried across: chart parts
3184
+ * (chart XML + `.rels` + embedded workbook) are injected under fresh names, and a
3185
+ * `slide:N` link is repointed at the Nth appended slide's new partname.
3186
+ *
3187
+ * The generator's presentation-level embedded fonts (`pptx.embedFont`) are also
3188
+ * carried into this deck and merged into its `p:embeddedFontLst`, de-duped by
3189
+ * typeface + face slot — so author-side embedded fonts survive the append onto a
3190
+ * template that may itself already embed fonts.
3191
+ *
3192
+ * Embedded audio/video is carried too: the media part backs the ECMA audio/video rel
3193
+ * and the MS-2007 `media` rel sharing one Target, plus a separate preview image part,
3194
+ * with the media content type registered as a Default extension entry (what PowerPoint
3195
+ * authors). Online (external-link) video rides as two External rels over the link.
3196
+ *
3197
+ * Speaker notes ride across too: a slide authored with `addNotes` gets a `notesSlide`
3198
+ * part wired back to it, with its hyperlink rels preserved. A notes slide must bind to
3199
+ * a notes master, and a template commonly has none, so the generator's is installed
3200
+ * (with the theme its `.rels` needs) — but only when this deck has none of its own, so
3201
+ * an existing notes master and its styling always win.
3202
+ *
3203
+ * Limitations:
3204
+ * - An internal link to a source slide outside the appended batch throws (its
3205
+ * target has no counterpart in the destination).
3206
+ * - Appended slides are concrete absolute-positioned content with no placeholder
3207
+ * inheritance from the bound layout; the binding governs theme/`clrMap`
3208
+ * resolution and the "based on" link, not placeholder geometry. Author with
3209
+ * concrete colours — any `schemeClr` re-resolves against the destination theme.
3210
+ * - Source and destination slide sizes must match (no geometry rescale).
3211
+ */
3212
+ appendSlides(source: SlideSource, options: AppendSlidesOptions): Promise<Slide[]>;
3213
+ /**
3214
+ * Copy one shape — an autoshape, picture, table/chart graphic frame, connector,
3215
+ * or group — from `source.shapes[shapeIndex]` onto `target`, returning the new
3216
+ * {@link Shape}. `target` must be a slide of *this* presentation; `source` may
3217
+ * belong to any open presentation.
3218
+ *
3219
+ * The lifted subtree is copied self-consistently: every media/chart/embedding it
3220
+ * depends on is dragged into this package (deduped against earlier imports from
3221
+ * the same source), its `r:embed`/`r:id`/… are rewritten to fresh host-slide
3222
+ * relationships, and its drawing ids (including a group's children) are reassigned
3223
+ * so they cannot collide with the host. With `theme: 'preserve'` (default) the
3224
+ * shape's theme references are baked to literals against the *source* theme so it
3225
+ * renders the same on a foreign host; `restyle` leaves them symbolic to re-brand;
3226
+ * `copy` brings the XML across untouched — see {@link ImportShapeOptions}.
3227
+ *
3228
+ * Differing slide sizes need `{ rescale }` (see {@link ImportShapeOptions.rescale});
3229
+ * a lifted `preserve` placeholder is baked self-contained and demoted to a plain
3230
+ * shape (see {@link ImportShapeOptions.theme}), so it neither re-inherits from nor
3231
+ * collides with the host. A shape's build animation lives in the slide-scoped
3232
+ * `p:timing`, not in its subtree, so the shape lands static unless
3233
+ * `{ carryAnimation: true }` opts in (see {@link ImportShapeOptions.carryAnimation}).
3234
+ */
3235
+ importShape(target: Slide, source: Slide, shapeIndex: number, options?: ImportShapeOptions): AnyShape;
3236
+ /**
3237
+ * Batch form of {@link importShape}: copy several shapes from one source slide
3238
+ * onto `target` in the given order. Media/chart/embedding parts shared by the
3239
+ * lifted shapes (and by earlier imports from the same source deck) are copied
3240
+ * once via the copy registry, and shared images resolve to a single host-slide
3241
+ * relationship. Returns the new {@link Shape}s in `shapeIndices` order.
3242
+ */
3243
+ importShapes(target: Slide, source: Slide, shapeIndices: number[], options?: ImportShapeOptions): AnyShape[];
3244
+ /** Re-emit the package; untouched parts stay byte-identical (see `OpcPackage.save`). */
3245
+ save(): Promise<Uint8Array>;
3246
+ }
3247
+ //#endregion
3248
+ export { ChartFill as $, GroupShape as A, BackgroundFill as At, TableCell as B, ColorContext as Bt, CommentAuthor as C, AutofitMode as Ct, NotesPlaceholder as D, Run as Dt, ModernCommentAuthor as E, Paragraph as Et, isPicture as F, PictureFillTile as Ft, ChartExAxis as G, ResolvedTableStyle as H, GraphicFrame as I, GradientFill as It, ChartExSeries as J, ChartExDataLabels as K, CellBorder as L, GradientStop as Lt, isConnector as M, SlideBackground as Mt, isGraphicFrame as N, FillRect as Nt, NotesSlide as O, RunHyperlink as Ot, isGroupShape as P, PictureFill as Pt, ChartDataLabels as Q, CellBorders as R, ResolvedColor as Rt, Comment as S, SoftEdge as St, ModernComment as T, LineSpacing as Tt, TableConditionFlags as U, TableRow as V, ChartEx as W, Chart as X, AxisNumberFormat as Y, ChartAxis as Z, ThemeColorSlot as _, PatternFill as _t, readCustomProperties as a, AutoShape as at, Tag as b, Reflection as bt, Slide as c, ConnectionSite as ct, TransitionSpeed as d, GeometryCommand as dt, ChartLegend as et, ColorMapToken as f, Glow as ft, Theme as g, OuterShadow as gt, SlideMaster as h, LineEnds as ht, readCoreProperties as i, Picture as it, isAutoShape as j, BackgroundSource as jt, AnyShape as k, TextFrame as kt, TransitionInfo as l, CustomGeometry as lt, SlideLayout as m, LineEnd as mt, CoreProperties as n, ChartSeries as nt, AddPictureOptions as o, Shape as ot, Placeholder as p, InnerShadow as pt, ChartExLegend as q, CustomProperty as r, Connector as rt, AddTextBoxOptions as s, AbsoluteFrame as st, Presentation as t, ChartLine as tt, TransitionInput as u, CustomGeometryPath as ut, ThemeFontFace as v, Recolor as vt, CommentSchema as w, BodyProperties as wt, readTagsForPart as x, ShapeType as xt, ThemeFontScheme as y, RecolorColor as yt, Table as z, resolveColorElement as zt };
3249
+ //# sourceMappingURL=presentation-RGOiun5P.d.ts.map