@yahoo/uds-create-cli 5.77.2 → 5.79.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.
@@ -10769,14 +10769,14 @@ var require_lib = __commonJS({
10769
10769
  };
10770
10770
  var mixinPluginNames = Object.keys(mixinPlugins);
10771
10771
  var ExpressionParser = class extends LValParser {
10772
- checkProto(prop, isRecord3, sawProto, refExpressionErrors) {
10772
+ checkProto(prop, isRecord4, sawProto, refExpressionErrors) {
10773
10773
  if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) {
10774
10774
  return sawProto;
10775
10775
  }
10776
10776
  const key2 = prop.key;
10777
10777
  const name = key2.type === "Identifier" ? key2.name : key2.value;
10778
10778
  if (name === "__proto__") {
10779
- if (isRecord3) {
10779
+ if (isRecord4) {
10780
10780
  this.raise(Errors.RecordNoProto, key2);
10781
10781
  return true;
10782
10782
  }
@@ -11834,8 +11834,8 @@ var require_lib = __commonJS({
11834
11834
  parseTemplateSubstitution() {
11835
11835
  return this.parseExpression();
11836
11836
  }
11837
- parseObjectLike(close, isPattern, isRecord3, refExpressionErrors) {
11838
- if (isRecord3) {
11837
+ parseObjectLike(close, isPattern, isRecord4, refExpressionErrors) {
11838
+ if (isRecord4) {
11839
11839
  this.expectPlugin("recordAndTuple");
11840
11840
  }
11841
11841
  const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
@@ -11860,9 +11860,9 @@ var require_lib = __commonJS({
11860
11860
  prop = this.parseBindingProperty();
11861
11861
  } else {
11862
11862
  prop = this.parsePropertyDefinition(refExpressionErrors);
11863
- sawProto = this.checkProto(prop, isRecord3, sawProto, refExpressionErrors);
11863
+ sawProto = this.checkProto(prop, isRecord4, sawProto, refExpressionErrors);
11864
11864
  }
11865
- if (isRecord3 && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
11865
+ if (isRecord4 && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
11866
11866
  this.raise(Errors.InvalidRecordProperty, prop);
11867
11867
  }
11868
11868
  if (prop.shorthand) {
@@ -11875,7 +11875,7 @@ var require_lib = __commonJS({
11875
11875
  let type = "ObjectExpression";
11876
11876
  if (isPattern) {
11877
11877
  type = "ObjectPattern";
11878
- } else if (isRecord3) {
11878
+ } else if (isRecord4) {
11879
11879
  type = "RecordExpression";
11880
11880
  }
11881
11881
  return this.finishNode(node2, type);
@@ -63709,12 +63709,17 @@ function partializeShape(shape2, keep) {
63709
63709
  }
63710
63710
  let inner = field;
63711
63711
  let description = inner.description;
63712
+ let deprecated = inner.meta()?.deprecated === true;
63712
63713
  while (inner instanceof external_exports.ZodOptional || inner instanceof external_exports.ZodDefault) {
63713
63714
  inner = inner.unwrap();
63714
63715
  description ??= inner.description;
63716
+ deprecated ||= inner.meta()?.deprecated === true;
63715
63717
  }
63716
63718
  const delta = inner.nullable().optional();
63717
- out[key2] = description ? delta.describe(description) : delta;
63719
+ out[key2] = description || deprecated ? delta.meta({
63720
+ ...description ? { description } : {},
63721
+ ...deprecated ? { deprecated } : {}
63722
+ }) : delta;
63718
63723
  }
63719
63724
  return out;
63720
63725
  }
@@ -64668,7 +64673,7 @@ function defaultSchemas(kind, declaredFields, groupFields, subEntities, { single
64668
64673
  * design, so `update` can never dissolve one. `create` refuses an occupied path, and
64669
64674
  * delete-then-create is refused by any referrer and drops the item to the end of its collection.
64670
64675
  *
64671
- * So this exists for edits that are a whole body by nature: a `linked-system/copy` landing the
64676
+ * So this exists for edits that are a whole body by nature: a `source/copy` landing the
64672
64677
  * literal a pointer stood for, or a `link` turning a row of yours into an extension through a pin
64673
64678
  * — one state replacing another rather than a field changing.
64674
64679
  *
@@ -65160,7 +65165,7 @@ function titleCase(kind) {
65160
65165
  return kind.split(/[-_]/).filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
65161
65166
  }
65162
65167
  function buildKind(spec2) {
65163
- const { name, prepareLinkedBody, rebaseLinkedBody, layerKeys, fields, groupFields, subEntities = {}, computed, label, labelPlural, schemas: userSchemas, derived, sourceIdentity, sourceOrigin, authoredRefs, linkable, localGroupFields, emergentGroups, singleton = false, bareMember, sourceResolution, bulkAdopts, bulkExcludes, bulkOverlay, bulkDirectives, bulkOverlayWrite, nameEdges, rewriteName, styleBags, uniqueLeaves, parts, authoredValue: authoredValue2, mentionFields, invariants, structuralBody, authoredBody, authoredAt, sourceType, answeredHere } = spec2;
65168
+ const { name, prepareLinkedBody, rebaseLinkedBody, layerKeys, fields, groupFields, subEntities = {}, computed, label, labelPlural, schemas: userSchemas, derived, sourceIdentity, sourceOrigin, authoredRefs, linkable, localGroupFields, emergentGroups, singleton = false, bareMember, sourceResolution, bulkAdopts, bulkExcludes, bulkOverlay, bulkDirectives, bulkOverlayWrite, nameEdges, rewriteName, styleBags, uniqueLeaves, parts, authoredValue: authoredValue2, mentionFields, invariants, structuralBody, authoredBody, retiredFields, retiredKinds, sourceType, answeredHere } = spec2;
65164
65169
  const allComputed = {
65165
65170
  sources: ({ member, config: config2 }) => sourceSlugs(member, config2),
65166
65171
  borrowedFrom: ({ config: config2, path: path2 }) => config2.borrowedFrom(name, path2),
@@ -65215,7 +65220,8 @@ function buildKind(spec2) {
65215
65220
  ...invariants ? { invariants } : {},
65216
65221
  ...structuralBody ? { structuralBody } : {},
65217
65222
  ...authoredBody ? { authoredBody } : {},
65218
- ...authoredAt ? { authoredAt } : {},
65223
+ ...retiredFields ? { retiredFields } : {},
65224
+ ...retiredKinds?.length ? { retiredKinds } : {},
65219
65225
  ...sourceType ? { sourceType } : {},
65220
65226
  ...answeredHere ? { answeredHere: true } : {}
65221
65227
  };
@@ -65355,7 +65361,8 @@ function defineEntity(spec2) {
65355
65361
  invariants: spec2.invariants,
65356
65362
  structuralBody: spec2.structuralBody,
65357
65363
  authoredBody: spec2.authoredBody,
65358
- authoredAt: spec2.authoredAt,
65364
+ retiredFields: spec2.retiredFields,
65365
+ retiredKinds: spec2.retiredKinds,
65359
65366
  sourceType: spec2.sourceType,
65360
65367
  answeredHere: spec2.answeredHere
65361
65368
  });
@@ -81117,7 +81124,7 @@ var resolvePlacements = createSliceMemo({
81117
81124
  kinds: [
81118
81125
  "component",
81119
81126
  "motion",
81120
- "linked-system"
81127
+ "source"
81121
81128
  ],
81122
81129
  compute: (config2) => {
81123
81130
  const out = [];
@@ -81149,7 +81156,7 @@ var cssMotionVariantGroups = createSliceMemo({
81149
81156
  kinds: [
81150
81157
  "component",
81151
81158
  "motion",
81152
- "linked-system"
81159
+ "source"
81153
81160
  ],
81154
81161
  compute: (config2) => variantGroupsOf({
81155
81162
  config: config2,
@@ -81160,7 +81167,7 @@ var resolveExits = createSliceMemo({
81160
81167
  kinds: [
81161
81168
  "component",
81162
81169
  "motion",
81163
- "linked-system"
81170
+ "source"
81164
81171
  ],
81165
81172
  compute: (config2) => {
81166
81173
  const out = [];
@@ -81200,7 +81207,7 @@ var resolveSwapped = createSliceMemo({
81200
81207
  kinds: [
81201
81208
  "component",
81202
81209
  "motion",
81203
- "linked-system"
81210
+ "source"
81204
81211
  ],
81205
81212
  compute: (config2) => {
81206
81213
  const links2 = swappingLinks(config2);
@@ -81216,10 +81223,10 @@ var resolveSwapped = createSliceMemo({
81216
81223
  }
81217
81224
  });
81218
81225
  var resolveLinkedSwaps = createSliceMemo({
81219
- kinds: ["linked-system", "motion"],
81226
+ kinds: ["source", "motion"],
81220
81227
  compute: (config2) => {
81221
81228
  const out = [];
81222
- for (const link2 of config2.list("linked-system")) {
81229
+ for (const link2 of config2.list("source")) {
81223
81230
  const { options } = link2.toJSON();
81224
81231
  for (const [preset, entry] of Object.entries(options?.motion ?? {})) {
81225
81232
  if (!isPlainObject(entry)) continue;
@@ -81580,7 +81587,7 @@ var placedMotions = createSliceMemo({
81580
81587
  kinds: [
81581
81588
  "component",
81582
81589
  "motion",
81583
- "linked-system"
81590
+ "source"
81584
81591
  ],
81585
81592
  compute: (config2) => {
81586
81593
  const out = [];
@@ -81608,7 +81615,7 @@ var motionVariantGroups = createSliceMemo({
81608
81615
  kinds: [
81609
81616
  "component",
81610
81617
  "motion",
81611
- "linked-system"
81618
+ "source"
81612
81619
  ],
81613
81620
  compute: (config2) => variantGroupsOf({
81614
81621
  config: config2,
@@ -89954,7 +89961,7 @@ function renderSignature(schema, options = {}) {
89954
89961
  return typeof node2.type === "string" ? node2.type : "unknown";
89955
89962
  };
89956
89963
  const renderObject = (node2, remaining) => {
89957
- const entries = Object.entries(node2.properties ?? {});
89964
+ const entries = Object.entries(node2.properties ?? {}).filter(([, value]) => value.deprecated !== true);
89958
89965
  if (entries.length === 1 && entries[0]?.[0] === "__ref") return "ref";
89959
89966
  if (entries.length === 0) {
89960
89967
  if (isNode(node2.additionalProperties)) {
@@ -90445,39 +90452,6 @@ function titleOf(config2, op) {
90445
90452
  return `${op.label} ${noun}`;
90446
90453
  }
90447
90454
 
90448
- // ../config/dist/framework/authored-at.js
90449
- function valueAt3(body, segments) {
90450
- let at = body;
90451
- for (const segment of segments) {
90452
- if (!isPlainObject(at) || !Object.hasOwn(at, segment)) return void 0;
90453
- at = at[segment];
90454
- }
90455
- return at;
90456
- }
90457
- function without(body, segments) {
90458
- const [head, ...rest] = segments;
90459
- if (head === void 0 || !Object.hasOwn(body, head)) return body;
90460
- const { [head]: child, ...others } = body;
90461
- if (rest.length === 0) return others;
90462
- if (!isPlainObject(child)) return body;
90463
- const remaining = without(child, rest);
90464
- return Object.keys(remaining).length === 0 ? others : {
90465
- ...others,
90466
- [head]: remaining
90467
- };
90468
- }
90469
- function storedFromAuthored({ body, authoredAt }) {
90470
- let stored = body;
90471
- for (const [field, at] of Object.entries(authoredAt)) {
90472
- const segments = at.split(".");
90473
- const value = valueAt3(stored, segments);
90474
- if (value === void 0) continue;
90475
- if (stored[field] !== void 0) rejectData(`\`${at}\` and \`${field}\` are one value, so a body sets only one of them. \`${field}\` is the deprecated spelling.`, segments);
90476
- stored = setAtPath(without(stored, segments), [field], value);
90477
- }
90478
- return stored;
90479
- }
90480
-
90481
90455
  // ../config/dist/framework/authoring.js
90482
90456
  function isAuthored(value) {
90483
90457
  if (typeof value !== "object" && typeof value !== "function") return false;
@@ -90604,7 +90578,7 @@ var Entity = class {
90604
90578
  };
90605
90579
 
90606
90580
  // ../config/dist/framework/schema-version.js
90607
- var CURRENT_SCHEMA_VERSION = 20261104151013;
90581
+ var CURRENT_SCHEMA_VERSION = 20261105185042;
90608
90582
  var SETTINGS_AS_KIND_VERSION = 20260908171448;
90609
90583
  var SchemaVersionTooNew = class extends ConfigFormatError {
90610
90584
  found;
@@ -90624,7 +90598,7 @@ function registerSchemaMigrations(...migrations) {
90624
90598
  for (const migration of migrations) {
90625
90599
  if (migration.version !== 1 && !isMintTimestamp(migration.version)) throw new Error(`Schema migration version ${migration.version} is not a mint timestamp \u2014 mint one with \`date +%Y%m%d%H%M%S\`, like a supabase migration.`);
90626
90600
  if (REGISTERED.has(migration.version)) throw new Error(`A schema migration at version ${migration.version} is already registered.`);
90627
- if (migration.version > 20261104151013) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) \u2014 a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
90601
+ if (migration.version > 20261105185042) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) \u2014 a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
90628
90602
  REGISTERED.set(migration.version, migration);
90629
90603
  }
90630
90604
  }
@@ -90655,7 +90629,7 @@ function pendingFor(version2, target2, options) {
90655
90629
  return [...(options?.migrations ?? REGISTERED).values()].filter((m) => m.version > version2 && m.version <= target2).sort((a, b) => a.version - b.version);
90656
90630
  }
90657
90631
  function upgradeSerializedConfig(json2, options) {
90658
- const target2 = options?.target ?? 20261104151013;
90632
+ const target2 = options?.target ?? 20261105185042;
90659
90633
  const version2 = detectedWireVersion(json2);
90660
90634
  if (version2 > target2) throw new SchemaVersionTooNew(version2, target2);
90661
90635
  const raw = json2;
@@ -90720,6 +90694,115 @@ function stamp(patch, id = crypto.randomUUID(), changeset) {
90720
90694
  } : stamped;
90721
90695
  }
90722
90696
 
90697
+ // ../config/dist/framework/retired-fields.js
90698
+ function valueAt3(body, segments) {
90699
+ let at = body;
90700
+ for (const segment of segments) {
90701
+ if (!isPlainObject(at) || !Object.hasOwn(at, segment)) return void 0;
90702
+ at = at[segment];
90703
+ }
90704
+ return at;
90705
+ }
90706
+ function without(body, segments) {
90707
+ const [head, ...rest] = segments;
90708
+ if (head === void 0 || !Object.hasOwn(body, head)) return body;
90709
+ const { [head]: child, ...others } = body;
90710
+ if (rest.length === 0) return others;
90711
+ if (!isPlainObject(child)) return body;
90712
+ const remaining = without(child, rest);
90713
+ return Object.keys(remaining).length === 0 ? others : {
90714
+ ...others,
90715
+ [head]: remaining
90716
+ };
90717
+ }
90718
+ function refuseBoth({ retired, current }) {
90719
+ rejectData(`\`${current}\` and \`${retired}\` are one value, so they can't both be set. \`${retired}\` is the deprecated spelling.`, current.split("."));
90720
+ }
90721
+ function foldRetiredFields({ body, retired }) {
90722
+ let folded = body;
90723
+ for (const [old, current] of Object.entries(retired)) {
90724
+ const from = old.split(".");
90725
+ const value = valueAt3(folded, from);
90726
+ if (value === void 0 || value === null) continue;
90727
+ const to = current.split(".");
90728
+ if (valueAt3(folded, to) !== void 0) refuseBoth({
90729
+ retired: old,
90730
+ current
90731
+ });
90732
+ folded = setAtPath(without(folded, from), to, value);
90733
+ }
90734
+ return folded;
90735
+ }
90736
+ function deltaUnderCurrentFields({ delta, retired }) {
90737
+ const renamed = (key2) => {
90738
+ for (const [old, current] of Object.entries(retired)) {
90739
+ if (key2 === old) return current;
90740
+ if (key2.startsWith(`${old}.`)) return `${current}${key2.slice(old.length)}`;
90741
+ }
90742
+ return key2;
90743
+ };
90744
+ if (!Object.keys(delta).some((key2) => renamed(key2) !== key2)) return delta;
90745
+ const out = {};
90746
+ for (const [key2, value] of Object.entries(delta)) {
90747
+ const to = renamed(key2);
90748
+ if (to !== key2 && Object.hasOwn(delta, to)) refuseBoth({
90749
+ retired: key2,
90750
+ current: to
90751
+ });
90752
+ out[to] = value;
90753
+ }
90754
+ return out;
90755
+ }
90756
+ function keptThroughContainerWrite({ delta, retired, stored }) {
90757
+ if (!stored) return delta;
90758
+ let kept = delta;
90759
+ for (const [old, current] of Object.entries(retired)) {
90760
+ const [container, ...inside] = current.split(".");
90761
+ if (container === void 0 || inside.length === 0) continue;
90762
+ if (!Object.hasOwn(kept, container)) continue;
90763
+ const names = (path2) => Object.keys(kept).some((key2) => key2 === path2 || key2.startsWith(`${path2}.`));
90764
+ if (names(old) || names(current)) continue;
90765
+ const value = valueAt3(stored, current.split("."));
90766
+ if (value === void 0) continue;
90767
+ const written = kept[container];
90768
+ if (written !== null && !isPlainObject(written)) continue;
90769
+ if (isPlainObject(written) && valueAt3(written, inside) !== void 0) continue;
90770
+ kept = {
90771
+ ...kept,
90772
+ [container]: setAtPath(isPlainObject(written) ? written : {}, inside, value)
90773
+ };
90774
+ }
90775
+ return kept;
90776
+ }
90777
+ function withEmptiedContainersCleared({ delta, retired, stored }) {
90778
+ if (!stored) return delta;
90779
+ let cleared = delta;
90780
+ for (const current of Object.values(retired)) {
90781
+ const [container, ...inside] = current.split(".");
90782
+ if (container === void 0 || inside.length === 0) continue;
90783
+ if (cleared[current] !== null || Object.hasOwn(cleared, container)) continue;
90784
+ if (Object.keys(cleared).some((key2) => key2 !== current && key2.startsWith(`${container}.`))) continue;
90785
+ const held = stored[container];
90786
+ if (!isPlainObject(held) || Object.keys(without(held, inside)).length > 0) continue;
90787
+ cleared = {
90788
+ ...cleared,
90789
+ [container]: null
90790
+ };
90791
+ }
90792
+ return cleared;
90793
+ }
90794
+ function withoutClearsInsideClears({ delta, retired }) {
90795
+ let applied3 = delta;
90796
+ for (const current of Object.values(retired)) {
90797
+ const [container] = current.split(".");
90798
+ if (container === void 0 || container === current) continue;
90799
+ if (applied3[container] !== null || applied3[current] !== null) continue;
90800
+ const { [current]: _inside, ...rest } = applied3;
90801
+ applied3 = rest;
90802
+ }
90803
+ return applied3;
90804
+ }
90805
+
90723
90806
  // ../config/dist/framework/ref-graph.js
90724
90807
  var key = (target2) => isRef2(target2) ? target2.__ref : target2;
90725
90808
  function edgesOf(ref2, data, extra = [], linkKinds = [], singletonKinds = []) {
@@ -91475,6 +91558,7 @@ function nameEdgeReaders(entities) {
91475
91558
  for (const [kind, entry] of entities) if (entry.nameEdges) readers.set(kind, entry.nameEdges);
91476
91559
  return readers;
91477
91560
  }
91561
+ var retiredKindsByEntities = /* @__PURE__ */ new WeakMap();
91478
91562
  var layerKeysByEntities = /* @__PURE__ */ new WeakMap();
91479
91563
  function linkKindsOf(entities) {
91480
91564
  const kinds = [];
@@ -91565,7 +91649,7 @@ function rejectCollisions(collisions2) {
91565
91649
  throw new ConfigRejection([{
91566
91650
  code: "SOURCE_COLLISION",
91567
91651
  collisions: collisions2,
91568
- message: `This would leave ${collisions2.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 (\`linked-system/link\` with \`onLinked: 'take'\`), or make the link that only reaches ${one ? "it" : "them"} \`hybrid\`, so it uses what this system already has.`
91652
+ message: `This would leave ${collisions2.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.`
91569
91653
  }]);
91570
91654
  }
91571
91655
  var parentSnapshotOf = /* @__PURE__ */ new WeakMap();
@@ -91942,6 +92026,7 @@ var Config = class Config2 {
91942
92026
  ownedKinds: /* @__PURE__ */ new Set(),
91943
92027
  sources: /* @__PURE__ */ new Map(),
91944
92028
  recorded: /* @__PURE__ */ new Map(),
92029
+ baseRecorded: /* @__PURE__ */ new Map(),
91945
92030
  sourceStates: /* @__PURE__ */ new Map(),
91946
92031
  derived: /* @__PURE__ */ new Map(),
91947
92032
  owner: void 0
@@ -92084,6 +92169,7 @@ var Config = class Config2 {
92084
92169
  ownedKinds: meta3.ownedKinds,
92085
92170
  sources: meta3.sources,
92086
92171
  recorded: meta3.recorded,
92172
+ baseRecorded: meta3.recorded,
92087
92173
  sourceStates: meta3.sourceStates,
92088
92174
  derived: meta3.derived,
92089
92175
  snapshot: withEdges,
@@ -92094,7 +92180,65 @@ var Config = class Config2 {
92094
92180
  * was registered into this instance. `undefined` for a kind this config doesn't know. The single
92095
92181
  * accessor every internal read routes through. */
92096
92182
  entityOf(kind) {
92097
- return this.state.entities.get(kind);
92183
+ return this.state.entities.get(kind) ?? this.state.entities.get(this.currentKind(kind));
92184
+ }
92185
+ /** An op address (`linked-system/link`) with its kind segment named as the kind is now. */
92186
+ currentAddress(address) {
92187
+ const slash = address.indexOf("/");
92188
+ if (slash <= 0) return address;
92189
+ const kind = address.slice(0, slash);
92190
+ const current = this.currentKind(kind);
92191
+ return current === kind ? address : `${current}${address.slice(slash)}`;
92192
+ }
92193
+ /** `patch`, addressed to the kind it names now, with its data at the fields the kind has now. This
92194
+ * is the patch as it is recorded, so it depends on nothing but the patch. */
92195
+ patchUnderCurrentKind(patch) {
92196
+ const kind = this.currentKind(patch.kind);
92197
+ const addressed2 = kind === patch.kind ? patch : {
92198
+ ...patch,
92199
+ kind
92200
+ };
92201
+ if (!("data" in addressed2) || "field" in addressed2) return addressed2;
92202
+ const data = this.underCurrentFields(kind, addressed2.operation, { data: addressed2.data }).data;
92203
+ return data === addressed2.data ? addressed2 : {
92204
+ ...addressed2,
92205
+ data
92206
+ };
92207
+ }
92208
+ /**
92209
+ * `patch` as it lands on `snapshot`: a whole write of a moved field's container keeps the value
92210
+ * stored there ({@link keptThroughContainerWrite}). Judged at each landing rather than written into
92211
+ * the recorded patch, so a replay onto a base that has changed the field since keeps that base's
92212
+ * value, not the one stored when the patch was first applied.
92213
+ */
92214
+ patchAsItLands(patch, snapshot) {
92215
+ if (patch.operation !== "update" || !("data" in patch) || "field" in patch) return patch;
92216
+ const retired = this.entityOf(patch.kind)?.retiredFields;
92217
+ if (!retired || !isPlainObject(patch.data)) return patch;
92218
+ const stored = snapshot.get(patch.kind, patch.path)?.toJSON();
92219
+ const data = withEmptiedContainersCleared({
92220
+ delta: keptThroughContainerWrite({
92221
+ delta: patch.data,
92222
+ retired,
92223
+ stored
92224
+ }),
92225
+ retired,
92226
+ stored
92227
+ });
92228
+ return data === patch.data ? patch : {
92229
+ ...patch,
92230
+ data
92231
+ };
92232
+ }
92233
+ /** `kind`, or the kind it names now when it's a retired name ({@link EntityKind.retiredKinds}). */
92234
+ currentKind(kind) {
92235
+ if (this.state.entities.has(kind)) return kind;
92236
+ const cached2 = retiredKindsByEntities.get(this.state.entities);
92237
+ if (cached2) return cached2.get(kind) ?? kind;
92238
+ const retired = /* @__PURE__ */ new Map();
92239
+ for (const [name, entity] of this.state.entities) for (const old of entity.retiredKinds ?? []) retired.set(old, name);
92240
+ retiredKindsByEntities.set(this.state.entities, retired);
92241
+ return retired.get(kind) ?? kind;
92098
92242
  }
92099
92243
  /** Every key a style rule's layer bag takes that a kind owns, with the kind that owns it. See
92100
92244
  * {@link LayerKey}. */
@@ -92156,12 +92300,16 @@ var Config = class Config2 {
92156
92300
  *
92157
92301
  * The single-op half of {@link run}, which is the door a caller uses.
92158
92302
  */
92159
- dispatch(op, id) {
92160
- const { kind } = op;
92303
+ dispatch(written, id) {
92304
+ const kind = this.currentKind(written.kind);
92305
+ const op = kind === written.kind ? written : {
92306
+ ...written,
92307
+ kind
92308
+ };
92161
92309
  const verb = opVerb(op);
92162
92310
  const entry = kind === "config" ? configSchemas(this.name)[verb] : this.entityOf(kind)?.schemas[verb];
92163
92311
  if (!entry?.handler) reject("UNSUPPORTED", `${kind} has no ${verb} operation`);
92164
- const input2 = this.wholeBodyShorthand(kind, verb, op);
92312
+ const input2 = this.underCurrentFields(kind, verb, this.wholeBodyShorthand(kind, verb, op));
92165
92313
  let schema = resolveInputSchema(entry.input, {
92166
92314
  config: this,
92167
92315
  body: input2.data
@@ -92173,6 +92321,30 @@ var Config = class Config2 {
92173
92321
  return this.named(produced, { id });
92174
92322
  }
92175
92323
  /**
92324
+ * An op's input with any field the kind has moved (`EntityKind.retiredFields`) written at its
92325
+ * current path: folded into a whole body, renamed in an update's delta. A member op addresses a
92326
+ * sub-collection, which no retired field names.
92327
+ */
92328
+ underCurrentFields(kind, verb, input2) {
92329
+ const retired = this.entityOf(kind)?.retiredFields;
92330
+ if (!retired || !isPlainObject(input2.data)) return input2;
92331
+ if (verb === "create" || verb === "replace") return {
92332
+ ...input2,
92333
+ data: foldRetiredFields({
92334
+ body: input2.data,
92335
+ retired
92336
+ })
92337
+ };
92338
+ if (verb === "update") return {
92339
+ ...input2,
92340
+ data: deltaUnderCurrentFields({
92341
+ delta: input2.data,
92342
+ retired
92343
+ })
92344
+ };
92345
+ return input2;
92346
+ }
92347
+ /**
92176
92348
  * A whole-body op's input with a bare ref put in the kind's primary field, so an op takes the same
92177
92349
  * shorthand `apply` does (`wholeBodyChange`): `Token.ref('x@ds')` is a token body at either door.
92178
92350
  * Anything else is handed back as it came.
@@ -92469,7 +92641,7 @@ var Config = class Config2 {
92469
92641
  * in.
92470
92642
  *
92471
92643
  * Checked rather than assumed. "The slug namespace is flat" is a property of the ref grammar, and
92472
- * nothing was making the data honour it: a config declaring `linkedSystems: { ds }` and
92644
+ * nothing was making the data honour it: a config declaring `sources: { ds }` and
92473
92645
  * `linkedPackages: { ds }` registered clean, `sourceSlugs()` answered `['ds', 'ds']`, and every read
92474
92646
  * through `@ds` picked a winner. Unreachable while a config declares one source kind, and the first
92475
92647
  * thing to go wrong the day it declares two — which is exactly what `sources` exists to allow.
@@ -92529,7 +92701,7 @@ var Config = class Config2 {
92529
92701
  * `apply` and {@link run} are two doors on one wall. A {@link Patch} is one of the framework's own
92530
92702
  * verbs (`create`, `update`, `rename`, `sub-update`, …) with its body already in stored shape, and
92531
92703
  * `apply` performs exactly that one and records it. A {@link ConfigOp} is anything the catalog
92532
- * addresses — those same verbs, and custom ops such as `linked-system/copy` that decompose into
92704
+ * addresses — those same verbs, and custom ops such as `source/copy` that decompose into
92533
92705
  * several patches — and `run` parses its input against the op's own schema and hands it to the op's
92534
92706
  * handler, which for a standard verb is a call to `apply`. So `apply` is what a handler and a
92535
92707
  * replay call, and `run` is what a caller calls: a tool, an editor gesture, a commit. A caller
@@ -92551,7 +92723,8 @@ var Config = class Config2 {
92551
92723
  * A delete records more than one patch when items declare they cannot outlive the target
92552
92724
  * ({@link EntityKind.structuralBody}): a delete per dependent, leaves first, then the target, as
92553
92725
  * one changeset. `id` then names the first of them and the changeset. */
92554
- apply(patch, id) {
92726
+ apply(written, id) {
92727
+ const patch = this.patchUnderCurrentKind(written);
92555
92728
  const dependents = this.structuralDependentsOf({ patch });
92556
92729
  if (dependents.length === 0) return this.applyRecorded(patch, id);
92557
92730
  const since = this.state.pending.length;
@@ -92565,7 +92738,8 @@ var Config = class Config2 {
92565
92738
  * patch as it was recorded, since a recorded delete's cascade was recorded beside it, ahead of it.
92566
92739
  * Deleting again what the base gained since would remove it with no patch saying so.
92567
92740
  */
92568
- applyRecorded(patch, id) {
92741
+ applyRecorded(written, id) {
92742
+ const patch = this.patchUnderCurrentKind(written);
92569
92743
  const deferred = this.state.deferredInvariants;
92570
92744
  if (deferred?.open) deferred.kinds.add(patch.kind);
92571
92745
  const applied3 = this.applyPatch(patch, id, !deferred?.open);
@@ -92620,7 +92794,8 @@ var Config = class Config2 {
92620
92794
  }
92621
92795
  }
92622
92796
  /** {@link apply}, with the kind's invariants judged now or left to the batch that called this. */
92623
- applyPatch(patch, id, checked) {
92797
+ applyPatch(written, id, checked) {
92798
+ const patch = this.patchUnderCurrentKind(written);
92624
92799
  const snapshot = this.computeApply(this.state.snapshot, patch, "write", checked);
92625
92800
  const sourceIdentity = this.entityOf(patch.kind)?.sourceIdentity;
92626
92801
  let { recorded, sources, sourceStates } = this.state;
@@ -92669,7 +92844,7 @@ var Config = class Config2 {
92669
92844
  */
92670
92845
  applyAll(requested) {
92671
92846
  if (requested.length === 0) return this;
92672
- const patches = this.withStructuralDependents(requested);
92847
+ const patches = this.withStructuralDependents(requested.map((patch) => this.patchUnderCurrentKind(patch)));
92673
92848
  const changeset = patches.length > 1 ? crypto.randomUUID() : void 0;
92674
92849
  const stampOf = (patch) => stamp(patch, void 0, changeset);
92675
92850
  const touched = new Set(patches.map((patch) => patch.kind));
@@ -93150,7 +93325,8 @@ var Config = class Config2 {
93150
93325
  }));
93151
93326
  }
93152
93327
  /** The next snapshot for one patch, validated. Pure in `snapshot`; reads metadata off `this`. */
93153
- computeApply(snapshot, incoming, mode = "write", checked = true) {
93328
+ computeApply(snapshot, written, mode = "write", checked = true) {
93329
+ const incoming = this.patchAsItLands(this.patchUnderCurrentKind(written), snapshot);
93154
93330
  const unitChange = incoming.kind === "style-property" && incoming.operation === "update" ? {
93155
93331
  path: incoming.path,
93156
93332
  was: stylePropNumberUnit(this.viewOf(snapshot), incoming.path)
@@ -93405,10 +93581,14 @@ var Config = class Config2 {
93405
93581
  }
93406
93582
  const parsed = updateSchema.safeParse(checked);
93407
93583
  if (!parsed.success) rejectInvalid(context, parsed.error);
93408
- const delta = {
93584
+ const parsedDelta = {
93409
93585
  ...parsed.data,
93410
93586
  ...reveals
93411
93587
  };
93588
+ const delta = entry.retiredFields ? withoutClearsInsideClears({
93589
+ delta: parsedDelta,
93590
+ retired: entry.retiredFields
93591
+ }) : parsedDelta;
93412
93592
  const touched = touchedFields(delta, isField2);
93413
93593
  if (extension) {
93414
93594
  const resolved = this.at(snapshot).resolveExtension({
@@ -94151,7 +94331,8 @@ var Config = class Config2 {
94151
94331
  });
94152
94332
  return new Entity(path2, withComputed, [...entry.fieldKeys, ...Object.keys(computed)]);
94153
94333
  }
94154
- resolve(kind, path2) {
94334
+ resolve(written, path2) {
94335
+ const kind = this.currentKind(written);
94155
94336
  const cache = this.caches.entities;
94156
94337
  const key2 = `${kind}\0${path2}`;
94157
94338
  const cached2 = cache.get(key2);
@@ -94567,13 +94748,13 @@ var Config = class Config2 {
94567
94748
  * accessor name, then by the item's slug:
94568
94749
  *
94569
94750
  * ```ts
94570
- * Config.registerSources({ linkedSystems: { yos: yahooOs } })
94751
+ * Config.registerSources({ sources: { yos: yahooOs } })
94571
94752
  * ```
94572
94753
  *
94573
- * The same two levels `register` takes (`{ linkedSystems: { yos: LinkedSystem.item(…) } }`) and the
94754
+ * The same two levels `register` takes (`{ sources: { yos: Source.item(…) } }`) and the
94574
94755
  * same two `fromJSON(json, { sources })` takes, so one gesture — declare a source, then hand
94575
94756
  * over what it resolved to — reads identically at all three. A flat `{ yos }` said nothing about
94576
- * which collection `yos` came from, which is fine while `linked-system` is the only source kind and
94757
+ * which collection `yos` came from, which is fine while `source` is the only source kind and
94577
94758
  * wrong the day there is a second.
94578
94759
  *
94579
94760
  * Immutable like every other authoring step: the sources ride on the derived config, and every later
@@ -94743,7 +94924,7 @@ var Config = class Config2 {
94743
94924
  *
94744
94925
  * Answers the slug, which is the kind-agnostic half and therefore the half that belongs here. Turning
94745
94926
  * a slug into the typed pin behind it is the source kind's own business (`sourceOfGroup` beside
94746
- * `LinkedSystem`) — a `Config` method could only hand back a bare `Entity`, and the rule above would
94927
+ * `Source`) — a `Config` method could only hand back a bare `Entity`, and the rule above would
94747
94928
  * then be stated once per source kind instead of once.
94748
94929
  */
94749
94930
  groupSource({ kind, groupPath }) {
@@ -94842,7 +95023,7 @@ var Config = class Config2 {
94842
95023
  * stores, so refusing on that shape would lock a pointer we declared. See `borrowedSlug`.
94843
95024
  */
94844
95025
  /**
94845
- * The pin whose `link` declaration covers `kind:path` and whose source has a row there, so the build
95026
+ * The pin whose `options.include` covers `kind:path` and whose source has a row there, so the build
94846
95027
  * mints the source's row at the path on its next pass. `undefined` when no declaration covers the
94847
95028
  * path, or the declaring source is attached and lacks it. A source that isn't attached is taken at
94848
95029
  * its declaration's word.
@@ -94946,16 +95127,17 @@ var Config = class Config2 {
94946
95127
  path: path2,
94947
95128
  overlay: null
94948
95129
  });
94949
- const field = Object.keys(write({
94950
- accessor,
94951
- path: path2,
94952
- overlay: null
94953
- }))[0]?.split(".")[0];
94954
- return field ? { [field]: null } : write({
95130
+ const clear = write({
94955
95131
  accessor,
94956
95132
  path: path2,
94957
95133
  overlay: null
94958
95134
  });
95135
+ const field = Object.keys(clear)[0]?.split(".")[0];
95136
+ if (!field) return clear;
95137
+ const sourceKind = this.sourceKindFor(slug2);
95138
+ const body = sourceKind ? this.storedBody(sourceKind, slug2) : void 0;
95139
+ const left = isPlainObject(body) ? applyPathDelta(body, clear, () => true)[field] : void 0;
95140
+ return isPlainObject(left) && Object.keys(left).length > 0 ? clear : { [field]: null };
94959
95141
  }
94960
95142
  /**
94961
95143
  * Every path a declared source's declaration says something about, with the accessor resolved to the
@@ -94986,7 +95168,7 @@ var Config = class Config2 {
94986
95168
  return found;
94987
95169
  }
94988
95170
  /**
94989
- * Whether one of a declared source's paths is adopted here — covered by the pin's `link`.
95171
+ * Whether one of a declared source's paths is adopted here — covered by the pin's `options.include`.
94990
95172
  *
94991
95173
  * The question a spelling turns on: an adopted path is addressed bare, because the build mints a
94992
95174
  * row for it at the path the source spells, and everything else is addressed qualified. The two are
@@ -95913,7 +96095,7 @@ var Config = class Config2 {
95913
96095
  }
95914
96096
  if (collides) rejectCollisions(derivation.collisions);
95915
96097
  if (stranded.length === 0) return;
95916
- reject("REFERRERS_BLOCK", `Cannot ${action} \u2014 it would take away ${stranded.join("; ")}. Copy what is used first (\`linked-system/copy\`), or break the link keeping its values (\`linked-system/break\` with \`keep: true\`).`);
96098
+ reject("REFERRERS_BLOCK", `Cannot ${action} \u2014 it would take away ${stranded.join("; ")}. Copy what is used first (\`source/copy\`), or break the link keeping its values (\`source/break\` with \`keep: true\`).`);
95917
96099
  }
95918
96100
  /**
95919
96101
  * Whether every directive of `pin` that names `target` sits on a path that no longer derives through
@@ -96879,7 +97061,7 @@ var Config = class Config2 {
96879
97061
  * in which fields they set are different sources, and collapsing them would share one cache entry.
96880
97062
  *
96881
97063
  * Derived rather than spelled, which is what makes it right for kinds nobody has written — it covers
96882
- * whatever fields a kind actually declares instead of the three `linked-system` happens to have. The
97064
+ * whatever fields a kind actually declares instead of the three `source` happens to have. The
96883
97065
  * key it replaces was `${systemId}@${version}`, which a repo-local source cannot state at all;
96884
97066
  * that is the case the walk using it had to pre-skip.
96885
97067
  */
@@ -96907,7 +97089,7 @@ var Config = class Config2 {
96907
97089
  *
96908
97090
  * A row borrowed or copied through a pin is asked of that pin's source in turn, so a system linked
96909
97091
  * to a system linked to a foundation answers with the foundation. A row a materialized artifact
96910
- * flattened to a literal has no pointer left, so the pin whose `link` declaration covers the path
97092
+ * flattened to a literal has no pointer left, so the pin whose `options.include` covers the path
96911
97093
  * stands in, provided the row still reads as the source's ({@link matchesSource}); one the
96912
97094
  * publisher changed is its own, and so is a linked row this config lays a value of its own over: the
96913
97095
  * Bridge's `spectrum/blue/0` points at Yahoo OS's with the Bridge's colours on it, which is the
@@ -96950,7 +97132,7 @@ var Config = class Config2 {
96950
97132
  }
96951
97133
  }
96952
97134
  /**
96953
- * The pin whose `link` declaration covers `kind:path` while the row there still reads as that
97135
+ * The pin whose `options.include` covers `kind:path` while the row there still reads as that
96954
97136
  * source's: how a row a materialized artifact flattened to a literal is traced back to the pin it
96955
97137
  * came through. `undefined` when no declaration covers it, or the row differs from the source's.
96956
97138
  */
@@ -97019,8 +97201,8 @@ var Config = class Config2 {
97019
97201
  return this.sourceKinds().find((kind) => this.storedBody(kind, slug2) !== void 0);
97020
97202
  }
97021
97203
  /**
97022
- * Every source kind by the accessor name its config type declares it under — `linkedSystems` →
97023
- * `linked-system`.
97204
+ * Every source kind by the accessor name its config type declares it under — `sources` →
97205
+ * `source`.
97024
97206
  *
97025
97207
  * The accessor name is what every source-shaped argument is keyed by ({@link AttachedSources},
97026
97208
  * `register`, `Config.load`'s resolvers), because it's the name an author writes, where the kind is
@@ -97192,7 +97374,8 @@ var Config = class Config2 {
97192
97374
  * {@link retired} answers true for. Both answers are cached per snapshot, so either is safe in a dep
97193
97375
  * array.
97194
97376
  */
97195
- list(kind, opts) {
97377
+ list(written, opts) {
97378
+ const kind = this.currentKind(written);
97196
97379
  const all = this.allOf(kind);
97197
97380
  if (opts?.retired !== false) return all;
97198
97381
  const cache = this.caches.activeLists;
@@ -97368,9 +97551,9 @@ var Config = class Config2 {
97368
97551
  * every sourced ref dangles, and emitters, integrity checks and memos all read exactly there.
97369
97552
  *
97370
97553
  * `sources` is keyed the way every other source-shaped argument is — by the source kind's accessor
97371
- * name, `{ linkedSystems: resolver }` — so the resolver set, the declaration, and
97554
+ * name, `{ sources: resolver }` — so the resolver set, the declaration, and
97372
97555
  * {@link registerSources} all spell the same key. Each resolver is the kind's own
97373
- * (`LinkedSystemResolver`), and its answer is validated against the schemas that kind declares.
97556
+ * (`SystemSourceResolver`), and its answer is validated against the schemas that kind declares.
97374
97557
  *
97375
97558
  * Reads the source entities off a throwaway bare parse, resolves them all, then hydrates once with
97376
97559
  * whatever came back attached. The bare parse is cheap and is what lets a resolver be handed the
@@ -97481,6 +97664,34 @@ var Config = class Config2 {
97481
97664
  });
97482
97665
  }
97483
97666
  /**
97667
+ * The branch as its base read it: no draft, and every source read the way the base read it.
97668
+ *
97669
+ * Replaying nothing over the base covers the snapshot. A pin the draft moved also left the
97670
+ * per-slug state answering for the new pin: its recorded closure gone and, once fetched, the new
97671
+ * version attached. So each moved slug gets the base's recorded closure back and loses that
97672
+ * attachment before the replay, which also re-derives the rows the old pin minted.
97673
+ */
97674
+ withoutDraft() {
97675
+ const atBase = this.at(this.state.base);
97676
+ const moved = atBase.sourceSlugs().filter((slug2) => atBase.sourceIdentityOf(slug2) !== this.sourceIdentityOf(slug2));
97677
+ let from = this;
97678
+ if (moved.length > 0) {
97679
+ const recorded = new Map(this.state.recorded);
97680
+ const sources = new Map(this.state.sources);
97681
+ for (const slug2 of moved) {
97682
+ sources.delete(slug2);
97683
+ const held = this.state.baseRecorded.get(slug2);
97684
+ if (held) recorded.set(slug2, held);
97685
+ else recorded.delete(slug2);
97686
+ }
97687
+ from = this.derive({
97688
+ recorded,
97689
+ sources
97690
+ });
97691
+ }
97692
+ return from.withDraft([]).config;
97693
+ }
97694
+ /**
97484
97695
  * Retire the attachment for every slug a walk answered `unavailable` for.
97485
97696
  *
97486
97697
  * A resolve walk is total over the declared items of a source kind — `unavailable` is a legal answer
@@ -97555,7 +97766,7 @@ var Config = class Config2 {
97555
97766
  * links from the provided sources. A declared `linkedKind` with no provided source throws. */
97556
97767
  hydrateFrom(stored, options) {
97557
97768
  const claimed = schemaVersionOf(stored);
97558
- if (claimed > 20261104151013) throw new SchemaVersionTooNew(claimed);
97769
+ if (claimed > 20261105185042) throw new SchemaVersionTooNew(claimed);
97559
97770
  const wire = upgradeSerializedConfig(stored);
97560
97771
  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 \u2014 import the config type's module (e.g. \`configs/system\`) before hydrating.`);
97561
97772
  const leftover = wire.options;
@@ -97796,9 +98007,9 @@ function extensionChange(entry, kind, path2, raw, validate2 = false) {
97796
98007
  function itemChange(entry, kind, path2, raw, validate2 = false) {
97797
98008
  const body = isRef2(raw) || isComposedValue(raw) || typeof raw !== "object" || raw === null ? { [entry.primaryField]: raw } : raw;
97798
98009
  let def = validate2 === "author" && entry.authoredBody ? entry.authoredBody(body) : body;
97799
- if (validate2 === "author" && entry.authoredAt) def = storedFromAuthored({
98010
+ if (validate2 === "author" && entry.retiredFields) def = foldRetiredFields({
97800
98011
  body: def,
97801
- authoredAt: entry.authoredAt
98012
+ retired: entry.retiredFields
97802
98013
  });
97803
98014
  if (validate2) {
97804
98015
  const parsed = wholeBodySchema(entry)?.safeParse(def);
@@ -98252,11 +98463,28 @@ function componentModuleFilePaths(config2, filePath) {
98252
98463
  }
98253
98464
 
98254
98465
  // ../config/dist/entities/system/link-declaration.js
98255
- var PIN_KIND = "linked-system";
98466
+ var PIN_KIND = "source";
98467
+ var INCLUDE = "include";
98468
+ function includeOf(body) {
98469
+ const options = isPlainObject(body) ? body.options : void 0;
98470
+ return isPlainObject(options) ? options[INCLUDE] : void 0;
98471
+ }
98472
+ function directivesOf(body) {
98473
+ const options = isPlainObject(body) ? body.options : void 0;
98474
+ if (!isPlainObject(options)) return [];
98475
+ return Object.entries(options).filter(([key2]) => key2 !== INCLUDE);
98476
+ }
98477
+ function includeWrite({ body, declared: declared2 }) {
98478
+ if (declared2 !== void 0 && declared2 !== null) return { [`options.${INCLUDE}`]: declared2 };
98479
+ return directivesOf(body).length === 0 ? {
98480
+ [`options.${INCLUDE}`]: null,
98481
+ options: null
98482
+ } : { [`options.${INCLUDE}`]: null };
98483
+ }
98256
98484
  function declarationOf(config2, slug2) {
98257
98485
  const pin = config2.storedBody(PIN_KIND, slug2);
98258
98486
  if (!pin) rejectData(`No linked system "${slug2}".`);
98259
- return pin.link;
98487
+ return includeOf(pin);
98260
98488
  }
98261
98489
  var EXCLUDE = "!";
98262
98490
  var reaches2 = (entry, path2) => entry === "*" || entry === path2 || path2.startsWith(`${entry}/`);
@@ -98794,7 +99022,10 @@ function planCopy({ config: config2, input: input2 }) {
98794
99022
  kind: PIN_KIND,
98795
99023
  operation: "update",
98796
99024
  path: slug2,
98797
- data: { link: next ?? null }
99025
+ data: { ...includeWrite({
99026
+ body: config2.storedBody(PIN_KIND, slug2),
99027
+ declared: next ?? null
99028
+ }) }
98798
99029
  });
98799
99030
  }
98800
99031
  }
@@ -99040,7 +99271,10 @@ function planLinkApplied({ config: config2, input: input2 }) {
99040
99271
  kind: PIN_KIND,
99041
99272
  operation: "update",
99042
99273
  path: slug2,
99043
- data: { link: "*" }
99274
+ data: { ...includeWrite({
99275
+ body: config2.storedBody(PIN_KIND, slug2),
99276
+ declared: "*"
99277
+ }) }
99044
99278
  });
99045
99279
  } else {
99046
99280
  const next = { ...current ?? {} };
@@ -99071,7 +99305,7 @@ function planLinkApplied({ config: config2, input: input2 }) {
99071
99305
  kind: PIN_KIND,
99072
99306
  operation: "update",
99073
99307
  path: slug2,
99074
- data: { [`link.${accessor}`]: value }
99308
+ data: { [`options.${INCLUDE}.${accessor}`]: value }
99075
99309
  });
99076
99310
  }
99077
99311
  declared2 = Object.keys(next).length === 0 ? current : next;
@@ -99273,7 +99507,7 @@ function directivesTakenFrom({ config: config2, slug: slug2, after: after5 }) {
99273
99507
  }
99274
99508
  const edits = [];
99275
99509
  for (const pin of new Set(dropped.map((at) => at.from))) {
99276
- const options = config2.storedBody("linked-system", pin).options ?? {};
99510
+ const options = config2.storedBody("source", pin).options ?? {};
99277
99511
  const data = {};
99278
99512
  let emptied = 0;
99279
99513
  for (const [accessor, entries] of Object.entries(options)) {
@@ -99369,7 +99603,10 @@ function planUnlink({ config: config2, input: input2 }) {
99369
99603
  kind: PIN_KIND,
99370
99604
  operation: "update",
99371
99605
  path: slug2,
99372
- data: { link: null }
99606
+ data: { ...includeWrite({
99607
+ body: config2.storedBody(PIN_KIND, slug2),
99608
+ declared: null
99609
+ }) }
99373
99610
  });
99374
99611
  } else {
99375
99612
  const removal = /* @__PURE__ */ new Map();
@@ -99402,7 +99639,10 @@ function planUnlink({ config: config2, input: input2 }) {
99402
99639
  kind: PIN_KIND,
99403
99640
  operation: "update",
99404
99641
  path: slug2,
99405
- data: { link: declared2 === void 0 ? null : declared2 }
99642
+ data: { ...includeWrite({
99643
+ body: config2.storedBody(PIN_KIND, slug2),
99644
+ declared: declared2 === void 0 ? null : declared2
99645
+ }) }
99406
99646
  });
99407
99647
  }
99408
99648
  let after5;
@@ -99434,8 +99674,20 @@ function planUnlink({ config: config2, input: input2 }) {
99434
99674
  }) : [];
99435
99675
  if (dropped.length > 0) {
99436
99676
  const update = patches[patches.length - 1];
99437
- if (dropped.length === config2.sourceDirectives(slug2).length) update.data.options = null;
99438
- else for (const { accessor, path: path2 } of dropped) update.data[`options.${accessor}.${path2}`] = null;
99677
+ const all = config2.sourceDirectives(slug2).every((directive) => dropped.some((gone) => gone.accessor === directive.accessor && gone.path === directive.path));
99678
+ patches[patches.length - 1] = all && declared2 === void 0 ? {
99679
+ ...update,
99680
+ data: {
99681
+ [`options.${INCLUDE}`]: null,
99682
+ options: null
99683
+ }
99684
+ } : {
99685
+ ...update,
99686
+ data: {
99687
+ ...update.data,
99688
+ ...Object.fromEntries(dropped.map(({ accessor, path: path2 }) => [`options.${accessor}.${path2}`, null]))
99689
+ }
99690
+ };
99439
99691
  }
99440
99692
  return {
99441
99693
  declared: declared2,
@@ -99477,8 +99729,7 @@ function planExclude({ config: config2, input: input2 }) {
99477
99729
  const declared2 = next;
99478
99730
  const dropped = [];
99479
99731
  const optionDeletes = {};
99480
- const options = config2.storedBody("linked-system", slug2).options ?? {};
99481
- for (const [accessor, entries] of Object.entries(options)) {
99732
+ for (const [accessor, entries] of directivesOf(config2.storedBody(PIN_KIND, slug2))) {
99482
99733
  if (!entries || typeof entries !== "object") continue;
99483
99734
  const kind = config2.accessors()[accessor]?.kind ?? accessor;
99484
99735
  for (const path2 of Object.keys(entries)) {
@@ -99499,7 +99750,10 @@ function planExclude({ config: config2, input: input2 }) {
99499
99750
  operation: "update",
99500
99751
  path: slug2,
99501
99752
  data: {
99502
- link: declared2,
99753
+ ...includeWrite({
99754
+ body: config2.storedBody(PIN_KIND, slug2),
99755
+ declared: declared2
99756
+ }),
99503
99757
  ...optionDeletes
99504
99758
  }
99505
99759
  }];
@@ -99676,7 +99930,10 @@ function planBreak({ config: config2, input: input2 }) {
99676
99930
  kind: PIN_KIND,
99677
99931
  operation: "update",
99678
99932
  path: slug2,
99679
- data: { link: null }
99933
+ data: { ...includeWrite({
99934
+ body: config2.storedBody(PIN_KIND, slug2),
99935
+ declared: null
99936
+ }) }
99680
99937
  }], {
99681
99938
  kind: PIN_KIND,
99682
99939
  operation: "delete",
@@ -99817,7 +100074,7 @@ function planBreak({ config: config2, input: input2 }) {
99817
100074
  });
99818
100075
  }
99819
100076
  for (const folder of plan.folders) released.add(`${folder.kind}:${folder.path}`);
99820
- patches.push(...plan.patches.filter((patch) => scoped || !(patch.kind === "linked-system" && patch.operation === "update")));
100077
+ patches.push(...plan.patches.filter((patch) => scoped || !(patch.kind === "source" && patch.operation === "update")));
99821
100078
  });
99822
100079
  if (copyBlocked !== void 0) return {
99823
100080
  rows,
@@ -99847,7 +100104,10 @@ function planBreak({ config: config2, input: input2 }) {
99847
100104
  kind: PIN_KIND,
99848
100105
  operation: "update",
99849
100106
  path: slug2,
99850
- data: { link: null }
100107
+ data: { ...includeWrite({
100108
+ body: config2.storedBody(PIN_KIND, slug2),
100109
+ declared: null
100110
+ }) }
99851
100111
  });
99852
100112
  patches.push({
99853
100113
  kind: PIN_KIND,
@@ -99993,7 +100253,7 @@ function rowStateOf({ config: config2, derived, source, slug: slug2, kind, node:
99993
100253
  };
99994
100254
  }
99995
100255
 
99996
- // ../config/dist/entities/system/LinkedSystem.js
100256
+ // ../config/dist/entities/system/Source.js
99997
100257
  var EXACT_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
99998
100258
  var LINK_SLUG = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/i;
99999
100259
  function isLinkSlug(slug2) {
@@ -100001,7 +100261,7 @@ function isLinkSlug(slug2) {
100001
100261
  }
100002
100262
  function freeExampleSlug(config2, besides) {
100003
100263
  let slug2 = "design-system";
100004
- for (let n = 2; slug2 === besides || config2.resolve("linked-system", slug2); n += 1) slug2 = `design-system-${n}`;
100264
+ for (let n = 2; slug2 === besides || config2.resolve("source", slug2); n += 1) slug2 = `design-system-${n}`;
100005
100265
  return slug2;
100006
100266
  }
100007
100267
  function renameExample({ config: config2, path: path2 }) {
@@ -100045,9 +100305,9 @@ var sourceUnavailable = external_exports.discriminatedUnion("code", [
100045
100305
  ]);
100046
100306
  var copyPaths = external_exports.union([external_exports.literal("*"), external_exports.array(external_exports.string().min(1)).min(1)]);
100047
100307
  var copyInput = external_exports.object({
100048
- path: pathInput("linked-system"),
100308
+ path: pathInput("source"),
100049
100309
  /**
100050
- * What to take, keyed by accessor the way the pin's `link` is — `{ tokens: ['color/brand', 'color'],
100310
+ * What to take, keyed by accessor the way the pin's `options.include` is — `{ tokens: ['color/brand', 'color'],
100051
100311
  * icons: '*' }` — or `'*'` for every kind the source offers and this config can hold. A path that
100052
100312
  * names a folder in the source takes its members. Copied rows keep the source's own names.
100053
100313
  */
@@ -100061,8 +100321,8 @@ var copyInput = external_exports.object({
100061
100321
  onConflict: external_exports.enum(["skip", "replace"]).optional()
100062
100322
  });
100063
100323
  var linkInput = external_exports.object({
100064
- path: pathInput("linked-system"),
100065
- /** What to draw, keyed by accessor the way the pin's `link` is, or `'*'` for everything the source
100324
+ path: pathInput("source"),
100325
+ /** What to draw, keyed by accessor the way the pin's `options.include` is, or `'*'` for everything the source
100066
100326
  * offers. A path that names a folder in the source covers its members. */
100067
100327
  data: external_exports.union([external_exports.literal("*"), external_exports.record(external_exports.string(), copyPaths)]),
100068
100328
  /** What to do at a path another linked system provides: `'take'` makes it follow this source,
@@ -100079,28 +100339,28 @@ var linkInput = external_exports.object({
100079
100339
  replace: external_exports.record(external_exports.string(), external_exports.record(external_exports.string().min(1), external_exports.string().min(1))).optional()
100080
100340
  });
100081
100341
  var unlinkInput = external_exports.object({
100082
- path: pathInput("linked-system"),
100342
+ path: pathInput("source"),
100083
100343
  /** What to stop drawing, in `link`'s shape; everything when omitted. */
100084
100344
  data: external_exports.union([external_exports.literal("*"), external_exports.record(external_exports.string(), copyPaths)]).optional()
100085
100345
  });
100086
100346
  var excludeInput = external_exports.object({
100087
- path: pathInput("linked-system"),
100088
- /** What to leave out, keyed by accessor the way the pin's `link` is: the source's paths, where a
100347
+ path: pathInput("source"),
100348
+ /** What to leave out, keyed by accessor the way the pin's `options.include` is: the source's paths, where a
100089
100349
  * folder leaves out its members. */
100090
100350
  data: external_exports.record(external_exports.string(), external_exports.array(external_exports.string().min(1)).min(1))
100091
100351
  });
100092
100352
  var breakInput = external_exports.object({
100093
- path: pathInput("linked-system"),
100353
+ path: pathInput("source"),
100094
100354
  /** Whether every value drawn through the pin becomes this config's own first. */
100095
100355
  keep: external_exports.boolean()
100096
100356
  });
100097
100357
  var breakPlanInput = external_exports.object({
100098
- path: pathInput("linked-system"),
100358
+ path: pathInput("source"),
100099
100359
  keep: external_exports.boolean().optional(),
100100
100360
  /** One entity or folder detached through `copy` rather than the whole pin. */
100101
100361
  data: external_exports.union([external_exports.literal("*"), external_exports.record(external_exports.string(), copyPaths)]).optional()
100102
100362
  });
100103
- var rowsInput = external_exports.object({ path: pathInput("linked-system") });
100363
+ var rowsInput = external_exports.object({ path: pathInput("source") });
100104
100364
  function copyInputOf(input2) {
100105
100365
  return {
100106
100366
  path: String(input2.path),
@@ -100163,20 +100423,22 @@ function exampleBorrowable(config2, slug2) {
100163
100423
  };
100164
100424
  }
100165
100425
  }
100166
- var pinOptions = external_exports.record(external_exports.string(), external_exports.record(external_exports.string(), external_exports.strictObject({
100426
+ var linkDeclarationSchema = external_exports.union([external_exports.literal("*"), external_exports.record(external_exports.string(), external_exports.union([external_exports.literal("*"), external_exports.array(external_exports.string().min(1)).min(1)]))]).describe("What this system draws from the source, standing: `'*'` for everything, or a record by kind (`'*'` keys every kind it doesn't name). A list's `'!path'` entry leaves that path out.");
100427
+ var pinOptions = external_exports.object({ include: linkDeclarationSchema.optional() }).catchall(external_exports.record(external_exports.string(), external_exports.strictObject({
100167
100428
  override: external_exports.union([refSchema, external_exports.record(external_exports.string(), external_exports.unknown())]).optional(),
100168
100429
  extend: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
100169
100430
  hidden: external_exports.boolean().optional()
100170
- }).refine((entry) => entry.override !== void 0 || entry.extend !== void 0 || entry.hidden !== void 0, { message: "An `options` entry needs `override`, `extend` or `hidden`." }))).optional().describe("Per-entity adjustments, keyed by accessor, then path, then verb.");
100171
- var SOURCE_AUTHORED_AT = { link: "options.include" };
100431
+ }).refine((entry) => entry.override !== void 0 || entry.extend !== void 0 || entry.hidden !== void 0, { message: "An `options` entry needs `override`, `extend` or `hidden`." }))).optional().describe("What the system includes from the source (`include`), and per-entity adjustments, keyed by accessor, then path, then verb.");
100432
+ var SOURCE_RETIRED_FIELDS = { link: "options.include" };
100172
100433
  var LinkedSystemDefinition = defineEntity({
100173
- kind: "linked-system",
100174
- label: "Linked system",
100175
- labelPlural: "Linked systems",
100434
+ kind: "source",
100435
+ label: "Source",
100436
+ labelPlural: "Sources",
100176
100437
  entityName: "Source",
100177
- authoredAt: SOURCE_AUTHORED_AT,
100438
+ retiredKinds: ["linked-system"],
100439
+ retiredFields: SOURCE_RETIRED_FIELDS,
100178
100440
  invariants: (config2) => [
100179
- ...config2.list("linked-system").filter(({ path: path2 }) => !isLinkSlug(path2)).map(({ path: path2 }) => `Link "${path2}": ${LINK_SLUG_MESSAGE}`),
100441
+ ...config2.list("source").filter(({ path: path2 }) => !isLinkSlug(path2)).map(({ path: path2 }) => `Link "${path2}": ${LINK_SLUG_MESSAGE}`),
100180
100442
  ...linkRedirects(config2).filter((redirect) => redirect.problem !== void 0 && redirect.problem !== "missing").map(redirectSentence),
100181
100443
  ...excludedDirectives(config2)
100182
100444
  ],
@@ -100191,7 +100453,7 @@ var LinkedSystemDefinition = defineEntity({
100191
100453
  rename: { example: renameExample },
100192
100454
  "rename-plan": { example: renameExample },
100193
100455
  /**
100194
- * Draw entities from a linked system: the pin's `link` declaration grows to cover them and the
100456
+ * Draw entities from a linked system: the pin's `options.include` declaration grows to cover them and the
100195
100457
  * build mints a pointer row per entity, in this one op. A row of this config's own at a covered
100196
100458
  * path is deleted so theirs shows through; a row held through another pin becomes an extension
100197
100459
  * through this one when `onLinked` is `'take'`, and the other pin's `options` entry there goes with
@@ -100201,7 +100463,7 @@ var LinkedSystemDefinition = defineEntity({
100201
100463
  input: linkInput,
100202
100464
  readOnly: false,
100203
100465
  label: "Link from",
100204
- description: "Draw entities from a linked system, following the source: `data` names them by accessor \u2014 `{ tokens: ['color/brand', 'color'] }` takes an entity and a folder's members, `{ tokens: '*' }` every token, and `'*'` the whole system. What this config already holds at those paths is replaced by theirs, so run `linked-system/link-plan` with the same input first to see what that is. To replace something this config holds under another name (the `SelectContent` it has with the source's `SelectMenu`), name the pair in `replace` (`{ components: { SelectContent: 'SelectMenu' } }`): every reference to the old name moves to the new one, in design files and code too. To hold their values as your own instead, `copy`.",
100466
+ description: "Draw entities from a linked system, following the source: `data` names them by accessor \u2014 `{ tokens: ['color/brand', 'color'] }` takes an entity and a folder's members, `{ tokens: '*' }` every token, and `'*'` the whole system. What this config already holds at those paths is replaced by theirs, so run `source/link-plan` with the same input first to see what that is. To replace something this config holds under another name (the `SelectContent` it has with the source's `SelectMenu`), name the pair in `replace` (`{ components: { SelectContent: 'SelectMenu' } }`): every reference to the old name moves to the new one, in design files and code too. To hold their values as your own instead, `copy`.",
100205
100467
  scope: "item",
100206
100468
  approval: "reference-change",
100207
100469
  title: (entity) => `Link something from ${entity}`,
@@ -100282,7 +100544,7 @@ var LinkedSystemDefinition = defineEntity({
100282
100544
  }
100283
100545
  },
100284
100546
  /**
100285
- * Leave part of a linked system out for good: a `!` entry per path in the pin's `link`. Unlike
100547
+ * Leave part of a linked system out for good: a `!` entry per path in the pin's `options.include`. Unlike
100286
100548
  * `unlink`, nothing derives there however the link reaches it, and the linked tokens' overrides
100287
100549
  * under an excluded modifier are left out of the build. `link` with the same path lifts it.
100288
100550
  */
@@ -100328,7 +100590,7 @@ var LinkedSystemDefinition = defineEntity({
100328
100590
  input: breakInput,
100329
100591
  readOnly: false,
100330
100592
  label: "Break link",
100331
- description: "Remove a linked system. With `keep: true` every value drawn through it is copied in as your own first, and a row of yours that pointed through the pin points at the copies; with `keep: false` the rows it minted go, and a row of yours still pointing through it refuses the break. Run `linked-system/break-plan` first to see every row it reaches.",
100593
+ description: "Remove a linked system. With `keep: true` every value drawn through it is copied in as your own first, and a row of yours that pointed through the pin points at the copies; with `keep: false` the rows it minted go, and a row of yours still pointing through it refuses the break. Run `source/break-plan` first to see every row it reaches.",
100332
100594
  scope: "item",
100333
100595
  approval: "destructive",
100334
100596
  title: (entity) => `Break the link to ${entity}`,
@@ -100399,7 +100661,7 @@ var LinkedSystemDefinition = defineEntity({
100399
100661
  * `extend` laid over the source's body. A folder's meta comes with its members, so a label the
100400
100662
  * folder was inheriting becomes its own.
100401
100663
  *
100402
- * `data` is keyed the way the pin's `link` is: by accessor, then `'*'` for every entry of the kind
100664
+ * `data` is keyed the way the pin's `options.include` is: by accessor, then `'*'` for every entry of the kind
100403
100665
  * or the source's paths — an item, or a folder, which takes its members. `'*'` alone takes every
100404
100666
  * kind the source offers and this config can hold. Kinds taken in one edit are copied together,
100405
100667
  * which is what lets a copied component point at the copied tokens rather than back through the
@@ -100412,7 +100674,7 @@ var LinkedSystemDefinition = defineEntity({
100412
100674
  input: copyInput,
100413
100675
  readOnly: false,
100414
100676
  label: "Copy from",
100415
- description: "Take entities from a linked system as your own, holding the values the source has now and no longer following it. `data` names them by accessor: `{ tokens: ['color/brand', 'color'] }` takes an entity and a folder's members, `{ tokens: '*' }` every token, and `'*'` the whole system. What a copied entity points at comes with it, so run `linked-system/copy-plan` with the same input first and see everything that lands. To use theirs without owning it, declare it in the pin's `link` instead. A whole-system copy is thousands of rows, and on a repo-backed system each one is written into `uds.config.ts`.",
100677
+ description: "Take entities from a linked system as your own, holding the values the source has now and no longer following it. `data` names them by accessor: `{ tokens: ['color/brand', 'color'] }` takes an entity and a folder's members, `{ tokens: '*' }` every token, and `'*'` the whole system. What a copied entity points at comes with it, so run `source/copy-plan` with the same input first and see everything that lands. To use theirs without owning it, declare it in the pin's `options.include` instead. A whole-system copy is thousands of rows, and on a repo-backed system each one is written into `uds.config.ts`.",
100416
100678
  scope: "item",
100417
100679
  approval: "reference-change",
100418
100680
  title: (entity) => `Copy something from ${entity}`,
@@ -100461,9 +100723,9 @@ var LinkedSystemDefinition = defineEntity({
100461
100723
  * rather than a silent wrong answer.
100462
100724
  *
100463
100725
  * ```ts
100464
- * linkedSystems: {
100726
+ * sources: {
100465
100727
  * ds: '../design-system/uds.config.ts', // repo-local
100466
- * yahooOs: LinkedSystem.item({ systemId, name, version }), // published
100728
+ * yahooOs: Source.item({ systemId, name, version }), // published
100467
100729
  * }
100468
100730
  * ```
100469
100731
  *
@@ -100483,72 +100745,6 @@ var LinkedSystemDefinition = defineEntity({
100483
100745
  */
100484
100746
  configPath: external_exports.string().min(1).optional().describe("The sibling config this link reads, as a path to its `uds.config.ts`. Wins for resolution when set."),
100485
100747
  /**
100486
- * What this system draws from that source — a standing declaration, and the thing the build turns
100487
- * into rows.
100488
- * ```ts
100489
- * link: '*' // everything, every kind
100490
- * link: { tokens: '*', icons: '*' } // those kinds whole
100491
- * link: { tokens: ['color/brand', 'color/paper'] } // those entities
100492
- * link: { components: ['actions'] } // a folder: its members
100493
- * link: { '*': '*', modifiers: ['*', '!text'] } // everything but one folder
100494
- * ```
100495
- * `Config.withDerivedRows` reads it and makes a pointer row per entity it covers — on every build,
100496
- * and inside the apply of any patch to this pin — so a link's cost in authored source is this one
100497
- * declaration whatever the source's size, and the rows come and go with it.
100498
- *
100499
- * Keyed by accessor (`tokens`, `components`) rather than by kind (`token`, `component`), because
100500
- * this is read in a config file, and a config file is keyed by accessor everywhere else —
100501
- * `register({ tokens, components })`, `sources: { linkedSystems: … }`. Ops and refs use the kind.
100502
- * `Config.accessorOf` maps between them, off the config type's own manifest, so no kind is named
100503
- * here. Paths are the source's own; a path that names a folder there covers its members.
100504
- *
100505
- * **Standing, so a source that grows is covered without re-running anything.** The declaration is
100506
- * read on every build, and what it produces is an ordinary stored row — indistinguishable from a
100507
- * borrow written by hand, which is what keeps the rename gate, `inlineAllSources` when it seals an
100508
- * artifact and `emitBorrowedComponents` when it emits a module all working unchanged.
100509
- *
100510
- * A path this config already holds is left alone, silently, whether it authored that row or
100511
- * borrowed it. Local shadows a source, and that is what makes deriving over a grown source
100512
- * additive rather than a set of conflicts to resolve. It is also how one of their entities is kept
100513
- * out: author your own at that path, or narrow what this declares.
100514
- *
100515
- * Deleting a row this covers is refused ({@link EntityKind.bulkAdopts} is what reads it): the
100516
- * build would make it again on the next pass, and a delete that comes back is worse than one that
100517
- * was refused. To own one of their entities, `copy` it; to stop drawing it, `unlink` it.
100518
- *
100519
- * The gestures that write this are the kind's own ops — `link`, `unlink`, `exclude`, `break` —
100520
- * each with a `-plan` read beside it, so a surface never assembles the declaration by hand.
100521
- *
100522
- * `'*'` means every kind that may be drawn on, which is every kind that may be borrowed — each
100523
- * kind says which it is (`EntityKind.linkable`). Nothing is subtracted: a pin and a `file` aren't
100524
- * borrowable, so no borrow of one exists for this to cover.
100525
- *
100526
- * **Leaving part of a kind out.** A record's `'*'` key stands for every accessor it doesn't name,
100527
- * and a list entry `'*'` for every path, so everything but one folder is spelled
100528
- * ```ts
100529
- * link: { '*': '*', modifiers: ['*', '!text'] }
100530
- * ```
100531
- * A `!` entry leaves that path out, or a folder's members, whatever else in the list reaches it.
100532
- * Unlike a path a list doesn't name, an excluded path derives no row however the link reaches it —
100533
- * a linked token whose override is under a `text` modifier names that modifier, and it still
100534
- * stays out — so the name is free for this config to author, and the source's entity stays
100535
- * reachable qualified. A token's overrides under an excluded modifier are left out of the build
100536
- * rather than refused (`unstatableConditions`), which is what a consumer without one of the
100537
- * source's mode axes means. A linked component's rule keyed on one still reaches the source's
100538
- * modifier, as a rule on any modifier the link doesn't take does. See `covers` and `excludes`.
100539
- *
100540
- * Exclusions win wherever they sit, so `['!text', '*']` is `['*', '!text']`, and a list of them
100541
- * alone (`['!text']`) takes nothing by name and still keeps `text` out. An `options` entry at an
100542
- * excluded path is refused (an invariant), since no row derives there for it to adjust. `exclude`
100543
- * writes one (and drops such entries with it), and `link` lifts one over what it takes. `unlink`
100544
- * keeps them and writes none, because a `!` also drops the overrides under the path, which
100545
- * unlinking never has.
100546
- *
100547
- * No entity path can be misread here: `entityPathProblem` refuses a segment that starts with `!`,
100548
- * a segment that is `*`, and an empty segment, wherever a path becomes an identity.
100549
- */
100550
- link: external_exports.union([external_exports.literal("*"), external_exports.record(external_exports.string(), external_exports.union([external_exports.literal("*"), external_exports.array(external_exports.string().min(1)).min(1)]))]).optional().describe("What this system draws from the source, standing: `'*'` for everything, or a record by kind (`'*'` keys every kind it doesn't name). A list's `'!path'` entry leaves that path out."),
100551
- /**
100552
100748
  * What this system does to individual entities of the source, keyed by accessor, then by the path
100553
100749
  * the source spells, then by verb.
100554
100750
  *
@@ -100591,6 +100787,11 @@ var LinkedSystemDefinition = defineEntity({
100591
100787
  */
100592
100788
  options: pinOptions,
100593
100789
  /**
100790
+ * The spelling `options.include` had. Still typed for a body written that way, and moved to
100791
+ * `options.include` wherever one is written (`EntityKind.retiredFields`), so it's never stored.
100792
+ */
100793
+ link: linkDeclarationSchema.optional().meta({ deprecated: true }).describe("Deprecated: what the source includes is `options.include`."),
100794
+ /**
100594
100795
  * An npm package that ships a built system — `@acme/design-system`.
100595
100796
  *
100596
100797
  * The third origin, and the one a consumer outside the publisher's monorepo and off their Create
@@ -100702,7 +100903,7 @@ var LinkedSystemDefinition = defineEntity({
100702
100903
  unavailable: sourceUnavailable
100703
100904
  },
100704
100905
  /**
100705
- * Whether this pin's `link` declaration covers one of the source's entities — the derive pass's
100906
+ * Whether this pin's `options.include` covers one of the source's entities — the derive pass's
100706
100907
  * question and the delete gate's, answered here because `link` is this kind's field and its shape
100707
100908
  * is this kind's to interpret.
100708
100909
  *
@@ -100713,13 +100914,13 @@ var LinkedSystemDefinition = defineEntity({
100713
100914
  * (`EntityKind.linkable`), so the claim is unreachable rather than filtered.
100714
100915
  */
100715
100916
  bulkAdopts: ({ body, kind, accessor, path: path2 }) => covers({
100716
- declared: body.link,
100917
+ declared: includeOf(body),
100717
100918
  accessor: accessor ?? kind,
100718
100919
  path: path2
100719
100920
  }),
100720
100921
  sourceType: (body) => body.type === "hybrid" ? "hybrid" : "linked",
100721
100922
  bulkExcludes: ({ body, kind, accessor, path: path2 }) => excludes({
100722
- declared: body.link,
100923
+ declared: includeOf(body),
100723
100924
  accessor: accessor ?? kind,
100724
100925
  path: path2
100725
100926
  }),
@@ -100736,14 +100937,10 @@ var LinkedSystemDefinition = defineEntity({
100736
100937
  * The field-path address `options` stores one entry at — accessor, then the path the source
100737
100938
  * spells, so an edit to a minted row lands on the same key {@link directiveAt} reads back.
100738
100939
  */
100739
- bulkDirectives: (body) => {
100740
- const options = body.options;
100741
- if (!options) return [];
100742
- return Object.entries(options).flatMap(([accessor, entries]) => isPlainObject(entries) ? Object.keys(entries).map((path2) => ({
100743
- accessor,
100744
- path: path2
100745
- })) : []);
100746
- },
100940
+ bulkDirectives: (body) => directivesOf(body).flatMap(([accessor, entries]) => isPlainObject(entries) ? Object.keys(entries).map((path2) => ({
100941
+ accessor,
100942
+ path: path2
100943
+ })) : []),
100747
100944
  bulkOverlayWrite: ({ accessor, path: path2, overlay }) => ({ [`options.${accessor}.${path2}`]: overlay })
100748
100945
  });
100749
100946
  function storedPinBody(body) {
@@ -100756,7 +100953,7 @@ function storedPinBody(body) {
100756
100953
  function storedPinOptions(options) {
100757
100954
  const stored = {};
100758
100955
  for (const [accessor, entries] of Object.entries(options)) {
100759
- if (!isPlainObject(entries)) {
100956
+ if (accessor === "include" || !isPlainObject(entries)) {
100760
100957
  stored[accessor] = entries;
100761
100958
  continue;
100762
100959
  }
@@ -100777,9 +100974,9 @@ function storedPinOptions(options) {
100777
100974
  }
100778
100975
  function sourceItem(def) {
100779
100976
  if (typeof def !== "object" || def === null || isRef2(def)) return def;
100780
- const body = storedFromAuthored({
100977
+ const body = foldRetiredFields({
100781
100978
  body: def,
100782
- authoredAt: SOURCE_AUTHORED_AT
100979
+ retired: SOURCE_RETIRED_FIELDS
100783
100980
  });
100784
100981
  if (!isPlainObject(body.options)) return body;
100785
100982
  return {
@@ -100789,14 +100986,14 @@ function sourceItem(def) {
100789
100986
  }
100790
100987
  var Source = Object.assign(LinkedSystemDefinition, { item: sourceItem });
100791
100988
  function excludedDirectives(config2) {
100792
- return config2.list("linked-system").flatMap(({ path: slug2 }) => {
100793
- const body = config2.storedBody("linked-system", slug2);
100794
- if (!body?.options) return [];
100795
- return Object.entries(body.options).flatMap(([accessor, entries]) => isPlainObject(entries) ? Object.keys(entries).filter((path2) => excludes({
100796
- declared: body.link,
100989
+ return config2.list("source").flatMap(({ path: slug2 }) => {
100990
+ const body = config2.storedBody("source", slug2);
100991
+ const declared2 = includeOf(body);
100992
+ return directivesOf(body).flatMap(([accessor, entries]) => isPlainObject(entries) ? Object.keys(entries).filter((path2) => excludes({
100993
+ declared: declared2,
100797
100994
  accessor,
100798
100995
  path: path2
100799
- })).map((path2) => `Link "${slug2}": options.${accessor}["${path2}"] adjusts a path its \`link\` excludes, which derives no row. Drop the entry, or the exclusion.`) : []);
100996
+ })).map((path2) => `Link "${slug2}": options.${accessor}["${path2}"] adjusts a path its \`options.include\` excludes, which derives no row. Drop the entry, or the exclusion.`) : []);
100800
100997
  });
100801
100998
  }
100802
100999
  function directiveAt(body, accessor, path2) {
@@ -100805,7 +101002,7 @@ function directiveAt(body, accessor, path2) {
100805
101002
  function linkRedirects(config2) {
100806
101003
  const kindOfAccessor = (accessor) => config2.accessors()[accessor]?.kind ?? accessor;
100807
101004
  const declared2 = [];
100808
- for (const link2 of config2.list("linked-system")) {
101005
+ for (const link2 of config2.list("source")) {
100809
101006
  const { options } = link2.toJSON();
100810
101007
  for (const [accessor, entries] of Object.entries(options ?? {})) for (const [path2, entry] of Object.entries(entries ?? {})) {
100811
101008
  const override = isPlainObject(entry) ? entry.override : void 0;
@@ -101201,6 +101398,107 @@ var buildDebugMigration = {
101201
101398
  }
101202
101399
  };
101203
101400
 
101401
+ // ../config/dist/migrations/20261105185042_sources_stored.js
101402
+ var SOURCES_STORED_VERSION = 20261105185042;
101403
+ var OLD_KIND = "linked-system";
101404
+ var NEW_KIND = "source";
101405
+ var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
101406
+ var OLD_PREFIX = `${OLD_KIND}:`;
101407
+ var NEW_PREFIX = `${NEW_KIND}:`;
101408
+ var renamedMarkers = (text) => text.includes(`{${OLD_PREFIX}`) ? text.split(`{${OLD_PREFIX}`).join(`{${NEW_PREFIX}`) : text;
101409
+ function renamedRefs(value) {
101410
+ if (typeof value === "string") return renamedMarkers(value);
101411
+ if (Array.isArray(value)) {
101412
+ const mapped = value.map(renamedRefs);
101413
+ return mapped.some((member, index) => member !== value[index]) ? mapped : value;
101414
+ }
101415
+ if (!isRecord2(value)) return value;
101416
+ let changed = false;
101417
+ const entries = Object.entries(value).map(([key2, member]) => {
101418
+ if (key2 === "__ref" && typeof member === "string") {
101419
+ const renamedRef = member.startsWith(OLD_PREFIX) ? `${NEW_PREFIX}${member.slice(OLD_PREFIX.length)}` : member;
101420
+ if (renamedRef !== member) changed = true;
101421
+ return [key2, renamedRef];
101422
+ }
101423
+ const renamedKey2 = renamedMarkers(key2);
101424
+ const renamedMember = renamedRefs(member);
101425
+ if (renamedKey2 !== key2 || renamedMember !== member) changed = true;
101426
+ return [renamedKey2, renamedMember];
101427
+ });
101428
+ return changed ? Object.fromEntries(entries) : value;
101429
+ }
101430
+ function withInclude(body) {
101431
+ if (!isRecord2(body) || !("link" in body)) return body;
101432
+ const { link: link2, ...rest } = body;
101433
+ if (link2 === void 0 || link2 === null) return rest;
101434
+ const options = isRecord2(rest.options) ? rest.options : {};
101435
+ if ("include" in options) return rest;
101436
+ return {
101437
+ ...rest,
101438
+ options: {
101439
+ include: link2,
101440
+ ...options
101441
+ }
101442
+ };
101443
+ }
101444
+ function renamedKey(record2, transform2 = (member) => member) {
101445
+ if (!isRecord2(record2) || !(OLD_KIND in record2)) return record2;
101446
+ const { [OLD_KIND]: moved, ...rest } = record2;
101447
+ const members2 = isRecord2(moved) ? Object.fromEntries(Object.entries(moved).map(([path2, member]) => [path2, transform2(member)])) : moved;
101448
+ return {
101449
+ ...rest,
101450
+ [NEW_KIND]: members2
101451
+ };
101452
+ }
101453
+ function sourcesStored(json2) {
101454
+ const ownedKinds = Array.isArray(json2.ownedKinds) ? json2.ownedKinds.map((kind) => kind === OLD_KIND ? NEW_KIND : kind) : json2.ownedKinds;
101455
+ return {
101456
+ ...json2,
101457
+ ...json2.ownedKinds === void 0 ? {} : { ownedKinds },
101458
+ ...json2.items === void 0 ? {} : { items: renamedRefs(renamedKey(json2.items, withInclude)) },
101459
+ ...json2.groups === void 0 ? {} : { groups: renamedRefs(renamedKey(json2.groups)) },
101460
+ ...json2.overrides === void 0 ? {} : { overrides: renamedRefs(renamedKey(json2.overrides)) }
101461
+ };
101462
+ }
101463
+ function renamedDelta2(data) {
101464
+ if (!isRecord2(data)) return data;
101465
+ const out = {};
101466
+ for (const [key2, value] of Object.entries(data)) if (key2 === "link") out["options.include"] = value;
101467
+ else if (key2.startsWith("link.")) out[`options.include${key2.slice(4)}`] = value;
101468
+ else out[key2] = value;
101469
+ return out;
101470
+ }
101471
+ var sourcesStoredMigration = {
101472
+ version: SOURCES_STORED_VERSION,
101473
+ up: sourcesStored,
101474
+ fromSchema: external_exports.looseObject({}),
101475
+ toSchema: external_exports.looseObject({}).refine((json2) => {
101476
+ const items = json2.items;
101477
+ if (!isRecord2(items)) return true;
101478
+ if (OLD_KIND in items) return false;
101479
+ const sources = items[NEW_KIND];
101480
+ return !isRecord2(sources) || Object.values(sources).every((body) => !isRecord2(body) || !("link" in body));
101481
+ }, { message: "a source is stored under `source`, with what it includes at `options.include`" }),
101482
+ upPatch(written) {
101483
+ const refsRenamed = "data" in written ? renamedRefs(written.data) : void 0;
101484
+ const patch = "data" in written && refsRenamed !== written.data ? {
101485
+ ...written,
101486
+ data: refsRenamed
101487
+ } : written;
101488
+ if (patch.kind !== OLD_KIND) return patch;
101489
+ const renamed = {
101490
+ ...patch,
101491
+ kind: NEW_KIND
101492
+ };
101493
+ if (!("data" in renamed) || "field" in renamed) return renamed;
101494
+ const data = renamed.operation === "update" ? renamedDelta2(renamed.data) : withInclude(renamed.data);
101495
+ return {
101496
+ ...renamed,
101497
+ data
101498
+ };
101499
+ }
101500
+ };
101501
+
101204
101502
  // ../../node_modules/css-tree/lib/generator/sourceMap.js
101205
101503
  var import_source_map_generator = __toESM(require_source_map_generator(), 1);
101206
101504
  var trackNodes = /* @__PURE__ */ new Set(["Atrule", "Selector", "Declaration"]);
@@ -103547,8 +103845,8 @@ var startingStyleModifierMigration = {
103547
103845
 
103548
103846
  // ../config/dist/migrations/20261009181635_css_motion_strict.js
103549
103847
  var CSS_MOTION_STRICT_VERSION = 20261009181635;
103550
- var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
103551
- var isRef3 = (value) => isRecord2(value) && "__ref" in value;
103848
+ var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
103849
+ var isRef3 = (value) => isRecord3(value) && "__ref" in value;
103552
103850
  var JS_ONLY = [
103553
103851
  "whileDrag",
103554
103852
  "layout",
@@ -103618,33 +103916,33 @@ function timingOf(level) {
103618
103916
  return out;
103619
103917
  }
103620
103918
  function transitionOf(transition2) {
103621
- const out = timingOf(isRecord2(transition2.default) ? transition2.default : transition2);
103622
- const properties = isRecord2(transition2.properties) ? { ...transition2.properties } : {};
103919
+ const out = timingOf(isRecord3(transition2.default) ? transition2.default : transition2);
103920
+ const properties = isRecord3(transition2.properties) ? { ...transition2.properties } : {};
103623
103921
  for (const [key2, value] of Object.entries(transition2)) {
103624
103922
  if (key2 === "default" || key2 === "properties" || TIMING.has(key2)) continue;
103625
- if (isRecord2(value) && !isRef3(value)) properties[key2] = timingOf(value);
103923
+ if (isRecord3(value) && !isRef3(value)) properties[key2] = timingOf(value);
103626
103924
  }
103627
103925
  if (Object.keys(properties).length > 0) out.properties = properties;
103628
103926
  return out;
103629
103927
  }
103630
103928
  function stateOf2(target2) {
103631
- if (!isRecord2(target2)) return target2;
103929
+ if (!isRecord3(target2)) return target2;
103632
103930
  const { transitionEnd: _transitionEnd, ...rest } = target2;
103633
- if (isRecord2(rest.transition)) rest.transition = transitionOf(rest.transition);
103931
+ if (isRecord3(rest.transition)) rest.transition = transitionOf(rest.transition);
103634
103932
  return rest;
103635
103933
  }
103636
103934
  function strictCssMotion(body) {
103637
- if (!isRecord2(body) || body.runtime !== "css") return body;
103935
+ if (!isRecord3(body) || body.runtime !== "css") return body;
103638
103936
  const out = { ...body };
103639
103937
  for (const field of JS_ONLY) delete out[field];
103640
103938
  for (const state of STATES2) if (out[state] !== void 0) out[state] = stateOf2(out[state]);
103641
- if (isRecord2(out.variants)) out.variants = Object.fromEntries(Object.entries(out.variants).map(([name, target2]) => [name, stateOf2(target2)]));
103642
- if (isRecord2(out.transition)) out.transition = transitionOf(out.transition);
103939
+ if (isRecord3(out.variants)) out.variants = Object.fromEntries(Object.entries(out.variants).map(([name, target2]) => [name, stateOf2(target2)]));
103940
+ if (isRecord3(out.transition)) out.transition = transitionOf(out.transition);
103643
103941
  return out;
103644
103942
  }
103645
103943
  function cssMotionStrict(json2) {
103646
103944
  const items = json2.items;
103647
- if (!isRecord2(items) || !isRecord2(items.motion)) return json2;
103945
+ if (!isRecord3(items) || !isRecord3(items.motion)) return json2;
103648
103946
  const motion = Object.fromEntries(Object.entries(items.motion).map(([path2, body]) => [path2, strictCssMotion(body)]));
103649
103947
  return {
103650
103948
  ...json2,
@@ -103660,8 +103958,8 @@ var cssMotionStrictMigration = {
103660
103958
  fromSchema: external_exports.looseObject({}),
103661
103959
  toSchema: external_exports.looseObject({}).refine((json2) => {
103662
103960
  const items = json2.items;
103663
- if (!isRecord2(items) || !isRecord2(items.motion)) return true;
103664
- return Object.values(items.motion).every((body) => !isRecord2(body) || body.runtime !== "css" || JS_ONLY.every((field) => body[field] === void 0));
103961
+ if (!isRecord3(items) || !isRecord3(items.motion)) return true;
103962
+ return Object.values(items.motion).every((body) => !isRecord3(body) || body.runtime !== "css" || JS_ONLY.every((field) => body[field] === void 0));
103665
103963
  }, { message: "a CSS motion preset holds none of a JS preset's own fields" }),
103666
103964
  upPatch(patch) {
103667
103965
  if (patch.kind !== "motion" || !("data" in patch)) return patch;
@@ -103946,6 +104244,7 @@ if (!registeredSchemaMigrations().has(20261102185610)) registerSchemaMigrations(
103946
104244
  if (!registeredSchemaMigrations().has(20261102193912)) registerSchemaMigrations(mapPropsFromMigration);
103947
104245
  if (!registeredSchemaMigrations().has(20261103115059)) registerSchemaMigrations(sourcesAuthoringMigration);
103948
104246
  if (!registeredSchemaMigrations().has(20261104151013)) registerSchemaMigrations(buildDebugMigration);
104247
+ if (!registeredSchemaMigrations().has(20261105185042)) registerSchemaMigrations(sourcesStoredMigration);
103949
104248
 
103950
104249
  // ../config/dist/capture/node-ops.js
103951
104250
  var DEFAULT_WIDTH = 1600;