@boopdoopgoop/design-system 0.0.0-stage → 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.
- package/README.md +442 -2
- package/dist/components/index.cjs +233 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +63 -0
- package/dist/components/index.d.ts +63 -0
- package/dist/components/index.js +208 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.cjs +777 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +775 -0
- package/dist/index.d.ts +775 -0
- package/dist/index.js +745 -0
- package/dist/index.js.map +1 -0
- package/package.json +99 -4
- package/src/tokens/primitives.json +354 -0
- package/src/tokens/semantic.json +133 -0
- package/styles/components.css +290 -0
- package/styles/fonts.css +8 -0
- package/styles/theme.css +271 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
flattenTokens: () => flattenTokens,
|
|
24
|
+
renderTheme: () => renderTheme,
|
|
25
|
+
resolveTokens: () => resolveTokens,
|
|
26
|
+
resolvedTokens: () => resolvedTokens,
|
|
27
|
+
tokenDocuments: () => tokenDocuments,
|
|
28
|
+
tokens: () => tokens
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(index_exports);
|
|
31
|
+
|
|
32
|
+
// src/tokens/primitives.json
|
|
33
|
+
var primitives_default = {
|
|
34
|
+
$description: "DTCG 2025.10 primitives. Colors use sRGB components in the 0\u20131 range; dimensions are CSS pixels. Product CSS is the value authority.",
|
|
35
|
+
primitive: {
|
|
36
|
+
color: {
|
|
37
|
+
$type: "color",
|
|
38
|
+
white: {
|
|
39
|
+
$value: {
|
|
40
|
+
colorSpace: "srgb",
|
|
41
|
+
components: [1, 1, 1],
|
|
42
|
+
hex: "#ffffff"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
black: {
|
|
46
|
+
$value: {
|
|
47
|
+
colorSpace: "srgb",
|
|
48
|
+
components: [0, 0, 0],
|
|
49
|
+
hex: "#000000"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
ink: {
|
|
53
|
+
$value: {
|
|
54
|
+
colorSpace: "srgb",
|
|
55
|
+
components: [
|
|
56
|
+
0.10196078431372549,
|
|
57
|
+
0.10196078431372549,
|
|
58
|
+
0.10196078431372549
|
|
59
|
+
],
|
|
60
|
+
hex: "#1a1a1a"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
muted: {
|
|
64
|
+
$value: {
|
|
65
|
+
colorSpace: "srgb",
|
|
66
|
+
components: [0.4, 0.4, 0.4],
|
|
67
|
+
hex: "#666666"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
mist: {
|
|
71
|
+
$value: {
|
|
72
|
+
colorSpace: "srgb",
|
|
73
|
+
components: [
|
|
74
|
+
0.9568627450980393,
|
|
75
|
+
0.9568627450980393,
|
|
76
|
+
0.9490196078431372
|
|
77
|
+
],
|
|
78
|
+
hex: "#f4f4f2"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
line: {
|
|
82
|
+
$value: {
|
|
83
|
+
colorSpace: "srgb",
|
|
84
|
+
components: [
|
|
85
|
+
0.8196078431372549,
|
|
86
|
+
0.8196078431372549,
|
|
87
|
+
0.8196078431372549
|
|
88
|
+
],
|
|
89
|
+
hex: "#d1d1d1"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"control-line": {
|
|
93
|
+
$value: {
|
|
94
|
+
colorSpace: "srgb",
|
|
95
|
+
components: [
|
|
96
|
+
0.5803921568627451,
|
|
97
|
+
0.5803921568627451,
|
|
98
|
+
0.5803921568627451
|
|
99
|
+
],
|
|
100
|
+
hex: "#949494"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
placeholder: {
|
|
104
|
+
$value: {
|
|
105
|
+
colorSpace: "srgb",
|
|
106
|
+
components: [
|
|
107
|
+
0.4627450980392157,
|
|
108
|
+
0.4627450980392157,
|
|
109
|
+
0.4627450980392157
|
|
110
|
+
],
|
|
111
|
+
hex: "#767676"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
signal: {
|
|
115
|
+
$value: {
|
|
116
|
+
colorSpace: "srgb",
|
|
117
|
+
components: [
|
|
118
|
+
0.27058823529411763,
|
|
119
|
+
0.27058823529411763,
|
|
120
|
+
0.27058823529411763
|
|
121
|
+
],
|
|
122
|
+
hex: "#454545"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
warning: {
|
|
126
|
+
$value: {
|
|
127
|
+
colorSpace: "srgb",
|
|
128
|
+
components: [
|
|
129
|
+
0.5411764705882353,
|
|
130
|
+
0.41568627450980394,
|
|
131
|
+
0.07058823529411765
|
|
132
|
+
],
|
|
133
|
+
hex: "#8a6a12"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
success: {
|
|
137
|
+
$value: {
|
|
138
|
+
colorSpace: "srgb",
|
|
139
|
+
components: [
|
|
140
|
+
0.2196078431372549,
|
|
141
|
+
0.43529411764705883,
|
|
142
|
+
0.1411764705882353
|
|
143
|
+
],
|
|
144
|
+
hex: "#386f24"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
danger: {
|
|
148
|
+
$value: {
|
|
149
|
+
colorSpace: "srgb",
|
|
150
|
+
components: [
|
|
151
|
+
0.6078431372549019,
|
|
152
|
+
0.17254901960784313,
|
|
153
|
+
0.17254901960784313
|
|
154
|
+
],
|
|
155
|
+
hex: "#9b2c2c"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
info: {
|
|
159
|
+
$value: {
|
|
160
|
+
colorSpace: "srgb",
|
|
161
|
+
components: [0.2, 0.3137254901960784, 0.611764705882353],
|
|
162
|
+
hex: "#33509c"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
sage: {
|
|
166
|
+
$value: {
|
|
167
|
+
colorSpace: "srgb",
|
|
168
|
+
components: [
|
|
169
|
+
0.8627450980392157,
|
|
170
|
+
0.9098039215686274,
|
|
171
|
+
0.8313725490196079
|
|
172
|
+
],
|
|
173
|
+
hex: "#dce8d4"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"sage-ink": {
|
|
177
|
+
$value: {
|
|
178
|
+
colorSpace: "srgb",
|
|
179
|
+
components: [
|
|
180
|
+
0.1843137254901961,
|
|
181
|
+
0.2901960784313726,
|
|
182
|
+
0.1607843137254902
|
|
183
|
+
],
|
|
184
|
+
hex: "#2f4a29"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
slate: {
|
|
188
|
+
$value: {
|
|
189
|
+
colorSpace: "srgb",
|
|
190
|
+
components: [
|
|
191
|
+
0.8588235294117647,
|
|
192
|
+
0.8980392156862745,
|
|
193
|
+
0.9372549019607843
|
|
194
|
+
],
|
|
195
|
+
hex: "#dbe5ef"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"slate-ink": {
|
|
199
|
+
$value: {
|
|
200
|
+
colorSpace: "srgb",
|
|
201
|
+
components: [
|
|
202
|
+
0.19607843137254902,
|
|
203
|
+
0.2823529411764706,
|
|
204
|
+
0.3764705882352941
|
|
205
|
+
],
|
|
206
|
+
hex: "#324860"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
ochre: {
|
|
210
|
+
$value: {
|
|
211
|
+
colorSpace: "srgb",
|
|
212
|
+
components: [
|
|
213
|
+
0.9411764705882353,
|
|
214
|
+
0.8901960784313725,
|
|
215
|
+
0.7686274509803922
|
|
216
|
+
],
|
|
217
|
+
hex: "#f0e3c4"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"ochre-ink": {
|
|
221
|
+
$value: {
|
|
222
|
+
colorSpace: "srgb",
|
|
223
|
+
components: [0.4, 0.2980392156862745, 0.08627450980392157],
|
|
224
|
+
hex: "#664c16"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
clay: {
|
|
228
|
+
$value: {
|
|
229
|
+
colorSpace: "srgb",
|
|
230
|
+
components: [
|
|
231
|
+
0.9411764705882353,
|
|
232
|
+
0.8588235294117647,
|
|
233
|
+
0.8156862745098039
|
|
234
|
+
],
|
|
235
|
+
hex: "#f0dbd0"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"clay-ink": {
|
|
239
|
+
$value: {
|
|
240
|
+
colorSpace: "srgb",
|
|
241
|
+
components: [
|
|
242
|
+
0.4549019607843137,
|
|
243
|
+
0.2627450980392157,
|
|
244
|
+
0.1843137254901961
|
|
245
|
+
],
|
|
246
|
+
hex: "#74432f"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
mauve: {
|
|
250
|
+
$value: {
|
|
251
|
+
colorSpace: "srgb",
|
|
252
|
+
components: [
|
|
253
|
+
0.9098039215686274,
|
|
254
|
+
0.8627450980392157,
|
|
255
|
+
0.9254901960784314
|
|
256
|
+
],
|
|
257
|
+
hex: "#e8dcec"
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
"mauve-ink": {
|
|
261
|
+
$value: {
|
|
262
|
+
colorSpace: "srgb",
|
|
263
|
+
components: [
|
|
264
|
+
0.3686274509803922,
|
|
265
|
+
0.25098039215686274,
|
|
266
|
+
0.40784313725490196
|
|
267
|
+
],
|
|
268
|
+
hex: "#5e4068"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
stone: {
|
|
272
|
+
$value: {
|
|
273
|
+
colorSpace: "srgb",
|
|
274
|
+
components: [
|
|
275
|
+
0.9019607843137255,
|
|
276
|
+
0.8901960784313725,
|
|
277
|
+
0.8588235294117647
|
|
278
|
+
],
|
|
279
|
+
hex: "#e6e3db"
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
"stone-ink": {
|
|
283
|
+
$value: {
|
|
284
|
+
colorSpace: "srgb",
|
|
285
|
+
components: [
|
|
286
|
+
0.30980392156862746,
|
|
287
|
+
0.2980392156862745,
|
|
288
|
+
0.2627450980392157
|
|
289
|
+
],
|
|
290
|
+
hex: "#4f4c43"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
paper: {
|
|
294
|
+
$value: {
|
|
295
|
+
colorSpace: "srgb",
|
|
296
|
+
components: [
|
|
297
|
+
0.9490196078431372,
|
|
298
|
+
0.9294117647058824,
|
|
299
|
+
0.8862745098039215
|
|
300
|
+
],
|
|
301
|
+
hex: "#f2ede2"
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
sheet: {
|
|
305
|
+
$value: {
|
|
306
|
+
colorSpace: "srgb",
|
|
307
|
+
components: [
|
|
308
|
+
0.9725490196078431,
|
|
309
|
+
0.9607843137254902,
|
|
310
|
+
0.9333333333333333
|
|
311
|
+
],
|
|
312
|
+
hex: "#f8f5ee"
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
"ink-70": {
|
|
316
|
+
$value: {
|
|
317
|
+
colorSpace: "srgb",
|
|
318
|
+
components: [
|
|
319
|
+
0.28627450980392155,
|
|
320
|
+
0.2784313725490196,
|
|
321
|
+
0.26666666666666666
|
|
322
|
+
],
|
|
323
|
+
hex: "#494744"
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"ink-35": {
|
|
327
|
+
$value: {
|
|
328
|
+
colorSpace: "srgb",
|
|
329
|
+
components: [
|
|
330
|
+
0.615686274509804,
|
|
331
|
+
0.6039215686274509,
|
|
332
|
+
0.5764705882352941
|
|
333
|
+
],
|
|
334
|
+
hex: "#9d9a93"
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"ink-18": {
|
|
338
|
+
$value: {
|
|
339
|
+
colorSpace: "srgb",
|
|
340
|
+
components: [
|
|
341
|
+
0.7764705882352941,
|
|
342
|
+
0.7607843137254902,
|
|
343
|
+
0.7254901960784313
|
|
344
|
+
],
|
|
345
|
+
hex: "#c6c2b9"
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
yellow: {
|
|
349
|
+
$value: {
|
|
350
|
+
colorSpace: "srgb",
|
|
351
|
+
components: [1, 0.9098039215686274, 0],
|
|
352
|
+
hex: "#ffe800"
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
font: {
|
|
357
|
+
$type: "fontFamily",
|
|
358
|
+
display: {
|
|
359
|
+
$value: [
|
|
360
|
+
"Big Shoulders Display",
|
|
361
|
+
"Arial Narrow",
|
|
362
|
+
"Helvetica Neue",
|
|
363
|
+
"Arial",
|
|
364
|
+
"sans-serif"
|
|
365
|
+
]
|
|
366
|
+
},
|
|
367
|
+
body: {
|
|
368
|
+
$value: ["Archivo", "ui-sans-serif", "system-ui", "sans-serif"]
|
|
369
|
+
},
|
|
370
|
+
mono: {
|
|
371
|
+
$value: ["Spline Sans Mono", "ui-monospace", "Menlo", "monospace"]
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
size: {
|
|
375
|
+
$type: "dimension",
|
|
376
|
+
"11": { $value: { value: 11, unit: "px" } },
|
|
377
|
+
"12": { $value: { value: 12, unit: "px" } },
|
|
378
|
+
"14": { $value: { value: 14, unit: "px" } },
|
|
379
|
+
"15": { $value: { value: 15, unit: "px" } },
|
|
380
|
+
"18": { $value: { value: 18, unit: "px" } },
|
|
381
|
+
"24": { $value: { value: 24, unit: "px" } },
|
|
382
|
+
"32": { $value: { value: 32, unit: "px" } }
|
|
383
|
+
},
|
|
384
|
+
dimension: {
|
|
385
|
+
$type: "dimension",
|
|
386
|
+
zero: { $value: { value: 0, unit: "px" } },
|
|
387
|
+
one: { $value: { value: 1, unit: "px" } },
|
|
388
|
+
two: { $value: { value: 2, unit: "px" } },
|
|
389
|
+
three: { $value: { value: 3, unit: "px" } }
|
|
390
|
+
},
|
|
391
|
+
space: {
|
|
392
|
+
$type: "dimension",
|
|
393
|
+
"4": { $value: { value: 4, unit: "px" } },
|
|
394
|
+
"6": { $value: { value: 6, unit: "px" } },
|
|
395
|
+
"8": { $value: { value: 8, unit: "px" } },
|
|
396
|
+
"10": { $value: { value: 10, unit: "px" } },
|
|
397
|
+
"12": { $value: { value: 12, unit: "px" } },
|
|
398
|
+
"16": { $value: { value: 16, unit: "px" } },
|
|
399
|
+
"20": { $value: { value: 20, unit: "px" } },
|
|
400
|
+
"24": { $value: { value: 24, unit: "px" } },
|
|
401
|
+
"32": { $value: { value: 32, unit: "px" } }
|
|
402
|
+
},
|
|
403
|
+
"component-size": {
|
|
404
|
+
$type: "dimension",
|
|
405
|
+
control: { $value: { value: 44, unit: "px" } },
|
|
406
|
+
textarea: { $value: { value: 96, unit: "px" } },
|
|
407
|
+
modal: { $value: { value: 480, unit: "px" } }
|
|
408
|
+
},
|
|
409
|
+
layer: {
|
|
410
|
+
$type: "number",
|
|
411
|
+
modal: { $value: 50 }
|
|
412
|
+
},
|
|
413
|
+
weight: {
|
|
414
|
+
$type: "fontWeight",
|
|
415
|
+
regular: { $value: 400 },
|
|
416
|
+
medium: { $value: 500 },
|
|
417
|
+
semibold: { $value: 600 },
|
|
418
|
+
bold: { $value: 700 },
|
|
419
|
+
black: { $value: 900 }
|
|
420
|
+
},
|
|
421
|
+
ratio: {
|
|
422
|
+
$type: "number",
|
|
423
|
+
display: { $value: 1 },
|
|
424
|
+
body: { $value: 1.45 },
|
|
425
|
+
copy: { $value: 1.4 },
|
|
426
|
+
label: { $value: 1.25 },
|
|
427
|
+
grain: { $value: 0.1 },
|
|
428
|
+
hover: { $value: 0.05 },
|
|
429
|
+
overlay: { $value: 0.4 },
|
|
430
|
+
disabled: { $value: 0.55 },
|
|
431
|
+
"tracking-control": { $value: 0.08 },
|
|
432
|
+
"tracking-label": { $value: 0.12 },
|
|
433
|
+
"tracking-panel": { $value: 0.14 }
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
// src/tokens/semantic.json
|
|
439
|
+
var semantic_default = {
|
|
440
|
+
$description: "Semantic aliases. App chrome and risograph paper are independent named tiers, not light/dark modes. Font choices are fixed for this release.",
|
|
441
|
+
color: {
|
|
442
|
+
$type: "color",
|
|
443
|
+
app: {
|
|
444
|
+
$description: "theme.css lines 6\u201332. App chrome only.",
|
|
445
|
+
canvas: { $value: "{primitive.color.white}" },
|
|
446
|
+
paper: { $value: "{primitive.color.white}" },
|
|
447
|
+
ink: { $value: "{primitive.color.ink}" },
|
|
448
|
+
muted: { $value: "{primitive.color.muted}" },
|
|
449
|
+
mist: { $value: "{primitive.color.mist}" },
|
|
450
|
+
line: { $value: "{primitive.color.line}" },
|
|
451
|
+
"control-line": { $value: "{primitive.color.control-line}" },
|
|
452
|
+
placeholder: { $value: "{primitive.color.placeholder}" },
|
|
453
|
+
signal: { $value: "{primitive.color.signal}" },
|
|
454
|
+
"on-signal": { $value: "{primitive.color.white}" },
|
|
455
|
+
focus: { $value: "{primitive.color.ink}" },
|
|
456
|
+
warning: { $value: "{primitive.color.warning}" },
|
|
457
|
+
success: { $value: "{primitive.color.success}" },
|
|
458
|
+
danger: { $value: "{primitive.color.danger}" },
|
|
459
|
+
info: { $value: "{primitive.color.info}" },
|
|
460
|
+
"tile-sage": { $value: "{primitive.color.sage}" },
|
|
461
|
+
"tile-sage-ink": { $value: "{primitive.color.sage-ink}" },
|
|
462
|
+
"tile-slate": { $value: "{primitive.color.slate}" },
|
|
463
|
+
"tile-slate-ink": { $value: "{primitive.color.slate-ink}" },
|
|
464
|
+
"tile-ochre": { $value: "{primitive.color.ochre}" },
|
|
465
|
+
"tile-ochre-ink": { $value: "{primitive.color.ochre-ink}" },
|
|
466
|
+
"tile-clay": { $value: "{primitive.color.clay}" },
|
|
467
|
+
"tile-clay-ink": { $value: "{primitive.color.clay-ink}" },
|
|
468
|
+
"tile-mauve": { $value: "{primitive.color.mauve}" },
|
|
469
|
+
"tile-mauve-ink": { $value: "{primitive.color.mauve-ink}" },
|
|
470
|
+
"tile-stone": { $value: "{primitive.color.stone}" },
|
|
471
|
+
"tile-stone-ink": { $value: "{primitive.color.stone-ink}" }
|
|
472
|
+
},
|
|
473
|
+
riso: {
|
|
474
|
+
$description: "risograph.css lines 12\u201318. A single black drum at three densities and marker yellow.",
|
|
475
|
+
paper: { $value: "{primitive.color.paper}" },
|
|
476
|
+
sheet: { $value: "{primitive.color.sheet}" },
|
|
477
|
+
ink: { $value: "{primitive.color.black}" },
|
|
478
|
+
"ink-2": { $value: "{primitive.color.ink-70}" },
|
|
479
|
+
"tint-35": { $value: "{primitive.color.ink-35}" },
|
|
480
|
+
"tint-18": { $value: "{primitive.color.ink-18}" },
|
|
481
|
+
highlight: { $value: "{primitive.color.yellow}" }
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
font: {
|
|
485
|
+
$type: "fontFamily",
|
|
486
|
+
display: { $value: "{primitive.font.display}" },
|
|
487
|
+
body: { $value: "{primitive.font.body}" },
|
|
488
|
+
sans: { $value: "{font.body}" },
|
|
489
|
+
ui: { $value: "{font.body}" },
|
|
490
|
+
mono: { $value: "{primitive.font.mono}" }
|
|
491
|
+
},
|
|
492
|
+
text: {
|
|
493
|
+
$type: "dimension",
|
|
494
|
+
display: { $value: "{primitive.size.32}" },
|
|
495
|
+
heading: { $value: "{primitive.size.24}" },
|
|
496
|
+
body: { $value: "{primitive.size.15}" },
|
|
497
|
+
ui: { $value: "{primitive.size.14}" },
|
|
498
|
+
mono: { $value: "{primitive.size.12}" },
|
|
499
|
+
label: { $value: "{primitive.size.11}" }
|
|
500
|
+
},
|
|
501
|
+
leading: {
|
|
502
|
+
$type: "number",
|
|
503
|
+
display: { $value: "{primitive.ratio.display}" },
|
|
504
|
+
body: { $value: "{primitive.ratio.body}" },
|
|
505
|
+
ui: { $value: "{primitive.ratio.copy}" },
|
|
506
|
+
label: { $value: "{primitive.ratio.label}" }
|
|
507
|
+
},
|
|
508
|
+
"font-weight": {
|
|
509
|
+
$type: "fontWeight",
|
|
510
|
+
black: { $value: "{primitive.weight.black}" },
|
|
511
|
+
regular: { $value: "{primitive.weight.regular}" },
|
|
512
|
+
medium: { $value: "{primitive.weight.medium}" },
|
|
513
|
+
semibold: { $value: "{primitive.weight.semibold}" },
|
|
514
|
+
bold: { $value: "{primitive.weight.bold}" }
|
|
515
|
+
},
|
|
516
|
+
radius: {
|
|
517
|
+
$type: "dimension",
|
|
518
|
+
control: { $value: "{primitive.dimension.zero}" }
|
|
519
|
+
},
|
|
520
|
+
border: {
|
|
521
|
+
$type: "dimension",
|
|
522
|
+
app: { $value: "{primitive.dimension.one}" },
|
|
523
|
+
riso: { $value: "{primitive.dimension.three}" }
|
|
524
|
+
},
|
|
525
|
+
focus: {
|
|
526
|
+
$type: "dimension",
|
|
527
|
+
"app-width": { $value: "{primitive.dimension.two}" },
|
|
528
|
+
"app-offset": { $value: "{primitive.dimension.two}" },
|
|
529
|
+
"riso-width": { $value: "{primitive.dimension.three}" },
|
|
530
|
+
"riso-offset": { $value: "{primitive.dimension.three}" }
|
|
531
|
+
},
|
|
532
|
+
space: {
|
|
533
|
+
$type: "dimension",
|
|
534
|
+
xs: { $value: "{primitive.space.4}" },
|
|
535
|
+
hint: { $value: "{primitive.space.6}" },
|
|
536
|
+
sm: { $value: "{primitive.space.8}" },
|
|
537
|
+
"tag-inline": { $value: "{primitive.space.10}" },
|
|
538
|
+
md: { $value: "{primitive.space.12}" },
|
|
539
|
+
lg: { $value: "{primitive.space.16}" },
|
|
540
|
+
panel: { $value: "{primitive.space.20}" },
|
|
541
|
+
modal: { $value: "{primitive.space.24}" },
|
|
542
|
+
viewport: { $value: "{primitive.space.32}" }
|
|
543
|
+
},
|
|
544
|
+
size: {
|
|
545
|
+
$type: "dimension",
|
|
546
|
+
control: { $value: "{primitive.component-size.control}" },
|
|
547
|
+
icon: { $value: "{primitive.size.12}" },
|
|
548
|
+
"close-icon": { $value: "{primitive.size.14}" },
|
|
549
|
+
close: { $value: "{primitive.size.32}" },
|
|
550
|
+
textarea: { $value: "{primitive.component-size.textarea}" },
|
|
551
|
+
modal: { $value: "{primitive.component-size.modal}" }
|
|
552
|
+
},
|
|
553
|
+
layer: {
|
|
554
|
+
$type: "number",
|
|
555
|
+
modal: { $value: "{primitive.layer.modal}" }
|
|
556
|
+
},
|
|
557
|
+
tracking: {
|
|
558
|
+
$type: "number",
|
|
559
|
+
control: { $value: "{primitive.ratio.tracking-control}" },
|
|
560
|
+
label: { $value: "{primitive.ratio.tracking-label}" },
|
|
561
|
+
panel: { $value: "{primitive.ratio.tracking-panel}" }
|
|
562
|
+
},
|
|
563
|
+
opacity: {
|
|
564
|
+
$type: "number",
|
|
565
|
+
"riso-grain": { $value: "{primitive.ratio.grain}" },
|
|
566
|
+
hover: { $value: "{primitive.ratio.hover}" },
|
|
567
|
+
overlay: { $value: "{primitive.ratio.overlay}" },
|
|
568
|
+
disabled: { $value: "{primitive.ratio.disabled}" },
|
|
569
|
+
"disabled-close": { $value: "{primitive.ratio.overlay}" }
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
// src/token-engine.ts
|
|
574
|
+
var types = /* @__PURE__ */ new Set([
|
|
575
|
+
"color",
|
|
576
|
+
"dimension",
|
|
577
|
+
"fontFamily",
|
|
578
|
+
"fontWeight",
|
|
579
|
+
"number"
|
|
580
|
+
]);
|
|
581
|
+
var reference = /^\{([^{}]+)\}$/;
|
|
582
|
+
function object(value) {
|
|
583
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
584
|
+
}
|
|
585
|
+
function flattenTokens(...documents) {
|
|
586
|
+
const result = {};
|
|
587
|
+
function visit(node, path, inherited) {
|
|
588
|
+
if (!object(node))
|
|
589
|
+
throw new Error(`Invalid token group: ${path.join(".")}`);
|
|
590
|
+
const type = node.$type ?? inherited;
|
|
591
|
+
if ("$value" in node) {
|
|
592
|
+
const name = path.join(".");
|
|
593
|
+
if (!name || !types.has(type))
|
|
594
|
+
throw new Error(`Unsupported type: ${name}`);
|
|
595
|
+
if (name in result) throw new Error(`Duplicate token: ${name}`);
|
|
596
|
+
result[name] = {
|
|
597
|
+
$type: type,
|
|
598
|
+
$value: node.$value,
|
|
599
|
+
...typeof node.$description === "string" ? { $description: node.$description } : {}
|
|
600
|
+
};
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
for (const [key, child] of Object.entries(node)) {
|
|
604
|
+
if (key.startsWith("$")) continue;
|
|
605
|
+
if (!/^[a-z0-9-]+$/.test(key))
|
|
606
|
+
throw new Error(`Invalid token key: ${key}`);
|
|
607
|
+
visit(child, [...path, key], type);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
for (const document of documents) visit(document, []);
|
|
611
|
+
return result;
|
|
612
|
+
}
|
|
613
|
+
function serialize(type, value, path) {
|
|
614
|
+
const fail = () => {
|
|
615
|
+
throw new Error(`Invalid ${type} value: ${path}`);
|
|
616
|
+
};
|
|
617
|
+
switch (type) {
|
|
618
|
+
case "color": {
|
|
619
|
+
if (!object(value) || value.colorSpace !== "srgb") return fail();
|
|
620
|
+
const components = value.components;
|
|
621
|
+
if (!Array.isArray(components) || components.length !== 3 || !components.every(
|
|
622
|
+
(n) => typeof n === "number" && Number.isFinite(n) && n >= 0 && n <= 1
|
|
623
|
+
))
|
|
624
|
+
return fail();
|
|
625
|
+
const alpha = value.alpha ?? 1;
|
|
626
|
+
if (typeof alpha !== "number" || !Number.isFinite(alpha) || alpha < 0 || alpha > 1)
|
|
627
|
+
return fail();
|
|
628
|
+
const hex = `#${components.map(
|
|
629
|
+
(n) => Math.round(n * 255).toString(16).padStart(2, "0")
|
|
630
|
+
).join("")}`;
|
|
631
|
+
if (value.hex !== void 0 && value.hex !== hex) return fail();
|
|
632
|
+
return alpha === 1 ? hex : `rgb(${components.map((n) => Math.round(n * 255)).join(" ")} / ${alpha})`;
|
|
633
|
+
}
|
|
634
|
+
case "dimension":
|
|
635
|
+
if (!object(value) || typeof value.value !== "number" || !Number.isFinite(value.value) || !["px", "rem"].includes(String(value.unit)))
|
|
636
|
+
return fail();
|
|
637
|
+
return `${value.value}${value.unit}`;
|
|
638
|
+
case "fontFamily": {
|
|
639
|
+
const families = typeof value === "string" ? [value] : value;
|
|
640
|
+
if (!Array.isArray(families) || !families.length || !families.every(
|
|
641
|
+
(family) => typeof family === "string" && /^[a-zA-Z0-9 -]+$/.test(family)
|
|
642
|
+
))
|
|
643
|
+
return fail();
|
|
644
|
+
const generic = /* @__PURE__ */ new Set([
|
|
645
|
+
"serif",
|
|
646
|
+
"sans-serif",
|
|
647
|
+
"monospace",
|
|
648
|
+
"system-ui",
|
|
649
|
+
"ui-serif",
|
|
650
|
+
"ui-sans-serif",
|
|
651
|
+
"ui-monospace"
|
|
652
|
+
]);
|
|
653
|
+
return families.map((family) => generic.has(family) ? family : `"${family}"`).join(", ");
|
|
654
|
+
}
|
|
655
|
+
case "fontWeight":
|
|
656
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 1 || value > 1e3)
|
|
657
|
+
return fail();
|
|
658
|
+
return String(value);
|
|
659
|
+
case "number":
|
|
660
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return fail();
|
|
661
|
+
return String(value);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
function resolveTokens(tokens2) {
|
|
665
|
+
const resolved = {};
|
|
666
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
667
|
+
const names = /* @__PURE__ */ new Set();
|
|
668
|
+
function resolve(path) {
|
|
669
|
+
if (resolved[path]) return resolved[path];
|
|
670
|
+
const token = tokens2[path];
|
|
671
|
+
if (!token) throw new Error(`Missing alias target: ${path}`);
|
|
672
|
+
if (visiting.has(path)) throw new Error(`Circular alias: ${path}`);
|
|
673
|
+
visiting.add(path);
|
|
674
|
+
let value = token.$value;
|
|
675
|
+
const match = typeof value === "string" ? reference.exec(value) : null;
|
|
676
|
+
if (match) {
|
|
677
|
+
const target = resolve(match[1]);
|
|
678
|
+
if (target.$type !== token.$type)
|
|
679
|
+
throw new Error(`Alias type mismatch: ${path}`);
|
|
680
|
+
value = target.$value;
|
|
681
|
+
}
|
|
682
|
+
const cssName = `--ds-${path.replaceAll(".", "-")}`;
|
|
683
|
+
if (names.has(cssName)) throw new Error(`CSS name collision: ${cssName}`);
|
|
684
|
+
names.add(cssName);
|
|
685
|
+
const entry = {
|
|
686
|
+
...token,
|
|
687
|
+
$value: value,
|
|
688
|
+
path,
|
|
689
|
+
cssName,
|
|
690
|
+
cssValue: serialize(token.$type, value, path)
|
|
691
|
+
};
|
|
692
|
+
resolved[path] = entry;
|
|
693
|
+
visiting.delete(path);
|
|
694
|
+
return entry;
|
|
695
|
+
}
|
|
696
|
+
for (const path of Object.keys(tokens2).sort()) resolve(path);
|
|
697
|
+
return resolved;
|
|
698
|
+
}
|
|
699
|
+
var commonRoles = {
|
|
700
|
+
canvas: ["canvas", "paper"],
|
|
701
|
+
paper: ["paper", "paper"],
|
|
702
|
+
sheet: ["paper", "sheet"],
|
|
703
|
+
ink: ["ink", "ink"],
|
|
704
|
+
muted: ["muted", "ink-2"],
|
|
705
|
+
line: ["line", "tint-18"],
|
|
706
|
+
"control-line": ["control-line", "ink"],
|
|
707
|
+
placeholder: ["placeholder", "tint-35"],
|
|
708
|
+
signal: ["signal", "ink"],
|
|
709
|
+
"on-signal": ["on-signal", "paper"],
|
|
710
|
+
focus: ["focus", "ink"]
|
|
711
|
+
};
|
|
712
|
+
function renderTheme(tokens2) {
|
|
713
|
+
const resolved = resolveTokens(tokens2);
|
|
714
|
+
const entries = Object.entries(resolved).sort(
|
|
715
|
+
([a], [b]) => a.localeCompare(b, "en")
|
|
716
|
+
);
|
|
717
|
+
function declaration(path) {
|
|
718
|
+
const token = tokens2[path];
|
|
719
|
+
const match = typeof token.$value === "string" ? reference.exec(token.$value) : null;
|
|
720
|
+
return match ? `var(${resolved[match[1]].cssName})` : resolved[path].cssValue;
|
|
721
|
+
}
|
|
722
|
+
function roles(tier) {
|
|
723
|
+
return Object.entries(commonRoles).map(([role, targets]) => {
|
|
724
|
+
const path = `color.${tier}.${targets[tier === "app" ? 0 : 1]}`;
|
|
725
|
+
if (!resolved[path]) throw new Error(`Missing tier role: ${path}`);
|
|
726
|
+
return ` --ds-color-${role}: var(${resolved[path].cssName});`;
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
const theme = entries.filter(
|
|
730
|
+
([path]) => /^(color|font|text|leading|font-weight|radius)\./.test(path)
|
|
731
|
+
).map(
|
|
732
|
+
([path, token]) => ` --${path.replaceAll(".", "-")}: var(${token.cssName});`
|
|
733
|
+
);
|
|
734
|
+
theme.push(
|
|
735
|
+
...Object.keys(commonRoles).map(
|
|
736
|
+
(role) => ` --color-${role}: var(--ds-color-${role});`
|
|
737
|
+
)
|
|
738
|
+
);
|
|
739
|
+
return [
|
|
740
|
+
"/* Generated from src/tokens/*.json. Run pnpm generate; do not edit. */",
|
|
741
|
+
":root {",
|
|
742
|
+
...entries.map(
|
|
743
|
+
([path, token]) => ` ${token.cssName}: ${declaration(path)};`
|
|
744
|
+
),
|
|
745
|
+
...roles("app"),
|
|
746
|
+
"}",
|
|
747
|
+
"",
|
|
748
|
+
'[data-intangibility-tier="app"] {',
|
|
749
|
+
...roles("app"),
|
|
750
|
+
"}",
|
|
751
|
+
"",
|
|
752
|
+
'[data-intangibility-tier="riso"] {',
|
|
753
|
+
...roles("riso"),
|
|
754
|
+
"}",
|
|
755
|
+
"",
|
|
756
|
+
"/* Inline utilities resolve scoped roles on the consuming element. */",
|
|
757
|
+
"@theme inline static {",
|
|
758
|
+
...theme,
|
|
759
|
+
"}",
|
|
760
|
+
""
|
|
761
|
+
].join("\n");
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// src/index.ts
|
|
765
|
+
var tokenDocuments = { primitives: primitives_default, semantic: semantic_default };
|
|
766
|
+
var tokens = flattenTokens(primitives_default, semantic_default);
|
|
767
|
+
var resolvedTokens = resolveTokens(tokens);
|
|
768
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
769
|
+
0 && (module.exports = {
|
|
770
|
+
flattenTokens,
|
|
771
|
+
renderTheme,
|
|
772
|
+
resolveTokens,
|
|
773
|
+
resolvedTokens,
|
|
774
|
+
tokenDocuments,
|
|
775
|
+
tokens
|
|
776
|
+
});
|
|
777
|
+
//# sourceMappingURL=index.cjs.map
|