motion-v 1.0.0-alpha.2 → 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 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
- strokeWidth: true,
5798
- opacity: true,
5799
- fillOpacity: true,
5800
- strokeOpacity: true,
5801
- strokeLinecap: true,
5802
- strokeLinejoin: true,
5803
- strokeDasharray: true,
5804
- strokeDashoffset: 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
- pathLength: true,
5815
- viewBox: true,
5816
- width: true,
5817
- height: true,
5818
- preserveAspectRatio: true,
5819
- clipPath: true,
5820
- filter: true,
5821
- mask: true,
5822
- stopColor: true,
5823
- stopOpacity: true,
5824
- gradientTransform: true,
5825
- gradientUnits: true,
5826
- spreadMethod: true,
5827
- markerEnd: true,
5828
- markerMid: true,
5829
- markerStart: true,
5830
- textAnchor: true,
5831
- dominantBaseline: true,
5832
- fontFamily: true,
5833
- fontSize: true,
5834
- fontWeight: true,
5835
- letterSpacing: true,
5836
- vectorEffect: true
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
- if (key in SVG_STYLE_TO_ATTRIBUTES) {
5852
+ const kebabKey = camelToKebab(key);
5853
+ if (kebabKey in SVG_STYLE_TO_ATTRIBUTES) {
5850
5854
  const value = keyframes2[key];
5851
- attributes[key] = isMotionValue(value) ? value.get() : value;
5855
+ attributes[kebabKey] = isMotionValue(value) ? value.get() : value;
5852
5856
  } else {
5853
5857
  styleProps[key] = keyframes2[key];
5854
5858
  }
5855
5859
  }
5856
- if (attributes.pathLength) {
5857
- buildSVGPath(attributes, attributes.pathLength, attributes.pathSpacing, attributes.pathOffset);
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,
@@ -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
- strokeWidth: true,
53
- opacity: true,
54
- fillOpacity: true,
55
- strokeOpacity: true,
56
- strokeLinecap: true,
57
- strokeLinejoin: true,
58
- strokeDasharray: true,
59
- strokeDashoffset: 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
- pathLength: true,
70
- viewBox: true,
71
- width: true,
72
- height: true,
73
- preserveAspectRatio: true,
74
- clipPath: true,
75
- filter: true,
76
- mask: true,
77
- stopColor: true,
78
- stopOpacity: true,
79
- gradientTransform: true,
80
- gradientUnits: true,
81
- spreadMethod: true,
82
- markerEnd: true,
83
- markerMid: true,
84
- markerStart: true,
85
- textAnchor: true,
86
- dominantBaseline: true,
87
- fontFamily: true,
88
- fontSize: true,
89
- fontWeight: true,
90
- letterSpacing: true,
91
- vectorEffect: true
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
- if (key in SVG_STYLE_TO_ATTRIBUTES) {
107
+ const kebabKey = camelToKebab(key);
108
+ if (kebabKey in SVG_STYLE_TO_ATTRIBUTES) {
105
109
  const value = keyframes[key];
106
- attributes[key] = isMotionValue(value) ? value.get() : value;
110
+ attributes[kebabKey] = isMotionValue(value) ? value.get() : value;
107
111
  } else {
108
112
  styleProps[key] = keyframes[key];
109
113
  }
110
114
  }
111
- if (attributes.pathLength) {
112
- buildSVGPath(attributes, attributes.pathLength, attributes.pathSpacing, attributes.pathOffset);
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-v",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.3",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",