@phcdevworks/spectre-tokens 3.3.1 → 3.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/README.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @phcdevworks/spectre-tokens
2
2
 
3
+ `@phcdevworks/spectre-tokens` is the design-token package of the Spectre
4
+ system. It provides a complete, UI-ready token surface for downstream Spectre
5
+ packages and compatible applications.
6
+
7
+ Maintained by [PHCDevworks](https://go.phcdev.co). It defines the visual
8
+ language, semantic roles, and token contracts that downstream consumers can
9
+ rely on without filling gaps with raw palette values or local token
10
+ inventions. Downstream UI packages define structure; adapter packages
11
+ translate Spectre contracts for specific frameworks and runtimes.
12
+
3
13
  ## Repository Snapshot
4
14
 
5
15
  | Field | Value |
@@ -7,7 +17,7 @@
7
17
  | Project team | `project-design` |
8
18
  | Repository role | Spectre L1 design-token contract |
9
19
  | Package/artifact | `@phcdevworks/spectre-tokens` |
10
- | Current version/status | 3.3.1 |
20
+ | Current version/status | 3.4.0 |
11
21
 
12
22
  ## Standard Workflow
13
23
 
@@ -500,7 +510,7 @@ This project expects Node.js `^22.12.0 || >=24.0.0` and npm `11.17.0`.
500
510
  | Command | What it does |
501
511
  | ------------------------ | ------------------------------------------------------------ |
502
512
  | `npm run build` | Regenerate all outputs — run after any token source change |
503
- | `npm run check` | Full validation gate — all 15 steps must pass before commit |
513
+ | `npm run check` | Full validation gate — all 16 steps must pass before commit |
504
514
  | `npm run lint` | Run ESLint against all source files |
505
515
  | `npm run format` | Apply Prettier formatting to all files |
506
516
  | `npm run generate` | Regenerate `src/generated/tokens.ts` from token sources only |
package/dist/index.cjs CHANGED
@@ -1215,131 +1215,13 @@ var coreTokens = {
1215
1215
  // src/css.ts
1216
1216
  var DEFAULT_PREFIX = "sp";
1217
1217
  var DEFAULT_SELECTOR = ":root";
1218
+ var LEGACY_COMPONENT_PREFIX_GROUPS = /* @__PURE__ */ new Set(["card", "input"]);
1218
1219
  var formatKey = (segment) => segment.replace(/[^a-z0-9]+/gi, "-").replace(/^-+|-+$/g, "").toLowerCase();
1219
1220
  var toVariableName = (prefix, ...parts) => {
1220
1221
  const filtered = parts.filter(Boolean).map(formatKey);
1221
1222
  return `--${prefix}-${filtered.join("-")}`;
1222
1223
  };
1223
- var BADGE_VARIANTS = [
1224
- { variant: "neutral", bgKey: "neutralBg", bgHoverKey: "neutralBgHover", textKey: "neutralText" },
1225
- { variant: "info", bgKey: "infoBg", bgHoverKey: "infoBgHover", textKey: "infoText" },
1226
- { variant: "success", bgKey: "successBg", bgHoverKey: "successBgHover", textKey: "successText" },
1227
- { variant: "warning", bgKey: "warningBg", bgHoverKey: "warningBgHover", textKey: "warningText" },
1228
- { variant: "danger", bgKey: "dangerBg", bgHoverKey: "dangerBgHover", textKey: "dangerText" }
1229
- ];
1230
- var ICON_BOX_FIELDS = [
1231
- { name: "bg", tokenKey: "bg" },
1232
- { name: "border", tokenKey: "border" },
1233
- { name: "icon-default", tokenKey: "iconDefault" },
1234
- { name: "icon-success", tokenKey: "iconSuccess" },
1235
- { name: "icon-warning", tokenKey: "iconWarning" },
1236
- { name: "icon-danger", tokenKey: "iconDanger" }
1237
- ];
1238
- var NAV_FIELDS = [
1239
- { name: "bg", tokenKey: "bg" },
1240
- { name: "text", tokenKey: "text" },
1241
- { name: "link", tokenKey: "link" },
1242
- { name: "link-hover", tokenKey: "linkHover" },
1243
- { name: "link-active", tokenKey: "linkActive" },
1244
- { name: "border", tokenKey: "border" }
1245
- ];
1246
- var MODAL_FIELDS = [
1247
- { name: "bg", tokenKey: "bg" },
1248
- { name: "shadow", tokenKey: "shadow" },
1249
- { name: "border", tokenKey: "border" },
1250
- { name: "overlay", tokenKey: "overlay" }
1251
- ];
1252
- var TESTIMONIAL_FIELDS = [
1253
- { name: "bg", tokenKey: "bg" },
1254
- { name: "bg-hover", tokenKey: "bgHover" },
1255
- { name: "border", tokenKey: "border" },
1256
- { name: "text", tokenKey: "text" },
1257
- { name: "author-name", tokenKey: "authorName" },
1258
- { name: "author-title", tokenKey: "authorTitle" },
1259
- { name: "quote-mark", tokenKey: "quoteMark" }
1260
- ];
1261
- var PRICING_CARD_FIELDS = [
1262
- { name: "bg", tokenKey: "bg" },
1263
- { name: "bg-hover", tokenKey: "bgHover" },
1264
- { name: "border", tokenKey: "border" },
1265
- { name: "featured-bg", tokenKey: "featuredBg" },
1266
- { name: "featured-text", tokenKey: "featuredText" },
1267
- { name: "featured-badge-bg", tokenKey: "featuredBadgeBg" },
1268
- { name: "featured-badge-text", tokenKey: "featuredBadgeText" },
1269
- { name: "price", tokenKey: "price" },
1270
- { name: "price-description", tokenKey: "priceDescription" }
1271
- ];
1272
- var RATING_FIELDS = [
1273
- { name: "star-filled", tokenKey: "starFilled" },
1274
- { name: "star-empty", tokenKey: "starEmpty" },
1275
- { name: "text", tokenKey: "text" }
1276
- ];
1277
- var TOAST_VARIANTS = ["success", "warning", "danger", "info"].map((variant) => ({
1278
- variant,
1279
- fields: [
1280
- { name: "bg", tokenKey: "bg" },
1281
- { name: "text", tokenKey: "text" },
1282
- { name: "border", tokenKey: "border" },
1283
- { name: "icon", tokenKey: "icon" }
1284
- ]
1285
- }));
1286
- var TOOLTIP_FIELDS = [
1287
- { name: "bg", tokenKey: "bg" },
1288
- { name: "text", tokenKey: "text" },
1289
- { name: "border", tokenKey: "border" }
1290
- ];
1291
- var DROPDOWN_FIELDS = [
1292
- { name: "bg", modePath: ["bg"], aliasPath: ["bg"] },
1293
- { name: "border", modePath: ["border"], aliasPath: ["border"] },
1294
- { name: "item-default", modePath: ["item", "default"], aliasPath: ["item", "default"] },
1295
- { name: "item-hover", modePath: ["item", "hover"], aliasPath: ["item", "hover"] },
1296
- { name: "item-active", modePath: ["item", "active"], aliasPath: ["item", "active"] },
1297
- { name: "item-text", modePath: ["item", "text"], aliasPath: ["item", "text"] }
1298
- ];
1299
- var SELECTION_CONTROL_FIELDS = [
1300
- { name: "bg", tokenKey: "bg" },
1301
- { name: "border", tokenKey: "border" },
1302
- { name: "checked-bg", tokenKey: "checkedBg" },
1303
- { name: "checked-border", tokenKey: "checkedBorder" },
1304
- { name: "text", tokenKey: "text" },
1305
- { name: "disabled-bg", tokenKey: "disabledBg" },
1306
- { name: "disabled-border", tokenKey: "disabledBorder" }
1307
- ];
1308
- var SELECT_FIELDS = [
1309
- { name: "bg", tokenKey: "bg" },
1310
- { name: "border", tokenKey: "border" },
1311
- { name: "text", tokenKey: "text" },
1312
- { name: "placeholder-text", tokenKey: "placeholderText" },
1313
- { name: "disabled-bg", tokenKey: "disabledBg" },
1314
- { name: "disabled-border", tokenKey: "disabledBorder" },
1315
- { name: "focus-border", tokenKey: "focusBorder" },
1316
- { name: "border-invalid", tokenKey: "borderInvalid" },
1317
- { name: "bg-invalid", tokenKey: "bgInvalid" },
1318
- { name: "border-success", tokenKey: "borderSuccess" },
1319
- { name: "bg-success", tokenKey: "bgSuccess" }
1320
- ];
1321
- var TEXTAREA_FIELDS = [
1322
- { name: "bg", tokenKey: "bg" },
1323
- { name: "border", tokenKey: "border" },
1324
- { name: "text", tokenKey: "text" },
1325
- { name: "placeholder", tokenKey: "placeholder" },
1326
- { name: "disabled-bg", tokenKey: "disabledBg" },
1327
- { name: "disabled-border", tokenKey: "disabledBorder" },
1328
- { name: "focus-border", tokenKey: "focusBorder" },
1329
- { name: "border-invalid", tokenKey: "borderInvalid" },
1330
- { name: "bg-invalid", tokenKey: "bgInvalid" },
1331
- { name: "border-success", tokenKey: "borderSuccess" },
1332
- { name: "bg-success", tokenKey: "bgSuccess" }
1333
- ];
1334
- var FIELDSET_FIELDS = [
1335
- { name: "border", tokenKey: "border" },
1336
- { name: "legend-text", tokenKey: "legendText" }
1337
- ];
1338
- var LABEL_FIELDS = [
1339
- { name: "text", tokenKey: "text" },
1340
- { name: "disabled-text", tokenKey: "disabledText" },
1341
- { name: "required-indicator-text", tokenKey: "requiredIndicatorText" }
1342
- ];
1224
+ var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1343
1225
  var resolveTokenReference = (tokens2, reference) => {
1344
1226
  const path = reference.slice(1, -1).split(".");
1345
1227
  let current = tokens2;
@@ -1377,14 +1259,21 @@ var resolveValue = (tokens2, value) => {
1377
1259
  str = str.replace(opacityRegex, (match, hex, opacity) => hexToRgba(hex, opacity));
1378
1260
  return str;
1379
1261
  };
1380
- var resolveSemanticValue = (value, tokens2) => {
1262
+ var resolveSemanticValue = (value, tokens2, path) => {
1263
+ if (value === void 0) return void 0;
1381
1264
  if (typeof value === "string" || typeof value === "number") {
1382
1265
  return resolveValue(tokens2, value);
1383
1266
  }
1384
- if (value && typeof value === "object" && "value" in value) {
1385
- return resolveValue(tokens2, value.value);
1267
+ if (isPlainObject(value)) {
1268
+ if ("value" in value) {
1269
+ return resolveValue(tokens2, value.value);
1270
+ }
1271
+ if ("metadata" in value || "description" in value) {
1272
+ throw new Error(`Unsupported token value shape at "${path ?? "(unknown path)"}": expected a string, number, or { value } wrapper.`);
1273
+ }
1274
+ return void 0;
1386
1275
  }
1387
- return void 0;
1276
+ throw new Error(`Unsupported token value shape at "${path ?? "(unknown path)"}": ${JSON.stringify(value)}`);
1388
1277
  };
1389
1278
  var getPath = (source, path) => path.reduce((acc, key) => acc && typeof acc === "object" ? acc[key] : void 0, source);
1390
1279
  var pickSemantic = (tokens2, ...candidates) => {
@@ -1469,6 +1358,18 @@ var createCssVariableMap = (tokens2, options = {}) => {
1469
1358
  Object.entries(baseTokens.radii).forEach(([key, value]) => {
1470
1359
  assign(toVariableName(prefix, "radius", key), value);
1471
1360
  });
1361
+ const icons = baseTokens.icons;
1362
+ if (icons) {
1363
+ Object.entries(icons).forEach(([key, value]) => {
1364
+ assign(toVariableName(prefix, "icon", key), value);
1365
+ });
1366
+ }
1367
+ const aspectRatios = baseTokens.aspectRatios;
1368
+ if (aspectRatios) {
1369
+ Object.entries(aspectRatios).forEach(([key, value]) => {
1370
+ assign(toVariableName(prefix, "aspect-ratio", key), value);
1371
+ });
1372
+ }
1472
1373
  Object.entries(baseTokens.typography.families).forEach(([key, value]) => {
1473
1374
  assign(toVariableName(prefix, "font-family", key), value);
1474
1375
  });
@@ -1515,6 +1416,7 @@ var createCssVariableMap = (tokens2, options = {}) => {
1515
1416
  assign(toVariableName(prefix, "min-touch-target"), baseTokens.accessibility.minTouchTarget);
1516
1417
  assign(toVariableName(prefix, "min-text-size"), baseTokens.accessibility.minTextSize);
1517
1418
  assign(toVariableName(prefix, "reduced-motion"), baseTokens.accessibility.reducedMotion);
1419
+ assign(toVariableName(prefix, "forced-colors"), baseTokens.accessibility.forcedColors);
1518
1420
  Object.entries(baseTokens.buttons).forEach(([variant, states]) => {
1519
1421
  Object.entries(states).forEach(([state, value]) => {
1520
1422
  assign(toVariableName(prefix, "button", variant, state), value);
@@ -1556,129 +1458,7 @@ var generateCssVariables = (tokens2, options = {}) => {
1556
1458
  const textAliases = tokens2.text ?? {};
1557
1459
  const componentAliases = tokens2.component ?? {};
1558
1460
  const linkTokens = tokens2.link ?? {};
1559
- const semanticEntries = [
1560
- { varParts: ["surface", "page"], modePath: ["surface", "page"], aliasSrc: surfaceAliases, aliasPath: ["page"] },
1561
- { varParts: ["surface", "card"], modePath: ["surface", "card"], aliasSrc: surfaceAliases, aliasPath: ["card"] },
1562
- { varParts: ["surface", "input"], modePath: ["surface", "input"], aliasSrc: surfaceAliases, aliasPath: ["input"] },
1563
- { varParts: ["surface", "overlay"], modePath: ["surface", "overlay"], aliasSrc: surfaceAliases, aliasPath: ["overlay"] },
1564
- { varParts: ["surface", "subtle"], modePath: ["surface", "subtle"] },
1565
- { varParts: ["surface", "hero"], modePath: ["surface", "hero"], aliasSrc: surfaceAliases, aliasPath: ["hero"] },
1566
- { varParts: ["surface", "hover"], modePath: ["surface", "hover"], aliasSrc: surfaceAliases, aliasPath: ["hover"] },
1567
- { varParts: ["surface", "selected"], modePath: ["surface", "selected"], aliasSrc: surfaceAliases, aliasPath: ["selected"] },
1568
- { varParts: ["surface", "active"], modePath: ["surface", "active"], aliasSrc: surfaceAliases, aliasPath: ["active"] },
1569
- { varParts: ["surface", "divider"], modePath: ["surface", "divider"], aliasSrc: surfaceAliases, aliasPath: ["divider"] },
1570
- { varParts: ["text", "on", "page", "default"], modePath: ["text", "onPage", "default"], aliasSrc: textAliases, aliasPath: ["onPage", "default"] },
1571
- { varParts: ["text", "on", "page", "muted"], modePath: ["text", "onPage", "muted"], aliasSrc: textAliases, aliasPath: ["onPage", "muted"] },
1572
- { varParts: ["text", "on", "page", "subtle"], modePath: ["text", "onPage", "subtle"], aliasSrc: textAliases, aliasPath: ["onPage", "subtle"] },
1573
- { varParts: ["text", "on", "page", "meta"], modePath: ["text", "onPage", "meta"], aliasSrc: textAliases, aliasPath: ["onPage", "meta"] },
1574
- { varParts: ["text", "on", "page", "brand"], modePath: ["text", "onPage", "brand"], aliasSrc: textAliases, aliasPath: ["onPage", "brand"] },
1575
- { varParts: ["text", "on", "surface", "default"], modePath: ["text", "onSurface", "default"], aliasSrc: textAliases, aliasPath: ["onSurface", "default"] },
1576
- { varParts: ["text", "on", "surface", "muted"], modePath: ["text", "onSurface", "muted"], aliasSrc: textAliases, aliasPath: ["onSurface", "muted"] },
1577
- { varParts: ["text", "on", "surface", "subtle"], modePath: ["text", "onSurface", "subtle"], aliasSrc: textAliases, aliasPath: ["onSurface", "subtle"] },
1578
- { varParts: ["text", "on", "surface", "meta"], modePath: ["text", "onSurface", "meta"], aliasSrc: textAliases, aliasPath: ["onSurface", "meta"] },
1579
- { varParts: ["text", "on", "surface", "brand"], modePath: ["text", "onSurface", "brand"], aliasSrc: textAliases, aliasPath: ["onSurface", "brand"] },
1580
- { varParts: ["component", "card", "text"], modePath: ["component", "card", "text"], aliasSrc: componentAliases, aliasPath: ["card", "text"] },
1581
- { varParts: ["component", "card", "text-muted"], modePath: ["component", "card", "textMuted"], aliasSrc: componentAliases, aliasPath: ["card", "textMuted"] },
1582
- { varParts: ["component", "input", "text"], modePath: ["component", "input", "text"], aliasSrc: componentAliases, aliasPath: ["input", "text"] },
1583
- { varParts: ["component", "input", "placeholder"], modePath: ["component", "input", "placeholder"], aliasSrc: componentAliases, aliasPath: ["input", "placeholder"] },
1584
- { varParts: ["button", "text", "default"], modePath: ["component", "button", "textDefault"], aliasSrc: componentAliases, aliasPath: ["button", "textDefault"] },
1585
- { varParts: ["button", "text", "on", "primary"], modePath: ["component", "button", "textOnPrimary"], aliasSrc: componentAliases, aliasPath: ["button", "textOnPrimary"] },
1586
- ...BADGE_VARIANTS.flatMap(({ variant, bgKey, bgHoverKey, textKey }) => [
1587
- { varParts: ["badge", variant, "bg"], modePath: ["component", "badge", bgKey], aliasSrc: componentAliases, aliasPath: ["badge", bgKey] },
1588
- { varParts: ["badge", variant, "bg-hover"], modePath: ["component", "badge", bgHoverKey], aliasSrc: componentAliases, aliasPath: ["badge", bgHoverKey] },
1589
- { varParts: ["badge", variant, "text"], modePath: ["component", "badge", textKey], aliasSrc: componentAliases, aliasPath: ["badge", textKey] }
1590
- ]),
1591
- ...ICON_BOX_FIELDS.map(({ name, tokenKey }) => ({
1592
- varParts: ["icon-box", name],
1593
- modePath: ["component", "iconBox", tokenKey],
1594
- aliasSrc: componentAliases,
1595
- aliasPath: ["iconBox", tokenKey]
1596
- })),
1597
- ...NAV_FIELDS.map(({ name, tokenKey }) => ({
1598
- varParts: ["nav", name],
1599
- modePath: ["component", "nav", tokenKey],
1600
- aliasSrc: componentAliases,
1601
- aliasPath: ["nav", tokenKey]
1602
- })),
1603
- ...MODAL_FIELDS.map(({ name, tokenKey }) => ({
1604
- varParts: ["modal", name],
1605
- modePath: ["component", "modal", tokenKey],
1606
- aliasSrc: componentAliases,
1607
- aliasPath: ["modal", tokenKey]
1608
- })),
1609
- ...TOAST_VARIANTS.flatMap(({ variant, fields }) => fields.map(({ name, tokenKey }) => ({
1610
- varParts: ["toast", variant, name],
1611
- modePath: ["component", "toast", variant, tokenKey],
1612
- aliasSrc: componentAliases,
1613
- aliasPath: ["toast", variant, tokenKey]
1614
- }))),
1615
- ...TOOLTIP_FIELDS.map(({ name, tokenKey }) => ({
1616
- varParts: ["tooltip", name],
1617
- modePath: ["component", "tooltip", tokenKey],
1618
- aliasSrc: componentAliases,
1619
- aliasPath: ["tooltip", tokenKey]
1620
- })),
1621
- ...DROPDOWN_FIELDS.map(({ name, modePath, aliasPath }) => ({
1622
- varParts: ["dropdown", name],
1623
- modePath: ["component", "dropdown", ...modePath],
1624
- aliasSrc: componentAliases,
1625
- aliasPath: ["dropdown", ...aliasPath]
1626
- })),
1627
- ...SELECTION_CONTROL_FIELDS.map(({ name, tokenKey }) => ({
1628
- varParts: ["checkbox", name],
1629
- modePath: ["component", "checkbox", tokenKey],
1630
- aliasSrc: componentAliases,
1631
- aliasPath: ["checkbox", tokenKey]
1632
- })),
1633
- ...SELECTION_CONTROL_FIELDS.map(({ name, tokenKey }) => ({
1634
- varParts: ["radio", name],
1635
- modePath: ["component", "radio", tokenKey],
1636
- aliasSrc: componentAliases,
1637
- aliasPath: ["radio", tokenKey]
1638
- })),
1639
- ...SELECT_FIELDS.map(({ name, tokenKey }) => ({
1640
- varParts: ["select", name],
1641
- modePath: ["component", "select", tokenKey],
1642
- aliasSrc: componentAliases,
1643
- aliasPath: ["select", tokenKey]
1644
- })),
1645
- ...TEXTAREA_FIELDS.map(({ name, tokenKey }) => ({
1646
- varParts: ["textarea", name],
1647
- modePath: ["component", "textarea", tokenKey],
1648
- aliasSrc: componentAliases,
1649
- aliasPath: ["textarea", tokenKey]
1650
- })),
1651
- ...FIELDSET_FIELDS.map(({ name, tokenKey }) => ({
1652
- varParts: ["fieldset", name],
1653
- modePath: ["component", "fieldset", tokenKey],
1654
- aliasSrc: componentAliases,
1655
- aliasPath: ["fieldset", tokenKey]
1656
- })),
1657
- ...LABEL_FIELDS.map(({ name, tokenKey }) => ({
1658
- varParts: ["label", name],
1659
- modePath: ["component", "label", tokenKey],
1660
- aliasSrc: componentAliases,
1661
- aliasPath: ["label", tokenKey]
1662
- })),
1663
- ...TESTIMONIAL_FIELDS.map(({ name, tokenKey }) => ({
1664
- varParts: ["testimonial", name],
1665
- modePath: ["component", "testimonial", tokenKey],
1666
- aliasSrc: componentAliases,
1667
- aliasPath: ["testimonial", tokenKey]
1668
- })),
1669
- ...PRICING_CARD_FIELDS.map(({ name, tokenKey }) => ({
1670
- varParts: ["pricing-card", name],
1671
- modePath: ["component", "pricingCard", tokenKey],
1672
- aliasSrc: componentAliases,
1673
- aliasPath: ["pricingCard", tokenKey]
1674
- })),
1675
- ...RATING_FIELDS.map(({ name, tokenKey }) => ({
1676
- varParts: ["rating", name],
1677
- modePath: ["component", "rating", tokenKey],
1678
- aliasSrc: componentAliases,
1679
- aliasPath: ["rating", tokenKey]
1680
- }))
1681
- ];
1461
+ const componentVarParts = (group, kebabGroup, path) => LEGACY_COMPONENT_PREFIX_GROUPS.has(group) ? ["component", kebabGroup, ...path] : [kebabGroup, ...path];
1682
1462
  const baseLines = [];
1683
1463
  const darkLines = [];
1684
1464
  const addBase = (name, value) => {
@@ -1687,12 +1467,56 @@ var generateCssVariables = (tokens2, options = {}) => {
1687
1467
  const addDark = (name, value) => {
1688
1468
  if (value !== void 0) darkLines.push(` ${name}: ${value};`);
1689
1469
  };
1690
- semanticEntries.forEach(({ varParts, modePath, aliasSrc, aliasPath }) => {
1691
- const varName = toVariableName(prefix, ...varParts);
1692
- const aliasCandidate = aliasSrc && aliasPath ? [getPath(aliasSrc, aliasPath)] : [];
1693
- addBase(varName, pickSemantic(tokens2, getPath(defaultMode, modePath), ...aliasCandidate));
1694
- addDark(varName, pickSemantic(tokens2, getPath(darkMode, modePath), getPath(defaultMode, modePath), ...aliasCandidate));
1695
- });
1470
+ const walkSemanticGroup = (namespace, varPartsFor, aliasSrc) => {
1471
+ const defaultNode = defaultMode[namespace];
1472
+ const darkNode = darkMode[namespace];
1473
+ const paths = /* @__PURE__ */ new Set();
1474
+ const collectPaths = (node, path) => {
1475
+ if (node === void 0) return;
1476
+ const leaf = resolveSemanticValue(node, tokens2, [namespace, ...path].join("."));
1477
+ if (leaf !== void 0) {
1478
+ paths.add(path.join("."));
1479
+ return;
1480
+ }
1481
+ if (isPlainObject(node)) {
1482
+ Object.keys(node).forEach((key) => collectPaths(node[key], [...path, key]));
1483
+ }
1484
+ };
1485
+ collectPaths(defaultNode, []);
1486
+ collectPaths(darkNode, []);
1487
+ collectPaths(aliasSrc, []);
1488
+ paths.forEach((joinedPath) => {
1489
+ const path = joinedPath.split(".");
1490
+ const varName = toVariableName(prefix, ...varPartsFor(path));
1491
+ const aliasCandidate = getPath(aliasSrc, path);
1492
+ const baseValue = pickSemantic(tokens2, getPath(defaultNode, path), aliasCandidate);
1493
+ const darkValue = pickSemantic(tokens2, getPath(darkNode, path), getPath(defaultNode, path), aliasCandidate);
1494
+ addBase(varName, baseValue);
1495
+ addDark(varName, darkValue);
1496
+ });
1497
+ };
1498
+ const kebabPathSegment = (segment) => formatKey(segment.replace(/([a-z0-9])([A-Z])/g, "$1-$2"));
1499
+ walkSemanticGroup(
1500
+ "surface",
1501
+ (path) => ["surface", ...path.map(kebabPathSegment)],
1502
+ surfaceAliases
1503
+ );
1504
+ walkSemanticGroup(
1505
+ "text",
1506
+ (path) => {
1507
+ const [scope, ...rest] = path;
1508
+ return ["text", ...kebabPathSegment(scope).split("-"), ...rest.map(kebabPathSegment)];
1509
+ },
1510
+ textAliases
1511
+ );
1512
+ walkSemanticGroup(
1513
+ "component",
1514
+ (path) => {
1515
+ const [group, ...rest] = path;
1516
+ return componentVarParts(group, kebabPathSegment(group), rest.map(kebabPathSegment));
1517
+ },
1518
+ componentAliases
1519
+ );
1696
1520
  Object.entries(linkTokens).forEach(([key, value]) => {
1697
1521
  const varName = toVariableName(prefix, "link", key);
1698
1522
  const resolved = pickSemantic(tokens2, value);