framer-motion 7.6.18 → 7.7.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/index.js +33 -27
- package/dist/es/animation/utils/transitions.mjs +1 -19
- package/dist/es/render/dom/use-render.mjs +1 -1
- package/dist/es/render/svg/SVGVisualElement.mjs +10 -1
- package/dist/es/render/svg/config-motion.mjs +2 -1
- package/dist/es/render/svg/lowercase-elements.mjs +1 -0
- package/dist/es/render/svg/use-props.mjs +3 -2
- package/dist/es/render/svg/utils/build-attrs.mjs +11 -1
- package/dist/es/render/svg/utils/camel-case-attrs.mjs +3 -0
- package/dist/es/render/svg/utils/is-svg-tag.mjs +3 -0
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +33 -27
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +3 -21
- 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 +9 -9
package/dist/cjs/index.js
CHANGED
|
@@ -432,6 +432,7 @@ const lowercaseSVGElements = [
|
|
|
432
432
|
"stop",
|
|
433
433
|
"switch",
|
|
434
434
|
"symbol",
|
|
435
|
+
"svg",
|
|
435
436
|
"text",
|
|
436
437
|
"tspan",
|
|
437
438
|
"use",
|
|
@@ -933,8 +934,18 @@ function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true
|
|
|
933
934
|
*/
|
|
934
935
|
function buildSVGAttrs(state, { attrX, attrY, originX, originY, pathLength, pathSpacing = 1, pathOffset = 0,
|
|
935
936
|
// This is object creation, which we try to avoid per-frame.
|
|
936
|
-
...latest }, options, transformTemplate) {
|
|
937
|
+
...latest }, options, isSVGTag, transformTemplate) {
|
|
937
938
|
buildHTMLStyles(state, latest, options, transformTemplate);
|
|
939
|
+
/**
|
|
940
|
+
* For svg tags we just want to make sure viewBox is animatable and treat all the styles
|
|
941
|
+
* as normal HTML tags.
|
|
942
|
+
*/
|
|
943
|
+
if (isSVGTag) {
|
|
944
|
+
if (state.style.viewBox) {
|
|
945
|
+
state.attrs.viewBox = state.style.viewBox;
|
|
946
|
+
}
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
938
949
|
state.attrs = state.style;
|
|
939
950
|
state.style = {};
|
|
940
951
|
const { attrs, style, dimensions } = state;
|
|
@@ -968,10 +979,12 @@ const createSvgRenderState = () => ({
|
|
|
968
979
|
attrs: {},
|
|
969
980
|
});
|
|
970
981
|
|
|
971
|
-
|
|
982
|
+
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
983
|
+
|
|
984
|
+
function useSVGProps(props, visualState, _isStatic, Component) {
|
|
972
985
|
const visualProps = React.useMemo(() => {
|
|
973
986
|
const state = createSvgRenderState();
|
|
974
|
-
buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, props.transformTemplate);
|
|
987
|
+
buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, isSVGTag(Component), props.transformTemplate);
|
|
975
988
|
return {
|
|
976
989
|
...state.attrs,
|
|
977
990
|
style: { ...state.style },
|
|
@@ -990,7 +1003,7 @@ function createUseRender(forwardMotionProps = false) {
|
|
|
990
1003
|
const useVisualProps = isSVGComponent(Component)
|
|
991
1004
|
? useSVGProps
|
|
992
1005
|
: useHTMLProps;
|
|
993
|
-
const visualProps = useVisualProps(props, latestValues, isStatic);
|
|
1006
|
+
const visualProps = useVisualProps(props, latestValues, isStatic, Component);
|
|
994
1007
|
const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
|
|
995
1008
|
const elementProps = {
|
|
996
1009
|
...filteredProps,
|
|
@@ -1042,6 +1055,9 @@ const camelCaseAttributes = new Set([
|
|
|
1042
1055
|
"viewBox",
|
|
1043
1056
|
"gradientTransform",
|
|
1044
1057
|
"pathLength",
|
|
1058
|
+
"startOffset",
|
|
1059
|
+
"textLength",
|
|
1060
|
+
"lengthAdjust",
|
|
1045
1061
|
]);
|
|
1046
1062
|
|
|
1047
1063
|
function renderSVG(element, renderState, _styleProp, projection) {
|
|
@@ -1214,7 +1230,7 @@ const svgMotionConfig = {
|
|
|
1214
1230
|
height: 0,
|
|
1215
1231
|
};
|
|
1216
1232
|
}
|
|
1217
|
-
buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, props.transformTemplate);
|
|
1233
|
+
buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, isSVGTag(instance.tagName), props.transformTemplate);
|
|
1218
1234
|
renderSVG(instance, renderState);
|
|
1219
1235
|
},
|
|
1220
1236
|
}),
|
|
@@ -2815,11 +2831,10 @@ function inertia({ from = 0, velocity = 0, min, max, power = 0.8, timeConstant =
|
|
|
2815
2831
|
function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, ...transition }) {
|
|
2816
2832
|
return !!Object.keys(transition).length;
|
|
2817
2833
|
}
|
|
2818
|
-
let legacyRepeatWarning = false;
|
|
2819
2834
|
/**
|
|
2820
2835
|
* Convert Framer Motion's Transition type into Popmotion-compatible options.
|
|
2821
2836
|
*/
|
|
2822
|
-
function convertTransitionToAnimationOptions({ ease, times,
|
|
2837
|
+
function convertTransitionToAnimationOptions({ ease, times, ...transition }) {
|
|
2823
2838
|
const options = { ...transition };
|
|
2824
2839
|
if (times)
|
|
2825
2840
|
options["offset"] = times;
|
|
@@ -2843,23 +2858,6 @@ function convertTransitionToAnimationOptions({ ease, times, yoyo, flip, loop, ..
|
|
|
2843
2858
|
*/
|
|
2844
2859
|
if (transition.type === "tween")
|
|
2845
2860
|
options.type = "keyframes";
|
|
2846
|
-
/**
|
|
2847
|
-
* TODO: These options are officially removed from the API.
|
|
2848
|
-
*/
|
|
2849
|
-
if (yoyo || loop || flip) {
|
|
2850
|
-
heyListen.warning(!legacyRepeatWarning, "yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options.");
|
|
2851
|
-
legacyRepeatWarning = true;
|
|
2852
|
-
if (yoyo) {
|
|
2853
|
-
options.repeatType = "reverse";
|
|
2854
|
-
}
|
|
2855
|
-
else if (loop) {
|
|
2856
|
-
options.repeatType = "loop";
|
|
2857
|
-
}
|
|
2858
|
-
else if (flip) {
|
|
2859
|
-
options.repeatType = "mirror";
|
|
2860
|
-
}
|
|
2861
|
-
options.repeat = loop || yoyo || flip || transition.repeat;
|
|
2862
|
-
}
|
|
2863
2861
|
/**
|
|
2864
2862
|
* TODO: Popmotion 9 has the ability to automatically detect whether to use
|
|
2865
2863
|
* a keyframes or spring animation, but does so by detecting velocity and other spring options.
|
|
@@ -3094,7 +3092,7 @@ class MotionValue {
|
|
|
3094
3092
|
* This will be replaced by the build step with the latest version number.
|
|
3095
3093
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3096
3094
|
*/
|
|
3097
|
-
this.version = "7.
|
|
3095
|
+
this.version = "7.7.0";
|
|
3098
3096
|
/**
|
|
3099
3097
|
* Duration, in milliseconds, since last updating frame.
|
|
3100
3098
|
*
|
|
@@ -5379,7 +5377,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
5379
5377
|
* and warn against mismatches.
|
|
5380
5378
|
*/
|
|
5381
5379
|
if (process.env.NODE_ENV === "development") {
|
|
5382
|
-
warnOnce(nextValue.version === "7.
|
|
5380
|
+
warnOnce(nextValue.version === "7.7.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.7.0 may not work as expected.`);
|
|
5383
5381
|
}
|
|
5384
5382
|
}
|
|
5385
5383
|
else if (isMotionValue(prevValue)) {
|
|
@@ -5946,6 +5944,10 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
5946
5944
|
}
|
|
5947
5945
|
|
|
5948
5946
|
class SVGVisualElement extends DOMVisualElement {
|
|
5947
|
+
constructor() {
|
|
5948
|
+
super(...arguments);
|
|
5949
|
+
this.isSVGTag = false;
|
|
5950
|
+
}
|
|
5949
5951
|
getBaseTargetFromProps(props, key) {
|
|
5950
5952
|
return props[key];
|
|
5951
5953
|
}
|
|
@@ -5964,11 +5966,15 @@ class SVGVisualElement extends DOMVisualElement {
|
|
|
5964
5966
|
return scrapeMotionValuesFromProps(props);
|
|
5965
5967
|
}
|
|
5966
5968
|
build(renderState, latestValues, options, props) {
|
|
5967
|
-
buildSVGAttrs(renderState, latestValues, options, props.transformTemplate);
|
|
5969
|
+
buildSVGAttrs(renderState, latestValues, options, this.isSVGTag, props.transformTemplate);
|
|
5968
5970
|
}
|
|
5969
5971
|
renderInstance(instance, renderState, styleProp, projection) {
|
|
5970
5972
|
renderSVG(instance, renderState, styleProp, projection);
|
|
5971
5973
|
}
|
|
5974
|
+
mount(instance) {
|
|
5975
|
+
this.isSVGTag = isSVGTag(instance.tagName);
|
|
5976
|
+
super.mount(instance);
|
|
5977
|
+
}
|
|
5972
5978
|
}
|
|
5973
5979
|
|
|
5974
5980
|
const createDomVisualElement = (Component, options) => {
|
|
@@ -18,11 +18,10 @@ import { animate } from '../legacy-popmotion/index.mjs';
|
|
|
18
18
|
function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, ...transition }) {
|
|
19
19
|
return !!Object.keys(transition).length;
|
|
20
20
|
}
|
|
21
|
-
let legacyRepeatWarning = false;
|
|
22
21
|
/**
|
|
23
22
|
* Convert Framer Motion's Transition type into Popmotion-compatible options.
|
|
24
23
|
*/
|
|
25
|
-
function convertTransitionToAnimationOptions({ ease, times,
|
|
24
|
+
function convertTransitionToAnimationOptions({ ease, times, ...transition }) {
|
|
26
25
|
const options = { ...transition };
|
|
27
26
|
if (times)
|
|
28
27
|
options["offset"] = times;
|
|
@@ -46,23 +45,6 @@ function convertTransitionToAnimationOptions({ ease, times, yoyo, flip, loop, ..
|
|
|
46
45
|
*/
|
|
47
46
|
if (transition.type === "tween")
|
|
48
47
|
options.type = "keyframes";
|
|
49
|
-
/**
|
|
50
|
-
* TODO: These options are officially removed from the API.
|
|
51
|
-
*/
|
|
52
|
-
if (yoyo || loop || flip) {
|
|
53
|
-
warning(!legacyRepeatWarning, "yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options.");
|
|
54
|
-
legacyRepeatWarning = true;
|
|
55
|
-
if (yoyo) {
|
|
56
|
-
options.repeatType = "reverse";
|
|
57
|
-
}
|
|
58
|
-
else if (loop) {
|
|
59
|
-
options.repeatType = "loop";
|
|
60
|
-
}
|
|
61
|
-
else if (flip) {
|
|
62
|
-
options.repeatType = "mirror";
|
|
63
|
-
}
|
|
64
|
-
options.repeat = loop || yoyo || flip || transition.repeat;
|
|
65
|
-
}
|
|
66
48
|
/**
|
|
67
49
|
* TODO: Popmotion 9 has the ability to automatically detect whether to use
|
|
68
50
|
* a keyframes or spring animation, but does so by detecting velocity and other spring options.
|
|
@@ -9,7 +9,7 @@ function createUseRender(forwardMotionProps = false) {
|
|
|
9
9
|
const useVisualProps = isSVGComponent(Component)
|
|
10
10
|
? useSVGProps
|
|
11
11
|
: useHTMLProps;
|
|
12
|
-
const visualProps = useVisualProps(props, latestValues, isStatic);
|
|
12
|
+
const visualProps = useVisualProps(props, latestValues, isStatic, Component);
|
|
13
13
|
const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
|
|
14
14
|
const elementProps = {
|
|
15
15
|
...filteredProps,
|
|
@@ -7,8 +7,13 @@ import { transformProps } from '../html/utils/transform.mjs';
|
|
|
7
7
|
import { renderSVG } from './utils/render.mjs';
|
|
8
8
|
import { getDefaultValueType } from '../dom/value-types/defaults.mjs';
|
|
9
9
|
import { createBox } from '../../projection/geometry/models.mjs';
|
|
10
|
+
import { isSVGTag } from './utils/is-svg-tag.mjs';
|
|
10
11
|
|
|
11
12
|
class SVGVisualElement extends DOMVisualElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.isSVGTag = false;
|
|
16
|
+
}
|
|
12
17
|
getBaseTargetFromProps(props, key) {
|
|
13
18
|
return props[key];
|
|
14
19
|
}
|
|
@@ -27,11 +32,15 @@ class SVGVisualElement extends DOMVisualElement {
|
|
|
27
32
|
return scrapeMotionValuesFromProps(props);
|
|
28
33
|
}
|
|
29
34
|
build(renderState, latestValues, options, props) {
|
|
30
|
-
buildSVGAttrs(renderState, latestValues, options, props.transformTemplate);
|
|
35
|
+
buildSVGAttrs(renderState, latestValues, options, this.isSVGTag, props.transformTemplate);
|
|
31
36
|
}
|
|
32
37
|
renderInstance(instance, renderState, styleProp, projection) {
|
|
33
38
|
renderSVG(instance, renderState, styleProp, projection);
|
|
34
39
|
}
|
|
40
|
+
mount(instance) {
|
|
41
|
+
this.isSVGTag = isSVGTag(instance.tagName);
|
|
42
|
+
super.mount(instance);
|
|
43
|
+
}
|
|
35
44
|
}
|
|
36
45
|
|
|
37
46
|
export { SVGVisualElement };
|
|
@@ -3,6 +3,7 @@ import { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.mjs';
|
|
|
3
3
|
import { makeUseVisualState } from '../../motion/utils/use-visual-state.mjs';
|
|
4
4
|
import { createSvgRenderState } from './utils/create-render-state.mjs';
|
|
5
5
|
import { buildSVGAttrs } from './utils/build-attrs.mjs';
|
|
6
|
+
import { isSVGTag } from './utils/is-svg-tag.mjs';
|
|
6
7
|
|
|
7
8
|
const svgMotionConfig = {
|
|
8
9
|
useVisualState: makeUseVisualState({
|
|
@@ -25,7 +26,7 @@ const svgMotionConfig = {
|
|
|
25
26
|
height: 0,
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
|
-
buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, props.transformTemplate);
|
|
29
|
+
buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, isSVGTag(instance.tagName), props.transformTemplate);
|
|
29
30
|
renderSVG(instance, renderState);
|
|
30
31
|
},
|
|
31
32
|
}),
|
|
@@ -2,11 +2,12 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import { copyRawValuesOnly } from '../html/use-props.mjs';
|
|
3
3
|
import { buildSVGAttrs } from './utils/build-attrs.mjs';
|
|
4
4
|
import { createSvgRenderState } from './utils/create-render-state.mjs';
|
|
5
|
+
import { isSVGTag } from './utils/is-svg-tag.mjs';
|
|
5
6
|
|
|
6
|
-
function useSVGProps(props, visualState) {
|
|
7
|
+
function useSVGProps(props, visualState, _isStatic, Component) {
|
|
7
8
|
const visualProps = useMemo(() => {
|
|
8
9
|
const state = createSvgRenderState();
|
|
9
|
-
buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, props.transformTemplate);
|
|
10
|
+
buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, isSVGTag(Component), props.transformTemplate);
|
|
10
11
|
return {
|
|
11
12
|
...state.attrs,
|
|
12
13
|
style: { ...state.style },
|
|
@@ -7,8 +7,18 @@ import { buildSVGPath } from './path.mjs';
|
|
|
7
7
|
*/
|
|
8
8
|
function buildSVGAttrs(state, { attrX, attrY, originX, originY, pathLength, pathSpacing = 1, pathOffset = 0,
|
|
9
9
|
// This is object creation, which we try to avoid per-frame.
|
|
10
|
-
...latest }, options, transformTemplate) {
|
|
10
|
+
...latest }, options, isSVGTag, transformTemplate) {
|
|
11
11
|
buildHTMLStyles(state, latest, options, transformTemplate);
|
|
12
|
+
/**
|
|
13
|
+
* For svg tags we just want to make sure viewBox is animatable and treat all the styles
|
|
14
|
+
* as normal HTML tags.
|
|
15
|
+
*/
|
|
16
|
+
if (isSVGTag) {
|
|
17
|
+
if (state.style.viewBox) {
|
|
18
|
+
state.attrs.viewBox = state.style.viewBox;
|
|
19
|
+
}
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
12
22
|
state.attrs = state.style;
|
|
13
23
|
state.style = {};
|
|
14
24
|
const { attrs, style, dimensions } = state;
|
|
@@ -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 === "7.
|
|
25
|
+
warnOnce(nextValue.version === "7.7.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.7.0 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ class MotionValue {
|
|
|
24
24
|
* This will be replaced by the build step with the latest version number.
|
|
25
25
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
26
26
|
*/
|
|
27
|
-
this.version = "7.
|
|
27
|
+
this.version = "7.7.0";
|
|
28
28
|
/**
|
|
29
29
|
* Duration, in milliseconds, since last updating frame.
|
|
30
30
|
*
|
|
@@ -427,6 +427,7 @@
|
|
|
427
427
|
"stop",
|
|
428
428
|
"switch",
|
|
429
429
|
"symbol",
|
|
430
|
+
"svg",
|
|
430
431
|
"text",
|
|
431
432
|
"tspan",
|
|
432
433
|
"use",
|
|
@@ -1129,8 +1130,18 @@
|
|
|
1129
1130
|
*/
|
|
1130
1131
|
function buildSVGAttrs(state, { attrX, attrY, originX, originY, pathLength, pathSpacing = 1, pathOffset = 0,
|
|
1131
1132
|
// This is object creation, which we try to avoid per-frame.
|
|
1132
|
-
...latest }, options, transformTemplate) {
|
|
1133
|
+
...latest }, options, isSVGTag, transformTemplate) {
|
|
1133
1134
|
buildHTMLStyles(state, latest, options, transformTemplate);
|
|
1135
|
+
/**
|
|
1136
|
+
* For svg tags we just want to make sure viewBox is animatable and treat all the styles
|
|
1137
|
+
* as normal HTML tags.
|
|
1138
|
+
*/
|
|
1139
|
+
if (isSVGTag) {
|
|
1140
|
+
if (state.style.viewBox) {
|
|
1141
|
+
state.attrs.viewBox = state.style.viewBox;
|
|
1142
|
+
}
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1134
1145
|
state.attrs = state.style;
|
|
1135
1146
|
state.style = {};
|
|
1136
1147
|
const { attrs, style, dimensions } = state;
|
|
@@ -1164,10 +1175,12 @@
|
|
|
1164
1175
|
attrs: {},
|
|
1165
1176
|
});
|
|
1166
1177
|
|
|
1167
|
-
|
|
1178
|
+
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
1179
|
+
|
|
1180
|
+
function useSVGProps(props, visualState, _isStatic, Component) {
|
|
1168
1181
|
const visualProps = React.useMemo(() => {
|
|
1169
1182
|
const state = createSvgRenderState();
|
|
1170
|
-
buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, props.transformTemplate);
|
|
1183
|
+
buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, isSVGTag(Component), props.transformTemplate);
|
|
1171
1184
|
return {
|
|
1172
1185
|
...state.attrs,
|
|
1173
1186
|
style: { ...state.style },
|
|
@@ -1186,7 +1199,7 @@
|
|
|
1186
1199
|
const useVisualProps = isSVGComponent(Component)
|
|
1187
1200
|
? useSVGProps
|
|
1188
1201
|
: useHTMLProps;
|
|
1189
|
-
const visualProps = useVisualProps(props, latestValues, isStatic);
|
|
1202
|
+
const visualProps = useVisualProps(props, latestValues, isStatic, Component);
|
|
1190
1203
|
const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
|
|
1191
1204
|
const elementProps = {
|
|
1192
1205
|
...filteredProps,
|
|
@@ -1238,6 +1251,9 @@
|
|
|
1238
1251
|
"viewBox",
|
|
1239
1252
|
"gradientTransform",
|
|
1240
1253
|
"pathLength",
|
|
1254
|
+
"startOffset",
|
|
1255
|
+
"textLength",
|
|
1256
|
+
"lengthAdjust",
|
|
1241
1257
|
]);
|
|
1242
1258
|
|
|
1243
1259
|
function renderSVG(element, renderState, _styleProp, projection) {
|
|
@@ -1410,7 +1426,7 @@
|
|
|
1410
1426
|
height: 0,
|
|
1411
1427
|
};
|
|
1412
1428
|
}
|
|
1413
|
-
buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, props.transformTemplate);
|
|
1429
|
+
buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, isSVGTag(instance.tagName), props.transformTemplate);
|
|
1414
1430
|
renderSVG(instance, renderState);
|
|
1415
1431
|
},
|
|
1416
1432
|
}),
|
|
@@ -3148,11 +3164,10 @@
|
|
|
3148
3164
|
function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, ...transition }) {
|
|
3149
3165
|
return !!Object.keys(transition).length;
|
|
3150
3166
|
}
|
|
3151
|
-
let legacyRepeatWarning = false;
|
|
3152
3167
|
/**
|
|
3153
3168
|
* Convert Framer Motion's Transition type into Popmotion-compatible options.
|
|
3154
3169
|
*/
|
|
3155
|
-
function convertTransitionToAnimationOptions({ ease, times,
|
|
3170
|
+
function convertTransitionToAnimationOptions({ ease, times, ...transition }) {
|
|
3156
3171
|
const options = { ...transition };
|
|
3157
3172
|
if (times)
|
|
3158
3173
|
options["offset"] = times;
|
|
@@ -3176,23 +3191,6 @@
|
|
|
3176
3191
|
*/
|
|
3177
3192
|
if (transition.type === "tween")
|
|
3178
3193
|
options.type = "keyframes";
|
|
3179
|
-
/**
|
|
3180
|
-
* TODO: These options are officially removed from the API.
|
|
3181
|
-
*/
|
|
3182
|
-
if (yoyo || loop || flip) {
|
|
3183
|
-
warning(!legacyRepeatWarning, "yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options.");
|
|
3184
|
-
legacyRepeatWarning = true;
|
|
3185
|
-
if (yoyo) {
|
|
3186
|
-
options.repeatType = "reverse";
|
|
3187
|
-
}
|
|
3188
|
-
else if (loop) {
|
|
3189
|
-
options.repeatType = "loop";
|
|
3190
|
-
}
|
|
3191
|
-
else if (flip) {
|
|
3192
|
-
options.repeatType = "mirror";
|
|
3193
|
-
}
|
|
3194
|
-
options.repeat = loop || yoyo || flip || transition.repeat;
|
|
3195
|
-
}
|
|
3196
3194
|
/**
|
|
3197
3195
|
* TODO: Popmotion 9 has the ability to automatically detect whether to use
|
|
3198
3196
|
* a keyframes or spring animation, but does so by detecting velocity and other spring options.
|
|
@@ -3427,7 +3425,7 @@
|
|
|
3427
3425
|
* This will be replaced by the build step with the latest version number.
|
|
3428
3426
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3429
3427
|
*/
|
|
3430
|
-
this.version = "7.
|
|
3428
|
+
this.version = "7.7.0";
|
|
3431
3429
|
/**
|
|
3432
3430
|
* Duration, in milliseconds, since last updating frame.
|
|
3433
3431
|
*
|
|
@@ -5712,7 +5710,7 @@
|
|
|
5712
5710
|
* and warn against mismatches.
|
|
5713
5711
|
*/
|
|
5714
5712
|
{
|
|
5715
|
-
warnOnce(nextValue.version === "7.
|
|
5713
|
+
warnOnce(nextValue.version === "7.7.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 7.7.0 may not work as expected.`);
|
|
5716
5714
|
}
|
|
5717
5715
|
}
|
|
5718
5716
|
else if (isMotionValue(prevValue)) {
|
|
@@ -6279,6 +6277,10 @@
|
|
|
6279
6277
|
}
|
|
6280
6278
|
|
|
6281
6279
|
class SVGVisualElement extends DOMVisualElement {
|
|
6280
|
+
constructor() {
|
|
6281
|
+
super(...arguments);
|
|
6282
|
+
this.isSVGTag = false;
|
|
6283
|
+
}
|
|
6282
6284
|
getBaseTargetFromProps(props, key) {
|
|
6283
6285
|
return props[key];
|
|
6284
6286
|
}
|
|
@@ -6297,11 +6299,15 @@
|
|
|
6297
6299
|
return scrapeMotionValuesFromProps(props);
|
|
6298
6300
|
}
|
|
6299
6301
|
build(renderState, latestValues, options, props) {
|
|
6300
|
-
buildSVGAttrs(renderState, latestValues, options, props.transformTemplate);
|
|
6302
|
+
buildSVGAttrs(renderState, latestValues, options, this.isSVGTag, props.transformTemplate);
|
|
6301
6303
|
}
|
|
6302
6304
|
renderInstance(instance, renderState, styleProp, projection) {
|
|
6303
6305
|
renderSVG(instance, renderState, styleProp, projection);
|
|
6304
6306
|
}
|
|
6307
|
+
mount(instance) {
|
|
6308
|
+
this.isSVGTag = isSVGTag(instance.tagName);
|
|
6309
|
+
super.mount(instance);
|
|
6310
|
+
}
|
|
6305
6311
|
}
|
|
6306
6312
|
|
|
6307
6313
|
const createDomVisualElement = (Component, options) => {
|