@phcdevworks/spectre-tokens 4.15.0 → 4.17.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
@@ -1927,6 +1927,11 @@ var coreTokens = {
1927
1927
  }
1928
1928
  },
1929
1929
  "dark": {
1930
+ "decorative": {
1931
+ "gradient": {
1932
+ "action": "linear-gradient(135deg, {colors.brand.300} 0%, {colors.brand.500} 100%)"
1933
+ }
1934
+ },
1930
1935
  "action": {
1931
1936
  "onPage": "{colors.brand.400}",
1932
1937
  "onSurface": "{colors.brand.400}",
@@ -2800,9 +2805,28 @@ var coreTokens = {
2800
2805
  "visited": "{colors.accent.300}",
2801
2806
  "underline": "{colors.brand.400} / 0.4",
2802
2807
  "underlineHover": "{colors.brand.300}"
2808
+ },
2809
+ "buttons": {
2810
+ "secondary": {
2811
+ "bg": "transparent",
2812
+ "bgHover": "{colors.neutral.800}",
2813
+ "bgActive": "{colors.neutral.700}",
2814
+ "bgDisabled": "transparent",
2815
+ "text": "{colors.info.300}",
2816
+ "textDisabled": "{colors.neutral.500}",
2817
+ "border": "{colors.info.400}",
2818
+ "borderDisabled": "{colors.neutral.700}",
2819
+ "focusRing": "{colors.info.500} / 0.4",
2820
+ "focusVisible": "{colors.info.500} / 0.4"
2821
+ }
2803
2822
  }
2804
2823
  },
2805
2824
  "highContrast": {
2825
+ "decorative": {
2826
+ "gradient": {
2827
+ "action": "linear-gradient(135deg, {colors.brand.700} 0%, {colors.brand.900} 100%)"
2828
+ }
2829
+ },
2806
2830
  "action": {
2807
2831
  "bg": "{colors.brand.800}",
2808
2832
  "bgHover": "{colors.brand.900}",
@@ -4360,6 +4384,32 @@ var coreTokens = {
4360
4384
  "800": "#2b251b",
4361
4385
  "900": "#1f190e",
4362
4386
  "950": "#0e0a05"
4387
+ },
4388
+ "bradpotts-teal": {
4389
+ "50": "#f1fdfc",
4390
+ "100": "#cef9f7",
4391
+ "200": "#9cf4f0",
4392
+ "300": "#5ae8e5",
4393
+ "400": "#34d1cf",
4394
+ "500": "#2db7b6",
4395
+ "600": "#249394",
4396
+ "700": "#1c7578",
4397
+ "800": "#165d61",
4398
+ "900": "#174d50",
4399
+ "950": "#092e31"
4400
+ },
4401
+ "bradpotts-ink": {
4402
+ "50": "#f7fafb",
4403
+ "100": "#f0f6f8",
4404
+ "200": "#dfe9ee",
4405
+ "300": "#c6d7df",
4406
+ "400": "#85a5b3",
4407
+ "500": "#557987",
4408
+ "600": "#395966",
4409
+ "700": "#244552",
4410
+ "800": "#0f2d38",
4411
+ "900": "#001b25",
4412
+ "950": "#00090f"
4363
4413
  }
4364
4414
  }
4365
4415
  },
@@ -4445,7 +4495,8 @@ var coreTokens = {
4445
4495
  "slow": "500ms",
4446
4496
  "slower": "700ms",
4447
4497
  "long": "1000ms",
4448
- "slowest": "1200ms"
4498
+ "slowest": "1200ms",
4499
+ "ambient": "7000ms"
4449
4500
  },
4450
4501
  "easing": {
4451
4502
  "linear": "linear",
@@ -4828,6 +4879,56 @@ var coreTokens = {
4828
4879
  "zIndex": "{zIndex.modal}"
4829
4880
  }
4830
4881
  },
4882
+ "decorative": {
4883
+ "pattern": {
4884
+ "cell": {
4885
+ "sm": "{space.12}",
4886
+ "md": "{space.20}",
4887
+ "lg": "{space.32}",
4888
+ "xl": "{space.48}"
4889
+ },
4890
+ "dotRadius": {
4891
+ "sm": "{space.1}",
4892
+ "md": "{space.2}",
4893
+ "lg": "{space.4}"
4894
+ },
4895
+ "lineWeight": {
4896
+ "sm": "{space.1}",
4897
+ "md": "{space.2}",
4898
+ "lg": "{space.4}"
4899
+ },
4900
+ "opacity": {
4901
+ "subtle": "0.25",
4902
+ "muted": "0.5",
4903
+ "strong": "0.75"
4904
+ }
4905
+ },
4906
+ "fade": {
4907
+ "edge": {
4908
+ "solid": "0%",
4909
+ "clear": "100%"
4910
+ },
4911
+ "corner": {
4912
+ "solid": "0%",
4913
+ "clear": "50%"
4914
+ },
4915
+ "radial": {
4916
+ "solid": "25%",
4917
+ "clear": "75%"
4918
+ }
4919
+ },
4920
+ "shimmer": {
4921
+ "band": {
4922
+ "start": "35%",
4923
+ "peak": "50%",
4924
+ "end": "65%"
4925
+ },
4926
+ "travel": "60%"
4927
+ },
4928
+ "gradient": {
4929
+ "action": "linear-gradient(135deg, {colors.brand.500} 0%, {colors.brand.700} 100%)"
4930
+ }
4931
+ },
4831
4932
  "font": {
4832
4933
  "xs": {
4833
4934
  "size": "0.75rem",
@@ -4912,7 +5013,9 @@ var coreTokens = {
4912
5013
  "families": {
4913
5014
  "sans": "system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",
4914
5015
  "serif": "'Times New Roman', Times, serif",
4915
- "mono": "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace"
5016
+ "mono": "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",
5017
+ "heading": "{typography.families.sans}",
5018
+ "body": "{typography.families.sans}"
4916
5019
  },
4917
5020
  "scale": {
4918
5021
  "xs": {
@@ -4996,42 +5099,42 @@ var coreTokens = {
4996
5099
  },
4997
5100
  "heading": {
4998
5101
  "h1": {
4999
- "fontFamily": "{typography.families.sans}",
5102
+ "fontFamily": "{typography.families.heading}",
5000
5103
  "fontSize": "{typography.scale.4xl.fontSize}",
5001
5104
  "lineHeight": "{typography.scale.4xl.lineHeight}",
5002
5105
  "fontWeight": 800,
5003
5106
  "letterSpacing": "{typography.scale.4xl.letterSpacing}"
5004
5107
  },
5005
5108
  "h2": {
5006
- "fontFamily": "{typography.families.sans}",
5109
+ "fontFamily": "{typography.families.heading}",
5007
5110
  "fontSize": "{typography.scale.3xl.fontSize}",
5008
5111
  "lineHeight": "{typography.scale.3xl.lineHeight}",
5009
5112
  "fontWeight": 700,
5010
5113
  "letterSpacing": "{typography.scale.3xl.letterSpacing}"
5011
5114
  },
5012
5115
  "h3": {
5013
- "fontFamily": "{typography.families.sans}",
5116
+ "fontFamily": "{typography.families.heading}",
5014
5117
  "fontSize": "{typography.scale.2xl.fontSize}",
5015
5118
  "lineHeight": "{typography.scale.2xl.lineHeight}",
5016
5119
  "fontWeight": 700,
5017
5120
  "letterSpacing": "{typography.scale.2xl.letterSpacing}"
5018
5121
  },
5019
5122
  "h4": {
5020
- "fontFamily": "{typography.families.sans}",
5123
+ "fontFamily": "{typography.families.heading}",
5021
5124
  "fontSize": "{typography.scale.xl.fontSize}",
5022
5125
  "lineHeight": "{typography.scale.xl.lineHeight}",
5023
5126
  "fontWeight": 600,
5024
5127
  "letterSpacing": "{typography.scale.xl.letterSpacing}"
5025
5128
  },
5026
5129
  "h5": {
5027
- "fontFamily": "{typography.families.sans}",
5130
+ "fontFamily": "{typography.families.heading}",
5028
5131
  "fontSize": "{typography.scale.xl.fontSize}",
5029
5132
  "lineHeight": "{typography.scale.xl.lineHeight}",
5030
5133
  "fontWeight": 600,
5031
5134
  "letterSpacing": "{typography.scale.xl.letterSpacing}"
5032
5135
  },
5033
5136
  "h6": {
5034
- "fontFamily": "{typography.families.sans}",
5137
+ "fontFamily": "{typography.families.heading}",
5035
5138
  "fontSize": "{typography.scale.xl.fontSize}",
5036
5139
  "lineHeight": "{typography.scale.xl.lineHeight}",
5037
5140
  "fontWeight": 600,
@@ -5039,7 +5142,7 @@ var coreTokens = {
5039
5142
  }
5040
5143
  },
5041
5144
  "body": {
5042
- "fontFamily": "{typography.families.sans}",
5145
+ "fontFamily": "{typography.families.body}",
5043
5146
  "fontSize": "{typography.scale.md.fontSize}",
5044
5147
  "lineHeight": "{typography.scale.md.lineHeight}",
5045
5148
  "fontWeight": 400,
@@ -5047,42 +5150,42 @@ var coreTokens = {
5047
5150
  },
5048
5151
  "display": {
5049
5152
  "1": {
5050
- "fontFamily": "{typography.families.sans}",
5153
+ "fontFamily": "{typography.families.heading}",
5051
5154
  "fontSize": "{typography.scale.4xl.fontSize}",
5052
5155
  "lineHeight": "{typography.scale.4xl.lineHeight}",
5053
5156
  "fontWeight": 800,
5054
5157
  "letterSpacing": "{typography.scale.4xl.letterSpacing}"
5055
5158
  },
5056
5159
  "2": {
5057
- "fontFamily": "{typography.families.sans}",
5160
+ "fontFamily": "{typography.families.heading}",
5058
5161
  "fontSize": "{typography.scale.4xl.fontSize}",
5059
5162
  "lineHeight": "{typography.scale.4xl.lineHeight}",
5060
5163
  "fontWeight": 800,
5061
5164
  "letterSpacing": "{typography.scale.4xl.letterSpacing}"
5062
5165
  },
5063
5166
  "3": {
5064
- "fontFamily": "{typography.families.sans}",
5167
+ "fontFamily": "{typography.families.heading}",
5065
5168
  "fontSize": "{typography.scale.4xl.fontSize}",
5066
5169
  "lineHeight": "{typography.scale.4xl.lineHeight}",
5067
5170
  "fontWeight": 700,
5068
5171
  "letterSpacing": "{typography.scale.4xl.letterSpacing}"
5069
5172
  },
5070
5173
  "4": {
5071
- "fontFamily": "{typography.families.sans}",
5174
+ "fontFamily": "{typography.families.heading}",
5072
5175
  "fontSize": "{typography.scale.4xl.fontSize}",
5073
5176
  "lineHeight": "{typography.scale.4xl.lineHeight}",
5074
5177
  "fontWeight": 700,
5075
5178
  "letterSpacing": "{typography.scale.4xl.letterSpacing}"
5076
5179
  },
5077
5180
  "5": {
5078
- "fontFamily": "{typography.families.sans}",
5181
+ "fontFamily": "{typography.families.heading}",
5079
5182
  "fontSize": "{typography.scale.3xl.fontSize}",
5080
5183
  "lineHeight": "{typography.scale.3xl.lineHeight}",
5081
5184
  "fontWeight": 600,
5082
5185
  "letterSpacing": "{typography.scale.3xl.letterSpacing}"
5083
5186
  },
5084
5187
  "6": {
5085
- "fontFamily": "{typography.families.sans}",
5188
+ "fontFamily": "{typography.families.heading}",
5086
5189
  "fontSize": "{typography.scale.2xl.fontSize}",
5087
5190
  "lineHeight": "{typography.scale.2xl.lineHeight}",
5088
5191
  "fontWeight": 600,
@@ -5090,7 +5193,7 @@ var coreTokens = {
5090
5193
  }
5091
5194
  },
5092
5195
  "lead": {
5093
- "fontFamily": "{typography.families.sans}",
5196
+ "fontFamily": "{typography.families.body}",
5094
5197
  "fontSize": "{typography.scale.xl.fontSize}",
5095
5198
  "lineHeight": "{typography.scale.xl.lineHeight}",
5096
5199
  "fontWeight": 400,
@@ -5422,8 +5525,12 @@ var createCssVariableMap = (tokens2, options = {}) => {
5422
5525
  assign(toVariableName(prefix, "aspect-ratio", key), value);
5423
5526
  });
5424
5527
  }
5528
+ const familyReference = (value) => {
5529
+ const key = typeof value === "string" ? value.match(/^\{typography\.families\.([^}]+)\}$/)?.[1] : void 0;
5530
+ return key === void 0 ? void 0 : `var(${toVariableName(prefix, "font-family", key)})`;
5531
+ };
5425
5532
  Object.entries(baseTokens.typography.families).forEach(([key, value]) => {
5426
- assign(toVariableName(prefix, "font-family", key), value);
5533
+ assign(toVariableName(prefix, "font-family", key), familyReference(value) ?? value);
5427
5534
  });
5428
5535
  const typographyScale = baseTokens.typography?.scale ?? {};
5429
5536
  const fontScale = baseTokens.font;
@@ -5446,7 +5553,8 @@ var createCssVariableMap = (tokens2, options = {}) => {
5446
5553
  });
5447
5554
  const assignRole = (rolePrefixParts, entry) => {
5448
5555
  Object.entries(ROLE_FIELD_SUFFIXES).forEach(([field, suffix]) => {
5449
- assign(toVariableName(prefix, ...rolePrefixParts, suffix), entry[field]);
5556
+ const value = entry[field];
5557
+ assign(toVariableName(prefix, ...rolePrefixParts, suffix), field === "fontFamily" && familyReference(value) || value);
5450
5558
  });
5451
5559
  };
5452
5560
  const heading = baseTokens.typography?.heading;
@@ -5496,6 +5604,17 @@ var createCssVariableMap = (tokens2, options = {}) => {
5496
5604
  Object.entries(baseTokens.opacity).forEach(([key, value]) => {
5497
5605
  assign(toVariableName(prefix, "opacity", key), value);
5498
5606
  });
5607
+ const decorative = baseTokens.decorative;
5608
+ if (isPlainObject(decorative)) {
5609
+ const assignDecorative = (node, parts) => {
5610
+ if (!isPlainObject(node)) {
5611
+ assign(toVariableName(prefix, ...parts.map(kebabCase)), node);
5612
+ return;
5613
+ }
5614
+ Object.entries(node).forEach(([key, nested]) => assignDecorative(nested, [...parts, key]));
5615
+ };
5616
+ Object.entries(decorative).filter(([group]) => group !== "gradient").forEach(([group, node]) => assignDecorative(node, [group]));
5617
+ }
5499
5618
  assign(toVariableName(prefix, "focus-ring-width"), baseTokens.accessibility.focusRing.width);
5500
5619
  assign(toVariableName(prefix, "focus-ring-offset"), baseTokens.accessibility.focusRing.offset);
5501
5620
  assign(toVariableName(prefix, "focus-ring-style"), baseTokens.accessibility.focusRing.style);
@@ -5641,14 +5760,34 @@ var generateCssVariables = (tokens2, options = {}) => {
5641
5760
  addDark(varName, actionValue(getPath(darkAction, [key]) ?? value));
5642
5761
  addHighContrast(varName, actionValue(getPath(highContrastAction, [key]) ?? value));
5643
5762
  });
5644
- const highContrastButtons = getPath(highContrastMode, ["buttons"]);
5645
- if (isPlainObject(highContrastButtons)) {
5646
- Object.entries(highContrastButtons).forEach(([variant, states]) => {
5763
+ const gradientValue = (value) => {
5764
+ const raw = isPlainObject(value) && "value" in value ? value.value : value;
5765
+ if (typeof raw !== "string") return pickSemantic(tokens2, value);
5766
+ return resolveValue(
5767
+ tokens2,
5768
+ raw.replace(/\{colors\.brand\.([^}]+)\}/g, (_, step) => `var(${toVariableName(prefix, "action", step)})`)
5769
+ );
5770
+ };
5771
+ const decorativeGradients = getPath(tokens2, ["decorative", "gradient"]);
5772
+ const darkGradients = getPath(darkMode, ["decorative", "gradient"]);
5773
+ const highContrastGradients = getPath(highContrastMode, ["decorative", "gradient"]);
5774
+ Object.entries(isPlainObject(decorativeGradients) ? decorativeGradients : {}).forEach(([key, value]) => {
5775
+ const varName = toVariableName(prefix, "gradient", kebabPathSegment(key));
5776
+ addBase(varName, gradientValue(value));
5777
+ addDark(varName, gradientValue(getPath(darkGradients, [key]) ?? value));
5778
+ addHighContrast(varName, gradientValue(getPath(highContrastGradients, [key]) ?? value));
5779
+ });
5780
+ const addButtonOverrides = (mode, add) => {
5781
+ const buttons = getPath(mode, ["buttons"]);
5782
+ if (!isPlainObject(buttons)) return;
5783
+ Object.entries(buttons).forEach(([variant, states]) => {
5647
5784
  Object.entries(states).forEach(([state, value]) => {
5648
- addHighContrast(toVariableName(prefix, "button", variant, state), pickSemantic(tokens2, value));
5785
+ add(toVariableName(prefix, "button", variant, state), pickSemantic(tokens2, value));
5649
5786
  });
5650
5787
  });
5651
- }
5788
+ };
5789
+ addButtonOverrides(darkMode, addDark);
5790
+ addButtonOverrides(highContrastMode, addHighContrast);
5652
5791
  const mapLines = Object.entries(declarations).filter(([name]) => !modeScopedNames.has(name)).map(([name, value]) => ` ${name}: ${value};`);
5653
5792
  const rootBlock = `${selector} {
5654
5793
  ${[...baseLines, ...mapLines].join("\n")}