@webstudio-is/css-data 0.56.0 → 0.57.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 +5 -16
- package/lib/schema.js +5 -16
- package/package.json +4 -4
- package/src/schema.ts +22 -23
- package/lib/types/bin/mdn-data.d.ts +0 -1
- package/lib/types/src/__generated__/keyword-values.d.ts +0 -349
- package/lib/types/src/__generated__/properties.d.ts +0 -3537
- package/lib/types/src/__generated__/units.d.ts +0 -12
- package/lib/types/src/index.d.ts +0 -4
- package/lib/types/src/popularity-index.d.ts +0 -6
- package/lib/types/src/schema.d.ts +0 -3856
package/lib/cjs/schema.js
CHANGED
|
@@ -18,7 +18,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var schema_exports = {};
|
|
20
20
|
__export(schema_exports, {
|
|
21
|
-
CssRule: () => CssRule,
|
|
22
21
|
ImageValue: () => ImageValue,
|
|
23
22
|
InvalidValue: () => InvalidValue,
|
|
24
23
|
KeywordValue: () => KeywordValue,
|
|
@@ -28,7 +27,7 @@ __export(schema_exports, {
|
|
|
28
27
|
TupleValueItem: () => TupleValueItem,
|
|
29
28
|
UnitValue: () => UnitValue,
|
|
30
29
|
UnparsedValue: () => UnparsedValue,
|
|
31
|
-
|
|
30
|
+
isValidStaticStyleValue: () => isValidStaticStyleValue
|
|
32
31
|
});
|
|
33
32
|
module.exports = __toCommonJS(schema_exports);
|
|
34
33
|
var import_units = require("./__generated__/units");
|
|
@@ -103,16 +102,6 @@ const LayersValue = import_zod.z.object({
|
|
|
103
102
|
])
|
|
104
103
|
)
|
|
105
104
|
});
|
|
106
|
-
const validStaticValueTypes = [
|
|
107
|
-
"unit",
|
|
108
|
-
"keyword",
|
|
109
|
-
"fontFamily",
|
|
110
|
-
"rgb",
|
|
111
|
-
"image",
|
|
112
|
-
"unparsed",
|
|
113
|
-
"layers",
|
|
114
|
-
"tuple"
|
|
115
|
-
];
|
|
116
105
|
const ValidStaticStyleValue = import_zod.z.union([
|
|
117
106
|
ImageValue,
|
|
118
107
|
LayersValue,
|
|
@@ -123,6 +112,10 @@ const ValidStaticStyleValue = import_zod.z.union([
|
|
|
123
112
|
UnparsedValue,
|
|
124
113
|
TupleValue
|
|
125
114
|
]);
|
|
115
|
+
const isValidStaticStyleValue = (styleValue) => {
|
|
116
|
+
const staticStyleValue = styleValue;
|
|
117
|
+
return staticStyleValue.type === "image" || staticStyleValue.type === "layers" || staticStyleValue.type === "unit" || staticStyleValue.type === "keyword" || staticStyleValue.type === "fontFamily" || staticStyleValue.type === "rgb" || staticStyleValue.type === "unparsed" || staticStyleValue.type === "tuple";
|
|
118
|
+
};
|
|
126
119
|
const VarValue = import_zod.z.object({
|
|
127
120
|
type: import_zod.z.literal("var"),
|
|
128
121
|
value: import_zod.z.string(),
|
|
@@ -135,7 +128,3 @@ const StyleValue = import_zod.z.union([
|
|
|
135
128
|
VarValue
|
|
136
129
|
]);
|
|
137
130
|
const Style = import_zod.z.record(import_zod.z.string(), StyleValue);
|
|
138
|
-
const CssRule = import_zod.z.object({
|
|
139
|
-
style: Style,
|
|
140
|
-
breakpoint: import_zod.z.optional(import_zod.z.string())
|
|
141
|
-
});
|
package/lib/schema.js
CHANGED
|
@@ -70,16 +70,6 @@ const LayersValue = z.object({
|
|
|
70
70
|
])
|
|
71
71
|
)
|
|
72
72
|
});
|
|
73
|
-
const validStaticValueTypes = [
|
|
74
|
-
"unit",
|
|
75
|
-
"keyword",
|
|
76
|
-
"fontFamily",
|
|
77
|
-
"rgb",
|
|
78
|
-
"image",
|
|
79
|
-
"unparsed",
|
|
80
|
-
"layers",
|
|
81
|
-
"tuple"
|
|
82
|
-
];
|
|
83
73
|
const ValidStaticStyleValue = z.union([
|
|
84
74
|
ImageValue,
|
|
85
75
|
LayersValue,
|
|
@@ -90,6 +80,10 @@ const ValidStaticStyleValue = z.union([
|
|
|
90
80
|
UnparsedValue,
|
|
91
81
|
TupleValue
|
|
92
82
|
]);
|
|
83
|
+
const isValidStaticStyleValue = (styleValue) => {
|
|
84
|
+
const staticStyleValue = styleValue;
|
|
85
|
+
return staticStyleValue.type === "image" || staticStyleValue.type === "layers" || staticStyleValue.type === "unit" || staticStyleValue.type === "keyword" || staticStyleValue.type === "fontFamily" || staticStyleValue.type === "rgb" || staticStyleValue.type === "unparsed" || staticStyleValue.type === "tuple";
|
|
86
|
+
};
|
|
93
87
|
const VarValue = z.object({
|
|
94
88
|
type: z.literal("var"),
|
|
95
89
|
value: z.string(),
|
|
@@ -102,12 +96,7 @@ const StyleValue = z.union([
|
|
|
102
96
|
VarValue
|
|
103
97
|
]);
|
|
104
98
|
const Style = z.record(z.string(), StyleValue);
|
|
105
|
-
const CssRule = z.object({
|
|
106
|
-
style: Style,
|
|
107
|
-
breakpoint: z.optional(z.string())
|
|
108
|
-
});
|
|
109
99
|
export {
|
|
110
|
-
CssRule,
|
|
111
100
|
ImageValue,
|
|
112
101
|
InvalidValue,
|
|
113
102
|
KeywordValue,
|
|
@@ -117,5 +106,5 @@ export {
|
|
|
117
106
|
TupleValueItem,
|
|
118
107
|
UnitValue,
|
|
119
108
|
UnparsedValue,
|
|
120
|
-
|
|
109
|
+
isValidStaticStyleValue
|
|
121
110
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/css-data",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "CSS Data",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"typescript": "5.0.3",
|
|
15
15
|
"zod": "^3.19.1",
|
|
16
16
|
"@webstudio-is/scripts": "^0.0.0",
|
|
17
|
-
"@webstudio-is/tsconfig": "^1.0.
|
|
17
|
+
"@webstudio-is/tsconfig": "^1.0.4"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"zod": "^3.19.1"
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"private": false,
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"scripts": {
|
|
37
|
-
"typecheck": "tsc --noEmit",
|
|
37
|
+
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
|
|
38
38
|
"checks": "pnpm typecheck && pnpm lint",
|
|
39
39
|
"dev": "build-package --watch",
|
|
40
40
|
"build": "build-package",
|
|
41
41
|
"build:mdn-data": "tsx ./bin/mdn-data.ts ./src/__generated__ && prettier --write \"./src/__generated__/**/*.ts\"",
|
|
42
|
-
"dts": "tsc
|
|
42
|
+
"dts": "tsc",
|
|
43
43
|
"lint": "eslint ./src --ext .ts,.tsx --max-warnings 0"
|
|
44
44
|
}
|
|
45
45
|
}
|
package/src/schema.ts
CHANGED
|
@@ -128,22 +128,6 @@ export const LayersValue = z.object({
|
|
|
128
128
|
|
|
129
129
|
export type LayersValue = z.infer<typeof LayersValue>;
|
|
130
130
|
|
|
131
|
-
/**
|
|
132
|
-
* All StyleValue types that going to need wrapping into a CSS variable when rendered
|
|
133
|
-
* on canvas inside builder.
|
|
134
|
-
* Values like InvalidValue, UnsetValue, VarValue don't need to be wrapped
|
|
135
|
-
*/
|
|
136
|
-
export const validStaticValueTypes = [
|
|
137
|
-
"unit",
|
|
138
|
-
"keyword",
|
|
139
|
-
"fontFamily",
|
|
140
|
-
"rgb",
|
|
141
|
-
"image",
|
|
142
|
-
"unparsed",
|
|
143
|
-
"layers",
|
|
144
|
-
"tuple",
|
|
145
|
-
] as const;
|
|
146
|
-
|
|
147
131
|
const ValidStaticStyleValue = z.union([
|
|
148
132
|
ImageValue,
|
|
149
133
|
LayersValue,
|
|
@@ -157,6 +141,28 @@ const ValidStaticStyleValue = z.union([
|
|
|
157
141
|
|
|
158
142
|
export type ValidStaticStyleValue = z.infer<typeof ValidStaticStyleValue>;
|
|
159
143
|
|
|
144
|
+
/**
|
|
145
|
+
* All StyleValue types that going to need wrapping into a CSS variable when rendered
|
|
146
|
+
* on canvas inside builder.
|
|
147
|
+
* Values like InvalidValue, UnsetValue, VarValue don't need to be wrapped
|
|
148
|
+
*/
|
|
149
|
+
export const isValidStaticStyleValue = (
|
|
150
|
+
styleValue: StyleValue
|
|
151
|
+
): styleValue is ValidStaticStyleValue => {
|
|
152
|
+
// guard against invalid checks
|
|
153
|
+
const staticStyleValue = styleValue as ValidStaticStyleValue;
|
|
154
|
+
return (
|
|
155
|
+
staticStyleValue.type === "image" ||
|
|
156
|
+
staticStyleValue.type === "layers" ||
|
|
157
|
+
staticStyleValue.type === "unit" ||
|
|
158
|
+
staticStyleValue.type === "keyword" ||
|
|
159
|
+
staticStyleValue.type === "fontFamily" ||
|
|
160
|
+
staticStyleValue.type === "rgb" ||
|
|
161
|
+
staticStyleValue.type === "unparsed" ||
|
|
162
|
+
staticStyleValue.type === "tuple"
|
|
163
|
+
);
|
|
164
|
+
};
|
|
165
|
+
|
|
160
166
|
const VarValue = z.object({
|
|
161
167
|
type: z.literal("var"),
|
|
162
168
|
value: z.string(),
|
|
@@ -178,10 +184,3 @@ const Style = z.record(z.string(), StyleValue);
|
|
|
178
184
|
export type Style = {
|
|
179
185
|
[property in StyleProperty]?: StyleValue;
|
|
180
186
|
} & { [property: CustomProperty]: StyleValue };
|
|
181
|
-
|
|
182
|
-
export const CssRule = z.object({
|
|
183
|
-
style: Style,
|
|
184
|
-
breakpoint: z.optional(z.string()),
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
export type CssRule = z.infer<typeof CssRule>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|