@webstudio-is/css-data 0.3.0 → 0.4.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/__generated__/keyword-values.js +6617 -6615
- package/lib/__generated__/properties.js +3200 -3198
- package/lib/__generated__/units.js +33 -31
- package/lib/cjs/__generated__/keyword-values.cjs +6636 -6617
- package/lib/cjs/__generated__/properties.cjs +3219 -3200
- package/lib/cjs/__generated__/units.cjs +52 -33
- package/lib/cjs/index.cjs +19 -18
- package/lib/cjs/popularity-index.cjs +4631 -4612
- package/lib/cjs/schema.cjs +83 -53
- package/lib/popularity-index.js +4612 -4610
- package/lib/schema.js +62 -49
- package/package.json +11 -19
- package/src/__generated__/keyword-values.ts +6616 -0
- package/src/__generated__/properties.ts +3200 -0
- package/src/__generated__/units.ts +32 -0
- package/{lib/cjs/index.d.ts → src/index.ts} +0 -1
- package/src/popularity-index.ts +4611 -0
- package/src/schema.ts +103 -0
- package/lib/__generated__/keyword-values.d.ts +0 -302
- package/lib/__generated__/keyword-values.d.ts.map +0 -1
- package/lib/__generated__/properties.d.ts +0 -3199
- package/lib/__generated__/properties.d.ts.map +0 -1
- package/lib/__generated__/units.d.ts +0 -2
- package/lib/__generated__/units.d.ts.map +0 -1
- package/lib/cjs/__generated__/keyword-values.d.ts +0 -302
- package/lib/cjs/__generated__/keyword-values.d.ts.map +0 -1
- package/lib/cjs/__generated__/properties.d.ts +0 -3199
- package/lib/cjs/__generated__/properties.d.ts.map +0 -1
- package/lib/cjs/__generated__/units.d.ts +0 -2
- package/lib/cjs/__generated__/units.d.ts.map +0 -1
- package/lib/cjs/index.d.ts.map +0 -1
- package/lib/cjs/popularity-index.d.ts +0 -7
- package/lib/cjs/popularity-index.d.ts.map +0 -1
- package/lib/cjs/schema.d.ts +0 -607
- package/lib/cjs/schema.d.ts.map +0 -1
- package/lib/index.d.ts +0 -5
- package/lib/index.d.ts.map +0 -1
- package/lib/popularity-index.d.ts +0 -7
- package/lib/popularity-index.d.ts.map +0 -1
- package/lib/schema.d.ts +0 -607
- package/lib/schema.d.ts.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
package/lib/schema.js
CHANGED
|
@@ -1,55 +1,68 @@
|
|
|
1
1
|
import { units } from "./__generated__/units";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
UnitValue,
|
|
31
|
-
KeywordValue,
|
|
32
|
-
FontFamilyValue,
|
|
3
|
+
const Unit = z.union([z.enum(units), z.literal("number")]);
|
|
4
|
+
const UnitValue = z.object({
|
|
5
|
+
type: z.literal("unit"),
|
|
6
|
+
unit: Unit,
|
|
7
|
+
value: z.number()
|
|
8
|
+
});
|
|
9
|
+
const KeywordValue = z.object({
|
|
10
|
+
type: z.literal("keyword"),
|
|
11
|
+
value: z.string()
|
|
12
|
+
});
|
|
13
|
+
const FontFamilyValue = z.object({
|
|
14
|
+
type: z.literal("fontFamily"),
|
|
15
|
+
value: z.array(z.string())
|
|
16
|
+
});
|
|
17
|
+
const InvalidValue = z.object({
|
|
18
|
+
type: z.literal("invalid"),
|
|
19
|
+
value: z.string()
|
|
20
|
+
});
|
|
21
|
+
const UnsetValue = z.object({
|
|
22
|
+
type: z.literal("unset"),
|
|
23
|
+
value: z.literal("")
|
|
24
|
+
});
|
|
25
|
+
const validStaticValueTypes = ["unit", "keyword", "fontFamily"];
|
|
26
|
+
const ValidStaticStyleValue = z.union([
|
|
27
|
+
UnitValue,
|
|
28
|
+
KeywordValue,
|
|
29
|
+
FontFamilyValue
|
|
33
30
|
]);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
const VarValue = z.object({
|
|
32
|
+
type: z.literal("var"),
|
|
33
|
+
value: z.string(),
|
|
34
|
+
fallbacks: z.array(ValidStaticStyleValue)
|
|
35
|
+
});
|
|
36
|
+
const StyleValue = z.union([
|
|
37
|
+
ValidStaticStyleValue,
|
|
38
|
+
InvalidValue,
|
|
39
|
+
UnsetValue,
|
|
40
|
+
VarValue
|
|
44
41
|
]);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
const Style = z.record(z.string(), StyleValue);
|
|
43
|
+
const CssRule = z.object({
|
|
44
|
+
style: Style,
|
|
45
|
+
breakpoint: z.optional(z.string())
|
|
49
46
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
const Breakpoint = z.object({
|
|
48
|
+
id: z.string(),
|
|
49
|
+
label: z.string(),
|
|
50
|
+
minWidth: z.number()
|
|
54
51
|
});
|
|
55
|
-
|
|
52
|
+
const Breakpoints = z.array(Breakpoint);
|
|
53
|
+
export {
|
|
54
|
+
Breakpoint,
|
|
55
|
+
Breakpoints,
|
|
56
|
+
CssRule,
|
|
57
|
+
FontFamilyValue,
|
|
58
|
+
InvalidValue,
|
|
59
|
+
KeywordValue,
|
|
60
|
+
Style,
|
|
61
|
+
StyleValue,
|
|
62
|
+
Unit,
|
|
63
|
+
UnitValue,
|
|
64
|
+
UnsetValue,
|
|
65
|
+
ValidStaticStyleValue,
|
|
66
|
+
VarValue,
|
|
67
|
+
validStaticValueTypes
|
|
68
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/css-data",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "CSS Data",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -8,21 +8,20 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"typecheck": "tsc --noEmit",
|
|
10
10
|
"checks": "yarn typecheck && yarn lint",
|
|
11
|
-
"dev": "
|
|
12
|
-
"build
|
|
13
|
-
"build": "
|
|
14
|
-
"build:mdn-data": "tsx ./bin/mdn-data.ts ./src/__generated__",
|
|
11
|
+
"dev": "build-package --watch",
|
|
12
|
+
"build": "build-package",
|
|
13
|
+
"build:mdn-data": "tsx ./bin/mdn-data.ts ./src/__generated__ && prettier --write \"./src/__generated__/**/*.ts\"",
|
|
15
14
|
"lint": "eslint ./src --ext .ts,.tsx --max-warnings 0",
|
|
16
15
|
"publish-to-npm": "bash ../../bin/publish-to-npm.sh"
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {},
|
|
19
18
|
"devDependencies": {
|
|
19
|
+
"@types/css-tree": "^2.0.0",
|
|
20
|
+
"@webstudio-is/scripts": "*",
|
|
21
|
+
"camelcase": "^6.3.0",
|
|
22
|
+
"css-tree": "^2.3.0",
|
|
20
23
|
"mdn-data": "2.0.23",
|
|
21
|
-
"tsup": "^6.1.3",
|
|
22
24
|
"typescript": "4.7.4",
|
|
23
|
-
"@types/css-tree": "^1.0.7",
|
|
24
|
-
"css-tree": "^2.1.0",
|
|
25
|
-
"camelcase": "^6.3.0",
|
|
26
25
|
"zod": "^3.19.1"
|
|
27
26
|
},
|
|
28
27
|
"peerDependencies": {
|
|
@@ -32,20 +31,13 @@
|
|
|
32
31
|
"import": "./lib/index.js",
|
|
33
32
|
"require": "./lib/cjs/index.cjs"
|
|
34
33
|
},
|
|
35
|
-
"types": "
|
|
34
|
+
"types": "src/index.ts",
|
|
36
35
|
"files": [
|
|
37
36
|
"lib/*",
|
|
38
|
-
"
|
|
37
|
+
"src/*",
|
|
39
38
|
"!*.test.*"
|
|
40
39
|
],
|
|
41
40
|
"license": "MIT",
|
|
42
41
|
"private": false,
|
|
43
|
-
"sideEffects": false
|
|
44
|
-
"tsup": {
|
|
45
|
-
"entry": [
|
|
46
|
-
"src/index.ts"
|
|
47
|
-
],
|
|
48
|
-
"format": "esm",
|
|
49
|
-
"outDir": "lib"
|
|
50
|
-
}
|
|
42
|
+
"sideEffects": false
|
|
51
43
|
}
|