pptxgenjs-plus 4.3.3 → 4.3.5

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.3.3 @ 2026-09-19T03:39:07.117Z */
1
+ /* PptxGenJS 4.3.5 @ 2026-10-31T02:02:20.255Z */
2
2
 
3
3
  "use strict";
4
4
  const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
@@ -1515,14 +1515,29 @@ function gen_utils_object_spread_props(target, source) {
1515
1515
  _warnedDeprecations.add(key);
1516
1516
  console.warn(`[pptxgenjs] DEPRECATED: ${message}`);
1517
1517
  }
1518
+ /**
1519
+ * Characters XML 1.0 forbids anywhere in a document (even when escaped):
1520
+ * C0 controls other than TAB / LF / CR, the non-characters U+FFFE / U+FFFF
1521
+ * and unpaired surrogates. A single one in a text run makes PowerPoint show
1522
+ * the repair prompt for the whole package.
1523
+ */ // eslint-disable-next-line no-control-regex
1524
+ const XML_ILLEGAL_CHARS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
1525
+ /**
1526
+ * Drop every character that cannot appear in an XML 1.0 document
1527
+ * @param {string} text - text to sanitize
1528
+ * @returns {string} text without XML-illegal characters
1529
+ */ function stripXmlIllegalChars(text) {
1530
+ return text.replace(XML_ILLEGAL_CHARS, '');
1531
+ }
1518
1532
  /**
1519
1533
  * Replace special XML characters with HTML-encoded strings
1534
+ * - Also drops characters XML 1.0 forbids outright (control chars, lone surrogates)
1520
1535
  * @param {string} xml - XML string to encode
1521
1536
  * @returns {string} escaped XML
1522
1537
  */ function encodeXmlEntities(xml) {
1523
1538
  // NOTE: Dont use short-circuit eval here as value c/b "0" (zero) etc.!
1524
1539
  if (typeof xml === 'undefined' || xml == null) return '';
1525
- return xml.toString().replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
1540
+ return stripXmlIllegalChars(xml.toString()).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
1526
1541
  }
1527
1542
  /**
1528
1543
  * Check that a string is a well-formed XML fragment (strict XML 1.0 via
@@ -3464,7 +3479,9 @@ const P1710_NS = 'http://schemas.microsoft.com/office/powerpoint/2017/10/main';
3464
3479
  * - Wraps in `<a14:m>` — PowerPoint silently drops bare `m:oMath` siblings of `a:r`.
3465
3480
  * @see MS-ODRAWXML Math / mc:AlternateContent; proven via PowerPoint 16 COM round-trip.
3466
3481
  */ function normalizeOmml(omml) {
3467
- let trimmed = omml.trim();
3482
+ // Control characters in math text (`<m:t>`) are a data defect, not a markup
3483
+ // one - drop them instead of failing the whole export over a single run.
3484
+ let trimmed = stripXmlIllegalChars(omml).trim();
3468
3485
  if (!trimmed) return '';
3469
3486
  // Malformed OMML would be embedded verbatim and corrupt the whole package
3470
3487
  // (PowerPoint repair prompt / open failure), so fail fast with a pointer.
@@ -8483,7 +8500,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
8483
8500
  strXml += ' <a:p>';
8484
8501
  strXml += ' <a:pPr>';
8485
8502
  strXml += ` <a:defRPr sz="${Math.round((opts.dataLabelFontSize || (/* inlined export .DEF_FONT_SIZE */12)) * 100)}" b="${opts.dataLabelFontBold ? '1' : '0'}" i="${opts.dataLabelFontItalic ? '1' : '0'}" u="none" strike="noStrike">`;
8486
- strXml += ` <a:solidFill><a:srgbClr val="000000"/></a:solidFill><a:latin typeface="${encodeXmlEntities(opts.dataLabelFontFace) || 'Arial'}"/>`;
8503
+ strXml += ` <a:solidFill>${createColorElement(opts.dataLabelColor || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill><a:latin typeface="${encodeXmlEntities(opts.dataLabelFontFace) || 'Arial'}"/>`;
8487
8504
  strXml += ' </a:defRPr>';
8488
8505
  strXml += ' </a:pPr>';
8489
8506
  strXml += ' </a:p>';
@@ -8698,7 +8715,7 @@ function makeNumberStyles(formats) {
8698
8715
  {
8699
8716
  let strTableXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
8700
8717
  if (chartObject.opts._type === core_enums_CHART_TYPE.BUBBLE || chartObject.opts._type === core_enums_CHART_TYPE.BUBBLE3D) {
8701
- strTableXml += `<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="1" name="Table1" displayName="Table1" ref="A1:${getExcelColName(intBubbleCols)}${intBubbleCols}" totalsRowShown="0">`;
8718
+ strTableXml += `<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="1" name="Table1" displayName="Table1" ref="A1:${getExcelColName(intBubbleCols)}${firstDataValues.length + 1}" totalsRowShown="0">`;
8702
8719
  strTableXml += `<tableColumns count="${intBubbleCols}">`;
8703
8720
  let idxColLtr = 1;
8704
8721
  data.forEach((obj, idx)=>{
@@ -23903,7 +23920,7 @@ class PptxGenJS {
23903
23920
  */ pptxgen_define_property(this, "_layout", void 0);
23904
23921
  /**
23905
23922
  * PptxGenJS Library Version
23906
- */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.3.3"));
23923
+ */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.3.5"));
23907
23924
  /**
23908
23925
  * @type {string}
23909
23926
  */ pptxgen_define_property(this, "_author", void 0);
@@ -1,4 +1,4 @@
1
- /* PptxGenJS 4.3.3 @ 2026-09-19T03:39:07.117Z */
1
+ /* PptxGenJS 4.3.5 @ 2026-10-31T02:02:20.255Z */
2
2
 
3
3
  import { JSZip } from "@node-projects/jszip";
4
4
  import { parseXml } from "@rgrove/parse-xml";
@@ -1477,14 +1477,29 @@ function gen_utils_object_spread_props(target, source) {
1477
1477
  _warnedDeprecations.add(key);
1478
1478
  console.warn(`[pptxgenjs] DEPRECATED: ${message}`);
1479
1479
  }
1480
+ /**
1481
+ * Characters XML 1.0 forbids anywhere in a document (even when escaped):
1482
+ * C0 controls other than TAB / LF / CR, the non-characters U+FFFE / U+FFFF
1483
+ * and unpaired surrogates. A single one in a text run makes PowerPoint show
1484
+ * the repair prompt for the whole package.
1485
+ */ // eslint-disable-next-line no-control-regex
1486
+ const XML_ILLEGAL_CHARS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
1487
+ /**
1488
+ * Drop every character that cannot appear in an XML 1.0 document
1489
+ * @param {string} text - text to sanitize
1490
+ * @returns {string} text without XML-illegal characters
1491
+ */ function stripXmlIllegalChars(text) {
1492
+ return text.replace(XML_ILLEGAL_CHARS, '');
1493
+ }
1480
1494
  /**
1481
1495
  * Replace special XML characters with HTML-encoded strings
1496
+ * - Also drops characters XML 1.0 forbids outright (control chars, lone surrogates)
1482
1497
  * @param {string} xml - XML string to encode
1483
1498
  * @returns {string} escaped XML
1484
1499
  */ function encodeXmlEntities(xml) {
1485
1500
  // NOTE: Dont use short-circuit eval here as value c/b "0" (zero) etc.!
1486
1501
  if (typeof xml === 'undefined' || xml == null) return '';
1487
- return xml.toString().replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
1502
+ return stripXmlIllegalChars(xml.toString()).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
1488
1503
  }
1489
1504
  /**
1490
1505
  * Check that a string is a well-formed XML fragment (strict XML 1.0 via
@@ -3422,7 +3437,9 @@ const P1710_NS = 'http://schemas.microsoft.com/office/powerpoint/2017/10/main';
3422
3437
  * - Wraps in `<a14:m>` — PowerPoint silently drops bare `m:oMath` siblings of `a:r`.
3423
3438
  * @see MS-ODRAWXML Math / mc:AlternateContent; proven via PowerPoint 16 COM round-trip.
3424
3439
  */ function normalizeOmml(omml) {
3425
- let trimmed = omml.trim();
3440
+ // Control characters in math text (`<m:t>`) are a data defect, not a markup
3441
+ // one - drop them instead of failing the whole export over a single run.
3442
+ let trimmed = stripXmlIllegalChars(omml).trim();
3426
3443
  if (!trimmed) return '';
3427
3444
  // Malformed OMML would be embedded verbatim and corrupt the whole package
3428
3445
  // (PowerPoint repair prompt / open failure), so fail fast with a pointer.
@@ -8433,7 +8450,7 @@ function makeChartType(chartType, data, opts, valAxisId, catAxisId, _isMultiType
8433
8450
  strXml += ' <a:p>';
8434
8451
  strXml += ' <a:pPr>';
8435
8452
  strXml += ` <a:defRPr sz="${Math.round((opts.dataLabelFontSize || (/* inlined export .DEF_FONT_SIZE */12)) * 100)}" b="${opts.dataLabelFontBold ? '1' : '0'}" i="${opts.dataLabelFontItalic ? '1' : '0'}" u="none" strike="noStrike">`;
8436
- strXml += ` <a:solidFill><a:srgbClr val="000000"/></a:solidFill><a:latin typeface="${encodeXmlEntities(opts.dataLabelFontFace) || 'Arial'}"/>`;
8453
+ strXml += ` <a:solidFill>${createColorElement(opts.dataLabelColor || (/* inlined export .DEF_FONT_COLOR */"000000"))}</a:solidFill><a:latin typeface="${encodeXmlEntities(opts.dataLabelFontFace) || 'Arial'}"/>`;
8437
8454
  strXml += ' </a:defRPr>';
8438
8455
  strXml += ' </a:pPr>';
8439
8456
  strXml += ' </a:p>';
@@ -8647,7 +8664,7 @@ function makeNumberStyles(formats) {
8647
8664
  {
8648
8665
  let strTableXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
8649
8666
  if (chartObject.opts._type === core_enums_CHART_TYPE.BUBBLE || chartObject.opts._type === core_enums_CHART_TYPE.BUBBLE3D) {
8650
- strTableXml += `<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="1" name="Table1" displayName="Table1" ref="A1:${getExcelColName(intBubbleCols)}${intBubbleCols}" totalsRowShown="0">`;
8667
+ strTableXml += `<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="1" name="Table1" displayName="Table1" ref="A1:${getExcelColName(intBubbleCols)}${firstDataValues.length + 1}" totalsRowShown="0">`;
8651
8668
  strTableXml += `<tableColumns count="${intBubbleCols}">`;
8652
8669
  let idxColLtr = 1;
8653
8670
  data.forEach((obj, idx)=>{
@@ -23771,7 +23788,7 @@ class PptxGenJS {
23771
23788
  */ pptxgen_define_property(this, "_layout", void 0);
23772
23789
  /**
23773
23790
  * PptxGenJS Library Version
23774
- */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.3.3"));
23791
+ */ pptxgen_define_property(this, "_version", (/* inlined export .VERSION */"4.3.5"));
23775
23792
  /**
23776
23793
  * @type {string}
23777
23794
  */ pptxgen_define_property(this, "_author", void 0);