@phcdevworks/spectre-tokens 2.3.0 → 2.4.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.css CHANGED
@@ -208,9 +208,9 @@
208
208
  --sp-icon-box-icon-warning: #d48806;
209
209
  --sp-icon-box-icon-danger: #dc2626;
210
210
  --sp-shadow-none: none;
211
- --sp-shadow-sm: 0 1px 2px 0 rgba(34, 43, 56, 0.06);
212
- --sp-shadow-md: 0 2px 6px -1px rgba(34, 43, 56, 0.08);
213
- --sp-shadow-lg: 0 6px 16px -4px rgba(34, 43, 56, 0.12);
211
+ --sp-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.06);
212
+ --sp-shadow-md: 0 2px 6px -1px rgba(0, 0, 0, 0.08);
213
+ --sp-shadow-lg: 0 6px 16px -4px rgba(0, 0, 0, 0.12);
214
214
  --sp-breakpoint-sm: 640px;
215
215
  --sp-breakpoint-md: 768px;
216
216
  --sp-breakpoint-lg: 1024px;
@@ -349,7 +349,7 @@
349
349
  --sp-surface-page: #141b24;
350
350
  --sp-surface-card: #222b38;
351
351
  --sp-surface-input: #374253;
352
- --sp-surface-overlay: #222b38;
352
+ --sp-surface-overlay: rgba(0, 0, 0, 0.6);
353
353
  --sp-surface-alternate: #222b38;
354
354
  --sp-surface-hero: linear-gradient(135deg, #5d28b8 0%, #401f75 100%);
355
355
  --sp-text-on-page-default: #f7f8fb;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var coreTokens = {
3
3
  "component": {
4
4
  "card": {
5
5
  "text": "{colors.neutral.900}",
6
- "textMuted": "{colors.neutral.500}"
6
+ "textMuted": "{colors.neutral.600}"
7
7
  },
8
8
  "input": {
9
9
  "text": "{colors.neutral.900}",
@@ -44,8 +44,8 @@ var coreTokens = {
44
44
  "border": "{colors.neutral.200}",
45
45
  "text": "{colors.neutral.700}",
46
46
  "authorName": "{colors.neutral.900}",
47
- "authorTitle": "{colors.neutral.500}",
48
- "quoteMark": "{colors.neutral.500}"
47
+ "authorTitle": "{colors.neutral.600}",
48
+ "quoteMark": "{colors.neutral.600}"
49
49
  },
50
50
  "pricingCard": {
51
51
  "bg": "{colors.white}",
@@ -56,7 +56,7 @@ var coreTokens = {
56
56
  "featuredBadgeBg": "{colors.warning.500}",
57
57
  "featuredBadgeText": "{colors.neutral.900}",
58
58
  "price": "{colors.neutral.900}",
59
- "priceDescription": "{colors.neutral.500}"
59
+ "priceDescription": "{colors.neutral.600}"
60
60
  },
61
61
  "rating": {
62
62
  "starFilled": "{colors.warning.500}",
@@ -237,8 +237,8 @@ var coreTokens = {
237
237
  "border": "{colors.neutral.200}",
238
238
  "text": "{colors.neutral.700}",
239
239
  "authorName": "{colors.neutral.900}",
240
- "authorTitle": "{colors.neutral.500}",
241
- "quoteMark": "{colors.neutral.500}"
240
+ "authorTitle": "{colors.neutral.600}",
241
+ "quoteMark": "{colors.neutral.600}"
242
242
  },
243
243
  "pricingCard": {
244
244
  "bg": "{colors.white}",
@@ -249,7 +249,7 @@ var coreTokens = {
249
249
  "featuredBadgeBg": "{colors.warning.500}",
250
250
  "featuredBadgeText": "{colors.neutral.900}",
251
251
  "price": "{colors.neutral.900}",
252
- "priceDescription": "{colors.neutral.500}"
252
+ "priceDescription": "{colors.neutral.600}"
253
253
  },
254
254
  "rating": {
255
255
  "starFilled": "{colors.warning.500}",
@@ -263,7 +263,7 @@ var coreTokens = {
263
263
  "page": "{colors.neutral.900}",
264
264
  "card": "{colors.neutral.800}",
265
265
  "input": "{colors.neutral.700}",
266
- "overlay": "{colors.neutral.800}",
266
+ "overlay": "{colors.black} / 0.6",
267
267
  "alternate": "{colors.neutral.800}",
268
268
  "hero": "linear-gradient(135deg, {colors.accent.700} 0%, {colors.accent.900} 100%)"
269
269
  },
@@ -327,8 +327,8 @@ var coreTokens = {
327
327
  "border": "{colors.neutral.700}",
328
328
  "text": "{colors.neutral.200}",
329
329
  "authorName": "{colors.neutral.100}",
330
- "authorTitle": "{colors.neutral.400}",
331
- "quoteMark": "{colors.neutral.400}"
330
+ "authorTitle": "{colors.neutral.300}",
331
+ "quoteMark": "{colors.neutral.300}"
332
332
  },
333
333
  "pricingCard": {
334
334
  "bg": "{colors.neutral.800}",
@@ -339,7 +339,7 @@ var coreTokens = {
339
339
  "featuredBadgeBg": "{colors.warning.500}",
340
340
  "featuredBadgeText": "{colors.neutral.900}",
341
341
  "price": "{colors.neutral.100}",
342
- "priceDescription": "{colors.neutral.400}"
342
+ "priceDescription": "{colors.neutral.300}"
343
343
  },
344
344
  "rating": {
345
345
  "starFilled": "{colors.warning.400}",
@@ -474,9 +474,9 @@ var coreTokens = {
474
474
  },
475
475
  "shadows": {
476
476
  "none": "none",
477
- "sm": "0 1px 2px 0 {colors.neutral.800} / 0.06",
478
- "md": "0 2px 6px -1px {colors.neutral.800} / 0.08",
479
- "lg": "0 6px 16px -4px {colors.neutral.800} / 0.12"
477
+ "sm": "0 1px 2px 0 {colors.black} / 0.06",
478
+ "md": "0 2px 6px -1px {colors.black} / 0.08",
479
+ "lg": "0 6px 16px -4px {colors.black} / 0.12"
480
480
  },
481
481
  "breakpoints": {
482
482
  "sm": "640px",
@@ -995,254 +995,56 @@ var generateCssVariables = (tokens2, options = {}) => {
995
995
  const surfaceAliases = tokens2.surface ?? {};
996
996
  const textAliases = tokens2.text ?? {};
997
997
  const componentAliases = tokens2.component ?? {};
998
+ const semanticEntries = [
999
+ { varParts: ["surface", "page"], modePath: ["surface", "page"], aliasSrc: surfaceAliases, aliasPath: ["page"] },
1000
+ { varParts: ["surface", "card"], modePath: ["surface", "card"], aliasSrc: surfaceAliases, aliasPath: ["card"] },
1001
+ { varParts: ["surface", "input"], modePath: ["surface", "input"], aliasSrc: surfaceAliases, aliasPath: ["input"] },
1002
+ { varParts: ["surface", "overlay"], modePath: ["surface", "overlay"], aliasSrc: surfaceAliases, aliasPath: ["overlay"] },
1003
+ { varParts: ["surface", "alternate"], modePath: ["surface", "alternate"] },
1004
+ { varParts: ["surface", "hero"], modePath: ["surface", "hero"], aliasSrc: surfaceAliases, aliasPath: ["hero"] },
1005
+ { varParts: ["text", "on", "page", "default"], modePath: ["text", "onPage", "default"], aliasSrc: textAliases, aliasPath: ["onPage", "default"] },
1006
+ { varParts: ["text", "on", "page", "muted"], modePath: ["text", "onPage", "muted"], aliasSrc: textAliases, aliasPath: ["onPage", "muted"] },
1007
+ { varParts: ["text", "on", "page", "subtle"], modePath: ["text", "onPage", "subtle"], aliasSrc: textAliases, aliasPath: ["onPage", "subtle"] },
1008
+ { varParts: ["text", "on", "page", "meta"], modePath: ["text", "onPage", "meta"], aliasSrc: textAliases, aliasPath: ["onPage", "meta"] },
1009
+ { varParts: ["text", "on", "page", "brand"], modePath: ["text", "onPage", "brand"], aliasSrc: textAliases, aliasPath: ["onPage", "brand"] },
1010
+ { varParts: ["text", "on", "surface", "default"], modePath: ["text", "onSurface", "default"], aliasSrc: textAliases, aliasPath: ["onSurface", "default"] },
1011
+ { varParts: ["text", "on", "surface", "muted"], modePath: ["text", "onSurface", "muted"], aliasSrc: textAliases, aliasPath: ["onSurface", "muted"] },
1012
+ { varParts: ["text", "on", "surface", "subtle"], modePath: ["text", "onSurface", "subtle"], aliasSrc: textAliases, aliasPath: ["onSurface", "subtle"] },
1013
+ { varParts: ["text", "on", "surface", "meta"], modePath: ["text", "onSurface", "meta"], aliasSrc: textAliases, aliasPath: ["onSurface", "meta"] },
1014
+ { varParts: ["text", "on", "surface", "brand"], modePath: ["text", "onSurface", "brand"], aliasSrc: textAliases, aliasPath: ["onSurface", "brand"] },
1015
+ { varParts: ["component", "card", "text"], modePath: ["component", "card", "text"], aliasSrc: componentAliases, aliasPath: ["card", "text"] },
1016
+ { varParts: ["component", "card", "text-muted"], modePath: ["component", "card", "textMuted"], aliasSrc: componentAliases, aliasPath: ["card", "textMuted"] },
1017
+ { varParts: ["component", "input", "text"], modePath: ["component", "input", "text"], aliasSrc: componentAliases, aliasPath: ["input", "text"] },
1018
+ { varParts: ["component", "input", "placeholder"], modePath: ["component", "input", "placeholder"], aliasSrc: componentAliases, aliasPath: ["input", "placeholder"] },
1019
+ { varParts: ["button", "text", "default"], modePath: ["component", "button", "textDefault"], aliasSrc: componentAliases, aliasPath: ["button", "textDefault"] },
1020
+ { varParts: ["button", "text", "on", "primary"], modePath: ["component", "button", "textOnPrimary"], aliasSrc: componentAliases, aliasPath: ["button", "textOnPrimary"] },
1021
+ ...BADGE_VARIANTS.flatMap(({ variant, bgKey, textKey }) => [
1022
+ { varParts: ["badge", variant, "bg"], modePath: ["component", "badge", bgKey], aliasSrc: componentAliases, aliasPath: ["badge", bgKey] },
1023
+ { varParts: ["badge", variant, "text"], modePath: ["component", "badge", textKey], aliasSrc: componentAliases, aliasPath: ["badge", textKey] }
1024
+ ]),
1025
+ ...ICON_BOX_FIELDS.map(({ name, tokenKey }) => ({
1026
+ varParts: ["icon-box", name],
1027
+ modePath: ["component", "iconBox", tokenKey],
1028
+ aliasSrc: componentAliases,
1029
+ aliasPath: ["iconBox", tokenKey]
1030
+ }))
1031
+ ];
998
1032
  const baseLines = [];
1033
+ const darkLines = [];
999
1034
  const addBase = (name, value) => {
1000
1035
  if (value !== void 0) baseLines.push(` ${name}: ${value};`);
1001
1036
  };
1002
- addBase(toVariableName(prefix, "surface", "page"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "page"]), getPath(surfaceAliases, ["page"])));
1003
- addBase(toVariableName(prefix, "surface", "card"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "card"]), getPath(surfaceAliases, ["card"])));
1004
- addBase(toVariableName(prefix, "surface", "input"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "input"]), getPath(surfaceAliases, ["input"])));
1005
- addBase(toVariableName(prefix, "surface", "overlay"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"])));
1006
- addBase(toVariableName(prefix, "surface", "alternate"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "alternate"])));
1007
- addBase(toVariableName(prefix, "surface", "hero"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "hero"]), getPath(surfaceAliases, ["hero"])));
1008
- addBase(toVariableName(prefix, "text", "on", "page", "default"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "default"]), getPath(textAliases, ["onPage", "default"])));
1009
- addBase(toVariableName(prefix, "text", "on", "page", "muted"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "muted"]), getPath(textAliases, ["onPage", "muted"])));
1010
- addBase(toVariableName(prefix, "text", "on", "page", "subtle"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "subtle"]), getPath(textAliases, ["onPage", "subtle"])));
1011
- addBase(toVariableName(prefix, "text", "on", "page", "meta"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "meta"]), getPath(textAliases, ["onPage", "meta"])));
1012
- addBase(toVariableName(prefix, "text", "on", "page", "brand"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "brand"]), getPath(textAliases, ["onPage", "brand"])));
1013
- addBase(toVariableName(prefix, "text", "on", "surface", "default"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "default"]), getPath(textAliases, ["onSurface", "default"])));
1014
- addBase(toVariableName(prefix, "text", "on", "surface", "muted"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "muted"]), getPath(textAliases, ["onSurface", "muted"])));
1015
- addBase(toVariableName(prefix, "text", "on", "surface", "subtle"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "subtle"]), getPath(textAliases, ["onSurface", "subtle"])));
1016
- addBase(toVariableName(prefix, "text", "on", "surface", "meta"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "meta"]), getPath(textAliases, ["onSurface", "meta"])));
1017
- addBase(toVariableName(prefix, "text", "on", "surface", "brand"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "brand"]), getPath(textAliases, ["onSurface", "brand"])));
1018
- addBase(toVariableName(prefix, "component", "card", "text"), pickSemantic(tokens2, getPath(defaultMode, ["component", "card", "text"]), getPath(componentAliases, ["card", "text"])));
1019
- addBase(toVariableName(prefix, "component", "card", "text-muted"), pickSemantic(tokens2, getPath(defaultMode, ["component", "card", "textMuted"]), getPath(componentAliases, ["card", "textMuted"])));
1020
- addBase(toVariableName(prefix, "component", "input", "text"), pickSemantic(tokens2, getPath(defaultMode, ["component", "input", "text"]), getPath(componentAliases, ["input", "text"])));
1021
- addBase(toVariableName(prefix, "component", "input", "placeholder"), pickSemantic(tokens2, getPath(defaultMode, ["component", "input", "placeholder"]), getPath(componentAliases, ["input", "placeholder"])));
1022
- addBase(toVariableName(prefix, "button", "text", "default"), pickSemantic(tokens2, getPath(defaultMode, ["component", "button", "textDefault"]), getPath(componentAliases, ["button", "textDefault"])));
1023
- addBase(toVariableName(prefix, "button", "text", "on", "primary"), pickSemantic(tokens2, getPath(defaultMode, ["component", "button", "textOnPrimary"]), getPath(componentAliases, ["button", "textOnPrimary"])));
1024
- BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
1025
- addBase(
1026
- toVariableName(prefix, "badge", variant, "bg"),
1027
- pickSemantic(tokens2, getPath(defaultMode, ["component", "badge", bgKey]), getPath(componentAliases, ["badge", bgKey]))
1028
- );
1029
- addBase(
1030
- toVariableName(prefix, "badge", variant, "text"),
1031
- pickSemantic(tokens2, getPath(defaultMode, ["component", "badge", textKey]), getPath(componentAliases, ["badge", textKey]))
1032
- );
1033
- });
1034
- ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
1035
- addBase(
1036
- toVariableName(prefix, "icon-box", name),
1037
- pickSemantic(tokens2, getPath(defaultMode, ["component", "iconBox", tokenKey]), getPath(componentAliases, ["iconBox", tokenKey]))
1038
- );
1039
- });
1040
- const rootLines = [...baseLines, ...mapLines];
1041
- const darkLines = [];
1042
1037
  const addDark = (name, value) => {
1043
1038
  if (value !== void 0) darkLines.push(` ${name}: ${value};`);
1044
1039
  };
1045
- addDark(
1046
- toVariableName(prefix, "surface", "page"),
1047
- pickSemantic(tokens2, getPath(darkMode, ["surface", "page"]), getPath(defaultMode, ["surface", "page"]), getPath(surfaceAliases, ["page"]))
1048
- );
1049
- addDark(
1050
- toVariableName(prefix, "surface", "card"),
1051
- pickSemantic(tokens2, getPath(darkMode, ["surface", "card"]), getPath(defaultMode, ["surface", "card"]), getPath(surfaceAliases, ["card"]))
1052
- );
1053
- addDark(
1054
- toVariableName(prefix, "surface", "input"),
1055
- pickSemantic(tokens2, getPath(darkMode, ["surface", "input"]), getPath(defaultMode, ["surface", "input"]), getPath(surfaceAliases, ["input"]))
1056
- );
1057
- addDark(
1058
- toVariableName(prefix, "surface", "overlay"),
1059
- pickSemantic(tokens2, getPath(darkMode, ["surface", "overlay"]), getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"]))
1060
- );
1061
- addDark(
1062
- toVariableName(prefix, "surface", "alternate"),
1063
- pickSemantic(tokens2, getPath(darkMode, ["surface", "alternate"]), getPath(defaultMode, ["surface", "alternate"]))
1064
- );
1065
- addDark(
1066
- toVariableName(prefix, "surface", "hero"),
1067
- pickSemantic(tokens2, getPath(darkMode, ["surface", "hero"]), getPath(defaultMode, ["surface", "hero"]), getPath(surfaceAliases, ["hero"]))
1068
- );
1069
- addDark(
1070
- toVariableName(prefix, "text", "on", "page", "default"),
1071
- pickSemantic(
1072
- tokens2,
1073
- getPath(darkMode, ["text", "onPage", "default"]),
1074
- getPath(defaultMode, ["text", "onPage", "default"]),
1075
- getPath(textAliases, ["onPage", "default"])
1076
- )
1077
- );
1078
- addDark(
1079
- toVariableName(prefix, "text", "on", "page", "muted"),
1080
- pickSemantic(
1081
- tokens2,
1082
- getPath(darkMode, ["text", "onPage", "muted"]),
1083
- getPath(defaultMode, ["text", "onPage", "muted"]),
1084
- getPath(textAliases, ["onPage", "muted"])
1085
- )
1086
- );
1087
- addDark(
1088
- toVariableName(prefix, "text", "on", "page", "subtle"),
1089
- pickSemantic(
1090
- tokens2,
1091
- getPath(darkMode, ["text", "onPage", "subtle"]),
1092
- getPath(defaultMode, ["text", "onPage", "subtle"]),
1093
- getPath(textAliases, ["onPage", "subtle"])
1094
- )
1095
- );
1096
- addDark(
1097
- toVariableName(prefix, "text", "on", "page", "meta"),
1098
- pickSemantic(
1099
- tokens2,
1100
- getPath(darkMode, ["text", "onPage", "meta"]),
1101
- getPath(defaultMode, ["text", "onPage", "meta"]),
1102
- getPath(textAliases, ["onPage", "meta"])
1103
- )
1104
- );
1105
- addDark(
1106
- toVariableName(prefix, "text", "on", "page", "brand"),
1107
- pickSemantic(
1108
- tokens2,
1109
- getPath(darkMode, ["text", "onPage", "brand"]),
1110
- getPath(defaultMode, ["text", "onPage", "brand"]),
1111
- getPath(textAliases, ["onPage", "brand"])
1112
- )
1113
- );
1114
- addDark(
1115
- toVariableName(prefix, "text", "on", "surface", "default"),
1116
- pickSemantic(
1117
- tokens2,
1118
- getPath(darkMode, ["text", "onSurface", "default"]),
1119
- getPath(defaultMode, ["text", "onSurface", "default"]),
1120
- getPath(textAliases, ["onSurface", "default"])
1121
- )
1122
- );
1123
- addDark(
1124
- toVariableName(prefix, "text", "on", "surface", "muted"),
1125
- pickSemantic(
1126
- tokens2,
1127
- getPath(darkMode, ["text", "onSurface", "muted"]),
1128
- getPath(defaultMode, ["text", "onSurface", "muted"]),
1129
- getPath(textAliases, ["onSurface", "muted"])
1130
- )
1131
- );
1132
- addDark(
1133
- toVariableName(prefix, "text", "on", "surface", "subtle"),
1134
- pickSemantic(
1135
- tokens2,
1136
- getPath(darkMode, ["text", "onSurface", "subtle"]),
1137
- getPath(defaultMode, ["text", "onSurface", "subtle"]),
1138
- getPath(textAliases, ["onSurface", "subtle"])
1139
- )
1140
- );
1141
- addDark(
1142
- toVariableName(prefix, "text", "on", "surface", "meta"),
1143
- pickSemantic(
1144
- tokens2,
1145
- getPath(darkMode, ["text", "onSurface", "meta"]),
1146
- getPath(defaultMode, ["text", "onSurface", "meta"]),
1147
- getPath(textAliases, ["onSurface", "meta"])
1148
- )
1149
- );
1150
- addDark(
1151
- toVariableName(prefix, "text", "on", "surface", "brand"),
1152
- pickSemantic(
1153
- tokens2,
1154
- getPath(darkMode, ["text", "onSurface", "brand"]),
1155
- getPath(defaultMode, ["text", "onSurface", "brand"]),
1156
- getPath(textAliases, ["onSurface", "brand"])
1157
- )
1158
- );
1159
- addDark(
1160
- toVariableName(prefix, "component", "card", "text"),
1161
- pickSemantic(
1162
- tokens2,
1163
- getPath(darkMode, ["component", "card", "text"]),
1164
- getPath(defaultMode, ["component", "card", "text"]),
1165
- getPath(componentAliases, ["card", "text"])
1166
- )
1167
- );
1168
- addDark(
1169
- toVariableName(prefix, "component", "card", "text-muted"),
1170
- pickSemantic(
1171
- tokens2,
1172
- getPath(darkMode, ["component", "card", "textMuted"]),
1173
- getPath(defaultMode, ["component", "card", "textMuted"]),
1174
- getPath(componentAliases, ["card", "textMuted"])
1175
- )
1176
- );
1177
- addDark(
1178
- toVariableName(prefix, "component", "input", "text"),
1179
- pickSemantic(
1180
- tokens2,
1181
- getPath(darkMode, ["component", "input", "text"]),
1182
- getPath(defaultMode, ["component", "input", "text"]),
1183
- getPath(componentAliases, ["input", "text"])
1184
- )
1185
- );
1186
- addDark(
1187
- toVariableName(prefix, "component", "input", "placeholder"),
1188
- pickSemantic(
1189
- tokens2,
1190
- getPath(darkMode, ["component", "input", "placeholder"]),
1191
- getPath(defaultMode, ["component", "input", "placeholder"]),
1192
- getPath(componentAliases, ["input", "placeholder"])
1193
- )
1194
- );
1195
- addDark(
1196
- toVariableName(prefix, "button", "text", "default"),
1197
- pickSemantic(
1198
- tokens2,
1199
- getPath(darkMode, ["component", "button", "textDefault"]),
1200
- getPath(defaultMode, ["component", "button", "textDefault"]),
1201
- getPath(componentAliases, ["button", "textDefault"])
1202
- )
1203
- );
1204
- addDark(
1205
- toVariableName(prefix, "button", "text", "on", "primary"),
1206
- pickSemantic(
1207
- tokens2,
1208
- getPath(darkMode, ["component", "button", "textOnPrimary"]),
1209
- getPath(defaultMode, ["component", "button", "textOnPrimary"]),
1210
- getPath(componentAliases, ["button", "textOnPrimary"])
1211
- )
1212
- );
1213
- BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
1214
- addDark(
1215
- toVariableName(prefix, "badge", variant, "bg"),
1216
- pickSemantic(
1217
- tokens2,
1218
- getPath(darkMode, ["component", "badge", bgKey]),
1219
- getPath(defaultMode, ["component", "badge", bgKey]),
1220
- getPath(componentAliases, ["badge", bgKey])
1221
- )
1222
- );
1223
- addDark(
1224
- toVariableName(prefix, "badge", variant, "text"),
1225
- pickSemantic(
1226
- tokens2,
1227
- getPath(darkMode, ["component", "badge", textKey]),
1228
- getPath(defaultMode, ["component", "badge", textKey]),
1229
- getPath(componentAliases, ["badge", textKey])
1230
- )
1231
- );
1232
- });
1233
- ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
1234
- addDark(
1235
- toVariableName(prefix, "icon-box", name),
1236
- pickSemantic(
1237
- tokens2,
1238
- getPath(darkMode, ["component", "iconBox", tokenKey]),
1239
- getPath(defaultMode, ["component", "iconBox", tokenKey]),
1240
- getPath(componentAliases, ["iconBox", tokenKey])
1241
- )
1242
- );
1040
+ semanticEntries.forEach(({ varParts, modePath, aliasSrc, aliasPath }) => {
1041
+ const varName = toVariableName(prefix, ...varParts);
1042
+ const aliasCandidate = aliasSrc && aliasPath ? [getPath(aliasSrc, aliasPath)] : [];
1043
+ addBase(varName, pickSemantic(tokens2, getPath(defaultMode, modePath), ...aliasCandidate));
1044
+ addDark(varName, pickSemantic(tokens2, getPath(darkMode, modePath), getPath(defaultMode, modePath), ...aliasCandidate));
1243
1045
  });
1244
1046
  const rootBlock = `${selector} {
1245
- ${rootLines.join("\n")}
1047
+ ${[...baseLines, ...mapLines].join("\n")}
1246
1048
  }`;
1247
1049
  const darkBlock = `${selector}[data-spectre-theme="dark"] {
1248
1050
  ${darkLines.join("\n")}