@phcdevworks/spectre-tokens 3.5.0 → 4.0.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/dist/index.js CHANGED
@@ -765,7 +765,347 @@ var coreTokens = {
765
765
  "info": "{colors.info.600}"
766
766
  },
767
767
  "white": "#ffffff",
768
- "black": "#000000"
768
+ "black": "#000000",
769
+ "palette": {
770
+ "red": {
771
+ "50": "#fef2f2",
772
+ "100": "#ffe2e2",
773
+ "200": "#ffc9c9",
774
+ "300": "#ffa2a2",
775
+ "400": "#ff6467",
776
+ "500": "#fb2c36",
777
+ "600": "#e7000b",
778
+ "700": "#c10007",
779
+ "800": "#9f0712",
780
+ "900": "#82181a",
781
+ "950": "#460809"
782
+ },
783
+ "orange": {
784
+ "50": "#fff7ed",
785
+ "100": "#ffedd4",
786
+ "200": "#ffd6a7",
787
+ "300": "#ffb86a",
788
+ "400": "#ff8904",
789
+ "500": "#ff6900",
790
+ "600": "#f54900",
791
+ "700": "#ca3500",
792
+ "800": "#9f2d00",
793
+ "900": "#7e2a0c",
794
+ "950": "#441306"
795
+ },
796
+ "amber": {
797
+ "50": "#fffbeb",
798
+ "100": "#fef3c6",
799
+ "200": "#fee685",
800
+ "300": "#ffd230",
801
+ "400": "#ffb900",
802
+ "500": "#fe9a00",
803
+ "600": "#e17100",
804
+ "700": "#bb4d00",
805
+ "800": "#973c00",
806
+ "900": "#7b3306",
807
+ "950": "#461901"
808
+ },
809
+ "yellow": {
810
+ "50": "#fefce8",
811
+ "100": "#fef9c2",
812
+ "200": "#fff085",
813
+ "300": "#ffdf20",
814
+ "400": "#fdc700",
815
+ "500": "#f0b100",
816
+ "600": "#d08700",
817
+ "700": "#a65f00",
818
+ "800": "#894b00",
819
+ "900": "#733e0a",
820
+ "950": "#432004"
821
+ },
822
+ "lime": {
823
+ "50": "#f7fee7",
824
+ "100": "#ecfcca",
825
+ "200": "#d8f999",
826
+ "300": "#bbf451",
827
+ "400": "#9ae600",
828
+ "500": "#7ccf00",
829
+ "600": "#5ea500",
830
+ "700": "#497d00",
831
+ "800": "#3c6300",
832
+ "900": "#35530e",
833
+ "950": "#192e03"
834
+ },
835
+ "green": {
836
+ "50": "#f0fdf4",
837
+ "100": "#dcfce7",
838
+ "200": "#b9f8cf",
839
+ "300": "#7bf1a8",
840
+ "400": "#05df72",
841
+ "500": "#00c950",
842
+ "600": "#00a63e",
843
+ "700": "#008236",
844
+ "800": "#016630",
845
+ "900": "#0d542b",
846
+ "950": "#032e15"
847
+ },
848
+ "emerald": {
849
+ "50": "#ecfdf5",
850
+ "100": "#d0fae5",
851
+ "200": "#a4f4cf",
852
+ "300": "#5ee9b5",
853
+ "400": "#00d492",
854
+ "500": "#00bc7d",
855
+ "600": "#009966",
856
+ "700": "#007a55",
857
+ "800": "#006045",
858
+ "900": "#004f3b",
859
+ "950": "#002c22"
860
+ },
861
+ "teal": {
862
+ "50": "#f0fdfa",
863
+ "100": "#cbfbf1",
864
+ "200": "#96f7e4",
865
+ "300": "#46ecd5",
866
+ "400": "#00d5be",
867
+ "500": "#00bba7",
868
+ "600": "#009689",
869
+ "700": "#00786f",
870
+ "800": "#005f5a",
871
+ "900": "#0b4f4a",
872
+ "950": "#022f2e"
873
+ },
874
+ "cyan": {
875
+ "50": "#ecfeff",
876
+ "100": "#cefafe",
877
+ "200": "#a2f4fd",
878
+ "300": "#53eafd",
879
+ "400": "#00d3f2",
880
+ "500": "#00b8db",
881
+ "600": "#0092b8",
882
+ "700": "#007595",
883
+ "800": "#005f78",
884
+ "900": "#104e64",
885
+ "950": "#053345"
886
+ },
887
+ "sky": {
888
+ "50": "#f0f9ff",
889
+ "100": "#dff2fe",
890
+ "200": "#b8e6fe",
891
+ "300": "#74d4ff",
892
+ "400": "#00bcff",
893
+ "500": "#00a6f4",
894
+ "600": "#0084d1",
895
+ "700": "#0069a8",
896
+ "800": "#00598a",
897
+ "900": "#024a70",
898
+ "950": "#052f4a"
899
+ },
900
+ "blue": {
901
+ "50": "#eff6ff",
902
+ "100": "#dbeafe",
903
+ "200": "#bedbff",
904
+ "300": "#8ec5ff",
905
+ "400": "#51a2ff",
906
+ "500": "#2b7fff",
907
+ "600": "#155dfc",
908
+ "700": "#1447e6",
909
+ "800": "#193cb8",
910
+ "900": "#1c398e",
911
+ "950": "#162456"
912
+ },
913
+ "indigo": {
914
+ "50": "#eef2ff",
915
+ "100": "#e0e7ff",
916
+ "200": "#c6d2ff",
917
+ "300": "#a3b3ff",
918
+ "400": "#7c86ff",
919
+ "500": "#615fff",
920
+ "600": "#4f39f6",
921
+ "700": "#432dd7",
922
+ "800": "#372aac",
923
+ "900": "#312c85",
924
+ "950": "#1e1a4d"
925
+ },
926
+ "violet": {
927
+ "50": "#f5f3ff",
928
+ "100": "#ede9fe",
929
+ "200": "#ddd6ff",
930
+ "300": "#c4b4ff",
931
+ "400": "#a684ff",
932
+ "500": "#8e51ff",
933
+ "600": "#7f22fe",
934
+ "700": "#7008e7",
935
+ "800": "#5d0ec0",
936
+ "900": "#4d179a",
937
+ "950": "#2f0d68"
938
+ },
939
+ "purple": {
940
+ "50": "#faf5ff",
941
+ "100": "#f3e8ff",
942
+ "200": "#e9d4ff",
943
+ "300": "#dab2ff",
944
+ "400": "#c27aff",
945
+ "500": "#ad46ff",
946
+ "600": "#9810fa",
947
+ "700": "#8200db",
948
+ "800": "#6e11b0",
949
+ "900": "#59168b",
950
+ "950": "#3c0366"
951
+ },
952
+ "fuchsia": {
953
+ "50": "#fdf4ff",
954
+ "100": "#fae8ff",
955
+ "200": "#f6cfff",
956
+ "300": "#f4a8ff",
957
+ "400": "#ed6aff",
958
+ "500": "#e12afb",
959
+ "600": "#c800de",
960
+ "700": "#a800b7",
961
+ "800": "#8a0194",
962
+ "900": "#721378",
963
+ "950": "#4b004f"
964
+ },
965
+ "pink": {
966
+ "50": "#fdf2f8",
967
+ "100": "#fce7f3",
968
+ "200": "#fccee8",
969
+ "300": "#fda5d5",
970
+ "400": "#fb64b6",
971
+ "500": "#f6339a",
972
+ "600": "#e60076",
973
+ "700": "#c6005c",
974
+ "800": "#a3004c",
975
+ "900": "#861043",
976
+ "950": "#510424"
977
+ },
978
+ "rose": {
979
+ "50": "#fff1f2",
980
+ "100": "#ffe4e6",
981
+ "200": "#ffccd3",
982
+ "300": "#ffa1ad",
983
+ "400": "#ff637e",
984
+ "500": "#ff2056",
985
+ "600": "#ec003f",
986
+ "700": "#c70036",
987
+ "800": "#a50036",
988
+ "900": "#8b0836",
989
+ "950": "#4d0218"
990
+ },
991
+ "slate": {
992
+ "50": "#f8fafc",
993
+ "100": "#f1f5f9",
994
+ "200": "#e2e8f0",
995
+ "300": "#cad5e2",
996
+ "400": "#90a1b9",
997
+ "500": "#62748e",
998
+ "600": "#45556c",
999
+ "700": "#314158",
1000
+ "800": "#1d293d",
1001
+ "900": "#0f172b",
1002
+ "950": "#020618"
1003
+ },
1004
+ "gray": {
1005
+ "50": "#f9fafb",
1006
+ "100": "#f3f4f6",
1007
+ "200": "#e5e7eb",
1008
+ "300": "#d1d5dc",
1009
+ "400": "#99a1af",
1010
+ "500": "#6a7282",
1011
+ "600": "#4a5565",
1012
+ "700": "#364153",
1013
+ "800": "#1e2939",
1014
+ "900": "#101828",
1015
+ "950": "#030712"
1016
+ },
1017
+ "zinc": {
1018
+ "50": "#fafafa",
1019
+ "100": "#f4f4f5",
1020
+ "200": "#e4e4e7",
1021
+ "300": "#d4d4d8",
1022
+ "400": "#9f9fa9",
1023
+ "500": "#71717b",
1024
+ "600": "#52525c",
1025
+ "700": "#3f3f46",
1026
+ "800": "#27272a",
1027
+ "900": "#18181b",
1028
+ "950": "#09090b"
1029
+ },
1030
+ "neutral": {
1031
+ "50": "#fafafa",
1032
+ "100": "#f5f5f5",
1033
+ "200": "#e5e5e5",
1034
+ "300": "#d4d4d4",
1035
+ "400": "#a1a1a1",
1036
+ "500": "#737373",
1037
+ "600": "#525252",
1038
+ "700": "#404040",
1039
+ "800": "#262626",
1040
+ "900": "#171717",
1041
+ "950": "#0a0a0a"
1042
+ },
1043
+ "stone": {
1044
+ "50": "#fafaf9",
1045
+ "100": "#f5f5f4",
1046
+ "200": "#e7e5e4",
1047
+ "300": "#d6d3d1",
1048
+ "400": "#a6a09b",
1049
+ "500": "#79716b",
1050
+ "600": "#57534d",
1051
+ "700": "#44403b",
1052
+ "800": "#292524",
1053
+ "900": "#1c1917",
1054
+ "950": "#0c0a09"
1055
+ },
1056
+ "mauve": {
1057
+ "50": "#fafafa",
1058
+ "100": "#f3f1f3",
1059
+ "200": "#e7e4e7",
1060
+ "300": "#d7d0d7",
1061
+ "400": "#a89ea9",
1062
+ "500": "#79697b",
1063
+ "600": "#594c5b",
1064
+ "700": "#463947",
1065
+ "800": "#2a212c",
1066
+ "900": "#1d161e",
1067
+ "950": "#0c090c"
1068
+ },
1069
+ "olive": {
1070
+ "50": "#fbfbf9",
1071
+ "100": "#f4f4f0",
1072
+ "200": "#e8e8e3",
1073
+ "300": "#d8d8d0",
1074
+ "400": "#abab9c",
1075
+ "500": "#7c7c67",
1076
+ "600": "#5b5b4b",
1077
+ "700": "#474739",
1078
+ "800": "#2b2b22",
1079
+ "900": "#1d1d16",
1080
+ "950": "#0c0c09"
1081
+ },
1082
+ "mist": {
1083
+ "50": "#f9fbfb",
1084
+ "100": "#f1f3f3",
1085
+ "200": "#e3e7e8",
1086
+ "300": "#d0d6d8",
1087
+ "400": "#9ca8ab",
1088
+ "500": "#67787c",
1089
+ "600": "#4b585b",
1090
+ "700": "#394447",
1091
+ "800": "#22292b",
1092
+ "900": "#161b1d",
1093
+ "950": "#090b0c"
1094
+ },
1095
+ "taupe": {
1096
+ "50": "#fbfaf9",
1097
+ "100": "#f3f1f1",
1098
+ "200": "#e8e4e3",
1099
+ "300": "#d8d2d0",
1100
+ "400": "#aba09c",
1101
+ "500": "#7c6d67",
1102
+ "600": "#5b4f4b",
1103
+ "700": "#473c39",
1104
+ "800": "#2b2422",
1105
+ "900": "#1d1816",
1106
+ "950": "#0c0a09"
1107
+ }
1108
+ }
769
1109
  },
770
1110
  "space": {
771
1111
  "0": "0rem",
@@ -1178,6 +1518,57 @@ var coreTokens = {
1178
1518
  "fontWeight": 900,
1179
1519
  "letterSpacing": "0em"
1180
1520
  }
1521
+ },
1522
+ "heading": {
1523
+ "h1": {
1524
+ "fontFamily": "{typography.families.sans}",
1525
+ "fontSize": "{typography.scale.5xl.fontSize}",
1526
+ "lineHeight": "{typography.scale.5xl.lineHeight}",
1527
+ "fontWeight": 800,
1528
+ "letterSpacing": "{typography.scale.5xl.letterSpacing}"
1529
+ },
1530
+ "h2": {
1531
+ "fontFamily": "{typography.families.sans}",
1532
+ "fontSize": "{typography.scale.4xl.fontSize}",
1533
+ "lineHeight": "{typography.scale.4xl.lineHeight}",
1534
+ "fontWeight": 700,
1535
+ "letterSpacing": "{typography.scale.4xl.letterSpacing}"
1536
+ },
1537
+ "h3": {
1538
+ "fontFamily": "{typography.families.sans}",
1539
+ "fontSize": "{typography.scale.3xl.fontSize}",
1540
+ "lineHeight": "{typography.scale.3xl.lineHeight}",
1541
+ "fontWeight": 700,
1542
+ "letterSpacing": "{typography.scale.3xl.letterSpacing}"
1543
+ },
1544
+ "h4": {
1545
+ "fontFamily": "{typography.families.sans}",
1546
+ "fontSize": "{typography.scale.2xl.fontSize}",
1547
+ "lineHeight": "{typography.scale.2xl.lineHeight}",
1548
+ "fontWeight": 600,
1549
+ "letterSpacing": "{typography.scale.2xl.letterSpacing}"
1550
+ },
1551
+ "h5": {
1552
+ "fontFamily": "{typography.families.sans}",
1553
+ "fontSize": "{typography.scale.xl.fontSize}",
1554
+ "lineHeight": "{typography.scale.xl.lineHeight}",
1555
+ "fontWeight": 600,
1556
+ "letterSpacing": "{typography.scale.xl.letterSpacing}"
1557
+ },
1558
+ "h6": {
1559
+ "fontFamily": "{typography.families.sans}",
1560
+ "fontSize": "{typography.scale.lg.fontSize}",
1561
+ "lineHeight": "{typography.scale.lg.lineHeight}",
1562
+ "fontWeight": 600,
1563
+ "letterSpacing": "{typography.scale.lg.letterSpacing}"
1564
+ }
1565
+ },
1566
+ "body": {
1567
+ "fontFamily": "{typography.families.sans}",
1568
+ "fontSize": "{typography.scale.md.fontSize}",
1569
+ "lineHeight": "{typography.scale.md.lineHeight}",
1570
+ "fontWeight": 400,
1571
+ "letterSpacing": "{typography.scale.md.letterSpacing}"
1181
1572
  }
1182
1573
  }
1183
1574
  };
@@ -1266,14 +1657,17 @@ var createCssVariableMap = (tokens2, options = {}) => {
1266
1657
  if (value === void 0) return;
1267
1658
  map[name] = resolveValue(tokens2, value);
1268
1659
  };
1269
- Object.entries(baseTokens.colors).forEach(([group, scale]) => {
1270
- if (typeof scale === "string" || typeof scale === "number") {
1271
- assign(toVariableName(prefix, "color", group), scale);
1660
+ const assignColorGroup = (parts, value) => {
1661
+ if (typeof value === "string" || typeof value === "number") {
1662
+ assign(toVariableName(prefix, "color", ...parts), value);
1272
1663
  return;
1273
1664
  }
1274
- Object.entries(scale).forEach(([step, value]) => {
1275
- assign(toVariableName(prefix, "color", group, step), value);
1665
+ Object.entries(value).forEach(([key, nested]) => {
1666
+ assignColorGroup([...parts, key], nested);
1276
1667
  });
1668
+ };
1669
+ Object.entries(baseTokens.colors).forEach(([group, scale]) => {
1670
+ assignColorGroup([group], scale);
1277
1671
  });
1278
1672
  if (baseTokens.space) {
1279
1673
  Object.entries(baseTokens.space).forEach(([key, value]) => {
@@ -1362,6 +1756,23 @@ var createCssVariableMap = (tokens2, options = {}) => {
1362
1756
  const scaleEntry = entry;
1363
1757
  assign(toVariableName(prefix, "font", key, "letter-spacing"), scaleEntry.letterSpacing);
1364
1758
  });
1759
+ const assignRole = (rolePrefixParts, entry) => {
1760
+ assign(toVariableName(prefix, ...rolePrefixParts, "family"), entry.fontFamily);
1761
+ assign(toVariableName(prefix, ...rolePrefixParts, "size"), entry.fontSize);
1762
+ assign(toVariableName(prefix, ...rolePrefixParts, "line-height"), entry.lineHeight);
1763
+ assign(toVariableName(prefix, ...rolePrefixParts, "weight"), entry.fontWeight);
1764
+ assign(toVariableName(prefix, ...rolePrefixParts, "letter-spacing"), entry.letterSpacing);
1765
+ };
1766
+ const heading = baseTokens.typography?.heading;
1767
+ if (heading) {
1768
+ Object.entries(heading).forEach(([level, entry]) => {
1769
+ assignRole(["heading", level], entry);
1770
+ });
1771
+ }
1772
+ const body = baseTokens.typography?.body;
1773
+ if (body) {
1774
+ assignRole(["body"], body);
1775
+ }
1365
1776
  Object.entries(baseTokens.shadows).forEach(([key, value]) => {
1366
1777
  assign(toVariableName(prefix, "shadow", key), value);
1367
1778
  });
@@ -1506,66 +1917,10 @@ ${darkBlock}
1506
1917
 
1507
1918
  // src/index.ts
1508
1919
  var tokens = coreTokens;
1509
- var sanitizeFontFamily = (value) => value.split(",").map((segment) => segment.trim().replace(/^['"]|['"]$/g, "")).filter(Boolean);
1510
- var createTailwindTheme = (source = tokens) => {
1511
- const colors = {};
1512
- Object.entries(source.colors).forEach(([group, value]) => {
1513
- if (typeof value === "object" && value !== null) {
1514
- colors[group] = { ...value };
1515
- } else {
1516
- colors[group] = value;
1517
- }
1518
- });
1519
- const fontFamily = Object.entries(source.typography.families).reduce((acc, [key, value]) => {
1520
- acc[key] = sanitizeFontFamily(value);
1521
- return acc;
1522
- }, {});
1523
- const fontSize = Object.entries(source.typography.scale).reduce((acc, [key, entry]) => {
1524
- acc[key] = [
1525
- entry.fontSize,
1526
- {
1527
- lineHeight: entry.lineHeight,
1528
- ...entry.fontWeight ? { fontWeight: entry.fontWeight } : {},
1529
- ..."letterSpacing" in entry ? { letterSpacing: entry.letterSpacing } : {}
1530
- }
1531
- ];
1532
- return acc;
1533
- }, {});
1534
- return {
1535
- colors,
1536
- spacing: { ...source.space ?? {} },
1537
- borderRadius: { ...source.radii ?? {} },
1538
- fontFamily,
1539
- fontSize,
1540
- boxShadow: { ...source.shadows },
1541
- screens: { ...source.breakpoints },
1542
- zIndex: { ...source.zIndex },
1543
- transitionDuration: { ...source.transitions.duration },
1544
- transitionTimingFunction: { ...source.transitions.easing },
1545
- opacity: { ...source.opacity },
1546
- maxWidth: {
1547
- container: source.layout?.container?.maxWidth,
1548
- prose: source.layout?.container?.maxWidthProse
1549
- },
1550
- width: {
1551
- sidebar: source.layout?.sidebar?.width
1552
- },
1553
- borderWidth: {
1554
- DEFAULT: source.border?.width.base,
1555
- ...source.border?.width ?? {}
1556
- }
1557
- };
1558
- };
1559
- var tailwindTheme = createTailwindTheme(tokens);
1560
- var tailwindPreset = {
1561
- theme: tailwindTheme
1562
- };
1563
1920
  var index_default = tokens;
1564
1921
  export {
1565
1922
  index_default as default,
1566
1923
  generateCssVariables,
1567
- tailwindPreset,
1568
- tailwindTheme,
1569
1924
  tokens
1570
1925
  };
1571
1926
  //# sourceMappingURL=index.js.map