@phcdevworks/spectre-tokens 2.2.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.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.300}"
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}",
@@ -103,7 +103,7 @@ var coreTokens = {
103
103
  "text": "{colors.white}",
104
104
  "textDisabled": "{colors.neutral.400}",
105
105
  "focusRing": "{colors.info.500} / 0.4",
106
- "focusVisible": "{buttons.primary.focusRing}"
106
+ "focusVisible": "{colors.info.500} / 0.4"
107
107
  },
108
108
  "secondary": {
109
109
  "bg": "{colors.white}",
@@ -115,7 +115,7 @@ var coreTokens = {
115
115
  "border": "{colors.info.700}",
116
116
  "borderDisabled": "{colors.neutral.200}",
117
117
  "focusRing": "{colors.info.500} / 0.4",
118
- "focusVisible": "{buttons.secondary.focusRing}"
118
+ "focusVisible": "{colors.info.500} / 0.4"
119
119
  },
120
120
  "ghost": {
121
121
  "bg": "transparent",
@@ -125,7 +125,7 @@ var coreTokens = {
125
125
  "text": "{colors.info.700}",
126
126
  "textDisabled": "{colors.neutral.400}",
127
127
  "focusRing": "{colors.info.500} / 0.4",
128
- "focusVisible": "{buttons.ghost.focusRing}"
128
+ "focusVisible": "{colors.info.500} / 0.4"
129
129
  },
130
130
  "danger": {
131
131
  "bg": "{colors.error.600}",
@@ -163,7 +163,7 @@ var coreTokens = {
163
163
  "text": "{colors.white}",
164
164
  "textDisabled": "{colors.neutral.400}",
165
165
  "focusRing": "{colors.accent.500} / 0.4",
166
- "focusVisible": "{buttons.accent.focusRing}"
166
+ "focusVisible": "{colors.accent.500} / 0.4"
167
167
  }
168
168
  },
169
169
  "forms": {
@@ -181,8 +181,8 @@ var coreTokens = {
181
181
  "ring": "{colors.info.500}"
182
182
  },
183
183
  "focusVisible": {
184
- "border": "{forms.focus.border}",
185
- "ring": "{forms.focus.ring}"
184
+ "border": "{colors.info.500}",
185
+ "ring": "{colors.info.500}"
186
186
  },
187
187
  "valid": {
188
188
  "border": "{colors.success.500}",
@@ -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,9 +293,9 @@ 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
- "hero": "linear-gradient(135deg, {colors.accent.900} 0%, {colors.accent.700} 100%)"
298
+ "hero": "linear-gradient(135deg, {colors.accent.700} 0%, {colors.accent.900} 100%)"
299
299
  },
300
300
  "text": {
301
301
  "onPage": {
@@ -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",
@@ -679,7 +679,8 @@ var coreTokens = {
679
679
  "xs": {
680
680
  "size": "0.75rem",
681
681
  "lineHeight": "1.25rem",
682
- "weight": 400
682
+ "weight": 400,
683
+ "letterSpacing": "0.02em"
683
684
  },
684
685
  "sm": {
685
686
  "size": "0.875rem",
@@ -863,6 +864,10 @@ var createCssVariableMap = (tokens2, options = {}) => {
863
864
  map[name] = resolveValue(tokens2, value);
864
865
  };
865
866
  Object.entries(baseTokens.colors).forEach(([group, scale]) => {
867
+ if (typeof scale === "string" || typeof scale === "number") {
868
+ assign(toVariableName(prefix, "color", group), scale);
869
+ return;
870
+ }
866
871
  Object.entries(scale).forEach(([step, value]) => {
867
872
  assign(toVariableName(prefix, "color", group, step), value);
868
873
  });
@@ -1020,229 +1025,56 @@ var generateCssVariables = (tokens2, options = {}) => {
1020
1025
  const surfaceAliases = tokens2.surface ?? {};
1021
1026
  const textAliases = tokens2.text ?? {};
1022
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
+ ];
1023
1062
  const baseLines = [];
1063
+ const darkLines = [];
1024
1064
  const addBase = (name, value) => {
1025
1065
  if (value !== void 0) baseLines.push(` ${name}: ${value};`);
1026
1066
  };
1027
- addBase(toVariableName(prefix, "surface", "page"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "page"]), getPath(surfaceAliases, ["page"])));
1028
- addBase(toVariableName(prefix, "surface", "card"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "card"]), getPath(surfaceAliases, ["card"])));
1029
- addBase(toVariableName(prefix, "surface", "input"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "input"]), getPath(surfaceAliases, ["input"])));
1030
- addBase(toVariableName(prefix, "surface", "overlay"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"])));
1031
- addBase(toVariableName(prefix, "surface", "hero"), pickSemantic(tokens2, getPath(defaultMode, ["surface", "hero"]), getPath(surfaceAliases, ["hero"])));
1032
- addBase(toVariableName(prefix, "text", "on", "page", "default"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "default"]), getPath(textAliases, ["onPage", "default"])));
1033
- addBase(toVariableName(prefix, "text", "on", "page", "muted"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "muted"]), getPath(textAliases, ["onPage", "muted"])));
1034
- addBase(toVariableName(prefix, "text", "on", "page", "subtle"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "subtle"]), getPath(textAliases, ["onPage", "subtle"])));
1035
- addBase(toVariableName(prefix, "text", "on", "page", "meta"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onPage", "meta"]), getPath(textAliases, ["onPage", "meta"])));
1036
- addBase(toVariableName(prefix, "text", "on", "surface", "default"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "default"]), getPath(textAliases, ["onSurface", "default"])));
1037
- addBase(toVariableName(prefix, "text", "on", "surface", "muted"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "muted"]), getPath(textAliases, ["onSurface", "muted"])));
1038
- addBase(toVariableName(prefix, "text", "on", "surface", "subtle"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "subtle"]), getPath(textAliases, ["onSurface", "subtle"])));
1039
- addBase(toVariableName(prefix, "text", "on", "surface", "meta"), pickSemantic(tokens2, getPath(defaultMode, ["text", "onSurface", "meta"]), getPath(textAliases, ["onSurface", "meta"])));
1040
- addBase(toVariableName(prefix, "component", "card", "text"), pickSemantic(tokens2, getPath(defaultMode, ["component", "card", "text"]), getPath(componentAliases, ["card", "text"])));
1041
- addBase(toVariableName(prefix, "component", "card", "text-muted"), pickSemantic(tokens2, getPath(defaultMode, ["component", "card", "textMuted"]), getPath(componentAliases, ["card", "textMuted"])));
1042
- addBase(toVariableName(prefix, "component", "input", "text"), pickSemantic(tokens2, getPath(defaultMode, ["component", "input", "text"]), getPath(componentAliases, ["input", "text"])));
1043
- addBase(toVariableName(prefix, "component", "input", "placeholder"), pickSemantic(tokens2, getPath(defaultMode, ["component", "input", "placeholder"]), getPath(componentAliases, ["input", "placeholder"])));
1044
- addBase(toVariableName(prefix, "button", "text", "default"), pickSemantic(tokens2, getPath(defaultMode, ["component", "button", "textDefault"]), getPath(componentAliases, ["button", "textDefault"])));
1045
- addBase(toVariableName(prefix, "button", "text", "on", "primary"), pickSemantic(tokens2, getPath(defaultMode, ["component", "button", "textOnPrimary"]), getPath(componentAliases, ["button", "textOnPrimary"])));
1046
- BADGE_VARIANTS.forEach(({ variant, bgKey, textKey }) => {
1047
- addBase(
1048
- toVariableName(prefix, "badge", variant, "bg"),
1049
- pickSemantic(tokens2, getPath(defaultMode, ["component", "badge", bgKey]), getPath(componentAliases, ["badge", bgKey]))
1050
- );
1051
- addBase(
1052
- toVariableName(prefix, "badge", variant, "text"),
1053
- pickSemantic(tokens2, getPath(defaultMode, ["component", "badge", textKey]), getPath(componentAliases, ["badge", textKey]))
1054
- );
1055
- });
1056
- ICON_BOX_FIELDS.forEach(({ name, tokenKey }) => {
1057
- addBase(
1058
- toVariableName(prefix, "icon-box", name),
1059
- pickSemantic(tokens2, getPath(defaultMode, ["component", "iconBox", tokenKey]), getPath(componentAliases, ["iconBox", tokenKey]))
1060
- );
1061
- });
1062
- const rootLines = [...baseLines, ...mapLines];
1063
- const darkLines = [];
1064
1067
  const addDark = (name, value) => {
1065
1068
  if (value !== void 0) darkLines.push(` ${name}: ${value};`);
1066
1069
  };
1067
- addDark(
1068
- toVariableName(prefix, "surface", "page"),
1069
- pickSemantic(tokens2, getPath(darkMode, ["surface", "page"]), getPath(defaultMode, ["surface", "page"]), getPath(surfaceAliases, ["page"]))
1070
- );
1071
- addDark(
1072
- toVariableName(prefix, "surface", "card"),
1073
- pickSemantic(tokens2, getPath(darkMode, ["surface", "card"]), getPath(defaultMode, ["surface", "card"]), getPath(surfaceAliases, ["card"]))
1074
- );
1075
- addDark(
1076
- toVariableName(prefix, "surface", "input"),
1077
- pickSemantic(tokens2, getPath(darkMode, ["surface", "input"]), getPath(defaultMode, ["surface", "input"]), getPath(surfaceAliases, ["input"]))
1078
- );
1079
- addDark(
1080
- toVariableName(prefix, "surface", "overlay"),
1081
- pickSemantic(tokens2, getPath(darkMode, ["surface", "overlay"]), getPath(defaultMode, ["surface", "overlay"]), getPath(surfaceAliases, ["overlay"]))
1082
- );
1083
- addDark(
1084
- toVariableName(prefix, "surface", "hero"),
1085
- pickSemantic(tokens2, getPath(darkMode, ["surface", "hero"]), getPath(defaultMode, ["surface", "hero"]), getPath(surfaceAliases, ["hero"]))
1086
- );
1087
- addDark(
1088
- toVariableName(prefix, "text", "on", "page", "default"),
1089
- pickSemantic(
1090
- tokens2,
1091
- getPath(darkMode, ["text", "onPage", "default"]),
1092
- getPath(defaultMode, ["text", "onPage", "default"]),
1093
- getPath(textAliases, ["onPage", "default"])
1094
- )
1095
- );
1096
- addDark(
1097
- toVariableName(prefix, "text", "on", "page", "muted"),
1098
- pickSemantic(
1099
- tokens2,
1100
- getPath(darkMode, ["text", "onPage", "muted"]),
1101
- getPath(defaultMode, ["text", "onPage", "muted"]),
1102
- getPath(textAliases, ["onPage", "muted"])
1103
- )
1104
- );
1105
- addDark(
1106
- toVariableName(prefix, "text", "on", "page", "subtle"),
1107
- pickSemantic(
1108
- tokens2,
1109
- getPath(darkMode, ["text", "onPage", "subtle"]),
1110
- getPath(defaultMode, ["text", "onPage", "subtle"]),
1111
- getPath(textAliases, ["onPage", "subtle"])
1112
- )
1113
- );
1114
- addDark(
1115
- toVariableName(prefix, "text", "on", "page", "meta"),
1116
- pickSemantic(
1117
- tokens2,
1118
- getPath(darkMode, ["text", "onPage", "meta"]),
1119
- getPath(defaultMode, ["text", "onPage", "meta"]),
1120
- getPath(textAliases, ["onPage", "meta"])
1121
- )
1122
- );
1123
- addDark(
1124
- toVariableName(prefix, "text", "on", "surface", "default"),
1125
- pickSemantic(
1126
- tokens2,
1127
- getPath(darkMode, ["text", "onSurface", "default"]),
1128
- getPath(defaultMode, ["text", "onSurface", "default"]),
1129
- getPath(textAliases, ["onSurface", "default"])
1130
- )
1131
- );
1132
- addDark(
1133
- toVariableName(prefix, "text", "on", "surface", "muted"),
1134
- pickSemantic(
1135
- tokens2,
1136
- getPath(darkMode, ["text", "onSurface", "muted"]),
1137
- getPath(defaultMode, ["text", "onSurface", "muted"]),
1138
- getPath(textAliases, ["onSurface", "muted"])
1139
- )
1140
- );
1141
- addDark(
1142
- toVariableName(prefix, "text", "on", "surface", "subtle"),
1143
- pickSemantic(
1144
- tokens2,
1145
- getPath(darkMode, ["text", "onSurface", "subtle"]),
1146
- getPath(defaultMode, ["text", "onSurface", "subtle"]),
1147
- getPath(textAliases, ["onSurface", "subtle"])
1148
- )
1149
- );
1150
- addDark(
1151
- toVariableName(prefix, "text", "on", "surface", "meta"),
1152
- pickSemantic(
1153
- tokens2,
1154
- getPath(darkMode, ["text", "onSurface", "meta"]),
1155
- getPath(defaultMode, ["text", "onSurface", "meta"]),
1156
- getPath(textAliases, ["onSurface", "meta"])
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
- );
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));
1243
1075
  });
1244
1076
  const rootBlock = `${selector} {
1245
- ${rootLines.join("\n")}
1077
+ ${[...baseLines, ...mapLines].join("\n")}
1246
1078
  }`;
1247
1079
  const darkBlock = `${selector}[data-spectre-theme="dark"] {
1248
1080
  ${darkLines.join("\n")}