@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.cjs
CHANGED
|
@@ -206,7 +206,7 @@ var coreTokens = {
|
|
|
206
206
|
"page": "{colors.neutral.50}",
|
|
207
207
|
"card": "{colors.white}",
|
|
208
208
|
"input": "{colors.white}",
|
|
209
|
-
"overlay": "{colors.
|
|
209
|
+
"overlay": "{colors.black} / 0.6",
|
|
210
210
|
"alternate": "{colors.neutral.100}",
|
|
211
211
|
"hero": "linear-gradient(135deg, {colors.indigo.500} 0%, {colors.violet.600} 100%)"
|
|
212
212
|
},
|
|
@@ -329,7 +329,7 @@ var coreTokens = {
|
|
|
329
329
|
"badge": {
|
|
330
330
|
"neutralBg": "{colors.neutral.700}",
|
|
331
331
|
"neutralBgHover": "{colors.neutral.600}",
|
|
332
|
-
"neutralText": "{colors.neutral.
|
|
332
|
+
"neutralText": "{colors.neutral.50}",
|
|
333
333
|
"infoBg": "{colors.info.800}",
|
|
334
334
|
"infoBgHover": "{colors.info.700}",
|
|
335
335
|
"infoText": "{colors.info.100}",
|
|
@@ -500,13 +500,17 @@ var coreTokens = {
|
|
|
500
500
|
"sm": "2px",
|
|
501
501
|
"md": "4px",
|
|
502
502
|
"lg": "8px",
|
|
503
|
+
"xl": "12px",
|
|
504
|
+
"2xl": "16px",
|
|
503
505
|
"pill": "999px"
|
|
504
506
|
},
|
|
505
507
|
"shadows": {
|
|
506
508
|
"none": "none",
|
|
507
509
|
"sm": "0 1px 2px 0 {colors.black} / 0.06",
|
|
508
510
|
"md": "0 2px 6px -1px {colors.black} / 0.08",
|
|
509
|
-
"lg": "0 6px 16px -4px {colors.black} / 0.12"
|
|
511
|
+
"lg": "0 6px 16px -4px {colors.black} / 0.12",
|
|
512
|
+
"xl": "0 12px 24px -6px {colors.black} / 0.15",
|
|
513
|
+
"2xl": "0 20px 48px -12px {colors.black} / 0.20"
|
|
510
514
|
},
|
|
511
515
|
"breakpoints": {
|
|
512
516
|
"sm": "640px",
|
|
@@ -523,64 +527,69 @@ var coreTokens = {
|
|
|
523
527
|
"overlay": "1300",
|
|
524
528
|
"modal": "1400",
|
|
525
529
|
"popover": "1500",
|
|
526
|
-
"tooltip": "1600"
|
|
530
|
+
"tooltip": "1600",
|
|
531
|
+
"toast": "1700"
|
|
527
532
|
},
|
|
528
533
|
"transitions": {
|
|
529
534
|
"duration": {
|
|
530
535
|
"instant": "75ms",
|
|
531
536
|
"fast": "150ms",
|
|
532
537
|
"base": "200ms",
|
|
538
|
+
"relaxed": "250ms",
|
|
533
539
|
"moderate": "300ms",
|
|
534
540
|
"slow": "500ms",
|
|
535
|
-
"slower": "700ms"
|
|
541
|
+
"slower": "700ms",
|
|
542
|
+
"long": "1000ms",
|
|
543
|
+
"slowest": "1200ms"
|
|
536
544
|
},
|
|
537
545
|
"easing": {
|
|
538
546
|
"linear": "linear",
|
|
539
547
|
"in": "cubic-bezier(0.4, 0, 1, 1)",
|
|
540
548
|
"out": "cubic-bezier(0, 0, 0.2, 1)",
|
|
541
549
|
"inOut": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
542
|
-
"spring": "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
550
|
+
"spring": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
551
|
+
"overshoot": "cubic-bezier(0.34, 1.56, 0.64, 1)"
|
|
543
552
|
}
|
|
544
553
|
},
|
|
545
554
|
"animations": {
|
|
546
555
|
"fadeIn": {
|
|
547
|
-
"duration": "
|
|
548
|
-
"easing": "
|
|
556
|
+
"duration": "{transitions.duration.base}",
|
|
557
|
+
"easing": "{transitions.easing.out}",
|
|
549
558
|
"keyframes": "fade-in"
|
|
550
559
|
},
|
|
551
560
|
"fadeOut": {
|
|
552
|
-
"duration": "
|
|
553
|
-
"easing": "
|
|
561
|
+
"duration": "{transitions.duration.fast}",
|
|
562
|
+
"easing": "{transitions.easing.in}",
|
|
554
563
|
"keyframes": "fade-out"
|
|
555
564
|
},
|
|
556
565
|
"slideUp": {
|
|
557
|
-
"duration": "
|
|
558
|
-
"easing": "
|
|
566
|
+
"duration": "{transitions.duration.moderate}",
|
|
567
|
+
"easing": "{transitions.easing.out}",
|
|
559
568
|
"keyframes": "slide-up"
|
|
560
569
|
},
|
|
561
570
|
"slideDown": {
|
|
562
|
-
"duration": "
|
|
563
|
-
"easing": "
|
|
571
|
+
"duration": "{transitions.duration.moderate}",
|
|
572
|
+
"easing": "{transitions.easing.out}",
|
|
564
573
|
"keyframes": "slide-down"
|
|
565
574
|
},
|
|
566
575
|
"scaleIn": {
|
|
567
|
-
"duration": "
|
|
568
|
-
"easing": "
|
|
576
|
+
"duration": "{transitions.duration.base}",
|
|
577
|
+
"easing": "{transitions.easing.overshoot}",
|
|
569
578
|
"keyframes": "scale-in"
|
|
570
579
|
},
|
|
571
580
|
"bounce": {
|
|
572
|
-
"duration": "
|
|
573
|
-
"easing": "
|
|
581
|
+
"duration": "{transitions.duration.moderate}",
|
|
582
|
+
"easing": "{transitions.easing.spring}",
|
|
574
583
|
"keyframes": "bounce"
|
|
575
584
|
},
|
|
576
585
|
"shake": {
|
|
577
|
-
"duration": "
|
|
578
|
-
"easing": "
|
|
586
|
+
"duration": "{transitions.duration.relaxed}",
|
|
587
|
+
"easing": "{transitions.easing.spring}",
|
|
579
588
|
"keyframes": "shake"
|
|
580
589
|
},
|
|
581
590
|
"pulse": {
|
|
582
|
-
"duration": "
|
|
583
|
-
"easing": "
|
|
591
|
+
"duration": "{transitions.duration.slowest}",
|
|
592
|
+
"easing": "{transitions.easing.spring}",
|
|
584
593
|
"keyframes": "pulse"
|
|
585
594
|
}
|
|
586
595
|
},
|
|
@@ -588,6 +597,7 @@ var coreTokens = {
|
|
|
588
597
|
"disabled": "0.38",
|
|
589
598
|
"hover": "0.92",
|
|
590
599
|
"active": "0.84",
|
|
600
|
+
"loading": "0.6",
|
|
591
601
|
"focus": "1",
|
|
592
602
|
"overlay": "0.5",
|
|
593
603
|
"tooltip": "0.95"
|
|
@@ -595,6 +605,7 @@ var coreTokens = {
|
|
|
595
605
|
"aspectRatios": {
|
|
596
606
|
"square": "1/1",
|
|
597
607
|
"video": "16/9",
|
|
608
|
+
"classic": "3/2",
|
|
598
609
|
"portrait": "3/4",
|
|
599
610
|
"landscape": "4/3",
|
|
600
611
|
"ultrawide": "21/9",
|
|
@@ -622,13 +633,17 @@ var coreTokens = {
|
|
|
622
633
|
"width": {
|
|
623
634
|
"base": "1px",
|
|
624
635
|
"thick": "2px"
|
|
636
|
+
},
|
|
637
|
+
"style": {
|
|
638
|
+
"none": "none",
|
|
639
|
+
"solid": "solid"
|
|
625
640
|
}
|
|
626
641
|
},
|
|
627
642
|
"surface": {
|
|
628
643
|
"page": "{colors.neutral.50}",
|
|
629
644
|
"card": "{colors.white}",
|
|
630
645
|
"input": "{colors.white}",
|
|
631
|
-
"overlay": "{colors.
|
|
646
|
+
"overlay": "{colors.black} / 0.6"
|
|
632
647
|
},
|
|
633
648
|
"text": {
|
|
634
649
|
"onPage": {
|
|
@@ -685,47 +700,56 @@ var coreTokens = {
|
|
|
685
700
|
"sm": {
|
|
686
701
|
"size": "0.875rem",
|
|
687
702
|
"lineHeight": "1.5rem",
|
|
688
|
-
"weight": 400
|
|
703
|
+
"weight": 400,
|
|
704
|
+
"letterSpacing": "0em"
|
|
689
705
|
},
|
|
690
706
|
"md": {
|
|
691
707
|
"size": "1rem",
|
|
692
708
|
"lineHeight": "1.75rem",
|
|
693
|
-
"weight": 500
|
|
709
|
+
"weight": 500,
|
|
710
|
+
"letterSpacing": "0em"
|
|
694
711
|
},
|
|
695
712
|
"lg": {
|
|
696
713
|
"size": "1.25rem",
|
|
697
714
|
"lineHeight": "2rem",
|
|
698
|
-
"weight": 600
|
|
715
|
+
"weight": 600,
|
|
716
|
+
"letterSpacing": "0em"
|
|
699
717
|
},
|
|
700
718
|
"xl": {
|
|
701
719
|
"size": "1.5rem",
|
|
702
720
|
"lineHeight": "2.125rem",
|
|
703
|
-
"weight": 600
|
|
721
|
+
"weight": 600,
|
|
722
|
+
"letterSpacing": "0em"
|
|
704
723
|
},
|
|
705
724
|
"2xl": {
|
|
706
725
|
"size": "1.875rem",
|
|
707
726
|
"lineHeight": "2.5rem",
|
|
708
|
-
"weight": 700
|
|
727
|
+
"weight": 700,
|
|
728
|
+
"letterSpacing": "0em"
|
|
709
729
|
},
|
|
710
730
|
"3xl": {
|
|
711
731
|
"size": "2.25rem",
|
|
712
732
|
"lineHeight": "2.75rem",
|
|
713
|
-
"weight": 700
|
|
733
|
+
"weight": 700,
|
|
734
|
+
"letterSpacing": "0em"
|
|
714
735
|
},
|
|
715
736
|
"4xl": {
|
|
716
737
|
"size": "3rem",
|
|
717
738
|
"lineHeight": "3.5rem",
|
|
718
|
-
"weight": 800
|
|
739
|
+
"weight": 800,
|
|
740
|
+
"letterSpacing": "0em"
|
|
719
741
|
},
|
|
720
742
|
"5xl": {
|
|
721
743
|
"size": "3.75rem",
|
|
722
744
|
"lineHeight": "4.25rem",
|
|
723
|
-
"weight": 800
|
|
745
|
+
"weight": 800,
|
|
746
|
+
"letterSpacing": "0em"
|
|
724
747
|
},
|
|
725
748
|
"6xl": {
|
|
726
749
|
"size": "4.5rem",
|
|
727
750
|
"lineHeight": "5rem",
|
|
728
|
-
"weight": 900
|
|
751
|
+
"weight": 900,
|
|
752
|
+
"letterSpacing": "0em"
|
|
729
753
|
}
|
|
730
754
|
},
|
|
731
755
|
"typography": {
|
|
@@ -744,47 +768,56 @@ var coreTokens = {
|
|
|
744
768
|
"sm": {
|
|
745
769
|
"fontSize": "0.875rem",
|
|
746
770
|
"lineHeight": "1.5rem",
|
|
747
|
-
"fontWeight": 400
|
|
771
|
+
"fontWeight": 400,
|
|
772
|
+
"letterSpacing": "0em"
|
|
748
773
|
},
|
|
749
774
|
"md": {
|
|
750
775
|
"fontSize": "1rem",
|
|
751
776
|
"lineHeight": "1.75rem",
|
|
752
|
-
"fontWeight": 500
|
|
777
|
+
"fontWeight": 500,
|
|
778
|
+
"letterSpacing": "0em"
|
|
753
779
|
},
|
|
754
780
|
"lg": {
|
|
755
781
|
"fontSize": "1.25rem",
|
|
756
782
|
"lineHeight": "2rem",
|
|
757
|
-
"fontWeight": 600
|
|
783
|
+
"fontWeight": 600,
|
|
784
|
+
"letterSpacing": "0em"
|
|
758
785
|
},
|
|
759
786
|
"xl": {
|
|
760
787
|
"fontSize": "1.5rem",
|
|
761
788
|
"lineHeight": "2.125rem",
|
|
762
|
-
"fontWeight": 600
|
|
789
|
+
"fontWeight": 600,
|
|
790
|
+
"letterSpacing": "0em"
|
|
763
791
|
},
|
|
764
792
|
"2xl": {
|
|
765
793
|
"fontSize": "1.875rem",
|
|
766
794
|
"lineHeight": "2.5rem",
|
|
767
|
-
"fontWeight": 700
|
|
795
|
+
"fontWeight": 700,
|
|
796
|
+
"letterSpacing": "0em"
|
|
768
797
|
},
|
|
769
798
|
"3xl": {
|
|
770
799
|
"fontSize": "2.25rem",
|
|
771
800
|
"lineHeight": "2.75rem",
|
|
772
|
-
"fontWeight": 700
|
|
801
|
+
"fontWeight": 700,
|
|
802
|
+
"letterSpacing": "0em"
|
|
773
803
|
},
|
|
774
804
|
"4xl": {
|
|
775
805
|
"fontSize": "3rem",
|
|
776
806
|
"lineHeight": "3.5rem",
|
|
777
|
-
"fontWeight": 800
|
|
807
|
+
"fontWeight": 800,
|
|
808
|
+
"letterSpacing": "0em"
|
|
778
809
|
},
|
|
779
810
|
"5xl": {
|
|
780
811
|
"fontSize": "3.75rem",
|
|
781
812
|
"lineHeight": "4.25rem",
|
|
782
|
-
"fontWeight": 800
|
|
813
|
+
"fontWeight": 800,
|
|
814
|
+
"letterSpacing": "0em"
|
|
783
815
|
},
|
|
784
816
|
"6xl": {
|
|
785
817
|
"fontSize": "4.5rem",
|
|
786
818
|
"lineHeight": "5rem",
|
|
787
|
-
"fontWeight": 900
|
|
819
|
+
"fontWeight": 900,
|
|
820
|
+
"letterSpacing": "0em"
|
|
788
821
|
}
|
|
789
822
|
}
|
|
790
823
|
}
|
|
@@ -850,6 +883,23 @@ var resolveValue = (tokens2, value) => {
|
|
|
850
883
|
str = str.replace(opacityRegex, (match, hex, opacity) => hexToRgba(hex, opacity));
|
|
851
884
|
return str;
|
|
852
885
|
};
|
|
886
|
+
var resolveSemanticValue = (value, tokens2) => {
|
|
887
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
888
|
+
return resolveValue(tokens2, value);
|
|
889
|
+
}
|
|
890
|
+
if (value && typeof value === "object" && "value" in value) {
|
|
891
|
+
return resolveValue(tokens2, value.value);
|
|
892
|
+
}
|
|
893
|
+
return void 0;
|
|
894
|
+
};
|
|
895
|
+
var getPath = (source, path) => path.reduce((acc, key) => acc && typeof acc === "object" ? acc[key] : void 0, source);
|
|
896
|
+
var pickSemantic = (tokens2, ...candidates) => {
|
|
897
|
+
for (const candidate of candidates) {
|
|
898
|
+
const resolved = resolveSemanticValue(candidate, tokens2);
|
|
899
|
+
if (resolved !== void 0) return resolved;
|
|
900
|
+
}
|
|
901
|
+
return void 0;
|
|
902
|
+
};
|
|
853
903
|
var createCssVariableMap = (tokens2, options = {}) => {
|
|
854
904
|
const prefix = options.prefix ?? DEFAULT_PREFIX;
|
|
855
905
|
const map = {};
|
|
@@ -910,6 +960,11 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
910
960
|
assign(toVariableName(prefix, "border", "width", key), value);
|
|
911
961
|
});
|
|
912
962
|
}
|
|
963
|
+
if (border?.style) {
|
|
964
|
+
Object.entries(border.style).forEach(([key, value]) => {
|
|
965
|
+
assign(toVariableName(prefix, "border", "style", key), value);
|
|
966
|
+
});
|
|
967
|
+
}
|
|
913
968
|
Object.entries(baseTokens.radii).forEach(([key, value]) => {
|
|
914
969
|
assign(toVariableName(prefix, "radius", key), value);
|
|
915
970
|
});
|
|
@@ -935,27 +990,6 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
935
990
|
const scaleEntry = entry;
|
|
936
991
|
assign(toVariableName(prefix, "font", key, "letter-spacing"), scaleEntry.letterSpacing);
|
|
937
992
|
});
|
|
938
|
-
assign(toVariableName(prefix, "text", "on", "page", "default"), tokens2.text.onPage.default);
|
|
939
|
-
assign(toVariableName(prefix, "text", "on", "page", "muted"), tokens2.text.onPage.muted);
|
|
940
|
-
assign(toVariableName(prefix, "text", "on", "page", "subtle"), tokens2.text.onPage.subtle);
|
|
941
|
-
assign(toVariableName(prefix, "text", "on", "page", "meta"), tokens2.text.onPage.meta);
|
|
942
|
-
assign(toVariableName(prefix, "text", "on", "surface", "default"), tokens2.text.onSurface.default);
|
|
943
|
-
assign(toVariableName(prefix, "text", "on", "surface", "muted"), tokens2.text.onSurface.muted);
|
|
944
|
-
assign(toVariableName(prefix, "text", "on", "surface", "subtle"), tokens2.text.onSurface.subtle);
|
|
945
|
-
assign(toVariableName(prefix, "text", "on", "surface", "meta"), tokens2.text.onSurface.meta);
|
|
946
|
-
const badge = tokens2.component?.badge;
|
|
947
|
-
if (badge) {
|
|
948
|
-
BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
|
|
949
|
-
assign(toVariableName(prefix, "badge", variant, "bg"), badge[bgKey]);
|
|
950
|
-
assign(toVariableName(prefix, "badge", variant, "text"), badge[textKey]);
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
const iconBox = tokens2.component?.iconBox;
|
|
954
|
-
if (iconBox) {
|
|
955
|
-
ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
|
|
956
|
-
assign(toVariableName(prefix, "icon-box", name), iconBox[tokenKey]);
|
|
957
|
-
});
|
|
958
|
-
}
|
|
959
993
|
Object.entries(baseTokens.shadows).forEach(([key, value]) => {
|
|
960
994
|
assign(toVariableName(prefix, "shadow", key), value);
|
|
961
995
|
});
|
|
@@ -998,23 +1032,6 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
998
1032
|
}
|
|
999
1033
|
return map;
|
|
1000
1034
|
};
|
|
1001
|
-
var resolveSemanticValue = (value, tokens2) => {
|
|
1002
|
-
if (typeof value === "string" || typeof value === "number") {
|
|
1003
|
-
return resolveValue(tokens2, value);
|
|
1004
|
-
}
|
|
1005
|
-
if (value && typeof value === "object" && "value" in value) {
|
|
1006
|
-
return resolveValue(tokens2, value.value);
|
|
1007
|
-
}
|
|
1008
|
-
return void 0;
|
|
1009
|
-
};
|
|
1010
|
-
var getPath = (source, path) => path.reduce((acc, key) => acc && typeof acc === "object" ? acc[key] : void 0, source);
|
|
1011
|
-
var pickSemantic = (tokens2, ...candidates) => {
|
|
1012
|
-
for (const candidate of candidates) {
|
|
1013
|
-
const resolved = resolveSemanticValue(candidate, tokens2);
|
|
1014
|
-
if (resolved !== void 0) return resolved;
|
|
1015
|
-
}
|
|
1016
|
-
return void 0;
|
|
1017
|
-
};
|
|
1018
1035
|
var generateCssVariables = (tokens2, options = {}) => {
|
|
1019
1036
|
const selector = options.selector ?? DEFAULT_SELECTOR;
|
|
1020
1037
|
const prefix = options.prefix ?? DEFAULT_PREFIX;
|