framer-motion 10.2.4 → 10.3.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/dom-entry.js +1 -1
- package/dist/cjs/index.js +24 -8
- package/dist/cjs/{wrap-62da7859.js → wrap-462b1507.js} +97 -48
- package/dist/dom-entry.d.ts +4 -1
- package/dist/es/animation/GroupPlaybackControls.mjs +18 -6
- package/dist/es/animation/create-instant-animation.mjs +6 -2
- package/dist/es/animation/js/index.mjs +48 -19
- package/dist/es/animation/optimized-appear/handoff.mjs +1 -1
- package/dist/es/animation/waapi/create-accelerated-animation.mjs +7 -2
- package/dist/es/projection/node/create-projection-node.mjs +22 -5
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +3593 -3528
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/projection.dev.js +102 -36
- package/dist/three-entry.d.ts +6 -2
- package/package.json +7 -7
|
@@ -20,6 +20,7 @@ import { globalProjectionState } from './state.mjs';
|
|
|
20
20
|
import { delay } from '../../utils/delay.mjs';
|
|
21
21
|
import { mix } from '../../utils/mix.mjs';
|
|
22
22
|
import { record } from '../../debug/record.mjs';
|
|
23
|
+
import { frameData } from '../../frameloop/data.mjs';
|
|
23
24
|
|
|
24
25
|
const transformAxes = ["", "X", "Y", "Z"];
|
|
25
26
|
/**
|
|
@@ -629,10 +630,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
629
630
|
this.target = undefined;
|
|
630
631
|
this.isLayoutDirty = false;
|
|
631
632
|
}
|
|
632
|
-
|
|
633
|
-
* Frame calculations
|
|
634
|
-
*/
|
|
635
|
-
resolveTargetDelta() {
|
|
633
|
+
resolveTargetDelta(forceRecalculation = false) {
|
|
636
634
|
var _a;
|
|
637
635
|
/**
|
|
638
636
|
* Once the dirty status of nodes has been spread through the tree, we also
|
|
@@ -648,7 +646,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
648
646
|
* We don't use transform for this step of processing so we don't
|
|
649
647
|
* need to check whether any nodes have changed transform.
|
|
650
648
|
*/
|
|
651
|
-
const canSkip = !(
|
|
649
|
+
const canSkip = !(forceRecalculation ||
|
|
650
|
+
(isShared && this.isSharedProjectionDirty) ||
|
|
652
651
|
this.isProjectionDirty ||
|
|
653
652
|
((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) ||
|
|
654
653
|
this.attemptToResolveRelativeTarget);
|
|
@@ -660,6 +659,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
660
659
|
*/
|
|
661
660
|
if (!this.layout || !(layout || layoutId))
|
|
662
661
|
return;
|
|
662
|
+
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
663
663
|
/**
|
|
664
664
|
* If we don't have a targetDelta but do have a layout, we can attempt to resolve
|
|
665
665
|
* a relativeParent. This will allow a component to perform scale correction
|
|
@@ -700,6 +700,16 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
700
700
|
this.relativeTargetOrigin &&
|
|
701
701
|
this.relativeParent &&
|
|
702
702
|
this.relativeParent.target) {
|
|
703
|
+
/**
|
|
704
|
+
* If the parent target isn't up-to-date, force it to update.
|
|
705
|
+
* This is an unfortunate de-optimisation as it means any updating relative
|
|
706
|
+
* projection will cause all the relative parents to recalculate back
|
|
707
|
+
* up the tree.
|
|
708
|
+
*/
|
|
709
|
+
if (this.relativeParent.resolvedRelativeTargetAt !==
|
|
710
|
+
frameData.timestamp) {
|
|
711
|
+
this.relativeParent.resolveTargetDelta(true);
|
|
712
|
+
}
|
|
703
713
|
calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
|
|
704
714
|
/**
|
|
705
715
|
* If we've only got a targetDelta, resolve it into a target
|
|
@@ -786,6 +796,13 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
786
796
|
(this.isSharedProjectionDirty || this.isTransformDirty)) {
|
|
787
797
|
canSkip = false;
|
|
788
798
|
}
|
|
799
|
+
/**
|
|
800
|
+
* If we have resolved the target this frame we must recalculate the
|
|
801
|
+
* projection to ensure it visually represents the internal calculations.
|
|
802
|
+
*/
|
|
803
|
+
if (this.resolvedRelativeTargetAt === frameData.timestamp) {
|
|
804
|
+
canSkip = false;
|
|
805
|
+
}
|
|
789
806
|
if (canSkip)
|
|
790
807
|
return;
|
|
791
808
|
const { layout, layoutId } = this.options;
|
|
@@ -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 === "10.
|
|
25
|
+
warnOnce(nextValue.version === "10.3.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.3.0 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ class MotionValue {
|
|
|
26
26
|
* This will be replaced by the build step with the latest version number.
|
|
27
27
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
28
28
|
*/
|
|
29
|
-
this.version = "10.
|
|
29
|
+
this.version = "10.3.0";
|
|
30
30
|
/**
|
|
31
31
|
* Duration, in milliseconds, since last updating frame.
|
|
32
32
|
*
|