@design-token-kit/core 0.1.1

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 (28) hide show
  1. package/LICENSE +159 -0
  2. package/README.md +57 -0
  3. package/lib/index.d.ts +608 -0
  4. package/lib/index.js +4737 -0
  5. package/lib/schemas/2025.10/format/group.json +55 -0
  6. package/lib/schemas/2025.10/format/groupOrToken.json +15 -0
  7. package/lib/schemas/2025.10/format/token.json +425 -0
  8. package/lib/schemas/2025.10/format/tokenType.json +23 -0
  9. package/lib/schemas/2025.10/format/values/border.json +45 -0
  10. package/lib/schemas/2025.10/format/values/color.json +515 -0
  11. package/lib/schemas/2025.10/format/values/cubicBezier.json +57 -0
  12. package/lib/schemas/2025.10/format/values/dimension.json +35 -0
  13. package/lib/schemas/2025.10/format/values/duration.json +35 -0
  14. package/lib/schemas/2025.10/format/values/fontFamily.json +34 -0
  15. package/lib/schemas/2025.10/format/values/fontWeight.json +39 -0
  16. package/lib/schemas/2025.10/format/values/gradient.json +53 -0
  17. package/lib/schemas/2025.10/format/values/number.json +8 -0
  18. package/lib/schemas/2025.10/format/values/shadow.json +103 -0
  19. package/lib/schemas/2025.10/format/values/strokeStyle.json +64 -0
  20. package/lib/schemas/2025.10/format/values/transition.json +45 -0
  21. package/lib/schemas/2025.10/format/values/typography.json +73 -0
  22. package/lib/schemas/2025.10/format.json +106 -0
  23. package/lib/schemas/2025.10/resolver/modifier.json +85 -0
  24. package/lib/schemas/2025.10/resolver/resolutionOrder.json +117 -0
  25. package/lib/schemas/2025.10/resolver/set.json +71 -0
  26. package/lib/schemas/2025.10/resolver.json +62 -0
  27. package/lib/schemas/hrdt-tokens.json +533 -0
  28. package/package.json +60 -0
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://www.designtokens.org/schemas/2025.10/format/group.json",
4
+ "title": "Group",
5
+ "description": "A group in the DTCG specification",
6
+ "type": "object",
7
+ "properties": {
8
+ "$type": {
9
+ "$ref": "tokenType.json",
10
+ "description": "The type for tokens in this group (inherited by nested tokens unless overridden)"
11
+ },
12
+ "$description": {
13
+ "type": "string",
14
+ "description": "A plain text description of the group"
15
+ },
16
+ "$extensions": {
17
+ "type": "object",
18
+ "description": "Vendor-specific extensions"
19
+ },
20
+ "$extends": {
21
+ "oneOf": [
22
+ {
23
+ "$ref": "../format.json#/definitions/curlyBraceReference"
24
+ },
25
+ {
26
+ "$ref": "../format.json#/definitions/jsonPointerReference"
27
+ }
28
+ ],
29
+ "description": "Reference to another group to inherit tokens and properties from"
30
+ },
31
+ "$deprecated": {
32
+ "oneOf": [
33
+ {
34
+ "type": "boolean"
35
+ },
36
+ {
37
+ "type": "string"
38
+ }
39
+ ],
40
+ "description": "Whether this group is deprecated"
41
+ },
42
+ "$root": {
43
+ "description": "Root token for this group. The $root token provides a base value for the group while allowing for variants or extensions.",
44
+ "$ref": "token.json"
45
+ }
46
+ },
47
+ "patternProperties": {
48
+ "^[^${}.][^{}.]*$": {
49
+ "description": "Nested groups and tokens (see ../format.json#/definitions/tokenOrGroupName for pattern definition)",
50
+ "$ref": "groupOrToken.json"
51
+ }
52
+ },
53
+ "additionalProperties": false
54
+ }
55
+
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://www.designtokens.org/schemas/2025.10/format/groupOrToken.json",
4
+ "title": "Group or Token",
5
+ "description": "A group or a token in the DTCG specification. A token is identified by the presence of a $value property, while a group is any object without a $value property.",
6
+ "oneOf": [
7
+ {
8
+ "$ref": "group.json"
9
+ },
10
+ {
11
+ "$ref": "token.json"
12
+ }
13
+ ]
14
+ }
15
+
@@ -0,0 +1,425 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://www.designtokens.org/schemas/2025.10/format/token.json",
4
+ "title": "Token",
5
+ "description": "A token in the DTCG specification",
6
+ "type": "object",
7
+ "properties": {
8
+ "$value": {
9
+ "description": "The token's value - can be a direct value or a reference to another token using curly brace syntax (e.g., '{token.name}'). Mutually exclusive with $ref."
10
+ },
11
+ "$type": {
12
+ "$ref": "tokenType.json"
13
+ },
14
+ "$ref": {
15
+ "$ref": "../format.json#/definitions/jsonPointerReference",
16
+ "description": "JSON Pointer reference (RFC 6901) for advanced referencing. Use this instead of $value for property-level references. Examples: '#/colors/blue/$value' or '#/colors/blue/$value/components/0'. Mutually exclusive with $value."
17
+ },
18
+ "$description": {
19
+ "type": "string",
20
+ "description": "A plain text description of the token"
21
+ },
22
+ "$extensions": {
23
+ "type": "object",
24
+ "description": "Vendor-specific extensions"
25
+ },
26
+ "$deprecated": {
27
+ "oneOf": [
28
+ {
29
+ "type": "boolean"
30
+ },
31
+ {
32
+ "type": "string"
33
+ }
34
+ ],
35
+ "description": "Whether this token is deprecated"
36
+ }
37
+ },
38
+ "additionalProperties": false,
39
+ "allOf": [
40
+ {
41
+ "description": "Tokens cannot define both $value and $ref; they must choose exactly one form of reference or direct value.",
42
+ "if": {
43
+ "required": ["$value"],
44
+ "properties": {
45
+ "$value": true
46
+ }
47
+ },
48
+ "then": {
49
+ "not": {
50
+ "required": ["$ref"],
51
+ "properties": {
52
+ "$ref": true
53
+ }
54
+ }
55
+ },
56
+ "else": {
57
+ "required": ["$ref"],
58
+ "properties": {
59
+ "$ref": true
60
+ }
61
+ }
62
+ },
63
+ {
64
+ "if": {
65
+ "required": ["$type"],
66
+ "properties": {
67
+ "$type": { "const": "color" }
68
+ }
69
+ },
70
+ "then": {
71
+ "properties": {
72
+ "$value": {
73
+ "oneOf": [
74
+ {
75
+ "$ref": "values/color.json"
76
+ },
77
+ {
78
+ "$ref": "../format.json#/definitions/tokenValueReference"
79
+ }
80
+ ]
81
+ }
82
+ }
83
+ }
84
+ },
85
+ {
86
+ "if": {
87
+ "required": ["$type"],
88
+ "properties": {
89
+ "$type": { "const": "dimension" }
90
+ }
91
+ },
92
+ "then": {
93
+ "properties": {
94
+ "$value": {
95
+ "oneOf": [
96
+ {
97
+ "$ref": "values/dimension.json"
98
+ },
99
+ {
100
+ "$ref": "../format.json#/definitions/tokenValueReference"
101
+ }
102
+ ]
103
+ }
104
+ }
105
+ }
106
+ },
107
+ {
108
+ "if": {
109
+ "required": ["$type"],
110
+ "properties": {
111
+ "$type": { "const": "fontFamily" }
112
+ }
113
+ },
114
+ "then": {
115
+ "properties": {
116
+ "$value": {
117
+ "oneOf": [
118
+ {
119
+ "$ref": "values/fontFamily.json"
120
+ },
121
+ {
122
+ "$ref": "../format.json#/definitions/tokenValueReference"
123
+ }
124
+ ]
125
+ }
126
+ }
127
+ }
128
+ },
129
+ {
130
+ "if": {
131
+ "required": ["$type"],
132
+ "properties": {
133
+ "$type": { "const": "fontWeight" }
134
+ }
135
+ },
136
+ "then": {
137
+ "properties": {
138
+ "$value": {
139
+ "oneOf": [
140
+ {
141
+ "$ref": "values/fontWeight.json"
142
+ },
143
+ {
144
+ "$ref": "../format.json#/definitions/tokenValueReference"
145
+ }
146
+ ]
147
+ }
148
+ }
149
+ }
150
+ },
151
+ {
152
+ "if": {
153
+ "required": ["$type"],
154
+ "properties": {
155
+ "$type": { "const": "duration" }
156
+ }
157
+ },
158
+ "then": {
159
+ "properties": {
160
+ "$value": {
161
+ "oneOf": [
162
+ {
163
+ "$ref": "values/duration.json"
164
+ },
165
+ {
166
+ "$ref": "../format.json#/definitions/tokenValueReference"
167
+ }
168
+ ]
169
+ }
170
+ }
171
+ }
172
+ },
173
+ {
174
+ "if": {
175
+ "required": ["$type"],
176
+ "properties": {
177
+ "$type": { "const": "cubicBezier" }
178
+ }
179
+ },
180
+ "then": {
181
+ "properties": {
182
+ "$value": {
183
+ "oneOf": [
184
+ {
185
+ "$ref": "values/cubicBezier.json"
186
+ },
187
+ {
188
+ "$ref": "../format.json#/definitions/tokenValueReference"
189
+ }
190
+ ]
191
+ }
192
+ }
193
+ }
194
+ },
195
+ {
196
+ "if": {
197
+ "required": ["$type"],
198
+ "properties": {
199
+ "$type": { "const": "number" }
200
+ }
201
+ },
202
+ "then": {
203
+ "properties": {
204
+ "$value": {
205
+ "oneOf": [
206
+ {
207
+ "$ref": "values/number.json"
208
+ },
209
+ {
210
+ "$ref": "../format.json#/definitions/tokenValueReference"
211
+ }
212
+ ]
213
+ }
214
+ }
215
+ }
216
+ },
217
+ {
218
+ "if": {
219
+ "required": ["$type"],
220
+ "properties": {
221
+ "$type": { "const": "strokeStyle" }
222
+ }
223
+ },
224
+ "then": {
225
+ "properties": {
226
+ "$value": {
227
+ "oneOf": [
228
+ {
229
+ "$ref": "values/strokeStyle.json"
230
+ },
231
+ {
232
+ "$ref": "../format.json#/definitions/tokenValueReference"
233
+ }
234
+ ]
235
+ }
236
+ }
237
+ }
238
+ },
239
+ {
240
+ "if": {
241
+ "required": ["$type"],
242
+ "properties": {
243
+ "$type": { "const": "border" }
244
+ }
245
+ },
246
+ "then": {
247
+ "properties": {
248
+ "$value": {
249
+ "oneOf": [
250
+ {
251
+ "$ref": "values/border.json"
252
+ },
253
+ {
254
+ "$ref": "../format.json#/definitions/tokenValueReference"
255
+ }
256
+ ]
257
+ }
258
+ }
259
+ }
260
+ },
261
+ {
262
+ "if": {
263
+ "required": ["$type"],
264
+ "properties": {
265
+ "$type": { "const": "transition" }
266
+ }
267
+ },
268
+ "then": {
269
+ "properties": {
270
+ "$value": {
271
+ "oneOf": [
272
+ {
273
+ "$ref": "values/transition.json"
274
+ },
275
+ {
276
+ "$ref": "../format.json#/definitions/tokenValueReference"
277
+ }
278
+ ]
279
+ }
280
+ }
281
+ }
282
+ },
283
+ {
284
+ "if": {
285
+ "required": ["$type"],
286
+ "properties": {
287
+ "$type": { "const": "shadow" }
288
+ }
289
+ },
290
+ "then": {
291
+ "properties": {
292
+ "$value": {
293
+ "oneOf": [
294
+ {
295
+ "$ref": "values/shadow.json"
296
+ },
297
+ {
298
+ "$ref": "../format.json#/definitions/tokenValueReference"
299
+ }
300
+ ]
301
+ }
302
+ }
303
+ }
304
+ },
305
+ {
306
+ "if": {
307
+ "required": ["$type"],
308
+ "properties": {
309
+ "$type": { "const": "gradient" }
310
+ }
311
+ },
312
+ "then": {
313
+ "properties": {
314
+ "$value": {
315
+ "oneOf": [
316
+ {
317
+ "$ref": "values/gradient.json"
318
+ },
319
+ {
320
+ "$ref": "../format.json#/definitions/tokenValueReference"
321
+ }
322
+ ]
323
+ }
324
+ }
325
+ }
326
+ },
327
+ {
328
+ "if": {
329
+ "required": ["$type"],
330
+ "properties": {
331
+ "$type": { "const": "typography" }
332
+ }
333
+ },
334
+ "then": {
335
+ "properties": {
336
+ "$value": {
337
+ "oneOf": [
338
+ {
339
+ "$ref": "values/typography.json"
340
+ },
341
+ {
342
+ "$ref": "../format.json#/definitions/tokenValueReference"
343
+ }
344
+ ]
345
+ }
346
+ }
347
+ }
348
+ },
349
+ {
350
+ "if": {
351
+ "allOf": [
352
+ {
353
+ "not": {
354
+ "required": ["$type"]
355
+ }
356
+ },
357
+ {
358
+ "required": ["$value"]
359
+ },
360
+ {
361
+ "properties": {
362
+ "$value": {
363
+ "not": {
364
+ "$ref": "../format.json#/definitions/tokenValueReference"
365
+ }
366
+ }
367
+ }
368
+ }
369
+ ]
370
+ },
371
+ "then": {
372
+ "properties": {
373
+ "$value": {
374
+ "oneOf": [
375
+ {
376
+ "$ref": "values/color.json"
377
+ },
378
+ {
379
+ "$ref": "values/dimension.json"
380
+ },
381
+ {
382
+ "$ref": "values/fontFamily.json"
383
+ },
384
+ {
385
+ "$ref": "values/duration.json"
386
+ },
387
+ {
388
+ "$ref": "values/cubicBezier.json"
389
+ },
390
+ {
391
+ "$ref": "values/strokeStyle.json"
392
+ },
393
+ {
394
+ "$ref": "values/border.json"
395
+ },
396
+ {
397
+ "$ref": "values/transition.json"
398
+ },
399
+ {
400
+ "$ref": "values/shadow.json"
401
+ },
402
+ {
403
+ "$ref": "values/gradient.json"
404
+ },
405
+ {
406
+ "$ref": "values/typography.json"
407
+ },
408
+ {
409
+ "anyOf": [
410
+ {
411
+ "$ref": "values/number.json"
412
+ },
413
+ {
414
+ "$ref": "values/fontWeight.json"
415
+ }
416
+ ]
417
+ }
418
+ ]
419
+ }
420
+ }
421
+ }
422
+ }
423
+ ]
424
+ }
425
+
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://www.designtokens.org/schemas/2025.10/format/tokenType.json",
4
+ "title": "TokenType",
5
+ "description": "A token type in the DTCG specification",
6
+ "type": "string",
7
+ "enum": [
8
+ "color",
9
+ "dimension",
10
+ "fontFamily",
11
+ "fontWeight",
12
+ "duration",
13
+ "cubicBezier",
14
+ "number",
15
+ "strokeStyle",
16
+ "border",
17
+ "transition",
18
+ "shadow",
19
+ "gradient",
20
+ "typography"
21
+ ]
22
+ }
23
+
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://www.designtokens.org/schemas/2025.10/format/values/border.json",
4
+ "title": "Border Value",
5
+ "description": "Value schema for border type tokens. Represents a border style.",
6
+ "type": "object",
7
+ "properties": {
8
+ "color": {
9
+ "description": "The color of the border",
10
+ "oneOf": [
11
+ {
12
+ "$ref": "color.json"
13
+ },
14
+ {
15
+ "$ref": "../../format.json#/definitions/tokenValueReference"
16
+ }
17
+ ]
18
+ },
19
+ "width": {
20
+ "description": "The width or thickness of the border",
21
+ "oneOf": [
22
+ {
23
+ "$ref": "dimension.json"
24
+ },
25
+ {
26
+ "$ref": "../../format.json#/definitions/tokenValueReference"
27
+ }
28
+ ]
29
+ },
30
+ "style": {
31
+ "description": "The border's style",
32
+ "oneOf": [
33
+ {
34
+ "$ref": "strokeStyle.json"
35
+ },
36
+ {
37
+ "$ref": "../../format.json#/definitions/tokenValueReference"
38
+ }
39
+ ]
40
+ }
41
+ },
42
+ "required": ["color", "width", "style"],
43
+ "additionalProperties": false
44
+ }
45
+