@shbernal/ts-pptx 1.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/dist/{autopage-tmfjRzL4.js → autopage-MxulehqQ.js} +3 -4
- package/dist/{autopage-tmfjRzL4.js.map → autopage-MxulehqQ.js.map} +1 -1
- package/dist/browser.d.ts +14 -6
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +12 -4
- package/dist/browser.js.map +1 -1
- package/dist/{diagnostics-DzY9Tyfm.d.ts → diagnostics-BqBTmA3a.d.ts} +95 -23
- package/dist/diagnostics-BqBTmA3a.d.ts.map +1 -0
- package/dist/{enums-D3aF4QGb.d.ts → enums-oLLeaSW3.d.ts} +2 -1
- package/dist/{enums-D3aF4QGb.d.ts.map → enums-oLLeaSW3.d.ts.map} +1 -1
- package/dist/{errors-DRLpOpgQ.d.ts → errors-BENA-Xuw.d.ts} +3 -3
- package/dist/{errors-DRLpOpgQ.d.ts.map → errors-BENA-Xuw.d.ts.map} +1 -1
- package/dist/errors-DGE9zh3U.js.map +1 -1
- package/dist/{fit-CbxyHN69.js → fit-DGSwMMNs.js} +0 -0
- package/dist/{fit-CbxyHN69.js.map → fit-DGSwMMNs.js.map} +1 -1
- package/dist/{html-dom-wVa3TiG7.js → html-dom--J-Xuucf.js} +19 -5
- package/dist/html-dom--J-Xuucf.js.map +1 -0
- package/dist/html.d.ts +3 -3
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +6 -3
- package/dist/html.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +1 -1
- package/dist/inspect.js +2 -2
- package/dist/inspect.js.map +1 -1
- package/dist/math.d.ts +1 -1
- package/dist/math.js +2 -1
- package/dist/math.js.map +1 -1
- package/dist/measure.d.ts +2 -2
- package/dist/measure.js +1 -1
- package/dist/node.d.ts +14 -6
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +11 -3
- package/dist/node.js.map +1 -1
- package/dist/{pres-5x1bjCzk.d.ts → pres-2WsBGimU.d.ts} +3 -3
- package/dist/{pres-5x1bjCzk.d.ts.map → pres-2WsBGimU.d.ts.map} +1 -1
- package/dist/{presentation-RGOiun5P.d.ts → presentation-CTVPpiwP.d.ts} +912 -485
- package/dist/presentation-CTVPpiwP.d.ts.map +1 -0
- package/dist/{presentation-B0JWdTN1.js → presentation-DAcOfzsP.js} +880 -366
- package/dist/presentation-DAcOfzsP.js.map +1 -0
- package/dist/read.d.ts +4 -4
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +2 -2
- package/dist/script.d.ts +2 -2
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +0 -0
- package/dist/script.js.map +1 -1
- package/dist/{shapes-BZU8UTW2.js → shapes-BWifcHDV.js} +1520 -996
- package/dist/shapes-BWifcHDV.js.map +1 -0
- package/dist/{slide-B6mDaM-P.d.ts → slide-YuSCGa45.d.ts} +409 -103
- package/dist/slide-YuSCGa45.d.ts.map +1 -0
- package/dist/{image-size-C5Z1sKof.js → st-enums-CgadEyPM.js} +235 -4
- package/dist/st-enums-CgadEyPM.js.map +1 -0
- package/dist/{text-WRUbOy2r.js → text-120VFSDm.js} +1027 -369
- package/dist/text-120VFSDm.js.map +1 -0
- package/dist/{units-internal-7JcMfYti.js → units-internal-CiFWZWk4.js} +2 -1
- package/dist/units-internal-CiFWZWk4.js.map +1 -0
- package/dist/zip.d.ts +2 -2
- package/dist/zip.js.map +1 -1
- package/package.json +38 -36
- package/dist/diagnostics-DzY9Tyfm.d.ts.map +0 -1
- package/dist/html-dom-wVa3TiG7.js.map +0 -1
- package/dist/image-size-C5Z1sKof.js.map +0 -1
- package/dist/presentation-B0JWdTN1.js.map +0 -1
- package/dist/presentation-RGOiun5P.d.ts.map +0 -1
- package/dist/shapes-BZU8UTW2.js.map +0 -1
- package/dist/slide-B6mDaM-P.d.ts.map +0 -1
- package/dist/text-WRUbOy2r.js.map +0 -1
- package/dist/units-internal-7JcMfYti.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as CustomPropertyValue } from "./pres-
|
|
1
|
+
import { t as CustomPropertyValue } from "./pres-2WsBGimU.js";
|
|
2
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
3
|
import { a as Part, i as Relationships, n as OpcPackage, o as Element, t as OpcInput } from "./package-CaOLXSNi.js";
|
|
4
4
|
//#region src/read/oxml/theme.d.ts
|
|
@@ -6,37 +6,31 @@ import { a as Part, i as Relationships, n as OpcPackage, o as Element, t as OpcI
|
|
|
6
6
|
* The colour-resolution context: the two maps that turn a DrawingML colour
|
|
7
7
|
* reference into a literal hex — the effective colour map (token → `clrScheme`
|
|
8
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
|
|
9
|
+
* 6-hex RGB). Shared by the read-model colour getters and {@link ThemeContext}.
|
|
10
10
|
*/
|
|
11
11
|
interface ColorContext {
|
|
12
12
|
clrMap: Map<string, string>;
|
|
13
13
|
clrScheme: Map<string, string>;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* The source theme subgraph a slide, notes slide, layout or master resolves against: the
|
|
17
|
+
* {@link ColorContext} maps, the live `a:fmtScheme` for style-matrix resolution, and the roots
|
|
18
|
+
* of the inheritance chain a placeholder reads through.
|
|
19
|
+
*
|
|
20
|
+
* Every root here is **read-only** — nothing in this module or in `placeholder-inherit.ts`
|
|
21
|
+
* mutates one. The import-time flatten pass extends this with the one field it needs to write
|
|
22
|
+
* from (see `FlattenContext` in `read/api/ops/flatten.ts`).
|
|
19
23
|
*/
|
|
20
|
-
interface
|
|
24
|
+
interface ThemeContext extends ColorContext {
|
|
21
25
|
fmtScheme: Element | null;
|
|
22
26
|
/**
|
|
23
|
-
* The
|
|
24
|
-
* `
|
|
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.
|
|
27
|
+
* The source `slideLayout` root element, for resolving what a placeholder inherits.
|
|
28
|
+
* `null`/absent disables the layout tier.
|
|
34
29
|
*/
|
|
35
30
|
layoutRoot?: Element | null;
|
|
36
31
|
/**
|
|
37
|
-
* The source `slideMaster` root element, for resolving placeholder
|
|
38
|
-
*
|
|
39
|
-
* never mutated.
|
|
32
|
+
* The source `slideMaster` root element, for resolving placeholder inheritance via its
|
|
33
|
+
* placeholder `a:lstStyle` and `p:txStyles`.
|
|
40
34
|
*/
|
|
41
35
|
masterRoot?: Element | null;
|
|
42
36
|
/**
|
|
@@ -304,101 +298,448 @@ interface ShapeProperties {
|
|
|
304
298
|
lnAfter: string[] | null;
|
|
305
299
|
}
|
|
306
300
|
//#endregion
|
|
307
|
-
//#region src/read/api/
|
|
301
|
+
//#region src/read/api/pattern-fill.d.ts
|
|
308
302
|
/**
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
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).
|
|
303
|
+
* A pattern fill (`a:pattFill`) — a two-colour preset hatch. The write-side
|
|
304
|
+
* `fill: { type: 'pattern', pattern: { preset, fgColor, bgColor } }` emits the same element,
|
|
305
|
+
* so the {@link preset} name and both colours round-trip. Colours resolve against the theme
|
|
306
|
+
* (a scheme token → literal hex) the same way a solid fill does.
|
|
316
307
|
*/
|
|
317
|
-
interface
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
|
|
308
|
+
interface PatternFill {
|
|
309
|
+
/** Preset pattern name (`@prst`, e.g. `pct50`/`diagCross`/`ltUpDiag`), or `null` when unset. */
|
|
310
|
+
preset: string | null;
|
|
311
|
+
/** Foreground colour (`a:fgClr`) resolved against the theme, or `null`. */
|
|
312
|
+
foreground: ResolvedColor | null;
|
|
313
|
+
/** Background colour (`a:bgClr`) resolved against the theme, or `null`. */
|
|
314
|
+
background: ResolvedColor | null;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/read/api/shapes/types.d.ts
|
|
318
|
+
/** Discriminator for the concrete `Shape` subclass. */
|
|
319
|
+
type ShapeType = 'autoShape' | 'picture' | 'connector' | 'graphicFrame' | 'group';
|
|
320
|
+
/** One end of a connector/line (`a:ln/a:headEnd` or `a:tailEnd`), as read from a shape. */
|
|
321
|
+
interface LineEnd {
|
|
322
|
+
/** Arrowhead type (`@type`: `none`/`triangle`/`stealth`/`diamond`/`oval`/`arrow`). */
|
|
323
|
+
type: string;
|
|
324
|
+
/** Width class (`@w`: `sm`/`med`/`lg`), or `null` when unset. */
|
|
325
|
+
width: string | null;
|
|
326
|
+
/** Length class (`@len`: `sm`/`med`/`lg`), or `null` when unset. */
|
|
327
|
+
length: string | null;
|
|
328
|
+
}
|
|
329
|
+
/** Both ends of a shape's line/border, when either carries an arrowhead. */
|
|
330
|
+
interface LineEnds {
|
|
331
|
+
head: LineEnd | null;
|
|
332
|
+
tail: LineEnd | null;
|
|
322
333
|
}
|
|
323
334
|
/**
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
335
|
+
* One bound end of a connector (`p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn` or `a:endCxn`),
|
|
336
|
+
* as read. A connector authored with `startShape`/`endShape` attaches each end to
|
|
337
|
+
* a shape by that shape's `p:cNvPr/@id` plus a connection-site index; an unbound
|
|
338
|
+
* end (the writer emits a bare `p:cNvCxnSpPr`) reports no site at all — see
|
|
339
|
+
* {@link Connector.startConnection}. This is the read counterpart of the write
|
|
340
|
+
* API's `startShape`/`startShapeIdx` split, which binds by `objectName` and
|
|
341
|
+
* resolves the name → id at serialize time.
|
|
328
342
|
*/
|
|
329
|
-
interface
|
|
330
|
-
/**
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
343
|
+
interface ConnectionSite {
|
|
344
|
+
/** The bound shape's drawing id (`@id`, i.e. its `p:cNvPr/@id`). */
|
|
345
|
+
shapeId: number;
|
|
346
|
+
/** Connection-site index on the bound shape (`@idx`; 0-based, preset-dependent). */
|
|
347
|
+
siteIndex: number;
|
|
348
|
+
/**
|
|
349
|
+
* The bound shape resolved to a read-model shape via {@link Slide.shapeByIdDeep},
|
|
350
|
+
* which descends into groups — so a connector bound to a shape nested in a group
|
|
351
|
+
* resolves the same as one bound to a top-level shape. `null` only when no shape
|
|
352
|
+
* anywhere on the slide carries that id (a genuinely dangling binding), which is
|
|
353
|
+
* faithful degradation and does not throw.
|
|
354
|
+
*/
|
|
355
|
+
boundShape: AnyShape | null;
|
|
340
356
|
}
|
|
341
357
|
/**
|
|
342
|
-
* A
|
|
343
|
-
*
|
|
344
|
-
*
|
|
358
|
+
* A shape's outer drop shadow (`spPr/a:effectLst/a:outerShdw`), as read from a
|
|
359
|
+
* shape and resolved against the slide theme. Distances are in points (the EMU
|
|
360
|
+
* source ÷ 12700) and the direction in degrees (the `60000`ths source ÷ 60000),
|
|
361
|
+
* matching the write-side {@link ShadowProps} convention so it round-trips.
|
|
345
362
|
*/
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
363
|
+
interface OuterShadow {
|
|
364
|
+
/** Effective shadow colour as 6-hex (theme-resolved, transforms applied), or `null`. */
|
|
365
|
+
color: string | null;
|
|
366
|
+
/** Theme colour token when the shadow colour was a scheme colour (e.g. `accent1`), else `undefined`. */
|
|
367
|
+
colorToken?: string;
|
|
368
|
+
/** Shadow opacity 0–1 (from the colour's `a:alpha`), or `undefined` when fully opaque. */
|
|
369
|
+
alpha?: number;
|
|
370
|
+
/** Blur radius in points (`@blurRad` ÷ 12700), or `undefined` when unset. */
|
|
371
|
+
blurPt?: number;
|
|
372
|
+
/** Offset distance in points (`@dist` ÷ 12700), or `undefined` when unset. */
|
|
373
|
+
offsetPt?: number;
|
|
374
|
+
/** Offset direction in degrees, clockwise from 3 o'clock (`@dir` ÷ 60000), or `undefined` when unset. */
|
|
375
|
+
angleDeg?: number;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* A shape's inner shadow (`spPr/a:effectLst/a:innerShdw`), resolved against the
|
|
379
|
+
* slide theme. Identical fields to {@link OuterShadow} — CT_InnerShadowEffect
|
|
380
|
+
* carries the same `blurRad`/`dist`/`dir` + colour — but a distinct type so a
|
|
381
|
+
* consumer can tell an inset shadow from a drop shadow. Distances in points,
|
|
382
|
+
* direction in degrees, matching the write-side `shadow: { type: 'inner' }`.
|
|
383
|
+
*/
|
|
384
|
+
interface InnerShadow {
|
|
385
|
+
/** Effective shadow colour as 6-hex (theme-resolved, transforms applied), or `null`. */
|
|
386
|
+
color: string | null;
|
|
387
|
+
/** Theme colour token when the shadow colour was a scheme colour (e.g. `accent1`), else `undefined`. */
|
|
388
|
+
colorToken?: string;
|
|
389
|
+
/** Shadow opacity 0–1 (from the colour's `a:alpha`), or `undefined` when fully opaque. */
|
|
390
|
+
alpha?: number;
|
|
391
|
+
/** Blur radius in points (`@blurRad` ÷ 12700), or `undefined` when unset. */
|
|
392
|
+
blurPt?: number;
|
|
393
|
+
/** Offset distance in points (`@dist` ÷ 12700), or `undefined` when unset. */
|
|
394
|
+
offsetPt?: number;
|
|
395
|
+
/** Offset direction in degrees, clockwise from 3 o'clock (`@dir` ÷ 60000), or `undefined` when unset. */
|
|
396
|
+
angleDeg?: number;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* A shape's glow effect (`spPr/a:effectLst/a:glow`) — a coloured halo — resolved
|
|
400
|
+
* against the slide theme. The write-side text glow (`glow: { size, color,
|
|
401
|
+
* opacity }`) emits the same element, so {@link radiusPt} (`@rad` ÷ 12700) and the
|
|
402
|
+
* colour round-trip.
|
|
403
|
+
*/
|
|
404
|
+
interface Glow {
|
|
405
|
+
/** Effective glow colour as 6-hex (theme-resolved, transforms applied), or `null`. */
|
|
406
|
+
color: string | null;
|
|
407
|
+
/** Theme colour token when the glow colour was a scheme colour (e.g. `accent1`), else `undefined`. */
|
|
408
|
+
colorToken?: string;
|
|
409
|
+
/** Glow opacity 0–1 (from the colour's `a:alpha`), or `undefined` when fully opaque. */
|
|
410
|
+
alpha?: number;
|
|
411
|
+
/** Glow radius in points (`@rad` ÷ 12700), or `undefined` when unset. */
|
|
412
|
+
radiusPt?: number;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* A shape's reflection effect (`spPr/a:effectLst/a:reflection`) — a mirrored fade
|
|
416
|
+
* beneath the shape. This library's writer authors none, so this is a **read-only**
|
|
417
|
+
* surface: a consumer that finds one should carry the part verbatim rather than
|
|
418
|
+
* regenerate it. Only the attributes a faithful replica needs are decoded —
|
|
419
|
+
* distances in points (÷ 12700), directions in degrees (÷ 60000), and the start/end
|
|
420
|
+
* alpha and position pairs as 0–1 fractions (the `1000`ths-of-a-percent source
|
|
421
|
+
* ÷ 100000). All fields are optional; an attribute absent from the source is omitted.
|
|
422
|
+
*/
|
|
423
|
+
interface Reflection {
|
|
424
|
+
/** Blur radius in points (`@blurRad` ÷ 12700). */
|
|
425
|
+
blurPt?: number;
|
|
426
|
+
/** Start opacity 0–1 (`@stA` ÷ 100000). */
|
|
427
|
+
startAlpha?: number;
|
|
428
|
+
/** Start position along the reflection 0–1 (`@stPos` ÷ 100000). */
|
|
429
|
+
startPos?: number;
|
|
430
|
+
/** End opacity 0–1 (`@endA` ÷ 100000). */
|
|
431
|
+
endAlpha?: number;
|
|
432
|
+
/** End position along the reflection 0–1 (`@endPos` ÷ 100000). */
|
|
433
|
+
endPos?: number;
|
|
434
|
+
/** Offset distance in points (`@dist` ÷ 12700). */
|
|
435
|
+
distPt?: number;
|
|
436
|
+
/** Offset direction in degrees (`@dir` ÷ 60000). */
|
|
437
|
+
angleDeg?: number;
|
|
438
|
+
/** Fade direction in degrees (`@fadeDir` ÷ 60000). */
|
|
439
|
+
fadeAngleDeg?: number;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* A shape's soft-edge effect (`spPr/a:effectLst/a:softEdge`) — a feathered border.
|
|
443
|
+
* Like {@link Reflection}, the writer authors none, so carry it verbatim. `@rad`
|
|
444
|
+
* (the feather radius) ÷ 12700 → points.
|
|
445
|
+
*/
|
|
446
|
+
interface SoftEdge {
|
|
447
|
+
/** Feather radius in points (`@rad` ÷ 12700). */
|
|
448
|
+
radiusPt: number;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* One segment of a custom-geometry path (`a:path`), as read from a shape. The
|
|
452
|
+
* command verbs mirror the write-side `GeometryPoint` DSL (`src/types/`)
|
|
453
|
+
* so a consumer can map a `GeometryCommand[]` to `GeometryPoint[]` one-to-one.
|
|
454
|
+
*
|
|
455
|
+
* Coordinates (`x`/`y`/`x1`…) are raw path-unit integers in the path's own
|
|
456
|
+
* `0..w` / `0..h` space (see {@link CustomGeometryPath.w}); they are not EMU and
|
|
457
|
+
* must be scaled by the consumer against the shape's box. `arcTo` angles are in
|
|
458
|
+
* **degrees** (the raw `60000`ths-of-a-degree values divided by 60000), matching
|
|
459
|
+
* the write DSL's degree input.
|
|
460
|
+
*/
|
|
461
|
+
type GeometryCommand = {
|
|
462
|
+
cmd: 'moveTo';
|
|
463
|
+
x: number;
|
|
464
|
+
y: number;
|
|
349
465
|
} | {
|
|
350
|
-
|
|
351
|
-
|
|
466
|
+
cmd: 'lnTo';
|
|
467
|
+
x: number;
|
|
468
|
+
y: number;
|
|
469
|
+
} | {
|
|
470
|
+
cmd: 'cubicBezTo';
|
|
471
|
+
x1: number;
|
|
472
|
+
y1: number;
|
|
473
|
+
x2: number;
|
|
474
|
+
y2: number;
|
|
475
|
+
x: number;
|
|
476
|
+
y: number;
|
|
477
|
+
} | {
|
|
478
|
+
cmd: 'quadBezTo';
|
|
479
|
+
x1: number;
|
|
480
|
+
y1: number;
|
|
481
|
+
x: number;
|
|
482
|
+
y: number;
|
|
483
|
+
} | {
|
|
484
|
+
cmd: 'arcTo';
|
|
485
|
+
wR: number;
|
|
486
|
+
hR: number;
|
|
487
|
+
stAng: number;
|
|
488
|
+
swAng: number;
|
|
489
|
+
} | {
|
|
490
|
+
cmd: 'close';
|
|
352
491
|
};
|
|
353
|
-
/** One
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
492
|
+
/** One `<a:path>` of a custom geometry, with its path-unit viewport and render attrs. */
|
|
493
|
+
interface CustomGeometryPath {
|
|
494
|
+
/** Path-unit width (`a:path/@w`); the `x` denominator for this path's coords. Default `0`. */
|
|
495
|
+
w: number;
|
|
496
|
+
/** Path-unit height (`a:path/@h`); the `y` denominator for this path's coords. Default `0`. */
|
|
497
|
+
h: number;
|
|
498
|
+
/** Fill mode (`a:path/@fill`, `ST_PathFillMode`, e.g. `norm`/`none`/`lighten`). Default `norm`. */
|
|
499
|
+
fill: string;
|
|
500
|
+
/** Whether the path is stroked (`a:path/@stroke`). Default `true`. */
|
|
501
|
+
stroke: boolean;
|
|
502
|
+
/** The path's segments in document order — order *is* the geometry. */
|
|
503
|
+
commands: GeometryCommand[];
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Custom freeform geometry (`spPr/a:custGeom/a:pathLst`), as read from a shape.
|
|
507
|
+
* Faithfully exposes every `a:path` rather than flattening to a single command
|
|
508
|
+
* list: the schema allows repeatable `a:path`, each with independent
|
|
509
|
+
* `fill`/`stroke`. Desktop PowerPoint's own freeforms only ever emit one
|
|
510
|
+
* `a:path` (a hole is one path with two `moveTo`…`close` contours), but
|
|
511
|
+
* multi-`a:path` input is schema-legal (e.g. SVG import) and preserved here.
|
|
512
|
+
*/
|
|
513
|
+
interface CustomGeometry {
|
|
514
|
+
paths: CustomGeometryPath[];
|
|
515
|
+
}
|
|
516
|
+
/** A shape's resolved position and size in slide-absolute EMU. */
|
|
517
|
+
interface AbsoluteFrame {
|
|
518
|
+
left: number;
|
|
519
|
+
top: number;
|
|
520
|
+
width: number;
|
|
521
|
+
height: number;
|
|
522
|
+
/** Effective clockwise rotation in degrees after composing enclosing group rotations. */
|
|
523
|
+
rotation: number;
|
|
524
|
+
/** Effective horizontal flip after XOR-composing enclosing group flips. */
|
|
525
|
+
flipH: boolean;
|
|
526
|
+
/** Effective vertical flip after XOR-composing enclosing group flips. */
|
|
527
|
+
flipV: boolean;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* A group shape's own child coordinate space (`p:grpSpPr/a:xfrm/a:chOff` and
|
|
531
|
+
* `a:chExt`) in EMU — the space its children's `a:off`/`a:ext` are authored in.
|
|
532
|
+
*
|
|
533
|
+
* Named after the OOXML attributes rather than in the `left`/`top`/`width`/
|
|
534
|
+
* `height` vocabulary the rest of the read model uses, because this is not a
|
|
535
|
+
* frame on the slide: it is the source rectangle of the
|
|
536
|
+
* `off + (p - chOff) * (ext / chExt)` mapping, and nothing about it is
|
|
537
|
+
* positional. A consumer reaching for it is rebuilding that mapping, so the
|
|
538
|
+
* names it needs are the ones the mapping is written in.
|
|
539
|
+
*/
|
|
540
|
+
interface ChildFrame {
|
|
541
|
+
/** `a:chOff/@x`. */
|
|
542
|
+
offsetX: number;
|
|
543
|
+
/** `a:chOff/@y`. */
|
|
544
|
+
offsetY: number;
|
|
545
|
+
/** `a:chExt/@cx`. */
|
|
546
|
+
extentX: number;
|
|
547
|
+
/** `a:chExt/@cy`. */
|
|
548
|
+
extentY: number;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* A colour reference inside a picture recolour effect, split by colour model
|
|
552
|
+
* (mirrors {@link GradientStop}). At most one field is non-`null`.
|
|
553
|
+
*/
|
|
554
|
+
interface RecolorColor {
|
|
555
|
+
/** Explicit RGB as 6-hex (`a:srgbClr/@val`), or `null`. */
|
|
556
|
+
color: string | null;
|
|
557
|
+
/** Theme colour token (`a:schemeClr/@val`, e.g. `accent1`), or `null`. */
|
|
558
|
+
schemeColor: string | null;
|
|
559
|
+
/** Preset colour name (`a:prstClr/@val`, e.g. `black`/`white` — the duotone icon-tint stops), or `null`. */
|
|
560
|
+
presetColor: string | null;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* A picture's blip recolour effect (`p:blipFill/a:blip` recolour child), as read.
|
|
564
|
+
* A small discriminated union over the effects a faithful reader needs to
|
|
565
|
+
* reproduce a recoloured image. Colours use the same `color`/`schemeColor`/
|
|
566
|
+
* `presetColor` split as {@link GradientStop}, so theme tokens can resolve through
|
|
567
|
+
* {@link Slide.themeContext}. `threshold`/`amount` are 0–1 fractions.
|
|
568
|
+
*/
|
|
569
|
+
type Recolor = {
|
|
570
|
+
kind: 'duotone';
|
|
571
|
+
stops: RecolorColor[];
|
|
572
|
+
} | {
|
|
573
|
+
kind: 'clrChange';
|
|
574
|
+
from: RecolorColor | null;
|
|
575
|
+
to: RecolorColor | null;
|
|
576
|
+
} | {
|
|
577
|
+
kind: 'grayscale';
|
|
578
|
+
} | {
|
|
579
|
+
kind: 'biLevel';
|
|
580
|
+
threshold: number | null;
|
|
581
|
+
} | {
|
|
582
|
+
kind: 'alphaModFix';
|
|
583
|
+
amount: number;
|
|
584
|
+
};
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/read/api/text.d.ts
|
|
587
|
+
/**
|
|
588
|
+
* What a {@link Run}'s text body needs to resolve an *inherited* run
|
|
589
|
+
* colour/size/face/bold: which placeholder the text lives in (or `null` for a
|
|
590
|
+
* non-placeholder shape, which still resolves its `p:style/a:fontRef` and the
|
|
591
|
+
* presentation `p:defaultTextStyle`), the slide theme context (with the
|
|
592
|
+
* layout/master roots) to resolve against, and the shape's resolved
|
|
593
|
+
* `p:style/a:fontRef` text tier. The owning slide's text body `a:lstStyle` is added
|
|
594
|
+
* per text frame. Absent only for text reached without a theme context (table cells).
|
|
595
|
+
*/
|
|
596
|
+
interface PlaceholderTextContext {
|
|
597
|
+
ph: PlaceholderRef | null;
|
|
598
|
+
flatten: ThemeContext;
|
|
599
|
+
/** The shape's resolved `p:style/a:fontRef` colour + face tier, or `null` when it has none. */
|
|
600
|
+
fontRef?: StyleFontRef | null;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* A run's click hyperlink (`a:rPr/a:hlinkClick`): a link on a span of text. A URL
|
|
604
|
+
* link carries an external {@link url}; a slide jump carries the internal
|
|
605
|
+
* {@link targetPartName} (the linked slide's part) alongside its `hlinksldjump`
|
|
606
|
+
* {@link action}. `tooltip` and `relId` are surfaced when present.
|
|
607
|
+
*/
|
|
608
|
+
interface RunHyperlink {
|
|
609
|
+
/** External URL target (its `@r:id` resolves to a `TargetMode="External"` rel), or `null` for an internal/action-only link. */
|
|
610
|
+
url: string | null;
|
|
611
|
+
/** Absolute partname of an internal target (e.g. the slide a jump points at), or `null`. */
|
|
612
|
+
targetPartName: string | null;
|
|
613
|
+
/** Navigation action token (`@action`, e.g. `ppaction://hlinksldjump`), or `null` when absent/empty. */
|
|
614
|
+
action: string | null;
|
|
615
|
+
/** Tooltip text (`@tooltip`), or `null` when absent/empty. */
|
|
616
|
+
tooltip: string | null;
|
|
617
|
+
/** The relationship id (`@r:id`) backing the link, or `null` when the link is action-only. */
|
|
618
|
+
relId: string | null;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* A paragraph's line spacing (`a:pPr/a:lnSpc`), in whichever of the two OOXML
|
|
622
|
+
* forms the file uses: an exact point height (`a:spcPts`) or a percentage of the
|
|
623
|
+
* single-line height (`a:spcPct` — e.g. `percent: 150` for 1.5× spacing).
|
|
624
|
+
*/
|
|
625
|
+
type LineSpacing = {
|
|
626
|
+
type: 'points';
|
|
627
|
+
valuePt: number;
|
|
628
|
+
} | {
|
|
629
|
+
type: 'percent';
|
|
630
|
+
percent: number;
|
|
631
|
+
};
|
|
632
|
+
/**
|
|
633
|
+
* The bullet's own font, size and colour (`a:buFont` / `a:buSzPct` / `a:buSzPts` /
|
|
634
|
+
* `a:buClr`) — the properties that style the glyph or number itself rather than
|
|
635
|
+
* the text after it. Every field is `null` when the paragraph leaves it to be
|
|
636
|
+
* inherited from the list style.
|
|
637
|
+
*
|
|
638
|
+
* These are siblings of the bullet kind in `a:pPr`, not children of it, so they
|
|
639
|
+
* are carried alongside each kind rather than inside it.
|
|
640
|
+
*/
|
|
641
|
+
interface BulletStyle {
|
|
642
|
+
/** `a:buFont/@typeface` — the face the glyph is drawn in (a symbol font such as `Wingdings`), or `null`. */
|
|
643
|
+
font: string | null;
|
|
644
|
+
/** `a:buSzPct/@val` as a percentage of the run size (e.g. `80`; the raw attribute is thousandths of a percent), or `null`. */
|
|
645
|
+
sizePct: number | null;
|
|
646
|
+
/** `a:buSzPts/@val` as an absolute point size (the raw attribute is hundredths of a point), or `null`. The alternative to {@link sizePct}; at most one is set. */
|
|
647
|
+
sizePt: number | null;
|
|
648
|
+
/** Explicit RGB bullet colour as 6-hex (`a:buClr/a:srgbClr/@val`), or `null`. */
|
|
649
|
+
color: string | null;
|
|
650
|
+
/** Theme colour token when the bullet colour is a scheme colour (`a:buClr/a:schemeClr/@val`), or `null`. */
|
|
651
|
+
schemeColor: string | null;
|
|
652
|
+
/** The bullet colour resolved against the slide theme with its transforms applied, or `null` when unset or not resolvable to a literal. */
|
|
653
|
+
resolvedColor: ResolvedColor | null;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* A paragraph's bullet, as the structured counterpart of the `a:pPr` bullet
|
|
657
|
+
* children. Discriminated on {@link kind}, which is one of the four mutually
|
|
658
|
+
* exclusive choices the schema allows:
|
|
659
|
+
*
|
|
660
|
+
* - `'none'` — `a:buNone`, the bullet explicitly suppressed. Carries no style,
|
|
661
|
+
* because there is no glyph to style.
|
|
662
|
+
* - `'char'` — `a:buChar`, a literal glyph.
|
|
663
|
+
* - `'autoNum'` — `a:buAutoNum`, an auto-numbered list.
|
|
664
|
+
* - `'picture'` — `a:buBlip`, an image used as the glyph.
|
|
665
|
+
*
|
|
666
|
+
* A paragraph that names none of them inherits its bullet from the list style and
|
|
667
|
+
* reports `null` rather than a member of this union.
|
|
668
|
+
*/
|
|
669
|
+
type BulletDetail = {
|
|
670
|
+
kind: 'none';
|
|
671
|
+
} | ({
|
|
672
|
+
kind: 'char';
|
|
673
|
+
/** The glyph itself (`a:buChar/@char`) — a bare character, never a tagged string. */
|
|
674
|
+
char: string;
|
|
675
|
+
} & BulletStyle) | ({
|
|
676
|
+
kind: 'autoNum';
|
|
677
|
+
/** The numbering scheme (`a:buAutoNum/@type`, e.g. `arabicPeriod`). */
|
|
678
|
+
scheme: string;
|
|
679
|
+
/**
|
|
680
|
+
* The number this list starts at (`a:buAutoNum/@startAt`), or `null` when
|
|
681
|
+
* unset (the schema default is 1). Content rather than styling: a list
|
|
682
|
+
* continuing "5. Deploy" that restarts at 1 is a different slide.
|
|
683
|
+
*/
|
|
684
|
+
startAt: number | null;
|
|
685
|
+
} & BulletStyle) | ({
|
|
686
|
+
kind: 'picture';
|
|
687
|
+
/**
|
|
688
|
+
* Absolute partname of the image used as the glyph (`a:buBlip/a:blip/@r:embed`,
|
|
689
|
+
* resolved through the owning part's relationships), or `null` when the
|
|
690
|
+
* paragraph was reached without them or the blip carries no `r:embed`.
|
|
691
|
+
*/
|
|
692
|
+
imagePartName: string | null;
|
|
693
|
+
} & BulletStyle);
|
|
694
|
+
/** One text run (`a:r`): a span of text with uniform character formatting. */
|
|
695
|
+
declare class Run {
|
|
696
|
+
#private;
|
|
697
|
+
private readonly element;
|
|
698
|
+
private readonly part;
|
|
699
|
+
/** The owning slide's theme context (colour maps + `fontScheme`), for the `resolved*` getters; absent when the run was reached without one. */
|
|
700
|
+
private readonly themeContext?;
|
|
701
|
+
/**
|
|
702
|
+
* Resolves the colour this run inherits from its placeholder/list-style chain
|
|
703
|
+
* when it sets none of its own (item A). Built by the owning {@link Paragraph}
|
|
704
|
+
* for placeholder text; absent for non-placeholder runs. Called lazily.
|
|
705
|
+
*/
|
|
706
|
+
private readonly inheritedColor?;
|
|
707
|
+
/**
|
|
708
|
+
* Resolves the point size this run inherits from the same chain when it sets no
|
|
709
|
+
* own `@sz`. Built by the owning {@link Paragraph} for placeholder text; absent
|
|
710
|
+
* for non-placeholder runs. Called lazily.
|
|
711
|
+
*/
|
|
712
|
+
private readonly inheritedSize?;
|
|
713
|
+
/**
|
|
714
|
+
* Resolves the typeface this run inherits from the same chain (a `+mj-*`/`+mn-*`
|
|
715
|
+
* theme token already resolved to a literal face) when it sets no own `a:latin`.
|
|
716
|
+
* Built by the owning {@link Paragraph} for placeholder text; absent otherwise.
|
|
717
|
+
* Called lazily.
|
|
718
|
+
*/
|
|
719
|
+
private readonly inheritedFace?;
|
|
720
|
+
/**
|
|
721
|
+
* Resolves whether this run inherits bold from the same chain when it sets no
|
|
722
|
+
* own `@b`. Built by the owning {@link Paragraph} for placeholder text; absent
|
|
723
|
+
* for non-placeholder runs. Called lazily.
|
|
724
|
+
*/
|
|
725
|
+
private readonly inheritedBold?;
|
|
726
|
+
/**
|
|
727
|
+
* The owning part's relationships, used to resolve a run hyperlink's `@r:id`
|
|
728
|
+
* to its external URL or internal target partname. Absent when the run was
|
|
729
|
+
* reached without them (e.g. table-cell or notes text), in which case
|
|
730
|
+
* {@link hyperlink} still reports the raw `@r:id`/`@action`/`@tooltip`.
|
|
731
|
+
*/
|
|
732
|
+
private readonly relationships?;
|
|
733
|
+
/**
|
|
734
|
+
* The owning shape's resolved `p:style/a:fontRef` colour + face tier — the
|
|
735
|
+
* fallback consulted for {@link resolvedColor}/{@link resolvedFontFace} just
|
|
395
736
|
* below the run's own `a:rPr` and above the placeholder/`p:defaultTextStyle`
|
|
396
737
|
* chain. Absent when the shape has no `p:style/a:fontRef`.
|
|
397
738
|
*/
|
|
398
739
|
private readonly fontRef?;
|
|
399
740
|
constructor(element: Element, part: Part,
|
|
400
741
|
/** The owning slide's theme context (colour maps + `fontScheme`), for the `resolved*` getters; absent when the run was reached without one. */
|
|
401
|
-
themeContext?:
|
|
742
|
+
themeContext?: ThemeContext | undefined,
|
|
402
743
|
/**
|
|
403
744
|
* Resolves the colour this run inherits from its placeholder/list-style chain
|
|
404
745
|
* when it sets none of its own (item A). Built by the owning {@link Paragraph}
|
|
@@ -569,7 +910,7 @@ declare class Paragraph {
|
|
|
569
910
|
private readonly relationships?;
|
|
570
911
|
constructor(element: Element, part: Part,
|
|
571
912
|
/** The owning slide's theme context (colour maps + `fontScheme`), threaded to each {@link Run} for the `resolved*` getters. */
|
|
572
|
-
themeContext?:
|
|
913
|
+
themeContext?: ThemeContext | undefined,
|
|
573
914
|
/**
|
|
574
915
|
* Placeholder + slide-list-style context for resolving a placeholder-inherited
|
|
575
916
|
* run colour/size/face; absent for non-placeholder text. The owning
|
|
@@ -610,13 +951,18 @@ declare class Paragraph {
|
|
|
610
951
|
/** First-line indent in points (`a:pPr/@indent` is EMU; negative for a hanging indent), or `null` when unset. */
|
|
611
952
|
get indentPt(): number | null;
|
|
612
953
|
/**
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
*
|
|
616
|
-
*
|
|
617
|
-
*
|
|
954
|
+
* This paragraph's bullet — its kind, and for a drawn bullet the glyph, the
|
|
955
|
+
* numbering start, and the bullet's own font/size/colour. `null` when the
|
|
956
|
+
* paragraph names no bullet at all and inherits one from the list style.
|
|
957
|
+
*
|
|
958
|
+
* Structured rather than a tagged string, which is not merely tidier. The
|
|
959
|
+
* previous `bullet` accessor reported `'none'` / `'char:•'` /
|
|
960
|
+
* `'autoNum:arabicPeriod'`, and that shape is ambiguous when the glyph is
|
|
961
|
+
* itself a colon; worse, it reads as a bare glyph, which is exactly how the
|
|
962
|
+
* script converter first consumed it — `'none'.codePointAt(0)` put a literal
|
|
963
|
+
* `n` bullet on every converted deck, silently. See {@link BulletDetail}.
|
|
618
964
|
*/
|
|
619
|
-
get
|
|
965
|
+
get bulletDetail(): BulletDetail | null;
|
|
620
966
|
/**
|
|
621
967
|
* The paragraph's text: run (`a:r`) and field (`a:fld`) text concatenated in
|
|
622
968
|
* document order, with each line break (`a:br`) rendered as `\n`.
|
|
@@ -627,379 +973,116 @@ declare class Paragraph {
|
|
|
627
973
|
/** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
|
|
628
974
|
markDirty(): void;
|
|
629
975
|
}
|
|
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
|
-
}
|
|
976
|
+
/** A shape's text frame (`p:txBody`): an ordered list of paragraphs. */
|
|
944
977
|
/**
|
|
945
|
-
*
|
|
946
|
-
*
|
|
947
|
-
*
|
|
948
|
-
*
|
|
949
|
-
* `
|
|
950
|
-
* multi-`a:path` input is schema-legal (e.g. SVG import) and preserved here.
|
|
978
|
+
* A text frame's body properties (`a:bodyPr`), as read from a shape. Carries the
|
|
979
|
+
* inset/anchor/vertical-text settings that govern where text sits inside its box
|
|
980
|
+
* — the difference between a label that clears a left rail and one that overlaps
|
|
981
|
+
* it. Only **explicitly set** attributes are reported; an absent inset means the
|
|
982
|
+
* PowerPoint default (`lIns`/`rIns` = 0.1", `tIns`/`bIns` = 0.05").
|
|
951
983
|
*/
|
|
952
|
-
interface
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
/**
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
flipV: boolean;
|
|
984
|
+
interface BodyProperties {
|
|
985
|
+
/** Text direction (`@vert`: `horz`/`vert`/`vert270`/`eaVert`/`wordArtVert`…), or `null` when horizontal/unset. */
|
|
986
|
+
vert: string | null;
|
|
987
|
+
/** Vertical anchor (`@anchor`: `t`/`ctr`/`b`), or `null` when unset (defaults to top). */
|
|
988
|
+
anchor: string | null;
|
|
989
|
+
/** Wrap mode (`@wrap`: `square`/`none`), or `null` when unset. */
|
|
990
|
+
wrap: string | null;
|
|
991
|
+
/** Explicitly-set text insets in points (`@lIns`/`@rIns`/`@tIns`/`@bIns` ÷ 12700); a missing side uses the PowerPoint default. */
|
|
992
|
+
insetsPt: {
|
|
993
|
+
left?: number;
|
|
994
|
+
right?: number;
|
|
995
|
+
top?: number;
|
|
996
|
+
bottom?: number;
|
|
997
|
+
};
|
|
967
998
|
}
|
|
968
999
|
/**
|
|
969
|
-
* A
|
|
970
|
-
*
|
|
1000
|
+
* A text frame's vertical-autofit mode, read from its `a:bodyPr` autofit child:
|
|
1001
|
+
* - `'none'` — `a:noAutofit`, or no autofit child at all (the box has a fixed
|
|
1002
|
+
* size and text can overflow); write-side `fit: 'none'`.
|
|
1003
|
+
* - `'normAutofit'`— `a:normAutofit` (shrink text to fit); write-side `fit: 'shrink'`.
|
|
1004
|
+
* - `'spAutoFit'` — `a:spAutoFit` (resize the shape to fit text); write-side `fit: 'resize'`.
|
|
971
1005
|
*/
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
/**
|
|
978
|
-
|
|
1006
|
+
type AutofitMode = 'none' | 'normAutofit' | 'spAutoFit';
|
|
1007
|
+
declare class TextFrame {
|
|
1008
|
+
#private;
|
|
1009
|
+
private readonly txBody;
|
|
1010
|
+
private readonly part;
|
|
1011
|
+
/** The owning slide's theme context (colour maps + `fontScheme`), threaded to each {@link Paragraph}/{@link Run} for the `resolved*` getters. */
|
|
1012
|
+
private readonly themeContext?;
|
|
1013
|
+
/**
|
|
1014
|
+
* The placeholder this text body lives in, when any — enables
|
|
1015
|
+
* placeholder-inherited run colour/size/face resolution. Absent for ordinary
|
|
1016
|
+
* text boxes and table cells.
|
|
1017
|
+
*/
|
|
1018
|
+
private readonly placeholder?;
|
|
1019
|
+
/** The owning part's relationships, threaded to each {@link Paragraph}/{@link Run} for hyperlink `@r:id` resolution; absent when reached without them. */
|
|
1020
|
+
private readonly relationships?;
|
|
1021
|
+
constructor(txBody: Element, part: Part,
|
|
1022
|
+
/** The owning slide's theme context (colour maps + `fontScheme`), threaded to each {@link Paragraph}/{@link Run} for the `resolved*` getters. */
|
|
1023
|
+
themeContext?: ThemeContext | undefined,
|
|
1024
|
+
/**
|
|
1025
|
+
* The placeholder this text body lives in, when any — enables
|
|
1026
|
+
* placeholder-inherited run colour/size/face resolution. Absent for ordinary
|
|
1027
|
+
* text boxes and table cells.
|
|
1028
|
+
*/
|
|
1029
|
+
placeholder?: PlaceholderTextContext | undefined,
|
|
1030
|
+
/** The owning part's relationships, threaded to each {@link Paragraph}/{@link Run} for hyperlink `@r:id` resolution; absent when reached without them. */
|
|
1031
|
+
relationships?: Relationships | undefined);
|
|
1032
|
+
/** Paragraphs (`a:p`) in document order. */
|
|
1033
|
+
get paragraphs(): Paragraph[];
|
|
1034
|
+
/**
|
|
1035
|
+
* The frame's body properties (`a:bodyPr`: insets, anchor, vertical text), or
|
|
1036
|
+
* `null` when there is no `a:bodyPr`. Only explicitly-set insets are reported
|
|
1037
|
+
* (a missing side is the PowerPoint default — see {@link BodyProperties}).
|
|
1038
|
+
*/
|
|
1039
|
+
get bodyProperties(): BodyProperties | null;
|
|
1040
|
+
/**
|
|
1041
|
+
* The effective vertical anchor (`t`/`ctr`/`b`): the frame's own
|
|
1042
|
+
* `a:bodyPr/@anchor` when set, else the anchor it inherits from its
|
|
1043
|
+
* layout → master placeholder `a:bodyPr`. `null` when nothing in the chain sets
|
|
1044
|
+
* one (PowerPoint then defaults to top). Unlike {@link bodyProperties}'s
|
|
1045
|
+
* `anchor` (own attribute only), this surfaces the inherited anchor a
|
|
1046
|
+
* placeholder title relies on — the difference between a top- and
|
|
1047
|
+
* centre-anchored title that own-attribute reads alone cannot see.
|
|
1048
|
+
*/
|
|
1049
|
+
get resolvedAnchor(): string | null;
|
|
1050
|
+
/**
|
|
1051
|
+
* The frame's vertical-autofit mode (`a:bodyPr` autofit child), or `null` when
|
|
1052
|
+
* there is no `a:bodyPr`. A `bodyPr` with no autofit child — or an explicit
|
|
1053
|
+
* `a:noAutofit` — reads `'none'`. See {@link AutofitMode}. This is the deep-model
|
|
1054
|
+
* counterpart of `inspectPptx`'s per-shape `autofit`; unlike the shallow surface
|
|
1055
|
+
* it hangs off the navigable text frame.
|
|
1056
|
+
*/
|
|
1057
|
+
get autofit(): AutofitMode | null;
|
|
1058
|
+
/**
|
|
1059
|
+
* The baked shrink scale of a `normAutofit` frame as a percent (62.5 = 62.5%),
|
|
1060
|
+
* or `null` when the frame has no `a:normAutofit` or bakes no scale. A bare
|
|
1061
|
+
* `<a:normAutofit/>` (write-side `fit: 'shrink'`) carries no scale — PowerPoint
|
|
1062
|
+
* computes it on edit and draws at 100% until then — so it too reads `null`; an
|
|
1063
|
+
* explicit scale comes from `fit: { type: 'shrink', fontScale }`.
|
|
1064
|
+
*/
|
|
1065
|
+
get autofitFontScale(): number | null;
|
|
1066
|
+
/**
|
|
1067
|
+
* The baked line-spacing reduction of a `normAutofit` frame as a percent
|
|
1068
|
+
* (`a:normAutofit/@lnSpcReduction` ÷ 1000), or `null` when unset. The companion
|
|
1069
|
+
* to {@link autofitFontScale} (write-side `fit: { type: 'shrink', lnSpcReduction }`).
|
|
1070
|
+
*/
|
|
1071
|
+
get autofitLineSpaceReduction(): number | null;
|
|
1072
|
+
/** All paragraph text joined by `\n` (mirrors python-pptx `TextFrame.text`). */
|
|
1073
|
+
get text(): string;
|
|
1074
|
+
/**
|
|
1075
|
+
* Replace the frame's text with a single paragraph and run, preserving the
|
|
1076
|
+
* character formatting (`a:rPr`) of the frame's first existing run when there
|
|
1077
|
+
* is one. For multiple runs or per-run formatting, edit
|
|
1078
|
+
* `paragraphs[].runs[]` directly.
|
|
1079
|
+
*/
|
|
1080
|
+
set text(value: string);
|
|
1081
|
+
/** Escape hatch: the underlying `p:txBody` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
|
|
1082
|
+
get element_(): Element;
|
|
1083
|
+
/** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
|
|
1084
|
+
markDirty(): void;
|
|
979
1085
|
}
|
|
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
1086
|
//#endregion
|
|
1004
1087
|
//#region src/read/api/shapes/base.d.ts
|
|
1005
1088
|
/** Common base for every shape in a slide's shape tree. */
|
|
@@ -1148,10 +1231,23 @@ declare abstract class Shape {
|
|
|
1148
1231
|
/** Theme colour token when the fill is a scheme colour (`a:solidFill/a:schemeClr/@val`, e.g. `accent2`), or `null`. */
|
|
1149
1232
|
get fillSchemeColor(): string | null;
|
|
1150
1233
|
set fillSchemeColor(value: string | null);
|
|
1234
|
+
/**
|
|
1235
|
+
* `true` when the shape sets an explicit no-fill (`spPr/a:noFill`) — a
|
|
1236
|
+
* deliberately transparent surface. The fill-side counterpart of
|
|
1237
|
+
* {@link lineNoFill}, and the only accessor that separates it from a shape
|
|
1238
|
+
* carrying no fill child at all (one inheriting through `p:style/a:fillRef`):
|
|
1239
|
+
* every other fill accessor — {@link fillColor}, {@link fillSchemeColor},
|
|
1240
|
+
* {@link resolvedFill}, {@link gradientFill}, {@link patternFill},
|
|
1241
|
+
* {@link pictureFill} — reports `null` for both. The two paint completely
|
|
1242
|
+
* differently, so a consumer that cannot tell them apart paints a transparent
|
|
1243
|
+
* shape in the theme's accent colour.
|
|
1244
|
+
*/
|
|
1245
|
+
get fillNoFill(): boolean;
|
|
1151
1246
|
/**
|
|
1152
1247
|
* Set an explicit `<a:noFill/>` on the shape — a transparent surface. This is
|
|
1153
1248
|
* distinct from clearing the fill (`fillColor = null`), which removes the
|
|
1154
1249
|
* `a:solidFill` and lets the fill inherit from the shape's style/placeholder.
|
|
1250
|
+
* Read it back with {@link fillNoFill}.
|
|
1155
1251
|
*/
|
|
1156
1252
|
noFill(): void;
|
|
1157
1253
|
/** Explicit RGB line/border colour (`spPr/a:ln/a:solidFill/a:srgbClr/@val`), or `null`. */
|
|
@@ -1177,6 +1273,26 @@ declare abstract class Shape {
|
|
|
1177
1273
|
* to know the border was explicitly suppressed.
|
|
1178
1274
|
*/
|
|
1179
1275
|
get lineNoFill(): boolean;
|
|
1276
|
+
/**
|
|
1277
|
+
* The line end cap (`spPr/a:ln/@cap`) as the raw OOXML token — `'flat'`,
|
|
1278
|
+
* `'rnd'` (round) or `'sq'` (square) — or `null` when unset (PowerPoint's
|
|
1279
|
+
* default is `flat`). The write API authors this attribute through
|
|
1280
|
+
* `ShapeLineProps.cap`, so without the accessor a deck this library produced
|
|
1281
|
+
* could not be read back without losing it.
|
|
1282
|
+
*
|
|
1283
|
+
* Not cosmetic on a thick dashed rule: the cap decides whether each dash reads
|
|
1284
|
+
* as a rectangle or a lozenge, and it extends every dash by the stroke width.
|
|
1285
|
+
* SVG's `stroke-linecap` is the exact equivalent (`flat`→`butt`, `rnd`→`round`,
|
|
1286
|
+
* `sq`→`square`).
|
|
1287
|
+
*/
|
|
1288
|
+
get lineCap(): string | null;
|
|
1289
|
+
/**
|
|
1290
|
+
* The line alignment (`spPr/a:ln/@algn`) as the raw OOXML token — `'ctr'`
|
|
1291
|
+
* (centred on the shape's outline) or `'in'` (inset, drawn wholly inside it) —
|
|
1292
|
+
* or `null` when unset. It shifts a thick outline by half its width, so it
|
|
1293
|
+
* changes where the border sits relative to the fill.
|
|
1294
|
+
*/
|
|
1295
|
+
get lineAlign(): string | null;
|
|
1180
1296
|
/**
|
|
1181
1297
|
* Preset geometry name (`spPr/a:prstGeom/@prst`, e.g. `rect`), or `null` for
|
|
1182
1298
|
* custom geometry or none. Not an auto-shape-only property: PowerPoint gives a
|
|
@@ -1805,6 +1921,19 @@ declare class ChartExAxis {
|
|
|
1805
1921
|
markDirty(): void;
|
|
1806
1922
|
}
|
|
1807
1923
|
//#endregion
|
|
1924
|
+
//#region src/read/api/table-edit.d.ts
|
|
1925
|
+
/** The four edges plus the two diagonals, keyed as {@link TableCellEdge} names them. */
|
|
1926
|
+
declare const EDGE_QNAMES: {
|
|
1927
|
+
readonly left: "a:lnL";
|
|
1928
|
+
readonly right: "a:lnR";
|
|
1929
|
+
readonly top: "a:lnT";
|
|
1930
|
+
readonly bottom: "a:lnB";
|
|
1931
|
+
readonly tlToBr: "a:lnTlToBr";
|
|
1932
|
+
readonly blToTr: "a:lnBlToTr";
|
|
1933
|
+
};
|
|
1934
|
+
/** Which border of a cell an edit addresses. */
|
|
1935
|
+
type TableCellEdge = keyof typeof EDGE_QNAMES;
|
|
1936
|
+
//#endregion
|
|
1808
1937
|
//#region src/read/api/table-style-resolve.d.ts
|
|
1809
1938
|
/**
|
|
1810
1939
|
* The `a:tblPr` condition flags that gate which style parts apply to a table.
|
|
@@ -1837,6 +1966,26 @@ interface ResolvedTableStyle {
|
|
|
1837
1966
|
}
|
|
1838
1967
|
//#endregion
|
|
1839
1968
|
//#region src/read/api/table.d.ts
|
|
1969
|
+
/**
|
|
1970
|
+
* One border as {@link TableCell.setBorder} takes it — the write-side mirror of
|
|
1971
|
+
* {@link CellBorder}, which is what reading one gives back.
|
|
1972
|
+
*
|
|
1973
|
+
* Deliberately not `CellBorder` itself: that type reports every field, `null` included, so
|
|
1974
|
+
* passing one back would make "leave this alone" unsayable. Here an omitted field is simply
|
|
1975
|
+
* not written, which is what an edit usually means.
|
|
1976
|
+
*/
|
|
1977
|
+
interface TableCellBorderEdit {
|
|
1978
|
+
/** Border width in points; omitted leaves `@w` unset, which renders as a hairline. */
|
|
1979
|
+
widthPt?: number | null;
|
|
1980
|
+
/** Dash preset (`a:prstDash/@val`, e.g. `sysDash`); omitted leaves the border solid. */
|
|
1981
|
+
dash?: string;
|
|
1982
|
+
/** Explicit colour as 6-hex (`#` optional). Ignored when {@link schemeColor} is given. */
|
|
1983
|
+
color?: string;
|
|
1984
|
+
/** Theme colour token (e.g. `accent1`); preferred over {@link color} when both are set. */
|
|
1985
|
+
schemeColor?: string;
|
|
1986
|
+
/** Write an explicit `a:noFill` — a deliberately suppressed edge, not an absent one. */
|
|
1987
|
+
noFill?: boolean;
|
|
1988
|
+
}
|
|
1840
1989
|
/**
|
|
1841
1990
|
* The context a cell needs to resolve its style-graph fill: the table's resolved
|
|
1842
1991
|
* `a:tblStyle`, its condition flags, and the grid dimensions. Threaded from
|
|
@@ -1848,7 +1997,7 @@ interface TableCellStyleContext {
|
|
|
1848
1997
|
flags: TableConditionFlags;
|
|
1849
1998
|
rowCount: number;
|
|
1850
1999
|
colCount: number;
|
|
1851
|
-
ctx:
|
|
2000
|
+
ctx: ThemeContext;
|
|
1852
2001
|
}
|
|
1853
2002
|
/**
|
|
1854
2003
|
* One edge border of a table cell (`a:tcPr/a:lnL|lnR|lnT|lnB|lnTlToBr|lnBlToTr`).
|
|
@@ -1883,6 +2032,29 @@ interface CellBorders {
|
|
|
1883
2032
|
tlToBr: CellBorder | null;
|
|
1884
2033
|
blToTr: CellBorder | null;
|
|
1885
2034
|
}
|
|
2035
|
+
/**
|
|
2036
|
+
* A table cell's 3-D bevel (`a:tcPr/a:cell3D`), as read back. Every field is `null` when the
|
|
2037
|
+
* source leaves it to the schema default, so a reader can tell "PowerPoint wrote `circle`"
|
|
2038
|
+
* from "PowerPoint wrote nothing and `circle` is what it means".
|
|
2039
|
+
*/
|
|
2040
|
+
interface CellThreeD {
|
|
2041
|
+
/** `a:cell3D/@prstMaterial` (`ST_PresetMaterialType`), or `null` when unset. */
|
|
2042
|
+
material: string | null;
|
|
2043
|
+
/** The required `a:bevel`. Present whenever the cell has a `a:cell3D` at all. */
|
|
2044
|
+
bevel: {
|
|
2045
|
+
/** `a:bevel/@prst` (`ST_BevelPresetType`), or `null` when unset. */
|
|
2046
|
+
preset: string | null;
|
|
2047
|
+
/** `a:bevel/@w` converted from EMU to points, or `null` when unset. */
|
|
2048
|
+
widthPt: number | null;
|
|
2049
|
+
/** `a:bevel/@h` converted from EMU to points, or `null` when unset. */
|
|
2050
|
+
heightPt: number | null;
|
|
2051
|
+
};
|
|
2052
|
+
/** `a:cell3D/a:lightRig`, or `null` when the cell leaves lighting to the renderer. */
|
|
2053
|
+
lightRig: {
|
|
2054
|
+
rig: string | null;
|
|
2055
|
+
dir: string | null;
|
|
2056
|
+
} | null;
|
|
2057
|
+
}
|
|
1886
2058
|
/** A table: a grid of rows and cells inside a graphic frame. */
|
|
1887
2059
|
declare class Table {
|
|
1888
2060
|
#private;
|
|
@@ -1896,7 +2068,7 @@ declare class Table {
|
|
|
1896
2068
|
private readonly rels?;
|
|
1897
2069
|
constructor(tbl: Element, part: Part,
|
|
1898
2070
|
/** The owning slide's theme colour context, threaded to each cell's text for `Run.resolvedColor`. */
|
|
1899
|
-
themeColors?:
|
|
2071
|
+
themeColors?: ThemeContext | undefined,
|
|
1900
2072
|
/** The deck package, for resolving `a:tableStyleId` against `tableStyles.xml` (style-graph cell fills). */
|
|
1901
2073
|
opc?: OpcPackage | undefined,
|
|
1902
2074
|
/** The owning slide's relationships, for resolving a cell picture fill's `r:embed` to a partname. */
|
|
@@ -1927,6 +2099,42 @@ declare class Table {
|
|
|
1927
2099
|
* table style, so it is the read counterpart of the writer's `tableStyle` option.
|
|
1928
2100
|
*/
|
|
1929
2101
|
get styleId(): string | null;
|
|
2102
|
+
/**
|
|
2103
|
+
* The table's own background (`a:tblPr` fill) resolved against the slide's theme colour
|
|
2104
|
+
* context to a literal hex, or `null` when the table carries no solid background.
|
|
2105
|
+
*
|
|
2106
|
+
* This is the table-level counterpart of {@link TableCell.resolvedFill}, and it is a
|
|
2107
|
+
* genuinely different thing from a cell fill: a `a:tblPr` fill sits *behind* the grid, so
|
|
2108
|
+
* a cell with no fill of its own shows it through. Reports `null` for a non-solid choice
|
|
2109
|
+
* (`a:blipFill`/`a:gradFill`/`a:pattFill`/`a:noFill`) — read {@link pictureFill} for an
|
|
2110
|
+
* image background — and `null` with no theme context.
|
|
2111
|
+
*/
|
|
2112
|
+
get resolvedFill(): ResolvedColor | null;
|
|
2113
|
+
/**
|
|
2114
|
+
* The table's picture background (`a:tblPr/a:blipFill`), or `null` when the table is not
|
|
2115
|
+
* image-backed. The table-level twin of {@link TableCell.pictureFill}, and needed for the
|
|
2116
|
+
* same reason: {@link resolvedFill} decodes only solid colours, so without this an
|
|
2117
|
+
* image-backed table is indistinguishable from an unfilled one.
|
|
2118
|
+
*/
|
|
2119
|
+
get pictureFill(): PictureFill | null;
|
|
2120
|
+
/**
|
|
2121
|
+
* The table's gradient background (`a:tblPr/a:gradFill`), or `null` when it is not
|
|
2122
|
+
* gradient-filled. Needed for the same reason {@link pictureFill} is:
|
|
2123
|
+
* {@link resolvedFill} decodes only solid colours.
|
|
2124
|
+
*/
|
|
2125
|
+
get gradientFill(): GradientFill | null;
|
|
2126
|
+
/**
|
|
2127
|
+
* The table's pattern (hatch) background (`a:tblPr/a:pattFill`), or `null` when it is not
|
|
2128
|
+
* pattern-filled.
|
|
2129
|
+
*/
|
|
2130
|
+
get patternFill(): PatternFill | null;
|
|
2131
|
+
/**
|
|
2132
|
+
* The raw `schemeClr` token of the table's own background
|
|
2133
|
+
* (`a:tblPr/a:solidFill/a:schemeClr/@val`), or `null` for an absent or `srgbClr` fill.
|
|
2134
|
+
* {@link resolvedFill} is the literal it resolves to; this is the unresolved reference,
|
|
2135
|
+
* which is what a replica should carry so the copy still tracks its theme.
|
|
2136
|
+
*/
|
|
2137
|
+
get fillSchemeColor(): string | null;
|
|
1930
2138
|
/** Whether the first row is styled as a header (`a:tblPr/@firstRow`). */
|
|
1931
2139
|
get firstRowHeader(): boolean;
|
|
1932
2140
|
/** Whether rows are banded (`a:tblPr/@bandRow`). */
|
|
@@ -1937,6 +2145,64 @@ declare class Table {
|
|
|
1937
2145
|
* spans columns (`gridSpan`) occupies a single index here.
|
|
1938
2146
|
*/
|
|
1939
2147
|
cell(rowIndex: number, columnIndex: number): TableCell | null;
|
|
2148
|
+
/**
|
|
2149
|
+
* Insert a row, defaulting to the bottom of the table. Returns the new {@link TableRow}.
|
|
2150
|
+
*
|
|
2151
|
+
* The new row is auto-height (`a:tr/@h="0"`) and its cells are empty. Inserting *through*
|
|
2152
|
+
* a vertical merge extends that merge rather than interrupting it: the span's origin
|
|
2153
|
+
* grows by a row and the new cell joins as a continuation, because an origin claiming
|
|
2154
|
+
* more rows than it has continuations is a table PowerPoint reports as corrupt.
|
|
2155
|
+
* @param {number} [index] - where to insert, `0`..`rowCount`; appended when omitted
|
|
2156
|
+
* @throws {InvalidOptionError} when `index` is outside that range
|
|
2157
|
+
*/
|
|
2158
|
+
addRow(index?: number): TableRow;
|
|
2159
|
+
/**
|
|
2160
|
+
* Remove the row at `index`, with its content.
|
|
2161
|
+
*
|
|
2162
|
+
* A cell in the row that *continues* a vertical merge shortens that merge. A cell that
|
|
2163
|
+
* *starts* one hands the region to its first continuation, which becomes the new origin —
|
|
2164
|
+
* the merged region survives one row shorter, and only the removed row's own text is lost.
|
|
2165
|
+
* @throws {InvalidOptionError} when `index` is out of range
|
|
2166
|
+
*/
|
|
2167
|
+
removeRow(index: number): void;
|
|
2168
|
+
/**
|
|
2169
|
+
* Insert a column, defaulting to the right-hand end. Updates `a:tblGrid` **and** every
|
|
2170
|
+
* row, which is the pair that has to stay in step.
|
|
2171
|
+
*
|
|
2172
|
+
* The mirror of {@link addRow}'s merge case: inserting inside a horizontal merge widens
|
|
2173
|
+
* it instead of splitting it.
|
|
2174
|
+
* @param {number} [index] - where to insert, `0`..`columnCount`; appended when omitted
|
|
2175
|
+
* @param {number} [widthEmu] - the new column's width; defaults to 1 inch
|
|
2176
|
+
* @throws {InvalidOptionError} when `index` is outside that range
|
|
2177
|
+
*/
|
|
2178
|
+
addColumn(index?: number, widthEmu?: number): void;
|
|
2179
|
+
/**
|
|
2180
|
+
* Remove the column at `index`, from `a:tblGrid` and from every row.
|
|
2181
|
+
*
|
|
2182
|
+
* Inside a horizontal merge the region narrows by one and keeps its content: a covered
|
|
2183
|
+
* cell is dropped rather than the origin. Elsewhere the column's cells go with it.
|
|
2184
|
+
* @throws {InvalidOptionError} when `index` is out of range
|
|
2185
|
+
*/
|
|
2186
|
+
removeColumn(index: number): void;
|
|
2187
|
+
/**
|
|
2188
|
+
* Merge the rectangle between two cell positions into one cell. The top-left cell keeps
|
|
2189
|
+
* its content; the rest become covered cells and are emptied, since a covered cell is
|
|
2190
|
+
* never rendered.
|
|
2191
|
+
*
|
|
2192
|
+
* A rectangle that cuts through an existing merge is **rejected**, not silently widened
|
|
2193
|
+
* to fit — the caller asked for a specific region, and quietly producing a different one
|
|
2194
|
+
* is how a layout ends up wrong with nothing to point at. Unmerge first.
|
|
2195
|
+
* @throws {InvalidOptionError} when an index is out of range, the range covers one cell,
|
|
2196
|
+
* or it partially overlaps an existing merge
|
|
2197
|
+
*/
|
|
2198
|
+
mergeCells(row1: number, col1: number, row2: number, col2: number): void;
|
|
2199
|
+
/**
|
|
2200
|
+
* Split the merged cell whose **origin** is `(row, col)` back into individual cells.
|
|
2201
|
+
* A no-op on a cell that is not merged; addressing a covered cell instead of the origin
|
|
2202
|
+
* throws, and the message names the origin to use.
|
|
2203
|
+
* @throws {InvalidOptionError} when an index is out of range or the cell is a covered cell
|
|
2204
|
+
*/
|
|
2205
|
+
unmergeCell(row: number, col: number): void;
|
|
1940
2206
|
/** Escape hatch: the underlying `a:tbl` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
|
|
1941
2207
|
get element_(): Element;
|
|
1942
2208
|
/** Mark the owning part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
|
|
@@ -1956,7 +2222,7 @@ declare class TableRow {
|
|
|
1956
2222
|
private readonly rels?;
|
|
1957
2223
|
constructor(tr: Element, part: Part,
|
|
1958
2224
|
/** The owning slide's theme colour context, threaded to each {@link TableCell}. */
|
|
1959
|
-
themeColors?:
|
|
2225
|
+
themeColors?: ThemeContext | undefined,
|
|
1960
2226
|
/** The table's style-resolution context, threaded to each cell for {@link TableCell.resolvedFill}. */
|
|
1961
2227
|
style?: (TableCellStyleContext | null) | undefined,
|
|
1962
2228
|
/** This row's zero-based index in the table, for style-graph banding/edge conditions. */
|
|
@@ -1989,7 +2255,7 @@ declare class TableCell {
|
|
|
1989
2255
|
private readonly rels?;
|
|
1990
2256
|
constructor(tc: Element, part: Part,
|
|
1991
2257
|
/** The owning slide's theme colour context, threaded to the cell's text for `Run.resolvedColor`. */
|
|
1992
|
-
themeColors?:
|
|
2258
|
+
themeColors?: ThemeContext | undefined,
|
|
1993
2259
|
/** The table's style-resolution context, for the {@link resolvedFill} style-graph fallback. */
|
|
1994
2260
|
style?: (TableCellStyleContext | null) | undefined,
|
|
1995
2261
|
/** This cell's zero-based row index in the table. */
|
|
@@ -2009,6 +2275,82 @@ declare class TableCell {
|
|
|
2009
2275
|
* `textFrame.paragraphs[].runs[]` directly.
|
|
2010
2276
|
*/
|
|
2011
2277
|
set text(value: string);
|
|
2278
|
+
/**
|
|
2279
|
+
* Set (or clear) the cell's vertical text anchor (`a:tcPr/@anchor`).
|
|
2280
|
+
* `null` removes the attribute, leaving PowerPoint's default of top.
|
|
2281
|
+
* @throws {InvalidOptionError} when the value is outside `ST_TextAnchoringType`
|
|
2282
|
+
*/
|
|
2283
|
+
setAnchor(value: string | null): void;
|
|
2284
|
+
/**
|
|
2285
|
+
* Set (or clear) the cell's text direction (`a:tcPr/@vert`), e.g. `'vert270'`.
|
|
2286
|
+
* `null` removes the attribute, leaving the default horizontal text.
|
|
2287
|
+
* @throws {InvalidOptionError} when the value is outside `ST_TextVerticalType`
|
|
2288
|
+
*/
|
|
2289
|
+
setVerticalText(value: string | null): void;
|
|
2290
|
+
/**
|
|
2291
|
+
* Set (or clear) `a:tcPr/@horzOverflow` — what a single glyph too wide for the cell does.
|
|
2292
|
+
* `null` removes the attribute; so does `'clip'` in effect, since it is the schema
|
|
2293
|
+
* default, but the attribute is still written as asked.
|
|
2294
|
+
* @throws {InvalidOptionError} when the value is outside `ST_TextHorzOverflowType`
|
|
2295
|
+
*/
|
|
2296
|
+
setHorzOverflow(value: string | null): void;
|
|
2297
|
+
/**
|
|
2298
|
+
* Centre the cell's text block horizontally, or stop doing so (`a:tcPr/@anchorCtr`).
|
|
2299
|
+
* `false` removes the attribute rather than writing `"0"`, since `false` is the schema
|
|
2300
|
+
* default and the two are indistinguishable to a renderer.
|
|
2301
|
+
*/
|
|
2302
|
+
setAnchorCtr(value: boolean): void;
|
|
2303
|
+
/**
|
|
2304
|
+
* Set the cell's text insets in EMU (`a:tcPr/@marL`/`@marR`/`@marT`/`@marB`).
|
|
2305
|
+
*
|
|
2306
|
+
* Partial: only the sides named are touched, so `{ left: 0 }` flushes the text left and
|
|
2307
|
+
* leaves the other three alone. A side given as `null` has its attribute removed, which
|
|
2308
|
+
* returns it to the schema default (91440 EMU left/right, 45720 top/bottom) — not to
|
|
2309
|
+
* zero. Pass `{}` to change nothing.
|
|
2310
|
+
* @throws {InvalidOptionError} when a value is not a finite number
|
|
2311
|
+
*/
|
|
2312
|
+
setMarginsEmu(margins: {
|
|
2313
|
+
left?: number | null;
|
|
2314
|
+
right?: number | null;
|
|
2315
|
+
top?: number | null;
|
|
2316
|
+
bottom?: number | null;
|
|
2317
|
+
}): void;
|
|
2318
|
+
/**
|
|
2319
|
+
* Set (or clear) one of the cell's six borders — the four edges and the two diagonals.
|
|
2320
|
+
*
|
|
2321
|
+
* `null` removes the element entirely, which is "inherit", and is a different thing from
|
|
2322
|
+
* `{ noFill: true }`, which writes an explicit no-border and suppresses whatever would
|
|
2323
|
+
* otherwise be inherited. The element is inserted at its schema position rather than
|
|
2324
|
+
* appended: `CT_TableCellProperties` is a sequence, and an out-of-order `a:tcPr` is
|
|
2325
|
+
* reported by PowerPoint as a corrupt file rather than as a bad edit.
|
|
2326
|
+
*
|
|
2327
|
+
* Colour is either `color` (6-hex, `#` optional) or `schemeColor` (a theme token); giving
|
|
2328
|
+
* both prefers the token, matching how the read side reports them.
|
|
2329
|
+
* @throws {InvalidOptionError} when the width or colour cannot be written
|
|
2330
|
+
*/
|
|
2331
|
+
setBorder(edge: TableCellEdge, border: TableCellBorderEdit | null): void;
|
|
2332
|
+
/**
|
|
2333
|
+
* Replace the cell's fill with a solid colour (`a:tcPr/a:solidFill`), or clear it.
|
|
2334
|
+
*
|
|
2335
|
+
* `null` removes the `a:solidFill` and lets the cell inherit from the table style again.
|
|
2336
|
+
* That is not the same as {@link noFill}, which writes an explicit `a:noFill` and so
|
|
2337
|
+
* suppresses the inherited shading. Any competing fill choice (`a:gradFill`,
|
|
2338
|
+
* `a:blipFill`, …) is dropped first — `EG_FillProperties` admits one.
|
|
2339
|
+
* @throws {InvalidOptionError} when `color` is not a 6-digit hex string
|
|
2340
|
+
*/
|
|
2341
|
+
setFillColor(color: string | null): void;
|
|
2342
|
+
/**
|
|
2343
|
+
* Replace the cell's fill with a theme colour token (`a:solidFill/a:schemeClr/@val`), or
|
|
2344
|
+
* clear it. Preferred over {@link setFillColor} when the deck's theme should keep
|
|
2345
|
+
* driving the colour.
|
|
2346
|
+
*/
|
|
2347
|
+
setFillSchemeColor(token: string | null): void;
|
|
2348
|
+
/**
|
|
2349
|
+
* Write an explicit `<a:noFill/>` on the cell — a transparent cell that shows the table
|
|
2350
|
+
* background (or the slide) through. Distinct from `setFillColor(null)`, which removes
|
|
2351
|
+
* the fill and lets the table style's shading apply again.
|
|
2352
|
+
*/
|
|
2353
|
+
noFill(): void;
|
|
2012
2354
|
/**
|
|
2013
2355
|
* The cell's solid fill resolved against the table's theme colour context to a
|
|
2014
2356
|
* literal hex — the table-cell counterpart of
|
|
@@ -2030,6 +2372,18 @@ declare class TableCell {
|
|
|
2030
2372
|
* `lumMod`/`lumOff`/… transforms applied) — read that for the final colour.
|
|
2031
2373
|
*/
|
|
2032
2374
|
get resolvedFill(): ResolvedColor | null;
|
|
2375
|
+
/**
|
|
2376
|
+
* Whether the cell carries a fill of its **own** (`a:tcPr` holds an `EG_FillProperties`
|
|
2377
|
+
* child), as opposed to inheriting one from the table style's header/banding rules.
|
|
2378
|
+
*
|
|
2379
|
+
* This is the flag that disambiguates {@link resolvedFill}, which deliberately reports
|
|
2380
|
+
* either — it answers "what colour does this cell render as", and both sources are valid
|
|
2381
|
+
* answers to that. Anything that has to reproduce the cell rather than describe it needs
|
|
2382
|
+
* to know which: baking an inherited banding colour into a copy makes the copy look right
|
|
2383
|
+
* until someone changes its table style, and then nothing moves. `false` for a cell whose
|
|
2384
|
+
* `a:tcPr` is empty or absent, whatever the style graph would render it as.
|
|
2385
|
+
*/
|
|
2386
|
+
get hasOwnFill(): boolean;
|
|
2033
2387
|
/**
|
|
2034
2388
|
* The cell's picture (image) fill (`a:tcPr/a:blipFill`), or `null` when the cell
|
|
2035
2389
|
* is not image-filled. The cell counterpart of
|
|
@@ -2041,6 +2395,18 @@ declare class TableCell {
|
|
|
2041
2395
|
* which a {@link Table} built without them cannot supply.
|
|
2042
2396
|
*/
|
|
2043
2397
|
get pictureFill(): PictureFill | null;
|
|
2398
|
+
/**
|
|
2399
|
+
* The cell's gradient fill (`a:tcPr/a:gradFill`), or `null` when the cell is not
|
|
2400
|
+
* gradient-filled. The cell twin of {@link Table.gradientFill}, and needed for the same
|
|
2401
|
+
* reason {@link pictureFill} is: {@link resolvedFill} reports `null` for every non-solid
|
|
2402
|
+
* choice, so without this a gradient cell is indistinguishable from an unfilled one.
|
|
2403
|
+
*/
|
|
2404
|
+
get gradientFill(): GradientFill | null;
|
|
2405
|
+
/**
|
|
2406
|
+
* The cell's pattern (hatch) fill (`a:tcPr/a:pattFill`), or `null` when the cell is not
|
|
2407
|
+
* pattern-filled.
|
|
2408
|
+
*/
|
|
2409
|
+
get patternFill(): PatternFill | null;
|
|
2044
2410
|
/**
|
|
2045
2411
|
* The raw `schemeClr` token of the cell's solid fill (`a:tcPr/a:solidFill/a:schemeClr/@val`),
|
|
2046
2412
|
* e.g. `accent1`/`bg1`, or `null` when the fill is absent or an explicit `srgbClr`.
|
|
@@ -2066,6 +2432,53 @@ declare class TableCell {
|
|
|
2066
2432
|
* bottom), or `null` when unset (PowerPoint defaults to top).
|
|
2067
2433
|
*/
|
|
2068
2434
|
get anchor(): string | null;
|
|
2435
|
+
/**
|
|
2436
|
+
* Whether the cell's whole text **block** is centred horizontally within it
|
|
2437
|
+
* (`a:tcPr/@anchorCtr`). `false` when unset — that is the schema default, and it is
|
|
2438
|
+
* what PowerPoint writes nothing for.
|
|
2439
|
+
*
|
|
2440
|
+
* Distinct from a paragraph's `align`, which decides where each *line* sits inside the
|
|
2441
|
+
* text block; this decides where the block sits inside the cell.
|
|
2442
|
+
*/
|
|
2443
|
+
get anchorCtr(): boolean;
|
|
2444
|
+
/**
|
|
2445
|
+
* The cell's 3-D bevel (`a:tcPr/a:cell3D`), or `null` when it has none.
|
|
2446
|
+
*
|
|
2447
|
+
* `CT_Cell3D` requires an `a:bevel`, so a present `cell3D` always reports a bevel;
|
|
2448
|
+
* `lightRig` is `null` when the cell leaves the scene lighting to the renderer. Sizes are
|
|
2449
|
+
* reported in **points** (the attributes are EMU), matching how the write option takes them.
|
|
2450
|
+
*/
|
|
2451
|
+
get cell3D(): CellThreeD | null;
|
|
2452
|
+
/**
|
|
2453
|
+
* The cell's unique identifier (`a:tc/@id`), or `null` when it has none.
|
|
2454
|
+
*
|
|
2455
|
+
* This is what {@link headerIds} references: a data cell names the header cells that
|
|
2456
|
+
* govern it by their `@id`, which is how a complex table tells a screen reader what a
|
|
2457
|
+
* value means. Unrelated to the shape-level `p:cNvPr/@id` — it is an `xs:string` scoped
|
|
2458
|
+
* to the table, not a slide-wide numeric id.
|
|
2459
|
+
*
|
|
2460
|
+
* **PowerPoint does not write this and strips it on save**, so it will read `null` on
|
|
2461
|
+
* any deck PowerPoint has saved, however it was produced. It is surfaced for decks from
|
|
2462
|
+
* other producers. There is deliberately no write-API counterpart — see
|
|
2463
|
+
* `test/read/fixtures/authoring/probe-table-cell-a11y-and-3d.ps1` for the measurement.
|
|
2464
|
+
*/
|
|
2465
|
+
get id(): string | null;
|
|
2466
|
+
/**
|
|
2467
|
+
* The `@id`s of the header cells that govern this cell
|
|
2468
|
+
* (`a:tcPr/a:headers/a:header/@val`), in document order. Empty when the cell declares no
|
|
2469
|
+
* header association — which is the common case, since only a complex table needs one.
|
|
2470
|
+
*
|
|
2471
|
+
* Carries the same caveat as {@link id}: PowerPoint strips `a:headers` on save, so this
|
|
2472
|
+
* is empty on any PowerPoint-saved deck. `Table.firstRowHeader` (`a:tblPr/@firstRow`) is
|
|
2473
|
+
* the header marker PowerPoint does keep.
|
|
2474
|
+
*/
|
|
2475
|
+
get headerIds(): string[];
|
|
2476
|
+
/**
|
|
2477
|
+
* How the cell treats a glyph too wide for its text width (`a:tcPr/@horzOverflow`):
|
|
2478
|
+
* `'clip'` cuts it at the cell edge, `'overflow'` lets it draw past. `null` when unset
|
|
2479
|
+
* (PowerPoint clips). Not a wrap flag — cell text always wraps to the column width.
|
|
2480
|
+
*/
|
|
2481
|
+
get horzOverflow(): string | null;
|
|
2069
2482
|
/**
|
|
2070
2483
|
* The cell's text insets in EMU (`a:tcPr/@marL`/`@marR`/`@marT`/`@marB`), or
|
|
2071
2484
|
* `null` when the cell sets none. Each side is `null` when only some are set.
|
|
@@ -2129,6 +2542,20 @@ declare class GroupShape extends Shape {
|
|
|
2129
2542
|
protected getOrAddXfrm(): Element;
|
|
2130
2543
|
protected properties(): Element | null;
|
|
2131
2544
|
protected getOrAddProperties(): ShapeProperties;
|
|
2545
|
+
/**
|
|
2546
|
+
* The group's own child coordinate space (`p:grpSpPr/a:xfrm/a:chOff` and
|
|
2547
|
+
* `a:chExt`) in EMU, or `null` when the group has no transform or either
|
|
2548
|
+
* element is incomplete.
|
|
2549
|
+
*
|
|
2550
|
+
* Most consumers should not need this: {@link Shape.absoluteFrame} already
|
|
2551
|
+
* composes the whole ancestor chain — child space, group flips and rotations —
|
|
2552
|
+
* and doing that arithmetic per consumer is how a shape in a nested group ends
|
|
2553
|
+
* up subtly displaced. It is here for a *replica* consumer rather than a
|
|
2554
|
+
* *paint* one: rebuilding this group and its children as OOXML needs the
|
|
2555
|
+
* source child space to reproduce the scaling, and without it only groups whose
|
|
2556
|
+
* child space is the identity can be rebuilt.
|
|
2557
|
+
*/
|
|
2558
|
+
get childFrame(): ChildFrame | null;
|
|
2132
2559
|
/** The shapes nested directly inside this group, in document order. */
|
|
2133
2560
|
get shapes(): AnyShape[];
|
|
2134
2561
|
}
|
|
@@ -2172,7 +2599,7 @@ declare class NotesPlaceholder {
|
|
|
2172
2599
|
private readonly relationships;
|
|
2173
2600
|
constructor(sp: Element, part: Part,
|
|
2174
2601
|
/** The notes theme context (notesMaster → `theme2.xml`), threaded to {@link textFrame}. */
|
|
2175
|
-
themeContext:
|
|
2602
|
+
themeContext: ThemeContext,
|
|
2176
2603
|
/** The notes part's relationships, threaded to {@link textFrame} for hyperlink resolution. */
|
|
2177
2604
|
relationships: Relationships);
|
|
2178
2605
|
/** Placeholder type (`p:ph/@type`: `sldImg` | `body` | `sldNum`), or `null` when absent. */
|
|
@@ -2228,7 +2655,7 @@ declare class NotesSlide {
|
|
|
2228
2655
|
* The notes theme context, resolved through the notesMaster → `theme2.xml` chain
|
|
2229
2656
|
* and cached. Backs {@link NotesPlaceholder.textFrame}'s `Run.resolvedColor`.
|
|
2230
2657
|
*/
|
|
2231
|
-
themeContext():
|
|
2658
|
+
themeContext(): ThemeContext;
|
|
2232
2659
|
/** The placeholders (`p:sp`) in the notes shape tree, in document order. */
|
|
2233
2660
|
get placeholders(): NotesPlaceholder[];
|
|
2234
2661
|
/** The notes body placeholder (`p:ph type="body"`), or `null` when the notes slide has none. */
|
|
@@ -2410,7 +2837,7 @@ declare class Placeholder {
|
|
|
2410
2837
|
private readonly relationships;
|
|
2411
2838
|
constructor(sp: Element, part: Part,
|
|
2412
2839
|
/** The owning master/layout theme context, threaded to {@link textFrame}. */
|
|
2413
|
-
themeContext:
|
|
2840
|
+
themeContext: ThemeContext,
|
|
2414
2841
|
/** The owning part's relationships, threaded to {@link textFrame} for hyperlink resolution. */
|
|
2415
2842
|
relationships: Relationships);
|
|
2416
2843
|
/** Placeholder type (`p:ph/@type`: `title` | `body` | `sldNum` | …), or `null` when absent (a body placeholder). */
|
|
@@ -2482,7 +2909,7 @@ declare class SlideMaster {
|
|
|
2482
2909
|
* The master's colour/font context (its `p:clrMap` + theme), resolved once and
|
|
2483
2910
|
* cached. Backs each {@link Placeholder}'s text frame.
|
|
2484
2911
|
*/
|
|
2485
|
-
themeContext():
|
|
2912
|
+
themeContext(): ThemeContext;
|
|
2486
2913
|
}
|
|
2487
2914
|
/**
|
|
2488
2915
|
* A deck's slide layout (`slideLayoutN.xml`) as a modeled object — the gallery entry
|
|
@@ -2526,7 +2953,7 @@ declare class SlideLayout {
|
|
|
2526
2953
|
* The layout's colour/font context (walked layout → master → theme), resolved once
|
|
2527
2954
|
* and cached. Backs each {@link Placeholder}'s text frame.
|
|
2528
2955
|
*/
|
|
2529
|
-
themeContext():
|
|
2956
|
+
themeContext(): ThemeContext;
|
|
2530
2957
|
}
|
|
2531
2958
|
//#endregion
|
|
2532
2959
|
//#region src/read/api/transition.d.ts
|
|
@@ -2655,7 +3082,7 @@ declare class Slide {
|
|
|
2655
3082
|
* font token included) resolves to a literal value. The maps/roots are empty when
|
|
2656
3083
|
* the theme chain is incomplete, in which case tokens simply stay unresolved.
|
|
2657
3084
|
*/
|
|
2658
|
-
themeContext():
|
|
3085
|
+
themeContext(): ThemeContext;
|
|
2659
3086
|
/** Authoring name of the slide (`p:cSld/@name`), or `null` if unnamed. */
|
|
2660
3087
|
get name(): string | null;
|
|
2661
3088
|
/**
|
|
@@ -3245,5 +3672,5 @@ declare class Presentation {
|
|
|
3245
3672
|
save(): Promise<Uint8Array>;
|
|
3246
3673
|
}
|
|
3247
3674
|
//#endregion
|
|
3248
|
-
export {
|
|
3249
|
-
//# sourceMappingURL=presentation-
|
|
3675
|
+
export { Chart as $, GroupShape as A, Recolor as At, Table as B, PictureFill as Bt, CommentAuthor as C, CustomGeometryPath as Ct, NotesPlaceholder as D, LineEnd as Dt, ModernCommentAuthor as E, InnerShadow as Et, isPicture as F, PatternFill as Ft, TableConditionFlags as G, resolveColorElement as Gt, TableCellBorderEdit as H, GradientFill as Ht, GraphicFrame as I, BackgroundFill as It, ChartExAxis as J, TableCellEdge as K, ColorContext as Kt, CellBorder as L, BackgroundSource as Lt, isConnector as M, Reflection as Mt, isGraphicFrame as N, ShapeType as Nt, NotesSlide as O, LineEnds as Ot, isGroupShape as P, SoftEdge as Pt, AxisNumberFormat as Q, CellBorders as R, SlideBackground as Rt, Comment as S, CustomGeometry as St, ModernComment as T, Glow as Tt, TableRow as U, GradientStop as Ut, TableCell as V, PictureFillTile as Vt, ResolvedTableStyle as W, ResolvedColor as Wt, ChartExLegend as X, ChartExDataLabels as Y, ChartExSeries as Z, ThemeColorSlot as _, RunHyperlink as _t, readCustomProperties as a, ChartSeries as at, Tag as b, ChildFrame as bt, Slide as c, AutoShape as ct, TransitionSpeed as d, BodyProperties as dt, ChartAxis as et, ColorMapToken as f, BulletDetail as ft, Theme as g, Run as gt, SlideMaster as h, Paragraph as ht, readCoreProperties as i, ChartLine as it, isAutoShape as j, RecolorColor as jt, AnyShape as k, OuterShadow as kt, TransitionInfo as l, Shape as lt, SlideLayout as m, LineSpacing as mt, CoreProperties as n, ChartFill as nt, AddPictureOptions as o, Connector as ot, Placeholder as p, BulletStyle as pt, ChartEx as q, CustomProperty as r, ChartLegend as rt, AddTextBoxOptions as s, Picture as st, Presentation as t, ChartDataLabels as tt, TransitionInput as u, AutofitMode as ut, ThemeFontFace as v, TextFrame as vt, CommentSchema as w, GeometryCommand as wt, readTagsForPart as x, ConnectionSite as xt, ThemeFontScheme as y, AbsoluteFrame as yt, CellThreeD as z, FillRect as zt };
|
|
3676
|
+
//# sourceMappingURL=presentation-CTVPpiwP.d.ts.map
|