@yahoo/uds-create-config 5.62.1 → 5.62.3

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.
@@ -198,8 +198,18 @@ function layerParents(json) {
198
198
  return isRef(element) && kindOf(element) === "layer" ? pathOf(element) : node;
199
199
  };
200
200
  const parents = /* @__PURE__ */ new Map();
201
- for (const [node, { children = [] } = {}] of Object.entries(json.anatomy)) for (const child of children) if (typeof child === "string") parents.set(layerOf(child), layerOf(node));
202
- for (const layer of Object.keys(json.layers ?? {})) if (layer !== root && !parents.has(layer)) parents.set(layer, root);
201
+ const placed = /* @__PURE__ */ new Set();
202
+ for (const [node, { children = [] } = {}] of Object.entries(json.anatomy)) {
203
+ const parent = layerOf(node);
204
+ placed.add(parent);
205
+ for (const child of children) {
206
+ if (typeof child !== "string") continue;
207
+ const layer = layerOf(child);
208
+ placed.add(layer);
209
+ if (layer !== parent) parents.set(layer, parent);
210
+ }
211
+ }
212
+ for (const layer of Object.keys(json.layers ?? {})) if (layer !== root && !placed.has(layer)) parents.set(layer, root);
203
213
  return parents;
204
214
  }
205
215
  /** Each combination of a component's variants, the rest of its props at their defaults, capped. */
@@ -540,7 +550,9 @@ function configLintContext({ config, rules, own: isOwn }) {
540
550
  if (name === root || keys === fill && painted()) return void 0;
541
551
  return at(root, keys);
542
552
  }
543
- for (let up = parents.get(name); up; up = parents.get(up)) {
553
+ const seen = new Set([name]);
554
+ for (let up = parents.get(name); up && !seen.has(up); up = parents.get(up)) {
555
+ seen.add(up);
544
556
  const found = at(up, keys);
545
557
  if (found) return found;
546
558
  }