pptxgenjs-plus 4.3.3 → 4.3.4

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.4 @ 2026-09-24T17:18:00.535Z */
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.
@@ -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.4"));
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.4 @ 2026-09-24T17:18:00.535Z */
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.
@@ -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.4"));
23775
23792
  /**
23776
23793
  * @type {string}
23777
23794
  */ pptxgen_define_property(this, "_author", void 0);