@phcdevworks/spectre-tokens 4.14.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.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;
@@ -2797,6 +2802,15 @@ interface SpectreGeneratedTokens {
2797
2802
  };
2798
2803
  };
2799
2804
  highContrast: {
2805
+ action: {
2806
+ bg: string;
2807
+ bgHover: string;
2808
+ bgActive: string;
2809
+ text: string;
2810
+ onPage: string;
2811
+ onSurface: string;
2812
+ rail: string;
2813
+ };
2800
2814
  surface: {
2801
2815
  page: string;
2802
2816
  card: string;
@@ -4649,6 +4663,16 @@ interface SpectreGeneratedTokens {
4649
4663
  underline: string;
4650
4664
  underlineHover: string;
4651
4665
  };
4666
+ action: {
4667
+ bg: string;
4668
+ bgHover: string;
4669
+ bgActive: string;
4670
+ text: string;
4671
+ focusRing: string;
4672
+ onPage: string;
4673
+ onSurface: string;
4674
+ rail: string;
4675
+ };
4652
4676
  text: {
4653
4677
  onPage: {
4654
4678
  default: string;
@@ -5071,6 +5095,46 @@ interface SpectreGeneratedTokens {
5071
5095
  fontWeight: number;
5072
5096
  letterSpacing: string;
5073
5097
  };
5098
+ responsive: {
5099
+ md: {
5100
+ heading: {
5101
+ h1: {
5102
+ fontSize: string;
5103
+ lineHeight: string;
5104
+ };
5105
+ h2: {
5106
+ fontSize: string;
5107
+ lineHeight: string;
5108
+ };
5109
+ h3: {
5110
+ fontSize: string;
5111
+ lineHeight: string;
5112
+ };
5113
+ h4: {
5114
+ fontSize: string;
5115
+ lineHeight: string;
5116
+ };
5117
+ h5: {
5118
+ fontSize: string;
5119
+ lineHeight: string;
5120
+ };
5121
+ };
5122
+ display: {
5123
+ '1': {
5124
+ fontSize: string;
5125
+ lineHeight: string;
5126
+ };
5127
+ '2': {
5128
+ fontSize: string;
5129
+ lineHeight: string;
5130
+ };
5131
+ '3': {
5132
+ fontSize: string;
5133
+ lineHeight: string;
5134
+ };
5135
+ };
5136
+ };
5137
+ };
5074
5138
  };
5075
5139
  }
5076
5140
 
@@ -5098,6 +5162,10 @@ interface TypographyTokens {
5098
5162
  body: TypographyBodyEntry;
5099
5163
  display: Record<string, TypographyRoleEntry>;
5100
5164
  lead: TypographyRoleEntry;
5165
+ responsive: Record<string, {
5166
+ heading?: Record<string, Partial<TypographyRoleEntry>>;
5167
+ display?: Record<string, Partial<TypographyRoleEntry>>;
5168
+ }>;
5101
5169
  }
5102
5170
  interface TransitionTokens {
5103
5171
  duration: TokenScale;
@@ -5400,6 +5468,7 @@ interface SpectreModeTokens {
5400
5468
  invalid?: Record<string, SemanticTokenValue>;
5401
5469
  };
5402
5470
  component: ComponentTokens<SemanticTokenValue>;
5471
+ action?: Record<string, SemanticTokenValue>;
5403
5472
  buttons?: Record<string, Record<string, SemanticTokenValue>>;
5404
5473
  link?: Record<string, SemanticTokenValue>;
5405
5474
  }
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;
@@ -2797,6 +2802,15 @@ interface SpectreGeneratedTokens {
2797
2802
  };
2798
2803
  };
2799
2804
  highContrast: {
2805
+ action: {
2806
+ bg: string;
2807
+ bgHover: string;
2808
+ bgActive: string;
2809
+ text: string;
2810
+ onPage: string;
2811
+ onSurface: string;
2812
+ rail: string;
2813
+ };
2800
2814
  surface: {
2801
2815
  page: string;
2802
2816
  card: string;
@@ -4649,6 +4663,16 @@ interface SpectreGeneratedTokens {
4649
4663
  underline: string;
4650
4664
  underlineHover: string;
4651
4665
  };
4666
+ action: {
4667
+ bg: string;
4668
+ bgHover: string;
4669
+ bgActive: string;
4670
+ text: string;
4671
+ focusRing: string;
4672
+ onPage: string;
4673
+ onSurface: string;
4674
+ rail: string;
4675
+ };
4652
4676
  text: {
4653
4677
  onPage: {
4654
4678
  default: string;
@@ -5071,6 +5095,46 @@ interface SpectreGeneratedTokens {
5071
5095
  fontWeight: number;
5072
5096
  letterSpacing: string;
5073
5097
  };
5098
+ responsive: {
5099
+ md: {
5100
+ heading: {
5101
+ h1: {
5102
+ fontSize: string;
5103
+ lineHeight: string;
5104
+ };
5105
+ h2: {
5106
+ fontSize: string;
5107
+ lineHeight: string;
5108
+ };
5109
+ h3: {
5110
+ fontSize: string;
5111
+ lineHeight: string;
5112
+ };
5113
+ h4: {
5114
+ fontSize: string;
5115
+ lineHeight: string;
5116
+ };
5117
+ h5: {
5118
+ fontSize: string;
5119
+ lineHeight: string;
5120
+ };
5121
+ };
5122
+ display: {
5123
+ '1': {
5124
+ fontSize: string;
5125
+ lineHeight: string;
5126
+ };
5127
+ '2': {
5128
+ fontSize: string;
5129
+ lineHeight: string;
5130
+ };
5131
+ '3': {
5132
+ fontSize: string;
5133
+ lineHeight: string;
5134
+ };
5135
+ };
5136
+ };
5137
+ };
5074
5138
  };
5075
5139
  }
5076
5140
 
@@ -5098,6 +5162,10 @@ interface TypographyTokens {
5098
5162
  body: TypographyBodyEntry;
5099
5163
  display: Record<string, TypographyRoleEntry>;
5100
5164
  lead: TypographyRoleEntry;
5165
+ responsive: Record<string, {
5166
+ heading?: Record<string, Partial<TypographyRoleEntry>>;
5167
+ display?: Record<string, Partial<TypographyRoleEntry>>;
5168
+ }>;
5101
5169
  }
5102
5170
  interface TransitionTokens {
5103
5171
  duration: TokenScale;
@@ -5400,6 +5468,7 @@ interface SpectreModeTokens {
5400
5468
  invalid?: Record<string, SemanticTokenValue>;
5401
5469
  };
5402
5470
  component: ComponentTokens<SemanticTokenValue>;
5471
+ action?: Record<string, SemanticTokenValue>;
5403
5472
  buttons?: Record<string, Record<string, SemanticTokenValue>>;
5404
5473
  link?: Record<string, SemanticTokenValue>;
5405
5474
  }
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}",
@@ -2798,6 +2803,15 @@ var coreTokens = {
2798
2803
  }
2799
2804
  },
2800
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
+ },
2801
2815
  "surface": {
2802
2816
  "page": "{colors.white}",
2803
2817
  "card": "{colors.white}",
@@ -4650,6 +4664,16 @@ var coreTokens = {
4650
4664
  "underline": "{colors.brand.600} / 0.4",
4651
4665
  "underlineHover": "{colors.brand.700}"
4652
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
+ },
4653
4677
  "text": {
4654
4678
  "onPage": {
4655
4679
  "default": "{colors.neutral.900}",
@@ -4973,38 +4997,38 @@ var coreTokens = {
4973
4997
  "heading": {
4974
4998
  "h1": {
4975
4999
  "fontFamily": "{typography.families.sans}",
4976
- "fontSize": "{typography.scale.6xl.fontSize}",
4977
- "lineHeight": "{typography.scale.6xl.lineHeight}",
5000
+ "fontSize": "{typography.scale.4xl.fontSize}",
5001
+ "lineHeight": "{typography.scale.4xl.lineHeight}",
4978
5002
  "fontWeight": 800,
4979
- "letterSpacing": "{typography.scale.6xl.letterSpacing}"
5003
+ "letterSpacing": "{typography.scale.4xl.letterSpacing}"
4980
5004
  },
4981
5005
  "h2": {
4982
5006
  "fontFamily": "{typography.families.sans}",
4983
- "fontSize": "{typography.scale.5xl.fontSize}",
4984
- "lineHeight": "{typography.scale.5xl.lineHeight}",
5007
+ "fontSize": "{typography.scale.3xl.fontSize}",
5008
+ "lineHeight": "{typography.scale.3xl.lineHeight}",
4985
5009
  "fontWeight": 700,
4986
- "letterSpacing": "{typography.scale.5xl.letterSpacing}"
5010
+ "letterSpacing": "{typography.scale.3xl.letterSpacing}"
4987
5011
  },
4988
5012
  "h3": {
4989
5013
  "fontFamily": "{typography.families.sans}",
4990
- "fontSize": "{typography.scale.4xl.fontSize}",
4991
- "lineHeight": "{typography.scale.4xl.lineHeight}",
5014
+ "fontSize": "{typography.scale.2xl.fontSize}",
5015
+ "lineHeight": "{typography.scale.2xl.lineHeight}",
4992
5016
  "fontWeight": 700,
4993
- "letterSpacing": "{typography.scale.4xl.letterSpacing}"
5017
+ "letterSpacing": "{typography.scale.2xl.letterSpacing}"
4994
5018
  },
4995
5019
  "h4": {
4996
5020
  "fontFamily": "{typography.families.sans}",
4997
- "fontSize": "{typography.scale.3xl.fontSize}",
4998
- "lineHeight": "{typography.scale.3xl.lineHeight}",
5021
+ "fontSize": "{typography.scale.xl.fontSize}",
5022
+ "lineHeight": "{typography.scale.xl.lineHeight}",
4999
5023
  "fontWeight": 600,
5000
- "letterSpacing": "{typography.scale.3xl.letterSpacing}"
5024
+ "letterSpacing": "{typography.scale.xl.letterSpacing}"
5001
5025
  },
5002
5026
  "h5": {
5003
5027
  "fontFamily": "{typography.families.sans}",
5004
- "fontSize": "{typography.scale.2xl.fontSize}",
5005
- "lineHeight": "{typography.scale.2xl.lineHeight}",
5028
+ "fontSize": "{typography.scale.xl.fontSize}",
5029
+ "lineHeight": "{typography.scale.xl.lineHeight}",
5006
5030
  "fontWeight": 600,
5007
- "letterSpacing": "{typography.scale.2xl.letterSpacing}"
5031
+ "letterSpacing": "{typography.scale.xl.letterSpacing}"
5008
5032
  },
5009
5033
  "h6": {
5010
5034
  "fontFamily": "{typography.families.sans}",
@@ -5024,24 +5048,24 @@ var coreTokens = {
5024
5048
  "display": {
5025
5049
  "1": {
5026
5050
  "fontFamily": "{typography.families.sans}",
5027
- "fontSize": "{typography.scale.7xl.fontSize}",
5028
- "lineHeight": "{typography.scale.7xl.lineHeight}",
5051
+ "fontSize": "{typography.scale.4xl.fontSize}",
5052
+ "lineHeight": "{typography.scale.4xl.lineHeight}",
5029
5053
  "fontWeight": 800,
5030
- "letterSpacing": "{typography.scale.7xl.letterSpacing}"
5054
+ "letterSpacing": "{typography.scale.4xl.letterSpacing}"
5031
5055
  },
5032
5056
  "2": {
5033
5057
  "fontFamily": "{typography.families.sans}",
5034
- "fontSize": "{typography.scale.6xl.fontSize}",
5035
- "lineHeight": "{typography.scale.6xl.lineHeight}",
5058
+ "fontSize": "{typography.scale.4xl.fontSize}",
5059
+ "lineHeight": "{typography.scale.4xl.lineHeight}",
5036
5060
  "fontWeight": 800,
5037
- "letterSpacing": "{typography.scale.6xl.letterSpacing}"
5061
+ "letterSpacing": "{typography.scale.4xl.letterSpacing}"
5038
5062
  },
5039
5063
  "3": {
5040
5064
  "fontFamily": "{typography.families.sans}",
5041
- "fontSize": "{typography.scale.5xl.fontSize}",
5042
- "lineHeight": "{typography.scale.5xl.lineHeight}",
5065
+ "fontSize": "{typography.scale.4xl.fontSize}",
5066
+ "lineHeight": "{typography.scale.4xl.lineHeight}",
5043
5067
  "fontWeight": 700,
5044
- "letterSpacing": "{typography.scale.5xl.letterSpacing}"
5068
+ "letterSpacing": "{typography.scale.4xl.letterSpacing}"
5045
5069
  },
5046
5070
  "4": {
5047
5071
  "fontFamily": "{typography.families.sans}",
@@ -5071,6 +5095,46 @@ var coreTokens = {
5071
5095
  "lineHeight": "{typography.scale.xl.lineHeight}",
5072
5096
  "fontWeight": 400,
5073
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
+ }
5074
5138
  }
5075
5139
  }
5076
5140
  };
@@ -5102,6 +5166,42 @@ var layoutResponsive = (layout) => {
5102
5166
  const responsive = isPlainObject(layout) ? layout.responsive : void 0;
5103
5167
  return isPlainObject(responsive) ? responsive : {};
5104
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);
5105
5205
  var resolveTokenReference = (tokens2, reference) => {
5106
5206
  const path = reference.slice(1, -1).split(".");
5107
5207
  let current = tokens2;
@@ -5188,6 +5288,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
5188
5288
  Object.entries(baseTokens.colors).forEach(([group, scale]) => {
5189
5289
  assignColorGroup([group], scale);
5190
5290
  });
5291
+ actionSteps(tokens2).forEach((step) => {
5292
+ assign(toVariableName(prefix, "action", step), baseTokens.colors.brand[step]);
5293
+ });
5191
5294
  if (baseTokens.space) {
5192
5295
  Object.entries(baseTokens.space).forEach(([key, value]) => {
5193
5296
  assign(toVariableName(prefix, "space", key), value);
@@ -5342,11 +5445,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
5342
5445
  assign(toVariableName(prefix, "font", key, "letter-spacing"), scaleEntry.letterSpacing);
5343
5446
  });
5344
5447
  const assignRole = (rolePrefixParts, entry) => {
5345
- assign(toVariableName(prefix, ...rolePrefixParts, "family"), entry.fontFamily);
5346
- assign(toVariableName(prefix, ...rolePrefixParts, "size"), entry.fontSize);
5347
- assign(toVariableName(prefix, ...rolePrefixParts, "line-height"), entry.lineHeight);
5348
- assign(toVariableName(prefix, ...rolePrefixParts, "weight"), entry.fontWeight);
5349
- 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
+ });
5350
5451
  };
5351
5452
  const heading = baseTokens.typography?.heading;
5352
5453
  if (heading) {
@@ -5368,6 +5469,9 @@ var createCssVariableMap = (tokens2, options = {}) => {
5368
5469
  if (lead) {
5369
5470
  assignRole(["lead"], lead);
5370
5471
  }
5472
+ typographyResponsive(baseTokens.typography).forEach(({ breakpoint, roleParts, suffix, value }) => {
5473
+ assign(toVariableName(prefix, "typography", "responsive", breakpoint, ...roleParts, suffix), value);
5474
+ });
5371
5475
  Object.entries(baseTokens.shadows).forEach(([key, value]) => {
5372
5476
  if (typeof value === "string") {
5373
5477
  assign(toVariableName(prefix, "shadow", key), value);
@@ -5523,6 +5627,20 @@ var generateCssVariables = (tokens2, options = {}) => {
5523
5627
  addDark(varName, pickSemantic(tokens2, getPath(darkLink, [key]), value));
5524
5628
  addHighContrast(varName, pickSemantic(tokens2, getPath(highContrastLink, [key]), value));
5525
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
+ });
5526
5644
  const highContrastButtons = getPath(highContrastMode, ["buttons"]);
5527
5645
  if (isPlainObject(highContrastButtons)) {
5528
5646
  Object.entries(highContrastButtons).forEach(([variant, states]) => {
@@ -5571,6 +5689,16 @@ ${indent}}`;
5571
5689
  const systemDarkBlock = `@media (prefers-color-scheme: dark) {
5572
5690
  ${modeBlock(themeSelectors("system"), modeLines(darkEntries), " ")}
5573
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
+ });
5574
5702
  const control = tokens2.control;
5575
5703
  const compact = isPlainObject(control) && isPlainObject(control.compact) ? control.compact : {};
5576
5704
  const densityLines = Object.entries(compact).flatMap(
@@ -5583,27 +5711,50 @@ ${modeBlock(themeSelectors("system"), modeLines(darkEntries), " ")}
5583
5711
  ${densityLines.join("\n")}
5584
5712
  }`] : [];
5585
5713
  const breakpoints = tokens2.breakpoints;
5586
- const responsiveBlocks = Object.entries(layoutResponsive(tokens2.layout)).map(([breakpoint, scales]) => {
5587
- const minWidth = breakpoints[breakpoint];
5588
- if (minWidth === void 0) {
5589
- 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`);
5590
5718
  }
5591
- const lines = LAYOUT_SCALES.flatMap(
5592
- ({ path, varParts }) => Object.keys(layoutScale(scales, path)).map((key) => {
5593
- const name = toVariableName(prefix, "layout", ...varParts, kebabCase(key));
5594
- const source = toVariableName(prefix, "layout", "responsive", breakpoint, ...varParts, kebabCase(key));
5595
- return ` ${name}: var(${source});`;
5596
- })
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)
5597
5739
  );
5598
- 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])}) {
5599
5743
  ${selector} {
5600
- ${lines.join("\n")}
5744
+ ${responsiveLines.get(breakpoint).join("\n")}
5601
5745
  }
5602
- }`;
5603
- });
5604
- return [rootBlock, darkBlock, highContrastBlock, lightBlock, systemDarkBlock, ...densityBlocks, ...responsiveBlocks].join(
5605
- "\n"
5606
- ) + "\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";
5607
5758
  };
5608
5759
 
5609
5760
  // src/index.ts