@phcdevworks/spectre-tokens 2.3.0 → 2.5.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 CHANGED
@@ -13,6 +13,7 @@ token data while downstream UI packages define structure and adapter packages
13
13
  translate those contracts for specific frameworks and runtimes.
14
14
 
15
15
  [Contributing](CONTRIBUTING.md) | [Changelog](CHANGELOG.md) |
16
+ [Token Contract](TOKEN_CONTRACT.md) | [Roadmap](ROADMAP.md) |
16
17
  [Security Policy](SECURITY.md)
17
18
 
18
19
  ## Key capabilities
package/dist/index.cjs CHANGED
@@ -33,7 +33,7 @@ var coreTokens = {
33
33
  "component": {
34
34
  "card": {
35
35
  "text": "{colors.neutral.900}",
36
- "textMuted": "{colors.neutral.500}"
36
+ "textMuted": "{colors.neutral.600}"
37
37
  },
38
38
  "input": {
39
39
  "text": "{colors.neutral.900}",
@@ -74,8 +74,8 @@ var coreTokens = {
74
74
  "border": "{colors.neutral.200}",
75
75
  "text": "{colors.neutral.700}",
76
76
  "authorName": "{colors.neutral.900}",
77
- "authorTitle": "{colors.neutral.500}",
78
- "quoteMark": "{colors.neutral.500}"
77
+ "authorTitle": "{colors.neutral.600}",
78
+ "quoteMark": "{colors.neutral.600}"
79
79
  },
80
80
  "pricingCard": {
81
81
  "bg": "{colors.white}",
@@ -86,7 +86,7 @@ var coreTokens = {
86
86
  "featuredBadgeBg": "{colors.warning.500}",
87
87
  "featuredBadgeText": "{colors.neutral.900}",
88
88
  "price": "{colors.neutral.900}",
89
- "priceDescription": "{colors.neutral.500}"
89
+ "priceDescription": "{colors.neutral.600}"
90
90
  },
91
91
  "rating": {
92
92
  "starFilled": "{colors.warning.500}",
@@ -156,9 +156,9 @@ var coreTokens = {
156
156
  "focusRing": "{colors.brand.500} / 0.4"
157
157
  },
158
158
  "accent": {
159
- "bg": "{colors.accent.600}",
160
- "bgHover": "{colors.accent.700}",
161
- "bgActive": "{colors.accent.800}",
159
+ "bg": "{colors.accent.700}",
160
+ "bgHover": "{colors.accent.800}",
161
+ "bgActive": "{colors.accent.900}",
162
162
  "bgDisabled": "{colors.accent.200}",
163
163
  "text": "{colors.white}",
164
164
  "textDisabled": "{colors.neutral.400}",
@@ -267,8 +267,8 @@ var coreTokens = {
267
267
  "border": "{colors.neutral.200}",
268
268
  "text": "{colors.neutral.700}",
269
269
  "authorName": "{colors.neutral.900}",
270
- "authorTitle": "{colors.neutral.500}",
271
- "quoteMark": "{colors.neutral.500}"
270
+ "authorTitle": "{colors.neutral.600}",
271
+ "quoteMark": "{colors.neutral.600}"
272
272
  },
273
273
  "pricingCard": {
274
274
  "bg": "{colors.white}",
@@ -279,7 +279,7 @@ var coreTokens = {
279
279
  "featuredBadgeBg": "{colors.warning.500}",
280
280
  "featuredBadgeText": "{colors.neutral.900}",
281
281
  "price": "{colors.neutral.900}",
282
- "priceDescription": "{colors.neutral.500}"
282
+ "priceDescription": "{colors.neutral.600}"
283
283
  },
284
284
  "rating": {
285
285
  "starFilled": "{colors.warning.500}",
@@ -293,7 +293,7 @@ var coreTokens = {
293
293
  "page": "{colors.neutral.900}",
294
294
  "card": "{colors.neutral.800}",
295
295
  "input": "{colors.neutral.700}",
296
- "overlay": "{colors.neutral.800}",
296
+ "overlay": "{colors.black} / 0.6",
297
297
  "alternate": "{colors.neutral.800}",
298
298
  "hero": "linear-gradient(135deg, {colors.accent.700} 0%, {colors.accent.900} 100%)"
299
299
  },
@@ -357,8 +357,8 @@ var coreTokens = {
357
357
  "border": "{colors.neutral.700}",
358
358
  "text": "{colors.neutral.200}",
359
359
  "authorName": "{colors.neutral.100}",
360
- "authorTitle": "{colors.neutral.400}",
361
- "quoteMark": "{colors.neutral.400}"
360
+ "authorTitle": "{colors.neutral.300}",
361
+ "quoteMark": "{colors.neutral.300}"
362
362
  },
363
363
  "pricingCard": {
364
364
  "bg": "{colors.neutral.800}",
@@ -369,7 +369,7 @@ var coreTokens = {
369
369
  "featuredBadgeBg": "{colors.warning.500}",
370
370
  "featuredBadgeText": "{colors.neutral.900}",
371
371
  "price": "{colors.neutral.100}",
372
- "priceDescription": "{colors.neutral.400}"
372
+ "priceDescription": "{colors.neutral.300}"
373
373
  },
374
374
  "rating": {
375
375
  "starFilled": "{colors.warning.400}",
@@ -504,9 +504,9 @@ var coreTokens = {
504
504
  },
505
505
  "shadows": {
506
506
  "none": "none",
507
- "sm": "0 1px 2px 0 {colors.neutral.800} / 0.06",
508
- "md": "0 2px 6px -1px {colors.neutral.800} / 0.08",
509
- "lg": "0 6px 16px -4px {colors.neutral.800} / 0.12"
507
+ "sm": "0 1px 2px 0 {colors.black} / 0.06",
508
+ "md": "0 2px 6px -1px {colors.black} / 0.08",
509
+ "lg": "0 6px 16px -4px {colors.black} / 0.12"
510
510
  },
511
511
  "breakpoints": {
512
512
  "sm": "640px",
@@ -1025,254 +1025,56 @@ var generateCssVariables = (tokens2, options = {}) => {
1025
1025
  const surfaceAliases = tokens2.surface ?? {};
1026
1026
  const textAliases = tokens2.text ?? {};
1027
1027
  const componentAliases = tokens2.component ?? {};
1028
+ const semanticEntries = [
1029
+ { varParts: ["surface", "page"], modePath: ["surface", "page"], aliasSrc: surfaceAliases, aliasPath: ["page"] },
1030
+ { varParts: ["surface", "card"], modePath: ["surface", "card"], aliasSrc: surfaceAliases, aliasPath: ["card"] },
1031
+ { varParts: ["surface", "input"], modePath: ["surface", "input"], aliasSrc: surfaceAliases, aliasPath: ["input"] },
1032
+ { varParts: ["surface", "overlay"], modePath: ["surface", "overlay"], aliasSrc: surfaceAliases, aliasPath: ["overlay"] },
1033
+ { varParts: ["surface", "alternate"], modePath: ["surface", "alternate"] },
1034
+ { varParts: ["surface", "hero"], modePath: ["surface", "hero"], aliasSrc: surfaceAliases, aliasPath: ["hero"] },
1035
+ { varParts: ["text", "on", "page", "default"], modePath: ["text", "onPage", "default"], aliasSrc: textAliases, aliasPath: ["onPage", "default"] },
1036
+ { varParts: ["text", "on", "page", "muted"], modePath: ["text", "onPage", "muted"], aliasSrc: textAliases, aliasPath: ["onPage", "muted"] },
1037
+ { varParts: ["text", "on", "page", "subtle"], modePath: ["text", "onPage", "subtle"], aliasSrc: textAliases, aliasPath: ["onPage", "subtle"] },
1038
+ { varParts: ["text", "on", "page", "meta"], modePath: ["text", "onPage", "meta"], aliasSrc: textAliases, aliasPath: ["onPage", "meta"] },
1039
+ { varParts: ["text", "on", "page", "brand"], modePath: ["text", "onPage", "brand"], aliasSrc: textAliases, aliasPath: ["onPage", "brand"] },
1040
+ { varParts: ["text", "on", "surface", "default"], modePath: ["text", "onSurface", "default"], aliasSrc: textAliases, aliasPath: ["onSurface", "default"] },
1041
+ { varParts: ["text", "on", "surface", "muted"], modePath: ["text", "onSurface", "muted"], aliasSrc: textAliases, aliasPath: ["onSurface", "muted"] },
1042
+ { varParts: ["text", "on", "surface", "subtle"], modePath: ["text", "onSurface", "subtle"], aliasSrc: textAliases, aliasPath: ["onSurface", "subtle"] },
1043
+ { varParts: ["text", "on", "surface", "meta"], modePath: ["text", "onSurface", "meta"], aliasSrc: textAliases, aliasPath: ["onSurface", "meta"] },
1044
+ { varParts: ["text", "on", "surface", "brand"], modePath: ["text", "onSurface", "brand"], aliasSrc: textAliases, aliasPath: ["onSurface", "brand"] },
1045
+ { varParts: ["component", "card", "text"], modePath: ["component", "card", "text"], aliasSrc: componentAliases, aliasPath: ["card", "text"] },
1046
+ { varParts: ["component", "card", "text-muted"], modePath: ["component", "card", "textMuted"], aliasSrc: componentAliases, aliasPath: ["card", "textMuted"] },
1047
+ { varParts: ["component", "input", "text"], modePath: ["component", "input", "text"], aliasSrc: componentAliases, aliasPath: ["input", "text"] },
1048
+ { varParts: ["component", "input", "placeholder"], modePath: ["component", "input", "placeholder"], aliasSrc: componentAliases, aliasPath: ["input", "placeholder"] },
1049
+ { varParts: ["button", "text", "default"], modePath: ["component", "button", "textDefault"], aliasSrc: componentAliases, aliasPath: ["button", "textDefault"] },
1050
+ { varParts: ["button", "text", "on", "primary"], modePath: ["component", "button", "textOnPrimary"], aliasSrc: componentAliases, aliasPath: ["button", "textOnPrimary"] },
1051
+ ...BADGE_VARIANTS.flatMap(({ variant, bgKey, textKey }) => [
1052
+ { varParts: ["badge", variant, "bg"], modePath: ["component", "badge", bgKey], aliasSrc: componentAliases, aliasPath: ["badge", bgKey] },
1053
+ { varParts: ["badge", variant, "text"], modePath: ["component", "badge", textKey], aliasSrc: componentAliases, aliasPath: ["badge", textKey] }
1054
+ ]),
1055
+ ...ICON_BOX_FIELDS.map(({ name, tokenKey }) => ({
1056
+ varParts: ["icon-box", name],
1057
+ modePath: ["component", "iconBox", tokenKey],
1058
+ aliasSrc: componentAliases,
1059
+ aliasPath: ["iconBox", tokenKey]
1060
+ }))
1061
+ ];
1028
1062
  const baseLines = [];
1063
+ const darkLines = [];
1029
1064
  const addBase = (name, value) => {
1030
1065
  if (value !== void 0) baseLines.push(` ${name}: ${value};`);
1031
1066
  };
1032
- addBase(toVariableName(prefix, "surface", "page"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "page"]), getPath(surfaceAliases, ["page"])));
1033
- addBase(toVariableName(prefix, "surface", "card"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "card"]), getPath(surfaceAliases, ["card"])));
1034
- addBase(toVariableName(prefix, "surface", "input"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "input"]), getPath(surfaceAliases, ["input"])));
1035
- addBase(toVariableName(prefix, "surface", "overlay"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"])));
1036
- addBase(toVariableName(prefix, "surface", "alternate"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "alternate"])));
1037
- addBase(toVariableName(prefix, "surface", "hero"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "hero"]), getPath(surfaceAliases, ["hero"])));
1038
- addBase(toVariableName(prefix, "text", "on", "page", "default"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "default"]), getPath(textAliases, ["onPage", "default"])));
1039
- addBase(toVariableName(prefix, "text", "on", "page", "muted"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "muted"]), getPath(textAliases, ["onPage", "muted"])));
1040
- addBase(toVariableName(prefix, "text", "on", "page", "subtle"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "subtle"]), getPath(textAliases, ["onPage", "subtle"])));
1041
- addBase(toVariableName(prefix, "text", "on", "page", "meta"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "meta"]), getPath(textAliases, ["onPage", "meta"])));
1042
- addBase(toVariableName(prefix, "text", "on", "page", "brand"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "brand"]), getPath(textAliases, ["onPage", "brand"])));
1043
- addBase(toVariableName(prefix, "text", "on", "surface", "default"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "default"]), getPath(textAliases, ["onSurface", "default"])));
1044
- addBase(toVariableName(prefix, "text", "on", "surface", "muted"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "muted"]), getPath(textAliases, ["onSurface", "muted"])));
1045
- addBase(toVariableName(prefix, "text", "on", "surface", "subtle"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "subtle"]), getPath(textAliases, ["onSurface", "subtle"])));
1046
- addBase(toVariableName(prefix, "text", "on", "surface", "meta"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "meta"]), getPath(textAliases, ["onSurface", "meta"])));
1047
- addBase(toVariableName(prefix, "text", "on", "surface", "brand"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "brand"]), getPath(textAliases, ["onSurface", "brand"])));
1048
- addBase(toVariableName(prefix, "component", "card", "text"), pickSemantic(tokens2, getPath(defaultMode, ["component", "card", "text"]), getPath(componentAliases, ["card", "text"])));
1049
- addBase(toVariableName(prefix, "component", "card", "text-muted"), pickSemantic(tokens2, getPath(defaultMode, ["component", "card", "textMuted"]), getPath(componentAliases, ["card", "textMuted"])));
1050
- addBase(toVariableName(prefix, "component", "input", "text"), pickSemantic(tokens2, getPath(defaultMode, ["component", "input", "text"]), getPath(componentAliases, ["input", "text"])));
1051
- addBase(toVariableName(prefix, "component", "input", "placeholder"), pickSemantic(tokens2, getPath(defaultMode, ["component", "input", "placeholder"]), getPath(componentAliases, ["input", "placeholder"])));
1052
- addBase(toVariableName(prefix, "button", "text", "default"), pickSemantic(tokens2, getPath(defaultMode, ["component", "button", "textDefault"]), getPath(componentAliases, ["button", "textDefault"])));
1053
- addBase(toVariableName(prefix, "button", "text", "on", "primary"), pickSemantic(tokens2, getPath(defaultMode, ["component", "button", "textOnPrimary"]), getPath(componentAliases, ["button", "textOnPrimary"])));
1054
- BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
1055
- addBase(
1056
- toVariableName(prefix, "badge", variant, "bg"),
1057
- pickSemantic(tokens2, getPath(defaultMode, ["component", "badge", bgKey]), getPath(componentAliases, ["badge", bgKey]))
1058
- );
1059
- addBase(
1060
- toVariableName(prefix, "badge", variant, "text"),
1061
- pickSemantic(tokens2, getPath(defaultMode, ["component", "badge", textKey]), getPath(componentAliases, ["badge", textKey]))
1062
- );
1063
- });
1064
- ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
1065
- addBase(
1066
- toVariableName(prefix, "icon-box", name),
1067
- pickSemantic(tokens2, getPath(defaultMode, ["component", "iconBox", tokenKey]), getPath(componentAliases, ["iconBox", tokenKey]))
1068
- );
1069
- });
1070
- const rootLines = [...baseLines, ...mapLines];
1071
- const darkLines = [];
1072
1067
  const addDark = (name, value) => {
1073
1068
  if (value !== void 0) darkLines.push(` ${name}: ${value};`);
1074
1069
  };
1075
- addDark(
1076
- toVariableName(prefix, "surface", "page"),
1077
- pickSemantic(tokens2, getPath(darkMode, ["surface", "page"]), getPath(defaultMode, ["surface", "page"]), getPath(surfaceAliases, ["page"]))
1078
- );
1079
- addDark(
1080
- toVariableName(prefix, "surface", "card"),
1081
- pickSemantic(tokens2, getPath(darkMode, ["surface", "card"]), getPath(defaultMode, ["surface", "card"]), getPath(surfaceAliases, ["card"]))
1082
- );
1083
- addDark(
1084
- toVariableName(prefix, "surface", "input"),
1085
- pickSemantic(tokens2, getPath(darkMode, ["surface", "input"]), getPath(defaultMode, ["surface", "input"]), getPath(surfaceAliases, ["input"]))
1086
- );
1087
- addDark(
1088
- toVariableName(prefix, "surface", "overlay"),
1089
- pickSemantic(tokens2, getPath(darkMode, ["surface", "overlay"]), getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"]))
1090
- );
1091
- addDark(
1092
- toVariableName(prefix, "surface", "alternate"),
1093
- pickSemantic(tokens2, getPath(darkMode, ["surface", "alternate"]), getPath(defaultMode, ["surface", "alternate"]))
1094
- );
1095
- addDark(
1096
- toVariableName(prefix, "surface", "hero"),
1097
- pickSemantic(tokens2, getPath(darkMode, ["surface", "hero"]), getPath(defaultMode, ["surface", "hero"]), getPath(surfaceAliases, ["hero"]))
1098
- );
1099
- addDark(
1100
- toVariableName(prefix, "text", "on", "page", "default"),
1101
- pickSemantic(
1102
- tokens2,
1103
- getPath(darkMode, ["text", "onPage", "default"]),
1104
- getPath(defaultMode, ["text", "onPage", "default"]),
1105
- getPath(textAliases, ["onPage", "default"])
1106
- )
1107
- );
1108
- addDark(
1109
- toVariableName(prefix, "text", "on", "page", "muted"),
1110
- pickSemantic(
1111
- tokens2,
1112
- getPath(darkMode, ["text", "onPage", "muted"]),
1113
- getPath(defaultMode, ["text", "onPage", "muted"]),
1114
- getPath(textAliases, ["onPage", "muted"])
1115
- )
1116
- );
1117
- addDark(
1118
- toVariableName(prefix, "text", "on", "page", "subtle"),
1119
- pickSemantic(
1120
- tokens2,
1121
- getPath(darkMode, ["text", "onPage", "subtle"]),
1122
- getPath(defaultMode, ["text", "onPage", "subtle"]),
1123
- getPath(textAliases, ["onPage", "subtle"])
1124
- )
1125
- );
1126
- addDark(
1127
- toVariableName(prefix, "text", "on", "page", "meta"),
1128
- pickSemantic(
1129
- tokens2,
1130
- getPath(darkMode, ["text", "onPage", "meta"]),
1131
- getPath(defaultMode, ["text", "onPage", "meta"]),
1132
- getPath(textAliases, ["onPage", "meta"])
1133
- )
1134
- );
1135
- addDark(
1136
- toVariableName(prefix, "text", "on", "page", "brand"),
1137
- pickSemantic(
1138
- tokens2,
1139
- getPath(darkMode, ["text", "onPage", "brand"]),
1140
- getPath(defaultMode, ["text", "onPage", "brand"]),
1141
- getPath(textAliases, ["onPage", "brand"])
1142
- )
1143
- );
1144
- addDark(
1145
- toVariableName(prefix, "text", "on", "surface", "default"),
1146
- pickSemantic(
1147
- tokens2,
1148
- getPath(darkMode, ["text", "onSurface", "default"]),
1149
- getPath(defaultMode, ["text", "onSurface", "default"]),
1150
- getPath(textAliases, ["onSurface", "default"])
1151
- )
1152
- );
1153
- addDark(
1154
- toVariableName(prefix, "text", "on", "surface", "muted"),
1155
- pickSemantic(
1156
- tokens2,
1157
- getPath(darkMode, ["text", "onSurface", "muted"]),
1158
- getPath(defaultMode, ["text", "onSurface", "muted"]),
1159
- getPath(textAliases, ["onSurface", "muted"])
1160
- )
1161
- );
1162
- addDark(
1163
- toVariableName(prefix, "text", "on", "surface", "subtle"),
1164
- pickSemantic(
1165
- tokens2,
1166
- getPath(darkMode, ["text", "onSurface", "subtle"]),
1167
- getPath(defaultMode, ["text", "onSurface", "subtle"]),
1168
- getPath(textAliases, ["onSurface", "subtle"])
1169
- )
1170
- );
1171
- addDark(
1172
- toVariableName(prefix, "text", "on", "surface", "meta"),
1173
- pickSemantic(
1174
- tokens2,
1175
- getPath(darkMode, ["text", "onSurface", "meta"]),
1176
- getPath(defaultMode, ["text", "onSurface", "meta"]),
1177
- getPath(textAliases, ["onSurface", "meta"])
1178
- )
1179
- );
1180
- addDark(
1181
- toVariableName(prefix, "text", "on", "surface", "brand"),
1182
- pickSemantic(
1183
- tokens2,
1184
- getPath(darkMode, ["text", "onSurface", "brand"]),
1185
- getPath(defaultMode, ["text", "onSurface", "brand"]),
1186
- getPath(textAliases, ["onSurface", "brand"])
1187
- )
1188
- );
1189
- addDark(
1190
- toVariableName(prefix, "component", "card", "text"),
1191
- pickSemantic(
1192
- tokens2,
1193
- getPath(darkMode, ["component", "card", "text"]),
1194
- getPath(defaultMode, ["component", "card", "text"]),
1195
- getPath(componentAliases, ["card", "text"])
1196
- )
1197
- );
1198
- addDark(
1199
- toVariableName(prefix, "component", "card", "text-muted"),
1200
- pickSemantic(
1201
- tokens2,
1202
- getPath(darkMode, ["component", "card", "textMuted"]),
1203
- getPath(defaultMode, ["component", "card", "textMuted"]),
1204
- getPath(componentAliases, ["card", "textMuted"])
1205
- )
1206
- );
1207
- addDark(
1208
- toVariableName(prefix, "component", "input", "text"),
1209
- pickSemantic(
1210
- tokens2,
1211
- getPath(darkMode, ["component", "input", "text"]),
1212
- getPath(defaultMode, ["component", "input", "text"]),
1213
- getPath(componentAliases, ["input", "text"])
1214
- )
1215
- );
1216
- addDark(
1217
- toVariableName(prefix, "component", "input", "placeholder"),
1218
- pickSemantic(
1219
- tokens2,
1220
- getPath(darkMode, ["component", "input", "placeholder"]),
1221
- getPath(defaultMode, ["component", "input", "placeholder"]),
1222
- getPath(componentAliases, ["input", "placeholder"])
1223
- )
1224
- );
1225
- addDark(
1226
- toVariableName(prefix, "button", "text", "default"),
1227
- pickSemantic(
1228
- tokens2,
1229
- getPath(darkMode, ["component", "button", "textDefault"]),
1230
- getPath(defaultMode, ["component", "button", "textDefault"]),
1231
- getPath(componentAliases, ["button", "textDefault"])
1232
- )
1233
- );
1234
- addDark(
1235
- toVariableName(prefix, "button", "text", "on", "primary"),
1236
- pickSemantic(
1237
- tokens2,
1238
- getPath(darkMode, ["component", "button", "textOnPrimary"]),
1239
- getPath(defaultMode, ["component", "button", "textOnPrimary"]),
1240
- getPath(componentAliases, ["button", "textOnPrimary"])
1241
- )
1242
- );
1243
- BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
1244
- addDark(
1245
- toVariableName(prefix, "badge", variant, "bg"),
1246
- pickSemantic(
1247
- tokens2,
1248
- getPath(darkMode, ["component", "badge", bgKey]),
1249
- getPath(defaultMode, ["component", "badge", bgKey]),
1250
- getPath(componentAliases, ["badge", bgKey])
1251
- )
1252
- );
1253
- addDark(
1254
- toVariableName(prefix, "badge", variant, "text"),
1255
- pickSemantic(
1256
- tokens2,
1257
- getPath(darkMode, ["component", "badge", textKey]),
1258
- getPath(defaultMode, ["component", "badge", textKey]),
1259
- getPath(componentAliases, ["badge", textKey])
1260
- )
1261
- );
1262
- });
1263
- ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
1264
- addDark(
1265
- toVariableName(prefix, "icon-box", name),
1266
- pickSemantic(
1267
- tokens2,
1268
- getPath(darkMode, ["component", "iconBox", tokenKey]),
1269
- getPath(defaultMode, ["component", "iconBox", tokenKey]),
1270
- getPath(componentAliases, ["iconBox", tokenKey])
1271
- )
1272
- );
1070
+ semanticEntries.forEach(({ varParts, modePath, aliasSrc, aliasPath }) => {
1071
+ const varName = toVariableName(prefix, ...varParts);
1072
+ const aliasCandidate = aliasSrc && aliasPath ? [getPath(aliasSrc, aliasPath)] : [];
1073
+ addBase(varName, pickSemantic(tokens2, getPath(defaultMode, modePath), ...aliasCandidate));
1074
+ addDark(varName, pickSemantic(tokens2, getPath(darkMode, modePath), getPath(defaultMode, modePath), ...aliasCandidate));
1273
1075
  });
1274
1076
  const rootBlock = `${selector} {
1275
- ${rootLines.join("\n")}
1077
+ ${[...baseLines, ...mapLines].join("\n")}
1276
1078
  }`;
1277
1079
  const darkBlock = `${selector}[data-spectre-theme="dark"] {
1278
1080
  ${darkLines.join("\n")}