@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,21 @@
1
+ //#region ../../internal/template-contracts/dist/slot-overrides.js
2
+ function isSlotOverridden(overrides, slotId) {
3
+ return overrides?.scalar?.[slotId] === true;
4
+ }
5
+ function objectFieldSlotId(objectId, field) {
6
+ return `${objectId}.${field}`;
7
+ }
8
+ function objectFieldOf(slotId) {
9
+ const dot = slotId.indexOf(".");
10
+ if (dot <= 0 || dot === slotId.length - 1 || slotId.includes(".", dot + 1)) return null;
11
+ return {
12
+ object: slotId.slice(0, dot),
13
+ field: slotId.slice(dot + 1)
14
+ };
15
+ }
16
+ function itemOverridesForSlot(overrides, slotId) {
17
+ return { ...overrides?.items?.[slotId] ?? {} };
18
+ }
19
+
20
+ //#endregion
21
+ export { isSlotOverridden, itemOverridesForSlot, objectFieldOf, objectFieldSlotId };
@@ -0,0 +1,155 @@
1
+ import { DocumentValue } from "./document-value.js";
2
+ import { TourValue } from "./tour-value.js";
3
+ import { VideoValue } from "./video-value.js";
4
+ import { ImageValue } from "./runtime-values.js";
5
+ import { SlotValue } from "./slot-value.js";
6
+ import { Slot } from "./slot-types.js";
7
+ import { DocumentMedia, DocumentMediaValue, ImageMedia, Media, TourMedia, VideoMedia } from "./registry-facts.js";
8
+ //#region ../../internal/template-contracts/dist/slot-ref.d.ts
9
+ /** The reserved `slot` prefix a display entry's ref is addressed by. */
10
+ declare const DISPLAY_REF_PREFIX = "display.";
11
+ /** The two `meta.display` entries a section may declare, and so may be read. */
12
+ type DisplayEntryName = "visibility" | "variant";
13
+ /**
14
+ * A slot of a section, or one of its two display entries, by name — what a
15
+ * declaration `reads`. Both string halves are literal on a section value
16
+ * (`Hero.slots.hero_image` is `SlotRef<"hero", "hero_image", ImageValue | null>`),
17
+ * which is what types the positional value a compute callback receives.
18
+ */
19
+ interface SlotRef<Section extends string = string, SlotId extends string = string, Value = unknown> {
20
+ readonly section: Section;
21
+ readonly slot: SlotId;
22
+ /**
23
+ * Phantom: the referent's own value type. Never present at runtime —
24
+ * `declareSection` builds `{ section, slot }` — and never serialized.
25
+ */
26
+ readonly __value?: Value;
27
+ }
28
+ /**
29
+ * One fact of a home, by its registry key — what every `fact.*` entry IS, and its wire
30
+ * form byte for byte (see the module header). `Key` is the registry key and `Value` the
31
+ * phantom type the entry reads at.
32
+ */
33
+ interface FactRef<Key extends string = string, Value = unknown> {
34
+ readonly kind: "home";
35
+ readonly key: Key;
36
+ /** Phantom: the value a `compute()` callback receives for this ref. Never present at runtime. */
37
+ readonly __value?: Value;
38
+ }
39
+ /**
40
+ * One member of the row a row slot holds — what `agent.phone` IS, read off the value
41
+ * `row()` returned. Inside a section it carries the row slot itself, invisibly;
42
+ * `defineSchema` resolves that to the row's key, and the wire form is
43
+ * `{kind:"row", slot, field}` — a slot's `source:` and a declaration's `reads` alike.
44
+ */
45
+ interface RowRef<Field extends string = string, Value = unknown, Read = Value> {
46
+ readonly kind: "row";
47
+ readonly field: Field;
48
+ /** The row slot's key, once `defineSchema` resolved it. Absent on a ref as authored. */
49
+ readonly slot?: string;
50
+ /** Phantom: the member's value type, as a slot sourced by it holds it. Never present at runtime. */
51
+ readonly __value?: Value;
52
+ /**
53
+ * Phantom: what the member holds as a `compute()` reads it — its value, but on a table's
54
+ * row what the facts document holds (an image's `{ asset_id }`, which `ReadValue` hands
55
+ * as its asset's record). Never present at runtime.
56
+ */
57
+ readonly __read?: Read;
58
+ }
59
+ /**
60
+ * The element an item function receives — `(el) => …` in `list({ source, item })`.
61
+ * Read whole (`image({ source: photo })`, `reads: [question]`) it is `{kind:"element"}`
62
+ * on the wire; its members are read only through a row declared from it
63
+ * (`row({ source: el })`). `Value` is the element's own value type, and `Table` the fact
64
+ * table whose row the element is, or `null` for any other element.
65
+ */
66
+ interface ElementRef<Value = unknown, Table extends string | null = string | null> {
67
+ readonly kind: "element";
68
+ /** Phantom: the element's value type. Never present at runtime. */
69
+ readonly __value?: Value;
70
+ /** Phantom: the table whose row the element is. Never present at runtime. */
71
+ readonly __table?: Table;
72
+ }
73
+ /**
74
+ * A typed handle on one value the platform can resolve — what `source:`, a
75
+ * `compute`'s `reads` and a fill decision's `reads` all take. A new kind is
76
+ * additive: it answers where its value comes from and when it settles, and
77
+ * changes no consumer.
78
+ */
79
+ type Ref = FactRef | SlotRef | RowRef | ElementRef;
80
+ /** A slot of the declaring section, named by its own const — see the module header. */
81
+ type SiblingSlot = Slot;
82
+ /**
83
+ * A list's or a row's `source:` naming a sibling list or row by its const, until
84
+ * `defineSchema` — which alone knows the section's keys — writes it as a slot ref to
85
+ * the declaring section.
86
+ */
87
+ interface SiblingSource {
88
+ readonly kind: "sibling";
89
+ readonly of: SiblingSlot;
90
+ }
91
+ /**
92
+ * A top-level fact of the declaring registry, named by the const its page was declared
93
+ * with — the registry's sibling read, as a sibling slot is a section's. `defineFacts`
94
+ * resolves it by identity to its key and serializes it as a fact read; a section
95
+ * refuses one, since a section reads the registry through `fact.*`.
96
+ */
97
+ interface SiblingPage<Declaration = unknown> {
98
+ readonly head: object;
99
+ readonly declaration: Declaration;
100
+ }
101
+ /** What a `compute`'s or a fill's `reads` (and a mirror's `source:`) may name: any ref, a sibling slot, or a sibling page. */
102
+ type ComputeRead = Ref | SiblingSlot | SiblingPage;
103
+ /**
104
+ * The entries of `Requires` not already among `Reads` — what a function's `requires`
105
+ * appends to its `reads`, so a callback is handed the read once wherever it was named.
106
+ * Matched by type: two `fact.*` refs are one entry iff they carry the same key.
107
+ */
108
+ type RequiresBeyond<Requires extends readonly unknown[], Reads extends readonly unknown[]> = Requires extends readonly [infer Head, ...infer Rest] ? [Head] extends [Reads[number]] ? RequiresBeyond<Rest, Reads> : [Head, ...RequiresBeyond<Rest, [...Reads, Head]>] : [];
109
+ /** The value a ref refers to, read off the phantom member. */
110
+ type RefValue<R> = R extends {
111
+ readonly __value?: infer V;
112
+ } ? V : unknown;
113
+ /**
114
+ * `V` as a read hands it: each media value in it — a reference, or a slot's media value —
115
+ * its asset's record, narrowed by kind where the value says it, at any depth. The type
116
+ * half of the read step (./registry-facts `readAsRecords`).
117
+ */
118
+ type AsRead<V> = V extends ImageValue ? ImageMedia : V extends VideoValue ? VideoMedia : V extends TourValue ? TourMedia : V extends DocumentValue ? DocumentMedia : V extends DocumentMediaValue ? Media : V extends readonly unknown[] ? { [I in keyof V]: AsRead<V[I]>; } : V extends object ? { [K in keyof V]: AsRead<V[K]>; } : V;
119
+ /**
120
+ * The value ONE ref hands a declaration that reads it, each media value in it its asset's
121
+ * record (`AsRead`). A slot read is always `| undefined` — the upstream section's page may
122
+ * be disabled, the section unplaced on a given composition, the slot empty — so a body
123
+ * must say what it does with nothing. A fact settles at intake and carries its own null.
124
+ */
125
+ type ReadValue<R> = AsRead<R extends SlotRef ? RefValue<R> | undefined : R extends SiblingSlot ? SlotValue<R> | undefined : R extends SiblingPage<infer D> ? SlotValue<D> | null : R extends RowRef<string, unknown, infer Read> ? Read : RefValue<R>>;
126
+ /**
127
+ * The positional arguments a reads-declaring callback receives: one value per ref,
128
+ * in `reads` order, each at that ref's own value type. Mutable so the tuple is
129
+ * legal in a rest parameter; the list it maps is the author's `const` one.
130
+ */
131
+ type RefValues<Reads extends readonly ComputeRead[]> = { -readonly [I in keyof Reads]: ReadValue<Reads[I]>; };
132
+ /** A home ref on the wire: a fact by its registry key. */
133
+ interface SerializedHomeRef {
134
+ readonly kind: "home";
135
+ readonly key: string;
136
+ }
137
+ /** A section ref on the wire: a section's LOCAL key, and a slot id, a dotted `<object>.<field>` or `display.<entry>`. */
138
+ interface SerializedSectionRef {
139
+ readonly kind: "section";
140
+ readonly section: string;
141
+ readonly slot: string;
142
+ }
143
+ /** A member ref on the wire: member `field` of the row (or address) the slot `slot` holds. */
144
+ interface SerializedRowRef {
145
+ readonly kind: "row";
146
+ readonly slot: string;
147
+ readonly field: string;
148
+ }
149
+ /** A member of the item the reader sits in — the fact registry's own-item sibling read; legal only inside an item. */
150
+ interface SerializedItemRef {
151
+ readonly kind: "item";
152
+ readonly field: string;
153
+ }
154
+ //#endregion
155
+ export { AsRead, ComputeRead, DISPLAY_REF_PREFIX, DisplayEntryName, ElementRef, FactRef, ReadValue, Ref, RefValue, RefValues, RequiresBeyond, RowRef, SerializedHomeRef, SerializedItemRef, SerializedRowRef, SerializedSectionRef, SiblingPage, SiblingSlot, SiblingSource, SlotRef };
@@ -0,0 +1,76 @@
1
+ //#region ../../internal/template-contracts/dist/slot-ref.js
2
+ const DISPLAY_REF_PREFIX = "display.";
3
+ const ROW_OF = Symbol.for("@homepages/concrete:row:of");
4
+ const ELEMENT_OF = Symbol.for("@homepages/concrete:element:of");
5
+ function isSiblingSource(x) {
6
+ return typeof x === "object" && x !== null && x.kind === "sibling" && isSiblingSlot(x.of);
7
+ }
8
+ function sameRead(a, b) {
9
+ return a === b || isFactRef(a) && isFactRef(b) && a.key === b.key;
10
+ }
11
+ function readsWithRequires(reads, requires) {
12
+ const out = [...reads];
13
+ for (const required of requires ?? []) if (!out.some((read) => sameRead(read, required))) out.push(required);
14
+ return out;
15
+ }
16
+ function isSlotRef(x) {
17
+ return typeof x === "object" && x !== null && "section" in x && typeof x.section === "string" && "slot" in x && typeof x.slot === "string";
18
+ }
19
+ function isRowRef(x) {
20
+ return typeof x === "object" && x !== null && "kind" in x && x.kind === "row" && "field" in x && typeof x.field === "string";
21
+ }
22
+ function rowOfMember(x) {
23
+ if (!isRowRef(x)) return void 0;
24
+ const row = x[ROW_OF];
25
+ return typeof row === "object" && row !== null ? row : void 0;
26
+ }
27
+ function isElementRef(x) {
28
+ return typeof x === "object" && x !== null && "kind" in x && x.kind === "element";
29
+ }
30
+ function elementOwner(x) {
31
+ if (!isElementRef(x)) return void 0;
32
+ const owner = x[ELEMENT_OF];
33
+ return typeof owner === "object" && owner !== null ? owner : void 0;
34
+ }
35
+ function isFactRef(x) {
36
+ return typeof x === "object" && x !== null && "kind" in x && x.kind === "home" && "key" in x && typeof x.key === "string";
37
+ }
38
+ function isSiblingPage(x) {
39
+ return typeof x === "object" && x !== null && "head" in x && typeof x.head === "object" && "declaration" in x && isSiblingSlot(x.declaration);
40
+ }
41
+ function isSiblingSlot(x) {
42
+ return typeof x === "object" && x !== null && "type" in x && typeof x.type === "string";
43
+ }
44
+ function serializeRowRef(ref) {
45
+ if (typeof ref.slot !== "string") throw new Error(`the row member "${ref.field}" is read through a row that is not in scope — declare the row beside its reader (a field of the same object or item) or at the top level, and read its member there.`);
46
+ return {
47
+ kind: "row",
48
+ slot: ref.slot,
49
+ field: ref.field
50
+ };
51
+ }
52
+ function serializeSectionRef(ref) {
53
+ return {
54
+ kind: "section",
55
+ section: ref.section,
56
+ slot: ref.slot
57
+ };
58
+ }
59
+ function serializeRef(ref) {
60
+ if (isSlotRef(ref)) return serializeSectionRef(ref);
61
+ if (isRowRef(ref)) return serializeRowRef(ref);
62
+ if (isElementRef(ref)) return { kind: "element" };
63
+ return {
64
+ kind: "home",
65
+ key: ref.key
66
+ };
67
+ }
68
+ function isSerializedSectionRef(ref) {
69
+ return ref.kind === "section";
70
+ }
71
+ function serializedSectionRefs(reads) {
72
+ return reads.filter(isSerializedSectionRef);
73
+ }
74
+
75
+ //#endregion
76
+ export { DISPLAY_REF_PREFIX, ELEMENT_OF, ROW_OF, elementOwner, isElementRef, isFactRef, isRowRef, isSerializedSectionRef, isSiblingPage, isSiblingSlot, isSiblingSource, isSlotRef, readsWithRequires, rowOfMember, serializeRef, serializeRowRef, serializeSectionRef, serializedSectionRefs };
@@ -0,0 +1,163 @@
1
+ import "./primitive-descriptors.js";
2
+ import { FillBinding } from "./fill-builders.js";
3
+ import { FILL } from "./fill-declaration.js";
4
+ import { z } from "zod";
5
+ //#region ../../internal/template-contracts/dist/slot-types.d.ts
6
+ type SlotBase = {
7
+ [FILL]?: readonly FillBinding[];
8
+ locked?: boolean;
9
+ required?: boolean;
10
+ source?: {
11
+ kind: string;
12
+ key?: string;
13
+ field?: string;
14
+ transform?: string;
15
+ slot?: string;
16
+ section?: string;
17
+ };
18
+ label?: string;
19
+ placeholder?: string;
20
+ variant?: {
21
+ cases: readonly string[];
22
+ };
23
+ };
24
+ /** Kind-level def type for a `text` slot — `SlotBinding<TextSlot>` accepts any text slot. */
25
+ type TextSlot = SlotBase & {
26
+ type: "text";
27
+ size?: string;
28
+ cap?: number;
29
+ };
30
+ /** Kind-level def type for a `number` slot — `SlotBinding<NumberSlot>` accepts any number slot. */
31
+ type NumberSlot = SlotBase & {
32
+ type: "number";
33
+ thousandsSep?: boolean;
34
+ decimals?: boolean;
35
+ maxDigits?: number;
36
+ };
37
+ /** Kind-level def type for a `select` slot — `SlotBinding<SelectSlot>` accepts any select slot. */
38
+ type SelectSlot = SlotBase & {
39
+ type: "select";
40
+ values?: (string | {
41
+ value: string;
42
+ label: string;
43
+ icon?: string;
44
+ description?: string;
45
+ })[];
46
+ options?: {
47
+ source: string;
48
+ };
49
+ creatable?: boolean;
50
+ };
51
+ /** Kind-level def type for an `image` slot — `SlotBinding<ImageSlot>` accepts any image slot. */
52
+ type ImageSlot = SlotBase & {
53
+ type: "image";
54
+ crop?: unknown;
55
+ };
56
+ /** Kind-level def type for a `video` slot — `SlotBinding<VideoSlot>` accepts any video slot. */
57
+ type VideoSlot = SlotBase & {
58
+ type: "video";
59
+ playback?: unknown;
60
+ };
61
+ /** Kind-level def type for a `tour` slot — `SlotBinding<TourSlot>` accepts any tour slot. */
62
+ type TourSlot = SlotBase & {
63
+ type: "tour";
64
+ };
65
+ /** Kind-level def type for a `poi` slot — one platform-built place; `SlotBinding<PoiSlot>` accepts any poi slot. */
66
+ type PoiSlot = SlotBase & {
67
+ type: "poi";
68
+ };
69
+ /** Kind-level def type for a `url` slot — `SlotBinding<UrlSlot>` accepts any url slot. */
70
+ type UrlSlot = SlotBase & {
71
+ type: "url";
72
+ accepts?: string;
73
+ };
74
+ /** Kind-level def type for an `address` slot — one place; `SlotBinding<AddressSlot>` accepts any address slot. */
75
+ type AddressSlot = SlotBase & {
76
+ type: "address";
77
+ };
78
+ /** Kind-level def type for a `date` slot — `SlotBinding<DateSlot>` accepts any date slot. */
79
+ type DateSlot = SlotBase & {
80
+ type: "date";
81
+ };
82
+ /** Kind-level def type for an `email` slot — `SlotBinding<EmailSlot>` accepts any email slot. */
83
+ type EmailSlot = SlotBase & {
84
+ type: "email";
85
+ };
86
+ /** Kind-level def type for a `phone` slot — `SlotBinding<PhoneSlot>` accepts any phone slot. */
87
+ type PhoneSlot = SlotBase & {
88
+ type: "phone";
89
+ };
90
+ /** Kind-level def type for a `document` slot — `SlotBinding<DocumentSlot>` accepts any document slot. */
91
+ type DocumentSlot = SlotBase & {
92
+ type: "document";
93
+ };
94
+ /** Kind-level def type for an open-kind `media` slot — `SlotBinding<MediaSlot>` accepts any media slot. */
95
+ type MediaSlot = SlotBase & {
96
+ type: "media";
97
+ kinds?: readonly string[];
98
+ };
99
+ /** Every kind that holds one value. */
100
+ type ValueSlot = TextSlot | NumberSlot | SelectSlot | ImageSlot | VideoSlot | TourSlot | PoiSlot | UrlSlot | AddressSlot | DateSlot | EmailSlot | PhoneSlot | DocumentSlot | MediaSlot;
101
+ /**
102
+ * Kind-level def type for a `list` slot. Its `element` is the item function's
103
+ * returned slot: a value slot, a row (a selection), or an object.
104
+ */
105
+ type ListSlot = SlotBase & {
106
+ type: "list";
107
+ min?: number;
108
+ max?: number;
109
+ element?: ListItemSlot;
110
+ };
111
+ /** Kind-level def type for a `row` slot — one row of its `from` table, read through its members. */
112
+ type RowSlot = SlotBase & {
113
+ type: "row";
114
+ from: string | readonly string[];
115
+ };
116
+ /**
117
+ * Kind-level def type for an `object` slot — a pure container: no source and no value
118
+ * of its own, its value its fields'. The same at the top level and as a list's item.
119
+ */
120
+ type ObjectSlot = {
121
+ type: "object";
122
+ /** The field whose value titles the card, when the label names one; any other label is the field keyed `label`. */
123
+ label?: {
124
+ field: string;
125
+ };
126
+ fields: Record<string, ObjectFieldSlot>;
127
+ /** Build-stamped field order — the declaration order, which JSONB would drop. */
128
+ item_order?: string[];
129
+ locked?: boolean;
130
+ variant?: {
131
+ cases: readonly string[];
132
+ };
133
+ source?: undefined;
134
+ placeholder?: undefined;
135
+ [FILL]?: undefined;
136
+ };
137
+ /** Every slot kind an author may declare at a section's top level. */
138
+ type Slot = ValueSlot | ListSlot | ObjectSlot | RowSlot;
139
+ /** The slot kinds legal as a list's item — a value slot, a row, or an object. */
140
+ type ListItemSlot = ValueSlot | RowSlot | ObjectSlot;
141
+ /**
142
+ * The slot kinds legal as a nested object's field — the item of an object's list of
143
+ * objects: a value slot, a row, or a list whose item is a value slot. A list of objects
144
+ * never nests a second level.
145
+ */
146
+ type NestedObjectFieldSlot = ValueSlot | RowSlot | (ListSlot & {
147
+ element?: ValueSlot;
148
+ });
149
+ /** The item of an object's list of objects: an object whose fields hold no list of objects. */
150
+ type NestedObjectSlot = Omit<ObjectSlot, "fields"> & {
151
+ fields: Record<string, NestedObjectFieldSlot>;
152
+ };
153
+ /**
154
+ * The slot kinds legal as an object's field — a value slot, a row, or a list whose item
155
+ * is a value slot or a nested object. An object is never a field, nor a list of rows. A
156
+ * list of objects is ONE field, its items part of that field's value, so identity stays
157
+ * a flat 4-tuple and there is no fifth element to address through.
158
+ */
159
+ type ObjectFieldSlot = NestedObjectFieldSlot | (ListSlot & {
160
+ element?: ValueSlot | NestedObjectSlot;
161
+ });
162
+ //#endregion
163
+ export { AddressSlot, DateSlot, DocumentSlot, EmailSlot, ImageSlot, ListItemSlot, ListSlot, MediaSlot, NestedObjectFieldSlot, NestedObjectSlot, NumberSlot, ObjectFieldSlot, ObjectSlot, PhoneSlot, PoiSlot, RowSlot, SelectSlot, Slot, TextSlot, TourSlot, UrlSlot, ValueSlot, VideoSlot };
@@ -0,0 +1,140 @@
1
+ import { PRIMITIVE_DESCRIPTORS } from "./primitive-descriptors.js";
2
+ import { z } from "zod";
3
+
4
+ //#region ../../internal/template-contracts/dist/slot-types.js
5
+ const slotHeadShape = {
6
+ locked: z.boolean().optional(),
7
+ required: z.literal(true).optional()
8
+ };
9
+ const HomeRefDef = z.object({
10
+ kind: z.literal("home"),
11
+ key: z.string().min(1)
12
+ }).strict();
13
+ const SectionRefDef = z.object({
14
+ kind: z.literal("section"),
15
+ section: z.string().min(1),
16
+ slot: z.string().min(1)
17
+ }).strict();
18
+ const RowRefDef = z.object({
19
+ kind: z.literal("row"),
20
+ slot: z.string().min(1),
21
+ field: z.string().min(1)
22
+ }).strict();
23
+ const ItemRefDef = z.object({
24
+ kind: z.literal("item"),
25
+ field: z.string().min(1)
26
+ }).strict();
27
+ const ElementRefDef = z.object({ kind: z.literal("element") }).strict();
28
+ const SerializedRefDef = z.discriminatedUnion("kind", [
29
+ HomeRefDef,
30
+ SectionRefDef,
31
+ RowRefDef,
32
+ ItemRefDef,
33
+ ElementRefDef
34
+ ]);
35
+ const SerializedReads = z.array(SerializedRefDef).min(1).optional();
36
+ const DerivedSourceDef = z.object({
37
+ kind: z.literal("derived"),
38
+ transform: z.string(),
39
+ reads: SerializedReads,
40
+ requires: SerializedReads
41
+ }).strict();
42
+ const variantShape = { variant: z.object({ cases: z.array(z.string().min(1)).min(1) }).strict().optional() };
43
+ const slotMetadataShape = {
44
+ label: z.string().min(1).optional(),
45
+ placeholder: z.string().optional(),
46
+ ...variantShape,
47
+ source: z.union([
48
+ z.object({ kind: z.literal("authored") }),
49
+ SerializedRefDef,
50
+ DerivedSourceDef
51
+ ]).optional(),
52
+ writeback: z.boolean().optional()
53
+ };
54
+ function slotMember(type, shape) {
55
+ return z.object({
56
+ type: z.literal(type),
57
+ ...slotHeadShape,
58
+ ...shape,
59
+ ...slotMetadataShape
60
+ }).strict();
61
+ }
62
+ const VALUE_DEF_MEMBERS = [
63
+ slotMember("text", PRIMITIVE_DESCRIPTORS.text.shape),
64
+ slotMember("number", PRIMITIVE_DESCRIPTORS.number.shape),
65
+ slotMember("select", PRIMITIVE_DESCRIPTORS.select.shape),
66
+ slotMember("image", PRIMITIVE_DESCRIPTORS.image.shape),
67
+ slotMember("video", PRIMITIVE_DESCRIPTORS.video.shape),
68
+ slotMember("tour", PRIMITIVE_DESCRIPTORS.tour.shape),
69
+ slotMember("poi", PRIMITIVE_DESCRIPTORS.poi.shape),
70
+ slotMember("url", PRIMITIVE_DESCRIPTORS.url.shape),
71
+ slotMember("address", PRIMITIVE_DESCRIPTORS.address.shape),
72
+ slotMember("date", PRIMITIVE_DESCRIPTORS.date.shape),
73
+ slotMember("email", PRIMITIVE_DESCRIPTORS.email.shape),
74
+ slotMember("phone", PRIMITIVE_DESCRIPTORS.phone.shape),
75
+ slotMember("document", PRIMITIVE_DESCRIPTORS.document.shape),
76
+ slotMember("media", PRIMITIVE_DESCRIPTORS.media.shape)
77
+ ];
78
+ const ValueSlotDef = z.discriminatedUnion("type", [...VALUE_DEF_MEMBERS]);
79
+ const RowDef = z.object({
80
+ type: z.literal("row"),
81
+ ...slotHeadShape,
82
+ label: z.string().min(1).optional(),
83
+ placeholder: z.string().optional(),
84
+ ...variantShape,
85
+ from: z.union([z.string().min(1), z.array(z.string().min(1)).min(2)]),
86
+ source: z.union([
87
+ SectionRefDef,
88
+ DerivedSourceDef,
89
+ ElementRefDef
90
+ ]).optional()
91
+ }).strict();
92
+ const VALUE_LIST_DEF_MEMBER = slotMember("list", {
93
+ ...PRIMITIVE_DESCRIPTORS.list.shape,
94
+ element: ValueSlotDef
95
+ });
96
+ function objectDef(field) {
97
+ return z.object({
98
+ type: z.literal("object"),
99
+ locked: slotHeadShape.locked,
100
+ label: z.object({ field: z.string().min(1) }).strict().optional(),
101
+ fields: z.record(z.string(), field),
102
+ item_order: z.array(z.string()).optional(),
103
+ ...variantShape
104
+ }).strict();
105
+ }
106
+ const NestedObjectFieldDef = z.discriminatedUnion("type", [
107
+ ...VALUE_DEF_MEMBERS,
108
+ RowDef,
109
+ VALUE_LIST_DEF_MEMBER
110
+ ]);
111
+ const NestedObjectDef = objectDef(NestedObjectFieldDef);
112
+ const FIELD_LIST_DEF_MEMBER = slotMember("list", {
113
+ ...PRIMITIVE_DESCRIPTORS.list.shape,
114
+ element: z.discriminatedUnion("type", [...VALUE_DEF_MEMBERS, NestedObjectDef])
115
+ });
116
+ const ObjectFieldDef = z.discriminatedUnion("type", [
117
+ ...VALUE_DEF_MEMBERS,
118
+ RowDef,
119
+ FIELD_LIST_DEF_MEMBER
120
+ ]);
121
+ const ObjectDef = objectDef(ObjectFieldDef);
122
+ const ListElementDef = z.discriminatedUnion("type", [
123
+ ...VALUE_DEF_MEMBERS,
124
+ RowDef,
125
+ ObjectDef
126
+ ]);
127
+ const LIST_DEF_MEMBER = slotMember("list", {
128
+ ...PRIMITIVE_DESCRIPTORS.list.shape,
129
+ element: ListElementDef
130
+ });
131
+ const SLOT_DEF_MEMBERS = [
132
+ ...VALUE_DEF_MEMBERS,
133
+ LIST_DEF_MEMBER,
134
+ ObjectDef,
135
+ RowDef
136
+ ];
137
+ const SlotDef = z.discriminatedUnion("type", [...SLOT_DEF_MEMBERS]);
138
+
139
+ //#endregion
140
+ export { HomeRefDef, ListElementDef, NestedObjectFieldDef, ObjectFieldDef, SectionRefDef, SerializedReads, SerializedRefDef, SlotDef, ValueSlotDef };
@@ -0,0 +1,97 @@
1
+ import { AddressValue } from "./address-value.js";
2
+ import { DocumentValue } from "./document-value.js";
3
+ import { MediaKind, RegistryTableKey } from "./slot-catalog.js";
4
+ import { TourValue } from "./tour-value.js";
5
+ import { VideoValue } from "./video-value.js";
6
+ import { PoiRow } from "./poi-row.js";
7
+ import { ImageValue, MediaValue } from "./runtime-values.js";
8
+ import { RowId, TableIdKey } from "./row-ref.js";
9
+ //#region ../../internal/template-contracts/dist/slot-value.d.ts
10
+ /**
11
+ * Maps one slot definition (as authored under a section schema's `slots`) to
12
+ * the runtime value shape a renderer receives at `props.slots[<key>]`, as
13
+ * normalized by the binding layer. String-valued kinds (`text`, `select`,
14
+ * `url`, `email`, `phone`) are plain `string` — the canonical blank is `""`, never
15
+ * `null`; a `number`, `date`, `image`, `poi`, `address` or `document` slot's blank is `null`. A `list` slot is always an
16
+ * array, never `null` — an empty list is the absent state. An `object` is its fields'
17
+ * values by key; a `row` is its element's identity, or `null`. An item of a list of
18
+ * objects is its identity plus its fields: a fact row's identity key (a unit's
19
+ * `unit_id`, a contact's or comparable's `id`) where the elements are a table's rows,
20
+ * the platform-minted `id` otherwise.
21
+ */
22
+ type SlotValue<S> = S extends {
23
+ type: "text";
24
+ } ? string : S extends {
25
+ type: "number";
26
+ } ? number | null : S extends {
27
+ type: "select";
28
+ } ? string : S extends {
29
+ type: "image";
30
+ } ? ImageValue | null : S extends {
31
+ type: "video";
32
+ } ? VideoValue | null : S extends {
33
+ type: "tour";
34
+ } ? TourValue | null : S extends {
35
+ type: "list";
36
+ } ? ListValue<S> : S extends {
37
+ type: "object";
38
+ fields: infer F;
39
+ } ? ObjectValue<F> : S extends {
40
+ type: "row";
41
+ } ? RowId<TableOf<S>> | null : S extends {
42
+ type: "poi";
43
+ } ? PoiRow | null : S extends {
44
+ type: "url";
45
+ } ? string : S extends {
46
+ type: "date";
47
+ } ? string | null : S extends {
48
+ type: "email";
49
+ } ? string : S extends {
50
+ type: "phone";
51
+ } ? string : S extends {
52
+ type: "address";
53
+ } ? AddressValue | null : S extends {
54
+ type: "document";
55
+ } ? DocumentValue | null : S extends {
56
+ type: "media";
57
+ } ? MediaValue<DeclaredKinds<S>> | null : never;
58
+ /** The kinds a `media` declaration holds — its `kinds`, all four when it states none. */
59
+ type DeclaredKinds<S> = S extends {
60
+ kinds?: readonly (infer K extends MediaKind)[];
61
+ } ? ([K] extends [never] ? MediaKind : K) : MediaKind;
62
+ /** The table a list's or a row's phantom names, or `null`. */
63
+ type TableOf<S> = S extends {
64
+ readonly __table?: infer T;
65
+ } ? (T extends RegistryTableKey ? T : null) : null;
66
+ type ListValue<S> = S extends {
67
+ type: "list";
68
+ element: {
69
+ type: "object";
70
+ fields: infer F;
71
+ };
72
+ } ? (ItemIdentity<TableOf<S>> & ObjectValue<F>)[] : S extends {
73
+ type: "list";
74
+ element: infer E extends {
75
+ type: "row";
76
+ };
77
+ } ? RowId<TableOf<E> extends RegistryTableKey ? TableOf<E> : TableOf<S>>[] : S extends {
78
+ type: "list";
79
+ element: infer E;
80
+ } ? NonNullable<SlotValue<E>>[] : unknown[];
81
+ /**
82
+ * The value of an `object` — at a section's top level, or as one item of a list —
83
+ * derived from its declared fields: each field typed by its own definition, and a
84
+ * label read from a source under `label` (a label naming one of the fields adds no
85
+ * key). Closed (no index signature), so an undeclared field is a compile error.
86
+ */
87
+ type ObjectValue<F> = { -readonly [K in keyof F]: SlotValue<F[K]>; };
88
+ /**
89
+ * The identity an item of a list of objects carries beside its fields: the table's own
90
+ * key where the elements are a table's rows (a unit names its unit by `unit_id`), the
91
+ * platform-minted `id` otherwise.
92
+ */
93
+ type ItemIdentity<T> = T extends RegistryTableKey ? { [K in TableIdKey<T>]: string; } : {
94
+ id: string;
95
+ };
96
+ //#endregion
97
+ export { ItemIdentity, ObjectValue, SlotValue };
@@ -0,0 +1,25 @@
1
+ import { AddressValue } from "./address-value.js";
2
+ import { RegistryTable } from "./slot-catalog.js";
3
+ import { MemberValueTypeOf, TableFieldsOf } from "./registry-shape.js";
4
+ import { LibraryFactRegistry, PropertyTablePages } from "./fact-registry.js";
5
+ import { FactItem } from "./registry-facts.js";
6
+ //#region ../../internal/template-contracts/dist/table-members.d.ts
7
+ interface RegistryItems {
8
+ units: FactItem<PropertyTablePages["units"]["declaration"]["element"]>;
9
+ comparables: FactItem<PropertyTablePages["comparables"]["declaration"]["element"]>;
10
+ commercial_spaces: FactItem<PropertyTablePages["commercial_spaces"]["declaration"]["element"]>;
11
+ contacts: FactItem<LibraryFactRegistry["pages"]["contacts"]["declaration"]["element"]>;
12
+ }
13
+ type RegistryItem<T extends RegistryTable> = RegistryItems[T];
14
+ type AddressMemberOf<T extends RegistryTable> = { [M in keyof TableFieldsOf<T>]: TableFieldsOf<T>[M] extends {
15
+ readonly type: "address";
16
+ } ? M : never; }[keyof TableFieldsOf<T>];
17
+ /**
18
+ * One row of table `T` under its registry reading: the facts document's item, its
19
+ * identity `id` beside its members, an address-valued member read as an address slot
20
+ * holds it (`AddressValue`, `null` when it holds no place). What a `compute()` reading
21
+ * the table's registry key receives per row, and what each member read reads.
22
+ */
23
+ type RegistryTableRow<T extends RegistryTable> = Omit<RegistryItem<T>, AddressMemberOf<T>> & { [M in AddressMemberOf<T> & string]: AddressValue | null; };
24
+ //#endregion
25
+ export { RegistryTableRow };