pptx-react-viewer 2.19.6 → 2.19.7

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 (90) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{AiChatPanel-IWC2BJH4.js → AiChatPanel-MAC2Z5SK.js} +23 -23
  3. package/dist/AiChatPanel-MAC2Z5SK.js.br +0 -0
  4. package/dist/AiChatPanel-MAC2Z5SK.js.gz +0 -0
  5. package/dist/{AiChatPanel-2VR6UFFK.mjs → AiChatPanel-WVO66CKC.mjs} +3 -3
  6. package/dist/AiChatPanel-WVO66CKC.mjs.br +0 -0
  7. package/dist/AiChatPanel-WVO66CKC.mjs.gz +0 -0
  8. package/dist/{Model3DScene-ATRIORJV.js → Model3DScene-CU4WGIMH.js} +2 -2
  9. package/dist/Model3DScene-CU4WGIMH.js.br +0 -0
  10. package/dist/Model3DScene-CU4WGIMH.js.gz +0 -0
  11. package/dist/{Model3DScene-E4T6KAJF.mjs → Model3DScene-PTCZUGIT.mjs} +1 -1
  12. package/dist/Model3DScene-PTCZUGIT.mjs.br +0 -0
  13. package/dist/Model3DScene-PTCZUGIT.mjs.gz +0 -0
  14. package/dist/{chunk-NHN6XKJV.mjs → chunk-5BG5BANR.mjs} +7 -7
  15. package/dist/chunk-5BG5BANR.mjs.br +0 -0
  16. package/dist/chunk-5BG5BANR.mjs.gz +0 -0
  17. package/dist/{chunk-IWCBDKPX.mjs → chunk-DZHCLAH3.mjs} +1 -1
  18. package/dist/chunk-DZHCLAH3.mjs.br +0 -0
  19. package/dist/chunk-DZHCLAH3.mjs.gz +0 -0
  20. package/dist/{chunk-KPNZXUKK.js → chunk-EVM5OFAD.js} +3 -3
  21. package/dist/chunk-EVM5OFAD.js.br +0 -0
  22. package/dist/chunk-EVM5OFAD.js.gz +0 -0
  23. package/dist/{chunk-3BK53XWF.js → chunk-GUGHIQ4P.js} +142 -31
  24. package/dist/chunk-GUGHIQ4P.js.br +0 -0
  25. package/dist/chunk-GUGHIQ4P.js.gz +0 -0
  26. package/dist/{chunk-2N2Z7WG2.js → chunk-JENKEQZP.js} +1022 -1022
  27. package/dist/chunk-JENKEQZP.js.br +0 -0
  28. package/dist/chunk-JENKEQZP.js.gz +0 -0
  29. package/dist/{chunk-VU4RQSTI.mjs → chunk-LP3Y4NXE.mjs} +2 -2
  30. package/dist/chunk-LP3Y4NXE.mjs.br +0 -0
  31. package/dist/chunk-LP3Y4NXE.mjs.gz +0 -0
  32. package/dist/{chunk-667ZAXQN.mjs → chunk-QZV7XDQG.mjs} +1 -1
  33. package/dist/chunk-QZV7XDQG.mjs.br +0 -0
  34. package/dist/chunk-QZV7XDQG.mjs.gz +0 -0
  35. package/dist/{chunk-FTUGCQVY.js → chunk-V5PW4QCE.js} +146 -146
  36. package/dist/chunk-V5PW4QCE.js.br +0 -0
  37. package/dist/chunk-V5PW4QCE.js.gz +0 -0
  38. package/dist/{chunk-YEEOYPFO.js → chunk-XDF76VFA.js} +373 -373
  39. package/dist/chunk-XDF76VFA.js.br +0 -0
  40. package/dist/chunk-XDF76VFA.js.gz +0 -0
  41. package/dist/{chunk-RQWZ7J3Z.mjs → chunk-ZPNLWBED.mjs} +142 -31
  42. package/dist/chunk-ZPNLWBED.mjs.br +0 -0
  43. package/dist/chunk-ZPNLWBED.mjs.gz +0 -0
  44. package/dist/index.js +45 -45
  45. package/dist/index.js.br +0 -0
  46. package/dist/index.js.gz +0 -0
  47. package/dist/index.mjs +5 -5
  48. package/dist/index.mjs.br +0 -0
  49. package/dist/index.mjs.gz +0 -0
  50. package/dist/internals.js +78 -78
  51. package/dist/internals.js.br +0 -0
  52. package/dist/internals.js.gz +0 -0
  53. package/dist/internals.mjs +3 -3
  54. package/dist/internals.mjs.br +0 -0
  55. package/dist/internals.mjs.gz +0 -0
  56. package/dist/viewer/index.js +26 -26
  57. package/dist/viewer/index.js.br +0 -0
  58. package/dist/viewer/index.js.gz +0 -0
  59. package/dist/viewer/index.mjs +5 -5
  60. package/dist/viewer/index.mjs.br +0 -0
  61. package/dist/viewer/index.mjs.gz +0 -0
  62. package/package.json +1 -1
  63. package/dist/AiChatPanel-2VR6UFFK.mjs.br +0 -0
  64. package/dist/AiChatPanel-2VR6UFFK.mjs.gz +0 -0
  65. package/dist/AiChatPanel-IWC2BJH4.js.br +0 -0
  66. package/dist/AiChatPanel-IWC2BJH4.js.gz +0 -0
  67. package/dist/Model3DScene-ATRIORJV.js.br +0 -0
  68. package/dist/Model3DScene-ATRIORJV.js.gz +0 -0
  69. package/dist/Model3DScene-E4T6KAJF.mjs.br +0 -0
  70. package/dist/Model3DScene-E4T6KAJF.mjs.gz +0 -0
  71. package/dist/chunk-2N2Z7WG2.js.br +0 -0
  72. package/dist/chunk-2N2Z7WG2.js.gz +0 -0
  73. package/dist/chunk-3BK53XWF.js.br +0 -0
  74. package/dist/chunk-3BK53XWF.js.gz +0 -0
  75. package/dist/chunk-667ZAXQN.mjs.br +0 -0
  76. package/dist/chunk-667ZAXQN.mjs.gz +0 -0
  77. package/dist/chunk-FTUGCQVY.js.br +0 -0
  78. package/dist/chunk-FTUGCQVY.js.gz +0 -0
  79. package/dist/chunk-IWCBDKPX.mjs.br +0 -0
  80. package/dist/chunk-IWCBDKPX.mjs.gz +0 -0
  81. package/dist/chunk-KPNZXUKK.js.br +0 -0
  82. package/dist/chunk-KPNZXUKK.js.gz +0 -0
  83. package/dist/chunk-NHN6XKJV.mjs.br +0 -0
  84. package/dist/chunk-NHN6XKJV.mjs.gz +0 -0
  85. package/dist/chunk-RQWZ7J3Z.mjs.br +0 -0
  86. package/dist/chunk-RQWZ7J3Z.mjs.gz +0 -0
  87. package/dist/chunk-VU4RQSTI.mjs.br +0 -0
  88. package/dist/chunk-VU4RQSTI.mjs.gz +0 -0
  89. package/dist/chunk-YEEOYPFO.js.br +0 -0
  90. package/dist/chunk-YEEOYPFO.js.gz +0 -0
@@ -20980,9 +20980,9 @@ function applyDrawingColorTransforms(baseColor, colorNode) {
20980
20980
  }
20981
20981
  const tint3 = parseDrawingPercent(getVal("a:tint"));
20982
20982
  if (tint3 !== void 0) {
20983
- r += (255 - r) * tint3;
20984
- g += (255 - g) * tint3;
20985
- b += (255 - b) * tint3;
20983
+ r = 255 - (255 - r) * tint3;
20984
+ g = 255 - (255 - g) * tint3;
20985
+ b = 255 - (255 - b) * tint3;
20986
20986
  }
20987
20987
  const hslKeys = [
20988
20988
  "a:hue",
@@ -27508,7 +27508,7 @@ function guidToKey(guid) {
27508
27508
  }
27509
27509
  const key2 = new Uint8Array(KEY_LENGTH);
27510
27510
  for (let i = 0; i < KEY_LENGTH; i++) {
27511
- key2[i] = parseInt(stripped.substring(i * 2, i * 2 + 2), 16);
27511
+ key2[KEY_LENGTH - 1 - i] = parseInt(stripped.substring(i * 2, i * 2 + 2), 16);
27512
27512
  }
27513
27513
  return key2;
27514
27514
  }
@@ -56172,11 +56172,6 @@ var PptxHandlerRuntime11 = class extends PptxHandlerRuntime10 {
56172
56172
  if (requestedSourcePath && this.slideMap.has(requestedSourcePath) && requestedSourcePath.startsWith("ppt/slides/slide")) {
56173
56173
  return requestedSourcePath;
56174
56174
  }
56175
- for (const slidePath of this.slideMap.keys()) {
56176
- if (slidePath.startsWith("ppt/slides/slide")) {
56177
- return slidePath;
56178
- }
56179
- }
56180
56175
  return void 0;
56181
56176
  }
56182
56177
  async loadSlideRelationships(slidePath, relsPath) {
@@ -56216,8 +56211,7 @@ var PptxHandlerRuntime11 = class extends PptxHandlerRuntime10 {
56216
56211
  }
56217
56212
  const cSld = pSld["p:cSld"];
56218
56213
  if (!cSld["p:spTree"]) {
56219
- const emptySlide = this.createEmptySlideXml();
56220
- const emptyTree = emptySlide["p:sld"]?.["p:cSld"]?.["p:spTree"];
56214
+ const emptySlide = this.createEmptySlideXml(), emptyTree = emptySlide["p:sld"]?.["p:cSld"]?.["p:spTree"];
56221
56215
  if (emptyTree) {
56222
56216
  cSld["p:spTree"] = emptyTree;
56223
56217
  }
@@ -59016,13 +59010,32 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
59016
59010
  const nvPr = xmlPath(raw, "p:nvSpPr", "p:nvPr") ?? xmlPath(raw, "p:nvPicPr", "p:nvPr") ?? xmlPath(raw, "p:nvGraphicFramePr", "p:nvPr");
59017
59011
  return this.readPlaceholderInfoFromNvPr(nvPr);
59018
59012
  }
59013
+ /**
59014
+ * Whether a placeholder element is still an untouched prompt ("Click to
59015
+ * add text") rather than real user content. Only `type: 'text'`
59016
+ * placeholders can be untouched this way: `createEmptyPlaceholderElement`
59017
+ * only ever fabricates that kind, and any other kind (picture, table,
59018
+ * chart, ...) implies the user already put something in it.
59019
+ */
59020
+ isUntouchedPlaceholderPrompt(element) {
59021
+ if (element.type !== "text") {
59022
+ return false;
59023
+ }
59024
+ if (element.text && element.text.trim().length > 0) {
59025
+ return false;
59026
+ }
59027
+ return !element.textSegments?.some((segment) => segment.text.trim().length > 0);
59028
+ }
59019
59029
  // ── Layout placeholder extraction ───────────────────────────────────
59020
59030
  /**
59021
- * Extract all placeholders from a layout's `p:spTree`, returning
59022
- * their placeholder info and their transform (position/size in EMU).
59031
+ * Extract placeholder info + transform (position/size in EMU) for every
59032
+ * placeholder shape in a `p:spTree`. Shared by layout and master
59033
+ * extraction so a layout slot that omits `a:xfrm` (common: only the first
59034
+ * placeholder of a family typically carries one, the rest inherit
59035
+ * position/size from the matching master placeholder) can be resolved
59036
+ * against the same shape of the master.
59023
59037
  */
59024
- extractLayoutPlaceholders(layoutXml) {
59025
- const spTree = xmlPath(layoutXml, "p:sldLayout", "p:cSld", "p:spTree");
59038
+ extractPlaceholderSlotsFromSpTree(spTree) {
59026
59039
  if (!spTree) {
59027
59040
  return [];
59028
59041
  }
@@ -59050,6 +59063,103 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
59050
59063
  }
59051
59064
  return result;
59052
59065
  }
59066
+ /**
59067
+ * Resolve a layout's slideMaster path from its `.rels` map. Mirrors
59068
+ * `PptxHandlerRuntimeLoadPipeline.findMasterPathForLayout` under a
59069
+ * distinct name: that mixin sits higher in the chain and is not yet
59070
+ * available at this level, and reusing its exact name here would collide
59071
+ * across the mixin chain (TypeScript requires consistent member
59072
+ * visibility for same-named members across the whole prototype chain).
59073
+ */
59074
+ resolveMasterPathForNewLayout(layoutPath) {
59075
+ const layoutRels = this.slideRelsMap.get(layoutPath);
59076
+ if (!layoutRels) {
59077
+ return void 0;
59078
+ }
59079
+ for (const [, target] of layoutRels.entries()) {
59080
+ if (target.includes("slideMaster")) {
59081
+ const layoutDir = layoutPath.substring(0, layoutPath.lastIndexOf("/") + 1);
59082
+ if (target.startsWith("..")) {
59083
+ const segments = (layoutDir + target).split("/");
59084
+ const stack = [];
59085
+ for (const seg of segments) {
59086
+ if (seg === "..") {
59087
+ stack.pop();
59088
+ } else if (seg && seg !== ".") {
59089
+ stack.push(seg);
59090
+ }
59091
+ }
59092
+ return stack.join("/");
59093
+ }
59094
+ return `ppt/${stripParentDirSegments(target)}`;
59095
+ }
59096
+ }
59097
+ return void 0;
59098
+ }
59099
+ /**
59100
+ * Find the master placeholder slot a layout slot inherits its geometry
59101
+ * from when the layout shape itself carries no `a:xfrm`. Prefers an idx
59102
+ * match (the common case: layout and master share idx for ordinary
59103
+ * title/body placeholders); falls back to a type match (with the
59104
+ * ctrTitle->title / subTitle->body aliasing `placeholderMatches` also
59105
+ * applies) since idx is not guaranteed to line up for every family.
59106
+ */
59107
+ findMasterSlotForLayoutSlot(masterSlots, layoutPhInfo) {
59108
+ if (layoutPhInfo.idx !== void 0) {
59109
+ const byIdx = masterSlots.find((slot) => slot.phInfo.idx === layoutPhInfo.idx);
59110
+ if (byIdx) {
59111
+ return byIdx;
59112
+ }
59113
+ }
59114
+ if (!layoutPhInfo.type) {
59115
+ return void 0;
59116
+ }
59117
+ const aliasedType = layoutPhInfo.type === "ctrtitle" ? "title" : layoutPhInfo.type === "subtitle" ? "body" : layoutPhInfo.type;
59118
+ return masterSlots.find(
59119
+ (slot) => slot.phInfo.type === layoutPhInfo.type || slot.phInfo.type === aliasedType
59120
+ );
59121
+ }
59122
+ /**
59123
+ * Extract all placeholders from a layout's `p:spTree`, returning their
59124
+ * placeholder info and transform (position/size in EMU). A slot whose
59125
+ * layout shape has no `a:xfrm` (inheriting position/size from the master
59126
+ * instead) resolves its geometry against the matching master placeholder
59127
+ * rather than reporting an all-zero transform.
59128
+ */
59129
+ extractLayoutPlaceholders(layoutXml, layoutPath) {
59130
+ const spTree = xmlPath(layoutXml, "p:sldLayout", "p:cSld", "p:spTree");
59131
+ const slots = this.extractPlaceholderSlotsFromSpTree(spTree);
59132
+ if (slots.length === 0 || !layoutPath) {
59133
+ return slots;
59134
+ }
59135
+ const needsMasterGeometry = slots.some((slot) => slot.cxEmu <= 0 || slot.cyEmu <= 0);
59136
+ if (!needsMasterGeometry) {
59137
+ return slots;
59138
+ }
59139
+ const masterPath = this.resolveMasterPathForNewLayout(layoutPath);
59140
+ const masterXml = masterPath ? this.masterXmlMap.get(masterPath) : void 0;
59141
+ const masterSpTree = xmlPath(masterXml, "p:sldMaster", "p:cSld", "p:spTree");
59142
+ const masterSlots = this.extractPlaceholderSlotsFromSpTree(masterSpTree);
59143
+ if (masterSlots.length === 0) {
59144
+ return slots;
59145
+ }
59146
+ return slots.map((slot) => {
59147
+ if (slot.cxEmu > 0 && slot.cyEmu > 0) {
59148
+ return slot;
59149
+ }
59150
+ const masterSlot = this.findMasterSlotForLayoutSlot(masterSlots, slot.phInfo);
59151
+ if (!masterSlot || masterSlot.cxEmu <= 0 || masterSlot.cyEmu <= 0) {
59152
+ return slot;
59153
+ }
59154
+ return {
59155
+ ...slot,
59156
+ xEmu: masterSlot.xEmu,
59157
+ yEmu: masterSlot.yEmu,
59158
+ cxEmu: masterSlot.cxEmu,
59159
+ cyEmu: masterSlot.cyEmu
59160
+ };
59161
+ });
59162
+ }
59053
59163
  // ── Core layout switching logic ─────────────────────────────────────
59054
59164
  /**
59055
59165
  * Re-map slide elements to a new layout's placeholders.
@@ -59066,7 +59176,10 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
59066
59176
  * @returns The updated elements array.
59067
59177
  */
59068
59178
  remapElementsToNewLayout(elements2, newLayoutXml, newLayoutPath) {
59069
- const targets = this.extractLayoutPlaceholders(newLayoutXml).map((slot) => ({ ...slot, matched: false }));
59179
+ const targets = this.extractLayoutPlaceholders(newLayoutXml, newLayoutPath).map((slot) => ({
59180
+ ...slot,
59181
+ matched: false
59182
+ }));
59070
59183
  const resultElements = [];
59071
59184
  for (const element of elements2) {
59072
59185
  const phInfo = this.getElementPlaceholderInfo(element);
@@ -59111,7 +59224,7 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
59111
59224
  retargetPlaceholder(updatedElement.rawXml, resolvedLayoutPh.phInfo);
59112
59225
  }
59113
59226
  resultElements.push(updatedElement);
59114
- } else {
59227
+ } else if (!this.isUntouchedPlaceholderPrompt(element)) {
59115
59228
  resultElements.push(element);
59116
59229
  }
59117
59230
  }
@@ -68838,6 +68951,7 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime18 extends PptxHandlerRuntim
68838
68951
  this.zip.file(relsPath, this.builder.build(relsData));
68839
68952
  }
68840
68953
  };
68954
+ var SPECIAL_PLACEHOLDER_TYPES = /* @__PURE__ */ new Set(["dt", "ftr", "hdr", "sldnum"]);
68841
68955
  var PptxHandlerRuntime52 = class _PptxHandlerRuntime19 extends PptxHandlerRuntime51 {
68842
68956
  /**
68843
68957
  * Parse media data (video/audio path and MIME type) from graphic frame data.
@@ -69066,6 +69180,9 @@ var PptxHandlerRuntime52 = class _PptxHandlerRuntime19 extends PptxHandlerRuntim
69066
69180
  if (source.type && target.type && !typesMatch) {
69067
69181
  return false;
69068
69182
  }
69183
+ if (source.type && SPECIAL_PLACEHOLDER_TYPES.has(source.type) && !target.type || target.type && SPECIAL_PLACEHOLDER_TYPES.has(target.type) && !source.type) {
69184
+ return false;
69185
+ }
69069
69186
  const bothHaveExplicitIdx = source.idx !== void 0 && target.idx !== void 0;
69070
69187
  if (!bothHaveExplicitIdx && source.type && !target.type) {
69071
69188
  return false;
@@ -107474,9 +107591,9 @@ function rgbToHex4(r, g, b) {
107474
107591
  function tintColor(hex4, tintFactor) {
107475
107592
  const { r, g, b } = hexToRgb4(hex4);
107476
107593
  return rgbToHex4(
107477
- r + (255 - r) * tintFactor,
107478
- g + (255 - g) * tintFactor,
107479
- b + (255 - b) * tintFactor
107594
+ 255 - (255 - r) * tintFactor,
107595
+ 255 - (255 - g) * tintFactor,
107596
+ 255 - (255 - b) * tintFactor
107480
107597
  );
107481
107598
  }
107482
107599
  function shadeColor(hex4, shadeFactor) {
@@ -107548,12 +107665,10 @@ function applyStyleFill(fill, colorScheme, css, fallback) {
107548
107665
  const fg = normalizeHexColor(
107549
107666
  resolveStyleFillColor(fill.pattern.foreground, colorScheme),
107550
107667
  "#000000"
107551
- );
107552
- const bg = normalizeHexColor(
107668
+ ), bg = normalizeHexColor(
107553
107669
  resolveStyleFillColor(fill.pattern.background, colorScheme),
107554
107670
  "#ffffff"
107555
- );
107556
- const svg = getPatternSvg(fill.pattern.preset, fg, bg);
107671
+ ), svg = getPatternSvg(fill.pattern.preset, fg, bg);
107557
107672
  clearBackground(css);
107558
107673
  if (svg) {
107559
107674
  css.backgroundImage = `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
@@ -107638,11 +107753,7 @@ var BEVEL_LIGHT_OFFSETS = {
107638
107753
  l: { x: 1, y: 0 }
107639
107754
  };
107640
107755
  function cell3DBevelCss(cell3D) {
107641
- const size = Math.max(cell3D.bevelHeight ?? cell3D.bevelWidth ?? 4, 1);
107642
- const dir = cell3D.lightRigDirection ?? "tl";
107643
- const off = BEVEL_LIGHT_OFFSETS[dir] ?? BEVEL_LIGHT_OFFSETS.tl;
107644
- const highlight = `inset ${off.x * size}px ${off.y * size}px ${size}px rgba(255,255,255,0.55)`;
107645
- const shadow = `inset ${-off.x * size}px ${-off.y * size}px ${size}px rgba(0,0,0,0.4)`;
107756
+ const size = Math.max(cell3D.bevelHeight ?? cell3D.bevelWidth ?? 4, 1), dir = cell3D.lightRigDirection ?? "tl", off = BEVEL_LIGHT_OFFSETS[dir] ?? BEVEL_LIGHT_OFFSETS.tl, highlight = `inset ${off.x * size}px ${off.y * size}px ${size}px rgba(255,255,255,0.55)`, shadow = `inset ${-off.x * size}px ${-off.y * size}px ${size}px rgba(0,0,0,0.4)`;
107646
107757
  return { boxShadow: `${highlight}, ${shadow}` };
107647
107758
  }
107648
107759
  function cellRunStyle(run) {
@@ -109167,7 +109278,7 @@ function getImageFitStyle(el) {
109167
109278
  const uncropped = {
109168
109279
  width: "100%",
109169
109280
  height: "100%",
109170
- objectFit: "cover"
109281
+ objectFit: "fill"
109171
109282
  };
109172
109283
  if (!isImageLikeElement(el)) {
109173
109284
  return uncropped;
@@ -130610,7 +130721,7 @@ var WEIGHT_SUFFIXES = [
130610
130721
  [/black|heavy/iu, "900"],
130611
130722
  [/bold/iu, "700"]
130612
130723
  ];
130613
- var STYLE_TOKEN = /[-_\s]*(?:thin|hairline|extralight|ultralight|light|regular|normal|book|medium|semibold|demibold|extrabold|ultrabold|black|heavy|bold|italic|oblique)+$/giu;
130724
+ var STYLE_TOKEN = /[-_\s]*(?:thin|hairline|extralight|ultralight|light|regular|normal|book|medium|semibold|demibold|extrabold|ultrabold|black|heavy|bold|italic|oblique)$/giu;
130614
130725
  function deriveCustomFontDescriptor(fileName) {
130615
130726
  const stem = fileName.replace(/\.[^.]+$/u, "");
130616
130727
  const italic = /(?:italic|oblique)(?![a-z])/iu.test(stem);
Binary file
Binary file