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