@yahoo/uds-create-config 5.107.0 → 5.107.2

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.
@@ -549,17 +549,14 @@ const nodeGestureOps = {
549
549
  input: wrapInput,
550
550
  readOnly: false,
551
551
  label: "Wrap children in a container",
552
- description: "Group or wrap elements (\"wrap these in a stack\", \"group the title and the body\", \"put it in a card\"): some of this node's direct children move into a new container element of the given component type, which takes their place among the node's children. They land in the container's children, or in the slot its `slotProp` names, and a slot that lists what it accepts refuses anything else.",
552
+ description: "Group or wrap elements (\"wrap these in a stack\", \"group the title and the body\", \"put it in a card\"): some of this node's direct children move into a new container element of the given component type, which takes their place among the node's children. Use the full component path as listed by the attached system, including any group prefix. The elements land in the container's children, or in the slot its `slotProp` names, and a slot that lists what it accepts refuses anything else.",
553
553
  scope: "item",
554
554
  title: (entity) => `Wrap children of ${entity}`,
555
555
  example: () => ({
556
556
  path: "card",
557
557
  data: {
558
558
  elements: ["card/title", "card/body"],
559
- container: {
560
- type: "VStack",
561
- props: { gap: "2" }
562
- }
559
+ container: { type: "layout/VStack" }
563
560
  }
564
561
  }),
565
562
  handler: (input, config) => applied(config, wrap(config, wrapInput.parse(input)))
@@ -38,7 +38,11 @@ function placedTypeRef({ type, slug, system, field }) {
38
38
  type,
39
39
  slug
40
40
  });
41
- if (kindOf(placed) === "component" && !system.resolve("component", pathOf(placed))) return rejectData(`The system has no component "${pathOf(placed)}".`, field);
41
+ const path = pathOf(placed);
42
+ if (kindOf(placed) === "component" && !system.resolve("component", path)) {
43
+ const matches = system.list("component").filter((entry) => entry.path.endsWith(`/${path}`));
44
+ return rejectData(`The system has no component "${path}".${matches.length === 1 ? ` Did you mean "${matches[0].path}"?` : ""}`, field);
45
+ }
42
46
  return placed;
43
47
  }
44
48
  /** The content fields of one element as a node row holds them. */
@@ -1,10 +1,10 @@
1
- import { isRef, kindOf, memberOf, pathOf, ref, refLeaf, splitRef } from "./utils/refs.js";
1
+ import { isRef, kindOf, memberOf, pathOf, ref, refLeaf, sourceOf, splitRef } from "./utils/refs.js";
2
2
  import { defaultsFor } from "./default-conditions.js";
3
3
  import { renderedElement } from "../entities/system/element.js";
4
4
  import { createSliceMemo } from "./memo.js";
5
5
  import { UDS_FORCE_STATES, componentStateDefaults, componentStates } from "./component-states.js";
6
6
  import { unconditionalPreviewProps } from "./preview-store.js";
7
- import { authoredBag, authoredValue, declaredPropDefaults, memberFromLeaf, refListOf, resolveComponentProps, stylePropertyPathFor } from "./projections.js";
7
+ import { LAYER_PROPS, authoredBag, authoredValue, declaredPropDefaults, glyphPropsOf, libraryThroughPin, memberFromLeaf, refListOf, resolveComponentProps, stylePropertyPathFor } from "./projections.js";
8
8
  import { slotHostLayer } from "./slot-host.js";
9
9
  import { forwardRoutes, forwardedLayers, intoName, isValueSlot, renderBindingsOf, routesContent } from "./prop-surface.js";
10
10
  import { withRequiredContentHidden } from "../entities/system/required-content-layers.js";
@@ -1516,7 +1516,69 @@ function moduleProps(config, type, props) {
1516
1516
  }
1517
1517
  return changed ? out : bag;
1518
1518
  };
1519
- return walk(props);
1519
+ const own = walk(props);
1520
+ if (through.length === 0 || !Object.hasOwn(own, "layerProps")) return own;
1521
+ return withLayerGlyphRefs({
1522
+ config,
1523
+ component: type,
1524
+ props: own,
1525
+ where: pathOf(type)
1526
+ });
1527
+ }
1528
+ /** Composed layers call their components directly, so their glyph names need refs before the
1529
+ * registry revives nested values into React components. */
1530
+ function withLayerGlyphRefs({ config, component, props, where }) {
1531
+ const overrides = props[LAYER_PROPS];
1532
+ if (!overrides || typeof overrides !== "object" || Array.isArray(overrides)) return props;
1533
+ const layers = bodyOf(config, splitRef(component).qualifiedPath)?.layers;
1534
+ let next;
1535
+ for (const [layer, value] of Object.entries(overrides)) {
1536
+ const target = layers?.[layer];
1537
+ if (!isRef(target) || kindOf(target) !== "component") continue;
1538
+ if (!value || typeof value !== "object" || Array.isArray(value)) continue;
1539
+ const owner = config.configFor(target);
1540
+ if (!owner) continue;
1541
+ const bag = value;
1542
+ const address = `${where}.${LAYER_PROPS}.${layer}`;
1543
+ const slug = sourceOf(target);
1544
+ let updated;
1545
+ for (const [prop, libraries] of Object.entries(glyphPropsOf(owner, pathOf(target)))) {
1546
+ const name = bag[prop];
1547
+ if (typeof name !== "string") continue;
1548
+ let glyph;
1549
+ if (kindOf(name) === "icon") {
1550
+ if (config.resolveRef(name)) glyph = { __ref: name };
1551
+ } else for (const library of libraries) {
1552
+ const group = splitRef(slug ? libraryThroughPin({
1553
+ config,
1554
+ slug,
1555
+ library
1556
+ }) : library);
1557
+ const candidate = ref("icon", `${group.path}/${name}`, group.source);
1558
+ if (!config.resolveRef(candidate)) continue;
1559
+ glyph = candidate;
1560
+ break;
1561
+ }
1562
+ if (!glyph) console.error(`[uds] ${address}.${prop}: unknown icon ${JSON.stringify(name)}`);
1563
+ updated ??= { ...bag };
1564
+ updated[prop] = glyph;
1565
+ }
1566
+ const inner = updated ?? bag;
1567
+ const nested = withLayerGlyphRefs({
1568
+ config,
1569
+ component: target.__ref,
1570
+ props: inner,
1571
+ where: address
1572
+ });
1573
+ if (nested !== bag) {
1574
+ next ??= { ...overrides };
1575
+ next[layer] = nested;
1576
+ }
1577
+ }
1578
+ return next ? {
1579
+ ...props,
1580
+ [LAYER_PROPS]: next
1581
+ } : props;
1520
1582
  }
1521
1583
  /** Whether any node under `key` (itself excluded) binds `prop` as its content. */
1522
1584
  function subtreeBinds(anatomy, key, prop) {