@phcdevworks/spectre-tokens 4.14.0 → 4.16.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 +59 -2
- package/dist/index.cjs +219 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +550 -56
- package/dist/index.d.cts +83 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.js +219 -51
- package/dist/index.js.map +1 -1
- package/dist/tokens.dtcg.json +248 -24
- package/package.json +11 -11
- package/tokens/modes.json +115 -0
- package/tokens/semantic-roles.json +56 -0
- package/tokens/typography.json +64 -24
package/dist/index.d.cts
CHANGED
|
@@ -1926,6 +1926,11 @@ interface SpectreGeneratedTokens {
|
|
|
1926
1926
|
};
|
|
1927
1927
|
};
|
|
1928
1928
|
dark: {
|
|
1929
|
+
action: {
|
|
1930
|
+
onPage: string;
|
|
1931
|
+
onSurface: string;
|
|
1932
|
+
rail: string;
|
|
1933
|
+
};
|
|
1929
1934
|
surface: {
|
|
1930
1935
|
page: string;
|
|
1931
1936
|
card: string;
|
|
@@ -2795,8 +2800,31 @@ interface SpectreGeneratedTokens {
|
|
|
2795
2800
|
underline: string;
|
|
2796
2801
|
underlineHover: string;
|
|
2797
2802
|
};
|
|
2803
|
+
buttons: {
|
|
2804
|
+
secondary: {
|
|
2805
|
+
bg: string;
|
|
2806
|
+
bgHover: string;
|
|
2807
|
+
bgActive: string;
|
|
2808
|
+
bgDisabled: string;
|
|
2809
|
+
text: string;
|
|
2810
|
+
textDisabled: string;
|
|
2811
|
+
border: string;
|
|
2812
|
+
borderDisabled: string;
|
|
2813
|
+
focusRing: string;
|
|
2814
|
+
focusVisible: string;
|
|
2815
|
+
};
|
|
2816
|
+
};
|
|
2798
2817
|
};
|
|
2799
2818
|
highContrast: {
|
|
2819
|
+
action: {
|
|
2820
|
+
bg: string;
|
|
2821
|
+
bgHover: string;
|
|
2822
|
+
bgActive: string;
|
|
2823
|
+
text: string;
|
|
2824
|
+
onPage: string;
|
|
2825
|
+
onSurface: string;
|
|
2826
|
+
rail: string;
|
|
2827
|
+
};
|
|
2800
2828
|
surface: {
|
|
2801
2829
|
page: string;
|
|
2802
2830
|
card: string;
|
|
@@ -4649,6 +4677,16 @@ interface SpectreGeneratedTokens {
|
|
|
4649
4677
|
underline: string;
|
|
4650
4678
|
underlineHover: string;
|
|
4651
4679
|
};
|
|
4680
|
+
action: {
|
|
4681
|
+
bg: string;
|
|
4682
|
+
bgHover: string;
|
|
4683
|
+
bgActive: string;
|
|
4684
|
+
text: string;
|
|
4685
|
+
focusRing: string;
|
|
4686
|
+
onPage: string;
|
|
4687
|
+
onSurface: string;
|
|
4688
|
+
rail: string;
|
|
4689
|
+
};
|
|
4652
4690
|
text: {
|
|
4653
4691
|
onPage: {
|
|
4654
4692
|
default: string;
|
|
@@ -5071,6 +5109,46 @@ interface SpectreGeneratedTokens {
|
|
|
5071
5109
|
fontWeight: number;
|
|
5072
5110
|
letterSpacing: string;
|
|
5073
5111
|
};
|
|
5112
|
+
responsive: {
|
|
5113
|
+
md: {
|
|
5114
|
+
heading: {
|
|
5115
|
+
h1: {
|
|
5116
|
+
fontSize: string;
|
|
5117
|
+
lineHeight: string;
|
|
5118
|
+
};
|
|
5119
|
+
h2: {
|
|
5120
|
+
fontSize: string;
|
|
5121
|
+
lineHeight: string;
|
|
5122
|
+
};
|
|
5123
|
+
h3: {
|
|
5124
|
+
fontSize: string;
|
|
5125
|
+
lineHeight: string;
|
|
5126
|
+
};
|
|
5127
|
+
h4: {
|
|
5128
|
+
fontSize: string;
|
|
5129
|
+
lineHeight: string;
|
|
5130
|
+
};
|
|
5131
|
+
h5: {
|
|
5132
|
+
fontSize: string;
|
|
5133
|
+
lineHeight: string;
|
|
5134
|
+
};
|
|
5135
|
+
};
|
|
5136
|
+
display: {
|
|
5137
|
+
'1': {
|
|
5138
|
+
fontSize: string;
|
|
5139
|
+
lineHeight: string;
|
|
5140
|
+
};
|
|
5141
|
+
'2': {
|
|
5142
|
+
fontSize: string;
|
|
5143
|
+
lineHeight: string;
|
|
5144
|
+
};
|
|
5145
|
+
'3': {
|
|
5146
|
+
fontSize: string;
|
|
5147
|
+
lineHeight: string;
|
|
5148
|
+
};
|
|
5149
|
+
};
|
|
5150
|
+
};
|
|
5151
|
+
};
|
|
5074
5152
|
};
|
|
5075
5153
|
}
|
|
5076
5154
|
|
|
@@ -5098,6 +5176,10 @@ interface TypographyTokens {
|
|
|
5098
5176
|
body: TypographyBodyEntry;
|
|
5099
5177
|
display: Record<string, TypographyRoleEntry>;
|
|
5100
5178
|
lead: TypographyRoleEntry;
|
|
5179
|
+
responsive: Record<string, {
|
|
5180
|
+
heading?: Record<string, Partial<TypographyRoleEntry>>;
|
|
5181
|
+
display?: Record<string, Partial<TypographyRoleEntry>>;
|
|
5182
|
+
}>;
|
|
5101
5183
|
}
|
|
5102
5184
|
interface TransitionTokens {
|
|
5103
5185
|
duration: TokenScale;
|
|
@@ -5400,6 +5482,7 @@ interface SpectreModeTokens {
|
|
|
5400
5482
|
invalid?: Record<string, SemanticTokenValue>;
|
|
5401
5483
|
};
|
|
5402
5484
|
component: ComponentTokens<SemanticTokenValue>;
|
|
5485
|
+
action?: Record<string, SemanticTokenValue>;
|
|
5403
5486
|
buttons?: Record<string, Record<string, SemanticTokenValue>>;
|
|
5404
5487
|
link?: Record<string, SemanticTokenValue>;
|
|
5405
5488
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1926,6 +1926,11 @@ interface SpectreGeneratedTokens {
|
|
|
1926
1926
|
};
|
|
1927
1927
|
};
|
|
1928
1928
|
dark: {
|
|
1929
|
+
action: {
|
|
1930
|
+
onPage: string;
|
|
1931
|
+
onSurface: string;
|
|
1932
|
+
rail: string;
|
|
1933
|
+
};
|
|
1929
1934
|
surface: {
|
|
1930
1935
|
page: string;
|
|
1931
1936
|
card: string;
|
|
@@ -2795,8 +2800,31 @@ interface SpectreGeneratedTokens {
|
|
|
2795
2800
|
underline: string;
|
|
2796
2801
|
underlineHover: string;
|
|
2797
2802
|
};
|
|
2803
|
+
buttons: {
|
|
2804
|
+
secondary: {
|
|
2805
|
+
bg: string;
|
|
2806
|
+
bgHover: string;
|
|
2807
|
+
bgActive: string;
|
|
2808
|
+
bgDisabled: string;
|
|
2809
|
+
text: string;
|
|
2810
|
+
textDisabled: string;
|
|
2811
|
+
border: string;
|
|
2812
|
+
borderDisabled: string;
|
|
2813
|
+
focusRing: string;
|
|
2814
|
+
focusVisible: string;
|
|
2815
|
+
};
|
|
2816
|
+
};
|
|
2798
2817
|
};
|
|
2799
2818
|
highContrast: {
|
|
2819
|
+
action: {
|
|
2820
|
+
bg: string;
|
|
2821
|
+
bgHover: string;
|
|
2822
|
+
bgActive: string;
|
|
2823
|
+
text: string;
|
|
2824
|
+
onPage: string;
|
|
2825
|
+
onSurface: string;
|
|
2826
|
+
rail: string;
|
|
2827
|
+
};
|
|
2800
2828
|
surface: {
|
|
2801
2829
|
page: string;
|
|
2802
2830
|
card: string;
|
|
@@ -4649,6 +4677,16 @@ interface SpectreGeneratedTokens {
|
|
|
4649
4677
|
underline: string;
|
|
4650
4678
|
underlineHover: string;
|
|
4651
4679
|
};
|
|
4680
|
+
action: {
|
|
4681
|
+
bg: string;
|
|
4682
|
+
bgHover: string;
|
|
4683
|
+
bgActive: string;
|
|
4684
|
+
text: string;
|
|
4685
|
+
focusRing: string;
|
|
4686
|
+
onPage: string;
|
|
4687
|
+
onSurface: string;
|
|
4688
|
+
rail: string;
|
|
4689
|
+
};
|
|
4652
4690
|
text: {
|
|
4653
4691
|
onPage: {
|
|
4654
4692
|
default: string;
|
|
@@ -5071,6 +5109,46 @@ interface SpectreGeneratedTokens {
|
|
|
5071
5109
|
fontWeight: number;
|
|
5072
5110
|
letterSpacing: string;
|
|
5073
5111
|
};
|
|
5112
|
+
responsive: {
|
|
5113
|
+
md: {
|
|
5114
|
+
heading: {
|
|
5115
|
+
h1: {
|
|
5116
|
+
fontSize: string;
|
|
5117
|
+
lineHeight: string;
|
|
5118
|
+
};
|
|
5119
|
+
h2: {
|
|
5120
|
+
fontSize: string;
|
|
5121
|
+
lineHeight: string;
|
|
5122
|
+
};
|
|
5123
|
+
h3: {
|
|
5124
|
+
fontSize: string;
|
|
5125
|
+
lineHeight: string;
|
|
5126
|
+
};
|
|
5127
|
+
h4: {
|
|
5128
|
+
fontSize: string;
|
|
5129
|
+
lineHeight: string;
|
|
5130
|
+
};
|
|
5131
|
+
h5: {
|
|
5132
|
+
fontSize: string;
|
|
5133
|
+
lineHeight: string;
|
|
5134
|
+
};
|
|
5135
|
+
};
|
|
5136
|
+
display: {
|
|
5137
|
+
'1': {
|
|
5138
|
+
fontSize: string;
|
|
5139
|
+
lineHeight: string;
|
|
5140
|
+
};
|
|
5141
|
+
'2': {
|
|
5142
|
+
fontSize: string;
|
|
5143
|
+
lineHeight: string;
|
|
5144
|
+
};
|
|
5145
|
+
'3': {
|
|
5146
|
+
fontSize: string;
|
|
5147
|
+
lineHeight: string;
|
|
5148
|
+
};
|
|
5149
|
+
};
|
|
5150
|
+
};
|
|
5151
|
+
};
|
|
5074
5152
|
};
|
|
5075
5153
|
}
|
|
5076
5154
|
|
|
@@ -5098,6 +5176,10 @@ interface TypographyTokens {
|
|
|
5098
5176
|
body: TypographyBodyEntry;
|
|
5099
5177
|
display: Record<string, TypographyRoleEntry>;
|
|
5100
5178
|
lead: TypographyRoleEntry;
|
|
5179
|
+
responsive: Record<string, {
|
|
5180
|
+
heading?: Record<string, Partial<TypographyRoleEntry>>;
|
|
5181
|
+
display?: Record<string, Partial<TypographyRoleEntry>>;
|
|
5182
|
+
}>;
|
|
5101
5183
|
}
|
|
5102
5184
|
interface TransitionTokens {
|
|
5103
5185
|
duration: TokenScale;
|
|
@@ -5400,6 +5482,7 @@ interface SpectreModeTokens {
|
|
|
5400
5482
|
invalid?: Record<string, SemanticTokenValue>;
|
|
5401
5483
|
};
|
|
5402
5484
|
component: ComponentTokens<SemanticTokenValue>;
|
|
5485
|
+
action?: Record<string, SemanticTokenValue>;
|
|
5403
5486
|
buttons?: Record<string, Record<string, SemanticTokenValue>>;
|
|
5404
5487
|
link?: Record<string, SemanticTokenValue>;
|
|
5405
5488
|
}
|
package/dist/index.js
CHANGED
|
@@ -1927,6 +1927,11 @@ var coreTokens = {
|
|
|
1927
1927
|
}
|
|
1928
1928
|
},
|
|
1929
1929
|
"dark": {
|
|
1930
|
+
"action": {
|
|
1931
|
+
"onPage": "{colors.brand.400}",
|
|
1932
|
+
"onSurface": "{colors.brand.400}",
|
|
1933
|
+
"rail": "{colors.brand.400}"
|
|
1934
|
+
},
|
|
1930
1935
|
"surface": {
|
|
1931
1936
|
"page": "{colors.neutral.900}",
|
|
1932
1937
|
"card": "{colors.neutral.800}",
|
|
@@ -2795,9 +2800,32 @@ var coreTokens = {
|
|
|
2795
2800
|
"visited": "{colors.accent.300}",
|
|
2796
2801
|
"underline": "{colors.brand.400} / 0.4",
|
|
2797
2802
|
"underlineHover": "{colors.brand.300}"
|
|
2803
|
+
},
|
|
2804
|
+
"buttons": {
|
|
2805
|
+
"secondary": {
|
|
2806
|
+
"bg": "transparent",
|
|
2807
|
+
"bgHover": "{colors.neutral.800}",
|
|
2808
|
+
"bgActive": "{colors.neutral.700}",
|
|
2809
|
+
"bgDisabled": "transparent",
|
|
2810
|
+
"text": "{colors.info.300}",
|
|
2811
|
+
"textDisabled": "{colors.neutral.500}",
|
|
2812
|
+
"border": "{colors.info.400}",
|
|
2813
|
+
"borderDisabled": "{colors.neutral.700}",
|
|
2814
|
+
"focusRing": "{colors.info.500} / 0.4",
|
|
2815
|
+
"focusVisible": "{colors.info.500} / 0.4"
|
|
2816
|
+
}
|
|
2798
2817
|
}
|
|
2799
2818
|
},
|
|
2800
2819
|
"highContrast": {
|
|
2820
|
+
"action": {
|
|
2821
|
+
"bg": "{colors.brand.800}",
|
|
2822
|
+
"bgHover": "{colors.brand.900}",
|
|
2823
|
+
"bgActive": "{colors.brand.900}",
|
|
2824
|
+
"text": "{colors.white}",
|
|
2825
|
+
"onPage": "{colors.brand.900}",
|
|
2826
|
+
"onSurface": "{colors.brand.900}",
|
|
2827
|
+
"rail": "{colors.brand.900}"
|
|
2828
|
+
},
|
|
2801
2829
|
"surface": {
|
|
2802
2830
|
"page": "{colors.white}",
|
|
2803
2831
|
"card": "{colors.white}",
|
|
@@ -4650,6 +4678,16 @@ var coreTokens = {
|
|
|
4650
4678
|
"underline": "{colors.brand.600} / 0.4",
|
|
4651
4679
|
"underlineHover": "{colors.brand.700}"
|
|
4652
4680
|
},
|
|
4681
|
+
"action": {
|
|
4682
|
+
"bg": "{colors.brand.700}",
|
|
4683
|
+
"bgHover": "{colors.brand.800}",
|
|
4684
|
+
"bgActive": "{colors.brand.900}",
|
|
4685
|
+
"text": "{colors.white}",
|
|
4686
|
+
"focusRing": "{colors.brand.500} / 0.4",
|
|
4687
|
+
"onPage": "{colors.brand.700}",
|
|
4688
|
+
"onSurface": "{colors.brand.700}",
|
|
4689
|
+
"rail": "{colors.brand.700}"
|
|
4690
|
+
},
|
|
4653
4691
|
"text": {
|
|
4654
4692
|
"onPage": {
|
|
4655
4693
|
"default": "{colors.neutral.900}",
|
|
@@ -4973,38 +5011,38 @@ var coreTokens = {
|
|
|
4973
5011
|
"heading": {
|
|
4974
5012
|
"h1": {
|
|
4975
5013
|
"fontFamily": "{typography.families.sans}",
|
|
4976
|
-
"fontSize": "{typography.scale.
|
|
4977
|
-
"lineHeight": "{typography.scale.
|
|
5014
|
+
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5015
|
+
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
4978
5016
|
"fontWeight": 800,
|
|
4979
|
-
"letterSpacing": "{typography.scale.
|
|
5017
|
+
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
4980
5018
|
},
|
|
4981
5019
|
"h2": {
|
|
4982
5020
|
"fontFamily": "{typography.families.sans}",
|
|
4983
|
-
"fontSize": "{typography.scale.
|
|
4984
|
-
"lineHeight": "{typography.scale.
|
|
5021
|
+
"fontSize": "{typography.scale.3xl.fontSize}",
|
|
5022
|
+
"lineHeight": "{typography.scale.3xl.lineHeight}",
|
|
4985
5023
|
"fontWeight": 700,
|
|
4986
|
-
"letterSpacing": "{typography.scale.
|
|
5024
|
+
"letterSpacing": "{typography.scale.3xl.letterSpacing}"
|
|
4987
5025
|
},
|
|
4988
5026
|
"h3": {
|
|
4989
5027
|
"fontFamily": "{typography.families.sans}",
|
|
4990
|
-
"fontSize": "{typography.scale.
|
|
4991
|
-
"lineHeight": "{typography.scale.
|
|
5028
|
+
"fontSize": "{typography.scale.2xl.fontSize}",
|
|
5029
|
+
"lineHeight": "{typography.scale.2xl.lineHeight}",
|
|
4992
5030
|
"fontWeight": 700,
|
|
4993
|
-
"letterSpacing": "{typography.scale.
|
|
5031
|
+
"letterSpacing": "{typography.scale.2xl.letterSpacing}"
|
|
4994
5032
|
},
|
|
4995
5033
|
"h4": {
|
|
4996
5034
|
"fontFamily": "{typography.families.sans}",
|
|
4997
|
-
"fontSize": "{typography.scale.
|
|
4998
|
-
"lineHeight": "{typography.scale.
|
|
5035
|
+
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5036
|
+
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
4999
5037
|
"fontWeight": 600,
|
|
5000
|
-
"letterSpacing": "{typography.scale.
|
|
5038
|
+
"letterSpacing": "{typography.scale.xl.letterSpacing}"
|
|
5001
5039
|
},
|
|
5002
5040
|
"h5": {
|
|
5003
5041
|
"fontFamily": "{typography.families.sans}",
|
|
5004
|
-
"fontSize": "{typography.scale.
|
|
5005
|
-
"lineHeight": "{typography.scale.
|
|
5042
|
+
"fontSize": "{typography.scale.xl.fontSize}",
|
|
5043
|
+
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5006
5044
|
"fontWeight": 600,
|
|
5007
|
-
"letterSpacing": "{typography.scale.
|
|
5045
|
+
"letterSpacing": "{typography.scale.xl.letterSpacing}"
|
|
5008
5046
|
},
|
|
5009
5047
|
"h6": {
|
|
5010
5048
|
"fontFamily": "{typography.families.sans}",
|
|
@@ -5024,24 +5062,24 @@ var coreTokens = {
|
|
|
5024
5062
|
"display": {
|
|
5025
5063
|
"1": {
|
|
5026
5064
|
"fontFamily": "{typography.families.sans}",
|
|
5027
|
-
"fontSize": "{typography.scale.
|
|
5028
|
-
"lineHeight": "{typography.scale.
|
|
5065
|
+
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5066
|
+
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5029
5067
|
"fontWeight": 800,
|
|
5030
|
-
"letterSpacing": "{typography.scale.
|
|
5068
|
+
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5031
5069
|
},
|
|
5032
5070
|
"2": {
|
|
5033
5071
|
"fontFamily": "{typography.families.sans}",
|
|
5034
|
-
"fontSize": "{typography.scale.
|
|
5035
|
-
"lineHeight": "{typography.scale.
|
|
5072
|
+
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5073
|
+
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5036
5074
|
"fontWeight": 800,
|
|
5037
|
-
"letterSpacing": "{typography.scale.
|
|
5075
|
+
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5038
5076
|
},
|
|
5039
5077
|
"3": {
|
|
5040
5078
|
"fontFamily": "{typography.families.sans}",
|
|
5041
|
-
"fontSize": "{typography.scale.
|
|
5042
|
-
"lineHeight": "{typography.scale.
|
|
5079
|
+
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5080
|
+
"lineHeight": "{typography.scale.4xl.lineHeight}",
|
|
5043
5081
|
"fontWeight": 700,
|
|
5044
|
-
"letterSpacing": "{typography.scale.
|
|
5082
|
+
"letterSpacing": "{typography.scale.4xl.letterSpacing}"
|
|
5045
5083
|
},
|
|
5046
5084
|
"4": {
|
|
5047
5085
|
"fontFamily": "{typography.families.sans}",
|
|
@@ -5071,6 +5109,46 @@ var coreTokens = {
|
|
|
5071
5109
|
"lineHeight": "{typography.scale.xl.lineHeight}",
|
|
5072
5110
|
"fontWeight": 400,
|
|
5073
5111
|
"letterSpacing": "{typography.scale.xl.letterSpacing}"
|
|
5112
|
+
},
|
|
5113
|
+
"responsive": {
|
|
5114
|
+
"md": {
|
|
5115
|
+
"heading": {
|
|
5116
|
+
"h1": {
|
|
5117
|
+
"fontSize": "{typography.scale.6xl.fontSize}",
|
|
5118
|
+
"lineHeight": "{typography.scale.6xl.lineHeight}"
|
|
5119
|
+
},
|
|
5120
|
+
"h2": {
|
|
5121
|
+
"fontSize": "{typography.scale.5xl.fontSize}",
|
|
5122
|
+
"lineHeight": "{typography.scale.5xl.lineHeight}"
|
|
5123
|
+
},
|
|
5124
|
+
"h3": {
|
|
5125
|
+
"fontSize": "{typography.scale.4xl.fontSize}",
|
|
5126
|
+
"lineHeight": "{typography.scale.4xl.lineHeight}"
|
|
5127
|
+
},
|
|
5128
|
+
"h4": {
|
|
5129
|
+
"fontSize": "{typography.scale.3xl.fontSize}",
|
|
5130
|
+
"lineHeight": "{typography.scale.3xl.lineHeight}"
|
|
5131
|
+
},
|
|
5132
|
+
"h5": {
|
|
5133
|
+
"fontSize": "{typography.scale.2xl.fontSize}",
|
|
5134
|
+
"lineHeight": "{typography.scale.2xl.lineHeight}"
|
|
5135
|
+
}
|
|
5136
|
+
},
|
|
5137
|
+
"display": {
|
|
5138
|
+
"1": {
|
|
5139
|
+
"fontSize": "{typography.scale.7xl.fontSize}",
|
|
5140
|
+
"lineHeight": "{typography.scale.7xl.lineHeight}"
|
|
5141
|
+
},
|
|
5142
|
+
"2": {
|
|
5143
|
+
"fontSize": "{typography.scale.6xl.fontSize}",
|
|
5144
|
+
"lineHeight": "{typography.scale.6xl.lineHeight}"
|
|
5145
|
+
},
|
|
5146
|
+
"3": {
|
|
5147
|
+
"fontSize": "{typography.scale.5xl.fontSize}",
|
|
5148
|
+
"lineHeight": "{typography.scale.5xl.lineHeight}"
|
|
5149
|
+
}
|
|
5150
|
+
}
|
|
5151
|
+
}
|
|
5074
5152
|
}
|
|
5075
5153
|
}
|
|
5076
5154
|
};
|
|
@@ -5102,6 +5180,42 @@ var layoutResponsive = (layout) => {
|
|
|
5102
5180
|
const responsive = isPlainObject(layout) ? layout.responsive : void 0;
|
|
5103
5181
|
return isPlainObject(responsive) ? responsive : {};
|
|
5104
5182
|
};
|
|
5183
|
+
var ROLE_FIELD_SUFFIXES = {
|
|
5184
|
+
fontFamily: "family",
|
|
5185
|
+
fontSize: "size",
|
|
5186
|
+
lineHeight: "line-height",
|
|
5187
|
+
fontWeight: "weight",
|
|
5188
|
+
letterSpacing: "letter-spacing"
|
|
5189
|
+
};
|
|
5190
|
+
var typographyResponsive = (typography) => {
|
|
5191
|
+
const responsive = isPlainObject(typography) ? typography.responsive : void 0;
|
|
5192
|
+
if (!isPlainObject(responsive)) return [];
|
|
5193
|
+
return Object.entries(responsive).flatMap(
|
|
5194
|
+
([breakpoint, groups]) => Object.entries(groups).flatMap(([group, node]) => {
|
|
5195
|
+
const roles = Object.keys(node).some((key) => key in ROLE_FIELD_SUFFIXES) ? [[[group], node]] : Object.entries(node).map(([level, fields]) => [[group, level], fields]);
|
|
5196
|
+
return roles.flatMap(
|
|
5197
|
+
([roleParts, fields]) => Object.entries(fields).map(([field, value]) => {
|
|
5198
|
+
const suffix = ROLE_FIELD_SUFFIXES[field];
|
|
5199
|
+
if (suffix === void 0) {
|
|
5200
|
+
throw new Error(`typography.responsive.${breakpoint}.${roleParts.join(".")}.${field} is not a typography role field`);
|
|
5201
|
+
}
|
|
5202
|
+
return { breakpoint, roleParts: [...roleParts], suffix, value };
|
|
5203
|
+
})
|
|
5204
|
+
);
|
|
5205
|
+
})
|
|
5206
|
+
);
|
|
5207
|
+
};
|
|
5208
|
+
var ACTION_SYSTEM_FAMILIES = ["brand", "accent", "info"];
|
|
5209
|
+
var ACTION_EXCLUDED_PALETTE_FAMILIES = /* @__PURE__ */ new Set(["yellow", "integration-icy-blue"]);
|
|
5210
|
+
var actionFamilies = (tokens2) => {
|
|
5211
|
+
const colors = tokens2.colors;
|
|
5212
|
+
const palette = isPlainObject(colors.palette) ? colors.palette : {};
|
|
5213
|
+
return Object.fromEntries([
|
|
5214
|
+
...ACTION_SYSTEM_FAMILIES.map((name) => [name, colors[name]]),
|
|
5215
|
+
...Object.entries(palette).filter(([name]) => !ACTION_EXCLUDED_PALETTE_FAMILIES.has(name))
|
|
5216
|
+
]);
|
|
5217
|
+
};
|
|
5218
|
+
var actionSteps = (tokens2) => Object.keys(tokens2.colors.brand);
|
|
5105
5219
|
var resolveTokenReference = (tokens2, reference) => {
|
|
5106
5220
|
const path = reference.slice(1, -1).split(".");
|
|
5107
5221
|
let current = tokens2;
|
|
@@ -5188,6 +5302,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5188
5302
|
Object.entries(baseTokens.colors).forEach(([group, scale]) => {
|
|
5189
5303
|
assignColorGroup([group], scale);
|
|
5190
5304
|
});
|
|
5305
|
+
actionSteps(tokens2).forEach((step) => {
|
|
5306
|
+
assign(toVariableName(prefix, "action", step), baseTokens.colors.brand[step]);
|
|
5307
|
+
});
|
|
5191
5308
|
if (baseTokens.space) {
|
|
5192
5309
|
Object.entries(baseTokens.space).forEach(([key, value]) => {
|
|
5193
5310
|
assign(toVariableName(prefix, "space", key), value);
|
|
@@ -5342,11 +5459,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5342
5459
|
assign(toVariableName(prefix, "font", key, "letter-spacing"), scaleEntry.letterSpacing);
|
|
5343
5460
|
});
|
|
5344
5461
|
const assignRole = (rolePrefixParts, entry) => {
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
assign(toVariableName(prefix, ...rolePrefixParts, "weight"), entry.fontWeight);
|
|
5349
|
-
assign(toVariableName(prefix, ...rolePrefixParts, "letter-spacing"), entry.letterSpacing);
|
|
5462
|
+
Object.entries(ROLE_FIELD_SUFFIXES).forEach(([field, suffix]) => {
|
|
5463
|
+
assign(toVariableName(prefix, ...rolePrefixParts, suffix), entry[field]);
|
|
5464
|
+
});
|
|
5350
5465
|
};
|
|
5351
5466
|
const heading = baseTokens.typography?.heading;
|
|
5352
5467
|
if (heading) {
|
|
@@ -5368,6 +5483,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
5368
5483
|
if (lead) {
|
|
5369
5484
|
assignRole(["lead"], lead);
|
|
5370
5485
|
}
|
|
5486
|
+
typographyResponsive(baseTokens.typography).forEach(({ breakpoint, roleParts, suffix, value }) => {
|
|
5487
|
+
assign(toVariableName(prefix, "typography", "responsive", breakpoint, ...roleParts, suffix), value);
|
|
5488
|
+
});
|
|
5371
5489
|
Object.entries(baseTokens.shadows).forEach(([key, value]) => {
|
|
5372
5490
|
if (typeof value === "string") {
|
|
5373
5491
|
assign(toVariableName(prefix, "shadow", key), value);
|
|
@@ -5523,14 +5641,31 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
5523
5641
|
addDark(varName, pickSemantic(tokens2, getPath(darkLink, [key]), value));
|
|
5524
5642
|
addHighContrast(varName, pickSemantic(tokens2, getPath(highContrastLink, [key]), value));
|
|
5525
5643
|
});
|
|
5526
|
-
const
|
|
5527
|
-
|
|
5528
|
-
|
|
5644
|
+
const actionValue = (value) => {
|
|
5645
|
+
const match = typeof value === "string" ? value.match(/^\{colors\.brand\.([^}]+)\}(?:\s*\/\s*([0-9.]+))?$/) : null;
|
|
5646
|
+
if (!match) return pickSemantic(tokens2, value);
|
|
5647
|
+
const ramp = `var(${toVariableName(prefix, "action", match[1])})`;
|
|
5648
|
+
return match[2] === void 0 ? ramp : `color-mix(in srgb, ${ramp} ${Math.round(Number(match[2]) * 1e3) / 10}%, transparent)`;
|
|
5649
|
+
};
|
|
5650
|
+
const darkAction = getPath(darkMode, ["action"]);
|
|
5651
|
+
const highContrastAction = getPath(highContrastMode, ["action"]);
|
|
5652
|
+
Object.entries(tokens2.action ?? {}).forEach(([key, value]) => {
|
|
5653
|
+
const varName = toVariableName(prefix, "action", kebabPathSegment(key));
|
|
5654
|
+
addBase(varName, actionValue(value));
|
|
5655
|
+
addDark(varName, actionValue(getPath(darkAction, [key]) ?? value));
|
|
5656
|
+
addHighContrast(varName, actionValue(getPath(highContrastAction, [key]) ?? value));
|
|
5657
|
+
});
|
|
5658
|
+
const addButtonOverrides = (mode, add) => {
|
|
5659
|
+
const buttons = getPath(mode, ["buttons"]);
|
|
5660
|
+
if (!isPlainObject(buttons)) return;
|
|
5661
|
+
Object.entries(buttons).forEach(([variant, states]) => {
|
|
5529
5662
|
Object.entries(states).forEach(([state, value]) => {
|
|
5530
|
-
|
|
5663
|
+
add(toVariableName(prefix, "button", variant, state), pickSemantic(tokens2, value));
|
|
5531
5664
|
});
|
|
5532
5665
|
});
|
|
5533
|
-
}
|
|
5666
|
+
};
|
|
5667
|
+
addButtonOverrides(darkMode, addDark);
|
|
5668
|
+
addButtonOverrides(highContrastMode, addHighContrast);
|
|
5534
5669
|
const mapLines = Object.entries(declarations).filter(([name]) => !modeScopedNames.has(name)).map(([name, value]) => ` ${name}: ${value};`);
|
|
5535
5670
|
const rootBlock = `${selector} {
|
|
5536
5671
|
${[...baseLines, ...mapLines].join("\n")}
|
|
@@ -5571,6 +5706,16 @@ ${indent}}`;
|
|
|
5571
5706
|
const systemDarkBlock = `@media (prefers-color-scheme: dark) {
|
|
5572
5707
|
${modeBlock(themeSelectors("system"), modeLines(darkEntries), " ")}
|
|
5573
5708
|
}`;
|
|
5709
|
+
const steps = actionSteps(tokens2);
|
|
5710
|
+
const actionBlocks = Object.entries(actionFamilies(tokens2)).map(([name, scale]) => {
|
|
5711
|
+
const lines = steps.map((step) => {
|
|
5712
|
+
if (scale[step] === void 0) throw new Error(`Action family "${name}" has no ${step} step`);
|
|
5713
|
+
return ` ${toVariableName(prefix, "action", step)}: ${resolveValue(tokens2, scale[step])};`;
|
|
5714
|
+
});
|
|
5715
|
+
return `${selector}[data-spectre-action="${name}"] {
|
|
5716
|
+
${lines.join("\n")}
|
|
5717
|
+
}`;
|
|
5718
|
+
});
|
|
5574
5719
|
const control = tokens2.control;
|
|
5575
5720
|
const compact = isPlainObject(control) && isPlainObject(control.compact) ? control.compact : {};
|
|
5576
5721
|
const densityLines = Object.entries(compact).flatMap(
|
|
@@ -5583,27 +5728,50 @@ ${modeBlock(themeSelectors("system"), modeLines(darkEntries), " ")}
|
|
|
5583
5728
|
${densityLines.join("\n")}
|
|
5584
5729
|
}`] : [];
|
|
5585
5730
|
const breakpoints = tokens2.breakpoints;
|
|
5586
|
-
const
|
|
5587
|
-
|
|
5588
|
-
if (
|
|
5589
|
-
throw new Error(
|
|
5731
|
+
const responsiveLines = /* @__PURE__ */ new Map();
|
|
5732
|
+
const addResponsive = (namespace, breakpoint, name, source) => {
|
|
5733
|
+
if (breakpoints[breakpoint] === void 0) {
|
|
5734
|
+
throw new Error(`${namespace}.responsive.${breakpoint} does not name a breakpoints entry`);
|
|
5590
5735
|
}
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5736
|
+
responsiveLines.set(breakpoint, [...responsiveLines.get(breakpoint) ?? [], ` ${name}: var(${source});`]);
|
|
5737
|
+
};
|
|
5738
|
+
Object.entries(layoutResponsive(tokens2.layout)).forEach(([breakpoint, scales]) => {
|
|
5739
|
+
LAYOUT_SCALES.forEach(({ path, varParts }) => {
|
|
5740
|
+
Object.keys(layoutScale(scales, path)).forEach((key) => {
|
|
5741
|
+
addResponsive(
|
|
5742
|
+
"layout",
|
|
5743
|
+
breakpoint,
|
|
5744
|
+
toVariableName(prefix, "layout", ...varParts, kebabCase(key)),
|
|
5745
|
+
toVariableName(prefix, "layout", "responsive", breakpoint, ...varParts, kebabCase(key))
|
|
5746
|
+
);
|
|
5747
|
+
});
|
|
5748
|
+
});
|
|
5749
|
+
});
|
|
5750
|
+
typographyResponsive(tokens2.typography).forEach(({ breakpoint, roleParts, suffix }) => {
|
|
5751
|
+
addResponsive(
|
|
5752
|
+
"typography",
|
|
5753
|
+
breakpoint,
|
|
5754
|
+
toVariableName(prefix, ...roleParts, suffix),
|
|
5755
|
+
toVariableName(prefix, "typography", "responsive", breakpoint, ...roleParts, suffix)
|
|
5597
5756
|
);
|
|
5598
|
-
|
|
5757
|
+
});
|
|
5758
|
+
const responsiveBlocks = Object.keys(breakpoints).filter((breakpoint) => responsiveLines.has(breakpoint)).map(
|
|
5759
|
+
(breakpoint) => `@media (min-width: ${resolveValue(tokens2, breakpoints[breakpoint])}) {
|
|
5599
5760
|
${selector} {
|
|
5600
|
-
${
|
|
5761
|
+
${responsiveLines.get(breakpoint).join("\n")}
|
|
5601
5762
|
}
|
|
5602
|
-
}
|
|
5603
|
-
|
|
5604
|
-
return [
|
|
5605
|
-
|
|
5606
|
-
|
|
5763
|
+
}`
|
|
5764
|
+
);
|
|
5765
|
+
return [
|
|
5766
|
+
rootBlock,
|
|
5767
|
+
darkBlock,
|
|
5768
|
+
highContrastBlock,
|
|
5769
|
+
lightBlock,
|
|
5770
|
+
systemDarkBlock,
|
|
5771
|
+
...actionBlocks,
|
|
5772
|
+
...densityBlocks,
|
|
5773
|
+
...responsiveBlocks
|
|
5774
|
+
].join("\n") + "\n";
|
|
5607
5775
|
};
|
|
5608
5776
|
|
|
5609
5777
|
// src/index.ts
|