@homepages/concrete 9.0.0 → 10.0.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 (143) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +3 -3
  3. package/codemods/manifest.json +14 -0
  4. package/codemods/registry-keys-only.mjs +113 -0
  5. package/codemods/steps/list-object-form.mjs +2 -3
  6. package/codemods/steps/registry-key-reads.mjs +276 -0
  7. package/dist/artifact/playground/client/assets/index-BFNHB7VM.css +1 -0
  8. package/dist/artifact/playground/client/assets/index-Div1yo6s.js +1259 -0
  9. package/dist/artifact/playground/client/index.html +2 -2
  10. package/dist/artifact/playground/host.mjs +42 -42
  11. package/dist/cli/build/artifact.js +2 -1
  12. package/dist/cli/build/fixtures.js +2 -1
  13. package/dist/cli/check/render/inputs.js +3 -3
  14. package/dist/cli/check/stages/sections.js +5 -6
  15. package/dist/cli/check/stages/workspace.js +2 -0
  16. package/dist/cli/check/template-key.js +16 -0
  17. package/dist/cli/dev/workspace-reader.js +9 -2
  18. package/dist/fixtures/media-store.js +3 -3
  19. package/dist/fixtures/resolve.js +28 -23
  20. package/dist/fixtures/synthesize-empties.js +3 -1
  21. package/dist/fixtures.d.ts +1 -1
  22. package/dist/index.d.ts +3 -4
  23. package/dist/packages/external/concrete/package.js +1 -1
  24. package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +1 -1
  25. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +15 -27
  26. package/dist/packages/internal/fill-bake/dist/compute-reads.js +12 -12
  27. package/dist/packages/internal/fill-bake/dist/derive-source.js +7 -14
  28. package/dist/packages/internal/fill-bake/dist/index.js +4 -3
  29. package/dist/packages/internal/fill-bake/dist/item-merge.js +36 -16
  30. package/dist/packages/internal/fill-bake/dist/item-overrides.js +1 -28
  31. package/dist/packages/internal/fill-bake/dist/linked-merge.js +5 -7
  32. package/dist/packages/internal/fill-bake/dist/list-grammar.js +11 -34
  33. package/dist/packages/internal/fill-bake/dist/stored-row-reader.js +1 -0
  34. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +12 -39
  35. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +2 -17
  36. package/dist/packages/internal/media-resolution/dist/document.js +16 -15
  37. package/dist/packages/internal/media-resolution/dist/image.js +38 -94
  38. package/dist/packages/internal/media-resolution/dist/index.js +1 -1
  39. package/dist/packages/internal/media-resolution/dist/list.js +12 -12
  40. package/dist/packages/internal/media-resolution/dist/media.js +17 -16
  41. package/dist/packages/internal/media-resolution/dist/records.js +4 -2
  42. package/dist/packages/internal/media-resolution/dist/slot.js +9 -6
  43. package/dist/packages/internal/media-resolution/dist/tour.js +12 -11
  44. package/dist/packages/internal/media-resolution/dist/video.js +16 -16
  45. package/dist/packages/internal/property-facts/dist/registry-facts.js +10 -2
  46. package/dist/packages/internal/section-contracts/dist/catalog.js +2 -10
  47. package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +5 -12
  48. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +1 -5
  49. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +7 -5
  50. package/dist/packages/internal/section-contracts/dist/grammar-scope.js +1 -1
  51. package/dist/packages/internal/section-contracts/dist/index.js +0 -2
  52. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +0 -29
  53. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +2 -16
  54. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +6 -6
  55. package/dist/packages/internal/section-contracts/dist/object-contract.js +4 -2
  56. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +6 -2
  57. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -15
  58. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +6 -7
  59. package/dist/packages/internal/section-contracts/dist/row-source-contract.js +7 -8
  60. package/dist/packages/internal/section-contracts/dist/runners.js +5 -17
  61. package/dist/packages/internal/section-contracts/dist/select-contract.js +7 -1
  62. package/dist/packages/internal/section-contracts/dist/source-contract.js +20 -79
  63. package/dist/packages/internal/section-contracts/dist/sources-contract.js +1 -1
  64. package/dist/packages/internal/section-contracts/dist/table-member.js +5 -8
  65. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +5 -10
  66. package/dist/packages/internal/source-resolution/dist/index.js +21 -189
  67. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  68. package/dist/packages/internal/template-artifact/dist/layout.js +3 -1
  69. package/dist/packages/internal/template-artifact/dist/verify.js +32 -16
  70. package/dist/packages/internal/template-contracts/dist/content-pick.js +24 -1
  71. package/dist/packages/internal/template-contracts/dist/decision-fills.js +2 -6
  72. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +2 -2
  73. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +3 -2
  74. package/dist/packages/internal/template-contracts/dist/fact-keys.js +19 -43
  75. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +24 -3
  76. package/dist/packages/internal/template-contracts/dist/fact-registry.js +14 -7
  77. package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +1 -1
  78. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +3 -68
  79. package/dist/packages/internal/template-contracts/dist/fill-spec.js +7 -6
  80. package/dist/packages/internal/template-contracts/dist/list-editing.js +0 -1
  81. package/dist/packages/internal/template-contracts/dist/list.d.ts +1 -1
  82. package/dist/packages/internal/template-contracts/dist/list.js +7 -15
  83. package/dist/packages/internal/template-contracts/dist/media-candidates.js +1 -1
  84. package/dist/packages/internal/template-contracts/dist/mirror-kind.js +2 -2
  85. package/dist/packages/internal/template-contracts/dist/object.js +3 -2
  86. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +2 -2
  87. package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +2 -2
  88. package/dist/packages/internal/template-contracts/dist/read-graph.js +14 -51
  89. package/dist/packages/internal/template-contracts/dist/ref-locate.js +15 -27
  90. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +3 -1
  91. package/dist/packages/internal/template-contracts/dist/registry-facts.js +13 -24
  92. package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +20 -4
  93. package/dist/packages/internal/template-contracts/dist/registry-shape.js +69 -11
  94. package/dist/packages/internal/template-contracts/dist/row-planners.js +1 -1
  95. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +5 -14
  96. package/dist/packages/internal/template-contracts/dist/row-ref.js +7 -23
  97. package/dist/packages/internal/template-contracts/dist/row-sources.js +6 -16
  98. package/dist/packages/internal/template-contracts/dist/row.d.ts +1 -1
  99. package/dist/packages/internal/template-contracts/dist/row.js +6 -7
  100. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +5 -20
  101. package/dist/packages/internal/template-contracts/dist/section-schema-types.d.ts +1 -0
  102. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +29 -37
  103. package/dist/packages/internal/template-contracts/dist/slot-builders.js +4 -7
  104. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +2 -733
  105. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +2 -502
  106. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +4 -1
  107. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +4 -4
  108. package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -2
  109. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +9 -10
  110. package/dist/packages/internal/template-contracts/dist/table-members.d.ts +5 -12
  111. package/dist/packages/internal/template-contracts/dist/table-members.js +7 -37
  112. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +2 -2
  113. package/dist/primitives/Image.d.ts +3 -3
  114. package/dist/primitives/slot-bindings.js +2 -2
  115. package/dist/primitives/slot-download.d.ts +1 -1
  116. package/dist/primitives/slot-media.d.ts +1 -1
  117. package/dist/rules/registry.js +6 -0
  118. package/dist/schema/fact.d.ts +19 -52
  119. package/dist/schema/fact.js +6 -25
  120. package/dist/schema/facts-view.d.ts +1 -2
  121. package/dist/schema/property-facts.d.ts +1 -62
  122. package/dist/schema/section-schema.d.ts +2 -2
  123. package/dist/schema/section-schema.js +1 -1
  124. package/dist/section/section.d.ts +2 -2
  125. package/guide/reference/cli/INDEX.md +2 -2
  126. package/guide/reference/cli/build.md +1 -1
  127. package/guide/reference/cli/check.md +1 -1
  128. package/guide/reference/cli/dev.md +1 -1
  129. package/guide/reference/cli/property-add.md +1 -1
  130. package/guide/reference/cli/property-list.md +1 -1
  131. package/guide/reference/cli/publish.md +1 -1
  132. package/guide/reference/cli/upgrade.md +1 -1
  133. package/guide/reference/rules/INDEX.md +4 -5
  134. package/package.json +1 -1
  135. package/dist/artifact/playground/client/assets/index-BUmdDDX5.js +0 -1259
  136. package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +0 -1
  137. package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +0 -15
  138. package/dist/packages/internal/section-contracts/dist/group-contract.js +0 -19
  139. package/dist/packages/internal/section-contracts/dist/option-source-contract.js +0 -22
  140. package/dist/packages/internal/template-contracts/dist/comparable-address.js +0 -19
  141. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +0 -62
  142. package/dist/packages/internal/template-contracts/dist/legacy-facts.js +0 -167
  143. package/dist/packages/internal/template-contracts/dist/registry-aliases.js +0 -77
@@ -1,6 +1,8 @@
1
- import { SLOT_TYPES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
1
+ import { SLOT_TYPES } from "../../template-contracts/dist/slot-catalog.js";
2
2
  import { readMediaOf } from "../../template-contracts/dist/media-candidates.js";
3
+ import { tableOf } from "../../template-contracts/dist/registry-shape.js";
3
4
  import { isMediaListKey } from "../../template-contracts/dist/fact-keys.js";
5
+ import "../../template-contracts/dist/table-members.js";
4
6
  import { FINDABLE_KINDS, isFindableKind } from "../../template-contracts/dist/findable.js";
5
7
  import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
6
8
  import { readFillVerb } from "../../fill-vocabulary/dist/verbs.js";
@@ -19,7 +21,7 @@ function checkCandidates(of, where) {
19
21
  if (!isRecord(of)) throw new Error(`${where} picks \`of\` ${JSON.stringify(of)}, which is no list of candidates.`);
20
22
  if (of["type"] === "media") {
21
23
  const from = readMediaOf(of)?.from;
22
- if (from === void 0 || !from.every((list) => isMediaListKey(list))) throw new Error(`${where} picks \`of\` ${JSON.stringify(of)} — a media pick states the media list of the property it picks \`from\` and its \`kinds\`; a media slot with no \`from\` owns its asset, and nothing picks it.`);
24
+ if (from === void 0 || !from.every((list) => isMediaListKey(list))) throw new Error(`${where} picks \`of\` ${JSON.stringify(of)} — a media pick states the media list of the property it picks \`from\` and its \`kinds\`; a media slot with no \`from\` owns its media, and nothing picks it.`);
23
25
  return;
24
26
  }
25
27
  if (typeof of["type"] === "string") {
@@ -28,7 +30,7 @@ function checkCandidates(of, where) {
28
30
  return;
29
31
  }
30
32
  const { kind, key, section, slot, transform } = of;
31
- if (kind === "home" && typeof key === "string" && tableKeyOf(key) !== null) return;
33
+ if (kind === "home" && typeof key === "string" && tableOf(key) !== null) return;
32
34
  if (kind === "section" && typeof section === "string" && typeof slot === "string") return;
33
35
  if (kind === "derived" && typeof transform === "string") return;
34
36
  throw new Error(`${where} picks \`of\` ${JSON.stringify(of)}, which is not a list of candidates — a table, a media slot's \`from\` list, a list slot, a compute, or a select's values.`);
@@ -70,7 +72,7 @@ function assertFillVerbContract(ctx, decision) {
70
72
  const where = `Section "${ctx.key}": fill "${decision.id}"`;
71
73
  const node = decision;
72
74
  if (decision.verb === void 0) {
73
- for (const option of ["of", "unique"]) if (decision[option] !== void 0) throw new Error(`${where} declares \`${option}\` but no verb — \`${option}\` belongs to a \`fill.pick\`; rebuild the section with the current Concrete.`);
75
+ for (const option of ["of", "unique"]) if (decision[option] !== void 0) throw new Error(`${where} declares \`${option}\` but no verb — \`${option}\` belongs to a \`fill.pick\`.`);
74
76
  } else {
75
77
  const verb = checkNode(node, where);
76
78
  for (const id of decision.produces) {
@@ -83,7 +85,7 @@ function assertFillVerbContract(ctx, decision) {
83
85
  const list = decision.produces.length === 1 ? producedSlot(ctx.schema, decision.produces[0]) : void 0;
84
86
  const itemFields = list === void 0 ? void 0 : listItemFieldsOf(list);
85
87
  for (const [name, entry] of Object.entries(fields)) {
86
- if (!isRecord(entry) || entry["verb"] === void 0) continue;
88
+ if (!isRecord(entry)) continue;
87
89
  const at = `${where} field "${name}"`;
88
90
  const verb = checkNode(entry, at);
89
91
  const field = itemFields?.[name];
@@ -5,7 +5,7 @@ import { listSourceOf } from "../../template-contracts/dist/row-sources.js";
5
5
  //#region ../../internal/section-contracts/dist/grammar-scope.js
6
6
  const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
7
7
  function isGrammarList(slot) {
8
- return slot.type === "list" && slot.fields === void 0 && slot.element !== void 0;
8
+ return slot.type === "list" && slot.element !== void 0;
9
9
  }
10
10
  function grammarSlots(schema) {
11
11
  const out = [];
@@ -1,7 +1,6 @@
1
1
  import { SECTION_CONTRACT_CATALOG } from "./catalog.js";
2
2
  import { assertCapContract } from "./cap-contract.js";
3
3
  import { assertCountBoundsContract } from "./count-bounds-contract.js";
4
- import { assertGroupContract } from "./group-contract.js";
5
4
  import { assertInterpolationContract } from "./interpolation-contract.js";
6
5
  import { assertWriterReadsFactContract } from "./writer-reads-fact-contract.js";
7
6
  import { assertListFillContract } from "./list-fill-contract.js";
@@ -11,7 +10,6 @@ import { assertNestedSlotTypes } from "./nested-slot-contract.js";
11
10
  import { assertDirectlyLinkedListContract } from "./directly-linked-list-contract.js";
12
11
  import { assertFillVerbContract } from "./fill-verb-contract.js";
13
12
  import { assertObjectContract } from "./object-contract.js";
14
- import { assertOptionSourceContract } from "./option-source-contract.js";
15
13
  import { assertPoiCurationContract } from "./poi-curation-contract.js";
16
14
  import { assertReadsAcyclicContract } from "./reads-acyclic-contract.js";
17
15
  import { assertRowFillContract } from "./row-fill-contract.js";
@@ -1,37 +1,8 @@
1
- import { isListSlot } from "../../fill-vocabulary/dist/holder.js";
2
- import { resolveDecision } from "../../fill-vocabulary/dist/resolved-decision.js";
3
- import { producedSlots } from "./grammar-scope.js";
4
1
  import { assertOptionsHonoured } from "./fill-options.js";
5
- import { isListFill, plannedFieldsOf } from "./fill-spec-view.js";
6
2
 
7
3
  //#region ../../internal/section-contracts/dist/list-fill-contract.js
8
4
  function assertListFillContract(schema, decision, sectionKey) {
9
5
  assertOptionsHonoured(schema, decision, sectionKey, ["brief", "none"]);
10
- const fill = decision;
11
- if (!isListFill(decision)) return;
12
- if (decision.verb !== void 0) return;
13
- const resolved = resolveDecision(decision, producedSlots(schema, decision.produces));
14
- for (const target of resolved.targets) {
15
- const slot = schema.slots[target.slot];
16
- if (slot === void 0 || !isListSlot(slot)) continue;
17
- const where = `Section "${sectionKey}": list fill "${decision.id}"`;
18
- if (!target.runs) {
19
- if (slot.fields !== void 0) assertRowsOriginate(slot, plannedFieldsOf(decision), `${where} produces "${target.slot}"`);
20
- continue;
21
- }
22
- assertDeclares(fill, resolved.verb, target, slot, where);
23
- }
24
- }
25
- function assertRowsOriginate(slot, planned, where) {
26
- const unwritten = Object.entries(slot.fields ?? {}).filter(([name, field]) => field.source === void 0 && !planned.includes(name)).map(([name]) => name);
27
- throw new Error(`${where}, a record list whose rows nothing originates: it is not bound to a facts array, and ${unwritten.length > 0 ? `${unwritten.map((name) => `"${name}"`).join(", ")} ${unwritten.length === 1 ? "carries" : "carry"} no fill of its own` : "no row field carries a fill of its own"}. Bind the list with \`source:\`, or give every row field a \`fill()\`, a row member or a \`compute()\`.`);
28
- }
29
- function assertDeclares(fill, verb, target, slot, where) {
30
- if (verb === void 0) return;
31
- if (typeof fill.brief !== "string" || fill.brief.length === 0) throw new Error(`${where} originates rows but declares no \`brief\` — the brief is the whole instruction.`);
32
- if (verb === "write" && fill.count === void 0 && slot.max === void 0) throw new Error(`${where} writes its ${target.holder?.shape === "objects" ? "rows" : "items"} but neither it nor the slot says how many — declare a \`count\`, or give the slot a \`max\`.`);
33
- const band = fill.count;
34
- if (typeof band?.min === "number" && typeof band.max === "number" && band.min > band.max) throw new Error(`${where} declares count.min ${String(band.min)} above count.max ${String(band.max)} — a band the model can never answer inside.`);
35
6
  }
36
7
 
37
8
  //#endregion
@@ -23,9 +23,9 @@ function checkSelectListVocabulary(element, label, sectionKey) {
23
23
  if (!Array.isArray(element.values) || element.values.length === 0) throw new Error(`Section "${sectionKey}": ${label} element is a \`select\` with no \`values\` — a select-list's vocabulary must be a non-empty static \`values\` array.`);
24
24
  }
25
25
  function checkSingleItem(slot, label, sectionKey) {
26
- if (slot.title !== void 0) throw new Error(`Section "${sectionKey}": ${label} declares \`title\` beside \`element\` — the row surface belongs to a record item (\`fields\`) only.`);
26
+ if (slot.title !== void 0) throw new Error(`Section "${sectionKey}": ${label} declares \`title\` — an item's title is its object's \`label\`.`);
27
27
  const element = slot.element;
28
- if (element == null) throw new Error(`Section "${sectionKey}": ${label} must declare its item — \`element\` (a single slot) or \`fields\` (a record of slots).`);
28
+ if (element == null) throw new Error(`Section "${sectionKey}": ${label} must declare its item — \`element\`, a slot, an \`object\` or a \`row\`.`);
29
29
  if (!LIST_ITEM_TYPES.has(element.type ?? "")) throw new Error(`Section "${sectionKey}": ${label} element must be a single value primitive (${[...LIST_ITEM_TYPES].join("|")}) — never a list or a record, got "${element.type}".`);
30
30
  if (element.type === "select") checkSelectListVocabulary(element, label, sectionKey);
31
31
  const vocabulary = element.values;
@@ -35,21 +35,7 @@ function checkSingleItem(slot, label, sectionKey) {
35
35
  if (typeof slot.min === "number" && slot.min > distinctCount) throw new Error(`Section "${sectionKey}": ${label} is \`unique\` with min ${slot.min} but its vocabulary has only ${distinctCount} distinct option(s) — min can never be satisfied.`);
36
36
  }
37
37
  }
38
- function checkRecordItem(slot, label, sectionKey) {
39
- if (slot.unique !== void 0) throw new Error(`Section "${sectionKey}": ${label} declares \`unique\` beside \`fields\` — \`unique\` is select-element distinctness; a record item has no element vocabulary.`);
40
- const fields = slot.fields ?? {};
41
- for (const [fieldId, field] of Object.entries(fields)) {
42
- if (field.type === "list" && field.fields != null) throw new Error(`Section "${sectionKey}": ${label} field "${fieldId}" may not be a record — identity is a flat 4-tuple, and a record field has no fifth element to address through.`);
43
- if (field.type === "list") checkSingleItem(field, `${label} field "${fieldId}"`, sectionKey);
44
- }
45
- if (slot.title !== void 0 && !Object.hasOwn(fields, slot.title)) throw new Error(`Section "${sectionKey}": ${label} \`title\` names "${slot.title}", which is not a declared field.`);
46
- }
47
38
  function checkListSlot(slot, label, sectionKey) {
48
- if (slot.element != null && slot.fields != null) throw new Error(`Section "${sectionKey}": ${label} declares both \`element\` and \`fields\` — the item is exactly one of the two.`);
49
- if (slot.fields != null) {
50
- checkRecordItem(slot, label, sectionKey);
51
- return;
52
- }
53
39
  const item = slot.element?.type;
54
40
  if (item === "object" || item === "row") {
55
41
  checkGrammarItem(slot, item, label, sectionKey);
@@ -4,16 +4,16 @@ import { nestedItemOf } from "./grammar-scope.js";
4
4
  //#region ../../internal/section-contracts/dist/nested-slot-contract.js
5
5
  function assertNestedSlotTypes(schema, sectionKey) {
6
6
  for (const [slotId, slot] of Object.entries(schema.slots)) {
7
- if (slot.fields) check(slot.fields, `${slot.type === "object" ? "object" : "list"} "${slotId}"`, slot.type === "object", sectionKey);
8
- if (slot.type === "list" && slot.fields === void 0 && slot.element?.type === "object" && slot.element.fields) check(slot.element.fields, `list "${slotId}"`, true, sectionKey);
7
+ if (slot.type === "object" && slot.fields) check(slot.fields, `object "${slotId}"`, sectionKey);
8
+ if (slot.type === "list" && slot.element?.type === "object" && slot.element.fields) check(slot.element.fields, `list "${slotId}"`, sectionKey);
9
9
  }
10
10
  }
11
- function check(fields, owner, grammar, sectionKey) {
11
+ function check(fields, owner, sectionKey) {
12
12
  for (const [childId, child] of Object.entries(fields)) {
13
13
  if (child.type == null) continue;
14
- if (!SLOT_TYPES.includes(child.type) && !(grammar && (child.type === "row" || child.type === "object"))) throw new Error(`Section "${sectionKey}": ${owner} item "${childId}" has unknown nested slot type "${child.type}".`);
15
- const nested = grammar ? nestedItemOf(child) : void 0;
16
- if (nested?.fields) check(nested.fields, `${owner} field "${childId}"`, true, sectionKey);
14
+ if (!SLOT_TYPES.includes(child.type) && child.type !== "row" && child.type !== "object") throw new Error(`Section "${sectionKey}": ${owner} item "${childId}" has unknown nested slot type "${child.type}".`);
15
+ const nested = nestedItemOf(child);
16
+ if (nested?.fields) check(nested.fields, `${owner} field "${childId}"`, sectionKey);
17
17
  }
18
18
  }
19
19
 
@@ -1,4 +1,6 @@
1
- import { OBJECT_BINDING_OWN_KEYS, SLOT_TYPES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
1
+ import { OBJECT_BINDING_OWN_KEYS, SLOT_TYPES } from "../../template-contracts/dist/slot-catalog.js";
2
+ import { tableOf } from "../../template-contracts/dist/registry-shape.js";
3
+ import "../../template-contracts/dist/table-members.js";
2
4
  import { fillOf, grammarSlots, nestedItemOf } from "./grammar-scope.js";
3
5
 
4
6
  //#region ../../internal/section-contracts/dist/object-contract.js
@@ -67,7 +69,7 @@ function checkNestedField(ctx, field) {
67
69
  const where = `Section "${ctx.key}": "${field.path}"`;
68
70
  const source = field.def.source;
69
71
  if (source === void 0) return;
70
- if (source.kind === "element" && field.def.type === "row" && tableKeyOf(field.def.from) !== null) throw new Error(`${where} is a table's row holding the element — the element of a list inside an object is a member's item; hold it in a row \`from\` that member.`);
72
+ if (source.kind === "element" && field.def.type === "row" && tableOf(field.def.from) !== null) throw new Error(`${where} is a table's row holding the element — the element of a list inside an object is a member's item; hold it in a row \`from\` that member.`);
71
73
  if (source.kind === "element") return;
72
74
  if (field.def.type !== "row" && source.kind === "row" && typeof source.slot === "string" && field.siblings?.[source.slot]?.type === "row") return;
73
75
  throw new Error(`${where} is sourced by ${JSON.stringify(source)} — an item of a list inside an object reads its element, a row \`from\` its member, or a row beside it; ${NESTED_HOME}.`);
@@ -1,4 +1,6 @@
1
- import { impliedVerbOf } from "../../fill-vocabulary/dist/verbs.js";
1
+ import { isFindableKind } from "../../template-contracts/dist/findable.js";
2
+ import { holderOf } from "../../fill-vocabulary/dist/holder.js";
3
+ import "../../fill-vocabulary/dist/verbs.js";
2
4
  import { isListFill } from "./fill-spec-view.js";
3
5
 
4
6
  //#region ../../internal/section-contracts/dist/poi-curation-contract.js
@@ -6,7 +8,9 @@ function assertPoiCurationContract(schema, decision, sectionKey) {
6
8
  if (!isListFill(decision) || decision.produces.length <= 1) return;
7
9
  const found = decision.produces.find((slotId) => {
8
10
  const slot = schema.slots[slotId];
9
- return slot !== void 0 && impliedVerbOf(slot) === "find";
11
+ if (slot === void 0) return false;
12
+ const holder = holderOf(slot);
13
+ return holder.shape === "list" && isFindableKind(holder.item);
10
14
  });
11
15
  if (found === void 0) return;
12
16
  throw new Error(`Section "${sectionKey}": POI find decision "${decision.id}" must produce exactly one slot (got [${decision.produces.join(", ")}]) — "${found}" is found by one place lookup, which answers one list.`);
@@ -2,7 +2,6 @@ import { plannerForField } from "../../template-contracts/dist/row-planners.js";
2
2
  import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
3
3
  import "../../fill-vocabulary/dist/row-planners.js";
4
4
  import { isListFill } from "./fill-spec-view.js";
5
- import { rowReadFields } from "../../fill-vocabulary/dist/row-reads.js";
6
5
 
7
6
  //#region ../../internal/section-contracts/dist/row-fill-contract.js
8
7
  function assertRowFillContract(schema, decision, sectionKey) {
@@ -21,23 +20,10 @@ function assertRowFillContract(schema, decision, sectionKey) {
21
20
  if (!rowField) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" field "${field}" is not a declared field of "${slotId}" (declared: ${declared.length > 0 ? declared.join(", ") : "none"}).`);
22
21
  if (rowField.source) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}", which is source-bound (source.kind "${rowField.source.kind ?? "?"}") — the fact bakes it; drop the decision.`);
23
22
  if (rowField.type === "row") continue;
24
- if (plannerForField(rowField) === void 0) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}" (type "${rowField.type}"), which no row can be filled with — a row field is written or picked inside the list's one batched call: text, a date, an email, a phone, a url, a select key, an asset, or a list of those.`);
25
- if (slot.source === void 0 && slot.fields !== void 0) {
26
- const reads = fill.fields?.[field]?.reads;
27
- assertEarlierRowReads(declared, field, reads, `Section "${sectionKey}": list fill "${decision.id}" field "${field}" of "${slotId}"`);
28
- }
23
+ if (plannerForField(rowField) === void 0) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}" (type "${rowField.type}"), which no row can be filled with — a row field is written or picked inside the list's one batched call: text, a date, an email, a phone, a url, a select key, a media value, or a list of those.`);
29
24
  }
30
25
  }
31
26
  }
32
- function assertEarlierRowReads(declared, field, reads, where) {
33
- const position = declared.indexOf(field);
34
- for (const read of rowReadFields(reads)) {
35
- const at = declared.indexOf(read);
36
- if (at === -1) throw new Error(`${where} reads row field "${read}", which the row does not declare (declared: ${declared.join(", ")}).`);
37
- if (at === position) throw new Error(`${where} reads itself — a row fill reads only fields declared before it.`);
38
- if (at > position) throw new Error(`${where} reads row field "${read}", declared after it — the model writes a row top to bottom, so a fill reads only earlier fields. Declare "${read}" first, or drop the read.`);
39
- }
40
- }
41
27
 
42
28
  //#endregion
43
29
  export { assertRowFillContract };
@@ -1,16 +1,18 @@
1
1
  import { ADDRESS_MEMBERS, isAddressMember } from "../../template-contracts/dist/address-value.js";
2
+ import { tableKey } from "../../template-contracts/dist/registry-shape.js";
2
3
  import { rowTableOf } from "../../template-contracts/dist/ref-locate.js";
4
+ import "../../template-contracts/dist/table-members.js";
3
5
  import { memberSourceOf } from "../../template-contracts/dist/row-sources.js";
4
6
  import { fillOf, grammarSlots, insideItem, slotInScope } from "./grammar-scope.js";
5
- import { tableKeySpelling, tableMemberOrRefuse } from "./table-member.js";
6
7
  import { fittingTypes, memberFits, refuseIndexedRow } from "./source-contract.js";
8
+ import { tableMemberOrRefuse } from "./table-member.js";
7
9
 
8
10
  //#region ../../internal/section-contracts/dist/row-rule-contract.js
9
11
  const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
10
12
  function memberOf(table, field, where) {
11
13
  return tableMemberOrRefuse(table, field, where, {
12
14
  noun: "member",
13
- identity: `"${field}" is the "${tableKeySpelling(table)}" row's identity, which the row slot's value already is — read a member of the row instead.`
15
+ identity: `"${field}" is the "${tableKey(table)}" row's identity, which the row slot's value already is — read a member of the row instead.`
14
16
  });
15
17
  }
16
18
  function resolveHolder(ctx, reader, rowKey, where) {
@@ -54,10 +56,7 @@ function checkReads(ctx, slot, reads, what) {
54
56
  refuseIndexedRow(where, entry);
55
57
  if (entry["kind"] !== "row") return;
56
58
  const member = memberSourceOf(entry);
57
- if (member === null) {
58
- if (slot.place === "top" && slot.def.fields !== void 0) return;
59
- throw new Error(`${where} reads a row member without naming its row slot — read it through a row: \`{ kind: "row", slot, field }\`.`);
60
- }
59
+ if (member === null) throw new Error(`${where} reads a row member without naming its row slot — read it through a row: \`{ kind: "row", slot, field }\`.`);
61
60
  const holder = resolveHolder(ctx, slot, member.slot, where);
62
61
  if (holder.kind === "address") addressMemberType(member.field, where);
63
62
  else if (holder.table !== null) memberOf(holder.table, member.field, where);
@@ -70,7 +69,7 @@ function assertRowRuleContract(ctx) {
70
69
  if (source?.kind === "row") {
71
70
  const member = memberSourceOf(source);
72
71
  if (member !== null) checkMemberSource(ctx, slot, member);
73
- else if (slot.place !== "top") throw new Error(`Section "${ctx.key}": "${slot.path}" reads row member "${String(source.field)}" without naming its row slot — the enclosing-list form reads only in a \`fields\` list. Declare the row and read through it: \`{ kind: "row", slot, field }\`.`);
72
+ else throw new Error(`Section "${ctx.key}": "${slot.path}" reads row member "${String(source.field)}" without naming its row slot — declare the row and read through it: \`{ kind: "row", slot, field }\`.`);
74
73
  }
75
74
  if (source?.kind === "derived") checkReads(ctx, slot, source.reads, "compute");
76
75
  if (source?.kind === "element" && slot.def.type !== "row" && !insideItem(slot)) throw new Error(`Section "${ctx.key}": "${slot.path}" is sourced by the element outside a list's item, where no element exists.`);
@@ -1,5 +1,4 @@
1
- import { TABLES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
2
- import { memberListOfKey } from "../../template-contracts/dist/registry-shape.js";
1
+ import { memberListOfKey, tableKey, tableNames, tableOf } from "../../template-contracts/dist/registry-shape.js";
3
2
  import { listSourceRefusal } from "../../template-contracts/dist/row.js";
4
3
  import "../../template-contracts/dist/table-members.js";
5
4
  import { elementTableOf, fillOf, grammarSlots, insideItem, sameSectionSlot, sectionSlotAt } from "./grammar-scope.js";
@@ -8,24 +7,24 @@ import { elementTableOf, fillOf, grammarSlots, insideItem, sameSectionSlot, sect
8
7
  const ORIGINS = "the element inside an item, a row slot, a `compute()`, or a `fill.pick`";
9
8
  function originTable(ctx, row) {
10
9
  const source = row.def.source;
11
- if (source?.kind === "element" && row.container !== void 0) return elementTableOf(ctx, row.container)?.table ?? null;
10
+ if (source?.kind === "element" && row.container !== void 0) return elementTableOf(ctx, row.container);
12
11
  if (source?.kind !== "section") return null;
13
12
  const target = sameSectionSlot(ctx, source);
14
13
  const def = target === null ? void 0 : sectionSlotAt(ctx.schema, target)?.def;
15
14
  if (def?.type !== "row" || typeof def.from !== "string") return null;
16
- return tableKeyOf(def.from)?.table ?? def.from;
15
+ return tableOf(def.from) ?? def.from;
17
16
  }
18
17
  function checkRow(ctx, row) {
19
18
  const where = `Section "${ctx.key}": row "${row.path}"`;
20
19
  const from = row.def.from;
21
20
  if (from === void 0) throw new Error(`${where} declares no \`from\` — a row names its table: \`row({ label, from: fact.property.contacts })\`; rebuild the section with the current Concrete.`);
22
21
  if (Array.isArray(from)) for (const [index, key] of from.entries()) {
23
- if (tableKeyOf(key) === null) throw new Error(`${where}'s \`from\` lists ${JSON.stringify(key)}, which is no table — a row's list of \`from\` names tables.`);
22
+ if (tableOf(key) === null) throw new Error(`${where}'s \`from\` lists ${JSON.stringify(key)}, which is no table — a row's list of \`from\` names tables.`);
24
23
  if (from.indexOf(key) !== index) throw new Error(`${where} names the table ${JSON.stringify(key)} twice in \`from\`.`);
25
24
  }
26
- const table = Array.isArray(from) ? tableKeyOf(from[0]) : tableKeyOf(from);
25
+ const table = Array.isArray(from) ? tableOf(from[0]) : tableOf(from);
27
26
  if (table === null) {
28
- if (memberListOfKey(from) === null) throw new Error(`${where}'s \`from\` is ${JSON.stringify(from)}, which is neither a table nor a table's list-valued member — a row's \`from\` is one of ${Object.keys(TABLES).map((t) => `"${t}"`).join(", ")}, or \`<table>.<member>\` for a list-valued member.`);
27
+ if (memberListOfKey(from) === null) throw new Error(`${where}'s \`from\` is ${JSON.stringify(from)}, which is neither a table nor a table's list-valued member — a row's \`from\` is one of ${tableNames().map((table) => `"${tableKey(table)}"`).join(", ")}, or \`<table>.<member>\` for a list-valued member.`);
29
28
  if (row.def.source?.kind !== "element" || !insideItem(row)) throw new Error(`${where} is \`from\` the list-valued member ${JSON.stringify(from)} but holds no element — a row from a member holds an item of the list over it: \`source: entry\`.`);
30
29
  return;
31
30
  }
@@ -57,7 +56,7 @@ function checkRow(ctx, row) {
57
56
  default: throw new Error(`${where} is sourced by ${JSON.stringify(source)} — a row's source is ${ORIGINS}.`);
58
57
  }
59
58
  const held = originTable(ctx, row);
60
- if (held !== null && held !== table.table) throw new Error(`${where} is \`from\` the ${table.table} table but its source holds rows of ${held} — a row's source yields a row of its own \`from\`.`);
59
+ if (held !== null && held !== table) throw new Error(`${where} is \`from\` the ${table} table but its source holds rows of ${held} — a row's source yields a row of its own \`from\`.`);
61
60
  }
62
61
  function assertRowSourceContract(ctx) {
63
62
  for (const slot of grammarSlots(ctx.schema)) if (slot.def.type === "row") checkRow(ctx, slot);
@@ -1,13 +1,9 @@
1
- import { FACT_GRAPH } from "../../template-contracts/dist/slot-catalog.js";
2
- import { legacyFactKey } from "../../template-contracts/dist/registry-aliases.js";
3
1
  import { isReadableFactKey } from "../../template-contracts/dist/fact-keys.js";
4
2
  import { SECTION_CONTRACT_CATALOG } from "./catalog.js";
5
3
  import { producedSlot } from "./grammar-scope.js";
6
4
  import { assertCapContract } from "./cap-contract.js";
7
5
  import { assertCountBoundsContract } from "./count-bounds-contract.js";
8
- import { assertGroupContract } from "./group-contract.js";
9
6
  import { assertInterpolationContract } from "./interpolation-contract.js";
10
- import { DECISION_KINDS } from "./fill-spec-view.js";
11
7
  import { assertWriterReadsFactContract } from "./writer-reads-fact-contract.js";
12
8
  import { assertListFillContract } from "./list-fill-contract.js";
13
9
  import { assertListScalarContract } from "./list-scalar-contract.js";
@@ -16,7 +12,7 @@ import { assertNestedSlotTypes } from "./nested-slot-contract.js";
16
12
  import { assertDirectlyLinkedListContract } from "./directly-linked-list-contract.js";
17
13
  import { assertFillVerbContract } from "./fill-verb-contract.js";
18
14
  import { assertObjectContract } from "./object-contract.js";
19
- import { assertOptionSourceContract } from "./option-source-contract.js";
15
+ import { DECISION_KINDS } from "./fill-spec-view.js";
20
16
  import { assertPoiCurationContract } from "./poi-curation-contract.js";
21
17
  import { assertReadsAcyclicContract } from "./reads-acyclic-contract.js";
22
18
  import { assertRowFillContract } from "./row-fill-contract.js";
@@ -55,8 +51,8 @@ function decisionReadNodes(decision) {
55
51
  const CONTRACTS = {
56
52
  "reads-readable": {
57
53
  implementation: bySection(({ key, fillSpec }) => {
58
- for (const r of fillSpec.reads ?? []) if (!isReadableFactKey(r) && !Object.hasOwn(FACT_GRAPH, legacyFactKey(r))) throw new Error(`Section "${key}": fill-spec reads "${r}", which is not a fact the registry declares.`);
59
- for (const d of fillSpec.decisions) for (const [at, node] of decisionReadNodes(d)) assertDeclaredRefs(`Section "${key}": fill-spec decision "${d.id}"${at}`, node.reads, () => void 0);
54
+ for (const r of fillSpec.reads ?? []) if (!isReadableFactKey(r)) throw new Error(`Section "${key}": fill-spec reads "${r}", which is not a fact the registry declares.`);
55
+ for (const d of fillSpec.decisions) for (const [at, node] of decisionReadNodes(d)) assertDeclaredRefs(`Section "${key}": fill-spec decision "${d.id}"${at}`, node.reads);
60
56
  }),
61
57
  assertions: []
62
58
  },
@@ -117,10 +113,10 @@ const CONTRACTS = {
117
113
  assertions: [assertDisplayEvidenceContract]
118
114
  },
119
115
  source: {
120
- implementation: bySection(({ key, schema, fillSpec }) => assertSourceContract({
116
+ implementation: bySection(({ key, schema }) => assertSourceContract({
121
117
  key,
122
118
  slots: schema.slots
123
- }, fillSpec)),
119
+ })),
124
120
  assertions: [assertSourceContract]
125
121
  },
126
122
  object: {
@@ -159,10 +155,6 @@ const CONTRACTS = {
159
155
  implementation: bySection(({ key, schema }) => assertSelectContract(schema, key)),
160
156
  assertions: [assertSelectContract]
161
157
  },
162
- "option-source": {
163
- implementation: bySection(({ key, schema }) => assertOptionSourceContract(schema, key)),
164
- assertions: [assertOptionSourceContract]
165
- },
166
158
  url: {
167
159
  implementation: bySection(({ key, schema }) => assertUrlContract(schema, key)),
168
160
  assertions: [assertUrlContract]
@@ -174,10 +166,6 @@ const CONTRACTS = {
174
166
  interpolation: {
175
167
  implementation: bySection(({ key, schema, fillSpec }) => assertInterpolationContract(fillSpec, key, schema)),
176
168
  assertions: [assertInterpolationContract]
177
- },
178
- group: {
179
- implementation: bySection(({ key, schema }) => assertGroupContract(schema, key)),
180
- assertions: [assertGroupContract]
181
169
  }
182
170
  };
183
171
  function perFill(input) {
@@ -1,7 +1,13 @@
1
+ import { factSelectValues } from "../../template-contracts/dist/fact-keys.js";
2
+
1
3
  //#region ../../internal/section-contracts/dist/select-contract.js
2
4
  function checkSelectSlot(slot, label, sectionKey) {
3
5
  if (slot.type !== "select") return;
4
- if (slot.values != null === (slot.options != null)) throw new Error(`Section "${sectionKey}": ${label} needs exactly one of \`values\` or \`options\`.`);
6
+ const hasValues = slot.values != null;
7
+ const fact = slot.source?.kind === "home" ? slot.source.key : void 0;
8
+ if (hasValues && fact !== void 0) throw new Error(`Section "${sectionKey}": ${label} declares both \`values\` and a fact source — name its choices in one place.`);
9
+ if (!hasValues && fact === void 0) throw new Error(`Section "${sectionKey}": ${label} needs its choices: \`values\`, or a fact source whose fact declares them.`);
10
+ if (fact !== void 0 && factSelectValues(fact) === void 0) throw new Error(`Section "${sectionKey}": ${label} is bound to ${JSON.stringify(fact)}, which declares no choices, so the dropdown would be empty — bind a fact that declares them (\`fact.property.listing_intent\`), or name the choices as its \`from\`.`);
5
11
  }
6
12
  function assertSelectContract(schema, sectionKey) {
7
13
  for (const [slotId, slotUnknown] of Object.entries(schema.slots)) {
@@ -1,10 +1,9 @@
1
- import { tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
1
+ import { tableOf } from "../../template-contracts/dist/registry-shape.js";
2
2
  import { mirrorKindOf } from "../../template-contracts/dist/mirror-kind.js";
3
- import { isMediaListKey, sourceFieldDescriptor } from "../../template-contracts/dist/fact-keys.js";
3
+ import { isMediaListKey, isRegistryFactKey, registryFactValueType } from "../../template-contracts/dist/fact-keys.js";
4
+ import "../../template-contracts/dist/table-members.js";
4
5
  import { memberSourceOf } from "../../template-contracts/dist/row-sources.js";
5
- import { plannedFieldsOf } from "./fill-spec-view.js";
6
6
  import { objectFieldOf } from "../../template-contracts/dist/slot-overrides.js";
7
- import { tableMemberOrRefuse } from "./table-member.js";
8
7
 
9
8
  //#region ../../internal/section-contracts/dist/source-contract.js
10
9
  function assertOne(path, key, slot, section) {
@@ -18,16 +17,15 @@ function assertOne(path, key, slot, section) {
18
17
  if (src.kind === "home") {
19
18
  const field = src.key ?? "";
20
19
  if (isMediaListKey(field)) throw new Error(`${path}: "${field}" is read, never bound — a \`compute()\` reads a media list; a media slot or a list of media picks from it, naming it as its \`from\` (\`fill.pick\`).`);
21
- const def = sourceFieldDescriptor(field);
22
- if (!def) throw new Error(`${path}: unknown fact "${String(src.key)}"`);
23
- const recordItemSlot = slot.type === "list" && slot.fields != null;
24
- if (def.image && slot.type !== "image") throw new Error(`${path}: image source field "${src.key}" must sit on an image slot`);
25
- if (def.value_type === "address" && slot.type !== "address") throw new Error(`${path}: "${field}" is a whole address, which only an \`address\` slot holds — bind it to an \`address()\`, or show the line you want with a \`compute()\` reading it (\`concrete upgrade\` rewrites a text slot bound to it).`);
26
- if (slot.type === "address" && def.value_type !== "address") throw new Error(`${path}: an \`address\` slot bound to "${field}", which is not an address — bind it to the property's address, or compute the value.`);
27
- if (tableKeyOf(field) !== null) {
28
- if (slot.type === "list" && slot.fields === void 0 && (slot.element?.type === "row" || slot.element?.type === "object")) return;
29
- if (!recordItemSlot) throw new Error(`${path}: table source "${src.key}" needs a record item (a list declaring \`fields\`, or an item that declares a row) — a fact row cannot project onto one slot.`);
20
+ if (tableOf(field) !== null) {
21
+ if (!(slot.type === "list" && (slot.element?.type === "row" || slot.element?.type === "object"))) throw new Error(`${path}: table source "${field}" needs an item that declares a row (\`list({ item: (el) => object({ … }) })\`) — a fact row cannot project onto one slot.`);
22
+ return;
30
23
  }
24
+ if (!isRegistryFactKey(field)) throw new Error(`${path}: unknown fact "${String(src.key)}"`);
25
+ const valueType = registryFactValueType(field);
26
+ if (valueType === "image" && slot.type !== "image") throw new Error(`${path}: image source field "${src.key}" must sit on an image slot`);
27
+ if (valueType === "address" && slot.type !== "address") throw new Error(`${path}: "${field}" is a whole address, which only an \`address\` slot holds — bind it to an \`address()\`, or show the line you want with a \`compute()\` reading it (\`concrete upgrade\` rewrites a text slot bound to it).`);
28
+ if (slot.type === "address" && valueType !== "address") throw new Error(`${path}: an \`address\` slot bound to "${field}", which is not an address — bind it to the property's address, or compute the value.`);
31
29
  return;
32
30
  }
33
31
  if (typeof src.kind !== "string") throw new Error(`${path} is sourced by a ref without a "kind" — this framework reads only kind-tagged refs. Run \`concrete upgrade\`, then build again.`);
@@ -54,7 +52,7 @@ function assertMirror(path, key, slot, section) {
54
52
  const upstreamKind = mirrorKindOf(upstreamDef);
55
53
  if (held !== void 0 && upstreamKind !== void 0 && held !== upstreamKind) throw new Error(`${path} mirrors slot "${upstream}" but holds ${held} where its upstream holds ${upstreamKind} — a mirror IS its upstream's value: declare it at the upstream's kind, or derive the value with a \`compute()\`.`);
56
54
  }
57
- function assertDeclaredRefs(path, reads, rowMember) {
55
+ function assertDeclaredRefs(path, reads) {
58
56
  if (reads === void 0) return;
59
57
  if (!Array.isArray(reads)) throw new Error(`${path}: "reads" is not a list of refs.`);
60
58
  reads.forEach((entry, i) => {
@@ -64,45 +62,23 @@ function assertDeclaredRefs(path, reads, rowMember) {
64
62
  if (kind === "section" && typeof section === "string" && typeof slot === "string") return;
65
63
  refuseIndexedRow(`${path}: reads[${String(i)}]`, record);
66
64
  if (kind === "row" && "slot" in record || kind === "element") return;
67
- if (kind === "row" && typeof field === "string") {
68
- if (rowMember === void 0) throw new Error(`${path}: reads[${String(i)}] reads the row member "${field}" outside a record list's row — only a row field's compute runs once per row.`);
69
- rowMember(field);
70
- return;
71
- }
72
- throw new Error(kind === void 0 ? `${path}: reads[${String(i)}] is a ref without a "kind" — this framework reads only kind-tagged refs. Run \`concrete upgrade\`, then build again.` : kind === "item" ? `${path}: reads[${String(i)}] reads a field of its own item ({ kind: "item" }) — a section's item fields do not read one another; read the element, or a member through a row.` : `${path}: reads[${String(i)}] is not a home ref ({ kind: "home", key }) or a section ref ({ kind: "section", section, slot }).`);
65
+ throw new Error(kind === void 0 ? `${path}: reads[${String(i)}] is a ref without a "kind" — this framework reads only kind-tagged refs. Run \`concrete upgrade\`, then build again.` : kind === "item" ? `${path}: reads[${String(i)}] reads a field of its own item ({ kind: "item" }) — a section's item fields do not read one another; read the element, or a member through a row.` : kind === "row" ? `${path}: reads[${String(i)}] reads the row member "${String(field)}" without naming its row slot — read it through a row: \`{ kind: "row", slot, field }\`.` : `${path}: reads[${String(i)}] is not a home ref ({ kind: "home", key }) or a section ref ({ kind: "section", section, slot }).`);
73
66
  });
74
67
  }
75
- function assertSourceContract(schema, fillSpec = { decisions: [] }) {
68
+ function assertSourceContract(schema) {
76
69
  for (const [name, slot] of Object.entries(schema.slots)) {
77
70
  const at = `${schema.key}.${name}`;
78
71
  refuseIndexedRow(at, slot.source);
79
72
  if (slot.source?.kind === "row" && memberSourceOf(slot.source) === null) throw new Error(`${at}: a row source on a top-level slot names no row slot — a top-level slot reads a member through a row it declares (\`{ kind: "row", slot, field }\`). Bind the slot to a fact or read it through a row.`);
80
73
  assertOne(at, name, slot, schema);
81
- const grammarFields = slot.type === "object" ? slot.fields : slot.type === "list" && slot.fields === void 0 ? slot.element?.fields : void 0;
82
- for (const [fieldKey, field] of Object.entries(grammarFields ?? {})) {
74
+ const fields = slot.type === "object" ? slot.fields : slot.type === "list" ? slot.element?.fields : void 0;
75
+ for (const [fieldKey, field] of Object.entries(fields ?? {})) {
83
76
  refuseIndexedRow(`${at}.${fieldKey}`, field.source);
84
77
  if (field.source?.kind === "row") continue;
85
78
  assertOne(`${at}.${fieldKey}`, `${name}.${fieldKey}`, field, schema);
86
79
  }
87
- if (slot.type !== "list" || slot.fields === void 0) continue;
88
- assertNotImplicit(at, slot.fields, plannedRowFields(fillSpec, name));
89
- assertRowSourceList(at, name, slot, slot.fields);
90
80
  }
91
81
  }
92
- function plannedRowFields(fillSpec, listKey) {
93
- const decision = fillSpec.decisions.find((d) => d.produces.includes(listKey));
94
- return new Set(decision === void 0 ? [] : plannedFieldsOf(decision));
95
- }
96
- function assertNotImplicit(at, fields, planned) {
97
- const offenders = [];
98
- for (const [fieldKey, field] of Object.entries(fields)) {
99
- const kind = field.source?.kind;
100
- if (kind === "home") offenders.push(`"${fieldKey}" (bound to the fact "${String(field.source?.key)}")`);
101
- else if ((kind === void 0 || kind === "authored") && !planned.has(fieldKey)) offenders.push(`"${fieldKey}" (no origin)`);
102
- }
103
- if (offenders.length === 0) return;
104
- throw new Error(`${at}: a record list in the implicit form, which this platform no longer reads — row field ${offenders.join(", ")}. Every row field declares its own origin: a member of its row (\`row.<member>\`), a \`compute()\`, or a \`fill()\`. Rebuild the section with @homepages/concrete 7.0.0 or later (\`concrete upgrade\`).`);
105
- }
106
82
  function refuseIndexedRow(path, ref) {
107
83
  if (ref === null || typeof ref !== "object") return;
108
84
  const record = ref;
@@ -114,10 +90,10 @@ function refuseIndexedRow(path, ref) {
114
90
  function memberFits(valueType, field) {
115
91
  switch (valueType) {
116
92
  case "image": return field.type === "image";
117
- case "image_list": return field.type === "list" && field.fields === void 0 && (field.element?.type === "image" || holdsElementImage(field.element));
118
- case "row_list": return field.type === "list" && field.fields === void 0 && (field.element?.type === "object" || field.element?.type === "row");
119
- case "text_list": return field.type === "list" && field.fields === void 0 && TEXT_FIELD_TYPES.includes(field.element?.type ?? "");
120
- case "number_list": return field.type === "list" && field.fields === void 0 && field.element?.type === "number";
93
+ case "image_list": return field.type === "list" && (field.element?.type === "image" || holdsElementImage(field.element));
94
+ case "row_list": return field.type === "list" && (field.element?.type === "object" || field.element?.type === "row");
95
+ case "text_list": return field.type === "list" && TEXT_FIELD_TYPES.includes(field.element?.type ?? "");
96
+ case "number_list": return field.type === "list" && field.element?.type === "number";
121
97
  case "address": return field.type === "address";
122
98
  case "number": return field.type === "number";
123
99
  case "text": return TEXT_FIELD_TYPES.includes(field.type ?? "");
@@ -149,41 +125,6 @@ function fittingTypes(valueType) {
149
125
  default: return "no field — it is not offered to a row";
150
126
  }
151
127
  }
152
- function assertRowSourceList(at, listKey, list, fields) {
153
- const listSource = list.source;
154
- const boundField = listSource?.kind === "home" ? listSource.key ?? "" : void 0;
155
- const table = boundField === void 0 ? void 0 : tableKeyOf(boundField);
156
- if (table === null) throw new Error(`${at}: row sources on a list bound to "${String(boundField)}", which is not a table — a row member names a member of the row a table supplies.`);
157
- const filled = listSource === void 0;
158
- const assertMember = (path, member) => {
159
- if (filled) throw new Error(`${path}: row member "${member}" on a list a fill() builds — its rows do not exist until the fill answers, so they offer no members. Give the field its own fill() instead.`);
160
- if (table === void 0) return void 0;
161
- return tableMemberOrRefuse(table, member, path, {
162
- noun: "row member",
163
- identity: `row member "${member}" is the row's identity, which every baked "${String(boundField)}" row carries as "${member}" already — drop the field.`
164
- });
165
- };
166
- for (const [fieldKey, field] of Object.entries(fields)) {
167
- const path = `${at}.${fieldKey}`;
168
- const src = field.source;
169
- if (src === void 0 || src.kind === "authored") continue;
170
- if (src.kind === "derived") {
171
- const handle = `${listKey}.${fieldKey}`;
172
- if (src.transform !== handle) throw new Error(`${path}: unknown transform "${String(src.transform)}". A row field's compute() is held under "${handle}" — its list's key and its own — which this declaration does not name, so it was not produced by the framework's compute() path.`);
173
- assertDeclaredRefs(path, src.reads, (member) => {
174
- assertMember(path, member);
175
- });
176
- continue;
177
- }
178
- if (src.kind !== "row") continue;
179
- refuseIndexedRow(path, src);
180
- if (typeof src.field !== "string") throw new Error(`${path}: a row source names no member — it is \`{ kind: "row", field: "<member>" }\`.`);
181
- const member = src.field;
182
- const descriptor = assertMember(path, member);
183
- if (descriptor === void 0) continue;
184
- if (!memberFits(descriptor.value_type, field)) throw new Error(`${path}: row member "${member}" is a ${descriptor.value_type} value and cannot sit on a "${String(field.type)}" field — it belongs on ${fittingTypes(descriptor.value_type)}.`);
185
- }
186
- }
187
128
 
188
129
  //#endregion
189
130
  export { assertDeclaredRefs, assertSourceContract, fittingTypes, memberFits, refuseIndexedRow };
@@ -27,7 +27,7 @@ function check(slot, sectionKey, path, inherited, picked = false) {
27
27
  }
28
28
  function checkMediaFilter(slot, sectionKey, path, bound) {
29
29
  const kind = slot.type ?? "";
30
- if ("category" in slot) throw new Error(`Section "${sectionKey}": slot "${path}" declares \`category\`. A media slot names the list it picks from in \`from\` (${mediaListKeys().map((key) => `"${key}"`).join(", ")}), or owns its asset without one.`);
30
+ if ("category" in slot) throw new Error(`Section "${sectionKey}": slot "${path}" declares \`category\`. A media slot names the list it picks from in \`from\` (${mediaListKeys().map((key) => `"${key}"`).join(", ")}), or owns its media without one.`);
31
31
  if (!isMediaType(kind)) {
32
32
  if (slot.from !== void 0 && kind !== "row") throw new Error(`Section "${sectionKey}": slot "${path}" declares \`from\`, but a section's ${kind === "select" ? "select states its values" : "slot names no candidates of its own"} — a media slot picks \`from\` a media list, a row from its table.`);
33
33
  if (slot.process !== void 0) throw new Error(`Section "${sectionKey}": slot "${path}" declares \`process\`, which only a media slot (image, video, tour, document, media) carries.`);
@@ -1,16 +1,13 @@
1
- import { REGISTRY_TABLE_KEYS } from "../../template-contracts/dist/slot-catalog.js";
1
+ import { tableKey } from "../../template-contracts/dist/registry-shape.js";
2
2
  import { tableRowMember } from "../../template-contracts/dist/table-members.js";
3
3
 
4
4
  //#region ../../internal/section-contracts/dist/table-member.js
5
- function tableKeySpelling(key) {
6
- return key.reading === "legacy" ? key.table : REGISTRY_TABLE_KEYS[key.table];
7
- }
8
- function tableMemberOrRefuse(key, field, at, refusal) {
9
- const found = tableRowMember(key, field);
5
+ function tableMemberOrRefuse(table, field, at, refusal) {
6
+ const found = tableRowMember(table, field);
10
7
  if (found.kind === "identity") throw new Error(`${at}: ${refusal.identity}`);
11
- if (found.kind === "unknown") throw new Error(`${at}: unknown ${refusal.noun} "${field}" — a "${tableKeySpelling(key)}" row offers ${found.offers.map((name) => `"${name}"`).join(", ")}.`);
8
+ if (found.kind === "unknown") throw new Error(`${at}: unknown ${refusal.noun} "${field}" — a "${tableKey(table)}" row offers ${found.offers.map((name) => `"${name}"`).join(", ")}.`);
12
9
  return found;
13
10
  }
14
11
 
15
12
  //#endregion
16
- export { tableKeySpelling, tableMemberOrRefuse };
13
+ export { tableMemberOrRefuse };