@webstudio-is/css-data 0.56.0 → 0.58.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/css-data",
3
- "version": "0.56.0",
3
+ "version": "0.58.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.3"
17
+ "@webstudio-is/tsconfig": "^1.0.5"
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 --emitDeclarationOnly --declaration --declarationDir lib/types",
42
+ "dts": "tsc --declarationDir lib/types",
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>;