framer-motion 12.23.6 → 12.23.9

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.
@@ -2687,6 +2687,11 @@
2687
2687
  ((type === "spring" || isGenerator(type)) && velocity));
2688
2688
  }
2689
2689
 
2690
+ function makeAnimationInstant(options) {
2691
+ options.duration = 0;
2692
+ options.type === "keyframes";
2693
+ }
2694
+
2690
2695
  /**
2691
2696
  * A list of values that can be hardware-accelerated.
2692
2697
  */
@@ -2779,7 +2784,7 @@
2779
2784
  onUpdate?.(getFinalKeyframe$1(keyframes, options, finalKeyframe));
2780
2785
  }
2781
2786
  keyframes[0] = keyframes[keyframes.length - 1];
2782
- options.duration = 0;
2787
+ makeAnimationInstant(options);
2783
2788
  options.repeat = 0;
2784
2789
  }
2785
2790
  /**
@@ -3625,7 +3630,7 @@
3625
3630
  * An object containing a SubscriptionManager for each active event.
3626
3631
  */
3627
3632
  this.events = {};
3628
- this.updateAndNotify = (v, render = true) => {
3633
+ this.updateAndNotify = (v) => {
3629
3634
  const currentTime = time.now();
3630
3635
  /**
3631
3636
  * If we're updating the value during another frame or eventloop
@@ -3646,10 +3651,6 @@
3646
3651
  }
3647
3652
  }
3648
3653
  }
3649
- // Update render subscribers
3650
- if (render) {
3651
- this.events.renderRequest?.notify(this.current);
3652
- }
3653
3654
  };
3654
3655
  this.hasAnimated = false;
3655
3656
  this.setCurrent(init);
@@ -3760,9 +3761,9 @@
3760
3761
  *
3761
3762
  * @public
3762
3763
  */
3763
- set(v, render = true) {
3764
- if (!render || !this.passiveEffect) {
3765
- this.updateAndNotify(v, render);
3764
+ set(v) {
3765
+ if (!this.passiveEffect) {
3766
+ this.updateAndNotify(v);
3766
3767
  }
3767
3768
  else {
3768
3769
  this.passiveEffect(v, this.updateAndNotify);
@@ -4674,12 +4675,15 @@
4674
4675
  frame.postRender(startAnimation);
4675
4676
  return value.get();
4676
4677
  }, stopAnimation);
4677
- let unsubscribe = undefined;
4678
4678
  if (isMotionValue(source)) {
4679
- unsubscribe = source.on("change", (v) => value.set(parseValue(v, unit)));
4680
- value.on("destroy", unsubscribe);
4679
+ const removeSourceOnChange = source.on("change", (v) => value.set(parseValue(v, unit)));
4680
+ const removeValueOnDestroy = value.on("destroy", removeSourceOnChange);
4681
+ return () => {
4682
+ removeSourceOnChange();
4683
+ removeValueOnDestroy();
4684
+ };
4681
4685
  }
4682
- return unsubscribe;
4686
+ return stopAnimation;
4683
4687
  }
4684
4688
  function parseValue(v, unit) {
4685
4689
  return unit ? v + unit : v;
@@ -5105,7 +5109,6 @@
5105
5109
  `);
5106
5110
  }
5107
5111
  return () => {
5108
- parent.removeChild(style);
5109
5112
  if (parent.contains(style)) {
5110
5113
  parent.removeChild(style);
5111
5114
  }
@@ -5591,7 +5594,7 @@
5591
5594
  let shouldSkip = false;
5592
5595
  if (options.type === false ||
5593
5596
  (options.duration === 0 && !options.repeatDelay)) {
5594
- options.duration = 0;
5597
+ makeAnimationInstant(options);
5595
5598
  if (options.delay === 0) {
5596
5599
  shouldSkip = true;
5597
5600
  }
@@ -5599,7 +5602,7 @@
5599
5602
  if (MotionGlobalConfig.instantAnimations ||
5600
5603
  MotionGlobalConfig.skipAnimations) {
5601
5604
  shouldSkip = true;
5602
- options.duration = 0;
5605
+ makeAnimationInstant(options);
5603
5606
  options.delay = 0;
5604
5607
  }
5605
5608
  /**
@@ -8257,7 +8260,7 @@
8257
8260
  for (const key in initialMotionValues) {
8258
8261
  const value = initialMotionValues[key];
8259
8262
  if (latestValues[key] !== undefined && isMotionValue(value)) {
8260
- value.set(latestValues[key], false);
8263
+ value.set(latestValues[key]);
8261
8264
  }
8262
8265
  }
8263
8266
  }
@@ -8321,15 +8324,14 @@
8321
8324
  if (valueIsTransform && this.projection) {
8322
8325
  this.projection.isTransformDirty = true;
8323
8326
  }
8327
+ this.scheduleRender();
8324
8328
  });
8325
- const removeOnRenderRequest = value.on("renderRequest", this.scheduleRender);
8326
8329
  let removeSyncCheck;
8327
8330
  if (window.MotionCheckAppearSync) {
8328
8331
  removeSyncCheck = window.MotionCheckAppearSync(this, key, value);
8329
8332
  }
8330
8333
  this.valueSubscriptions.set(key, () => {
8331
8334
  removeOnChange();
8332
- removeOnRenderRequest();
8333
8335
  if (removeSyncCheck)
8334
8336
  removeSyncCheck();
8335
8337
  if (value.owner)
@@ -14163,6 +14165,7 @@
14163
14165
  exports.isZeroValueString = isZeroValueString;
14164
14166
  exports.keyframes = keyframes;
14165
14167
  exports.m = m;
14168
+ exports.makeAnimationInstant = makeAnimationInstant;
14166
14169
  exports.makeUseVisualState = makeUseVisualState;
14167
14170
  exports.mapEasingToNativeEasing = mapEasingToNativeEasing;
14168
14171
  exports.mapValue = mapValue;