@webstudio-is/css-data 0.53.0 → 0.54.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/lib/cjs/schema.js +10 -15
- package/lib/schema.js +10 -15
- package/lib/types/src/schema.d.ts +1152 -3911
- package/package.json +3 -4
- package/src/schema.ts +10 -24
package/lib/cjs/schema.js
CHANGED
|
@@ -23,7 +23,7 @@ __export(schema_exports, {
|
|
|
23
23
|
InvalidValue: () => InvalidValue,
|
|
24
24
|
KeywordValue: () => KeywordValue,
|
|
25
25
|
LayersValue: () => LayersValue,
|
|
26
|
-
|
|
26
|
+
StyleValue: () => StyleValue,
|
|
27
27
|
TupleValue: () => TupleValue,
|
|
28
28
|
TupleValueItem: () => TupleValueItem,
|
|
29
29
|
UnitValue: () => UnitValue,
|
|
@@ -33,7 +33,6 @@ __export(schema_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(schema_exports);
|
|
34
34
|
var import_units = require("./__generated__/units");
|
|
35
35
|
var import_zod = require("zod");
|
|
36
|
-
var import_asset_uploader = require("@webstudio-is/asset-uploader");
|
|
37
36
|
const Unit = import_zod.z.union([
|
|
38
37
|
// expected tuple with at least single element
|
|
39
38
|
// so cast to tuple with single union element to get correct inference
|
|
@@ -69,7 +68,12 @@ const RgbValue = import_zod.z.object({
|
|
|
69
68
|
});
|
|
70
69
|
const ImageValue = import_zod.z.object({
|
|
71
70
|
type: import_zod.z.literal("image"),
|
|
72
|
-
value: import_zod.z.
|
|
71
|
+
value: import_zod.z.union([
|
|
72
|
+
import_zod.z.object({ type: import_zod.z.literal("asset"), value: import_zod.z.string() }),
|
|
73
|
+
// url is not stored in db and only used by css-engine transformValue
|
|
74
|
+
// to prepare image value for rendering
|
|
75
|
+
import_zod.z.object({ type: import_zod.z.literal("url"), url: import_zod.z.string() })
|
|
76
|
+
]),
|
|
73
77
|
// For the builder we want to be able to hide images
|
|
74
78
|
hidden: import_zod.z.boolean().optional()
|
|
75
79
|
});
|
|
@@ -109,7 +113,9 @@ const validStaticValueTypes = [
|
|
|
109
113
|
"layers",
|
|
110
114
|
"tuple"
|
|
111
115
|
];
|
|
112
|
-
const
|
|
116
|
+
const ValidStaticStyleValue = import_zod.z.union([
|
|
117
|
+
ImageValue,
|
|
118
|
+
LayersValue,
|
|
113
119
|
UnitValue,
|
|
114
120
|
KeywordValue,
|
|
115
121
|
FontFamilyValue,
|
|
@@ -117,11 +123,6 @@ const SharedStaticStyleValue = import_zod.z.union([
|
|
|
117
123
|
UnparsedValue,
|
|
118
124
|
TupleValue
|
|
119
125
|
]);
|
|
120
|
-
const ValidStaticStyleValue = import_zod.z.union([
|
|
121
|
-
ImageValue,
|
|
122
|
-
LayersValue,
|
|
123
|
-
SharedStaticStyleValue
|
|
124
|
-
]);
|
|
125
126
|
const VarValue = import_zod.z.object({
|
|
126
127
|
type: import_zod.z.literal("var"),
|
|
127
128
|
value: import_zod.z.string(),
|
|
@@ -133,12 +134,6 @@ const StyleValue = import_zod.z.union([
|
|
|
133
134
|
UnsetValue,
|
|
134
135
|
VarValue
|
|
135
136
|
]);
|
|
136
|
-
const SharedStyleValue = import_zod.z.union([
|
|
137
|
-
SharedStaticStyleValue,
|
|
138
|
-
InvalidValue,
|
|
139
|
-
UnsetValue,
|
|
140
|
-
VarValue
|
|
141
|
-
]);
|
|
142
137
|
const Style = import_zod.z.record(import_zod.z.string(), StyleValue);
|
|
143
138
|
const CssRule = import_zod.z.object({
|
|
144
139
|
style: Style,
|
package/lib/schema.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { units } from "./__generated__/units";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { ImageAsset } from "@webstudio-is/asset-uploader";
|
|
4
3
|
const Unit = z.union([
|
|
5
4
|
// expected tuple with at least single element
|
|
6
5
|
// so cast to tuple with single union element to get correct inference
|
|
@@ -36,7 +35,12 @@ const RgbValue = z.object({
|
|
|
36
35
|
});
|
|
37
36
|
const ImageValue = z.object({
|
|
38
37
|
type: z.literal("image"),
|
|
39
|
-
value: z.
|
|
38
|
+
value: z.union([
|
|
39
|
+
z.object({ type: z.literal("asset"), value: z.string() }),
|
|
40
|
+
// url is not stored in db and only used by css-engine transformValue
|
|
41
|
+
// to prepare image value for rendering
|
|
42
|
+
z.object({ type: z.literal("url"), url: z.string() })
|
|
43
|
+
]),
|
|
40
44
|
// For the builder we want to be able to hide images
|
|
41
45
|
hidden: z.boolean().optional()
|
|
42
46
|
});
|
|
@@ -76,7 +80,9 @@ const validStaticValueTypes = [
|
|
|
76
80
|
"layers",
|
|
77
81
|
"tuple"
|
|
78
82
|
];
|
|
79
|
-
const
|
|
83
|
+
const ValidStaticStyleValue = z.union([
|
|
84
|
+
ImageValue,
|
|
85
|
+
LayersValue,
|
|
80
86
|
UnitValue,
|
|
81
87
|
KeywordValue,
|
|
82
88
|
FontFamilyValue,
|
|
@@ -84,11 +90,6 @@ const SharedStaticStyleValue = z.union([
|
|
|
84
90
|
UnparsedValue,
|
|
85
91
|
TupleValue
|
|
86
92
|
]);
|
|
87
|
-
const ValidStaticStyleValue = z.union([
|
|
88
|
-
ImageValue,
|
|
89
|
-
LayersValue,
|
|
90
|
-
SharedStaticStyleValue
|
|
91
|
-
]);
|
|
92
93
|
const VarValue = z.object({
|
|
93
94
|
type: z.literal("var"),
|
|
94
95
|
value: z.string(),
|
|
@@ -100,12 +101,6 @@ const StyleValue = z.union([
|
|
|
100
101
|
UnsetValue,
|
|
101
102
|
VarValue
|
|
102
103
|
]);
|
|
103
|
-
const SharedStyleValue = z.union([
|
|
104
|
-
SharedStaticStyleValue,
|
|
105
|
-
InvalidValue,
|
|
106
|
-
UnsetValue,
|
|
107
|
-
VarValue
|
|
108
|
-
]);
|
|
109
104
|
const Style = z.record(z.string(), StyleValue);
|
|
110
105
|
const CssRule = z.object({
|
|
111
106
|
style: Style,
|
|
@@ -117,7 +112,7 @@ export {
|
|
|
117
112
|
InvalidValue,
|
|
118
113
|
KeywordValue,
|
|
119
114
|
LayersValue,
|
|
120
|
-
|
|
115
|
+
StyleValue,
|
|
121
116
|
TupleValue,
|
|
122
117
|
TupleValueItem,
|
|
123
118
|
UnitValue,
|