@homepages/concrete 8.0.0 → 9.1.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 (331) hide show
  1. package/CHANGELOG.md +1005 -0
  2. package/README.md +20 -9
  3. package/codemods/list-grammar.mjs +923 -0
  4. package/codemods/manifest.json +64 -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-BOYbgBnP.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/check/stages/workspace.js +2 -0
  57. package/dist/cli/check/template-key.js +16 -0
  58. package/dist/cli/commands.js +1 -1
  59. package/dist/cli/dev/crop.js +1 -1
  60. package/dist/cli/dev/fixture-ladders.js +96 -0
  61. package/dist/cli/dev/islands.js +12 -123
  62. package/dist/cli/dev/listen.js +20 -1
  63. package/dist/cli/dev/load-template.js +1 -1
  64. package/dist/cli/dev/server.js +35 -10
  65. package/dist/cli/dev/vite.js +9 -7
  66. package/dist/cli/dev/workspace-reader.js +16 -16
  67. package/dist/cli/media/derive.js +43 -57
  68. package/dist/cli/media/frame-rung-floor.js +0 -1
  69. package/dist/cli/property/index.js +1 -6
  70. package/dist/css/inline.js +1 -22
  71. package/dist/eslint/rules/no-marker-literal.js +1 -1
  72. package/dist/fixtures/load.js +16 -7
  73. package/dist/fixtures/media-plugin.js +17 -12
  74. package/dist/fixtures/media-store.js +115 -0
  75. package/dist/fixtures/property.js +345 -126
  76. package/dist/fixtures/resolve.js +260 -251
  77. package/dist/fixtures/rows.js +4 -11
  78. package/dist/fixtures.d.ts +234 -109
  79. package/dist/index.d.ts +25 -16
  80. package/dist/index.js +10 -6
  81. package/dist/islands/marker.js +2 -1
  82. package/dist/packages/external/concrete/package.js +1 -1
  83. package/dist/packages/internal/canvas-core/dist/island-host.js +62 -0
  84. package/dist/packages/internal/canvas-core/dist/island-shields.js +30 -0
  85. package/dist/packages/internal/capture-settle/dist/index.js +3 -0
  86. package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +13 -0
  87. package/dist/packages/internal/capture-settle/dist/island-markers.js +6 -0
  88. package/dist/packages/internal/capture-settle/dist/settle.js +150 -0
  89. package/dist/packages/internal/{image-ladder/dist/crop.js → crop-region/dist/index.js} +21 -20
  90. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +250 -46
  91. package/dist/packages/internal/fill-bake/dist/compute-reads.js +361 -4
  92. package/dist/packages/internal/fill-bake/dist/derive-source.js +25 -18
  93. package/dist/packages/internal/fill-bake/dist/index.js +9 -3
  94. package/dist/packages/internal/fill-bake/dist/item-merge.js +113 -0
  95. package/dist/packages/internal/fill-bake/dist/item-overrides.js +1 -0
  96. package/dist/packages/internal/fill-bake/dist/linked-merge.js +38 -0
  97. package/dist/packages/internal/fill-bake/dist/list-grammar.js +174 -0
  98. package/dist/packages/internal/fill-bake/dist/stored-row-reader.js +1 -0
  99. package/dist/packages/internal/fill-vocabulary/dist/holder.js +51 -0
  100. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +363 -0
  101. package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -23
  102. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +60 -0
  103. package/dist/packages/internal/format-geometry/dist/capture.js +11 -147
  104. package/dist/packages/internal/format-geometry/dist/format.d.ts +8 -2
  105. package/dist/packages/internal/format-geometry/dist/geometry.js +13 -2
  106. package/dist/packages/internal/image-ladder/dist/encode.js +27 -14
  107. package/dist/packages/internal/image-ladder/dist/index.js +3 -3
  108. package/dist/packages/internal/image-ladder/dist/policy.js +28 -53
  109. package/dist/packages/internal/island-runtime/dist/capture-holds.js +1 -1
  110. package/dist/packages/internal/island-runtime/dist/contract.d.ts +3 -12
  111. package/dist/packages/internal/island-runtime/dist/contract.js +2 -2
  112. package/dist/packages/internal/island-runtime/dist/index.d.ts +3 -7
  113. package/dist/packages/internal/island-runtime/dist/index.js +2 -1
  114. package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +1 -1
  115. package/dist/packages/internal/media-resolution/dist/crop-key.js +7 -0
  116. package/dist/packages/internal/media-resolution/dist/document.js +63 -0
  117. package/dist/packages/internal/media-resolution/dist/image.js +226 -0
  118. package/dist/packages/internal/media-resolution/dist/index.js +11 -0
  119. package/dist/packages/internal/media-resolution/dist/list.js +112 -0
  120. package/dist/packages/internal/media-resolution/dist/media.js +59 -0
  121. package/dist/packages/internal/media-resolution/dist/records.js +7 -0
  122. package/dist/packages/internal/media-resolution/dist/slot.js +37 -0
  123. package/dist/packages/internal/media-resolution/dist/store.js +19 -0
  124. package/dist/packages/internal/media-resolution/dist/tour.js +59 -0
  125. package/dist/packages/internal/media-resolution/dist/video.js +93 -0
  126. package/dist/packages/internal/property-facts/dist/registry-facts.js +245 -0
  127. package/dist/packages/internal/section-contracts/dist/cap-contract.js +8 -17
  128. package/dist/packages/internal/section-contracts/dist/catalog.js +34 -14
  129. package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +11 -2
  130. package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +21 -0
  131. package/dist/packages/internal/section-contracts/dist/fill-options.js +12 -0
  132. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +1 -5
  133. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +95 -0
  134. package/dist/packages/internal/section-contracts/dist/grammar-scope.js +154 -0
  135. package/dist/packages/internal/section-contracts/dist/index.js +7 -2
  136. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +2 -36
  137. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +12 -21
  138. package/dist/packages/internal/section-contracts/dist/list-source-contract.js +46 -0
  139. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +11 -2
  140. package/dist/packages/internal/section-contracts/dist/object-contract.js +92 -0
  141. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +9 -5
  142. package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +63 -0
  143. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -17
  144. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +80 -0
  145. package/dist/packages/internal/section-contracts/dist/row-source-contract.js +67 -0
  146. package/dist/packages/internal/section-contracts/dist/runners.js +77 -18
  147. package/dist/packages/internal/section-contracts/dist/select-contract.js +0 -8
  148. package/dist/packages/internal/section-contracts/dist/source-contract.js +89 -95
  149. package/dist/packages/internal/section-contracts/dist/sources-contract.js +47 -17
  150. package/dist/packages/internal/section-contracts/dist/table-member.js +16 -0
  151. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +39 -23
  152. package/dist/packages/internal/source-resolution/dist/index.js +113 -73
  153. package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +16 -0
  154. package/dist/packages/internal/street-address/dist/index.js +72 -0
  155. package/dist/packages/internal/template-artifact/dist/asset-mime.js +30 -0
  156. package/dist/packages/internal/template-artifact/dist/layout.js +1 -2
  157. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
  158. package/dist/packages/internal/template-artifact/dist/verify.js +12 -29
  159. package/dist/packages/internal/template-contracts/dist/address-value.d.ts +52 -0
  160. package/dist/packages/internal/template-contracts/dist/address-value.js +90 -0
  161. package/dist/packages/internal/template-contracts/dist/comparable-address.js +19 -0
  162. package/dist/{schema → packages/internal/template-contracts/dist}/compute.d.ts +29 -6
  163. package/dist/{schema → packages/internal/template-contracts/dist}/compute.js +11 -13
  164. package/dist/packages/internal/template-contracts/dist/content-pick.js +51 -0
  165. package/dist/packages/internal/template-contracts/dist/decision-fills.js +81 -0
  166. package/dist/packages/internal/template-contracts/dist/display-overrides.js +7 -0
  167. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +16 -5
  168. package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +24 -0
  169. package/dist/packages/internal/template-contracts/dist/fact-compute.js +30 -0
  170. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +44 -0
  171. package/dist/packages/internal/template-contracts/dist/fact-keys.js +88 -0
  172. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +290 -0
  173. package/dist/packages/internal/template-contracts/dist/fact-registry.js +598 -0
  174. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +10 -24
  175. package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +157 -0
  176. package/dist/packages/internal/template-contracts/dist/fill-builders.js +79 -0
  177. package/dist/packages/internal/template-contracts/dist/fill-declaration.d.ts +14 -0
  178. package/dist/{schema → packages/internal/template-contracts/dist}/fill-declaration.js +6 -5
  179. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +93 -0
  180. package/dist/packages/internal/template-contracts/dist/fill-spec.js +291 -0
  181. package/dist/packages/internal/template-contracts/dist/findable.js +8 -0
  182. package/dist/packages/internal/template-contracts/dist/floor-presets.js +13 -0
  183. package/dist/packages/internal/template-contracts/dist/icon-names.d.ts +5 -0
  184. package/dist/packages/internal/template-contracts/dist/icon-names.js +70 -0
  185. package/dist/packages/internal/template-contracts/dist/legacy-facts.js +167 -0
  186. package/dist/packages/internal/template-contracts/dist/list-editing.js +93 -0
  187. package/dist/packages/internal/template-contracts/dist/list.d.ts +215 -0
  188. package/dist/packages/internal/template-contracts/dist/list.js +258 -0
  189. package/dist/packages/internal/template-contracts/dist/markers.d.ts +2 -2
  190. package/dist/packages/internal/template-contracts/dist/media-candidates.js +38 -0
  191. package/dist/packages/internal/template-contracts/dist/mirror-kind.js +48 -0
  192. package/dist/packages/internal/template-contracts/dist/number-display.js +10 -0
  193. package/dist/packages/internal/template-contracts/dist/object.d.ts +89 -0
  194. package/dist/packages/internal/template-contracts/dist/object.js +131 -0
  195. package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +1 -1
  196. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.d.ts +1 -0
  197. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +162 -0
  198. package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +77 -0
  199. package/dist/packages/internal/template-contracts/dist/process-builders.js +73 -0
  200. package/dist/packages/internal/template-contracts/dist/read-graph.js +240 -0
  201. package/dist/packages/internal/template-contracts/dist/ref-locate.js +176 -0
  202. package/dist/packages/internal/template-contracts/dist/registry-aliases.js +77 -0
  203. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +270 -0
  204. package/dist/packages/internal/template-contracts/dist/registry-facts.js +202 -0
  205. package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +41 -0
  206. package/dist/packages/internal/template-contracts/dist/registry-shape.js +135 -0
  207. package/dist/packages/internal/template-contracts/dist/resolve-scope.js +103 -0
  208. package/dist/packages/internal/{image-descriptor/dist/index.d.ts → template-contracts/dist/responsive-image.d.ts} +1 -1
  209. package/dist/packages/internal/template-contracts/dist/row-planners.js +29 -0
  210. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +127 -0
  211. package/dist/packages/internal/template-contracts/dist/row-ref.js +101 -0
  212. package/dist/packages/internal/template-contracts/dist/row-sources.js +41 -5
  213. package/dist/packages/internal/template-contracts/dist/row.d.ts +155 -0
  214. package/dist/packages/internal/template-contracts/dist/row.js +84 -0
  215. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +97 -0
  216. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +782 -0
  217. package/dist/packages/internal/template-contracts/dist/slot-builders.js +233 -0
  218. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +233 -405
  219. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +331 -227
  220. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +21 -0
  221. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +155 -0
  222. package/dist/packages/internal/template-contracts/dist/slot-ref.js +76 -0
  223. package/dist/packages/internal/template-contracts/dist/slot-types.d.ts +163 -0
  224. package/dist/packages/internal/template-contracts/dist/slot-types.js +139 -0
  225. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +95 -0
  226. package/dist/packages/internal/template-contracts/dist/table-members.d.ts +25 -0
  227. package/dist/packages/internal/template-contracts/dist/table-members.js +90 -0
  228. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +5 -5
  229. package/dist/packages/internal/template-contracts/dist/value-contracts.js +15 -0
  230. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +2 -2
  231. package/dist/platform/fs.js +5 -2
  232. package/dist/playground/canvas-island-host.d.ts +11 -0
  233. package/dist/playground/canvas-island-host.js +29 -0
  234. package/dist/playground/canvas-markers.js +14 -0
  235. package/dist/playground-island-runtime.d.ts +3 -2
  236. package/dist/playground-island-runtime.js +3 -2
  237. package/dist/primitives/FrameShell.js +0 -1
  238. package/dist/primitives/Image.d.ts +5 -4
  239. package/dist/primitives/Tour.d.ts +1 -1
  240. package/dist/primitives/Video.d.ts +2 -2
  241. package/dist/primitives/index.d.ts +2 -3
  242. package/dist/primitives/picture-sources.js +2 -2
  243. package/dist/primitives/probe-context.js +2 -12
  244. package/dist/primitives/slot-address.d.ts +44 -0
  245. package/dist/primitives/slot-address.js +19 -0
  246. package/dist/primitives/slot-bindings.d.ts +65 -26
  247. package/dist/primitives/slot-bindings.js +104 -46
  248. package/dist/primitives/slot-document.d.ts +23 -18
  249. package/dist/primitives/slot-document.js +39 -14
  250. package/dist/primitives/slot-download.d.ts +39 -0
  251. package/dist/primitives/slot-download.js +39 -0
  252. package/dist/primitives/slot-list.d.ts +3 -3
  253. package/dist/primitives/slot-list.js +0 -2
  254. package/dist/primitives/slot-media.d.ts +24 -5
  255. package/dist/primitives/slot-media.js +6 -9
  256. package/dist/primitives/slot-object.d.ts +49 -0
  257. package/dist/primitives/slot-object.js +20 -0
  258. package/dist/primitives/slot-scalar.d.ts +27 -2
  259. package/dist/primitives/slot-scalar.js +50 -7
  260. package/dist/primitives/slot.d.ts +13 -6
  261. package/dist/primitives/slot.js +10 -3
  262. package/dist/rules/registry.js +25 -30
  263. package/dist/schema/define-schema.d.ts +4 -8
  264. package/dist/schema/define-schema.js +178 -79
  265. package/dist/schema/extract-fill-spec.js +2 -153
  266. package/dist/schema/fact.d.ts +57 -15
  267. package/dist/schema/fact.js +42 -7
  268. package/dist/schema/facts-view.d.ts +14 -0
  269. package/dist/schema/format.d.ts +1 -0
  270. package/dist/schema/format.js +2 -1
  271. package/dist/schema/manifest.js +24 -0
  272. package/dist/schema/property-facts.d.ts +8 -12
  273. package/dist/schema/section-props.d.ts +2 -66
  274. package/dist/schema/section-schema.d.ts +8 -11
  275. package/dist/schema/section-schema.js +27 -10
  276. package/dist/section/declare.d.ts +18 -7
  277. package/dist/section/declare.js +18 -5
  278. package/dist/section/materialize.js +3 -8
  279. package/dist/section/section.d.ts +12 -8
  280. package/dist/section/section.js +1 -1
  281. package/dist/template/logic-shim.d.ts +14 -7
  282. package/dist/template/logic-shim.js +14 -7
  283. package/dist/template/materialize.js +17 -18
  284. package/dist/template/mirror-types.js +30 -31
  285. package/dist/template/section-reads.js +85 -9
  286. package/guide/reference/cli/INDEX.md +2 -2
  287. package/guide/reference/cli/build.md +1 -1
  288. package/guide/reference/cli/check.md +1 -1
  289. package/guide/reference/cli/dev.md +1 -1
  290. package/guide/reference/cli/property-add.md +1 -1
  291. package/guide/reference/cli/property-list.md +2 -2
  292. package/guide/reference/cli/publish.md +1 -1
  293. package/guide/reference/cli/upgrade.md +1 -1
  294. package/guide/reference/rules/INDEX.md +29 -25
  295. package/package.json +9 -8
  296. package/dist/artifact/playground/client/assets/index-CckS2ONm.css +0 -1
  297. package/dist/artifact/playground/client/assets/index-Dn_xT16-.js +0 -1101
  298. package/dist/fixtures/canonical.d.ts +0 -166
  299. package/dist/fixtures/media.js +0 -163
  300. package/dist/packages/internal/fill-vocabulary/dist/origination.js +0 -51
  301. package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +0 -15
  302. package/dist/packages/internal/format-geometry/dist/index.js +0 -4
  303. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +0 -10
  304. package/dist/packages/internal/property-facts/dist/index.js +0 -3
  305. package/dist/packages/internal/property-facts/dist/property-facts-Cy7-O4p0.js +0 -189
  306. package/dist/packages/internal/section-contracts/dist/group-contract.js +0 -19
  307. package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +0 -24
  308. package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -22
  309. package/dist/packages/internal/template-contracts/dist/facts-view.js +0 -104
  310. package/dist/packages/internal/template-contracts/dist/select-key.js +0 -7
  311. package/dist/primitives/slot-group.d.ts +0 -40
  312. package/dist/primitives/slot-group.js +0 -36
  313. package/dist/schema/extract-used-facts.js +0 -34
  314. package/dist/schema/fill-builders.d.ts +0 -115
  315. package/dist/schema/fill-builders.js +0 -25
  316. package/dist/schema/fill-declaration.d.ts +0 -14
  317. package/dist/schema/fill-spec.js +0 -98
  318. package/dist/schema/layout.d.ts +0 -30
  319. package/dist/schema/layout.js +0 -14
  320. package/dist/schema/row-fields.js +0 -88
  321. package/dist/schema/row-ref.d.ts +0 -59
  322. package/dist/schema/row-ref.js +0 -28
  323. package/dist/schema/runtime-values.d.ts +0 -71
  324. package/dist/schema/section-nav.js +0 -14
  325. package/dist/schema/slot-builders.d.ts +0 -633
  326. package/dist/schema/slot-builders.js +0 -177
  327. package/dist/schema/slot-ref.d.ts +0 -79
  328. package/dist/schema/slot-ref.js +0 -41
  329. package/dist/schema/slot-types.d.ts +0 -111
  330. package/dist/schema/slot-types.js +0 -214
  331. package/dist/section/groups.js +0 -68
@@ -1,633 +0,0 @@
1
- import { CollectionField, LinkKind, LinkProviderId, SourceFieldName, VideoSource, WritableSourceFieldName } from "../packages/internal/template-contracts/dist/slot-catalog.js";
2
- import { FillBinding, FillFor } from "./fill-builders.js";
3
- import { FillMark } from "./fill-declaration.js";
4
- import { ListFieldSlot, ListItemSlot } from "./slot-types.js";
5
- import { RefValue, RowRef, SiblingSlot, SlotRef } from "./slot-ref.js";
6
- import { ComputeBinding } from "./compute.js";
7
- import { VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
8
- import { TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
9
- import { ImageValue, PlaybackConfig } from "./runtime-values.js";
10
- import { RowOf } from "./row-ref.js";
11
- import { BoundRowValue, RowValue, SlotValue } from "./section-props.js";
12
- //#region src/schema/slot-builders.d.ts
13
- /**
14
- * Where a slot's value comes from: the `direct` literal a `fact.*` entry emits
15
- * into a builder's `source`, or the `derived` literal `defineSchema` rewrites a
16
- * `compute()` binding to — whose `transform` is always the slot's own key.
17
- */
18
- type SlotSource = {
19
- kind: "direct";
20
- field: SourceFieldName;
21
- } | {
22
- kind: "derived";
23
- transform: string;
24
- };
25
- type SourceMark<HasSource extends SourceBinding | undefined> = HasSource extends SlotSource | ComputeBinding<unknown> | RowRef ? {
26
- source: HasSource;
27
- } : HasSource extends MirrorSource ? {
28
- source: ComputeBinding<unknown>;
29
- } : unknown;
30
- /**
31
- * A MIRROR's `source:` — another slot, whose value this slot IS: another section's
32
- * slot ref (`Hero.slots.title`, `Video.display.variant`) or, inside one section, a
33
- * sibling slot's own const. The builder rewrites it to the identity `compute()` over
34
- * that one read, so the slot settles, propagates and takes a user's whole-slot
35
- * override exactly as a computed slot does. Nothing writes through to the upstream.
36
- */
37
- type MirrorSource = SlotRef | SiblingSlot;
38
- /** Everything a builder's `source:` takes: a fact, a row member, a `compute()`, a mirrored slot, or a `fill()`. */
39
- type SourceBinding = SlotSource | RowRef | ComputeBinding<unknown> | MirrorSource | FillBinding;
40
- /** The value a mirror's upstream holds — a ref's phantom, or a sibling slot's own value type. */
41
- type MirroredValue<Upstream> = Upstream extends SlotRef ? RefValue<Upstream> : SlotValue<Upstream>;
42
- /**
43
- * The value-type check a mirror or a row member owes: the upstream's value type must
44
- * be assignable to this slot kind's `CV` — what a `compute()` here must return. A
45
- * projection or a join is a `compute()`, never a mirror. A mismatch demands a key no
46
- * author can supply, so the compile error names both types. Any other `source` owes
47
- * nothing.
48
- */
49
- type MirrorOption<HasSource, CV> = HasSource extends MirrorSource ? [MirroredValue<HasSource>] extends [CV] ? unknown : {
50
- "a mirrored slot's value type must be assignable to this slot's": [upstream: MirroredValue<HasSource>, slot: CV];
51
- } : HasSource extends RowRef<string, infer Member> ? [Member] extends [CV] ? unknown : {
52
- "a row member's value type must be assignable to this slot's": [member: Member, slot: CV];
53
- } : unknown;
54
- /**
55
- * The `writeback` key a builder's options must carry, decided by the slot's
56
- * `source`. A direct fact binding or a row member REQUIRES the boolean —
57
- * `true`/`false` where the catalog entry or the member is writable, the literal
58
- * `false` where it is read-only, so the answer to "do edits propagate?" is visible
59
- * without opening the catalog. A `compute()` binding and an unsourced (AI-filled /
60
- * authored) slot admit no `writeback` key at all: nothing can write back through a
61
- * derivation, and propagation is meaningless for generated content.
62
- */
63
- type WritebackOption<HasSource extends SourceBinding | undefined> = HasSource extends {
64
- kind: "direct";
65
- field: infer F;
66
- } ? [F] extends [WritableSourceFieldName] ? {
67
- writeback: boolean;
68
- } : {
69
- writeback: false;
70
- } : HasSource extends RowRef<string, unknown, infer Writable> ? [Writable] extends [true] ? {
71
- writeback: boolean;
72
- } : {
73
- writeback: false;
74
- } : {
75
- writeback?: never;
76
- };
77
- /**
78
- * An `image` slot's crop — the ASSET's contract: what the cropper cuts, and which cut
79
- * a viewport is served. It paints no box; the rendered box is your own classes.
80
- * `mode` picks the cropper behavior ("locked" keeps `aspect`, w/h; "free" resizes any
81
- * edge), `aspectLabel` is the cropper's pill text. `mobile` declares a distinct second
82
- * cut for narrow viewports: the cropper offers a desktop/mobile toggle at its `aspect`,
83
- * and `<Image>` serves that cut below `breakpoint` — a VIEWPORT width, the only thing a
84
- * `<picture><source media>` can switch on. `Slot.Image` reads it off the slot; a raw
85
- * `<Image>` takes the same number as `mobileBreakpoint`.
86
- */
87
- interface CropConfig {
88
- mode: "locked" | "free";
89
- aspect?: number;
90
- aspectLabel?: string;
91
- mobile?: {
92
- aspect: number;
93
- breakpoint: number;
94
- };
95
- }
96
- interface CommonOptions<CV = never, F = never> {
97
- label: string;
98
- locked?: boolean;
99
- source?: SlotSource | RowRef | ComputeBinding<CV> | MirrorSource | F;
100
- writeback?: boolean;
101
- placeholder?: string;
102
- when?: string | readonly string[];
103
- }
104
- interface Head {
105
- locked?: true;
106
- label: string;
107
- source?: SlotSource | RowRef | ComputeBinding<unknown>;
108
- writeback?: boolean;
109
- placeholder?: string;
110
- when?: string | readonly string[];
111
- }
112
- /** The fill a `text` slot takes: it is written, so a lower `cap` and `none` both bind. */
113
- type TextFill = FillFor<"cap" | "none">;
114
- interface TextOptions extends CommonOptions<string | null, TextFill> {
115
- cap?: number;
116
- }
117
- /** The serialized shape `text.short`/`.medium`/`.long` emit — a `text`-kind `SlotDef`. */
118
- interface TextSlotDef<Size extends "short" | "medium" | "long"> extends Head {
119
- type: "text";
120
- size: Size;
121
- cap?: number;
122
- }
123
- /**
124
- * The text slot, sized by the member you pick: `text.short` / `.medium` / `.long`.
125
- *
126
- * `cap` is the slot's character budget and the ONLY declaration of it: it bounds
127
- * what a user may type in the editor, and a `fill()` producing the slot inherits it
128
- * as the budget the model writes to. A filled slot must declare one; the fill's own
129
- * `cap` only ever asks for something strictly shorter.
130
- * @example
131
- * ```ts
132
- * import { fact, fill, text } from "@homepages/concrete";
133
- *
134
- * text.medium({
135
- * cap: 60,
136
- * label: "Headline",
137
- * source: fill({
138
- * reads: [fact.property.address, fact.description],
139
- * brief: "A marketing headline in one sentence. Confident, no exclamation marks.",
140
- * }),
141
- * });
142
- * ```
143
- */
144
- declare const text: {
145
- short: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
146
- source?: HasSource | undefined;
147
- } & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>) => TextSlotDef<"short"> & SourceMark<HasSource> & FillMark;
148
- medium: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
149
- source?: HasSource | undefined;
150
- } & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>) => TextSlotDef<"medium"> & SourceMark<HasSource> & FillMark;
151
- long: <const HasSource extends SourceBinding | undefined = undefined>(opts: TextOptions & {
152
- source?: HasSource | undefined;
153
- } & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>) => TextSlotDef<"long"> & SourceMark<HasSource> & FillMark;
154
- };
155
- /**
156
- * The fill a `number` slot takes: the model ESTIMATES the figure, so only `none`
157
- * binds — there is no character budget to lower and no count of one value.
158
- */
159
- type NumberFill = FillFor<"none">;
160
- interface NumberOptions extends CommonOptions<number | null, NumberFill> {
161
- prefix?: string;
162
- suffix?: string;
163
- thousandsSep?: boolean;
164
- decimals?: boolean;
165
- maxDigits?: number;
166
- }
167
- /** The serialized shape the `number` builder emits — a `number`-kind `SlotDef`. */
168
- interface NumberSlotDef extends Head {
169
- type: "number";
170
- prefix?: string;
171
- suffix?: string;
172
- thousandsSep?: boolean;
173
- decimals?: boolean;
174
- maxDigits?: number;
175
- }
176
- /**
177
- * A numeric slot. `prefix`/`suffix` are rendered strings (such as `"$"` /
178
- * `" sq ft"`), `thousandsSep` toggles grouping-separator formatting, `decimals`
179
- * toggles decimal display, and `maxDigits` caps the digit count — all read by
180
- * the renderer's number formatting, not enforced as an input range.
181
- *
182
- * A figure the platform holds is a fact: bind it (`source:` a fact, a slot or a
183
- * `compute()`). `source: fill({ brief, reads })` is for a figure that is a
184
- * judgement rather than a fact — an ESTIMATE the model proposes and the user
185
- * confirms, such as a suggested price band. The model returns a number, rounded to
186
- * a whole one unless the slot declares `decimals`; `none: true` lets it leave the
187
- * slot empty. A fill takes no `cap` and no `count`, and a record row's number field
188
- * takes no fill at all.
189
- * @example
190
- * ```ts
191
- * import { fact, fill, number } from "@homepages/concrete";
192
- *
193
- * number({ source: fact.unit.sqft, writeback: true, label: "Square feet", thousandsSep: true, suffix: "sqft", maxDigits: 7 });
194
- *
195
- * number({
196
- * label: "Suggested list price",
197
- * prefix: "$",
198
- * thousandsSep: true,
199
- * source: fill({
200
- * reads: [fact.property.units, fact.property.comparables],
201
- * brief: "The most likely sale price, in whole dollars, rounded to $5,000.",
202
- * }),
203
- * });
204
- * ```
205
- */
206
- declare function number<const HasSource extends SourceBinding | undefined = undefined>(opts: NumberOptions & {
207
- source?: HasSource;
208
- } & WritebackOption<HasSource> & MirrorOption<HasSource, number | null>): NumberSlotDef & SourceMark<HasSource> & FillMark;
209
- /** One authored select choice: a bare string (value === label) or a stored key with display text. */
210
- type SelectOptionInput = string | {
211
- value: string;
212
- label: string;
213
- };
214
- /**
215
- * The serialized shape a select slot emits — a `select`-kind `SlotDef`.
216
- * `values` (the authored `options`, stored under their old name) and
217
- * `options.source` (a fact-derived vocabulary) are mutually exclusive: which one is
218
- * present depends on whether the slot was built with `select({ options })` or
219
- * `select({ source: fact.… })`. `unique` rides only on a record row's field; a
220
- * list's single item hands it to the list (`list({ item })`), which stores it there.
221
- */
222
- interface SelectSlotDef extends Head {
223
- type: "select";
224
- values?: SelectOptionInput[];
225
- options?: {
226
- source: string;
227
- };
228
- creatable?: boolean;
229
- unique?: true;
230
- }
231
- /** The one source that supplies a select's vocabulary: a direct fact binding. */
232
- type FactSource = Extract<SlotSource, {
233
- kind: "direct";
234
- }>;
235
- interface SelectFactOptions extends Omit<CommonOptions<never>, "source"> {
236
- creatable?: boolean;
237
- options?: never;
238
- unique?: never;
239
- }
240
- type SelectFill = FillFor<"none">;
241
- interface SelectChoiceOptions extends Omit<CommonOptions<never>, "source"> {
242
- options: readonly SelectOptionInput[];
243
- creatable?: boolean;
244
- unique?: true;
245
- source?: ComputeBinding<string | null> | MirrorSource | RowRef | SelectFill;
246
- }
247
- /**
248
- * The fill a `meta.display` entry takes: the model picks ONE of the entry's own
249
- * cases. The brief and `reads` alone — an entry always resolves a case, so it
250
- * never abstains, and a pick of one has no count or cap.
251
- */
252
- type DisplayFill = FillFor<never>;
253
- /**
254
- * One `meta.display` entry as authored under `defineSchema`'s `display:` —
255
- * the declared `cases` (the FIRST is the default and the failure posture), an
256
- * optional `locked` opting the entry out of user switching, and its one origin as
257
- * written: `source: compute(fn)` (still a live binding here; `defineSchema` strips
258
- * it into the logic bundle exactly as it does a slot's) or `source: fill({ brief })`.
259
- */
260
- interface DisplayEntryInput<C extends readonly string[] = readonly string[]> {
261
- cases: [...C];
262
- locked?: true;
263
- source?: ComputeBinding<C[number]> | DisplayFill;
264
- }
265
- interface DisplaySelectOptions<C extends readonly [string, ...string[]]> {
266
- options: C;
267
- locked?: boolean;
268
- source?: ComputeBinding<NoInfer<C>[number]> | DisplayFill;
269
- label?: never;
270
- }
271
- /**
272
- * The select builder: a slot, a record row's field, a list's item, or a
273
- * `meta.display` entry, each declared with one options object.
274
- *
275
- * As a slot or field it declares exactly one set of choices:
276
- * `select({ label, options: [...] })` for an authored vocabulary, or
277
- * `select({ label, source: fact.… })` for one the fact supplies. A top-level select
278
- * is bound (or computed) and is never filled. As a record row's field, an authored
279
- * select declares its own origin like every row field: a member of the row, or its
280
- * own `source: fill({ brief })`, which picks this one field's key per row in the
281
- * list's batched call. Inside a list, `unique: true` says a picked value does not
282
- * repeat across the rows.
283
- *
284
- * As a display entry — under `display:`, with no `label` —
285
- * `select({ options: cases, source: compute({ reads }, fn) })` or
286
- * `select({ options: cases, source: fill({ brief }) })` declares a `meta.display`
287
- * `visibility`/`variant`: the first case is the default and the failure posture,
288
- * `locked: true` opts a variant out of user switching, and the entry takes exactly
289
- * one origin.
290
- * @example
291
- * ```ts
292
- * import { compute, fact, fill, select } from "@homepages/concrete";
293
- *
294
- * select({ label: "Status", options: ["for_sale", "sold"] });
295
- * select({ label: "Listing status", source: fact.property.listing_intent, writeback: true });
296
- * select({ label: "Comparable status", options: ["regular", "highlight"], source: fill({ brief: "Highlight the two or three strongest sales." }) });
297
- * select({ options: ["visible", "hidden"], source: compute({ reads: [fact.tours] }, (tours) => (tours.length > 0 ? "visible" : "hidden")) });
298
- * select({ options: ["classic", "editorial"], source: fill({ brief: "Prefer editorial for story-driven narratives." }) });
299
- * ```
300
- */
301
- interface SelectBuilder {
302
- <const C extends readonly [string, ...string[]]>(opts: DisplaySelectOptions<C>): DisplayEntryInput<C>;
303
- <const HasSource extends SourceBinding | undefined = undefined>(opts: SelectChoiceOptions & {
304
- source?: HasSource;
305
- } & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>): SelectSlotDef & SourceMark<HasSource> & FillMark;
306
- <const HasSource extends FactSource>(opts: SelectFactOptions & {
307
- source: HasSource;
308
- } & WritebackOption<HasSource>): SelectSlotDef & SourceMark<HasSource>;
309
- }
310
- /** The select builder — see {@link SelectBuilder}. */
311
- declare const select: SelectBuilder;
312
- interface UrlOptions extends CommonOptions<string | null> {
313
- accepts?: LinkKind | LinkProviderId;
314
- }
315
- /** The serialized shape the `url` builder emits — a `url`-kind `SlotDef`. */
316
- interface UrlSlotDef extends Head {
317
- type: "url";
318
- accepts?: LinkKind | LinkProviderId;
319
- }
320
- /**
321
- * A URL string slot. `accepts` names a single link kind (such as `"tour"`) or
322
- * link-provider id (such as `"matterport"`) the value must match. A link kind
323
- * with no provider behind it admits no url at all, which the type cannot say —
324
- * check time rejects those.
325
- *
326
- * Binding-only: no fill produces a url, so `source` takes a fact, a slot or a
327
- * `compute()`, never a `fill()`.
328
- * @example
329
- * ```ts
330
- * import { url } from "@homepages/concrete";
331
- *
332
- * url({ label: "Tour URL", accepts: "tour" });
333
- * ```
334
- */
335
- declare function url<const HasSource extends SourceBinding | undefined = undefined>(opts: UrlOptions & {
336
- source?: HasSource;
337
- } & WritebackOption<HasSource> & MirrorOption<HasSource, string | null>): UrlSlotDef & SourceMark<HasSource>;
338
- /** The fill a single-asset slot takes: one pick out of that type's pool, which may abstain. */
339
- type AssetFill = FillFor<"none">;
340
- interface AssetRowOptions {
341
- unique?: true;
342
- }
343
- interface ImageOptions extends CommonOptions<ImageValue | null, AssetFill>, AssetRowOptions {
344
- crop?: CropConfig;
345
- }
346
- /** The serialized shape the `image` builder emits — an `image`-kind `SlotDef`. */
347
- interface ImageSlotDef extends Head {
348
- type: "image";
349
- crop?: CropConfig;
350
- unique?: true;
351
- }
352
- /**
353
- * A single image slot — the resolved value is always one `ImageValue`, never a
354
- * list, so it carries no count bounds (a list of them does). `crop` is the asset's
355
- * contract — the editor's cropper and `<Image>`'s mobile-crop switch read it; the box
356
- * the image renders in is the section's own classes.
357
- * `source: fill({ brief })` picks one of the property's photos.
358
- * @example
359
- * ```ts
360
- * import { fill, image } from "@homepages/concrete";
361
- *
362
- * image({ label: "Hero photo", crop: { mode: "locked", aspect: 16 / 9 }, source: fill({ brief: "The strongest exterior." }) });
363
- * ```
364
- */
365
- declare function image<const HasSource extends SourceBinding | undefined = undefined>(opts: ImageOptions & {
366
- source?: HasSource;
367
- } & WritebackOption<HasSource> & MirrorOption<HasSource, ImageValue | null>): ImageSlotDef & SourceMark<HasSource> & FillMark;
368
- type VideoSources = readonly [VideoSource, ...VideoSource[]];
369
- interface VideoOptions extends CommonOptions<VideoValue | null, AssetFill>, AssetRowOptions {
370
- playback?: PlaybackConfig;
371
- sources?: VideoSources;
372
- }
373
- /** The serialized shape the `video` builder emits — a `video`-kind `SlotDef`. */
374
- interface VideoSlotDef extends Head {
375
- type: "video";
376
- playback?: PlaybackConfig;
377
- sources?: VideoSources;
378
- unique?: true;
379
- }
380
- /**
381
- * A single video slot, resolved as a `VideoValue`. Unlike `image`, there is no
382
- * `crop` — a video is selected, never re-edited. `sources` opts into which
383
- * origins the value may come from (`"upload"`, `"link"`); omitted means
384
- * upload-only. `playback` configures the renderer's `<Video>`; the box it plays
385
- * in is your own classes.
386
- * `source: fill({ brief })` picks one of the property's videos.
387
- * @example
388
- * ```ts
389
- * import { video } from "@homepages/concrete";
390
- *
391
- * video({ label: "Property video", playback: { controls: true }, sources: ["upload", "link"] });
392
- * ```
393
- */
394
- declare function video<const HasSource extends SourceBinding | undefined = undefined>(opts: VideoOptions & {
395
- source?: HasSource;
396
- } & WritebackOption<HasSource> & MirrorOption<HasSource, VideoValue | null>): VideoSlotDef & SourceMark<HasSource> & FillMark;
397
- type TourOptions = CommonOptions<TourValue | null, AssetFill> & AssetRowOptions;
398
- /** The serialized shape the `tour` builder emits — a `tour`-kind `SlotDef`. */
399
- interface TourSlotDef extends Head {
400
- type: "tour";
401
- unique?: true;
402
- }
403
- /**
404
- * A single 3D-tour slot, resolved as a `TourValue`. Its own kind rather than a
405
- * third video source: `playback` is meaningless on a walkthrough, and the fill
406
- * pool would otherwise mix videos with tour models. It has no type-specific
407
- * option at all — no `crop` (a tour is selected, never edited), no `playback`,
408
- * no `sources` and no `accepts`; which providers are admitted widens in the
409
- * link-provider catalog, never on a slot, and the box the embed fills is your
410
- * own classes.
411
- *
412
- * Render it with `<Slot.Tour>` for the embed, `<Slot.Image>` for the tour's
413
- * thumbnail, or both — two positions from one selection.
414
- * `source: fill({ brief })` picks one of the property's tours.
415
- * @example
416
- * ```ts
417
- * import { fill, tour } from "@homepages/concrete";
418
- *
419
- * tour({ label: "3D tour", source: fill({ brief: "The whole-home walkthrough, not a single-room scan." }) });
420
- * ```
421
- */
422
- declare function tour<const HasSource extends SourceBinding | undefined = undefined>(opts: TourOptions & {
423
- source?: HasSource;
424
- } & WritebackOption<HasSource> & MirrorOption<HasSource, TourValue | null>): TourSlotDef & SourceMark<HasSource> & FillMark;
425
- type StripHead<E> = Omit<E, "locked" | "unique">;
426
- /**
427
- * The serialized shape a single-item list emits — a `list`-kind `SlotDef` carrying
428
- * `element` (never `fields`). `element` is the bare item shape (its `locked` is
429
- * stripped, since a list holds present items, not an editable slot itself).
430
- * `min`/`max` bound the list's item count; `unique` says no two items hold the same
431
- * value — written on the item (`select({ …, unique: true })`, `image({ …, unique: true })`),
432
- * stored here — and is passed through as-authored: this module does not itself
433
- * deduplicate anything.
434
- */
435
- interface ListSlotDef<E> extends Head {
436
- type: "list";
437
- element: E;
438
- min?: number;
439
- max?: number;
440
- unique?: boolean;
441
- }
442
- type ListFillFor<E> = E extends {
443
- type: "text";
444
- } ? FillFor<"count" | "cap" | "none"> : E extends {
445
- type: "poi";
446
- } ? FillFor<"count"> : FillFor<"count" | "none">;
447
- type ListRecordFill = FillFor<"count" | "none">;
448
- /**
449
- * The serialized shape a record list emits — a `list`-kind `SlotDef` carrying
450
- * `fields` (never `element`), plus the record-item surface: `title` (the field whose
451
- * value titles each row). Its fields' declaration order is the row's order; which of
452
- * them share a row is the editor's rule.
453
- */
454
- interface ListRecordSlotDef<I extends Record<string, ListFieldSlot>> extends Head {
455
- type: "list";
456
- fields: I;
457
- title?: string;
458
- min?: number;
459
- max?: number;
460
- }
461
- interface ListHeadOptions {
462
- label: string;
463
- locked?: boolean;
464
- placeholder?: string;
465
- when?: string | readonly string[];
466
- min?: number;
467
- max?: number;
468
- }
469
- /** `list({ item })`: one slot per entry. Its distinctness is the item's `unique`. */
470
- interface ListItemOptions<E> extends ListHeadOptions {
471
- item: E;
472
- fields?: never;
473
- title?: never;
474
- source?: SlotSource | RowRef | ComputeBinding<NonNullable<SlotValue<E>>[]> | MirrorSource | ListFillFor<E>;
475
- writeback?: boolean;
476
- }
477
- /** A collection a record list's rows are baked from: `fact.property.units`, `.contacts` or `.comparables`. */
478
- type CollectionSource = {
479
- readonly kind: "direct";
480
- readonly field: CollectionField;
481
- };
482
- /** Where a record list's rows come from: a collection, a `compute()` or a slot holding rows, or the model. */
483
- type ListRowsSource = CollectionSource | ComputeBinding<readonly object[]> | MirrorSource | ListRecordFill;
484
- /**
485
- * `list({ fields })`: a record per entry. `fields` receives the row reference, whose
486
- * members the `source` decides (`RowOf`); `title` names the field that titles a row.
487
- */
488
- interface ListFieldsOptions<HasSource, I> extends ListHeadOptions {
489
- source?: HasSource;
490
- fields: (row: RowOf<HasSource>) => I;
491
- item?: never;
492
- title?: NoInfer<keyof I & string>;
493
- writeback?: boolean;
494
- }
495
- /**
496
- * One baked row of a record list: the collection's identity key beside each declared
497
- * field — nothing of the collection reaches a row a field does not name. A row the
498
- * model or a `compute()` supplies carries the stamped `id` instead.
499
- */
500
- type DeclaredRow<HasSource, I> = HasSource extends {
501
- kind: "direct";
502
- field: infer C extends CollectionField;
503
- } ? BoundRowValue<C, I> : RowValue<I>;
504
- /** What a `fields` list's rows are typed as, carried as a phantom `SlotValue` reads. */
505
- type DeclaredRowsMark<HasSource, I> = {
506
- readonly __row?: DeclaredRow<HasSource, I>;
507
- };
508
- /**
509
- * The list slot — one primitive for everything multi-item, declared with one options
510
- * object and exactly one of `item` or `fields`.
511
- *
512
- * `item` is one slot per entry: `list({ label: "Features", item: text.short({ label: "Feature", cap: 80 }) })`.
513
- * A select or media item may say `unique: true`: no two entries hold the same value.
514
- *
515
- * `fields` is a record per entry, written as a function of the row reference, whose
516
- * members follow the list's `source`:
517
- *
518
- * - bound to a collection (`fact.property.units`, `.contacts`, `.comparables`), `row`
519
- * offers that collection's members — `unit.beds`, `contact.headshot`, `comp.photo` —
520
- * each a legal row field `source:` (with `writeback`, `true` only on a writable
521
- * member) and a legal `reads` entry of a row field's `fill()` or `compute()`;
522
- * - sourced by a `compute()` or another slot, `row` offers the members of that value's
523
- * rows;
524
- * - sourced by a `fill()`, the model writes each row, and every field declares its own
525
- * `fill()`: a field reads an EARLIER field of its row by that field's const.
526
- *
527
- * Every row field declares its origin — a row member, a `fill()` or a `compute()`. A
528
- * property fact is the same value in every row, so it is read inside a field's
529
- * `reads`, never bound; `fact.unit.*` and `fact.contact.*` name the primary row.
530
- * Inside a list, `unique: true` on a select or media field says its value does not
531
- * repeat across the rows.
532
- *
533
- * Depth is fixed: an item is never a list, a record field is never a record, and a
534
- * field-level list holds a single non-record item.
535
- * @example
536
- * ```ts
537
- * import { fact, fill, image, list, number, text } from "@homepages/concrete";
538
- *
539
- * list({
540
- * label: "Units",
541
- * source: fact.property.units,
542
- * writeback: false,
543
- * title: "unit_label",
544
- * fields: (unit) => ({
545
- * unit_label: text.medium({ label: "Unit name", cap: 40, source: unit.unit_label, writeback: true }),
546
- * beds: number({ label: "Beds", source: unit.beds, writeback: true }),
547
- * floor_plans: list({ label: "Floor plans", source: unit.floor_plans, writeback: false, item: image({ label: "Floor plan" }) }),
548
- * }),
549
- * });
550
- *
551
- * list({
552
- * label: "FAQ",
553
- * source: fill({ count: 6, brief: "Questions a buyer would ask, each on a different topic." }),
554
- * fields: () => {
555
- * const question = text.medium({ label: "Question", cap: 72, source: fill({ brief: "One question." }) });
556
- * return {
557
- * question,
558
- * answer: text.long({ label: "Answer", cap: 300, source: fill({ reads: [fact.description, question], brief: "Answer it." }) }),
559
- * };
560
- * },
561
- * });
562
- * ```
563
- */
564
- interface ListBuilder {
565
- <const E extends ListItemSlot, const HasSource extends SourceBinding | undefined = undefined>(opts: ListItemOptions<E> & {
566
- source?: HasSource;
567
- } & WritebackOption<HasSource> & MirrorOption<HasSource, NonNullable<SlotValue<E>>[]>): ListSlotDef<StripHead<E>> & SourceMark<HasSource> & FillMark;
568
- <const I extends Record<string, ListFieldSlot>, const HasSource extends ListRowsSource | undefined = undefined>(opts: ListFieldsOptions<HasSource, I> & WritebackOption<HasSource>): ListRecordSlotDef<I> & SourceMark<HasSource> & FillMark & DeclaredRowsMark<HasSource, I>;
569
- }
570
- /** The list builder — see {@link ListBuilder}. */
571
- declare const list: ListBuilder;
572
- interface PoiOptions {
573
- label: string;
574
- locked?: boolean;
575
- placeholder?: string;
576
- when?: string | readonly string[];
577
- }
578
- /** The serialized shape the `poi` builder emits — a `poi`-kind `SlotDef`. */
579
- interface PoiSlotDef extends Head {
580
- type: "poi";
581
- }
582
- /**
583
- * A single point of interest — one platform-built place (a `PoiRow`), picked
584
- * in the editor's place search. The platform owns the row's content; there is
585
- * nothing to configure beyond the head. Usable standalone or as a list item
586
- * (`list({ label: "Restaurants", item: poi({ label: "Restaurant" }) })`).
587
- * @example
588
- * ```ts
589
- * import { poi } from "@homepages/concrete";
590
- *
591
- * poi({ label: "Nearest station", placeholder: "Search places…" });
592
- * ```
593
- */
594
- declare function poi(opts: PoiOptions): PoiSlotDef;
595
- interface DocumentOptions extends AssetRowOptions {
596
- label: string;
597
- locked?: boolean;
598
- placeholder?: string;
599
- when?: string | readonly string[];
600
- source?: AssetFill;
601
- }
602
- /** The serialized shape the `document` builder emits — a `document`-kind `SlotDef`. */
603
- interface DocumentSlotDef extends Head {
604
- type: "document";
605
- unique?: true;
606
- }
607
- /**
608
- * A single platform-hosted document — a pdf, spreadsheet, or office file the
609
- * visitor opens in the browser or downloads. The value resolves to one
610
- * `DocumentValue` (served url plus filename, type and size); render it with
611
- * `Slot.Document`, which is one anchor.
612
- *
613
- * Reach for `url({ accepts: "file" })` instead when the file lives somewhere
614
- * else — a Drive or Dropbox link the platform neither stores nor serves.
615
- *
616
- * `source: fill({ brief })` picks one file out of the documents stored on the
617
- * property. The model sees each candidate's filename, file type, and whatever text
618
- * was distilled out of it (a spreadsheet or slide deck carries none, so name the
619
- * file type when it matters). Usable standalone or as a list item — a
620
- * `list({ item: document(…) })` carries its own fill and picks a SET from the same pool.
621
- * @example
622
- * ```ts
623
- * import { document, fill } from "@homepages/concrete";
624
- *
625
- * document({
626
- * label: "Offering brochure",
627
- * source: fill({ brief: "The offering brochure: a multi-page PDF about the whole property, not a single-unit floor plan." }),
628
- * });
629
- * ```
630
- */
631
- declare function document(opts: DocumentOptions): DocumentSlotDef & FillMark;
632
- //#endregion
633
- export { CropConfig, DeclaredRow, DeclaredRowsMark, DisplayEntryInput, DisplayFill, DocumentSlotDef, ImageSlotDef, ListBuilder, ListRecordSlotDef, ListSlotDef, MirrorOption, MirrorSource, NumberSlotDef, PoiSlotDef, SelectBuilder, SelectOptionInput, SelectSlotDef, SlotSource, SourceBinding, SourceMark, TextSlotDef, TourSlotDef, UrlSlotDef, VideoSlotDef, WritebackOption, document, image, list, number, poi, select, text, tour, url, video };