framer-motion 11.2.0 → 11.2.2
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-Dw1ndaYq.js → dom-entry-B5lD2iX6.js} +17 -23
- package/dist/cjs/dom-entry.js +1 -1
- package/dist/cjs/index.js +26 -5
- package/dist/dom-entry.d.ts +1 -1
- package/dist/dom.js +1 -1
- package/dist/es/animation/interfaces/visual-element-target.mjs +1 -1
- package/dist/es/animation/optimized-appear/handoff.mjs +25 -4
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/render/utils/resolve-dynamic-variants.mjs +1 -17
- package/dist/es/render/utils/resolve-variants.mjs +13 -3
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +42 -27
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/projection.dev.js +15 -5
- package/package.json +4 -4
|
@@ -1301,12 +1301,21 @@
|
|
|
1301
1301
|
return newValues;
|
|
1302
1302
|
}
|
|
1303
1303
|
|
|
1304
|
-
function
|
|
1304
|
+
function getValueState(visualElement) {
|
|
1305
|
+
const state = [{}, {}];
|
|
1306
|
+
visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
|
|
1307
|
+
state[0][key] = value.get();
|
|
1308
|
+
state[1][key] = value.getVelocity();
|
|
1309
|
+
});
|
|
1310
|
+
return state;
|
|
1311
|
+
}
|
|
1312
|
+
function resolveVariantFromProps(props, definition, custom, visualElement) {
|
|
1305
1313
|
/**
|
|
1306
1314
|
* If the variant definition is a function, resolve.
|
|
1307
1315
|
*/
|
|
1308
1316
|
if (typeof definition === "function") {
|
|
1309
|
-
|
|
1317
|
+
const [current, velocity] = getValueState(visualElement);
|
|
1318
|
+
definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
|
|
1310
1319
|
}
|
|
1311
1320
|
/**
|
|
1312
1321
|
* If the variant definition is a variant label, or
|
|
@@ -1321,7 +1330,8 @@
|
|
|
1321
1330
|
* If so, resolve. This can only have returned a valid target object.
|
|
1322
1331
|
*/
|
|
1323
1332
|
if (typeof definition === "function") {
|
|
1324
|
-
|
|
1333
|
+
const [current, velocity] = getValueState(visualElement);
|
|
1334
|
+
definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
|
|
1325
1335
|
}
|
|
1326
1336
|
return definition;
|
|
1327
1337
|
}
|
|
@@ -1943,25 +1953,9 @@
|
|
|
1943
1953
|
return true;
|
|
1944
1954
|
}
|
|
1945
1955
|
|
|
1946
|
-
/**
|
|
1947
|
-
* Creates an object containing the latest state of every MotionValue on a VisualElement
|
|
1948
|
-
*/
|
|
1949
|
-
function getCurrent(visualElement) {
|
|
1950
|
-
const current = {};
|
|
1951
|
-
visualElement.values.forEach((value, key) => (current[key] = value.get()));
|
|
1952
|
-
return current;
|
|
1953
|
-
}
|
|
1954
|
-
/**
|
|
1955
|
-
* Creates an object containing the latest velocity of every MotionValue on a VisualElement
|
|
1956
|
-
*/
|
|
1957
|
-
function getVelocity$1(visualElement) {
|
|
1958
|
-
const velocity = {};
|
|
1959
|
-
visualElement.values.forEach((value, key) => (velocity[key] = value.getVelocity()));
|
|
1960
|
-
return velocity;
|
|
1961
|
-
}
|
|
1962
1956
|
function resolveVariant(visualElement, definition, custom) {
|
|
1963
1957
|
const props = visualElement.getProps();
|
|
1964
|
-
return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom,
|
|
1958
|
+
return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, visualElement);
|
|
1965
1959
|
}
|
|
1966
1960
|
|
|
1967
1961
|
/**
|
|
@@ -4639,7 +4633,7 @@
|
|
|
4639
4633
|
* This will be replaced by the build step with the latest version number.
|
|
4640
4634
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
4641
4635
|
*/
|
|
4642
|
-
this.version = "11.2.
|
|
4636
|
+
this.version = "11.2.2";
|
|
4643
4637
|
/**
|
|
4644
4638
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
4645
4639
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -4984,7 +4978,7 @@
|
|
|
4984
4978
|
const props = visualElement.getProps();
|
|
4985
4979
|
const appearId = props[optimizedAppearDataAttribute];
|
|
4986
4980
|
if (appearId) {
|
|
4987
|
-
const elapsed = window.HandoffAppearAnimations(appearId, key);
|
|
4981
|
+
const elapsed = window.HandoffAppearAnimations(appearId, key, value, frame);
|
|
4988
4982
|
if (elapsed !== null) {
|
|
4989
4983
|
valueTransition.elapsed = elapsed;
|
|
4990
4984
|
isHandoff = true;
|
|
@@ -7102,7 +7096,7 @@
|
|
|
7102
7096
|
* and warn against mismatches.
|
|
7103
7097
|
*/
|
|
7104
7098
|
{
|
|
7105
|
-
warnOnce(nextValue.version === "11.2.
|
|
7099
|
+
warnOnce(nextValue.version === "11.2.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.2.2 may not work as expected.`);
|
|
7106
7100
|
}
|
|
7107
7101
|
}
|
|
7108
7102
|
else if (isMotionValue(prevValue)) {
|
|
@@ -11970,7 +11964,7 @@
|
|
|
11970
11964
|
*
|
|
11971
11965
|
* Remove in early 2024.
|
|
11972
11966
|
*/
|
|
11973
|
-
_value,
|
|
11967
|
+
_value, frame) {
|
|
11974
11968
|
const optimisedValueName = transformProps.has(valueName)
|
|
11975
11969
|
? "transform"
|
|
11976
11970
|
: valueName;
|
|
@@ -11982,10 +11976,31 @@
|
|
|
11982
11976
|
const { animation, startTime } = optimisedAnimation;
|
|
11983
11977
|
const cancelAnimation = () => {
|
|
11984
11978
|
appearAnimationStore.delete(storeId);
|
|
11985
|
-
|
|
11986
|
-
|
|
11979
|
+
if (frame) {
|
|
11980
|
+
/**
|
|
11981
|
+
* If we've been provided the frameloop as an argument, use it to defer
|
|
11982
|
+
* cancellation until keyframes of the subsequent animation have been resolved.
|
|
11983
|
+
* This "papers over" a gap where the JS animations haven't rendered with
|
|
11984
|
+
* the latest time after a potential heavy blocking workload.
|
|
11985
|
+
* Otherwise cancel immediately.
|
|
11986
|
+
*
|
|
11987
|
+
* This is an optional dependency to deal with the fact that this inline
|
|
11988
|
+
* script and the library can be version sharded, and there have been
|
|
11989
|
+
* times when this isn't provided as an argument.
|
|
11990
|
+
*/
|
|
11991
|
+
frame.render(() => frame.render(() => {
|
|
11992
|
+
try {
|
|
11993
|
+
animation.cancel();
|
|
11994
|
+
}
|
|
11995
|
+
catch (error) { }
|
|
11996
|
+
}));
|
|
11997
|
+
}
|
|
11998
|
+
else {
|
|
11999
|
+
try {
|
|
12000
|
+
animation.cancel();
|
|
12001
|
+
}
|
|
12002
|
+
catch (error) { }
|
|
11987
12003
|
}
|
|
11988
|
-
catch (error) { }
|
|
11989
12004
|
};
|
|
11990
12005
|
/**
|
|
11991
12006
|
* If the startTime is null, this animation is the Paint Ready detection animation
|