framer-motion 10.2.4 → 10.2.5

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/index.d.ts CHANGED
@@ -1403,6 +1403,7 @@ interface IProjectionNode<I = unknown> {
1403
1403
  isProjectionDirty: boolean;
1404
1404
  isSharedProjectionDirty: boolean;
1405
1405
  isTransformDirty: boolean;
1406
+ resolvedRelativeTargetAt?: number;
1406
1407
  shouldResetTransform: boolean;
1407
1408
  prevTransformTemplateValue: string | undefined;
1408
1409
  isUpdateBlocked(): boolean;
@@ -1438,7 +1439,7 @@ interface IProjectionNode<I = unknown> {
1438
1439
  resetTransform(): void;
1439
1440
  resetRotation(): void;
1440
1441
  applyTransform(box: Box, transformOnly?: boolean): Box;
1441
- resolveTargetDelta(): void;
1442
+ resolveTargetDelta(force?: boolean): void;
1442
1443
  calcProjection(): void;
1443
1444
  getProjectionStyles(styles?: MotionStyle): MotionStyle | undefined;
1444
1445
  clearMeasurements(): void;
@@ -1973,7 +1973,7 @@
1973
1973
  * This will be replaced by the build step with the latest version number.
1974
1974
  * When MotionValues are provided to motion components, warn if versions are mixed.
1975
1975
  */
1976
- this.version = "10.2.4";
1976
+ this.version = "10.2.5";
1977
1977
  /**
1978
1978
  * Duration, in milliseconds, since last updating frame.
1979
1979
  *
@@ -3549,10 +3549,7 @@
3549
3549
  this.target = undefined;
3550
3550
  this.isLayoutDirty = false;
3551
3551
  }
3552
- /**
3553
- * Frame calculations
3554
- */
3555
- resolveTargetDelta() {
3552
+ resolveTargetDelta(forceRecalculation = false) {
3556
3553
  var _a;
3557
3554
  /**
3558
3555
  * Once the dirty status of nodes has been spread through the tree, we also
@@ -3568,7 +3565,8 @@
3568
3565
  * We don't use transform for this step of processing so we don't
3569
3566
  * need to check whether any nodes have changed transform.
3570
3567
  */
3571
- const canSkip = !((isShared && this.isSharedProjectionDirty) ||
3568
+ const canSkip = !(forceRecalculation ||
3569
+ (isShared && this.isSharedProjectionDirty) ||
3572
3570
  this.isProjectionDirty ||
3573
3571
  ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) ||
3574
3572
  this.attemptToResolveRelativeTarget);
@@ -3580,6 +3578,7 @@
3580
3578
  */
3581
3579
  if (!this.layout || !(layout || layoutId))
3582
3580
  return;
3581
+ this.resolvedRelativeTargetAt = frameData.timestamp;
3583
3582
  /**
3584
3583
  * If we don't have a targetDelta but do have a layout, we can attempt to resolve
3585
3584
  * a relativeParent. This will allow a component to perform scale correction
@@ -3620,6 +3619,16 @@
3620
3619
  this.relativeTargetOrigin &&
3621
3620
  this.relativeParent &&
3622
3621
  this.relativeParent.target) {
3622
+ /**
3623
+ * If the parent target isn't up-to-date, force it to update.
3624
+ * This is an unfortunate de-optimisation as it means any updating relative
3625
+ * projection will cause all the relative parents to recalculate back
3626
+ * up the tree.
3627
+ */
3628
+ if (this.relativeParent.resolvedRelativeTargetAt !==
3629
+ frameData.timestamp) {
3630
+ this.relativeParent.resolveTargetDelta(true);
3631
+ }
3623
3632
  calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
3624
3633
  /**
3625
3634
  * If we've only got a targetDelta, resolve it into a target
@@ -3706,6 +3715,13 @@
3706
3715
  (this.isSharedProjectionDirty || this.isTransformDirty)) {
3707
3716
  canSkip = false;
3708
3717
  }
3718
+ /**
3719
+ * If we have resolved the target this frame we must recalculate the
3720
+ * projection to ensure it visually represents the internal calculations.
3721
+ */
3722
+ if (this.resolvedRelativeTargetAt === frameData.timestamp) {
3723
+ canSkip = false;
3724
+ }
3709
3725
  if (canSkip)
3710
3726
  return;
3711
3727
  const { layout, layoutId } = this.options;
@@ -5203,7 +5219,7 @@
5203
5219
  * and warn against mismatches.
5204
5220
  */
5205
5221
  {
5206
- warnOnce(nextValue.version === "10.2.4", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.4 may not work as expected.`);
5222
+ warnOnce(nextValue.version === "10.2.5", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.5 may not work as expected.`);
5207
5223
  }
5208
5224
  }
5209
5225
  else if (isMotionValue(prevValue)) {
@@ -5845,6 +5861,7 @@
5845
5861
  exports.calcBoxDelta = calcBoxDelta;
5846
5862
  exports.correctBorderRadius = correctBorderRadius;
5847
5863
  exports.correctBoxShadow = correctBoxShadow;
5864
+ exports.frameData = frameData;
5848
5865
  exports.mix = mix;
5849
5866
  exports.nodeGroup = nodeGroup;
5850
5867
  exports.sync = sync;
@@ -1299,6 +1299,7 @@ interface IProjectionNode<I = unknown> {
1299
1299
  isProjectionDirty: boolean;
1300
1300
  isSharedProjectionDirty: boolean;
1301
1301
  isTransformDirty: boolean;
1302
+ resolvedRelativeTargetAt?: number;
1302
1303
  shouldResetTransform: boolean;
1303
1304
  prevTransformTemplateValue: string | undefined;
1304
1305
  isUpdateBlocked(): boolean;
@@ -1334,7 +1335,7 @@ interface IProjectionNode<I = unknown> {
1334
1335
  resetTransform(): void;
1335
1336
  resetRotation(): void;
1336
1337
  applyTransform(box: Box, transformOnly?: boolean): Box;
1337
- resolveTargetDelta(): void;
1338
+ resolveTargetDelta(force?: boolean): void;
1338
1339
  calcProjection(): void;
1339
1340
  getProjectionStyles(styles?: MotionStyle): MotionStyle | undefined;
1340
1341
  clearMeasurements(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framer-motion",
3
- "version": "10.2.4",
3
+ "version": "10.2.5",
4
4
  "description": "A simple and powerful React and JavaScript animation library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.mjs",
@@ -85,7 +85,7 @@
85
85
  "bundlesize": [
86
86
  {
87
87
  "path": "./dist/size-rollup-motion.js",
88
- "maxSize": "29.85 kB"
88
+ "maxSize": "29.89 kB"
89
89
  },
90
90
  {
91
91
  "path": "./dist/size-rollup-m.js",
@@ -93,11 +93,11 @@
93
93
  },
94
94
  {
95
95
  "path": "./dist/size-rollup-dom-animation.js",
96
- "maxSize": "14.56 kB"
96
+ "maxSize": "14.64 kB"
97
97
  },
98
98
  {
99
99
  "path": "./dist/size-rollup-dom-max.js",
100
- "maxSize": "25.6 kB"
100
+ "maxSize": "25.64 kB"
101
101
  },
102
102
  {
103
103
  "path": "./dist/size-rollup-animate.js",
@@ -113,8 +113,8 @@
113
113
  },
114
114
  {
115
115
  "path": "./dist/size-webpack-dom-max.js",
116
- "maxSize": "30.42 kB"
116
+ "maxSize": "30.46 kB"
117
117
  }
118
118
  ],
119
- "gitHead": "82eb0ba26cd103d524a27dc95415e437cce35822"
119
+ "gitHead": "08a892929cc60026ae1e97d382dee6f0d8f3893d"
120
120
  }