@webstudio-is/css-data 0.47.0 → 0.48.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/__generated__/keyword-values.js +1 -0
- package/lib/__generated__/properties.js +10 -0
- package/lib/cjs/__generated__/keyword-values.cjs +1 -0
- package/lib/cjs/__generated__/properties.cjs +10 -0
- package/lib/cjs/schema.cjs +17 -8
- package/lib/schema.js +17 -8
- package/package.json +3 -2
- package/src/__generated__/keyword-values.ts +1 -0
- package/src/__generated__/properties.ts +10 -0
- package/src/schema.ts +22 -11
|
@@ -485,6 +485,7 @@ const keywordValues = {
|
|
|
485
485
|
],
|
|
486
486
|
backgroundImage: ["none"],
|
|
487
487
|
backgroundOrigin: ["border-box", "padding-box", "content-box"],
|
|
488
|
+
backgroundPosition: ["left", "center", "right", "top", "bottom"],
|
|
488
489
|
backgroundPositionX: ["center", "left", "right", "x-start", "x-end"],
|
|
489
490
|
backgroundPositionY: ["center", "top", "bottom", "y-start", "y-end"],
|
|
490
491
|
backgroundRepeat: [
|
|
@@ -252,6 +252,16 @@ const properties = {
|
|
|
252
252
|
popularity: 0.0847006,
|
|
253
253
|
appliesTo: "allElements"
|
|
254
254
|
},
|
|
255
|
+
backgroundPosition: {
|
|
256
|
+
unitGroups: ["length", "percentage"],
|
|
257
|
+
inherited: false,
|
|
258
|
+
initial: {
|
|
259
|
+
type: "keyword",
|
|
260
|
+
value: "0% 0%"
|
|
261
|
+
},
|
|
262
|
+
popularity: 0.76724967,
|
|
263
|
+
appliesTo: "allElements"
|
|
264
|
+
},
|
|
255
265
|
backgroundPositionX: {
|
|
256
266
|
unitGroups: ["length", "percentage"],
|
|
257
267
|
inherited: false,
|
|
@@ -508,6 +508,7 @@ const keywordValues = {
|
|
|
508
508
|
],
|
|
509
509
|
backgroundImage: ["none"],
|
|
510
510
|
backgroundOrigin: ["border-box", "padding-box", "content-box"],
|
|
511
|
+
backgroundPosition: ["left", "center", "right", "top", "bottom"],
|
|
511
512
|
backgroundPositionX: ["center", "left", "right", "x-start", "x-end"],
|
|
512
513
|
backgroundPositionY: ["center", "top", "bottom", "y-start", "y-end"],
|
|
513
514
|
backgroundRepeat: [
|
|
@@ -275,6 +275,16 @@ const properties = {
|
|
|
275
275
|
popularity: 0.0847006,
|
|
276
276
|
appliesTo: "allElements"
|
|
277
277
|
},
|
|
278
|
+
backgroundPosition: {
|
|
279
|
+
unitGroups: ["length", "percentage"],
|
|
280
|
+
inherited: false,
|
|
281
|
+
initial: {
|
|
282
|
+
type: "keyword",
|
|
283
|
+
value: "0% 0%"
|
|
284
|
+
},
|
|
285
|
+
popularity: 0.76724967,
|
|
286
|
+
appliesTo: "allElements"
|
|
287
|
+
},
|
|
278
288
|
backgroundPositionX: {
|
|
279
289
|
unitGroups: ["length", "percentage"],
|
|
280
290
|
inherited: false,
|
package/lib/cjs/schema.cjs
CHANGED
|
@@ -49,7 +49,8 @@ const KeywordValue = import_zod.z.object({
|
|
|
49
49
|
});
|
|
50
50
|
const UnparsedValue = import_zod.z.object({
|
|
51
51
|
type: import_zod.z.literal("unparsed"),
|
|
52
|
-
value: import_zod.z.string()
|
|
52
|
+
value: import_zod.z.string(),
|
|
53
|
+
hidden: import_zod.z.boolean().optional()
|
|
53
54
|
});
|
|
54
55
|
const FontFamilyValue = import_zod.z.object({
|
|
55
56
|
type: import_zod.z.literal("fontFamily"),
|
|
@@ -64,7 +65,8 @@ const RgbValue = import_zod.z.object({
|
|
|
64
65
|
});
|
|
65
66
|
const ImageValue = import_zod.z.object({
|
|
66
67
|
type: import_zod.z.literal("image"),
|
|
67
|
-
value: import_zod.z.object({ type: import_zod.z.literal("asset"), value: import_asset_uploader.ImageAsset })
|
|
68
|
+
value: import_zod.z.object({ type: import_zod.z.literal("asset"), value: import_asset_uploader.ImageAsset }),
|
|
69
|
+
hidden: import_zod.z.boolean().optional()
|
|
68
70
|
});
|
|
69
71
|
const InvalidValue = import_zod.z.object({
|
|
70
72
|
type: import_zod.z.literal("invalid"),
|
|
@@ -74,17 +76,24 @@ const UnsetValue = import_zod.z.object({
|
|
|
74
76
|
type: import_zod.z.literal("unset"),
|
|
75
77
|
value: import_zod.z.literal("")
|
|
76
78
|
});
|
|
77
|
-
const LayersValue = import_zod.z.object({
|
|
78
|
-
type: import_zod.z.literal("layers"),
|
|
79
|
-
value: import_zod.z.array(
|
|
80
|
-
import_zod.z.union([UnitValue, KeywordValue, UnparsedValue, ImageValue, InvalidValue])
|
|
81
|
-
)
|
|
82
|
-
});
|
|
83
79
|
const TupleValueItem = import_zod.z.union([UnitValue, KeywordValue, UnparsedValue]);
|
|
84
80
|
const TupleValue = import_zod.z.object({
|
|
85
81
|
type: import_zod.z.literal("tuple"),
|
|
86
82
|
value: import_zod.z.array(TupleValueItem)
|
|
87
83
|
});
|
|
84
|
+
const LayersValue = import_zod.z.object({
|
|
85
|
+
type: import_zod.z.literal("layers"),
|
|
86
|
+
value: import_zod.z.array(
|
|
87
|
+
import_zod.z.union([
|
|
88
|
+
UnitValue,
|
|
89
|
+
KeywordValue,
|
|
90
|
+
UnparsedValue,
|
|
91
|
+
ImageValue,
|
|
92
|
+
TupleValue,
|
|
93
|
+
InvalidValue
|
|
94
|
+
])
|
|
95
|
+
)
|
|
96
|
+
});
|
|
88
97
|
const validStaticValueTypes = [
|
|
89
98
|
"unit",
|
|
90
99
|
"keyword",
|
package/lib/schema.js
CHANGED
|
@@ -16,7 +16,8 @@ const KeywordValue = z.object({
|
|
|
16
16
|
});
|
|
17
17
|
const UnparsedValue = z.object({
|
|
18
18
|
type: z.literal("unparsed"),
|
|
19
|
-
value: z.string()
|
|
19
|
+
value: z.string(),
|
|
20
|
+
hidden: z.boolean().optional()
|
|
20
21
|
});
|
|
21
22
|
const FontFamilyValue = z.object({
|
|
22
23
|
type: z.literal("fontFamily"),
|
|
@@ -31,7 +32,8 @@ const RgbValue = z.object({
|
|
|
31
32
|
});
|
|
32
33
|
const ImageValue = z.object({
|
|
33
34
|
type: z.literal("image"),
|
|
34
|
-
value: z.object({ type: z.literal("asset"), value: ImageAsset })
|
|
35
|
+
value: z.object({ type: z.literal("asset"), value: ImageAsset }),
|
|
36
|
+
hidden: z.boolean().optional()
|
|
35
37
|
});
|
|
36
38
|
const InvalidValue = z.object({
|
|
37
39
|
type: z.literal("invalid"),
|
|
@@ -41,17 +43,24 @@ const UnsetValue = z.object({
|
|
|
41
43
|
type: z.literal("unset"),
|
|
42
44
|
value: z.literal("")
|
|
43
45
|
});
|
|
44
|
-
const LayersValue = z.object({
|
|
45
|
-
type: z.literal("layers"),
|
|
46
|
-
value: z.array(
|
|
47
|
-
z.union([UnitValue, KeywordValue, UnparsedValue, ImageValue, InvalidValue])
|
|
48
|
-
)
|
|
49
|
-
});
|
|
50
46
|
const TupleValueItem = z.union([UnitValue, KeywordValue, UnparsedValue]);
|
|
51
47
|
const TupleValue = z.object({
|
|
52
48
|
type: z.literal("tuple"),
|
|
53
49
|
value: z.array(TupleValueItem)
|
|
54
50
|
});
|
|
51
|
+
const LayersValue = z.object({
|
|
52
|
+
type: z.literal("layers"),
|
|
53
|
+
value: z.array(
|
|
54
|
+
z.union([
|
|
55
|
+
UnitValue,
|
|
56
|
+
KeywordValue,
|
|
57
|
+
UnparsedValue,
|
|
58
|
+
ImageValue,
|
|
59
|
+
TupleValue,
|
|
60
|
+
InvalidValue
|
|
61
|
+
])
|
|
62
|
+
)
|
|
63
|
+
});
|
|
55
64
|
const validStaticValueTypes = [
|
|
56
65
|
"unit",
|
|
57
66
|
"keyword",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/css-data",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "CSS Data",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"mdn-data": "2.0.30",
|
|
13
13
|
"typescript": "4.9.5",
|
|
14
14
|
"zod": "^3.19.1",
|
|
15
|
-
"@webstudio-is/asset-uploader": "^0.
|
|
15
|
+
"@webstudio-is/asset-uploader": "^0.48.0",
|
|
16
16
|
"@webstudio-is/scripts": "^0.0.0",
|
|
17
17
|
"@webstudio-is/tsconfig": "^1.0.1"
|
|
18
18
|
},
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"zod": "^3.19.1"
|
|
21
21
|
},
|
|
22
22
|
"exports": {
|
|
23
|
+
"source": "./src/index.ts",
|
|
23
24
|
"import": "./lib/index.js",
|
|
24
25
|
"require": "./lib/cjs/index.cjs"
|
|
25
26
|
},
|
|
@@ -486,6 +486,7 @@ export const keywordValues = {
|
|
|
486
486
|
],
|
|
487
487
|
backgroundImage: ["none"],
|
|
488
488
|
backgroundOrigin: ["border-box", "padding-box", "content-box"],
|
|
489
|
+
backgroundPosition: ["left", "center", "right", "top", "bottom"],
|
|
489
490
|
backgroundPositionX: ["center", "left", "right", "x-start", "x-end"],
|
|
490
491
|
backgroundPositionY: ["center", "top", "bottom", "y-start", "y-end"],
|
|
491
492
|
backgroundRepeat: [
|
|
@@ -253,6 +253,16 @@ export const properties = {
|
|
|
253
253
|
popularity: 0.0847006,
|
|
254
254
|
appliesTo: "allElements",
|
|
255
255
|
},
|
|
256
|
+
backgroundPosition: {
|
|
257
|
+
unitGroups: ["length", "percentage"],
|
|
258
|
+
inherited: false,
|
|
259
|
+
initial: {
|
|
260
|
+
type: "keyword",
|
|
261
|
+
value: "0% 0%",
|
|
262
|
+
},
|
|
263
|
+
popularity: 0.76724967,
|
|
264
|
+
appliesTo: "allElements",
|
|
265
|
+
},
|
|
256
266
|
backgroundPositionX: {
|
|
257
267
|
unitGroups: ["length", "percentage"],
|
|
258
268
|
inherited: false,
|
package/src/schema.ts
CHANGED
|
@@ -51,6 +51,8 @@ export type KeywordValue = z.infer<typeof KeywordValue>;
|
|
|
51
51
|
export const UnparsedValue = z.object({
|
|
52
52
|
type: z.literal("unparsed"),
|
|
53
53
|
value: z.string(),
|
|
54
|
+
// For the builder we want to be able to hide background-image
|
|
55
|
+
hidden: z.boolean().optional(),
|
|
54
56
|
});
|
|
55
57
|
|
|
56
58
|
const FontFamilyValue = z.object({
|
|
@@ -71,6 +73,8 @@ export type RgbValue = z.infer<typeof RgbValue>;
|
|
|
71
73
|
export const ImageValue = z.object({
|
|
72
74
|
type: z.literal("image"),
|
|
73
75
|
value: z.object({ type: z.literal("asset"), value: ImageAsset }),
|
|
76
|
+
// For the builder we want to be able to hide images
|
|
77
|
+
hidden: z.boolean().optional(),
|
|
74
78
|
});
|
|
75
79
|
|
|
76
80
|
export type ImageValue = z.infer<typeof ImageValue>;
|
|
@@ -89,28 +93,35 @@ const UnsetValue = z.object({
|
|
|
89
93
|
});
|
|
90
94
|
export type UnsetValue = z.infer<typeof UnsetValue>;
|
|
91
95
|
|
|
96
|
+
export const TupleValueItem = z.union([UnitValue, KeywordValue, UnparsedValue]);
|
|
97
|
+
export type TupleValueItem = z.infer<typeof TupleValueItem>;
|
|
98
|
+
|
|
99
|
+
export const TupleValue = z.object({
|
|
100
|
+
type: z.literal("tuple"),
|
|
101
|
+
value: z.array(TupleValueItem),
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export type TupleValue = z.infer<typeof TupleValue>;
|
|
105
|
+
|
|
92
106
|
// To support background layers https://developer.mozilla.org/en-US/docs/Web/CSS/background
|
|
93
107
|
// and similar comma separated css properties
|
|
94
108
|
// InvalidValue used in case of asset not found
|
|
95
109
|
export const LayersValue = z.object({
|
|
96
110
|
type: z.literal("layers"),
|
|
97
111
|
value: z.array(
|
|
98
|
-
z.union([
|
|
112
|
+
z.union([
|
|
113
|
+
UnitValue,
|
|
114
|
+
KeywordValue,
|
|
115
|
+
UnparsedValue,
|
|
116
|
+
ImageValue,
|
|
117
|
+
TupleValue,
|
|
118
|
+
InvalidValue,
|
|
119
|
+
])
|
|
99
120
|
),
|
|
100
121
|
});
|
|
101
122
|
|
|
102
123
|
export type LayersValue = z.infer<typeof LayersValue>;
|
|
103
124
|
|
|
104
|
-
export const TupleValueItem = z.union([UnitValue, KeywordValue, UnparsedValue]);
|
|
105
|
-
export type TupleValueItem = z.infer<typeof TupleValueItem>;
|
|
106
|
-
|
|
107
|
-
export const TupleValue = z.object({
|
|
108
|
-
type: z.literal("tuple"),
|
|
109
|
-
value: z.array(TupleValueItem),
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
export type TupleValue = z.infer<typeof TupleValue>;
|
|
113
|
-
|
|
114
125
|
/**
|
|
115
126
|
* All StyleValue types that going to need wrapping into a CSS variable when rendered
|
|
116
127
|
* on canvas inside builder.
|