@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/dist/index.js CHANGED
@@ -410,7 +410,7 @@ var coreTokens = {
410
410
  },
411
411
  "text": "{colors.neutral.900}",
412
412
  "divider": "{colors.neutral.200}",
413
- "stripeBg": "{colors.neutral.50}",
413
+ "stripeBg": "{colors.black} / 0.05",
414
414
  "hoverBg": "{colors.neutral.100}",
415
415
  "selectedBg": "{colors.info.50}",
416
416
  "row": {
@@ -1491,7 +1491,7 @@ var coreTokens = {
1491
1491
  },
1492
1492
  "text": "{colors.neutral.900}",
1493
1493
  "divider": "{colors.neutral.200}",
1494
- "stripeBg": "{colors.neutral.50}",
1494
+ "stripeBg": "{colors.black} / 0.05",
1495
1495
  "hoverBg": "{colors.neutral.100}",
1496
1496
  "selectedBg": "{colors.info.50}",
1497
1497
  "row": {
@@ -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}",
@@ -2354,7 +2359,7 @@ var coreTokens = {
2354
2359
  },
2355
2360
  "text": "{colors.neutral.100}",
2356
2361
  "divider": "{colors.neutral.700}",
2357
- "stripeBg": "{colors.neutral.800}",
2362
+ "stripeBg": "{colors.white} / 0.06",
2358
2363
  "hoverBg": "{colors.neutral.700}",
2359
2364
  "selectedBg": "{colors.info.900}",
2360
2365
  "row": {
@@ -2787,9 +2792,26 @@ var coreTokens = {
2787
2792
  "spelling": "{colors.error.400}",
2788
2793
  "grammar": "{colors.info.400}"
2789
2794
  }
2795
+ },
2796
+ "link": {
2797
+ "default": "{colors.brand.400}",
2798
+ "hover": "{colors.brand.300}",
2799
+ "active": "{colors.brand.200}",
2800
+ "visited": "{colors.accent.300}",
2801
+ "underline": "{colors.brand.400} / 0.4",
2802
+ "underlineHover": "{colors.brand.300}"
2790
2803
  }
2791
2804
  },
2792
2805
  "highContrast": {
2806
+ "action": {
2807
+ "bg": "{colors.brand.800}",
2808
+ "bgHover": "{colors.brand.900}",
2809
+ "bgActive": "{colors.brand.900}",
2810
+ "text": "{colors.white}",
2811
+ "onPage": "{colors.brand.900}",
2812
+ "onSurface": "{colors.brand.900}",
2813
+ "rail": "{colors.brand.900}"
2814
+ },
2793
2815
  "surface": {
2794
2816
  "page": "{colors.white}",
2795
2817
  "card": "{colors.white}",
@@ -4606,6 +4628,21 @@ var coreTokens = {
4606
4628
  "extrabold": 800,
4607
4629
  "black": 900
4608
4630
  },
4631
+ "fontSize": {
4632
+ "12": "0.75rem",
4633
+ "14": "0.875rem",
4634
+ "16": "1rem",
4635
+ "18": "1.125rem",
4636
+ "20": "1.25rem",
4637
+ "24": "1.5rem",
4638
+ "30": "1.875rem",
4639
+ "36": "2.25rem",
4640
+ "48": "3rem",
4641
+ "60": "3.75rem",
4642
+ "72": "4.5rem",
4643
+ "96": "6rem",
4644
+ "128": "8rem"
4645
+ },
4609
4646
  "surface": {
4610
4647
  "page": "{colors.neutral.50}",
4611
4648
  "card": "{colors.white}",
@@ -4627,6 +4664,16 @@ var coreTokens = {
4627
4664
  "underline": "{colors.brand.600} / 0.4",
4628
4665
  "underlineHover": "{colors.brand.700}"
4629
4666
  },
4667
+ "action": {
4668
+ "bg": "{colors.brand.700}",
4669
+ "bgHover": "{colors.brand.800}",
4670
+ "bgActive": "{colors.brand.900}",
4671
+ "text": "{colors.white}",
4672
+ "focusRing": "{colors.brand.500} / 0.4",
4673
+ "onPage": "{colors.brand.700}",
4674
+ "onSurface": "{colors.brand.700}",
4675
+ "rail": "{colors.brand.700}"
4676
+ },
4630
4677
  "text": {
4631
4678
  "onPage": {
4632
4679
  "default": "{colors.neutral.900}",
@@ -4801,46 +4848,64 @@ var coreTokens = {
4801
4848
  "letterSpacing": "0em"
4802
4849
  },
4803
4850
  "lg": {
4851
+ "size": "1.125rem",
4852
+ "lineHeight": "1.875rem",
4853
+ "weight": 500,
4854
+ "letterSpacing": "0em"
4855
+ },
4856
+ "xl": {
4804
4857
  "size": "1.25rem",
4805
4858
  "lineHeight": "2rem",
4806
4859
  "weight": 600,
4807
4860
  "letterSpacing": "0em"
4808
4861
  },
4809
- "xl": {
4862
+ "2xl": {
4810
4863
  "size": "1.5rem",
4811
4864
  "lineHeight": "2.125rem",
4812
4865
  "weight": 600,
4813
4866
  "letterSpacing": "0em"
4814
4867
  },
4815
- "2xl": {
4868
+ "3xl": {
4816
4869
  "size": "1.875rem",
4817
4870
  "lineHeight": "2.5rem",
4818
4871
  "weight": 700,
4819
4872
  "letterSpacing": "0em"
4820
4873
  },
4821
- "3xl": {
4874
+ "4xl": {
4822
4875
  "size": "2.25rem",
4823
4876
  "lineHeight": "2.75rem",
4824
4877
  "weight": 700,
4825
4878
  "letterSpacing": "0em"
4826
4879
  },
4827
- "4xl": {
4880
+ "5xl": {
4828
4881
  "size": "3rem",
4829
4882
  "lineHeight": "3.5rem",
4830
4883
  "weight": 800,
4831
4884
  "letterSpacing": "0em"
4832
4885
  },
4833
- "5xl": {
4886
+ "6xl": {
4834
4887
  "size": "3.75rem",
4835
4888
  "lineHeight": "4.25rem",
4836
4889
  "weight": 800,
4837
4890
  "letterSpacing": "0em"
4838
4891
  },
4839
- "6xl": {
4892
+ "7xl": {
4840
4893
  "size": "4.5rem",
4841
4894
  "lineHeight": "5rem",
4842
4895
  "weight": 900,
4843
4896
  "letterSpacing": "0em"
4897
+ },
4898
+ "8xl": {
4899
+ "size": "6rem",
4900
+ "lineHeight": "6.5rem",
4901
+ "weight": 900,
4902
+ "letterSpacing": "0em"
4903
+ },
4904
+ "9xl": {
4905
+ "size": "8rem",
4906
+ "lineHeight": "8.5rem",
4907
+ "weight": 900,
4908
+ "letterSpacing": "0em"
4844
4909
  }
4845
4910
  },
4846
4911
  "typography": {
@@ -4869,77 +4934,95 @@ var coreTokens = {
4869
4934
  "letterSpacing": "0em"
4870
4935
  },
4871
4936
  "lg": {
4937
+ "fontSize": "1.125rem",
4938
+ "lineHeight": "1.875rem",
4939
+ "fontWeight": 500,
4940
+ "letterSpacing": "0em"
4941
+ },
4942
+ "xl": {
4872
4943
  "fontSize": "1.25rem",
4873
4944
  "lineHeight": "2rem",
4874
4945
  "fontWeight": 600,
4875
4946
  "letterSpacing": "0em"
4876
4947
  },
4877
- "xl": {
4948
+ "2xl": {
4878
4949
  "fontSize": "1.5rem",
4879
4950
  "lineHeight": "2.125rem",
4880
4951
  "fontWeight": 600,
4881
4952
  "letterSpacing": "0em"
4882
4953
  },
4883
- "2xl": {
4954
+ "3xl": {
4884
4955
  "fontSize": "1.875rem",
4885
4956
  "lineHeight": "2.5rem",
4886
4957
  "fontWeight": 700,
4887
4958
  "letterSpacing": "0em"
4888
4959
  },
4889
- "3xl": {
4960
+ "4xl": {
4890
4961
  "fontSize": "2.25rem",
4891
4962
  "lineHeight": "2.75rem",
4892
4963
  "fontWeight": 700,
4893
4964
  "letterSpacing": "0em"
4894
4965
  },
4895
- "4xl": {
4966
+ "5xl": {
4896
4967
  "fontSize": "3rem",
4897
4968
  "lineHeight": "3.5rem",
4898
4969
  "fontWeight": 800,
4899
4970
  "letterSpacing": "0em"
4900
4971
  },
4901
- "5xl": {
4972
+ "6xl": {
4902
4973
  "fontSize": "3.75rem",
4903
4974
  "lineHeight": "4.25rem",
4904
4975
  "fontWeight": 800,
4905
4976
  "letterSpacing": "0em"
4906
4977
  },
4907
- "6xl": {
4978
+ "7xl": {
4908
4979
  "fontSize": "4.5rem",
4909
4980
  "lineHeight": "5rem",
4910
4981
  "fontWeight": 900,
4911
4982
  "letterSpacing": "0em"
4983
+ },
4984
+ "8xl": {
4985
+ "fontSize": "6rem",
4986
+ "lineHeight": "6.5rem",
4987
+ "fontWeight": 900,
4988
+ "letterSpacing": "0em"
4989
+ },
4990
+ "9xl": {
4991
+ "fontSize": "8rem",
4992
+ "lineHeight": "8.5rem",
4993
+ "fontWeight": 900,
4994
+ "letterSpacing": "0em"
4912
4995
  }
4913
4996
  },
4914
4997
  "heading": {
4915
4998
  "h1": {
4916
- "fontFamily": "{typography.families.sans}",
4917
- "fontSize": "{typography.scale.5xl.fontSize}",
4918
- "lineHeight": "{typography.scale.5xl.lineHeight}",
4919
- "fontWeight": 800,
4920
- "letterSpacing": "{typography.scale.5xl.letterSpacing}"
4921
- },
4922
- "h2": {
4923
4999
  "fontFamily": "{typography.families.sans}",
4924
5000
  "fontSize": "{typography.scale.4xl.fontSize}",
4925
5001
  "lineHeight": "{typography.scale.4xl.lineHeight}",
4926
- "fontWeight": 700,
5002
+ "fontWeight": 800,
4927
5003
  "letterSpacing": "{typography.scale.4xl.letterSpacing}"
4928
5004
  },
4929
- "h3": {
5005
+ "h2": {
4930
5006
  "fontFamily": "{typography.families.sans}",
4931
5007
  "fontSize": "{typography.scale.3xl.fontSize}",
4932
5008
  "lineHeight": "{typography.scale.3xl.lineHeight}",
4933
5009
  "fontWeight": 700,
4934
5010
  "letterSpacing": "{typography.scale.3xl.letterSpacing}"
4935
5011
  },
4936
- "h4": {
5012
+ "h3": {
4937
5013
  "fontFamily": "{typography.families.sans}",
4938
5014
  "fontSize": "{typography.scale.2xl.fontSize}",
4939
5015
  "lineHeight": "{typography.scale.2xl.lineHeight}",
4940
- "fontWeight": 600,
5016
+ "fontWeight": 700,
4941
5017
  "letterSpacing": "{typography.scale.2xl.letterSpacing}"
4942
5018
  },
5019
+ "h4": {
5020
+ "fontFamily": "{typography.families.sans}",
5021
+ "fontSize": "{typography.scale.xl.fontSize}",
5022
+ "lineHeight": "{typography.scale.xl.lineHeight}",
5023
+ "fontWeight": 600,
5024
+ "letterSpacing": "{typography.scale.xl.letterSpacing}"
5025
+ },
4943
5026
  "h5": {
4944
5027
  "fontFamily": "{typography.families.sans}",
4945
5028
  "fontSize": "{typography.scale.xl.fontSize}",
@@ -4949,10 +5032,10 @@ var coreTokens = {
4949
5032
  },
4950
5033
  "h6": {
4951
5034
  "fontFamily": "{typography.families.sans}",
4952
- "fontSize": "{typography.scale.lg.fontSize}",
4953
- "lineHeight": "{typography.scale.lg.lineHeight}",
5035
+ "fontSize": "{typography.scale.xl.fontSize}",
5036
+ "lineHeight": "{typography.scale.xl.lineHeight}",
4954
5037
  "fontWeight": 600,
4955
- "letterSpacing": "{typography.scale.lg.letterSpacing}"
5038
+ "letterSpacing": "{typography.scale.xl.letterSpacing}"
4956
5039
  }
4957
5040
  },
4958
5041
  "body": {
@@ -4965,17 +5048,17 @@ var coreTokens = {
4965
5048
  "display": {
4966
5049
  "1": {
4967
5050
  "fontFamily": "{typography.families.sans}",
4968
- "fontSize": "{typography.scale.6xl.fontSize}",
4969
- "lineHeight": "{typography.scale.6xl.lineHeight}",
5051
+ "fontSize": "{typography.scale.4xl.fontSize}",
5052
+ "lineHeight": "{typography.scale.4xl.lineHeight}",
4970
5053
  "fontWeight": 800,
4971
- "letterSpacing": "{typography.scale.6xl.letterSpacing}"
5054
+ "letterSpacing": "{typography.scale.4xl.letterSpacing}"
4972
5055
  },
4973
5056
  "2": {
4974
5057
  "fontFamily": "{typography.families.sans}",
4975
- "fontSize": "{typography.scale.5xl.fontSize}",
4976
- "lineHeight": "{typography.scale.5xl.lineHeight}",
5058
+ "fontSize": "{typography.scale.4xl.fontSize}",
5059
+ "lineHeight": "{typography.scale.4xl.lineHeight}",
4977
5060
  "fontWeight": 800,
4978
- "letterSpacing": "{typography.scale.5xl.letterSpacing}"
5061
+ "letterSpacing": "{typography.scale.4xl.letterSpacing}"
4979
5062
  },
4980
5063
  "3": {
4981
5064
  "fontFamily": "{typography.families.sans}",
@@ -4986,32 +5069,72 @@ var coreTokens = {
4986
5069
  },
4987
5070
  "4": {
4988
5071
  "fontFamily": "{typography.families.sans}",
4989
- "fontSize": "{typography.scale.3xl.fontSize}",
4990
- "lineHeight": "{typography.scale.3xl.lineHeight}",
5072
+ "fontSize": "{typography.scale.4xl.fontSize}",
5073
+ "lineHeight": "{typography.scale.4xl.lineHeight}",
4991
5074
  "fontWeight": 700,
4992
- "letterSpacing": "{typography.scale.3xl.letterSpacing}"
5075
+ "letterSpacing": "{typography.scale.4xl.letterSpacing}"
4993
5076
  },
4994
5077
  "5": {
4995
5078
  "fontFamily": "{typography.families.sans}",
4996
- "fontSize": "{typography.scale.2xl.fontSize}",
4997
- "lineHeight": "{typography.scale.2xl.lineHeight}",
5079
+ "fontSize": "{typography.scale.3xl.fontSize}",
5080
+ "lineHeight": "{typography.scale.3xl.lineHeight}",
4998
5081
  "fontWeight": 600,
4999
- "letterSpacing": "{typography.scale.2xl.letterSpacing}"
5082
+ "letterSpacing": "{typography.scale.3xl.letterSpacing}"
5000
5083
  },
5001
5084
  "6": {
5002
5085
  "fontFamily": "{typography.families.sans}",
5003
- "fontSize": "{typography.scale.xl.fontSize}",
5004
- "lineHeight": "{typography.scale.xl.lineHeight}",
5086
+ "fontSize": "{typography.scale.2xl.fontSize}",
5087
+ "lineHeight": "{typography.scale.2xl.lineHeight}",
5005
5088
  "fontWeight": 600,
5006
- "letterSpacing": "{typography.scale.xl.letterSpacing}"
5089
+ "letterSpacing": "{typography.scale.2xl.letterSpacing}"
5007
5090
  }
5008
5091
  },
5009
5092
  "lead": {
5010
5093
  "fontFamily": "{typography.families.sans}",
5011
- "fontSize": "{typography.scale.lg.fontSize}",
5012
- "lineHeight": "{typography.scale.lg.lineHeight}",
5094
+ "fontSize": "{typography.scale.xl.fontSize}",
5095
+ "lineHeight": "{typography.scale.xl.lineHeight}",
5013
5096
  "fontWeight": 400,
5014
- "letterSpacing": "{typography.scale.lg.letterSpacing}"
5097
+ "letterSpacing": "{typography.scale.xl.letterSpacing}"
5098
+ },
5099
+ "responsive": {
5100
+ "md": {
5101
+ "heading": {
5102
+ "h1": {
5103
+ "fontSize": "{typography.scale.6xl.fontSize}",
5104
+ "lineHeight": "{typography.scale.6xl.lineHeight}"
5105
+ },
5106
+ "h2": {
5107
+ "fontSize": "{typography.scale.5xl.fontSize}",
5108
+ "lineHeight": "{typography.scale.5xl.lineHeight}"
5109
+ },
5110
+ "h3": {
5111
+ "fontSize": "{typography.scale.4xl.fontSize}",
5112
+ "lineHeight": "{typography.scale.4xl.lineHeight}"
5113
+ },
5114
+ "h4": {
5115
+ "fontSize": "{typography.scale.3xl.fontSize}",
5116
+ "lineHeight": "{typography.scale.3xl.lineHeight}"
5117
+ },
5118
+ "h5": {
5119
+ "fontSize": "{typography.scale.2xl.fontSize}",
5120
+ "lineHeight": "{typography.scale.2xl.lineHeight}"
5121
+ }
5122
+ },
5123
+ "display": {
5124
+ "1": {
5125
+ "fontSize": "{typography.scale.7xl.fontSize}",
5126
+ "lineHeight": "{typography.scale.7xl.lineHeight}"
5127
+ },
5128
+ "2": {
5129
+ "fontSize": "{typography.scale.6xl.fontSize}",
5130
+ "lineHeight": "{typography.scale.6xl.lineHeight}"
5131
+ },
5132
+ "3": {
5133
+ "fontSize": "{typography.scale.5xl.fontSize}",
5134
+ "lineHeight": "{typography.scale.5xl.lineHeight}"
5135
+ }
5136
+ }
5137
+ }
5015
5138
  }
5016
5139
  }
5017
5140
  };
@@ -5043,6 +5166,42 @@ var layoutResponsive = (layout) => {
5043
5166
  const responsive = isPlainObject(layout) ? layout.responsive : void 0;
5044
5167
  return isPlainObject(responsive) ? responsive : {};
5045
5168
  };
5169
+ var ROLE_FIELD_SUFFIXES = {
5170
+ fontFamily: "family",
5171
+ fontSize: "size",
5172
+ lineHeight: "line-height",
5173
+ fontWeight: "weight",
5174
+ letterSpacing: "letter-spacing"
5175
+ };
5176
+ var typographyResponsive = (typography) => {
5177
+ const responsive = isPlainObject(typography) ? typography.responsive : void 0;
5178
+ if (!isPlainObject(responsive)) return [];
5179
+ return Object.entries(responsive).flatMap(
5180
+ ([breakpoint, groups]) => Object.entries(groups).flatMap(([group, node]) => {
5181
+ const roles = Object.keys(node).some((key) => key in ROLE_FIELD_SUFFIXES) ? [[[group], node]] : Object.entries(node).map(([level, fields]) => [[group, level], fields]);
5182
+ return roles.flatMap(
5183
+ ([roleParts, fields]) => Object.entries(fields).map(([field, value]) => {
5184
+ const suffix = ROLE_FIELD_SUFFIXES[field];
5185
+ if (suffix === void 0) {
5186
+ throw new Error(`typography.responsive.${breakpoint}.${roleParts.join(".")}.${field} is not a typography role field`);
5187
+ }
5188
+ return { breakpoint, roleParts: [...roleParts], suffix, value };
5189
+ })
5190
+ );
5191
+ })
5192
+ );
5193
+ };
5194
+ var ACTION_SYSTEM_FAMILIES = ["brand", "accent", "info"];
5195
+ var ACTION_EXCLUDED_PALETTE_FAMILIES = /* @__PURE__ */ new Set(["yellow", "integration-icy-blue"]);
5196
+ var actionFamilies = (tokens2) => {
5197
+ const colors = tokens2.colors;
5198
+ const palette = isPlainObject(colors.palette) ? colors.palette : {};
5199
+ return Object.fromEntries([
5200
+ ...ACTION_SYSTEM_FAMILIES.map((name) => [name, colors[name]]),
5201
+ ...Object.entries(palette).filter(([name]) => !ACTION_EXCLUDED_PALETTE_FAMILIES.has(name))
5202
+ ]);
5203
+ };
5204
+ var actionSteps = (tokens2) => Object.keys(tokens2.colors.brand);
5046
5205
  var resolveTokenReference = (tokens2, reference) => {
5047
5206
  const path = reference.slice(1, -1).split(".");
5048
5207
  let current = tokens2;
@@ -5129,6 +5288,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
5129
5288
  Object.entries(baseTokens.colors).forEach(([group, scale]) => {
5130
5289
  assignColorGroup([group], scale);
5131
5290
  });
5291
+ actionSteps(tokens2).forEach((step) => {
5292
+ assign(toVariableName(prefix, "action", step), baseTokens.colors.brand[step]);
5293
+ });
5132
5294
  if (baseTokens.space) {
5133
5295
  Object.entries(baseTokens.space).forEach(([key, value]) => {
5134
5296
  assign(toVariableName(prefix, "space", key), value);
@@ -5234,6 +5396,12 @@ var createCssVariableMap = (tokens2, options = {}) => {
5234
5396
  assign(toVariableName(prefix, "font-weight", key), value);
5235
5397
  });
5236
5398
  }
5399
+ const fontSize = baseTokens.fontSize;
5400
+ if (fontSize) {
5401
+ Object.entries(fontSize).forEach(([key, value]) => {
5402
+ assign(toVariableName(prefix, "font-size", key), value);
5403
+ });
5404
+ }
5237
5405
  const textDecoration = baseTokens.textDecoration;
5238
5406
  if (textDecoration) {
5239
5407
  Object.entries(textDecoration).forEach(([group, scale]) => {
@@ -5277,11 +5445,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
5277
5445
  assign(toVariableName(prefix, "font", key, "letter-spacing"), scaleEntry.letterSpacing);
5278
5446
  });
5279
5447
  const assignRole = (rolePrefixParts, entry) => {
5280
- assign(toVariableName(prefix, ...rolePrefixParts, "family"), entry.fontFamily);
5281
- assign(toVariableName(prefix, ...rolePrefixParts, "size"), entry.fontSize);
5282
- assign(toVariableName(prefix, ...rolePrefixParts, "line-height"), entry.lineHeight);
5283
- assign(toVariableName(prefix, ...rolePrefixParts, "weight"), entry.fontWeight);
5284
- assign(toVariableName(prefix, ...rolePrefixParts, "letter-spacing"), entry.letterSpacing);
5448
+ Object.entries(ROLE_FIELD_SUFFIXES).forEach(([field, suffix]) => {
5449
+ assign(toVariableName(prefix, ...rolePrefixParts, suffix), entry[field]);
5450
+ });
5285
5451
  };
5286
5452
  const heading = baseTokens.typography?.heading;
5287
5453
  if (heading) {
@@ -5303,6 +5469,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
5303
5469
  if (lead) {
5304
5470
  assignRole(["lead"], lead);
5305
5471
  }
5472
+ typographyResponsive(baseTokens.typography).forEach(({ breakpoint, roleParts, suffix, value }) => {
5473
+ assign(toVariableName(prefix, "typography", "responsive", breakpoint, ...roleParts, suffix), value);
5474
+ });
5306
5475
  Object.entries(baseTokens.shadows).forEach(([key, value]) => {
5307
5476
  if (typeof value === "string") {
5308
5477
  assign(toVariableName(prefix, "shadow", key), value);
@@ -5450,14 +5619,28 @@ var generateCssVariables = (tokens2, options = {}) => {
5450
5619
  (path) => ["form", ...path.map(kebabPathSegment)],
5451
5620
  void 0
5452
5621
  );
5622
+ const darkLink = getPath(darkMode, ["link"]);
5453
5623
  const highContrastLink = getPath(highContrastMode, ["link"]);
5454
5624
  Object.entries(linkTokens).forEach(([key, value]) => {
5455
5625
  const varName = toVariableName(prefix, "link", kebabPathSegment(key));
5456
- const resolved = pickSemantic(tokens2, value);
5457
- addBase(varName, resolved);
5458
- addDark(varName, resolved);
5626
+ addBase(varName, pickSemantic(tokens2, value));
5627
+ addDark(varName, pickSemantic(tokens2, getPath(darkLink, [key]), value));
5459
5628
  addHighContrast(varName, pickSemantic(tokens2, getPath(highContrastLink, [key]), value));
5460
5629
  });
5630
+ const actionValue = (value) => {
5631
+ const match = typeof value === "string" ? value.match(/^\{colors\.brand\.([^}]+)\}(?:\s*\/\s*([0-9.]+))?$/) : null;
5632
+ if (!match) return pickSemantic(tokens2, value);
5633
+ const ramp = `var(${toVariableName(prefix, "action", match[1])})`;
5634
+ return match[2] === void 0 ? ramp : `color-mix(in srgb, ${ramp} ${Math.round(Number(match[2]) * 1e3) / 10}%, transparent)`;
5635
+ };
5636
+ const darkAction = getPath(darkMode, ["action"]);
5637
+ const highContrastAction = getPath(highContrastMode, ["action"]);
5638
+ Object.entries(tokens2.action ?? {}).forEach(([key, value]) => {
5639
+ const varName = toVariableName(prefix, "action", kebabPathSegment(key));
5640
+ addBase(varName, actionValue(value));
5641
+ addDark(varName, actionValue(getPath(darkAction, [key]) ?? value));
5642
+ addHighContrast(varName, actionValue(getPath(highContrastAction, [key]) ?? value));
5643
+ });
5461
5644
  const highContrastButtons = getPath(highContrastMode, ["buttons"]);
5462
5645
  if (isPlainObject(highContrastButtons)) {
5463
5646
  Object.entries(highContrastButtons).forEach(([variant, states]) => {
@@ -5506,6 +5689,16 @@ ${indent}}`;
5506
5689
  const systemDarkBlock = `@media (prefers-color-scheme: dark) {
5507
5690
  ${modeBlock(themeSelectors("system"), modeLines(darkEntries), " ")}
5508
5691
  }`;
5692
+ const steps = actionSteps(tokens2);
5693
+ const actionBlocks = Object.entries(actionFamilies(tokens2)).map(([name, scale]) => {
5694
+ const lines = steps.map((step) => {
5695
+ if (scale[step] === void 0) throw new Error(`Action family "${name}" has no ${step} step`);
5696
+ return ` ${toVariableName(prefix, "action", step)}: ${resolveValue(tokens2, scale[step])};`;
5697
+ });
5698
+ return `${selector}[data-spectre-action="${name}"] {
5699
+ ${lines.join("\n")}
5700
+ }`;
5701
+ });
5509
5702
  const control = tokens2.control;
5510
5703
  const compact = isPlainObject(control) && isPlainObject(control.compact) ? control.compact : {};
5511
5704
  const densityLines = Object.entries(compact).flatMap(
@@ -5518,27 +5711,50 @@ ${modeBlock(themeSelectors("system"), modeLines(darkEntries), " ")}
5518
5711
  ${densityLines.join("\n")}
5519
5712
  }`] : [];
5520
5713
  const breakpoints = tokens2.breakpoints;
5521
- const responsiveBlocks = Object.entries(layoutResponsive(tokens2.layout)).map(([breakpoint, scales]) => {
5522
- const minWidth = breakpoints[breakpoint];
5523
- if (minWidth === void 0) {
5524
- throw new Error(`layout.responsive.${breakpoint} does not name a breakpoints entry`);
5714
+ const responsiveLines = /* @__PURE__ */ new Map();
5715
+ const addResponsive = (namespace, breakpoint, name, source) => {
5716
+ if (breakpoints[breakpoint] === void 0) {
5717
+ throw new Error(`${namespace}.responsive.${breakpoint} does not name a breakpoints entry`);
5525
5718
  }
5526
- const lines = LAYOUT_SCALES.flatMap(
5527
- ({ path, varParts }) => Object.keys(layoutScale(scales, path)).map((key) => {
5528
- const name = toVariableName(prefix, "layout", ...varParts, kebabCase(key));
5529
- const source = toVariableName(prefix, "layout", "responsive", breakpoint, ...varParts, kebabCase(key));
5530
- return ` ${name}: var(${source});`;
5531
- })
5719
+ responsiveLines.set(breakpoint, [...responsiveLines.get(breakpoint) ?? [], ` ${name}: var(${source});`]);
5720
+ };
5721
+ Object.entries(layoutResponsive(tokens2.layout)).forEach(([breakpoint, scales]) => {
5722
+ LAYOUT_SCALES.forEach(({ path, varParts }) => {
5723
+ Object.keys(layoutScale(scales, path)).forEach((key) => {
5724
+ addResponsive(
5725
+ "layout",
5726
+ breakpoint,
5727
+ toVariableName(prefix, "layout", ...varParts, kebabCase(key)),
5728
+ toVariableName(prefix, "layout", "responsive", breakpoint, ...varParts, kebabCase(key))
5729
+ );
5730
+ });
5731
+ });
5732
+ });
5733
+ typographyResponsive(tokens2.typography).forEach(({ breakpoint, roleParts, suffix }) => {
5734
+ addResponsive(
5735
+ "typography",
5736
+ breakpoint,
5737
+ toVariableName(prefix, ...roleParts, suffix),
5738
+ toVariableName(prefix, "typography", "responsive", breakpoint, ...roleParts, suffix)
5532
5739
  );
5533
- return `@media (min-width: ${resolveValue(tokens2, minWidth)}) {
5740
+ });
5741
+ const responsiveBlocks = Object.keys(breakpoints).filter((breakpoint) => responsiveLines.has(breakpoint)).map(
5742
+ (breakpoint) => `@media (min-width: ${resolveValue(tokens2, breakpoints[breakpoint])}) {
5534
5743
  ${selector} {
5535
- ${lines.join("\n")}
5744
+ ${responsiveLines.get(breakpoint).join("\n")}
5536
5745
  }
5537
- }`;
5538
- });
5539
- return [rootBlock, darkBlock, highContrastBlock, lightBlock, systemDarkBlock, ...densityBlocks, ...responsiveBlocks].join(
5540
- "\n"
5541
- ) + "\n";
5746
+ }`
5747
+ );
5748
+ return [
5749
+ rootBlock,
5750
+ darkBlock,
5751
+ highContrastBlock,
5752
+ lightBlock,
5753
+ systemDarkBlock,
5754
+ ...actionBlocks,
5755
+ ...densityBlocks,
5756
+ ...responsiveBlocks
5757
+ ].join("\n") + "\n";
5542
5758
  };
5543
5759
 
5544
5760
  // src/index.ts