pptxgenjs-plus 4.2.0 → 4.3.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.
@@ -1,4 +1,4 @@
1
- /* PptxGenJS 4.2.0 @ 2026-08-24T12:56:09.653Z */
1
+ /* PptxGenJS 4.3.0 @ 2026-08-26T00:32:15.081Z */
2
2
 
3
3
  import { JSZip } from "@node-projects/jszip";
4
4
  import { parseXml } from "@rgrove/parse-xml";
@@ -118,6 +118,261 @@ const AXIS_ID_VALUE_SECONDARY = '2094734553';
118
118
  const AXIS_ID_CATEGORY_PRIMARY = '2094734554';
119
119
  const AXIS_ID_CATEGORY_SECONDARY = '2094734555';
120
120
  const AXIS_ID_SERIES_PRIMARY = '2094734556';
121
+ /** ECMA-376 20.1.10.51 ST_SchemeColorVal - every slot `a:schemeClr@val` accepts */ const SCHEME_COLOR_VALUES = new Set([
122
+ 'bg1',
123
+ 'tx1',
124
+ 'bg2',
125
+ 'tx2',
126
+ 'dk1',
127
+ 'lt1',
128
+ 'dk2',
129
+ 'lt2',
130
+ 'accent1',
131
+ 'accent2',
132
+ 'accent3',
133
+ 'accent4',
134
+ 'accent5',
135
+ 'accent6',
136
+ 'hlink',
137
+ 'folHlink',
138
+ 'phClr'
139
+ ]);
140
+ /** ECMA-376 20.1.10.58 ST_SystemColorVal - `a:sysClr@val` */ const SYSTEM_COLOR_VALUES = new Set([
141
+ 'scrollBar',
142
+ 'background',
143
+ 'activeCaption',
144
+ 'inactiveCaption',
145
+ 'menu',
146
+ 'window',
147
+ 'windowFrame',
148
+ 'menuText',
149
+ 'windowText',
150
+ 'captionText',
151
+ 'activeBorder',
152
+ 'inactiveBorder',
153
+ 'appWorkspace',
154
+ 'highlight',
155
+ 'highlightText',
156
+ 'btnFace',
157
+ 'btnShadow',
158
+ 'grayText',
159
+ 'btnText',
160
+ 'inactiveCaptionText',
161
+ 'btnHighlight',
162
+ '3dDkShadow',
163
+ '3dLight',
164
+ 'infoText',
165
+ 'infoBk',
166
+ 'hotLight',
167
+ 'gradientActiveCaption',
168
+ 'gradientInactiveCaption',
169
+ 'menuHighlight',
170
+ 'menuBar'
171
+ ]);
172
+ /** ECMA-376 20.1.10.48 ST_PresetColorVal - the 140 named preset colors for `a:prstClr@val` */ const PRESET_COLOR_VALUES = new Set([
173
+ 'aliceBlue',
174
+ 'antiqueWhite',
175
+ 'aqua',
176
+ 'aquamarine',
177
+ 'azure',
178
+ 'beige',
179
+ 'bisque',
180
+ 'black',
181
+ 'blanchedAlmond',
182
+ 'blue',
183
+ 'blueViolet',
184
+ 'brown',
185
+ 'burlyWood',
186
+ 'cadetBlue',
187
+ 'chartreuse',
188
+ 'chocolate',
189
+ 'coral',
190
+ 'cornflowerBlue',
191
+ 'cornsilk',
192
+ 'crimson',
193
+ 'cyan',
194
+ 'darkBlue',
195
+ 'darkCyan',
196
+ 'darkGoldenrod',
197
+ 'darkGray',
198
+ 'darkGrey',
199
+ 'darkGreen',
200
+ 'darkKhaki',
201
+ 'darkMagenta',
202
+ 'darkOliveGreen',
203
+ 'darkOrange',
204
+ 'darkOrchid',
205
+ 'darkRed',
206
+ 'darkSalmon',
207
+ 'darkSeaGreen',
208
+ 'darkSlateBlue',
209
+ 'darkSlateGray',
210
+ 'darkSlateGrey',
211
+ 'darkTurquoise',
212
+ 'darkViolet',
213
+ 'deepPink',
214
+ 'deepSkyBlue',
215
+ 'dimGray',
216
+ 'dimGrey',
217
+ 'dkBlue',
218
+ 'dkCyan',
219
+ 'dkGoldenrod',
220
+ 'dkGray',
221
+ 'dkGrey',
222
+ 'dkGreen',
223
+ 'dkKhaki',
224
+ 'dkMagenta',
225
+ 'dkOliveGreen',
226
+ 'dkOrange',
227
+ 'dkOrchid',
228
+ 'dkRed',
229
+ 'dkSalmon',
230
+ 'dkSeaGreen',
231
+ 'dkSlateBlue',
232
+ 'dkSlateGray',
233
+ 'dkSlateGrey',
234
+ 'dkTurquoise',
235
+ 'dkViolet',
236
+ 'dodgerBlue',
237
+ 'firebrick',
238
+ 'floralWhite',
239
+ 'forestGreen',
240
+ 'fuchsia',
241
+ 'gainsboro',
242
+ 'ghostWhite',
243
+ 'gold',
244
+ 'goldenrod',
245
+ 'gray',
246
+ 'grey',
247
+ 'green',
248
+ 'greenYellow',
249
+ 'honeydew',
250
+ 'hotPink',
251
+ 'indianRed',
252
+ 'indigo',
253
+ 'ivory',
254
+ 'khaki',
255
+ 'lavender',
256
+ 'lavenderBlush',
257
+ 'lawnGreen',
258
+ 'lemonChiffon',
259
+ 'lightBlue',
260
+ 'lightCoral',
261
+ 'lightCyan',
262
+ 'lightGoldenrodYellow',
263
+ 'lightGray',
264
+ 'lightGrey',
265
+ 'lightGreen',
266
+ 'lightPink',
267
+ 'lightSalmon',
268
+ 'lightSeaGreen',
269
+ 'lightSkyBlue',
270
+ 'lightSlateGray',
271
+ 'lightSlateGrey',
272
+ 'lightSteelBlue',
273
+ 'lightYellow',
274
+ 'lime',
275
+ 'limeGreen',
276
+ 'linen',
277
+ 'ltBlue',
278
+ 'ltCoral',
279
+ 'ltCyan',
280
+ 'ltGoldenrodYellow',
281
+ 'ltGray',
282
+ 'ltGrey',
283
+ 'ltGreen',
284
+ 'ltPink',
285
+ 'ltSalmon',
286
+ 'ltSeaGreen',
287
+ 'ltSkyBlue',
288
+ 'ltSlateGray',
289
+ 'ltSlateGrey',
290
+ 'ltSteelBlue',
291
+ 'ltYellow',
292
+ 'magenta',
293
+ 'maroon',
294
+ 'medAquamarine',
295
+ 'medBlue',
296
+ 'medOrchid',
297
+ 'medPurple',
298
+ 'medSeaGreen',
299
+ 'medSlateBlue',
300
+ 'medSpringGreen',
301
+ 'medTurquoise',
302
+ 'medVioletRed',
303
+ 'mediumAquamarine',
304
+ 'mediumBlue',
305
+ 'mediumOrchid',
306
+ 'mediumPurple',
307
+ 'mediumSeaGreen',
308
+ 'mediumSlateBlue',
309
+ 'mediumSpringGreen',
310
+ 'mediumTurquoise',
311
+ 'mediumVioletRed',
312
+ 'midnightBlue',
313
+ 'mintCream',
314
+ 'mistyRose',
315
+ 'moccasin',
316
+ 'navajoWhite',
317
+ 'navy',
318
+ 'oldLace',
319
+ 'olive',
320
+ 'oliveDrab',
321
+ 'orange',
322
+ 'orangeRed',
323
+ 'orchid',
324
+ 'paleGoldenrod',
325
+ 'paleGreen',
326
+ 'paleTurquoise',
327
+ 'paleVioletRed',
328
+ 'papayaWhip',
329
+ 'peachPuff',
330
+ 'peru',
331
+ 'pink',
332
+ 'plum',
333
+ 'powderBlue',
334
+ 'purple',
335
+ 'red',
336
+ 'rosyBrown',
337
+ 'royalBlue',
338
+ 'saddleBrown',
339
+ 'salmon',
340
+ 'sandyBrown',
341
+ 'seaGreen',
342
+ 'seaShell',
343
+ 'sienna',
344
+ 'silver',
345
+ 'skyBlue',
346
+ 'slateBlue',
347
+ 'slateGray',
348
+ 'slateGrey',
349
+ 'snow',
350
+ 'springGreen',
351
+ 'steelBlue',
352
+ 'tan',
353
+ 'teal',
354
+ 'thistle',
355
+ 'tomato',
356
+ 'turquoise',
357
+ 'violet',
358
+ 'wheat',
359
+ 'white',
360
+ 'whiteSmoke',
361
+ 'yellow',
362
+ 'yellowGreen'
363
+ ]);
364
+ /** ECMA-376 20.1.10.23 ST_CompoundLine - `a:ln@cmpd` */ const COMPOUND_TYPES = new Set([
365
+ 'sng',
366
+ 'dbl',
367
+ 'thickThin',
368
+ 'thinThick',
369
+ 'tri'
370
+ ]);
371
+ /** ECMA-376 20.1.10.34/35 ST_LineEndWidth and ST_LineEndLength - arrow sizing */ const ARROW_SIZES = new Set([
372
+ 'sm',
373
+ 'med',
374
+ 'lg'
375
+ ]);
121
376
  /**
122
377
  * Chart style and chart colour-style parts (MS-ODRAWXML)
123
378
  * - verified against Microsoft's own `ChartStylePart`/`ChartColorStylePart` definitions in
@@ -539,6 +794,13 @@ var core_enums_ShapeType = /*#__PURE__*/ function(ShapeType) {
539
794
  SchemeColor["accent4"] = "accent4";
540
795
  SchemeColor["accent5"] = "accent5";
541
796
  SchemeColor["accent6"] = "accent6";
797
+ SchemeColor["dk1"] = "dk1";
798
+ SchemeColor["lt1"] = "lt1";
799
+ SchemeColor["dk2"] = "dk2";
800
+ SchemeColor["lt2"] = "lt2";
801
+ SchemeColor["hlink"] = "hlink";
802
+ SchemeColor["folHlink"] = "folHlink";
803
+ SchemeColor["phClr"] = "phClr";
542
804
  return SchemeColor;
543
805
  }({});
544
806
  var core_enums_AlignH = /*#__PURE__*/ function(AlignH) {
@@ -1295,6 +1557,20 @@ function _object_spread_props(target, source) {
1295
1557
  function isModifiedThemeColor(value) {
1296
1558
  return typeof value === 'object' && value !== null && 'baseColor' in value;
1297
1559
  }
1560
+ /**
1561
+ * Whether a value is a DrawingML color object rather than a fill object
1562
+ * - the six specification fields are unique to `ColorProps`
1563
+ */ function isColorProps(value) {
1564
+ if (!value || typeof value !== 'object') return false;
1565
+ return [
1566
+ 'hex',
1567
+ 'scheme',
1568
+ 'system',
1569
+ 'preset',
1570
+ 'hsl',
1571
+ 'scrgb'
1572
+ ].some((key)=>key in value);
1573
+ }
1298
1574
  /** Percent-based OOXML color transforms (0-100 → val*1000) */ const PERCENT_COLOR_MODIFIERS = [
1299
1575
  'alpha',
1300
1576
  'alphaMod',
@@ -1356,11 +1632,86 @@ const FLAG_COLOR_MODIFIERS = [
1356
1632
  * @example [gen-charts.tx] `strXml += '<a:solidFill>' + createColorElement(seriesColor, `<a:alpha val="${Math.round(opts.chartColorsOpacity * 1000)}"/>`) + '</a:solidFill>'`
1357
1633
  * Thi sis wrong. We s/b calling `genXmlColorSelection()` instead as it returns `<a:solidfill>BLAH</a:solidFill>`!!
1358
1634
  */ /**
1635
+ * DrawingML stores percentages in 1000ths of a percent
1636
+ * - `CT_PositiveFixedPercentage` (tint, shade, alpha) is 0-100
1637
+ * - `CT_FixedPercentage` (the `*Off` transforms) is -100 to 100
1638
+ * - `CT_PositivePercentage` (the `*Mod` transforms) is a *scale* and is unbounded above
1639
+ */ function gen_utils_pct(value, min = 0, max = 100) {
1640
+ const clamped = Math.min(max, Math.max(min, isFinite(value) ? value : 0));
1641
+ return String(Math.round(clamped * 1000));
1642
+ }
1643
+ /**
1644
+ * Create the color transform children shared by every ColorProps element (ECMA-376 20.1.2.3)
1645
+ */ function createColorTransforms(props) {
1646
+ let xml = '';
1647
+ if (typeof props.tint === 'number') xml += `<a:tint val="${gen_utils_pct(props.tint)}"/>`;
1648
+ if (typeof props.shade === 'number') xml += `<a:shade val="${gen_utils_pct(props.shade)}"/>`;
1649
+ if (props.inverse === true) xml += '<a:inv/>';
1650
+ if (props.grayscale === true) xml += '<a:gray/>';
1651
+ if (typeof props.alpha === 'number') xml += `<a:alpha val="${gen_utils_pct(props.alpha)}"/>`;
1652
+ if (typeof props.alphaOff === 'number') xml += `<a:alphaOff val="${gen_utils_pct(props.alphaOff, -100, 100)}"/>`;
1653
+ if (typeof props.alphaMod === 'number') xml += `<a:alphaMod val="${gen_utils_pct(props.alphaMod, 0, Number.MAX_SAFE_INTEGER)}"/>`;
1654
+ if (typeof props.hueMod === 'number') xml += `<a:hueMod val="${gen_utils_pct(props.hueMod, 0, Number.MAX_SAFE_INTEGER)}"/>`;
1655
+ if (typeof props.hueOff === 'number') xml += `<a:hueOff val="${Math.round(Math.min(360, Math.max(-360, isFinite(props.hueOff) ? props.hueOff : 0)) * 60000)}"/>`;
1656
+ if (typeof props.satMod === 'number') xml += `<a:satMod val="${gen_utils_pct(props.satMod, 0, Number.MAX_SAFE_INTEGER)}"/>`;
1657
+ if (typeof props.satOff === 'number') xml += `<a:satOff val="${gen_utils_pct(props.satOff, -100, 100)}"/>`;
1658
+ if (typeof props.lumMod === 'number') xml += `<a:lumMod val="${gen_utils_pct(props.lumMod, 0, Number.MAX_SAFE_INTEGER)}"/>`;
1659
+ if (typeof props.lumOff === 'number') xml += `<a:lumOff val="${gen_utils_pct(props.lumOff, -100, 100)}"/>`;
1660
+ if (props.complement === true) xml += '<a:comp/>';
1661
+ if (props.gamma === true) xml += '<a:gamma/>';
1662
+ if (props.inverseGamma === true) xml += '<a:invGamma/>';
1663
+ return xml;
1664
+ }
1665
+ /**
1666
+ * Create the color element for a `ColorProps` object
1667
+ */ function createColorPropsElement(props, extra) {
1668
+ const inner = createColorTransforms(props) + extra;
1669
+ const wrap = (tag, attrs)=>inner ? `<a:${tag} ${attrs}>${inner}</a:${tag}>` : `<a:${tag} ${attrs}/>`;
1670
+ if ('hex' in props) {
1671
+ var _props_hex;
1672
+ const hex = String((_props_hex = props.hex) !== null && _props_hex !== void 0 ? _props_hex : '').replace('#', '');
1673
+ if (!REGEX_HEX_COLOR.test(hex)) {
1674
+ console.warn(`[pptxgenjs] "${hex}" is not a 6-digit hex color - "${(/* inlined export .DEF_FONT_COLOR */"000000")}" used instead`);
1675
+ return wrap('srgbClr', `val="${(/* inlined export .DEF_FONT_COLOR */"000000")}"`);
1676
+ }
1677
+ return wrap('srgbClr', `val="${hex.toUpperCase()}"`);
1678
+ }
1679
+ if ('scheme' in props) {
1680
+ if (!SCHEME_COLOR_VALUES.has(props.scheme)) {
1681
+ console.warn(`[pptxgenjs] "${String(props.scheme)}" is not a theme color slot - "${(/* inlined export .DEF_FONT_COLOR */"000000")}" used instead`);
1682
+ return wrap('srgbClr', `val="${(/* inlined export .DEF_FONT_COLOR */"000000")}"`);
1683
+ }
1684
+ return wrap('schemeClr', `val="${props.scheme}"`);
1685
+ }
1686
+ if ('system' in props) {
1687
+ if (!SYSTEM_COLOR_VALUES.has(props.system)) {
1688
+ console.warn(`[pptxgenjs] "${String(props.system)}" is not a system color - "${(/* inlined export .DEF_FONT_COLOR */"000000")}" used instead`);
1689
+ return wrap('srgbClr', `val="${(/* inlined export .DEF_FONT_COLOR */"000000")}"`);
1690
+ }
1691
+ const last = props.lastColor && REGEX_HEX_COLOR.test(props.lastColor.replace('#', '')) ? ` lastClr="${props.lastColor.replace('#', '').toUpperCase()}"` : '';
1692
+ return wrap('sysClr', `val="${props.system}"${last}`);
1693
+ }
1694
+ if ('preset' in props) {
1695
+ if (!PRESET_COLOR_VALUES.has(props.preset)) {
1696
+ console.warn(`[pptxgenjs] "${String(props.preset)}" is not a preset color name - "${(/* inlined export .DEF_FONT_COLOR */"000000")}" used instead`);
1697
+ return wrap('srgbClr', `val="${(/* inlined export .DEF_FONT_COLOR */"000000")}"`);
1698
+ }
1699
+ return wrap('prstClr', `val="${props.preset}"`);
1700
+ }
1701
+ if ('hsl' in props) {
1702
+ const hue = Math.round(((props.hsl.hue % 360 + 360) % 360 || 0) * 60000);
1703
+ return wrap('hslClr', `hue="${isFinite(hue) ? hue : 0}" sat="${gen_utils_pct(props.hsl.sat)}" lum="${gen_utils_pct(props.hsl.lum)}"`);
1704
+ }
1705
+ return wrap('scrgbClr', `r="${gen_utils_pct(props.scrgb.r)}" g="${gen_utils_pct(props.scrgb.g)}" b="${gen_utils_pct(props.scrgb.b)}"`);
1706
+ }
1707
+ /**
1359
1708
  * Create either a `a:schemeClr` - (scheme color) or `a:srgbClr` (hexa representation).
1360
- * @param {Color|SCHEME_COLORS} colorInput - hex, scheme token, or ModifiedThemeColor
1709
+ * Object forms (`ColorProps`, `ModifiedThemeColor`) reach the rest of the DrawingML color model.
1710
+ * @param {Color|SCHEME_COLORS} colorInput - hex, scheme token, ModifiedThemeColor, or ColorProps
1361
1711
  * @param {string} innerElements - additional elements that adjust the color and are enclosed by the color element
1362
1712
  * @returns {string} XML string
1363
1713
  */ function createColorElement(colorInput, innerElements) {
1714
+ if (isColorProps(colorInput)) return createColorPropsElement(colorInput, innerElements !== null && innerElements !== void 0 ? innerElements : '');
1364
1715
  const base = isModifiedThemeColor(colorInput) ? colorInput.baseColor : colorInput;
1365
1716
  const colorStr = typeof base === 'string' ? base : (/* inlined export .DEF_FONT_COLOR */"000000");
1366
1717
  let colorVal = (colorStr || '').replace('#', '');
@@ -1368,7 +1719,7 @@ const FLAG_COLOR_MODIFIERS = [
1368
1719
  if (isModifiedThemeColor(colorInput)) {
1369
1720
  kids += handleModifiedColorProps(colorInput);
1370
1721
  }
1371
- if (!REGEX_HEX_COLOR.test(colorVal) && colorVal !== core_enums_SchemeColor.background1 && colorVal !== core_enums_SchemeColor.background2 && colorVal !== core_enums_SchemeColor.text1 && colorVal !== core_enums_SchemeColor.text2 && colorVal !== core_enums_SchemeColor.accent1 && colorVal !== core_enums_SchemeColor.accent2 && colorVal !== core_enums_SchemeColor.accent3 && colorVal !== core_enums_SchemeColor.accent4 && colorVal !== core_enums_SchemeColor.accent5 && colorVal !== core_enums_SchemeColor.accent6) {
1722
+ if (!REGEX_HEX_COLOR.test(colorVal) && !SCHEME_COLOR_VALUES.has(colorVal)) {
1372
1723
  console.warn(`"${colorVal}" is not a valid scheme color or hex RGB! "${(/* inlined export .DEF_FONT_COLOR */"000000")}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`);
1373
1724
  colorVal = (/* inlined export .DEF_FONT_COLOR */"000000");
1374
1725
  }
@@ -1515,10 +1866,10 @@ function createGlowElement(glow) {
1515
1866
  let internalElements = '';
1516
1867
  let outText = '';
1517
1868
  if (props) {
1518
- // ModifiedThemeColor as a bare Color value (must not be treated as ShapeFillProps)
1869
+ // A bare color - string, ModifiedThemeColor, or ColorProps - is a solid fill of that color
1519
1870
  if (typeof props === 'string') {
1520
1871
  colorVal = props;
1521
- } else if (isModifiedThemeColor(props)) {
1872
+ } else if (isModifiedThemeColor(props) || isColorProps(props)) {
1522
1873
  colorVal = props;
1523
1874
  } else {
1524
1875
  var _props_image;
@@ -1528,22 +1879,23 @@ function createGlowElement(glow) {
1528
1879
  if (props.alpha) internalElements += `<a:alpha val="${Math.round((100 - props.alpha) * 1000)}"/>`; // DEPRECATED: @deprecated v3.3.0
1529
1880
  if (props.transparency) internalElements += `<a:alpha val="${Math.round((100 - props.transparency) * 1000)}"/>`;
1530
1881
  }
1882
+ const isBareColor = typeof props === 'string' || isModifiedThemeColor(props) || isColorProps(props);
1531
1883
  switch(fillType){
1532
1884
  case 'solid':
1533
1885
  outText += `<a:solidFill>${createColorElement(colorVal, internalElements)}</a:solidFill>`;
1534
1886
  break;
1535
1887
  case 'gradient':
1536
1888
  case 'linearGradient':
1537
- outText += createGradientFillElement(typeof props === 'string' || isModifiedThemeColor(props) ? undefined : resolveGradientProps(props), colorVal || '', internalElements);
1889
+ outText += createGradientFillElement(isBareColor ? undefined : resolveGradientProps(props), colorVal || '', internalElements);
1538
1890
  break;
1539
1891
  case 'pattern':
1540
- outText += createPatternFillElement(typeof props === 'string' || isModifiedThemeColor(props) ? undefined : props.pattern, typeof colorVal === 'string' ? colorVal : String(colorVal.baseColor));
1892
+ outText += createPatternFillElement(isBareColor ? undefined : props.pattern, typeof colorVal === 'string' ? colorVal : isModifiedThemeColor(colorVal) ? String(colorVal.baseColor) : (/* inlined export .DEF_FONT_COLOR */"000000"));
1541
1893
  break;
1542
1894
  case 'image':
1543
1895
  {
1544
1896
  var _ref;
1545
- const image = typeof props === 'string' || isModifiedThemeColor(props) ? undefined : props.image;
1546
- const rId = (_ref = image === null || image === void 0 ? void 0 : image._rId) !== null && _ref !== void 0 ? _ref : typeof props === 'string' || isModifiedThemeColor(props) ? undefined : props._rId;
1897
+ const image = isBareColor ? undefined : props.image;
1898
+ const rId = (_ref = image === null || image === void 0 ? void 0 : image._rId) !== null && _ref !== void 0 ? _ref : isBareColor ? undefined : props._rId;
1547
1899
  if (rId) {
1548
1900
  outText += createImageFillElement(image !== null && image !== void 0 ? image : {}, rId);
1549
1901
  } else {
@@ -2528,6 +2880,137 @@ function gen_tables_object_spread(target) {
2528
2880
  return `<a:snd r:embed="rId${link.sound._sndRId}" name="${encodeXmlEntities((_link_sound_name = link.sound.name) !== null && _link_sound_name !== void 0 ? _link_sound_name : 'sound.wav')}"/>`;
2529
2881
  }
2530
2882
 
2883
+ function line_define_property(obj, key, value) {
2884
+ if (key in obj) {
2885
+ Object.defineProperty(obj, key, {
2886
+ value: value,
2887
+ enumerable: true,
2888
+ configurable: true,
2889
+ writable: true
2890
+ });
2891
+ } else obj[key] = value;
2892
+ return obj;
2893
+ }
2894
+ function line_object_spread(target) {
2895
+ for(var i = 1; i < arguments.length; i++){
2896
+ var source = arguments[i] != null ? arguments[i] : {};
2897
+ var ownKeys = Object.keys(source);
2898
+ if (typeof Object.getOwnPropertySymbols === "function") {
2899
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2900
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2901
+ }));
2902
+ }
2903
+ ownKeys.forEach(function(key) {
2904
+ line_define_property(target, key, source[key]);
2905
+ });
2906
+ }
2907
+ return target;
2908
+ }
2909
+ function line_ownKeys(object, enumerableOnly) {
2910
+ var keys = Object.keys(object);
2911
+ if (Object.getOwnPropertySymbols) {
2912
+ var symbols = Object.getOwnPropertySymbols(object);
2913
+ if (enumerableOnly) {
2914
+ symbols = symbols.filter(function(sym) {
2915
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2916
+ });
2917
+ }
2918
+ keys.push.apply(keys, symbols);
2919
+ }
2920
+ return keys;
2921
+ }
2922
+ function line_object_spread_props(target, source) {
2923
+ source = source != null ? source : {};
2924
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2925
+ else {
2926
+ line_ownKeys(Object(source)).forEach(function(key) {
2927
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2928
+ });
2929
+ }
2930
+ return target;
2931
+ }
2932
+ /**
2933
+ * PptxGenJS: Line properties (`a:ln` and its aliases)
2934
+ *
2935
+ * The same `CT_LineProperties` content model is used by shape outlines (`a:ln`), underlines
2936
+ * (`a:uLn`), and table cell borders, so the element name is a parameter rather than baked in.
2937
+ */
2938
+
2939
+ /**
2940
+ * Create a line element
2941
+ * @param {ShapeLineProps} line - line options
2942
+ * @param {string} tag - element name; `a:ln` for a shape outline, `a:uLn` for an underline
2943
+ * @return {string} XML
2944
+ */ function genXmlLine(line, tag = 'a:ln') {
2945
+ // ECMA-376 §5.1.2.1.34: `<a:ln>` carries `w`, `cap`, and `cmpd` attributes
2946
+ const cap = line.cap && [
2947
+ 'flat',
2948
+ 'sq',
2949
+ 'rnd'
2950
+ ].includes(line.cap) ? ` cap="${line.cap}"` : '';
2951
+ const compound = COMPOUND_TYPES.has(String(line.compound)) ? ` cmpd="${String(line.compound)}"` : '';
2952
+ if (line.compound && !COMPOUND_TYPES.has(String(line.compound))) {
2953
+ console.warn(`[pptxgenjs] line \`compound\` must be one of ${[
2954
+ ...COMPOUND_TYPES
2955
+ ].join(', ')} - "${String(line.compound)}" ignored`);
2956
+ }
2957
+ const attrs = (line.width ? ` w="${valToPts(line.width)}"` : '') + cap + compound;
2958
+ let xml = `<${tag}${attrs}>`;
2959
+ const hasGrad = !!(line.gradient || line.type === 'gradient' || line.type === 'linearGradient');
2960
+ if (line.type !== 'none' && (line.color || hasGrad)) {
2961
+ xml += genXmlColorSelection(hasGrad && !line.type ? line_object_spread_props(line_object_spread({}, line), {
2962
+ type: 'gradient'
2963
+ }) : line);
2964
+ }
2965
+ // CT_LineProperties sequence: fill, dash, join, headEnd, tailEnd. A custom pattern replaces
2966
+ // the preset one - emitting both would be ambiguous, since `a:custDash` is the same choice.
2967
+ xml += genXmlDash(line);
2968
+ xml += genXmlJoin(line);
2969
+ xml += genXmlArrow('a:headEnd', line.beginArrowType, line.beginArrowSize);
2970
+ xml += genXmlArrow('a:tailEnd', line.endArrowType, line.endArrowSize);
2971
+ xml += `</${tag}>`;
2972
+ return xml;
2973
+ }
2974
+ /** The dash choice: a custom pattern when given, otherwise the preset */ function genXmlDash(line) {
2975
+ var _line_custDash;
2976
+ const stops = ((_line_custDash = line.custDash) !== null && _line_custDash !== void 0 ? _line_custDash : []).filter((stop)=>{
2977
+ const ok = typeof (stop === null || stop === void 0 ? void 0 : stop.dash) === 'number' && isFinite(stop.dash) && stop.dash > 0 && typeof stop.space === 'number' && isFinite(stop.space) && stop.space >= 0;
2978
+ if (!ok) console.warn('[pptxgenjs] each `custDash` stop needs a positive `dash` and a non-negative `space` (percent of line width) - stop ignored');
2979
+ return ok;
2980
+ });
2981
+ if (stops.length > 0) {
2982
+ const items = stops.map((stop)=>`<a:ds d="${Math.round(stop.dash * 1000)}" sp="${Math.round(stop.space * 1000)}"/>`).join('');
2983
+ return `<a:custDash>${items}</a:custDash>`;
2984
+ }
2985
+ return line.dashType ? `<a:prstDash val="${line.dashType}"/>` : '';
2986
+ }
2987
+ /** The join choice: `a:round`, `a:bevel`, or `a:miter` with its limit */ function genXmlJoin(line) {
2988
+ if (!line.join) return '';
2989
+ if (line.join === 'round') return '<a:round/>';
2990
+ if (line.join === 'bevel') return '<a:bevel/>';
2991
+ if (line.join === 'miter') {
2992
+ const lim = typeof line.miterLimit === 'number' && isFinite(line.miterLimit) && line.miterLimit >= 0 ? line.miterLimit : 800;
2993
+ return `<a:miter lim="${Math.round(lim * 1000)}"/>`;
2994
+ }
2995
+ console.warn(`[pptxgenjs] line \`join\` must be 'round' | 'bevel' | 'miter' - "${String(line.join)}" ignored`);
2996
+ return '';
2997
+ }
2998
+ function resolveArrowSize(size) {
2999
+ if (!size) return undefined;
3000
+ if (typeof size === 'string') return {
3001
+ width: size,
3002
+ length: size
3003
+ };
3004
+ return size;
3005
+ }
3006
+ /** An arrow end with its optional sizing */ function genXmlArrow(tag, type, size) {
3007
+ if (!type) return '';
3008
+ const resolved = resolveArrowSize(size);
3009
+ const w = ARROW_SIZES.has(String(resolved === null || resolved === void 0 ? void 0 : resolved.width)) ? ` w="${String(resolved === null || resolved === void 0 ? void 0 : resolved.width)}"` : '';
3010
+ const len = ARROW_SIZES.has(String(resolved === null || resolved === void 0 ? void 0 : resolved.length)) ? ` len="${String(resolved === null || resolved === void 0 ? void 0 : resolved.length)}"` : '';
3011
+ return `<${tag} type="${type}"${w}${len}/>`;
3012
+ }
3013
+
2531
3014
  function text_define_property(obj, key, value) {
2532
3015
  if (key in obj) {
2533
3016
  Object.defineProperty(obj, key, {
@@ -2625,6 +3108,7 @@ function text_object_spread_props(target, source) {
2625
3108
  'textCascadeDown'
2626
3109
  ]);
2627
3110
 
3111
+
2628
3112
  /**
2629
3113
  * Build the `a:buClr` / `a:buSzPct` / `a:buSzPts` / `a:buFont` prefix shared by every bullet kind
2630
3114
  * - the size defaults to 100% because that is what every branch emitted before
@@ -2690,6 +3174,21 @@ function text_object_spread_props(target, source) {
2690
3174
  if (options.indentLevel && !isNaN(Number(options.indentLevel)) && options.indentLevel > 0) {
2691
3175
  paragraphPropXml += ` lvl="${options.indentLevel}"`;
2692
3176
  }
3177
+ // Remaining CT_TextParagraphProperties attributes - omitted unless set
3178
+ const para = options;
3179
+ if (typeof para.marR === 'number' && isFinite(para.marR) && para.marR >= 0) paragraphPropXml += ` marR="${inch2Emu(para.marR)}"`;
3180
+ if (typeof para.defTabSz === 'number' && isFinite(para.defTabSz) && para.defTabSz > 0) paragraphPropXml += ` defTabSz="${inch2Emu(para.defTabSz)}"`;
3181
+ if ([
3182
+ 'auto',
3183
+ 't',
3184
+ 'ctr',
3185
+ 'base',
3186
+ 'b'
3187
+ ].includes(String(para.fontAlgn))) paragraphPropXml += ` fontAlgn="${String(para.fontAlgn)}"`;
3188
+ // these three default to true in the schema, so only write them when turned off
3189
+ if (para.eaLnBrk === false) paragraphPropXml += ' eaLnBrk="0"';
3190
+ if (para.latinLnBrk === false) paragraphPropXml += ' latinLnBrk="0"';
3191
+ if (para.hangingPunct === false) paragraphPropXml += ' hangingPunct="0"';
2693
3192
  // OPTION: Paragraph Spacing: Before/After
2694
3193
  if (options.paraSpaceBefore && !isNaN(Number(options.paraSpaceBefore)) && options.paraSpaceBefore > 0) {
2695
3194
  strXmlParaSpc += `<a:spcBef><a:spcPts val="${Math.round(options.paraSpaceBefore * 100)}"/></a:spcBef>`;
@@ -2797,9 +3296,13 @@ function text_object_spread_props(target, source) {
2797
3296
  'all'
2798
3297
  ].includes(opts.caps) ? ` cap="${opts.caps}"` : '';
2799
3298
  if (opts.kumimoji === true) runProps += ' kumimoji="1"';
2800
- runProps += ' dirty="0">';
2801
- // Color / Font / Highlight / Outline are children of <a:rPr>, so add them now before closing the runProperties tag
2802
- if (opts.color || opts.gradient || opts.fontFace || opts.fontFaceEa || opts.fontFaceCs || opts.outline || typeof opts.underline === 'object' && opts.underline.color) {
3299
+ const run = opts;
3300
+ if (run.normalizeH === true) runProps += ' normalizeH="1"';
3301
+ if (run.noProof === true) runProps += ' noProof="1"';
3302
+ // `dirty` was hardcoded to 0; it stays the default so existing output does not change
3303
+ runProps += ` dirty="${run.dirty === true ? '1' : '0'}">`;
3304
+ // CT_TextCharacterProperties child order: ln, fill, effect, highlight, uLn, uFill, latin, ea, cs, sym
3305
+ if (opts.color || opts.gradient || opts.fontFace || opts.fontFaceEa || opts.fontFaceCs || opts.fontFaceSym || opts.outline || opts.glow || opts.highlight || run.underlineLine || typeof opts.underline === 'object' && opts.underline.color) {
2803
3306
  if (opts.outline && typeof opts.outline === 'object') {
2804
3307
  runProps += `<a:ln w="${valToPts(opts.outline.size || 0.75)}">${genXmlColorSelection({
2805
3308
  color: opts.outline.color || 'FFFFFF',
@@ -2816,10 +3319,12 @@ function text_object_spread_props(target, source) {
2816
3319
  color: opts.color,
2817
3320
  transparency: opts.transparency
2818
3321
  });
2819
- if (opts.highlight) runProps += `<a:highlight>${createColorElement(opts.highlight)}</a:highlight>`;
2820
- if (typeof opts.underline === 'object' && opts.underline.color) runProps += `<a:uFill>${genXmlColorSelection(opts.underline.color)}</a:uFill>`;
2821
3322
  const resolvedGlow = resolveGlowOptions(opts.glow);
2822
3323
  if (resolvedGlow) runProps += `<a:effectLst>${createGlowElement(resolvedGlow)}</a:effectLst>`;
3324
+ if (opts.highlight) runProps += `<a:highlight>${createColorElement(opts.highlight)}</a:highlight>`;
3325
+ if (run.underlineLine === 'text') runProps += '<a:uLnTx/>';
3326
+ else if (run.underlineLine && typeof run.underlineLine === 'object') runProps += genXmlLine(run.underlineLine, 'a:uLn');
3327
+ if (typeof opts.underline === 'object' && opts.underline.color) runProps += `<a:uFill>${genXmlColorSelection(opts.underline.color)}</a:uFill>`;
2823
3328
  const latin = opts.fontFace;
2824
3329
  const ea = opts.fontFaceEa || opts.fontFace;
2825
3330
  const cs = opts.fontFaceCs || opts.fontFace;
@@ -2829,6 +3334,7 @@ function text_object_spread_props(target, source) {
2829
3334
  if (ea) runProps += `<a:ea typeface="${encodeXmlEntities(ea)}" pitchFamily="34" charset="-122"/>`;
2830
3335
  if (cs) runProps += `<a:cs typeface="${encodeXmlEntities(cs)}" pitchFamily="34" charset="-120"/>`;
2831
3336
  }
3337
+ if (opts.fontFaceSym) runProps += `<a:sym typeface="${encodeXmlEntities(opts.fontFaceSym)}"/>`;
2832
3338
  }
2833
3339
  // Hyperlink support
2834
3340
  if (opts.hyperlink) {
@@ -2961,6 +3467,14 @@ function genXmlTextRun(textObj) {
2961
3467
  if (slideObject.options._bodyProp.tIns || slideObject.options._bodyProp.tIns === 0) bodyProperties += ` tIns="${slideObject.options._bodyProp.tIns}"`;
2962
3468
  if (slideObject.options._bodyProp.rIns || slideObject.options._bodyProp.rIns === 0) bodyProperties += ` rIns="${slideObject.options._bodyProp.rIns}"`;
2963
3469
  if (slideObject.options._bodyProp.bIns || slideObject.options._bodyProp.bIns === 0) bodyProperties += ` bIns="${slideObject.options._bodyProp.bIns}"`;
3470
+ // Remaining CT_TextBodyProperties attributes - each omitted unless asked for
3471
+ const body = slideObject.options;
3472
+ if (body.upright === true) bodyProperties += ' upright="1"';
3473
+ if (typeof body.textRotate === 'number' && isFinite(body.textRotate)) bodyProperties += ` rot="${convertRotationDegrees(body.textRotate)}"`;
3474
+ if (body.anchorCtr === true) bodyProperties += ' anchorCtr="1"';
3475
+ if (body.spcFirstLastPara === true) bodyProperties += ' spcFirstLastPara="1"';
3476
+ if (body.compatLnSpc === true) bodyProperties += ' compatLnSpc="1"';
3477
+ if (body.forceAA === true) bodyProperties += ' forceAA="1"';
2964
3478
  // Text columns — ECMA-376 §5.1.5.1.4 CT_TextBodyProperties@numCol/@spcCol (issue #1320)
2965
3479
  if (slideObject.options._bodyProp.numCol && slideObject.options._bodyProp.numCol > 1) {
2966
3480
  bodyProperties += ` numCol="${slideObject.options._bodyProp.numCol}"`;
@@ -4862,7 +5376,7 @@ function addShapeDefinition(target, shapeName, opts) {
4862
5376
  }
4863
5377
  // 1: ShapeLineProps defaults
4864
5378
  const hasConnectorEnds = options.line.sourceId != null || options.line.targetId != null;
4865
- const newLineOpts = {
5379
+ const newLineOpts = gen_objects_object_spread_props(gen_objects_object_spread({}, options.line), {
4866
5380
  type: options.line.type || (options.line.gradient ? 'gradient' : 'solid'),
4867
5381
  color: options.line.color || (/* inlined export .DEF_SHAPE_LINE_COLOR */"333333"),
4868
5382
  transparency: options.line.transparency || 0,
@@ -4881,7 +5395,7 @@ function addShapeDefinition(target, shapeName, opts) {
4881
5395
  curveadjust: options.line.curveadjust,
4882
5396
  _sourceName: options.line._sourceName,
4883
5397
  _targetName: options.line._targetName
4884
- };
5398
+ });
4885
5399
  if (typeof options.line === 'object' && options.line.type !== 'none') options.line = newLineOpts;
4886
5400
  // 2: Set options defaults
4887
5401
  const shapeOpts = options;
@@ -5274,7 +5788,7 @@ function addShapeDefinition(target, shapeName, opts) {
5274
5788
  if (itemOpts.shape === core_enums_SHAPE_TYPE.LINE) {
5275
5789
  var _itemOpts_line, _itemOpts_line1, _itemOpts_line2, _itemOpts_line3, _itemOpts_line4, _itemOpts_line5, _itemOpts_line6, _itemOpts_line7, _itemOpts_line8, _itemOpts_line9;
5276
5790
  // ShapeLineProps defaults
5277
- const newLineOpts = {
5791
+ const newLineOpts = gen_objects_object_spread_props(gen_objects_object_spread({}, itemOpts.line), {
5278
5792
  type: ((_itemOpts_line = itemOpts.line) === null || _itemOpts_line === void 0 ? void 0 : _itemOpts_line.type) || (((_itemOpts_line1 = itemOpts.line) === null || _itemOpts_line1 === void 0 ? void 0 : _itemOpts_line1.gradient) ? 'gradient' : 'solid'),
5279
5793
  color: ((_itemOpts_line2 = itemOpts.line) === null || _itemOpts_line2 === void 0 ? void 0 : _itemOpts_line2.color) || (/* inlined export .DEF_SHAPE_LINE_COLOR */"333333"),
5280
5794
  transparency: ((_itemOpts_line3 = itemOpts.line) === null || _itemOpts_line3 === void 0 ? void 0 : _itemOpts_line3.transparency) || 0,
@@ -5284,7 +5798,7 @@ function addShapeDefinition(target, shapeName, opts) {
5284
5798
  cap: (_itemOpts_line7 = itemOpts.line) === null || _itemOpts_line7 === void 0 ? void 0 : _itemOpts_line7.cap,
5285
5799
  beginArrowType: ((_itemOpts_line8 = itemOpts.line) === null || _itemOpts_line8 === void 0 ? void 0 : _itemOpts_line8.beginArrowType) || undefined,
5286
5800
  endArrowType: ((_itemOpts_line9 = itemOpts.line) === null || _itemOpts_line9 === void 0 ? void 0 : _itemOpts_line9.endArrowType) || undefined
5287
- };
5801
+ });
5288
5802
  if (typeof itemOpts.line === 'object') itemOpts.line = newLineOpts;
5289
5803
  // 3: Handle line (lots of deprecated opts)
5290
5804
  normalizeDeprecatedLineProps(itemOpts, newLineOpts);
@@ -20450,6 +20964,7 @@ function slide_object_spread_props(target, source) {
20450
20964
 
20451
20965
 
20452
20966
 
20967
+
20453
20968
  function nvPrModIdExt(modId) {
20454
20969
  return genXmlModIdExt(modId).replace(/^<p:extLst>|<\/p:extLst>$/g, '');
20455
20970
  }
@@ -20587,31 +21102,6 @@ const ImageSizingXml = {
20587
21102
  const time = typeof (point === null || point === void 0 ? void 0 : point.time) === 'number' && isFinite(point.time) && point.time > 0 ? ` time="${Math.round(point.time)}"` : '';
20588
21103
  return `<${tag} track="${track}"${time}/>`;
20589
21104
  }
20590
- /**
20591
- * Create the `a:ln` outline block for a shape/image
20592
- * @param {ShapeLineProps} line - line options
20593
- * @return {string} XML
20594
- */ function genXmlLine(line) {
20595
- // ECMA-376 §5.1.2.1.34: `<a:ln>` carries `w` and `cap` attributes (cap = line ending style, issue #782)
20596
- const attrs = (line.width ? ` w="${valToPts(line.width)}"` : '') + (line.cap && [
20597
- 'flat',
20598
- 'sq',
20599
- 'rnd'
20600
- ].includes(line.cap) ? ` cap="${line.cap}"` : '');
20601
- let xml = `<a:ln${attrs}>`;
20602
- const hasGrad = !!(line.gradient || line.type === 'gradient' || line.type === 'linearGradient');
20603
- if (line.type !== 'none' && (line.color || hasGrad)) {
20604
- xml += genXmlColorSelection(hasGrad && !line.type ? slide_object_spread_props(xml_slide_object_spread({}, line), {
20605
- type: 'gradient'
20606
- }) : line);
20607
- }
20608
- if (line.dashType) xml += `<a:prstDash val="${line.dashType}"/>`;
20609
- if (line.beginArrowType) xml += `<a:headEnd type="${line.beginArrowType}"/>`;
20610
- if (line.endArrowType) xml += `<a:tailEnd type="${line.endArrowType}"/>`;
20611
- // FUTURE: `endArrowSize` < a: headEnd type = "arrow" w = "lg" len = "lg" /> 'sm' | 'med' | 'lg'(values are 1 - 9, making a 3x3 grid of w / len possibilities)
20612
- xml += '</a:ln>';
20613
- return xml;
20614
- }
20615
21105
  /**
20616
21106
  * Create a single `a:outerShdw` / `a:innerShdw` element (no `effectLst` wrapper).
20617
21107
  * @note pure - unit conversion must NOT mutate the caller's options (issue #20)
@@ -21872,6 +22362,7 @@ function package_object_spread(target) {
21872
22362
 
21873
22363
 
21874
22364
 
22365
+
21875
22366
  /**
21876
22367
  * Content-type overrides a chart needs: the chart itself plus, when requested, its style and colour-style parts.
21877
22368
  * - one helper because charts appear on slides, layouts and the master, and a part with no declared
@@ -22704,6 +23195,7 @@ function makeXmlPresPropsExtLst(pres) {
22704
23195
 
22705
23196
 
22706
23197
 
23198
+
22707
23199
  function pptxgen_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
22708
23200
  try {
22709
23201
  var info = gen[key](arg);
@@ -23231,7 +23723,7 @@ class PptxGenJS {
23231
23723
  */ pptxgen_define_property(this, "_layout", void 0);
23232
23724
  /**
23233
23725
  * PptxGenJS Library Version
23234
- */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.2.0"));
23726
+ */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.3.0"));
23235
23727
  /**
23236
23728
  * @type {string}
23237
23729
  */ pptxgen_define_property(this, "_author", void 0);