@webstudio-is/css-data 0.44.0 → 0.45.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.
@@ -21,6 +21,8 @@ __export(schema_exports, {
21
21
  CssRule: () => CssRule,
22
22
  ImageValue: () => ImageValue,
23
23
  SharedStyleValue: () => SharedStyleValue,
24
+ TupleValue: () => TupleValue,
25
+ TupleValueItem: () => TupleValueItem,
24
26
  validStaticValueTypes: () => validStaticValueTypes
25
27
  });
26
28
  module.exports = __toCommonJS(schema_exports);
@@ -71,6 +73,11 @@ const ArrayValue = import_zod.z.object({
71
73
  type: import_zod.z.literal("layers"),
72
74
  value: import_zod.z.array(import_zod.z.union([UnitValue, KeywordValue, UnparsedValue, ImageValue]))
73
75
  });
76
+ const TupleValueItem = import_zod.z.union([UnitValue, KeywordValue, UnparsedValue]);
77
+ const TupleValue = import_zod.z.object({
78
+ type: import_zod.z.literal("tuple"),
79
+ value: import_zod.z.array(TupleValueItem)
80
+ });
74
81
  const validStaticValueTypes = [
75
82
  "unit",
76
83
  "keyword",
@@ -78,7 +85,8 @@ const validStaticValueTypes = [
78
85
  "rgb",
79
86
  "image",
80
87
  "unparsed",
81
- "array"
88
+ "array",
89
+ "tuple"
82
90
  ];
83
91
  const SharedStaticStyleValue = import_zod.z.union([
84
92
  UnitValue,
@@ -86,7 +94,8 @@ const SharedStaticStyleValue = import_zod.z.union([
86
94
  FontFamilyValue,
87
95
  RgbValue,
88
96
  UnparsedValue,
89
- ArrayValue
97
+ ArrayValue,
98
+ TupleValue
90
99
  ]);
91
100
  const ValidStaticStyleValue = import_zod.z.union([ImageValue, SharedStaticStyleValue]);
92
101
  const VarValue = import_zod.z.object({
package/lib/schema.js CHANGED
@@ -45,6 +45,11 @@ const ArrayValue = z.object({
45
45
  type: z.literal("layers"),
46
46
  value: z.array(z.union([UnitValue, KeywordValue, UnparsedValue, ImageValue]))
47
47
  });
48
+ const TupleValueItem = z.union([UnitValue, KeywordValue, UnparsedValue]);
49
+ const TupleValue = z.object({
50
+ type: z.literal("tuple"),
51
+ value: z.array(TupleValueItem)
52
+ });
48
53
  const validStaticValueTypes = [
49
54
  "unit",
50
55
  "keyword",
@@ -52,7 +57,8 @@ const validStaticValueTypes = [
52
57
  "rgb",
53
58
  "image",
54
59
  "unparsed",
55
- "array"
60
+ "array",
61
+ "tuple"
56
62
  ];
57
63
  const SharedStaticStyleValue = z.union([
58
64
  UnitValue,
@@ -60,7 +66,8 @@ const SharedStaticStyleValue = z.union([
60
66
  FontFamilyValue,
61
67
  RgbValue,
62
68
  UnparsedValue,
63
- ArrayValue
69
+ ArrayValue,
70
+ TupleValue
64
71
  ]);
65
72
  const ValidStaticStyleValue = z.union([ImageValue, SharedStaticStyleValue]);
66
73
  const VarValue = z.object({
@@ -89,5 +96,7 @@ export {
89
96
  CssRule,
90
97
  ImageValue,
91
98
  SharedStyleValue,
99
+ TupleValue,
100
+ TupleValueItem,
92
101
  validStaticValueTypes
93
102
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/css-data",
3
- "version": "0.44.0",
3
+ "version": "0.45.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.44.0",
15
+ "@webstudio-is/asset-uploader": "^0.45.0",
16
16
  "@webstudio-is/scripts": "^0.0.0",
17
17
  "@webstudio-is/tsconfig": "^1.0.1"
18
18
  },
package/src/schema.ts CHANGED
@@ -97,6 +97,20 @@ const ArrayValue = z.object({
97
97
  });
98
98
  export type ArrayValue = z.infer<typeof ArrayValue>;
99
99
 
100
+ export const TupleValueItem = z.union([UnitValue, KeywordValue, UnparsedValue]);
101
+ export type TupleValueItem = z.infer<typeof TupleValueItem>;
102
+
103
+ export const TupleValue = z.object({
104
+ type: z.literal("tuple"),
105
+ value: z.array(TupleValueItem),
106
+ });
107
+ export type TupleValue = z.infer<typeof TupleValue>;
108
+
109
+ /**
110
+ * All StyleValue types that going to need wrapping into a CSS variable when rendered
111
+ * on canvas inside builder.
112
+ * Values like InvalidValue, UnsetValue, VarValue don't need to be wrapped
113
+ */
100
114
  export const validStaticValueTypes = [
101
115
  "unit",
102
116
  "keyword",
@@ -105,6 +119,7 @@ export const validStaticValueTypes = [
105
119
  "image",
106
120
  "unparsed",
107
121
  "array",
122
+ "tuple",
108
123
  ] as const;
109
124
 
110
125
  /**
@@ -118,6 +133,7 @@ const SharedStaticStyleValue = z.union([
118
133
  RgbValue,
119
134
  UnparsedValue,
120
135
  ArrayValue,
136
+ TupleValue,
121
137
  ]);
122
138
 
123
139
  const ValidStaticStyleValue = z.union([ImageValue, SharedStaticStyleValue]);