@phcdevworks/spectre-tokens 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1287 -38
- package/dist/index.cjs +277 -191
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +81 -34
- package/dist/index.d.cts +57 -68
- package/dist/index.d.ts +57 -68
- package/dist/index.js +277 -191
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tokens/core.json +159 -89
package/dist/index.cjs
CHANGED
|
@@ -167,22 +167,24 @@ var core_default = {
|
|
|
167
167
|
textOnPrimary: "#ffffff"
|
|
168
168
|
},
|
|
169
169
|
badge: {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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"
|
|
186
188
|
}
|
|
187
189
|
},
|
|
188
190
|
modes: {
|
|
@@ -257,37 +259,55 @@ var core_default = {
|
|
|
257
259
|
}
|
|
258
260
|
},
|
|
259
261
|
badge: {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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"
|
|
267
282
|
},
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
value: "#22c55e"
|
|
271
|
-
},
|
|
272
|
-
text: {
|
|
273
|
-
value: "#0f172a"
|
|
274
|
-
}
|
|
283
|
+
warningText: {
|
|
284
|
+
value: "#b45309"
|
|
275
285
|
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
value: "#f59e0b"
|
|
279
|
-
},
|
|
280
|
-
text: {
|
|
281
|
-
value: "#0f172a"
|
|
282
|
-
}
|
|
286
|
+
dangerBg: {
|
|
287
|
+
value: "#fee2e2"
|
|
283
288
|
},
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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"
|
|
291
311
|
}
|
|
292
312
|
}
|
|
293
313
|
}
|
|
@@ -363,37 +383,55 @@ var core_default = {
|
|
|
363
383
|
}
|
|
364
384
|
},
|
|
365
385
|
badge: {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
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"
|
|
373
400
|
},
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
value: "#22c55e"
|
|
377
|
-
},
|
|
378
|
-
text: {
|
|
379
|
-
value: "#f1f5f9"
|
|
380
|
-
}
|
|
401
|
+
successText: {
|
|
402
|
+
value: "#dcfce7"
|
|
381
403
|
},
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
value: "#f59e0b"
|
|
385
|
-
},
|
|
386
|
-
text: {
|
|
387
|
-
value: "#f1f5f9"
|
|
388
|
-
}
|
|
404
|
+
warningBg: {
|
|
405
|
+
value: "#92400e"
|
|
389
406
|
},
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
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"
|
|
397
435
|
}
|
|
398
436
|
}
|
|
399
437
|
}
|
|
@@ -490,17 +528,49 @@ var core_default = {
|
|
|
490
528
|
text: "#94a3b8"
|
|
491
529
|
}
|
|
492
530
|
},
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
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"
|
|
504
574
|
},
|
|
505
575
|
radii: {
|
|
506
576
|
none: "0",
|
|
@@ -682,11 +752,31 @@ var toVariableName = (prefix, ...parts) => {
|
|
|
682
752
|
const filtered = parts.filter(Boolean).map(formatKey);
|
|
683
753
|
return `--${prefix}-${filtered.join("-")}`;
|
|
684
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
|
+
];
|
|
685
770
|
var createCssVariableMap = (tokens2, options = {}) => {
|
|
686
771
|
const prefix = options.prefix ?? DEFAULT_PREFIX;
|
|
687
772
|
const map = {};
|
|
688
773
|
const baseTokens = tokens2;
|
|
689
774
|
const assign = (name, value) => {
|
|
775
|
+
const resolved = resolveSemanticValue(value);
|
|
776
|
+
if (resolved !== void 0) {
|
|
777
|
+
map[name] = resolved;
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
690
780
|
if (value === void 0) return;
|
|
691
781
|
map[name] = String(value);
|
|
692
782
|
};
|
|
@@ -695,9 +785,34 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
695
785
|
assign(toVariableName(prefix, "color", group, step), value);
|
|
696
786
|
});
|
|
697
787
|
});
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
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
|
+
}
|
|
701
816
|
Object.entries(baseTokens.radii).forEach(([key, value]) => {
|
|
702
817
|
assign(toVariableName(prefix, "radius", key), value);
|
|
703
818
|
});
|
|
@@ -724,19 +839,24 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
724
839
|
});
|
|
725
840
|
assign(toVariableName(prefix, "text", "on", "page", "default"), tokens2.text.onPage.default);
|
|
726
841
|
assign(toVariableName(prefix, "text", "on", "page", "muted"), tokens2.text.onPage.muted);
|
|
842
|
+
assign(toVariableName(prefix, "text", "on", "page", "subtle"), tokens2.text.onPage.subtle);
|
|
843
|
+
assign(toVariableName(prefix, "text", "on", "page", "meta"), tokens2.text.onPage.meta);
|
|
727
844
|
assign(toVariableName(prefix, "text", "on", "surface", "default"), tokens2.text.onSurface.default);
|
|
728
845
|
assign(toVariableName(prefix, "text", "on", "surface", "muted"), tokens2.text.onSurface.muted);
|
|
846
|
+
assign(toVariableName(prefix, "text", "on", "surface", "subtle"), tokens2.text.onSurface.subtle);
|
|
729
847
|
assign(toVariableName(prefix, "text", "on", "surface", "meta"), tokens2.text.onSurface.meta);
|
|
730
848
|
const badge = tokens2.component?.badge;
|
|
731
849
|
if (badge) {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
850
|
+
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
851
|
+
assign(toVariableName(prefix, "badge", variant, "bg"), badge[bgKey]);
|
|
852
|
+
assign(toVariableName(prefix, "badge", variant, "text"), badge[textKey]);
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
const iconBox = tokens2.component?.iconBox;
|
|
856
|
+
if (iconBox) {
|
|
857
|
+
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
858
|
+
assign(toVariableName(prefix, "icon-box", name), iconBox[tokenKey]);
|
|
859
|
+
});
|
|
740
860
|
}
|
|
741
861
|
Object.entries(baseTokens.shadows).forEach(([key, value]) => {
|
|
742
862
|
assign(toVariableName(prefix, "shadow", key), value);
|
|
@@ -813,9 +933,11 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
813
933
|
addBase(toVariableName(prefix, "surface", "overlay"), pickSemantic(getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"])));
|
|
814
934
|
addBase(toVariableName(prefix, "text", "on", "page", "default"), pickSemantic(getPath(defaultMode, ["text", "onPage", "default"]), getPath(textAliases, ["onPage", "default"])));
|
|
815
935
|
addBase(toVariableName(prefix, "text", "on", "page", "muted"), pickSemantic(getPath(defaultMode, ["text", "onPage", "muted"]), getPath(textAliases, ["onPage", "muted"])));
|
|
936
|
+
addBase(toVariableName(prefix, "text", "on", "page", "subtle"), pickSemantic(getPath(defaultMode, ["text", "onPage", "subtle"]), getPath(textAliases, ["onPage", "subtle"])));
|
|
816
937
|
addBase(toVariableName(prefix, "text", "on", "page", "meta"), pickSemantic(getPath(defaultMode, ["text", "onPage", "meta"]), getPath(textAliases, ["onPage", "meta"])));
|
|
817
938
|
addBase(toVariableName(prefix, "text", "on", "surface", "default"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "default"]), getPath(textAliases, ["onSurface", "default"])));
|
|
818
939
|
addBase(toVariableName(prefix, "text", "on", "surface", "muted"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "muted"]), getPath(textAliases, ["onSurface", "muted"])));
|
|
940
|
+
addBase(toVariableName(prefix, "text", "on", "surface", "subtle"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "subtle"]), getPath(textAliases, ["onSurface", "subtle"])));
|
|
819
941
|
addBase(toVariableName(prefix, "text", "on", "surface", "meta"), pickSemantic(getPath(defaultMode, ["text", "onSurface", "meta"]), getPath(textAliases, ["onSurface", "meta"])));
|
|
820
942
|
addBase(toVariableName(prefix, "component", "card", "text"), pickSemantic(getPath(defaultMode, ["component", "card", "text"]), getPath(componentAliases, ["card", "text"])));
|
|
821
943
|
addBase(toVariableName(prefix, "component", "card", "text-muted"), pickSemantic(getPath(defaultMode, ["component", "card", "textMuted"]), getPath(componentAliases, ["card", "textMuted"])));
|
|
@@ -823,38 +945,22 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
823
945
|
addBase(toVariableName(prefix, "component", "input", "placeholder"), pickSemantic(getPath(defaultMode, ["component", "input", "placeholder"]), getPath(componentAliases, ["input", "placeholder"])));
|
|
824
946
|
addBase(toVariableName(prefix, "button", "text", "default"), pickSemantic(getPath(defaultMode, ["component", "button", "textDefault"]), getPath(componentAliases, ["button", "textDefault"])));
|
|
825
947
|
addBase(toVariableName(prefix, "button", "text", "on", "primary"), pickSemantic(getPath(defaultMode, ["component", "button", "textOnPrimary"]), getPath(componentAliases, ["button", "textOnPrimary"])));
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
);
|
|
842
|
-
addBase(
|
|
843
|
-
toVariableName(prefix, "badge", "warning", "bg"),
|
|
844
|
-
pickSemantic(getPath(defaultMode, ["component", "badge", "warning", "bg"]), getPath(componentAliases, ["badge", "warning", "bg"]))
|
|
845
|
-
);
|
|
846
|
-
addBase(
|
|
847
|
-
toVariableName(prefix, "badge", "warning", "text"),
|
|
848
|
-
pickSemantic(getPath(defaultMode, ["component", "badge", "warning", "text"]), getPath(componentAliases, ["badge", "warning", "text"]))
|
|
849
|
-
);
|
|
850
|
-
addBase(
|
|
851
|
-
toVariableName(prefix, "badge", "danger", "bg"),
|
|
852
|
-
pickSemantic(getPath(defaultMode, ["component", "badge", "danger", "bg"]), getPath(componentAliases, ["badge", "danger", "bg"]))
|
|
853
|
-
);
|
|
854
|
-
addBase(
|
|
855
|
-
toVariableName(prefix, "badge", "danger", "text"),
|
|
856
|
-
pickSemantic(getPath(defaultMode, ["component", "badge", "danger", "text"]), getPath(componentAliases, ["badge", "danger", "text"]))
|
|
857
|
-
);
|
|
948
|
+
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
949
|
+
addBase(
|
|
950
|
+
toVariableName(prefix, "badge", variant, "bg"),
|
|
951
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", bgKey]), getPath(componentAliases, ["badge", bgKey]))
|
|
952
|
+
);
|
|
953
|
+
addBase(
|
|
954
|
+
toVariableName(prefix, "badge", variant, "text"),
|
|
955
|
+
pickSemantic(getPath(defaultMode, ["component", "badge", textKey]), getPath(componentAliases, ["badge", textKey]))
|
|
956
|
+
);
|
|
957
|
+
});
|
|
958
|
+
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
959
|
+
addBase(
|
|
960
|
+
toVariableName(prefix, "icon-box", name),
|
|
961
|
+
pickSemantic(getPath(defaultMode, ["component", "iconBox", tokenKey]), getPath(componentAliases, ["iconBox", tokenKey]))
|
|
962
|
+
);
|
|
963
|
+
});
|
|
858
964
|
const rootLines = [...baseLines, ...mapLines];
|
|
859
965
|
const darkLines = [];
|
|
860
966
|
const addDark = (name, value) => {
|
|
@@ -892,6 +998,14 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
892
998
|
getPath(textAliases, ["onPage", "muted"])
|
|
893
999
|
)
|
|
894
1000
|
);
|
|
1001
|
+
addDark(
|
|
1002
|
+
toVariableName(prefix, "text", "on", "page", "subtle"),
|
|
1003
|
+
pickSemantic(
|
|
1004
|
+
getPath(darkMode, ["text", "onPage", "subtle"]),
|
|
1005
|
+
getPath(defaultMode, ["text", "onPage", "subtle"]),
|
|
1006
|
+
getPath(textAliases, ["onPage", "subtle"])
|
|
1007
|
+
)
|
|
1008
|
+
);
|
|
895
1009
|
addDark(
|
|
896
1010
|
toVariableName(prefix, "text", "on", "page", "meta"),
|
|
897
1011
|
pickSemantic(
|
|
@@ -916,6 +1030,14 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
916
1030
|
getPath(textAliases, ["onSurface", "muted"])
|
|
917
1031
|
)
|
|
918
1032
|
);
|
|
1033
|
+
addDark(
|
|
1034
|
+
toVariableName(prefix, "text", "on", "surface", "subtle"),
|
|
1035
|
+
pickSemantic(
|
|
1036
|
+
getPath(darkMode, ["text", "onSurface", "subtle"]),
|
|
1037
|
+
getPath(defaultMode, ["text", "onSurface", "subtle"]),
|
|
1038
|
+
getPath(textAliases, ["onSurface", "subtle"])
|
|
1039
|
+
)
|
|
1040
|
+
);
|
|
919
1041
|
addDark(
|
|
920
1042
|
toVariableName(prefix, "text", "on", "surface", "meta"),
|
|
921
1043
|
pickSemantic(
|
|
@@ -972,70 +1094,34 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
972
1094
|
getPath(componentAliases, ["button", "textOnPrimary"])
|
|
973
1095
|
)
|
|
974
1096
|
);
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
getPath(defaultMode, ["component", "badge", "success", "text"]),
|
|
1004
|
-
getPath(componentAliases, ["badge", "success", "text"])
|
|
1005
|
-
)
|
|
1006
|
-
);
|
|
1007
|
-
addDark(
|
|
1008
|
-
toVariableName(prefix, "badge", "warning", "bg"),
|
|
1009
|
-
pickSemantic(
|
|
1010
|
-
getPath(darkMode, ["component", "badge", "warning", "bg"]),
|
|
1011
|
-
getPath(defaultMode, ["component", "badge", "warning", "bg"]),
|
|
1012
|
-
getPath(componentAliases, ["badge", "warning", "bg"])
|
|
1013
|
-
)
|
|
1014
|
-
);
|
|
1015
|
-
addDark(
|
|
1016
|
-
toVariableName(prefix, "badge", "warning", "text"),
|
|
1017
|
-
pickSemantic(
|
|
1018
|
-
getPath(darkMode, ["component", "badge", "warning", "text"]),
|
|
1019
|
-
getPath(defaultMode, ["component", "badge", "warning", "text"]),
|
|
1020
|
-
getPath(componentAliases, ["badge", "warning", "text"])
|
|
1021
|
-
)
|
|
1022
|
-
);
|
|
1023
|
-
addDark(
|
|
1024
|
-
toVariableName(prefix, "badge", "danger", "bg"),
|
|
1025
|
-
pickSemantic(
|
|
1026
|
-
getPath(darkMode, ["component", "badge", "danger", "bg"]),
|
|
1027
|
-
getPath(defaultMode, ["component", "badge", "danger", "bg"]),
|
|
1028
|
-
getPath(componentAliases, ["badge", "danger", "bg"])
|
|
1029
|
-
)
|
|
1030
|
-
);
|
|
1031
|
-
addDark(
|
|
1032
|
-
toVariableName(prefix, "badge", "danger", "text"),
|
|
1033
|
-
pickSemantic(
|
|
1034
|
-
getPath(darkMode, ["component", "badge", "danger", "text"]),
|
|
1035
|
-
getPath(defaultMode, ["component", "badge", "danger", "text"]),
|
|
1036
|
-
getPath(componentAliases, ["badge", "danger", "text"])
|
|
1037
|
-
)
|
|
1038
|
-
);
|
|
1097
|
+
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
1098
|
+
addDark(
|
|
1099
|
+
toVariableName(prefix, "badge", variant, "bg"),
|
|
1100
|
+
pickSemantic(
|
|
1101
|
+
getPath(darkMode, ["component", "badge", bgKey]),
|
|
1102
|
+
getPath(defaultMode, ["component", "badge", bgKey]),
|
|
1103
|
+
getPath(componentAliases, ["badge", bgKey])
|
|
1104
|
+
)
|
|
1105
|
+
);
|
|
1106
|
+
addDark(
|
|
1107
|
+
toVariableName(prefix, "badge", variant, "text"),
|
|
1108
|
+
pickSemantic(
|
|
1109
|
+
getPath(darkMode, ["component", "badge", textKey]),
|
|
1110
|
+
getPath(defaultMode, ["component", "badge", textKey]),
|
|
1111
|
+
getPath(componentAliases, ["badge", textKey])
|
|
1112
|
+
)
|
|
1113
|
+
);
|
|
1114
|
+
});
|
|
1115
|
+
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
1116
|
+
addDark(
|
|
1117
|
+
toVariableName(prefix, "icon-box", name),
|
|
1118
|
+
pickSemantic(
|
|
1119
|
+
getPath(darkMode, ["component", "iconBox", tokenKey]),
|
|
1120
|
+
getPath(defaultMode, ["component", "iconBox", tokenKey]),
|
|
1121
|
+
getPath(componentAliases, ["iconBox", tokenKey])
|
|
1122
|
+
)
|
|
1123
|
+
);
|
|
1124
|
+
});
|
|
1039
1125
|
const rootBlock = `${selector} {
|
|
1040
1126
|
${rootLines.join("\n")}
|
|
1041
1127
|
}`;
|
|
@@ -1072,7 +1158,7 @@ var createTailwindTheme = (source = tokens) => {
|
|
|
1072
1158
|
}, {});
|
|
1073
1159
|
return {
|
|
1074
1160
|
colors,
|
|
1075
|
-
spacing: { ...source.
|
|
1161
|
+
spacing: { ...source.space ?? {} },
|
|
1076
1162
|
borderRadius: { ...source.radii },
|
|
1077
1163
|
fontFamily,
|
|
1078
1164
|
fontSize,
|