pptx-ts 3.7.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +116 -269
  2. package/dist/autopage-odPz7zZO.js +536 -0
  3. package/dist/autopage-odPz7zZO.js.map +1 -0
  4. package/dist/binary-string-CKVAYI3M.js +24 -0
  5. package/dist/binary-string-CKVAYI3M.js.map +1 -0
  6. package/dist/body-insets-Dw_BeWD_.js +54 -0
  7. package/dist/body-insets-Dw_BeWD_.js.map +1 -0
  8. package/dist/browser.d.ts +29 -9
  9. package/dist/browser.d.ts.map +1 -1
  10. package/dist/browser.js +41 -14
  11. package/dist/browser.js.map +1 -1
  12. package/dist/clip-Bl01BPcN.d.ts +67 -0
  13. package/dist/clip-Bl01BPcN.d.ts.map +1 -0
  14. package/dist/diagnostics-D8ot4Ei7.d.ts +244 -0
  15. package/dist/diagnostics-D8ot4Ei7.d.ts.map +1 -0
  16. package/dist/embedded-fonts-DarT9aoa.d.ts +20 -0
  17. package/dist/embedded-fonts-DarT9aoa.d.ts.map +1 -0
  18. package/dist/entry-compose-DCnvBZz2.d.ts +1046 -0
  19. package/dist/entry-compose-DCnvBZz2.d.ts.map +1 -0
  20. package/dist/{enums-CvRYniUA.d.ts → enums-BUKTUB6V.d.ts} +21 -13
  21. package/dist/{enums-CvRYniUA.d.ts.map → enums-BUKTUB6V.d.ts.map} +1 -1
  22. package/dist/{errors-Bvln0H-7.js → errors-C4oENPcu.js} +92 -2
  23. package/dist/errors-C4oENPcu.js.map +1 -0
  24. package/dist/families.d.ts +260 -0
  25. package/dist/families.d.ts.map +1 -0
  26. package/dist/families.js +57 -0
  27. package/dist/families.js.map +1 -0
  28. package/dist/{fit-BKs0zxMI.js → fit-Cb7naFj6.js} +249 -167
  29. package/dist/fit-Cb7naFj6.js.map +1 -0
  30. package/dist/font-metrics-v5fn7s7e.d.ts +613 -0
  31. package/dist/font-metrics-v5fn7s7e.d.ts.map +1 -0
  32. package/dist/grid-DikTjFey.js +187 -0
  33. package/dist/grid-DikTjFey.js.map +1 -0
  34. package/dist/{html-dom-B0I0QSbU.js → html-dom-Iuog2wdK.js} +121 -91
  35. package/dist/html-dom-Iuog2wdK.js.map +1 -0
  36. package/dist/html.d.ts +6 -6
  37. package/dist/html.d.ts.map +1 -1
  38. package/dist/html.js +7 -6
  39. package/dist/html.js.map +1 -1
  40. package/dist/image-size-CvN2iCA4.js +1611 -0
  41. package/dist/image-size-CvN2iCA4.js.map +1 -0
  42. package/dist/index.d.ts +24 -10
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +31 -11
  45. package/dist/index.js.map +1 -1
  46. package/dist/inspect.d.ts +40 -31
  47. package/dist/inspect.d.ts.map +1 -1
  48. package/dist/inspect.js +40 -48
  49. package/dist/inspect.js.map +1 -1
  50. package/dist/math.d.ts +7 -5
  51. package/dist/math.d.ts.map +1 -1
  52. package/dist/math.js +16 -7
  53. package/dist/math.js.map +1 -1
  54. package/dist/measure.d.ts +12 -225
  55. package/dist/measure.d.ts.map +1 -1
  56. package/dist/measure.js +3 -3
  57. package/dist/node.d.ts +22 -8
  58. package/dist/node.d.ts.map +1 -1
  59. package/dist/node.js +27 -7
  60. package/dist/node.js.map +1 -1
  61. package/dist/notes-Dh12JAbn.js +3264 -0
  62. package/dist/notes-Dh12JAbn.js.map +1 -0
  63. package/dist/options-internal-WqgMf720.js +43 -0
  64. package/dist/options-internal-WqgMf720.js.map +1 -0
  65. package/dist/{package-CaOLXSNi.d.ts → package-J49Ck6S2.d.ts} +27 -12
  66. package/dist/package-J49Ck6S2.d.ts.map +1 -0
  67. package/dist/playbtn-CUqQdoDf.js +22 -0
  68. package/dist/playbtn-CUqQdoDf.js.map +1 -0
  69. package/dist/{slide-ZqAdVvHV.d.ts → pres-C6qgOFAa.d.ts} +1021 -1423
  70. package/dist/pres-C6qgOFAa.d.ts.map +1 -0
  71. package/dist/{presentation-DrJtj3-C.js → presentation-DGYlAWhl.js} +3208 -2727
  72. package/dist/presentation-DGYlAWhl.js.map +1 -0
  73. package/dist/{presentation-types-CDjScsev.d.ts → presentation-types-8jLQHI4M.d.ts} +1070 -683
  74. package/dist/presentation-types-8jLQHI4M.d.ts.map +1 -0
  75. package/dist/read.d.ts +9 -9
  76. package/dist/read.d.ts.map +1 -1
  77. package/dist/read.js +4 -4
  78. package/dist/script.d.ts +80 -66
  79. package/dist/script.d.ts.map +1 -1
  80. package/dist/script.js +2399 -1139
  81. package/dist/script.js.map +1 -1
  82. package/dist/{shapes-BemroU-z.js → shapes-re0KyQk_.js} +2807 -1609
  83. package/dist/shapes-re0KyQk_.js.map +1 -0
  84. package/dist/slide-Dx2ZeVZ6.d.ts +1256 -0
  85. package/dist/slide-Dx2ZeVZ6.d.ts.map +1 -0
  86. package/dist/slide-size-BalTjFuv.js +88 -0
  87. package/dist/slide-size-BalTjFuv.js.map +1 -0
  88. package/dist/{units-internal-Dg95w_YD.js → table-cell-margins-EVg0EwxT.js} +235 -273
  89. package/dist/table-cell-margins-EVg0EwxT.js.map +1 -0
  90. package/dist/table-dom-BTDP3lEP.js +21 -0
  91. package/dist/table-dom-BTDP3lEP.js.map +1 -0
  92. package/dist/text-KnLOtEEu.js +3980 -0
  93. package/dist/text-KnLOtEEu.js.map +1 -0
  94. package/dist/text-anchor-CrYXAfUu.js +176 -0
  95. package/dist/text-anchor-CrYXAfUu.js.map +1 -0
  96. package/dist/transition-speed-kUEWDWTx.js +14 -0
  97. package/dist/transition-speed-kUEWDWTx.js.map +1 -0
  98. package/dist/units-internal-XJlf-hOl.js +649 -0
  99. package/dist/units-internal-XJlf-hOl.js.map +1 -0
  100. package/dist/zip-C0leZZMj.d.ts +67 -0
  101. package/dist/zip-C0leZZMj.d.ts.map +1 -0
  102. package/dist/zip-CKd8ihcf.js +177 -0
  103. package/dist/zip-CKd8ihcf.js.map +1 -0
  104. package/dist/zip.d.ts +3 -68
  105. package/dist/zip.js +3 -163
  106. package/dist/zoom-cX9sllpH.js +8865 -0
  107. package/dist/zoom-cX9sllpH.js.map +1 -0
  108. package/package.json +106 -19
  109. package/skills/ts-pptx-upstream/SKILL.md +58 -57
  110. package/dist/autopage-DkjYZUFD.js +0 -423
  111. package/dist/autopage-DkjYZUFD.js.map +0 -1
  112. package/dist/diagnostics-DfBdDHre.d.ts +0 -829
  113. package/dist/diagnostics-DfBdDHre.d.ts.map +0 -1
  114. package/dist/errors-Bvln0H-7.js.map +0 -1
  115. package/dist/errors-PflMPWBn.d.ts +0 -182
  116. package/dist/errors-PflMPWBn.d.ts.map +0 -1
  117. package/dist/fit-BKs0zxMI.js.map +0 -1
  118. package/dist/html-dom-B0I0QSbU.js.map +0 -1
  119. package/dist/namespaces-BVnNu7sg.js +0 -666
  120. package/dist/namespaces-BVnNu7sg.js.map +0 -1
  121. package/dist/notes-CJFJaG6M.js +0 -1724
  122. package/dist/notes-CJFJaG6M.js.map +0 -1
  123. package/dist/package-CaOLXSNi.d.ts.map +0 -1
  124. package/dist/pres-BcBR3CSM.d.ts +0 -202
  125. package/dist/pres-BcBR3CSM.d.ts.map +0 -1
  126. package/dist/presentation-DrJtj3-C.js.map +0 -1
  127. package/dist/presentation-types-CDjScsev.d.ts.map +0 -1
  128. package/dist/shapes-BemroU-z.js.map +0 -1
  129. package/dist/slide-ZqAdVvHV.d.ts.map +0 -1
  130. package/dist/text-B8SLEaZx.js +0 -11327
  131. package/dist/text-B8SLEaZx.js.map +0 -1
  132. package/dist/units-1kRzYShk.js +0 -231
  133. package/dist/units-1kRzYShk.js.map +0 -1
  134. package/dist/units-internal-Dg95w_YD.js.map +0 -1
  135. package/dist/zip.d.ts.map +0 -1
  136. package/dist/zip.js.map +0 -1
@@ -1,4 +1,252 @@
1
- import { _ as TextAnchor, f as SHAPE_NAME, g as TableStyle, h as SlideObjectType, i as CHART_NAME, l as PLACEHOLDER_TYPE, t as AlignH } from "./enums-CvRYniUA.js";
1
+ import { c as PLACEHOLDER_TYPE, d as SHAPE_NAME, i as CHART_NAME, v as WRITE_OUTPUT_TYPE } from "./enums-BUKTUB6V.js";
2
+ //#region src/ooxml/st-enums.d.ts
3
+ /**
4
+ * `ST_` simple-type enumerations from ECMA-376, declared once as the single source of both the
5
+ * TypeScript union a caller is checked against and the runtime list a value is validated against.
6
+ *
7
+ * **The problem this solves.** Each of these used to exist twice: a hand-written string union in
8
+ * `src/types/` (what the compiler enforces) and a hand-written array in `src/gen/` or `src/read/`
9
+ * (what the validator checks at run time). Nothing tied the two together, so adding a member to
10
+ * one and not the other produced either a value TypeScript accepts and the validator drops, or a
11
+ * value the validator passes and the type rejects. Two of them had already diverged in *order*,
12
+ * which is harmless, but nothing would have caught a divergence in *content*.
13
+ *
14
+ * **The shape.** Every entry is a `readonly` tuple declared `as const`, with its union derived via
15
+ * `(typeof X)[number]`. Widening the tuple widens the union in the same edit — they cannot drift.
16
+ * This is the idiom `EXTRA_SHAPE_PRESETS` already used; this module brings the stragglers onto it,
17
+ * and holds a few closed schema lists that are not `ST_` types, such as `EMBEDDED_FONT_SLOTS`.
18
+ *
19
+ * **Why this module is neither `gen/` nor `read/`.** `src/types/` needs the unions for the public
20
+ * write API, `src/gen/` needs the tuples to vet a value before emitting it, and `src/read/` needs
21
+ * them to vet a value before writing it into a loaded part. It is a fact about the schema, so it
22
+ * belongs to none of the three.
23
+ *
24
+ * Values are listed in **schema declaration order**, which is the order the diagnostics print
25
+ * when they tell a caller what is legal.
26
+ *
27
+ * **The chart option bag reads its enumerations from here**: `BarDirection`, `BarGrouping`,
28
+ * `Bar3DShape`, `LegendPosition`, `DisplayBlanksAs`, `DataLabelPosition` and `LineDataSymbol`
29
+ * first, then the axis and error-bar ones. They were the half of this consolidation that went
30
+ * unfinished for a while. `src/types/chart.ts`
31
+ * hand-wrote four of those unions beside the option that takes them and typed the other three as
32
+ * bare `string`, so `barDir` carried no compile-time check at all, and `dataLabelPosition`'s
33
+ * hand-written union was missing `inBase` — a value the validator accepts on a stacked bar, so
34
+ * the two spellings had already diverged in content. Both are gone: for every option here, the
35
+ * type a caller is checked against and the tuple the validator checks are one declaration.
36
+ */
37
+ /** `ST_TextAutonumberScheme` — the numbering an auto-numbered bullet counts in (`a:buAutoNum/@type`). */
38
+ declare const TEXT_AUTONUM_SCHEMES: readonly ['alphaLcParenBoth', 'alphaUcParenBoth', 'alphaLcParenR', 'alphaUcParenR', 'alphaLcPeriod', 'alphaUcPeriod', 'arabicParenBoth', 'arabicParenR', 'arabicPeriod', 'arabicPlain', 'romanLcParenBoth', 'romanUcParenBoth', 'romanLcParenR', 'romanUcParenR', 'romanLcPeriod', 'romanUcPeriod', 'circleNumDbPlain', 'circleNumWdBlackPlain', 'circleNumWdWhitePlain', 'arabicDbPeriod', 'arabicDbPlain', 'ea1ChsPeriod', 'ea1ChsPlain', 'ea1ChtPeriod', 'ea1ChtPlain', 'ea1JpnChsDbPeriod', 'ea1JpnKorPlain', 'ea1JpnKorPeriod', 'arabic1Minus', 'arabic2Minus', 'hebrew2Minus', 'thaiAlphaPeriod', 'thaiAlphaParenR', 'thaiAlphaParenBoth', 'thaiNumPeriod', 'thaiNumParenR', 'thaiNumParenBoth', 'hindiAlphaPeriod', 'hindiNumPeriod', 'hindiNumParenR', 'hindiAlpha1Period'];
39
+ /** `ST_TextStrikeType` — a run's strikethrough (`a:rPr/@strike`). */
40
+ declare const TEXT_STRIKE_TYPES: readonly ['noStrike', 'sngStrike', 'dblStrike'];
41
+ /** `ST_TextCapsType` — a run's capitalization (`a:rPr/@cap`). */
42
+ declare const TEXT_CAPS_TYPES: readonly ['none', 'small', 'all'];
43
+ /** `ST_TextUnderlineType` — a run's underline (`a:rPr/@u`). */
44
+ declare const TEXT_UNDERLINE_TYPES: readonly ['none', 'words', 'sng', 'dbl', 'heavy', 'dotted', 'dottedHeavy', 'dash', 'dashHeavy', 'dashLong', 'dashLongHeavy', 'dotDash', 'dotDashHeavy', 'dotDotDash', 'dotDotDashHeavy', 'wavy', 'wavyHeavy', 'wavyDbl'];
45
+ /** `ST_TextTabAlignType` — a tab stop's alignment (`a:tab/@algn`). */
46
+ declare const TEXT_TAB_ALIGN_TYPES: readonly ['l', 'ctr', 'r', 'dec'];
47
+ /**
48
+ * The base slide transitions: the `p:` type elements of `CT_SlideTransition`'s choice, in its
49
+ * declaration order. The writer emits the type as `<p:TYPE/>`, so this is also the list a type is
50
+ * checked against before it becomes an element name, and the list the script converter uses to
51
+ * decide which read transitions the write API can express. PowerPoint's modern transitions live in
52
+ * other namespaces and are not here.
53
+ */
54
+ declare const TRANSITION_TYPES: readonly ['blinds', 'checker', 'circle', 'dissolve', 'comb', 'cover', 'cut', 'diamond', 'fade', 'newsflash', 'plus', 'pull', 'push', 'random', 'randomBar', 'split', 'strips', 'wedge', 'wheel', 'wipe', 'zoom'];
55
+ /**
56
+ * `ST_BevelPresetType` — the bevel profile applied to a 3-D edge.
57
+ * @see ECMA-376 Part 1 §20.1.10.9
58
+ */
59
+ declare const BEVEL_PRESETS: readonly ['relaxedInset', 'circle', 'slope', 'cross', 'angle', 'softRound', 'convex', 'coolSlant', 'divot', 'riblet', 'hardEdge', 'artDeco'];
60
+ type BevelPresetType = (typeof BEVEL_PRESETS)[number];
61
+ /**
62
+ * `ST_PresetMaterialType` — how a 3-D surface responds to light.
63
+ * @see ECMA-376 Part 1 §20.1.10.50
64
+ */
65
+ declare const PRESET_MATERIALS: readonly ['legacyMatte', 'legacyPlastic', 'legacyMetal', 'legacyWireframe', 'matte', 'plastic', 'metal', 'warmMatte', 'translucentPowder', 'powder', 'dkEdge', 'softEdge', 'clear', 'flat', 'softmetal'];
66
+ type PresetMaterialType = (typeof PRESET_MATERIALS)[number];
67
+ /**
68
+ * `ST_LightRigType` — the preset lighting scene.
69
+ * @see ECMA-376 Part 1 §20.1.10.35
70
+ */
71
+ declare const LIGHT_RIGS: readonly ['legacyFlat1', 'legacyFlat2', 'legacyFlat3', 'legacyFlat4', 'legacyNormal1', 'legacyNormal2', 'legacyNormal3', 'legacyNormal4', 'legacyHarsh1', 'legacyHarsh2', 'legacyHarsh3', 'legacyHarsh4', 'threePt', 'balanced', 'soft', 'harsh', 'flood', 'contrasting', 'morning', 'sunrise', 'sunset', 'chilly', 'freezing', 'flat', 'twoPt', 'glow', 'brightRoom'];
72
+ type LightRigType = (typeof LIGHT_RIGS)[number];
73
+ /**
74
+ * `ST_LightRigDirection` — where the light rig sits relative to the scene.
75
+ * @see ECMA-376 Part 1 §20.1.10.33
76
+ */
77
+ declare const LIGHT_RIG_DIRECTIONS: readonly ['tl', 't', 'tr', 'l', 'r', 'bl', 'b', 'br'];
78
+ type LightRigDirection = (typeof LIGHT_RIG_DIRECTIONS)[number];
79
+ /**
80
+ * `ST_TextHorzOverflowType` — `a:bodyPr/@horzOverflow` and `a:tcPr/@horzOverflow`.
81
+ * @see ECMA-376 Part 1 §20.1.10.68
82
+ */
83
+ declare const TEXT_HORZ_OVERFLOW: readonly ['clip', 'overflow'];
84
+ type TextHorzOverflowType = (typeof TEXT_HORZ_OVERFLOW)[number];
85
+ /**
86
+ * `ST_TextVerticalType` — `a:bodyPr/@vert` and `a:tcPr/@vert`.
87
+ * @see ECMA-376 Part 1 §20.1.10.83
88
+ */
89
+ declare const TEXT_VERTICAL: readonly ['horz', 'vert', 'vert270', 'wordArtVert', 'eaVert', 'mongolianVert', 'wordArtVertRtl'];
90
+ type TextVerticalType = (typeof TEXT_VERTICAL)[number];
91
+ /**
92
+ * `ST_LineEndType` — the arrowhead at either end of a stroke (`a:headEnd/@type`,
93
+ * `a:tailEnd/@type`).
94
+ * @see ECMA-376 Part 1 §20.1.10.33
95
+ */
96
+ declare const LINE_END_TYPES: readonly ['none', 'triangle', 'stealth', 'diamond', 'oval', 'arrow'];
97
+ /**
98
+ * The four face slots of `CT_EmbeddedFontListEntry`, in schema child order (`p:font` first, then
99
+ * these). Not an `ST_` type, but a closed, ordered set the schema declares, like
100
+ * {@link THEME_COLOR_SLOTS}. The read and write sides iterate it so their emitters agree on
101
+ * element order, and `sequence.ts` derives `EMBEDDED_FONT_ENTRY_SEQUENCE` from it, so the order
102
+ * the serializer writes and the order the insertion points are computed from are one fact.
103
+ * `embedded-fonts.ts` re-exports it.
104
+ */
105
+ declare const EMBEDDED_FONT_SLOTS: readonly ['regular', 'bold', 'italic', 'boldItalic'];
106
+ type LineEndType = (typeof LINE_END_TYPES)[number];
107
+ /**
108
+ * `ST_TextShapeType` — the preset path text is bent along (`a:prstTxWarp/@prst`), which
109
+ * PowerPoint calls WordArt.
110
+ *
111
+ * `textNoShape` is the identity member: it is legal, and it warps nothing. The library does not
112
+ * narrow this set — every member is a shape PowerPoint draws.
113
+ * @see ECMA-376 Part 1 §20.1.10.76
114
+ */
115
+ declare const TEXT_SHAPE_TYPES: readonly ['textNoShape', 'textPlain', 'textStop', 'textTriangle', 'textTriangleInverted', 'textChevron', 'textChevronInverted', 'textRingInside', 'textRingOutside', 'textArchUp', 'textArchDown', 'textCircle', 'textButton', 'textArchUpPour', 'textArchDownPour', 'textCirclePour', 'textButtonPour', 'textCurveUp', 'textCurveDown', 'textCanUp', 'textCanDown', 'textWave1', 'textWave2', 'textDoubleWave1', 'textWave4', 'textInflate', 'textDeflate', 'textInflateBottom', 'textDeflateBottom', 'textInflateTop', 'textDeflateTop', 'textDeflateInflate', 'textDeflateInflateDeflate', 'textFadeRight', 'textFadeLeft', 'textFadeUp', 'textFadeDown', 'textSlantUp', 'textSlantDown', 'textCascadeUp', 'textCascadeDown'];
116
+ type TextShapeType = (typeof TEXT_SHAPE_TYPES)[number];
117
+ /**
118
+ * `ST_PresetLineDashVal` — the dash pattern of a line or border (`a:prstDash/@val`).
119
+ *
120
+ * The `sys*` members are the "system" dashes whose exact dot/gap ratio the renderer picks; the
121
+ * rest are defined by the spec. Both `BorderProps.dashType` and `ShapeLineProps.dashType` accept
122
+ * this whole set, so a caller who knows one knows the other.
123
+ * @see ECMA-376 Part 1 §20.1.10.49
124
+ */
125
+ declare const PRESET_LINE_DASHES: readonly ['solid', 'dot', 'dash', 'lgDash', 'dashDot', 'lgDashDot', 'lgDashDotDot', 'sysDash', 'sysDot', 'sysDashDot', 'sysDashDotDot'];
126
+ type PresetLineDashVal = (typeof PRESET_LINE_DASHES)[number];
127
+ /**
128
+ * `ST_BarDir` — whether a bar/column plot runs horizontally or vertically (`c:barDir/@val`).
129
+ * @see ECMA-376 Part 1 §21.2.3.3
130
+ */
131
+ declare const BAR_DIRECTIONS: readonly ['bar', 'col'];
132
+ type BarDirection = (typeof BAR_DIRECTIONS)[number];
133
+ /**
134
+ * `ST_BarGrouping` — how a bar/column plot stacks its series (`c:grouping/@val` inside
135
+ * `c:barChart`/`c:bar3DChart`).
136
+ * @see ECMA-376 Part 1 §21.2.3.4
137
+ */
138
+ declare const BAR_GROUPINGS: readonly ['percentStacked', 'clustered', 'standard', 'stacked'];
139
+ type BarGrouping = (typeof BAR_GROUPINGS)[number];
140
+ /**
141
+ * `ST_Shape` — the solid a 3-D bar is drawn as (`c:shape/@val`).
142
+ * @see ECMA-376 Part 1 §21.2.3.35
143
+ */
144
+ declare const BAR_3D_SHAPES: readonly ['cone', 'coneToMax', 'box', 'cylinder', 'pyramid', 'pyramidToMax'];
145
+ type Bar3DShape = (typeof BAR_3D_SHAPES)[number];
146
+ /**
147
+ * `ST_RadarStyle` — how a radar plot is drawn (`c:radarStyle/@val`).
148
+ * @see ECMA-376 Part 1 §21.2.3.33
149
+ */
150
+ declare const RADAR_STYLES: readonly ['standard', 'marker', 'filled'];
151
+ type RadarStyle = (typeof RADAR_STYLES)[number];
152
+ /**
153
+ * This library's own names for two of the three radar styles, mapped to the wire spelling each
154
+ * one means. They are the PowerPoint UI's words ("Radar", "Radar with Markers"), which is why
155
+ * they were chosen; `filled` needed no rename and is already the schema's own spelling, which is
156
+ * what made the other two read as typos rather than as a second vocabulary.
157
+ *
158
+ * Both spellings are accepted on the public option and normalized to the wire one at definition
159
+ * time. Before that, `radarStyle: 'marker'` — the schema's word, and the obvious guess for anyone
160
+ * reading a chart part — failed the enum check and silently fell back to `standard`, so a caller
161
+ * asking for markers got a plain radar.
162
+ */
163
+ declare const RADAR_STYLE_ALIASES: {
164
+ readonly radar: 'standard';
165
+ readonly markers: 'marker';
166
+ };
167
+ type RadarStyleAlias = keyof typeof RADAR_STYLE_ALIASES;
168
+ /**
169
+ * `ST_LegendPos` — where the legend sits relative to the plot area (`c:legendPos/@val`).
170
+ * @see ECMA-376 Part 1 §21.2.3.24
171
+ */
172
+ declare const LEGEND_POSITIONS: readonly ['b', 'tr', 'l', 'r', 't'];
173
+ type LegendPosition = (typeof LEGEND_POSITIONS)[number];
174
+ /**
175
+ * `ST_DispBlanksAs` — what a plot draws where a value is missing (`c:dispBlanksAs/@val`).
176
+ * @see ECMA-376 Part 1 §21.2.3.10
177
+ */
178
+ declare const DISPLAY_BLANKS_AS: readonly ['span', 'gap', 'zero'];
179
+ type DisplayBlanksAs = (typeof DISPLAY_BLANKS_AS)[number];
180
+ /**
181
+ * `ST_DLblPos` — where a data label sits relative to its point (`c:dLblPos/@val`).
182
+ *
183
+ * The whole set is legal on the attribute, but only a subset of it is legal *per plot type* —
184
+ * PowerPoint offers a pie chart `bestFit`/`ctr`/`inEnd`/`outEnd` and nothing else. Those subsets
185
+ * are a fact about the chart types rather than about the attribute, so they live beside the
186
+ * chart definer that applies them; this is the value space they are drawn from.
187
+ * @see ECMA-376 Part 1 §21.2.3.13
188
+ */
189
+ declare const DATA_LABEL_POSITIONS: readonly ['bestFit', 'b', 'ctr', 'inBase', 'inEnd', 'l', 'outEnd', 'r', 't'];
190
+ type DataLabelPosition = (typeof DATA_LABEL_POSITIONS)[number];
191
+ /**
192
+ * `ST_MarkerStyle`, **narrowed** to what the library authors (`c:symbol/@val`).
193
+ *
194
+ * The schema also has `plus`, `star`, `x`, `picture` and `auto`. Neither PowerPoint 2013 nor
195
+ * PowerPoint Online draws the first three, `picture` needs a `c:spPr` blip this API has no
196
+ * spelling for, and `auto` is what leaving the option off already means — so the accepted set is
197
+ * deliberately smaller than the type. Widen it only with evidence that the member renders.
198
+ * @see ECMA-376 Part 1 §21.2.3.27
199
+ */
200
+ declare const LINE_DATA_SYMBOLS: readonly ['circle', 'dash', 'diamond', 'dot', 'none', 'square', 'triangle'];
201
+ type LineDataSymbol = (typeof LINE_DATA_SYMBOLS)[number];
202
+ /** `ST_TickLblPos` — where an axis draws its tick labels (`c:tickLblPos/@val`). */
203
+ declare const TICK_LABEL_POSITIONS: readonly ['high', 'low', 'nextTo', 'none'];
204
+ type TickLabelPosition = (typeof TICK_LABEL_POSITIONS)[number];
205
+ /** `ST_Orientation` — which way an axis runs (`c:orientation/@val`). */
206
+ declare const AXIS_ORIENTATIONS: readonly ['maxMin', 'minMax'];
207
+ type AxisOrientation = (typeof AXIS_ORIENTATIONS)[number];
208
+ /** `ST_TickMark` — an axis' major or minor tick marks (`c:majorTickMark/@val`, `c:minorTickMark/@val`). */
209
+ declare const TICK_MARKS: readonly ['cross', 'in', 'none', 'out'];
210
+ type TickMark = (typeof TICK_MARKS)[number];
211
+ /** `ST_CrossBetween` — whether a value axis crosses its category axis between or on categories (`c:crossBetween/@val`). */
212
+ declare const CROSS_BETWEEN: readonly ['between', 'midCat'];
213
+ type CrossBetween = (typeof CROSS_BETWEEN)[number];
214
+ /** `ST_BuiltInUnit` — the unit a value axis displays its labels in (`c:builtInUnit/@val`). */
215
+ declare const BUILT_IN_UNITS: readonly ['hundreds', 'thousands', 'tenThousands', 'hundredThousands', 'millions', 'tenMillions', 'hundredMillions', 'billions', 'trillions'];
216
+ type BuiltInUnit = (typeof BUILT_IN_UNITS)[number];
217
+ /** `ST_TimeUnit` — a date axis' base, major or minor time unit (`c:baseTimeUnit/@val` and its two siblings). */
218
+ declare const TIME_UNITS: readonly ['days', 'months', 'years'];
219
+ type TimeUnit = (typeof TIME_UNITS)[number];
220
+ /** `ST_ErrDir` — the axis an error bar measures along (`c:errDir/@val`). */
221
+ declare const ERROR_BAR_DIRECTIONS: readonly ['x', 'y'];
222
+ type ErrorBarDirection = (typeof ERROR_BAR_DIRECTIONS)[number];
223
+ /** `ST_ErrBarType` — which sides of a point draw an error bar (`c:errBarType/@val`). */
224
+ declare const ERROR_BAR_TYPES: readonly ['both', 'minus', 'plus'];
225
+ type ErrorBarType = (typeof ERROR_BAR_TYPES)[number];
226
+ /** `ST_ErrValType` — how an error bar's amount is read (`c:errValType/@val`). */
227
+ declare const ERROR_BAR_VALUE_TYPES: readonly ['cust', 'fixedVal', 'percentage', 'stdDev', 'stdErr'];
228
+ type ErrorBarValueType = (typeof ERROR_BAR_VALUE_TYPES)[number];
229
+ /**
230
+ * The twelve theme colour slots (`a:clrScheme` children) a `p:clrMap` token can point at.
231
+ *
232
+ * Not an `ST_` type — these are element names inside `a:CT_ColorScheme`, which the schema
233
+ * declares as a fixed sequence rather than an enumeration. The effect is the same: a closed,
234
+ * ordered set of twelve names, in the order the scheme declares them.
235
+ * @see ECMA-376 Part 1 §20.1.6.2
236
+ */
237
+ declare const THEME_COLOR_SLOTS: readonly ['dk1', 'lt1', 'dk2', 'lt2', 'accent1', 'accent2', 'accent3', 'accent4', 'accent5', 'accent6', 'hlink', 'folHlink'];
238
+ type ThemeColorSlot = (typeof THEME_COLOR_SLOTS)[number];
239
+ /**
240
+ * The twelve colour-map tokens (`p:clrMap` attributes), in schema attribute order.
241
+ *
242
+ * A slide's `schemeClr val="tx1"` names a *token*, not a slot: the master's `p:clrMap` is the
243
+ * indirection that sends it to a {@link ThemeColorSlot}. Which is why the two lists look alike
244
+ * and are not the same list — `bg1`/`tx1` are tokens, `lt1`/`dk1` are slots.
245
+ * @see ECMA-376 Part 1 §19.3.1.6
246
+ */
247
+ declare const COLOR_MAP_TOKENS: readonly ['bg1', 'tx1', 'bg2', 'tx2', 'accent1', 'accent2', 'accent3', 'accent4', 'accent5', 'accent6', 'hlink', 'folHlink'];
248
+ type ColorMapToken = (typeof COLOR_MAP_TOKENS)[number];
249
+ //#endregion
2
250
  //#region src/types/shape.d.ts
3
251
  /**
4
252
  * A single preset-geometry adjustment guide (`<a:gd>` inside `<a:avLst>`).
@@ -101,12 +349,14 @@ interface ShapeProps extends PositionProps, ObjectNameProps {
101
349
  */
102
350
  arcThicknessRatio?: number;
103
351
  /**
104
- * Shape fill color properties
352
+ * Shape fill color properties, or a bare {@link Color} as shorthand for a solid fill
353
+ * ({@link FillOption}).
354
+ * @example 'FF0000' // hex color (red), shorthand for { color:'FF0000' }
105
355
  * @example { color:'FF0000' } // hex color (red)
106
356
  * @example { color:'0088CC', transparency:50 } // hex color, 50% transparent
107
357
  * @example { color:SchemeColor.accent1 } // Theme color Accent1
108
358
  */
109
- fill?: ShapeFillProps;
359
+ fill?: FillOption;
110
360
  /**
111
361
  * Flip shape horizontally?
112
362
  * @default false
@@ -156,9 +406,10 @@ interface ShapeProps extends PositionProps, ObjectNameProps {
156
406
  */
157
407
  adjustHandles?: ShapeAdjustHandle[];
158
408
  /**
159
- * Rounded rectangle radius (only for ShapeType.roundRect)
160
- * - values: 0.0 to 1.0
161
- * @default 0
409
+ * Corner radius (inches), for `'roundRect'` and the other rounded presets
410
+ * - resolved against the shorter side of the shape and written as the preset's corner guide
411
+ * - not clamped: a radius past half the shorter side is written as given, and PowerPoint draws the corner at its limit
412
+ * - omitted, the preset keeps its own radius
162
413
  */
163
414
  rectRadius?: number;
164
415
  /**
@@ -195,6 +446,7 @@ interface ImageBaseProps extends PositionProps, ObjectNameProps {
195
446
  /**
196
447
  * Alt Text value ("How would you describe this object and its contents to someone who is blind?")
197
448
  * - PowerPoint: [right-click on an image] > "Edit Alt Text..."
449
+ * - omitted, the picture's `descr` is empty, as PowerPoint writes it; the source path or URL is never used
198
450
  */
199
451
  altText?: string;
200
452
  /**
@@ -256,9 +508,10 @@ interface ImageBaseProps extends PositionProps, ObjectNameProps {
256
508
  */
257
509
  points?: GeometryPoint[];
258
510
  /**
259
- * Rounded rectangle corner radius (inches) when `shape: 'roundRect'`
260
- * - values: 0.0 to 1.0
261
- * @default 0
511
+ * Corner radius (inches) of the clip `shape`, for `'roundRect'` and the other rounded presets
512
+ * - resolved against the shorter side of the box and written as the preset's corner guide
513
+ * - not clamped: a radius past half the shorter side is written as given, and PowerPoint draws the corner at its limit
514
+ * - omitted, the preset keeps its own radius
262
515
  */
263
516
  rectRadius?: number;
264
517
  /**
@@ -468,7 +721,7 @@ interface OleObjectBaseProps extends PositionProps, ObjectNameProps {
468
721
  /**
469
722
  * Payload file extension, used to name the embedded part and to pick the content type,
470
723
  * relationship type, and default `progId`.
471
- * - inferred from `data`'s MIME, else `path`'s extension, else `progId`
724
+ * - inferred from the MIME type of a `data:` URI in `data`, else `path`'s extension, else `progId`
472
725
  * - anything that is not a known Office package extension (`xlsx`/`xlsm`/`docx`/`docm`/`pptx`/`pptm`)
473
726
  * is embedded as a generic OLE blob part named `.bin`
474
727
  * @example 'xlsx'
@@ -528,6 +781,72 @@ type MediaProps = MediaBaseProps & ((DataOrPathRequiredProps & {
528
781
  }));
529
782
  //#endregion
530
783
  //#region src/types/text.d.ts
784
+ /**
785
+ * A drawn bullet: the object arm of {@link TextPropsOptions.bullet}.
786
+ *
787
+ * Named rather than left inline so a caller can build one as a variable and so the two
788
+ * relationship ids `addText()` stamps on it have somewhere off the public surface to live
789
+ * (`TextBulletPropsInternal`).
790
+ */
791
+ interface TextBulletProps {
792
+ /**
793
+ * Bullet type
794
+ * @default bullet
795
+ */
796
+ type?: 'bullet' | 'number';
797
+ /**
798
+ * Bullet character code (unicode)
799
+ * @example '25BA' // 'BLACK RIGHT-POINTING POINTER' (U+25BA)
800
+ */
801
+ characterCode?: string;
802
+ /**
803
+ * Bullet glyph font typeface (`<a:buFont/>`), e.g. for symbol-font bullets
804
+ * @example 'Wingdings' // render `characterCode` using the Wingdings font
805
+ */
806
+ fontFace?: string;
807
+ /**
808
+ * Bullet glyph size as a percentage of the run's text size (25–400)
809
+ * @default 100
810
+ * @example 80 // bullet glyph is 80% of the text size
811
+ */
812
+ size?: number;
813
+ /**
814
+ * Indentation (space between bullet and text) (points)
815
+ * @default 27 // DEF_BULLET_MARGIN
816
+ * @example 10 // Indents text 10 points from bullet
817
+ */
818
+ indent?: number;
819
+ /**
820
+ * Number type: any `ST_TextAutonumberScheme` (`a:buAutoNum/@type`)
821
+ * @example 'romanLcParenR' // roman numerals lower-case with paranthesis right
822
+ */
823
+ numberType?: (typeof TEXT_AUTONUM_SCHEMES)[number];
824
+ /**
825
+ * Number bullets start at
826
+ * @default 1
827
+ * @example 10 // numbered bullets start with 10
828
+ */
829
+ numberStartAt?: number;
830
+ /**
831
+ * Image to use as the bullet glyph ("picture bullet", `<a:buBlip>`)
832
+ * - supply an image `path` (filesystem/URL) or base64 `data` (same forms as `addImage()`)
833
+ * - raster formats (PNG/JPG/GIF) and SVG are supported; use `size` to scale relative to the text height
834
+ * - SVG bullets embed a PNG preview plus the SVG (the same dual-rel handling as `addImage()`)
835
+ * - takes precedence over `type`/`characterCode` when set
836
+ * @example image: { path: 'images/star.png' }
837
+ * @example image: { data: 'image/png;base64,iVBOR...' }
838
+ * @example image: { path: 'images/star.svg' }
839
+ */
840
+ image?: {
841
+ path?: string;
842
+ data?: string;
843
+ };
844
+ /**
845
+ * Bullet glyph color (separate from the text run color)
846
+ * @example 'FF0000' // red bullet
847
+ */
848
+ color?: HexColor;
849
+ }
531
850
  interface TextBaseProps {
532
851
  /**
533
852
  * Horizontal alignment
@@ -553,12 +872,12 @@ interface TextBaseProps {
553
872
  breakLine?: boolean;
554
873
  /**
555
874
  * Preset text warp / WordArt shape (`<a:bodyPr><a:prstTxWarp prst="..">`), which
556
- * bends the text along a preset path (arch, circle, wave, …). The value is an
557
- * OOXML `ST_TextShapeType` preset name.
875
+ * bends the text along a preset path (arch, circle, wave, …) — the whole
876
+ * `ST_TextShapeType` set.
558
877
  * @example 'textArchUp' // bend text along an upward arch (e.g. a label following a ring/arc)
559
878
  * @example 'textCircle'
560
879
  */
561
- textWarp?: string;
880
+ textWarp?: TextShapeType;
562
881
  /**
563
882
  * Add standard or custom bullet
564
883
  * - use `true` for standard bullet
@@ -580,76 +899,7 @@ interface TextBaseProps {
580
899
  * paragraphs. A paragraph takes its properties from its first run.
581
900
  * @default false
582
901
  */
583
- bullet?: boolean | 'inherit' | {
584
- /**
585
- * Bullet type
586
- * @default bullet
587
- */
588
- type?: 'bullet' | 'number';
589
- /**
590
- * Bullet character code (unicode)
591
- * @example '25BA' // 'BLACK RIGHT-POINTING POINTER' (U+25BA)
592
- */
593
- characterCode?: string;
594
- /**
595
- * Bullet glyph font typeface (`<a:buFont/>`), e.g. for symbol-font bullets
596
- * @example 'Wingdings' // render `characterCode` using the Wingdings font
597
- */
598
- fontFace?: string;
599
- /**
600
- * Bullet glyph size as a percentage of the run's text size (25–400)
601
- * @default 100
602
- * @example 80 // bullet glyph is 80% of the text size
603
- */
604
- size?: number;
605
- /**
606
- * Indentation (space between bullet and text) (points)
607
- * @default 27 // DEF_BULLET_MARGIN
608
- * @example 10 // Indents text 10 points from bullet
609
- */
610
- indent?: number;
611
- /**
612
- * Number type
613
- * @example 'romanLcParenR' // roman numerals lower-case with paranthesis right
614
- */
615
- numberType?: 'alphaLcParenBoth' | 'alphaLcParenR' | 'alphaLcPeriod' | 'alphaUcParenBoth' | 'alphaUcParenR' | 'alphaUcPeriod' | 'arabicParenBoth' | 'arabicParenR' | 'arabicPeriod' | 'arabicPlain' | 'romanLcParenBoth' | 'romanLcParenR' | 'romanLcPeriod' | 'romanUcParenBoth' | 'romanUcParenR' | 'romanUcPeriod';
616
- /**
617
- * Number bullets start at
618
- * @default 1
619
- * @example 10 // numbered bullets start with 10
620
- */
621
- numberStartAt?: number;
622
- /**
623
- * Image to use as the bullet glyph ("picture bullet", `<a:buBlip>`)
624
- * - supply an image `path` (filesystem/URL) or base64 `data` (same forms as `addImage()`)
625
- * - raster formats (PNG/JPG/GIF) and SVG are supported; use `size` to scale relative to the text height
626
- * - SVG bullets embed a PNG preview plus the SVG (the same dual-rel handling as `addImage()`)
627
- * - takes precedence over `type`/`characterCode` when set
628
- * @example image: { path: 'images/star.png' }
629
- * @example image: { data: 'image/png;base64,iVBOR...' }
630
- * @example image: { path: 'images/star.svg' }
631
- */
632
- image?: {
633
- path?: string;
634
- data?: string;
635
- };
636
- /**
637
- * Relationship id assigned to a picture-bullet image (`<a:blip r:embed>`)
638
- * - for SVG bullets this is the PNG-preview rel; the SVG rel is `_rIdSvg`
639
- * @internal populated by `addText()`; do not set directly
640
- */
641
- _rId?: number;
642
- /**
643
- * Relationship id of the SVG image for an SVG picture bullet (`<asvg:svgBlip r:embed>`)
644
- * @internal populated by `addText()`; do not set directly
645
- */
646
- _rIdSvg?: number;
647
- /**
648
- * Bullet glyph color (separate from the text run color)
649
- * @example 'FF0000' // red bullet
650
- */
651
- color?: HexColor;
652
- };
902
+ bullet?: boolean | 'inherit' | TextBulletProps;
653
903
  /**
654
904
  * Text capitalization (`a:rPr/@cap`, `ST_TextCapsType`)
655
905
  * - `'all'` = ALL CAPS
@@ -660,7 +910,7 @@ interface TextBaseProps {
660
910
  * - PowerPoint: Font > Effects > All Caps / Small Caps
661
911
  * @default (unset) inherit
662
912
  */
663
- caps?: 'none' | 'small' | 'all';
913
+ caps?: (typeof TEXT_CAPS_TYPES)[number];
664
914
  /**
665
915
  * Text color
666
916
  * - `HexColor` or `ThemeColor`
@@ -757,7 +1007,7 @@ interface TextBaseProps {
757
1007
  */
758
1008
  tabStops?: Array<{
759
1009
  position: number;
760
- alignment?: 'l' | 'r' | 'ctr' | 'dec';
1010
+ alignment?: (typeof TEXT_TAB_ALIGN_TYPES)[number];
761
1011
  }>;
762
1012
  /**
763
1013
  * text direction
@@ -767,7 +1017,7 @@ interface TextBaseProps {
767
1017
  * `wordArtVert` = stacked
768
1018
  * @default 'horz'
769
1019
  */
770
- textDirection?: 'horz' | 'vert' | 'vert270' | 'wordArtVert';
1020
+ textDirection?: Extract<TextVerticalType, 'horz' | 'vert' | 'vert270' | 'wordArtVert'>;
771
1021
  /**
772
1022
  * Transparency (percent)
773
1023
  * - MS-PPT > Format Shape > Text Options > Text Fill & Outline > Text Fill > Transparency
@@ -786,7 +1036,7 @@ interface TextBaseProps {
786
1036
  * @default (unset) inherit
787
1037
  */
788
1038
  underline?: {
789
- style?: 'dash' | 'dashHeavy' | 'dashLong' | 'dashLongHeavy' | 'dbl' | 'dotDash' | 'dotDashHeavy' | 'dotDotDash' | 'dotDotDashHeavy' | 'dotted' | 'dottedHeavy' | 'heavy' | 'none' | 'sng' | 'wavy' | 'wavyDbl' | 'wavyHeavy' | 'words';
1039
+ style?: (typeof TEXT_UNDERLINE_TYPES)[number];
790
1040
  color?: Color;
791
1041
  };
792
1042
  /**
@@ -846,20 +1096,6 @@ interface TextPropsOptions extends PositionProps, DataOrPathProps, TextBaseProps
846
1096
  points?: GeometryPoint[];
847
1097
  /** Preset-geometry adjustment guides for text frames. */
848
1098
  shapeAdjust?: ShapeAdjustValue | ShapeAdjustValue[];
849
- _bodyProp?: {
850
- align?: AlignH;
851
- anchor?: TextAnchor;
852
- lIns?: number;
853
- rIns?: number;
854
- tIns?: number;
855
- bIns?: number;
856
- numCol?: number;
857
- spcCol?: number;
858
- vert?: TextVertType;
859
- wrap?: boolean;
860
- prstTxWarp?: string;
861
- };
862
- _lineIdx?: number;
863
1099
  baseline?: number;
864
1100
  /**
865
1101
  * Character spacing
@@ -898,8 +1134,11 @@ interface TextPropsOptions extends PositionProps, DataOrPathProps, TextBaseProps
898
1134
  * - `'resize'` computes the height the text needs and bakes it into the shape's
899
1135
  * `a:ext/@cy` (adjusting `a:off/@y` per vertical anchor), the marker being
900
1136
  * `<a:spAutoFit/>`.
901
- * Without registered metrics they fall back to the bare flag (`<a:normAutofit/>` /
902
- * `<a:spAutoFit/>`, which only PowerPoint recomputes on edit) and warn once.
1137
+ * With no metrics registered at all they fall back to the bare flag (`<a:normAutofit/>` /
1138
+ * `<a:spAutoFit/>`, which only PowerPoint recomputes on edit), with no warning. Once any face
1139
+ * is registered, a named face without metrics is measured with a conservative estimate
1140
+ * (`measure/heuristic-metrics`), and a run with no face keeps the bare flag
1141
+ * (`measure/shrink-unmeasured`, `measure/resize-unmeasured`); each code warns once per write.
903
1142
  *
904
1143
  * **Note** Bare `'shrink'`/`'resize'` (no metrics) only take effect after editing
905
1144
  * text / resizing the shape; PowerPoint calculates the result then. The object form
@@ -911,12 +1150,13 @@ interface TextPropsOptions extends PositionProps, DataOrPathProps, TextBaseProps
911
1150
  */
912
1151
  fit?: 'none' | 'shrink' | 'resize' | TextFitShrinkProps;
913
1152
  /**
914
- * Shape fill
1153
+ * Shape fill, or a bare {@link Color} as shorthand for a solid fill ({@link FillOption}).
1154
+ * @example 'FF0000' // hex color (red), shorthand for { color:'FF0000' }
915
1155
  * @example { color:'FF0000' } // hex color (red)
916
1156
  * @example { color:'0088CC', transparency:50 } // hex color, 50% transparent
917
1157
  * @example { color:SchemeColor.accent1 } // theme color Accent1
918
1158
  */
919
- fill?: ShapeFillProps;
1159
+ fill?: FillOption;
920
1160
  /**
921
1161
  * Flip shape horizontally?
922
1162
  * @default false
@@ -929,6 +1169,16 @@ interface TextPropsOptions extends PositionProps, DataOrPathProps, TextBaseProps
929
1169
  flipV?: boolean;
930
1170
  glow?: TextGlowProps;
931
1171
  hyperlink?: HyperlinkProps;
1172
+ /**
1173
+ * Outline level of the paragraph (`a:p/@lvl`) — which of the list style's nine levels the
1174
+ * paragraph takes its bullet, indent and typography from.
1175
+ * - range: 0-8, whole numbers only (`ST_TextIndentLevelType`); anything else is reported
1176
+ * under `text/invalid-indent-level` and ignored
1177
+ * - `0` is the default and writes no attribute
1178
+ * - this is the discrete level, not a measurement: `paraMarginLeft` and `paraIndent` are the
1179
+ * points-valued controls
1180
+ * @default 0
1181
+ */
932
1182
  indentLevel?: number;
933
1183
  isTextBox?: boolean;
934
1184
  line?: ShapeLineProps;
@@ -970,14 +1220,26 @@ interface TextPropsOptions extends PositionProps, DataOrPathProps, TextBaseProps
970
1220
  * a real `<p:ph type="...">`. Use `placeholder: 'title'` to give a slide an accessible
971
1221
  * title (PowerPoint's accessibility checker otherwise reports "Missing Slide Title")
972
1222
  * - values: 'title' | 'body' | et. al.
1223
+ *
1224
+ * **The placeholder supplies, it does not impose.** Every option this bag states wins; the
1225
+ * layout placeholder fills in the ones it leaves out. So `{ placeholder: 'body' }` alone
1226
+ * takes the placeholder's frame, anchor, margins, bullet and text style, and
1227
+ * `{ placeholder: 'body', valign: 'top' }` takes all of that except the anchor. It matches
1228
+ * PowerPoint, where a slide placeholder's XML carries only the properties it overrides and
1229
+ * inherits the rest.
1230
+ *
1231
+ * The rule is about what the *caller* wrote, not about what the option bag holds by the time
1232
+ * inheritance runs: a value this library defaults on the way past does not count as the
1233
+ * caller stating one, and does not beat the layout.
973
1234
  * @example 'title'
974
1235
  * @see https://learn.microsoft.com/en-us/office/vba/api/powerpoint.ppplaceholdertype
975
1236
  */
976
1237
  placeholder?: string;
977
1238
  /**
978
- * Rounded rectangle radius (only for ShapeType.roundRect)
979
- * - values: 0.0 to 1.0
980
- * @default 0
1239
+ * Corner radius (inches) of the text box's `shape`, for `'roundRect'` and the other rounded presets
1240
+ * - resolved against the shorter side of the box and written as the preset's corner guide
1241
+ * - not clamped: a radius past half the shorter side is written as given, and PowerPoint draws the corner at its limit
1242
+ * - omitted, the preset keeps its own radius
981
1243
  */
982
1244
  rectRadius?: number;
983
1245
  /**
@@ -992,6 +1254,21 @@ interface TextPropsOptions extends PositionProps, DataOrPathProps, TextBaseProps
992
1254
  * @default false
993
1255
  */
994
1256
  rtlMode?: boolean;
1257
+ /**
1258
+ * Shadow options. **Which shadow depends on which bag it is on**, and the two are different
1259
+ * effects rather than two spellings of one:
1260
+ *
1261
+ * - on the options passed to `addText` — the *shape's* bag — it is the shape's drop shadow
1262
+ * (`p:spPr/a:effectLst`), PowerPoint's Shape Effects ▸ Shadow;
1263
+ * - on a run's own `options` inside the text array, it is the *text* shadow
1264
+ * (`a:rPr/a:effectLst`), PowerPoint's Text Effects ▸ Shadow.
1265
+ *
1266
+ * A run therefore does **not** inherit the shape's shadow: PowerPoint's two gestures are
1267
+ * independent, and applying both is what darkens a shadow twice. State it in both places to
1268
+ * get both, exactly as it takes two actions there.
1269
+ * @example addText('hi', { shadow }) // the box has a shadow; its glyphs do not
1270
+ * @example addText([{ text: 'hi', options: { shadow } }]) // the glyphs do; the box does not
1271
+ */
995
1272
  shadow?: ShadowProps;
996
1273
  shape?: SHAPE_NAME;
997
1274
  /**
@@ -1006,7 +1283,7 @@ interface TextPropsOptions extends PositionProps, DataOrPathProps, TextBaseProps
1006
1283
  * struck" rather than "unspecified"
1007
1284
  * @default (unset) inherit
1008
1285
  */
1009
- strike?: boolean | 'noStrike' | 'sngStrike' | 'dblStrike';
1286
+ strike?: boolean | (typeof TEXT_STRIKE_TYPES)[number];
1010
1287
  subscript?: boolean;
1011
1288
  superscript?: boolean;
1012
1289
  /**
@@ -1037,9 +1314,9 @@ interface TextProps {
1037
1314
  * `<m:oMathPara>…</m:oMathPara>`; the `m:` prefix is resolved by the wrapper, so the markup does
1038
1315
  * not need its own namespace declarations.
1039
1316
  * This is the raw-OMML entry point. To author from LaTeX or MathML, convert with
1040
- * `latexToOmml()` / `mathmlToOmml()` from the `@shbernal/ts-pptx/math` subpath.
1317
+ * `latexToOmml()` / `mathmlToOmml()` from the `pptx-ts/math` subpath.
1041
1318
  * @example { math: '<m:r><m:t>x^2+1=y</m:t></m:r>' } // raw OMML
1042
- * @example import { latexToOmml } from '@shbernal/ts-pptx/math'; ({ math: latexToOmml('x^2+1=y') })
1319
+ * @example import { latexToOmml } from 'pptx-ts/math'; ({ math: latexToOmml('x^2+1=y') })
1043
1320
  */
1044
1321
  math?: string;
1045
1322
  /**
@@ -1235,7 +1512,12 @@ declare function textRun(text: string | number, options?: TextPropsOptions): Tex
1235
1512
  declare function textRuns(runs: TextProps[]): TextProps[];
1236
1513
  //#endregion
1237
1514
  //#region src/types/object.d.ts
1238
- interface PlaceholderProps extends PositionProps, TextBaseProps, ObjectNameProps {
1515
+ /**
1516
+ * A layout placeholder's options. They reach the slide objects that fill the placeholder as text
1517
+ * options, so beside the text formatting a placeholder takes the shape `fill` (an image fill
1518
+ * included) and the `hyperlink` a text box does, and `bullet` through {@link TextBaseProps}.
1519
+ */
1520
+ interface PlaceholderProps extends PositionProps, TextBaseProps, ObjectNameProps, Pick<TextPropsOptions, 'fill' | 'hyperlink'> {
1239
1521
  name: string;
1240
1522
  type: PLACEHOLDER_TYPE;
1241
1523
  /**
@@ -1248,17 +1530,19 @@ interface PlaceholderProps extends PositionProps, TextBaseProps, ObjectNameProps
1248
1530
  */
1249
1531
  shape?: SHAPE_NAME;
1250
1532
  /**
1251
- * Rounded rectangle corner radius (inches) when `shape: 'roundRect'`
1252
- * - range: 0.0 to slide height/2
1533
+ * Corner radius (inches) of the placeholder's `shape`, for `'roundRect'` and the other rounded presets
1534
+ * - resolved against the shorter side of the placeholder and written as the preset's corner guide
1535
+ * - not clamped: a radius past half the shorter side is written as given, and PowerPoint draws the corner at its limit
1536
+ * - omitted, the preset keeps its own radius
1253
1537
  */
1254
1538
  rectRadius?: number;
1255
1539
  }
1256
1540
  interface ObjectNameProps {
1257
1541
  /**
1258
1542
  * Object name
1259
- * - used instead of default "Object N" name
1543
+ * - used instead of the default name for the object's kind: `Text 1`, `Shape 2`, `Image 1` and so
1544
+ * on, numbered per kind (see `docs/reference/object-names.md`)
1260
1545
  * - PowerPoint: Home > Arrange > Selection Pane...
1261
- * @default 'Object 1'
1262
1546
  * @example 'Antenna Design 9'
1263
1547
  */
1264
1548
  objectName?: string;
@@ -1361,7 +1645,13 @@ type CommonObjectDescriptor = {
1361
1645
  };
1362
1646
  //#endregion
1363
1647
  //#region src/types/chart.d.ts
1364
- type ChartAxisTickMark = 'none' | 'inside' | 'outside' | 'cross';
1648
+ /**
1649
+ * An axis' tick marks (`ST_TickMark`): `in` and `out` of the axis line, `cross` through it, or `none`.
1650
+ *
1651
+ * This used to offer `'inside'` and `'outside'`, which are not the schema's words; they reached
1652
+ * the part as written and PowerPoint refused it. Any other value warns and takes the default.
1653
+ */
1654
+ type ChartAxisTickMark = TickMark;
1365
1655
  /**
1366
1656
  * Line end cap style. Maps to the OOXML `cap` attribute on `<a:ln>` (`flat`/`sq`/`rnd`).
1367
1657
  */
@@ -1454,18 +1744,18 @@ interface ChartDataPointStyle {
1454
1744
  * Error-bar configuration for a chart series (`<c:errBars>`).
1455
1745
  * Maps onto OOXML `CT_ErrBars` (errDir / errBarType / errValType / noEndCap / plus / minus / val).
1456
1746
  */
1457
- interface ChartErrorBarOptions {
1747
+ interface ChartErrorBarOptions extends StrokeProps {
1458
1748
  /**
1459
1749
  * Axis the error bars measure along.
1460
1750
  * - `'y'` (the value axis) for BAR/BAR3D/LINE/AREA; SCATTER may also use `'x'`.
1461
1751
  * @default 'y'
1462
1752
  */
1463
- direction?: 'x' | 'y';
1753
+ direction?: ErrorBarDirection;
1464
1754
  /**
1465
1755
  * Which sides of each marker draw a bar.
1466
1756
  * @default 'both'
1467
1757
  */
1468
- barType?: 'both' | 'minus' | 'plus';
1758
+ barType?: ErrorBarType;
1469
1759
  /**
1470
1760
  * How `value` (or `plusValues`/`minusValues`) is interpreted.
1471
1761
  * - `'fixedVal'` — fixed amount in axis units
@@ -1475,9 +1765,10 @@ interface ChartErrorBarOptions {
1475
1765
  * - `'cust'` — explicit per-point amounts via `plusValues`/`minusValues`
1476
1766
  * @default 'fixedVal'
1477
1767
  */
1478
- valueType?: 'cust' | 'fixedVal' | 'percentage' | 'stdDev' | 'stdErr';
1768
+ valueType?: ErrorBarValueType;
1479
1769
  /**
1480
1770
  * Magnitude for `'fixedVal'`, `'percentage'`, or `'stdDev'`. Ignored for `'stdErr'` and `'cust'`.
1771
+ * - a finite number; `NaN` or `Infinity` throws
1481
1772
  * @default 1
1482
1773
  */
1483
1774
  value?: number;
@@ -1490,31 +1781,36 @@ interface ChartErrorBarOptions {
1490
1781
  * @default false
1491
1782
  */
1492
1783
  noEndCap?: boolean;
1493
- /** Error-bar line color (hex, e.g. `'FF0000'`). */
1494
- color?: HexColor;
1495
- /** Error-bar line width (points). */
1496
- size?: number;
1497
- }
1498
- interface OptsChartGridLine {
1499
- /**
1500
- * MS-PPT > Chart format > Format Major Gridlines > Line > Cap type
1501
- * - line cap type
1502
- * @default flat
1503
- */
1504
- cap?: LineCap;
1505
1784
  /**
1506
- * Gridline color
1507
- * - `HexColor` or `ThemeColor`
1508
- * @example 'FF3399'
1509
- * @example SchemeColor.accent1 // theme color Accent1
1785
+ * Error-bar line width (points).
1786
+ * @deprecated Use {@link StrokeProps.width}. `width` wins when both are set.
1510
1787
  */
1511
- color?: Color;
1788
+ size?: number;
1789
+ }
1790
+ /**
1791
+ * The stroke a plot draws its gridlines (or a stacked bar its series lines) with.
1792
+ *
1793
+ * A {@link StrokeProps}, so it takes `width`, `dashType`, `type`, `cap`, `color` and
1794
+ * `transparency` under the same names a table border does. `size` and `style` are the
1795
+ * pre-4.0 spellings and still work; see their notes for the exact mapping.
1796
+ *
1797
+ * Defaults where a gridline is drawn: `color: '888888'`, `width: 1`, `cap: 'flat'`, solid.
1798
+ */
1799
+ interface OptsChartGridLine extends StrokeProps {
1512
1800
  /**
1513
- * Gridline size (points)
1801
+ * Gridline size (points).
1802
+ * @deprecated Use {@link StrokeProps.width}. `width` wins when both are set.
1514
1803
  */
1515
1804
  size?: number;
1516
1805
  /**
1517
- * Gridline style
1806
+ * Gridline style.
1807
+ *
1808
+ * `'none'` omits the gridlines entirely and is the same statement as `type: 'none'`;
1809
+ * `'solid'`, `'dash'` and `'dot'` are `a:prstDash` presets and map onto `dashType`
1810
+ * unchanged — note that this `'dash'` is the literal `dash` preset, where
1811
+ * {@link StrokeProps.type}`: 'dash'` means `sysDash`.
1812
+ * @deprecated Use {@link StrokeProps.dashType} (or `type: 'none'`). `dashType` and an
1813
+ * explicit `type` both win when set.
1518
1814
  */
1519
1815
  style?: 'solid' | 'dash' | 'dot' | 'none';
1520
1816
  }
@@ -1538,13 +1834,14 @@ interface ChartPropsFillLine {
1538
1834
  *
1539
1835
  * `type: 'image'` is not supported here and falls back to no fill with a warning: a
1540
1836
  * blip fill needs a media relationship on the chart part, which nothing registers.
1837
+ * @example fill: '696969' // hex RGB color value, shorthand for {color: '696969'}
1541
1838
  * @example fill: {color: '696969'} // hex RGB color value
1542
1839
  * @example fill: {color: SchemeColor.background2} // Theme color value
1543
1840
  * @example fill: {color: '696969', transparency: 50} // 50% transparent grey
1544
1841
  * @example fill: {type: 'gradient', gradient: {kind: 'linear', angle: 90, stops: [{position: 0, color: '0088CC'}, {position: 100, color: 'FFFFFF'}]}}
1545
1842
  * @example fill: {type: 'inherit'} // no fill child at all -- take the chart style's fill
1546
1843
  */
1547
- fill?: ShapeFillProps;
1844
+ fill?: FillOption;
1548
1845
  }
1549
1846
  interface ChartAreaProps extends ChartPropsFillLine {
1550
1847
  /**
@@ -1555,10 +1852,6 @@ interface ChartAreaProps extends ChartPropsFillLine {
1555
1852
  roundedCorners?: boolean;
1556
1853
  }
1557
1854
  interface ChartPropsBase {
1558
- /**
1559
- * Axis position
1560
- */
1561
- axisPos?: 'b' | 'l' | 'r' | 't';
1562
1855
  /**
1563
1856
  * Series colours, cycled: series (or, on a pie/doughnut, data point) `n` takes
1564
1857
  * `chartColors[n % chartColors.length]`, so a shorter list repeats rather than running out.
@@ -1569,12 +1862,20 @@ interface ChartPropsBase {
1569
1862
  */
1570
1863
  chartColors?: HexColor[];
1571
1864
  /**
1572
- * opacity (0 - 100)
1865
+ * Series fill opacity, as a percentage from 0 to 100.
1866
+ *
1867
+ * `0` means what it says: a fully transparent fill, so the series is invisible. That is a
1868
+ * deliberate meaning, not a shorthand for "unset"; leave the option out for an opaque fill.
1869
+ * A value outside 0-100 clamps with a warning, and `NaN` throws.
1573
1870
  * @example 50 // 50% opaque
1574
1871
  */
1575
1872
  chartColorsOpacity?: number;
1576
1873
  dataBorder?: BorderProps;
1577
- displayBlanksAs?: 'gap' | 'span' | 'zero';
1874
+ /**
1875
+ * What a plot draws where a value is missing (`ST_DispBlanksAs`).
1876
+ * @default 'gap'
1877
+ */
1878
+ displayBlanksAs?: DisplayBlanksAs;
1578
1879
  invertedColors?: HexColor[];
1579
1880
  lang?: string;
1580
1881
  layout?: PositionProps;
@@ -1589,7 +1890,9 @@ interface ChartPropsBase {
1589
1890
  * Enable data labels, with a meaning that is **overloaded per plot type** — it is not a
1590
1891
  * plain duplicate of {@link ChartPropsBase.showValue}:
1591
1892
  * - pie / doughnut: shows the **category name** (`c:showCatName`);
1592
- * - scatter: shows **both** the value and the category name;
1893
+ * - scatter: turns on the labels {@link ChartPropsDataLabel.dataLabelFormatScatter} describes,
1894
+ * and shows nothing without it: `'XY'` shows both the value and the category name, and
1895
+ * `'custom'`/`'customXY'` show each point's label text;
1593
1896
  * - chartEx (waterfall/funnel/…): OR-combined with `showValue` to show the **value** label.
1594
1897
  *
1595
1898
  * For the common "show the numeric value" case on standard plots, prefer `showValue`.
@@ -1666,8 +1969,27 @@ interface ChartPropsBase {
1666
1969
  plotArea?: ChartPropsFillLine;
1667
1970
  /**
1668
1971
  * Per-series style overrides.
1669
- * Element at index N applies to the series at data[N].
1670
- * Missing indices or unset fields fall back to the chart-level option.
1972
+ *
1973
+ * Element at index N applies to the **Nth series of the chart** — the same number the series
1974
+ * carries in `<c:idx>`/`<c:order>`. For most plots that is its position in `data`; on a combo
1975
+ * it counts across every subchart in order, so a bar(2) + line(1) combo reaches the line at
1976
+ * index 2. A scatter or bubble series counts one lower than its position, because the X row in
1977
+ * front of it is not a series: `seriesOptions[0]` styles `data[1]`. Missing indices or unset
1978
+ * fields fall back to the chart-level option.
1979
+ *
1980
+ * **Not every field reaches every plot**, and a stated field that cannot be resolved warns
1981
+ * (`chart/option-not-supported`) naming itself rather than being dropped in silence:
1982
+ *
1983
+ * - `color` reaches every plot that colours *series*: `bar`, `bar3d`, `area`, `line`, `radar`,
1984
+ * `scatter`, `bubble`, `bubble3d`, and (as the volume bar and the close marker) `stock`.
1985
+ * - `lineSize` reaches only a series that strokes itself: `line`, `radar`, `scatter`, `bubble`
1986
+ * and `bubble3d`. A bar or an area takes its outline from `dataBorder`; a stock price series
1987
+ * draws no line at all.
1988
+ * - the `dataLabel*` fields need a per-series `<c:dLbls>`, which the category-axis family and
1989
+ * `scatter` emit. A bubble chart's label block is chart-level, and `dataLabelFormatCode` in
1990
+ * particular has no referent on `scatter`, whose label builders emit no number format.
1991
+ * - `pie`, `doughnut` and `surface` read nothing: a pie colours points and a surface colours
1992
+ * bands, so a per-*series* override has no referent even in principle.
1671
1993
  */
1672
1994
  seriesOptions?: ChartSeriesOpts[];
1673
1995
  }
@@ -1676,7 +1998,16 @@ interface ChartPropsAxisCat {
1676
1998
  * Multi-Chart prop: array of cat axes
1677
1999
  */
1678
2000
  catAxes?: ChartPropsAxisCat[];
1679
- catAxisBaseTimeUnit?: string;
2001
+ /**
2002
+ * The unit a date axis counts from in (`c:baseTimeUnit/@val`, `ST_TimeUnit`).
2003
+ *
2004
+ * The canonical spelling is lower-case, and the check forgives case at run time, so `'Days'`
2005
+ * is taken as `days`. The type names the canonical three so the call site offers them; do not
2006
+ * read the narrower type as permission to drop the tolerance, which a JavaScript caller with
2007
+ * no types still relies on. Anything else warns `chart/invalid-axis-time-unit` and leaves the
2008
+ * element off, because a garbage unit makes PowerPoint render nothing at all.
2009
+ */
2010
+ catAxisBaseTimeUnit?: TimeUnit;
1680
2011
  catAxisCrossesAt?: number | 'autoZero';
1681
2012
  catAxisHidden?: boolean;
1682
2013
  catAxisLabelColor?: string;
@@ -1691,23 +2022,89 @@ interface ChartPropsAxisCat {
1691
2022
  * - PowerPoint: Format Axis > Number > Format Code
1692
2023
  */
1693
2024
  catAxisLabelFormatCode?: string;
1694
- catAxisLabelFrequency?: string;
1695
- catAxisLabelPos?: 'none' | 'low' | 'high' | 'nextTo';
2025
+ /**
2026
+ * Show every Nth category label (`c:tickLblSkip`, `ST_Skip`), e.g. `2` for every other one.
2027
+ * - a whole number of at least 1; anything else warns and leaves the element off
2028
+ *
2029
+ * Pass a number. The `string` half is a compatibility hangover — this was typed as a
2030
+ * free-form string and emitted verbatim, which both rejected the natural `2` and let
2031
+ * `'every other'` reach the attribute — and is read with `Number()` like any other.
2032
+ */
2033
+ catAxisLabelFrequency?: number | string;
2034
+ catAxisLabelPos?: TickLabelPosition;
1696
2035
  catAxisLabelRotate?: number;
1697
- catAxisLineColor?: string;
2036
+ /**
2037
+ * The category axis line, as a stroke: `width`, `dashType`, `type`, `color`, `cap` and
2038
+ * `transparency` under the same names a table border and a gridline use.
2039
+ *
2040
+ * `type: 'none'` paints no line (an `<a:noFill/>` on the axis' own `<c:spPr>`), which is
2041
+ * what `catAxisLineShow: false` used to say. Omitted, the line is drawn at 1 pt in
2042
+ * `DEF_GRIDLINE_COLOR`, solid, flat-capped.
2043
+ *
2044
+ * The four flat `catAxisLine*` keys below are the pre-4.0 spellings. Anything set here wins
2045
+ * over its flat counterpart. They cannot express a cap, a transparency, or any
2046
+ * dash outside `solid`/`dash`/`dot`, which is why they are superseded rather than
2047
+ * widened.
2048
+ * @example { width: 1.5, dashType: 'lgDashDot', color: SchemeColor.accent1, transparency: 40 }
2049
+ */
2050
+ catAxisLine?: StrokeProps;
2051
+ /**
2052
+ * Category-axis line colour.
2053
+ * @deprecated Use `catAxisLine.color`.
2054
+ */
2055
+ catAxisLineColor?: Color;
2056
+ /**
2057
+ * Draw the category-axis line at all.
2058
+ * @deprecated Use `catAxisLine.type: 'none'` to suppress it.
2059
+ * @default true
2060
+ */
1698
2061
  catAxisLineShow?: boolean;
2062
+ /**
2063
+ * Category-axis line width in points.
2064
+ * @deprecated Use `catAxisLine.width`.
2065
+ */
1699
2066
  catAxisLineSize?: number;
2067
+ /**
2068
+ * Category-axis line dash.
2069
+ * @deprecated Use `catAxisLine.dashType`, which takes the full `ST_PresetLineDashVal` set.
2070
+ */
1700
2071
  catAxisLineStyle?: 'solid' | 'dash' | 'dot';
1701
2072
  catAxisMajorTickMark?: ChartAxisTickMark;
1702
- catAxisMajorTimeUnit?: string;
2073
+ /**
2074
+ * The unit a date axis counts major tick marks in (`c:majorTimeUnit/@val`, `ST_TimeUnit`).
2075
+ *
2076
+ * The canonical spelling is lower-case, and the check forgives case at run time, so `'Days'`
2077
+ * is taken as `days`. The type names the canonical three so the call site offers them; do not
2078
+ * read the narrower type as permission to drop the tolerance, which a JavaScript caller with
2079
+ * no types still relies on. Anything else warns `chart/invalid-axis-time-unit` and leaves the
2080
+ * element off, because a garbage unit makes PowerPoint render nothing at all.
2081
+ */
2082
+ catAxisMajorTimeUnit?: TimeUnit;
2083
+ /**
2084
+ * Spacing between major tick marks on a date axis or a scatter's X axis (`c:majorUnit`,
2085
+ * `ST_AxisUnit`).
2086
+ * - above 0; anything else warns and leaves the element off
2087
+ */
1703
2088
  catAxisMajorUnit?: number;
2089
+ /** Axis maximum (`c:max`). A value that is not a finite number throws. */
1704
2090
  catAxisMaxVal?: number;
1705
2091
  catAxisMinorTickMark?: ChartAxisTickMark;
1706
- catAxisMinorTimeUnit?: string;
2092
+ /**
2093
+ * The unit a date axis counts minor tick marks in (`c:minorTimeUnit/@val`, `ST_TimeUnit`).
2094
+ *
2095
+ * The canonical spelling is lower-case, and the check forgives case at run time, so `'Days'`
2096
+ * is taken as `days`. The type names the canonical three so the call site offers them; do not
2097
+ * read the narrower type as permission to drop the tolerance, which a JavaScript caller with
2098
+ * no types still relies on. Anything else warns `chart/invalid-axis-time-unit` and leaves the
2099
+ * element off, because a garbage unit makes PowerPoint render nothing at all.
2100
+ */
2101
+ catAxisMinorTimeUnit?: TimeUnit;
2102
+ /** Spacing between minor tick marks; the same rule as {@link ChartPropsAxisCat.catAxisMajorUnit}. */
1707
2103
  catAxisMinorUnit?: number;
2104
+ /** Axis minimum (`c:min`). A value that is not a finite number throws. */
1708
2105
  catAxisMinVal?: number;
1709
2106
  catAxisMultiLevelLabels?: boolean;
1710
- catAxisOrientation?: 'minMax' | 'maxMin';
2107
+ catAxisOrientation?: AxisOrientation;
1711
2108
  catAxisTitle?: string;
1712
2109
  catAxisTitleColor?: string;
1713
2110
  catAxisTitleFontFace?: string;
@@ -1717,40 +2114,79 @@ interface ChartPropsAxisCat {
1717
2114
  catLabelFormatCode?: string;
1718
2115
  /**
1719
2116
  * Whether data should use secondary category axis (instead of primary)
2117
+ *
2118
+ * A combo subchart plots on the secondary category and value axes together, because a plot's
2119
+ * two axes have to cross each other. When no subchart sets `secondaryValAxis`, the secondary
2120
+ * value axis is written hidden; `valAxes[1]` can show it.
1720
2121
  * @default false
1721
2122
  */
1722
2123
  secondaryCatAxis?: boolean;
1723
2124
  showCatAxisTitle?: boolean;
1724
2125
  }
1725
2126
  interface ChartPropsAxisSer {
1726
- serAxisBaseTimeUnit?: string;
1727
2127
  serAxisHidden?: boolean;
1728
2128
  serAxisLabelColor?: string;
1729
2129
  serAxisLabelFontBold?: boolean;
1730
2130
  serAxisLabelFontFace?: string;
1731
2131
  serAxisLabelFontItalic?: boolean;
1732
2132
  serAxisLabelFontSize?: number;
1733
- serAxisLabelFrequency?: string;
1734
- serAxisLabelPos?: 'none' | 'low' | 'high' | 'nextTo';
1735
- serAxisLineColor?: string;
1736
- serAxisLineShow?: boolean;
1737
- serAxisMajorTimeUnit?: string;
1738
- serAxisMajorUnit?: number;
1739
- serAxisMinorTimeUnit?: string;
1740
- serAxisMinorUnit?: number;
1741
- serAxisOrientation?: string;
1742
- serAxisTitle?: string;
1743
- serAxisTitleColor?: string;
1744
- serAxisTitleFontFace?: string;
1745
- serAxisTitleFontSize?: number;
1746
- serAxisTitleRotate?: number;
1747
- serGridLine?: OptsChartGridLine;
1748
- serLabelFormatCode?: string;
1749
- showSerAxisTitle?: boolean;
1750
- }
2133
+ /**
2134
+ * Show every Nth series-axis label (`c:tickLblSkip`, `ST_Skip`) on a 3-D chart.
2135
+ * - a whole number of at least 1; anything else warns and leaves the element off
2136
+ *
2137
+ * Pass a number; see {@link ChartPropsAxisCat.catAxisLabelFrequency} for the `string` half.
2138
+ */
2139
+ serAxisLabelFrequency?: number | string;
2140
+ serAxisLabelPos?: TickLabelPosition;
2141
+ /**
2142
+ * The series axis line, as a stroke — the same {@link StrokeProps} the other two axes and
2143
+ * every gridline take. See {@link ChartPropsAxisCat.catAxisLine}.
2144
+ *
2145
+ * The series axis is the third axis of a 3-D chart, and it was the one axis whose line
2146
+ * could be shown and coloured but not sized or dashed: the emitter hardcoded one point and
2147
+ * `solid` where the other two read the caller. Comparing the three axes' option spellings
2148
+ * side by side is how that was found.
2149
+ */
2150
+ serAxisLine?: StrokeProps;
2151
+ /**
2152
+ * Series-axis line colour.
2153
+ * @deprecated Use `serAxisLine.color`.
2154
+ */
2155
+ serAxisLineColor?: Color;
2156
+ /**
2157
+ * Draw the series-axis line at all.
2158
+ * @deprecated Use `serAxisLine.type: 'none'` to suppress it.
2159
+ * @default true
2160
+ */
2161
+ serAxisLineShow?: boolean;
2162
+ /**
2163
+ * Series-axis line width in points.
2164
+ * @deprecated Use `serAxisLine.width`.
2165
+ */
2166
+ serAxisLineSize?: number;
2167
+ /**
2168
+ * Series-axis line dash.
2169
+ * @deprecated Use `serAxisLine.dashType`, which takes the full `ST_PresetLineDashVal` set.
2170
+ */
2171
+ serAxisLineStyle?: 'solid' | 'dash' | 'dot';
2172
+ serAxisOrientation?: AxisOrientation;
2173
+ serAxisTitle?: string;
2174
+ serAxisTitleColor?: string;
2175
+ serAxisTitleFontFace?: string;
2176
+ serAxisTitleFontSize?: number;
2177
+ serAxisTitleRotate?: number;
2178
+ serGridLine?: OptsChartGridLine;
2179
+ serLabelFormatCode?: string;
2180
+ showSerAxisTitle?: boolean;
2181
+ }
1751
2182
  interface ChartPropsAxisVal {
1752
2183
  /**
1753
2184
  * Whether data should use secondary value axis (instead of primary)
2185
+ *
2186
+ * A combo subchart plots on the secondary category and value axes together, because a plot's
2187
+ * two axes have to cross each other. When no subchart sets `secondaryCatAxis`, the secondary
2188
+ * category axis is written hidden, as PowerPoint does for a series moved to its secondary axis;
2189
+ * `catAxes[1]` can show it.
1754
2190
  * @default false
1755
2191
  */
1756
2192
  secondaryValAxis?: boolean;
@@ -1766,8 +2202,8 @@ interface ChartPropsAxisVal {
1766
2202
  * - `'midCat'` = values plotted on tick marks (default for scatter/area)
1767
2203
  * - PowerPoint: Format Axis > Axis Options > Axis crosses > On tick marks / Between tick marks
1768
2204
  */
1769
- valAxisCrossBetween?: 'between' | 'midCat';
1770
- valAxisDisplayUnit?: 'billions' | 'hundredMillions' | 'hundreds' | 'hundredThousands' | 'millions' | 'tenMillions' | 'tenThousands' | 'thousands' | 'trillions';
2205
+ valAxisCrossBetween?: CrossBetween;
2206
+ valAxisDisplayUnit?: BuiltInUnit;
1771
2207
  valAxisDisplayUnitLabel?: boolean;
1772
2208
  valAxisHidden?: boolean;
1773
2209
  valAxisLabelColor?: string;
@@ -1776,23 +2212,58 @@ interface ChartPropsAxisVal {
1776
2212
  valAxisLabelFontItalic?: boolean;
1777
2213
  valAxisLabelFontSize?: number;
1778
2214
  valAxisLabelFormatCode?: string;
1779
- valAxisLabelPos?: 'none' | 'low' | 'high' | 'nextTo';
2215
+ valAxisLabelPos?: TickLabelPosition;
1780
2216
  valAxisLabelRotate?: number;
1781
- valAxisLineColor?: string;
2217
+ /**
2218
+ * The value axis line, as a stroke — the same {@link StrokeProps} the other two axes and
2219
+ * every gridline take. See {@link ChartPropsAxisCat.catAxisLine}.
2220
+ */
2221
+ valAxisLine?: StrokeProps;
2222
+ /**
2223
+ * Value-axis line colour.
2224
+ * @deprecated Use `valAxisLine.color`.
2225
+ */
2226
+ valAxisLineColor?: Color;
2227
+ /**
2228
+ * Draw the value-axis line at all.
2229
+ * @deprecated Use `valAxisLine.type: 'none'` to suppress it.
2230
+ * @default true
2231
+ */
1782
2232
  valAxisLineShow?: boolean;
2233
+ /**
2234
+ * Value-axis line width in points.
2235
+ * @deprecated Use `valAxisLine.width`.
2236
+ */
1783
2237
  valAxisLineSize?: number;
2238
+ /**
2239
+ * Value-axis line dash.
2240
+ * @deprecated Use `valAxisLine.dashType`, which takes the full `ST_PresetLineDashVal` set.
2241
+ */
1784
2242
  valAxisLineStyle?: 'solid' | 'dash' | 'dot';
1785
2243
  /**
1786
2244
  * PowerPoint: Format Axis > Axis Options > Logarithmic scale - Base
1787
- * - range: 2-99
2245
+ * - range: 2-1000 (`ST_LogBase`); a value outside it clamps with a warning, and `NaN` throws
1788
2246
  */
1789
2247
  valAxisLogScaleBase?: number;
1790
2248
  valAxisMajorTickMark?: ChartAxisTickMark;
2249
+ /**
2250
+ * Spacing between major tick marks on the value axis (`c:majorUnit`, `ST_AxisUnit`).
2251
+ * - above 0; anything else warns and leaves the element off
2252
+ * - PowerPoint: Format Axis > Axis Options > Units > Major
2253
+ */
1791
2254
  valAxisMajorUnit?: number;
2255
+ /** Axis maximum (`c:max`). A value that is not a finite number throws. */
1792
2256
  valAxisMaxVal?: number;
1793
2257
  valAxisMinorTickMark?: ChartAxisTickMark;
2258
+ /**
2259
+ * Spacing between minor tick marks on the value axis (`c:minorUnit`) — the sibling
2260
+ * `valAxisMajorUnit` had had for years, while the category and series axes carried both.
2261
+ * - PowerPoint: Format Axis > Axis Options > Units > Minor
2262
+ */
2263
+ valAxisMinorUnit?: number;
2264
+ /** Axis minimum (`c:min`). A value that is not a finite number throws. */
1794
2265
  valAxisMinVal?: number;
1795
- valAxisOrientation?: 'minMax' | 'maxMin';
2266
+ valAxisOrientation?: AxisOrientation;
1796
2267
  valAxisTitle?: string;
1797
2268
  valAxisTitleColor?: string;
1798
2269
  valAxisTitleFontFace?: string;
@@ -1809,8 +2280,16 @@ interface ChartPropsAxisVal {
1809
2280
  valLabelFormatCode?: string;
1810
2281
  }
1811
2282
  interface ChartPropsChartBar {
1812
- bar3DShape?: string;
1813
- barDir?: string;
2283
+ /**
2284
+ * The solid a 3-D bar is drawn as (`ST_Shape`).
2285
+ * @default 'box'
2286
+ */
2287
+ bar3DShape?: Bar3DShape;
2288
+ /**
2289
+ * Whether bars run horizontally (`bar`) or vertically (`col`) (`ST_BarDir`).
2290
+ * @default 'col'
2291
+ */
2292
+ barDir?: BarDirection;
1814
2293
  barGapDepthPct?: number;
1815
2294
  /**
1816
2295
  * MS-PPT > Format chart > Format Data Point > Series Options > "Gap Width"
@@ -1819,7 +2298,13 @@ interface ChartPropsChartBar {
1819
2298
  * @default 150
1820
2299
  */
1821
2300
  barGapWidthPct?: number;
1822
- barGrouping?: string;
2301
+ /**
2302
+ * How the plot stacks its series (`ST_BarGrouping`). A 2-D bar plot takes every member but
2303
+ * `standard`, which is the 3-D form's own default; an out-of-range value falls back to the
2304
+ * default for the plot with a warning.
2305
+ * @default 'clustered' (2-D), 'standard' (3-D)
2306
+ */
2307
+ barGrouping?: BarGrouping;
1823
2308
  /**
1824
2309
  * MS-PPT > Format chart > Format Data Point > Series Options > "Series Overlap"
1825
2310
  * - overlap (percent)
@@ -1860,7 +2345,8 @@ interface ChartPropsChartLine {
1860
2345
  */
1861
2346
  lineDash?: ChartLineDash;
1862
2347
  /**
1863
- * Per-series dash type overrides; index matches the series order in the `data` array.
2348
+ * Per-series dash type overrides; index matches the series order in the `data` array — and on a
2349
+ * combo, the order across every subchart, the same index `seriesOptions` uses.
1864
2350
  * - entries shorter than the series count fall back to `lineDash`
1865
2351
  * - example: `['solid', 'dash', 'lgDash']` gives each series its own dash pattern
1866
2352
  */
@@ -1870,7 +2356,7 @@ interface ChartPropsChartLine {
1870
2356
  * - marker type
1871
2357
  * @default circle
1872
2358
  */
1873
- lineDataSymbol?: 'circle' | 'dash' | 'diamond' | 'dot' | 'none' | 'square' | 'triangle';
2359
+ lineDataSymbol?: LineDataSymbol;
1874
2360
  /**
1875
2361
  * MS-PPT > Chart format > Format Data Series > [Marker Options] > Border > Color
1876
2362
  * - border color
@@ -1916,11 +2402,13 @@ interface ChartPropsChartPie {
1916
2402
  }
1917
2403
  interface ChartPropsChartRadar {
1918
2404
  /**
1919
- * Radar chart sub-type, named to match the PowerPoint UI ("Radar", "Radar with
1920
- * Markers", "Filled Radar").
2405
+ * Radar chart sub-type. Two vocabularies are accepted and mean the same three things:
2406
+ * this library's PowerPoint-UI names (`radar`, `markers`, `filled`) and `ST_RadarStyle`'s
2407
+ * own wire spellings (`standard`, `marker`, `filled`), which is what the chart part shows.
2408
+ * `filled` is spelled the same in both.
1921
2409
  * @default radar
1922
2410
  */
1923
- radarStyle?: 'radar' | 'markers' | 'filled';
2411
+ radarStyle?: RadarStyle | RadarStyleAlias;
1924
2412
  }
1925
2413
  /**
1926
2414
  * Options for the modern (Office 2016) chartEx chart types.
@@ -2083,8 +2571,24 @@ interface ChartPropsDataLabel {
2083
2571
  * @example '$0.00' // shows values as '$0.00'
2084
2572
  */
2085
2573
  dataLabelFormatCode?: string;
2574
+ /**
2575
+ * What a scatter's data labels show when {@link ChartPropsBase.showLabel} is set. A scatter
2576
+ * writes series labels only for one of these, so `showLabel` alone shows nothing.
2577
+ * - `'XY'`: each point's value and category name, composed by PowerPoint;
2578
+ * - `'custom'`: each point's label text;
2579
+ * - `'customXY'`: each point's label text followed by its X and Y values, for a label that is
2580
+ * not blank.
2581
+ */
2086
2582
  dataLabelFormatScatter?: 'custom' | 'customXY' | 'XY';
2087
- dataLabelPosition?: 'b' | 'bestFit' | 'ctr' | 'l' | 'r' | 't' | 'inEnd' | 'outEnd';
2583
+ /**
2584
+ * Where a data label sits relative to its point (`ST_DLblPos`).
2585
+ *
2586
+ * The whole set is legal on the attribute, but only a subset of it is legal *per plot type*
2587
+ * -- a pie takes `bestFit`/`ctr`/`inEnd`/`outEnd` and nothing else, a stacked bar takes
2588
+ * `inBase` and not `outEnd`. A value outside this plot's subset is dropped with a warning
2589
+ * rather than emitted, because PowerPoint reports the file as needing repair.
2590
+ */
2591
+ dataLabelPosition?: DataLabelPosition;
2088
2592
  }
2089
2593
  interface ChartPropsDataTable {
2090
2594
  dataTableFontSize?: number;
@@ -2118,12 +2622,21 @@ interface ChartPropsLegend {
2118
2622
  * legend horizontally while leaving vertical placement and size automatic.
2119
2623
  * Setting this overrides the automatic placement implied by `legendPos`.
2120
2624
  *
2625
+ * Held to the plot area's {@link ChartPropsBase.layout} rule: `x` and `y` from 0 to 1, `w` and
2626
+ * `h` above 0 and at most 1. A value outside that, or one that is not a number, warns and is
2627
+ * dropped, so that axis stays automatic. `ST_Double` itself is unbounded; whether PowerPoint
2628
+ * places a legend reaching past the chart edge has not been checked, so the narrower rule stands.
2629
+ *
2121
2630
  * Has no effect unless `showLegend` is `true`.
2122
2631
  *
2123
2632
  * @example { x: 0.7, y: 0.3, w: 0.25, h: 0.4 }
2124
2633
  */
2125
2634
  legendLayout?: PositionProps;
2126
- legendPos?: 'b' | 'l' | 'r' | 't' | 'tr';
2635
+ /**
2636
+ * Where the legend sits (`ST_LegendPos`).
2637
+ * @default 'r'
2638
+ */
2639
+ legendPos?: LegendPosition;
2127
2640
  }
2128
2641
  interface ChartPropsTitle extends TextBaseProps {
2129
2642
  title?: string;
@@ -2145,7 +2658,7 @@ interface ChartPropsTitle extends TextBaseProps {
2145
2658
  };
2146
2659
  titleRotate?: number;
2147
2660
  }
2148
- interface ChartOpts extends ChartPropsAxisCat, ChartPropsAxisSer, ChartPropsAxisVal, ChartPropsBase, ChartPropsChartBar, ChartPropsChartDoughnut, ChartPropsChartLine, ChartPropsChartPie, ChartPropsChartRadar, ChartPropsChartWaterfall, ChartPropsChartHistogram, ChartPropsChartBoxWhisker, ChartPropsChartRegionMap, ChartPropsChartStock, ChartPropsChartSurface, ChartPropsDataLabel, ChartPropsDataTable, ChartPropsLegend, ChartPropsTitle, ObjectNameProps, OptsChartGridLine, PositionProps {
2661
+ interface ChartOpts extends ChartPropsAxisCat, ChartPropsAxisSer, ChartPropsAxisVal, ChartPropsBase, ChartPropsChartBar, ChartPropsChartDoughnut, ChartPropsChartLine, ChartPropsChartPie, ChartPropsChartRadar, ChartPropsChartWaterfall, ChartPropsChartHistogram, ChartPropsChartBoxWhisker, ChartPropsChartRegionMap, ChartPropsChartStock, ChartPropsChartSurface, ChartPropsDataLabel, ChartPropsDataTable, ChartPropsLegend, ChartPropsTitle, ObjectNameProps, PositionProps {
2149
2662
  /**
2150
2663
  * Chart type — required when using the canonical `addChart(data, options)` signature.
2151
2664
  * - Omit only for multi-type (combo) charts, where each `ChartMulti` entry carries its own `type`.
@@ -2169,130 +2682,59 @@ interface ChartOpts extends ChartPropsAxisCat, ChartPropsAxisSer, ChartPropsAxis
2169
2682
  metadata?: Record<string, string>;
2170
2683
  }
2171
2684
  //#endregion
2172
- //#region src/ooxml/st-enums.d.ts
2685
+ //#region src/types/style.d.ts
2173
2686
  /**
2174
- * `ST_` simple-type enumerations from ECMA-376, declared once as the single source of both the
2175
- * TypeScript union a caller is checked against and the runtime list a value is validated against.
2687
+ * A stroke, stated once.
2176
2688
  *
2177
- * **The problem this solves.** Each of these used to exist twice: a hand-written string union in
2178
- * `src/types/` (what the compiler enforces) and a hand-written array in `src/gen/` or `src/read/`
2179
- * (what the validator checks at run time). Nothing tied the two together, so adding a member to
2180
- * one and not the other produced either a value TypeScript accepts and the validator drops, or a
2181
- * value the validator passes and the type rejects. Two of them had already diverged in *order*,
2182
- * which is harmless, but nothing would have caught a divergence in *content*.
2689
+ * Width, dash, colour, transparency and cap are one concept, and the library used to spell
2690
+ * them five ways: `width`/`size`/`catAxisLineSize` for the measure, `type` + `dashType` /
2691
+ * `style` / `catAxisLineStyle` for the dash, `HexColor` / `Color` / bare `string` for the
2692
+ * paint. This is that vocabulary; {@link BorderProps} is an alias of it, and the chart
2693
+ * option bag now takes it wherever it used to spell a stroke by hand.
2183
2694
  *
2184
- * **The shape.** Every entry is a `readonly` tuple declared `as const`, with its union derived via
2185
- * `(typeof X)[number]`. Widening the tuple widens the union in the same edit — they cannot drift.
2186
- * This is the idiom already used for `EMBEDDED_FONT_SLOTS` and `EXTRA_SHAPE_PRESETS`; this module
2187
- * brings the stragglers onto it.
2188
- *
2189
- * **Why this module is neither `gen/` nor `read/`.** `src/types/` needs the unions for the public
2190
- * write API, `src/gen/` needs the tuples to vet a value before emitting it, and `src/read/` needs
2191
- * them to vet a value before writing it into a loaded part. It is a fact about the schema, so it
2192
- * belongs to none of the three.
2193
- *
2194
- * Values are listed in **schema declaration order**, which is the order the diagnostics print
2195
- * when they tell a caller what is legal.
2196
- */
2197
- /**
2198
- * `ST_BevelPresetType` — the bevel profile applied to a 3-D edge.
2199
- * @see ECMA-376 Part 1 §20.1.10.9
2200
- */
2201
- declare const BEVEL_PRESETS: readonly ['relaxedInset', 'circle', 'slope', 'cross', 'angle', 'softRound', 'convex', 'coolSlant', 'divot', 'riblet', 'hardEdge', 'artDeco'];
2202
- type BevelPresetType = (typeof BEVEL_PRESETS)[number];
2203
- /**
2204
- * `ST_PresetMaterialType` — how a 3-D surface responds to light.
2205
- * @see ECMA-376 Part 1 §20.1.10.50
2206
- */
2207
- declare const PRESET_MATERIALS: readonly ['legacyMatte', 'legacyPlastic', 'legacyMetal', 'legacyWireframe', 'matte', 'plastic', 'metal', 'warmMatte', 'translucentPowder', 'powder', 'dkEdge', 'softEdge', 'clear', 'flat', 'softmetal'];
2208
- type PresetMaterialType = (typeof PRESET_MATERIALS)[number];
2209
- /**
2210
- * `ST_LightRigType` — the preset lighting scene.
2211
- * @see ECMA-376 Part 1 §20.1.10.35
2212
- */
2213
- declare const LIGHT_RIGS: readonly ['legacyFlat1', 'legacyFlat2', 'legacyFlat3', 'legacyFlat4', 'legacyNormal1', 'legacyNormal2', 'legacyNormal3', 'legacyNormal4', 'legacyHarsh1', 'legacyHarsh2', 'legacyHarsh3', 'legacyHarsh4', 'threePt', 'balanced', 'soft', 'harsh', 'flood', 'contrasting', 'morning', 'sunrise', 'sunset', 'chilly', 'freezing', 'flat', 'twoPt', 'glow', 'brightRoom'];
2214
- type LightRigType = (typeof LIGHT_RIGS)[number];
2215
- /**
2216
- * `ST_LightRigDirection` — where the light rig sits relative to the scene.
2217
- * @see ECMA-376 Part 1 §20.1.10.33
2218
- */
2219
- declare const LIGHT_RIG_DIRECTIONS: readonly ['tl', 't', 'tr', 'l', 'r', 'bl', 'b', 'br'];
2220
- type LightRigDirection = (typeof LIGHT_RIG_DIRECTIONS)[number];
2221
- /**
2222
- * `ST_TextVerticalType` — `a:bodyPr/@vert` and `a:tcPr/@vert`.
2223
- * @see ECMA-376 Part 1 §20.1.10.83
2224
- */
2225
- declare const TEXT_VERTICAL: readonly ['horz', 'vert', 'vert270', 'wordArtVert', 'eaVert', 'mongolianVert', 'wordArtVertRtl'];
2226
- type TextVerticalType = (typeof TEXT_VERTICAL)[number];
2227
- /**
2228
- * `ST_PresetLineDashVal` — the dash pattern of a line or border (`a:prstDash/@val`).
2695
+ * Defaults are **per site**, not per interface — a table border's absent `width` is 1 pt, a
2696
+ * chart gridline's is whatever `DEF_CHART_GRIDLINE` says — so each consumer documents its own
2697
+ * rather than this type claiming one for all of them.
2229
2698
  *
2230
- * The `sys*` members are the "system" dashes whose exact dot/gap ratio the renderer picks; the
2231
- * rest are defined by the spec. Both `BorderProps.dashType` and `ShapeLineProps.dashType` accept
2232
- * this whole set, so a caller who knows one knows the other.
2233
- * @see ECMA-376 Part 1 §20.1.10.49
2699
+ * {@link ShapeLineProps} is deliberately *not* an alias: a shape stroke is a **paint**, so its
2700
+ * `type` names a fill kind (`gradient`, `pattern`, …) rather than the three-way dash switch
2701
+ * below. The keys the two share (`width`, `dashType`, `cap`, `transparency`) already agree.
2234
2702
  */
2235
- declare const PRESET_LINE_DASHES: readonly ['solid', 'dot', 'dash', 'lgDash', 'dashDot', 'lgDashDot', 'lgDashDotDot', 'sysDash', 'sysDot', 'sysDashDot', 'sysDashDotDot'];
2236
- type PresetLineDashVal = (typeof PRESET_LINE_DASHES)[number];
2237
- /**
2238
- * The twelve theme colour slots (`a:clrScheme` children) a `p:clrMap` token can point at.
2239
- *
2240
- * Not an `ST_` type — these are element names inside `a:CT_ColorScheme`, which the schema
2241
- * declares as a fixed sequence rather than an enumeration. The effect is the same: a closed,
2242
- * ordered set of twelve names, in the order the scheme declares them.
2243
- * @see ECMA-376 Part 1 §20.1.6.2
2244
- */
2245
- declare const THEME_COLOR_SLOTS: readonly ['dk1', 'lt1', 'dk2', 'lt2', 'accent1', 'accent2', 'accent3', 'accent4', 'accent5', 'accent6', 'hlink', 'folHlink'];
2246
- type ThemeColorSlot = (typeof THEME_COLOR_SLOTS)[number];
2247
- /**
2248
- * The twelve colour-map tokens (`p:clrMap` attributes), in schema attribute order.
2249
- *
2250
- * A slide's `schemeClr val="tx1"` names a *token*, not a slot: the master's `p:clrMap` is the
2251
- * indirection that sends it to a {@link ThemeColorSlot}. Which is why the two lists look alike
2252
- * and are not the same list — `bg1`/`tx1` are tokens, `lt1`/`dk1` are slots.
2253
- * @see ECMA-376 Part 1 §19.3.1.6
2254
- */
2255
- declare const COLOR_MAP_TOKENS: readonly ['bg1', 'tx1', 'bg2', 'tx2', 'accent1', 'accent2', 'accent3', 'accent4', 'accent5', 'accent6', 'hlink', 'folHlink'];
2256
- type ColorMapToken = (typeof COLOR_MAP_TOKENS)[number];
2257
- //#endregion
2258
- //#region src/types/style.d.ts
2259
- interface BorderProps {
2703
+ interface StrokeProps {
2260
2704
  /**
2261
- * Border type
2262
- * @default solid
2705
+ * Coarse three-way switch: `'none'` suppresses the stroke, `'dash'` asks for a dashed one,
2706
+ * `'solid'` for an unbroken one.
2263
2707
  */
2264
2708
  type?: 'none' | 'dash' | 'solid';
2265
2709
  /**
2266
- * Dash pattern, using the same vocabulary as {@link ShapeLineProps.dashType}.
2710
+ * Dash pattern, over the full `ST_PresetLineDashVal` set, so any dash a source deck can
2711
+ * carry can also be authored.
2267
2712
  *
2268
- * `type` is only a coarse three-way switch, so every dashed border it can express
2269
- * collapses onto `sysDash`. Set this to pick the exact `a:prstDash` preset instead:
2713
+ * `type` is only a coarse three-way switch, so every dashed stroke it can express collapses
2714
+ * onto `sysDash`. Set this to pick the exact `a:prstDash` preset instead:
2270
2715
  * `dashType: 'lgDashDot'` emits `<a:prstDash val="lgDashDot"/>`.
2271
2716
  *
2272
2717
  * **Precedence.** When both are set, `dashType` wins over `type` for the dash pattern —
2273
2718
  * `{ type: 'solid', dashType: 'sysDot' }` draws a dotted rule. The one exception is
2274
- * `type: 'none'`, which suppresses the border entirely and is decided before any dash
2719
+ * `type: 'none'`, which suppresses the stroke entirely and is decided before any dash
2275
2720
  * pattern is chosen. An unrecognized value warns and falls back to what `type` implies.
2276
- * @default (derived from `type`: `sysDash` for `'dash'`, else `solid`)
2277
2721
  * @example { type: 'solid', color: '999999', dashType: 'lgDash' }
2278
2722
  */
2279
- dashType?: ShapeLineProps['dashType'];
2723
+ dashType?: PresetLineDashVal;
2280
2724
  /**
2281
- * Border color (hex)
2725
+ * Stroke colour — a 6-digit hex RGB or a `SchemeColor` token.
2282
2726
  * @example 'FF3399'
2283
- * @default '666666'
2727
+ * @example SchemeColor.accent1
2284
2728
  */
2285
- color?: HexColor;
2729
+ color?: Color;
2286
2730
  /**
2287
- * Border width (points)
2731
+ * Stroke width, in points.
2288
2732
  * - MS-PPT > Format Shape > Fill & Line > Line > Width
2289
- * @default 1
2290
2733
  */
2291
2734
  width?: number;
2292
2735
  /**
2293
- * Border transparency (percent)
2736
+ * Stroke transparency (percent, 0-100).
2294
2737
  * - MS-PPT > Format Shape > Fill & Line > Line > Transparency
2295
- * - range: 0-100
2296
2738
  * @default 0
2297
2739
  */
2298
2740
  transparency?: number;
@@ -2302,6 +2744,13 @@ interface BorderProps {
2302
2744
  */
2303
2745
  cap?: LineCap;
2304
2746
  }
2747
+ /**
2748
+ * A border is a {@link StrokeProps} under its older name, kept because it reads better on the
2749
+ * four sides of a table cell and on a chart area's outline than "stroke" would.
2750
+ *
2751
+ * Defaults where a table border is drawn: `type: 'solid'`, `color: '666666'`, `width: 1`.
2752
+ */
2753
+ type BorderProps = StrokeProps;
2305
2754
  /**
2306
2755
  * Slide-show navigation action for action-button shapes. Each value maps 1:1 onto
2307
2756
  * `ppaction://hlinkshowjump?jump=<value>`. A specific numbered slide is reached via
@@ -2309,9 +2758,8 @@ interface BorderProps {
2309
2758
  */
2310
2759
  type HyperlinkActionJump = 'firstslide' | 'previousslide' | 'nextslide' | 'lastslide' | 'lastslideviewed' | 'endshow';
2311
2760
  interface HyperlinkProps {
2312
- _rId?: number;
2313
2761
  /**
2314
- * Slide number to link to
2762
+ * The 1-based number of the slide to link to. The deck has to have that slide when it is written.
2315
2763
  */
2316
2764
  slide?: number;
2317
2765
  /**
@@ -2344,7 +2792,10 @@ interface ShadowProps {
2344
2792
  transparency?: number;
2345
2793
  /**
2346
2794
  * blur (points)
2347
- * - range: 0-100
2795
+ * - MS-PPT > Format Shape > Effects > Shadow > Blur
2796
+ * - PowerPoint's own spinner stops at 100, but a larger blur is unusual rather than
2797
+ * invalid: it loads and paints. Only a *negative* blur is rejected (clamped to `0` with
2798
+ * a `shadow/blur-out-of-range` diagnostic), because the `blurRad` attribute is unsigned.
2348
2799
  * @default 0
2349
2800
  */
2350
2801
  blur?: number;
@@ -2356,7 +2807,10 @@ interface ShadowProps {
2356
2807
  angle?: number;
2357
2808
  /**
2358
2809
  * shadow offset (points)
2359
- * - range: 0-200
2810
+ * - MS-PPT > Format Shape > Effects > Shadow > Distance
2811
+ * - PowerPoint's own spinner stops at 200, but a larger distance is unusual rather than
2812
+ * invalid: it loads and paints. Only a *negative* offset is rejected (clamped to `0` with
2813
+ * a `shadow/offset-out-of-range` diagnostic), because the `dist` attribute is unsigned.
2360
2814
  * @default 0
2361
2815
  */
2362
2816
  offset?: number;
@@ -2371,6 +2825,24 @@ interface ShadowProps {
2371
2825
  */
2372
2826
  rotateWithShape?: boolean;
2373
2827
  }
2828
+ /**
2829
+ * What a fill option accepts: a {@link ShapeFillProps} object, or a bare {@link Color} as
2830
+ * shorthand for a solid fill in that colour.
2831
+ *
2832
+ * `'FF0000'` and `{ color: 'FF0000' }` are the same statement and emit the same
2833
+ * `<a:solidFill>` — the shorthand is lossless, not a lesser spelling, and every other key on
2834
+ * the object (`transparency`, `gradient`, `pattern`, `image`) is simply one the shorthand has
2835
+ * no way to say. Reach for the object as soon as you need any of them.
2836
+ *
2837
+ * The shorthand is deliberately **not** offered on {@link ShapeLineProps}. A stroke carries
2838
+ * width and dash alongside its paint, and those defaults are applied by rebuilding the line
2839
+ * object at definition time; a bare string arrives with nothing to rebuild, so it would paint
2840
+ * the colour and silently drop `w` and `prstDash`. A stroke says more than a colour, so it is
2841
+ * spelled as an object.
2842
+ * @example fill: 'FF0000' // solid red
2843
+ * @example fill: { color: 'FF0000', transparency: 50 } // the same red, half transparent
2844
+ */
2845
+ type FillOption = Color | ShapeFillProps;
2374
2846
  interface ShapeFillProps {
2375
2847
  /**
2376
2848
  * Fill color
@@ -2400,15 +2872,24 @@ interface ShapeFillProps {
2400
2872
  * On a table cell (`TableCellProps.fill`) and a slide background the two spellings
2401
2873
  * differ the same way, except that *omitting* the option there already means
2402
2874
  * inherit, so `'inherit'` is merely the explicit form of the default.
2875
+ *
2876
+ * **Omitting `type` is not the same as omitting the fill.** Setting `gradient`,
2877
+ * `pattern` or `image` selects that kind on its own — the sub-object is the statement,
2878
+ * and `type` is how you say something the sub-objects cannot. Where both are given and
2879
+ * they disagree, **the explicit `type` wins** and the sub-object is ignored, because
2880
+ * that is the only rule under which `{ type: 'none', gradient }` can still mean
2881
+ * transparent.
2403
2882
  * @default 'solid'
2404
2883
  */
2405
2884
  type?: 'none' | 'inherit' | 'solid' | 'gradient' | 'pattern' | 'image';
2406
2885
  /**
2407
- * Native PPTX gradient fill options.
2886
+ * Native PPTX gradient fill options. Setting this (or `type: 'gradient'`) paints the
2887
+ * shape interior with a gradient instead of a color.
2408
2888
  */
2409
2889
  gradient?: GradientFillProps;
2410
2890
  /**
2411
- * Native PPTX pattern fill options.
2891
+ * Native PPTX pattern fill options. Setting this (or `type: 'pattern'`) paints the
2892
+ * shape interior with a two-color preset pattern instead of a color.
2412
2893
  */
2413
2894
  pattern?: PatternFillProps;
2414
2895
  /**
@@ -2416,22 +2897,36 @@ interface ShapeFillProps {
2416
2897
  * shape interior with a stretched bitmap instead of a color.
2417
2898
  */
2418
2899
  image?: ImageFillProps;
2419
- /**
2420
- * Resolved media relationship id for an image fill, assigned at add-time.
2421
- * @internal
2422
- */
2423
- _imgRid?: number;
2424
2900
  }
2425
2901
  /**
2426
2902
  * Line (stroke) options.
2427
2903
  *
2428
- * A stroke is painted like a fill: in addition to a solid `color`, it accepts the
2429
- * inherited `gradient`/`pattern`/`image` fill options (DrawingML allows the same
2430
- * fill group inside `<a:ln>`). Setting `gradient` (or `type: 'gradient'`) paints a
2431
- * gradient stroke, e.g. `line: { width: 1, gradient: { kind: 'linear', angle: 0,
2432
- * stops: [{ position: 0, color: 'accent3' }, { position: 100, color: 'accent4' }] } }`.
2904
+ * A stroke is painted much like a fill: in addition to a solid `color`, it accepts the
2905
+ * inherited `gradient` and `pattern` fill options. Setting `gradient` (or
2906
+ * `type: 'gradient'`) paints a gradient stroke, e.g. `line: { width: 1, gradient: {
2907
+ * kind: 'linear', angle: 0, stops: [{ position: 0, color: 'accent3' }, { position: 100,
2908
+ * color: 'accent4' }] } }`.
2909
+ *
2910
+ * **A picture stroke is not one of them**, which is why `image` and `type: 'image'` are
2911
+ * subtracted from the inherited fill props rather than carried. `<a:ln>`'s paint child is
2912
+ * `EG_LineFillProperties` — `a:noFill`, `a:solidFill`, `a:gradFill`, `a:pattFill` and
2913
+ * nothing else — so unlike a shape interior a stroke has no `a:blipFill` slot to put a
2914
+ * bitmap in, and a package that emitted one is what PowerPoint answers with a repair
2915
+ * prompt. The interface carried `image` from `ShapeFillProps` regardless, and no call site
2916
+ * ever registered the media for it, so a picture stroke reached the emitter with no rel and
2917
+ * painted nothing. It is now spelled out as unsupported: a JS caller who sets it anyway
2918
+ * gets `line/image-fill-unsupported`.
2919
+ *
2920
+ * A stroke also does not take the bare-colour shorthand a fill does — see {@link FillOption}
2921
+ * for why. Spell it `line: { color: 'FF0000' }`.
2433
2922
  */
2434
- interface ShapeLineProps extends ShapeFillProps {
2923
+ interface ShapeLineProps extends Omit<ShapeFillProps, 'type' | 'image'> {
2924
+ /**
2925
+ * Stroke paint kind. The same vocabulary as {@link ShapeFillProps.type} minus
2926
+ * `'image'`, which `<a:ln>` cannot express (see the note on this interface).
2927
+ * @default 'solid'
2928
+ */
2929
+ type?: 'none' | 'inherit' | 'solid' | 'gradient' | 'pattern';
2435
2930
  /**
2436
2931
  * Line width (pt)
2437
2932
  * @default 1
@@ -2449,13 +2944,13 @@ interface ShapeLineProps extends ShapeFillProps {
2449
2944
  */
2450
2945
  cap?: LineCap;
2451
2946
  /**
2452
- * Begin arrow type
2947
+ * Begin arrow type — the `ST_LineEndType` set (`a:headEnd/@type`).
2453
2948
  */
2454
- beginArrowType?: 'none' | 'arrow' | 'diamond' | 'oval' | 'stealth' | 'triangle';
2949
+ beginArrowType?: LineEndType;
2455
2950
  /**
2456
- * End arrow type
2951
+ * End arrow type — the `ST_LineEndType` set (`a:tailEnd/@type`).
2457
2952
  */
2458
- endArrowType?: 'none' | 'arrow' | 'diamond' | 'oval' | 'stealth' | 'triangle';
2953
+ endArrowType?: LineEndType;
2459
2954
  }
2460
2955
  /**
2461
2956
  * Connector routing style. Maps to a connector preset geometry. The exact preset
@@ -2503,8 +2998,9 @@ interface ConnectorProps {
2503
2998
  * The shape's `objectName` must be set and unique on the slide. `x1`/`y1` remain the static
2504
2999
  * fallback geometry (and are used if the name can't be resolved).
2505
3000
  *
2506
- * A shape inside a group is a valid target — group children are named on the same slide — though
2507
- * the connector itself cannot be a group child (see {@link Slide.addGroup}).
3001
+ * A shape inside a group is a valid target — group children are named on the same slide. The
3002
+ * connector itself is not an {@link Slide.addGroup} child, but {@link Slide.groupObjects} can
3003
+ * group one that is already on the slide.
2508
3004
  */
2509
3005
  startShape?: string;
2510
3006
  /**
@@ -2530,7 +3026,7 @@ interface ConnectorProps {
2530
3026
  y2: Coord;
2531
3027
  /**
2532
3028
  * Line color (6-digit hex, no `#`)
2533
- * @default '000000'
3029
+ * @default '333333'
2534
3030
  */
2535
3031
  color?: HexColor;
2536
3032
  /**
@@ -2625,6 +3121,13 @@ type DataOrPathRequiredProps = (DataOrPathProps & {
2625
3121
  path: string;
2626
3122
  });
2627
3123
  interface BackgroundProps extends DataOrPathProps, ShapeFillProps {}
3124
+ /**
3125
+ * What a `background` option accepts: a {@link BackgroundProps} object, or a bare
3126
+ * {@link Color} as shorthand for a solid background in that colour — the same shorthand
3127
+ * every other fill site takes (see `FillOption`).
3128
+ * @example background: 'FF3399' // shorthand for { color: 'FF3399' }
3129
+ */
3130
+ type BackgroundOption = BackgroundProps | Color;
2628
3131
  /**
2629
3132
  * Color in Hex format
2630
3133
  * @example 'FF3399'
@@ -2722,6 +3225,27 @@ interface ImageFillProps {
2722
3225
  path?: string;
2723
3226
  /** Pre-encoded base64 data URI, e.g. `'image/png;base64,iVBOR...'`. */
2724
3227
  data?: string;
3228
+ /**
3229
+ * Crop the source image to a sub-region by percentage edge insets, emitted as
3230
+ * DrawingML `<a:srcRect>`.
3231
+ * - each value is the percent (0–100) trimmed from that edge of the source image
3232
+ * - `l` + `r` and `t` + `b` must each be less than 100
3233
+ * - omitted edges default to 0
3234
+ *
3235
+ * This is the source-image crop used by native Shape picture fills. The
3236
+ * remaining region is stretched to fill the shape's bounding box and then
3237
+ * clipped by the shape geometry.
3238
+ */
3239
+ crop?: {
3240
+ /** Percent trimmed from the left edge of the source image. @default 0 */
3241
+ l?: number;
3242
+ /** Percent trimmed from the top edge of the source image. @default 0 */
3243
+ t?: number;
3244
+ /** Percent trimmed from the right edge of the source image. @default 0 */
3245
+ r?: number;
3246
+ /** Percent trimmed from the bottom edge of the source image. @default 0 */
3247
+ b?: number;
3248
+ };
2725
3249
  }
2726
3250
  type Margin = number | [number, number, number, number];
2727
3251
  type HAlign = 'left' | 'center' | 'right' | 'justify';
@@ -2774,1153 +3298,227 @@ type GeometryPoint = {
2774
3298
  close: true;
2775
3299
  };
2776
3300
  //#endregion
2777
- //#region src/types/table.d.ts
3301
+ //#region src/types/theme.d.ts
2778
3302
  /**
2779
- * A `<table>` element, from whatever DOM implementation the caller has.
3303
+ * Theme color scheme overrides. Each slot maps to one `<a:clrScheme>` entry in `theme1.xml`;
3304
+ * any slot left unset keeps the default Office value. Provide 6-digit hex (no `#`).
2780
3305
  *
2781
- * Deliberately *not* `lib.dom`'s `Element`. `lib.dom`'s types are built for a browser, and a
2782
- * non-browser DOM's element type — happy-dom's, jsdom's — declares its own members and does
2783
- * not satisfy them, so demanding `Element` would reject from TypeScript exactly the
2784
- * implementations `ts-pptx/html` exists to accept. Requiring the three members the conversion
2785
- * actually calls keeps a mistyped argument an error while letting every real DOM through.
3306
+ * Slot names use the OOXML scheme names. The PowerPoint UI labels them as:
3307
+ * `dk1`=Text/Dark 1, `lt1`=Background/Light 1, `dk2`=Text/Dark 2, `lt2`=Background/Light 2,
3308
+ * `accent1`-`accent6`=Accent 1-6, `hlink`=Hyperlink, `folHlink`=Followed Hyperlink.
3309
+ * @example { accent1: 'C00000', dk2: '1F3864', hlink: '0070C0' }
2786
3310
  */
2787
- interface TableToSlidesElement {
2788
- getAttribute: (name: string) => string | null;
2789
- querySelector: (selectors: string) => unknown;
2790
- querySelectorAll: (selectors: string) => unknown;
3311
+ interface ThemeColorScheme {
3312
+ /** Text/Dark 1 (default Office: black via `windowText`) */
3313
+ dk1?: HexColor;
3314
+ /** Background/Light 1 (default Office: white via `window`) */
3315
+ lt1?: HexColor;
3316
+ /** Text/Dark 2 (default Office: `44546A`) */
3317
+ dk2?: HexColor;
3318
+ /** Background/Light 2 (default Office: `E7E6E6`) */
3319
+ lt2?: HexColor;
3320
+ /** Accent 1 (default Office: `4472C4`) */
3321
+ accent1?: HexColor;
3322
+ /** Accent 2 (default Office: `ED7D31`) */
3323
+ accent2?: HexColor;
3324
+ /** Accent 3 (default Office: `A5A5A5`) */
3325
+ accent3?: HexColor;
3326
+ /** Accent 4 (default Office: `FFC000`) */
3327
+ accent4?: HexColor;
3328
+ /** Accent 5 (default Office: `5B9BD5`) */
3329
+ accent5?: HexColor;
3330
+ /** Accent 6 (default Office: `70AD47`) */
3331
+ accent6?: HexColor;
3332
+ /** Hyperlink (default Office: `0563C1`) */
3333
+ hlink?: HexColor;
3334
+ /** Followed Hyperlink (default Office: `954F72`) */
3335
+ folHlink?: HexColor;
3336
+ }
3337
+ interface ThemeProps {
3338
+ /**
3339
+ * Headings font face name
3340
+ * @example 'Arial Narrow'
3341
+ * @default 'Calibri Light'
3342
+ */
3343
+ headFontFace?: string;
3344
+ /**
3345
+ * Body font face name
3346
+ * @example 'Arial'
3347
+ * @default 'Calibri'
3348
+ */
3349
+ bodyFontFace?: string;
3350
+ /**
3351
+ * Headings East Asian font face — theme `<a:ea>` slot of the major font.
3352
+ * Used for CJK (Chinese/Japanese/Korean) runs that fall back to the theme font.
3353
+ * - leave unset to keep PowerPoint's empty default (auto-resolved per script)
3354
+ * @example 'Yu Gothic'
3355
+ */
3356
+ headFontFaceEA?: string;
3357
+ /**
3358
+ * Body East Asian font face — theme `<a:ea>` slot of the minor font.
3359
+ * Used for CJK (Chinese/Japanese/Korean) runs that fall back to the theme font.
3360
+ * - leave unset to keep PowerPoint's empty default (auto-resolved per script)
3361
+ * @example 'Yu Gothic'
3362
+ */
3363
+ bodyFontFaceEA?: string;
3364
+ /**
3365
+ * Headings complex-script font face — theme `<a:cs>` slot of the major font.
3366
+ * Used for complex scripts such as Arabic, Hebrew, Thai, and Devanagari.
3367
+ * - leave unset to keep PowerPoint's empty default (auto-resolved per script)
3368
+ * @example 'Arial'
3369
+ */
3370
+ headFontFaceCS?: string;
3371
+ /**
3372
+ * Body complex-script font face — theme `<a:cs>` slot of the minor font.
3373
+ * Used for complex scripts such as Arabic, Hebrew, Thai, and Devanagari.
3374
+ * - leave unset to keep PowerPoint's empty default (auto-resolved per script)
3375
+ * @example 'Arial'
3376
+ */
3377
+ bodyFontFaceCS?: string;
3378
+ /**
3379
+ * Theme color scheme overrides written to `ppt/theme/theme1.xml`.
3380
+ * - any unset slot keeps its default Office value
3381
+ * - references such as `SchemeColor.accent1` resolve against these values
3382
+ * @example { accent1: 'C00000', accent2: '00B050', hlink: '0070C0' }
3383
+ */
3384
+ colorScheme?: ThemeColorScheme;
2791
3385
  }
2792
- /**
2793
- * The one thing `tableToSlides` asks a document for. Structural for the same reason
2794
- * {@link TableToSlidesElement} is.
2795
- */
2796
- interface TableToSlidesDocument {
2797
- getElementById: (elementId: string) => TableToSlidesElement | null;
2798
- }
2799
- interface TableToSlidesProps extends TableProps {
2800
- _arrObjTabHeadRows?: TableRow[];
2801
- /**
2802
- * Add an image to slide(s) created during autopaging
2803
- * - `image` prop requires either `path` or `data`
2804
- * - see `DataOrPathProps` for details on `image` props
2805
- * - see `PositionProps` for details on `options` props
2806
- */
2807
- addImage?: {
2808
- image: DataOrPathProps;
2809
- options: PositionProps;
2810
- };
2811
- /**
2812
- * Add a shape to slide(s) created during autopaging
2813
- */
2814
- addShape?: {
2815
- shapeName: SHAPE_NAME;
2816
- options: ShapeProps;
2817
- };
2818
- /**
2819
- * Add a table to slide(s) created during autopaging
2820
- */
2821
- addTable?: {
2822
- rows: TableRow[];
2823
- options: TableProps;
2824
- };
2825
- /**
2826
- * Add a text object to slide(s) created during autopaging
2827
- */
2828
- addText?: {
2829
- text: TextProps[];
2830
- options: TextPropsOptions;
2831
- };
3386
+ //#endregion
3387
+ //#region src/types/pres.d.ts
3388
+ interface WriteBaseProps {
2832
3389
  /**
2833
- * Whether to enable auto-paging
2834
- * - auto-paging creates new slides as content overflows a slide
3390
+ * Whether to DEFLATE-compress the package (PowerPoint itself always compresses;
3391
+ * set `false` only if export time matters more than file size)
2835
3392
  * @default true
2836
3393
  */
2837
- autoPage?: boolean;
2838
- /**
2839
- * Auto-paging character weight
2840
- * - adjusts how many characters are used before lines wrap
2841
- * - range: -1.0 to 1.0
2842
- * @default 0.0
2843
- * @example 0.5 // lines are longer (increases the number of characters that can fit on a given line)
2844
- */
2845
- autoPageCharWeight?: number;
2846
- /**
2847
- * Auto-paging line weight
2848
- * - adjusts how many lines are used before slides wrap
2849
- * - range: -1.0 to 1.0
2850
- * @default 0.0
2851
- * @example 0.5 // tables are taller (increases the number of lines that can fit on a given slide)
2852
- */
2853
- autoPageLineWeight?: number;
2854
- /**
2855
- * Whether to repeat head row(s) on new tables created by autopaging
2856
- * @default false
2857
- */
2858
- autoPageRepeatHeader?: boolean;
2859
- /**
2860
- * The `y` location to use on subsequent slides created by autopaging
2861
- * @default (top margin of Slide)
2862
- */
2863
- autoPageSlideStartY?: number;
2864
- /**
2865
- * Column widths (inches)
2866
- */
2867
- colW?: number | number[];
2868
- /**
2869
- * Document to resolve a table *id* against.
2870
- * - only consulted when the table is identified by string id; passing the element itself
2871
- * needs no document, since one is reached through the element's `ownerDocument`
2872
- * - defaults to the global `document`, which is what a browser caller gets
2873
- * - supply this to convert a table outside a browser (any DOM implementation will do)
2874
- */
2875
- document?: TableToSlidesDocument;
2876
- /**
2877
- * Title of the slide master to use for the auto-paged slides (the `title` passed to
2878
- * `defineSlideMaster`). Matches the `masterTitle` option of `addSlide`.
2879
- * - define a master slide to have your auto-paged slides carry a corporate design, etc.
2880
- */
2881
- masterTitle?: string;
2882
- /**
2883
- * Slide margin
2884
- * - this margin will be across all slides created by auto-paging
2885
- */
2886
- slideMargin?: Margin;
2887
- }
2888
- /**
2889
- * A table cell's corner-to-corner rules (`a:tcPr/a:lnTlToBr` / `a:lnBlToTr`) — the
2890
- * "Diagonal Down Border" / "Diagonal Up Border" of PowerPoint's border gallery.
2891
- *
2892
- * Deliberately its own object rather than two more entries on {@link TableCellProps.border}'s
2893
- * tuple: widening that tuple to six would break every existing caller for a construct almost
2894
- * no deck uses, and the two diagonals are not edges — they do not participate in the
2895
- * perimeter, and they are not inherited by a merged region's covered cells.
2896
- *
2897
- * @example diagonal: { tlToBr: { type:'solid', color:'C00000', width:1 } } // strike a cell out
2898
- * @example diagonal: { tlToBr: { type:'solid' }, blToTr: { type:'solid' } } // an X across the cell
2899
- */
2900
- interface TableCellDiagonals {
2901
- /** Top-left to bottom-right (`╲`, `a:lnTlToBr`). */
2902
- tlToBr?: BorderProps;
2903
- /** Bottom-left to top-right (`╱`, `a:lnBlToTr`). */
2904
- blToTr?: BorderProps;
2905
- }
2906
- /**
2907
- * A cell's 3-D bevel (`a:tcPr/a:cell3D`).
2908
- *
2909
- * A minimal surface over `CT_Cell3D`, which is a required `a:bevel` plus an optional
2910
- * `a:lightRig`. PowerPoint's table UI exposes no control for it — it reaches a deck through a
2911
- * theme's table style or through another producer — so this exists to author and reproduce
2912
- * one, not as a general 3-D model.
2913
- */
2914
- interface TableCell3DProps {
2915
- /**
2916
- * The bevel's preset shape (`a:bevel/@prst`).
2917
- * @default 'circle'
2918
- */
2919
- preset?: BevelPresetType;
2920
- /**
2921
- * Bevel width in points (`a:bevel/@w`; the attribute is EMU).
2922
- * @default 6 // 76200 EMU
2923
- */
2924
- width?: number;
2925
- /**
2926
- * Bevel height in points (`a:bevel/@h`; the attribute is EMU).
2927
- * @default 6 // 76200 EMU
2928
- */
2929
- height?: number;
2930
- /**
2931
- * Surface material (`a:cell3D/@prstMaterial`), which decides how the bevel takes light.
2932
- * @default 'plastic'
2933
- */
2934
- material?: PresetMaterialType;
2935
- /**
2936
- * Scene lighting (`a:cell3D/a:lightRig`). Both fields are required by the schema, so
2937
- * either give both or omit the whole object and let the renderer light the bevel.
2938
- * @example lightRig: { rig: 'threePt', dir: 't' }
2939
- */
2940
- lightRig?: {
2941
- rig: LightRigType;
2942
- dir: LightRigDirection;
2943
- };
2944
- }
2945
- interface TableCellProps extends TextBaseProps {
2946
- /**
2947
- * Auto-paging character weight
2948
- * - adjusts how many characters are used before lines wrap
2949
- * - range: -1.0 to 1.0
2950
- * @default 0.0
2951
- * @example 0.5 // lines are longer (increases the number of characters that can fit on a given line)
2952
- */
2953
- autoPageCharWeight?: number;
2954
- /**
2955
- * Auto-paging line weight
2956
- * - adjusts how many lines are used before slides wrap
2957
- * - range: -1.0 to 1.0
2958
- * @default 0.0
2959
- * @example 0.5 // tables are taller (increases the number of lines that can fit on a given slide)
2960
- */
2961
- autoPageLineWeight?: number;
2962
- /**
2963
- * The cell's four edge borders (`a:tcPr/a:lnT|lnR|lnB|lnL`).
2964
- * - a single `BorderProps` is broadcast to all four sides
2965
- * - an array is read in **TRBL** order (`[top, right, bottom, left]`)
2966
- *
2967
- * Overrides the table-level {@link TableProps.border} default entirely — the two do not
2968
- * merge per side. A `null` entry is a hole: that edge is left out of `a:tcPr` and keeps
2969
- * inheriting from the table style, while `{ type: 'none' }` writes an explicit no-line
2970
- * that overrides it. For the two corner-to-corner rules see {@link diagonal}; for the
2971
- * table's outside edge see {@link TableProps.outerBorder}.
2972
- */
2973
- border?: BorderProps | [BorderProps | null, BorderProps | null, BorderProps | null, BorderProps | null];
2974
- /**
2975
- * The cell's corner-to-corner rules — PowerPoint's "Diagonal Down/Up Border".
3394
+ compression?: boolean;
3395
+ /**
3396
+ * How to handle a media asset (image/audio/video) that fails to load during export.
3397
+ * - `'throw'` (default): reject the export with an error naming the failing asset. A deck
3398
+ * that silently embeds a broken-image placeholder is a degenerate result, so failing
3399
+ * loudly is the safe default.
3400
+ * - `'placeholder'`: substitute a broken-image placeholder, emit a `media/load-failed`
3401
+ * diagnostic (see `setDiagnosticHandler`), and
3402
+ * continue. Useful for best-effort/batch jobs where one missing asset should not abort
3403
+ * the whole deck. An OLE object's or a 3D model's payload still rejects the export: the
3404
+ * placeholder is a picture, and written into a `.xlsx` or `.glb` part it is a part
3405
+ * PowerPoint cannot open.
2976
3406
  *
2977
- * Kept off {@link border}'s tuple on purpose: see {@link TableCellDiagonals}. A diagonal
2978
- * on a merged cell is one stroke across the whole region, so only the span origin carries
2979
- * it — the covered cells inherit the origin's *edges* but never its diagonals.
2980
- * @example diagonal: { tlToBr: { type:'solid', color:'C00000' } } // strike the cell out
3407
+ * An SVG that loads but cannot be rasterized into the PNG fallback written beside it (in a
3408
+ * browser, one that does not decode or has no intrinsic size) is reported as
3409
+ * `media/svg-preview-failed` instead, whether it was given by `path` or inline: the export
3410
+ * rejects with it under `'throw'`, and under `'placeholder'` it is warned, the SVG part keeps
3411
+ * its bytes and only the PNG fallback is a placeholder. A runtime with no rasterizer (Node,
3412
+ * the neutral entry) always writes that placeholder, and reports nothing.
3413
+ * @default 'throw'
2981
3414
  */
2982
- diagonal?: TableCellDiagonals;
2983
- /**
2984
- * Centre the cell's whole text **block** horizontally within the cell
2985
- * (`a:tcPr/@anchorCtr`), independent of each paragraph's own `align`.
2986
- *
2987
- * The two do different things and compose: `align` decides where each line sits inside
2988
- * the text block, `anchorCtr` decides where that block sits inside the cell. With
2989
- * left-aligned text in a wide cell, `anchorCtr: true` centres the ragged-right column of
2990
- * lines as a unit while keeping their left edges flush with each other.
2991
- *
2992
- * `false` is the schema default, so it emits nothing — the same reasoning as
2993
- * `horzOverflow: 'clip'`.
2994
- * @default false
2995
- */
2996
- anchorCtr?: boolean;
2997
- /**
2998
- * A 3-D bevel on the cell (`a:tcPr/a:cell3D`). Niche: PowerPoint's table UI has no
2999
- * control for it, so it reaches a deck from a theme or another producer, and this exists
3000
- * to author and reproduce one. See {@link TableCell3DProps}.
3001
- */
3002
- cell3D?: TableCell3DProps;
3003
- /**
3004
- * Cell colspan
3005
- */
3006
- colspan?: number;
3007
- /**
3008
- * Cell fill — a solid color, or a picture that fills the cell (`a:blipFill` in
3009
- * the cell's `a:tcPr`, stretched to the cell box). A picture fill embeds the
3010
- * image as slide media; identical sources are embedded once. Raster only —
3011
- * an SVG source warns and is ignored, matching shape fills.
3012
- * @example { color:'FF0000' } // hex color (red)
3013
- * @example { color:'0088CC', transparency:50 } // hex color, 50% transparent
3014
- * @example { color:SchemeColor.accent1 } // theme color Accent1
3015
- * @example { type:'image', image:{ path:'logo.png' } } // picture fill
3016
- * @example { image:{ data:'image/png;base64,…' } } // picture fill, `type` inferred
3017
- */
3018
- fill?: ShapeFillProps;
3019
- /**
3020
- * What happens to a **single glyph** wider than the cell's text width (`a:tcPr/@horzOverflow`).
3021
- * - `'clip'` (PowerPoint's default) cuts the glyph off at the cell edge
3022
- * - `'overflow'` lets it draw past the edge, over whatever is beside it
3023
- *
3024
- * This is **not** a text-wrap switch, despite the name. Lines always wrap to the column
3025
- * width; only an individual character too wide to fit on a line by itself is affected, so
3026
- * it matters for oversized display type, wide CJK/emoji glyphs, and icon fonts in a narrow
3027
- * column. PowerPoint has no per-cell no-wrap at all — `wrap="none"` on a cell's `a:bodyPr`
3028
- * is discarded on the next save (probe:
3029
- * `test/read/fixtures/authoring/probe-table-cell-wrap.ps1`).
3030
- * `'clip'` is written as asked but is the schema default, so PowerPoint drops the
3031
- * attribute again the first time it saves the deck — the visible result is the same
3032
- * either way, and leaving this unset emits nothing at all.
3033
- * @default (unset — PowerPoint clips)
3034
- * @example 'overflow' // a 60pt glyph in a 0.5in column draws whole instead of being cut
3035
- */
3036
- horzOverflow?: 'clip' | 'overflow';
3037
- hyperlink?: HyperlinkProps;
3038
- /**
3039
- * Cell margin (inches)
3040
- * @default 0
3041
- */
3042
- margin?: Margin;
3043
- /**
3044
- * Cell rowspan
3045
- */
3046
- rowspan?: number;
3047
- /**
3048
- * Shrink cell text to fit when it would overflow the cell's fixed height.
3049
- * - `'shrink'` measures the wrapped text and bakes a **reduced literal font size**
3050
- * onto the cell's runs so the text fits — PowerPoint does not support text
3051
- * autofit (`normAutofit`) inside table cells, so there is no font-scale flag to
3052
- * set; the size itself is lowered, which both PowerPoint and LibreOffice render
3053
- * identically with no edit/resize.
3054
- * - Requires the cell font registered via {@link TsPptx.registerFontMetrics};
3055
- * without metrics it is a no-op (the cell keeps its authored size) and warns once.
3056
- * - Only triggers when the cell's row has a **fixed** height that the text exceeds.
3057
- * With auto-height rows (no `rowH`/`h`), the row simply grows, so nothing shrinks.
3058
- * - Only `'shrink'` is acted on for cells. `'resize'` and the object form are ignored
3059
- * here: a table row already auto-grows to fit its tallest cell (the cell equivalent
3060
- * of `spAutoFit`), so there is nothing to bake. (The wider union is shared with
3061
- * {@link TextPropsOptions.fit} so table-level `fit` can cascade to cells.)
3062
- * @example 'shrink' // measured when the cell font is registered; else no-op
3063
- */
3064
- fit?: 'none' | 'shrink' | 'resize' | TextFitShrinkProps;
3065
- }
3066
- interface TableProps extends PositionProps, TextBaseProps, ObjectNameProps {
3067
- _arrObjTabHeadRows?: TableRow[];
3068
- /**
3069
- * Name of a table/content placeholder defined on the slide layout/master to bind this table to.
3070
- * - when it matches a layout/master placeholder, the table's `<p:graphicFrame>` emits that
3071
- * placeholder's `<p:ph>` (idx/type) so PowerPoint treats the table as filling the placeholder
3072
- * (e.g. a "Title and Content" content placeholder)
3073
- * - the table also inherits the placeholder's position/size for any of x/y/w/h left unset
3074
- * @example 'body' // bind to the layout placeholder named 'body'
3075
- */
3076
- placeholder?: string;
3077
- /**
3078
- * Whether to enable auto-paging
3079
- * - auto-paging creates new slides as content overflows a slide
3080
- * @default false
3081
- */
3082
- autoPage?: boolean;
3083
- /**
3084
- * Auto-paging character weight
3085
- * - adjusts how many characters are used before lines wrap
3086
- * - range: -1.0 to 1.0
3087
- * @default 0.0
3088
- * @example 0.5 // lines are longer (increases the number of characters that can fit on a given line)
3089
- */
3090
- autoPageCharWeight?: number;
3091
- /**
3092
- * Auto-paging line weight
3093
- * - adjusts how many lines are used before slides wrap
3094
- * - range: -1.0 to 1.0
3095
- * @default 0.0
3096
- * @example 0.5 // tables are taller (increases the number of lines that can fit on a given slide)
3097
- */
3098
- autoPageLineWeight?: number;
3099
- /**
3100
- * Whether table header row(s) should be repeated on each new slide creating by autoPage.
3101
- * Use `autoPageHeaderRows` to designate how many rows comprise the table header (1+).
3102
- * @default false
3103
- */
3104
- autoPageRepeatHeader?: boolean;
3105
- /**
3106
- * Number of rows that comprise table headers
3107
- * - required when `autoPageRepeatHeader` is set to true.
3108
- * @example 2 - repeats the first two table rows on each new slide created
3109
- * @default 1
3110
- */
3111
- autoPageHeaderRows?: number;
3112
- /**
3113
- * The `y` location to use on subsequent slides created by autopaging
3114
- * @default (top margin of Slide)
3115
- */
3116
- autoPageSlideStartY?: number;
3117
- /**
3118
- * Whether populated placeholders on the source slide (e.g. a title set via
3119
- * `addText(text, { placeholder })`) are copied onto each overflow slide created by autoPage.
3120
- * - new slides otherwise inherit only the layout's empty placeholders, so a title set on the
3121
- * first slide would not appear on continuation slides.
3122
- * @default false
3123
- */
3124
- autoPagePlaceholder?: boolean;
3125
- /**
3126
- * Default border for **every cell** in the table — not the table's outer perimeter.
3127
- *
3128
- * A single `BorderProps` is broadcast to all four sides of each cell; an array is read
3129
- * in TRBL order and applied to each cell's own four sides. So
3130
- * `border: [{type:'solid'}, {type:'none'}, {type:'solid'}, {type:'none'}]` gives *every*
3131
- * cell a top and bottom rule — a full set of horizontal grid lines, not a rule at the
3132
- * top and bottom of the table. A cell's own `options.border` overrides this entirely.
3133
- *
3134
- * A `null` entry is a hole — that edge inherits from the table style — where
3135
- * `{ type: 'none' }` writes an explicit no-line that overrides it. Authoring nothing at
3136
- * all depends on {@link tableStyle}: a styled table leaves every edge absent so the style
3137
- * paints its grid, and a table with no style takes four no-fill sides, which is what keeps
3138
- * it clear of PowerPoint's no-style black hairline grid.
3139
- *
3140
- * For the perimeter, use {@link outerBorder}, which applies only to the cells on the
3141
- * table's outside edge. The two compose: `border` draws the interior grid and
3142
- * `outerBorder` overrides the edges it reaches.
3143
- * @example border: { type:'solid', color:'D9D9D9', width:0.5 } // full grid
3144
- * @example border: [{type:'solid'}, {type:'none'}, {type:'solid'}, {type:'none'}] // horizontal rules only
3145
- */
3146
- border?: BorderProps | [BorderProps | null, BorderProps | null, BorderProps | null, BorderProps | null];
3147
- /**
3148
- * Border for the table's outer perimeter only — the top edge of the first row, the
3149
- * bottom edge of the last row, the left edge of the first column and the right edge of
3150
- * the last column.
3151
- *
3152
- * A single `BorderProps` is used for all four perimeter sides; an array is read in TRBL
3153
- * order, so `outerBorder: [box, box, box, box]` boxes the table and
3154
- * `outerBorder: [rule, undefined, rule, undefined]` rules only above and below it.
3155
- * An `undefined`/omitted entry leaves that side to whatever {@link border} (or the cell's
3156
- * own `options.border`) already put there.
3157
- *
3158
- * Applied **after** every other border source, so it wins on the sides it touches and
3159
- * leaves the interior alone — the "outline the table, no interior grid" case is
3160
- * `outerBorder` with no `border` at all. Merged cells are handled: a span's covered cells
3161
- * inherit the origin's borders, so a colspan straddling the last column still gets the
3162
- * right-hand rule.
3163
- * @example outerBorder: { type:'solid', color:'1A2B3C', width:1 } // box the table
3164
- * @example outerBorder: [{type:'solid'}, undefined, {type:'solid'}, undefined] // rules above and below
3165
- */
3166
- outerBorder?: BorderProps | [BorderProps?, BorderProps?, BorderProps?, BorderProps?];
3167
- /**
3168
- * Width of table columns (inches)
3169
- * - single value is applied to every column equally based upon `w`
3170
- * - array of values in applied to each column in order
3171
- * @default columns of equal width based upon `w`
3172
- */
3173
- colW?: number | number[];
3174
- /**
3175
- * Shrink columns proportionally so a too-wide table fits the slide.
3176
- * - `'shrink'`: if the total column width exceeds the space available between
3177
- * the table's `x` and the right slide margin, scale every column down by the
3178
- * same factor so the whole table fits. Columns that already fit are untouched.
3179
- * - applies to an explicit `colW` array (the common "too many columns" case) and
3180
- * to a `w` wider than the slide; never grows columns and never enforces a
3181
- * minimum width, so a very high column count can still become thin.
3182
- * - opt-in: explicit widths are otherwise emitted as-is and may run off the slide.
3183
- * @default undefined (no scaling)
3184
- */
3185
- fitColumns?: 'shrink';
3186
- /**
3187
- * Table-level text-fit policy, cascaded to every cell that does not set its own
3188
- * {@link TableCellProps.fit}.
3189
- * - `'shrink'`: each cell whose row has a **fixed** height that its wrapped text
3190
- * would exceed gets a reduced literal font size baked onto its runs so the text
3191
- * fits (see {@link TableCellProps.fit} for the full semantics and the font-metrics
3192
- * requirement). Cells that set their own `fit` win over this table default.
3193
- * - `'none'` / `'resize'` / the object form are accepted for parity with
3194
- * {@link TextPropsOptions.fit} but only `'shrink'` is acted on for table cells.
3195
- * @default undefined (cells keep their authored size)
3196
- * @example 'shrink'
3197
- */
3198
- fit?: 'none' | 'shrink' | 'resize' | TextFitShrinkProps;
3199
- /**
3200
- * Mark the first row as a header row.
3201
- * Emits `firstRow="1"` on `<a:tblPr>`, activating the first-row style region of
3202
- * the table style and satisfying the PowerPoint accessibility checker's "table header" rule.
3203
- * @default false
3204
- */
3205
- hasHeader?: boolean;
3206
- /**
3207
- * Mark the last row as a footer row.
3208
- * Emits `lastRow="1"` on `<a:tblPr>`, activating the last-row style region.
3209
- * Requires `tableStyle` to have a visible effect.
3210
- * @default false
3211
- */
3212
- hasFooter?: boolean;
3213
- /**
3214
- * Enable alternating row (band) shading.
3215
- * Emits `bandRow="1"` on `<a:tblPr>`, activating band1H/band2H style regions.
3216
- * Requires `tableStyle` to have a visible effect.
3217
- * @default false
3218
- */
3219
- hasBandedRows?: boolean;
3220
- /**
3221
- * Enable alternating column (band) shading.
3222
- * Emits `bandCol="1"` on `<a:tblPr>`, activating band1V/band2V style regions.
3223
- * Requires `tableStyle` to have a visible effect.
3224
- * @default false
3225
- */
3226
- hasBandedColumns?: boolean;
3227
- /**
3228
- * Apply special styling to the first column.
3229
- * Emits `firstCol="1"` on `<a:tblPr>`, activating the firstCol style region.
3230
- * Requires `tableStyle` to have a visible effect.
3231
- * @default false
3232
- */
3233
- hasFirstColumn?: boolean;
3234
- /**
3235
- * Apply special styling to the last column.
3236
- * Emits `lastCol="1"` on `<a:tblPr>`, activating the lastCol style region.
3237
- * Requires `tableStyle` to have a visible effect.
3238
- * @default false
3239
- */
3240
- hasLastColumn?: boolean;
3241
- /**
3242
- * Lay the table out right-to-left.
3243
- * Emits `rtl="1"` on `<a:tblPr>`, which mirrors the column order so the first
3244
- * column renders on the right — the correct layout for RTL scripts (Arabic, Hebrew).
3245
- * This controls only the table/column direction; per-cell text direction is set
3246
- * with each cell's `rtlMode` option.
3247
- * @default false
3248
- */
3249
- rtl?: boolean;
3250
- /**
3251
- * Built-in table style to apply, as a `TableStyle` member.
3252
- * Emits `<a:tableStyleId>` inside `<a:tblPr>` with the corresponding GUID.
3253
- * Style flags (`hasHeader`, `hasFooter`, `hasBandedRows`, etc.) select which
3254
- * regions of the chosen style are activated; they have no visible effect without
3255
- * a `tableStyle` set.
3256
- *
3257
- * **Only a built-in GUID renders.** PowerPoint resolves `<a:tableStyleId>` against
3258
- * its own table-style gallery and never reads a style definition out of the package,
3259
- * so a GUID it does not recognise leaves the table with PowerPoint's no-style look —
3260
- * a black hairline grid. For brand colours use direct formatting instead:
3261
- * `headerRow`, `columns[i]`, the table-level {@link border} / {@link fill}, or per-cell
3262
- * options. See `docs/tables.md` → "Table styles".
3263
- *
3264
- * @example tableStyle: pptx.TableStyle.MEDIUM_STYLE_2_ACCENT_1
3265
- */
3266
- tableStyle?: TableStyle;
3267
- /**
3268
- * Inline styling for the header (first) row, applied as direct per-cell formatting.
3269
- *
3270
- * This is how a header is styled distinctly from the body: each property is merged
3271
- * onto every cell of row 0 (`fill`, `color`, `bold`, `align`, `border`, etc.).
3272
- *
3273
- * Precedence (highest wins), matching how PowerPoint resolves styling — direct cell
3274
- * formatting overrides a table-style region:
3275
- * 1. explicit per-cell `options` on a row-0 cell
3276
- * 2. this `headerRow`
3277
- * 3. the `firstRow` region of a built-in `tableStyle`
3278
- * 4. the library's per-cell defaults
3279
- *
3280
- * Setting `headerRow` also implies `hasHeader: true` (emits `firstRow="1"` for the
3281
- * accessibility "table header" marker) unless `hasHeader` is explicitly set to `false`.
3282
- * @example headerRow: { fill: { color:'1A2B3C' }, color:'FFFFFF', bold:true, align:'center' }
3283
- */
3284
- headerRow?: TableCellProps;
3285
- /**
3286
- * Per-column default cell styling, applied as direct per-cell formatting.
3287
- *
3288
- * `columns[i]` is merged onto every cell that starts in column `i` (`fill`, `color`,
3289
- * `bold`, `align`, `valign`, `border`, `margin`, …), so a wide **colored** matrix —
3290
- * per-column fills, maturity-gradient headers — does not require hand-writing a fill
3291
- * onto every cell. Entries may be sparse (`columns[2]` alone styles only column 2);
3292
- * an `undefined`/omitted entry leaves that column untouched. The whole option is
3293
- * optional and degrades cleanly to today's text-on-white when not given.
3294
- *
3295
- * Precedence (highest wins), matching how PowerPoint resolves styling — direct cell
3296
- * formatting overrides a table-style region:
3297
- * 1. explicit per-cell `options`
3298
- * 2. `headerRow` (row 0 only)
3299
- * 3. this `columns[colIdx]`
3300
- * 4. a built-in `tableStyle` / the library's per-cell defaults
3301
- *
3302
- * The merge is property-level, so a header cell keeps `headerRow`'s typography **and**
3303
- * takes its column's `fill` when they set different properties. For a graduated header
3304
- * band, put shared header typography (bold/white/centered, **no fill**) in `headerRow`
3305
- * and let each `columns[i].fill` supply that column's fill.
3306
- *
3307
- * Column index counts each cell's `colspan` (default 1) within a row, so merged cells
3308
- * map to the correct column; it does not track `rowspan`s inherited from earlier rows.
3309
- *
3310
- * There is deliberately no built-in "group bracket" annotation. Label a span of columns
3311
- * by composing existing primitives: `addShape('rightBrace', …)` (or `'bracePair'`) plus
3312
- * `addText`, positioned from the table's `x` and `colW` (a span's `x`/`w` is the running
3313
- * sum of the preceding/covered column widths).
3314
- *
3315
- * @example columns: [{}, { fill: { color:'E8F0FE' } }, { fill: { color:'C6DAFC' } }] // per-column solid fills
3316
- * @example // gradient header: shared typography on headerRow, graduated fills per column
3317
- * headerRow: { color:'FFFFFF', bold:true, align:'center' },
3318
- * columns: [{}, { fill:{color:'BBD3FB'} }, { fill:{color:'89AEF6'} }, { fill:{color:'4B7BE5'} }]
3319
- */
3320
- columns?: TableCellProps[];
3321
- /**
3322
- * Default cell background — **stamped onto every cell**, not painted behind the table.
3323
- *
3324
- * Each cell that does not set its own `options.fill` (or take one from `headerRow` /
3325
- * `columns[i]`) gets this as its own `a:tcPr` fill. A picture fill is embedded once and
3326
- * shared by every cell that inherits it.
3327
- *
3328
- * Visually this is usually what you want, but it is not what a source deck contains, and
3329
- * it has one real consequence: because every cell ends up explicitly filled, a cell that
3330
- * later gets its own fill has nothing to fall back to. For a genuine table background —
3331
- * one `a:tblPr` fill that cells sit on top of — use {@link tableFill}.
3332
- * @example { color:'FF0000' } // hex color (red)
3333
- * @example { color:'0088CC', transparency:50 } // hex color, 50% transparent
3334
- * @example { color:SchemeColor.accent1 } // theme color Accent1
3335
- * @example { type:'image', image:{ path:'watermark.png' } } // picture fill
3336
- */
3337
- fill?: ShapeFillProps;
3338
- /**
3339
- * The table's own background (`a:tblPr` fill) — one fill behind the whole table that
3340
- * every cell sits on top of.
3341
- *
3342
- * The counterpart to {@link fill}, and the difference is where the paint lands rather
3343
- * than how it looks: `fill` copies a colour onto every cell, while this writes a single
3344
- * fill on the table itself. That matters when a cell is meant to be transparent — with
3345
- * `tableFill`, an unfilled cell shows the table background through; with `fill` there is
3346
- * no such thing as an unfilled cell. It is also what a deck read back from PowerPoint
3347
- * actually carries, so a replica reproduces the source's structure rather than an
3348
- * equivalent-looking flattening of it.
3349
- *
3350
- * Takes the same `ShapeFillProps` a cell does — solid, gradient, pattern or picture.
3351
- * @example { color:'F2F2F2' } // a light background behind the whole table
3352
- * @example { type:'image', image:{ path:'watermark.png' } } // one watermark, not one per cell
3353
- */
3354
- tableFill?: ShapeFillProps;
3355
- /**
3356
- * Cell margin (inches)
3357
- * - affects all table cells, is superceded by cell options
3358
- */
3359
- margin?: Margin;
3360
- /**
3361
- * Height of table rows (inches)
3362
- * - single value is applied to every row equally based upon `h`
3363
- * - array of values in applied to each row in order
3364
- * @default rows of equal height based upon `h`
3365
- */
3366
- rowH?: number | number[];
3367
- /**
3368
- * DEV-ONLY diagnostic flag: when `true`, logs a verbose trace of the auto-paging
3369
- * calculations to the console. Intended for debugging table layout only; leave unset
3370
- * in production. Inherited by {@link TableToSlidesProps}.
3371
- * @default false
3372
- */
3373
- verbose?: boolean;
3374
- }
3375
- interface TableCell {
3376
- _type?: SlideObjectType.tablecell;
3377
- /** lines in this cell (autoPage) */
3378
- _lines?: TableCell[][];
3379
- /** `text` prop but guaranteed to hold "TableCell[]" */
3380
- _tableCells?: TableCell[];
3381
- /** height in EMU */
3382
- _lineHeight?: number;
3383
- _hmerge?: boolean;
3384
- _vmerge?: boolean;
3385
- _rowContinue?: number;
3386
- /** origin cell of a colspan/rowspan span, set on the dummy `_hmerge`/`_vmerge` cells so they can
3387
- * inherit the origin's border/fill and render the merged region's outer edges */
3388
- _spanOrigin?: TableCell;
3389
- /**
3390
- * Cell content: a plain string, or an array of `TableCell` runs for mixed formatting.
3391
- * (A `number` is still coerced to a string at runtime for plain-JS callers, but is no
3392
- * longer part of the type — pass `String(n)` from TypeScript.)
3393
- */
3394
- text?: string | TableCell[];
3395
- options?: TableCellProps;
3396
- }
3397
- interface TableRowSlide {
3398
- rows: TableRow[];
3399
- /**
3400
- * Per-row height (inches) aligned 1:1 with `rows`, derived from the original `rowH` array.
3401
- * Auto-paging splits/reorders rows across slides and inserts repeated headers, so the caller's
3402
- * `rowH[i]` (keyed by *original* row index) can no longer be applied by physical row index on
3403
- * each generated slide. This carries each output row's resolved height so a configured height
3404
- * follows its source row instead of being re-applied to whatever lands at that index.
3405
- * Entries are `undefined` where no explicit height was configured (auto-distributed height).
3406
- */
3407
- rowH?: Array<number | undefined>;
3408
- }
3409
- type TableRow = TableCell[];
3410
- //#endregion
3411
- //#region src/types/animation.d.ts
3412
- /**
3413
- * Slide transition and animation types.
3414
- *
3415
- * Re-exported by `./index.js`, which is the import site for the rest of `src/`.
3416
- */
3417
- /**
3418
- * Base ECMA-376 slide-transition type (`p:transition`'s single type child). Each
3419
- * maps to a `<p:TYPE/>` element; type-specific variants (e.g. direction) go in
3420
- * {@link TransitionProps.variant}. Modern PowerPoint-only transitions (Morph,
3421
- * Vortex, …) live in the `p14`/`p15`/`p159` namespaces and are out of authoring
3422
- * scope for now. See `docs/animations-and-transitions.md`.
3423
- */
3424
- type TransitionType = 'blinds' | 'checker' | 'circle' | 'comb' | 'cover' | 'cut' | 'diamond' | 'dissolve' | 'fade' | 'newsflash' | 'plus' | 'pull' | 'push' | 'random' | 'randomBar' | 'split' | 'strips' | 'wedge' | 'wheel' | 'wipe' | 'zoom';
3425
- /**
3426
- * Slide-show transition applied between slides (`p:transition`). Assign to
3427
- * {@link Slide.transition}. Setting `durationMs` emits PowerPoint's
3428
- * `mc:AlternateContent` form (a `p14` Choice carrying `p14:dur` plus a base
3429
- * `mc:Fallback`); otherwise only the coarse `speed` bucket is written.
3430
- * @example slide.transition = { type: 'push', durationMs: 1250, variant: { dir: 'd' } }
3431
- */
3432
- interface TransitionProps {
3433
- /** Transition type (the `<p:TYPE/>` element), e.g. `fade`, `push`, `wipe`, `cut`, `dissolve`. */
3434
- type: TransitionType;
3435
- /** Exact duration in milliseconds (`p14:dur`); emits the `mc:AlternateContent` form. */
3436
- durationMs?: number;
3437
- /** Coarse speed bucket (`spd`); derived from `durationMs` when omitted, else defaults to `fast`. */
3438
- speed?: 'slow' | 'med' | 'fast';
3439
- /** Advance on mouse click (`advClick`). @default true */
3440
- advanceOnClick?: boolean;
3441
- /** Auto-advance after this many milliseconds (`advTm`). */
3442
- advanceAfterMs?: number;
3443
- /** Type-specific variant attributes, e.g. `{ dir: 'd' }` for push, `{ spokes: '2' }` for wheel. */
3444
- variant?: Record<string, string>;
3445
- /** Sound played with the transition (`p:sndAc`): a start sound (embedded WAV) or the stop-previous form. */
3446
- sound?: TransitionSoundProps;
3447
- /**
3448
- * Internal: the slide relationship id assigned to the embedded sound part, stamped
3449
- * by the export-time registration pass. Not part of the authoring surface.
3450
- */
3451
- _sndRId?: number;
3452
- }
3453
- /**
3454
- * A transition sound (`p:sndAc`). Either a **start sound** — an embedded WAV played
3455
- * when the transition runs (`p:stSnd` → `p:snd`), optionally looped — or the
3456
- * **stop-previous** form (`p:endSnd`) that silences a still-playing transition
3457
- * sound. Built-in PowerPoint sounds embed identically to a custom file, so there is
3458
- * no separate built-in path: supply the WAV bytes via `data` or `path`.
3459
- * See `docs/animations-and-transitions.md`.
3460
- */
3461
- interface TransitionSoundProps {
3462
- /** Embedded sound bytes as a base64 data URI (e.g. `data:audio/wav;base64,…`) or raw base64. */
3463
- data?: string;
3464
- /** Path to a sound file, read at export time (alternative to `data`). */
3465
- path?: string;
3466
- /** Display name emitted on `<p:snd @name>` (e.g. `ding.wav`); defaults to the file name. */
3467
- name?: string;
3468
- /** Loop the sound until the next sound starts (`<p:stSnd loop="1">`). @default false */
3469
- loop?: boolean;
3470
- /** Emit the stop-previous form (`<p:endSnd/>`) instead of a start sound. Mutually exclusive with `data`/`path`. */
3471
- stopPrevious?: boolean;
3415
+ onMediaError?: 'throw' | 'placeholder';
3472
3416
  }
3473
- /**
3474
- * A preset build-animation effect. The supported set is fixed (each is a verbatim
3475
- * template captured from PowerPoint); adding one means adding a fixture + template,
3476
- * not a new code path. See `docs/animations-and-transitions.md`.
3477
- */
3478
- type PresetEffect = 'fadeIn' | 'flyIn' | 'appear' | 'wipe' | 'grow' | 'spin' | 'fadeOut' | 'flyOut';
3479
- /** When a build-animation effect starts relative to the preceding one. */
3480
- type AnimationTrigger = 'onClick' | 'withPrevious' | 'afterPrevious';
3481
- /**
3482
- * A preset build animation on a shape (entrance/emphasis/exit), added via
3483
- * {@link Slide.addAnimation}. Target the shape by its 0-based add order
3484
- * (`shapeIndex`, mapping to the generated `spid = shapeIndex + 2`) or by
3485
- * `objectName`. Effects play in the order added, grouped into click steps by
3486
- * `trigger`.
3487
- */
3488
- interface AnimationProps {
3489
- /** The preset effect to play. */
3490
- preset: PresetEffect;
3417
+ interface WriteProps extends WriteBaseProps {
3491
3418
  /**
3492
- * 0-based add order of the target shape on the slide (`spid = shapeIndex + 2`).
3493
- * Counts top-level objects only; use `objectName` to target a shape inside a group.
3419
+ * Output type
3420
+ * - values: 'arraybuffer' | 'base64' | 'binarystring' | 'blob' | 'nodebuffer' | 'uint8array'
3421
+ * @default 'blob'
3494
3422
  */
3495
- shapeIndex?: number;
3496
- /**
3497
- * Target shape by its `objectName` (alternative to `shapeIndex`). Any shape on the slide,
3498
- * including one inside a group; an unresolved name warns and drops the effect.
3499
- */
3500
- objectName?: string;
3501
- /** Trigger relative to the previous effect. @default 'onClick' */
3502
- trigger?: AnimationTrigger;
3503
- /** Effect duration in milliseconds; preset-specific default when omitted. */
3504
- durationMs?: number;
3423
+ outputType?: WRITE_OUTPUT_TYPE;
3505
3424
  }
3506
- //#endregion
3507
- //#region src/types/master.d.ts
3508
- interface SlideNumberProps extends PositionProps, TextBaseProps {
3425
+ interface WriteFileProps extends WriteBaseProps {
3509
3426
  /**
3510
- * margin (inches) — text-frame internal margin; a value `>= 1` warns as a likely legacy points value
3427
+ * Export file name
3428
+ * @default 'Presentation.pptx'
3511
3429
  */
3512
- margin?: Margin;
3513
- }
3514
- interface SlideMasterChartProps {
3515
- type: CHART_NAME | ChartMulti[];
3516
- data: OptsChartData[];
3517
- options?: ChartOpts;
3518
- opts?: ChartOpts;
3519
- }
3520
- /**
3521
- * One object on a slide master, as a key-tagged descriptor.
3522
- *
3523
- * The six descriptors it shares with a group child are {@link CommonObjectDescriptor}; the two
3524
- * below are the master's own — a chart, which a group cannot hold, and a placeholder, which is
3525
- * the whole point of a master.
3526
- */
3527
- type SlideMasterObject = CommonObjectDescriptor | {
3528
- chart: SlideMasterChartProps;
3529
- } | {
3530
- placeholder: {
3531
- options: PlaceholderProps;
3532
- /**
3533
- * Text to be shown in placeholder (shown until user focuses textbox or adds text)
3534
- * - Leave blank to have powerpoint show default phrase (ex: "Click to add title")
3535
- */
3536
- text?: string;
3537
- };
3538
- };
3539
- /**
3540
- * Bullet configuration for one slide-master text-style level (`a:buChar`/`a:buAutoNum`/`a:buNone`).
3541
- * A focused subset of the run-level bullet model — picture bullets and per-glyph sizing are not
3542
- * supported in master defaults (those require slide rels). Set `bullet: false` to suppress the
3543
- * level's bullet entirely.
3544
- */
3545
- interface MasterBulletProps {
3546
- /** `'bullet'` emits a character bullet (`a:buChar`); `'number'` emits an auto-number (`a:buAutoNum`). @default 'bullet' */
3547
- type?: 'bullet' | 'number';
3548
- /** Bullet character (unicode code point hex), e.g. `'2022'` for •. Used when `type` is `'bullet'`. */
3549
- characterCode?: string;
3550
- /** Glyph font typeface for the bullet character (`a:buFont`), e.g. `'Arial'` or `'Wingdings'`. */
3551
- fontFace?: string;
3552
- /** Auto-number scheme (`a:buAutoNum@type`) when `type` is `'number'`, e.g. `'arabicPeriod'`. @default 'arabicPeriod' */
3553
- numberType?: string;
3554
- /** Starting value for auto-numbered bullets (`a:buAutoNum@startAt`). @default 1 */
3555
- numberStartAt?: number;
3430
+ fileName?: string;
3556
3431
  }
3557
3432
  /**
3558
- * Styling for one paragraph level (`a:lvlNpPr`) of a slide-master text style. Every field is
3559
- * optional; an unset field keeps PowerPoint's built-in default for that level. Configure via
3560
- * {@link SlideMasterProps.textStyles}.
3433
+ * One emitted OOXML package part: its full slash-path and already-encoded bytes. Returned by
3434
+ * {@link TsPptx.toParts} for callers that want the raw parts of the `.pptx` OPC package without
3435
+ * zipping (custom containers, streaming, part-level inspection). The bytes are byte-identical to
3436
+ * what `write()` would compress for the same part;
3437
+ * XML parts are UTF-8 (decode with `new TextDecoder().decode(part.data)`), media/font parts are
3438
+ * their raw binary.
3561
3439
  */
3562
- interface MasterTextStyleLevel {
3563
- /** Font size in points (`a:defRPr@sz`), e.g. `24`. */
3564
- fontSize?: number;
3565
- /** Font face (`a:defRPr/a:latin@typeface`). Unset keeps the theme font (`+mn-lt`/`+mj-lt`). */
3566
- fontFace?: string;
3567
- /** Text color — hex (`'C00000'`) or theme slot (`'tx1'`) — emitted as `a:defRPr/a:solidFill`. */
3568
- color?: Color;
3569
- /** Bold text (`a:defRPr@b`). */
3570
- bold?: boolean;
3571
- /** Italic text (`a:defRPr@i`). */
3572
- italic?: boolean;
3573
- /** Horizontal alignment (`a:lvlNpPr@algn`). */
3574
- align?: HAlign;
3575
- /** Left margin in inches (`a:lvlNpPr@marL`); for a hanging bullet this is the text indent. */
3576
- marginLeft?: number;
3577
- /** First-line indent in inches (`a:lvlNpPr@indent`); negative produces a hanging bullet. */
3578
- indent?: number;
3579
- /** Bullet config: `false` emits `a:buNone`; an object configures a char/number bullet. Unset keeps the level default. */
3580
- bullet?: boolean | MasterBulletProps;
3440
+ interface PackagePart {
3441
+ /** Full OOXML package part path, e.g. `ppt/slides/slide1.xml`. */
3442
+ readonly path: string;
3443
+ /** The part's already-encoded bytes: a fresh view per call, safe to keep or transfer. */
3444
+ readonly data: Uint8Array;
3581
3445
  }
3582
3446
  /**
3583
- * Per-level slide-master text styles, written to `slideMaster1.xml`'s `<p:txStyles>`.
3584
- * Because a deck has a single shared slide master, these styles are **deck-wide**: when set on more
3585
- * than one `defineSlideMaster()` call the last value for each group (`title`/`body`/`other`) wins.
3447
+ * Options for {@link TsPptx.toParts}. A deliberately narrow subset of {@link WriteProps}:
3448
+ * `compression` and `outputType` are zip concerns and do not apply when parts are returned
3449
+ * unzipped, so only media-error handling is exposed.
3586
3450
  */
3587
- interface MasterTextStyleProps {
3588
- /** Title placeholder style (`p:titleStyle`, single level). */
3589
- title?: MasterTextStyleLevel;
3590
- /** Body placeholder per-level styles (`p:bodyStyle`, levels 1–9; index 0 is `lvl1`). */
3591
- body?: MasterTextStyleLevel[];
3592
- /** Other/default placeholder per-level styles (`p:otherStyle`, levels 1–9). */
3593
- other?: MasterTextStyleLevel[];
3594
- }
3595
- interface SlideMasterProps {
3596
- /**
3597
- * Unique name for this master
3598
- */
3599
- title: string;
3600
- background?: BackgroundProps;
3601
- margin?: Margin;
3602
- slideNumber?: SlideNumberProps;
3603
- objects?: SlideMasterObject[];
3604
- /**
3605
- * Per-level master text styles (title / body / other) written to the shared slide master's
3606
- * `<p:txStyles>`. Configure nested bullet character, font size, color, alignment, and indent
3607
- * for each of the nine list levels. Deck-wide (see {@link MasterTextStyleProps}).
3608
- * @example textStyles: { body: [{ fontSize: 24, color: 'C00000', bullet: { characterCode: '25AA' } }] }
3609
- */
3610
- textStyles?: MasterTextStyleProps;
3611
- }
3612
- //#endregion
3613
- //#region src/types/model3d.d.ts
3614
- /** A point or direction in the model's 3D scene, in metres. */
3615
- interface Model3dPoint {
3616
- x: number;
3617
- y: number;
3618
- z: number;
3619
- }
3620
- /**
3621
- * Camera override for `addModel3d()`, mapping onto `am3d:camera`.
3622
- *
3623
- * The defaults are what PowerPoint itself wrote for a 2×2×2 cube, and they are correct for any
3624
- * model whose bounding box is roughly cubic **once `meterPerModelUnit` is right** — the camera is
3625
- * expressed in metres, so the scale is what actually decides framing.
3626
- *
3627
- * PowerPoint's own rule, measured against three models: it normalizes the model's largest
3628
- * bounding-box extent to 1 metre and then places the camera at
3629
- *
3630
- * ```
3631
- * pos.z = |halfExtents / maxExtent| / sin(fov / 2)
3632
- * ```
3633
- *
3634
- * looking at the origin. A caller who knows their model's bounding box can reproduce that
3635
- * exactly; a caller who does not should at least set `meterPerModelUnit` to `1 / maxExtent`.
3636
- */
3637
- interface Model3dCameraProps {
3638
- /**
3639
- * Camera position in metres (`am3d:camera/am3d:pos`).
3640
- * @default { x: 0, y: 0, z: 2.2630334 }
3641
- */
3642
- pos?: Model3dPoint;
3451
+ interface PartsProps {
3643
3452
  /**
3644
- * Point the camera aims at, in metres (`am3d:camera/am3d:lookAt`).
3645
- * @default { x: 0, y: 0, z: 0 }
3453
+ * How to handle a media asset (image/audio/video) that fails to load. Same semantics as
3454
+ * {@link WriteBaseProps.onMediaError}.
3455
+ * @default 'throw'
3646
3456
  */
3647
- lookAt?: Model3dPoint;
3648
- /**
3649
- * Camera "up" direction (`am3d:camera/am3d:up`). Need not be normalized.
3650
- * @default { x: 0, y: 1, z: 0 }
3651
- */
3652
- up?: Model3dPoint;
3653
- /**
3654
- * Vertical field of view in **degrees** (`am3d:perspective@fov`).
3655
- * - range: greater than 0 and less than 180
3656
- * @default 45
3657
- */
3658
- fov?: number;
3457
+ onMediaError?: 'throw' | 'placeholder';
3659
3458
  }
3660
- /**
3661
- * Add an embedded 3D model (PowerPoint's Insert ▸ 3D Models) to a slide.
3662
- *
3663
- * The `.glb` bytes travel inside the `.pptx` (in `ppt/media/`), so PowerPoint 2019+ renders and
3664
- * lets the viewer orbit the model. Requires either `data` or `path`. Linked (non-embedded)
3665
- * models are not supported.
3666
- */
3667
- interface Model3dBaseProps extends PositionProps, ObjectNameProps {
3459
+ interface SectionProps {
3668
3460
  /**
3669
- * Picture of the model shown wherever the live 3D view is unavailable — a raster image `path`
3670
- * (Node/local) or base64 `data:` URI.
3671
- * - the library cannot render a 3D scene, so when this is omitted a neutral gray placeholder is
3672
- * embedded; PowerPoint 2019+ draws the live model over it, but every other consumer — and
3673
- * PowerPoint's own `mc:Fallback` path, thumbnails, and PDF export — shows exactly what is here
3674
- * - supply a real render whenever the deck is meant to read correctly outside PowerPoint
3675
- * @example { path: 'assets/engine-render.png' }
3461
+ * Section title
3676
3462
  */
3677
- preview?: {
3678
- path?: string;
3679
- data?: string;
3680
- };
3681
- /**
3682
- * Camera override. Omitted, ts-pptx emits the camera PowerPoint wrote for a 2×2×2 cube.
3683
- * @see {@link Model3dCameraProps} for the framing formula and when this matters.
3684
- */
3685
- camera?: Model3dCameraProps;
3463
+ title: string;
3686
3464
  /**
3687
- * Metres per model unit (`am3d:trans/am3d:meterPerModelUnit`) — the scale that decides how
3688
- * large the model is in the scene the {@link camera} looks at.
3465
+ * Where to insert the section, counting from **1**: `order: 1` puts it first, `order: 2`
3466
+ * second. Omit it to append.
3689
3467
  *
3690
- * This is the single override most models need. PowerPoint sets it to `1 / maxExtent`, where
3691
- * `maxExtent` is the model's largest bounding-box dimension in model units, which normalizes
3692
- * every model to 1 metre across. ts-pptx does not parse the `.glb`, so it cannot measure that
3693
- * — it defaults to `0.5`, correct for a model 2 units across. A model 100 units across left at
3694
- * the default is a 50-metre object with the camera 2.26 metres from its centre, i.e. the
3695
- * viewer is inside it.
3696
- * - range: greater than 0
3697
- * @default 0.5
3698
- * @example 1 / 100 // a model whose largest bounding-box dimension is 100 units
3468
+ * An order past the end appends, which is the only sensible reading of "put it at
3469
+ * position 12" in a deck with four sections. Anything that is not a whole number of at
3470
+ * least 1 -- `0`, a negative, a fraction -- warns and appends: it named no position, and
3471
+ * silently treating it as one is how `order: 1` came to insert *second* and `order: 0` to
3472
+ * append with no word said.
3473
+ * - values: 1-n
3699
3474
  */
3700
- meterPerModelUnit?: number;
3701
- /**
3702
- * Alt text (`p:cNvPr@descr`) — what a screen reader announces for the model.
3703
- */
3704
- altText?: string;
3705
- }
3706
- /**
3707
- * Options for `slide.addModel3d()`. Requires either `data` (base64, with or without a
3708
- * `data:...;base64,` header) or `path` (a local/remote `.glb` read at export time).
3709
- *
3710
- * Sizing note: `w`/`h` default to 4 × 3 inches rather than being measured. A 3D model has no
3711
- * intrinsic aspect ratio, and the library never opens the payload.
3712
- */
3713
- type Model3dProps = Model3dBaseProps & DataOrPathRequiredProps;
3714
- //#endregion
3715
- //#region src/types/slide.d.ts
3716
- /**
3717
- * A child object that can be placed inside a group via `slide.addGroup()`.
3718
- *
3719
- * The six descriptors it shares with `SlideMasterObject` are {@link CommonObjectDescriptor};
3720
- * `group` is the group's own, and the master's `chart` and `placeholder` are deliberately not
3721
- * here. A `group` child nests another group (an identity child
3722
- * coordinate space is kept at every depth, so descendants keep their slide-absolute
3723
- * coordinates). Charts, media, tables, and placeholders are intentionally excluded (see
3724
- * `addGroup`); passing one logs a warning and skips it.
3725
- */
3726
- type GroupChildProps = CommonObjectDescriptor | {
3727
- group: {
3728
- children: GroupChildProps[];
3729
- options?: GroupProps;
3730
- };
3731
- };
3732
- /**
3733
- * Options for `slide.addGroup()`.
3734
- *
3735
- * The group keeps an identity child coordinate space (`chOff/chExt == off/ext`) at every depth:
3736
- * children — including nested groups — keep their slide-absolute `x/y/w/h`. A consequence worth
3737
- * knowing: a group's own frame never moves or scales its children, it only places the selection
3738
- * handle and the rotate pivot.
3739
- *
3740
- * The frame is all-or-nothing. Pass all four of `x/y/w/h` to set it explicitly, or none to have it
3741
- * auto-computed as the bounding box of the children. A partial frame is ambiguous, so it warns and
3742
- * falls back to auto-bounds on every axis.
3743
- */
3744
- interface GroupProps extends PositionProps, ObjectNameProps {
3745
- /** Rotation in degrees (applied to the whole group) */
3746
- rotate?: number;
3747
- /** Flip the group horizontally */
3748
- flipH?: boolean;
3749
- /** Flip the group vertically */
3750
- flipV?: boolean;
3475
+ order?: number;
3751
3476
  }
3752
- interface ObjectOptions extends ImageBaseProps, PositionProps, ShapeProps, TableCellProps, TextPropsOptions {
3753
- _placeholderIdx?: number;
3754
- _placeholderType?: PLACEHOLDER_TYPE;
3755
- /** Connector adjust-guide values (OOXML 1000ths-of-a-percent), one per bend; emitted as `<a:gd name="adjN">` */
3756
- _connectorAdj?: number[];
3757
- /** Connector start-point binding: target shape `objectName` (raw, as the caller spelled it) + connection-site index; resolved to `<a:stCxn>` at serialize time */
3758
- _startCxn?: {
3759
- name: string;
3760
- idx: number;
3761
- };
3762
- /** Connector end-point binding: target shape `objectName` (raw, as the caller spelled it) + connection-site index; resolved to `<a:endCxn>` at serialize time */
3763
- _endCxn?: {
3764
- name: string;
3765
- idx: number;
3766
- };
3767
- /**
3768
- * Image: which dimensions were omitted by the user and should be derived from the image's
3769
- * natural pixel size at serialize time. Path-based images can't be measured synchronously in
3770
- * `addImage()` (bytes are loaded async during export), so the missing extent is backfilled
3771
- * once `_relsMedia[].data` is populated. `{ w, h }` true means "derive this side from the
3772
- * natural ratio". Base64 `data` images are measured eagerly in `addImage()` and never set this.
3773
- */
3774
- _szAuto?: {
3775
- w: boolean;
3776
- h: boolean;
3777
- };
3778
- cx?: Coord;
3779
- cy?: Coord;
3780
- margin?: Margin;
3781
- colW?: number | number[];
3782
- rowH?: number | number[];
3783
- hasHeader?: boolean;
3784
- hasFooter?: boolean;
3785
- hasBandedRows?: boolean;
3786
- hasBandedColumns?: boolean;
3787
- hasFirstColumn?: boolean;
3788
- hasLastColumn?: boolean;
3789
- rtl?: boolean;
3790
- tableStyle?: TableStyle;
3791
- /**
3792
- * Table perimeter border. `addTableDefinition` normalizes it to a 4-tuple (TRBL, sides
3793
- * left unset as `undefined`) before it reaches the emitter, so the serializer never has
3794
- * to re-handle the single-`BorderProps` form.
3795
- */
3796
- outerBorder?: TableProps['outerBorder'];
3797
- /** Table background (`a:tblPr` fill), as distinct from `fill`, which is stamped onto each cell. */
3798
- tableFill?: TableProps['tableFill'];
3799
- }
3800
- interface SlideLayout {
3801
- background?: BackgroundProps;
3802
- }
3803
- /**
3804
- * One authored object on a slide, as {@link Slide.objects} reports it: what it is and how it is
3805
- * addressed, not how it is drawn. It is a snapshot taken when the getter ran, not a live handle —
3806
- * nothing on it writes back, and a later `addShape`/`groupObjects` leaves it describing the slide
3807
- * as it was.
3808
- *
3809
- * The point of it is composition. A slide assembled by independent renderers arrives with objects
3810
- * whose descriptors nobody kept, and the only durable handle on them is the `objectName` each one
3811
- * was authored with; without a way to enumerate those, a consumer that wants to act on what is
3812
- * already there has to either make every renderer surrender its internals or keep a parallel
3813
- * ledger of what it added — and a ledger is wrong the moment a renderer adds an object it did not
3814
- * announce.
3815
- */
3816
- interface SlideObjectInfo {
3817
- /** What kind of object this is — the same value the object was authored as. */
3818
- readonly type: SlideObjectType;
3819
- /**
3820
- * Selection Pane name, in the spelling the caller passed to `objectName`, so it can be handed
3821
- * straight back to `groupObjects()` or to an animation or connector reference.
3822
- *
3823
- * Always a string: an object authored without a name still gets the generated `Shape 3` /
3824
- * `Text 1` / `Group 2` identity PowerPoint shows in the Selection Pane, and that name addresses
3825
- * it just as well. The two are indistinguishable here on purpose — nothing downstream of
3826
- * authoring records which is which, and a consumer that cares can tell them apart by the
3827
- * naming convention it chose for its own objects.
3828
- */
3829
- readonly objectName: string;
3830
- /** True when the object occupies a layout placeholder, which grouping refuses on top of kind. */
3831
- readonly isPlaceholder: boolean;
3832
- /**
3833
- * Whether `groupObjects()` would accept this object on kind alone. It cannot speak for the
3834
- * *selection* — an unresolved, duplicated or ambiguous name still throws — so it answers "is
3835
- * this object groupable", never "will this call succeed".
3836
- */
3837
- readonly canGroup: boolean;
3838
- /**
3839
- * Children, when `type` is `group`; empty otherwise. Ordered bottom-to-top like
3840
- * {@link Slide.objects} itself, and nested to whatever depth the groups nest.
3841
- */
3842
- readonly children: readonly SlideObjectInfo[];
3843
- }
3844
- interface Slide {
3845
- addChart(data: OptsChartData[], options: ChartOpts & {
3846
- type: CHART_NAME;
3847
- }): Slide;
3848
- addChart(charts: ChartMulti[], options?: ChartOpts): Slide;
3849
- addConnector: (options: ConnectorProps) => Slide;
3850
- addImage: (options: ImageProps) => Slide;
3851
- addMedia: (options: MediaProps) => Slide;
3852
- /** Embed a 3D model (Insert ▸ 3D Models) — a `.glb` PowerPoint 2019+ renders live. */
3853
- addModel3d: (options: Model3dProps) => Slide;
3854
- /** Embed an OLE object (Insert ▸ Object) whose bytes travel inside the `.pptx`. */
3855
- addOleObject: (options: OleObjectProps) => Slide;
3856
- addComment: (options: CommentProps) => Slide;
3857
- addNotes: (notes: string | NotesProps | NotesProps[]) => Slide;
3858
- addShape: (shapeName: SHAPE_NAME, options?: ShapeProps) => Slide;
3859
- addTable: (tableRows: TableRow[], options?: TableProps) => Slide;
3860
- addText: (text: string | number | TextProps[], options?: TextPropsOptions) => Slide;
3861
- addAnimation: (options: AnimationProps) => Slide;
3862
- /** Group child object descriptors into a single PowerPoint group (`<p:grpSp>`). */
3863
- addGroup: (children: GroupChildProps[], options?: GroupProps) => Slide;
3864
- /** Group objects already on this slide, addressed by their `objectName`, into a single group. */
3865
- groupObjects: (objectNames: string[], options?: GroupProps) => Slide;
3866
- /**
3867
- * The objects authored on this slide so far, bottom-to-top in z-order — the read-back half of
3868
- * `groupObjects()`, which addresses those same objects by name but until now gave no way to
3869
- * learn the names.
3870
- *
3871
- * A fresh snapshot on every access, and inert: it describes the slide, and writing to it does
3872
- * nothing. To act on what it reports, call the authoring API with the names it hands you.
3873
- * @example
3874
- * const cards = slide.objects.filter((o) => o.canGroup && o.objectName?.startsWith('card:'))
3875
- * slide.groupObjects(cards.map((o) => o.objectName), { objectName: 'Cards' })
3876
- */
3877
- readonly objects: readonly SlideObjectInfo[];
3878
- readonly newAutoPagedSlides?: Slide[];
3477
+ interface PresLayout {
3879
3478
  /**
3880
- * Slide-show transition played when advancing to this slide (`p:transition`).
3881
- * @example slide.transition = { type: 'fade', durationMs: 1500 }
3479
+ * Layout Name
3480
+ * @example 'LAYOUT_WIDE'
3882
3481
  */
3883
- transition?: TransitionProps;
3884
- /**
3885
- * Slide width in inches, resolved from the active presentation layout.
3886
- * Use for coordinate math instead of hard-coding layout dimensions.
3887
- * @example slide.addText('Centered', { x: 0, w: slide.width, align: 'center' })
3888
- */
3889
- readonly width?: number;
3482
+ name: string;
3890
3483
  /**
3891
- * Slide height in inches, resolved from the active presentation layout.
3892
- */
3893
- readonly height?: number;
3484
+ * Slide width.
3485
+ *
3486
+ * **The unit depends on which direction this shape is travelling.** `defineLayout` reads it
3487
+ * as INCHES -- that is what its own example passes -- while `pptx.presLayout` returns it in
3488
+ * EMU. So `defineLayout({ ...pptx.presLayout, name: 'Copy' })`, the obvious way to derive a
3489
+ * layout from the current one, states a width of nine million inches; `defineLayout` now
3490
+ * clamps it to the 56in maximum and says so rather than emitting a `sldSz` PowerPoint
3491
+ * refuses.
3492
+ */
3493
+ width: number;
3494
+ /** Slide height; the same two units as {@link width}, in the same two directions. */
3495
+ height: number;
3496
+ }
3497
+ type CustomPropertyValue = string | number | boolean | Date;
3498
+ interface PresentationProps {
3499
+ author: string;
3500
+ company: string;
3501
+ layout: string;
3894
3502
  /**
3895
- * Background color or image (`color` | `path` | `data`)
3896
- * @example { color: 'FF3399' } - hex color
3897
- * @example { color: 'FF3399', transparency:50 } - hex color with 50% transparency
3898
- * @example { path: 'https://onedrives.com/myimg.png` } - retrieve image via URL
3899
- * @example { path: '/home/user/images/myimg.png` } - retrieve image via local path
3900
- * @example { data: 'image/png;base64,iVtDaDrF[...]=' } - base64 string
3503
+ * Presentation's layout
3504
+ * read-only
3901
3505
  */
3902
- background?: BackgroundProps;
3506
+ presLayout: PresLayout;
3507
+ revision: string;
3903
3508
  /**
3904
- * Default text color (hex format)
3905
- * @example 'FF3399'
3906
- * @default '000000' (DEF_FONT_COLOR)
3509
+ * Slide number to assign to the first slide (affects the slide-number field displayed in placeholders).
3510
+ * @default 1
3907
3511
  */
3908
- color?: HexColor;
3512
+ firstSlideNum: number;
3909
3513
  /**
3910
- * Whether slide is hidden
3514
+ * Whether to enable right-to-left mode
3911
3515
  * @default false
3912
3516
  */
3913
- hidden?: boolean;
3914
- /**
3915
- * Slide number options
3916
- */
3917
- slideNumber?: SlideNumberProps;
3918
- }
3919
- interface AddSlideProps {
3920
- /** Title of the slide master to use for the new slide (the `title` passed to {@link SlideMasterProps} via `defineSlideMaster`). */
3921
- masterTitle?: string;
3922
- sectionTitle?: string;
3517
+ rtlMode: boolean;
3518
+ subject: string;
3519
+ theme: ThemeProps;
3520
+ title: string;
3923
3521
  }
3924
3522
  //#endregion
3925
- export { VAlign as $, MeasureTextOptions as $t, TableRowSlide as A, ChartPropsChartDoughnut as At, GradientFillProps as B, ChartPropsDataTable as Bt, TransitionType as C, ShapeAdjustValue as Cn, ChartOpts as Ct, TableCellProps as D, ChartPropsBase as Dt, TableCellDiagonals as E, ShapeProps as En, ChartPropsAxisVal as Et, Color as F, ChartPropsChartRegionMap as Ft, LinearGradientFillProps as G, LineCap as Gt, HAlign as H, ChartPropsLegend as Ht, Coord as I, ChartPropsChartStock as It, PatternPreset as J, CommonObjectDescriptor as Jt, Margin as K, OptsChartData as Kt, DataOrPathProps as L, ChartPropsChartSurface as Lt, TableToSlidesElement as M, ChartPropsChartLine as Mt, TableToSlidesProps as N, ChartPropsChartPie as Nt, TableProps as O, ChartPropsChartBar as Ot, BackgroundProps as P, ChartPropsChartRadar as Pt, ThemeColor as Q, CommentProps as Qt, DataOrPathRequiredProps as R, ChartPropsChartWaterfall as Rt, TransitionSoundProps as S, ShapeAdjustHandleXY as Sn, ChartMulti as St, TableCell3DProps as T, ShapeGuide as Tn, ChartPropsAxisSer as Tt, HexColor as U, ChartPropsTitle as Ut, GradientStopProps as V, ChartPropsFillLine as Vt, ImageFillProps as W, ChartSeriesOpts as Wt, RadialGradientFillProps as X, ObjectNameProps as Xt, PositionProps as Y, ObjectLockProps as Yt, TextVertType as Z, PlaceholderProps as Zt, SlideNumberProps as _, MediaProps as _n, ChartErrorBarOptions as _t, Slide as a, TableCellLayout as an, ShadowProps as at, PresetEffect as b, ShapeAdjustHandle as bn, ChartExStatistics as bt, Model3dCameraProps as c, TextFitShrinkProps as cn, BevelPresetType as ct, MasterBulletProps as d, TextProps as dn, LightRigType as dt, NotesProps as en, BorderProps as et, MasterTextStyleLevel as f, TextPropsOptions as fn, PresetMaterialType as ft, SlideMasterProps as g, ImageProps as gn, ChartDataPointStyle as gt, SlideMasterObject as h, ImageBaseProps as hn, ChartAxisTickMark as ht, ObjectOptions as i, SlideComment as in, HyperlinkProps as it, TableToSlidesDocument as j, ChartPropsChartHistogram as jt, TableRow as k, ChartPropsChartBoxWhisker as kt, Model3dPoint as l, TextGlowProps as ln, ColorMapToken as lt, SlideMasterChartProps as m, textRuns as mn, ChartAreaProps as mt, GroupChildProps as n, OverflowBoxOptions as nn, ConnectorType as nt, SlideLayout as o, TableLayoutResult as on, ShapeFillProps as ot, MasterTextStyleProps as p, textRun as pn, ThemeColorSlot as pt, PatternFillProps as q, OptsChartGridLine as qt, GroupProps as r, ResolvedCommentAuthor as rn, HyperlinkActionJump as rt, SlideObjectInfo as s, TextBaseProps as sn, ShapeLineProps as st, AddSlideProps as t, NotesTextOptions as tn, ConnectorProps as tt, Model3dProps as u, TextMeasurement as un, LightRigDirection as ut, AnimationProps as v, MediaType as vn, ChartExBinning as vt, TableCell as w, ShapeConnectionSite as wn, ChartPropsAxisCat as wt, TransitionProps as x, ShapeAdjustHandlePolar as xn, ChartLineDash as xt, AnimationTrigger as y, OleObjectProps as yn, ChartExGeography as yt, GeometryPoint as z, ChartPropsDataLabel as zt };
3926
- //# sourceMappingURL=slide-ZqAdVvHV.d.ts.map
3523
+ export { ChartPropsAxisCat as $, ShapeAdjustValue as $t, TextVertType as A, NotesTextOptions as At, ShapeFillProps as B, TextMeasurement as Bt, ImageFillProps as C, TimeUnit as Cn, CommonObjectDescriptor as Ct, PatternPreset as D, CommentProps as Dt, PatternFillProps as E, PlaceholderProps as Et, ConnectorType as F, TableLayoutResult as Ft, ChartDataPointStyle as G, ImageBaseProps as Gt, StrokeProps as H, TextPropsOptions as Ht, FillOption as I, TextBaseProps as It, ChartExGeography as J, MediaType as Jt, ChartErrorBarOptions as K, ImageProps as Kt, HyperlinkActionJump as L, TextBulletProps as Lt, VAlign as M, ResolvedCommentAuthor as Mt, BorderProps as N, SlideComment as Nt, PositionProps as O, MeasureTextOptions as Ot, ConnectorProps as P, TableCellLayout as Pt, ChartOpts as Q, ShapeAdjustHandleXY as Qt, HyperlinkProps as R, TextFitShrinkProps as Rt, HexColor as S, ThemeColorSlot as Sn, OptsChartGridLine as St, Margin as T, ObjectNameProps as Tt, ChartAreaProps as U, textRun as Ut, ShapeLineProps as V, TextProps as Vt, ChartAxisTickMark as W, textRuns as Wt, ChartLineDash as X, ShapeAdjustHandle as Xt, ChartExStatistics as Y, OleObjectProps as Yt, ChartMulti as Z, ShapeAdjustHandlePolar as Zt, DataOrPathRequiredProps as _, RadarStyleAlias as _n, ChartPropsLegend as _t, PresentationProps as a, BarGrouping as an, ChartPropsChartDoughnut as at, GradientStopProps as b, TextHorzOverflowType as bn, LineCap as bt, WriteFileProps as c, DataLabelPosition as cn, ChartPropsChartPie as ct, ThemeProps as d, LegendPosition as dn, ChartPropsChartStock as dt, ShapeConnectionSite as en, ChartPropsAxisSer as et, BackgroundOption as f, LightRigDirection as fn, ChartPropsChartSurface as ft, DataOrPathProps as g, RadarStyle as gn, ChartPropsFillLine as gt, Coord as h, PresetMaterialType as hn, ChartPropsDataTable as ht, PresLayout as i, BarDirection as in, ChartPropsChartBoxWhisker as it, ThemeColor as j, OverflowBoxOptions as jt, RadialGradientFillProps as k, NotesProps as kt, WriteProps as l, DisplayBlanksAs as ln, ChartPropsChartRadar as lt, Color as m, LineDataSymbol as mn, ChartPropsDataLabel as mt, PackagePart as n, ShapeProps as nn, ChartPropsBase as nt, SectionProps as o, BevelPresetType as on, ChartPropsChartHistogram as ot, BackgroundProps as p, LightRigType as pn, ChartPropsChartWaterfall as pt, ChartExBinning as q, MediaProps as qt, PartsProps as r, Bar3DShape as rn, ChartPropsChartBar as rt, WriteBaseProps as s, ColorMapToken as sn, ChartPropsChartLine as st, CustomPropertyValue as t, ShapeGuide as tn, ChartPropsAxisVal as tt, ThemeColorScheme as u, EMBEDDED_FONT_SLOTS as un, ChartPropsChartRegionMap as ut, GeometryPoint as v, TEXT_AUTONUM_SCHEMES as vn, ChartPropsTitle as vt, LinearGradientFillProps as w, ObjectLockProps as wt, HAlign as x, TextShapeType as xn, OptsChartData as xt, GradientFillProps as y, TRANSITION_TYPES as yn, ChartSeriesOpts as yt, ShadowProps as z, TextGlowProps as zt };
3524
+ //# sourceMappingURL=pres-C6qgOFAa.d.ts.map