framer-motion 8.4.1 → 8.4.3

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
@@ -2072,7 +2072,7 @@ class MotionValue {
2072
2072
  * This will be replaced by the build step with the latest version number.
2073
2073
  * When MotionValues are provided to motion components, warn if versions are mixed.
2074
2074
  */
2075
- this.version = "8.4.1";
2075
+ this.version = "8.4.2";
2076
2076
  /**
2077
2077
  * Duration, in milliseconds, since last updating frame.
2078
2078
  *
@@ -4166,17 +4166,7 @@ function animateTarget(visualElement, definition, { delay = 0, transitionOverrid
4166
4166
  shouldBlockAnimation(animationTypeState, key))) {
4167
4167
  continue;
4168
4168
  }
4169
- let valueTransition = { delay, elapsed: 0, ...transition };
4170
- /**
4171
- * Make animation instant if this is a transform prop and we should reduce motion.
4172
- */
4173
- if (visualElement.shouldReduceMotion && transformProps.has(key)) {
4174
- valueTransition = {
4175
- ...valueTransition,
4176
- type: false,
4177
- delay: 0,
4178
- };
4179
- }
4169
+ const valueTransition = { delay, elapsed: 0, ...transition };
4180
4170
  /**
4181
4171
  * If this is the first time a value is being animated, check
4182
4172
  * to see if we're handling off from an existing animation.
@@ -4187,7 +4177,9 @@ function animateTarget(visualElement, definition, { delay = 0, transitionOverrid
4187
4177
  valueTransition.elapsed = handoffOptimizedAppearAnimation(appearId, key);
4188
4178
  }
4189
4179
  }
4190
- let animation = value.start(createMotionValueAnimation(key, value, valueTarget, valueTransition));
4180
+ let animation = value.start(createMotionValueAnimation(key, value, valueTarget, visualElement.shouldReduceMotion && transformProps.has(key)
4181
+ ? { type: false }
4182
+ : valueTransition));
4191
4183
  if (isWillChangeMotionValue(willChange)) {
4192
4184
  willChange.add(key);
4193
4185
  animation = animation.then(() => willChange.remove(key));
@@ -4643,8 +4635,12 @@ class PanSession {
4643
4635
  };
4644
4636
  this.handlePointerUp = (event, info) => {
4645
4637
  this.end();
4638
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo))
4639
+ return;
4646
4640
  const { onEnd, onSessionEnd } = this.handlers;
4647
- const panInfo = getPanInfo(transformPoint(info, this.transformPagePoint), this.history);
4641
+ const panInfo = getPanInfo(event.type === "pointercancel"
4642
+ ? this.lastMoveEventInfo
4643
+ : transformPoint(info, this.transformPagePoint), this.history);
4648
4644
  if (this.startEvent && onEnd) {
4649
4645
  onEnd(event, panInfo);
4650
4646
  }
@@ -5928,7 +5924,7 @@ function updateMotionValuesFromProps(element, next, prev) {
5928
5924
  * and warn against mismatches.
5929
5925
  */
5930
5926
  if (process.env.NODE_ENV === "development") {
5931
- warnOnce(nextValue.version === "8.4.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.4.1 may not work as expected.`);
5927
+ warnOnce(nextValue.version === "8.4.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.4.2 may not work as expected.`);
5932
5928
  }
5933
5929
  }
5934
5930
  else if (isMotionValue(prevValue)) {
@@ -57,8 +57,12 @@ class PanSession {
57
57
  };
58
58
  this.handlePointerUp = (event, info) => {
59
59
  this.end();
60
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo))
61
+ return;
60
62
  const { onEnd, onSessionEnd } = this.handlers;
61
- const panInfo = getPanInfo(transformPoint(info, this.transformPagePoint), this.history);
63
+ const panInfo = getPanInfo(event.type === "pointercancel"
64
+ ? this.lastMoveEventInfo
65
+ : transformPoint(info, this.transformPagePoint), this.history);
62
66
  if (this.startEvent && onEnd) {
63
67
  onEnd(event, panInfo);
64
68
  }
@@ -83,17 +83,7 @@ function animateTarget(visualElement, definition, { delay = 0, transitionOverrid
83
83
  shouldBlockAnimation(animationTypeState, key))) {
84
84
  continue;
85
85
  }
86
- let valueTransition = { delay, elapsed: 0, ...transition };
87
- /**
88
- * Make animation instant if this is a transform prop and we should reduce motion.
89
- */
90
- if (visualElement.shouldReduceMotion && transformProps.has(key)) {
91
- valueTransition = {
92
- ...valueTransition,
93
- type: false,
94
- delay: 0,
95
- };
96
- }
86
+ const valueTransition = { delay, elapsed: 0, ...transition };
97
87
  /**
98
88
  * If this is the first time a value is being animated, check
99
89
  * to see if we're handling off from an existing animation.
@@ -104,7 +94,9 @@ function animateTarget(visualElement, definition, { delay = 0, transitionOverrid
104
94
  valueTransition.elapsed = handoffOptimizedAppearAnimation(appearId, key);
105
95
  }
106
96
  }
107
- let animation = value.start(createMotionValueAnimation(key, value, valueTarget, valueTransition));
97
+ let animation = value.start(createMotionValueAnimation(key, value, valueTarget, visualElement.shouldReduceMotion && transformProps.has(key)
98
+ ? { type: false }
99
+ : valueTransition));
108
100
  if (isWillChangeMotionValue(willChange)) {
109
101
  willChange.add(key);
110
102
  animation = animation.then(() => willChange.remove(key));
@@ -22,7 +22,7 @@ function updateMotionValuesFromProps(element, next, prev) {
22
22
  * and warn against mismatches.
23
23
  */
24
24
  if (process.env.NODE_ENV === "development") {
25
- warnOnce(nextValue.version === "8.4.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.4.1 may not work as expected.`);
25
+ warnOnce(nextValue.version === "8.4.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.4.2 may not work as expected.`);
26
26
  }
27
27
  }
28
28
  else if (isMotionValue(prevValue)) {
@@ -25,7 +25,7 @@ class MotionValue {
25
25
  * This will be replaced by the build step with the latest version number.
26
26
  * When MotionValues are provided to motion components, warn if versions are mixed.
27
27
  */
28
- this.version = "8.4.1";
28
+ this.version = "8.4.2";
29
29
  /**
30
30
  * Duration, in milliseconds, since last updating frame.
31
31
  *
@@ -2070,7 +2070,7 @@
2070
2070
  * This will be replaced by the build step with the latest version number.
2071
2071
  * When MotionValues are provided to motion components, warn if versions are mixed.
2072
2072
  */
2073
- this.version = "8.4.1";
2073
+ this.version = "8.4.2";
2074
2074
  /**
2075
2075
  * Duration, in milliseconds, since last updating frame.
2076
2076
  *
@@ -4179,17 +4179,7 @@
4179
4179
  shouldBlockAnimation(animationTypeState, key))) {
4180
4180
  continue;
4181
4181
  }
4182
- let valueTransition = { delay, elapsed: 0, ...transition };
4183
- /**
4184
- * Make animation instant if this is a transform prop and we should reduce motion.
4185
- */
4186
- if (visualElement.shouldReduceMotion && transformProps.has(key)) {
4187
- valueTransition = {
4188
- ...valueTransition,
4189
- type: false,
4190
- delay: 0,
4191
- };
4192
- }
4182
+ const valueTransition = { delay, elapsed: 0, ...transition };
4193
4183
  /**
4194
4184
  * If this is the first time a value is being animated, check
4195
4185
  * to see if we're handling off from an existing animation.
@@ -4200,7 +4190,9 @@
4200
4190
  valueTransition.elapsed = handoffOptimizedAppearAnimation(appearId, key);
4201
4191
  }
4202
4192
  }
4203
- let animation = value.start(createMotionValueAnimation(key, value, valueTarget, valueTransition));
4193
+ let animation = value.start(createMotionValueAnimation(key, value, valueTarget, visualElement.shouldReduceMotion && transformProps.has(key)
4194
+ ? { type: false }
4195
+ : valueTransition));
4204
4196
  if (isWillChangeMotionValue(willChange)) {
4205
4197
  willChange.add(key);
4206
4198
  animation = animation.then(() => willChange.remove(key));
@@ -4656,8 +4648,12 @@
4656
4648
  };
4657
4649
  this.handlePointerUp = (event, info) => {
4658
4650
  this.end();
4651
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo))
4652
+ return;
4659
4653
  const { onEnd, onSessionEnd } = this.handlers;
4660
- const panInfo = getPanInfo(transformPoint(info, this.transformPagePoint), this.history);
4654
+ const panInfo = getPanInfo(event.type === "pointercancel"
4655
+ ? this.lastMoveEventInfo
4656
+ : transformPoint(info, this.transformPagePoint), this.history);
4661
4657
  if (this.startEvent && onEnd) {
4662
4658
  onEnd(event, panInfo);
4663
4659
  }
@@ -5941,7 +5937,7 @@
5941
5937
  * and warn against mismatches.
5942
5938
  */
5943
5939
  {
5944
- warnOnce(nextValue.version === "8.4.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.4.1 may not work as expected.`);
5940
+ warnOnce(nextValue.version === "8.4.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.4.2 may not work as expected.`);
5945
5941
  }
5946
5942
  }
5947
5943
  else if (isMotionValue(prevValue)) {