@phcdevworks/spectre-tokens 2.5.0 → 2.7.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 +185 -76
- package/dist/index.cjs +96 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +23 -26
- package/dist/index.d.cts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +96 -79
- package/dist/index.js.map +1 -1
- package/package.json +19 -11
- package/tokens/components.json +22 -6
- package/tokens/modes.json +14 -6
- package/tokens/primitives.json +35 -20
- package/tokens/semantic-roles.json +69 -12
- package/tokens/typography.json +36 -18
package/dist/index.js
CHANGED
|
@@ -176,7 +176,7 @@ var coreTokens = {
|
|
|
176
176
|
"page": "{colors.neutral.50}",
|
|
177
177
|
"card": "{colors.white}",
|
|
178
178
|
"input": "{colors.white}",
|
|
179
|
-
"overlay": "{colors.
|
|
179
|
+
"overlay": "{colors.black} / 0.6",
|
|
180
180
|
"alternate": "{colors.neutral.100}",
|
|
181
181
|
"hero": "linear-gradient(135deg, {colors.indigo.500} 0%, {colors.violet.600} 100%)"
|
|
182
182
|
},
|
|
@@ -299,7 +299,7 @@ var coreTokens = {
|
|
|
299
299
|
"badge": {
|
|
300
300
|
"neutralBg": "{colors.neutral.700}",
|
|
301
301
|
"neutralBgHover": "{colors.neutral.600}",
|
|
302
|
-
"neutralText": "{colors.neutral.
|
|
302
|
+
"neutralText": "{colors.neutral.50}",
|
|
303
303
|
"infoBg": "{colors.info.800}",
|
|
304
304
|
"infoBgHover": "{colors.info.700}",
|
|
305
305
|
"infoText": "{colors.info.100}",
|
|
@@ -470,13 +470,17 @@ var coreTokens = {
|
|
|
470
470
|
"sm": "2px",
|
|
471
471
|
"md": "4px",
|
|
472
472
|
"lg": "8px",
|
|
473
|
+
"xl": "12px",
|
|
474
|
+
"2xl": "16px",
|
|
473
475
|
"pill": "999px"
|
|
474
476
|
},
|
|
475
477
|
"shadows": {
|
|
476
478
|
"none": "none",
|
|
477
479
|
"sm": "0 1px 2px 0 {colors.black} / 0.06",
|
|
478
480
|
"md": "0 2px 6px -1px {colors.black} / 0.08",
|
|
479
|
-
"lg": "0 6px 16px -4px {colors.black} / 0.12"
|
|
481
|
+
"lg": "0 6px 16px -4px {colors.black} / 0.12",
|
|
482
|
+
"xl": "0 12px 24px -6px {colors.black} / 0.15",
|
|
483
|
+
"2xl": "0 20px 48px -12px {colors.black} / 0.20"
|
|
480
484
|
},
|
|
481
485
|
"breakpoints": {
|
|
482
486
|
"sm": "640px",
|
|
@@ -493,64 +497,69 @@ var coreTokens = {
|
|
|
493
497
|
"overlay": "1300",
|
|
494
498
|
"modal": "1400",
|
|
495
499
|
"popover": "1500",
|
|
496
|
-
"tooltip": "1600"
|
|
500
|
+
"tooltip": "1600",
|
|
501
|
+
"toast": "1700"
|
|
497
502
|
},
|
|
498
503
|
"transitions": {
|
|
499
504
|
"duration": {
|
|
500
505
|
"instant": "75ms",
|
|
501
506
|
"fast": "150ms",
|
|
502
507
|
"base": "200ms",
|
|
508
|
+
"relaxed": "250ms",
|
|
503
509
|
"moderate": "300ms",
|
|
504
510
|
"slow": "500ms",
|
|
505
|
-
"slower": "700ms"
|
|
511
|
+
"slower": "700ms",
|
|
512
|
+
"long": "1000ms",
|
|
513
|
+
"slowest": "1200ms"
|
|
506
514
|
},
|
|
507
515
|
"easing": {
|
|
508
516
|
"linear": "linear",
|
|
509
517
|
"in": "cubic-bezier(0.4, 0, 1, 1)",
|
|
510
518
|
"out": "cubic-bezier(0, 0, 0.2, 1)",
|
|
511
519
|
"inOut": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
512
|
-
"spring": "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
520
|
+
"spring": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
521
|
+
"overshoot": "cubic-bezier(0.34, 1.56, 0.64, 1)"
|
|
513
522
|
}
|
|
514
523
|
},
|
|
515
524
|
"animations": {
|
|
516
525
|
"fadeIn": {
|
|
517
|
-
"duration": "
|
|
518
|
-
"easing": "
|
|
526
|
+
"duration": "{transitions.duration.base}",
|
|
527
|
+
"easing": "{transitions.easing.out}",
|
|
519
528
|
"keyframes": "fade-in"
|
|
520
529
|
},
|
|
521
530
|
"fadeOut": {
|
|
522
|
-
"duration": "
|
|
523
|
-
"easing": "
|
|
531
|
+
"duration": "{transitions.duration.fast}",
|
|
532
|
+
"easing": "{transitions.easing.in}",
|
|
524
533
|
"keyframes": "fade-out"
|
|
525
534
|
},
|
|
526
535
|
"slideUp": {
|
|
527
|
-
"duration": "
|
|
528
|
-
"easing": "
|
|
536
|
+
"duration": "{transitions.duration.moderate}",
|
|
537
|
+
"easing": "{transitions.easing.out}",
|
|
529
538
|
"keyframes": "slide-up"
|
|
530
539
|
},
|
|
531
540
|
"slideDown": {
|
|
532
|
-
"duration": "
|
|
533
|
-
"easing": "
|
|
541
|
+
"duration": "{transitions.duration.moderate}",
|
|
542
|
+
"easing": "{transitions.easing.out}",
|
|
534
543
|
"keyframes": "slide-down"
|
|
535
544
|
},
|
|
536
545
|
"scaleIn": {
|
|
537
|
-
"duration": "
|
|
538
|
-
"easing": "
|
|
546
|
+
"duration": "{transitions.duration.base}",
|
|
547
|
+
"easing": "{transitions.easing.overshoot}",
|
|
539
548
|
"keyframes": "scale-in"
|
|
540
549
|
},
|
|
541
550
|
"bounce": {
|
|
542
|
-
"duration": "
|
|
543
|
-
"easing": "
|
|
551
|
+
"duration": "{transitions.duration.moderate}",
|
|
552
|
+
"easing": "{transitions.easing.spring}",
|
|
544
553
|
"keyframes": "bounce"
|
|
545
554
|
},
|
|
546
555
|
"shake": {
|
|
547
|
-
"duration": "
|
|
548
|
-
"easing": "
|
|
556
|
+
"duration": "{transitions.duration.relaxed}",
|
|
557
|
+
"easing": "{transitions.easing.spring}",
|
|
549
558
|
"keyframes": "shake"
|
|
550
559
|
},
|
|
551
560
|
"pulse": {
|
|
552
|
-
"duration": "
|
|
553
|
-
"easing": "
|
|
561
|
+
"duration": "{transitions.duration.slowest}",
|
|
562
|
+
"easing": "{transitions.easing.spring}",
|
|
554
563
|
"keyframes": "pulse"
|
|
555
564
|
}
|
|
556
565
|
},
|
|
@@ -558,6 +567,7 @@ var coreTokens = {
|
|
|
558
567
|
"disabled": "0.38",
|
|
559
568
|
"hover": "0.92",
|
|
560
569
|
"active": "0.84",
|
|
570
|
+
"loading": "0.6",
|
|
561
571
|
"focus": "1",
|
|
562
572
|
"overlay": "0.5",
|
|
563
573
|
"tooltip": "0.95"
|
|
@@ -565,6 +575,7 @@ var coreTokens = {
|
|
|
565
575
|
"aspectRatios": {
|
|
566
576
|
"square": "1/1",
|
|
567
577
|
"video": "16/9",
|
|
578
|
+
"classic": "3/2",
|
|
568
579
|
"portrait": "3/4",
|
|
569
580
|
"landscape": "4/3",
|
|
570
581
|
"ultrawide": "21/9",
|
|
@@ -592,13 +603,17 @@ var coreTokens = {
|
|
|
592
603
|
"width": {
|
|
593
604
|
"base": "1px",
|
|
594
605
|
"thick": "2px"
|
|
606
|
+
},
|
|
607
|
+
"style": {
|
|
608
|
+
"none": "none",
|
|
609
|
+
"solid": "solid"
|
|
595
610
|
}
|
|
596
611
|
},
|
|
597
612
|
"surface": {
|
|
598
613
|
"page": "{colors.neutral.50}",
|
|
599
614
|
"card": "{colors.white}",
|
|
600
615
|
"input": "{colors.white}",
|
|
601
|
-
"overlay": "{colors.
|
|
616
|
+
"overlay": "{colors.black} / 0.6"
|
|
602
617
|
},
|
|
603
618
|
"text": {
|
|
604
619
|
"onPage": {
|
|
@@ -655,47 +670,56 @@ var coreTokens = {
|
|
|
655
670
|
"sm": {
|
|
656
671
|
"size": "0.875rem",
|
|
657
672
|
"lineHeight": "1.5rem",
|
|
658
|
-
"weight": 400
|
|
673
|
+
"weight": 400,
|
|
674
|
+
"letterSpacing": "0em"
|
|
659
675
|
},
|
|
660
676
|
"md": {
|
|
661
677
|
"size": "1rem",
|
|
662
678
|
"lineHeight": "1.75rem",
|
|
663
|
-
"weight": 500
|
|
679
|
+
"weight": 500,
|
|
680
|
+
"letterSpacing": "0em"
|
|
664
681
|
},
|
|
665
682
|
"lg": {
|
|
666
683
|
"size": "1.25rem",
|
|
667
684
|
"lineHeight": "2rem",
|
|
668
|
-
"weight": 600
|
|
685
|
+
"weight": 600,
|
|
686
|
+
"letterSpacing": "0em"
|
|
669
687
|
},
|
|
670
688
|
"xl": {
|
|
671
689
|
"size": "1.5rem",
|
|
672
690
|
"lineHeight": "2.125rem",
|
|
673
|
-
"weight": 600
|
|
691
|
+
"weight": 600,
|
|
692
|
+
"letterSpacing": "0em"
|
|
674
693
|
},
|
|
675
694
|
"2xl": {
|
|
676
695
|
"size": "1.875rem",
|
|
677
696
|
"lineHeight": "2.5rem",
|
|
678
|
-
"weight": 700
|
|
697
|
+
"weight": 700,
|
|
698
|
+
"letterSpacing": "0em"
|
|
679
699
|
},
|
|
680
700
|
"3xl": {
|
|
681
701
|
"size": "2.25rem",
|
|
682
702
|
"lineHeight": "2.75rem",
|
|
683
|
-
"weight": 700
|
|
703
|
+
"weight": 700,
|
|
704
|
+
"letterSpacing": "0em"
|
|
684
705
|
},
|
|
685
706
|
"4xl": {
|
|
686
707
|
"size": "3rem",
|
|
687
708
|
"lineHeight": "3.5rem",
|
|
688
|
-
"weight": 800
|
|
709
|
+
"weight": 800,
|
|
710
|
+
"letterSpacing": "0em"
|
|
689
711
|
},
|
|
690
712
|
"5xl": {
|
|
691
713
|
"size": "3.75rem",
|
|
692
714
|
"lineHeight": "4.25rem",
|
|
693
|
-
"weight": 800
|
|
715
|
+
"weight": 800,
|
|
716
|
+
"letterSpacing": "0em"
|
|
694
717
|
},
|
|
695
718
|
"6xl": {
|
|
696
719
|
"size": "4.5rem",
|
|
697
720
|
"lineHeight": "5rem",
|
|
698
|
-
"weight": 900
|
|
721
|
+
"weight": 900,
|
|
722
|
+
"letterSpacing": "0em"
|
|
699
723
|
}
|
|
700
724
|
},
|
|
701
725
|
"typography": {
|
|
@@ -714,47 +738,56 @@ var coreTokens = {
|
|
|
714
738
|
"sm": {
|
|
715
739
|
"fontSize": "0.875rem",
|
|
716
740
|
"lineHeight": "1.5rem",
|
|
717
|
-
"fontWeight": 400
|
|
741
|
+
"fontWeight": 400,
|
|
742
|
+
"letterSpacing": "0em"
|
|
718
743
|
},
|
|
719
744
|
"md": {
|
|
720
745
|
"fontSize": "1rem",
|
|
721
746
|
"lineHeight": "1.75rem",
|
|
722
|
-
"fontWeight": 500
|
|
747
|
+
"fontWeight": 500,
|
|
748
|
+
"letterSpacing": "0em"
|
|
723
749
|
},
|
|
724
750
|
"lg": {
|
|
725
751
|
"fontSize": "1.25rem",
|
|
726
752
|
"lineHeight": "2rem",
|
|
727
|
-
"fontWeight": 600
|
|
753
|
+
"fontWeight": 600,
|
|
754
|
+
"letterSpacing": "0em"
|
|
728
755
|
},
|
|
729
756
|
"xl": {
|
|
730
757
|
"fontSize": "1.5rem",
|
|
731
758
|
"lineHeight": "2.125rem",
|
|
732
|
-
"fontWeight": 600
|
|
759
|
+
"fontWeight": 600,
|
|
760
|
+
"letterSpacing": "0em"
|
|
733
761
|
},
|
|
734
762
|
"2xl": {
|
|
735
763
|
"fontSize": "1.875rem",
|
|
736
764
|
"lineHeight": "2.5rem",
|
|
737
|
-
"fontWeight": 700
|
|
765
|
+
"fontWeight": 700,
|
|
766
|
+
"letterSpacing": "0em"
|
|
738
767
|
},
|
|
739
768
|
"3xl": {
|
|
740
769
|
"fontSize": "2.25rem",
|
|
741
770
|
"lineHeight": "2.75rem",
|
|
742
|
-
"fontWeight": 700
|
|
771
|
+
"fontWeight": 700,
|
|
772
|
+
"letterSpacing": "0em"
|
|
743
773
|
},
|
|
744
774
|
"4xl": {
|
|
745
775
|
"fontSize": "3rem",
|
|
746
776
|
"lineHeight": "3.5rem",
|
|
747
|
-
"fontWeight": 800
|
|
777
|
+
"fontWeight": 800,
|
|
778
|
+
"letterSpacing": "0em"
|
|
748
779
|
},
|
|
749
780
|
"5xl": {
|
|
750
781
|
"fontSize": "3.75rem",
|
|
751
782
|
"lineHeight": "4.25rem",
|
|
752
|
-
"fontWeight": 800
|
|
783
|
+
"fontWeight": 800,
|
|
784
|
+
"letterSpacing": "0em"
|
|
753
785
|
},
|
|
754
786
|
"6xl": {
|
|
755
787
|
"fontSize": "4.5rem",
|
|
756
788
|
"lineHeight": "5rem",
|
|
757
|
-
"fontWeight": 900
|
|
789
|
+
"fontWeight": 900,
|
|
790
|
+
"letterSpacing": "0em"
|
|
758
791
|
}
|
|
759
792
|
}
|
|
760
793
|
}
|
|
@@ -820,6 +853,23 @@ var resolveValue = (tokens2, value) => {
|
|
|
820
853
|
str = str.replace(opacityRegex, (match, hex, opacity) => hexToRgba(hex, opacity));
|
|
821
854
|
return str;
|
|
822
855
|
};
|
|
856
|
+
var resolveSemanticValue = (value, tokens2) => {
|
|
857
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
858
|
+
return resolveValue(tokens2, value);
|
|
859
|
+
}
|
|
860
|
+
if (value && typeof value === "object" && "value" in value) {
|
|
861
|
+
return resolveValue(tokens2, value.value);
|
|
862
|
+
}
|
|
863
|
+
return void 0;
|
|
864
|
+
};
|
|
865
|
+
var getPath = (source, path) => path.reduce((acc, key) => acc && typeof acc === "object" ? acc[key] : void 0, source);
|
|
866
|
+
var pickSemantic = (tokens2, ...candidates) => {
|
|
867
|
+
for (const candidate of candidates) {
|
|
868
|
+
const resolved = resolveSemanticValue(candidate, tokens2);
|
|
869
|
+
if (resolved !== void 0) return resolved;
|
|
870
|
+
}
|
|
871
|
+
return void 0;
|
|
872
|
+
};
|
|
823
873
|
var createCssVariableMap = (tokens2, options = {}) => {
|
|
824
874
|
const prefix = options.prefix ?? DEFAULT_PREFIX;
|
|
825
875
|
const map = {};
|
|
@@ -880,6 +930,11 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
880
930
|
assign(toVariableName(prefix, "border", "width", key), value);
|
|
881
931
|
});
|
|
882
932
|
}
|
|
933
|
+
if (border?.style) {
|
|
934
|
+
Object.entries(border.style).forEach(([key, value]) => {
|
|
935
|
+
assign(toVariableName(prefix, "border", "style", key), value);
|
|
936
|
+
});
|
|
937
|
+
}
|
|
883
938
|
Object.entries(baseTokens.radii).forEach(([key, value]) => {
|
|
884
939
|
assign(toVariableName(prefix, "radius", key), value);
|
|
885
940
|
});
|
|
@@ -905,27 +960,6 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
905
960
|
const scaleEntry = entry;
|
|
906
961
|
assign(toVariableName(prefix, "font", key, "letter-spacing"), scaleEntry.letterSpacing);
|
|
907
962
|
});
|
|
908
|
-
assign(toVariableName(prefix, "text", "on", "page", "default"), tokens2.text.onPage.default);
|
|
909
|
-
assign(toVariableName(prefix, "text", "on", "page", "muted"), tokens2.text.onPage.muted);
|
|
910
|
-
assign(toVariableName(prefix, "text", "on", "page", "subtle"), tokens2.text.onPage.subtle);
|
|
911
|
-
assign(toVariableName(prefix, "text", "on", "page", "meta"), tokens2.text.onPage.meta);
|
|
912
|
-
assign(toVariableName(prefix, "text", "on", "surface", "default"), tokens2.text.onSurface.default);
|
|
913
|
-
assign(toVariableName(prefix, "text", "on", "surface", "muted"), tokens2.text.onSurface.muted);
|
|
914
|
-
assign(toVariableName(prefix, "text", "on", "surface", "subtle"), tokens2.text.onSurface.subtle);
|
|
915
|
-
assign(toVariableName(prefix, "text", "on", "surface", "meta"), tokens2.text.onSurface.meta);
|
|
916
|
-
const badge = tokens2.component?.badge;
|
|
917
|
-
if (badge) {
|
|
918
|
-
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
919
|
-
assign(toVariableName(prefix, "badge", variant, "bg"), badge[bgKey]);
|
|
920
|
-
assign(toVariableName(prefix, "badge", variant, "text"), badge[textKey]);
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
const iconBox = tokens2.component?.iconBox;
|
|
924
|
-
if (iconBox) {
|
|
925
|
-
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
926
|
-
assign(toVariableName(prefix, "icon-box", name), iconBox[tokenKey]);
|
|
927
|
-
});
|
|
928
|
-
}
|
|
929
963
|
Object.entries(baseTokens.shadows).forEach(([key, value]) => {
|
|
930
964
|
assign(toVariableName(prefix, "shadow", key), value);
|
|
931
965
|
});
|
|
@@ -968,23 +1002,6 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
968
1002
|
}
|
|
969
1003
|
return map;
|
|
970
1004
|
};
|
|
971
|
-
var resolveSemanticValue = (value, tokens2) => {
|
|
972
|
-
if (typeof value === "string" || typeof value === "number") {
|
|
973
|
-
return resolveValue(tokens2, value);
|
|
974
|
-
}
|
|
975
|
-
if (value && typeof value === "object" && "value" in value) {
|
|
976
|
-
return resolveValue(tokens2, value.value);
|
|
977
|
-
}
|
|
978
|
-
return void 0;
|
|
979
|
-
};
|
|
980
|
-
var getPath = (source, path) => path.reduce((acc, key) => acc && typeof acc === "object" ? acc[key] : void 0, source);
|
|
981
|
-
var pickSemantic = (tokens2, ...candidates) => {
|
|
982
|
-
for (const candidate of candidates) {
|
|
983
|
-
const resolved = resolveSemanticValue(candidate, tokens2);
|
|
984
|
-
if (resolved !== void 0) return resolved;
|
|
985
|
-
}
|
|
986
|
-
return void 0;
|
|
987
|
-
};
|
|
988
1005
|
var generateCssVariables = (tokens2, options = {}) => {
|
|
989
1006
|
const selector = options.selector ?? DEFAULT_SELECTOR;
|
|
990
1007
|
const prefix = options.prefix ?? DEFAULT_PREFIX;
|