@phcdevworks/spectre-tokens 0.0.4 → 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 +91 -7
- package/dist/index.cjs +378 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +86 -16
- package/dist/index.d.cts +81 -38
- package/dist/index.d.ts +81 -38
- package/dist/index.js +378 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tokens/core.json +215 -13
package/dist/index.cjs
CHANGED
|
@@ -143,12 +143,14 @@ var core_default = {
|
|
|
143
143
|
onPage: {
|
|
144
144
|
default: "#0f172a",
|
|
145
145
|
muted: "#475569",
|
|
146
|
-
subtle: "#94a3b8"
|
|
146
|
+
subtle: "#94a3b8",
|
|
147
|
+
meta: "#94a3b8"
|
|
147
148
|
},
|
|
148
149
|
onSurface: {
|
|
149
150
|
default: "#0f172a",
|
|
150
151
|
muted: "#6b7280",
|
|
151
|
-
subtle: "#94a3b8"
|
|
152
|
+
subtle: "#94a3b8",
|
|
153
|
+
meta: "#94a3b8"
|
|
152
154
|
}
|
|
153
155
|
},
|
|
154
156
|
component: {
|
|
@@ -163,6 +165,26 @@ var core_default = {
|
|
|
163
165
|
button: {
|
|
164
166
|
textDefault: "#0f172a",
|
|
165
167
|
textOnPrimary: "#ffffff"
|
|
168
|
+
},
|
|
169
|
+
badge: {
|
|
170
|
+
neutralBg: "#f1f5f9",
|
|
171
|
+
neutralText: "#334155",
|
|
172
|
+
infoBg: "#dbeafe",
|
|
173
|
+
infoText: "#1d4ed8",
|
|
174
|
+
successBg: "#dcfce7",
|
|
175
|
+
successText: "#15803d",
|
|
176
|
+
warningBg: "#fef3c7",
|
|
177
|
+
warningText: "#b45309",
|
|
178
|
+
dangerBg: "#fee2e2",
|
|
179
|
+
dangerText: "#b91c1c"
|
|
180
|
+
},
|
|
181
|
+
iconBox: {
|
|
182
|
+
bg: "#ffffff",
|
|
183
|
+
border: "#e2e8f0",
|
|
184
|
+
iconDefault: "#6c32e6",
|
|
185
|
+
iconSuccess: "#16a34a",
|
|
186
|
+
iconWarning: "#d97706",
|
|
187
|
+
iconDanger: "#dc2626"
|
|
166
188
|
}
|
|
167
189
|
},
|
|
168
190
|
modes: {
|
|
@@ -191,6 +213,9 @@ var core_default = {
|
|
|
191
213
|
},
|
|
192
214
|
subtle: {
|
|
193
215
|
value: "#94a3b8"
|
|
216
|
+
},
|
|
217
|
+
meta: {
|
|
218
|
+
value: "#94a3b8"
|
|
194
219
|
}
|
|
195
220
|
},
|
|
196
221
|
onSurface: {
|
|
@@ -202,6 +227,9 @@ var core_default = {
|
|
|
202
227
|
},
|
|
203
228
|
subtle: {
|
|
204
229
|
value: "#94a3b8"
|
|
230
|
+
},
|
|
231
|
+
meta: {
|
|
232
|
+
value: "#94a3b8"
|
|
205
233
|
}
|
|
206
234
|
}
|
|
207
235
|
},
|
|
@@ -229,6 +257,58 @@ var core_default = {
|
|
|
229
257
|
textOnPrimary: {
|
|
230
258
|
value: "#ffffff"
|
|
231
259
|
}
|
|
260
|
+
},
|
|
261
|
+
badge: {
|
|
262
|
+
neutralBg: {
|
|
263
|
+
value: "#f1f5f9"
|
|
264
|
+
},
|
|
265
|
+
neutralText: {
|
|
266
|
+
value: "#334155"
|
|
267
|
+
},
|
|
268
|
+
infoBg: {
|
|
269
|
+
value: "#dbeafe"
|
|
270
|
+
},
|
|
271
|
+
infoText: {
|
|
272
|
+
value: "#1d4ed8"
|
|
273
|
+
},
|
|
274
|
+
successBg: {
|
|
275
|
+
value: "#dcfce7"
|
|
276
|
+
},
|
|
277
|
+
successText: {
|
|
278
|
+
value: "#15803d"
|
|
279
|
+
},
|
|
280
|
+
warningBg: {
|
|
281
|
+
value: "#fef3c7"
|
|
282
|
+
},
|
|
283
|
+
warningText: {
|
|
284
|
+
value: "#b45309"
|
|
285
|
+
},
|
|
286
|
+
dangerBg: {
|
|
287
|
+
value: "#fee2e2"
|
|
288
|
+
},
|
|
289
|
+
dangerText: {
|
|
290
|
+
value: "#b91c1c"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
iconBox: {
|
|
294
|
+
bg: {
|
|
295
|
+
value: "#ffffff"
|
|
296
|
+
},
|
|
297
|
+
border: {
|
|
298
|
+
value: "#e2e8f0"
|
|
299
|
+
},
|
|
300
|
+
iconDefault: {
|
|
301
|
+
value: "#6c32e6"
|
|
302
|
+
},
|
|
303
|
+
iconSuccess: {
|
|
304
|
+
value: "#16a34a"
|
|
305
|
+
},
|
|
306
|
+
iconWarning: {
|
|
307
|
+
value: "#d97706"
|
|
308
|
+
},
|
|
309
|
+
iconDanger: {
|
|
310
|
+
value: "#dc2626"
|
|
311
|
+
}
|
|
232
312
|
}
|
|
233
313
|
}
|
|
234
314
|
},
|
|
@@ -257,6 +337,9 @@ var core_default = {
|
|
|
257
337
|
},
|
|
258
338
|
subtle: {
|
|
259
339
|
value: "#94a3b8"
|
|
340
|
+
},
|
|
341
|
+
meta: {
|
|
342
|
+
value: "#94a3b8"
|
|
260
343
|
}
|
|
261
344
|
},
|
|
262
345
|
onSurface: {
|
|
@@ -268,6 +351,9 @@ var core_default = {
|
|
|
268
351
|
},
|
|
269
352
|
subtle: {
|
|
270
353
|
value: "#94a3b8"
|
|
354
|
+
},
|
|
355
|
+
meta: {
|
|
356
|
+
value: "#94a3b8"
|
|
271
357
|
}
|
|
272
358
|
}
|
|
273
359
|
},
|
|
@@ -295,6 +381,58 @@ var core_default = {
|
|
|
295
381
|
textOnPrimary: {
|
|
296
382
|
value: "#ffffff"
|
|
297
383
|
}
|
|
384
|
+
},
|
|
385
|
+
badge: {
|
|
386
|
+
neutralBg: {
|
|
387
|
+
value: "#334155"
|
|
388
|
+
},
|
|
389
|
+
neutralText: {
|
|
390
|
+
value: "#f1f5f9"
|
|
391
|
+
},
|
|
392
|
+
infoBg: {
|
|
393
|
+
value: "#1e40af"
|
|
394
|
+
},
|
|
395
|
+
infoText: {
|
|
396
|
+
value: "#dbeafe"
|
|
397
|
+
},
|
|
398
|
+
successBg: {
|
|
399
|
+
value: "#166534"
|
|
400
|
+
},
|
|
401
|
+
successText: {
|
|
402
|
+
value: "#dcfce7"
|
|
403
|
+
},
|
|
404
|
+
warningBg: {
|
|
405
|
+
value: "#92400e"
|
|
406
|
+
},
|
|
407
|
+
warningText: {
|
|
408
|
+
value: "#fef3c7"
|
|
409
|
+
},
|
|
410
|
+
dangerBg: {
|
|
411
|
+
value: "#991b1b"
|
|
412
|
+
},
|
|
413
|
+
dangerText: {
|
|
414
|
+
value: "#fee2e2"
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
iconBox: {
|
|
418
|
+
bg: {
|
|
419
|
+
value: "#1e293b"
|
|
420
|
+
},
|
|
421
|
+
border: {
|
|
422
|
+
value: "#334155"
|
|
423
|
+
},
|
|
424
|
+
iconDefault: {
|
|
425
|
+
value: "#a37aff"
|
|
426
|
+
},
|
|
427
|
+
iconSuccess: {
|
|
428
|
+
value: "#4ade80"
|
|
429
|
+
},
|
|
430
|
+
iconWarning: {
|
|
431
|
+
value: "#fbbf24"
|
|
432
|
+
},
|
|
433
|
+
iconDanger: {
|
|
434
|
+
value: "#f87171"
|
|
435
|
+
}
|
|
298
436
|
}
|
|
299
437
|
}
|
|
300
438
|
}
|
|
@@ -390,17 +528,49 @@ var core_default = {
|
|
|
390
528
|
text: "#94a3b8"
|
|
391
529
|
}
|
|
392
530
|
},
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
531
|
+
layout: {
|
|
532
|
+
section: {
|
|
533
|
+
padding: {
|
|
534
|
+
sm: "1.5rem",
|
|
535
|
+
md: "2rem",
|
|
536
|
+
lg: "3rem"
|
|
537
|
+
},
|
|
538
|
+
gap: {
|
|
539
|
+
sm: "1rem",
|
|
540
|
+
md: "1.5rem",
|
|
541
|
+
lg: "2rem"
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
stack: {
|
|
545
|
+
gap: {
|
|
546
|
+
sm: "0.5rem",
|
|
547
|
+
md: "0.75rem",
|
|
548
|
+
lg: "1rem"
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
container: {
|
|
552
|
+
paddingInline: {
|
|
553
|
+
sm: "1rem",
|
|
554
|
+
md: "1.5rem",
|
|
555
|
+
lg: "2rem"
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
space: {
|
|
560
|
+
"0": "0rem",
|
|
561
|
+
"4": "0.25rem",
|
|
562
|
+
"8": "0.5rem",
|
|
563
|
+
"12": "0.75rem",
|
|
564
|
+
"16": "1rem",
|
|
565
|
+
"20": "1.25rem",
|
|
566
|
+
"24": "1.5rem",
|
|
567
|
+
"32": "2rem",
|
|
568
|
+
"40": "2.5rem",
|
|
569
|
+
"48": "3rem",
|
|
570
|
+
"56": "3.5rem",
|
|
571
|
+
"64": "4rem",
|
|
572
|
+
"80": "5rem",
|
|
573
|
+
"96": "6rem"
|
|
404
574
|
},
|
|
405
575
|
radii: {
|
|
406
576
|
none: "0",
|
|
@@ -413,6 +583,38 @@ var core_default = {
|
|
|
413
583
|
card: "#334155",
|
|
414
584
|
input: "#cbd5f5"
|
|
415
585
|
},
|
|
586
|
+
font: {
|
|
587
|
+
xs: {
|
|
588
|
+
size: "0.75rem",
|
|
589
|
+
lineHeight: "1.25rem",
|
|
590
|
+
weight: 400
|
|
591
|
+
},
|
|
592
|
+
sm: {
|
|
593
|
+
size: "0.875rem",
|
|
594
|
+
lineHeight: "1.5rem",
|
|
595
|
+
weight: 400
|
|
596
|
+
},
|
|
597
|
+
md: {
|
|
598
|
+
size: "1rem",
|
|
599
|
+
lineHeight: "1.75rem",
|
|
600
|
+
weight: 500
|
|
601
|
+
},
|
|
602
|
+
lg: {
|
|
603
|
+
size: "1.25rem",
|
|
604
|
+
lineHeight: "2rem",
|
|
605
|
+
weight: 500
|
|
606
|
+
},
|
|
607
|
+
xl: {
|
|
608
|
+
size: "1.5rem",
|
|
609
|
+
lineHeight: "2.125rem",
|
|
610
|
+
weight: 600
|
|
611
|
+
},
|
|
612
|
+
"2xl": {
|
|
613
|
+
size: "1.875rem",
|
|
614
|
+
lineHeight: "2.5rem",
|
|
615
|
+
weight: 600
|
|
616
|
+
}
|
|
617
|
+
},
|
|
416
618
|
typography: {
|
|
417
619
|
families: {
|
|
418
620
|
sans: "'Inter', 'Helvetica Neue', Arial, sans-serif",
|
|
@@ -550,67 +752,143 @@ var toVariableName = (prefix, ...parts) => {
|
|
|
550
752
|
const filtered = parts.filter(Boolean).map(formatKey);
|
|
551
753
|
return `--${prefix}-${filtered.join("-")}`;
|
|
552
754
|
};
|
|
755
|
+
var BADGE_VARIANTS = [
|
|
756
|
+
{ variant: "neutral", bgKey: "neutralBg", textKey: "neutralText" },
|
|
757
|
+
{ variant: "info", bgKey: "infoBg", textKey: "infoText" },
|
|
758
|
+
{ variant: "success", bgKey: "successBg", textKey: "successText" },
|
|
759
|
+
{ variant: "warning", bgKey: "warningBg", textKey: "warningText" },
|
|
760
|
+
{ variant: "danger", bgKey: "dangerBg", textKey: "dangerText" }
|
|
761
|
+
];
|
|
762
|
+
var ICON_BOX_FIELDS = [
|
|
763
|
+
{ name: "bg", tokenKey: "bg" },
|
|
764
|
+
{ name: "border", tokenKey: "border" },
|
|
765
|
+
{ name: "icon-default", tokenKey: "iconDefault" },
|
|
766
|
+
{ name: "icon-success", tokenKey: "iconSuccess" },
|
|
767
|
+
{ name: "icon-warning", tokenKey: "iconWarning" },
|
|
768
|
+
{ name: "icon-danger", tokenKey: "iconDanger" }
|
|
769
|
+
];
|
|
553
770
|
var createCssVariableMap = (tokens2, options = {}) => {
|
|
554
771
|
const prefix = options.prefix ?? DEFAULT_PREFIX;
|
|
555
772
|
const map = {};
|
|
773
|
+
const baseTokens = tokens2;
|
|
556
774
|
const assign = (name, value) => {
|
|
775
|
+
const resolved = resolveSemanticValue(value);
|
|
776
|
+
if (resolved !== void 0) {
|
|
777
|
+
map[name] = resolved;
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
557
780
|
if (value === void 0) return;
|
|
558
781
|
map[name] = String(value);
|
|
559
782
|
};
|
|
560
|
-
Object.entries(
|
|
783
|
+
Object.entries(baseTokens.colors).forEach(([group, scale]) => {
|
|
561
784
|
Object.entries(scale).forEach(([step, value]) => {
|
|
562
785
|
assign(toVariableName(prefix, "color", group, step), value);
|
|
563
786
|
});
|
|
564
787
|
});
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
788
|
+
if (baseTokens.space) {
|
|
789
|
+
Object.entries(baseTokens.space).forEach(([key, value]) => {
|
|
790
|
+
assign(toVariableName(prefix, "space", key), value);
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
if (baseTokens.layout) {
|
|
794
|
+
const { section, stack, container } = baseTokens.layout;
|
|
795
|
+
if (section?.padding) {
|
|
796
|
+
Object.entries(section.padding).forEach(([key, value]) => {
|
|
797
|
+
assign(toVariableName(prefix, "layout", "section", "padding", key), value);
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
if (section?.gap) {
|
|
801
|
+
Object.entries(section.gap).forEach(([key, value]) => {
|
|
802
|
+
assign(toVariableName(prefix, "layout", "section", "gap", key), value);
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
if (stack?.gap) {
|
|
806
|
+
Object.entries(stack.gap).forEach(([key, value]) => {
|
|
807
|
+
assign(toVariableName(prefix, "layout", "stack", "gap", key), value);
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
if (container?.paddingInline) {
|
|
811
|
+
Object.entries(container.paddingInline).forEach(([key, value]) => {
|
|
812
|
+
assign(toVariableName(prefix, "layout", "container", "padding-inline", key), value);
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
Object.entries(baseTokens.radii).forEach(([key, value]) => {
|
|
569
817
|
assign(toVariableName(prefix, "radius", key), value);
|
|
570
818
|
});
|
|
571
|
-
Object.entries(
|
|
819
|
+
Object.entries(baseTokens.typography.families).forEach(([key, value]) => {
|
|
572
820
|
assign(toVariableName(prefix, "font-family", key), value);
|
|
573
821
|
});
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
822
|
+
const typographyScale = baseTokens.typography?.scale ?? {};
|
|
823
|
+
const fontScale = baseTokens.font;
|
|
824
|
+
if (fontScale && Object.keys(fontScale).length > 0) {
|
|
825
|
+
Object.entries(fontScale).forEach(([key, entry]) => {
|
|
826
|
+
assign(toVariableName(prefix, "font", key, "size"), entry.size);
|
|
827
|
+
assign(toVariableName(prefix, "font", key, "line-height"), entry.lineHeight);
|
|
828
|
+
assign(toVariableName(prefix, "font", key, "weight"), entry.weight);
|
|
829
|
+
});
|
|
830
|
+
} else {
|
|
831
|
+
Object.entries(typographyScale).forEach(([key, entry]) => {
|
|
832
|
+
assign(toVariableName(prefix, "font", key, "size"), entry.fontSize);
|
|
833
|
+
assign(toVariableName(prefix, "font", key, "line-height"), entry.lineHeight);
|
|
834
|
+
assign(toVariableName(prefix, "font", key, "weight"), entry.fontWeight);
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
Object.entries(typographyScale).forEach(([key, entry]) => {
|
|
578
838
|
assign(toVariableName(prefix, "font", key, "letter-spacing"), entry.letterSpacing);
|
|
579
839
|
});
|
|
580
|
-
|
|
840
|
+
assign(toVariableName(prefix, "text", "on", "page", "default"), tokens2.text.onPage.default);
|
|
841
|
+
assign(toVariableName(prefix, "text", "on", "page", "muted"), tokens2.text.onPage.muted);
|
|
842
|
+
assign(toVariableName(prefix, "text", "on", "surface", "default"), tokens2.text.onSurface.default);
|
|
843
|
+
assign(toVariableName(prefix, "text", "on", "surface", "muted"), tokens2.text.onSurface.muted);
|
|
844
|
+
assign(toVariableName(prefix, "text", "on", "surface", "meta"), tokens2.text.onSurface.meta);
|
|
845
|
+
const badge = tokens2.component?.badge;
|
|
846
|
+
if (badge) {
|
|
847
|
+
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
848
|
+
assign(toVariableName(prefix, "badge", variant, "bg"), badge[bgKey]);
|
|
849
|
+
assign(toVariableName(prefix, "badge", variant, "text"), badge[textKey]);
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
const iconBox = tokens2.component?.iconBox;
|
|
853
|
+
if (iconBox) {
|
|
854
|
+
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
855
|
+
assign(toVariableName(prefix, "icon-box", name), iconBox[tokenKey]);
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
Object.entries(baseTokens.shadows).forEach(([key, value]) => {
|
|
581
859
|
assign(toVariableName(prefix, "shadow", key), value);
|
|
582
860
|
});
|
|
583
|
-
Object.entries(
|
|
861
|
+
Object.entries(baseTokens.breakpoints).forEach(([key, value]) => {
|
|
584
862
|
assign(toVariableName(prefix, "breakpoint", key), value);
|
|
585
863
|
});
|
|
586
|
-
Object.entries(
|
|
864
|
+
Object.entries(baseTokens.zIndex).forEach(([key, value]) => {
|
|
587
865
|
assign(toVariableName(prefix, "z-index", key), value);
|
|
588
866
|
});
|
|
589
|
-
Object.entries(
|
|
867
|
+
Object.entries(baseTokens.transitions.duration).forEach(([key, value]) => {
|
|
590
868
|
assign(toVariableName(prefix, "duration", key), value);
|
|
591
869
|
});
|
|
592
|
-
Object.entries(
|
|
870
|
+
Object.entries(baseTokens.transitions.easing).forEach(([key, value]) => {
|
|
593
871
|
assign(toVariableName(prefix, "easing", key), value);
|
|
594
872
|
});
|
|
595
|
-
Object.entries(
|
|
873
|
+
Object.entries(baseTokens.opacity).forEach(([key, value]) => {
|
|
596
874
|
assign(toVariableName(prefix, "opacity", key), value);
|
|
597
875
|
});
|
|
598
|
-
assign(toVariableName(prefix, "focus-ring-width"),
|
|
599
|
-
assign(toVariableName(prefix, "focus-ring-offset"),
|
|
600
|
-
assign(toVariableName(prefix, "focus-ring-style"),
|
|
601
|
-
assign(toVariableName(prefix, "min-touch-target"),
|
|
602
|
-
assign(toVariableName(prefix, "min-text-size"),
|
|
603
|
-
Object.entries(
|
|
876
|
+
assign(toVariableName(prefix, "focus-ring-width"), baseTokens.accessibility.focusRing.width);
|
|
877
|
+
assign(toVariableName(prefix, "focus-ring-offset"), baseTokens.accessibility.focusRing.offset);
|
|
878
|
+
assign(toVariableName(prefix, "focus-ring-style"), baseTokens.accessibility.focusRing.style);
|
|
879
|
+
assign(toVariableName(prefix, "min-touch-target"), baseTokens.accessibility.minTouchTarget);
|
|
880
|
+
assign(toVariableName(prefix, "min-text-size"), baseTokens.accessibility.minTextSize);
|
|
881
|
+
Object.entries(baseTokens.buttons).forEach(([variant, states]) => {
|
|
604
882
|
Object.entries(states).forEach(([state, value]) => {
|
|
605
883
|
assign(toVariableName(prefix, "button", variant, state), value);
|
|
606
884
|
});
|
|
607
885
|
});
|
|
608
|
-
Object.entries(
|
|
886
|
+
Object.entries(baseTokens.forms).forEach(([state, properties]) => {
|
|
609
887
|
Object.entries(properties).forEach(([prop, value]) => {
|
|
610
888
|
if (value) assign(toVariableName(prefix, "form", state, prop), value);
|
|
611
889
|
});
|
|
612
890
|
});
|
|
613
|
-
Object.entries(
|
|
891
|
+
Object.entries(baseTokens.animations).forEach(([name, animation]) => {
|
|
614
892
|
assign(toVariableName(prefix, "animation", name, "duration"), animation.duration);
|
|
615
893
|
assign(toVariableName(prefix, "animation", name, "easing"), animation.easing);
|
|
616
894
|
assign(toVariableName(prefix, "animation", name, "keyframes"), animation.keyframes);
|
|
@@ -652,14 +930,32 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
652
930
|
addBase(toVariableName(prefix, "surface", "overlay"), pickSemantic(getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"])));
|
|
653
931
|
addBase(toVariableName(prefix, "text", "on", "page", "default"), pickSemantic(getPath(defaultMode, ["text", "onPage", "default"]), getPath(textAliases, ["onPage", "default"])));
|
|
654
932
|
addBase(toVariableName(prefix, "text", "on", "page", "muted"), pickSemantic(getPath(defaultMode, ["text", "onPage", "muted"]), getPath(textAliases, ["onPage", "muted"])));
|
|
933
|
+
addBase(toVariableName(prefix, "text", "on", "page", "meta"), pickSemantic(getPath(defaultMode, ["text", "onPage", "meta"]), getPath(textAliases, ["onPage", "meta"])));
|
|
655
934
|
addBase(toVariableName(prefix, "text", "on", "surface", "default"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "default"]), getPath(textAliases, ["onSurface", "default"])));
|
|
656
935
|
addBase(toVariableName(prefix, "text", "on", "surface", "muted"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "muted"]), getPath(textAliases, ["onSurface", "muted"])));
|
|
936
|
+
addBase(toVariableName(prefix, "text", "on", "surface", "meta"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "meta"]), getPath(textAliases, ["onSurface", "meta"])));
|
|
657
937
|
addBase(toVariableName(prefix, "component", "card", "text"), pickSemantic(getPath(defaultMode, ["component", "card", "text"]), getPath(componentAliases, ["card", "text"])));
|
|
658
938
|
addBase(toVariableName(prefix, "component", "card", "text-muted"), pickSemantic(getPath(defaultMode, ["component", "card", "textMuted"]), getPath(componentAliases, ["card", "textMuted"])));
|
|
659
939
|
addBase(toVariableName(prefix, "component", "input", "text"), pickSemantic(getPath(defaultMode, ["component", "input", "text"]), getPath(componentAliases, ["input", "text"])));
|
|
660
940
|
addBase(toVariableName(prefix, "component", "input", "placeholder"), pickSemantic(getPath(defaultMode, ["component", "input", "placeholder"]), getPath(componentAliases, ["input", "placeholder"])));
|
|
661
941
|
addBase(toVariableName(prefix, "button", "text", "default"), pickSemantic(getPath(defaultMode, ["component", "button", "textDefault"]), getPath(componentAliases, ["button", "textDefault"])));
|
|
662
942
|
addBase(toVariableName(prefix, "button", "text", "on", "primary"), pickSemantic(getPath(defaultMode, ["component", "button", "textOnPrimary"]), getPath(componentAliases, ["button", "textOnPrimary"])));
|
|
943
|
+
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
944
|
+
addBase(
|
|
945
|
+
toVariableName(prefix, "badge", variant, "bg"),
|
|
946
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", bgKey]), getPath(componentAliases, ["badge", bgKey]))
|
|
947
|
+
);
|
|
948
|
+
addBase(
|
|
949
|
+
toVariableName(prefix, "badge", variant, "text"),
|
|
950
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", textKey]), getPath(componentAliases, ["badge", textKey]))
|
|
951
|
+
);
|
|
952
|
+
});
|
|
953
|
+
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
954
|
+
addBase(
|
|
955
|
+
toVariableName(prefix, "icon-box", name),
|
|
956
|
+
pickSemantic(getPath(defaultMode, ["component", "iconBox", tokenKey]), getPath(componentAliases, ["iconBox", tokenKey]))
|
|
957
|
+
);
|
|
958
|
+
});
|
|
663
959
|
const rootLines = [...baseLines, ...mapLines];
|
|
664
960
|
const darkLines = [];
|
|
665
961
|
const addDark = (name, value) => {
|
|
@@ -697,6 +993,14 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
697
993
|
getPath(textAliases, ["onPage", "muted"])
|
|
698
994
|
)
|
|
699
995
|
);
|
|
996
|
+
addDark(
|
|
997
|
+
toVariableName(prefix, "text", "on", "page", "meta"),
|
|
998
|
+
pickSemantic(
|
|
999
|
+
getPath(darkMode, ["text", "onPage", "meta"]),
|
|
1000
|
+
getPath(defaultMode, ["text", "onPage", "meta"]),
|
|
1001
|
+
getPath(textAliases, ["onPage", "meta"])
|
|
1002
|
+
)
|
|
1003
|
+
);
|
|
700
1004
|
addDark(
|
|
701
1005
|
toVariableName(prefix, "text", "on", "surface", "default"),
|
|
702
1006
|
pickSemantic(
|
|
@@ -713,6 +1017,14 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
713
1017
|
getPath(textAliases, ["onSurface", "muted"])
|
|
714
1018
|
)
|
|
715
1019
|
);
|
|
1020
|
+
addDark(
|
|
1021
|
+
toVariableName(prefix, "text", "on", "surface", "meta"),
|
|
1022
|
+
pickSemantic(
|
|
1023
|
+
getPath(darkMode, ["text", "onSurface", "meta"]),
|
|
1024
|
+
getPath(defaultMode, ["text", "onSurface", "meta"]),
|
|
1025
|
+
getPath(textAliases, ["onSurface", "meta"])
|
|
1026
|
+
)
|
|
1027
|
+
);
|
|
716
1028
|
addDark(
|
|
717
1029
|
toVariableName(prefix, "component", "card", "text"),
|
|
718
1030
|
pickSemantic(
|
|
@@ -761,6 +1073,34 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
761
1073
|
getPath(componentAliases, ["button", "textOnPrimary"])
|
|
762
1074
|
)
|
|
763
1075
|
);
|
|
1076
|
+
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
1077
|
+
addDark(
|
|
1078
|
+
toVariableName(prefix, "badge", variant, "bg"),
|
|
1079
|
+
pickSemantic(
|
|
1080
|
+
getPath(darkMode, ["component", "badge", bgKey]),
|
|
1081
|
+
getPath(defaultMode, ["component", "badge", bgKey]),
|
|
1082
|
+
getPath(componentAliases, ["badge", bgKey])
|
|
1083
|
+
)
|
|
1084
|
+
);
|
|
1085
|
+
addDark(
|
|
1086
|
+
toVariableName(prefix, "badge", variant, "text"),
|
|
1087
|
+
pickSemantic(
|
|
1088
|
+
getPath(darkMode, ["component", "badge", textKey]),
|
|
1089
|
+
getPath(defaultMode, ["component", "badge", textKey]),
|
|
1090
|
+
getPath(componentAliases, ["badge", textKey])
|
|
1091
|
+
)
|
|
1092
|
+
);
|
|
1093
|
+
});
|
|
1094
|
+
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
1095
|
+
addDark(
|
|
1096
|
+
toVariableName(prefix, "icon-box", name),
|
|
1097
|
+
pickSemantic(
|
|
1098
|
+
getPath(darkMode, ["component", "iconBox", tokenKey]),
|
|
1099
|
+
getPath(defaultMode, ["component", "iconBox", tokenKey]),
|
|
1100
|
+
getPath(componentAliases, ["iconBox", tokenKey])
|
|
1101
|
+
)
|
|
1102
|
+
);
|
|
1103
|
+
});
|
|
764
1104
|
const rootBlock = `${selector} {
|
|
765
1105
|
${rootLines.join("\n")}
|
|
766
1106
|
}`;
|
|
@@ -797,7 +1137,7 @@ var createTailwindTheme = (source = tokens) => {
|
|
|
797
1137
|
}, {});
|
|
798
1138
|
return {
|
|
799
1139
|
colors,
|
|
800
|
-
spacing: { ...source.
|
|
1140
|
+
spacing: { ...source.space ?? {} },
|
|
801
1141
|
borderRadius: { ...source.radii },
|
|
802
1142
|
fontFamily,
|
|
803
1143
|
fontSize,
|