@phcdevworks/spectre-tokens 4.13.0 → 4.15.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 +204 -8
- package/dist/index.cjs +288 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +569 -50
- package/dist/index.d.cts +130 -1
- package/dist/index.d.ts +130 -1
- package/dist/index.js +288 -72
- package/dist/index.js.map +1 -1
- package/dist/tokens.dtcg.json +421 -48
- package/package.json +10 -10
- package/tokens/components.json +1 -1
- package/tokens/modes.json +111 -2
- package/tokens/primitives.json +15 -0
- package/tokens/semantic-roles.json +56 -0
- package/tokens/typography.json +114 -38
package/dist/index.cjs
CHANGED
|
@@ -438,7 +438,7 @@ var coreTokens = {
|
|
|
438
438
|
},
|
|
439
439
|
"text": "{colors.neutral.900}",
|
|
440
440
|
"divider": "{colors.neutral.200}",
|
|
441
|
-
"stripeBg": "{colors.
|
|
441
|
+
"stripeBg": "{colors.black} / 0.05",
|
|
442
442
|
"hoverBg": "{colors.neutral.100}",
|
|
443
443
|
"selectedBg": "{colors.info.50}",
|
|
444
444
|
"row": {
|
|
@@ -1519,7 +1519,7 @@ var coreTokens = {
|
|
|
1519
1519
|
},
|
|
1520
1520
|
"text": "{colors.neutral.900}",
|
|
1521
1521
|
"divider": "{colors.neutral.200}",
|
|
1522
|
-
"stripeBg": "{colors.
|
|
1522
|
+
"stripeBg": "{colors.black} / 0.05",
|
|
1523
1523
|
"hoverBg": "{colors.neutral.100}",
|
|
1524
1524
|
"selectedBg": "{colors.info.50}",
|
|
1525
1525
|
"row": {
|
|
@@ -1955,6 +1955,11 @@ var coreTokens = {
|
|
|
1955
1955
|
}
|
|
1956
1956
|
},
|
|
1957
1957
|
"dark": {
|
|
1958
|
+
"action": {
|
|
1959
|
+
"onPage": "{colors.brand.400}",
|
|
1960
|
+
"onSurface": "{colors.brand.400}",
|
|
1961
|
+
"rail": "{colors.brand.400}"
|
|
1962
|
+
},
|
|
1958
1963
|
"surface": {
|
|
1959
1964
|
"page": "{colors.neutral.900}",
|
|
1960
1965
|
"card": "{colors.neutral.800}",
|
|
@@ -2382,7 +2387,7 @@ var coreTokens = {
|
|
|
2382
2387
|
},
|
|
2383
2388
|
"text": "{colors.neutral.100}",
|
|
2384
2389
|
"divider": "{colors.neutral.700}",
|
|
2385
|
-
"stripeBg": "{colors.
|
|
2390
|
+
"stripeBg": "{colors.white} / 0.06",
|
|
2386
2391
|
"hoverBg": "{colors.neutral.700}",
|
|
2387
2392
|
"selectedBg": "{colors.info.900}",
|
|
2388
2393
|
"row": {
|
|
@@ -2815,9 +2820,26 @@ var coreTokens = {
|
|
|
2815
2820
|
"spelling": "{colors.error.400}",
|
|
2816
2821
|
"grammar": "{colors.info.400}"
|
|
2817
2822
|
}
|
|
2823
|
+
},
|
|
2824
|
+
"link": {
|
|
2825
|
+
"default": "{colors.brand.400}",
|
|
2826
|
+
"hover": "{colors.brand.300}",
|
|
2827
|
+
"active": "{colors.brand.200}",
|
|
2828
|
+
"visited": "{colors.accent.300}",
|
|
2829
|
+
"underline": "{colors.brand.400} / 0.4",
|
|
2830
|
+
"underlineHover": "{colors.brand.300}"
|
|
2818
2831
|
}
|
|
2819
2832
|
},
|
|
2820
2833
|
"highContrast": {
|
|
2834
|
+
"action": {
|
|
2835
|
+
"bg": "{colors.brand.800}",
|
|
2836
|
+
"bgHover": "{colors.brand.900}",
|
|
2837
|
+
"bgActive": "{colors.brand.900}",
|
|
2838
|
+
"text": "{colors.white}",
|
|
2839
|
+
"onPage": "{colors.brand.900}",
|
|
2840
|
+
"onSurface": "{colors.brand.900}",
|
|
2841
|
+
"rail": "{colors.brand.900}"
|
|
2842
|
+
},
|
|
2821
2843
|
"surface": {
|
|
2822
2844
|
"page": "{colors.white}",
|
|
2823
2845
|
"card": "{colors.white}",
|
|
@@ -4634,6 +4656,21 @@ var coreTokens = {
|
|
|
4634
4656
|
"extrabold": 800,
|
|
4635
4657
|
"black": 900
|
|
4636
4658
|
},
|
|
4659
|
+
"fontSize": {
|
|
4660
|
+
"12": "0.75rem",
|
|
4661
|
+
"14": "0.875rem",
|
|
4662
|
+
"16": "1rem",
|
|
4663
|
+
"18": "1.125rem",
|
|
4664
|
+
"20": "1.25rem",
|
|
4665
|
+
"24": "1.5rem",
|
|
4666
|
+
"30": "1.875rem",
|
|
4667
|
+
"36": "2.25rem",
|
|
4668
|
+
"48": "3rem",
|
|
4669
|
+
"60": "3.75rem",
|
|
4670
|
+
"72": "4.5rem",
|
|
4671
|
+
"96": "6rem",
|
|
4672
|
+
"128": "8rem"
|
|
4673
|
+
},
|
|
4637
4674
|
"surface": {
|
|
4638
4675
|
"page": "{colors.neutral.50}",
|
|
4639
4676
|
"card": "{colors.white}",
|
|
@@ -4655,6 +4692,16 @@ var coreTokens = {
|
|
|
4655
4692
|
"underline": "{colors.brand.600} / 0.4",
|
|
4656
4693
|
"underlineHover": "{colors.brand.700}"
|
|
4657
4694
|
},
|
|
4695
|
+
"action": {
|
|
4696
|
+
"bg": "{colors.brand.700}",
|
|
4697
|
+
"bgHover": "{colors.brand.800}",
|
|
4698
|
+
"bgActive": "{colors.brand.900}",
|
|
4699
|
+
"text": "{colors.white}",
|
|
4700
|
+
"focusRing": "{colors.brand.500} / 0.4",
|
|
4701
|
+
"onPage": "{colors.brand.700}",
|
|
4702
|
+
"onSurface": "{colors.brand.700}",
|
|
4703
|
+
"rail": "{colors.brand.700}"
|
|
4704
|
+
},
|
|
4658
4705
|
"text": {
|
|
4659
4706
|
"onPage": {
|
|
4660
4707
|
"default": "{colors.neutral.900}",
|
|
@@ -4829,46 +4876,64 @@ var coreTokens = {
|
|
|
4829
4876
|
"letterSpacing": "0em"
|
|
4830
4877
|
},
|
|
4831
4878
|
"lg": {
|
|
4879
|
+
"size": "1.125rem",
|
|
4880
|
+
"lineHeight": "1.875rem",
|
|
4881
|
+
"weight": 500,
|
|
4882
|
+
"letterSpacing": "0em"
|
|
4883
|
+
},
|
|
4884
|
+
"xl": {
|
|
4832
4885
|
"size": "1.25rem",
|
|
4833
4886
|
"lineHeight": "2rem",
|
|
4834
4887
|
"weight": 600,
|
|
4835
4888
|
"letterSpacing": "0em"
|
|
4836
4889
|
},
|
|
4837
|
-
"
|
|
4890
|
+
"2xl": {
|
|
4838
4891
|
"size": "1.5rem",
|
|
4839
4892
|
"lineHeight": "2.125rem",
|
|
4840
4893
|
"weight": 600,
|
|
4841
4894
|
"letterSpacing": "0em"
|
|
4842
4895
|
},
|
|
4843
|
-
"
|
|
4896
|
+
"3xl": {
|
|
4844
4897
|
"size": "1.875rem",
|
|
4845
4898
|
"lineHeight": "2.5rem",
|
|
4846
4899
|
"weight": 700,
|
|
4847
4900
|
"letterSpacing": "0em"
|
|
4848
4901
|
},
|
|
4849
|
-
"
|
|
4902
|
+
"4xl": {
|
|
4850
4903
|
"size": "2.25rem",
|
|
4851
4904
|
"lineHeight": "2.75rem",
|
|
4852
4905
|
"weight": 700,
|
|
4853
4906
|
"letterSpacing": "0em"
|
|
4854
4907
|
},
|
|
4855
|
-
"
|
|
4908
|
+
"5xl": {
|
|
4856
4909
|
"size": "3rem",
|
|
4857
4910
|
"lineHeight": "3.5rem",
|
|
4858
4911
|
"weight": 800,
|
|
4859
4912
|
"letterSpacing": "0em"
|
|
4860
4913
|
},
|
|
4861
|
-
"
|
|
4914
|
+
"6xl": {
|
|
4862
4915
|
"size": "3.75rem",
|
|
4863
4916
|
"lineHeight": "4.25rem",
|
|
4864
4917
|
"weight": 800,
|
|
4865
4918
|
"letterSpacing": "0em"
|
|
4866
4919
|
},
|
|
4867
|
-
"
|
|
4920
|
+
"7xl": {
|
|
4868
4921
|
"size": "4.5rem",
|
|
4869
4922
|
"lineHeight": "5rem",
|
|
4870
4923
|
"weight": 900,
|
|
4871
4924
|
"letterSpacing": "0em"
|
|
4925
|
+
},
|
|
4926
|
+
"8xl": {
|
|
4927
|
+
"size": "6rem",
|
|
4928
|
+
"lineHeight": "6.5rem",
|
|
4929
|
+
"weight": 900,
|
|
4930
|
+
"letterSpacing": "0em"
|
|
4931
|
+
},
|
|
4932
|
+
"9xl": {
|
|
4933
|
+
"size": "8rem",
|
|
4934
|
+
"lineHeight": "8.5rem",
|
|
4935
|
+
"weight": 900,
|
|
4936
|
+
"letterSpacing": "0em"
|
|
4872
4937
|
}
|
|
4873
4938
|
},
|
|
4874
4939
|
"typography": {
|
|
@@ -4897,77 +4962,95 @@ var coreTokens = {
|
|
|
4897
4962
|
"letterSpacing": "0em"
|
|
4898
4963
|
},
|
|
4899
4964
|
"lg": {
|
|
4965
|
+
"fontSize": "1.125rem",
|
|
4966
|
+
"lineHeight": "1.875rem",
|
|
4967
|
+
"fontWeight": 500,
|
|
4968
|
+
"letterSpacing": "0em"
|
|
4969
|
+
},
|
|
4970
|
+
"xl": {
|
|
4900
4971
|
"fontSize": "1.25rem",
|
|
4901
4972
|
"lineHeight": "2rem",
|
|
4902
4973
|
"fontWeight": 600,
|
|
4903
4974
|
"letterSpacing": "0em"
|
|
4904
4975
|
},
|
|
4905
|
-
"
|
|
4976
|
+
"2xl": {
|
|
4906
4977
|
"fontSize": "1.5rem",
|
|
4907
4978
|
"lineHeight": "2.125rem",
|
|
4908
4979
|
"fontWeight": 600,
|
|
4909
4980
|
"letterSpacing": "0em"
|
|
4910
4981
|
},
|
|
4911
|
-
"
|
|
4982
|
+
"3xl": {
|
|
4912
4983
|
"fontSize": "1.875rem",
|
|
4913
4984
|
"lineHeight": "2.5rem",
|
|
4914
4985
|
"fontWeight": 700,
|
|
4915
4986
|
"letterSpacing": "0em"
|
|
4916
4987
|
},
|
|
4917
|
-
"
|
|
4988
|
+
"4xl": {
|
|
4918
4989
|
"fontSize": "2.25rem",
|
|
4919
4990
|
"lineHeight": "2.75rem",
|
|
4920
4991
|
"fontWeight": 700,
|
|
4921
4992
|
"letterSpacing": "0em"
|
|
4922
4993
|
},
|
|
4923
|
-
"
|
|
4994
|
+
"5xl": {
|
|
4924
4995
|
"fontSize": "3rem",
|
|
4925
4996
|
"lineHeight": "3.5rem",
|
|
4926
4997
|
"fontWeight": 800,
|
|
4927
4998
|
"letterSpacing": "0em"
|
|
4928
4999
|
},
|
|
4929
|
-
"
|
|
5000
|
+
"6xl": {
|
|
4930
5001
|
"fontSize": "3.75rem",
|
|
4931
5002
|
"lineHeight": "4.25rem",
|
|
4932
5003
|
"fontWeight": 800,
|
|
4933
5004
|
"letterSpacing": "0em"
|
|
4934
5005
|
},
|
|
4935
|
-
"
|
|
5006
|
+
"7xl": {
|
|
4936
5007
|
"fontSize": "4.5rem",
|
|
4937
5008
|
"lineHeight": "5rem",
|
|
4938
5009
|
"fontWeight": 900,
|
|
4939
5010
|
"letterSpacing": "0em"
|
|
5011
|
+
},
|
|
5012
|
+
"8xl": {
|
|
5013
|
+
"fontSize": "6rem",
|
|
5014
|
+
"lineHeight": "6.5rem",
|
|
5015
|
+
"fontWeight": 900,
|
|
5016
|
+
"letterSpacing": "0em"
|
|
5017
|
+
},
|
|
5018
|
+
"9xl": {
|
|
5019
|
+
"fontSize": "8rem",
|
|
5020
|
+
"lineHeight": "8.5rem",
|
|
5021
|
+
"fontWeight": 900,
|
|
5022
|
+
"letterSpacing": "0em"
|
|
4940
5023
|
}
|
|
4941
5024
|
},
|
|
4942
5025
|
"heading": {
|
|
4943
5026
|
"h1": {
|
|
4944
|
-
"fontFamily": "{typography.families.sans}",
|
|
4945
|
-
"fontSize": "{typography.scale.5xl.fontSize}",
|
|
4946
|
-
"lineHeight": "{typography.scale.5xl.lineHeight}",
|
|
4947
|
-
"fontWeight": 800,
|
|
4948
|
-
"letterSpacing": "{typography.scale.5xl.letterSpacing}"
|
|
4949
|
-
},
|
|
4950
|
-
"h2": {
|
|
4951
5027
|
"fontFamily": "{typography.families.sans}",
|
|
4952
5028
|
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
4953
5029
|
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
4954
|
-
"fontWeight":
|
|
5030
|
+
"fontWeight": 800,
|
|
4955
5031
|
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
4956
5032
|
},
|
|
4957
|
-
"
|
|
5033
|
+
"h2": {
|
|
4958
5034
|
"fontFamily": "{typography.families.sans}",
|
|
4959
5035
|
"fontSize": "{typography.scale.3xl.fontSize}",
|
|
4960
5036
|
"lineHeight": "{typography.scale.3xl.lineHeight}",
|
|
4961
5037
|
"fontWeight": 700,
|
|
4962
5038
|
"letterSpacing": "{typography.scale.3xl.letterSpacing}"
|
|
4963
5039
|
},
|
|
4964
|
-
"
|
|
5040
|
+
"h3": {
|
|
4965
5041
|
"fontFamily": "{typography.families.sans}",
|
|
4966
5042
|
"fontSize": "{typography.scale.2xl.fontSize}",
|
|
4967
5043
|
"lineHeight": "{typography.scale.2xl.lineHeight}",
|
|
4968
|
-
"fontWeight":
|
|
5044
|
+
"fontWeight": 700,
|
|
4969
5045
|
"letterSpacing": "{typography.scale.2xl.letterSpacing}"
|
|
4970
5046
|
},
|
|
5047
|
+
"h4": {
|
|
5048
|
+
"fontFamily": "{typography.families.sans}",
|
|
5049
|
+
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5050
|
+
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5051
|
+
"fontWeight": 600,
|
|
5052
|
+
"letterSpacing": "{typography.scale.xl.letterSpacing}"
|
|
5053
|
+
},
|
|
4971
5054
|
"h5": {
|
|
4972
5055
|
"fontFamily": "{typography.families.sans}",
|
|
4973
5056
|
"fontSize": "{typography.scale.xl.fontSize}",
|
|
@@ -4977,10 +5060,10 @@ var coreTokens = {
|
|
|
4977
5060
|
},
|
|
4978
5061
|
"h6": {
|
|
4979
5062
|
"fontFamily": "{typography.families.sans}",
|
|
4980
|
-
"fontSize": "{typography.scale.
|
|
4981
|
-
"lineHeight": "{typography.scale.
|
|
5063
|
+
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5064
|
+
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
4982
5065
|
"fontWeight": 600,
|
|
4983
|
-
"letterSpacing": "{typography.scale.
|
|
5066
|
+
"letterSpacing": "{typography.scale.xl.letterSpacing}"
|
|
4984
5067
|
}
|
|
4985
5068
|
},
|
|
4986
5069
|
"body": {
|
|
@@ -4993,17 +5076,17 @@ var coreTokens = {
|
|
|
4993
5076
|
"display": {
|
|
4994
5077
|
"1": {
|
|
4995
5078
|
"fontFamily": "{typography.families.sans}",
|
|
4996
|
-
"fontSize": "{typography.scale.
|
|
4997
|
-
"lineHeight": "{typography.scale.
|
|
5079
|
+
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5080
|
+
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
4998
5081
|
"fontWeight": 800,
|
|
4999
|
-
"letterSpacing": "{typography.scale.
|
|
5082
|
+
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5000
5083
|
},
|
|
5001
5084
|
"2": {
|
|
5002
5085
|
"fontFamily": "{typography.families.sans}",
|
|
5003
|
-
"fontSize": "{typography.scale.
|
|
5004
|
-
"lineHeight": "{typography.scale.
|
|
5086
|
+
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5087
|
+
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5005
5088
|
"fontWeight": 800,
|
|
5006
|
-
"letterSpacing": "{typography.scale.
|
|
5089
|
+
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5007
5090
|
},
|
|
5008
5091
|
"3": {
|
|
5009
5092
|
"fontFamily": "{typography.families.sans}",
|
|
@@ -5014,32 +5097,72 @@ var coreTokens = {
|
|
|
5014
5097
|
},
|
|
5015
5098
|
"4": {
|
|
5016
5099
|
"fontFamily": "{typography.families.sans}",
|
|
5017
|
-
"fontSize": "{typography.scale.
|
|
5018
|
-
"lineHeight": "{typography.scale.
|
|
5100
|
+
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5101
|
+
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5019
5102
|
"fontWeight": 700,
|
|
5020
|
-
"letterSpacing": "{typography.scale.
|
|
5103
|
+
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5021
5104
|
},
|
|
5022
5105
|
"5": {
|
|
5023
5106
|
"fontFamily": "{typography.families.sans}",
|
|
5024
|
-
"fontSize": "{typography.scale.
|
|
5025
|
-
"lineHeight": "{typography.scale.
|
|
5107
|
+
"fontSize": "{typography.scale.3xl.fontSize}",
|
|
5108
|
+
"lineHeight": "{typography.scale.3xl.lineHeight}",
|
|
5026
5109
|
"fontWeight": 600,
|
|
5027
|
-
"letterSpacing": "{typography.scale.
|
|
5110
|
+
"letterSpacing": "{typography.scale.3xl.letterSpacing}"
|
|
5028
5111
|
},
|
|
5029
5112
|
"6": {
|
|
5030
5113
|
"fontFamily": "{typography.families.sans}",
|
|
5031
|
-
"fontSize": "{typography.scale.
|
|
5032
|
-
"lineHeight": "{typography.scale.
|
|
5114
|
+
"fontSize": "{typography.scale.2xl.fontSize}",
|
|
5115
|
+
"lineHeight": "{typography.scale.2xl.lineHeight}",
|
|
5033
5116
|
"fontWeight": 600,
|
|
5034
|
-
"letterSpacing": "{typography.scale.
|
|
5117
|
+
"letterSpacing": "{typography.scale.2xl.letterSpacing}"
|
|
5035
5118
|
}
|
|
5036
5119
|
},
|
|
5037
5120
|
"lead": {
|
|
5038
5121
|
"fontFamily": "{typography.families.sans}",
|
|
5039
|
-
"fontSize": "{typography.scale.
|
|
5040
|
-
"lineHeight": "{typography.scale.
|
|
5122
|
+
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5123
|
+
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5041
5124
|
"fontWeight": 400,
|
|
5042
|
-
"letterSpacing": "{typography.scale.
|
|
5125
|
+
"letterSpacing": "{typography.scale.xl.letterSpacing}"
|
|
5126
|
+
},
|
|
5127
|
+
"responsive": {
|
|
5128
|
+
"md": {
|
|
5129
|
+
"heading": {
|
|
5130
|
+
"h1": {
|
|
5131
|
+
"fontSize": "{typography.scale.6xl.fontSize}",
|
|
5132
|
+
"lineHeight": "{typography.scale.6xl.lineHeight}"
|
|
5133
|
+
},
|
|
5134
|
+
"h2": {
|
|
5135
|
+
"fontSize": "{typography.scale.5xl.fontSize}",
|
|
5136
|
+
"lineHeight": "{typography.scale.5xl.lineHeight}"
|
|
5137
|
+
},
|
|
5138
|
+
"h3": {
|
|
5139
|
+
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5140
|
+
"lineHeight": "{typography.scale.4xl.lineHeight}"
|
|
5141
|
+
},
|
|
5142
|
+
"h4": {
|
|
5143
|
+
"fontSize": "{typography.scale.3xl.fontSize}",
|
|
5144
|
+
"lineHeight": "{typography.scale.3xl.lineHeight}"
|
|
5145
|
+
},
|
|
5146
|
+
"h5": {
|
|
5147
|
+
"fontSize": "{typography.scale.2xl.fontSize}",
|
|
5148
|
+
"lineHeight": "{typography.scale.2xl.lineHeight}"
|
|
5149
|
+
}
|
|
5150
|
+
},
|
|
5151
|
+
"display": {
|
|
5152
|
+
"1": {
|
|
5153
|
+
"fontSize": "{typography.scale.7xl.fontSize}",
|
|
5154
|
+
"lineHeight": "{typography.scale.7xl.lineHeight}"
|
|
5155
|
+
},
|
|
5156
|
+
"2": {
|
|
5157
|
+
"fontSize": "{typography.scale.6xl.fontSize}",
|
|
5158
|
+
"lineHeight": "{typography.scale.6xl.lineHeight}"
|
|
5159
|
+
},
|
|
5160
|
+
"3": {
|
|
5161
|
+
"fontSize": "{typography.scale.5xl.fontSize}",
|
|
5162
|
+
"lineHeight": "{typography.scale.5xl.lineHeight}"
|
|
5163
|
+
}
|
|
5164
|
+
}
|
|
5165
|
+
}
|
|
5043
5166
|
}
|
|
5044
5167
|
}
|
|
5045
5168
|
};
|
|
@@ -5071,6 +5194,42 @@ var layoutResponsive = (layout) => {
|
|
|
5071
5194
|
const responsive = isPlainObject(layout) ? layout.responsive : void 0;
|
|
5072
5195
|
return isPlainObject(responsive) ? responsive : {};
|
|
5073
5196
|
};
|
|
5197
|
+
var ROLE_FIELD_SUFFIXES = {
|
|
5198
|
+
fontFamily: "family",
|
|
5199
|
+
fontSize: "size",
|
|
5200
|
+
lineHeight: "line-height",
|
|
5201
|
+
fontWeight: "weight",
|
|
5202
|
+
letterSpacing: "letter-spacing"
|
|
5203
|
+
};
|
|
5204
|
+
var typographyResponsive = (typography) => {
|
|
5205
|
+
const responsive = isPlainObject(typography) ? typography.responsive : void 0;
|
|
5206
|
+
if (!isPlainObject(responsive)) return [];
|
|
5207
|
+
return Object.entries(responsive).flatMap(
|
|
5208
|
+
([breakpoint, groups]) => Object.entries(groups).flatMap(([group, node]) => {
|
|
5209
|
+
const roles = Object.keys(node).some((key) => key in ROLE_FIELD_SUFFIXES) ? [[[group], node]] : Object.entries(node).map(([level, fields]) => [[group, level], fields]);
|
|
5210
|
+
return roles.flatMap(
|
|
5211
|
+
([roleParts, fields]) => Object.entries(fields).map(([field, value]) => {
|
|
5212
|
+
const suffix = ROLE_FIELD_SUFFIXES[field];
|
|
5213
|
+
if (suffix === void 0) {
|
|
5214
|
+
throw new Error(`typography.responsive.${breakpoint}.${roleParts.join(".")}.${field} is not a typography role field`);
|
|
5215
|
+
}
|
|
5216
|
+
return { breakpoint, roleParts: [...roleParts], suffix, value };
|
|
5217
|
+
})
|
|
5218
|
+
);
|
|
5219
|
+
})
|
|
5220
|
+
);
|
|
5221
|
+
};
|
|
5222
|
+
var ACTION_SYSTEM_FAMILIES = ["brand", "accent", "info"];
|
|
5223
|
+
var ACTION_EXCLUDED_PALETTE_FAMILIES = /* @__PURE__ */ new Set(["yellow", "integration-icy-blue"]);
|
|
5224
|
+
var actionFamilies = (tokens2) => {
|
|
5225
|
+
const colors = tokens2.colors;
|
|
5226
|
+
const palette = isPlainObject(colors.palette) ? colors.palette : {};
|
|
5227
|
+
return Object.fromEntries([
|
|
5228
|
+
...ACTION_SYSTEM_FAMILIES.map((name) => [name, colors[name]]),
|
|
5229
|
+
...Object.entries(palette).filter(([name]) => !ACTION_EXCLUDED_PALETTE_FAMILIES.has(name))
|
|
5230
|
+
]);
|
|
5231
|
+
};
|
|
5232
|
+
var actionSteps = (tokens2) => Object.keys(tokens2.colors.brand);
|
|
5074
5233
|
var resolveTokenReference = (tokens2, reference) => {
|
|
5075
5234
|
const path = reference.slice(1, -1).split(".");
|
|
5076
5235
|
let current = tokens2;
|
|
@@ -5157,6 +5316,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5157
5316
|
Object.entries(baseTokens.colors).forEach(([group, scale]) => {
|
|
5158
5317
|
assignColorGroup([group], scale);
|
|
5159
5318
|
});
|
|
5319
|
+
actionSteps(tokens2).forEach((step) => {
|
|
5320
|
+
assign(toVariableName(prefix, "action", step), baseTokens.colors.brand[step]);
|
|
5321
|
+
});
|
|
5160
5322
|
if (baseTokens.space) {
|
|
5161
5323
|
Object.entries(baseTokens.space).forEach(([key, value]) => {
|
|
5162
5324
|
assign(toVariableName(prefix, "space", key), value);
|
|
@@ -5262,6 +5424,12 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5262
5424
|
assign(toVariableName(prefix, "font-weight", key), value);
|
|
5263
5425
|
});
|
|
5264
5426
|
}
|
|
5427
|
+
const fontSize = baseTokens.fontSize;
|
|
5428
|
+
if (fontSize) {
|
|
5429
|
+
Object.entries(fontSize).forEach(([key, value]) => {
|
|
5430
|
+
assign(toVariableName(prefix, "font-size", key), value);
|
|
5431
|
+
});
|
|
5432
|
+
}
|
|
5265
5433
|
const textDecoration = baseTokens.textDecoration;
|
|
5266
5434
|
if (textDecoration) {
|
|
5267
5435
|
Object.entries(textDecoration).forEach(([group, scale]) => {
|
|
@@ -5305,11 +5473,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5305
5473
|
assign(toVariableName(prefix, "font", key, "letter-spacing"), scaleEntry.letterSpacing);
|
|
5306
5474
|
});
|
|
5307
5475
|
const assignRole = (rolePrefixParts, entry) => {
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
assign(toVariableName(prefix, ...rolePrefixParts, "weight"), entry.fontWeight);
|
|
5312
|
-
assign(toVariableName(prefix, ...rolePrefixParts, "letter-spacing"), entry.letterSpacing);
|
|
5476
|
+
Object.entries(ROLE_FIELD_SUFFIXES).forEach(([field, suffix]) => {
|
|
5477
|
+
assign(toVariableName(prefix, ...rolePrefixParts, suffix), entry[field]);
|
|
5478
|
+
});
|
|
5313
5479
|
};
|
|
5314
5480
|
const heading = baseTokens.typography?.heading;
|
|
5315
5481
|
if (heading) {
|
|
@@ -5331,6 +5497,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5331
5497
|
if (lead) {
|
|
5332
5498
|
assignRole(["lead"], lead);
|
|
5333
5499
|
}
|
|
5500
|
+
typographyResponsive(baseTokens.typography).forEach(({ breakpoint, roleParts, suffix, value }) => {
|
|
5501
|
+
assign(toVariableName(prefix, "typography", "responsive", breakpoint, ...roleParts, suffix), value);
|
|
5502
|
+
});
|
|
5334
5503
|
Object.entries(baseTokens.shadows).forEach(([key, value]) => {
|
|
5335
5504
|
if (typeof value === "string") {
|
|
5336
5505
|
assign(toVariableName(prefix, "shadow", key), value);
|
|
@@ -5478,14 +5647,28 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
5478
5647
|
(path) => ["form", ...path.map(kebabPathSegment)],
|
|
5479
5648
|
void 0
|
|
5480
5649
|
);
|
|
5650
|
+
const darkLink = getPath(darkMode, ["link"]);
|
|
5481
5651
|
const highContrastLink = getPath(highContrastMode, ["link"]);
|
|
5482
5652
|
Object.entries(linkTokens).forEach(([key, value]) => {
|
|
5483
5653
|
const varName = toVariableName(prefix, "link", kebabPathSegment(key));
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
addDark(varName, resolved);
|
|
5654
|
+
addBase(varName, pickSemantic(tokens2, value));
|
|
5655
|
+
addDark(varName, pickSemantic(tokens2, getPath(darkLink, [key]), value));
|
|
5487
5656
|
addHighContrast(varName, pickSemantic(tokens2, getPath(highContrastLink, [key]), value));
|
|
5488
5657
|
});
|
|
5658
|
+
const actionValue = (value) => {
|
|
5659
|
+
const match = typeof value === "string" ? value.match(/^\{colors\.brand\.([^}]+)\}(?:\s*\/\s*([0-9.]+))?$/) : null;
|
|
5660
|
+
if (!match) return pickSemantic(tokens2, value);
|
|
5661
|
+
const ramp = `var(${toVariableName(prefix, "action", match[1])})`;
|
|
5662
|
+
return match[2] === void 0 ? ramp : `color-mix(in srgb, ${ramp} ${Math.round(Number(match[2]) * 1e3) / 10}%, transparent)`;
|
|
5663
|
+
};
|
|
5664
|
+
const darkAction = getPath(darkMode, ["action"]);
|
|
5665
|
+
const highContrastAction = getPath(highContrastMode, ["action"]);
|
|
5666
|
+
Object.entries(tokens2.action ?? {}).forEach(([key, value]) => {
|
|
5667
|
+
const varName = toVariableName(prefix, "action", kebabPathSegment(key));
|
|
5668
|
+
addBase(varName, actionValue(value));
|
|
5669
|
+
addDark(varName, actionValue(getPath(darkAction, [key]) ?? value));
|
|
5670
|
+
addHighContrast(varName, actionValue(getPath(highContrastAction, [key]) ?? value));
|
|
5671
|
+
});
|
|
5489
5672
|
const highContrastButtons = getPath(highContrastMode, ["buttons"]);
|
|
5490
5673
|
if (isPlainObject(highContrastButtons)) {
|
|
5491
5674
|
Object.entries(highContrastButtons).forEach(([variant, states]) => {
|
|
@@ -5534,6 +5717,16 @@ ${indent}}`;
|
|
|
5534
5717
|
const systemDarkBlock = `@media (prefers-color-scheme: dark) {
|
|
5535
5718
|
${modeBlock(themeSelectors("system"), modeLines(darkEntries), " ")}
|
|
5536
5719
|
}`;
|
|
5720
|
+
const steps = actionSteps(tokens2);
|
|
5721
|
+
const actionBlocks = Object.entries(actionFamilies(tokens2)).map(([name, scale]) => {
|
|
5722
|
+
const lines = steps.map((step) => {
|
|
5723
|
+
if (scale[step] === void 0) throw new Error(`Action family "${name}" has no ${step} step`);
|
|
5724
|
+
return ` ${toVariableName(prefix, "action", step)}: ${resolveValue(tokens2, scale[step])};`;
|
|
5725
|
+
});
|
|
5726
|
+
return `${selector}[data-spectre-action="${name}"] {
|
|
5727
|
+
${lines.join("\n")}
|
|
5728
|
+
}`;
|
|
5729
|
+
});
|
|
5537
5730
|
const control = tokens2.control;
|
|
5538
5731
|
const compact = isPlainObject(control) && isPlainObject(control.compact) ? control.compact : {};
|
|
5539
5732
|
const densityLines = Object.entries(compact).flatMap(
|
|
@@ -5546,27 +5739,50 @@ ${modeBlock(themeSelectors("system"), modeLines(darkEntries), " ")}
|
|
|
5546
5739
|
${densityLines.join("\n")}
|
|
5547
5740
|
}`] : [];
|
|
5548
5741
|
const breakpoints = tokens2.breakpoints;
|
|
5549
|
-
const
|
|
5550
|
-
|
|
5551
|
-
if (
|
|
5552
|
-
throw new Error(
|
|
5742
|
+
const responsiveLines = /* @__PURE__ */ new Map();
|
|
5743
|
+
const addResponsive = (namespace, breakpoint, name, source) => {
|
|
5744
|
+
if (breakpoints[breakpoint] === void 0) {
|
|
5745
|
+
throw new Error(`${namespace}.responsive.${breakpoint} does not name a breakpoints entry`);
|
|
5553
5746
|
}
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5747
|
+
responsiveLines.set(breakpoint, [...responsiveLines.get(breakpoint) ?? [], ` ${name}: var(${source});`]);
|
|
5748
|
+
};
|
|
5749
|
+
Object.entries(layoutResponsive(tokens2.layout)).forEach(([breakpoint, scales]) => {
|
|
5750
|
+
LAYOUT_SCALES.forEach(({ path, varParts }) => {
|
|
5751
|
+
Object.keys(layoutScale(scales, path)).forEach((key) => {
|
|
5752
|
+
addResponsive(
|
|
5753
|
+
"layout",
|
|
5754
|
+
breakpoint,
|
|
5755
|
+
toVariableName(prefix, "layout", ...varParts, kebabCase(key)),
|
|
5756
|
+
toVariableName(prefix, "layout", "responsive", breakpoint, ...varParts, kebabCase(key))
|
|
5757
|
+
);
|
|
5758
|
+
});
|
|
5759
|
+
});
|
|
5760
|
+
});
|
|
5761
|
+
typographyResponsive(tokens2.typography).forEach(({ breakpoint, roleParts, suffix }) => {
|
|
5762
|
+
addResponsive(
|
|
5763
|
+
"typography",
|
|
5764
|
+
breakpoint,
|
|
5765
|
+
toVariableName(prefix, ...roleParts, suffix),
|
|
5766
|
+
toVariableName(prefix, "typography", "responsive", breakpoint, ...roleParts, suffix)
|
|
5560
5767
|
);
|
|
5561
|
-
|
|
5768
|
+
});
|
|
5769
|
+
const responsiveBlocks = Object.keys(breakpoints).filter((breakpoint) => responsiveLines.has(breakpoint)).map(
|
|
5770
|
+
(breakpoint) => `@media (min-width: ${resolveValue(tokens2, breakpoints[breakpoint])}) {
|
|
5562
5771
|
${selector} {
|
|
5563
|
-
${
|
|
5772
|
+
${responsiveLines.get(breakpoint).join("\n")}
|
|
5564
5773
|
}
|
|
5565
|
-
}
|
|
5566
|
-
|
|
5567
|
-
return [
|
|
5568
|
-
|
|
5569
|
-
|
|
5774
|
+
}`
|
|
5775
|
+
);
|
|
5776
|
+
return [
|
|
5777
|
+
rootBlock,
|
|
5778
|
+
darkBlock,
|
|
5779
|
+
highContrastBlock,
|
|
5780
|
+
lightBlock,
|
|
5781
|
+
systemDarkBlock,
|
|
5782
|
+
...actionBlocks,
|
|
5783
|
+
...densityBlocks,
|
|
5784
|
+
...responsiveBlocks
|
|
5785
|
+
].join("\n") + "\n";
|
|
5570
5786
|
};
|
|
5571
5787
|
|
|
5572
5788
|
// src/index.ts
|