@webstudio-is/css-data 0.53.0 → 0.55.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/css-data",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.0",
|
|
4
4
|
"description": "CSS Data",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -13,9 +13,8 @@
|
|
|
13
13
|
"tsx": "^3.12.6",
|
|
14
14
|
"typescript": "5.0.3",
|
|
15
15
|
"zod": "^3.19.1",
|
|
16
|
-
"@webstudio-is/
|
|
17
|
-
"@webstudio-is/tsconfig": "^1.0.
|
|
18
|
-
"@webstudio-is/scripts": "^0.0.0"
|
|
16
|
+
"@webstudio-is/scripts": "^0.0.0",
|
|
17
|
+
"@webstudio-is/tsconfig": "^1.0.3"
|
|
19
18
|
},
|
|
20
19
|
"peerDependencies": {
|
|
21
20
|
"zod": "^3.19.1"
|
package/src/schema.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { units } from "./__generated__/units";
|
|
2
2
|
import type { properties } from "./__generated__/properties";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { ImageAsset } from "@webstudio-is/asset-uploader";
|
|
5
4
|
|
|
6
5
|
type Properties = typeof properties & {
|
|
7
6
|
[custom: CustomProperty]: {
|
|
@@ -74,7 +73,12 @@ export type RgbValue = z.infer<typeof RgbValue>;
|
|
|
74
73
|
|
|
75
74
|
export const ImageValue = z.object({
|
|
76
75
|
type: z.literal("image"),
|
|
77
|
-
value: z.
|
|
76
|
+
value: z.union([
|
|
77
|
+
z.object({ type: z.literal("asset"), value: z.string() }),
|
|
78
|
+
// url is not stored in db and only used by css-engine transformValue
|
|
79
|
+
// to prepare image value for rendering
|
|
80
|
+
z.object({ type: z.literal("url"), url: z.string() }),
|
|
81
|
+
]),
|
|
78
82
|
// For the builder we want to be able to hide images
|
|
79
83
|
hidden: z.boolean().optional(),
|
|
80
84
|
});
|
|
@@ -140,11 +144,9 @@ export const validStaticValueTypes = [
|
|
|
140
144
|
"tuple",
|
|
141
145
|
] as const;
|
|
142
146
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
*/
|
|
147
|
-
const SharedStaticStyleValue = z.union([
|
|
147
|
+
const ValidStaticStyleValue = z.union([
|
|
148
|
+
ImageValue,
|
|
149
|
+
LayersValue,
|
|
148
150
|
UnitValue,
|
|
149
151
|
KeywordValue,
|
|
150
152
|
FontFamilyValue,
|
|
@@ -153,12 +155,6 @@ const SharedStaticStyleValue = z.union([
|
|
|
153
155
|
TupleValue,
|
|
154
156
|
]);
|
|
155
157
|
|
|
156
|
-
const ValidStaticStyleValue = z.union([
|
|
157
|
-
ImageValue,
|
|
158
|
-
LayersValue,
|
|
159
|
-
SharedStaticStyleValue,
|
|
160
|
-
]);
|
|
161
|
-
|
|
162
158
|
export type ValidStaticStyleValue = z.infer<typeof ValidStaticStyleValue>;
|
|
163
159
|
|
|
164
160
|
const VarValue = z.object({
|
|
@@ -168,23 +164,13 @@ const VarValue = z.object({
|
|
|
168
164
|
});
|
|
169
165
|
export type VarValue = z.infer<typeof VarValue>;
|
|
170
166
|
|
|
171
|
-
const StyleValue = z.union([
|
|
167
|
+
export const StyleValue = z.union([
|
|
172
168
|
ValidStaticStyleValue,
|
|
173
169
|
InvalidValue,
|
|
174
170
|
UnsetValue,
|
|
175
171
|
VarValue,
|
|
176
172
|
]);
|
|
177
173
|
|
|
178
|
-
/**
|
|
179
|
-
* Shared types with DB types
|
|
180
|
-
*/
|
|
181
|
-
export const SharedStyleValue = z.union([
|
|
182
|
-
SharedStaticStyleValue,
|
|
183
|
-
InvalidValue,
|
|
184
|
-
UnsetValue,
|
|
185
|
-
VarValue,
|
|
186
|
-
]);
|
|
187
|
-
|
|
188
174
|
export type StyleValue = z.infer<typeof StyleValue>;
|
|
189
175
|
|
|
190
176
|
const Style = z.record(z.string(), StyleValue);
|