framer-motion 11.2.6 → 11.2.7
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-fJy-kji5.js → dom-entry-CDIl0jTw.js} +8 -4
- package/dist/cjs/dom-entry.js +1 -1
- package/dist/cjs/index.js +43 -10
- package/dist/dom.js +1 -1
- package/dist/es/animation/interfaces/visual-element-target.mjs +2 -3
- package/dist/es/animation/optimized-appear/get-appear-id.mjs +7 -0
- package/dist/es/projection/node/create-projection-node.mjs +43 -9
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +49 -13
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/projection.dev.js +56 -11
- package/dist/three-entry.d.ts +1 -0
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1365,6 +1365,7 @@ interface IProjectionNode<I = unknown> {
|
|
|
1365
1365
|
setAnimationOrigin(delta: Delta): void;
|
|
1366
1366
|
startAnimation(transition: Transition$1): void;
|
|
1367
1367
|
finishAnimation(): void;
|
|
1368
|
+
hasCheckedOptimisedAppear: boolean;
|
|
1368
1369
|
isLead(): boolean;
|
|
1369
1370
|
promote(options?: {
|
|
1370
1371
|
needsReset?: boolean;
|
package/dist/projection.dev.js
CHANGED
|
@@ -1013,7 +1013,7 @@
|
|
|
1013
1013
|
* This will be replaced by the build step with the latest version number.
|
|
1014
1014
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
1015
1015
|
*/
|
|
1016
|
-
this.version = "11.2.
|
|
1016
|
+
this.version = "11.2.7";
|
|
1017
1017
|
/**
|
|
1018
1018
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
1019
1019
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -3937,6 +3937,18 @@
|
|
|
3937
3937
|
return definition;
|
|
3938
3938
|
}
|
|
3939
3939
|
|
|
3940
|
+
/**
|
|
3941
|
+
* Convert camelCase to dash-case properties.
|
|
3942
|
+
*/
|
|
3943
|
+
const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase();
|
|
3944
|
+
|
|
3945
|
+
const optimizedAppearDataId = "framerAppearId";
|
|
3946
|
+
const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId);
|
|
3947
|
+
|
|
3948
|
+
function getOptimisedAppearId(visualElement) {
|
|
3949
|
+
return visualElement.getProps()[optimizedAppearDataAttribute];
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3940
3952
|
function isSVGElement(element) {
|
|
3941
3953
|
return element instanceof SVGElement && element.tagName !== "svg";
|
|
3942
3954
|
}
|
|
@@ -4042,7 +4054,7 @@
|
|
|
4042
4054
|
* and warn against mismatches.
|
|
4043
4055
|
*/
|
|
4044
4056
|
{
|
|
4045
|
-
warnOnce(nextValue.version === "11.2.
|
|
4057
|
+
warnOnce(nextValue.version === "11.2.7", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.2.7 may not work as expected.`);
|
|
4046
4058
|
}
|
|
4047
4059
|
}
|
|
4048
4060
|
else if (isMotionValue(prevValue)) {
|
|
@@ -4904,6 +4916,25 @@
|
|
|
4904
4916
|
}
|
|
4905
4917
|
}
|
|
4906
4918
|
}
|
|
4919
|
+
function isOptimisedAppearTree(projectionNode) {
|
|
4920
|
+
projectionNode.hasCheckedOptimisedAppear = true;
|
|
4921
|
+
if (projectionNode.root === projectionNode)
|
|
4922
|
+
return false;
|
|
4923
|
+
const { visualElement } = projectionNode.options;
|
|
4924
|
+
if (!visualElement) {
|
|
4925
|
+
return false;
|
|
4926
|
+
}
|
|
4927
|
+
else if (getOptimisedAppearId(visualElement)) {
|
|
4928
|
+
return true;
|
|
4929
|
+
}
|
|
4930
|
+
else if (projectionNode.parent &&
|
|
4931
|
+
!projectionNode.parent.hasCheckedOptimisedAppear) {
|
|
4932
|
+
return isOptimisedAppearTree(projectionNode.parent);
|
|
4933
|
+
}
|
|
4934
|
+
else {
|
|
4935
|
+
return false;
|
|
4936
|
+
}
|
|
4937
|
+
}
|
|
4907
4938
|
function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) {
|
|
4908
4939
|
return class ProjectionNode {
|
|
4909
4940
|
constructor(latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) {
|
|
@@ -4979,6 +5010,13 @@
|
|
|
4979
5010
|
* Flags whether this node should have its transform reset prior to measuring.
|
|
4980
5011
|
*/
|
|
4981
5012
|
this.shouldResetTransform = false;
|
|
5013
|
+
/**
|
|
5014
|
+
* Store whether this node has been checked for optimised appear animations. As
|
|
5015
|
+
* effects fire bottom-up, and we want to look up the tree for appear animations,
|
|
5016
|
+
* this makes sure we only check each path once, stopping at nodes that
|
|
5017
|
+
* have already been checked.
|
|
5018
|
+
*/
|
|
5019
|
+
this.hasCheckedOptimisedAppear = false;
|
|
4982
5020
|
/**
|
|
4983
5021
|
* An object representing the calculated contextual/accumulated/tree scale.
|
|
4984
5022
|
* This will be used to scale calculcated projection transforms, as these are
|
|
@@ -5184,15 +5222,6 @@
|
|
|
5184
5222
|
if (this.isUpdateBlocked())
|
|
5185
5223
|
return;
|
|
5186
5224
|
this.isUpdating = true;
|
|
5187
|
-
/**
|
|
5188
|
-
* If we're running optimised appear animations then these must be
|
|
5189
|
-
* cancelled before measuring the DOM. This is so we can measure
|
|
5190
|
-
* the true layout of the element rather than the WAAPI animation
|
|
5191
|
-
* which will be unaffected by the resetSkewAndRotate step.
|
|
5192
|
-
*/
|
|
5193
|
-
if (window.HandoffCancelAllAnimations) {
|
|
5194
|
-
window.HandoffCancelAllAnimations();
|
|
5195
|
-
}
|
|
5196
5225
|
this.nodes && this.nodes.forEach(resetSkewAndRotation);
|
|
5197
5226
|
this.animationId++;
|
|
5198
5227
|
}
|
|
@@ -5206,6 +5235,22 @@
|
|
|
5206
5235
|
this.options.onExitComplete && this.options.onExitComplete();
|
|
5207
5236
|
return;
|
|
5208
5237
|
}
|
|
5238
|
+
/**
|
|
5239
|
+
* If we're running optimised appear animations then these must be
|
|
5240
|
+
* cancelled before measuring the DOM. This is so we can measure
|
|
5241
|
+
* the true layout of the element rather than the WAAPI animation
|
|
5242
|
+
* which will be unaffected by the resetSkewAndRotate step.
|
|
5243
|
+
*
|
|
5244
|
+
* Note: This is a DOM write. Worst case scenario is this is sandwiched
|
|
5245
|
+
* between other snapshot reads which will cause unnecessary style recalculations.
|
|
5246
|
+
* This has to happen here though, as we don't yet know which nodes will need
|
|
5247
|
+
* snapshots in startUpdate(), but we only want to cancel optimised animations
|
|
5248
|
+
* if a layout animation measurement is actually going to be affected by them.
|
|
5249
|
+
*/
|
|
5250
|
+
if (window.HandoffCancelAllAnimations &&
|
|
5251
|
+
isOptimisedAppearTree(this)) {
|
|
5252
|
+
window.HandoffCancelAllAnimations();
|
|
5253
|
+
}
|
|
5209
5254
|
!this.root.isUpdating && this.root.startUpdate();
|
|
5210
5255
|
if (this.isLayoutDirty)
|
|
5211
5256
|
return;
|
package/dist/three-entry.d.ts
CHANGED
|
@@ -1081,6 +1081,7 @@ interface IProjectionNode<I = unknown> {
|
|
|
1081
1081
|
setAnimationOrigin(delta: Delta): void;
|
|
1082
1082
|
startAnimation(transition: Transition$1): void;
|
|
1083
1083
|
finishAnimation(): void;
|
|
1084
|
+
hasCheckedOptimisedAppear: boolean;
|
|
1084
1085
|
isLead(): boolean;
|
|
1085
1086
|
promote(options?: {
|
|
1086
1087
|
needsReset?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "framer-motion",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.7",
|
|
4
4
|
"description": "A simple and powerful JavaScript animation library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.mjs",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"bundlesize": [
|
|
88
88
|
{
|
|
89
89
|
"path": "./dist/size-rollup-motion.js",
|
|
90
|
-
"maxSize": "
|
|
90
|
+
"maxSize": "33 kB"
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
"path": "./dist/size-rollup-m.js",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
"path": "./dist/size-rollup-dom-max.js",
|
|
102
|
-
"maxSize": "28.
|
|
102
|
+
"maxSize": "28.3 kB"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
"path": "./dist/size-rollup-animate.js",
|
|
@@ -115,8 +115,8 @@
|
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"path": "./dist/size-webpack-dom-max.js",
|
|
118
|
-
"maxSize": "34.
|
|
118
|
+
"maxSize": "34.3 kB"
|
|
119
119
|
}
|
|
120
120
|
],
|
|
121
|
-
"gitHead": "
|
|
121
|
+
"gitHead": "9f47af2f738d750528fff1367448e969dd04be29"
|
|
122
122
|
}
|