pptx-react-viewer 1.1.2 → 1.1.3

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 (20) hide show
  1. package/node_modules/emf-converter/package.json +1 -1
  2. package/node_modules/mtx-decompressor/package.json +1 -1
  3. package/node_modules/pptx-viewer-core/dist/{SvgExporter--H1PDfAY.d.ts → SvgExporter-BMjoxMDV.d.ts} +1 -1
  4. package/node_modules/pptx-viewer-core/dist/{SvgExporter-Dq_2eV_r.d.mts → SvgExporter-z6AbXRQg.d.mts} +1 -1
  5. package/node_modules/pptx-viewer-core/dist/cli/index.d.mts +2 -2
  6. package/node_modules/pptx-viewer-core/dist/cli/index.d.ts +2 -2
  7. package/node_modules/pptx-viewer-core/dist/cli/index.js +165 -18
  8. package/node_modules/pptx-viewer-core/dist/cli/index.mjs +165 -18
  9. package/node_modules/pptx-viewer-core/dist/converter/index.d.mts +3 -3
  10. package/node_modules/pptx-viewer-core/dist/converter/index.d.ts +3 -3
  11. package/node_modules/pptx-viewer-core/dist/index.d.mts +26 -5
  12. package/node_modules/pptx-viewer-core/dist/index.d.ts +26 -5
  13. package/node_modules/pptx-viewer-core/dist/index.js +165 -18
  14. package/node_modules/pptx-viewer-core/dist/index.mjs +165 -18
  15. package/node_modules/pptx-viewer-core/dist/{presentation-BozkirFp.d.mts → presentation-CchuDGfU.d.mts} +1 -1
  16. package/node_modules/pptx-viewer-core/dist/{presentation-BozkirFp.d.ts → presentation-CchuDGfU.d.ts} +1 -1
  17. package/node_modules/pptx-viewer-core/dist/{text-operations-B2JbPA5H.d.mts → text-operations-CeukUztU.d.mts} +1 -1
  18. package/node_modules/pptx-viewer-core/dist/{text-operations-zwF6i4eH.d.ts → text-operations-e7JxgI5l.d.ts} +1 -1
  19. package/node_modules/pptx-viewer-core/package.json +1 -1
  20. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emf-converter",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Convert EMF/WMF metafile binaries to PNG data URLs using Canvas",
5
5
  "keywords": [
6
6
  "canvas",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtx-decompressor",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "MicroType Express (MTX) font decompressor — extracts TTF/OTF from compressed EOT containers.",
5
5
  "homepage": "https://github.com/ChristopherVR/pptx-viewer",
6
6
  "bugs": {
@@ -1,4 +1,4 @@
1
- import { m as PptxData, P as PptxElement, K as TextSegment, l as PptxSlide } from './presentation-BozkirFp.js';
1
+ import { m as PptxData, P as PptxElement, K as TextSegment, l as PptxSlide } from './presentation-CchuDGfU.js';
2
2
 
3
3
  /**
4
4
  * Platform adapter for file system operations.
@@ -1,4 +1,4 @@
1
- import { m as PptxData, P as PptxElement, K as TextSegment, l as PptxSlide } from './presentation-BozkirFp.mjs';
1
+ import { m as PptxData, P as PptxElement, K as TextSegment, l as PptxSlide } from './presentation-CchuDGfU.mjs';
2
2
 
3
3
  /**
4
4
  * Platform adapter for file system operations.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { F as FindResult, M as MergeOptions } from '../text-operations-B2JbPA5H.mjs';
3
- import '../presentation-BozkirFp.mjs';
2
+ import { F as FindResult, M as MergeOptions } from '../text-operations-CeukUztU.mjs';
3
+ import '../presentation-CchuDGfU.mjs';
4
4
 
5
5
  /**
6
6
  * CLI command handlers for pptx-cli.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { F as FindResult, M as MergeOptions } from '../text-operations-zwF6i4eH.js';
3
- import '../presentation-BozkirFp.js';
2
+ import { F as FindResult, M as MergeOptions } from '../text-operations-e7JxgI5l.js';
3
+ import '../presentation-CchuDGfU.js';
4
4
 
5
5
  /**
6
6
  * CLI command handlers for pptx-cli.
@@ -5188,7 +5188,11 @@ function isoNow() {
5188
5188
  return (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+Z$/, "Z");
5189
5189
  }
5190
5190
  var STANDARD_LAYOUTS = [
5191
- { name: "Title Slide", type: "ctrTitle" },
5191
+ // `type` is ST_SlideLayoutType per ECMA-376 §19.7.15. The Title Slide
5192
+ // layout uses `title`; `ctrTitle` is a placeholder type (ST_PlaceholderType)
5193
+ // and is not valid here — PowerPoint's OPC loader rejects the package
5194
+ // with ERROR_FILE_CORRUPT (0x80070570) when it sees it.
5195
+ { name: "Title Slide", type: "title" },
5192
5196
  { name: "Title and Content", type: "obj" },
5193
5197
  { name: "Section Header", type: "secHead" },
5194
5198
  { name: "Two Content", type: "twoObj" },
@@ -5222,7 +5226,7 @@ ${slideOverrides}
5222
5226
  <Override PartName="/ppt/viewProps.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"/>
5223
5227
  <Override PartName="/ppt/tableStyles.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"/>
5224
5228
  <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
5225
- <Override PartName="/docProps/app.xml" ContentType="application/vnd.ms-officedocument.extended-properties+xml"/>
5229
+ <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
5226
5230
  </Types>`;
5227
5231
  }
5228
5232
  function rootRelsXml() {
@@ -6548,9 +6552,40 @@ var PptxPresentationSlidesReconciler = class {
6548
6552
  "@_r:id": slide.rId
6549
6553
  };
6550
6554
  });
6551
- presentation["p:sldIdLst"] = slideIdList;
6552
- input.presentationData["p:presentation"] = presentation;
6555
+ input.presentationData["p:presentation"] = this.insertSlideIdListInOrder(
6556
+ presentation,
6557
+ slideIdList
6558
+ );
6559
+ }
6560
+ }
6561
+ /**
6562
+ * Return a new presentation XML object whose `p:sldIdLst` child sits in the
6563
+ * schema-mandated position (after `sldMasterIdLst` / `notesMasterIdLst` /
6564
+ * `handoutMasterIdLst`, before `sldSz`). Non-sldIdLst keys keep their
6565
+ * relative order; attribute keys (`@_...`) stay at the front.
6566
+ */
6567
+ insertSlideIdListInOrder(presentation, slideIdList) {
6568
+ const before = /* @__PURE__ */ new Set([
6569
+ "p:sldMasterIdLst",
6570
+ "p:notesMasterIdLst",
6571
+ "p:handoutMasterIdLst"
6572
+ ]);
6573
+ const rebuilt = {};
6574
+ let inserted = false;
6575
+ for (const key of Object.keys(presentation)) {
6576
+ if (key === "p:sldIdLst") {
6577
+ continue;
6578
+ }
6579
+ if (!inserted && !key.startsWith("@_") && !before.has(key)) {
6580
+ rebuilt["p:sldIdLst"] = slideIdList;
6581
+ inserted = true;
6582
+ }
6583
+ rebuilt[key] = presentation[key];
6584
+ }
6585
+ if (!inserted) {
6586
+ rebuilt["p:sldIdLst"] = slideIdList;
6553
6587
  }
6588
+ return rebuilt;
6554
6589
  }
6555
6590
  async attachNewSlide(init) {
6556
6591
  const sourceSlidePath = init.input.findSourceSlidePath(init.slide.sourceSlideId);
@@ -26807,6 +26842,55 @@ var PptxHandlerRuntime14 = class extends PptxHandlerRuntime13 {
26807
26842
 
26808
26843
  // src/core/core/runtime/PptxHandlerRuntimeSaveShapeXml.ts
26809
26844
  var PptxHandlerRuntime15 = class _PptxHandlerRuntime extends PptxHandlerRuntime14 {
26845
+ /**
26846
+ * Build a `p:graphicFrame` XML skeleton for an SDK-created table.
26847
+ *
26848
+ * Tables round-trip as `<p:graphicFrame>/<a:graphic>/<a:graphicData
26849
+ * uri=".../drawingml/2006/table">/<a:tbl>` inside `p:spTree`. When the
26850
+ * element was loaded from an existing file, `el.rawXml` already contains
26851
+ * this envelope and the downstream `serializeTableDataToXml` path
26852
+ * populates cells in place. When the element was created via the SDK
26853
+ * (`SlideBuilder.addTable`), there is no `rawXml`, so this method
26854
+ * fabricates a minimal envelope with an empty `a:tbl`. The element
26855
+ * writer then calls `serializeTableDataToXml`, which triggers
26856
+ * `rebuildTableXmlFromData` and fills in `a:tblGrid` / `a:tr` children.
26857
+ */
26858
+ createTableGraphicFrameXml(el) {
26859
+ const EMU = _PptxHandlerRuntime.EMU_PER_PX;
26860
+ const offX = String(Math.round(el.x * EMU));
26861
+ const offY = String(Math.round(el.y * EMU));
26862
+ const extCx = String(Math.round(Math.max(el.width, 1) * EMU));
26863
+ const extCy = String(Math.round(Math.max(el.height, 1) * EMU));
26864
+ const tblPr = {
26865
+ "@_firstRow": el.tableData?.firstRowHeader ? "1" : "0",
26866
+ "@_bandRow": el.tableData?.bandedRows ? "1" : "0"
26867
+ };
26868
+ if (el.tableData?.tableStyleId) {
26869
+ tblPr["a:tableStyleId"] = el.tableData.tableStyleId;
26870
+ }
26871
+ return {
26872
+ "p:nvGraphicFramePr": {
26873
+ "p:cNvPr": { "@_id": "0", "@_name": el.name || "Table" },
26874
+ "p:cNvGraphicFramePr": {
26875
+ "a:graphicFrameLocks": { "@_noGrp": "1" }
26876
+ },
26877
+ "p:nvPr": {}
26878
+ },
26879
+ "p:xfrm": {
26880
+ "a:off": { "@_x": offX, "@_y": offY },
26881
+ "a:ext": { "@_cx": extCx, "@_cy": extCy }
26882
+ },
26883
+ "a:graphic": {
26884
+ "a:graphicData": {
26885
+ "@_uri": "http://schemas.openxmlformats.org/drawingml/2006/table",
26886
+ "a:tbl": {
26887
+ "a:tblPr": tblPr,
26888
+ "a:tblGrid": {}
26889
+ }
26890
+ }
26891
+ }
26892
+ };
26893
+ }
26810
26894
  /**
26811
26895
  * Build a p:sp XML object for an ink annotation element.
26812
26896
  * Each ink path becomes a separate a:path within a:pathLst,
@@ -28288,14 +28372,15 @@ function writeCellTextFormatting(xmlCell, style, ensureArray6) {
28288
28372
  const paragraphs = ensureArray6(xmlCell["a:txBody"]?.["a:p"]);
28289
28373
  for (const paragraph of paragraphs) {
28290
28374
  const runs = ensureArray6(paragraph?.["a:r"]);
28375
+ const rebuiltRuns = [];
28376
+ let runsChanged = false;
28291
28377
  for (const run of runs) {
28292
28378
  if (!run) {
28379
+ rebuiltRuns.push(run);
28293
28380
  continue;
28294
28381
  }
28295
- if (!run["a:rPr"]) {
28296
- run["a:rPr"] = {};
28297
- }
28298
- const rPr = run["a:rPr"];
28382
+ const existingRPr = run["a:rPr"] ?? {};
28383
+ const rPr = { ...existingRPr };
28299
28384
  if (style.bold !== void 0) {
28300
28385
  rPr["@_b"] = style.bold ? "1" : "0";
28301
28386
  }
@@ -28315,6 +28400,18 @@ function writeCellTextFormatting(xmlCell, style, ensureArray6) {
28315
28400
  }
28316
28401
  };
28317
28402
  }
28403
+ const rebuilt = { "a:rPr": rPr };
28404
+ for (const key of Object.keys(run)) {
28405
+ if (key === "a:rPr") {
28406
+ continue;
28407
+ }
28408
+ rebuilt[key] = run[key];
28409
+ }
28410
+ rebuiltRuns.push(rebuilt);
28411
+ runsChanged = true;
28412
+ }
28413
+ if (runsChanged && rebuiltRuns.length > 0) {
28414
+ paragraph["a:r"] = rebuiltRuns.length === 1 ? rebuiltRuns[0] : rebuiltRuns;
28318
28415
  }
28319
28416
  }
28320
28417
  }
@@ -28336,6 +28433,9 @@ var PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
28336
28433
  const existingParagraphs = this.ensureArray(txBody["a:p"]);
28337
28434
  const firstRPr = this.ensureArray(existingParagraphs[0]?.["a:r"])[0]?.["a:rPr"];
28338
28435
  const firstPPr = existingParagraphs[0]?.["a:pPr"];
28436
+ const firstEndParaRPr = existingParagraphs[0]?.["a:endParaRPr"];
28437
+ const rPrForRun = firstRPr ? { ...firstRPr } : { "@_lang": "en-US", "@_dirty": "0" };
28438
+ const endParaRPr = firstEndParaRPr ? { ...firstEndParaRPr } : { "@_lang": "en-US", "@_dirty": "0" };
28339
28439
  const lines = text.split("\n");
28340
28440
  const paragraphs = lines.map((line) => {
28341
28441
  const paragraph = {};
@@ -28343,9 +28443,10 @@ var PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
28343
28443
  paragraph["a:pPr"] = firstPPr;
28344
28444
  }
28345
28445
  paragraph["a:r"] = {
28346
- ...firstRPr ? { "a:rPr": firstRPr } : {},
28446
+ "a:rPr": rPrForRun,
28347
28447
  "a:t": line
28348
28448
  };
28449
+ paragraph["a:endParaRPr"] = endParaRPr;
28349
28450
  return paragraph;
28350
28451
  });
28351
28452
  txBody["a:p"] = paragraphs.length === 1 ? paragraphs[0] : paragraphs;
@@ -28495,14 +28596,27 @@ function serializeCellMergeAttributes(xmlCell, cell) {
28495
28596
  delete xmlCell["@_vMerge"];
28496
28597
  }
28497
28598
  }
28599
+ var DEFAULT_POWERPOINT_TABLE_STYLE_ID = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
28498
28600
  function serializeTablePropertyFlags(tbl, tableData) {
28499
28601
  const tblPr = tbl["a:tblPr"] ?? {};
28500
- tblPr["@_bandRow"] = tableData.bandedRows ? "1" : "0";
28501
- tblPr["@_bandCol"] = tableData.bandedColumns ? "1" : "0";
28502
- tblPr["@_firstRow"] = tableData.firstRowHeader ? "1" : "0";
28503
- tblPr["@_lastRow"] = tableData.lastRow ? "1" : "0";
28504
- tblPr["@_firstCol"] = tableData.firstCol ? "1" : "0";
28505
- tblPr["@_lastCol"] = tableData.lastCol ? "1" : "0";
28602
+ const setOrDelete = (key, truthy) => {
28603
+ if (truthy) {
28604
+ tblPr[key] = "1";
28605
+ } else {
28606
+ delete tblPr[key];
28607
+ }
28608
+ };
28609
+ setOrDelete("@_bandRow", tableData.bandedRows);
28610
+ setOrDelete("@_bandCol", tableData.bandedColumns);
28611
+ setOrDelete("@_firstRow", tableData.firstRowHeader);
28612
+ setOrDelete("@_lastRow", tableData.lastRow);
28613
+ setOrDelete("@_firstCol", tableData.firstCol);
28614
+ setOrDelete("@_lastCol", tableData.lastCol);
28615
+ if (tableData.tableStyleId) {
28616
+ tblPr["a:tableStyleId"] = tableData.tableStyleId;
28617
+ } else if (!tblPr["a:tableStyleId"]) {
28618
+ tblPr["a:tableStyleId"] = DEFAULT_POWERPOINT_TABLE_STYLE_ID;
28619
+ }
28506
28620
  tbl["a:tblPr"] = tblPr;
28507
28621
  }
28508
28622
  function replaceFirstTextValueInTree(node, localName, newValue, getXmlLocalName) {
@@ -28547,7 +28661,9 @@ function createDefaultXmlCell() {
28547
28661
  "a:bodyPr": {},
28548
28662
  "a:lstStyle": {},
28549
28663
  "a:p": {
28550
- "a:endParaRPr": { "@_lang": "en-US" }
28664
+ // Match PowerPoint's "Insert Table" default: every paragraph-end
28665
+ // run carries `lang="en-US" dirty="0"`.
28666
+ "a:endParaRPr": { "@_lang": "en-US", "@_dirty": "0" }
28551
28667
  }
28552
28668
  },
28553
28669
  "a:tcPr": {}
@@ -28555,6 +28671,11 @@ function createDefaultXmlCell() {
28555
28671
  }
28556
28672
 
28557
28673
  // src/core/core/runtime/table-xml-rebuild.ts
28674
+ var GRID_COL_ID_EXT_URI = "{9D8B030D-6E8A-4147-A177-3AD203B41FA5}";
28675
+ var A16_NAMESPACE = "http://schemas.microsoft.com/office/drawing/2014/main";
28676
+ function randomColumnId() {
28677
+ return String(Math.floor(Math.random() * 4294967295));
28678
+ }
28558
28679
  function rebuildTableXmlFromData(tbl, tableData, emuPerPx, ensureArrayFn) {
28559
28680
  const existingXmlRows = ensureArrayFn(tbl["a:tr"]);
28560
28681
  const existingGridCols = ensureArrayFn(
@@ -28563,8 +28684,31 @@ function rebuildTableXmlFromData(tbl, tableData, emuPerPx, ensureArrayFn) {
28563
28684
  const totalWidthEmu = existingGridCols.reduce((sum, col) => {
28564
28685
  return sum + (parseInt(String(col?.["@_w"] || "0"), 10) || 0);
28565
28686
  }, 0) || 9144e3;
28566
- const newGridCols = tableData.columnWidths.map((w) => ({
28567
- "@_w": String(Math.round(w * totalWidthEmu))
28687
+ const existingColIds = existingGridCols.map((col) => {
28688
+ const extList = col?.["a:extLst"];
28689
+ const exts = Array.isArray(extList?.["a:ext"]) ? extList["a:ext"] : extList?.["a:ext"] ? [extList["a:ext"]] : [];
28690
+ for (const ext of exts) {
28691
+ if (ext?.["@_uri"] === GRID_COL_ID_EXT_URI) {
28692
+ const colId = ext["a16:colId"];
28693
+ const val = colId?.["@_val"];
28694
+ if (typeof val === "string" && val.length > 0) {
28695
+ return val;
28696
+ }
28697
+ }
28698
+ }
28699
+ return "";
28700
+ });
28701
+ const newGridCols = tableData.columnWidths.map((w, i) => ({
28702
+ "@_w": String(Math.round(w * totalWidthEmu)),
28703
+ "a:extLst": {
28704
+ "a:ext": {
28705
+ "@_uri": GRID_COL_ID_EXT_URI,
28706
+ "a16:colId": {
28707
+ "@_xmlns:a16": A16_NAMESPACE,
28708
+ "@_val": existingColIds[i] || randomColumnId()
28709
+ }
28710
+ }
28711
+ }
28568
28712
  }));
28569
28713
  if (!tbl["a:tblGrid"]) {
28570
28714
  tbl["a:tblGrid"] = {};
@@ -30974,6 +31118,9 @@ var PptxHandlerRuntime32 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
30974
31118
  if (!shape && el.type === "ink") {
30975
31119
  shape = this.createInkShapeXml(el);
30976
31120
  }
31121
+ if (!shape && el.type === "table") {
31122
+ shape = this.createTableGraphicFrameXml(el);
31123
+ }
30977
31124
  if (!shape) {
30978
31125
  this.compatibilityService.reportWarning({
30979
31126
  code: "SAVE_ELEMENT_SKIPPED",
@@ -5162,7 +5162,11 @@ function isoNow() {
5162
5162
  return (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+Z$/, "Z");
5163
5163
  }
5164
5164
  var STANDARD_LAYOUTS = [
5165
- { name: "Title Slide", type: "ctrTitle" },
5165
+ // `type` is ST_SlideLayoutType per ECMA-376 §19.7.15. The Title Slide
5166
+ // layout uses `title`; `ctrTitle` is a placeholder type (ST_PlaceholderType)
5167
+ // and is not valid here — PowerPoint's OPC loader rejects the package
5168
+ // with ERROR_FILE_CORRUPT (0x80070570) when it sees it.
5169
+ { name: "Title Slide", type: "title" },
5166
5170
  { name: "Title and Content", type: "obj" },
5167
5171
  { name: "Section Header", type: "secHead" },
5168
5172
  { name: "Two Content", type: "twoObj" },
@@ -5196,7 +5200,7 @@ ${slideOverrides}
5196
5200
  <Override PartName="/ppt/viewProps.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"/>
5197
5201
  <Override PartName="/ppt/tableStyles.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"/>
5198
5202
  <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
5199
- <Override PartName="/docProps/app.xml" ContentType="application/vnd.ms-officedocument.extended-properties+xml"/>
5203
+ <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
5200
5204
  </Types>`;
5201
5205
  }
5202
5206
  function rootRelsXml() {
@@ -6522,9 +6526,40 @@ var PptxPresentationSlidesReconciler = class {
6522
6526
  "@_r:id": slide.rId
6523
6527
  };
6524
6528
  });
6525
- presentation["p:sldIdLst"] = slideIdList;
6526
- input.presentationData["p:presentation"] = presentation;
6529
+ input.presentationData["p:presentation"] = this.insertSlideIdListInOrder(
6530
+ presentation,
6531
+ slideIdList
6532
+ );
6533
+ }
6534
+ }
6535
+ /**
6536
+ * Return a new presentation XML object whose `p:sldIdLst` child sits in the
6537
+ * schema-mandated position (after `sldMasterIdLst` / `notesMasterIdLst` /
6538
+ * `handoutMasterIdLst`, before `sldSz`). Non-sldIdLst keys keep their
6539
+ * relative order; attribute keys (`@_...`) stay at the front.
6540
+ */
6541
+ insertSlideIdListInOrder(presentation, slideIdList) {
6542
+ const before = /* @__PURE__ */ new Set([
6543
+ "p:sldMasterIdLst",
6544
+ "p:notesMasterIdLst",
6545
+ "p:handoutMasterIdLst"
6546
+ ]);
6547
+ const rebuilt = {};
6548
+ let inserted = false;
6549
+ for (const key of Object.keys(presentation)) {
6550
+ if (key === "p:sldIdLst") {
6551
+ continue;
6552
+ }
6553
+ if (!inserted && !key.startsWith("@_") && !before.has(key)) {
6554
+ rebuilt["p:sldIdLst"] = slideIdList;
6555
+ inserted = true;
6556
+ }
6557
+ rebuilt[key] = presentation[key];
6558
+ }
6559
+ if (!inserted) {
6560
+ rebuilt["p:sldIdLst"] = slideIdList;
6527
6561
  }
6562
+ return rebuilt;
6528
6563
  }
6529
6564
  async attachNewSlide(init) {
6530
6565
  const sourceSlidePath = init.input.findSourceSlidePath(init.slide.sourceSlideId);
@@ -26781,6 +26816,55 @@ var PptxHandlerRuntime14 = class extends PptxHandlerRuntime13 {
26781
26816
 
26782
26817
  // src/core/core/runtime/PptxHandlerRuntimeSaveShapeXml.ts
26783
26818
  var PptxHandlerRuntime15 = class _PptxHandlerRuntime extends PptxHandlerRuntime14 {
26819
+ /**
26820
+ * Build a `p:graphicFrame` XML skeleton for an SDK-created table.
26821
+ *
26822
+ * Tables round-trip as `<p:graphicFrame>/<a:graphic>/<a:graphicData
26823
+ * uri=".../drawingml/2006/table">/<a:tbl>` inside `p:spTree`. When the
26824
+ * element was loaded from an existing file, `el.rawXml` already contains
26825
+ * this envelope and the downstream `serializeTableDataToXml` path
26826
+ * populates cells in place. When the element was created via the SDK
26827
+ * (`SlideBuilder.addTable`), there is no `rawXml`, so this method
26828
+ * fabricates a minimal envelope with an empty `a:tbl`. The element
26829
+ * writer then calls `serializeTableDataToXml`, which triggers
26830
+ * `rebuildTableXmlFromData` and fills in `a:tblGrid` / `a:tr` children.
26831
+ */
26832
+ createTableGraphicFrameXml(el) {
26833
+ const EMU = _PptxHandlerRuntime.EMU_PER_PX;
26834
+ const offX = String(Math.round(el.x * EMU));
26835
+ const offY = String(Math.round(el.y * EMU));
26836
+ const extCx = String(Math.round(Math.max(el.width, 1) * EMU));
26837
+ const extCy = String(Math.round(Math.max(el.height, 1) * EMU));
26838
+ const tblPr = {
26839
+ "@_firstRow": el.tableData?.firstRowHeader ? "1" : "0",
26840
+ "@_bandRow": el.tableData?.bandedRows ? "1" : "0"
26841
+ };
26842
+ if (el.tableData?.tableStyleId) {
26843
+ tblPr["a:tableStyleId"] = el.tableData.tableStyleId;
26844
+ }
26845
+ return {
26846
+ "p:nvGraphicFramePr": {
26847
+ "p:cNvPr": { "@_id": "0", "@_name": el.name || "Table" },
26848
+ "p:cNvGraphicFramePr": {
26849
+ "a:graphicFrameLocks": { "@_noGrp": "1" }
26850
+ },
26851
+ "p:nvPr": {}
26852
+ },
26853
+ "p:xfrm": {
26854
+ "a:off": { "@_x": offX, "@_y": offY },
26855
+ "a:ext": { "@_cx": extCx, "@_cy": extCy }
26856
+ },
26857
+ "a:graphic": {
26858
+ "a:graphicData": {
26859
+ "@_uri": "http://schemas.openxmlformats.org/drawingml/2006/table",
26860
+ "a:tbl": {
26861
+ "a:tblPr": tblPr,
26862
+ "a:tblGrid": {}
26863
+ }
26864
+ }
26865
+ }
26866
+ };
26867
+ }
26784
26868
  /**
26785
26869
  * Build a p:sp XML object for an ink annotation element.
26786
26870
  * Each ink path becomes a separate a:path within a:pathLst,
@@ -28262,14 +28346,15 @@ function writeCellTextFormatting(xmlCell, style, ensureArray6) {
28262
28346
  const paragraphs = ensureArray6(xmlCell["a:txBody"]?.["a:p"]);
28263
28347
  for (const paragraph of paragraphs) {
28264
28348
  const runs = ensureArray6(paragraph?.["a:r"]);
28349
+ const rebuiltRuns = [];
28350
+ let runsChanged = false;
28265
28351
  for (const run of runs) {
28266
28352
  if (!run) {
28353
+ rebuiltRuns.push(run);
28267
28354
  continue;
28268
28355
  }
28269
- if (!run["a:rPr"]) {
28270
- run["a:rPr"] = {};
28271
- }
28272
- const rPr = run["a:rPr"];
28356
+ const existingRPr = run["a:rPr"] ?? {};
28357
+ const rPr = { ...existingRPr };
28273
28358
  if (style.bold !== void 0) {
28274
28359
  rPr["@_b"] = style.bold ? "1" : "0";
28275
28360
  }
@@ -28289,6 +28374,18 @@ function writeCellTextFormatting(xmlCell, style, ensureArray6) {
28289
28374
  }
28290
28375
  };
28291
28376
  }
28377
+ const rebuilt = { "a:rPr": rPr };
28378
+ for (const key of Object.keys(run)) {
28379
+ if (key === "a:rPr") {
28380
+ continue;
28381
+ }
28382
+ rebuilt[key] = run[key];
28383
+ }
28384
+ rebuiltRuns.push(rebuilt);
28385
+ runsChanged = true;
28386
+ }
28387
+ if (runsChanged && rebuiltRuns.length > 0) {
28388
+ paragraph["a:r"] = rebuiltRuns.length === 1 ? rebuiltRuns[0] : rebuiltRuns;
28292
28389
  }
28293
28390
  }
28294
28391
  }
@@ -28310,6 +28407,9 @@ var PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
28310
28407
  const existingParagraphs = this.ensureArray(txBody["a:p"]);
28311
28408
  const firstRPr = this.ensureArray(existingParagraphs[0]?.["a:r"])[0]?.["a:rPr"];
28312
28409
  const firstPPr = existingParagraphs[0]?.["a:pPr"];
28410
+ const firstEndParaRPr = existingParagraphs[0]?.["a:endParaRPr"];
28411
+ const rPrForRun = firstRPr ? { ...firstRPr } : { "@_lang": "en-US", "@_dirty": "0" };
28412
+ const endParaRPr = firstEndParaRPr ? { ...firstEndParaRPr } : { "@_lang": "en-US", "@_dirty": "0" };
28313
28413
  const lines = text.split("\n");
28314
28414
  const paragraphs = lines.map((line) => {
28315
28415
  const paragraph = {};
@@ -28317,9 +28417,10 @@ var PptxHandlerRuntime22 = class _PptxHandlerRuntime extends PptxHandlerRuntime2
28317
28417
  paragraph["a:pPr"] = firstPPr;
28318
28418
  }
28319
28419
  paragraph["a:r"] = {
28320
- ...firstRPr ? { "a:rPr": firstRPr } : {},
28420
+ "a:rPr": rPrForRun,
28321
28421
  "a:t": line
28322
28422
  };
28423
+ paragraph["a:endParaRPr"] = endParaRPr;
28323
28424
  return paragraph;
28324
28425
  });
28325
28426
  txBody["a:p"] = paragraphs.length === 1 ? paragraphs[0] : paragraphs;
@@ -28469,14 +28570,27 @@ function serializeCellMergeAttributes(xmlCell, cell) {
28469
28570
  delete xmlCell["@_vMerge"];
28470
28571
  }
28471
28572
  }
28573
+ var DEFAULT_POWERPOINT_TABLE_STYLE_ID = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
28472
28574
  function serializeTablePropertyFlags(tbl, tableData) {
28473
28575
  const tblPr = tbl["a:tblPr"] ?? {};
28474
- tblPr["@_bandRow"] = tableData.bandedRows ? "1" : "0";
28475
- tblPr["@_bandCol"] = tableData.bandedColumns ? "1" : "0";
28476
- tblPr["@_firstRow"] = tableData.firstRowHeader ? "1" : "0";
28477
- tblPr["@_lastRow"] = tableData.lastRow ? "1" : "0";
28478
- tblPr["@_firstCol"] = tableData.firstCol ? "1" : "0";
28479
- tblPr["@_lastCol"] = tableData.lastCol ? "1" : "0";
28576
+ const setOrDelete = (key, truthy) => {
28577
+ if (truthy) {
28578
+ tblPr[key] = "1";
28579
+ } else {
28580
+ delete tblPr[key];
28581
+ }
28582
+ };
28583
+ setOrDelete("@_bandRow", tableData.bandedRows);
28584
+ setOrDelete("@_bandCol", tableData.bandedColumns);
28585
+ setOrDelete("@_firstRow", tableData.firstRowHeader);
28586
+ setOrDelete("@_lastRow", tableData.lastRow);
28587
+ setOrDelete("@_firstCol", tableData.firstCol);
28588
+ setOrDelete("@_lastCol", tableData.lastCol);
28589
+ if (tableData.tableStyleId) {
28590
+ tblPr["a:tableStyleId"] = tableData.tableStyleId;
28591
+ } else if (!tblPr["a:tableStyleId"]) {
28592
+ tblPr["a:tableStyleId"] = DEFAULT_POWERPOINT_TABLE_STYLE_ID;
28593
+ }
28480
28594
  tbl["a:tblPr"] = tblPr;
28481
28595
  }
28482
28596
  function replaceFirstTextValueInTree(node, localName, newValue, getXmlLocalName) {
@@ -28521,7 +28635,9 @@ function createDefaultXmlCell() {
28521
28635
  "a:bodyPr": {},
28522
28636
  "a:lstStyle": {},
28523
28637
  "a:p": {
28524
- "a:endParaRPr": { "@_lang": "en-US" }
28638
+ // Match PowerPoint's "Insert Table" default: every paragraph-end
28639
+ // run carries `lang="en-US" dirty="0"`.
28640
+ "a:endParaRPr": { "@_lang": "en-US", "@_dirty": "0" }
28525
28641
  }
28526
28642
  },
28527
28643
  "a:tcPr": {}
@@ -28529,6 +28645,11 @@ function createDefaultXmlCell() {
28529
28645
  }
28530
28646
 
28531
28647
  // src/core/core/runtime/table-xml-rebuild.ts
28648
+ var GRID_COL_ID_EXT_URI = "{9D8B030D-6E8A-4147-A177-3AD203B41FA5}";
28649
+ var A16_NAMESPACE = "http://schemas.microsoft.com/office/drawing/2014/main";
28650
+ function randomColumnId() {
28651
+ return String(Math.floor(Math.random() * 4294967295));
28652
+ }
28532
28653
  function rebuildTableXmlFromData(tbl, tableData, emuPerPx, ensureArrayFn) {
28533
28654
  const existingXmlRows = ensureArrayFn(tbl["a:tr"]);
28534
28655
  const existingGridCols = ensureArrayFn(
@@ -28537,8 +28658,31 @@ function rebuildTableXmlFromData(tbl, tableData, emuPerPx, ensureArrayFn) {
28537
28658
  const totalWidthEmu = existingGridCols.reduce((sum, col) => {
28538
28659
  return sum + (parseInt(String(col?.["@_w"] || "0"), 10) || 0);
28539
28660
  }, 0) || 9144e3;
28540
- const newGridCols = tableData.columnWidths.map((w) => ({
28541
- "@_w": String(Math.round(w * totalWidthEmu))
28661
+ const existingColIds = existingGridCols.map((col) => {
28662
+ const extList = col?.["a:extLst"];
28663
+ const exts = Array.isArray(extList?.["a:ext"]) ? extList["a:ext"] : extList?.["a:ext"] ? [extList["a:ext"]] : [];
28664
+ for (const ext of exts) {
28665
+ if (ext?.["@_uri"] === GRID_COL_ID_EXT_URI) {
28666
+ const colId = ext["a16:colId"];
28667
+ const val = colId?.["@_val"];
28668
+ if (typeof val === "string" && val.length > 0) {
28669
+ return val;
28670
+ }
28671
+ }
28672
+ }
28673
+ return "";
28674
+ });
28675
+ const newGridCols = tableData.columnWidths.map((w, i) => ({
28676
+ "@_w": String(Math.round(w * totalWidthEmu)),
28677
+ "a:extLst": {
28678
+ "a:ext": {
28679
+ "@_uri": GRID_COL_ID_EXT_URI,
28680
+ "a16:colId": {
28681
+ "@_xmlns:a16": A16_NAMESPACE,
28682
+ "@_val": existingColIds[i] || randomColumnId()
28683
+ }
28684
+ }
28685
+ }
28542
28686
  }));
28543
28687
  if (!tbl["a:tblGrid"]) {
28544
28688
  tbl["a:tblGrid"] = {};
@@ -30948,6 +31092,9 @@ var PptxHandlerRuntime32 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
30948
31092
  if (!shape && el.type === "ink") {
30949
31093
  shape = this.createInkShapeXml(el);
30950
31094
  }
31095
+ if (!shape && el.type === "table") {
31096
+ shape = this.createTableGraphicFrameXml(el);
31097
+ }
30951
31098
  if (!shape) {
30952
31099
  this.compatibilityService.reportWarning({
30953
31100
  code: "SAVE_ELEMENT_SKIPPED",
@@ -1,6 +1,6 @@
1
- import { T as TextSegmentRenderer } from '../SvgExporter-Dq_2eV_r.mjs';
2
- export { C as ConversionOptions, a as ConversionResult, D as DocumentConverter, F as FileSystemAdapter, M as MediaContext, P as PptxConverterOptions, b as PptxMarkdownConverter, S as SlideProcessor, c as SlideProcessorOptions, d as SvgExportOptions, e as SvgExporter, f as dataUrlToMediaBytes, g as deriveOutputPath, h as generateMediaFilename, i as getDirectory, n as normalizePath } from '../SvgExporter-Dq_2eV_r.mjs';
3
- import { l as PptxSlide } from '../presentation-BozkirFp.mjs';
1
+ import { T as TextSegmentRenderer } from '../SvgExporter-z6AbXRQg.mjs';
2
+ export { C as ConversionOptions, a as ConversionResult, D as DocumentConverter, F as FileSystemAdapter, M as MediaContext, P as PptxConverterOptions, b as PptxMarkdownConverter, S as SlideProcessor, c as SlideProcessorOptions, d as SvgExportOptions, e as SvgExporter, f as dataUrlToMediaBytes, g as deriveOutputPath, h as generateMediaFilename, i as getDirectory, n as normalizePath } from '../SvgExporter-z6AbXRQg.mjs';
3
+ import { l as PptxSlide } from '../presentation-CchuDGfU.mjs';
4
4
 
5
5
  /**
6
6
  * Renders slide-level metadata sections (transition, animations,
@@ -1,6 +1,6 @@
1
- import { T as TextSegmentRenderer } from '../SvgExporter--H1PDfAY.js';
2
- export { C as ConversionOptions, a as ConversionResult, D as DocumentConverter, F as FileSystemAdapter, M as MediaContext, P as PptxConverterOptions, b as PptxMarkdownConverter, S as SlideProcessor, c as SlideProcessorOptions, d as SvgExportOptions, e as SvgExporter, f as dataUrlToMediaBytes, g as deriveOutputPath, h as generateMediaFilename, i as getDirectory, n as normalizePath } from '../SvgExporter--H1PDfAY.js';
3
- import { l as PptxSlide } from '../presentation-BozkirFp.js';
1
+ import { T as TextSegmentRenderer } from '../SvgExporter-BMjoxMDV.js';
2
+ export { C as ConversionOptions, a as ConversionResult, D as DocumentConverter, F as FileSystemAdapter, M as MediaContext, P as PptxConverterOptions, b as PptxMarkdownConverter, S as SlideProcessor, c as SlideProcessorOptions, d as SvgExportOptions, e as SvgExporter, f as dataUrlToMediaBytes, g as deriveOutputPath, h as generateMediaFilename, i as getDirectory, n as normalizePath } from '../SvgExporter-BMjoxMDV.js';
3
+ import { l as PptxSlide } from '../presentation-CchuDGfU.js';
4
4
 
5
5
  /**
6
6
  * Renders slide-level metadata sections (transition, animations,