framer-motion 7.5.3 → 7.5.4

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
@@ -2245,7 +2245,7 @@ class MotionValue {
2245
2245
  * This will be replaced by the build step with the latest version number.
2246
2246
  * When MotionValues are provided to motion components, warn if versions are mixed.
2247
2247
  */
2248
- this.version = "7.5.3";
2248
+ this.version = "7.5.4";
2249
2249
  /**
2250
2250
  * Duration, in milliseconds, since last updating frame.
2251
2251
  *
@@ -3533,14 +3533,16 @@ function hasScale({ scale, scaleX, scaleY }) {
3533
3533
  }
3534
3534
  function hasTransform(values) {
3535
3535
  return (hasScale(values) ||
3536
- hasTranslate(values.x) ||
3537
- hasTranslate(values.y) ||
3536
+ has2DTranslate(values) ||
3538
3537
  values.z ||
3539
3538
  values.rotate ||
3540
3539
  values.rotateX ||
3541
3540
  values.rotateY);
3542
3541
  }
3543
- function hasTranslate(value) {
3542
+ function has2DTranslate(values) {
3543
+ return is2DTranslate(values.x) || is2DTranslate(values.y);
3544
+ }
3545
+ function is2DTranslate(value) {
3544
3546
  return value && value !== "0%";
3545
3547
  }
3546
3548
 
@@ -4221,7 +4223,7 @@ function updateMotionValuesFromProps(element, next, prev) {
4221
4223
  * and warn against mismatches.
4222
4224
  */
4223
4225
  if (process.env.NODE_ENV === "development") {
4224
- warnOnce(nextValue.version === "7.5.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.5.3 may not work as expected.`);
4226
+ warnOnce(nextValue.version === "7.5.4", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.5.4 may not work as expected.`);
4225
4227
  }
4226
4228
  }
4227
4229
  else if (isMotionValue(prevValue)) {
@@ -5996,7 +5998,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
5996
5998
  */
5997
5999
  if (!hasLayoutChanged &&
5998
6000
  this.animationProgress === 0) {
5999
- this.finishAnimation();
6001
+ finishAnimation(this);
6000
6002
  }
6001
6003
  this.isLead() && ((_e = (_d = this.options).onExitComplete) === null || _e === void 0 ? void 0 : _e.call(_d));
6002
6004
  }
@@ -6405,7 +6407,9 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6405
6407
  }
6406
6408
  }
6407
6409
  getClosestProjectingParent() {
6408
- if (!this.parent || hasTransform(this.parent.latestValues))
6410
+ if (!this.parent ||
6411
+ hasScale(this.parent.latestValues) ||
6412
+ has2DTranslate(this.parent.latestValues))
6409
6413
  return undefined;
6410
6414
  if ((this.parent.relativeTarget || this.parent.targetDelta) &&
6411
6415
  this.parent.layout) {
@@ -14,7 +14,7 @@ import { NodeStack } from '../shared/stack.mjs';
14
14
  import { scaleCorrectors } from '../styles/scale-correction.mjs';
15
15
  import { buildProjectionTransform } from '../styles/transform.mjs';
16
16
  import { eachAxis } from '../utils/each-axis.mjs';
17
- import { hasTransform, hasScale } from '../utils/has-transform.mjs';
17
+ import { hasTransform, hasScale, has2DTranslate } from '../utils/has-transform.mjs';
18
18
  import { FlatTree } from '../../render/utils/flat-tree.mjs';
19
19
  import { resolveMotionValue } from '../../value/utils/resolve-motion-value.mjs';
20
20
  import { globalProjectionState } from './state.mjs';
@@ -230,7 +230,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
230
230
  */
231
231
  if (!hasLayoutChanged &&
232
232
  this.animationProgress === 0) {
233
- this.finishAnimation();
233
+ finishAnimation(this);
234
234
  }
235
235
  this.isLead() && ((_e = (_d = this.options).onExitComplete) === null || _e === void 0 ? void 0 : _e.call(_d));
236
236
  }
@@ -639,7 +639,9 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
639
639
  }
640
640
  }
641
641
  getClosestProjectingParent() {
642
- if (!this.parent || hasTransform(this.parent.latestValues))
642
+ if (!this.parent ||
643
+ hasScale(this.parent.latestValues) ||
644
+ has2DTranslate(this.parent.latestValues))
643
645
  return undefined;
644
646
  if ((this.parent.relativeTarget || this.parent.targetDelta) &&
645
647
  this.parent.layout) {
@@ -8,15 +8,17 @@ function hasScale({ scale, scaleX, scaleY }) {
8
8
  }
9
9
  function hasTransform(values) {
10
10
  return (hasScale(values) ||
11
- hasTranslate(values.x) ||
12
- hasTranslate(values.y) ||
11
+ has2DTranslate(values) ||
13
12
  values.z ||
14
13
  values.rotate ||
15
14
  values.rotateX ||
16
15
  values.rotateY);
17
16
  }
18
- function hasTranslate(value) {
17
+ function has2DTranslate(values) {
18
+ return is2DTranslate(values.x) || is2DTranslate(values.y);
19
+ }
20
+ function is2DTranslate(value) {
19
21
  return value && value !== "0%";
20
22
  }
21
23
 
22
- export { hasScale, hasTransform };
24
+ export { has2DTranslate, hasScale, hasTransform };
@@ -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 === "7.5.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.5.3 may not work as expected.`);
25
+ warnOnce(nextValue.version === "7.5.4", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.5.4 may not work as expected.`);
26
26
  }
27
27
  }
28
28
  else if (isMotionValue(prevValue)) {
@@ -24,7 +24,7 @@ class MotionValue {
24
24
  * This will be replaced by the build step with the latest version number.
25
25
  * When MotionValues are provided to motion components, warn if versions are mixed.
26
26
  */
27
- this.version = "7.5.3";
27
+ this.version = "7.5.4";
28
28
  /**
29
29
  * Duration, in milliseconds, since last updating frame.
30
30
  *
@@ -3413,7 +3413,7 @@
3413
3413
  * This will be replaced by the build step with the latest version number.
3414
3414
  * When MotionValues are provided to motion components, warn if versions are mixed.
3415
3415
  */
3416
- this.version = "7.5.3";
3416
+ this.version = "7.5.4";
3417
3417
  /**
3418
3418
  * Duration, in milliseconds, since last updating frame.
3419
3419
  *
@@ -4701,14 +4701,16 @@
4701
4701
  }
4702
4702
  function hasTransform(values) {
4703
4703
  return (hasScale(values) ||
4704
- hasTranslate(values.x) ||
4705
- hasTranslate(values.y) ||
4704
+ has2DTranslate(values) ||
4706
4705
  values.z ||
4707
4706
  values.rotate ||
4708
4707
  values.rotateX ||
4709
4708
  values.rotateY);
4710
4709
  }
4711
- function hasTranslate(value) {
4710
+ function has2DTranslate(values) {
4711
+ return is2DTranslate(values.x) || is2DTranslate(values.y);
4712
+ }
4713
+ function is2DTranslate(value) {
4712
4714
  return value && value !== "0%";
4713
4715
  }
4714
4716
 
@@ -5389,7 +5391,7 @@
5389
5391
  * and warn against mismatches.
5390
5392
  */
5391
5393
  {
5392
- warnOnce(nextValue.version === "7.5.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.5.3 may not work as expected.`);
5394
+ warnOnce(nextValue.version === "7.5.4", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.5.4 may not work as expected.`);
5393
5395
  }
5394
5396
  }
5395
5397
  else if (isMotionValue(prevValue)) {
@@ -7164,7 +7166,7 @@
7164
7166
  */
7165
7167
  if (!hasLayoutChanged &&
7166
7168
  this.animationProgress === 0) {
7167
- this.finishAnimation();
7169
+ finishAnimation(this);
7168
7170
  }
7169
7171
  this.isLead() && ((_e = (_d = this.options).onExitComplete) === null || _e === void 0 ? void 0 : _e.call(_d));
7170
7172
  }
@@ -7573,7 +7575,9 @@
7573
7575
  }
7574
7576
  }
7575
7577
  getClosestProjectingParent() {
7576
- if (!this.parent || hasTransform(this.parent.latestValues))
7578
+ if (!this.parent ||
7579
+ hasScale(this.parent.latestValues) ||
7580
+ has2DTranslate(this.parent.latestValues))
7577
7581
  return undefined;
7578
7582
  if ((this.parent.relativeTarget || this.parent.targetDelta) &&
7579
7583
  this.parent.layout) {