@webstudio-is/css-engine 0.142.0 → 0.144.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
@@ -80,6 +80,9 @@ var toValue = (styleValue, transformValue) => {
80
80
  if (value.type === "function") {
81
81
  return `${value.name}(${toValue(value.args, transformValue)})`;
82
82
  }
83
+ if (value.type === "guaranteedInvalid") {
84
+ return "";
85
+ }
83
86
  return captureError(new Error("Unknown value type"), value);
84
87
  };
85
88
 
@@ -538,6 +541,9 @@ var ImageValue = z.object({
538
541
  // For the builder we want to be able to hide images
539
542
  hidden: z.boolean().optional()
540
543
  });
544
+ var GuaranteedInvalidValue = z.object({
545
+ type: z.literal("guaranteedInvalid")
546
+ });
541
547
  var InvalidValue = z.object({
542
548
  type: z.literal("invalid"),
543
549
  value: z.string()
@@ -580,11 +586,12 @@ var ValidStaticStyleValue = z.union([
580
586
  RgbValue,
581
587
  UnparsedValue,
582
588
  TupleValue,
583
- FunctionValue
589
+ FunctionValue,
590
+ GuaranteedInvalidValue
584
591
  ]);
585
592
  var isValidStaticStyleValue = (styleValue) => {
586
593
  const staticStyleValue = styleValue;
587
- 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" || staticStyleValue.type === "function";
594
+ 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" || staticStyleValue.type === "function" || staticStyleValue.type === "guaranteedInvalid";
588
595
  };
589
596
  var VarValue = z.object({
590
597
  type: z.literal("var"),
@@ -600,6 +607,7 @@ var StyleValue = z.union([
600
607
  var Style = z.record(z.string(), StyleValue);
601
608
  export {
602
609
  FunctionValue,
610
+ GuaranteedInvalidValue,
603
611
  ImageValue,
604
612
  InvalidValue,
605
613
  KeywordValue,
@@ -130,6 +130,8 @@ export declare class StylePropertyMap {
130
130
  type: "invalid";
131
131
  value: string;
132
132
  })[];
133
+ } | {
134
+ type: "guaranteedInvalid";
133
135
  } | {
134
136
  type: "unset";
135
137
  value: "";
@@ -235,6 +237,8 @@ export declare class StylePropertyMap {
235
237
  type: "invalid";
236
238
  value: string;
237
239
  })[];
240
+ } | {
241
+ type: "guaranteedInvalid";
238
242
  })[];
239
243
  };
240
244
  } | {
@@ -350,6 +354,8 @@ export declare class StylePropertyMap {
350
354
  type: "invalid";
351
355
  value: string;
352
356
  })[];
357
+ } | {
358
+ type: "guaranteedInvalid";
353
359
  } | {
354
360
  type: "unset";
355
361
  value: "";
@@ -455,6 +461,8 @@ export declare class StylePropertyMap {
455
461
  type: "invalid";
456
462
  value: string;
457
463
  })[];
464
+ } | {
465
+ type: "guaranteedInvalid";
458
466
  })[];
459
467
  };
460
468
  })[];
@@ -559,6 +567,8 @@ export declare class StylePropertyMap {
559
567
  type: "invalid";
560
568
  value: string;
561
569
  })[];
570
+ } | {
571
+ type: "guaranteedInvalid";
562
572
  } | {
563
573
  type: "unset";
564
574
  value: "";
@@ -664,6 +674,8 @@ export declare class StylePropertyMap {
664
674
  type: "invalid";
665
675
  value: string;
666
676
  })[];
677
+ } | {
678
+ type: "guaranteedInvalid";
667
679
  })[];
668
680
  };
669
681
  } | {
@@ -701,6 +713,8 @@ export declare class StylePropertyMap {
701
713
  type: "invalid";
702
714
  value: string;
703
715
  })[];
716
+ } | {
717
+ type: "guaranteedInvalid";
704
718
  } | {
705
719
  type: "unset";
706
720
  value: "";
@@ -811,6 +825,8 @@ export declare class StylePropertyMap {
811
825
  type: "invalid";
812
826
  value: string;
813
827
  })[];
828
+ } | {
829
+ type: "guaranteedInvalid";
814
830
  } | {
815
831
  type: "unset";
816
832
  value: "";
@@ -916,6 +932,8 @@ export declare class StylePropertyMap {
916
932
  type: "invalid";
917
933
  value: string;
918
934
  })[];
935
+ } | {
936
+ type: "guaranteedInvalid";
919
937
  })[];
920
938
  };
921
939
  } | {
@@ -997,6 +1015,8 @@ export declare class StylePropertyMap {
997
1015
  type: "invalid";
998
1016
  value: string;
999
1017
  })[];
1018
+ } | {
1019
+ type: "guaranteedInvalid";
1000
1020
  })[];
1001
1021
  } | undefined;
1002
1022
  has(property: StyleProperty): boolean;
@@ -127,6 +127,14 @@ export declare const ImageValue: z.ZodObject<{
127
127
  hidden?: boolean | undefined;
128
128
  }>;
129
129
  export type ImageValue = z.infer<typeof ImageValue>;
130
+ export declare const GuaranteedInvalidValue: z.ZodObject<{
131
+ type: z.ZodLiteral<"guaranteedInvalid">;
132
+ }, "strip", z.ZodTypeAny, {
133
+ type: "guaranteedInvalid";
134
+ }, {
135
+ type: "guaranteedInvalid";
136
+ }>;
137
+ export type GuaranteedInvalidValue = z.infer<typeof GuaranteedInvalidValue>;
130
138
  export declare const InvalidValue: z.ZodObject<{
131
139
  type: z.ZodLiteral<"invalid">;
132
140
  value: z.ZodString;
@@ -1397,6 +1405,12 @@ declare const ValidStaticStyleValue: z.ZodUnion<[z.ZodObject<{
1397
1405
  type: "function";
1398
1406
  name: string;
1399
1407
  args: StyleValue;
1408
+ }>, z.ZodObject<{
1409
+ type: z.ZodLiteral<"guaranteedInvalid">;
1410
+ }, "strip", z.ZodTypeAny, {
1411
+ type: "guaranteedInvalid";
1412
+ }, {
1413
+ type: "guaranteedInvalid";
1400
1414
  }>]>;
1401
1415
  export type ValidStaticStyleValue = z.infer<typeof ValidStaticStyleValue>;
1402
1416
  /**
@@ -1519,6 +1533,8 @@ export declare const isValidStaticStyleValue: (styleValue: StyleValue) => styleV
1519
1533
  type: "invalid";
1520
1534
  value: string;
1521
1535
  })[];
1536
+ } | {
1537
+ type: "guaranteedInvalid";
1522
1538
  };
1523
1539
  declare const VarValue: z.ZodObject<{
1524
1540
  type: z.ZodLiteral<"var">;
@@ -2066,6 +2082,12 @@ declare const VarValue: z.ZodObject<{
2066
2082
  type: "function";
2067
2083
  name: string;
2068
2084
  args: StyleValue;
2085
+ }>, z.ZodObject<{
2086
+ type: z.ZodLiteral<"guaranteedInvalid">;
2087
+ }, "strip", z.ZodTypeAny, {
2088
+ type: "guaranteedInvalid";
2089
+ }, {
2090
+ type: "guaranteedInvalid";
2069
2091
  }>]>, "many">;
2070
2092
  }, "strip", z.ZodTypeAny, {
2071
2093
  type: "var";
@@ -2185,6 +2207,8 @@ declare const VarValue: z.ZodObject<{
2185
2207
  type: "invalid";
2186
2208
  value: string;
2187
2209
  })[];
2210
+ } | {
2211
+ type: "guaranteedInvalid";
2188
2212
  })[];
2189
2213
  }, {
2190
2214
  type: "var";
@@ -2304,6 +2328,8 @@ declare const VarValue: z.ZodObject<{
2304
2328
  type: "invalid";
2305
2329
  value: string;
2306
2330
  })[];
2331
+ } | {
2332
+ type: "guaranteedInvalid";
2307
2333
  })[];
2308
2334
  }>;
2309
2335
  export type VarValue = z.infer<typeof VarValue>;
@@ -2850,6 +2876,12 @@ export declare const StyleValue: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
2850
2876
  type: "function";
2851
2877
  name: string;
2852
2878
  args: StyleValue;
2879
+ }>, z.ZodObject<{
2880
+ type: z.ZodLiteral<"guaranteedInvalid">;
2881
+ }, "strip", z.ZodTypeAny, {
2882
+ type: "guaranteedInvalid";
2883
+ }, {
2884
+ type: "guaranteedInvalid";
2853
2885
  }>]>, z.ZodObject<{
2854
2886
  type: z.ZodLiteral<"invalid">;
2855
2887
  value: z.ZodString;
@@ -3414,6 +3446,12 @@ export declare const StyleValue: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
3414
3446
  type: "function";
3415
3447
  name: string;
3416
3448
  args: StyleValue;
3449
+ }>, z.ZodObject<{
3450
+ type: z.ZodLiteral<"guaranteedInvalid">;
3451
+ }, "strip", z.ZodTypeAny, {
3452
+ type: "guaranteedInvalid";
3453
+ }, {
3454
+ type: "guaranteedInvalid";
3417
3455
  }>]>, "many">;
3418
3456
  }, "strip", z.ZodTypeAny, {
3419
3457
  type: "var";
@@ -3533,6 +3571,8 @@ export declare const StyleValue: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
3533
3571
  type: "invalid";
3534
3572
  value: string;
3535
3573
  })[];
3574
+ } | {
3575
+ type: "guaranteedInvalid";
3536
3576
  })[];
3537
3577
  }, {
3538
3578
  type: "var";
@@ -3652,6 +3692,8 @@ export declare const StyleValue: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
3652
3692
  type: "invalid";
3653
3693
  value: string;
3654
3694
  })[];
3695
+ } | {
3696
+ type: "guaranteedInvalid";
3655
3697
  })[];
3656
3698
  }>]>;
3657
3699
  export type StyleValue = z.infer<typeof StyleValue>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/css-engine",
3
- "version": "0.142.0",
3
+ "version": "0.144.0",
4
4
  "description": "CSS Renderer for Webstudio",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -8,8 +8,8 @@
8
8
  "dependencies": {
9
9
  "@emotion/hash": "^0.9.1",
10
10
  "hyphenate-style-name": "^1.0.4",
11
- "@webstudio-is/error-utils": "0.142.0",
12
- "@webstudio-is/fonts": "0.142.0"
11
+ "@webstudio-is/error-utils": "0.144.0",
12
+ "@webstudio-is/fonts": "0.144.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@jest/globals": "^29.7.0",