motion-v 0.13.0 → 0.13.1-alpha.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 +87 -75
- package/dist/es/components/motion/Motion.vue.mjs +6 -6
- package/dist/es/components/reorder/Group.d.ts +14 -32
- package/dist/es/components/reorder/Group.vue.mjs +2 -1
- package/dist/es/components/reorder/Item.vue.mjs +2 -1
- package/dist/es/components/reorder/index.d.ts +1686 -7512
- package/dist/es/state/style.mjs +16 -6
- package/dist/es/value/types/numbers/units.mjs +3 -1
- package/package.json +1 -1
package/dist/es/state/style.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isNumber, isCssVar } from "./utils.mjs";
|
|
2
2
|
import { isTransform, transformAlias, transformDefinitions, buildTransformTemplate } from "./transform.mjs";
|
|
3
|
+
import { px } from "../value/types/numbers/units.mjs";
|
|
3
4
|
import { isMotionValue } from "../utils/motion-value.mjs";
|
|
4
5
|
const style = {
|
|
5
6
|
get: (element, name) => {
|
|
@@ -60,15 +61,12 @@ const SVG_STYLE_TO_ATTRIBUTES = {
|
|
|
60
61
|
cy: true,
|
|
61
62
|
r: true,
|
|
62
63
|
d: true,
|
|
63
|
-
x: true,
|
|
64
|
-
y: true,
|
|
65
64
|
x1: true,
|
|
66
65
|
y1: true,
|
|
67
66
|
x2: true,
|
|
68
67
|
y2: true,
|
|
69
68
|
points: true,
|
|
70
69
|
pathLength: true,
|
|
71
|
-
transform: true,
|
|
72
70
|
viewBox: true,
|
|
73
71
|
width: true,
|
|
74
72
|
height: true,
|
|
@@ -92,19 +90,31 @@ const SVG_STYLE_TO_ATTRIBUTES = {
|
|
|
92
90
|
letterSpacing: true,
|
|
93
91
|
vectorEffect: true
|
|
94
92
|
};
|
|
93
|
+
function buildSVGPath(attrs, length, spacing = 1, offset = 0) {
|
|
94
|
+
attrs.pathLength = 1;
|
|
95
|
+
attrs["stroke-dashoffset"] = px.transform(-offset);
|
|
96
|
+
const pathLength = px.transform(length);
|
|
97
|
+
const pathSpacing = px.transform(spacing);
|
|
98
|
+
attrs["stroke-dasharray"] = `${pathLength} ${pathSpacing}`;
|
|
99
|
+
}
|
|
95
100
|
function convertSvgStyleToAttributes(keyframes) {
|
|
96
101
|
const attributes = {};
|
|
97
102
|
const styleProps = {};
|
|
103
|
+
let shouldBuildPath = false;
|
|
98
104
|
for (const key in keyframes) {
|
|
99
105
|
if (key in SVG_STYLE_TO_ATTRIBUTES) {
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
if (key === "pathLength") {
|
|
107
|
+
shouldBuildPath = true;
|
|
108
|
+
}
|
|
102
109
|
const value = keyframes[key];
|
|
103
|
-
attributes[
|
|
110
|
+
attributes[key] = isMotionValue(value) ? value.get() : value;
|
|
104
111
|
} else {
|
|
105
112
|
styleProps[key] = keyframes[key];
|
|
106
113
|
}
|
|
107
114
|
}
|
|
115
|
+
if (shouldBuildPath) {
|
|
116
|
+
buildSVGPath(attributes, attributes.pathLength, attributes.pathSpacing, attributes.pathOffset);
|
|
117
|
+
}
|
|
108
118
|
return {
|
|
109
119
|
attributes,
|
|
110
120
|
style: styleProps
|