pptx-react-viewer 2.4.0 → 2.5.0

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 (102) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{AiChatPanel-SXYMXFYS.mjs → AiChatPanel-EMF3UYCE.mjs} +3 -3
  3. package/dist/AiChatPanel-EMF3UYCE.mjs.br +0 -0
  4. package/dist/AiChatPanel-EMF3UYCE.mjs.gz +0 -0
  5. package/dist/{AiChatPanel-HLLGXBZF.js → AiChatPanel-OHSLJNYG.js} +22 -22
  6. package/dist/AiChatPanel-OHSLJNYG.js.br +0 -0
  7. package/dist/AiChatPanel-OHSLJNYG.js.gz +0 -0
  8. package/dist/{Model3DScene-ZQBWLAMC.js → Model3DScene-ULHIJPMU.js} +2 -2
  9. package/dist/Model3DScene-ULHIJPMU.js.br +0 -0
  10. package/dist/Model3DScene-ULHIJPMU.js.gz +0 -0
  11. package/dist/{Model3DScene-IECT4RWT.mjs → Model3DScene-X6QJTWHV.mjs} +1 -1
  12. package/dist/{Model3DScene-IECT4RWT.mjs.br → Model3DScene-X6QJTWHV.mjs.br} +0 -0
  13. package/dist/Model3DScene-X6QJTWHV.mjs.gz +0 -0
  14. package/dist/{SurfaceChart3DScene-4KRMRWW6.js → SurfaceChart3DScene-K7Q5NYZ4.js} +2 -2
  15. package/dist/SurfaceChart3DScene-K7Q5NYZ4.js.br +0 -0
  16. package/dist/SurfaceChart3DScene-K7Q5NYZ4.js.gz +0 -0
  17. package/dist/{SurfaceChart3DScene-52C3IMPQ.mjs → SurfaceChart3DScene-PRCKQJQQ.mjs} +1 -1
  18. package/dist/{SurfaceChart3DScene-52C3IMPQ.mjs.br → SurfaceChart3DScene-PRCKQJQQ.mjs.br} +0 -0
  19. package/dist/SurfaceChart3DScene-PRCKQJQQ.mjs.gz +0 -0
  20. package/dist/{chunk-VEZO33T2.js → chunk-7Q7AEPO7.js} +378 -324
  21. package/dist/chunk-7Q7AEPO7.js.br +0 -0
  22. package/dist/chunk-7Q7AEPO7.js.gz +0 -0
  23. package/dist/{chunk-XSBFV6TL.js → chunk-I4AFCPUC.js} +843 -844
  24. package/dist/chunk-I4AFCPUC.js.br +0 -0
  25. package/dist/chunk-I4AFCPUC.js.gz +0 -0
  26. package/dist/{chunk-KK7FWBGO.mjs → chunk-JSFUU2BB.mjs} +7 -8
  27. package/dist/chunk-JSFUU2BB.mjs.br +0 -0
  28. package/dist/chunk-JSFUU2BB.mjs.gz +0 -0
  29. package/dist/{chunk-LRIXPSVT.mjs → chunk-LIQGO45T.mjs} +72 -18
  30. package/dist/chunk-LIQGO45T.mjs.br +0 -0
  31. package/dist/chunk-LIQGO45T.mjs.gz +0 -0
  32. package/dist/{chunk-WK56SFN7.js → chunk-LTEDT475.js} +392 -68
  33. package/dist/chunk-LTEDT475.js.br +0 -0
  34. package/dist/chunk-LTEDT475.js.gz +0 -0
  35. package/dist/{chunk-5GHLRHBR.js → chunk-MJAEB43A.js} +3 -3
  36. package/dist/chunk-MJAEB43A.js.br +0 -0
  37. package/dist/chunk-MJAEB43A.js.gz +0 -0
  38. package/dist/{chunk-5TPQJWEO.js → chunk-NVH3RIN7.js} +271 -279
  39. package/dist/chunk-NVH3RIN7.js.br +0 -0
  40. package/dist/chunk-NVH3RIN7.js.gz +0 -0
  41. package/dist/{chunk-G6Q3NXRV.mjs → chunk-TGVID6BB.mjs} +40 -48
  42. package/dist/chunk-TGVID6BB.mjs.br +0 -0
  43. package/dist/chunk-TGVID6BB.mjs.gz +0 -0
  44. package/dist/{chunk-QBZA2GMB.mjs → chunk-VOV2N3NY.mjs} +388 -69
  45. package/dist/chunk-VOV2N3NY.mjs.br +0 -0
  46. package/dist/chunk-VOV2N3NY.mjs.gz +0 -0
  47. package/dist/{chunk-Q6FC2552.mjs → chunk-WJKMTDXS.mjs} +1 -1
  48. package/dist/chunk-WJKMTDXS.mjs.br +0 -0
  49. package/dist/chunk-WJKMTDXS.mjs.gz +0 -0
  50. package/dist/index.d.ts +33 -0
  51. package/dist/index.js +34 -34
  52. package/dist/index.js.br +0 -0
  53. package/dist/index.js.gz +0 -0
  54. package/dist/index.mjs +5 -5
  55. package/dist/index.mjs.br +0 -0
  56. package/dist/index.mjs.gz +0 -0
  57. package/dist/internals.d.ts +58 -1
  58. package/dist/internals.d.ts.map +1 -1
  59. package/dist/internals.js +78 -78
  60. package/dist/internals.js.br +0 -0
  61. package/dist/internals.js.gz +0 -0
  62. package/dist/internals.mjs +3 -3
  63. package/dist/internals.mjs.br +0 -0
  64. package/dist/internals.mjs.gz +0 -0
  65. package/dist/viewer/index.d.ts +33 -0
  66. package/dist/viewer/index.js +21 -21
  67. package/dist/viewer/index.js.br +0 -0
  68. package/dist/viewer/index.js.gz +0 -0
  69. package/dist/viewer/index.mjs +5 -5
  70. package/dist/viewer/index.mjs.br +0 -0
  71. package/dist/viewer/index.mjs.gz +0 -0
  72. package/package.json +1 -1
  73. package/dist/AiChatPanel-HLLGXBZF.js.br +0 -0
  74. package/dist/AiChatPanel-HLLGXBZF.js.gz +0 -0
  75. package/dist/AiChatPanel-SXYMXFYS.mjs.br +0 -0
  76. package/dist/AiChatPanel-SXYMXFYS.mjs.gz +0 -0
  77. package/dist/Model3DScene-IECT4RWT.mjs.gz +0 -0
  78. package/dist/Model3DScene-ZQBWLAMC.js.br +0 -0
  79. package/dist/Model3DScene-ZQBWLAMC.js.gz +0 -0
  80. package/dist/SurfaceChart3DScene-4KRMRWW6.js.br +0 -0
  81. package/dist/SurfaceChart3DScene-4KRMRWW6.js.gz +0 -0
  82. package/dist/SurfaceChart3DScene-52C3IMPQ.mjs.gz +0 -0
  83. package/dist/chunk-5GHLRHBR.js.br +0 -0
  84. package/dist/chunk-5GHLRHBR.js.gz +0 -0
  85. package/dist/chunk-5TPQJWEO.js.br +0 -0
  86. package/dist/chunk-5TPQJWEO.js.gz +0 -0
  87. package/dist/chunk-G6Q3NXRV.mjs.br +0 -0
  88. package/dist/chunk-G6Q3NXRV.mjs.gz +0 -0
  89. package/dist/chunk-KK7FWBGO.mjs.br +0 -0
  90. package/dist/chunk-KK7FWBGO.mjs.gz +0 -0
  91. package/dist/chunk-LRIXPSVT.mjs.br +0 -0
  92. package/dist/chunk-LRIXPSVT.mjs.gz +0 -0
  93. package/dist/chunk-Q6FC2552.mjs.br +0 -0
  94. package/dist/chunk-Q6FC2552.mjs.gz +0 -0
  95. package/dist/chunk-QBZA2GMB.mjs.br +0 -0
  96. package/dist/chunk-QBZA2GMB.mjs.gz +0 -0
  97. package/dist/chunk-VEZO33T2.js.br +0 -0
  98. package/dist/chunk-VEZO33T2.js.gz +0 -0
  99. package/dist/chunk-WK56SFN7.js.br +0 -0
  100. package/dist/chunk-WK56SFN7.js.gz +0 -0
  101. package/dist/chunk-XSBFV6TL.js.br +0 -0
  102. package/dist/chunk-XSBFV6TL.js.gz +0 -0
@@ -17697,6 +17697,49 @@ var PptxTemplateBackgroundService = class {
17697
17697
  };
17698
17698
  }
17699
17699
  };
17700
+ function applyBackgroundFillToShapes(elements2, background) {
17701
+ for (const element of elements2) {
17702
+ if (element.type === "group" && Array.isArray(element.children)) {
17703
+ applyBackgroundFillToShapes(element.children, background);
17704
+ }
17705
+ if (!hasShapeProperties(element) || !element.shapeStyle?.useBackgroundFill) {
17706
+ continue;
17707
+ }
17708
+ applyBackground(element.shapeStyle, background);
17709
+ }
17710
+ }
17711
+ function applyBackground(style, background) {
17712
+ if (background.backgroundImage) {
17713
+ style.fillMode = "image";
17714
+ style.fillImageUrl = background.backgroundImage;
17715
+ style.fillColor = "transparent";
17716
+ style.fillOpacity = 1;
17717
+ return;
17718
+ }
17719
+ if (background.backgroundGradient) {
17720
+ style.fillMode = "gradient";
17721
+ style.fillGradient = background.backgroundGradient;
17722
+ style.fillOpacity = 1;
17723
+ return;
17724
+ }
17725
+ if (background.backgroundPattern) {
17726
+ style.fillMode = "pattern";
17727
+ style.fillPatternPreset = background.backgroundPattern.preset;
17728
+ style.fillColor = background.backgroundPattern.fgColor;
17729
+ style.fillPatternBackgroundColor = background.backgroundPattern.bgColor;
17730
+ style.fillOpacity = 1;
17731
+ return;
17732
+ }
17733
+ if (background.backgroundColor) {
17734
+ style.fillMode = "solid";
17735
+ style.fillColor = background.backgroundColor;
17736
+ style.fillOpacity = 1;
17737
+ return;
17738
+ }
17739
+ style.fillMode = "none";
17740
+ style.fillColor = "transparent";
17741
+ style.fillOpacity = 0;
17742
+ }
17700
17743
  var EMU_PER_PX3 = 914400 / 96;
17701
17744
  var EMU_PER_POS_UNIT = 12700 / 8;
17702
17745
  var P14_GUIDE_URI = "{72B1D4B2-8646-4E06-B1EF-53B0C71A9B0A}";
@@ -18324,6 +18367,12 @@ var PptxSlideLoaderService = class {
18324
18367
  const nativeAnimations = params.parseNativeAnimations(slideXmlObj);
18325
18368
  reconcileAnimationTargets(elements2, nativeAnimations, animations);
18326
18369
  const rawTiming = slideXmlObj["p:sld"]?.["p:timing"];
18370
+ applyBackgroundFillToShapes(elements2, {
18371
+ backgroundColor,
18372
+ backgroundGradient: backgroundGradient || void 0,
18373
+ backgroundImage,
18374
+ backgroundPattern
18375
+ });
18327
18376
  const drawingGuides = parseSlideDrawingGuides(slideXmlObj);
18328
18377
  const activeXControls = params.parseSlideActiveXControls(slideXmlObj);
18329
18378
  const legacyVmlElements = await loadLegacyVmlDrawings(
@@ -19491,6 +19540,61 @@ function parseConditionList(condListXml) {
19491
19540
  }
19492
19541
  return result.length > 0 ? result : void 0;
19493
19542
  }
19543
+ var TIME_NODE_EVENTS = /* @__PURE__ */ new Set(["onBegin", "onEnd", "begin", "end"]);
19544
+ function createGroupContext() {
19545
+ return { parCounter: { next: 0 } };
19546
+ }
19547
+ function conditionsStartAutomatically(cTn) {
19548
+ if (!cTn) {
19549
+ return true;
19550
+ }
19551
+ const stCondLst = cTn["p:stCondLst"];
19552
+ if (!stCondLst) {
19553
+ return true;
19554
+ }
19555
+ const conditions = ensureArray5(stCondLst["p:cond"]);
19556
+ if (conditions.length === 0) {
19557
+ return true;
19558
+ }
19559
+ for (const condition of conditions) {
19560
+ const event = condition["@_evt"] === void 0 ? void 0 : String(condition["@_evt"]);
19561
+ const hasTimeNode = condition["p:tn"] !== void 0 || condition["@_tn"] !== void 0;
19562
+ if (event !== void 0 && TIME_NODE_EVENTS.has(event) && hasTimeNode) {
19563
+ return true;
19564
+ }
19565
+ if (event !== void 0) {
19566
+ continue;
19567
+ }
19568
+ const delay = condition["@_delay"];
19569
+ if (delay !== void 0 && Number.isFinite(Number.parseInt(String(delay), 10))) {
19570
+ return true;
19571
+ }
19572
+ }
19573
+ return false;
19574
+ }
19575
+ function isMainSequence(cTn) {
19576
+ return cTn !== void 0 && String(cTn["@_nodeType"] ?? "") === "mainSeq";
19577
+ }
19578
+ function isEffectNode(cTn) {
19579
+ return cTn !== void 0 && cTn["@_presetClass"] !== void 0;
19580
+ }
19581
+ function childGroupContext(parent, cTn, options) {
19582
+ if (options.isClickLevelGroup) {
19583
+ return {
19584
+ groupAutoStart: conditionsStartAutomatically(cTn),
19585
+ parGroupIndex: parent.parGroupIndex,
19586
+ parCounter: parent.parCounter
19587
+ };
19588
+ }
19589
+ if (isEffectNode(cTn)) {
19590
+ return parent;
19591
+ }
19592
+ return {
19593
+ groupAutoStart: parent.groupAutoStart,
19594
+ parGroupIndex: parent.parCounter.next++,
19595
+ parCounter: parent.parCounter
19596
+ };
19597
+ }
19494
19598
  function extractColorAnimation(childTnList) {
19495
19599
  if (!childTnList) {
19496
19600
  return void 0;
@@ -19751,7 +19855,7 @@ var PptxNativeAnimationService = class {
19751
19855
  if (!rootPar || typeof rootPar !== "object") {
19752
19856
  return void 0;
19753
19857
  }
19754
- this.walkTimingTree(rootPar, animations, "onClick");
19858
+ this.walkTimingTree(rootPar, animations, "onClick", createGroupContext());
19755
19859
  this.parseInteractiveSequences(rootPar, animations);
19756
19860
  this.parseMediaAnimations(timing, animations);
19757
19861
  const bldLst = timing["p:bldLst"];
@@ -19800,8 +19904,11 @@ var PptxNativeAnimationService = class {
19800
19904
  * @param node - Current XML node in the timing tree.
19801
19905
  * @param animations - Mutable array to collect discovered animations.
19802
19906
  * @param currentTrigger - Inherited trigger type from parent context.
19907
+ * @param group - Click-group / effect-wrapper context inherited from the
19908
+ * parent node. See `animation-group-context` for why the flat list
19909
+ * needs it.
19803
19910
  */
19804
- walkTimingTree(node, animations, currentTrigger) {
19911
+ walkTimingTree(node, animations, currentTrigger, group = createGroupContext()) {
19805
19912
  if (!node) {
19806
19913
  return;
19807
19914
  }
@@ -19899,23 +20006,33 @@ var PptxNativeAnimationService = class {
19899
20006
  commandString: cmdInfo.commandString,
19900
20007
  textTarget: textTarget ?? void 0,
19901
20008
  cTnAttributes: roundTripAttrs,
19902
- afterEffect: afterEffectFlag
20009
+ afterEffect: afterEffectFlag,
20010
+ groupAutoStart: group.groupAutoStart,
20011
+ parGroupIndex: group.parGroupIndex
19903
20012
  });
19904
20013
  }
19905
20014
  const childTnList = cTn["p:childTnLst"];
19906
20015
  if (childTnList) {
20016
+ const isClickLevel = isMainSequence(cTn);
19907
20017
  const parallels = ensureArray5(childTnList["p:par"]);
19908
20018
  const sequences = ensureArray5(childTnList["p:seq"]);
19909
20019
  const exclusives = ensureArray5(childTnList["p:excl"]);
19910
20020
  for (const parallel of parallels) {
19911
- this.walkTimingTree(parallel, animations, trigger);
20021
+ this.walkTimingTree(
20022
+ parallel,
20023
+ animations,
20024
+ trigger,
20025
+ childGroupContext(group, parallel["p:cTn"], {
20026
+ isClickLevelGroup: isClickLevel
20027
+ })
20028
+ );
19912
20029
  }
19913
20030
  for (const sequence of sequences) {
19914
- this.walkTimingTree(sequence, animations, trigger);
20031
+ this.walkTimingTree(sequence, animations, trigger, group);
19915
20032
  }
19916
20033
  for (const excl of exclusives) {
19917
20034
  const exclAnims = [];
19918
- this.walkTimingTree(excl, exclAnims, trigger);
20035
+ this.walkTimingTree(excl, exclAnims, trigger, group);
19919
20036
  for (const a of exclAnims) {
19920
20037
  a.exclusive = true;
19921
20038
  animations.push(a);
@@ -19926,10 +20043,17 @@ var PptxNativeAnimationService = class {
19926
20043
  const directParallels = ensureArray5(node["p:par"]);
19927
20044
  const directSequences = ensureArray5(node["p:seq"]);
19928
20045
  for (const parallel of directParallels) {
19929
- this.walkTimingTree(parallel, animations, currentTrigger);
20046
+ this.walkTimingTree(
20047
+ parallel,
20048
+ animations,
20049
+ currentTrigger,
20050
+ childGroupContext(group, parallel["p:cTn"], {
20051
+ isClickLevelGroup: false
20052
+ })
20053
+ );
19930
20054
  }
19931
20055
  for (const sequence of directSequences) {
19932
- this.walkTimingTree(sequence, animations, currentTrigger);
20056
+ this.walkTimingTree(sequence, animations, currentTrigger, group);
19933
20057
  }
19934
20058
  }
19935
20059
  /**
@@ -21651,6 +21775,18 @@ function buildInteractiveSequences(animations, allocateId) {
21651
21775
  }
21652
21776
  return seqNodes;
21653
21777
  }
21778
+ function markGroupAutoStart(groupNode, mainSeqId) {
21779
+ const cTn = groupNode?.["p:cTn"];
21780
+ if (!cTn) {
21781
+ return;
21782
+ }
21783
+ cTn["p:stCondLst"] = {
21784
+ "p:cond": [
21785
+ { "@_delay": "indefinite" },
21786
+ { "@_evt": "onBegin", "@_delay": "0", "p:tn": { "@_val": String(mainSeqId) } }
21787
+ ]
21788
+ };
21789
+ }
21654
21790
  var PptxAnimationWriteService = class {
21655
21791
  nextId = 1;
21656
21792
  /**
@@ -21677,12 +21813,15 @@ var PptxAnimationWriteService = class {
21677
21813
  const interactiveAnimations = validAnimations.filter(
21678
21814
  (a) => a.trigger === "onShapeClick" && a.triggerShapeId
21679
21815
  );
21680
- const animationNodes = this.buildAnimationSequence(regularAnimations);
21816
+ const { nodes: animationNodes, firstGroupAutoStarts } = this.buildAnimationSequence(regularAnimations);
21681
21817
  if (animationNodes.length === 0 && interactiveAnimations.length === 0) {
21682
21818
  return existingRawTiming;
21683
21819
  }
21684
21820
  const rootParId = this.allocateId();
21685
21821
  const mainSeqId = this.allocateId();
21822
+ if (firstGroupAutoStarts) {
21823
+ markGroupAutoStart(animationNodes[0], mainSeqId);
21824
+ }
21686
21825
  const mainSequenceChildren = [];
21687
21826
  for (const node of animationNodes) {
21688
21827
  mainSequenceChildren.push(node);
@@ -21749,12 +21888,14 @@ var PptxAnimationWriteService = class {
21749
21888
  buildAnimationSequence(animations) {
21750
21889
  const clickGroups = [];
21751
21890
  let currentGroup = [];
21891
+ let firstTrigger;
21752
21892
  for (const anim of animations) {
21753
21893
  const effectNodes = this.buildEffectNodesForAnimation(anim);
21754
21894
  if (effectNodes.length === 0) {
21755
21895
  continue;
21756
21896
  }
21757
21897
  const trigger = anim.trigger ?? "onClick";
21898
+ firstTrigger ??= trigger;
21758
21899
  if (trigger === "onClick" || currentGroup.length === 0) {
21759
21900
  if (currentGroup.length > 0) {
21760
21901
  clickGroups.push(currentGroup);
@@ -21768,7 +21909,7 @@ var PptxAnimationWriteService = class {
21768
21909
  if (currentGroup.length > 0) {
21769
21910
  clickGroups.push(currentGroup);
21770
21911
  }
21771
- return clickGroups.map((group) => {
21912
+ const nodes = clickGroups.map((group) => {
21772
21913
  const groupId = this.allocateId();
21773
21914
  return {
21774
21915
  "p:cTn": {
@@ -21785,6 +21926,10 @@ var PptxAnimationWriteService = class {
21785
21926
  }
21786
21927
  };
21787
21928
  });
21929
+ return {
21930
+ nodes,
21931
+ firstGroupAutoStarts: firstTrigger !== void 0 && firstTrigger !== "onClick"
21932
+ };
21788
21933
  }
21789
21934
  buildEffectNodesForAnimation(anim) {
21790
21935
  return buildEffectNodesForAnimation(anim, this.allocateId.bind(this));
@@ -56482,7 +56627,8 @@ var PptxHandlerRuntime28 = class _PptxHandlerRuntime8 extends PptxHandlerRuntime
56482
56627
  applyFillAndStroke(spPr, shapeStyle) {
56483
56628
  const requestedFillMode = shapeStyle.fillMode;
56484
56629
  const gradientFillXml = this.buildGradientFillXml(shapeStyle);
56485
- if (requestedFillMode === "none" || shapeStyle.fillColor === "transparent") {
56630
+ if (shapeStyle.useBackgroundFill) ;
56631
+ else if (requestedFillMode === "none" || shapeStyle.fillColor === "transparent") {
56486
56632
  spPr["a:noFill"] = {};
56487
56633
  delete spPr["a:solidFill"];
56488
56634
  delete spPr["a:gradFill"];
@@ -63323,6 +63469,10 @@ var PptxHandlerRuntime64 = class _PptxHandlerRuntime27 extends PptxHandlerRuntim
63323
63469
  text2 = textParts.join("");
63324
63470
  }
63325
63471
  const shapeStyle = this.extractShapeStyle(effectiveSpPr, styleNode);
63472
+ const useBgFill = String(shape?.["@_useBgFill"] ?? "").trim().toLowerCase();
63473
+ if (useBgFill === "1" || useBgFill === "true") {
63474
+ shapeStyle.useBackgroundFill = true;
63475
+ }
63326
63476
  const hasText = text2.trim().length > 0;
63327
63477
  const isPlainRect = (!prstGeom || prstGeom === "rect") && !custGeom;
63328
63478
  const hasVisibleStyle = shapeStyle.fillColor && shapeStyle.fillColor !== "transparent" || (shapeStyle.strokeWidth || 0) > 0;
@@ -93119,10 +93269,63 @@ function expandTextBuildAnimations(animations, segmentCounts) {
93119
93269
  }
93120
93270
  return result;
93121
93271
  }
93122
- function expandSingleBuildAnimation(anim, buildType, counts, output) {
93272
+ function iterateGranularity(anim) {
93273
+ if (anim.iterate?.type === "lt") {
93274
+ return "byChar";
93275
+ }
93276
+ if (anim.iterate?.type === "wd") {
93277
+ return "byWord";
93278
+ }
93279
+ return void 0;
93280
+ }
93281
+ function pieceCounts(kind, counts) {
93282
+ return kind === "byChar" ? { token: "c", perParagraph: counts.charCounts ?? [] } : { token: "w", perParagraph: counts.wordCounts ?? [] };
93283
+ }
93284
+ function emitStaggeredPieces(anim, kind, counts, output, newClickStepPerParagraph) {
93123
93285
  const targetId = anim.targetId ?? "";
93124
93286
  const baseDuration = anim.durationMs ?? 500;
93287
+ const stagger = iterateStaggerMs(anim, baseDuration);
93288
+ const { token: token2, perParagraph } = pieceCounts(kind, counts);
93289
+ const fallbackDuration = kind === "byChar" ? Math.max(50, Math.round(baseDuration / 4)) : Math.max(100, Math.round(baseDuration / 2));
93290
+ const fallbackStagger = kind === "byChar" ? 20 : 50;
93291
+ let stepIndex = 0;
93292
+ for (let pIdx = 0; pIdx < counts.paragraphCount; pIdx++) {
93293
+ const pieces = perParagraph[pIdx] ?? 0;
93294
+ for (let i = 0; i < pieces; i++) {
93295
+ const opensParagraph = i === 0;
93296
+ const isFirstStep = stepIndex === 0;
93297
+ const startsClickStep = newClickStepPerParagraph && opensParagraph && !isFirstStep;
93298
+ output.push({
93299
+ ...anim,
93300
+ targetId: `${targetId}${TEXT_BUILD_ID_SEP}${token2}${pIdx}-${i}`,
93301
+ trigger: isFirstStep ? anim.trigger : startsClickStep ? "onClick" : stagger !== void 0 ? "withPrevious" : "afterPrevious",
93302
+ durationMs: stagger !== void 0 ? baseDuration : fallbackDuration,
93303
+ delayMs: isFirstStep ? anim.delayMs ?? 0 : startsClickStep ? 0 : stagger ?? fallbackStagger,
93304
+ // Only the first sub-step inherits the parent's start delay; the
93305
+ // rest carry the bare stagger, so these must not re-apply it.
93306
+ // They are synthetic chain steps rather than OOXML `p:par`
93307
+ // siblings, so they also drop the wrapper index: their delay is
93308
+ // an interval off the step before, not an offset from the group.
93309
+ ...isFirstStep ? {} : {
93310
+ triggerDelayMs: void 0,
93311
+ startConditions: void 0,
93312
+ parGroupIndex: void 0
93313
+ },
93314
+ buildType: void 0,
93315
+ iterate: void 0
93316
+ });
93317
+ stepIndex++;
93318
+ }
93319
+ }
93320
+ }
93321
+ function expandSingleBuildAnimation(anim, buildType, counts, output) {
93322
+ const targetId = anim.targetId ?? "";
93125
93323
  if (buildType === "byParagraph") {
93324
+ const granularity = iterateGranularity(anim);
93325
+ if (granularity) {
93326
+ emitStaggeredPieces(anim, granularity, counts, output, true);
93327
+ return;
93328
+ }
93126
93329
  for (let i = 0; i < counts.paragraphCount; i++) {
93127
93330
  output.push({
93128
93331
  ...anim,
@@ -93133,51 +93336,8 @@ function expandSingleBuildAnimation(anim, buildType, counts, output) {
93133
93336
  }
93134
93337
  return;
93135
93338
  }
93136
- const stagger = iterateStaggerMs(anim, baseDuration);
93137
- if (buildType === "byWord") {
93138
- const wordCounts = counts.wordCounts ?? [];
93139
- let stepIndex = 0;
93140
- for (let pIdx = 0; pIdx < counts.paragraphCount; pIdx++) {
93141
- const wc = wordCounts[pIdx] ?? 0;
93142
- for (let wIdx = 0; wIdx < wc; wIdx++) {
93143
- output.push({
93144
- ...anim,
93145
- targetId: `${targetId}${TEXT_BUILD_ID_SEP}w${pIdx}-${wIdx}`,
93146
- trigger: stepIndex === 0 ? anim.trigger : stagger !== void 0 ? "withPrevious" : "afterPrevious",
93147
- durationMs: stagger !== void 0 ? baseDuration : Math.max(100, Math.round(baseDuration / 2)),
93148
- delayMs: stepIndex === 0 ? anim.delayMs ?? 0 : stagger ?? 50,
93149
- // Only the first sub-step inherits the parent's start delay; the
93150
- // rest carry the bare stagger, so these must not re-apply it.
93151
- ...stepIndex === 0 ? {} : { triggerDelayMs: void 0, startConditions: void 0 },
93152
- buildType: void 0,
93153
- iterate: void 0
93154
- });
93155
- stepIndex++;
93156
- }
93157
- }
93158
- return;
93159
- }
93160
- if (buildType === "byChar") {
93161
- const charCounts = counts.charCounts ?? [];
93162
- let stepIndex = 0;
93163
- for (let pIdx = 0; pIdx < counts.paragraphCount; pIdx++) {
93164
- const cc = charCounts[pIdx] ?? 0;
93165
- for (let cIdx = 0; cIdx < cc; cIdx++) {
93166
- output.push({
93167
- ...anim,
93168
- targetId: `${targetId}${TEXT_BUILD_ID_SEP}c${pIdx}-${cIdx}`,
93169
- trigger: stepIndex === 0 ? anim.trigger : stagger !== void 0 ? "withPrevious" : "afterPrevious",
93170
- durationMs: stagger !== void 0 ? baseDuration : Math.max(50, Math.round(baseDuration / 4)),
93171
- delayMs: stepIndex === 0 ? anim.delayMs ?? 0 : stagger ?? 20,
93172
- // Only the first sub-step inherits the parent's start delay; the
93173
- // rest carry the bare stagger, so these must not re-apply it.
93174
- ...stepIndex === 0 ? {} : { triggerDelayMs: void 0, startConditions: void 0 },
93175
- buildType: void 0,
93176
- iterate: void 0
93177
- });
93178
- stepIndex++;
93179
- }
93180
- }
93339
+ if (buildType === "byWord" || buildType === "byChar") {
93340
+ emitStaggeredPieces(anim, buildType, counts, output, false);
93181
93341
  return;
93182
93342
  }
93183
93343
  output.push(anim);
@@ -93448,6 +93608,9 @@ function buildTimeline(nativeAnimations) {
93448
93608
  let dynamicUid = 0;
93449
93609
  let currentGroup = [];
93450
93610
  let currentGroupIsClick = false;
93611
+ let currentGroupAutoStart = false;
93612
+ let subGroupIndex;
93613
+ let subGroupStartMs = 0;
93451
93614
  for (const anim of regularAnims) {
93452
93615
  const expandedSteps = expandIterateAnimation(anim);
93453
93616
  for (const singleAnim of expandedSteps) {
@@ -93502,21 +93665,29 @@ function buildTimeline(nativeAnimations) {
93502
93665
  if (isOnClick || isFirstAnimation) {
93503
93666
  if (currentGroup.length > 0) {
93504
93667
  const group = finalizeClickGroup(currentGroup);
93505
- if (!currentGroupIsClick && clickGroups.length > 0) {
93668
+ if (currentGroupAutoStart || !currentGroupIsClick && clickGroups.length > 0) {
93506
93669
  group.autoAdvance = true;
93507
93670
  }
93508
93671
  clickGroups.push(group);
93509
93672
  }
93510
93673
  currentGroup = [];
93511
93674
  currentGroupIsClick = isOnClick || isFirstAnimation;
93675
+ currentGroupAutoStart = !isOnClick && singleAnim.groupAutoStart === true;
93676
+ subGroupIndex = singleAnim.parGroupIndex;
93677
+ subGroupStartMs = 0;
93512
93678
  }
93679
+ const prevStep = currentGroup.length > 0 ? currentGroup[currentGroup.length - 1] : void 0;
93513
93680
  let delayMs;
93514
- if (trigger === "withPrevious" && currentGroup.length > 0) {
93515
- const prev = currentGroup[currentGroup.length - 1];
93516
- delayMs = prev.delayMs + animDelay + triggerDelay;
93517
- } else if ((trigger === "afterPrevious" || trigger === "afterDelay") && currentGroup.length > 0) {
93518
- const prev = currentGroup[currentGroup.length - 1];
93519
- delayMs = prev.delayMs + prev.durationMs + animDelay + triggerDelay;
93681
+ if (singleAnim.parGroupIndex !== void 0 && prevStep) {
93682
+ if (singleAnim.parGroupIndex !== subGroupIndex) {
93683
+ subGroupIndex = singleAnim.parGroupIndex;
93684
+ subGroupStartMs = trigger === "withPrevious" ? prevStep.delayMs : prevStep.delayMs + prevStep.durationMs;
93685
+ }
93686
+ delayMs = subGroupStartMs + animDelay + triggerDelay;
93687
+ } else if (trigger === "withPrevious" && prevStep) {
93688
+ delayMs = prevStep.delayMs + animDelay + triggerDelay;
93689
+ } else if ((trigger === "afterPrevious" || trigger === "afterDelay") && prevStep) {
93690
+ delayMs = prevStep.delayMs + prevStep.durationMs + animDelay + triggerDelay;
93520
93691
  } else {
93521
93692
  delayMs = animDelay + triggerDelay;
93522
93693
  }
@@ -93542,14 +93713,14 @@ function buildTimeline(nativeAnimations) {
93542
93713
  }
93543
93714
  if (currentGroup.length > 0) {
93544
93715
  const group = finalizeClickGroup(currentGroup);
93545
- if (!currentGroupIsClick && clickGroups.length > 0) {
93716
+ if (currentGroupAutoStart || !currentGroupIsClick && clickGroups.length > 0) {
93546
93717
  group.autoAdvance = true;
93547
93718
  }
93548
93719
  clickGroups.push(group);
93549
93720
  }
93550
- for (let i = 1; i < clickGroups.length; i++) {
93551
- if (clickGroups[i].autoAdvance) {
93552
- clickGroups[i].autoAdvanceDelayMs = 0;
93721
+ for (const group of clickGroups) {
93722
+ if (group.autoAdvance) {
93723
+ group.autoAdvanceDelayMs = 0;
93553
93724
  }
93554
93725
  }
93555
93726
  const interactiveSequences = buildSequenceGroups(
@@ -93919,6 +94090,34 @@ var TimelineEngine = class _TimelineEngine {
93919
94090
  resetHover(triggerShapeId) {
93920
94091
  this.hoverGroupIndexes.delete(triggerShapeId);
93921
94092
  }
94093
+ /**
94094
+ * Jump to the END of the timeline: every click-group counted as played, every
94095
+ * entrance revealed and every exit applied, with no CSS animation attached so
94096
+ * nothing replays.
94097
+ *
94098
+ * This is what PowerPoint shows when you step BACKWARD onto a slide: it
94099
+ * appears with its builds already complete, and a further back press walks
94100
+ * them off again. Re-running the timeline from zero instead made a deck whose
94101
+ * opening build auto-starts restart its animation every time the presenter
94102
+ * stepped back onto it.
94103
+ */
94104
+ completeAll() {
94105
+ this.reset();
94106
+ for (const group of this.timeline.clickGroups) {
94107
+ for (const step of group.steps) {
94108
+ if (step.build || step.colorTargets) {
94109
+ this.activeSteps.set(step.elementId, step);
94110
+ }
94111
+ if (step.presetClass === "entr") {
94112
+ this.revealedElements.add(step.elementId);
94113
+ }
94114
+ if (step.presetClass === "exit") {
94115
+ this.exitedElements.add(step.elementId);
94116
+ }
94117
+ }
94118
+ }
94119
+ this.currentGroupIndex = this.timeline.clickGroups.length - 1;
94120
+ }
93922
94121
  /**
93923
94122
  * Reset the engine to its initial state (no animations played).
93924
94123
  */
@@ -94036,6 +94235,14 @@ var PresentationAnimationController = class _PresentationAnimationController {
94036
94235
  reset() {
94037
94236
  this.engine.reset();
94038
94237
  }
94238
+ /**
94239
+ * Seed the slide as fully built: every group counted as played, nothing
94240
+ * animating. Bindings use it when the presenter steps BACKWARD onto a slide,
94241
+ * which PowerPoint shows with its builds already complete.
94242
+ */
94243
+ completeAll() {
94244
+ this.engine.completeAll();
94245
+ }
94039
94246
  // -----------------------------------------------------------------------
94040
94247
  // Interactive + hover sequences (delegated to the engine)
94041
94248
  // -----------------------------------------------------------------------
@@ -104187,6 +104394,93 @@ function notesSegmentsToSpans(segments) {
104187
104394
  return { kind: "text", key: `seg-${index}`, text: segment.text, style };
104188
104395
  });
104189
104396
  }
104397
+ function charactersWithStyle(runs) {
104398
+ const out = [];
104399
+ for (const run of runs) {
104400
+ for (const ch of run.text) {
104401
+ out.push({ ch, style: run.style });
104402
+ }
104403
+ }
104404
+ return out;
104405
+ }
104406
+ function stateSpan(animId, text2, states, style) {
104407
+ const state = states.get(animId);
104408
+ return {
104409
+ animId,
104410
+ text: text2,
104411
+ hidden: state?.visible === false,
104412
+ cssAnimation: state?.cssAnimation,
104413
+ style
104414
+ };
104415
+ }
104416
+ function buildTextBuildSpec(elementId, paraIndex, runs, states) {
104417
+ if (!states || states.size === 0) {
104418
+ return void 0;
104419
+ }
104420
+ const paraKey = `${elementId}${TEXT_BUILD_ID_SEP}p${paraIndex}`;
104421
+ const paraState = states.get(paraKey);
104422
+ if (paraState) {
104423
+ return {
104424
+ granularity: "paragraph",
104425
+ animId: paraKey,
104426
+ hidden: paraState.visible === false,
104427
+ cssAnimation: paraState.cssAnimation
104428
+ };
104429
+ }
104430
+ const characters = charactersWithStyle(runs);
104431
+ if (states.has(`${elementId}${TEXT_BUILD_ID_SEP}w${paraIndex}-0`)) {
104432
+ const spans = [];
104433
+ let wordIndex = 0;
104434
+ let current = null;
104435
+ const flush = () => {
104436
+ if (!current) {
104437
+ return;
104438
+ }
104439
+ spans.push(
104440
+ stateSpan(
104441
+ `${elementId}${TEXT_BUILD_ID_SEP}w${paraIndex}-${wordIndex}`,
104442
+ current.text,
104443
+ states,
104444
+ current.style
104445
+ )
104446
+ );
104447
+ wordIndex++;
104448
+ current = null;
104449
+ };
104450
+ for (const { ch, style } of characters) {
104451
+ if (/\s/u.test(ch)) {
104452
+ flush();
104453
+ spans.push({ text: ch, hidden: false, style });
104454
+ continue;
104455
+ }
104456
+ current = current === null ? { text: ch, style } : { text: current.text + ch, style: current.style };
104457
+ }
104458
+ flush();
104459
+ return { granularity: "word", spans };
104460
+ }
104461
+ if (states.has(`${elementId}${TEXT_BUILD_ID_SEP}c${paraIndex}-0`)) {
104462
+ const spans = characters.map(
104463
+ (entry, index) => stateSpan(
104464
+ `${elementId}${TEXT_BUILD_ID_SEP}c${paraIndex}-${index}`,
104465
+ entry.ch,
104466
+ states,
104467
+ entry.style
104468
+ )
104469
+ );
104470
+ return { granularity: "char", spans };
104471
+ }
104472
+ return void 0;
104473
+ }
104474
+ function textBuildSpanStyle(span) {
104475
+ const style = { display: "inline" };
104476
+ if (span.hidden) {
104477
+ style.visibility = "hidden";
104478
+ }
104479
+ if (span.cssAnimation) {
104480
+ style.animation = span.cssAnimation;
104481
+ }
104482
+ return style;
104483
+ }
104190
104484
  var PRESENTER_ZOOM_MIN = 1;
104191
104485
  var PRESENTER_ZOOM_MAX = 4;
104192
104486
  var PRESENTER_ZOOM_STEP = 0.5;
@@ -104566,6 +104860,31 @@ async function clearAudienceContent(sessionId) {
104566
104860
  } catch {
104567
104861
  }
104568
104862
  }
104863
+ function isAudienceDisplayHash(hash2) {
104864
+ return typeof hash2 === "string" && hash2.startsWith(PRESENTATION_HASH);
104865
+ }
104866
+ function isAudienceDisplayTab() {
104867
+ if (typeof window === "undefined") {
104868
+ return false;
104869
+ }
104870
+ return isAudienceDisplayHash(window.location.hash);
104871
+ }
104872
+ function mayLeaveSlideShow(isAudienceDisplay = isAudienceDisplayTab()) {
104873
+ return !isAudienceDisplay;
104874
+ }
104875
+ function acceptsPresentationInput(isAudienceDisplay = isAudienceDisplayTab()) {
104876
+ return !isAudienceDisplay;
104877
+ }
104878
+ function endAudienceDisplay(win = globalThis.window) {
104879
+ if (!win) {
104880
+ return true;
104881
+ }
104882
+ try {
104883
+ win.close();
104884
+ } catch {
104885
+ }
104886
+ return !win.closed;
104887
+ }
104569
104888
  function formatSlideCounter(currentSlide, totalSlides) {
104570
104889
  return `${currentSlide + 1} / ${totalSlides}`;
104571
104890
  }
@@ -109471,6 +109790,7 @@ exports.ThemePresets = ThemePresets;
109471
109790
  exports.VIEWER_OPTIONS_TABS = VIEWER_OPTIONS_TABS;
109472
109791
  exports.VIEWER_PREFS_STORAGE_KEY = VIEWER_PREFS_STORAGE_KEY;
109473
109792
  exports.WEBM_MIME_CANDIDATES = WEBM_MIME_CANDIDATES;
109793
+ exports.acceptsPresentationInput = acceptsPresentationInput;
109474
109794
  exports.activateModalFocus = activateModalFocus;
109475
109795
  exports.addQuickAccessCommand = addQuickAccessCommand;
109476
109796
  exports.addSection = addSection;
@@ -109530,6 +109850,7 @@ exports.buildSmartArtA11y = buildSmartArtA11y;
109530
109850
  exports.buildSmartArtPresetData = buildSmartArtPresetData;
109531
109851
  exports.buildSummaryZoomView = buildSummaryZoomView;
109532
109852
  exports.buildTextBody3DSceneStyle = buildTextBody3DSceneStyle;
109853
+ exports.buildTextBuildSpec = buildTextBuildSpec;
109533
109854
  exports.buildTextFillCss = buildTextFillCss;
109534
109855
  exports.buildTextReflectionCss = buildTextReflectionCss;
109535
109856
  exports.buildTextRunFilterChain = buildTextRunFilterChain;
@@ -109620,6 +109941,7 @@ exports.dragAnchorViewY = dragAnchorViewY;
109620
109941
  exports.dragValueForPart = dragValueForPart;
109621
109942
  exports.elementActionToPptxAction = elementActionToPptxAction;
109622
109943
  exports.encodeGif = encodeGif;
109944
+ exports.endAudienceDisplay = endAudienceDisplay;
109623
109945
  exports.erasePresentationInkAt = erasePresentationInkAt;
109624
109946
  exports.evaluatePresetShape = evaluatePresetShape;
109625
109947
  exports.extractPathPoints = extractPathPoints;
@@ -109738,6 +110060,7 @@ exports.loadAudienceContent = loadAudienceContent;
109738
110060
  exports.makeCloneId = makeCloneId;
109739
110061
  exports.makeSlideId = makeSlideId;
109740
110062
  exports.mapPresentationKey = mapPresentationKey;
110063
+ exports.mayLeaveSlideShow = mayLeaveSlideShow;
109741
110064
  exports.mergeAdditiveSelection = mergeAdditiveSelection;
109742
110065
  exports.mergeCells = mergeCells;
109743
110066
  exports.mergePresentationSnapshot = mergePresentationSnapshot;
@@ -109867,6 +110190,7 @@ exports.svgLineCap = svgLineCap;
109867
110190
  exports.svgPathToPolygons = svgPathToPolygons;
109868
110191
  exports.swapPresentationWindows = swapPresentationWindows;
109869
110192
  exports.switchSmartArtLayout = switchSmartArtLayout;
110193
+ exports.textBuildSpanStyle = textBuildSpanStyle;
109870
110194
  exports.themeColorSchemesEqual = themeColorSchemesEqual;
109871
110195
  exports.themeToCssVars = themeToCssVars;
109872
110196
  exports.tintColor2 = tintColor2;
Binary file
Binary file