@yahoo/uds-create-config 5.96.5 → 5.97.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.
Files changed (33) hide show
  1. package/dist/configs/system.js +2 -0
  2. package/dist/entities/system/Source.d.ts +1 -0
  3. package/dist/entities/system/Source.js +39 -3
  4. package/dist/entities/system/component-module.d.ts +15 -1
  5. package/dist/entities/system/component-module.js +76 -5
  6. package/dist/entities/system/copy-plan.js +2 -1
  7. package/dist/entities/system/defineComponent.d.ts +7 -1
  8. package/dist/entities/system/icon-library.js +9 -0
  9. package/dist/entities/system/vendor-conditions.d.ts +67 -0
  10. package/dist/entities/system/vendor-conditions.js +253 -0
  11. package/dist/framework/Config.d.ts +24 -2
  12. package/dist/framework/Config.js +44 -6
  13. package/dist/framework/class-names.js +7 -4
  14. package/dist/framework/module-views.d.ts +9 -1
  15. package/dist/framework/projections.js +56 -10
  16. package/dist/framework/prop-surface.d.ts +7 -1
  17. package/dist/framework/prop-surface.js +140 -37
  18. package/dist/framework/ref-integrity.js +1 -0
  19. package/dist/framework/registry.d.ts +3 -1
  20. package/dist/framework/render-spec.js +6 -0
  21. package/dist/framework/schema-version.d.ts +1 -1
  22. package/dist/framework/schema-version.js +5 -5
  23. package/dist/framework/source-integrity.js +1 -0
  24. package/dist/index.d.ts +6 -5
  25. package/dist/index.js +5 -4
  26. package/dist/lint/rules.d.ts +6 -0
  27. package/dist/lint/rules.js +6 -0
  28. package/dist/migrations/20261112163439_vendor_link_type.d.ts +8 -0
  29. package/dist/migrations/20261112163439_vendor_link_type.js +10 -0
  30. package/dist/spec/glyph-jsx.js +4 -2
  31. package/dist/spec/glyph-members.js +3 -1
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +2 -2
@@ -74,7 +74,7 @@ interface RecordedSource {
74
74
  * The dense-counter `2` a short-lived scheme stamped before the chain existed reads as the mint
75
75
  * that replaced it (see `detectedWireVersion`).
76
76
  */
77
- declare const SERIALIZED_CONFIG_VERSION = 20261112154943;
77
+ declare const SERIALIZED_CONFIG_VERSION = 20261112163439;
78
78
  interface SerializedConfig {
79
79
  /** See {@link SERIALIZED_CONFIG_VERSION}. Always written; a stored artifact may lack it. */
80
80
  readonly version: number;
@@ -621,6 +621,9 @@ declare class Config {
621
621
  /** Bind this config's lineage to the handle that owns it — called by `ConfigSession`, so links
622
622
  * taken off any config it produces resolve through the session rather than freezing. */
623
623
  withOwner(owner: LiveConfig): this;
624
+ /** This config under an identity of its own. It answers what the receiver does, so a holder that
625
+ * keys a fact on the value (`registerModuleView`) can tag it and leave the receiver untagged. */
626
+ fork(): this;
624
627
  /** The pending edits with their ids — what a sink persists and `merge` names. */
625
628
  get pending(): readonly StampedPatch[];
626
629
  /**
@@ -2460,6 +2463,9 @@ declare class Config {
2460
2463
  * A path no pin declares goes to the first `linked` source when every `linked` source holding it
2461
2464
  * reads the same entity, the `hybrid` ones yielding to them. With only `hybrid` sources it goes to
2462
2465
  * the first on the same condition. Two pins declaring one path is a collision either way.
2466
+ *
2467
+ * A `vendor` source decides as a `linked` one does. It only ever offers what it declares, so
2468
+ * another link reaching a different entity at that path collides with it.
2463
2469
  */
2464
2470
  private declaringClaimant;
2465
2471
  /**
@@ -2483,6 +2489,18 @@ declare class Config {
2483
2489
  /** How `slug`'s source joins this config ({@link EntityKind.sourceType}): `linked` unless its pin
2484
2490
  * says otherwise. */
2485
2491
  sourceTypeOf(slug: string): SourceType;
2492
+ /**
2493
+ * The `vendor` pin the item at `kind:path` is drawn through: a row its declaration derived, or a ref
2494
+ * this config placed under a name of its own. `undefined` for anything else, including a row of
2495
+ * this config's own whose fields name the source.
2496
+ */
2497
+ /**
2498
+ * Refuse a write to a row a `vendor` pin draws. Its source is used as shipped, so even a write the
2499
+ * overlay would read as nothing (a `null` revealing the source's own value) is refused rather than
2500
+ * kept as an edit.
2501
+ */
2502
+ private refuseVendorEdit;
2503
+ vendorOf(kind: string, path: string): string | undefined;
2486
2504
  /**
2487
2505
  * Whether a value `slug` brings is drawn with this config's row at `kind:path` rather than declared
2488
2506
  * under the pin's own name: a token that something taken through `slug` names.
@@ -2490,7 +2508,8 @@ declare class Config {
2490
2508
  * A `hybrid` pin binds to any row here that isn't its own, authored or held through another pin, so
2491
2509
  * what it brings uses this config's values. A `linked` pin binds only to a row held through another
2492
2510
  * pin that is the same entity, the way {@link heldThroughAnotherPin} reads it; a different one there
2493
- * is a collision, and a row this config authored is its own entity under the same name.
2511
+ * is a collision, and a row this config authored is its own entity under the same name. A `vendor`
2512
+ * pin never binds: everything it brings is drawn from its own source.
2494
2513
  */
2495
2514
  drawsWithLocalRow({
2496
2515
  slug,
@@ -2631,6 +2650,9 @@ declare class Config {
2631
2650
  * Every guard the adopted targets pass through applies to these too — a name this config already
2632
2651
  * holds wins, an entry it cannot express is left behind — because
2633
2652
  * they join the same loop rather than being written directly.
2653
+ *
2654
+ * A `vendor` pin has none. What it declares is all that lands, and the rest is read through the
2655
+ * source under the pin's names.
2634
2656
  */
2635
2657
  private groupRefMembers;
2636
2658
  adoptedFrom(slug: string): string[];
@@ -241,7 +241,7 @@ function rejectCollisions(collisions) {
241
241
  throw new ConfigRejection([{
242
242
  code: "SOURCE_COLLISION",
243
243
  collisions,
244
- message: `This would leave ${collisions.length} ${one ? "path" : "paths"} offered by ${by} as different things, so neither applies: ${shown}${rest}. Take ${one ? "it" : "each"} from the system ${one ? "it" : "each"} should follow (\`source/link\` with \`onLinked: 'take'\`), or make the link that only reaches ${one ? "it" : "them"} \`hybrid\`, so it uses what this system already has.`
244
+ message: `This would leave ${collisions.length} ${one ? "path" : "paths"} offered by ${by} as different things, so neither applies: ${shown}${rest}. Take ${one ? "it" : "each"} from the system ${one ? "it" : "each"} should follow (\`source/link\` with \`onLinked: 'take'\`)${pins ? `, or make the link that only reaches ${one ? "it" : "them"} \`hybrid\`, so it uses what this system already has` : ""}.`
245
245
  }]);
246
246
  }
247
247
  /** The snapshot a derived snapshot came from, while the parent holds a row derivation the child has
@@ -788,6 +788,11 @@ var Config = class Config {
788
788
  withOwner(owner) {
789
789
  return this.derive({ owner });
790
790
  }
791
+ /** This config under an identity of its own. It answers what the receiver does, so a holder that
792
+ * keys a fact on the value (`registerModuleView`) can tag it and leave the receiver untagged. */
793
+ fork() {
794
+ return this.derive({});
795
+ }
791
796
  /** The pending edits with their ids — what a sink persists and `merge` names. */
792
797
  get pending() {
793
798
  return this.state.pending;
@@ -2207,6 +2212,7 @@ var Config = class Config {
2207
2212
  })]);
2208
2213
  if (patch.operation === "sub-create" || patch.operation === "sub-upsert" || patch.operation === "sub-update" || patch.operation === "sub-delete" || patch.operation === "sub-rename" || patch.operation === "sub-reorder") {
2209
2214
  if (extension) {
2215
+ this.at(snapshot).refuseVendorEdit(patch.kind, patch.path);
2210
2216
  const resolved = this.at(snapshot).resolveExtension({
2211
2217
  kind: patch.kind,
2212
2218
  path: patch.path,
@@ -2316,6 +2322,7 @@ var Config = class Config {
2316
2322
  }) : parsedDelta;
2317
2323
  const touched = touchedFields(delta, isField);
2318
2324
  if (extension) {
2325
+ this.at(snapshot).refuseVendorEdit(patch.kind, patch.path);
2319
2326
  const resolved = this.at(snapshot).resolveExtension({
2320
2327
  kind: patch.kind,
2321
2328
  path: patch.path,
@@ -2890,6 +2897,7 @@ var Config = class Config {
2890
2897
  ...classifyOverlay(local, theirs),
2891
2898
  ...existing?.hidden ? { hidden: true } : {}
2892
2899
  };
2900
+ if (view.sourceTypeOf(slug) === "vendor" && (overlay.override !== void 0 || overlay.extend !== void 0)) reject("UNSUPPORTED", `Cannot update ${kind} group "${path}" — it comes from the vendor source "${slug}", which is used as shipped.`);
2893
2901
  const data = view.directiveWrite({
2894
2902
  slug,
2895
2903
  accessor,
@@ -5081,6 +5089,9 @@ var Config = class Config {
5081
5089
  * A path no pin declares goes to the first `linked` source when every `linked` source holding it
5082
5090
  * reads the same entity, the `hybrid` ones yielding to them. With only `hybrid` sources it goes to
5083
5091
  * the first on the same condition. Two pins declaring one path is a collision either way.
5092
+ *
5093
+ * A `vendor` source decides as a `linked` one does. It only ever offers what it declares, so
5094
+ * another link reaching a different entity at that path collides with it.
5084
5095
  */
5085
5096
  declaringClaimant({ target, slugs, declaredBy }) {
5086
5097
  const declarers = slugs.filter((slug) => declaredBy.get(slug)?.has(target));
@@ -5093,7 +5104,7 @@ var Config = class Config {
5093
5104
  kind,
5094
5105
  path
5095
5106
  }));
5096
- const linked = slugs.filter((slug) => this.sourceTypeOf(slug) === "linked");
5107
+ const linked = slugs.filter((slug) => this.sourceTypeOf(slug) !== "hybrid");
5097
5108
  const [declarer] = declarers;
5098
5109
  if (declarer !== void 0) return agree(declarer, linked) ? declarer : void 0;
5099
5110
  const deciding = linked.length > 0 ? linked : slugs;
@@ -5184,20 +5195,44 @@ var Config = class Config {
5184
5195
  return "linked";
5185
5196
  }
5186
5197
  /**
5198
+ * The `vendor` pin the item at `kind:path` is drawn through: a row its declaration derived, or a ref
5199
+ * this config placed under a name of its own. `undefined` for anything else, including a row of
5200
+ * this config's own whose fields name the source.
5201
+ */
5202
+ /**
5203
+ * Refuse a write to a row a `vendor` pin draws. Its source is used as shipped, so even a write the
5204
+ * overlay would read as nothing (a `null` revealing the source's own value) is refused rather than
5205
+ * kept as an edit.
5206
+ */
5207
+ refuseVendorEdit(kind, path) {
5208
+ const slug = this.vendorOf(kind, path);
5209
+ if (slug === void 0) return;
5210
+ reject("UNSUPPORTED", `Cannot edit ${kind} "${path}" — it comes from the vendor source "${slug}", which is used as shipped. To change it, wrap it in a ${kind} of your own.`);
5211
+ }
5212
+ vendorOf(kind, path) {
5213
+ const stored = this.storedBody(kind, path);
5214
+ if (!isRef(stored)) return void 0;
5215
+ const slug = sourceOf(stored.__ref);
5216
+ return slug !== void 0 && this.sourceTypeOf(slug) === "vendor" ? slug : void 0;
5217
+ }
5218
+ /**
5187
5219
  * Whether a value `slug` brings is drawn with this config's row at `kind:path` rather than declared
5188
5220
  * under the pin's own name: a token that something taken through `slug` names.
5189
5221
  *
5190
5222
  * A `hybrid` pin binds to any row here that isn't its own, authored or held through another pin, so
5191
5223
  * what it brings uses this config's values. A `linked` pin binds only to a row held through another
5192
5224
  * pin that is the same entity, the way {@link heldThroughAnotherPin} reads it; a different one there
5193
- * is a collision, and a row this config authored is its own entity under the same name.
5225
+ * is a collision, and a row this config authored is its own entity under the same name. A `vendor`
5226
+ * pin never binds: everything it brings is drawn from its own source.
5194
5227
  */
5195
5228
  drawsWithLocalRow({ slug, kind, path }) {
5196
5229
  const stored = this.storedBody(kind, path);
5197
5230
  if (stored === void 0) return false;
5198
5231
  const held = isRef(stored) ? sourceOf(stored.__ref) : void 0;
5199
5232
  if (held === slug) return false;
5200
- if (this.sourceTypeOf(slug) === "hybrid") return true;
5233
+ const type = this.sourceTypeOf(slug);
5234
+ if (type === "vendor") return false;
5235
+ if (type === "hybrid") return true;
5201
5236
  if (!isMintedRow(stored) || held === void 0) return false;
5202
5237
  return this.sameEntityThrough({
5203
5238
  held,
@@ -5719,10 +5754,13 @@ var Config = class Config {
5719
5754
  * Every guard the adopted targets pass through applies to these too — a name this config already
5720
5755
  * holds wins, an entry it cannot express is left behind — because
5721
5756
  * they join the same loop rather than being written directly.
5757
+ *
5758
+ * A `vendor` pin has none. What it declares is all that lands, and the rest is read through the
5759
+ * source under the pin's names.
5722
5760
  */
5723
5761
  groupRefMembers(slug) {
5724
5762
  const source = this.sourceFor(slug);
5725
- if (!source) return [];
5763
+ if (!source || this.sourceTypeOf(slug) === "vendor") return [];
5726
5764
  const members = /* @__PURE__ */ new Set();
5727
5765
  /**
5728
5766
  * Every entity or folder visited, and whether a linked row reached it.
@@ -6605,7 +6643,7 @@ var Config = class Config {
6605
6643
  * links from the provided sources. A declared `linkedKind` with no provided source throws. */
6606
6644
  hydrateFrom(stored, options) {
6607
6645
  const claimed = schemaVersionOf(stored);
6608
- if (claimed > 20261112154943) throw new SchemaVersionTooNew(claimed);
6646
+ if (claimed > 20261112163439) throw new SchemaVersionTooNew(claimed);
6609
6647
  const wire = upgradeSerializedConfig(stored);
6610
6648
  if (!Array.isArray(wire.ownedKinds) || typeof wire.items !== "object" || wire.items === null) throw new ConfigFormatError(`Config "${stored.name ?? "system-config"}" cannot be hydrated: this is not a serialized config-v2 config (no "ownedKinds"/"items"). A pre-cutover build artifact converts through the registered cutover migration — import the config type's module (e.g. \`configs/system\`) before hydrating.`);
6611
6649
  const leftover = wire.options;
@@ -268,7 +268,9 @@ function compositePropRuleClasses(config, path) {
268
268
  const out = [];
269
269
  for (const [prop, groupRef, layer] of declared.groups) {
270
270
  const group = pathOf(groupRef);
271
- for (const composite of config.list("composite")) {
271
+ const slug = sourceOf(groupRef);
272
+ const holder = slug === void 0 || config.members("composite", group).length > 0 ? config : config.sourceFor(slug) ?? config;
273
+ for (const composite of holder.list("composite")) {
272
274
  if (!composite.path.startsWith(`${group}/`)) continue;
273
275
  const when = { [prop]: composite.path.slice(group.length + 1) };
274
276
  out.push({
@@ -1171,8 +1173,8 @@ function compositeBags(entity) {
1171
1173
  return [{ bag: entity.toJSON().styles }];
1172
1174
  }
1173
1175
  /**
1174
- * A token object that changes when the class VOCABULARY does — the style properties, and everything
1175
- * their value domains reach.
1176
+ * A token object that changes when the class VOCABULARY does — the style properties, everything
1177
+ * their value domains reach, and the settings, which hold the class prefix.
1176
1178
  *
1177
1179
  * `splitStyleProps` names a class by asking the config what a prop's leaves are, so a scan's answer
1178
1180
  * survives any edit that leaves those alone. Which is every edit to the entities being scanned.
@@ -1184,7 +1186,8 @@ const vocabularyToken = createSliceMemo({
1184
1186
  "composite",
1185
1187
  "motion",
1186
1188
  "icon",
1187
- "font"
1189
+ "font",
1190
+ "settings"
1188
1191
  ],
1189
1192
  compute: (_config) => ({})
1190
1193
  });
@@ -7,8 +7,16 @@ interface ModuleViewLink {
7
7
  readonly consumer: Config;
8
8
  readonly slug: string;
9
9
  }
10
+ /** Records that `view` is an owner's config as `link.consumer` converts its files. */
11
+ declare function registerModuleView({
12
+ view,
13
+ link
14
+ }: {
15
+ readonly view: Config;
16
+ readonly link: ModuleViewLink;
17
+ }): void;
10
18
  /** The consumer and pin `config` was built for, when it is a module view. A name it reads is its
11
19
  * owner's, and what that names is drawn as the consumer draws it. */
12
20
  declare function moduleViewOf(config: Config): ModuleViewLink | undefined;
13
21
  //#endregion
14
- export { ModuleViewLink, moduleViewOf };
22
+ export { ModuleViewLink, moduleViewOf, registerModuleView };
@@ -1,4 +1,4 @@
1
- import { declarationText, hasRefMarker, isRef, kindOf, memberOf, pathOf, ref, refLeaf, refOfKey, replaceRefMarkers, routedSource, sourceHops, sourceOf, splitRef, whenLeaves } from "./utils/refs.js";
1
+ import { declarationText, hasRefMarker, isRef, kindOf, memberOf, pathOf, qualifyRefs, ref, refLeaf, refOfKey, replaceRefMarkers, routedSource, sourceHops, sourceOf, splitRef, whenLeaves } from "./utils/refs.js";
2
2
  import { defaultsFor, holdingDefaultConditions } from "./default-conditions.js";
3
3
  import { evaluateCalc, isCalc, leadingNumber } from "../entities/system/calc.js";
4
4
  import { isOklchColor, renderOklch } from "../entities/system/color.js";
@@ -462,7 +462,8 @@ function expandMemberEntries(config, target, opts) {
462
462
  leaf: leafOf(member.path),
463
463
  path: member.path
464
464
  }));
465
- const ours = config.members(kind, path);
465
+ const vendor = config.sourceTypeOf(source) === "vendor";
466
+ const ours = config.members(kind, path).filter((member) => !vendor || member.source === source);
466
467
  const held = new Set(ours.map((member) => member.path));
467
468
  const covered = new Set(theirs.map((member) => member.path));
468
469
  return [...theirs.filter((member) => offered(held.has(member.path) ? config : owner, member.path)).map((member) => ({
@@ -1612,7 +1613,11 @@ function computeComponentProps(config, path, seen) {
1612
1613
  for (const [layer, entry] of Object.entries(forwardsOf(body))) {
1613
1614
  const element = body.layers?.[layer];
1614
1615
  if (!isRef(element)) continue;
1615
- const exposed = resolveComponentProps(config, pathOf(element.__ref), new Set(seen));
1616
+ const exposed = elementProps({
1617
+ config,
1618
+ element,
1619
+ seen: new Set(seen)
1620
+ });
1616
1621
  for (const [name, decl] of Object.entries(takenByForward({
1617
1622
  entry,
1618
1623
  exposed
@@ -1622,6 +1627,25 @@ function computeComponentProps(config, path, seen) {
1622
1627
  else merged[name] = prop;
1623
1628
  return merged;
1624
1629
  }
1630
+ /**
1631
+ * The props a layer's element exposes, as this config reads them.
1632
+ *
1633
+ * An element named through a pin (`primitives/Box@acme`, which a `vendor` link's component keeps) is
1634
+ * read in that pin's source, and what it exposes is qualified with the pin, so it reads here as the
1635
+ * source's own rather than as this config's entity of the same name, or as nothing where this config
1636
+ * has none.
1637
+ */
1638
+ function elementProps({ config, element, seen = /* @__PURE__ */ new Set() }) {
1639
+ const slug = sourceOf(element.__ref);
1640
+ if (slug === void 0) return resolveComponentProps(config, pathOf(element.__ref), seen);
1641
+ const owner = config.configFor(element);
1642
+ if (!owner) return {};
1643
+ return qualifyRefs({
1644
+ value: resolveComponentProps(owner, pathOf(element.__ref)),
1645
+ source: slug,
1646
+ owns: (kind) => owner.ownedKinds().includes(kind)
1647
+ });
1648
+ }
1625
1649
  /** The props a `forwards` entry takes from what its element exposes: `'*'` is the whole surface, a
1626
1650
  * list is an allowlist of the names it spells. A list never subtracts, which is what a `null` own
1627
1651
  * prop is for. */
@@ -1691,12 +1715,15 @@ function propValueDomain(config, decl) {
1691
1715
  if (decl.type === "styleProperty") {
1692
1716
  const target = domainRef();
1693
1717
  if (!target) return null;
1694
- const path = splitRef(target).qualifiedPath;
1695
- const leaves = stylePropValueLeaves(config, path);
1718
+ const local = splitRef(target).qualifiedPath;
1719
+ const here = config.resolve("style-property", local) !== void 0;
1720
+ const owner = here ? config : config.configFor(target) ?? config;
1721
+ const path = here ? local : pathOf(target);
1722
+ const leaves = stylePropValueLeaves(owner, path);
1696
1723
  if (leaves.length === 0) return null;
1697
1724
  return {
1698
1725
  leaves,
1699
- accepts: (v) => stylePropValueFromLeaf(config, path, v) !== void 0
1726
+ accepts: (v) => stylePropValueFromLeaf(owner, path, v) !== void 0
1700
1727
  };
1701
1728
  }
1702
1729
  if (decl.type === "composite") {
@@ -1738,6 +1765,17 @@ function glyphLibrariesOf(domain) {
1738
1765
  return (refListOf(domain) ?? (isRef(domain) ? [domain.__ref] : [])).filter((ref) => kindOf(ref) === "icon" && memberOf(ref) === void 0).map(pathOf);
1739
1766
  }
1740
1767
  /**
1768
+ * An icon library a component named through a pin draws from, as this config names it: the bare path
1769
+ * where the library's members are rows drawn through that pin, and the path qualified with the pin
1770
+ * (`phosphor@acme`) otherwise. A `vendor` link mints no row for a library its components draw from,
1771
+ * and a library of this config's own under the same name is a different one.
1772
+ */
1773
+ function libraryThroughPin({ config, slug, library }) {
1774
+ if (library.includes("@")) return library;
1775
+ const held = config.members("icon", library);
1776
+ return held.length > 0 && held.every((member) => member.source === slug) ? library : `${library}@${slug}`;
1777
+ }
1778
+ /**
1741
1779
  * The props of a component that hold a glyph, each mapped to the icon libraries that are its
1742
1780
  * domain, in declaration order (`{ name: ['phosphor'] }` for a component whose `name` declares
1743
1781
  * `Icon.ref('phosphor')`; two entries when it declares a list). A forward onto a layer component's
@@ -1776,10 +1814,18 @@ function glyphPropsOfBody({ config, body, seen = /* @__PURE__ */ new Set() }) {
1776
1814
  if (declaration?.type !== "forward" || !isRef(target) || kindOf(target) !== "layer") continue;
1777
1815
  const element = layers[pathOf(target)];
1778
1816
  if (!isRef(element) || kindOf(element) !== "component") continue;
1817
+ const slug = sourceOf(element.__ref);
1818
+ const owner = slug === void 0 ? config : config.configFor(element);
1819
+ if (!owner) continue;
1779
1820
  const receiver = pathOf(element);
1780
- if (seen.has(receiver)) continue;
1781
- const libraries = glyphPropsOf(config, receiver, seen)[forwardIntoName(declaration.into, prop)];
1782
- if (libraries) out[prop] = libraries;
1821
+ if (slug === void 0 && seen.has(receiver)) continue;
1822
+ const libraries = glyphPropsOf(owner, receiver, slug === void 0 ? seen : /* @__PURE__ */ new Set())[forwardIntoName(declaration.into, prop)];
1823
+ if (!libraries) continue;
1824
+ out[prop] = slug === void 0 ? libraries : libraries.map((library) => libraryThroughPin({
1825
+ config,
1826
+ slug,
1827
+ library
1828
+ }));
1783
1829
  }
1784
1830
  const [, rootElement] = rootLayerOf(layers);
1785
1831
  if (isRef(rootElement) && kindOf(rootElement) === "component") {
@@ -2274,4 +2320,4 @@ function declaredPropDefaults(props) {
2274
2320
  return out;
2275
2321
  }
2276
2322
  //#endregion
2277
- export { LAYER_PROPS, authoredBag, authoredValue, bodyNumberLeaves, bodyNumberUnit, className, cssPropValue, cssVar, cssVarRef, declarationKeyName, declaredPropDefaults, declaredPropRouting, declaresCssVariable, defaultSources, fontStackOf, glyphComponentOf, glyphLibrariesOf, glyphPropsOf, glyphPropsOfBody, heldLinked, holdingPreviewConditions, iconToolAxisOptions, iconToolFor, iconToolOf, iconToolsOf, isCustomPropertyKey, keyedPreviewConditions, layerPropsErrors, linkedDraw, linkedLocalRow, linkedVarNaming, literalValueOf, memberFromLeaf, memberLeaves, nameStyleNumbers, negatedCssValue, opacityPercentage, pinBodyStyleNumbers, pinStyleNumbers, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, propAcceptsValue, propOwner, propValueDomain, propValueFromAxis, refListOf, renderInterpolated, renderStyleValue, resolveComponentProps, resolveFieldValue, resolveTokenValue, resolveTokenValueUnder, rewriteStyleNumbers, routedBag, sourceVarPrefix, styleAliasesOf, styleDeclarationGroups, styleDeclarations, styleNumberAsPainted, styleNumberReadingChanges, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropNumberCss, stylePropNumberLeaf, stylePropNumberLeaves, stylePropNumberName, stylePropNumberNamedLeaves, stylePropNumberUnit, stylePropNumberUnitRefusal, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, takenByForward, tokenConditions, tokenReference, validateComponentProps };
2323
+ export { LAYER_PROPS, authoredBag, authoredValue, bodyNumberLeaves, bodyNumberUnit, className, cssPropValue, cssVar, cssVarRef, declarationKeyName, declaredPropDefaults, declaredPropRouting, declaresCssVariable, defaultSources, elementProps, fontStackOf, glyphComponentOf, glyphLibrariesOf, glyphPropsOf, glyphPropsOfBody, heldLinked, holdingPreviewConditions, iconToolAxisOptions, iconToolFor, iconToolOf, iconToolsOf, isCustomPropertyKey, keyedPreviewConditions, layerPropsErrors, libraryThroughPin, linkedDraw, linkedLocalRow, linkedVarNaming, literalValueOf, memberFromLeaf, memberLeaves, nameStyleNumbers, negatedCssValue, opacityPercentage, pinBodyStyleNumbers, pinStyleNumbers, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, propAcceptsValue, propOwner, propValueDomain, propValueFromAxis, refListOf, renderInterpolated, renderStyleValue, resolveComponentProps, resolveFieldValue, resolveTokenValue, resolveTokenValueUnder, rewriteStyleNumbers, routedBag, sourceVarPrefix, styleAliasesOf, styleDeclarationGroups, styleDeclarations, styleNumberAsPainted, styleNumberReadingChanges, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropNumberCss, stylePropNumberLeaf, stylePropNumberLeaves, stylePropNumberName, stylePropNumberNamedLeaves, stylePropNumberUnit, stylePropNumberUnitRefusal, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, takenByForward, tokenConditions, tokenReference, validateComponentProps };
@@ -174,6 +174,12 @@ declare function routesContent(config: Config, layers: Readonly<Record<string, u
174
174
  */
175
175
  declare function surfaceProps(config: Config, componentPath: string, /** Forwards already followed, so a routing loop terminates. Internal — callers pass nothing. */
176
176
  seen?: ReadonlySet<string>): SurfaceProp[];
177
+ /**
178
+ * The style-property props a component takes none of at its call site because a `vendor` pin draws
179
+ * it: its own and the ones a forwarded layer exposes. Its values are its source's, and a style prop
180
+ * passed to it would be read in this config's vocabulary. Empty for any other component.
181
+ */
182
+ declare function withheldStyleProps(config: Config, componentPath: string): readonly string[];
177
183
  /** One prop by name, or `undefined` when the component doesn't expose it. */
178
184
  declare function surfaceProp(config: Config, componentPath: string, name: string): SurfaceProp | undefined;
179
185
  /**
@@ -244,4 +250,4 @@ interface PropRoute {
244
250
  */
245
251
  declare function renderBindingsOf(config: Config, componentPath: string): PropRoute[];
246
252
  //#endregion
247
- export { BindingKind, CodeSlot, ForwardClaims, PropRoute, SurfaceCompositeProp, SurfaceProp, SurfacePropCondition, SurfacePropKind, SurfaceScalarProp, SurfaceSlotProp, SurfaceStylePropertyProp, SurfaceVariantProp, codeSlotsOf, forwardClaims, forwardRoutes, forwardedLayers, glyphVariantProp, intoName, isValueSlot, layerPropRoutes, ownTextProp, propApplies, propRegistryRef, renderBindingsOf, routedProp, routedPropIn, routesContent, slotCodeForms, standsInForCode, surfaceProp, surfaceProps };
253
+ export { BindingKind, CodeSlot, ForwardClaims, PropRoute, SurfaceCompositeProp, SurfaceProp, SurfacePropCondition, SurfacePropKind, SurfaceScalarProp, SurfaceSlotProp, SurfaceStylePropertyProp, SurfaceVariantProp, codeSlotsOf, forwardClaims, forwardRoutes, forwardedLayers, glyphVariantProp, intoName, isValueSlot, layerPropRoutes, ownTextProp, propApplies, propRegistryRef, renderBindingsOf, routedProp, routedPropIn, routesContent, slotCodeForms, standsInForCode, surfaceProp, surfaceProps, withheldStyleProps };
@@ -1,7 +1,8 @@
1
- import { isRef, kindOf, memberOf, pathOf, qualifyRefs, refLeaf, sourceOf } from "./utils/refs.js";
1
+ import { isRef, kindOf, memberOf, pathOf, ref, refLeaf, sourceOf } from "./utils/refs.js";
2
2
  import { forwardsOf, rootLayerOf } from "../entities/system/element.js";
3
+ import { moduleViewOf } from "./module-views.js";
3
4
  import { booleanValuesIn } from "./utils/enumerated.js";
4
- import { propValueDomain, refListOf, resolveComponentProps, takenByForward } from "./projections.js";
5
+ import { elementProps, libraryThroughPin, propValueDomain, refListOf, resolveComponentProps, takenByForward } from "./projections.js";
5
6
  import { layerOfElement, slotHostLayer } from "./slot-host.js";
6
7
  import { Component } from "../entities/system/Component.js";
7
8
  //#region src/framework/prop-surface.ts
@@ -95,6 +96,63 @@ function propApplies(prop, values) {
95
96
  function refPath(value) {
96
97
  return isRef(value) ? pathOf(value.__ref) : void 0;
97
98
  }
99
+ /**
100
+ * A prop surfaced at a route's far end, named for this config. Through a pin (`primitives/Icon@acme`)
101
+ * the far end is the source's, so the icon libraries its value is drawn from are named as this config
102
+ * reaches them ({@link libraryThroughPin}).
103
+ */
104
+ function throughPin({ config, prop, layers, decl }) {
105
+ const element = layers?.[refPath(decl.target) ?? ""];
106
+ const slug = isRef(element) ? sourceOf(element.__ref) : void 0;
107
+ const libraries = prop.iconLibraries;
108
+ if (slug === void 0 || !libraries) return prop;
109
+ return {
110
+ ...prop,
111
+ iconLibraries: libraries.map((library) => libraryThroughPin({
112
+ config,
113
+ slug,
114
+ library
115
+ }))
116
+ };
117
+ }
118
+ /** The cycle guard's key for a route's far end: `Pressable#tone`, or `Icon@acme#name` through a pin. */
119
+ function routeKey({ named, prop }) {
120
+ const slug = sourceOf(named.__ref);
121
+ const path = pathOf(named.__ref);
122
+ return `${slug === void 0 ? path : `${path}@${slug}`}#${prop}`;
123
+ }
124
+ /**
125
+ * The component a route's far end names, and the config that holds it. One named through a pin
126
+ * (`primitives/Icon@acme`, which a `vendor` link's component keeps) is the pin's source's, read by its
127
+ * own path there, since this config may have no component at that path or a different one.
128
+ */
129
+ function farEnd(config, named) {
130
+ const path = pathOf(named.__ref);
131
+ const slug = sourceOf(named.__ref);
132
+ if (slug === void 0) return {
133
+ config,
134
+ path
135
+ };
136
+ const owner = config.configFor(ref(Component.kind, path, slug));
137
+ return owner ? {
138
+ config: owner,
139
+ path
140
+ } : void 0;
141
+ }
142
+ /**
143
+ * A composite prop's group as this config reads it: the bare path where the group's members are rows
144
+ * drawn through the pin the ref names, and the path qualified with that pin (`surface@acme`)
145
+ * otherwise. A `vendor` link's component reaches its groups only through its pin, and a group of this
146
+ * config's own under the same name is a different one.
147
+ */
148
+ function compositeNameOf(config, value) {
149
+ if (!isRef(value)) return void 0;
150
+ const path = pathOf(value.__ref);
151
+ const slug = sourceOf(value.__ref);
152
+ if (slug === void 0) return path;
153
+ const held = config.members(kindOf(value.__ref), path);
154
+ return held.length > 0 && held.every((member) => member.source === slug) ? path : `${path}@${slug}`;
155
+ }
98
156
  /** Every ref in an `accepts` declaration (one, or a list). */
99
157
  function acceptsRefs(accepts) {
100
158
  return (Array.isArray(accepts) ? accepts : [accepts]).filter(isRef).map((ref) => ref.__ref);
@@ -159,15 +217,10 @@ function routedPropIn(config, layers, decl) {
159
217
  if (!layerKey) return void 0;
160
218
  const element = layers?.[layerKey];
161
219
  if (!isRef(element) || kindOf(element) !== "component") return void 0;
162
- const owner = config.configFor(element);
163
- if (!owner) return void 0;
164
- const landed = resolveComponentProps(owner, pathOf(element))[intoName(decl.into)];
165
- const source = sourceOf(element);
166
- return source === void 0 ? landed : qualifyRefs({
167
- value: landed,
168
- source,
169
- owns: (kind) => owner.ownedKinds().includes(kind)
170
- });
220
+ return elementProps({
221
+ config,
222
+ element
223
+ })[intoName(decl.into)];
171
224
  }
172
225
  /** {@link routedPropIn} for a component the config already holds. The layers are what the resolution
173
226
  * needs; a path is the convenience for a caller that has one instead. */
@@ -236,15 +289,23 @@ function routeEnd(config, layers, decl, seen = /* @__PURE__ */ new Set()) {
236
289
  route: decl
237
290
  };
238
291
  const layerKey = refPath(decl.target);
239
- const target = layerKey ? refPath(layers?.[layerKey]) : void 0;
240
- if (!target) return {
292
+ const element = layerKey ? layers?.[layerKey] : void 0;
293
+ if (!isRef(element)) return {
241
294
  decl: landed,
242
295
  route: decl
243
296
  };
244
- const key = `${target}#${intoName(decl.into)}`;
297
+ const far = farEnd(config, element);
298
+ if (!far) return {
299
+ decl: landed,
300
+ route: decl
301
+ };
302
+ const key = routeKey({
303
+ named: element,
304
+ prop: intoName(decl.into)
305
+ });
245
306
  if (seen.has(key)) return void 0;
246
- const farLayers = (Component.get(config, target)?.toJSON())?.layers;
247
- return routeEnd(config, farLayers, landed, new Set([...seen, key]));
307
+ const farLayers = (Component.get(far.config, far.path)?.toJSON())?.layers;
308
+ return routeEnd(far.config, farLayers, landed, new Set([...seen, key]));
248
309
  }
249
310
  function slotProp(config, componentPath, name, decl) {
250
311
  if (isValueSlot(decl)) {
@@ -283,7 +344,7 @@ function slotProp(config, componentPath, name, decl) {
283
344
  ...icons.length > 0 ? { acceptsIconLibraries: icons } : {},
284
345
  ...routedKind ? { valueKind: routedKind } : {},
285
346
  ...routed ? { valueOptions: propValueDomain(config, routed)?.leaves } : {},
286
- ...routedKind === "composite" ? { compositeName: refPath(routed?.value) } : {}
347
+ ...routedKind === "composite" ? { compositeName: compositeNameOf(config, routed?.value) } : {}
287
348
  };
288
349
  }
289
350
  const surfaces = /* @__PURE__ */ new WeakMap();
@@ -295,16 +356,44 @@ const surfaces = /* @__PURE__ */ new WeakMap();
295
356
  * what a component accepts; a caller with no editor for it can fall back to a generic one.
296
357
  */
297
358
  function surfaceProps(config, componentPath, seen = /* @__PURE__ */ new Set()) {
298
- let cache;
299
- if (seen.size === 0) {
300
- cache = surfaces.get(config);
301
- if (!cache) {
302
- cache = /* @__PURE__ */ new Map();
303
- surfaces.set(config, cache);
304
- }
305
- const cached = cache.get(componentPath);
306
- if (cached) return cached;
359
+ if (seen.size > 0) return collectSurfaceProps(config, componentPath, seen);
360
+ let cache = surfaces.get(config);
361
+ if (!cache) {
362
+ cache = /* @__PURE__ */ new Map();
363
+ surfaces.set(config, cache);
307
364
  }
365
+ const cached = cache.get(componentPath);
366
+ if (cached) return cached;
367
+ const all = collectSurfaceProps(config, componentPath, seen);
368
+ const props = drawnByVendor(config, componentPath) ? all.filter((prop) => prop.kind !== "styleProperty") : all;
369
+ cache.set(componentPath, props);
370
+ return props;
371
+ }
372
+ const NO_NAMES = [];
373
+ /**
374
+ * The style-property props a component takes none of at its call site because a `vendor` pin draws
375
+ * it: its own and the ones a forwarded layer exposes. Its values are its source's, and a style prop
376
+ * passed to it would be read in this config's vocabulary. Empty for any other component.
377
+ */
378
+ function withheldStyleProps(config, componentPath) {
379
+ if (!drawnByVendor(config, componentPath)) return NO_NAMES;
380
+ return collectSurfaceProps(config, componentPath, /* @__PURE__ */ new Set()).filter((prop) => prop.kind === "styleProperty").map((prop) => prop.name);
381
+ }
382
+ /**
383
+ * Whether a `vendor` pin draws the component at `componentPath`: a row of this config's, or, read in a
384
+ * module view (the source's own config, as a consumer converts its files), one the consumer takes.
385
+ */
386
+ function drawnByVendor(config, componentPath) {
387
+ if (config.vendorOf(Component.kind, componentPath) !== void 0) return true;
388
+ const view = moduleViewOf(config);
389
+ if (view?.consumer.sourceTypeOf(view.slug) !== "vendor") return false;
390
+ const taken = `${Component.kind}:${componentPath}@${view.slug}`;
391
+ return view.consumer.list(Component.kind).some((item) => {
392
+ const stored = view.consumer.storedBody(Component.kind, item.path);
393
+ return isRef(stored) && stored.__ref === taken;
394
+ });
395
+ }
396
+ function collectSurfaceProps(config, componentPath, seen) {
308
397
  const declared = resolveComponentProps(config, componentPath);
309
398
  const layers = (Component.get(config, componentPath)?.toJSON())?.layers;
310
399
  const props = [];
@@ -318,7 +407,12 @@ function surfaceProps(config, componentPath, seen = /* @__PURE__ */ new Set()) {
318
407
  }
319
408
  const routed = boundProp(config, layers, decl, seen);
320
409
  if (routed) props.push(conditioned({
321
- ...routed,
410
+ ...throughPin({
411
+ config,
412
+ prop: routed,
413
+ layers,
414
+ decl
415
+ }),
322
416
  name,
323
417
  required
324
418
  }, when));
@@ -353,7 +447,7 @@ function surfaceProps(config, componentPath, seen = /* @__PURE__ */ new Set()) {
353
447
  continue;
354
448
  }
355
449
  if (decl.type === "composite") {
356
- const compositeName = refPath(decl.value);
450
+ const compositeName = compositeNameOf(config, decl.value);
357
451
  if (!compositeName) continue;
358
452
  props.push(conditioned({
359
453
  name,
@@ -369,7 +463,6 @@ function surfaceProps(config, componentPath, seen = /* @__PURE__ */ new Set()) {
369
463
  required
370
464
  }, when));
371
465
  }
372
- cache?.set(componentPath, props);
373
466
  return props;
374
467
  }
375
468
  /**
@@ -391,15 +484,22 @@ function boundProp(config, layers, decl, seen) {
391
484
  kind: "string",
392
485
  required: false
393
486
  };
394
- const target = isRef(decl.into) ? pathOf(decl.into) : refPath(element);
395
- if (!target) return typeof element === "string" ? undeclared : void 0;
396
- const key = `${target}#${propName}`;
487
+ let named;
488
+ if (isRef(decl.into)) named = decl.into;
489
+ else if (isRef(element)) named = element;
490
+ if (!named) return typeof element === "string" ? undeclared : void 0;
491
+ const end = farEnd(config, named);
492
+ if (!end) return void 0;
493
+ const key = routeKey({
494
+ named,
495
+ prop: propName
496
+ });
397
497
  if (seen.has(key)) return void 0;
398
- const far = surfaceProps(config, target, new Set([...seen, key])).find((prop) => prop.name === propName);
498
+ const far = surfaceProps(end.config, end.path, new Set([...seen, key])).find((prop) => prop.name === propName);
399
499
  if (far) return far;
400
- const farBody = Component.get(config, target)?.toJSON();
500
+ const farBody = Component.get(end.config, end.path)?.toJSON();
401
501
  if (!farBody) return void 0;
402
- return propName in resolveComponentProps(config, target) || propName in (farBody.props ?? {}) ? void 0 : undeclared;
502
+ return propName in resolveComponentProps(end.config, end.path) || propName in (farBody.props ?? {}) ? void 0 : undeclared;
403
503
  }
404
504
  /** One prop by name, or `undefined` when the component doesn't expose it. */
405
505
  function surfaceProp(config, componentPath, name) {
@@ -470,7 +570,10 @@ function computeForwardClaims(config, componentPath) {
470
570
  if (!isRef(element)) continue;
471
571
  const taken = takenByForward({
472
572
  entry,
473
- exposed: resolveComponentProps(config, pathOf(element.__ref))
573
+ exposed: elementProps({
574
+ config,
575
+ element
576
+ })
474
577
  });
475
578
  for (const name of Object.keys(taken)) {
476
579
  if (own.has(name)) continue;
@@ -583,4 +686,4 @@ function renderBoundProp(value) {
583
686
  return name.length > 0 && !name.includes("/") ? name : void 0;
584
687
  }
585
688
  //#endregion
586
- export { carriesContent, codeSlotsOf, forwardClaims, forwardRoutes, forwardedLayers, glyphVariantProp, intoName, isValueSlot, layerPropRoutes, ownTextProp, propApplies, propRegistryRef, renderBindingsOf, renderBoundProp, routeEnd, routedProp, routedPropIn, routesContent, routesIntoText, slotCodeForms, standsInForCode, surfaceProp, surfaceProps };
689
+ export { carriesContent, codeSlotsOf, forwardClaims, forwardRoutes, forwardedLayers, glyphVariantProp, intoName, isValueSlot, layerPropRoutes, ownTextProp, propApplies, propRegistryRef, renderBindingsOf, renderBoundProp, routeEnd, routedProp, routedPropIn, routesContent, routesIntoText, slotCodeForms, standsInForCode, surfaceProp, surfaceProps, withheldStyleProps };