@aixa-transformation/pptx-viewer 2.0.3 → 2.0.15

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,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkCHHLFKT6_js = require('./chunk-CHHLFKT6.js');
4
- require('./chunk-ODMFBYAP.js');
3
+ var chunkIVCWQLQK_js = require('./chunk-IVCWQLQK.js');
4
+ require('./chunk-KAP5TS7O.js');
5
5
  require('./chunk-QGM4M3NI.js');
6
6
  var react = require('react');
7
7
  var jsxRuntime = require('react/jsx-runtime');
@@ -15,7 +15,7 @@ function Model3DScene({ modelUrl, interactive, width, height }) {
15
15
  return;
16
16
  }
17
17
  let disposed = false;
18
- void chunkCHHLFKT6_js.mountModel3D(container, modelUrl, { width, height, interactive }).then((handle) => {
18
+ void chunkIVCWQLQK_js.mountModel3D(container, modelUrl, { width, height, interactive }).then((handle) => {
19
19
  if (disposed) {
20
20
  handle.dispose();
21
21
  } else {
@@ -1,5 +1,5 @@
1
- import { mountModel3D } from './chunk-34H7NGLC.mjs';
2
- import './chunk-7H2BJF4H.mjs';
1
+ import { mountModel3D } from './chunk-4ZF7B5WU.mjs';
2
+ import './chunk-C36MFNDN.mjs';
3
3
  import './chunk-6DZX6EAA.mjs';
4
4
  import { useRef, useEffect } from 'react';
5
5
  import { jsx } from 'react/jsx-runtime';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkCHHLFKT6_js = require('./chunk-CHHLFKT6.js');
4
- require('./chunk-ODMFBYAP.js');
3
+ var chunkIVCWQLQK_js = require('./chunk-IVCWQLQK.js');
4
+ require('./chunk-KAP5TS7O.js');
5
5
  require('./chunk-QGM4M3NI.js');
6
6
  var react = require('react');
7
7
  var jsxRuntime = require('react/jsx-runtime');
@@ -26,7 +26,7 @@ function SurfaceChart3DScene({
26
26
  return;
27
27
  }
28
28
  let disposed = false;
29
- void chunkCHHLFKT6_js.mountSurfaceChart3D(container, {
29
+ void chunkIVCWQLQK_js.mountSurfaceChart3D(container, {
30
30
  cols,
31
31
  rows,
32
32
  heightMap,
@@ -1,5 +1,5 @@
1
- import { mountSurfaceChart3D } from './chunk-34H7NGLC.mjs';
2
- import './chunk-7H2BJF4H.mjs';
1
+ import { mountSurfaceChart3D } from './chunk-4ZF7B5WU.mjs';
2
+ import './chunk-C36MFNDN.mjs';
3
3
  import './chunk-6DZX6EAA.mjs';
4
4
  import { useRef, useEffect } from 'react';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -1,4 +1,4 @@
1
- import { THEME_PRESETS, MIN_ELEMENT_SIZE, guideEmuToPx, hasShapeProperties, THEME_COLOR_SCHEME_KEYS, hasTextProperties, createChartElement, getShapeClipPath, getAdjustmentAwareShapeClipPath, getShapeClipPathFromPreset, getCloudPathForRendering, hslToRgb, PRESET_COLOR_MAP, isImageLikeElement, stripXmlOrderSuffix, orderedXmlKey, createBuiltinVariables, resolveCoordinate, applyDrawingColorTransforms } from './chunk-7H2BJF4H.mjs';
1
+ import { THEME_PRESETS, MIN_ELEMENT_SIZE, guideEmuToPx, hasShapeProperties, THEME_COLOR_SCHEME_KEYS, hasTextProperties, createChartElement, getShapeClipPath, getAdjustmentAwareShapeClipPath, getShapeClipPathFromPreset, getCloudPathForRendering, hslToRgb, PRESET_COLOR_MAP, isImageLikeElement, stripXmlOrderSuffix, orderedXmlKey, createBuiltinVariables, resolveCoordinate, applyDrawingColorTransforms } from './chunk-C36MFNDN.mjs';
2
2
  import DOMPurify from 'dompurify';
3
3
 
4
4
  var defaultThemeColors = {
@@ -24440,6 +24440,12 @@ var BACKSTAGE_TEMPLATES = [
24440
24440
  name: "Future Forward",
24441
24441
  description: "Clean technology storytelling",
24442
24442
  preview: "repeating-radial-gradient(ellipse at bottom, #111 0 3px, #fff 4px 13px)"
24443
+ },
24444
+ {
24445
+ id: "oasis",
24446
+ name: "Oasis",
24447
+ description: "56 editorial layouts with marble imagery",
24448
+ preview: "linear-gradient(90deg, #111111 0 48%, transparent 48%), radial-gradient(ellipse at 78% 38%, #e8c7b4 0 18%, #91b9b4 42%, #c8a38f 67%, #eee6df 100%)"
24443
24449
  }
24444
24450
  ];
24445
24451
  var TEMPLATE_BACKGROUNDS = {
@@ -42208,6 +42208,11 @@ function getSectionSlideRange(zoomElement, slides) {
42208
42208
  }
42209
42209
  var FONT_SUBSTITUTION_MAP = {
42210
42210
  // Microsoft Office default fonts
42211
+ // Aptos replaced Calibri as Office's default and is intentionally close in
42212
+ // metrics. Calibri/Calibri Light are better fidelity fallbacks than Segoe UI
42213
+ // (which is wider and makes authored one-line titles wrap).
42214
+ Aptos: ["Calibri", "Arial", "sans-serif"],
42215
+ "Aptos Display": ["Calibri Light", "Calibri", "Arial", "sans-serif"],
42211
42216
  Calibri: ["Carlito", "Liberation Sans", "Arial", "sans-serif"],
42212
42217
  "Calibri Light": ["Carlito", "Liberation Sans", "Arial", "sans-serif"],
42213
42218
  Cambria: ["Caladea", "Liberation Serif", "Times New Roman", "serif"],
@@ -55218,6 +55223,28 @@ var PptxHandlerRuntime9 = class _PptxHandlerRuntime extends PptxHandlerRuntime8
55218
55223
  if (!this.layoutXmlMap.has(layoutPath)) {
55219
55224
  this.layoutXmlMap.set(layoutPath, data);
55220
55225
  }
55226
+ if (!this.slideRelsMap.has(layoutPath)) {
55227
+ const layoutRelsPath = `${layoutPath.replace(
55228
+ "slideLayouts/",
55229
+ "slideLayouts/_rels/"
55230
+ )}.rels`;
55231
+ const layoutRelsXml2 = await this.zip.file(layoutRelsPath)?.async("string");
55232
+ if (layoutRelsXml2) {
55233
+ const layoutRelsData = this.parser.parse(layoutRelsXml2);
55234
+ const relationships = this.ensureArray(
55235
+ xmlChild(layoutRelsData, "Relationships")?.["Relationship"]
55236
+ );
55237
+ const relationshipMap = /* @__PURE__ */ new Map();
55238
+ for (const relationship of relationships) {
55239
+ const id = String(relationship["@_Id"] || "").trim();
55240
+ const target = String(relationship["@_Target"] || "").trim();
55241
+ if (id && target) {
55242
+ relationshipMap.set(id, target);
55243
+ }
55244
+ }
55245
+ this.slideRelsMap.set(layoutPath, relationshipMap);
55246
+ }
55247
+ }
55221
55248
  const layout = { path: layoutPath };
55222
55249
  const cSldName = (xmlAttr(xmlChild(sldLayout, "p:cSld"), "name") ?? "").trim();
55223
55250
  if (cSldName) {
@@ -58124,6 +58151,16 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
58124
58151
  }
58125
58152
  return type;
58126
58153
  }
58154
+ placeholderRole(phInfo) {
58155
+ const type = phInfo.type || "body";
58156
+ if (type === "title" || type === "ctrtitle") {
58157
+ return "title";
58158
+ }
58159
+ if (type === "body" || type === "obj" || type === "subtitle") {
58160
+ return "content";
58161
+ }
58162
+ return type;
58163
+ }
58127
58164
  // ── Core layout switching logic ─────────────────────────────────────
58128
58165
  /**
58129
58166
  * Re-map slide elements to a new layout's placeholders.
@@ -58162,6 +58199,15 @@ var PptxHandlerRuntime21 = class extends PptxHandlerRuntime20 {
58162
58199
  }
58163
58200
  }
58164
58201
  }
58202
+ if (!resolvedLayoutPh) {
58203
+ const sourceRole = this.placeholderRole(phInfo);
58204
+ for (const [, lp] of layoutPhMap.entries()) {
58205
+ if (!lp.matched && this.placeholderRole(lp.phInfo) === sourceRole) {
58206
+ resolvedLayoutPh = lp;
58207
+ break;
58208
+ }
58209
+ }
58210
+ }
58165
58211
  if (resolvedLayoutPh) {
58166
58212
  resolvedLayoutPh.matched = true;
58167
58213
  const updatedElement = { ...element };
@@ -67551,12 +67597,20 @@ var PptxHandlerRuntime56 = class extends PptxHandlerRuntime55 {
67551
67597
  }
67552
67598
  const phKey = this.buildPlaceholderDefaultsKey(phInfo);
67553
67599
  const layoutMap = this.layoutPlaceholderDefaultsCache.get(layoutPath);
67554
- const layoutDefaults = layoutMap?.get(phKey);
67600
+ const lookupDefaults = (map) => {
67601
+ const exact = map?.get(phKey);
67602
+ if (exact || phInfo.type !== void 0 || phInfo.idx === void 0) {
67603
+ return exact;
67604
+ }
67605
+ return map?.get(`obj_${phInfo.idx}`) ?? map?.get(`body_${phInfo.idx}`);
67606
+ };
67607
+ const layoutDefaults = lookupDefaults(layoutMap);
67555
67608
  const masterPath = this.resolveMasterPathForLayout(layoutPath);
67556
67609
  const masterMap = masterPath ? this.masterPlaceholderDefaultsCache.get(masterPath) : void 0;
67557
- const masterDefaults = masterMap?.get(phKey);
67610
+ const masterDefaults = lookupDefaults(masterMap);
67558
67611
  const normalizedType = this.buildPlaceholderDefaultsKey(phInfo).split("_")[0];
67559
- const masterTextStyleType = phInfo.type === "title" || phInfo.type === "ctrtitle" ? "title" : phInfo.type === "body" || phInfo.type === "obj" || phInfo.type === "subtitle" ? "body" : "other";
67612
+ const effectivePlaceholderType = phInfo.type ?? "obj";
67613
+ const masterTextStyleType = effectivePlaceholderType === "title" || effectivePlaceholderType === "ctrtitle" ? "title" : effectivePlaceholderType === "body" || effectivePlaceholderType === "obj" || effectivePlaceholderType === "subtitle" ? "body" : "other";
67560
67614
  const masterTextStyles = masterPath ? this.masterTxStylesCache.get(masterPath) : void 0;
67561
67615
  const masterTextLevels = masterTextStyleType === "title" ? masterTextStyles?.titleStyle : masterTextStyleType === "body" ? masterTextStyles?.bodyStyle : masterTextStyles?.otherStyle;
67562
67616
  const resolvedMasterDefaults = masterTextLevels ? {
@@ -68240,6 +68294,17 @@ var PptxHandlerRuntime58 = class _PptxHandlerRuntime24 extends PptxHandlerRuntim
68240
68294
  return void 0;
68241
68295
  }
68242
68296
  };
68297
+ function parseOoxmlPercentage(value) {
68298
+ const raw = String(value ?? "").trim();
68299
+ if (!raw) {
68300
+ return void 0;
68301
+ }
68302
+ const numeric = Number.parseFloat(raw.endsWith("%") ? raw.slice(0, -1) : raw);
68303
+ if (!Number.isFinite(numeric)) {
68304
+ return void 0;
68305
+ }
68306
+ return raw.endsWith("%") ? numeric / 100 : numeric / 1e5;
68307
+ }
68243
68308
  var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
68244
68309
  /**
68245
68310
  * Apply {@link PlaceholderDefaults} body-level properties to a
@@ -68286,12 +68351,11 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
68286
68351
  if (Number.isFinite(spacingPointsRaw)) {
68287
68352
  return this.pointsToPixels(spacingPointsRaw / 100);
68288
68353
  }
68289
- const spacingPercentRaw = Number.parseInt(
68290
- String(spacingNode["a:spcPct"]?.["@_val"] || ""),
68291
- 10
68354
+ const spacingPercent = parseOoxmlPercentage(
68355
+ spacingNode["a:spcPct"]?.["@_val"]
68292
68356
  );
68293
- if (Number.isFinite(spacingPercentRaw) && typeof basisFontSizePx === "number" && basisFontSizePx > 0) {
68294
- return spacingPercentRaw / 1e5 * basisFontSizePx;
68357
+ if (spacingPercent !== void 0 && typeof basisFontSizePx === "number" && basisFontSizePx > 0) {
68358
+ return spacingPercent * basisFontSizePx;
68295
68359
  }
68296
68360
  return void 0;
68297
68361
  }
@@ -68299,12 +68363,11 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
68299
68363
  if (!lineSpacingNode) {
68300
68364
  return void 0;
68301
68365
  }
68302
- const spacingPercentRaw = Number.parseInt(
68303
- String(lineSpacingNode["a:spcPct"]?.["@_val"] || ""),
68304
- 10
68366
+ const spacingPercent = parseOoxmlPercentage(
68367
+ lineSpacingNode["a:spcPct"]?.["@_val"]
68305
68368
  );
68306
- if (Number.isFinite(spacingPercentRaw)) {
68307
- return Math.max(0.1, Math.min(5, spacingPercentRaw / 1e5));
68369
+ if (spacingPercent !== void 0) {
68370
+ return Math.max(0.1, Math.min(5, spacingPercent));
68308
68371
  }
68309
68372
  return void 0;
68310
68373
  }
@@ -68342,8 +68405,13 @@ var PptxHandlerRuntime59 = class extends PptxHandlerRuntime58 {
68342
68405
  if (textStyle.italic === void 0 && levelStyle.italic !== void 0) {
68343
68406
  textStyle.italic = levelStyle.italic;
68344
68407
  }
68345
- if (textStyle.color === void 0 && levelStyle.color !== void 0) {
68346
- textStyle.color = levelStyle.color;
68408
+ if (textStyle.color === void 0) {
68409
+ const currentSlideColor = levelStyle.colorXml ? this.parseColor(levelStyle.colorXml) : void 0;
68410
+ if (currentSlideColor !== void 0) {
68411
+ textStyle.color = currentSlideColor;
68412
+ } else if (levelStyle.color !== void 0) {
68413
+ textStyle.color = levelStyle.color;
68414
+ }
68347
68415
  }
68348
68416
  if (textStyle.paragraphMarginLeft === void 0 && levelStyle.marginLeft !== void 0) {
68349
68417
  textStyle.paragraphMarginLeft = levelStyle.marginLeft;
@@ -69308,25 +69376,31 @@ var PptxHandlerRuntime63 = class extends PptxHandlerRuntime62 {
69308
69376
  "mc:AlternateContent",
69309
69377
  "a:br"
69310
69378
  ]);
69379
+ const paragraphRuns = this.ensureArray(p["a:r"]);
69380
+ const paragraphBreaks = this.ensureArray(p["a:br"]);
69381
+ const hasCollapsedRunBreakOrder = paragraphRuns.length > 1 && paragraphBreaks.length > 0;
69311
69382
  for (const key of Object.keys(p)) {
69312
69383
  if (!contentTagSet.has(key)) {
69313
69384
  continue;
69314
69385
  }
69315
69386
  const items = this.ensureArray(p[key]);
69316
- const rawBreaks = p["a:br"];
69317
- const breakCount = Array.isArray(rawBreaks) ? rawBreaks.length : rawBreaks === void 0 ? 0 : 1;
69318
- const insertCollapsedBreaks = key === "a:r" && items.length > 1 && breakCount > 0;
69387
+ const breakCount = paragraphBreaks.length;
69388
+ const insertCollapsedBreaks = key === "a:r" && hasCollapsedRunBreakOrder;
69319
69389
  for (const [itemIndex, item] of items.entries()) {
69320
69390
  switch (key) {
69321
69391
  case "a:r": {
69322
69392
  processRun(item);
69323
- if (insertCollapsedBreaks && itemIndex < Math.min(items.length - 1, breakCount)) {
69324
- parts.push("\n");
69325
- segments.push({
69326
- text: "\n",
69327
- style: { ...mergedDefaultRunStyle },
69328
- isLineBreak: true
69329
- });
69393
+ if (insertCollapsedBreaks && itemIndex < items.length - 1) {
69394
+ const gapCount = items.length - 1;
69395
+ const breaksHere = Math.floor(breakCount / gapCount) + (itemIndex < breakCount % gapCount ? 1 : 0);
69396
+ for (let breakIndex = 0; breakIndex < breaksHere; breakIndex++) {
69397
+ parts.push("\n");
69398
+ segments.push({
69399
+ text: "\n",
69400
+ style: { ...mergedDefaultRunStyle },
69401
+ isLineBreak: true
69402
+ });
69403
+ }
69330
69404
  }
69331
69405
  break;
69332
69406
  }
@@ -69347,7 +69421,7 @@ var PptxHandlerRuntime63 = class extends PptxHandlerRuntime62 {
69347
69421
  processAlternateContent(item);
69348
69422
  break;
69349
69423
  case "a:br": {
69350
- if (insertCollapsedBreaks) {
69424
+ if (hasCollapsedRunBreakOrder) {
69351
69425
  break;
69352
69426
  }
69353
69427
  const brNode = item ?? {};
@@ -69371,6 +69445,14 @@ var PptxHandlerRuntime63 = class extends PptxHandlerRuntime62 {
69371
69445
  }
69372
69446
  }
69373
69447
  }
69448
+ const markerSegment = segments.find((segment) => segment.bulletInfo);
69449
+ const firstVisibleRun = segments.find(
69450
+ (segment) => !segment.bulletInfo && segment.text !== "\n" && segment.text.length > 0
69451
+ );
69452
+ if (markerSegment && firstVisibleRun) {
69453
+ markerSegment.style = { ...firstVisibleRun.style };
69454
+ seedStyle = { ...firstVisibleRun.style };
69455
+ }
69374
69456
  if (pIdx < paraCount - 1) {
69375
69457
  parts.push("\n");
69376
69458
  segments.push({ text: "\n", style: { ...mergedDefaultRunStyle } });
@@ -71670,10 +71752,14 @@ var PptxHandlerRuntime72 = class _PptxHandlerRuntime31 extends PptxHandlerRuntim
71670
71752
  if (defRPr["@_i"] !== void 0) {
71671
71753
  style.italic = defRPr["@_i"] === "1";
71672
71754
  }
71673
- const color2 = this.parseColor(defRPr["a:solidFill"]);
71755
+ const colorXml2 = defRPr["a:solidFill"];
71756
+ const color2 = this.parseColor(colorXml2);
71674
71757
  if (color2) {
71675
71758
  style.color = color2;
71676
71759
  }
71760
+ if (colorXml2) {
71761
+ style.colorXml = colorXml2;
71762
+ }
71677
71763
  const latin = defRPr["a:latin"];
71678
71764
  if (latin?.["@_typeface"]) {
71679
71765
  const typeface = String(latin["@_typeface"]);