@webstudio-is/css-data 0.48.0 → 0.50.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.
@@ -35,6 +35,8 @@ var import_units = require("./__generated__/units");
35
35
  var import_zod = require("zod");
36
36
  var import_asset_uploader = require("@webstudio-is/asset-uploader");
37
37
  const Unit = import_zod.z.union([
38
+ // expected tuple with at least single element
39
+ // so cast to tuple with single union element to get correct inference
38
40
  import_zod.z.enum(Object.values(import_units.units).flat()),
39
41
  import_zod.z.literal("number")
40
42
  ]);
@@ -45,11 +47,13 @@ const UnitValue = import_zod.z.object({
45
47
  });
46
48
  const KeywordValue = import_zod.z.object({
47
49
  type: import_zod.z.literal("keyword"),
50
+ // @todo use exact type
48
51
  value: import_zod.z.string()
49
52
  });
50
53
  const UnparsedValue = import_zod.z.object({
51
54
  type: import_zod.z.literal("unparsed"),
52
55
  value: import_zod.z.string(),
56
+ // For the builder we want to be able to hide background-image
53
57
  hidden: import_zod.z.boolean().optional()
54
58
  });
55
59
  const FontFamilyValue = import_zod.z.object({
@@ -66,6 +70,7 @@ const RgbValue = import_zod.z.object({
66
70
  const ImageValue = import_zod.z.object({
67
71
  type: import_zod.z.literal("image"),
68
72
  value: import_zod.z.object({ type: import_zod.z.literal("asset"), value: import_asset_uploader.ImageAsset }),
73
+ // For the builder we want to be able to hide images
69
74
  hidden: import_zod.z.boolean().optional()
70
75
  });
71
76
  const InvalidValue = import_zod.z.object({
package/lib/schema.js CHANGED
@@ -2,6 +2,8 @@ import { units } from "./__generated__/units";
2
2
  import { z } from "zod";
3
3
  import { ImageAsset } from "@webstudio-is/asset-uploader";
4
4
  const Unit = z.union([
5
+ // expected tuple with at least single element
6
+ // so cast to tuple with single union element to get correct inference
5
7
  z.enum(Object.values(units).flat()),
6
8
  z.literal("number")
7
9
  ]);
@@ -12,11 +14,13 @@ const UnitValue = z.object({
12
14
  });
13
15
  const KeywordValue = z.object({
14
16
  type: z.literal("keyword"),
17
+ // @todo use exact type
15
18
  value: z.string()
16
19
  });
17
20
  const UnparsedValue = z.object({
18
21
  type: z.literal("unparsed"),
19
22
  value: z.string(),
23
+ // For the builder we want to be able to hide background-image
20
24
  hidden: z.boolean().optional()
21
25
  });
22
26
  const FontFamilyValue = z.object({
@@ -33,6 +37,7 @@ const RgbValue = z.object({
33
37
  const ImageValue = z.object({
34
38
  type: z.literal("image"),
35
39
  value: z.object({ type: z.literal("asset"), value: ImageAsset }),
40
+ // For the builder we want to be able to hide images
36
41
  hidden: z.boolean().optional()
37
42
  });
38
43
  const InvalidValue = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/css-data",
3
- "version": "0.48.0",
3
+ "version": "0.50.0",
4
4
  "description": "CSS Data",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -10,9 +10,10 @@
10
10
  "camelcase": "^6.3.0",
11
11
  "css-tree": "^2.3.1",
12
12
  "mdn-data": "2.0.30",
13
+ "tsx": "^3.12.6",
13
14
  "typescript": "4.9.5",
14
15
  "zod": "^3.19.1",
15
- "@webstudio-is/asset-uploader": "^0.48.0",
16
+ "@webstudio-is/asset-uploader": "^0.50.0",
16
17
  "@webstudio-is/scripts": "^0.0.0",
17
18
  "@webstudio-is/tsconfig": "^1.0.1"
18
19
  },
package/src/schema.ts CHANGED
@@ -55,6 +55,8 @@ export const UnparsedValue = z.object({
55
55
  hidden: z.boolean().optional(),
56
56
  });
57
57
 
58
+ export type UnparsedValue = z.infer<typeof UnparsedValue>;
59
+
58
60
  const FontFamilyValue = z.object({
59
61
  type: z.literal("fontFamily"),
60
62
  value: z.array(z.string()),