motion-v 1.0.0-alpha.1 → 1.0.0-alpha.3
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 +51 -47
- package/dist/es/features/animation/animation.mjs +1 -1
- package/dist/es/state/style.mjs +50 -46
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -5792,49 +5792,52 @@ function createStyles(keyframes2) {
|
|
|
5792
5792
|
return initialKeyframes;
|
|
5793
5793
|
}
|
|
5794
5794
|
const SVG_STYLE_TO_ATTRIBUTES = {
|
|
5795
|
-
fill: true,
|
|
5796
|
-
stroke: true,
|
|
5797
|
-
|
|
5798
|
-
opacity: true,
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
cx: true,
|
|
5806
|
-
cy: true,
|
|
5807
|
-
r: true,
|
|
5808
|
-
d: true,
|
|
5809
|
-
x1: true,
|
|
5810
|
-
y1: true,
|
|
5811
|
-
x2: true,
|
|
5812
|
-
y2: true,
|
|
5813
|
-
points: true,
|
|
5814
|
-
|
|
5815
|
-
viewBox: true,
|
|
5816
|
-
width: true,
|
|
5817
|
-
height: true,
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
filter: true,
|
|
5821
|
-
mask: true,
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5795
|
+
"fill": true,
|
|
5796
|
+
"stroke": true,
|
|
5797
|
+
"stroke-width": true,
|
|
5798
|
+
"opacity": true,
|
|
5799
|
+
"fill-opacity": true,
|
|
5800
|
+
"stroke-opacity": true,
|
|
5801
|
+
"stroke-linecap": true,
|
|
5802
|
+
"stroke-linejoin": true,
|
|
5803
|
+
"stroke-dasharray": true,
|
|
5804
|
+
"stroke-dashoffset": true,
|
|
5805
|
+
"cx": true,
|
|
5806
|
+
"cy": true,
|
|
5807
|
+
"r": true,
|
|
5808
|
+
"d": true,
|
|
5809
|
+
"x1": true,
|
|
5810
|
+
"y1": true,
|
|
5811
|
+
"x2": true,
|
|
5812
|
+
"y2": true,
|
|
5813
|
+
"points": true,
|
|
5814
|
+
"path-length": true,
|
|
5815
|
+
"viewBox": true,
|
|
5816
|
+
"width": true,
|
|
5817
|
+
"height": true,
|
|
5818
|
+
"preserve-aspect-ratio": true,
|
|
5819
|
+
"clip-path": true,
|
|
5820
|
+
"filter": true,
|
|
5821
|
+
"mask": true,
|
|
5822
|
+
"stop-color": true,
|
|
5823
|
+
"stop-opacity": true,
|
|
5824
|
+
"gradient-transform": true,
|
|
5825
|
+
"gradient-units": true,
|
|
5826
|
+
"spread-method": true,
|
|
5827
|
+
"marker-end": true,
|
|
5828
|
+
"marker-mid": true,
|
|
5829
|
+
"marker-start": true,
|
|
5830
|
+
"text-anchor": true,
|
|
5831
|
+
"dominant-baseline": true,
|
|
5832
|
+
"font-family": true,
|
|
5833
|
+
"font-size": true,
|
|
5834
|
+
"font-weight": true,
|
|
5835
|
+
"letter-spacing": true,
|
|
5836
|
+
"vector-effect": true
|
|
5837
5837
|
};
|
|
5838
|
+
function camelToKebab(str) {
|
|
5839
|
+
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
5840
|
+
}
|
|
5838
5841
|
function buildSVGPath(attrs, length, spacing = 1, offset = 0) {
|
|
5839
5842
|
attrs.pathLength = 1;
|
|
5840
5843
|
attrs["stroke-dashoffset"] = px.transform(-offset);
|
|
@@ -5846,15 +5849,16 @@ function convertSvgStyleToAttributes(keyframes2) {
|
|
|
5846
5849
|
const attributes = {};
|
|
5847
5850
|
const styleProps = {};
|
|
5848
5851
|
for (const key in keyframes2) {
|
|
5849
|
-
|
|
5852
|
+
const kebabKey = camelToKebab(key);
|
|
5853
|
+
if (kebabKey in SVG_STYLE_TO_ATTRIBUTES) {
|
|
5850
5854
|
const value = keyframes2[key];
|
|
5851
|
-
attributes[
|
|
5855
|
+
attributes[kebabKey] = isMotionValue(value) ? value.get() : value;
|
|
5852
5856
|
} else {
|
|
5853
5857
|
styleProps[key] = keyframes2[key];
|
|
5854
5858
|
}
|
|
5855
5859
|
}
|
|
5856
|
-
if (attributes
|
|
5857
|
-
buildSVGPath(attributes, attributes
|
|
5860
|
+
if (attributes["path-length"]) {
|
|
5861
|
+
buildSVGPath(attributes, attributes["path-length"], attributes["path-spacing"], attributes["path-offset"]);
|
|
5858
5862
|
}
|
|
5859
5863
|
return {
|
|
5860
5864
|
attributes,
|
|
@@ -5887,7 +5891,7 @@ class AnimationFeature extends Feature {
|
|
|
5887
5891
|
directTransition
|
|
5888
5892
|
});
|
|
5889
5893
|
const factories = this.createAnimationFactories(prevTarget, animationOptions, controlDelay);
|
|
5890
|
-
const { getChildAnimations, childAnimations } = this.setupChildAnimations(animationOptions,
|
|
5894
|
+
const { getChildAnimations, childAnimations } = this.setupChildAnimations(animationOptions, this.state.activeStates, isFallback);
|
|
5891
5895
|
return this.executeAnimations({
|
|
5892
5896
|
factories,
|
|
5893
5897
|
getChildAnimations,
|
|
@@ -34,7 +34,7 @@ class AnimationFeature extends Feature {
|
|
|
34
34
|
directTransition
|
|
35
35
|
});
|
|
36
36
|
const factories = this.createAnimationFactories(prevTarget, animationOptions, controlDelay);
|
|
37
|
-
const { getChildAnimations, childAnimations } = this.setupChildAnimations(animationOptions,
|
|
37
|
+
const { getChildAnimations, childAnimations } = this.setupChildAnimations(animationOptions, this.state.activeStates, isFallback);
|
|
38
38
|
return this.executeAnimations({
|
|
39
39
|
factories,
|
|
40
40
|
getChildAnimations,
|
package/dist/es/state/style.mjs
CHANGED
|
@@ -47,49 +47,52 @@ function createStyles(keyframes) {
|
|
|
47
47
|
return initialKeyframes;
|
|
48
48
|
}
|
|
49
49
|
const SVG_STYLE_TO_ATTRIBUTES = {
|
|
50
|
-
fill: true,
|
|
51
|
-
stroke: true,
|
|
52
|
-
|
|
53
|
-
opacity: true,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
cx: true,
|
|
61
|
-
cy: true,
|
|
62
|
-
r: true,
|
|
63
|
-
d: true,
|
|
64
|
-
x1: true,
|
|
65
|
-
y1: true,
|
|
66
|
-
x2: true,
|
|
67
|
-
y2: true,
|
|
68
|
-
points: true,
|
|
69
|
-
|
|
70
|
-
viewBox: true,
|
|
71
|
-
width: true,
|
|
72
|
-
height: true,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
filter: true,
|
|
76
|
-
mask: true,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
50
|
+
"fill": true,
|
|
51
|
+
"stroke": true,
|
|
52
|
+
"stroke-width": true,
|
|
53
|
+
"opacity": true,
|
|
54
|
+
"fill-opacity": true,
|
|
55
|
+
"stroke-opacity": true,
|
|
56
|
+
"stroke-linecap": true,
|
|
57
|
+
"stroke-linejoin": true,
|
|
58
|
+
"stroke-dasharray": true,
|
|
59
|
+
"stroke-dashoffset": true,
|
|
60
|
+
"cx": true,
|
|
61
|
+
"cy": true,
|
|
62
|
+
"r": true,
|
|
63
|
+
"d": true,
|
|
64
|
+
"x1": true,
|
|
65
|
+
"y1": true,
|
|
66
|
+
"x2": true,
|
|
67
|
+
"y2": true,
|
|
68
|
+
"points": true,
|
|
69
|
+
"path-length": true,
|
|
70
|
+
"viewBox": true,
|
|
71
|
+
"width": true,
|
|
72
|
+
"height": true,
|
|
73
|
+
"preserve-aspect-ratio": true,
|
|
74
|
+
"clip-path": true,
|
|
75
|
+
"filter": true,
|
|
76
|
+
"mask": true,
|
|
77
|
+
"stop-color": true,
|
|
78
|
+
"stop-opacity": true,
|
|
79
|
+
"gradient-transform": true,
|
|
80
|
+
"gradient-units": true,
|
|
81
|
+
"spread-method": true,
|
|
82
|
+
"marker-end": true,
|
|
83
|
+
"marker-mid": true,
|
|
84
|
+
"marker-start": true,
|
|
85
|
+
"text-anchor": true,
|
|
86
|
+
"dominant-baseline": true,
|
|
87
|
+
"font-family": true,
|
|
88
|
+
"font-size": true,
|
|
89
|
+
"font-weight": true,
|
|
90
|
+
"letter-spacing": true,
|
|
91
|
+
"vector-effect": true
|
|
92
92
|
};
|
|
93
|
+
function camelToKebab(str) {
|
|
94
|
+
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
95
|
+
}
|
|
93
96
|
function buildSVGPath(attrs, length, spacing = 1, offset = 0) {
|
|
94
97
|
attrs.pathLength = 1;
|
|
95
98
|
attrs["stroke-dashoffset"] = px.transform(-offset);
|
|
@@ -101,15 +104,16 @@ function convertSvgStyleToAttributes(keyframes) {
|
|
|
101
104
|
const attributes = {};
|
|
102
105
|
const styleProps = {};
|
|
103
106
|
for (const key in keyframes) {
|
|
104
|
-
|
|
107
|
+
const kebabKey = camelToKebab(key);
|
|
108
|
+
if (kebabKey in SVG_STYLE_TO_ATTRIBUTES) {
|
|
105
109
|
const value = keyframes[key];
|
|
106
|
-
attributes[
|
|
110
|
+
attributes[kebabKey] = isMotionValue(value) ? value.get() : value;
|
|
107
111
|
} else {
|
|
108
112
|
styleProps[key] = keyframes[key];
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
|
-
if (attributes
|
|
112
|
-
buildSVGPath(attributes, attributes
|
|
115
|
+
if (attributes["path-length"]) {
|
|
116
|
+
buildSVGPath(attributes, attributes["path-length"], attributes["path-spacing"], attributes["path-offset"]);
|
|
113
117
|
}
|
|
114
118
|
return {
|
|
115
119
|
attributes,
|