@homepages/concrete 8.0.0 → 9.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 (326) hide show
  1. package/CHANGELOG.md +988 -0
  2. package/README.md +20 -9
  3. package/codemods/list-grammar.mjs +923 -0
  4. package/codemods/manifest.json +60 -0
  5. package/codemods/process-builders.mjs +198 -0
  6. package/codemods/slot-object.mjs +1097 -0
  7. package/codemods/steps/content-object-fields.mjs +324 -0
  8. package/codemods/steps/list-object-form.mjs +6 -7
  9. package/codemods/table-rows.mjs +568 -0
  10. package/codemods/unwrap-object-fields.mjs +310 -0
  11. package/codemods/viewer-slot-document.mjs +131 -0
  12. package/codemods/write-property-as-facts-document.mjs +716 -0
  13. package/codemods/write-the-address-line.mjs +255 -0
  14. package/codemods/write-the-registry-members.mjs +653 -0
  15. package/codemods/write-the-select-from.mjs +141 -0
  16. package/codemods/write-the-sole-from.mjs +369 -0
  17. package/codemods/write-the-table-from.mjs +267 -0
  18. package/codemods/write-the-whole-item.mjs +512 -0
  19. package/codemods/writeback-drop.mjs +168 -0
  20. package/codemods/written-contact-address.mjs +162 -0
  21. package/codemods/written-media-category.mjs +227 -0
  22. package/codemods/written-ref-kinds-name-the-layer.mjs +172 -0
  23. package/codemods/written-uploads-replace-pool-reads.mjs +454 -0
  24. package/codemods/written-uploads-sort-into-lists.mjs +405 -0
  25. package/codemods/written-uploads-stated-in-sorted-lists.mjs +295 -0
  26. package/codemods/written-video-sources-drop.mjs +144 -0
  27. package/codemods/written-without-pick-none.mjs +146 -0
  28. package/codemods/written-without-retired-knowledge.mjs +223 -0
  29. package/codemods/written-without-the-media-key.mjs +202 -0
  30. package/codemods/written-without-the-property-type.mjs +249 -0
  31. package/dist/artifact/playground/client/assets/index-BUmdDDX5.js +1259 -0
  32. package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +1 -0
  33. package/dist/artifact/playground/client/index.html +2 -2
  34. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
  35. package/dist/artifact/playground/host.mjs +61 -27
  36. package/dist/base.css +58 -1
  37. package/dist/cli/build/artifact.js +6 -9
  38. package/dist/cli/build/captures.js +2 -12
  39. package/dist/cli/build/esbuild.js +1 -25
  40. package/dist/cli/build/fixtures.js +2 -1
  41. package/dist/cli/build/icons.js +1 -1
  42. package/dist/cli/build/static.js +2 -2
  43. package/dist/cli/capture/capture.js +8 -9
  44. package/dist/cli/check/analyze.js +8 -1
  45. package/dist/cli/check/load-outdir.js +47 -0
  46. package/dist/cli/check/load-workspace.js +4 -4
  47. package/dist/cli/check/render/html.js +1 -2
  48. package/dist/cli/check/render/inputs.js +10 -3
  49. package/dist/cli/check/render/island-frames.js +2 -1
  50. package/dist/cli/check/render/marker-coverage.js +23 -15
  51. package/dist/cli/check/report.js +5 -0
  52. package/dist/cli/check/stages/bundles.js +1 -1
  53. package/dist/cli/check/stages/relations.js +1 -1
  54. package/dist/cli/check/stages/render.js +48 -33
  55. package/dist/cli/check/stages/sections.js +83 -31
  56. package/dist/cli/commands.js +1 -1
  57. package/dist/cli/dev/crop.js +1 -1
  58. package/dist/cli/dev/fixture-ladders.js +96 -0
  59. package/dist/cli/dev/islands.js +12 -123
  60. package/dist/cli/dev/listen.js +20 -1
  61. package/dist/cli/dev/load-template.js +1 -1
  62. package/dist/cli/dev/server.js +35 -10
  63. package/dist/cli/dev/vite.js +9 -7
  64. package/dist/cli/dev/workspace-reader.js +16 -16
  65. package/dist/cli/media/derive.js +43 -57
  66. package/dist/cli/media/frame-rung-floor.js +0 -1
  67. package/dist/cli/property/index.js +1 -6
  68. package/dist/css/inline.js +1 -22
  69. package/dist/eslint/rules/no-marker-literal.js +1 -1
  70. package/dist/fixtures/load.js +16 -7
  71. package/dist/fixtures/media-plugin.js +17 -12
  72. package/dist/fixtures/media-store.js +115 -0
  73. package/dist/fixtures/property.js +345 -126
  74. package/dist/fixtures/resolve.js +263 -251
  75. package/dist/fixtures/rows.js +4 -11
  76. package/dist/fixtures.d.ts +234 -109
  77. package/dist/index.d.ts +25 -16
  78. package/dist/index.js +10 -6
  79. package/dist/islands/marker.js +2 -1
  80. package/dist/packages/external/concrete/package.js +1 -1
  81. package/dist/packages/internal/canvas-core/dist/island-host.js +62 -0
  82. package/dist/packages/internal/canvas-core/dist/island-shields.js +30 -0
  83. package/dist/packages/internal/capture-settle/dist/index.js +3 -0
  84. package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +13 -0
  85. package/dist/packages/internal/capture-settle/dist/island-markers.js +6 -0
  86. package/dist/packages/internal/capture-settle/dist/settle.js +150 -0
  87. package/dist/packages/internal/{image-ladder/dist/crop.js → crop-region/dist/index.js} +21 -20
  88. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +251 -33
  89. package/dist/packages/internal/fill-bake/dist/compute-reads.js +365 -4
  90. package/dist/packages/internal/fill-bake/dist/derive-source.js +35 -21
  91. package/dist/packages/internal/fill-bake/dist/index.js +8 -3
  92. package/dist/packages/internal/fill-bake/dist/item-merge.js +119 -0
  93. package/dist/packages/internal/fill-bake/dist/item-overrides.js +28 -0
  94. package/dist/packages/internal/fill-bake/dist/linked-merge.js +40 -0
  95. package/dist/packages/internal/fill-bake/dist/list-grammar.js +175 -0
  96. package/dist/packages/internal/fill-vocabulary/dist/holder.js +51 -0
  97. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +390 -0
  98. package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -23
  99. package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +1 -1
  100. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +75 -0
  101. package/dist/packages/internal/format-geometry/dist/capture.js +11 -147
  102. package/dist/packages/internal/format-geometry/dist/format.d.ts +8 -2
  103. package/dist/packages/internal/format-geometry/dist/geometry.js +13 -2
  104. package/dist/packages/internal/image-ladder/dist/encode.js +27 -14
  105. package/dist/packages/internal/image-ladder/dist/index.js +3 -3
  106. package/dist/packages/internal/image-ladder/dist/policy.js +28 -53
  107. package/dist/packages/internal/island-runtime/dist/capture-holds.js +1 -1
  108. package/dist/packages/internal/island-runtime/dist/contract.d.ts +3 -12
  109. package/dist/packages/internal/island-runtime/dist/contract.js +2 -2
  110. package/dist/packages/internal/island-runtime/dist/index.d.ts +3 -7
  111. package/dist/packages/internal/island-runtime/dist/index.js +2 -1
  112. package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +1 -1
  113. package/dist/packages/internal/media-resolution/dist/crop-key.js +7 -0
  114. package/dist/packages/internal/media-resolution/dist/document.js +63 -0
  115. package/dist/packages/internal/media-resolution/dist/image.js +228 -0
  116. package/dist/packages/internal/media-resolution/dist/index.js +11 -0
  117. package/dist/packages/internal/media-resolution/dist/list.js +112 -0
  118. package/dist/packages/internal/media-resolution/dist/media.js +59 -0
  119. package/dist/packages/internal/media-resolution/dist/records.js +7 -0
  120. package/dist/packages/internal/media-resolution/dist/slot.js +34 -0
  121. package/dist/packages/internal/media-resolution/dist/store.js +19 -0
  122. package/dist/packages/internal/media-resolution/dist/tour.js +59 -0
  123. package/dist/packages/internal/media-resolution/dist/video.js +93 -0
  124. package/dist/packages/internal/property-facts/dist/registry-facts.js +244 -0
  125. package/dist/packages/internal/section-contracts/dist/cap-contract.js +8 -17
  126. package/dist/packages/internal/section-contracts/dist/catalog.js +34 -10
  127. package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +11 -2
  128. package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +27 -0
  129. package/dist/packages/internal/section-contracts/dist/fill-options.js +12 -0
  130. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +95 -0
  131. package/dist/packages/internal/section-contracts/dist/grammar-scope.js +154 -0
  132. package/dist/packages/internal/section-contracts/dist/index.js +7 -1
  133. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +15 -20
  134. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +12 -7
  135. package/dist/packages/internal/section-contracts/dist/list-source-contract.js +46 -0
  136. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +11 -2
  137. package/dist/packages/internal/section-contracts/dist/object-contract.js +92 -0
  138. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +5 -5
  139. package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +63 -0
  140. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +7 -4
  141. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +83 -0
  142. package/dist/packages/internal/section-contracts/dist/row-source-contract.js +67 -0
  143. package/dist/packages/internal/section-contracts/dist/runners.js +74 -10
  144. package/dist/packages/internal/section-contracts/dist/select-contract.js +0 -8
  145. package/dist/packages/internal/section-contracts/dist/source-contract.js +103 -46
  146. package/dist/packages/internal/section-contracts/dist/sources-contract.js +47 -17
  147. package/dist/packages/internal/section-contracts/dist/table-member.js +16 -0
  148. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +42 -21
  149. package/dist/packages/internal/source-resolution/dist/index.js +113 -72
  150. package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +16 -0
  151. package/dist/packages/internal/street-address/dist/index.js +72 -0
  152. package/dist/packages/internal/template-artifact/dist/asset-mime.js +30 -0
  153. package/dist/packages/internal/template-artifact/dist/layout.js +1 -2
  154. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
  155. package/dist/packages/internal/template-artifact/dist/verify.js +12 -29
  156. package/dist/packages/internal/template-contracts/dist/address-value.d.ts +52 -0
  157. package/dist/packages/internal/template-contracts/dist/address-value.js +90 -0
  158. package/dist/packages/internal/template-contracts/dist/comparable-address.js +19 -0
  159. package/dist/{schema → packages/internal/template-contracts/dist}/compute.d.ts +29 -6
  160. package/dist/{schema → packages/internal/template-contracts/dist}/compute.js +11 -13
  161. package/dist/packages/internal/template-contracts/dist/content-pick.js +51 -0
  162. package/dist/packages/internal/template-contracts/dist/decision-fills.js +85 -0
  163. package/dist/packages/internal/template-contracts/dist/display-overrides.js +7 -0
  164. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +16 -5
  165. package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +24 -0
  166. package/dist/packages/internal/template-contracts/dist/fact-compute.js +30 -0
  167. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +44 -0
  168. package/dist/packages/internal/template-contracts/dist/fact-keys.js +88 -0
  169. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +290 -0
  170. package/dist/packages/internal/template-contracts/dist/fact-registry.js +598 -0
  171. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +10 -24
  172. package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +157 -0
  173. package/dist/packages/internal/template-contracts/dist/fill-builders.js +79 -0
  174. package/dist/packages/internal/template-contracts/dist/fill-declaration.d.ts +14 -0
  175. package/dist/{schema → packages/internal/template-contracts/dist}/fill-declaration.js +6 -5
  176. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +158 -0
  177. package/dist/packages/internal/template-contracts/dist/fill-spec.js +291 -0
  178. package/dist/packages/internal/template-contracts/dist/findable.js +8 -0
  179. package/dist/packages/internal/template-contracts/dist/floor-presets.js +13 -0
  180. package/dist/packages/internal/template-contracts/dist/icon-names.d.ts +5 -0
  181. package/dist/packages/internal/template-contracts/dist/icon-names.js +70 -0
  182. package/dist/packages/internal/template-contracts/dist/legacy-facts.js +167 -0
  183. package/dist/packages/internal/template-contracts/dist/list-editing.js +94 -0
  184. package/dist/packages/internal/template-contracts/dist/list.d.ts +215 -0
  185. package/dist/packages/internal/template-contracts/dist/list.js +258 -0
  186. package/dist/packages/internal/template-contracts/dist/markers.d.ts +2 -2
  187. package/dist/packages/internal/template-contracts/dist/media-candidates.js +38 -0
  188. package/dist/packages/internal/template-contracts/dist/mirror-kind.js +48 -0
  189. package/dist/packages/internal/template-contracts/dist/number-display.js +10 -0
  190. package/dist/packages/internal/template-contracts/dist/object.d.ts +89 -0
  191. package/dist/packages/internal/template-contracts/dist/object.js +131 -0
  192. package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +1 -1
  193. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.d.ts +1 -0
  194. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +162 -0
  195. package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +77 -0
  196. package/dist/packages/internal/template-contracts/dist/process-builders.js +73 -0
  197. package/dist/packages/internal/template-contracts/dist/read-graph.js +250 -0
  198. package/dist/packages/internal/template-contracts/dist/ref-locate.js +192 -0
  199. package/dist/packages/internal/template-contracts/dist/registry-aliases.js +77 -0
  200. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +268 -0
  201. package/dist/packages/internal/template-contracts/dist/registry-facts.js +202 -0
  202. package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +41 -0
  203. package/dist/packages/internal/template-contracts/dist/registry-shape.js +135 -0
  204. package/dist/packages/internal/template-contracts/dist/resolve-scope.js +103 -0
  205. package/dist/packages/internal/{image-descriptor/dist/index.d.ts → template-contracts/dist/responsive-image.d.ts} +1 -1
  206. package/dist/packages/internal/template-contracts/dist/row-planners.js +29 -0
  207. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +133 -0
  208. package/dist/packages/internal/template-contracts/dist/row-ref.js +101 -0
  209. package/dist/packages/internal/template-contracts/dist/row-sources.js +49 -3
  210. package/dist/packages/internal/template-contracts/dist/row.d.ts +155 -0
  211. package/dist/packages/internal/template-contracts/dist/row.js +84 -0
  212. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +97 -0
  213. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +782 -0
  214. package/dist/packages/internal/template-contracts/dist/slot-builders.js +233 -0
  215. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +243 -384
  216. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +335 -227
  217. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +21 -0
  218. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +155 -0
  219. package/dist/packages/internal/template-contracts/dist/slot-ref.js +76 -0
  220. package/dist/packages/internal/template-contracts/dist/slot-types.d.ts +163 -0
  221. package/dist/packages/internal/template-contracts/dist/slot-types.js +140 -0
  222. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +97 -0
  223. package/dist/packages/internal/template-contracts/dist/table-members.d.ts +25 -0
  224. package/dist/packages/internal/template-contracts/dist/table-members.js +90 -0
  225. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +5 -5
  226. package/dist/packages/internal/template-contracts/dist/value-contracts.js +15 -0
  227. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +2 -2
  228. package/dist/platform/fs.js +5 -2
  229. package/dist/playground/canvas-island-host.d.ts +11 -0
  230. package/dist/playground/canvas-island-host.js +29 -0
  231. package/dist/playground/canvas-markers.js +14 -0
  232. package/dist/playground-island-runtime.d.ts +3 -2
  233. package/dist/playground-island-runtime.js +3 -2
  234. package/dist/primitives/FrameShell.js +0 -1
  235. package/dist/primitives/Image.d.ts +5 -4
  236. package/dist/primitives/Tour.d.ts +1 -1
  237. package/dist/primitives/Video.d.ts +2 -2
  238. package/dist/primitives/index.d.ts +2 -3
  239. package/dist/primitives/picture-sources.js +2 -2
  240. package/dist/primitives/probe-context.js +2 -12
  241. package/dist/primitives/slot-address.d.ts +44 -0
  242. package/dist/primitives/slot-address.js +19 -0
  243. package/dist/primitives/slot-bindings.d.ts +65 -26
  244. package/dist/primitives/slot-bindings.js +104 -46
  245. package/dist/primitives/slot-document.d.ts +23 -18
  246. package/dist/primitives/slot-document.js +39 -14
  247. package/dist/primitives/slot-download.d.ts +39 -0
  248. package/dist/primitives/slot-download.js +39 -0
  249. package/dist/primitives/slot-list.d.ts +3 -3
  250. package/dist/primitives/slot-list.js +0 -2
  251. package/dist/primitives/slot-media.d.ts +24 -5
  252. package/dist/primitives/slot-media.js +6 -9
  253. package/dist/primitives/slot-object.d.ts +49 -0
  254. package/dist/primitives/slot-object.js +20 -0
  255. package/dist/primitives/slot-scalar.d.ts +27 -2
  256. package/dist/primitives/slot-scalar.js +50 -7
  257. package/dist/primitives/slot.d.ts +13 -6
  258. package/dist/primitives/slot.js +10 -3
  259. package/dist/rules/registry.js +19 -30
  260. package/dist/schema/define-schema.d.ts +4 -8
  261. package/dist/schema/define-schema.js +178 -79
  262. package/dist/schema/extract-fill-spec.js +2 -153
  263. package/dist/schema/fact.d.ts +57 -15
  264. package/dist/schema/fact.js +42 -7
  265. package/dist/schema/facts-view.d.ts +14 -0
  266. package/dist/schema/format.d.ts +1 -0
  267. package/dist/schema/format.js +2 -1
  268. package/dist/schema/manifest.js +24 -0
  269. package/dist/schema/property-facts.d.ts +8 -12
  270. package/dist/schema/section-props.d.ts +2 -66
  271. package/dist/schema/section-schema.d.ts +8 -11
  272. package/dist/schema/section-schema.js +27 -10
  273. package/dist/section/declare.d.ts +18 -7
  274. package/dist/section/declare.js +18 -5
  275. package/dist/section/materialize.js +3 -8
  276. package/dist/section/section.d.ts +12 -8
  277. package/dist/section/section.js +1 -1
  278. package/dist/template/logic-shim.d.ts +14 -7
  279. package/dist/template/logic-shim.js +14 -7
  280. package/dist/template/materialize.js +17 -18
  281. package/dist/template/mirror-types.js +30 -31
  282. package/dist/template/section-reads.js +85 -9
  283. package/guide/reference/cli/INDEX.md +2 -2
  284. package/guide/reference/cli/build.md +1 -1
  285. package/guide/reference/cli/check.md +1 -1
  286. package/guide/reference/cli/dev.md +1 -1
  287. package/guide/reference/cli/property-add.md +1 -1
  288. package/guide/reference/cli/property-list.md +2 -2
  289. package/guide/reference/cli/publish.md +1 -1
  290. package/guide/reference/cli/upgrade.md +1 -1
  291. package/guide/reference/rules/INDEX.md +28 -24
  292. package/package.json +9 -8
  293. package/dist/artifact/playground/client/assets/index-CckS2ONm.css +0 -1
  294. package/dist/artifact/playground/client/assets/index-Dn_xT16-.js +0 -1101
  295. package/dist/fixtures/canonical.d.ts +0 -166
  296. package/dist/fixtures/media.js +0 -163
  297. package/dist/packages/internal/fill-vocabulary/dist/origination.js +0 -51
  298. package/dist/packages/internal/format-geometry/dist/index.js +0 -4
  299. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +0 -10
  300. package/dist/packages/internal/property-facts/dist/index.js +0 -3
  301. package/dist/packages/internal/property-facts/dist/property-facts-Cy7-O4p0.js +0 -189
  302. package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +0 -24
  303. package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -22
  304. package/dist/packages/internal/template-contracts/dist/facts-view.js +0 -104
  305. package/dist/packages/internal/template-contracts/dist/select-key.js +0 -7
  306. package/dist/primitives/slot-group.d.ts +0 -40
  307. package/dist/primitives/slot-group.js +0 -36
  308. package/dist/schema/extract-used-facts.js +0 -34
  309. package/dist/schema/fill-builders.d.ts +0 -115
  310. package/dist/schema/fill-builders.js +0 -25
  311. package/dist/schema/fill-declaration.d.ts +0 -14
  312. package/dist/schema/fill-spec.js +0 -98
  313. package/dist/schema/layout.d.ts +0 -30
  314. package/dist/schema/layout.js +0 -14
  315. package/dist/schema/row-fields.js +0 -88
  316. package/dist/schema/row-ref.d.ts +0 -59
  317. package/dist/schema/row-ref.js +0 -28
  318. package/dist/schema/runtime-values.d.ts +0 -71
  319. package/dist/schema/section-nav.js +0 -14
  320. package/dist/schema/slot-builders.d.ts +0 -633
  321. package/dist/schema/slot-builders.js +0 -177
  322. package/dist/schema/slot-ref.d.ts +0 -79
  323. package/dist/schema/slot-ref.js +0 -41
  324. package/dist/schema/slot-types.d.ts +0 -111
  325. package/dist/schema/slot-types.js +0 -214
  326. package/dist/section/groups.js +0 -68
@@ -0,0 +1,67 @@
1
+ import { TABLES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
2
+ import { memberListOfKey } from "../../template-contracts/dist/registry-shape.js";
3
+ import { listSourceRefusal } from "../../template-contracts/dist/row.js";
4
+ import "../../template-contracts/dist/table-members.js";
5
+ import { elementTableOf, fillOf, grammarSlots, insideItem, sameSectionSlot, sectionSlotAt } from "./grammar-scope.js";
6
+
7
+ //#region ../../internal/section-contracts/dist/row-source-contract.js
8
+ const ORIGINS = "the element inside an item, a row slot, a `compute()`, or a `fill.pick`";
9
+ function originTable(ctx, row) {
10
+ const source = row.def.source;
11
+ if (source?.kind === "element" && row.container !== void 0) return elementTableOf(ctx, row.container)?.table ?? null;
12
+ if (source?.kind !== "section") return null;
13
+ const target = sameSectionSlot(ctx, source);
14
+ const def = target === null ? void 0 : sectionSlotAt(ctx.schema, target)?.def;
15
+ if (def?.type !== "row" || typeof def.from !== "string") return null;
16
+ return tableKeyOf(def.from)?.table ?? def.from;
17
+ }
18
+ function checkRow(ctx, row) {
19
+ const where = `Section "${ctx.key}": row "${row.path}"`;
20
+ const from = row.def.from;
21
+ 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
+ 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.`);
24
+ if (from.indexOf(key) !== index) throw new Error(`${where} names the table ${JSON.stringify(key)} twice in \`from\`.`);
25
+ }
26
+ const table = Array.isArray(from) ? tableKeyOf(from[0]) : tableKeyOf(from);
27
+ 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.`);
29
+ 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
+ return;
31
+ }
32
+ const source = row.def.source;
33
+ if (source === void 0) {
34
+ const fill = fillOf(ctx, row);
35
+ if (fill !== void 0 && fill["verb"] !== "pick") throw new Error(`${where} is filled by ${fill["verb"] === void 0 ? "a fill naming no verb" : `\`fill.${String(fill["verb"])}\``} — a row holds a row that exists, which only a \`fill.pick\` yields.`);
36
+ return;
37
+ }
38
+ switch (source.kind) {
39
+ case "home": throw new Error(`${where} is sourced by ${JSON.stringify(source.key)} — a table is a row's \`from\`, never its source; a row's source is ${ORIGINS}.`);
40
+ case "element":
41
+ if (!insideItem(row)) throw new Error(`${where} is sourced by the element, but it sits outside a list's item, where no element exists.`);
42
+ break;
43
+ case "section": {
44
+ if (typeof source.section !== "string" || typeof source.slot !== "string") throw new Error(`${where} is sourced by a section ref naming no section and slot.`);
45
+ const target = sameSectionSlot(ctx, source);
46
+ if (target === null) return;
47
+ const def = sectionSlotAt(ctx.schema, target)?.def;
48
+ if (def === void 0) throw new Error(`${where} is sourced by slot "${target}", which this section does not declare.`);
49
+ if (def.type === "list") throw new Error(listSourceRefusal(where, `the list slot "${target}"`));
50
+ if (def.type !== "row") throw new Error(`${where} is sourced by slot "${target}", a "${String(def.type)}" — a row's slot source is another row.`);
51
+ if (target === row.path) throw new Error(`${where} is sourced by itself.`);
52
+ break;
53
+ }
54
+ case "derived":
55
+ if (source.transform !== row.path) throw new Error(`${where}: unknown transform "${String(source.transform)}". A row's compute() is held under "${row.path}".`);
56
+ return;
57
+ default: throw new Error(`${where} is sourced by ${JSON.stringify(source)} — a row's source is ${ORIGINS}.`);
58
+ }
59
+ 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\`.`);
61
+ }
62
+ function assertRowSourceContract(ctx) {
63
+ for (const slot of grammarSlots(ctx.schema)) if (slot.def.type === "row") checkRow(ctx, slot);
64
+ }
65
+
66
+ //#endregion
67
+ export { assertRowSourceContract };
@@ -1,5 +1,8 @@
1
1
  import { FACT_GRAPH } from "../../template-contracts/dist/slot-catalog.js";
2
+ import { legacyFactKey } from "../../template-contracts/dist/registry-aliases.js";
3
+ import { isReadableFactKey } from "../../template-contracts/dist/fact-keys.js";
2
4
  import { SECTION_CONTRACT_CATALOG } from "./catalog.js";
5
+ import { producedSlot } from "./grammar-scope.js";
3
6
  import { assertCapContract } from "./cap-contract.js";
4
7
  import { assertCountBoundsContract } from "./count-bounds-contract.js";
5
8
  import { assertGroupContract } from "./group-contract.js";
@@ -8,12 +11,19 @@ import { DECISION_KINDS } from "./fill-spec-view.js";
8
11
  import { assertWriterReadsFactContract } from "./writer-reads-fact-contract.js";
9
12
  import { assertListFillContract } from "./list-fill-contract.js";
10
13
  import { assertListScalarContract } from "./list-scalar-contract.js";
14
+ import { assertListSourceContract } from "./list-source-contract.js";
11
15
  import { assertNestedSlotTypes } from "./nested-slot-contract.js";
12
- import { assertRecordCollectionContract } from "./record-collection-contract.js";
16
+ import { assertDirectlyLinkedListContract } from "./directly-linked-list-contract.js";
17
+ import { assertFillVerbContract } from "./fill-verb-contract.js";
18
+ import { assertObjectContract } from "./object-contract.js";
13
19
  import { assertOptionSourceContract } from "./option-source-contract.js";
14
20
  import { assertPoiCurationContract } from "./poi-curation-contract.js";
21
+ import { assertReadsAcyclicContract } from "./reads-acyclic-contract.js";
15
22
  import { assertRowFillContract } from "./row-fill-contract.js";
16
- import { assertSourceContract } from "./source-contract.js";
23
+ import { assertDeclaredRefs, assertSourceContract } from "./source-contract.js";
24
+ import { assertRowRuleContract } from "./row-rule-contract.js";
25
+ import { assertRowSourceContract } from "./row-source-contract.js";
26
+ import { fillViews } from "../../template-contracts/dist/decision-fills.js";
17
27
  import { assertDisplayContract } from "./display-contract.js";
18
28
  import { assertDisplayEvidenceContract } from "./display-evidence-contract.js";
19
29
  import { assertSelectContract } from "./select-contract.js";
@@ -29,10 +39,24 @@ const byDecision = (run) => ({
29
39
  scope: "decision",
30
40
  run
31
41
  });
42
+ function decisionReadNodes(decision) {
43
+ const nodes = [];
44
+ const add = (at, node) => {
45
+ if (node === null || typeof node !== "object") return;
46
+ const { reads, of } = node;
47
+ nodes.push([at, { reads }]);
48
+ if (of !== null && typeof of === "object") nodes.push([`${at} of`, { reads: of.reads }]);
49
+ };
50
+ add("", decision);
51
+ const fields = decision.fields;
52
+ if (fields !== null && typeof fields === "object") for (const [field, node] of Object.entries(fields)) add(` field "${field}"`, node);
53
+ return nodes;
54
+ }
32
55
  const CONTRACTS = {
33
56
  "reads-readable": {
34
57
  implementation: bySection(({ key, fillSpec }) => {
35
- 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.`);
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);
36
60
  }),
37
61
  assertions: []
38
62
  },
@@ -48,10 +72,18 @@ const CONTRACTS = {
48
72
  },
49
73
  "produces-known-slot": {
50
74
  implementation: byDecision(({ key, schema }, d) => {
51
- for (const produced of d.produces) if (!(produced in schema.slots)) throw new Error(`Section "${key}": fill-spec decision "${d.id}" produces unknown slot "${produced}".`);
75
+ for (const produced of d.produces) if (producedSlot(schema, produced) === void 0) throw new Error(`Section "${key}": fill-spec decision "${d.id}" produces unknown slot "${produced}".`);
52
76
  }),
53
77
  assertions: []
54
78
  },
79
+ "fill-verb": {
80
+ implementation: byDecision(({ key, schema, fillSpec }, d) => assertFillVerbContract({
81
+ key,
82
+ schema,
83
+ fillSpec
84
+ }, d)),
85
+ assertions: [assertFillVerbContract]
86
+ },
55
87
  "poi-curation": {
56
88
  implementation: byDecision(({ key, schema }, d) => assertPoiCurationContract(schema, d, key)),
57
89
  assertions: [assertPoiCurationContract]
@@ -73,7 +105,7 @@ const CONTRACTS = {
73
105
  assertions: [assertCapContract]
74
106
  },
75
107
  "writer-reads-fact": {
76
- implementation: byDecision(({ key, schema }, d) => assertWriterReadsFactContract(schema, d, key)),
108
+ implementation: byDecision(({ key, schema, fillSpec }, d) => assertWriterReadsFactContract(schema, d, key, fillSpec)),
77
109
  assertions: [assertWriterReadsFactContract]
78
110
  },
79
111
  display: {
@@ -91,9 +123,29 @@ const CONTRACTS = {
91
123
  }, fillSpec)),
92
124
  assertions: [assertSourceContract]
93
125
  },
126
+ object: {
127
+ implementation: bySection(({ key, schema, fillSpec }) => assertObjectContract(schema, key, fillSpec)),
128
+ assertions: [assertObjectContract]
129
+ },
130
+ "list-source": {
131
+ implementation: bySection((input) => assertListSourceContract(input)),
132
+ assertions: [assertListSourceContract]
133
+ },
134
+ "row-source": {
135
+ implementation: bySection((input) => assertRowSourceContract(input)),
136
+ assertions: [assertRowSourceContract]
137
+ },
138
+ "row-rule": {
139
+ implementation: bySection((input) => assertRowRuleContract(input)),
140
+ assertions: [assertRowRuleContract]
141
+ },
142
+ "reads-acyclic": {
143
+ implementation: bySection((input) => assertReadsAcyclicContract(input)),
144
+ assertions: [assertReadsAcyclicContract]
145
+ },
94
146
  "record-collection": {
95
- implementation: bySection(({ key, schema }) => assertRecordCollectionContract(schema, key)),
96
- assertions: [assertRecordCollectionContract]
147
+ implementation: bySection(({ key, schema }) => assertDirectlyLinkedListContract(schema, key)),
148
+ assertions: [assertDirectlyLinkedListContract]
97
149
  },
98
150
  "nested-slot-types": {
99
151
  implementation: bySection(({ key, schema }) => assertNestedSlotTypes(schema, key)),
@@ -128,16 +180,28 @@ const CONTRACTS = {
128
180
  assertions: [assertGroupContract]
129
181
  }
130
182
  };
183
+ function perFill(input) {
184
+ const decisions = input.fillSpec.decisions.flatMap((decision) => fillViews(decision));
185
+ return {
186
+ ...input,
187
+ fillSpec: {
188
+ ...input.fillSpec,
189
+ decisions
190
+ }
191
+ };
192
+ }
131
193
  function toSectionRunner(implementation) {
132
- if (implementation.scope === "section") return implementation.run;
194
+ if (implementation.scope === "section") return (input) => implementation.run(perFill(input));
133
195
  const { run } = implementation;
134
- return (input) => {
196
+ return (raw) => {
197
+ const input = perFill(raw);
135
198
  for (const decision of input.fillSpec.decisions) run(input, decision);
136
199
  };
137
200
  }
138
201
  const SECTION_CONTRACT_RUNNERS = Object.fromEntries(SECTION_CONTRACT_CATALOG.map(({ id }) => [id, toSectionRunner(CONTRACTS[id].implementation)]));
139
202
  const SECTION_CONTRACT_ASSERTIONS = Object.fromEntries(SECTION_CONTRACT_CATALOG.map(({ id }) => [id, CONTRACTS[id].assertions]));
140
- function collectSectionContractViolations(input) {
203
+ function collectSectionContractViolations(raw) {
204
+ const input = perFill(raw);
141
205
  const violations = [];
142
206
  const attempt = (contract, run) => {
143
207
  try {
@@ -1,15 +1,7 @@
1
- import { normalizeSelectKey } from "../../template-contracts/dist/select-key.js";
2
-
3
1
  //#region ../../internal/section-contracts/dist/select-contract.js
4
2
  function checkSelectSlot(slot, label, sectionKey) {
5
3
  if (slot.type !== "select") return;
6
4
  if (slot.values != null === (slot.options != null)) throw new Error(`Section "${sectionKey}": ${label} needs exactly one of \`values\` or \`options\`.`);
7
- if (slot.creatable === true && Array.isArray(slot.values)) for (const entry of slot.values) {
8
- const key = typeof entry === "string" ? entry : entry?.value;
9
- if (typeof key !== "string") continue;
10
- const normalized = normalizeSelectKey(key);
11
- if (normalized !== key) throw new Error(`Section "${sectionKey}": ${label} is \`creatable\`, so its option keys must be normalized — "${key}" should be "${normalized}".`);
12
- }
13
5
  }
14
6
  function assertSelectContract(schema, sectionKey) {
15
7
  for (const [slotId, slotUnknown] of Object.entries(schema.slots)) {
@@ -1,50 +1,89 @@
1
- import { COLLECTIONS, FACT_GRAPH, SOURCE_FIELDS, isWritableSourceField } from "../../template-contracts/dist/slot-catalog.js";
1
+ import { tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
2
+ import { mirrorKindOf } from "../../template-contracts/dist/mirror-kind.js";
3
+ import { isMediaListKey, sourceFieldDescriptor } from "../../template-contracts/dist/fact-keys.js";
4
+ import { memberSourceOf } from "../../template-contracts/dist/row-sources.js";
2
5
  import { plannedFieldsOf } from "./fill-spec-view.js";
6
+ import { objectFieldOf } from "../../template-contracts/dist/slot-overrides.js";
7
+ import { tableMemberOrRefuse } from "./table-member.js";
3
8
 
4
9
  //#region ../../internal/section-contracts/dist/source-contract.js
5
- function assertOne(path, key, slot) {
10
+ function assertOne(path, key, slot, section) {
11
+ if (slot.type === "row" || slot.type === "object") return;
6
12
  const src = slot.source;
7
- if (!src) {
8
- if (slot.writeback !== void 0) throw new Error(`${path}: "writeback" without a source. Only a slot bound to a fact (a direct source) answers whether edits propagate — remove the key.`);
13
+ if (!src) return;
14
+ if (src.kind === "section") {
15
+ if (slot.type !== "list") assertMirror(path, key, slot, section);
9
16
  return;
10
17
  }
11
- if (src.kind === "direct") {
12
- const def = SOURCE_FIELDS[src.field ?? ""];
13
- if (!def) throw new Error(`${path}: unknown direct source field "${String(src.field)}"`);
18
+ if (src.kind === "home") {
19
+ const field = src.key ?? "";
20
+ 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)}"`);
14
23
  const recordItemSlot = slot.type === "list" && slot.fields != null;
15
- if (def.image && slot.type !== "image") throw new Error(`${path}: image source field "${src.field}" must sit on an image slot`);
16
- if (Object.hasOwn(COLLECTIONS, src.field ?? "")) {
17
- if (!recordItemSlot) throw new Error(`${path}: fact-collection source "${src.field}" needs a record item (a list declaring \`fields\`) — a fact row cannot project onto one slot.`);
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.`);
18
30
  }
19
- if (typeof slot.writeback !== "boolean") throw new Error(`${path}: a direct source requires "writeback" (boolean) — declare whether edits propagate to "${src.field}".`);
20
- if (slot.writeback === true && !isWritableSourceField(src.field ?? "")) throw new Error(`${path}: "writeback: true" on read-only source field "${src.field}" — the catalog has no write path for it; declare "writeback: false".`);
21
31
  return;
22
32
  }
33
+ 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.`);
34
+ if (src.kind === "item") throw new Error(`${path} is sourced by 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.`);
23
35
  if (src.kind !== "derived") return;
24
- 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.`);
25
36
  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) })").`);
26
37
  assertDeclaredRefs(path, src.reads);
27
38
  }
39
+ function declaredSlot(section, target) {
40
+ if (Object.hasOwn(section.slots, target)) return section.slots[target];
41
+ const field = objectFieldOf(target);
42
+ if (field === null) return void 0;
43
+ const object = section.slots[field.object];
44
+ return object?.type === "object" && object.fields !== void 0 && Object.hasOwn(object.fields, field.field) ? object.fields[field.field] : void 0;
45
+ }
46
+ function assertMirror(path, key, slot, section) {
47
+ const { section: upstreamSection, slot: upstream } = slot.source ?? {};
48
+ if (typeof upstreamSection !== "string" || upstreamSection === "" || typeof upstream !== "string" || upstream === "") throw new Error(`${path}: a slot source names no section and slot — a mirror's source is a section ref (\`{ kind: "section", section, slot }\`).`);
49
+ if (upstreamSection !== section.key) return;
50
+ if (upstream === key) throw new Error(`${path} is sourced by itself — a mirror's source is another slot.`);
51
+ const upstreamDef = declaredSlot(section, upstream);
52
+ if (upstreamDef === void 0) throw new Error(`${path} mirrors slot "${upstream}", which this section does not declare — name a top-level slot or a top-level object's field.`);
53
+ const held = mirrorKindOf(slot);
54
+ const upstreamKind = mirrorKindOf(upstreamDef);
55
+ 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
+ }
28
57
  function assertDeclaredRefs(path, reads, rowMember) {
29
58
  if (reads === void 0) return;
30
59
  if (!Array.isArray(reads)) throw new Error(`${path}: "reads" is not a list of refs.`);
31
60
  reads.forEach((entry, i) => {
32
- const { kind, key, section, slot, field } = entry ?? {};
33
- if (kind === "fact" && typeof key === "string") return;
34
- if (kind === "slot" && typeof section === "string" && typeof slot === "string") return;
61
+ const record = entry ?? {};
62
+ const { kind, key, section, slot, field } = record;
63
+ if (kind === "home" && typeof key === "string") return;
64
+ if (kind === "section" && typeof section === "string" && typeof slot === "string") return;
65
+ refuseIndexedRow(`${path}: reads[${String(i)}]`, record);
66
+ if (kind === "row" && "slot" in record || kind === "element") return;
35
67
  if (kind === "row" && typeof field === "string") {
36
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.`);
37
69
  rowMember(field);
38
70
  return;
39
71
  }
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 }).`);
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 }).`);
41
73
  });
42
74
  }
43
75
  function assertSourceContract(schema, fillSpec = { decisions: [] }) {
44
76
  for (const [name, slot] of Object.entries(schema.slots)) {
45
77
  const at = `${schema.key}.${name}`;
46
- if (slot.source?.kind === "row") throw new Error(`${at}: a row source on a top-level slot — a row member or marker names a field of a record list's row, and a top-level slot has no row. Bind the slot to a fact instead.`);
47
- assertOne(at, name, slot);
78
+ refuseIndexedRow(at, slot.source);
79
+ 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
+ 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 ?? {})) {
83
+ refuseIndexedRow(`${at}.${fieldKey}`, field.source);
84
+ if (field.source?.kind === "row") continue;
85
+ assertOne(`${at}.${fieldKey}`, `${name}.${fieldKey}`, field, schema);
86
+ }
48
87
  if (slot.type !== "list" || slot.fields === void 0) continue;
49
88
  assertNotImplicit(at, slot.fields, plannedRowFields(fillSpec, name));
50
89
  assertRowSourceList(at, name, slot, slot.fields);
@@ -58,55 +97,77 @@ function assertNotImplicit(at, fields, planned) {
58
97
  const offenders = [];
59
98
  for (const [fieldKey, field] of Object.entries(fields)) {
60
99
  const kind = field.source?.kind;
61
- if (kind === "direct") offenders.push(`"${fieldKey}" (bound \`direct\` to "${String(field.source?.field)}")`);
100
+ if (kind === "home") offenders.push(`"${fieldKey}" (bound to the fact "${String(field.source?.key)}")`);
62
101
  else if ((kind === void 0 || kind === "authored") && !planned.has(fieldKey)) offenders.push(`"${fieldKey}" (no origin)`);
63
102
  }
64
103
  if (offenders.length === 0) return;
65
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\`).`);
66
105
  }
106
+ function refuseIndexedRow(path, ref) {
107
+ if (ref === null || typeof ref !== "object") return;
108
+ const record = ref;
109
+ if (record["kind"] !== "row" || !("collection" in record || "index" in record)) return;
110
+ const table = String(record["collection"]);
111
+ const index = String(record["index"]);
112
+ throw new Error(`${path}: a row read by position (\`fact.property.${table}[${index}]\`) — a list is read whole, and no source or read names its element by position. Declare the row as a computed row and read its member: \`row({ from: fact.property.${table}, source: compute({ reads: [fact.property.${table}] }, (rows) => rows[${index}] ?? null) })\`.`);
113
+ }
67
114
  function memberFits(valueType, field) {
68
115
  switch (valueType) {
69
116
  case "image": return field.type === "image";
70
- case "image_list": return field.type === "list" && field.fields === void 0 && field.element?.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";
121
+ case "address": return field.type === "address";
71
122
  case "number": return field.type === "number";
72
- case "text": return field.type === "text" || field.type === "url" || field.type === "select";
123
+ case "text": return TEXT_FIELD_TYPES.includes(field.type ?? "");
73
124
  default: return false;
74
125
  }
75
126
  }
127
+ const TEXT_FIELD_TYPES = [
128
+ "text",
129
+ "url",
130
+ "select",
131
+ "date",
132
+ "email",
133
+ "phone"
134
+ ];
135
+ function holdsElementImage(element) {
136
+ if (element?.type !== "object" || element.fields === void 0) return false;
137
+ return Object.values(element.fields).some((field) => field.type === "image" && field.source?.kind === "element");
138
+ }
76
139
  function fittingTypes(valueType) {
77
140
  switch (valueType) {
78
141
  case "image": return "an `image` field";
79
- case "image_list": return "a list of images (`list({ item: image() })`)";
142
+ case "image_list": return "a list of images (`list({ item: image() })`), or a list of objects with an image field reading the element";
143
+ case "row_list": return "a list of objects (`list({ item: object(...) })`)";
144
+ case "text_list": return "a list of text values (`list({ item: text.short({ cap }) })`)";
145
+ case "number_list": return "a list of numbers (`list({ item: number() })`)";
146
+ case "address": return "an `address` field";
80
147
  case "number": return "a `number` field";
81
- case "text": return "a `text`, `url` or `select` field";
148
+ case "text": return "a `text`, `url`, `select`, `date`, `email` or `phone` field";
82
149
  default: return "no field — it is not offered to a row";
83
150
  }
84
151
  }
85
152
  function assertRowSourceList(at, listKey, list, fields) {
86
153
  const listSource = list.source;
87
- const boundField = listSource?.kind === "direct" ? listSource.field ?? "" : void 0;
88
- if (boundField !== void 0 && !Object.hasOwn(COLLECTIONS, boundField)) throw new Error(`${at}: row sources on a list bound to "${boundField}", which is not a fact collection — a row member names a member of the row a collection supplies.`);
89
- const collection = boundField;
90
- const computed = listSource?.kind === "derived";
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.`);
91
157
  const filled = listSource === void 0;
92
158
  const assertMember = (path, member) => {
93
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.`);
94
- if (collection === void 0) return void 0;
95
- if (member === COLLECTIONS[collection].idKey) throw new Error(`${path}: row member "${member}" is the row's identity, which every baked "${collection}" row carries as "${member}" already — drop the field.`);
96
- const row = FACT_GRAPH[collection].row;
97
- const descriptor = row[member];
98
- if (descriptor === void 0) throw new Error(`${path}: unknown row member "${member}" — a "${collection}" row offers ${Object.keys(row).filter((name) => name !== COLLECTIONS[collection].idKey).map((name) => `"${name}"`).join(", ")}.`);
99
- return descriptor;
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
+ });
100
165
  };
101
166
  for (const [fieldKey, field] of Object.entries(fields)) {
102
167
  const path = `${at}.${fieldKey}`;
103
168
  const src = field.source;
104
- if (src === void 0 || src.kind === "authored") {
105
- if (field.writeback !== void 0) throw new Error(`${path}: "writeback" without a source. Only a field bound to a row member answers whether edits propagate — remove the key.`);
106
- continue;
107
- }
169
+ if (src === void 0 || src.kind === "authored") continue;
108
170
  if (src.kind === "derived") {
109
- if (field.writeback !== void 0) throw new Error(`${path}: "writeback" on a derived (compute) source. Nothing can write back through a derivation — remove the key.`);
110
171
  const handle = `${listKey}.${fieldKey}`;
111
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.`);
112
173
  assertDeclaredRefs(path, src.reads, (member) => {
@@ -115,18 +176,14 @@ function assertRowSourceList(at, listKey, list, fields) {
115
176
  continue;
116
177
  }
117
178
  if (src.kind !== "row") continue;
179
+ refuseIndexedRow(path, src);
118
180
  if (typeof src.field !== "string") throw new Error(`${path}: a row source names no member — it is \`{ kind: "row", field: "<member>" }\`.`);
119
181
  const member = src.field;
120
182
  const descriptor = assertMember(path, member);
121
- if (field.writeback !== void 0 && typeof field.writeback !== "boolean") throw new Error(`${path}: "writeback" is not a boolean — declare whether edits propagate to row member "${member}".`);
122
- if (descriptor === void 0) {
123
- if (computed && field.writeback === true) throw new Error(`${path}: "writeback: true" on a row of a computed list — nothing can write back through a derivation; declare "writeback: false".`);
124
- continue;
125
- }
183
+ if (descriptor === void 0) continue;
126
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)}.`);
127
- if (field.writeback === true && descriptor.writeback === void 0) throw new Error(`${path}: "writeback: true" on read-only row member "${member}" — the catalog has no write path for it; declare "writeback: false".`);
128
185
  }
129
186
  }
130
187
 
131
188
  //#endregion
132
- export { assertDeclaredRefs, assertSourceContract };
189
+ export { assertDeclaredRefs, assertSourceContract, fittingTypes, memberFits, refuseIndexedRow };
@@ -1,26 +1,56 @@
1
- import { VIDEO_SOURCES } from "../../template-contracts/dist/slot-catalog.js";
1
+ import { declaredKinds, isMediaType, mediaDeclarationProblem } from "../../template-contracts/dist/slot-catalog.js";
2
+ import { isMediaListKey, mediaListKeys, mediaListKinds } from "../../template-contracts/dist/fact-keys.js";
2
3
 
3
4
  //#region ../../internal/section-contracts/dist/sources-contract.js
4
5
  function assertSourcesContract(schema, sectionKey) {
5
- for (const [slotId, slotUnknown] of Object.entries(schema.slots)) check(slotUnknown, sectionKey, slotId);
6
+ for (const [slotId, slot] of Object.entries(schema.slots)) check(slot, sectionKey, slotId, false);
6
7
  }
7
- function check(slotUnknown, sectionKey, path) {
8
- const slot = slotUnknown;
9
- if (slot.sources !== void 0) {
10
- if (slot.type !== "video") throw new Error(`Section "${sectionKey}": slot "${path}" declares \`sources\`, but only a video slot may — a LIST of videos declares it on its item, not on the list. A url slot's link vocabulary is \`accepts\`.`);
11
- validateSources(slot.sources, sectionKey, path);
8
+ const BINDING_KINDS = /* @__PURE__ */ new Set([
9
+ "home",
10
+ "row",
11
+ "element",
12
+ "section"
13
+ ]);
14
+ function isBound(slot) {
15
+ const kind = slot.source?.kind;
16
+ return kind !== void 0 && BINDING_KINDS.has(kind);
17
+ }
18
+ function check(slot, sectionKey, path, inherited, picked = false) {
19
+ if (slot.sources !== void 0) throw new Error(`Section "${sectionKey}": slot "${path}" declares \`sources\`. A media slot takes a pasted link wherever a link provider claims its kind (a video, a tour) and declares nothing for it — \`concrete upgrade\` removes it.`);
20
+ const holdsPick = picked && slot.source?.kind === "element" && isMediaType(slot.type ?? "");
21
+ checkMediaFilter(slot, sectionKey, path, inherited || isBound(slot) && !holdsPick);
22
+ if (slot.element) {
23
+ const list = slot.type === "list";
24
+ check(slot.element, sectionKey, `${path}.element`, list && isBound(slot), list && slot.source === void 0);
12
25
  }
13
- if (slot.element) check(slot.element, sectionKey, `${path}.element`);
14
- if (slot.fields) for (const [fieldId, field] of Object.entries(slot.fields)) check(field, sectionKey, `${path}.${fieldId}`);
26
+ if (slot.fields) for (const [fieldId, field] of Object.entries(slot.fields)) check(field, sectionKey, `${path}.${fieldId}`, false, picked && slot.type === "object");
15
27
  }
16
- function validateSources(sources, sectionKey, path) {
17
- if (!Array.isArray(sources)) throw new Error(`Section "${sectionKey}": video "${path}" \`sources\` must be an array of ${VIDEO_SOURCES.join(" | ")}, got ${JSON.stringify(sources)}.`);
18
- if (sources.length === 0) throw new Error(`Section "${sectionKey}": video "${path}" declares no source. A slot admitting nothing should not exist — omit \`sources\` for the upload-only default.`);
19
- const seen = /* @__PURE__ */ new Set();
20
- for (const source of sources) {
21
- if (typeof source !== "string" || !VIDEO_SOURCES.includes(source)) throw new Error(`Section "${sectionKey}": video "${path}" declares unknown video source ${JSON.stringify(source)}. Use one of ${VIDEO_SOURCES.join(" | ")}.`);
22
- if (seen.has(source)) throw new Error(`Section "${sectionKey}": video "${path}" lists duplicate source ${JSON.stringify(source)}.`);
23
- seen.add(source);
28
+ function checkMediaFilter(slot, sectionKey, path, bound) {
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.`);
31
+ if (!isMediaType(kind)) {
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
+ 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.`);
34
+ return;
35
+ }
36
+ const problem = mediaDeclarationProblem({
37
+ type: kind,
38
+ kinds: slot.kinds,
39
+ process: slot.process
40
+ });
41
+ if (problem !== null) throw new Error(`Section "${sectionKey}": ${kind} "${path}" ${problem}.`);
42
+ if (slot.from === void 0 && slot.process === void 0) return;
43
+ if (bound) throw new Error(`Section "${sectionKey}": ${kind} "${path}" is bound to a fact and declares \`${slot.from !== void 0 ? "from" : "process"}\`. A bound media slot holds what its fact holds — remove it.`);
44
+ const lists = slot.from === void 0 ? [] : Array.isArray(slot.from) ? slot.from : [slot.from];
45
+ const holds = declaredKinds({
46
+ type: kind,
47
+ kinds: slot.kinds
48
+ });
49
+ for (const [index, list] of lists.entries()) {
50
+ if (!isMediaListKey(list)) throw new Error(`Section "${sectionKey}": ${kind} "${path}" picks \`from\` ${JSON.stringify(list)}, which is no media list of the property — ${mediaListKeys().map((key) => `"${key}"`).join(", ")}.`);
51
+ if (lists.indexOf(list) !== index) throw new Error(`Section "${sectionKey}": ${kind} "${path}" picks \`from\` "${list}" twice — each list is named once.`);
52
+ const listed = mediaListKinds(list) ?? [];
53
+ if (listed.length > 0 && !holds.some((held) => listed.includes(held))) throw new Error(`Section "${sectionKey}": ${kind} "${path}" picks \`from\` "${list}", a list of ${listed.join(", ")}, whose items can never be ${holds.join(" or ")} — each list a media slot picks from holds items of its kinds.`);
24
54
  }
25
55
  }
26
56
 
@@ -0,0 +1,16 @@
1
+ import { REGISTRY_TABLE_KEYS } from "../../template-contracts/dist/slot-catalog.js";
2
+ import { tableRowMember } from "../../template-contracts/dist/table-members.js";
3
+
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);
10
+ 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(", ")}.`);
12
+ return found;
13
+ }
14
+
15
+ //#endregion
16
+ export { tableKeySpelling, tableMemberOrRefuse };