framer-motion 9.0.3 → 9.0.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 +16 -17
- package/dist/es/render/html/utils/build-styles.mjs +2 -4
- package/dist/es/render/html/utils/build-transform.mjs +12 -10
- package/dist/es/render/html/utils/create-render-state.mjs +0 -1
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +16 -17
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/projection.dev.js +16 -16
- package/dist/size-rollup-dom-animation-assets.js +1 -1
- package/dist/size-rollup-dom-animation-m.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max-assets.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-webpack-dom-animation.js +1 -1
- package/dist/size-webpack-dom-max.js +1 -1
- package/dist/size-webpack-m.js +1 -1
- package/package.json +7 -7
package/dist/cjs/index.js
CHANGED
|
@@ -504,24 +504,26 @@ const translateAlias = {
|
|
|
504
504
|
z: "translateZ",
|
|
505
505
|
transformPerspective: "perspective",
|
|
506
506
|
};
|
|
507
|
-
|
|
508
|
-
* A function to use with Array.sort to sort transform keys by their default order.
|
|
509
|
-
*/
|
|
510
|
-
const sortTransformProps = (a, b) => transformPropOrder.indexOf(a) - transformPropOrder.indexOf(b);
|
|
507
|
+
const numTransforms = transformPropOrder.length;
|
|
511
508
|
/**
|
|
512
509
|
* Build a CSS transform style from individual x/y/scale etc properties.
|
|
513
510
|
*
|
|
514
511
|
* This outputs with a default order of transforms/scales/rotations, this can be customised by
|
|
515
512
|
* providing a transformTemplate function.
|
|
516
513
|
*/
|
|
517
|
-
function buildTransform(
|
|
514
|
+
function buildTransform(transform, { enableHardwareAcceleration = true, allowTransformNone = true, }, transformIsDefault, transformTemplate) {
|
|
518
515
|
// The transform string we're going to build into.
|
|
519
516
|
let transformString = "";
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
517
|
+
/**
|
|
518
|
+
* Loop over all possible transforms in order, adding the ones that
|
|
519
|
+
* are present to the transform string.
|
|
520
|
+
*/
|
|
521
|
+
for (let i = 0; i < numTransforms; i++) {
|
|
522
|
+
const key = transformPropOrder[i];
|
|
523
|
+
if (transform[key] !== undefined) {
|
|
524
|
+
const transformName = translateAlias[key] || key;
|
|
525
|
+
transformString += `${transformName}(${transform[key]}) `;
|
|
526
|
+
}
|
|
525
527
|
}
|
|
526
528
|
if (enableHardwareAcceleration && !transform.z) {
|
|
527
529
|
transformString += "translateZ(0)";
|
|
@@ -673,8 +675,7 @@ const numberValueTypes = {
|
|
|
673
675
|
};
|
|
674
676
|
|
|
675
677
|
function buildHTMLStyles(state, latestValues, options, transformTemplate) {
|
|
676
|
-
const { style, vars, transform,
|
|
677
|
-
transformKeys.length = 0;
|
|
678
|
+
const { style, vars, transform, transformOrigin } = state;
|
|
678
679
|
// Track whether we encounter any transform or transformOrigin values.
|
|
679
680
|
let hasTransform = false;
|
|
680
681
|
let hasTransformOrigin = false;
|
|
@@ -702,7 +703,6 @@ function buildHTMLStyles(state, latestValues, options, transformTemplate) {
|
|
|
702
703
|
// If this is a transform, flag to enable further transform processing
|
|
703
704
|
hasTransform = true;
|
|
704
705
|
transform[key] = valueAsType;
|
|
705
|
-
transformKeys.push(key);
|
|
706
706
|
// If we already know we have a non-default transform, early return
|
|
707
707
|
if (!transformIsNone)
|
|
708
708
|
continue;
|
|
@@ -721,7 +721,7 @@ function buildHTMLStyles(state, latestValues, options, transformTemplate) {
|
|
|
721
721
|
}
|
|
722
722
|
if (!latestValues.transform) {
|
|
723
723
|
if (hasTransform || transformTemplate) {
|
|
724
|
-
style.transform = buildTransform(state, options, transformIsNone, transformTemplate);
|
|
724
|
+
style.transform = buildTransform(state.transform, options, transformIsNone, transformTemplate);
|
|
725
725
|
}
|
|
726
726
|
else if (style.transform) {
|
|
727
727
|
/**
|
|
@@ -744,7 +744,6 @@ function buildHTMLStyles(state, latestValues, options, transformTemplate) {
|
|
|
744
744
|
const createHtmlRenderState = () => ({
|
|
745
745
|
style: {},
|
|
746
746
|
transform: {},
|
|
747
|
-
transformKeys: [],
|
|
748
747
|
transformOrigin: {},
|
|
749
748
|
vars: {},
|
|
750
749
|
});
|
|
@@ -2016,7 +2015,7 @@ class MotionValue {
|
|
|
2016
2015
|
* This will be replaced by the build step with the latest version number.
|
|
2017
2016
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
2018
2017
|
*/
|
|
2019
|
-
this.version = "9.0.
|
|
2018
|
+
this.version = "9.0.4";
|
|
2020
2019
|
/**
|
|
2021
2020
|
* Duration, in milliseconds, since last updating frame.
|
|
2022
2021
|
*
|
|
@@ -7772,7 +7771,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
7772
7771
|
* and warn against mismatches.
|
|
7773
7772
|
*/
|
|
7774
7773
|
if (process.env.NODE_ENV === "development") {
|
|
7775
|
-
warnOnce(nextValue.version === "9.0.
|
|
7774
|
+
warnOnce(nextValue.version === "9.0.4", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.4 may not work as expected.`);
|
|
7776
7775
|
}
|
|
7777
7776
|
}
|
|
7778
7777
|
else if (isMotionValue(prevValue)) {
|
|
@@ -5,8 +5,7 @@ import { getValueAsType } from '../../dom/value-types/get-as-type.mjs';
|
|
|
5
5
|
import { numberValueTypes } from '../../dom/value-types/number.mjs';
|
|
6
6
|
|
|
7
7
|
function buildHTMLStyles(state, latestValues, options, transformTemplate) {
|
|
8
|
-
const { style, vars, transform,
|
|
9
|
-
transformKeys.length = 0;
|
|
8
|
+
const { style, vars, transform, transformOrigin } = state;
|
|
10
9
|
// Track whether we encounter any transform or transformOrigin values.
|
|
11
10
|
let hasTransform = false;
|
|
12
11
|
let hasTransformOrigin = false;
|
|
@@ -34,7 +33,6 @@ function buildHTMLStyles(state, latestValues, options, transformTemplate) {
|
|
|
34
33
|
// If this is a transform, flag to enable further transform processing
|
|
35
34
|
hasTransform = true;
|
|
36
35
|
transform[key] = valueAsType;
|
|
37
|
-
transformKeys.push(key);
|
|
38
36
|
// If we already know we have a non-default transform, early return
|
|
39
37
|
if (!transformIsNone)
|
|
40
38
|
continue;
|
|
@@ -53,7 +51,7 @@ function buildHTMLStyles(state, latestValues, options, transformTemplate) {
|
|
|
53
51
|
}
|
|
54
52
|
if (!latestValues.transform) {
|
|
55
53
|
if (hasTransform || transformTemplate) {
|
|
56
|
-
style.transform = buildTransform(state, options, transformIsNone, transformTemplate);
|
|
54
|
+
style.transform = buildTransform(state.transform, options, transformIsNone, transformTemplate);
|
|
57
55
|
}
|
|
58
56
|
else if (style.transform) {
|
|
59
57
|
/**
|
|
@@ -6,24 +6,26 @@ const translateAlias = {
|
|
|
6
6
|
z: "translateZ",
|
|
7
7
|
transformPerspective: "perspective",
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
* A function to use with Array.sort to sort transform keys by their default order.
|
|
11
|
-
*/
|
|
12
|
-
const sortTransformProps = (a, b) => transformPropOrder.indexOf(a) - transformPropOrder.indexOf(b);
|
|
9
|
+
const numTransforms = transformPropOrder.length;
|
|
13
10
|
/**
|
|
14
11
|
* Build a CSS transform style from individual x/y/scale etc properties.
|
|
15
12
|
*
|
|
16
13
|
* This outputs with a default order of transforms/scales/rotations, this can be customised by
|
|
17
14
|
* providing a transformTemplate function.
|
|
18
15
|
*/
|
|
19
|
-
function buildTransform(
|
|
16
|
+
function buildTransform(transform, { enableHardwareAcceleration = true, allowTransformNone = true, }, transformIsDefault, transformTemplate) {
|
|
20
17
|
// The transform string we're going to build into.
|
|
21
18
|
let transformString = "";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Loop over all possible transforms in order, adding the ones that
|
|
21
|
+
* are present to the transform string.
|
|
22
|
+
*/
|
|
23
|
+
for (let i = 0; i < numTransforms; i++) {
|
|
24
|
+
const key = transformPropOrder[i];
|
|
25
|
+
if (transform[key] !== undefined) {
|
|
26
|
+
const transformName = translateAlias[key] || key;
|
|
27
|
+
transformString += `${transformName}(${transform[key]}) `;
|
|
28
|
+
}
|
|
27
29
|
}
|
|
28
30
|
if (enableHardwareAcceleration && !transform.z) {
|
|
29
31
|
transformString += "translateZ(0)";
|
|
@@ -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 === "9.0.
|
|
25
|
+
warnOnce(nextValue.version === "9.0.4", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.4 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -25,7 +25,7 @@ class MotionValue {
|
|
|
25
25
|
* This will be replaced by the build step with the latest version number.
|
|
26
26
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
27
27
|
*/
|
|
28
|
-
this.version = "9.0.
|
|
28
|
+
this.version = "9.0.4";
|
|
29
29
|
/**
|
|
30
30
|
* Duration, in milliseconds, since last updating frame.
|
|
31
31
|
*
|
|
@@ -502,24 +502,26 @@
|
|
|
502
502
|
z: "translateZ",
|
|
503
503
|
transformPerspective: "perspective",
|
|
504
504
|
};
|
|
505
|
-
|
|
506
|
-
* A function to use with Array.sort to sort transform keys by their default order.
|
|
507
|
-
*/
|
|
508
|
-
const sortTransformProps = (a, b) => transformPropOrder.indexOf(a) - transformPropOrder.indexOf(b);
|
|
505
|
+
const numTransforms = transformPropOrder.length;
|
|
509
506
|
/**
|
|
510
507
|
* Build a CSS transform style from individual x/y/scale etc properties.
|
|
511
508
|
*
|
|
512
509
|
* This outputs with a default order of transforms/scales/rotations, this can be customised by
|
|
513
510
|
* providing a transformTemplate function.
|
|
514
511
|
*/
|
|
515
|
-
function buildTransform(
|
|
512
|
+
function buildTransform(transform, { enableHardwareAcceleration = true, allowTransformNone = true, }, transformIsDefault, transformTemplate) {
|
|
516
513
|
// The transform string we're going to build into.
|
|
517
514
|
let transformString = "";
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
515
|
+
/**
|
|
516
|
+
* Loop over all possible transforms in order, adding the ones that
|
|
517
|
+
* are present to the transform string.
|
|
518
|
+
*/
|
|
519
|
+
for (let i = 0; i < numTransforms; i++) {
|
|
520
|
+
const key = transformPropOrder[i];
|
|
521
|
+
if (transform[key] !== undefined) {
|
|
522
|
+
const transformName = translateAlias[key] || key;
|
|
523
|
+
transformString += `${transformName}(${transform[key]}) `;
|
|
524
|
+
}
|
|
523
525
|
}
|
|
524
526
|
if (enableHardwareAcceleration && !transform.z) {
|
|
525
527
|
transformString += "translateZ(0)";
|
|
@@ -671,8 +673,7 @@
|
|
|
671
673
|
};
|
|
672
674
|
|
|
673
675
|
function buildHTMLStyles(state, latestValues, options, transformTemplate) {
|
|
674
|
-
const { style, vars, transform,
|
|
675
|
-
transformKeys.length = 0;
|
|
676
|
+
const { style, vars, transform, transformOrigin } = state;
|
|
676
677
|
// Track whether we encounter any transform or transformOrigin values.
|
|
677
678
|
let hasTransform = false;
|
|
678
679
|
let hasTransformOrigin = false;
|
|
@@ -700,7 +701,6 @@
|
|
|
700
701
|
// If this is a transform, flag to enable further transform processing
|
|
701
702
|
hasTransform = true;
|
|
702
703
|
transform[key] = valueAsType;
|
|
703
|
-
transformKeys.push(key);
|
|
704
704
|
// If we already know we have a non-default transform, early return
|
|
705
705
|
if (!transformIsNone)
|
|
706
706
|
continue;
|
|
@@ -719,7 +719,7 @@
|
|
|
719
719
|
}
|
|
720
720
|
if (!latestValues.transform) {
|
|
721
721
|
if (hasTransform || transformTemplate) {
|
|
722
|
-
style.transform = buildTransform(state, options, transformIsNone, transformTemplate);
|
|
722
|
+
style.transform = buildTransform(state.transform, options, transformIsNone, transformTemplate);
|
|
723
723
|
}
|
|
724
724
|
else if (style.transform) {
|
|
725
725
|
/**
|
|
@@ -742,7 +742,6 @@
|
|
|
742
742
|
const createHtmlRenderState = () => ({
|
|
743
743
|
style: {},
|
|
744
744
|
transform: {},
|
|
745
|
-
transformKeys: [],
|
|
746
745
|
transformOrigin: {},
|
|
747
746
|
vars: {},
|
|
748
747
|
});
|
|
@@ -2014,7 +2013,7 @@
|
|
|
2014
2013
|
* This will be replaced by the build step with the latest version number.
|
|
2015
2014
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
2016
2015
|
*/
|
|
2017
|
-
this.version = "9.0.
|
|
2016
|
+
this.version = "9.0.4";
|
|
2018
2017
|
/**
|
|
2019
2018
|
* Duration, in milliseconds, since last updating frame.
|
|
2020
2019
|
*
|
|
@@ -7785,7 +7784,7 @@
|
|
|
7785
7784
|
* and warn against mismatches.
|
|
7786
7785
|
*/
|
|
7787
7786
|
{
|
|
7788
|
-
warnOnce(nextValue.version === "9.0.
|
|
7787
|
+
warnOnce(nextValue.version === "9.0.4", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.0.4 may not work as expected.`);
|
|
7789
7788
|
}
|
|
7790
7789
|
}
|
|
7791
7790
|
else if (isMotionValue(prevValue)) {
|