motion-dom 12.38.0 → 12.39.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.
package/dist/cjs/index.js CHANGED
@@ -3057,7 +3057,8 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
3057
3057
  }
3058
3058
  if (motionUtils.MotionGlobalConfig.instantAnimations ||
3059
3059
  motionUtils.MotionGlobalConfig.skipAnimations ||
3060
- element?.shouldSkipAnimations) {
3060
+ element?.shouldSkipAnimations ||
3061
+ valueTransition.skipAnimations) {
3061
3062
  shouldSkip = true;
3062
3063
  makeAnimationInstant(options);
3063
3064
  options.delay = 0;
@@ -3536,6 +3537,7 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
3536
3537
  ? resolveTransition(transition, defaultTransition)
3537
3538
  : defaultTransition;
3538
3539
  const reduceMotion = transition?.reduceMotion;
3540
+ const skipAnimations = transition?.skipAnimations;
3539
3541
  if (transitionOverride)
3540
3542
  transition = transitionOverride;
3541
3543
  const animations = [];
@@ -3554,6 +3556,8 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
3554
3556
  delay,
3555
3557
  ...getValueTransition(transition || {}, key),
3556
3558
  };
3559
+ if (skipAnimations)
3560
+ valueTransition.skipAnimations = true;
3557
3561
  /**
3558
3562
  * If the value is already at the defined target, skip the animation.
3559
3563
  * We still re-assert the value via frame.update to take precedence
@@ -5918,8 +5922,8 @@ class VisualElement {
5918
5922
  removeOnChange();
5919
5923
  if (removeSyncCheck)
5920
5924
  removeSyncCheck();
5921
- if (value.owner)
5922
- value.stop();
5925
+ // Defer to MotionValue.on("change") auto-stop so React 19 remounts
5926
+ // can resubscribe before the animation is cancelled (#3315).
5923
5927
  });
5924
5928
  }
5925
5929
  sortNodePosition(other) {
@@ -7163,7 +7167,8 @@ function createAnimationState(visualElement) {
7163
7167
  */
7164
7168
  let valueHasChanged = false;
7165
7169
  if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
7166
- valueHasChanged = !shallowCompare(next, prev);
7170
+ valueHasChanged =
7171
+ !shallowCompare(next, prev) || variantDidChange;
7167
7172
  }
7168
7173
  else {
7169
7174
  valueHasChanged = next !== prev;