@webstudio-is/css-data 0.1.0 → 0.2.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/properties.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8nGb,CAAC"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Breakpoints = exports.Breakpoint = exports.CssRule = exports.Style = exports.StyleValue = exports.VarValue = exports.ValidStaticStyleValue = exports.validStaticValueTypes = exports.UnsetValue = exports.InvalidValue = exports.FontFamilyValue = exports.KeywordValue = exports.UnitValue = exports.Unit = void 0;
4
+ const units_1 = require("./units");
5
+ const zod_1 = require("zod");
6
+ exports.Unit = zod_1.z.union([zod_1.z.enum(units_1.units), zod_1.z.literal("number")]);
7
+ exports.UnitValue = zod_1.z.object({
8
+ type: zod_1.z.literal("unit"),
9
+ unit: exports.Unit,
10
+ value: zod_1.z.number(),
11
+ });
12
+ exports.KeywordValue = zod_1.z.object({
13
+ type: zod_1.z.literal("keyword"),
14
+ // @todo use exact type
15
+ value: zod_1.z.string(),
16
+ });
17
+ exports.FontFamilyValue = zod_1.z.object({
18
+ type: zod_1.z.literal("fontFamily"),
19
+ value: zod_1.z.array(zod_1.z.string()),
20
+ });
21
+ // We want to be able to render the invalid value
22
+ // and show it is invalid visually, without saving it to the db
23
+ exports.InvalidValue = zod_1.z.object({
24
+ type: zod_1.z.literal("invalid"),
25
+ value: zod_1.z.string(),
26
+ });
27
+ exports.UnsetValue = zod_1.z.object({
28
+ type: zod_1.z.literal("unset"),
29
+ value: zod_1.z.literal(""),
30
+ });
31
+ exports.validStaticValueTypes = ["unit", "keyword", "fontFamily"];
32
+ exports.ValidStaticStyleValue = zod_1.z.union([
33
+ exports.UnitValue,
34
+ exports.KeywordValue,
35
+ exports.FontFamilyValue,
36
+ ]);
37
+ exports.VarValue = zod_1.z.object({
38
+ type: zod_1.z.literal("var"),
39
+ value: zod_1.z.string(),
40
+ fallbacks: zod_1.z.array(exports.ValidStaticStyleValue),
41
+ });
42
+ exports.StyleValue = zod_1.z.union([
43
+ exports.ValidStaticStyleValue,
44
+ exports.InvalidValue,
45
+ exports.UnsetValue,
46
+ exports.VarValue,
47
+ ]);
48
+ exports.Style = zod_1.z.record(zod_1.z.string(), exports.StyleValue);
49
+ exports.CssRule = zod_1.z.object({
50
+ style: exports.Style,
51
+ breakpoint: zod_1.z.string(),
52
+ });
53
+ exports.Breakpoint = zod_1.z.object({
54
+ id: zod_1.z.string(),
55
+ label: zod_1.z.string(),
56
+ minWidth: zod_1.z.number(),
57
+ });
58
+ exports.Breakpoints = zod_1.z.array(exports.Breakpoint);