@valancex/style 0.0.0-stage → 0.14.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.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +33 -2
  3. package/contract/style-contract-v1.json +207 -0
  4. package/dist/check.d.ts +31 -0
  5. package/dist/check.js +250 -0
  6. package/dist/color.d.ts +17 -0
  7. package/dist/color.js +82 -0
  8. package/dist/contrast.d.ts +5 -0
  9. package/dist/contrast.js +13 -0
  10. package/dist/coverage.d.ts +21 -0
  11. package/dist/coverage.js +60 -0
  12. package/dist/css.d.ts +9 -0
  13. package/dist/css.js +201 -0
  14. package/dist/desktop.d.ts +33 -0
  15. package/dist/desktop.js +112 -0
  16. package/dist/index.d.ts +17 -0
  17. package/dist/index.js +11 -0
  18. package/dist/load.d.ts +5 -0
  19. package/dist/load.js +8 -0
  20. package/dist/primitives.d.ts +2 -0
  21. package/dist/primitives.js +364 -0
  22. package/dist/suggest.d.ts +2 -0
  23. package/dist/suggest.js +22 -0
  24. package/dist/theme.d.ts +5 -0
  25. package/dist/theme.js +129 -0
  26. package/dist/tokens.d.ts +21 -0
  27. package/dist/tokens.js +257 -0
  28. package/dist/types.d.ts +114 -0
  29. package/dist/types.js +3 -0
  30. package/package.json +64 -3
  31. package/schema/dtcg-2025.10/NOTICE.md +6 -0
  32. package/schema/dtcg-2025.10/format/group.json +54 -0
  33. package/schema/dtcg-2025.10/format/groupOrToken.json +14 -0
  34. package/schema/dtcg-2025.10/format/token.json +450 -0
  35. package/schema/dtcg-2025.10/format/tokenType.json +22 -0
  36. package/schema/dtcg-2025.10/format/values/border.json +44 -0
  37. package/schema/dtcg-2025.10/format/values/color.json +570 -0
  38. package/schema/dtcg-2025.10/format/values/cubicBezier.json +56 -0
  39. package/schema/dtcg-2025.10/format/values/dimension.json +34 -0
  40. package/schema/dtcg-2025.10/format/values/duration.json +34 -0
  41. package/schema/dtcg-2025.10/format/values/fontFamily.json +33 -0
  42. package/schema/dtcg-2025.10/format/values/fontWeight.json +38 -0
  43. package/schema/dtcg-2025.10/format/values/gradient.json +52 -0
  44. package/schema/dtcg-2025.10/format/values/number.json +7 -0
  45. package/schema/dtcg-2025.10/format/values/shadow.json +102 -0
  46. package/schema/dtcg-2025.10/format/values/strokeStyle.json +63 -0
  47. package/schema/dtcg-2025.10/format/values/transition.json +44 -0
  48. package/schema/dtcg-2025.10/format/values/typography.json +72 -0
  49. package/schema/dtcg-2025.10/format.json +105 -0
  50. package/schema/recipe-v1.schema.json +43 -0
  51. package/schema/style-contract-v1.schema.json +171 -0
  52. package/schema/theme-v1.schema.json +78 -0
  53. package/themes/default/recipes/button.json +87 -0
  54. package/themes/default/recipes/checkbox.json +26 -0
  55. package/themes/default/recipes/column.json +10 -0
  56. package/themes/default/recipes/heading.json +11 -0
  57. package/themes/default/recipes/row.json +10 -0
  58. package/themes/default/recipes/text.json +12 -0
  59. package/themes/default/recipes/textfield.json +37 -0
  60. package/themes/default/theme.json +61 -0
  61. package/themes/default/tokens/base.tokens.json +193 -0
  62. package/themes/default/tokens/contrast.tokens.json +127 -0
  63. package/themes/default/tokens/dark.tokens.json +127 -0
  64. package/themes/default/tokens/light.tokens.json +127 -0
@@ -0,0 +1,171 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://valancex.dev/schema/style-contract-v1.json",
4
+ "title": "The style contract (style-contract-v1)",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "version",
9
+ "parts",
10
+ "interactionStates",
11
+ "semanticStates",
12
+ "variants",
13
+ "conditions",
14
+ "properties"
15
+ ],
16
+ "properties": {
17
+ "version": {
18
+ "const": 1
19
+ },
20
+ "note": {
21
+ "type": "string"
22
+ },
23
+ "parts": {
24
+ "type": "object",
25
+ "minProperties": 1,
26
+ "additionalProperties": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "interactionStates": {
31
+ "type": "object",
32
+ "minProperties": 1,
33
+ "additionalProperties": {
34
+ "type": "string",
35
+ "pattern": "^:[a-z-]+$"
36
+ }
37
+ },
38
+ "interactionMedia": {
39
+ "type": "object",
40
+ "additionalProperties": {
41
+ "type": "string",
42
+ "pattern": "^\\(.+\\)$"
43
+ }
44
+ },
45
+ "semanticStates": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "string"
49
+ },
50
+ "uniqueItems": true
51
+ },
52
+ "variants": {
53
+ "type": "object",
54
+ "additionalProperties": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": [
58
+ "values",
59
+ "default"
60
+ ],
61
+ "properties": {
62
+ "values": {
63
+ "type": "array",
64
+ "items": {
65
+ "type": "string"
66
+ },
67
+ "minItems": 2,
68
+ "uniqueItems": true
69
+ },
70
+ "default": {
71
+ "type": "string"
72
+ }
73
+ }
74
+ }
75
+ },
76
+ "conditions": {
77
+ "type": "object",
78
+ "additionalProperties": {
79
+ "type": "object",
80
+ "additionalProperties": false,
81
+ "required": [
82
+ "values"
83
+ ],
84
+ "properties": {
85
+ "values": {
86
+ "type": "array",
87
+ "items": {
88
+ "type": "string"
89
+ },
90
+ "minItems": 1
91
+ },
92
+ "web": {
93
+ "type": "object",
94
+ "additionalProperties": {
95
+ "type": "string"
96
+ }
97
+ },
98
+ "desktop": {
99
+ "enum": [
100
+ "supported",
101
+ "unsupported"
102
+ ]
103
+ }
104
+ }
105
+ }
106
+ },
107
+ "properties": {
108
+ "type": "object",
109
+ "additionalProperties": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": [
113
+ "accepts",
114
+ "web",
115
+ "desktop"
116
+ ],
117
+ "properties": {
118
+ "accepts": {
119
+ "enum": [
120
+ "color",
121
+ "stroke",
122
+ "dimension",
123
+ "space-list",
124
+ "typography",
125
+ "shadow",
126
+ "opacity",
127
+ "alignment"
128
+ ]
129
+ },
130
+ "web": {
131
+ "type": "array",
132
+ "items": {
133
+ "type": "string"
134
+ },
135
+ "minItems": 1
136
+ },
137
+ "desktop": {
138
+ "enum": [
139
+ "supported",
140
+ "partial",
141
+ "unsupported"
142
+ ]
143
+ }
144
+ }
145
+ }
146
+ },
147
+ "desktopNotes": {
148
+ "type": "object",
149
+ "additionalProperties": {
150
+ "type": "string"
151
+ }
152
+ },
153
+ "modeConditions": {
154
+ "type": "object",
155
+ "additionalProperties": {
156
+ "type": "string",
157
+ "pattern": "^[a-z-]+:[a-z-]+$"
158
+ }
159
+ },
160
+ "desktopStates": {
161
+ "type": "object",
162
+ "additionalProperties": {
163
+ "enum": [
164
+ "supported",
165
+ "partial",
166
+ "unsupported"
167
+ ]
168
+ }
169
+ }
170
+ }
171
+ }
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://valancex.dev/schema/theme-v1.json",
4
+ "title": "A theme (theme-v1): its token documents by mode, its recipes, and the pairs whose contrast it declares",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "version",
9
+ "name",
10
+ "modes",
11
+ "recipes"
12
+ ],
13
+ "properties": {
14
+ "version": {
15
+ "const": 1
16
+ },
17
+ "name": {
18
+ "type": "string",
19
+ "pattern": "^[a-z][a-z0-9-]*$"
20
+ },
21
+ "modes": {
22
+ "type": "object",
23
+ "required": [
24
+ "light"
25
+ ],
26
+ "propertyNames": {
27
+ "pattern": "^[a-z][a-z0-9-]*$"
28
+ },
29
+ "additionalProperties": {
30
+ "type": "string",
31
+ "minLength": 1
32
+ }
33
+ },
34
+ "recipes": {
35
+ "type": "array",
36
+ "items": {
37
+ "type": "string",
38
+ "minLength": 1
39
+ }
40
+ },
41
+ "contrast": {
42
+ "type": "array",
43
+ "items": {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "required": [
47
+ "text",
48
+ "on",
49
+ "min"
50
+ ],
51
+ "properties": {
52
+ "text": {
53
+ "type": "string"
54
+ },
55
+ "on": {
56
+ "type": "string"
57
+ },
58
+ "min": {
59
+ "type": "number",
60
+ "minimum": 1,
61
+ "maximum": 21
62
+ },
63
+ "modes": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "string"
67
+ },
68
+ "minItems": 1
69
+ }
70
+ }
71
+ }
72
+ },
73
+ "base": {
74
+ "type": "string",
75
+ "minLength": 1
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "version": 1,
3
+ "target": {
4
+ "primitive": "button",
5
+ "part": "root"
6
+ },
7
+ "base": {
8
+ "radius": "radius.2",
9
+ "padding": [
10
+ "space.2",
11
+ "space.4"
12
+ ],
13
+ "type": "type.label",
14
+ "min-size": "size.target"
15
+ },
16
+ "variants": {
17
+ "intent": {
18
+ "neutral": {
19
+ "background": "color.surface",
20
+ "text": "color.text",
21
+ "border": {
22
+ "width": "border.1",
23
+ "color": "color.border"
24
+ }
25
+ },
26
+ "primary": {
27
+ "background": "color.accent",
28
+ "text": "color.on-accent",
29
+ "border": {
30
+ "width": "border.1",
31
+ "color": "color.accent"
32
+ }
33
+ },
34
+ "danger": {
35
+ "background": "color.danger",
36
+ "text": "color.on-danger",
37
+ "border": {
38
+ "width": "border.1",
39
+ "color": "color.danger"
40
+ }
41
+ }
42
+ },
43
+ "size": {
44
+ "sm": {
45
+ "padding": [
46
+ "space.1",
47
+ "space.3"
48
+ ]
49
+ },
50
+ "md": {
51
+ "padding": [
52
+ "space.2",
53
+ "space.4"
54
+ ]
55
+ },
56
+ "lg": {
57
+ "padding": [
58
+ "space.3",
59
+ "space.6"
60
+ ]
61
+ }
62
+ }
63
+ },
64
+ "states": {
65
+ "hovered": {
66
+ "elevation": "elevation.1"
67
+ },
68
+ "pressed": {
69
+ "elevation": "none"
70
+ },
71
+ "focus-visible": {
72
+ "outline": {
73
+ "width": "border.2",
74
+ "color": "color.focus",
75
+ "offset": "space.1"
76
+ }
77
+ },
78
+ "disabled": {
79
+ "opacity": 0.5
80
+ }
81
+ },
82
+ "when": {
83
+ "viewport:compact": {
84
+ "min-size": "size.target-touch"
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "version": 1,
3
+ "target": {
4
+ "primitive": "checkbox",
5
+ "part": "root"
6
+ },
7
+ "base": {
8
+ "min-size": "space.5"
9
+ },
10
+ "states": {
11
+ "focus-visible": {
12
+ "outline": {
13
+ "width": "border.2",
14
+ "color": "color.focus",
15
+ "offset": "space.1"
16
+ }
17
+ },
18
+ "invalid": {
19
+ "outline": {
20
+ "width": "border.2",
21
+ "color": "color.danger",
22
+ "offset": "space.1"
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 1,
3
+ "target": {
4
+ "primitive": "column",
5
+ "part": "root"
6
+ },
7
+ "base": {
8
+ "gap": "space.3"
9
+ }
10
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": 1,
3
+ "target": {
4
+ "primitive": "heading",
5
+ "part": "root"
6
+ },
7
+ "base": {
8
+ "text": "color.text",
9
+ "type": "type.heading"
10
+ }
11
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 1,
3
+ "target": {
4
+ "primitive": "row",
5
+ "part": "root"
6
+ },
7
+ "base": {
8
+ "gap": "space.2"
9
+ }
10
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 1,
3
+ "target": {
4
+ "primitive": "text",
5
+ "part": "root"
6
+ },
7
+ "base": {
8
+ "text": "color.text",
9
+ "type": "type.body",
10
+ "min-size": "size.line"
11
+ }
12
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "version": 1,
3
+ "target": {
4
+ "primitive": "textfield",
5
+ "part": "root"
6
+ },
7
+ "base": {
8
+ "background": "color.surface-field",
9
+ "text": "color.text",
10
+ "border": {
11
+ "width": "border.1",
12
+ "color": "color.border"
13
+ },
14
+ "radius": "radius.2",
15
+ "padding": [
16
+ "space.2",
17
+ "space.3"
18
+ ],
19
+ "type": "type.body",
20
+ "min-size": "size.target"
21
+ },
22
+ "states": {
23
+ "focus-visible": {
24
+ "outline": {
25
+ "width": "border.2",
26
+ "color": "color.focus",
27
+ "offset": "space.1"
28
+ }
29
+ },
30
+ "invalid": {
31
+ "border": {
32
+ "width": "border.2",
33
+ "color": "color.danger"
34
+ }
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "version": 1,
3
+ "name": "default",
4
+ "base": "tokens/base.tokens.json",
5
+ "modes": {
6
+ "light": "tokens/light.tokens.json",
7
+ "dark": "tokens/dark.tokens.json",
8
+ "contrast": "tokens/contrast.tokens.json"
9
+ },
10
+ "recipes": [
11
+ "recipes/column.json",
12
+ "recipes/row.json",
13
+ "recipes/heading.json",
14
+ "recipes/text.json",
15
+ "recipes/button.json",
16
+ "recipes/checkbox.json",
17
+ "recipes/textfield.json"
18
+ ],
19
+ "contrast": [
20
+ {
21
+ "text": "color.text",
22
+ "on": "color.surface",
23
+ "min": 4.5
24
+ },
25
+ {
26
+ "text": "color.text-muted",
27
+ "on": "color.surface",
28
+ "min": 4.5
29
+ },
30
+ {
31
+ "text": "color.text",
32
+ "on": "color.surface-field",
33
+ "min": 4.5
34
+ },
35
+ {
36
+ "text": "color.on-accent",
37
+ "on": "color.accent",
38
+ "min": 4.5
39
+ },
40
+ {
41
+ "text": "color.on-danger",
42
+ "on": "color.danger",
43
+ "min": 4.5
44
+ },
45
+ {
46
+ "text": "color.border",
47
+ "on": "color.surface",
48
+ "min": 3
49
+ },
50
+ {
51
+ "text": "color.border",
52
+ "on": "color.surface-field",
53
+ "min": 3
54
+ },
55
+ {
56
+ "text": "color.focus",
57
+ "on": "color.surface",
58
+ "min": 3
59
+ }
60
+ ]
61
+ }
@@ -0,0 +1,193 @@
1
+ {
2
+ "$schema": "https://www.designtokens.org/schemas/2025.10/format.json",
3
+ "$description": "The tokens that do not change with the mode.",
4
+ "space": {
5
+ "$type": "dimension",
6
+ "1": {
7
+ "$value": {
8
+ "value": 0.25,
9
+ "unit": "rem"
10
+ }
11
+ },
12
+ "2": {
13
+ "$value": {
14
+ "value": 0.5,
15
+ "unit": "rem"
16
+ }
17
+ },
18
+ "3": {
19
+ "$value": {
20
+ "value": 0.75,
21
+ "unit": "rem"
22
+ }
23
+ },
24
+ "4": {
25
+ "$value": {
26
+ "value": 1,
27
+ "unit": "rem"
28
+ }
29
+ },
30
+ "5": {
31
+ "$value": {
32
+ "value": 1.5,
33
+ "unit": "rem"
34
+ }
35
+ },
36
+ "6": {
37
+ "$value": {
38
+ "value": 2,
39
+ "unit": "rem"
40
+ }
41
+ }
42
+ },
43
+ "radius": {
44
+ "$type": "dimension",
45
+ "1": {
46
+ "$value": {
47
+ "value": 0.25,
48
+ "unit": "rem"
49
+ }
50
+ },
51
+ "2": {
52
+ "$value": {
53
+ "value": 0.5,
54
+ "unit": "rem"
55
+ }
56
+ },
57
+ "3": {
58
+ "$value": {
59
+ "value": 999,
60
+ "unit": "px"
61
+ }
62
+ }
63
+ },
64
+ "border": {
65
+ "$type": "dimension",
66
+ "1": {
67
+ "$value": {
68
+ "value": 1,
69
+ "unit": "px"
70
+ }
71
+ },
72
+ "2": {
73
+ "$value": {
74
+ "value": 2,
75
+ "unit": "px"
76
+ }
77
+ }
78
+ },
79
+ "size": {
80
+ "$type": "dimension",
81
+ "target": {
82
+ "$value": {
83
+ "value": 2.5,
84
+ "unit": "rem"
85
+ },
86
+ "$description": "The least height of a control a finger or a pointer must hit."
87
+ },
88
+ "target-touch": {
89
+ "$value": {
90
+ "value": 3,
91
+ "unit": "rem"
92
+ },
93
+ "$description": "The least height of a control on a compact screen, where a finger is the pointer."
94
+ },
95
+ "line": {
96
+ "$value": {
97
+ "value": 1.5,
98
+ "unit": "rem"
99
+ },
100
+ "$description": "The height of one line of body text (its line height): the room a message that comes and goes keeps, so what is below it does not move."
101
+ }
102
+ },
103
+ "type": {
104
+ "$type": "typography",
105
+ "body": {
106
+ "$value": {
107
+ "fontFamily": [
108
+ "system-ui",
109
+ "sans-serif"
110
+ ],
111
+ "fontSize": {
112
+ "value": 1,
113
+ "unit": "rem"
114
+ },
115
+ "fontWeight": 400,
116
+ "letterSpacing": {
117
+ "value": 0,
118
+ "unit": "px"
119
+ },
120
+ "lineHeight": 1.5
121
+ }
122
+ },
123
+ "label": {
124
+ "$value": {
125
+ "fontFamily": [
126
+ "system-ui",
127
+ "sans-serif"
128
+ ],
129
+ "fontSize": {
130
+ "value": 0.9375,
131
+ "unit": "rem"
132
+ },
133
+ "fontWeight": 500,
134
+ "letterSpacing": {
135
+ "value": 0,
136
+ "unit": "px"
137
+ },
138
+ "lineHeight": 1.25
139
+ }
140
+ },
141
+ "heading": {
142
+ "$value": {
143
+ "fontFamily": [
144
+ "system-ui",
145
+ "sans-serif"
146
+ ],
147
+ "fontSize": {
148
+ "value": 1.5,
149
+ "unit": "rem"
150
+ },
151
+ "fontWeight": 700,
152
+ "letterSpacing": {
153
+ "value": 0,
154
+ "unit": "px"
155
+ },
156
+ "lineHeight": 1.2
157
+ }
158
+ }
159
+ },
160
+ "elevation": {
161
+ "$type": "shadow",
162
+ "1": {
163
+ "$value": {
164
+ "color": {
165
+ "colorSpace": "srgb",
166
+ "components": [
167
+ 0.0,
168
+ 0.0,
169
+ 0.0
170
+ ],
171
+ "hex": "#000000",
172
+ "alpha": 0.18
173
+ },
174
+ "offsetX": {
175
+ "value": 0,
176
+ "unit": "px"
177
+ },
178
+ "offsetY": {
179
+ "value": 1,
180
+ "unit": "px"
181
+ },
182
+ "blur": {
183
+ "value": 3,
184
+ "unit": "px"
185
+ },
186
+ "spread": {
187
+ "value": 0,
188
+ "unit": "px"
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }