@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,244 @@
1
+ import { ADDRESS_SOURCES } from "../../template-contracts/dist/address-value.js";
2
+ import { FILE_RENDITION_NAMES, PLACE_RENDITION_NAMES, RENDITION_NAMES, fileNameOf, framedAt, framingOver, hasOwnFraming, isHomeMediaValue, isMediaReference, mediaIdOf, mediaRecords, mergeMedia, readAsRecords, recordOf, splitMedia, videoSourceOf } from "../../template-contracts/dist/registry-facts.js";
3
+ import { libraryFacts, listKeyOf, propertyFacts } from "../../template-contracts/dist/fact-registry.js";
4
+ import { z } from "zod";
5
+
6
+ //#region ../../internal/property-facts/dist/registry-facts.js
7
+ const RenditionSchema = z.object({
8
+ key: z.string(),
9
+ mime: z.string().nullable(),
10
+ width: z.number().int().nullable(),
11
+ height: z.number().int().nullable(),
12
+ bytes: z.number().int().nullable()
13
+ }).strict();
14
+ const ServedRenditionSchema = RenditionSchema.extend({ url: z.string() }).strict();
15
+ const CropSchema = z.object({
16
+ x: z.number(),
17
+ y: z.number(),
18
+ width: z.number(),
19
+ height: z.number()
20
+ }).strict();
21
+ const RenditionInputsSchema = z.object({
22
+ crop: CropSchema.nullable(),
23
+ options: z.record(z.string(), z.unknown())
24
+ }).strict();
25
+ const PlaceRenditionSchema = RenditionSchema.extend({ over: RenditionInputsSchema }).strict();
26
+ const ServedPlaceRenditionSchema = ServedRenditionSchema.extend({ over: RenditionInputsSchema }).strict();
27
+ const nothing = z.null();
28
+ const text = z.string().nullable();
29
+ const count = z.number().int().nullable();
30
+ function renditionsSchema(rendition, placed, has, names = RENDITION_NAMES) {
31
+ const isPlace = (name) => PLACE_RENDITION_NAMES.includes(name);
32
+ const slots = Object.fromEntries(names.map((name) => [name, has.includes(name) ? (isPlace(name) ? placed : rendition).nullable() : nothing]));
33
+ return z.object(slots).strict();
34
+ }
35
+ const placeMembers = {
36
+ id: z.string(),
37
+ file: z.string(),
38
+ crop: CropSchema.nullable(),
39
+ name: z.string()
40
+ };
41
+ const members = {
42
+ key: text,
43
+ mime: text,
44
+ bytes: count,
45
+ url: text,
46
+ provider: text,
47
+ added_at: z.string(),
48
+ account: text,
49
+ page_count: count,
50
+ duration_ms: count,
51
+ width: count,
52
+ height: count,
53
+ captured_at: text,
54
+ scan_count: count,
55
+ poster_at_ms: count,
56
+ state: z.enum([
57
+ "processing",
58
+ "ready",
59
+ "failed"
60
+ ]),
61
+ ...placeMembers
62
+ };
63
+ function mediaSchemaOf(rendition, placed, extras) {
64
+ const image = z.object({
65
+ ...members,
66
+ kind: z.literal("image"),
67
+ key: z.string(),
68
+ url: nothing,
69
+ provider: nothing,
70
+ page_count: nothing,
71
+ duration_ms: nothing,
72
+ poster_at_ms: nothing,
73
+ captured_at: nothing,
74
+ scan_count: nothing,
75
+ renditions: renditionsSchema(rendition, placed, [
76
+ "master",
77
+ "crop",
78
+ "cutout",
79
+ "mask_white",
80
+ "mask_black"
81
+ ]),
82
+ ...extras.image
83
+ }).strict();
84
+ const video = z.object({
85
+ ...members,
86
+ kind: z.literal("video"),
87
+ crop: nothing,
88
+ page_count: nothing,
89
+ scan_count: nothing,
90
+ renditions: renditionsSchema(rendition, placed, ["poster", "encode"]),
91
+ ...extras.video
92
+ }).strict();
93
+ const tour = z.object({
94
+ ...members,
95
+ kind: z.literal("tour"),
96
+ crop: nothing,
97
+ key: nothing,
98
+ mime: nothing,
99
+ bytes: nothing,
100
+ url: z.string(),
101
+ provider: z.string(),
102
+ page_count: nothing,
103
+ duration_ms: nothing,
104
+ poster_at_ms: nothing,
105
+ width: nothing,
106
+ height: nothing,
107
+ renditions: renditionsSchema(rendition, placed, ["poster"]),
108
+ ...extras.tour
109
+ }).strict();
110
+ const document = z.object({
111
+ ...members,
112
+ kind: z.literal("document"),
113
+ crop: nothing,
114
+ key: z.string(),
115
+ url: nothing,
116
+ provider: nothing,
117
+ duration_ms: nothing,
118
+ poster_at_ms: nothing,
119
+ width: nothing,
120
+ height: nothing,
121
+ captured_at: nothing,
122
+ scan_count: nothing,
123
+ renditions: renditionsSchema(rendition, placed, ["poster"]),
124
+ ...extras.document
125
+ }).strict();
126
+ return z.discriminatedUnion("kind", [
127
+ image,
128
+ video,
129
+ tour,
130
+ document
131
+ ]);
132
+ }
133
+ const MediaSchema = mediaSchemaOf(RenditionSchema, PlaceRenditionSchema, {
134
+ image: {},
135
+ video: {},
136
+ tour: {},
137
+ document: {}
138
+ });
139
+ const SERVED_EXTRAS = {
140
+ image: { file_url: z.string() },
141
+ video: { file_url: text },
142
+ tour: { file_url: nothing },
143
+ document: { file_url: z.string() }
144
+ };
145
+ const ServedMediaSchema = mediaSchemaOf(ServedRenditionSchema, ServedPlaceRenditionSchema, SERVED_EXTRAS);
146
+ function fileSchemaOf(rendition, extras) {
147
+ const [image, video, tour, document] = mediaSchemaOf(rendition, rendition, extras).options;
148
+ const place = {
149
+ file: true,
150
+ crop: true,
151
+ name: true
152
+ };
153
+ return z.discriminatedUnion("kind", [
154
+ image.omit(place).extend({ renditions: renditionsSchema(rendition, rendition, ["master"], FILE_RENDITION_NAMES) }),
155
+ video.omit(place).extend({ renditions: renditionsSchema(rendition, rendition, ["poster", "encode"], FILE_RENDITION_NAMES) }),
156
+ tour.omit(place).extend({ renditions: renditionsSchema(rendition, rendition, ["poster"], FILE_RENDITION_NAMES) }),
157
+ document.omit(place).extend({ renditions: renditionsSchema(rendition, rendition, ["poster"], FILE_RENDITION_NAMES) })
158
+ ]);
159
+ }
160
+ const MediaFileSchema = fileSchemaOf(RenditionSchema, {
161
+ image: {},
162
+ video: {},
163
+ tour: {},
164
+ document: {}
165
+ });
166
+ const ServedFileSchema = fileSchemaOf(ServedRenditionSchema, SERVED_EXTRAS);
167
+ const placeRenditions = renditionsSchema(RenditionSchema, PlaceRenditionSchema, PLACE_RENDITION_NAMES, PLACE_RENDITION_NAMES);
168
+ const HomeMediaValueSchema = z.object({
169
+ id: z.string(),
170
+ file: z.string(),
171
+ crop: CropSchema.nullable(),
172
+ name: z.string().nullable(),
173
+ renditions: placeRenditions
174
+ }).strict();
175
+ const MediaReferenceSchema = z.object({
176
+ media: z.string(),
177
+ crop: CropSchema.nullable().optional(),
178
+ renditions: placeRenditions.partial().strict().optional()
179
+ }).strict();
180
+ const REGISTRIES = {
181
+ property: propertyFacts,
182
+ library: libraryFacts
183
+ };
184
+ const nullableText = z.string().nullable();
185
+ const AddressViewSchema = z.object({
186
+ street: nullableText,
187
+ unit: nullableText,
188
+ city: nullableText,
189
+ state: nullableText,
190
+ postal: nullableText,
191
+ latitude: z.number().nullable(),
192
+ longitude: z.number().nullable(),
193
+ source: z.enum(ADDRESS_SOURCES).nullable(),
194
+ display: nullableText,
195
+ street_no_type: nullableText
196
+ }).strict();
197
+ function rowElement(from) {
198
+ const list = listKeyOf(from);
199
+ const listed = REGISTRIES[list.home].pages[list.key]?.declaration;
200
+ if (listed?.type !== "list") throw new Error(`registry facts: ${from} is not a list fact`);
201
+ return listed.element;
202
+ }
203
+ function selectSchema(values, creatable) {
204
+ const [first, ...rest] = (values ?? []).map((option) => typeof option === "string" ? option : option.value);
205
+ return creatable === true || first === void 0 ? nullableText : z.enum([first, ...rest]).nullable();
206
+ }
207
+ function valueSchema(declaration) {
208
+ switch (declaration.type) {
209
+ case "list": return z.array(itemSchema(declaration.element));
210
+ case "object": return z.object(Object.fromEntries(Object.entries(declaration.fields).map(([key, field]) => [key, valueSchema(field)]))).strict();
211
+ case "row": return itemSchema(rowElement(declaration.from));
212
+ case "address": return AddressViewSchema;
213
+ case "image":
214
+ case "video":
215
+ case "tour":
216
+ case "document":
217
+ case "media": return (declaration.from === void 0 ? HomeMediaValueSchema : MediaReferenceSchema).nullable();
218
+ case "number": return (declaration.decimals === true ? z.number() : z.number().int()).nullable();
219
+ case "select": return selectSchema(declaration.values, declaration.creatable);
220
+ case "date": return z.string().regex(/^\d{4}-\d{2}-\d{2}$/).nullable();
221
+ case "text":
222
+ case "url":
223
+ case "email":
224
+ case "phone": return nullableText;
225
+ }
226
+ }
227
+ function itemSchema(element) {
228
+ if (element.type === "object") {
229
+ const fields = Object.entries(element.fields);
230
+ return z.object({
231
+ ...Object.fromEntries(fields.map(([key, field]) => [key, valueSchema(field)])),
232
+ id: z.string()
233
+ }).strict();
234
+ }
235
+ if (element.type === "row") return valueSchema(element);
236
+ return valueSchema(element).unwrap();
237
+ }
238
+ const RegistryFactsSchema = z.object({
239
+ ...Object.fromEntries(Object.entries(REGISTRIES.property.pages).map(([key, page]) => [key, valueSchema(page.declaration)])),
240
+ files: z.record(z.string(), MediaFileSchema)
241
+ }).strict();
242
+
243
+ //#endregion
244
+ export { HomeMediaValueSchema, MediaFileSchema, MediaReferenceSchema, RegistryFactsSchema };
@@ -1,22 +1,12 @@
1
- import { plannerForField } from "../../fill-vocabulary/dist/row-planners.js";
1
+ import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
2
+ import { capHolderOf } from "../../fill-vocabulary/dist/resolved-decision.js";
3
+ import { producedSlot } from "./grammar-scope.js";
4
+ import { assertOptionsHonoured } from "./fill-options.js";
2
5
 
3
6
  //#region ../../internal/section-contracts/dist/cap-contract.js
4
- function capHolder(slot) {
5
- if (slot.fields !== void 0) return null;
6
- const planner = plannerForField(slot);
7
- if (planner === "text") return {
8
- holder: slot,
9
- suffix: ""
10
- };
11
- if (planner === "list") return {
12
- holder: slot.element ?? {},
13
- suffix: "'s element"
14
- };
15
- return null;
16
- }
17
7
  function checkAgainstSlot(node, slot, where, decisionId, sectionKey) {
18
8
  if (slot === void 0) return;
19
- const resolved = capHolder(slot);
9
+ const resolved = capHolderOf(slot);
20
10
  if (resolved === null) return;
21
11
  const label = `${where}${resolved.suffix}`;
22
12
  const slotCap = resolved.holder.cap;
@@ -28,14 +18,15 @@ function checkAgainstSlot(node, slot, where, decisionId, sectionKey) {
28
18
  function checkNode(node, slot, slotId, field, decisionId, sectionKey) {
29
19
  checkAgainstSlot(node, slot, field === void 0 ? `slot "${slotId}"` : `inner slot "${field}" of "${slotId}"`, decisionId, sectionKey);
30
20
  for (const [planned, plan] of Object.entries(node.fields ?? {})) {
31
- const rowField = slot?.fields?.[planned];
21
+ const rowField = slot === void 0 ? void 0 : listItemFieldsOf(slot)?.[planned];
32
22
  if (!rowField) continue;
33
23
  checkNode(plan, rowField, slotId, planned, decisionId, sectionKey);
34
24
  }
35
25
  }
36
26
  function assertCapContract(schema, decision, sectionKey) {
27
+ assertOptionsHonoured(schema, decision, sectionKey, ["cap"]);
37
28
  const node = decision;
38
- for (const slotId of decision.produces) checkNode(node, schema.slots[slotId], slotId, void 0, decision.id, sectionKey);
29
+ for (const slotId of decision.produces) checkNode(node, producedSlot(schema, slotId), slotId, void 0, decision.id, sectionKey);
39
30
  }
40
31
 
41
32
  //#endregion
@@ -12,21 +12,25 @@ const SECTION_CONTRACT_CATALOG = [
12
12
  id: "produces-known-slot",
13
13
  summary: "Every fill decision produces only slots the section declares."
14
14
  },
15
+ {
16
+ id: "fill-verb",
17
+ summary: "A fill names its verb and brief, a pick names its candidates with of and no other verb takes one, and a filled list declares max."
18
+ },
15
19
  {
16
20
  id: "poi-curation",
17
21
  summary: "A points-of-interest curation decision produces exactly one slot, a list of points of interest."
18
22
  },
19
23
  {
20
24
  id: "list-fill",
21
- summary: "A list fill declares what the slot's own origination needs: rows bound to facts or filled field by field, a brief where the model originates rows, a bound where it writes them."
25
+ summary: "A list fill declares what its source needs: a brief wherever the model yields the items, a max wherever it writes rather than picks them, and nothing of the model's on a list bound to a table."
22
26
  },
23
27
  {
24
28
  id: "row-fill",
25
- summary: "A list fill plans only unbound fields its record item declares, each of a type a row can be filled with."
29
+ summary: "A list fill plans only unbound fields its object item declares, each of a kind an item field can be filled with."
26
30
  },
27
31
  {
28
32
  id: "count-bounds",
29
- summary: "Every item count a decision requests fits the bounds of the slot or row field that holds the items."
33
+ summary: "The items a fill is asked for fit the min and max of the list that holds them, at the top level or inside an item."
30
34
  },
31
35
  {
32
36
  id: "cap",
@@ -34,7 +38,7 @@ const SECTION_CONTRACT_CATALOG = [
34
38
  },
35
39
  {
36
40
  id: "writer-reads-fact",
37
- summary: "A fill that writes text, its row fields included, reads at least one fact to ground what it writes."
41
+ summary: "A fill that writes text, its item fields included, reads at least one fact to ground what it writes."
38
42
  },
39
43
  {
40
44
  id: "display",
@@ -46,23 +50,43 @@ const SECTION_CONTRACT_CATALOG = [
46
50
  },
47
51
  {
48
52
  id: "source",
49
- summary: "Every slot and row field source names a known fact or its own compute binding, with a legal writeback."
53
+ summary: "Every slot and item field source names a known fact, another slot or its own compute binding; the uploads are read, never bound."
54
+ },
55
+ {
56
+ id: "object",
57
+ summary: "An object groups value slots, rows, lists of value slots and lists of objects one level deep, holds no value of its own, is labelled by a string or its label field, and names no field like its binding's own keys."
58
+ },
59
+ {
60
+ id: "list-source",
61
+ summary: "A list's source is a list, a table, a list slot or a compute, and its item can take the source's element."
62
+ },
63
+ {
64
+ id: "row-source",
65
+ summary: "A row names its table in `from`; its source is a row slot it mirrors, a compute, the element inside an item, or a pick, and is never a table or a list."
66
+ },
67
+ {
68
+ id: "row-rule",
69
+ summary: "A member is read only through a row slot or an address in scope that offers it, and fits the slot that reads it."
70
+ },
71
+ {
72
+ id: "reads-acyclic",
73
+ summary: "No slot reads itself through its sources, rows and reads."
50
74
  },
51
75
  {
52
76
  id: "record-collection",
53
- summary: "A fact-bound record list binds a registry collection and may only narrow its membership bounds."
77
+ summary: "A list bound to a fact binds a registry table and may only narrow its min and max."
54
78
  },
55
79
  {
56
80
  id: "nested-slot-types",
57
- summary: "Every field of a record item carries a known slot type."
81
+ summary: "An object's fields, a nested list item's included, are each a value slot, a row or a list, of a kind the catalog declares."
58
82
  },
59
83
  {
60
84
  id: "list-scalar",
61
- summary: "A list declares exactly one legal item, a value element or a flat record of fields, with satisfiable bounds."
85
+ summary: "A list declares exactly one legal item, a value element, an object or a row, with satisfiable bounds."
62
86
  },
63
87
  {
64
88
  id: "select",
65
- summary: "A select declares exactly one of values or options, and a creatable select's keys are normalized."
89
+ summary: "A select declares exactly one of values or options."
66
90
  },
67
91
  {
68
92
  id: "option-source",
@@ -74,7 +98,7 @@ const SECTION_CONTRACT_CATALOG = [
74
98
  },
75
99
  {
76
100
  id: "sources",
77
- summary: "Only a video slot declares sources, as a non-empty list of distinct known video sources."
101
+ summary: "No slot declares sources, since a media slot takes a pasted link wherever a link provider claims its kind; a media slot picks `from` a media list of the property, or owns its asset without one, and processes only what its kind takes; a slot bound to a fact states neither."
78
102
  },
79
103
  {
80
104
  id: "interpolation",
@@ -1,3 +1,7 @@
1
+ import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
2
+ import { producedSlot } from "./grammar-scope.js";
3
+ import { assertOptionsHonoured } from "./fill-options.js";
4
+
1
5
  //#region ../../internal/section-contracts/dist/count-bounds-contract.js
2
6
  function requestedCount(raw) {
3
7
  if (typeof raw === "number") return {
@@ -30,11 +34,16 @@ function checkNode(node, holder, slotId, field, decisionId, sectionKey) {
30
34
  }
31
35
  }
32
36
  function assertCountBoundsContract(schema, decision, sectionKey) {
37
+ assertOptionsHonoured(schema, decision, sectionKey, ["count"]);
33
38
  const node = decision;
34
39
  for (const slotId of decision.produces) {
35
- const slot = schema.slots[slotId];
40
+ const slot = producedSlot(schema, slotId);
36
41
  if (!slot) continue;
37
- checkNode(node, slot, slotId, void 0, decision.id, sectionKey);
42
+ checkNode(node, {
43
+ min: slot.min,
44
+ max: slot.max,
45
+ fields: listItemFieldsOf(slot)
46
+ }, slotId, void 0, decision.id, sectionKey);
38
47
  }
39
48
  }
40
49
 
@@ -0,0 +1,27 @@
1
+ import { REGISTRY_TABLE_KEYS, TABLES, isLegacyTable, tableBounds, tableForSlot } from "../../template-contracts/dist/slot-catalog.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/directly-linked-list-contract.js
4
+ function assertDirectlyLinkedListContract(schema, sectionKey) {
5
+ for (const [slotId, slotUnknown] of Object.entries(schema.slots)) {
6
+ const slot = slotUnknown;
7
+ const grammar = slot.fields == null && (slot.element?.type === "object" || slot.element?.type === "row");
8
+ if (slot.type !== "list" || slot.fields == null && !grammar) continue;
9
+ const label = `list "${slotId}"`;
10
+ const source = slot.source;
11
+ if (source?.kind !== "home") continue;
12
+ const table = tableForSlot(slot);
13
+ if (table === null && grammar) continue;
14
+ if (table === null) {
15
+ const legal = Object.keys(REGISTRY_TABLE_KEYS).map((field) => `fact.property.${field}`).join(" / ");
16
+ throw new Error(`Section "${sectionKey}": ${label} is bound to the fact "${source.key ?? "?"}", which is not a known table. TABLES is a closed registry owned by @homepages/concrete — a workspace cannot add to it. A directly linked list may only bind a registry array (${legal}); for any other repeating data, drop \`source\` and give the slot a fill decision instead.`);
17
+ }
18
+ const entry = isLegacyTable(table) ? TABLES[table] : null;
19
+ if (entry !== null && !entry.ownership) throw new Error(`Section "${sectionKey}": ${label} table "${table}" declares no ownership in TABLES. TABLES is a closed registry owned by @homepages/concrete — this is a framework defect, not something a workspace can fix.`);
20
+ const inherited = tableBounds(table);
21
+ if (inherited.max !== void 0 && slot.max !== void 0 && slot.max >= inherited.max) throw new Error(`Section "${sectionKey}": ${label} declares max ${slot.max}, but table "${table}" already caps membership at ${inherited.max}. An explicit max is legal only if it is strictly lower; drop it to inherit ${inherited.max}.`);
22
+ if (inherited.min !== void 0 && slot.min !== void 0 && slot.min <= inherited.min) throw new Error(`Section "${sectionKey}": ${label} declares min ${slot.min}, but table "${table}" already requires at least ${inherited.min}. An explicit min is legal only if it is strictly higher; drop it to inherit ${inherited.min}.`);
23
+ }
24
+ }
25
+
26
+ //#endregion
27
+ export { assertDirectlyLinkedListContract };
@@ -0,0 +1,12 @@
1
+ import { resolveDecision } from "../../fill-vocabulary/dist/resolved-decision.js";
2
+ import { producedSlots } from "./grammar-scope.js";
3
+
4
+ //#region ../../internal/section-contracts/dist/fill-options.js
5
+ function assertOptionsHonoured(schema, decision, sectionKey, options) {
6
+ const { refused } = resolveDecision(decision, producedSlots(schema, decision.produces));
7
+ const first = refused.find((refusal) => options.includes(refusal.option));
8
+ if (first !== void 0) throw new Error(`Section "${sectionKey}": ${first.message}`);
9
+ }
10
+
11
+ //#endregion
12
+ export { assertOptionsHonoured };
@@ -0,0 +1,95 @@
1
+ import { SLOT_TYPES, tableKeyOf } from "../../template-contracts/dist/slot-catalog.js";
2
+ import { readMediaOf } from "../../template-contracts/dist/media-candidates.js";
3
+ import { isMediaListKey } from "../../template-contracts/dist/fact-keys.js";
4
+ import { FINDABLE_KINDS, isFindableKind } from "../../template-contracts/dist/findable.js";
5
+ import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
6
+ import { readFillVerb } from "../../fill-vocabulary/dist/verbs.js";
7
+ import { producedSlot } from "./grammar-scope.js";
8
+
9
+ //#region ../../internal/section-contracts/dist/fill-verb-contract.js
10
+ const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
11
+ function checkCandidates(of, where) {
12
+ if (Array.isArray(of) && of.length > 0) {
13
+ for (const table of of) {
14
+ if (!isRecord(table) || table["kind"] !== "home") throw new Error(`${where} picks \`of\` ${JSON.stringify(of)} — a list of candidates names tables, one \`home\` ref each.`);
15
+ checkCandidates(table, where);
16
+ }
17
+ return;
18
+ }
19
+ if (!isRecord(of)) throw new Error(`${where} picks \`of\` ${JSON.stringify(of)}, which is no list of candidates.`);
20
+ if (of["type"] === "media") {
21
+ const from = readMediaOf(of)?.from;
22
+ if (from === void 0 || !from.every((list) => isMediaListKey(list))) throw new Error(`${where} picks \`of\` ${JSON.stringify(of)} — a media pick states the media list of the property it picks \`from\` and its \`kinds\`; a media slot with no \`from\` owns its asset, and nothing picks it.`);
23
+ return;
24
+ }
25
+ if (typeof of["type"] === "string") {
26
+ if (!SLOT_TYPES.includes(of["type"])) throw new Error(`${where} picks \`of\` a kind of unknown type "${of["type"]}".`);
27
+ if (of["type"] !== "select") throw new Error(`${where} picks \`of\` a "${of["type"]}" kind — a pick's candidates are a table, a media slot's \`from\` list, a list slot, a compute, or a select's options.`);
28
+ return;
29
+ }
30
+ const { kind, key, section, slot, transform } = of;
31
+ if (kind === "home" && typeof key === "string" && tableKeyOf(key) !== null) return;
32
+ if (kind === "section" && typeof section === "string" && typeof slot === "string") return;
33
+ if (kind === "derived" && typeof transform === "string") return;
34
+ throw new Error(`${where} picks \`of\` ${JSON.stringify(of)}, which is not a list of candidates — a table, a media slot's \`from\` list, a list slot, a compute, or a select's values.`);
35
+ }
36
+ function checkNode(node, where) {
37
+ const verb = readFillVerb(node["verb"]);
38
+ if (verb === void 0) throw new Error(`${where} declares the verb ${JSON.stringify(node["verb"])} — a fill is \`write\`, \`pick\` or \`find\`.`);
39
+ if (node["unique"] !== void 0 && (verb !== "pick" || typeof node["unique"] !== "boolean")) throw new Error(`${where} declares \`unique\` ${verb === "pick" ? "that is not a boolean" : `on a \`${verb}\``} — distinctness is a pick's, \`true\` unless it says \`unique: false\`.`);
40
+ if (typeof node["brief"] !== "string" || node["brief"] === "") throw new Error(`${where} declares no \`brief\` — the brief is the whole instruction.`);
41
+ if (verb === "pick") {
42
+ if (node["of"] === void 0) throw new Error(`${where} picks with no \`of\` — a pick names its candidates on every holder.`);
43
+ checkCandidates(node["of"], where);
44
+ } else if (node["of"] !== void 0) throw new Error(verb === "write" ? `${where} writes \`of\` something — the kind a write produces is its holder's (a text slot's own, a list's \`item\`), so a write takes no \`of\`.` : `${where} finds \`of\` something — the platform's lookup supplies what a find yields, so it takes no \`of\`.`);
45
+ return verb;
46
+ }
47
+ function checkTarget(verb, node, slot, where) {
48
+ if (slot.type === "object") throw new Error(`${where} fills an object, which holds no value of its own — fill its fields.`);
49
+ if (slot.type === "row") {
50
+ if (verb !== "pick") throw new Error(`${where} fills a row with \`fill.${verb}\` — a row holds an element that exists, which only a \`fill.pick\` yields.`);
51
+ return;
52
+ }
53
+ if (slot.type === "list") {
54
+ if (slot.source !== void 0 && slot.source.kind !== "authored") throw new Error(`${where} fills a list that declares its own source (${String(slot.source.kind)}) — a fill IS the list's source; keep one.`);
55
+ if (verb === "find" && !isFindableKind(slot.element?.type)) throw new Error(`${where} finds a list of "${String(slot.element?.type)}" — ${FINDS}.`);
56
+ if (verb !== "find" && isFindableKind(slot.element?.type)) throw new Error(`${where} ${VERBED[verb] ?? verb} a list of "${String(slot.element?.type)}" — ${ONLY_FOUND}.`);
57
+ if (typeof slot.max !== "number") throw new Error(`${where} fills a list that declares no \`max\` — a fill is an open supply, so the list it sources must bound it.`);
58
+ return;
59
+ }
60
+ if (verb === "find" && !isFindableKind(slot.type)) throw new Error(`${where} finds a "${String(slot.type)}" slot — ${FINDS}.`);
61
+ if (verb !== "find" && isFindableKind(slot.type)) throw new Error(`${where} ${VERBED[verb] ?? verb} a "${String(slot.type)}" slot — ${ONLY_FOUND}.`);
62
+ }
63
+ const FINDS = `a find locates what a platform lookup finds — a ${FINDABLE_KINDS.map((k) => `"${k}"`).join(", ")}, or a list of them`;
64
+ const ONLY_FOUND = "its value is located by the platform's lookup, never written or picked — fill it with `fill.find`";
65
+ const VERBED = {
66
+ write: "writes",
67
+ pick: "picks"
68
+ };
69
+ function assertFillVerbContract(ctx, decision) {
70
+ const where = `Section "${ctx.key}": fill "${decision.id}"`;
71
+ const node = decision;
72
+ if (decision.verb === void 0) {
73
+ for (const option of ["of", "unique"]) if (decision[option] !== void 0) throw new Error(`${where} declares \`${option}\` but no verb — \`${option}\` belongs to a \`fill.pick\`; rebuild the section with the current Concrete.`);
74
+ } else {
75
+ const verb = checkNode(node, where);
76
+ for (const id of decision.produces) {
77
+ const slot = producedSlot(ctx.schema, id);
78
+ if (slot !== void 0) checkTarget(verb, node, slot, `${where} (producing "${id}")`);
79
+ }
80
+ }
81
+ const fields = node["fields"];
82
+ if (!isRecord(fields)) return;
83
+ const list = decision.produces.length === 1 ? producedSlot(ctx.schema, decision.produces[0]) : void 0;
84
+ const itemFields = list === void 0 ? void 0 : listItemFieldsOf(list);
85
+ for (const [name, entry] of Object.entries(fields)) {
86
+ if (!isRecord(entry) || entry["verb"] === void 0) continue;
87
+ const at = `${where} field "${name}"`;
88
+ const verb = checkNode(entry, at);
89
+ const field = itemFields?.[name];
90
+ if (field !== void 0) checkTarget(verb, entry, field, at);
91
+ }
92
+ }
93
+
94
+ //#endregion
95
+ export { assertFillVerbContract };