@homepages/concrete 4.0.0 → 6.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 (272) hide show
  1. package/CHANGELOG.md +359 -0
  2. package/README.md +28 -17
  3. package/codemods/fill-is-a-source.mjs +533 -0
  4. package/codemods/manifest.json +18 -0
  5. package/codemods/reads-replace-reconcile.mjs +285 -0
  6. package/dist/artifact/playground/client/assets/{index-D1fwOGVK.js → index-u3T7DiSN.js} +96 -96
  7. package/dist/artifact/playground/client/index.html +1 -1
  8. package/dist/artifact/playground/host.mjs +23 -23
  9. package/dist/base.css +3 -8
  10. package/dist/browser/site-config.js +1 -16
  11. package/dist/browser/submit-lead.js +0 -31
  12. package/dist/cli/build/artifact.js +16 -23
  13. package/dist/cli/build/captures.js +0 -6
  14. package/dist/cli/build/esbuild.js +0 -17
  15. package/dist/cli/build/fixtures.js +15 -30
  16. package/dist/cli/build/icons.js +0 -3
  17. package/dist/cli/build/index.js +1 -1
  18. package/dist/cli/build/playground.js +4 -8
  19. package/dist/cli/build/sections.js +9 -30
  20. package/dist/cli/build/source.js +52 -27
  21. package/dist/cli/build/static.js +4 -25
  22. package/dist/cli/capture/bundle.js +0 -9
  23. package/dist/cli/capture/capture-browser.js +0 -14
  24. package/dist/cli/capture/capture.js +1 -8
  25. package/dist/cli/check/analyze.js +2 -5
  26. package/dist/cli/check/index.js +1 -1
  27. package/dist/cli/check/line-endings.js +52 -0
  28. package/dist/cli/check/load-workspace.js +3 -8
  29. package/dist/cli/check/portable-names.js +48 -0
  30. package/dist/cli/check/render/class-conflicts.js +0 -5
  31. package/dist/cli/check/render/html.js +0 -1
  32. package/dist/cli/check/render/invariants.js +0 -5
  33. package/dist/cli/check/render/island-frames.js +0 -25
  34. package/dist/cli/check/render/marker-coverage.js +0 -20
  35. package/dist/cli/check/render/nav.js +0 -33
  36. package/dist/cli/check/report.js +0 -3
  37. package/dist/cli/check/stages/bundles.js +1 -9
  38. package/dist/cli/check/stages/composition.js +3 -2
  39. package/dist/cli/check/stages/dependencies.js +7 -38
  40. package/dist/cli/check/stages/fixtures.js +3 -31
  41. package/dist/cli/check/stages/lint.js +2 -2
  42. package/dist/cli/check/stages/logic.js +3 -34
  43. package/dist/cli/check/stages/relations.js +46 -0
  44. package/dist/cli/check/stages/render.js +0 -1
  45. package/dist/cli/check/stages/sections.js +3 -3
  46. package/dist/cli/check/stages/stylesheet.js +1 -1
  47. package/dist/cli/check/stages/typecheck.js +5 -11
  48. package/dist/cli/check/stages/workspace.js +36 -14
  49. package/dist/cli/commands.js +9 -56
  50. package/dist/cli/currency/cache.js +4 -17
  51. package/dist/cli/currency/decide.js +0 -14
  52. package/dist/cli/currency/opt-out.js +0 -7
  53. package/dist/cli/currency/preamble.js +3 -24
  54. package/dist/cli/currency/prompt.js +0 -1
  55. package/dist/cli/currency/refresh.js +5 -12
  56. package/dist/cli/currency/resolve-latest.js +3 -64
  57. package/dist/cli/currency/version-order.js +0 -12
  58. package/dist/cli/dev/crop.js +0 -2
  59. package/dist/cli/dev/http.js +0 -13
  60. package/dist/cli/dev/index.js +3 -4
  61. package/dist/cli/dev/islands.js +25 -70
  62. package/dist/cli/dev/listen.js +26 -0
  63. package/dist/cli/dev/load-template.js +0 -1
  64. package/dist/cli/dev/request-error.js +0 -4
  65. package/dist/cli/dev/server.js +46 -52
  66. package/dist/cli/dev/tsconfig-paths.js +0 -13
  67. package/dist/cli/dev/vite.js +9 -38
  68. package/dist/cli/dev/workspace-reader.js +4 -34
  69. package/dist/cli/media/cache.js +4 -51
  70. package/dist/cli/media/derive.js +2 -94
  71. package/dist/cli/media/deriver-plugin.js +0 -2
  72. package/dist/cli/media/frame-rung-floor.js +0 -6
  73. package/dist/cli/property/index.js +0 -4
  74. package/dist/cli/property/library.js +6 -24
  75. package/dist/cli/publish/client.js +0 -1
  76. package/dist/cli/publish/freshness.js +0 -2
  77. package/dist/cli/publish/git.js +2 -8
  78. package/dist/cli/publish/index.js +8 -15
  79. package/dist/cli/publish/pack.js +5 -6
  80. package/dist/cli/publish/report.js +0 -6
  81. package/dist/cli/publish/target.js +16 -13
  82. package/dist/cli/publish/wire.js +0 -6
  83. package/dist/cli/tar.js +2 -9
  84. package/dist/cli/upgrade/codemod.js +0 -8
  85. package/dist/cli/upgrade/index.js +0 -24
  86. package/dist/cli/upgrade/manifest.js +0 -12
  87. package/dist/cli/upgrade/plan.js +0 -17
  88. package/dist/cli/upgrade/stage.js +12 -15
  89. package/dist/cli/version.js +0 -8
  90. package/dist/cli/workspace.js +2 -34
  91. package/dist/cli.js +4 -21
  92. package/dist/css/compile.js +25 -28
  93. package/dist/css/graph.js +3 -10
  94. package/dist/css/inline.js +3 -13
  95. package/dist/css/rules.js +6 -43
  96. package/dist/design-system/format-variants.js +0 -22
  97. package/dist/eslint/authoring.js +0 -2
  98. package/dist/eslint/correctness.js +0 -7
  99. package/dist/eslint/rules/editor-reason.js +0 -11
  100. package/dist/eslint/rules/island-ids.js +0 -1
  101. package/dist/eslint/rules/jsx-visitor.js +0 -13
  102. package/dist/eslint/rules/no-editor-globals.js +0 -2
  103. package/dist/eslint/rules/no-raw-values.js +0 -1
  104. package/dist/fixtures/brand.js +0 -1
  105. package/dist/fixtures/bundle-rule.js +4 -9
  106. package/dist/fixtures/canonical.d.ts +20 -0
  107. package/dist/fixtures/image-dimensions.js +0 -1
  108. package/dist/fixtures/load.js +8 -17
  109. package/dist/fixtures/media-plugin.js +4 -31
  110. package/dist/fixtures/media.js +0 -21
  111. package/dist/fixtures/package-stylesheets.js +0 -6
  112. package/dist/fixtures/property.js +16 -15
  113. package/dist/fixtures/resolve.js +102 -29
  114. package/dist/fixtures/rows.js +12 -11
  115. package/dist/fixtures/synthesize-empties.js +0 -4
  116. package/dist/fixtures.d.ts +19 -4
  117. package/dist/fixtures.js +0 -18
  118. package/dist/index.d.ts +8 -9
  119. package/dist/index.js +2 -11
  120. package/dist/islands/client-module.js +0 -11
  121. package/dist/islands/marker.js +0 -33
  122. package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +0 -20
  123. package/dist/packages/external/concrete/package.js +1 -1
  124. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +22 -36
  125. package/dist/packages/internal/fill-bake/dist/compute-reads.js +4 -0
  126. package/dist/packages/internal/fill-bake/dist/derive-source.js +40 -0
  127. package/dist/packages/internal/fill-bake/dist/display.js +0 -1
  128. package/dist/packages/internal/fill-bake/dist/index.js +4 -4
  129. package/dist/packages/internal/fill-vocabulary/dist/origination.js +106 -0
  130. package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -49
  131. package/dist/packages/internal/format-geometry/dist/capture.js +10 -240
  132. package/dist/packages/internal/format-geometry/dist/geometry.js +0 -6
  133. package/dist/packages/internal/image-ladder/dist/crop.js +0 -12
  134. package/dist/packages/internal/image-ladder/dist/policy.js +0 -14
  135. package/dist/packages/internal/island-runtime/dist/capture-holds.js +0 -13
  136. package/dist/packages/internal/island-runtime/dist/contract.js +0 -34
  137. package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +0 -1
  138. package/dist/packages/internal/island-runtime/dist/index.js +0 -34
  139. package/dist/packages/internal/island-runtime/dist/island-id-context.js +0 -1
  140. package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +0 -15
  141. package/dist/packages/internal/island-runtime/dist/use-editor.js +0 -10
  142. package/dist/packages/internal/island-runtime/dist/use-island-id.js +0 -32
  143. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +2 -17
  144. package/dist/packages/internal/property-facts/dist/index.js +1 -1
  145. package/dist/packages/internal/property-facts/dist/{property-facts-CSdkSuD7.js → property-facts-5pxZnlkh.js} +13 -2
  146. package/dist/packages/internal/section-contracts/dist/cap-contract.js +1 -18
  147. package/dist/packages/internal/section-contracts/dist/catalog.js +16 -8
  148. package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +12 -16
  149. package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +5 -11
  150. package/dist/packages/internal/section-contracts/dist/display-contract.js +2 -0
  151. package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +2 -8
  152. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +13 -0
  153. package/dist/packages/internal/section-contracts/dist/index.js +2 -1
  154. package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +16 -42
  155. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +24 -43
  156. package/dist/packages/internal/section-contracts/dist/name-title-contract.js +11 -18
  157. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +10 -12
  158. package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +3 -13
  159. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -18
  160. package/dist/packages/internal/section-contracts/dist/runners.js +21 -13
  161. package/dist/packages/internal/section-contracts/dist/source-contract.js +13 -2
  162. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +31 -0
  163. package/dist/packages/internal/source-resolution/dist/index.js +5 -30
  164. package/dist/packages/internal/template-artifact/dist/hash.js +0 -8
  165. package/dist/packages/internal/template-artifact/dist/index.js +1 -1
  166. package/dist/packages/internal/template-artifact/dist/layout.js +0 -39
  167. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -9
  168. package/dist/packages/internal/template-artifact/dist/sha256.js +0 -1
  169. package/dist/packages/internal/template-artifact/dist/verify.js +2 -4
  170. package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -16
  171. package/dist/packages/internal/template-contracts/dist/content-categories.js +0 -4
  172. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +16 -10
  173. package/dist/packages/internal/template-contracts/dist/facts-view.js +15 -28
  174. package/dist/packages/internal/template-contracts/dist/layout.js +0 -7
  175. package/dist/packages/internal/template-contracts/dist/markers.js +0 -29
  176. package/dist/packages/internal/template-contracts/dist/select-key.js +0 -6
  177. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +56 -34
  178. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +22 -389
  179. package/dist/platform/file-url.js +8 -0
  180. package/dist/platform/fs.js +73 -0
  181. package/dist/platform/names.js +63 -0
  182. package/dist/platform/order.js +7 -0
  183. package/dist/platform/paths.js +62 -0
  184. package/dist/platform/process.js +97 -0
  185. package/dist/playground/host/page-state.js +0 -2
  186. package/dist/playground/host/paths.js +0 -1
  187. package/dist/playground/layout.js +0 -7
  188. package/dist/playground/wire.js +0 -8
  189. package/dist/primitives/FrameShell.js +0 -18
  190. package/dist/primitives/Image.d.ts +5 -1
  191. package/dist/primitives/Image.js +2 -68
  192. package/dist/primitives/Section.js +0 -13
  193. package/dist/primitives/Tour.js +0 -26
  194. package/dist/primitives/Video.js +0 -32
  195. package/dist/primitives/embed-playback.js +0 -1
  196. package/dist/primitives/marker-attrs.js +0 -17
  197. package/dist/primitives/picture-sources.js +6 -1
  198. package/dist/primitives/probe-context.js +0 -7
  199. package/dist/primitives/slot-bindings.d.ts +3 -2
  200. package/dist/primitives/slot-bindings.js +0 -46
  201. package/dist/primitives/slot-document.js +0 -11
  202. package/dist/primitives/slot-group.js +0 -9
  203. package/dist/primitives/slot-media.js +0 -27
  204. package/dist/primitives/slot-scalar.js +0 -4
  205. package/dist/primitives/slot.js +0 -6
  206. package/dist/rules/registry.js +42 -24
  207. package/dist/schema/compute.d.ts +46 -8
  208. package/dist/schema/compute.js +21 -15
  209. package/dist/schema/define-schema.d.ts +1 -1
  210. package/dist/schema/define-schema.js +37 -17
  211. package/dist/schema/extract-fill-spec.js +93 -180
  212. package/dist/schema/extract-used-facts.js +16 -158
  213. package/dist/schema/fact.d.ts +33 -18
  214. package/dist/schema/fact.js +7 -11
  215. package/dist/schema/fill-builders.d.ts +91 -366
  216. package/dist/schema/fill-builders.js +21 -259
  217. package/dist/schema/fill-declaration.d.ts +7 -69
  218. package/dist/schema/fill-declaration.js +5 -34
  219. package/dist/schema/fill-spec.js +59 -148
  220. package/dist/schema/format-presets.js +0 -12
  221. package/dist/schema/format.js +0 -7
  222. package/dist/schema/layout.js +0 -10
  223. package/dist/schema/manifest.js +0 -39
  224. package/dist/schema/property-facts.d.ts +20 -0
  225. package/dist/schema/runtime-values.d.ts +6 -18
  226. package/dist/schema/section-nav.js +0 -15
  227. package/dist/schema/section-props.d.ts +7 -9
  228. package/dist/schema/section-schema.d.ts +0 -1
  229. package/dist/schema/section-schema.js +4 -20
  230. package/dist/schema/slot-builders.d.ts +128 -117
  231. package/dist/schema/slot-builders.js +18 -201
  232. package/dist/schema/slot-ref.d.ts +63 -0
  233. package/dist/schema/slot-ref.js +33 -0
  234. package/dist/schema/slot-types.d.ts +3 -2
  235. package/dist/schema/slot-types.js +11 -20
  236. package/dist/section/declare.d.ts +14 -10
  237. package/dist/section/declare.js +13 -2
  238. package/dist/section/discovery.js +6 -21
  239. package/dist/section/groups.js +0 -6
  240. package/dist/section/materialize.js +0 -5
  241. package/dist/section/placements.js +0 -4
  242. package/dist/section/section.d.ts +8 -5
  243. package/dist/section/section.js +7 -29
  244. package/dist/styles.css +5 -0
  245. package/dist/template/define-template.d.ts +0 -4
  246. package/dist/template/define-template.js +1 -15
  247. package/dist/template/logic-build.js +8 -35
  248. package/dist/template/logic-shim.d.ts +4 -5
  249. package/dist/template/logic-shim.js +2 -6
  250. package/dist/template/logic-transform.js +0 -6
  251. package/dist/template/materialize.js +52 -43
  252. package/dist/template/mirror-types.js +43 -0
  253. package/dist/template/running-copy.js +5 -20
  254. package/dist/template/section-reads.js +83 -0
  255. package/guide/reference/cli/INDEX.md +12 -6
  256. package/guide/reference/cli/build.md +1 -1
  257. package/guide/reference/cli/check.md +1 -1
  258. package/guide/reference/cli/dev.md +3 -3
  259. package/guide/reference/cli/property-add.md +1 -1
  260. package/guide/reference/cli/property-list.md +1 -1
  261. package/guide/reference/cli/publish.md +4 -2
  262. package/guide/reference/cli/upgrade.md +1 -1
  263. package/guide/reference/rules/INDEX.md +26 -13
  264. package/package.json +4 -2
  265. package/dist/packages/internal/fact-interpolation/dist/index.js +0 -22
  266. package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +0 -170
  267. package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +0 -32
  268. package/dist/packages/internal/fill-vocabulary/dist/facts.js +0 -131
  269. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +0 -11
  270. package/dist/schema/fill-spec.d.ts +0 -18
  271. package/dist/template/reconcile.d.ts +0 -67
  272. package/dist/template/reconcile.js +0 -25
@@ -1,19 +1,11 @@
1
- import { EXECUTABLE_NESTED_TYPES, PLANNER_DECISION_TYPES, plannerForField } from "../../fill-vocabulary/dist/row-planners.js";
1
+ import { plannerForField } from "../../fill-vocabulary/dist/row-planners.js";
2
+ import { isListFill } from "./fill-spec-view.js";
2
3
 
3
4
  //#region ../../internal/section-contracts/dist/row-fill-contract.js
4
- function legalDecisionTypes(field) {
5
- const planner = plannerForField(field);
6
- return planner === void 0 ? [] : [PLANNER_DECISION_TYPES[planner]];
7
- }
8
- /**
9
- * Every rule a list fill's per-field planners must satisfy against the row the
10
- * schema declares. Throws on the first violation; a decision that plans no
11
- * fields has nothing to cross-reference and passes.
12
- */
13
5
  function assertRowFillContract(schema, decision, sectionKey) {
14
6
  const fill = decision;
15
- if (fill.type !== "list-fill") return;
16
- const planned = Object.entries(fill.fields ?? {});
7
+ if (!isListFill(decision)) return;
8
+ const planned = Object.keys(fill.fields ?? {});
17
9
  if (planned.length === 0) return;
18
10
  for (const slotId of decision.produces) {
19
11
  const slot = schema.slots[slotId];
@@ -21,15 +13,11 @@ function assertRowFillContract(schema, decision, sectionKey) {
21
13
  const rowFields = slot.fields;
22
14
  if (rowFields === void 0) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" plans row fields but produces "${slotId}", whose items declare none; only a record list has fields to plan.`);
23
15
  const declared = Object.keys(rowFields);
24
- for (const [field, plan] of planned) {
16
+ for (const field of planned) {
25
17
  const rowField = rowFields[field];
26
18
  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"}).`);
27
19
  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.`);
28
- const legal = legalDecisionTypes(rowField);
29
- if (!legal.includes(plan.type ?? "")) {
30
- const takes = legal.length > 0 ? `that field takes ${legal.map((t) => `"${t}"`).join(" or ")}` : `that field's item content takes no fill decision (a row field is planned as ${EXECUTABLE_NESTED_TYPES.map((t) => `"${t}"`).join(", ")}, each on the item content that selects it)`;
31
- throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}" (type "${rowField.type}") with a "${plan.type}" decision; ${takes}.`);
32
- }
20
+ 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 select key, an asset, or a list of text, keys or assets.`);
33
21
  }
34
22
  }
35
23
  }
@@ -1,10 +1,12 @@
1
+ import { FACT_GRAPH } from "../../template-contracts/dist/slot-catalog.js";
1
2
  import { SECTION_CONTRACT_CATALOG } from "./catalog.js";
2
3
  import { assertCapContract } from "./cap-contract.js";
4
+ import { DECISION_KINDS } from "./fill-spec-view.js";
3
5
  import { assertChooseSelectContract } from "./choose-select-contract.js";
4
6
  import { assertCountBoundsContract } from "./count-bounds-contract.js";
5
7
  import { assertGroupContract } from "./group-contract.js";
6
- import { FACTS_READABLE, isReadableFactsKey } from "../../fill-vocabulary/dist/facts.js";
7
8
  import { assertInterpolationContract } from "./interpolation-contract.js";
9
+ import { assertWriterReadsFactContract } from "./writer-reads-fact-contract.js";
8
10
  import { assertListFillContract } from "./list-fill-contract.js";
9
11
  import { assertListScalarContract } from "./list-scalar-contract.js";
10
12
  import { assertNameTitleContract } from "./name-title-contract.js";
@@ -15,10 +17,10 @@ import { assertPoiCurationContract } from "./poi-curation-contract.js";
15
17
  import { assertPoolingFieldContract } from "./pooling-field-contract.js";
16
18
  import { assertRowContract } from "./row-contract.js";
17
19
  import { assertRowFillContract } from "./row-fill-contract.js";
20
+ import { assertSourceContract } from "./source-contract.js";
18
21
  import { assertDisplayContract } from "./display-contract.js";
19
22
  import { assertDisplayEvidenceContract } from "./display-evidence-contract.js";
20
23
  import { assertSelectContract } from "./select-contract.js";
21
- import { assertSourceContract } from "./source-contract.js";
22
24
  import { assertSourceFilterContract } from "./source-filter-contract.js";
23
25
  import { assertSourcesContract } from "./sources-contract.js";
24
26
  import { assertUrlContract } from "./url-contract.js";
@@ -35,7 +37,17 @@ const byDecision = (run) => ({
35
37
  const CONTRACTS = {
36
38
  "reads-readable": {
37
39
  implementation: bySection(({ key, fillSpec }) => {
38
- for (const r of fillSpec.reads ?? []) if (!isReadableFactsKey(r)) throw new Error(`Section "${key}": fill-spec reads "${r}" is not an author-declarable facts key (allowed: ${FACTS_READABLE.join(", ")}).`);
40
+ for (const r of fillSpec.reads ?? []) if (!Object.hasOwn(FACT_GRAPH, r)) throw new Error(`Section "${key}": fill-spec reads "${r}", which is not a fact the registry declares.`);
41
+ }),
42
+ assertions: []
43
+ },
44
+ "decision-kind": {
45
+ implementation: byDecision(({ key }, d) => {
46
+ if (d.kind !== void 0 && DECISION_KINDS.includes(d.kind)) return;
47
+ const { type } = d;
48
+ const found = d.kind === void 0 ? "declares no `kind`" : `declares kind "${d.kind}"`;
49
+ const retired = typeof type === "string" ? `, naming its executor by \`type: "${type}"\`, a fill-spec shape the platform no longer runs` : "";
50
+ throw new Error(`Section "${key}": fill-spec decision "${d.id}" ${found}${retired}. A decision's kind is one of ${DECISION_KINDS.map((k) => `"${k}"`).join(", ")}; rebuild the section with the current Concrete.`);
39
51
  }),
40
52
  assertions: []
41
53
  },
@@ -50,7 +62,7 @@ const CONTRACTS = {
50
62
  assertions: [assertPoiCurationContract]
51
63
  },
52
64
  "list-fill": {
53
- implementation: byDecision(({ key }, d) => assertListFillContract(d, key)),
65
+ implementation: byDecision(({ key, schema }, d) => assertListFillContract(schema, d, key)),
54
66
  assertions: [assertListFillContract]
55
67
  },
56
68
  "choose-select": {
@@ -77,6 +89,10 @@ const CONTRACTS = {
77
89
  implementation: byDecision(({ key, schema }, d) => assertCapContract(schema, d, key)),
78
90
  assertions: [assertCapContract]
79
91
  },
92
+ "writer-reads-fact": {
93
+ implementation: byDecision(({ key, schema }, d) => assertWriterReadsFactContract(schema, d, key)),
94
+ assertions: [assertWriterReadsFactContract]
95
+ },
80
96
  display: {
81
97
  implementation: bySection(({ key, schema }) => assertDisplayContract(schema, key)),
82
98
  assertions: [assertDisplayContract]
@@ -125,7 +141,7 @@ const CONTRACTS = {
125
141
  assertions: [assertSourcesContract]
126
142
  },
127
143
  interpolation: {
128
- implementation: bySection(({ key, fillSpec }) => assertInterpolationContract(fillSpec, key)),
144
+ implementation: bySection(({ key, schema, fillSpec }) => assertInterpolationContract(fillSpec, key, schema)),
129
145
  assertions: [assertInterpolationContract]
130
146
  },
131
147
  group: {
@@ -144,16 +160,8 @@ function toSectionRunner(implementation) {
144
160
  for (const decision of input.fillSpec.decisions) run(input, decision);
145
161
  };
146
162
  }
147
- /** Every contract as one whole-section runner, keyed by id in catalog order. Each throws on its first violation. */
148
163
  const SECTION_CONTRACT_RUNNERS = Object.fromEntries(SECTION_CONTRACT_CATALOG.map(({ id }) => [id, toSectionRunner(CONTRACTS[id].implementation)]));
149
- /** The exported `assert*` functions each contract's runner calls, keyed by id in catalog order. */
150
164
  const SECTION_CONTRACT_ASSERTIONS = Object.fromEntries(SECTION_CONTRACT_CATALOG.map(({ id }) => [id, CONTRACTS[id].assertions]));
151
- /**
152
- * Every contract violation of one section, in catalog order. A contract that
153
- * throws contributes its message and every other contract still runs; a
154
- * per-decision contract is guarded per decision, so it reports each failing
155
- * decision. Never throws a contract's error.
156
- */
157
165
  function collectSectionContractViolations(input) {
158
166
  const violations = [];
159
167
  const attempt = (contract, run) => {
@@ -27,7 +27,18 @@ function assertOne(path, key, slot, rowContainer) {
27
27
  }
28
28
  if (src.kind !== "derived") return;
29
29
  if (slot.writeback !== void 0) throw new Error(`${path}: "writeback" on a derived (compute) source. Nothing can write back through a derivation — remove the key.`);
30
- if (src.transform !== key) throw new Error(`${path}: unknown transform "${String(src.transform)}". A "derived" source is a compute() binding, and its transform must equal its own slot key ("${key}") — it does not, which means the schema was hand-authored with a mismatched transform rather than produced by defineSchema's compute() path. Author a derived value with compute() ("slot({ source: compute((f) => …) })").`);
30
+ if (src.transform !== key) throw new Error(`${path}: unknown transform "${String(src.transform)}". A "derived" source is a compute() binding, and its transform must equal its own slot key ("${key}") — it does not, which means the schema was hand-authored with a mismatched transform rather than produced by defineSchema's compute() path. Author a derived value with compute() ("slot({ source: compute({ reads }, fn) })").`);
31
+ assertDeclaredRefs(path, src.reads);
32
+ }
33
+ function assertDeclaredRefs(path, reads) {
34
+ if (reads === void 0) return;
35
+ if (!Array.isArray(reads)) throw new Error(`${path}: "reads" is not a list of refs.`);
36
+ reads.forEach((entry, i) => {
37
+ const { kind, key, section, slot } = entry ?? {};
38
+ if (kind === "fact" && typeof key === "string") return;
39
+ if (kind === "slot" && typeof section === "string" && typeof slot === "string") return;
40
+ throw new Error(kind === void 0 ? `${path}: reads[${String(i)}] is a ref without a "kind" — this framework reads only kind-tagged fact and slot refs. Run \`concrete upgrade\`, then build again.` : `${path}: reads[${String(i)}] is not a fact ref ({ kind: "fact", key }) or a slot ref ({ kind: "slot", section, slot }).`);
41
+ });
31
42
  }
32
43
  function assertSourceContract(schema) {
33
44
  for (const [name, slot] of Object.entries(schema.slots)) {
@@ -45,4 +56,4 @@ function assertSourceContract(schema) {
45
56
  }
46
57
 
47
58
  //#endregion
48
- export { assertSourceContract };
59
+ export { assertDeclaredRefs, assertSourceContract };
@@ -0,0 +1,31 @@
1
+ import { originationFor } from "../../fill-vocabulary/dist/origination.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/writer-reads-fact-contract.js
4
+ const WRITES = ["write", "write-items"];
5
+ function writes(slot) {
6
+ if (slot === void 0) return false;
7
+ const origination = originationFor(slot);
8
+ if (origination === void 0) return false;
9
+ return WRITES.includes(origination.kind) || origination.kind === "keyed-rows" && origination.keys === "written";
10
+ }
11
+ function readsAFact(reads) {
12
+ return (reads ?? []).some((ref) => ref?.kind === "fact");
13
+ }
14
+ function assertWriterReadsFactContract(schema, decision, sectionKey) {
15
+ if (decision.kind !== "text" && decision.kind !== "list") return;
16
+ const fill = decision;
17
+ const writing = [];
18
+ for (const slotId of decision.produces) {
19
+ const slot = schema.slots[slotId];
20
+ if (slot === void 0) continue;
21
+ if (decision.kind === "text" || writes(slot)) writing.push(slotId);
22
+ for (const field of Object.keys(fill.fields ?? {})) if (writes(slot.fields?.[field])) writing.push(`${slotId}.${field}`);
23
+ }
24
+ if (writing.length === 0) return;
25
+ const fields = Object.values(fill.fields ?? {});
26
+ if (readsAFact(fill.reads) || fields.some((field) => readsAFact(field.reads))) return;
27
+ throw new Error(`Section "${sectionKey}": fill "${decision.id}" writes ${writing.map((w) => `"${w}"`).join(", ")} but reads no fact — its model call is shown exactly its \`reads\`, so it would write from the brief alone. Declare the facts it writes from (\`reads: [fact.description]\`), on the fill or on the row field that writes.`);
28
+ }
29
+
30
+ //#endregion
31
+ export { assertWriterReadsFactContract };
@@ -1,18 +1,11 @@
1
1
  import { FACT_GRAPH, REFERRAL_IMAGE_FIELDS, SOURCE_FIELDS } from "../../template-contracts/dist/slot-catalog.js";
2
- import { DEFAULT_FACTS_VIEW_YEAR, projectFactsView } from "../../template-contracts/dist/facts-view.js";
2
+ import { projectFactsView } from "../../template-contracts/dist/facts-view.js";
3
3
 
4
4
  //#region ../../internal/source-resolution/dist/index.js
5
- /**
6
- * Extracts the {@link RowFieldSourceMap} from a slot's serialized row-field
7
- * declarations (`fields`), keeping only direct-sourced entries. Returns
8
- * `undefined` when nothing is declared — a pre-writeback schema — so callers
9
- * fall back to the historical default row shape.
10
- */
11
5
  function rowFieldSources(fields) {
12
- if (fields === void 0) return void 0;
13
6
  const map = {};
14
- for (const [key, field] of Object.entries(fields)) if (field.source?.kind === "direct" && typeof field.source.field === "string") map[key] = field.source.field;
15
- return Object.keys(map).length > 0 ? map : void 0;
7
+ for (const [key, field] of Object.entries(fields ?? {})) if (field.source?.kind === "direct" && typeof field.source.field === "string") map[key] = field.source.field;
8
+ return map;
16
9
  }
17
10
  function primaryContact(facts) {
18
11
  return facts.contacts?.find((c) => c.primary) ?? facts.contacts?.[0];
@@ -103,28 +96,13 @@ function singleUnitLabelDefault(propertyType) {
103
96
  default: return null;
104
97
  }
105
98
  }
106
- const CONTACT_ROW_DEFAULT_FIELDS = {
107
- name: "name",
108
- title: "title",
109
- bio: "bio",
110
- email: "email",
111
- phone: "phone",
112
- instagram: "instagram",
113
- linkedin: "linkedin",
114
- x: "x",
115
- facebook: "facebook",
116
- website: "website",
117
- headshot: "headshot",
118
- logo: "logo_dark"
119
- };
120
99
  function resolveContactRowField(c, field) {
121
100
  return resolveContactScalar(c, field);
122
101
  }
123
102
  function buildContactsList(facts, fields) {
124
- const mapping = fields ?? CONTACT_ROW_DEFAULT_FIELDS;
125
103
  return contactsOf(facts).map((c) => {
126
104
  const row = { id: c.id };
127
- for (const [key, field] of Object.entries(mapping)) row[key] = resolveContactRowField(c, field);
105
+ for (const [key, field] of Object.entries(fields)) row[key] = resolveContactRowField(c, field);
128
106
  return row;
129
107
  });
130
108
  }
@@ -135,7 +113,6 @@ function buildUnitsList(facts, fields) {
135
113
  ...u,
136
114
  unit_label: u.unit_label ?? fallback
137
115
  };
138
- if (fields === void 0) return base;
139
116
  const row = { ...base };
140
117
  for (const [key, field] of Object.entries(fields)) row[key] = resolveUnitScalar(base, field);
141
118
  return row;
@@ -198,7 +175,7 @@ function resolveContactScalar(contact, field) {
198
175
  function readFrom(field, ctx) {
199
176
  const desc = SOURCE_FIELDS[field];
200
177
  if (!desc) return null;
201
- if (Object.hasOwn(COLLECTION_PROJECTIONS, field)) return COLLECTION_PROJECTIONS[field](ctx.facts, ctx.rowFields);
178
+ if (Object.hasOwn(COLLECTION_PROJECTIONS, field)) return COLLECTION_PROJECTIONS[field](ctx.facts, ctx.rowFields ?? {});
202
179
  if (desc.container === "contact") return resolveContactScalar(ctx.contact ?? primaryContact(ctx.facts), field);
203
180
  if (desc.container === "unit") return resolveUnitScalar(ctx.unit ?? firstUnit(ctx.facts), field);
204
181
  return resolvePropertyScalar(ctx.facts, field);
@@ -210,8 +187,6 @@ const ADDRESS_PARTS = {
210
187
  address_state: "state",
211
188
  address_postal: "postal"
212
189
  };
213
- /** One part of the structured address, or null when absent or blank — an empty
214
- * string never reaches a slot, so a section can test the value for presence. */
215
190
  function readAddressPart(address, part) {
216
191
  if (!address || typeof address !== "object") return null;
217
192
  const trimmed = (address[part] ?? "").trim();
@@ -3,13 +3,11 @@ import { sha256Hex } from "./sha256.js";
3
3
 
4
4
  //#region ../../internal/template-artifact/dist/hash.js
5
5
  const encoder = new TextEncoder();
6
- /** SHA-256 over the sorted `<name>\0<sha256>\n` listing. Names must be unique. */
7
6
  function listingDigest(entries) {
8
7
  const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
9
8
  for (let i = 1; i < sorted.length; i++) if (sorted[i].name === sorted[i - 1].name) throw new Error(`listingDigest: "${sorted[i].name}" is listed twice.`);
10
9
  return sha256Hex(encoder.encode(sorted.map((entry) => `${entry.name}\0${entry.sha256}\n`).join("")));
11
10
  }
12
- /** The entries of `files` under `dir/`, named relative to it. */
13
11
  function entriesUnder(files, dir) {
14
12
  const prefix = `${dir}/`;
15
13
  const out = [];
@@ -19,13 +17,11 @@ function entriesUnder(files, dir) {
19
17
  });
20
18
  return out;
21
19
  }
22
- /** A section's content hash, over every artifact file under `sections/<key>/`. */
23
20
  function sectionContentHash(files, key) {
24
21
  const entries = entriesUnder(files, sectionDir(key));
25
22
  if (entries.length === 0) throw new Error(`sectionContentHash: the artifact has no files under ${sectionDir(key)}/.`);
26
23
  return listingDigest(entries);
27
24
  }
28
- /** The template's content hash, over every file under `template/` and each section's hash. */
29
25
  function templateContentHash(files, sectionHashes) {
30
26
  const entries = entriesUnder(files, TEMPLATE_DIR);
31
27
  if (entries.length === 0) throw new Error(`templateContentHash: the artifact has no files under ${TEMPLATE_DIR}/.`);
@@ -35,10 +31,6 @@ function templateContentHash(files, sectionHashes) {
35
31
  });
36
32
  return listingDigest(entries);
37
33
  }
38
- /**
39
- * The source digest: what a later publish compares the workspace against to decide
40
- * whether this artifact is still the build of that tree.
41
- */
42
34
  function sourceDigest(files) {
43
35
  return listingDigest(files.map((file) => ({
44
36
  name: file.path,
@@ -4,4 +4,4 @@ import { listingDigest, sectionContentHash, sourceDigest, templateContentHash }
4
4
  import { ArtifactManifest, ArtifactScope, ArtifactSection, readArtifactSchema } from "./manifest.js";
5
5
  import { verifyArtifact } from "./verify.js";
6
6
 
7
- export { ASSET_URL_PREFIX, ArtifactManifest, CAPTURE_FILES, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTION_FILES, TEMPLATE_FILES, assetPath, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionContentHash, sectionPath, sourceDigest, staticPath, templateContentHash, templatePath, verifyArtifact };
7
+ export { ASSET_URL_PREFIX, ArtifactManifest, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTION_FILES, TEMPLATE_FILES, assetPath, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionContentHash, sectionDir, sectionPath, sourceDigest, staticPath, templateContentHash, templatePath, verifyArtifact };
@@ -9,43 +9,28 @@ const PLAYGROUND_DIR = "playground";
9
9
  const PLAYGROUND_CLIENT_DIR = "client";
10
10
  const FIXTURES_DIR = "fixtures";
11
11
  const CAPTURES_DIR = "captures";
12
- /** The top-level directories outside every content hash. */
13
12
  const UNHASHED_DIRS = [
14
13
  FIXTURES_DIR,
15
14
  PLAYGROUND_DIR,
16
15
  CAPTURES_DIR
17
16
  ];
18
- /** Every file a fixture directory carries. */
19
17
  const FIXTURE_FILES = {
20
18
  contentDoc: "content-doc.json",
21
19
  property: "property.json",
22
20
  meta: "meta.json"
23
21
  };
24
- /** The capture files that are not a page's PNG. */
25
22
  const CAPTURE_FILES = {
26
23
  bundle: "bundle.zip",
27
24
  document: "document.pdf"
28
25
  };
29
- /**
30
- * The URL prefix an artifact's author assets are named under wherever bytes or data name
31
- * them — a renderer bundle's image, a fixture's media file — each `<prefix>/<filename>`
32
- * naming `assets/<filename>`. The platform serves it from the same store.
33
- */
34
26
  const ASSET_URL_PREFIX = "/section-assets/";
35
- /**
36
- * The playground's loader contract: the module a reader imports, the one export it
37
- * calls, and the client shell it serves with its `<base href>` stamped. A change to any
38
- * of these is a new `artifact_schema`.
39
- */
40
27
  const PLAYGROUND_FILES = {
41
28
  host: "host.mjs",
42
29
  clientShell: `${PLAYGROUND_CLIENT_DIR}/index.html`
43
30
  };
44
- /** A file inside the playground directory, by its path below it. */
45
31
  function playgroundPath(file) {
46
32
  return `${PLAYGROUND_DIR}/${file}`;
47
33
  }
48
- /** Every file a section directory carries besides its island chunks. */
49
34
  const SECTION_FILES = {
50
35
  schema: "schema.json",
51
36
  fillSpec: "fill-spec.json",
@@ -53,34 +38,24 @@ const SECTION_FILES = {
53
38
  logic: "logic.mjs",
54
39
  renderer: "renderer.mjs"
55
40
  };
56
- /** Every file the template directory carries. */
57
41
  const TEMPLATE_FILES = {
58
42
  composition: "composition.json",
59
- logic: "logic.mjs",
60
43
  usedFacts: "used-facts.json",
61
44
  stylesheet: "template.css",
62
45
  preview: "preview.json",
63
46
  staticAssets: "static-assets.json"
64
47
  };
65
48
  const SEGMENT = /^(?!\.{1,2}$)[A-Za-z0-9._-]+$/;
66
- /** Whether `key` is a template key the layout can place: one safe path segment. */
67
49
  function isTemplateKey(key) {
68
50
  return SEGMENT.test(key);
69
51
  }
70
- /** Whether `key` is a published section key: `<template>/<section>`, two safe segments. */
71
52
  function isSectionKey(key) {
72
53
  const parts = key.split("/");
73
54
  return parts.length === 2 && parts.every((part) => SEGMENT.test(part));
74
55
  }
75
- /** The published key of a section a template declares under `local`. */
76
56
  function publishedSectionKey(templateKey, local) {
77
57
  return `${templateKey}/${local}`;
78
58
  }
79
- /**
80
- * One capture file of one fixture at one format: `captures/<fixture>/<format>/<file>`,
81
- * the file a {@link CAPTURE_FILES} name or `<page>.png`. Throws unless every part is one
82
- * safe path segment, so no fixture or format id can place a file elsewhere.
83
- */
84
59
  function capturePath(fixture, format, file) {
85
60
  for (const segment of [
86
61
  fixture,
@@ -89,48 +64,34 @@ function capturePath(fixture, format, file) {
89
64
  ]) if (!SEGMENT.test(segment)) throw new Error(`"${segment}" cannot name a capture path: one path segment of letters, digits, ".", "_" and "-".`);
90
65
  return `${CAPTURES_DIR}/${fixture}/${format}/${file}`;
91
66
  }
92
- /** Whether `id` is a fixture id the layout can place: one safe path segment. */
93
67
  function isFixtureId(id) {
94
68
  return SEGMENT.test(id);
95
69
  }
96
- /** A file inside a fixture's directory. */
97
70
  function fixturePath(id, file) {
98
71
  return `${FIXTURES_DIR}/${id}/${file}`;
99
72
  }
100
- /** `sections/<key>`. */
101
73
  function sectionDir(key) {
102
74
  return `${SECTIONS_DIR}/${key}`;
103
75
  }
104
- /** A file inside a section directory. */
105
76
  function sectionPath(key, file) {
106
77
  return `${sectionDir(key)}/${file}`;
107
78
  }
108
- /** A file inside the template directory. */
109
79
  function templatePath(file) {
110
80
  return `${TEMPLATE_DIR}/${file}`;
111
81
  }
112
- /** An island chunk of a section, by the filename the binding names it by. */
113
82
  function islandPath(sectionKey, filename) {
114
83
  return sectionPath(sectionKey, `${SECTION_ISLANDS_DIR}/${filename}`);
115
84
  }
116
- /** The section an island key belongs to: everything before its last `:`. */
117
85
  function sectionOfIslandKey(islandKey) {
118
86
  const at = islandKey.lastIndexOf(":");
119
87
  return at < 0 ? islandKey : islandKey.slice(0, at);
120
88
  }
121
- /** A shared static bundle. */
122
89
  function staticPath(filename) {
123
90
  return `${STATIC_DIR}/${filename}`;
124
91
  }
125
- /** A content-addressed asset. */
126
92
  function assetPath(filename) {
127
93
  return `${ASSETS_DIR}/${filename}`;
128
94
  }
129
- /**
130
- * Where every file a static-assets binding names lives in the artifact. A reader
131
- * uploads each one under its binding filename; the verifier checks each is present
132
- * and, where the binding states a hash, that the bytes match it.
133
- */
134
95
  function boundFiles(binding) {
135
96
  const out = [];
136
97
  const ref = (path, r) => {
@@ -4,7 +4,6 @@ import { z } from "zod";
4
4
  //#region ../../internal/template-artifact/dist/manifest.js
5
5
  const Sha256 = z.string().regex(/^[0-9a-f]{64}$/, "a lowercase hex SHA-256");
6
6
  const OrgId = z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, "an org UUID");
7
- /** Who the template is offered to, as authored: every org, or the named set. */
8
7
  const ArtifactScope = z.union([z.literal("global"), z.object({ orgs: z.array(OrgId).min(1) }).strict()]);
9
8
  const ArtifactSection = z.object({
10
9
  key: z.string().refine(isSectionKey, "a section key `<template>/<section>`"),
@@ -12,7 +11,7 @@ const ArtifactSection = z.object({
12
11
  content_hash: Sha256
13
12
  }).strict();
14
13
  const ArtifactManifest = z.object({
15
- artifact_schema: z.literal(1),
14
+ artifact_schema: z.literal(2),
16
15
  framework_version: z.string().min(1),
17
16
  key: z.string().refine(isTemplateKey, "a template key: one path segment"),
18
17
  display_name: z.string().min(1),
@@ -24,9 +23,7 @@ const ArtifactManifest = z.object({
24
23
  scope: ArtifactScope,
25
24
  source_digest: Sha256,
26
25
  template: z.object({ content_hash: Sha256 }).strict(),
27
- /** Sorted by key. */
28
26
  sections: z.array(ArtifactSection),
29
- /** The authored fixtures under `fixtures/`, in discovery order: the first is the one a playground opens. */
30
27
  fixtures: z.array(z.string().refine(isFixtureId, "a fixture id: one path segment"))
31
28
  }).strict().superRefine((manifest, ctx) => {
32
29
  manifest.fixtures.forEach((id, index) => {
@@ -58,11 +55,6 @@ const ArtifactManifest = z.object({
58
55
  });
59
56
  });
60
57
  });
61
- /**
62
- * The schema number a manifest claims, read before anything else is parsed, so a
63
- * reader can refuse an artifact from a newer shape by name rather than by a wall of
64
- * field errors. `null` when the value carries no integer `artifact_schema`.
65
- */
66
58
  function readArtifactSchema(value) {
67
59
  if (typeof value !== "object" || value === null) return null;
68
60
  const schema = value.artifact_schema;
@@ -66,7 +66,6 @@ const K = new Uint32Array([
66
66
  3329325298
67
67
  ]);
68
68
  const HEX = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
69
- /** The lowercase hex SHA-256 of `bytes`. */
70
69
  function sha256Hex(bytes) {
71
70
  const h = new Uint32Array([
72
71
  1779033703,
@@ -47,7 +47,6 @@ function checkUsedFacts(value, path, problems) {
47
47
  return;
48
48
  }
49
49
  }
50
- /** The section keys a composition's pages place, read structurally. */
51
50
  function composedSections(composition) {
52
51
  const pages = composition?.pages;
53
52
  if (!Array.isArray(pages)) return null;
@@ -63,7 +62,6 @@ function composedSections(composition) {
63
62
  }
64
63
  return keys;
65
64
  }
66
- /** Verify `files` against the artifact shape. Never throws for a malformed artifact. */
67
65
  function verifyArtifact(files) {
68
66
  const problems = [];
69
67
  const raw = readJson(files, MANIFEST_FILE, problems);
@@ -72,10 +70,10 @@ function verifyArtifact(files) {
72
70
  problems
73
71
  };
74
72
  const schema = readArtifactSchema(raw.value);
75
- if (schema !== 1) {
73
+ if (schema !== 2) {
76
74
  problems.push({
77
75
  path: MANIFEST_FILE,
78
- message: schema === null ? `carries no integer artifact_schema; this reader knows ${String(1)}` : `artifact_schema ${String(schema)} is not one this reader knows (it knows ${String(1)})`
76
+ message: schema === null ? `carries no integer artifact_schema; this reader knows ${String(2)}` : `artifact_schema ${String(schema)} is not one this reader knows (it knows ${String(2)})`
79
77
  });
80
78
  return {
81
79
  manifest: null,
@@ -7,15 +7,6 @@ function editorOf(def) {
7
7
  if (element === "document") return "document-list";
8
8
  return "scalar-list";
9
9
  }
10
- /**
11
- * The editor state one collection slot derives from its item content — the
12
- * D6 table. Item content is the only input: an unrecognized or absent item
13
- * declaration reads as the scalar card rather than widening the contract.
14
- *
15
- * Only a record item selects per-item; every other editor addresses the
16
- * collection as one card, which is what every audited scalar and media
17
- * collection already did.
18
- */
19
10
  function collectionEditorState(def) {
20
11
  const editor = editorOf(def);
21
12
  return {
@@ -23,13 +14,6 @@ function collectionEditorState(def) {
23
14
  granularity: editor === "row-editor" ? "item" : "unit"
24
15
  };
25
16
  }
26
- /**
27
- * How the editor treats one collection slot's items: `"item"` selects/crops each
28
- * item individually; `"unit"` edits the whole collection as one card.
29
- *
30
- * The granularity half of `collectionEditorState`, kept as the narrow view
31
- * existing consumers read.
32
- */
33
17
  function collectionEditing(def) {
34
18
  return collectionEditorState(def).granularity;
35
19
  }
@@ -1,8 +1,4 @@
1
1
  //#region ../../internal/template-contracts/dist/content-categories.js
2
- /**
3
- * The closed v1 category keys, in display order. `website` belongs to the
4
- * geometry-less website format only; the rest classify rendered formats.
5
- */
6
2
  const CONTENT_CATEGORIES = [
7
3
  "website",
8
4
  "social-post",
@@ -33,8 +33,6 @@ type AuthorFacingName<K extends FactGraphName> = [AliasNameFor<ContainerOf<K>, K
33
33
  */
34
34
  type FactsRow<P extends FactPoolName> = { readonly [K in RowBindableName<P> as AuthorFacingName<K>]: MemberType<PoolRow<P>[BoundRowMember<P, K> & keyof PoolRow<P>]>; } & { readonly [M in keyof PoolRow<P> as M extends BoundMembers<P> ? never : M]: MemberType<PoolRow<P>[M]>; };
35
35
  type EntryValue<K extends FactGraphName> = Graph[K] extends {
36
- ambient: true;
37
- } ? Exclude<ScalarType<Graph[K]["value_type"]>, null> : Graph[K] extends {
38
36
  primary_of: infer P extends FactPoolName;
39
37
  } ? FactsRow<P> | null : Graph[K] extends {
40
38
  row: FactShapeDescriptor;
@@ -46,17 +44,27 @@ type PropertyBranch = { readonly [K in FactGraphName as Graph[K] extends {
46
44
  container: "property";
47
45
  } ? K : never]: EntryValue<K>; } & { readonly [A in keyof FactProjections["property"]]: EntryValue<FactProjections["property"][A]>; };
48
46
  /**
49
- * The derive-time view a `compute((f) => …)` callback's parameter is bound to
50
- * — a mapped type over the fact graph registry. Bindable facts sit at
51
- * `f.<container>.<key>` (`f.property.*`; the unit and contact containers read
52
- * through the primary rows `unit` and `contact`), readable-only entries at
53
- * `f.<key>`, and the ambient `year` is injected at derive time.
47
+ * The derive-time view a fact ref resolves against — a mapped type over the fact
48
+ * graph registry. Bindable facts sit at `f.<container>.<key>` (`f.property.*`; the unit and
49
+ * contact containers read through the primary rows `unit` and `contact`) and
50
+ * readable-only entries at `f.<key>`.
54
51
  */
55
52
  type Facts = {
56
53
  readonly property: PropertyBranch;
57
54
  } & { readonly [K in FactGraphName as Graph[K] extends {
58
55
  role: "readable";
59
56
  } ? K : never]: EntryValue<K>; };
57
+ /**
58
+ * One registry entry's value, as the derive-time view carries it — the type a
59
+ * typed fact ref (`fact.property.address`, `fact.photos`) reads at.
60
+ *
61
+ * @remarks
62
+ * The same projection {@link Facts} places the entry under, named on its own so
63
+ * a ref's phantom value type and the view stay one derivation. The container is
64
+ * not a parameter: an entry's key is globally unique, and `fact.unit.beds` and
65
+ * `f.unit.beds` are the same registry entry read two ways.
66
+ */
67
+ type FactValue<K extends FactGraphName> = EntryValue<K>;
60
68
  /** One unit row of `property.units` (and the shape of the primary `unit`). */
61
69
  type FactsUnit = FactsRow<"units">;
62
70
  /** One full contact card of `property.contacts` (and the shape of the primary `contact`), spelled as `fact.contact.*` spells it. */
@@ -75,7 +83,5 @@ type FactsDocument = FactsRow<"documents">;
75
83
  type FactsDocumentNote = FactsRow<"document_notes">;
76
84
  /** The structured address at `property.address`. */
77
85
  type FactsAddress = Facts["property"]["address"];
78
- /** The always-on narrative at `narrative`. */
79
- type FactsNarrative = Facts["narrative"];
80
86
  //#endregion
81
- export { FactPoolName, Facts, FactsAddress, FactsContact, FactsDocument, FactsDocumentNote, FactsFloorPlan, FactsNarrative, FactsPhoto, FactsRow, FactsTour, FactsUnit, FactsVideo };
87
+ export { FactPoolName, FactValue, Facts, FactsAddress, FactsContact, FactsDocument, FactsDocumentNote, FactsFloorPlan, FactsPhoto, FactsRow, FactsTour, FactsUnit, FactsVideo };