@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.js
CHANGED
|
@@ -113,12 +113,14 @@ var core_default = {
|
|
|
113
113
|
onPage: {
|
|
114
114
|
default: "#0f172a",
|
|
115
115
|
muted: "#475569",
|
|
116
|
-
subtle: "#94a3b8"
|
|
116
|
+
subtle: "#94a3b8",
|
|
117
|
+
meta: "#94a3b8"
|
|
117
118
|
},
|
|
118
119
|
onSurface: {
|
|
119
120
|
default: "#0f172a",
|
|
120
121
|
muted: "#6b7280",
|
|
121
|
-
subtle: "#94a3b8"
|
|
122
|
+
subtle: "#94a3b8",
|
|
123
|
+
meta: "#94a3b8"
|
|
122
124
|
}
|
|
123
125
|
},
|
|
124
126
|
component: {
|
|
@@ -133,6 +135,26 @@ var core_default = {
|
|
|
133
135
|
button: {
|
|
134
136
|
textDefault: "#0f172a",
|
|
135
137
|
textOnPrimary: "#ffffff"
|
|
138
|
+
},
|
|
139
|
+
badge: {
|
|
140
|
+
neutralBg: "#f1f5f9",
|
|
141
|
+
neutralText: "#334155",
|
|
142
|
+
infoBg: "#dbeafe",
|
|
143
|
+
infoText: "#1d4ed8",
|
|
144
|
+
successBg: "#dcfce7",
|
|
145
|
+
successText: "#15803d",
|
|
146
|
+
warningBg: "#fef3c7",
|
|
147
|
+
warningText: "#b45309",
|
|
148
|
+
dangerBg: "#fee2e2",
|
|
149
|
+
dangerText: "#b91c1c"
|
|
150
|
+
},
|
|
151
|
+
iconBox: {
|
|
152
|
+
bg: "#ffffff",
|
|
153
|
+
border: "#e2e8f0",
|
|
154
|
+
iconDefault: "#6c32e6",
|
|
155
|
+
iconSuccess: "#16a34a",
|
|
156
|
+
iconWarning: "#d97706",
|
|
157
|
+
iconDanger: "#dc2626"
|
|
136
158
|
}
|
|
137
159
|
},
|
|
138
160
|
modes: {
|
|
@@ -161,6 +183,9 @@ var core_default = {
|
|
|
161
183
|
},
|
|
162
184
|
subtle: {
|
|
163
185
|
value: "#94a3b8"
|
|
186
|
+
},
|
|
187
|
+
meta: {
|
|
188
|
+
value: "#94a3b8"
|
|
164
189
|
}
|
|
165
190
|
},
|
|
166
191
|
onSurface: {
|
|
@@ -172,6 +197,9 @@ var core_default = {
|
|
|
172
197
|
},
|
|
173
198
|
subtle: {
|
|
174
199
|
value: "#94a3b8"
|
|
200
|
+
},
|
|
201
|
+
meta: {
|
|
202
|
+
value: "#94a3b8"
|
|
175
203
|
}
|
|
176
204
|
}
|
|
177
205
|
},
|
|
@@ -199,6 +227,58 @@ var core_default = {
|
|
|
199
227
|
textOnPrimary: {
|
|
200
228
|
value: "#ffffff"
|
|
201
229
|
}
|
|
230
|
+
},
|
|
231
|
+
badge: {
|
|
232
|
+
neutralBg: {
|
|
233
|
+
value: "#f1f5f9"
|
|
234
|
+
},
|
|
235
|
+
neutralText: {
|
|
236
|
+
value: "#334155"
|
|
237
|
+
},
|
|
238
|
+
infoBg: {
|
|
239
|
+
value: "#dbeafe"
|
|
240
|
+
},
|
|
241
|
+
infoText: {
|
|
242
|
+
value: "#1d4ed8"
|
|
243
|
+
},
|
|
244
|
+
successBg: {
|
|
245
|
+
value: "#dcfce7"
|
|
246
|
+
},
|
|
247
|
+
successText: {
|
|
248
|
+
value: "#15803d"
|
|
249
|
+
},
|
|
250
|
+
warningBg: {
|
|
251
|
+
value: "#fef3c7"
|
|
252
|
+
},
|
|
253
|
+
warningText: {
|
|
254
|
+
value: "#b45309"
|
|
255
|
+
},
|
|
256
|
+
dangerBg: {
|
|
257
|
+
value: "#fee2e2"
|
|
258
|
+
},
|
|
259
|
+
dangerText: {
|
|
260
|
+
value: "#b91c1c"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
iconBox: {
|
|
264
|
+
bg: {
|
|
265
|
+
value: "#ffffff"
|
|
266
|
+
},
|
|
267
|
+
border: {
|
|
268
|
+
value: "#e2e8f0"
|
|
269
|
+
},
|
|
270
|
+
iconDefault: {
|
|
271
|
+
value: "#6c32e6"
|
|
272
|
+
},
|
|
273
|
+
iconSuccess: {
|
|
274
|
+
value: "#16a34a"
|
|
275
|
+
},
|
|
276
|
+
iconWarning: {
|
|
277
|
+
value: "#d97706"
|
|
278
|
+
},
|
|
279
|
+
iconDanger: {
|
|
280
|
+
value: "#dc2626"
|
|
281
|
+
}
|
|
202
282
|
}
|
|
203
283
|
}
|
|
204
284
|
},
|
|
@@ -227,6 +307,9 @@ var core_default = {
|
|
|
227
307
|
},
|
|
228
308
|
subtle: {
|
|
229
309
|
value: "#94a3b8"
|
|
310
|
+
},
|
|
311
|
+
meta: {
|
|
312
|
+
value: "#94a3b8"
|
|
230
313
|
}
|
|
231
314
|
},
|
|
232
315
|
onSurface: {
|
|
@@ -238,6 +321,9 @@ var core_default = {
|
|
|
238
321
|
},
|
|
239
322
|
subtle: {
|
|
240
323
|
value: "#94a3b8"
|
|
324
|
+
},
|
|
325
|
+
meta: {
|
|
326
|
+
value: "#94a3b8"
|
|
241
327
|
}
|
|
242
328
|
}
|
|
243
329
|
},
|
|
@@ -265,6 +351,58 @@ var core_default = {
|
|
|
265
351
|
textOnPrimary: {
|
|
266
352
|
value: "#ffffff"
|
|
267
353
|
}
|
|
354
|
+
},
|
|
355
|
+
badge: {
|
|
356
|
+
neutralBg: {
|
|
357
|
+
value: "#334155"
|
|
358
|
+
},
|
|
359
|
+
neutralText: {
|
|
360
|
+
value: "#f1f5f9"
|
|
361
|
+
},
|
|
362
|
+
infoBg: {
|
|
363
|
+
value: "#1e40af"
|
|
364
|
+
},
|
|
365
|
+
infoText: {
|
|
366
|
+
value: "#dbeafe"
|
|
367
|
+
},
|
|
368
|
+
successBg: {
|
|
369
|
+
value: "#166534"
|
|
370
|
+
},
|
|
371
|
+
successText: {
|
|
372
|
+
value: "#dcfce7"
|
|
373
|
+
},
|
|
374
|
+
warningBg: {
|
|
375
|
+
value: "#92400e"
|
|
376
|
+
},
|
|
377
|
+
warningText: {
|
|
378
|
+
value: "#fef3c7"
|
|
379
|
+
},
|
|
380
|
+
dangerBg: {
|
|
381
|
+
value: "#991b1b"
|
|
382
|
+
},
|
|
383
|
+
dangerText: {
|
|
384
|
+
value: "#fee2e2"
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
iconBox: {
|
|
388
|
+
bg: {
|
|
389
|
+
value: "#1e293b"
|
|
390
|
+
},
|
|
391
|
+
border: {
|
|
392
|
+
value: "#334155"
|
|
393
|
+
},
|
|
394
|
+
iconDefault: {
|
|
395
|
+
value: "#a37aff"
|
|
396
|
+
},
|
|
397
|
+
iconSuccess: {
|
|
398
|
+
value: "#4ade80"
|
|
399
|
+
},
|
|
400
|
+
iconWarning: {
|
|
401
|
+
value: "#fbbf24"
|
|
402
|
+
},
|
|
403
|
+
iconDanger: {
|
|
404
|
+
value: "#f87171"
|
|
405
|
+
}
|
|
268
406
|
}
|
|
269
407
|
}
|
|
270
408
|
}
|
|
@@ -360,17 +498,49 @@ var core_default = {
|
|
|
360
498
|
text: "#94a3b8"
|
|
361
499
|
}
|
|
362
500
|
},
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
501
|
+
layout: {
|
|
502
|
+
section: {
|
|
503
|
+
padding: {
|
|
504
|
+
sm: "1.5rem",
|
|
505
|
+
md: "2rem",
|
|
506
|
+
lg: "3rem"
|
|
507
|
+
},
|
|
508
|
+
gap: {
|
|
509
|
+
sm: "1rem",
|
|
510
|
+
md: "1.5rem",
|
|
511
|
+
lg: "2rem"
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
stack: {
|
|
515
|
+
gap: {
|
|
516
|
+
sm: "0.5rem",
|
|
517
|
+
md: "0.75rem",
|
|
518
|
+
lg: "1rem"
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
container: {
|
|
522
|
+
paddingInline: {
|
|
523
|
+
sm: "1rem",
|
|
524
|
+
md: "1.5rem",
|
|
525
|
+
lg: "2rem"
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
space: {
|
|
530
|
+
"0": "0rem",
|
|
531
|
+
"4": "0.25rem",
|
|
532
|
+
"8": "0.5rem",
|
|
533
|
+
"12": "0.75rem",
|
|
534
|
+
"16": "1rem",
|
|
535
|
+
"20": "1.25rem",
|
|
536
|
+
"24": "1.5rem",
|
|
537
|
+
"32": "2rem",
|
|
538
|
+
"40": "2.5rem",
|
|
539
|
+
"48": "3rem",
|
|
540
|
+
"56": "3.5rem",
|
|
541
|
+
"64": "4rem",
|
|
542
|
+
"80": "5rem",
|
|
543
|
+
"96": "6rem"
|
|
374
544
|
},
|
|
375
545
|
radii: {
|
|
376
546
|
none: "0",
|
|
@@ -383,6 +553,38 @@ var core_default = {
|
|
|
383
553
|
card: "#334155",
|
|
384
554
|
input: "#cbd5f5"
|
|
385
555
|
},
|
|
556
|
+
font: {
|
|
557
|
+
xs: {
|
|
558
|
+
size: "0.75rem",
|
|
559
|
+
lineHeight: "1.25rem",
|
|
560
|
+
weight: 400
|
|
561
|
+
},
|
|
562
|
+
sm: {
|
|
563
|
+
size: "0.875rem",
|
|
564
|
+
lineHeight: "1.5rem",
|
|
565
|
+
weight: 400
|
|
566
|
+
},
|
|
567
|
+
md: {
|
|
568
|
+
size: "1rem",
|
|
569
|
+
lineHeight: "1.75rem",
|
|
570
|
+
weight: 500
|
|
571
|
+
},
|
|
572
|
+
lg: {
|
|
573
|
+
size: "1.25rem",
|
|
574
|
+
lineHeight: "2rem",
|
|
575
|
+
weight: 500
|
|
576
|
+
},
|
|
577
|
+
xl: {
|
|
578
|
+
size: "1.5rem",
|
|
579
|
+
lineHeight: "2.125rem",
|
|
580
|
+
weight: 600
|
|
581
|
+
},
|
|
582
|
+
"2xl": {
|
|
583
|
+
size: "1.875rem",
|
|
584
|
+
lineHeight: "2.5rem",
|
|
585
|
+
weight: 600
|
|
586
|
+
}
|
|
587
|
+
},
|
|
386
588
|
typography: {
|
|
387
589
|
families: {
|
|
388
590
|
sans: "'Inter', 'Helvetica Neue', Arial, sans-serif",
|
|
@@ -520,67 +722,143 @@ var toVariableName = (prefix, ...parts) => {
|
|
|
520
722
|
const filtered = parts.filter(Boolean).map(formatKey);
|
|
521
723
|
return `--${prefix}-${filtered.join("-")}`;
|
|
522
724
|
};
|
|
725
|
+
var BADGE_VARIANTS = [
|
|
726
|
+
{ variant: "neutral", bgKey: "neutralBg", textKey: "neutralText" },
|
|
727
|
+
{ variant: "info", bgKey: "infoBg", textKey: "infoText" },
|
|
728
|
+
{ variant: "success", bgKey: "successBg", textKey: "successText" },
|
|
729
|
+
{ variant: "warning", bgKey: "warningBg", textKey: "warningText" },
|
|
730
|
+
{ variant: "danger", bgKey: "dangerBg", textKey: "dangerText" }
|
|
731
|
+
];
|
|
732
|
+
var ICON_BOX_FIELDS = [
|
|
733
|
+
{ name: "bg", tokenKey: "bg" },
|
|
734
|
+
{ name: "border", tokenKey: "border" },
|
|
735
|
+
{ name: "icon-default", tokenKey: "iconDefault" },
|
|
736
|
+
{ name: "icon-success", tokenKey: "iconSuccess" },
|
|
737
|
+
{ name: "icon-warning", tokenKey: "iconWarning" },
|
|
738
|
+
{ name: "icon-danger", tokenKey: "iconDanger" }
|
|
739
|
+
];
|
|
523
740
|
var createCssVariableMap = (tokens2, options = {}) => {
|
|
524
741
|
const prefix = options.prefix ?? DEFAULT_PREFIX;
|
|
525
742
|
const map = {};
|
|
743
|
+
const baseTokens = tokens2;
|
|
526
744
|
const assign = (name, value) => {
|
|
745
|
+
const resolved = resolveSemanticValue(value);
|
|
746
|
+
if (resolved !== void 0) {
|
|
747
|
+
map[name] = resolved;
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
527
750
|
if (value === void 0) return;
|
|
528
751
|
map[name] = String(value);
|
|
529
752
|
};
|
|
530
|
-
Object.entries(
|
|
753
|
+
Object.entries(baseTokens.colors).forEach(([group, scale]) => {
|
|
531
754
|
Object.entries(scale).forEach(([step, value]) => {
|
|
532
755
|
assign(toVariableName(prefix, "color", group, step), value);
|
|
533
756
|
});
|
|
534
757
|
});
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
758
|
+
if (baseTokens.space) {
|
|
759
|
+
Object.entries(baseTokens.space).forEach(([key, value]) => {
|
|
760
|
+
assign(toVariableName(prefix, "space", key), value);
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
if (baseTokens.layout) {
|
|
764
|
+
const { section, stack, container } = baseTokens.layout;
|
|
765
|
+
if (section?.padding) {
|
|
766
|
+
Object.entries(section.padding).forEach(([key, value]) => {
|
|
767
|
+
assign(toVariableName(prefix, "layout", "section", "padding", key), value);
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
if (section?.gap) {
|
|
771
|
+
Object.entries(section.gap).forEach(([key, value]) => {
|
|
772
|
+
assign(toVariableName(prefix, "layout", "section", "gap", key), value);
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
if (stack?.gap) {
|
|
776
|
+
Object.entries(stack.gap).forEach(([key, value]) => {
|
|
777
|
+
assign(toVariableName(prefix, "layout", "stack", "gap", key), value);
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
if (container?.paddingInline) {
|
|
781
|
+
Object.entries(container.paddingInline).forEach(([key, value]) => {
|
|
782
|
+
assign(toVariableName(prefix, "layout", "container", "padding-inline", key), value);
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
Object.entries(baseTokens.radii).forEach(([key, value]) => {
|
|
539
787
|
assign(toVariableName(prefix, "radius", key), value);
|
|
540
788
|
});
|
|
541
|
-
Object.entries(
|
|
789
|
+
Object.entries(baseTokens.typography.families).forEach(([key, value]) => {
|
|
542
790
|
assign(toVariableName(prefix, "font-family", key), value);
|
|
543
791
|
});
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
792
|
+
const typographyScale = baseTokens.typography?.scale ?? {};
|
|
793
|
+
const fontScale = baseTokens.font;
|
|
794
|
+
if (fontScale && Object.keys(fontScale).length > 0) {
|
|
795
|
+
Object.entries(fontScale).forEach(([key, entry]) => {
|
|
796
|
+
assign(toVariableName(prefix, "font", key, "size"), entry.size);
|
|
797
|
+
assign(toVariableName(prefix, "font", key, "line-height"), entry.lineHeight);
|
|
798
|
+
assign(toVariableName(prefix, "font", key, "weight"), entry.weight);
|
|
799
|
+
});
|
|
800
|
+
} else {
|
|
801
|
+
Object.entries(typographyScale).forEach(([key, entry]) => {
|
|
802
|
+
assign(toVariableName(prefix, "font", key, "size"), entry.fontSize);
|
|
803
|
+
assign(toVariableName(prefix, "font", key, "line-height"), entry.lineHeight);
|
|
804
|
+
assign(toVariableName(prefix, "font", key, "weight"), entry.fontWeight);
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
Object.entries(typographyScale).forEach(([key, entry]) => {
|
|
548
808
|
assign(toVariableName(prefix, "font", key, "letter-spacing"), entry.letterSpacing);
|
|
549
809
|
});
|
|
550
|
-
|
|
810
|
+
assign(toVariableName(prefix, "text", "on", "page", "default"), tokens2.text.onPage.default);
|
|
811
|
+
assign(toVariableName(prefix, "text", "on", "page", "muted"), tokens2.text.onPage.muted);
|
|
812
|
+
assign(toVariableName(prefix, "text", "on", "surface", "default"), tokens2.text.onSurface.default);
|
|
813
|
+
assign(toVariableName(prefix, "text", "on", "surface", "muted"), tokens2.text.onSurface.muted);
|
|
814
|
+
assign(toVariableName(prefix, "text", "on", "surface", "meta"), tokens2.text.onSurface.meta);
|
|
815
|
+
const badge = tokens2.component?.badge;
|
|
816
|
+
if (badge) {
|
|
817
|
+
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
818
|
+
assign(toVariableName(prefix, "badge", variant, "bg"), badge[bgKey]);
|
|
819
|
+
assign(toVariableName(prefix, "badge", variant, "text"), badge[textKey]);
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
const iconBox = tokens2.component?.iconBox;
|
|
823
|
+
if (iconBox) {
|
|
824
|
+
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
825
|
+
assign(toVariableName(prefix, "icon-box", name), iconBox[tokenKey]);
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
Object.entries(baseTokens.shadows).forEach(([key, value]) => {
|
|
551
829
|
assign(toVariableName(prefix, "shadow", key), value);
|
|
552
830
|
});
|
|
553
|
-
Object.entries(
|
|
831
|
+
Object.entries(baseTokens.breakpoints).forEach(([key, value]) => {
|
|
554
832
|
assign(toVariableName(prefix, "breakpoint", key), value);
|
|
555
833
|
});
|
|
556
|
-
Object.entries(
|
|
834
|
+
Object.entries(baseTokens.zIndex).forEach(([key, value]) => {
|
|
557
835
|
assign(toVariableName(prefix, "z-index", key), value);
|
|
558
836
|
});
|
|
559
|
-
Object.entries(
|
|
837
|
+
Object.entries(baseTokens.transitions.duration).forEach(([key, value]) => {
|
|
560
838
|
assign(toVariableName(prefix, "duration", key), value);
|
|
561
839
|
});
|
|
562
|
-
Object.entries(
|
|
840
|
+
Object.entries(baseTokens.transitions.easing).forEach(([key, value]) => {
|
|
563
841
|
assign(toVariableName(prefix, "easing", key), value);
|
|
564
842
|
});
|
|
565
|
-
Object.entries(
|
|
843
|
+
Object.entries(baseTokens.opacity).forEach(([key, value]) => {
|
|
566
844
|
assign(toVariableName(prefix, "opacity", key), value);
|
|
567
845
|
});
|
|
568
|
-
assign(toVariableName(prefix, "focus-ring-width"),
|
|
569
|
-
assign(toVariableName(prefix, "focus-ring-offset"),
|
|
570
|
-
assign(toVariableName(prefix, "focus-ring-style"),
|
|
571
|
-
assign(toVariableName(prefix, "min-touch-target"),
|
|
572
|
-
assign(toVariableName(prefix, "min-text-size"),
|
|
573
|
-
Object.entries(
|
|
846
|
+
assign(toVariableName(prefix, "focus-ring-width"), baseTokens.accessibility.focusRing.width);
|
|
847
|
+
assign(toVariableName(prefix, "focus-ring-offset"), baseTokens.accessibility.focusRing.offset);
|
|
848
|
+
assign(toVariableName(prefix, "focus-ring-style"), baseTokens.accessibility.focusRing.style);
|
|
849
|
+
assign(toVariableName(prefix, "min-touch-target"), baseTokens.accessibility.minTouchTarget);
|
|
850
|
+
assign(toVariableName(prefix, "min-text-size"), baseTokens.accessibility.minTextSize);
|
|
851
|
+
Object.entries(baseTokens.buttons).forEach(([variant, states]) => {
|
|
574
852
|
Object.entries(states).forEach(([state, value]) => {
|
|
575
853
|
assign(toVariableName(prefix, "button", variant, state), value);
|
|
576
854
|
});
|
|
577
855
|
});
|
|
578
|
-
Object.entries(
|
|
856
|
+
Object.entries(baseTokens.forms).forEach(([state, properties]) => {
|
|
579
857
|
Object.entries(properties).forEach(([prop, value]) => {
|
|
580
858
|
if (value) assign(toVariableName(prefix, "form", state, prop), value);
|
|
581
859
|
});
|
|
582
860
|
});
|
|
583
|
-
Object.entries(
|
|
861
|
+
Object.entries(baseTokens.animations).forEach(([name, animation]) => {
|
|
584
862
|
assign(toVariableName(prefix, "animation", name, "duration"), animation.duration);
|
|
585
863
|
assign(toVariableName(prefix, "animation", name, "easing"), animation.easing);
|
|
586
864
|
assign(toVariableName(prefix, "animation", name, "keyframes"), animation.keyframes);
|
|
@@ -622,14 +900,32 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
622
900
|
addBase(toVariableName(prefix, "surface", "overlay"), pickSemantic(getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"])));
|
|
623
901
|
addBase(toVariableName(prefix, "text", "on", "page", "default"), pickSemantic(getPath(defaultMode, ["text", "onPage", "default"]), getPath(textAliases, ["onPage", "default"])));
|
|
624
902
|
addBase(toVariableName(prefix, "text", "on", "page", "muted"), pickSemantic(getPath(defaultMode, ["text", "onPage", "muted"]), getPath(textAliases, ["onPage", "muted"])));
|
|
903
|
+
addBase(toVariableName(prefix, "text", "on", "page", "meta"), pickSemantic(getPath(defaultMode, ["text", "onPage", "meta"]), getPath(textAliases, ["onPage", "meta"])));
|
|
625
904
|
addBase(toVariableName(prefix, "text", "on", "surface", "default"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "default"]), getPath(textAliases, ["onSurface", "default"])));
|
|
626
905
|
addBase(toVariableName(prefix, "text", "on", "surface", "muted"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "muted"]), getPath(textAliases, ["onSurface", "muted"])));
|
|
906
|
+
addBase(toVariableName(prefix, "text", "on", "surface", "meta"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "meta"]), getPath(textAliases, ["onSurface", "meta"])));
|
|
627
907
|
addBase(toVariableName(prefix, "component", "card", "text"), pickSemantic(getPath(defaultMode, ["component", "card", "text"]), getPath(componentAliases, ["card", "text"])));
|
|
628
908
|
addBase(toVariableName(prefix, "component", "card", "text-muted"), pickSemantic(getPath(defaultMode, ["component", "card", "textMuted"]), getPath(componentAliases, ["card", "textMuted"])));
|
|
629
909
|
addBase(toVariableName(prefix, "component", "input", "text"), pickSemantic(getPath(defaultMode, ["component", "input", "text"]), getPath(componentAliases, ["input", "text"])));
|
|
630
910
|
addBase(toVariableName(prefix, "component", "input", "placeholder"), pickSemantic(getPath(defaultMode, ["component", "input", "placeholder"]), getPath(componentAliases, ["input", "placeholder"])));
|
|
631
911
|
addBase(toVariableName(prefix, "button", "text", "default"), pickSemantic(getPath(defaultMode, ["component", "button", "textDefault"]), getPath(componentAliases, ["button", "textDefault"])));
|
|
632
912
|
addBase(toVariableName(prefix, "button", "text", "on", "primary"), pickSemantic(getPath(defaultMode, ["component", "button", "textOnPrimary"]), getPath(componentAliases, ["button", "textOnPrimary"])));
|
|
913
|
+
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
914
|
+
addBase(
|
|
915
|
+
toVariableName(prefix, "badge", variant, "bg"),
|
|
916
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", bgKey]), getPath(componentAliases, ["badge", bgKey]))
|
|
917
|
+
);
|
|
918
|
+
addBase(
|
|
919
|
+
toVariableName(prefix, "badge", variant, "text"),
|
|
920
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", textKey]), getPath(componentAliases, ["badge", textKey]))
|
|
921
|
+
);
|
|
922
|
+
});
|
|
923
|
+
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
924
|
+
addBase(
|
|
925
|
+
toVariableName(prefix, "icon-box", name),
|
|
926
|
+
pickSemantic(getPath(defaultMode, ["component", "iconBox", tokenKey]), getPath(componentAliases, ["iconBox", tokenKey]))
|
|
927
|
+
);
|
|
928
|
+
});
|
|
633
929
|
const rootLines = [...baseLines, ...mapLines];
|
|
634
930
|
const darkLines = [];
|
|
635
931
|
const addDark = (name, value) => {
|
|
@@ -667,6 +963,14 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
667
963
|
getPath(textAliases, ["onPage", "muted"])
|
|
668
964
|
)
|
|
669
965
|
);
|
|
966
|
+
addDark(
|
|
967
|
+
toVariableName(prefix, "text", "on", "page", "meta"),
|
|
968
|
+
pickSemantic(
|
|
969
|
+
getPath(darkMode, ["text", "onPage", "meta"]),
|
|
970
|
+
getPath(defaultMode, ["text", "onPage", "meta"]),
|
|
971
|
+
getPath(textAliases, ["onPage", "meta"])
|
|
972
|
+
)
|
|
973
|
+
);
|
|
670
974
|
addDark(
|
|
671
975
|
toVariableName(prefix, "text", "on", "surface", "default"),
|
|
672
976
|
pickSemantic(
|
|
@@ -683,6 +987,14 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
683
987
|
getPath(textAliases, ["onSurface", "muted"])
|
|
684
988
|
)
|
|
685
989
|
);
|
|
990
|
+
addDark(
|
|
991
|
+
toVariableName(prefix, "text", "on", "surface", "meta"),
|
|
992
|
+
pickSemantic(
|
|
993
|
+
getPath(darkMode, ["text", "onSurface", "meta"]),
|
|
994
|
+
getPath(defaultMode, ["text", "onSurface", "meta"]),
|
|
995
|
+
getPath(textAliases, ["onSurface", "meta"])
|
|
996
|
+
)
|
|
997
|
+
);
|
|
686
998
|
addDark(
|
|
687
999
|
toVariableName(prefix, "component", "card", "text"),
|
|
688
1000
|
pickSemantic(
|
|
@@ -731,6 +1043,34 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
731
1043
|
getPath(componentAliases, ["button", "textOnPrimary"])
|
|
732
1044
|
)
|
|
733
1045
|
);
|
|
1046
|
+
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
1047
|
+
addDark(
|
|
1048
|
+
toVariableName(prefix, "badge", variant, "bg"),
|
|
1049
|
+
pickSemantic(
|
|
1050
|
+
getPath(darkMode, ["component", "badge", bgKey]),
|
|
1051
|
+
getPath(defaultMode, ["component", "badge", bgKey]),
|
|
1052
|
+
getPath(componentAliases, ["badge", bgKey])
|
|
1053
|
+
)
|
|
1054
|
+
);
|
|
1055
|
+
addDark(
|
|
1056
|
+
toVariableName(prefix, "badge", variant, "text"),
|
|
1057
|
+
pickSemantic(
|
|
1058
|
+
getPath(darkMode, ["component", "badge", textKey]),
|
|
1059
|
+
getPath(defaultMode, ["component", "badge", textKey]),
|
|
1060
|
+
getPath(componentAliases, ["badge", textKey])
|
|
1061
|
+
)
|
|
1062
|
+
);
|
|
1063
|
+
});
|
|
1064
|
+
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
1065
|
+
addDark(
|
|
1066
|
+
toVariableName(prefix, "icon-box", name),
|
|
1067
|
+
pickSemantic(
|
|
1068
|
+
getPath(darkMode, ["component", "iconBox", tokenKey]),
|
|
1069
|
+
getPath(defaultMode, ["component", "iconBox", tokenKey]),
|
|
1070
|
+
getPath(componentAliases, ["iconBox", tokenKey])
|
|
1071
|
+
)
|
|
1072
|
+
);
|
|
1073
|
+
});
|
|
734
1074
|
const rootBlock = `${selector} {
|
|
735
1075
|
${rootLines.join("\n")}
|
|
736
1076
|
}`;
|
|
@@ -767,7 +1107,7 @@ var createTailwindTheme = (source = tokens) => {
|
|
|
767
1107
|
}, {});
|
|
768
1108
|
return {
|
|
769
1109
|
colors,
|
|
770
|
-
spacing: { ...source.
|
|
1110
|
+
spacing: { ...source.space ?? {} },
|
|
771
1111
|
borderRadius: { ...source.radii },
|
|
772
1112
|
fontFamily,
|
|
773
1113
|
fontSize,
|