motion 11.17.1 → 11.18.1
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 +22 -17
- package/dist/cjs/mini.js +409 -2
- package/dist/cjs/react-client.js +28 -21
- package/dist/cjs/react-m.js +22 -19
- package/dist/cjs/react-mini.js +5 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-sequence.mjs +14 -0
- package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +6 -4
- package/dist/es/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +1 -1
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/framer-motion/dist/es/value/index.mjs +1 -1
- package/dist/es/motion/lib/mini.mjs +1 -0
- package/dist/es/motion-utils/dist/es/memo.mjs +1 -0
- package/dist/es/motion-utils/dist/es/noop.mjs +1 -0
- package/dist/es/motion-utils/dist/es/progress.mjs +1 -0
- package/dist/es/motion-utils/dist/es/time-conversion.mjs +2 -0
- package/dist/motion.dev.js +22 -17
- package/dist/motion.js +1 -1
- package/package.json +3 -3
package/dist/cjs/react-m.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
|
|
8
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
8
9
|
const noop = (any) => any;
|
|
9
10
|
|
|
10
11
|
let warning = noop;
|
|
@@ -1026,21 +1027,6 @@ function buildHTMLStyles(state, latestValues, transformTemplate) {
|
|
|
1026
1027
|
}
|
|
1027
1028
|
}
|
|
1028
1029
|
|
|
1029
|
-
function calcOrigin(origin, offset, size) {
|
|
1030
|
-
return typeof origin === "string"
|
|
1031
|
-
? origin
|
|
1032
|
-
: px.transform(offset + size * origin);
|
|
1033
|
-
}
|
|
1034
|
-
/**
|
|
1035
|
-
* The SVG transform origin defaults are different to CSS and is less intuitive,
|
|
1036
|
-
* so we use the measured dimensions of the SVG to reconcile these.
|
|
1037
|
-
*/
|
|
1038
|
-
function calcSVGTransformOrigin(dimensions, originX, originY) {
|
|
1039
|
-
const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
|
|
1040
|
-
const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
|
|
1041
|
-
return `${pxOriginX} ${pxOriginY}`;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
1030
|
const dashKeys = {
|
|
1045
1031
|
offset: "stroke-dashoffset",
|
|
1046
1032
|
array: "stroke-dasharray",
|
|
@@ -1070,6 +1056,21 @@ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true
|
|
|
1070
1056
|
attrs[keys.array] = `${pathLength} ${pathSpacing}`;
|
|
1071
1057
|
}
|
|
1072
1058
|
|
|
1059
|
+
function calcOrigin(origin, offset, size) {
|
|
1060
|
+
return typeof origin === "string"
|
|
1061
|
+
? origin
|
|
1062
|
+
: px.transform(offset + size * origin);
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* The SVG transform origin defaults are different to CSS and is less intuitive,
|
|
1066
|
+
* so we use the measured dimensions of the SVG to reconcile these.
|
|
1067
|
+
*/
|
|
1068
|
+
function calcSVGTransformOrigin(dimensions, originX, originY) {
|
|
1069
|
+
const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
|
|
1070
|
+
const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
|
|
1071
|
+
return `${pxOriginX} ${pxOriginY}`;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1073
1074
|
/**
|
|
1074
1075
|
* Build SVG visual attrbutes, like cx and style.transform
|
|
1075
1076
|
*/
|
|
@@ -1266,10 +1267,12 @@ const svgMotionConfig = {
|
|
|
1266
1267
|
}
|
|
1267
1268
|
if (!needsMeasure)
|
|
1268
1269
|
return;
|
|
1269
|
-
frame.read(() =>
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1270
|
+
frame.read(() => {
|
|
1271
|
+
updateSVGDimensions(current, renderState);
|
|
1272
|
+
frame.render(() => {
|
|
1273
|
+
buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
|
|
1274
|
+
renderSVG(current, renderState);
|
|
1275
|
+
});
|
|
1273
1276
|
});
|
|
1274
1277
|
},
|
|
1275
1278
|
}),
|
package/dist/cjs/react-mini.js
CHANGED
|
@@ -23,6 +23,7 @@ function useUnmountEffect(callback) {
|
|
|
23
23
|
return react.useEffect(() => () => callback(), []);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
26
27
|
const noop = (any) => any;
|
|
27
28
|
|
|
28
29
|
let invariant = noop;
|
|
@@ -34,6 +35,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
37
39
|
function memo(callback) {
|
|
38
40
|
let result;
|
|
39
41
|
return () => {
|
|
@@ -55,6 +57,7 @@ function memo(callback) {
|
|
|
55
57
|
@param [number]: Value to find progress within given range
|
|
56
58
|
@return [number]: Progress of value within range as expressed 0-1
|
|
57
59
|
*/
|
|
60
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
58
61
|
const progress = (from, to, value) => {
|
|
59
62
|
const toFromDifference = to - from;
|
|
60
63
|
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
|
|
@@ -66,7 +69,9 @@ const progress = (from, to, value) => {
|
|
|
66
69
|
* @param seconds - Time in seconds.
|
|
67
70
|
* @return milliseconds - Converted time in milliseconds.
|
|
68
71
|
*/
|
|
72
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
69
73
|
const secondsToMilliseconds = (seconds) => seconds * 1000;
|
|
74
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
70
75
|
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
|
|
71
76
|
|
|
72
77
|
const supportsScrollTimeline = memo(() => window.ScrollTimeline !== undefined);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GroupPlaybackControls } from '../../../../../../motion-dom/dist/es/animation/controls/Group.mjs';
|
|
2
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
3
|
+
import { createAnimationsFromSequence } from '../../sequence/create.mjs';
|
|
4
|
+
import { animateElements } from './animate-elements.mjs';
|
|
5
|
+
|
|
6
|
+
function animateSequence(definition, options) {
|
|
7
|
+
const animations = [];
|
|
8
|
+
createAnimationsFromSequence(definition, options).forEach(({ keyframes, transition }, element) => {
|
|
9
|
+
animations.push(...animateElements(element, keyframes, transition));
|
|
10
|
+
});
|
|
11
|
+
return new GroupPlaybackControls(animations);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { animateSequence };
|
|
@@ -59,10 +59,12 @@ const svgMotionConfig = {
|
|
|
59
59
|
}
|
|
60
60
|
if (!needsMeasure)
|
|
61
61
|
return;
|
|
62
|
-
frame.read(() =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
frame.read(() => {
|
|
63
|
+
updateSVGDimensions(current, renderState);
|
|
64
|
+
frame.render(() => {
|
|
65
|
+
buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
|
|
66
|
+
renderSVG(current, renderState);
|
|
67
|
+
});
|
|
66
68
|
});
|
|
67
69
|
},
|
|
68
70
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildHTMLStyles } from '../../html/utils/build-styles.mjs';
|
|
2
|
-
import { calcSVGTransformOrigin } from './transform-origin.mjs';
|
|
3
2
|
import { buildSVGPath } from './path.mjs';
|
|
3
|
+
import { calcSVGTransformOrigin } from './transform-origin.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Build SVG visual attrbutes, like cx and style.transform
|
|
@@ -17,7 +17,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
17
17
|
* and warn against mismatches.
|
|
18
18
|
*/
|
|
19
19
|
if (process.env.NODE_ENV === "development") {
|
|
20
|
-
warnOnce(nextValue.version === "11.
|
|
20
|
+
warnOnce(nextValue.version === "11.18.1", `Attempting to mix Motion versions ${nextValue.version} with 11.18.1 may not work as expected.`);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
else if (isMotionValue(prevValue)) {
|
|
@@ -34,7 +34,7 @@ class MotionValue {
|
|
|
34
34
|
* This will be replaced by the build step with the latest version number.
|
|
35
35
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
36
36
|
*/
|
|
37
|
-
this.version = "11.
|
|
37
|
+
this.version = "11.18.1";
|
|
38
38
|
/**
|
|
39
39
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
40
40
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
@param [number]: Value to find progress within given range
|
|
11
11
|
@return [number]: Progress of value within range as expressed 0-1
|
|
12
12
|
*/
|
|
13
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
13
14
|
const progress = (from, to, value) => {
|
|
14
15
|
const toFromDifference = to - from;
|
|
15
16
|
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* @param seconds - Time in seconds.
|
|
5
5
|
* @return milliseconds - Converted time in milliseconds.
|
|
6
6
|
*/
|
|
7
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
7
8
|
const secondsToMilliseconds = (seconds) => seconds * 1000;
|
|
9
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
8
10
|
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
|
|
9
11
|
|
|
10
12
|
export { millisecondsToSeconds, secondsToMilliseconds };
|
package/dist/motion.dev.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Motion = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
7
8
|
const noop = (any) => any;
|
|
8
9
|
|
|
9
10
|
let warning = noop;
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
24
26
|
function memo(callback) {
|
|
25
27
|
let result;
|
|
26
28
|
return () => {
|
|
@@ -42,6 +44,7 @@
|
|
|
42
44
|
@param [number]: Value to find progress within given range
|
|
43
45
|
@return [number]: Progress of value within range as expressed 0-1
|
|
44
46
|
*/
|
|
47
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
45
48
|
const progress = (from, to, value) => {
|
|
46
49
|
const toFromDifference = to - from;
|
|
47
50
|
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
|
|
@@ -53,7 +56,9 @@
|
|
|
53
56
|
* @param seconds - Time in seconds.
|
|
54
57
|
* @return milliseconds - Converted time in milliseconds.
|
|
55
58
|
*/
|
|
59
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
56
60
|
const secondsToMilliseconds = (seconds) => seconds * 1000;
|
|
61
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
57
62
|
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
|
|
58
63
|
|
|
59
64
|
const supportsScrollTimeline = memo(() => window.ScrollTimeline !== undefined);
|
|
@@ -1369,7 +1374,7 @@
|
|
|
1369
1374
|
* This will be replaced by the build step with the latest version number.
|
|
1370
1375
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
1371
1376
|
*/
|
|
1372
|
-
this.version = "11.
|
|
1377
|
+
this.version = "11.18.1";
|
|
1373
1378
|
/**
|
|
1374
1379
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
1375
1380
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -4299,7 +4304,7 @@
|
|
|
4299
4304
|
* and warn against mismatches.
|
|
4300
4305
|
*/
|
|
4301
4306
|
{
|
|
4302
|
-
warnOnce(nextValue.version === "11.
|
|
4307
|
+
warnOnce(nextValue.version === "11.18.1", `Attempting to mix Motion versions ${nextValue.version} with 11.18.1 may not work as expected.`);
|
|
4303
4308
|
}
|
|
4304
4309
|
}
|
|
4305
4310
|
else if (isMotionValue(prevValue)) {
|
|
@@ -4956,21 +4961,6 @@
|
|
|
4956
4961
|
}
|
|
4957
4962
|
}
|
|
4958
4963
|
|
|
4959
|
-
function calcOrigin(origin, offset, size) {
|
|
4960
|
-
return typeof origin === "string"
|
|
4961
|
-
? origin
|
|
4962
|
-
: px.transform(offset + size * origin);
|
|
4963
|
-
}
|
|
4964
|
-
/**
|
|
4965
|
-
* The SVG transform origin defaults are different to CSS and is less intuitive,
|
|
4966
|
-
* so we use the measured dimensions of the SVG to reconcile these.
|
|
4967
|
-
*/
|
|
4968
|
-
function calcSVGTransformOrigin(dimensions, originX, originY) {
|
|
4969
|
-
const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
|
|
4970
|
-
const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
|
|
4971
|
-
return `${pxOriginX} ${pxOriginY}`;
|
|
4972
|
-
}
|
|
4973
|
-
|
|
4974
4964
|
const dashKeys = {
|
|
4975
4965
|
offset: "stroke-dashoffset",
|
|
4976
4966
|
array: "stroke-dasharray",
|
|
@@ -5000,6 +4990,21 @@
|
|
|
5000
4990
|
attrs[keys.array] = `${pathLength} ${pathSpacing}`;
|
|
5001
4991
|
}
|
|
5002
4992
|
|
|
4993
|
+
function calcOrigin(origin, offset, size) {
|
|
4994
|
+
return typeof origin === "string"
|
|
4995
|
+
? origin
|
|
4996
|
+
: px.transform(offset + size * origin);
|
|
4997
|
+
}
|
|
4998
|
+
/**
|
|
4999
|
+
* The SVG transform origin defaults are different to CSS and is less intuitive,
|
|
5000
|
+
* so we use the measured dimensions of the SVG to reconcile these.
|
|
5001
|
+
*/
|
|
5002
|
+
function calcSVGTransformOrigin(dimensions, originX, originY) {
|
|
5003
|
+
const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
|
|
5004
|
+
const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
|
|
5005
|
+
return `${pxOriginX} ${pxOriginY}`;
|
|
5006
|
+
}
|
|
5007
|
+
|
|
5003
5008
|
/**
|
|
5004
5009
|
* Build SVG visual attrbutes, like cx and style.transform
|
|
5005
5010
|
*/
|