@ggui-ai/project-config 0.15.0 → 0.17.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/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +3 -3
- package/dist/schema.d.ts +2 -2
- package/dist/theme-loader.d.ts +25 -23
- package/dist/theme-loader.d.ts.map +1 -1
- package/dist/theme-loader.js +56 -49
- package/dist/theme.d.ts +451 -100
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +323 -135
- package/package.json +3 -3
package/dist/theme.d.ts
CHANGED
|
@@ -1,82 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `ggui.json#theme` → plain DTCG JSON document.
|
|
2
|
+
* `ggui.json#theme` → plain DTCG JSON document, v2 (ggui#987).
|
|
3
3
|
*
|
|
4
4
|
* The theme file is a plain JSON document matching the Design Tokens
|
|
5
|
-
* Community Group (DTCG) spec
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
5
|
+
* Community Group (DTCG) spec, in the same vocabulary as
|
|
6
|
+
* `@ggui-ai/design`'s canonical {@link DtcgTheme}: the curated registry
|
|
7
|
+
* themes and an authored `theme.json` are the same shape.
|
|
8
8
|
*
|
|
9
|
-
* **
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* the
|
|
9
|
+
* **What is authored, what is derived.** An author states the six
|
|
10
|
+
* layering roles (`ground`/`onGround`, `container`/`onContainer`,
|
|
11
|
+
* `sunken`/`onSunken`), one `500` anchor per family (`primary`,
|
|
12
|
+
* `success`, `warning`, `error`, `info`), the font families and
|
|
13
|
+
* weights, spacing, radii, shadows. Everything else — the ten-stop
|
|
14
|
+
* ramps, every `on*` ink and container, the neutral ladder, outlines,
|
|
15
|
+
* `elevated`, the type scale from the one `font.ramp` — is DERIVED by
|
|
16
|
+
* the one producer (`deriveThemeVariables`), so the retired ladders
|
|
17
|
+
* (`font.size`, `font.lineHeight`, `motion.duration`, `motion.easing`)
|
|
18
|
+
* and `$metadata.fontUrl` are refused, not ignored. Fonts are declared
|
|
19
|
+
* as `typography.faces` (https `src` only); the card installs them.
|
|
17
20
|
*
|
|
18
|
-
* **External-tool
|
|
19
|
-
*
|
|
20
|
-
* the
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* (`$name`, `$description`, `$metadata`) are all OPTIONAL so tools
|
|
24
|
-
* that only emit colors + dimensions still parse cleanly.
|
|
25
|
-
*
|
|
26
|
-
* **BREAKING for old `theme.json` files.** Authors who hand-wrote a
|
|
27
|
-
* `theme.json` against the pre-rc schema must rename:
|
|
28
|
-
*
|
|
29
|
-
* - `typography.fontFamily` → `font.family`
|
|
30
|
-
* - `typography.fontSize` → `font.size`
|
|
31
|
-
* - `typography.fontWeight` → `font.weight`
|
|
32
|
-
* - `typography.lineHeight` → `font.lineHeight`
|
|
33
|
-
* - top-level `radius` → `shape.radius`
|
|
34
|
-
* - top-level `shadow` → `shape.shadow`
|
|
35
|
-
* - top-level `duration` → `motion.duration`
|
|
36
|
-
* - top-level `transition` → `motion.transition`
|
|
37
|
-
*
|
|
38
|
-
* Plus: under `font.family`, `sans` is the only required sub-token
|
|
39
|
-
* (was previously freeform); other family slots (`mono`, …) are
|
|
40
|
-
* optional. The font-family record itself stays open so additional
|
|
41
|
-
* named families parse without a schema change.
|
|
21
|
+
* **External-tool leniency.** `motion`, `accessibility`, `zIndex` and
|
|
22
|
+
* the DTCG metadata fields stay OPTIONAL; {@link normalizeThemeDocument}
|
|
23
|
+
* fills them from the shipped default and flattens the DTCG object
|
|
24
|
+
* forms (structured shadows, transitions, array font stacks) to the CSS
|
|
25
|
+
* strings the producer reads.
|
|
42
26
|
*
|
|
43
27
|
* **Ownership boundary:**
|
|
44
28
|
*
|
|
45
29
|
* - *Where* the theme lives → `ggui.json#theme` (pointer string).
|
|
46
30
|
* - *What* the theme file looks like → this module's schema.
|
|
47
|
-
* - *How*
|
|
48
|
-
* `
|
|
49
|
-
* emit). The duck-typed walker accepts any DTCG-shaped tree, so
|
|
50
|
-
* the new nested groups (`font.size`, `shape.radius`, …) walk
|
|
51
|
-
* into `--ggui-font-size-md`/`--ggui-shape-radius-md` CSS vars
|
|
52
|
-
* without code changes.
|
|
31
|
+
* - *How* the document becomes CSS variables → `@ggui-ai/design`'s
|
|
32
|
+
* `deriveThemeVariables` (the loader calls it for both modes).
|
|
53
33
|
* - *Built-in default* when `theme` is absent → `@ggui-ai/design`'s
|
|
54
|
-
* shipped `lightTheme`.
|
|
55
|
-
*
|
|
56
|
-
* **Extending rules:**
|
|
34
|
+
* shipped `lightTheme` / `darkTheme`.
|
|
57
35
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* values, no build-pipeline fields.
|
|
62
|
-
* 3. Root and per-group objects are strict — unknown keys fail
|
|
63
|
-
* parse. Same discipline as `ggui.json`, `ggui.ui.json`, and
|
|
64
|
-
* `ggui.primitives.json`.
|
|
65
|
-
*
|
|
66
|
-
* **Strictness tradeoff:**
|
|
67
|
-
*
|
|
68
|
-
* Individual DTCG token leaves are validated with a discriminated
|
|
69
|
-
* union over `$type` (color / dimension / fontFamily / fontWeight /
|
|
70
|
-
* shadow / duration / cubicBezier / transition / number). Each
|
|
71
|
-
* variant validates its `$value` shape. `$description` is accepted
|
|
72
|
-
* everywhere as a free-form docstring. Token leaves under newer
|
|
73
|
-
* groups (`accessibility`, `zIndex`) accept a slightly
|
|
74
|
-
* wider token vocabulary because external tools sometimes encode
|
|
75
|
-
* scalar/array values with permissive `$type` strings (`string`,
|
|
76
|
-
* `array`, …); the schema accepts those without enumerating every
|
|
77
|
-
* possible spelling.
|
|
36
|
+
* **Extending rules:** additive only within `schema: '1'`; framework-
|
|
37
|
+
* and host-neutral; root and per-group objects are strict — unknown
|
|
38
|
+
* keys fail parse, the same discipline as `ggui.json`.
|
|
78
39
|
*/
|
|
79
40
|
import { z } from 'zod';
|
|
41
|
+
import type { DtcgTheme } from '@ggui-ai/design/themes';
|
|
80
42
|
/**
|
|
81
43
|
* Plain DTCG theme document v1. Required groups (`color`, `font`,
|
|
82
44
|
* `spacing`, `shape`) map 1:1 to `@ggui-ai/design`'s
|
|
@@ -96,25 +58,188 @@ import { z } from 'zod';
|
|
|
96
58
|
* allow-listed (DTCG metadata); anything else is a typo. Additive
|
|
97
59
|
* slices add new fields here under `schema: '1'`.
|
|
98
60
|
*/
|
|
99
|
-
export declare const
|
|
61
|
+
export declare const ThemeDocumentV2: z.ZodObject<{
|
|
100
62
|
$schema: z.ZodOptional<z.ZodString>;
|
|
101
63
|
$version: z.ZodOptional<z.ZodString>;
|
|
102
64
|
$name: z.ZodOptional<z.ZodString>;
|
|
103
65
|
$description: z.ZodOptional<z.ZodString>;
|
|
104
66
|
$metadata: z.ZodOptional<z.ZodObject<{
|
|
105
67
|
font: z.ZodOptional<z.ZodString>;
|
|
106
|
-
fontUrl: z.ZodOptional<z.ZodString>;
|
|
107
68
|
philosophy: z.ZodOptional<z.ZodString>;
|
|
69
|
+
frameless: z.ZodOptional<z.ZodBoolean>;
|
|
108
70
|
}, z.core.$strict>>;
|
|
109
|
-
color: z.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
71
|
+
color: z.ZodObject<{
|
|
72
|
+
primary: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
73
|
+
$type: z.ZodLiteral<"color">;
|
|
74
|
+
$value: z.ZodString;
|
|
75
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, z.core.$strict>>;
|
|
77
|
+
neutral: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
78
|
+
$type: z.ZodLiteral<"color">;
|
|
79
|
+
$value: z.ZodString;
|
|
80
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strict>>>;
|
|
82
|
+
success: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
83
|
+
$type: z.ZodLiteral<"color">;
|
|
84
|
+
$value: z.ZodString;
|
|
85
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, z.core.$strict>>;
|
|
87
|
+
warning: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
88
|
+
$type: z.ZodLiteral<"color">;
|
|
89
|
+
$value: z.ZodString;
|
|
90
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$strict>>;
|
|
92
|
+
error: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
93
|
+
$type: z.ZodLiteral<"color">;
|
|
94
|
+
$value: z.ZodString;
|
|
95
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strict>>;
|
|
97
|
+
info: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
98
|
+
$type: z.ZodLiteral<"color">;
|
|
99
|
+
$value: z.ZodString;
|
|
100
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, z.core.$strict>>;
|
|
102
|
+
ground: z.ZodObject<{
|
|
103
|
+
$type: z.ZodLiteral<"color">;
|
|
104
|
+
$value: z.ZodString;
|
|
105
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
onGround: z.ZodObject<{
|
|
108
|
+
$type: z.ZodLiteral<"color">;
|
|
109
|
+
$value: z.ZodString;
|
|
110
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strict>;
|
|
112
|
+
container: z.ZodObject<{
|
|
113
|
+
$type: z.ZodLiteral<"color">;
|
|
114
|
+
$value: z.ZodString;
|
|
115
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
onContainer: z.ZodObject<{
|
|
118
|
+
$type: z.ZodLiteral<"color">;
|
|
119
|
+
$value: z.ZodString;
|
|
120
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strict>;
|
|
122
|
+
sunken: z.ZodObject<{
|
|
123
|
+
$type: z.ZodLiteral<"color">;
|
|
124
|
+
$value: z.ZodString;
|
|
125
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, z.core.$strict>;
|
|
127
|
+
onSunken: z.ZodObject<{
|
|
128
|
+
$type: z.ZodLiteral<"color">;
|
|
129
|
+
$value: z.ZodString;
|
|
130
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
link: z.ZodOptional<z.ZodObject<{
|
|
133
|
+
$type: z.ZodLiteral<"color">;
|
|
134
|
+
$value: z.ZodString;
|
|
135
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, z.core.$strict>>;
|
|
137
|
+
outline: z.ZodOptional<z.ZodObject<{
|
|
138
|
+
$type: z.ZodLiteral<"color">;
|
|
139
|
+
$value: z.ZodString;
|
|
140
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}, z.core.$strict>>;
|
|
142
|
+
outlineVariant: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
$type: z.ZodLiteral<"color">;
|
|
144
|
+
$value: z.ZodString;
|
|
145
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$strict>>;
|
|
147
|
+
onPrimary: z.ZodOptional<z.ZodObject<{
|
|
148
|
+
$type: z.ZodLiteral<"color">;
|
|
149
|
+
$value: z.ZodString;
|
|
150
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}, z.core.$strict>>;
|
|
152
|
+
primaryContainer: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
$type: z.ZodLiteral<"color">;
|
|
154
|
+
$value: z.ZodString;
|
|
155
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
156
|
+
}, z.core.$strict>>;
|
|
157
|
+
onPrimaryContainer: z.ZodOptional<z.ZodObject<{
|
|
158
|
+
$type: z.ZodLiteral<"color">;
|
|
159
|
+
$value: z.ZodString;
|
|
160
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
161
|
+
}, z.core.$strict>>;
|
|
162
|
+
onSuccess: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
$type: z.ZodLiteral<"color">;
|
|
164
|
+
$value: z.ZodString;
|
|
165
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
166
|
+
}, z.core.$strict>>;
|
|
167
|
+
successContainer: z.ZodOptional<z.ZodObject<{
|
|
168
|
+
$type: z.ZodLiteral<"color">;
|
|
169
|
+
$value: z.ZodString;
|
|
170
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
171
|
+
}, z.core.$strict>>;
|
|
172
|
+
onSuccessContainer: z.ZodOptional<z.ZodObject<{
|
|
173
|
+
$type: z.ZodLiteral<"color">;
|
|
174
|
+
$value: z.ZodString;
|
|
175
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
176
|
+
}, z.core.$strict>>;
|
|
177
|
+
onWarning: z.ZodOptional<z.ZodObject<{
|
|
178
|
+
$type: z.ZodLiteral<"color">;
|
|
179
|
+
$value: z.ZodString;
|
|
180
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
181
|
+
}, z.core.$strict>>;
|
|
182
|
+
warningContainer: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
$type: z.ZodLiteral<"color">;
|
|
184
|
+
$value: z.ZodString;
|
|
185
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
186
|
+
}, z.core.$strict>>;
|
|
187
|
+
onWarningContainer: z.ZodOptional<z.ZodObject<{
|
|
188
|
+
$type: z.ZodLiteral<"color">;
|
|
189
|
+
$value: z.ZodString;
|
|
190
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
191
|
+
}, z.core.$strict>>;
|
|
192
|
+
onError: z.ZodOptional<z.ZodObject<{
|
|
193
|
+
$type: z.ZodLiteral<"color">;
|
|
194
|
+
$value: z.ZodString;
|
|
195
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
196
|
+
}, z.core.$strict>>;
|
|
197
|
+
errorContainer: z.ZodOptional<z.ZodObject<{
|
|
198
|
+
$type: z.ZodLiteral<"color">;
|
|
199
|
+
$value: z.ZodString;
|
|
200
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
201
|
+
}, z.core.$strict>>;
|
|
202
|
+
onErrorContainer: z.ZodOptional<z.ZodObject<{
|
|
203
|
+
$type: z.ZodLiteral<"color">;
|
|
204
|
+
$value: z.ZodString;
|
|
205
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, z.core.$strict>>;
|
|
207
|
+
onInfo: z.ZodOptional<z.ZodObject<{
|
|
208
|
+
$type: z.ZodLiteral<"color">;
|
|
209
|
+
$value: z.ZodString;
|
|
210
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
211
|
+
}, z.core.$strict>>;
|
|
212
|
+
infoContainer: z.ZodOptional<z.ZodObject<{
|
|
213
|
+
$type: z.ZodLiteral<"color">;
|
|
214
|
+
$value: z.ZodString;
|
|
215
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
216
|
+
}, z.core.$strict>>;
|
|
217
|
+
onInfoContainer: z.ZodOptional<z.ZodObject<{
|
|
218
|
+
$type: z.ZodLiteral<"color">;
|
|
219
|
+
$value: z.ZodString;
|
|
220
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
221
|
+
}, z.core.$strict>>;
|
|
222
|
+
tertiary: z.ZodOptional<z.ZodObject<{
|
|
223
|
+
$type: z.ZodLiteral<"color">;
|
|
224
|
+
$value: z.ZodString;
|
|
225
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
226
|
+
}, z.core.$strict>>;
|
|
227
|
+
onTertiary: z.ZodOptional<z.ZodObject<{
|
|
228
|
+
$type: z.ZodLiteral<"color">;
|
|
229
|
+
$value: z.ZodString;
|
|
230
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
231
|
+
}, z.core.$strict>>;
|
|
232
|
+
tertiaryContainer: z.ZodOptional<z.ZodObject<{
|
|
233
|
+
$type: z.ZodLiteral<"color">;
|
|
234
|
+
$value: z.ZodString;
|
|
235
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
236
|
+
}, z.core.$strict>>;
|
|
237
|
+
onTertiaryContainer: z.ZodOptional<z.ZodObject<{
|
|
238
|
+
$type: z.ZodLiteral<"color">;
|
|
239
|
+
$value: z.ZodString;
|
|
240
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
241
|
+
}, z.core.$strict>>;
|
|
242
|
+
}, z.core.$strict>;
|
|
118
243
|
spacing: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
119
244
|
$type: z.ZodLiteral<"dimension">;
|
|
120
245
|
$value: z.ZodString;
|
|
@@ -132,26 +257,45 @@ export declare const ThemeDocumentV1: z.ZodObject<{
|
|
|
132
257
|
$description: z.ZodOptional<z.ZodString>;
|
|
133
258
|
}, z.core.$strict>;
|
|
134
259
|
}, z.core.$strip>>;
|
|
135
|
-
size: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
136
|
-
$type: z.ZodLiteral<"dimension">;
|
|
137
|
-
$value: z.ZodString;
|
|
138
|
-
$description: z.ZodOptional<z.ZodString>;
|
|
139
|
-
}, z.core.$strict>>;
|
|
140
260
|
weight: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
141
261
|
$type: z.ZodLiteral<"fontWeight">;
|
|
142
262
|
$value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
143
263
|
$description: z.ZodOptional<z.ZodString>;
|
|
144
264
|
}, z.core.$strict>>;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
265
|
+
letterSpacing: z.ZodOptional<z.ZodObject<{
|
|
266
|
+
body: z.ZodOptional<z.ZodObject<{
|
|
267
|
+
$type: z.ZodLiteral<"dimension">;
|
|
268
|
+
$value: z.ZodString;
|
|
269
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
270
|
+
}, z.core.$strict>>;
|
|
271
|
+
heading: z.ZodOptional<z.ZodObject<{
|
|
272
|
+
$type: z.ZodLiteral<"dimension">;
|
|
273
|
+
$value: z.ZodString;
|
|
274
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
275
|
+
}, z.core.$strict>>;
|
|
276
|
+
}, z.core.$strict>>;
|
|
277
|
+
ramp: z.ZodOptional<z.ZodObject<{
|
|
278
|
+
base: z.ZodObject<{
|
|
279
|
+
$type: z.ZodLiteral<"dimension">;
|
|
280
|
+
$value: z.ZodString;
|
|
281
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
282
|
+
}, z.core.$strict>;
|
|
283
|
+
ratio: z.ZodObject<{
|
|
284
|
+
$type: z.ZodLiteral<"number">;
|
|
285
|
+
$value: z.ZodNumber;
|
|
286
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
287
|
+
}, z.core.$strict>;
|
|
288
|
+
}, z.core.$strict>>;
|
|
154
289
|
}, z.core.$strict>;
|
|
290
|
+
typography: z.ZodOptional<z.ZodObject<{
|
|
291
|
+
faces: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
292
|
+
family: z.ZodString;
|
|
293
|
+
src: z.ZodString;
|
|
294
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
295
|
+
style: z.ZodOptional<z.ZodString>;
|
|
296
|
+
display: z.ZodOptional<z.ZodString>;
|
|
297
|
+
}, z.core.$strict>>>;
|
|
298
|
+
}, z.core.$strict>>;
|
|
155
299
|
shape: z.ZodObject<{
|
|
156
300
|
radius: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
157
301
|
$type: z.ZodLiteral<"dimension">;
|
|
@@ -169,18 +313,149 @@ export declare const ThemeDocumentV1: z.ZodObject<{
|
|
|
169
313
|
}, z.core.$strict>]>;
|
|
170
314
|
$description: z.ZodOptional<z.ZodString>;
|
|
171
315
|
}, z.core.$strict>>;
|
|
316
|
+
border: z.ZodOptional<z.ZodObject<{
|
|
317
|
+
width: z.ZodOptional<z.ZodObject<{
|
|
318
|
+
$type: z.ZodLiteral<"dimension">;
|
|
319
|
+
$value: z.ZodString;
|
|
320
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
321
|
+
}, z.core.$strict>>;
|
|
322
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
323
|
+
$type: z.ZodString;
|
|
324
|
+
$value: z.ZodString;
|
|
325
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
326
|
+
}, z.core.$strict>>;
|
|
327
|
+
}, z.core.$strict>>;
|
|
172
328
|
}, z.core.$strict>;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
329
|
+
typeScale: z.ZodOptional<z.ZodObject<{
|
|
330
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
331
|
+
size: z.ZodObject<{
|
|
332
|
+
$type: z.ZodLiteral<"dimension">;
|
|
333
|
+
$value: z.ZodString;
|
|
334
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
335
|
+
}, z.core.$strict>;
|
|
336
|
+
weight: z.ZodOptional<z.ZodObject<{
|
|
337
|
+
$type: z.ZodLiteral<"fontWeight">;
|
|
338
|
+
$value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
339
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
340
|
+
}, z.core.$strict>>;
|
|
341
|
+
tracking: z.ZodOptional<z.ZodObject<{
|
|
342
|
+
$type: z.ZodLiteral<"dimension">;
|
|
343
|
+
$value: z.ZodString;
|
|
344
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
345
|
+
}, z.core.$strict>>;
|
|
346
|
+
leading: z.ZodOptional<z.ZodObject<{
|
|
347
|
+
$type: z.ZodLiteral<"number">;
|
|
348
|
+
$value: z.ZodNumber;
|
|
349
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
350
|
+
}, z.core.$strict>>;
|
|
351
|
+
}, z.core.$strict>>;
|
|
352
|
+
h1: z.ZodOptional<z.ZodObject<{
|
|
353
|
+
size: z.ZodObject<{
|
|
354
|
+
$type: z.ZodLiteral<"dimension">;
|
|
355
|
+
$value: z.ZodString;
|
|
356
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
357
|
+
}, z.core.$strict>;
|
|
358
|
+
weight: z.ZodOptional<z.ZodObject<{
|
|
359
|
+
$type: z.ZodLiteral<"fontWeight">;
|
|
360
|
+
$value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
361
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
362
|
+
}, z.core.$strict>>;
|
|
363
|
+
tracking: z.ZodOptional<z.ZodObject<{
|
|
364
|
+
$type: z.ZodLiteral<"dimension">;
|
|
365
|
+
$value: z.ZodString;
|
|
366
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
367
|
+
}, z.core.$strict>>;
|
|
368
|
+
leading: z.ZodOptional<z.ZodObject<{
|
|
369
|
+
$type: z.ZodLiteral<"number">;
|
|
370
|
+
$value: z.ZodNumber;
|
|
371
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
372
|
+
}, z.core.$strict>>;
|
|
373
|
+
}, z.core.$strict>>;
|
|
374
|
+
h2: z.ZodOptional<z.ZodObject<{
|
|
375
|
+
size: z.ZodObject<{
|
|
376
|
+
$type: z.ZodLiteral<"dimension">;
|
|
377
|
+
$value: z.ZodString;
|
|
378
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
379
|
+
}, z.core.$strict>;
|
|
380
|
+
weight: z.ZodOptional<z.ZodObject<{
|
|
381
|
+
$type: z.ZodLiteral<"fontWeight">;
|
|
382
|
+
$value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
383
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
384
|
+
}, z.core.$strict>>;
|
|
385
|
+
tracking: z.ZodOptional<z.ZodObject<{
|
|
386
|
+
$type: z.ZodLiteral<"dimension">;
|
|
387
|
+
$value: z.ZodString;
|
|
388
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
389
|
+
}, z.core.$strict>>;
|
|
390
|
+
leading: z.ZodOptional<z.ZodObject<{
|
|
391
|
+
$type: z.ZodLiteral<"number">;
|
|
392
|
+
$value: z.ZodNumber;
|
|
393
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
394
|
+
}, z.core.$strict>>;
|
|
395
|
+
}, z.core.$strict>>;
|
|
396
|
+
body: z.ZodOptional<z.ZodObject<{
|
|
397
|
+
size: z.ZodObject<{
|
|
398
|
+
$type: z.ZodLiteral<"dimension">;
|
|
399
|
+
$value: z.ZodString;
|
|
400
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
401
|
+
}, z.core.$strict>;
|
|
402
|
+
weight: z.ZodOptional<z.ZodObject<{
|
|
403
|
+
$type: z.ZodLiteral<"fontWeight">;
|
|
404
|
+
$value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
405
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
406
|
+
}, z.core.$strict>>;
|
|
407
|
+
tracking: z.ZodOptional<z.ZodObject<{
|
|
408
|
+
$type: z.ZodLiteral<"dimension">;
|
|
409
|
+
$value: z.ZodString;
|
|
410
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
411
|
+
}, z.core.$strict>>;
|
|
412
|
+
leading: z.ZodOptional<z.ZodObject<{
|
|
413
|
+
$type: z.ZodLiteral<"number">;
|
|
414
|
+
$value: z.ZodNumber;
|
|
415
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
416
|
+
}, z.core.$strict>>;
|
|
417
|
+
}, z.core.$strict>>;
|
|
418
|
+
label: z.ZodOptional<z.ZodObject<{
|
|
419
|
+
size: z.ZodObject<{
|
|
420
|
+
$type: z.ZodLiteral<"dimension">;
|
|
421
|
+
$value: z.ZodString;
|
|
422
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
423
|
+
}, z.core.$strict>;
|
|
424
|
+
weight: z.ZodOptional<z.ZodObject<{
|
|
425
|
+
$type: z.ZodLiteral<"fontWeight">;
|
|
426
|
+
$value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
427
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
428
|
+
}, z.core.$strict>>;
|
|
429
|
+
tracking: z.ZodOptional<z.ZodObject<{
|
|
430
|
+
$type: z.ZodLiteral<"dimension">;
|
|
431
|
+
$value: z.ZodString;
|
|
432
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
433
|
+
}, z.core.$strict>>;
|
|
434
|
+
leading: z.ZodOptional<z.ZodObject<{
|
|
435
|
+
$type: z.ZodLiteral<"number">;
|
|
436
|
+
$value: z.ZodNumber;
|
|
437
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
438
|
+
}, z.core.$strict>>;
|
|
439
|
+
}, z.core.$strict>>;
|
|
440
|
+
}, z.core.$strict>>;
|
|
441
|
+
rhythm: z.ZodOptional<z.ZodObject<{
|
|
442
|
+
base: z.ZodObject<{
|
|
443
|
+
$type: z.ZodLiteral<"dimension">;
|
|
444
|
+
$value: z.ZodString;
|
|
445
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
446
|
+
}, z.core.$strict>;
|
|
447
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
448
|
+
$type: z.ZodLiteral<"dimension">;
|
|
176
449
|
$value: z.ZodString;
|
|
177
450
|
$description: z.ZodOptional<z.ZodString>;
|
|
178
451
|
}, z.core.$strict>>;
|
|
179
|
-
|
|
180
|
-
$type: z.ZodLiteral<"
|
|
452
|
+
inset: z.ZodOptional<z.ZodObject<{
|
|
453
|
+
$type: z.ZodLiteral<"dimension">;
|
|
181
454
|
$value: z.ZodString;
|
|
182
455
|
$description: z.ZodOptional<z.ZodString>;
|
|
183
|
-
}, z.core.$strict
|
|
456
|
+
}, z.core.$strict>>;
|
|
457
|
+
}, z.core.$strict>>;
|
|
458
|
+
motion: z.ZodOptional<z.ZodObject<{
|
|
184
459
|
transition: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
185
460
|
$type: z.ZodLiteral<"transition">;
|
|
186
461
|
$value: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
@@ -192,9 +467,67 @@ export declare const ThemeDocumentV1: z.ZodObject<{
|
|
|
192
467
|
}, z.core.$strict>>;
|
|
193
468
|
keyframes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
194
469
|
$type: z.ZodString;
|
|
195
|
-
$value: z.
|
|
470
|
+
$value: z.ZodString;
|
|
196
471
|
$description: z.ZodOptional<z.ZodString>;
|
|
197
472
|
}, z.core.$strict>>>;
|
|
473
|
+
duration: z.ZodOptional<z.ZodObject<{
|
|
474
|
+
fast: z.ZodOptional<z.ZodObject<{
|
|
475
|
+
$type: z.ZodLiteral<"duration">;
|
|
476
|
+
$value: z.ZodString;
|
|
477
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
478
|
+
}, z.core.$strict>>;
|
|
479
|
+
base: z.ZodOptional<z.ZodObject<{
|
|
480
|
+
$type: z.ZodLiteral<"duration">;
|
|
481
|
+
$value: z.ZodString;
|
|
482
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
483
|
+
}, z.core.$strict>>;
|
|
484
|
+
slow: z.ZodOptional<z.ZodObject<{
|
|
485
|
+
$type: z.ZodLiteral<"duration">;
|
|
486
|
+
$value: z.ZodString;
|
|
487
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
488
|
+
}, z.core.$strict>>;
|
|
489
|
+
}, z.core.$strict>>;
|
|
490
|
+
easing: z.ZodOptional<z.ZodObject<{
|
|
491
|
+
standard: z.ZodOptional<z.ZodObject<{
|
|
492
|
+
$type: z.ZodString;
|
|
493
|
+
$value: z.ZodString;
|
|
494
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
495
|
+
}, z.core.$strict>>;
|
|
496
|
+
emphasized: z.ZodOptional<z.ZodObject<{
|
|
497
|
+
$type: z.ZodString;
|
|
498
|
+
$value: z.ZodString;
|
|
499
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
500
|
+
}, z.core.$strict>>;
|
|
501
|
+
exit: z.ZodOptional<z.ZodObject<{
|
|
502
|
+
$type: z.ZodString;
|
|
503
|
+
$value: z.ZodString;
|
|
504
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
505
|
+
}, z.core.$strict>>;
|
|
506
|
+
}, z.core.$strict>>;
|
|
507
|
+
reduce: z.ZodOptional<z.ZodEnum<{
|
|
508
|
+
ignore: "ignore";
|
|
509
|
+
respect: "respect";
|
|
510
|
+
}>>;
|
|
511
|
+
}, z.core.$strict>>;
|
|
512
|
+
scrim: z.ZodOptional<z.ZodObject<{
|
|
513
|
+
tone: z.ZodUnion<readonly [z.ZodEnum<{
|
|
514
|
+
light: "light";
|
|
515
|
+
dark: "dark";
|
|
516
|
+
}>, z.ZodObject<{
|
|
517
|
+
$type: z.ZodLiteral<"color">;
|
|
518
|
+
$value: z.ZodString;
|
|
519
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
520
|
+
}, z.core.$strict>]>;
|
|
521
|
+
opacity: z.ZodObject<{
|
|
522
|
+
$type: z.ZodLiteral<"number">;
|
|
523
|
+
$value: z.ZodNumber;
|
|
524
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
525
|
+
}, z.core.$strict>;
|
|
526
|
+
blur: z.ZodObject<{
|
|
527
|
+
$type: z.ZodLiteral<"dimension">;
|
|
528
|
+
$value: z.ZodString;
|
|
529
|
+
$description: z.ZodOptional<z.ZodString>;
|
|
530
|
+
}, z.core.$strict>;
|
|
198
531
|
}, z.core.$strict>>;
|
|
199
532
|
accessibility: z.ZodOptional<z.ZodObject<{
|
|
200
533
|
focusRing: z.ZodOptional<z.ZodObject<{
|
|
@@ -251,9 +584,9 @@ export declare const ThemeDocumentV1: z.ZodObject<{
|
|
|
251
584
|
}, z.core.$strict>>>;
|
|
252
585
|
}, z.core.$strict>;
|
|
253
586
|
/** Static TypeScript type derived from the v1 schema. */
|
|
254
|
-
export type
|
|
587
|
+
export type ThemeDocumentV2 = z.infer<typeof ThemeDocumentV2>;
|
|
255
588
|
/** Canonical type alias used everywhere else. */
|
|
256
|
-
export type ThemeDocument =
|
|
589
|
+
export type ThemeDocument = ThemeDocumentV2;
|
|
257
590
|
/**
|
|
258
591
|
* Parse a raw JSON value into a validated {@link ThemeDocument}.
|
|
259
592
|
* Throws a `ZodError` with human-readable issues on invalid input.
|
|
@@ -264,5 +597,23 @@ export declare function parseThemeDocument(raw: unknown): ThemeDocument;
|
|
|
264
597
|
* Prefer this inside CLI tooling where you want to render the issue
|
|
265
598
|
* list without try/catch.
|
|
266
599
|
*/
|
|
267
|
-
export declare function safeParseThemeDocument(raw: unknown): ReturnType<typeof
|
|
600
|
+
export declare function safeParseThemeDocument(raw: unknown): ReturnType<typeof ThemeDocumentV2.safeParse>;
|
|
601
|
+
/**
|
|
602
|
+
* Turn a parsed document into the EXACT {@link DtcgTheme} the one
|
|
603
|
+
* producer (`deriveThemeVariables`) consumes:
|
|
604
|
+
*
|
|
605
|
+
* - names the document (`$name` ⇒ `'custom'`, `$description` ⇒ `''`);
|
|
606
|
+
* - drops the DTCG envelope fields the producer does not read
|
|
607
|
+
* (`$schema`, `$version`);
|
|
608
|
+
* - flattens the DTCG object forms to the CSS strings the producer
|
|
609
|
+
* reads: array font stacks → `'Inter, system-ui'`, numeric weights →
|
|
610
|
+
* `'400'`, structured shadows → `'0 1px 2px 0 …'`, structured
|
|
611
|
+
* transitions → `'<property ?? all> <duration> <timingFunction>'`;
|
|
612
|
+
* - fills the optional groups (`motion`, `accessibility`, `zIndex` and
|
|
613
|
+
* their sub-records) from the shipped default, so an external tool's
|
|
614
|
+
* colours-and-dimensions export still derives every consumed token.
|
|
615
|
+
*
|
|
616
|
+
* The authored roles, anchors and faces pass through verbatim.
|
|
617
|
+
*/
|
|
618
|
+
export declare function normalizeThemeDocument(doc: ThemeDocument): DtcgTheme;
|
|
268
619
|
//# sourceMappingURL=theme.d.ts.map
|
package/dist/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,wBAAwB,CAAC;AAqYnE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8D1B,CAAC;AAEH,yDAAyD;AACzD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,iDAAiD;AACjD,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC;AAE5C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,OAAO,GACX,UAAU,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,CAE9C;AAYD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,aAAa,GAAG,SAAS,CAmDpE"}
|