@webstudio-is/css-engine 0.44.0 → 0.45.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.
|
@@ -73,7 +73,10 @@ const toValue = (value, options = defaultOptions) => {
|
|
|
73
73
|
return value.value;
|
|
74
74
|
}
|
|
75
75
|
if (value.type === "layers") {
|
|
76
|
-
return value.value.map((
|
|
76
|
+
return value.value.map((value2) => toValue(value2, options)).join(",");
|
|
77
|
+
}
|
|
78
|
+
if (value.type === "tuple") {
|
|
79
|
+
return value.value.map((value2) => toValue(value2, options)).join(" ");
|
|
77
80
|
}
|
|
78
81
|
assertUnreachable(value, `Unknown value type`);
|
|
79
82
|
throw new Error("Unknown value type");
|
package/lib/core/to-value.js
CHANGED
|
@@ -50,7 +50,10 @@ const toValue = (value, options = defaultOptions) => {
|
|
|
50
50
|
return value.value;
|
|
51
51
|
}
|
|
52
52
|
if (value.type === "layers") {
|
|
53
|
-
return value.value.map((
|
|
53
|
+
return value.value.map((value2) => toValue(value2, options)).join(",");
|
|
54
|
+
}
|
|
55
|
+
if (value.type === "tuple") {
|
|
56
|
+
return value.value.map((value2) => toValue(value2, options)).join(" ");
|
|
54
57
|
}
|
|
55
58
|
assertUnreachable(value, `Unknown value type`);
|
|
56
59
|
throw new Error("Unknown value type");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/css-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "CSS Renderer for Webstudio",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"hyphenate-style-name": "^1.0.4",
|
|
10
10
|
"react": "^17.0.2",
|
|
11
11
|
"react-dom": "^17.0.2",
|
|
12
|
-
"@webstudio-is/fonts": "^0.
|
|
12
|
+
"@webstudio-is/fonts": "^0.45.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@jest/globals": "^29.3.1",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@types/react-dom": "^17.0.9",
|
|
22
22
|
"jest": "^29.3.1",
|
|
23
23
|
"typescript": "4.9.5",
|
|
24
|
-
"@webstudio-is/css-data": "^0.
|
|
24
|
+
"@webstudio-is/css-data": "^0.45.0",
|
|
25
25
|
"@webstudio-is/jest-config": "^1.0.2",
|
|
26
26
|
"@webstudio-is/scripts": "^0.0.0",
|
|
27
27
|
"@webstudio-is/storybook-config": "^0.0.0",
|
|
@@ -100,4 +100,17 @@ describe("Convert WS CSS Values to native CSS strings", () => {
|
|
|
100
100
|
|
|
101
101
|
expect(value).toBe("auto,10px,calc(10px),url(foo.png) /* id=1234567890 */");
|
|
102
102
|
});
|
|
103
|
+
|
|
104
|
+
test("tuple", () => {
|
|
105
|
+
const value = toValue({
|
|
106
|
+
type: "tuple",
|
|
107
|
+
value: [
|
|
108
|
+
{ type: "unit", value: 10, unit: "px" },
|
|
109
|
+
{ type: "unit", value: 20, unit: "px" },
|
|
110
|
+
{ type: "unit", value: 30, unit: "px" },
|
|
111
|
+
{ type: "unit", value: 40, unit: "px" },
|
|
112
|
+
],
|
|
113
|
+
});
|
|
114
|
+
expect(value).toBe("10px 20px 30px 40px");
|
|
115
|
+
});
|
|
103
116
|
});
|
package/src/core/to-value.ts
CHANGED
|
@@ -71,7 +71,11 @@ export const toValue = (
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
if (value.type === "layers") {
|
|
74
|
-
return value.value.map((
|
|
74
|
+
return value.value.map((value) => toValue(value, options)).join(",");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (value.type === "tuple") {
|
|
78
|
+
return value.value.map((value) => toValue(value, options)).join(" ");
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
// Will give ts error in case of missing type
|