@webstudio-is/css-engine 0.185.0 → 0.189.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/index.js CHANGED
@@ -84,7 +84,19 @@ var UnsetValue = z.object({
84
84
  value: z.literal(""),
85
85
  hidden: z.boolean().optional()
86
86
  });
87
- var VarFallback = z.union([UnparsedValue, KeywordValue]);
87
+ var VarFallback = z.union([
88
+ UnparsedValue,
89
+ KeywordValue,
90
+ UnitValue,
91
+ RgbValue
92
+ ]);
93
+ var toVarFallback = (styleValue, transformValue) => {
94
+ if (styleValue.type === "unparsed" || styleValue.type === "keyword" || styleValue.type === "unit" || styleValue.type === "rgb") {
95
+ return styleValue;
96
+ }
97
+ styleValue;
98
+ return { type: "unparsed", value: toValue(styleValue, transformValue) };
99
+ };
88
100
  var VarValue = z.object({
89
101
  type: z.literal("var"),
90
102
  value: z.string(),
@@ -312,6 +324,9 @@ var mergeWhiteSpaceAndTextWrap = (styleMap) => {
312
324
  if (collapse === "break-spaces") {
313
325
  styleMap.set("white-space", { type: "keyword", value: "break-spaces" });
314
326
  }
327
+ if (style === "auto") {
328
+ styleMap.set("text-wrap", modeValue ?? { type: "keyword", value: "wrap" });
329
+ }
315
330
  if (style === "balance" || style === "stable" || style === "pretty") {
316
331
  styleMap.set("text-wrap", { type: "keyword", value: style });
317
332
  }
@@ -931,5 +946,6 @@ export {
931
946
  matchMedia,
932
947
  mergeStyles,
933
948
  prefixStyles,
934
- toValue
949
+ toValue,
950
+ toVarFallback
935
951
  };
@@ -43,6 +43,11 @@ export declare const mergeStyles: (styleMap: StyleMap) => Map<string, {
43
43
  type: "var";
44
44
  value: string;
45
45
  fallback?: {
46
+ type: "unit";
47
+ value: number;
48
+ unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
49
+ hidden?: boolean | undefined;
50
+ } | {
46
51
  type: "keyword";
47
52
  value: string;
48
53
  hidden?: boolean | undefined;
@@ -50,6 +55,13 @@ export declare const mergeStyles: (styleMap: StyleMap) => Map<string, {
50
55
  type: "unparsed";
51
56
  value: string;
52
57
  hidden?: boolean | undefined;
58
+ } | {
59
+ type: "rgb";
60
+ r: number;
61
+ g: number;
62
+ b: number;
63
+ alpha: number;
64
+ hidden?: boolean | undefined;
53
65
  } | undefined;
54
66
  hidden?: boolean | undefined;
55
67
  } | {
@@ -93,6 +105,11 @@ export declare const mergeStyles: (styleMap: StyleMap) => Map<string, {
93
105
  type: "var";
94
106
  value: string;
95
107
  fallback?: {
108
+ type: "unit";
109
+ value: number;
110
+ unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
111
+ hidden?: boolean | undefined;
112
+ } | {
96
113
  type: "keyword";
97
114
  value: string;
98
115
  hidden?: boolean | undefined;
@@ -100,6 +117,13 @@ export declare const mergeStyles: (styleMap: StyleMap) => Map<string, {
100
117
  type: "unparsed";
101
118
  value: string;
102
119
  hidden?: boolean | undefined;
120
+ } | {
121
+ type: "rgb";
122
+ r: number;
123
+ g: number;
124
+ b: number;
125
+ alpha: number;
126
+ hidden?: boolean | undefined;
103
127
  } | undefined;
104
128
  hidden?: boolean | undefined;
105
129
  })[];
@@ -149,6 +173,11 @@ export declare const mergeStyles: (styleMap: StyleMap) => Map<string, {
149
173
  type: "var";
150
174
  value: string;
151
175
  fallback?: {
176
+ type: "unit";
177
+ value: number;
178
+ unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
179
+ hidden?: boolean | undefined;
180
+ } | {
152
181
  type: "keyword";
153
182
  value: string;
154
183
  hidden?: boolean | undefined;
@@ -156,6 +185,13 @@ export declare const mergeStyles: (styleMap: StyleMap) => Map<string, {
156
185
  type: "unparsed";
157
186
  value: string;
158
187
  hidden?: boolean | undefined;
188
+ } | {
189
+ type: "rgb";
190
+ r: number;
191
+ g: number;
192
+ b: number;
193
+ alpha: number;
194
+ hidden?: boolean | undefined;
159
195
  } | undefined;
160
196
  hidden?: boolean | undefined;
161
197
  } | {
@@ -199,6 +235,11 @@ export declare const mergeStyles: (styleMap: StyleMap) => Map<string, {
199
235
  type: "var";
200
236
  value: string;
201
237
  fallback?: {
238
+ type: "unit";
239
+ value: number;
240
+ unit: "number" | "%" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "px" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "dppx" | "x" | "st" | "s" | "ms";
241
+ hidden?: boolean | undefined;
242
+ } | {
202
243
  type: "keyword";
203
244
  value: string;
204
245
  hidden?: boolean | undefined;
@@ -206,6 +247,13 @@ export declare const mergeStyles: (styleMap: StyleMap) => Map<string, {
206
247
  type: "unparsed";
207
248
  value: string;
208
249
  hidden?: boolean | undefined;
250
+ } | {
251
+ type: "rgb";
252
+ r: number;
253
+ g: number;
254
+ b: number;
255
+ alpha: number;
256
+ hidden?: boolean | undefined;
209
257
  } | undefined;
210
258
  hidden?: boolean | undefined;
211
259
  })[];
@@ -33,7 +33,7 @@ export declare class MixinRule {
33
33
  clearBreakpoints(): void;
34
34
  setDeclaration(declaration: Declaration): void;
35
35
  deleteDeclaration(declaration: DeclarationKey): void;
36
- getDeclarations(): IterableIterator<Declaration>;
36
+ getDeclarations(): MapIterator<Declaration>;
37
37
  }
38
38
  /**
39
39
  * Universal style rule with nested selectors and media queries support