animot-presenter 0.6.1 → 0.6.2

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.
@@ -893,8 +893,9 @@
893
893
 
894
894
  if (hasSlideTransition) {
895
895
  // Phase 2 sprint-1 polish — fire per-element exit presets BEFORE
896
- // the slide-level CSS transition starts so they're visible alongside
897
- // the cross-fade. Skip elements still on the target slide (morph case).
896
+ // the slide-level CSS transition starts, then WAIT for them to
897
+ // finish so the cross-fade doesn't swallow their visual.
898
+ let maxExitDur = 0;
898
899
  for (const el of currentSlide.canvas.elements) {
899
900
  const exitMode = el.animationConfig?.exit;
900
901
  if (!exitMode || exitMode === 'none' || exitMode === 'fade') continue;
@@ -904,13 +905,16 @@
904
905
  if (stillOnTarget) continue;
905
906
  const dur = el.animationConfig?.exitDuration ?? el.animationConfig?.duration ?? 600;
906
907
  presenterRegisterRuntimeAnim(el.id, 'exit', kf, dur);
907
- // Snap opacity to 0 after the CSS exit keyframe finishes so the
908
- // element vanishes cleanly once the runtime registry entry expires.
908
+ if (dur > maxExitDur) maxExitDur = dur;
909
909
  const elId = el.id;
910
910
  const animatedRef = animatedElements.get(elId);
911
911
  if (animatedRef) setTimeout(() => animatedRef.opacity.to(0, { duration: 0 }), dur);
912
912
  }
913
913
 
914
+ if (maxExitDur > 0) {
915
+ await new Promise(r => setTimeout(r, maxExitDur));
916
+ }
917
+
914
918
  transitionClass = `transition-${transition.type}-out`;
915
919
  await new Promise(r => setTimeout(r, duration * 0.4));
916
920
  const newElementContent = new Map(elementContent);