@homepages/concrete 7.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 (331) hide show
  1. package/CHANGELOG.md +1007 -0
  2. package/README.md +20 -9
  3. package/codemods/list-grammar.mjs +923 -0
  4. package/codemods/manifest.json +66 -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 +252 -35
  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 +35 -27
  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-spec-view.js +1 -0
  131. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +95 -0
  132. package/dist/packages/internal/section-contracts/dist/grammar-scope.js +154 -0
  133. package/dist/packages/internal/section-contracts/dist/index.js +7 -5
  134. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +23 -19
  135. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +12 -7
  136. package/dist/packages/internal/section-contracts/dist/list-source-contract.js +46 -0
  137. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +11 -2
  138. package/dist/packages/internal/section-contracts/dist/object-contract.js +92 -0
  139. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +5 -5
  140. package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +63 -0
  141. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +7 -4
  142. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +83 -0
  143. package/dist/packages/internal/section-contracts/dist/row-source-contract.js +67 -0
  144. package/dist/packages/internal/section-contracts/dist/runners.js +77 -33
  145. package/dist/packages/internal/section-contracts/dist/select-contract.js +0 -8
  146. package/dist/packages/internal/section-contracts/dist/source-contract.js +120 -66
  147. package/dist/packages/internal/section-contracts/dist/sources-contract.js +47 -17
  148. package/dist/packages/internal/section-contracts/dist/table-member.js +16 -0
  149. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +43 -18
  150. package/dist/packages/internal/source-resolution/dist/index.js +113 -118
  151. package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +16 -0
  152. package/dist/packages/internal/street-address/dist/index.js +72 -0
  153. package/dist/packages/internal/template-artifact/dist/asset-mime.js +30 -0
  154. package/dist/packages/internal/template-artifact/dist/layout.js +1 -2
  155. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
  156. package/dist/packages/internal/template-artifact/dist/verify.js +12 -29
  157. package/dist/packages/internal/template-contracts/dist/address-value.d.ts +52 -0
  158. package/dist/packages/internal/template-contracts/dist/address-value.js +90 -0
  159. package/dist/packages/internal/template-contracts/dist/comparable-address.js +19 -0
  160. package/dist/{schema → packages/internal/template-contracts/dist}/compute.d.ts +29 -6
  161. package/dist/{schema → packages/internal/template-contracts/dist}/compute.js +11 -13
  162. package/dist/packages/internal/template-contracts/dist/content-pick.js +51 -0
  163. package/dist/packages/internal/template-contracts/dist/decision-fills.js +85 -0
  164. package/dist/packages/internal/template-contracts/dist/display-overrides.js +7 -0
  165. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +16 -5
  166. package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +24 -0
  167. package/dist/packages/internal/template-contracts/dist/fact-compute.js +30 -0
  168. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +44 -0
  169. package/dist/packages/internal/template-contracts/dist/fact-keys.js +88 -0
  170. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +290 -0
  171. package/dist/packages/internal/template-contracts/dist/fact-registry.js +598 -0
  172. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +12 -36
  173. package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +157 -0
  174. package/dist/packages/internal/template-contracts/dist/fill-builders.js +79 -0
  175. package/dist/packages/internal/template-contracts/dist/fill-declaration.d.ts +14 -0
  176. package/dist/{schema → packages/internal/template-contracts/dist}/fill-declaration.js +6 -5
  177. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +158 -0
  178. package/dist/packages/internal/template-contracts/dist/fill-spec.js +291 -0
  179. package/dist/packages/internal/template-contracts/dist/findable.js +8 -0
  180. package/dist/packages/internal/template-contracts/dist/floor-presets.js +13 -0
  181. package/dist/packages/internal/template-contracts/dist/icon-names.d.ts +5 -0
  182. package/dist/packages/internal/template-contracts/dist/icon-names.js +70 -0
  183. package/dist/packages/internal/template-contracts/dist/legacy-facts.js +167 -0
  184. package/dist/packages/internal/template-contracts/dist/list-editing.js +94 -0
  185. package/dist/packages/internal/template-contracts/dist/list.d.ts +215 -0
  186. package/dist/packages/internal/template-contracts/dist/list.js +258 -0
  187. package/dist/packages/internal/template-contracts/dist/markers.d.ts +2 -2
  188. package/dist/packages/internal/template-contracts/dist/media-candidates.js +38 -0
  189. package/dist/packages/internal/template-contracts/dist/mirror-kind.js +48 -0
  190. package/dist/packages/internal/template-contracts/dist/number-display.js +10 -0
  191. package/dist/packages/internal/template-contracts/dist/object.d.ts +89 -0
  192. package/dist/packages/internal/template-contracts/dist/object.js +131 -0
  193. package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +1 -1
  194. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.d.ts +1 -0
  195. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +162 -0
  196. package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +77 -0
  197. package/dist/packages/internal/template-contracts/dist/process-builders.js +73 -0
  198. package/dist/packages/internal/template-contracts/dist/read-graph.js +250 -0
  199. package/dist/packages/internal/template-contracts/dist/ref-locate.js +192 -0
  200. package/dist/packages/internal/template-contracts/dist/registry-aliases.js +77 -0
  201. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +268 -0
  202. package/dist/packages/internal/template-contracts/dist/registry-facts.js +202 -0
  203. package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +41 -0
  204. package/dist/packages/internal/template-contracts/dist/registry-shape.js +135 -0
  205. package/dist/packages/internal/template-contracts/dist/resolve-scope.js +103 -0
  206. package/dist/packages/internal/{image-descriptor/dist/index.d.ts → template-contracts/dist/responsive-image.d.ts} +1 -1
  207. package/dist/packages/internal/template-contracts/dist/row-planners.js +29 -0
  208. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +133 -0
  209. package/dist/packages/internal/template-contracts/dist/row-ref.js +101 -0
  210. package/dist/packages/internal/template-contracts/dist/row-sources.js +48 -8
  211. package/dist/packages/internal/template-contracts/dist/row.d.ts +155 -0
  212. package/dist/packages/internal/template-contracts/dist/row.js +84 -0
  213. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +97 -0
  214. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +782 -0
  215. package/dist/packages/internal/template-contracts/dist/slot-builders.js +233 -0
  216. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +243 -384
  217. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +334 -230
  218. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +21 -0
  219. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +155 -0
  220. package/dist/packages/internal/template-contracts/dist/slot-ref.js +76 -0
  221. package/dist/packages/internal/template-contracts/dist/slot-types.d.ts +163 -0
  222. package/dist/packages/internal/template-contracts/dist/slot-types.js +140 -0
  223. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +97 -0
  224. package/dist/packages/internal/template-contracts/dist/table-members.d.ts +25 -0
  225. package/dist/packages/internal/template-contracts/dist/table-members.js +90 -0
  226. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +5 -5
  227. package/dist/packages/internal/template-contracts/dist/value-contracts.js +15 -0
  228. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +2 -2
  229. package/dist/platform/fs.js +5 -2
  230. package/dist/playground/canvas-island-host.d.ts +11 -0
  231. package/dist/playground/canvas-island-host.js +29 -0
  232. package/dist/playground/canvas-markers.js +14 -0
  233. package/dist/playground-island-runtime.d.ts +3 -2
  234. package/dist/playground-island-runtime.js +3 -2
  235. package/dist/primitives/FrameShell.js +0 -1
  236. package/dist/primitives/Image.d.ts +5 -4
  237. package/dist/primitives/Tour.d.ts +1 -1
  238. package/dist/primitives/Video.d.ts +2 -2
  239. package/dist/primitives/index.d.ts +2 -3
  240. package/dist/primitives/picture-sources.js +2 -2
  241. package/dist/primitives/probe-context.js +2 -12
  242. package/dist/primitives/slot-address.d.ts +44 -0
  243. package/dist/primitives/slot-address.js +19 -0
  244. package/dist/primitives/slot-bindings.d.ts +65 -26
  245. package/dist/primitives/slot-bindings.js +104 -46
  246. package/dist/primitives/slot-document.d.ts +23 -18
  247. package/dist/primitives/slot-document.js +39 -14
  248. package/dist/primitives/slot-download.d.ts +39 -0
  249. package/dist/primitives/slot-download.js +39 -0
  250. package/dist/primitives/slot-list.d.ts +3 -3
  251. package/dist/primitives/slot-list.js +0 -2
  252. package/dist/primitives/slot-media.d.ts +24 -5
  253. package/dist/primitives/slot-media.js +6 -9
  254. package/dist/primitives/slot-object.d.ts +49 -0
  255. package/dist/primitives/slot-object.js +20 -0
  256. package/dist/primitives/slot-scalar.d.ts +27 -2
  257. package/dist/primitives/slot-scalar.js +50 -7
  258. package/dist/primitives/slot.d.ts +13 -6
  259. package/dist/primitives/slot.js +10 -3
  260. package/dist/rules/registry.js +19 -30
  261. package/dist/schema/define-schema.d.ts +4 -8
  262. package/dist/schema/define-schema.js +178 -79
  263. package/dist/schema/extract-fill-spec.js +2 -158
  264. package/dist/schema/fact.d.ts +57 -15
  265. package/dist/schema/fact.js +42 -7
  266. package/dist/schema/facts-view.d.ts +14 -0
  267. package/dist/schema/format.d.ts +1 -0
  268. package/dist/schema/format.js +2 -1
  269. package/dist/schema/manifest.js +24 -0
  270. package/dist/schema/property-facts.d.ts +8 -11
  271. package/dist/schema/section-props.d.ts +2 -66
  272. package/dist/schema/section-schema.d.ts +8 -11
  273. package/dist/schema/section-schema.js +27 -10
  274. package/dist/section/declare.d.ts +18 -7
  275. package/dist/section/declare.js +18 -5
  276. package/dist/section/materialize.js +3 -8
  277. package/dist/section/section.d.ts +12 -8
  278. package/dist/section/section.js +1 -1
  279. package/dist/template/logic-shim.d.ts +14 -7
  280. package/dist/template/logic-shim.js +14 -7
  281. package/dist/template/materialize.js +17 -18
  282. package/dist/template/mirror-types.js +30 -31
  283. package/dist/template/section-reads.js +85 -9
  284. package/guide/reference/cli/INDEX.md +2 -2
  285. package/guide/reference/cli/build.md +1 -1
  286. package/guide/reference/cli/check.md +1 -1
  287. package/guide/reference/cli/dev.md +1 -1
  288. package/guide/reference/cli/property-add.md +1 -1
  289. package/guide/reference/cli/property-list.md +2 -2
  290. package/guide/reference/cli/publish.md +1 -1
  291. package/guide/reference/cli/upgrade.md +1 -1
  292. package/guide/reference/rules/INDEX.md +29 -29
  293. package/package.json +9 -8
  294. package/dist/artifact/playground/client/assets/index-CckS2ONm.css +0 -1
  295. package/dist/artifact/playground/client/assets/index-D8eepVr-.js +0 -1101
  296. package/dist/fixtures/canonical.d.ts +0 -166
  297. package/dist/fixtures/media.js +0 -163
  298. package/dist/packages/internal/fill-vocabulary/dist/origination.js +0 -111
  299. package/dist/packages/internal/format-geometry/dist/index.js +0 -4
  300. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +0 -10
  301. package/dist/packages/internal/property-facts/dist/index.js +0 -3
  302. package/dist/packages/internal/property-facts/dist/property-facts-Cy7-O4p0.js +0 -189
  303. package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +0 -20
  304. package/dist/packages/internal/section-contracts/dist/name-title-contract.js +0 -20
  305. package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +0 -22
  306. package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +0 -24
  307. package/dist/packages/internal/section-contracts/dist/source-filter-contract.js +0 -15
  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 -111
  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 -89
  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 -613
  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
@@ -0,0 +1,103 @@
1
+ import { rowOfMember } from "./slot-ref.js";
2
+ import { isComputeBinding } from "./compute.js";
3
+ import { FILL, getFills } from "./fill-declaration.js";
4
+ import { ROW_OWN_KEYS, rowDefinition } from "./row-ref.js";
5
+
6
+ //#region ../../internal/template-contracts/dist/resolve-scope.js
7
+ function mapReads(reads, map) {
8
+ const mapped = reads.map(map);
9
+ return mapped.some((ref, i) => ref !== reads[i]) ? mapped : void 0;
10
+ }
11
+ function mapFunctionRefs(binding, map) {
12
+ const reads = binding.reads === void 0 ? void 0 : mapReads(binding.reads, map);
13
+ const requires = binding.requires === void 0 ? void 0 : mapReads(binding.requires, map);
14
+ if (reads === void 0 && requires === void 0) return binding;
15
+ return {
16
+ ...binding,
17
+ ...reads === void 0 ? {} : { reads },
18
+ ...requires === void 0 ? {} : { requires }
19
+ };
20
+ }
21
+ function mapSlotRefs(value, map) {
22
+ const slot = rowDefinition(value);
23
+ let out;
24
+ const source = slot.source;
25
+ if (source !== void 0) if (isComputeBinding(source)) {
26
+ const mapped = mapFunctionRefs(source, map);
27
+ if (mapped !== source) out = {
28
+ ...slot,
29
+ source: mapped
30
+ };
31
+ } else {
32
+ const mapped = map(source);
33
+ if (mapped !== source) out = {
34
+ ...slot,
35
+ source: mapped
36
+ };
37
+ }
38
+ const fills = getFills(slot);
39
+ if (fills !== void 0) {
40
+ let changed = false;
41
+ const mapped = fills.map((binding) => {
42
+ const resolved = mapFunctionRefs(binding, map);
43
+ if (resolved !== binding) changed = true;
44
+ return resolved;
45
+ });
46
+ if (changed) out = {
47
+ ...out ?? slot,
48
+ [FILL]: mapped
49
+ };
50
+ }
51
+ return out ?? slot;
52
+ }
53
+ function memberResolver(rows) {
54
+ return (ref) => {
55
+ const row = rowOfMember(ref);
56
+ if (row === void 0) return ref;
57
+ const key = rows.get(row);
58
+ if (key === void 0) return ref;
59
+ return {
60
+ kind: "row",
61
+ slot: key,
62
+ field: ref.field
63
+ };
64
+ };
65
+ }
66
+ const MEMBER_HOLDERS = /* @__PURE__ */ new Set(["row", "address"]);
67
+ function rowScope(slots) {
68
+ const rows = /* @__PURE__ */ new Map();
69
+ for (const [key, slot] of Object.entries(slots)) if (typeof slot === "object" && slot !== null && MEMBER_HOLDERS.has(slot.type)) rows.set(slot, key);
70
+ return rows;
71
+ }
72
+ function ownKeyRead(slot, rows, at) {
73
+ const refs = [slot.source];
74
+ mapSlotRefs(slot, (ref) => {
75
+ refs.push(ref);
76
+ return ref;
77
+ });
78
+ for (const [row, rowKey] of rows) {
79
+ if (row === slot || rowKey === at) continue;
80
+ for (const key of ROW_OWN_KEYS) {
81
+ const own = row[key];
82
+ if (own !== void 0 && refs.includes(own)) return `${rowKey}.${key}`;
83
+ }
84
+ }
85
+ }
86
+ function ownKeyRefusal(read) {
87
+ const key = read.slice(read.indexOf(".") + 1);
88
+ return `reads \`${read}\`, which is the row's own \`${key}\`, not a member — a row's ${ROW_OWN_KEYS.map((k) => `\`${k}\``).join(", ")} are its slot definition's, and its table has no member named \`${key}\`.`;
89
+ }
90
+ function unresolvedMember(slot) {
91
+ let found;
92
+ mapSlotRefs(slot, (ref) => {
93
+ if (found === void 0 && rowOfMember(ref) !== void 0) found = ref.field;
94
+ return ref;
95
+ });
96
+ return found;
97
+ }
98
+ function plainSlot(slot) {
99
+ return MEMBER_HOLDERS.has(slot.type) ? { ...rowDefinition(slot) } : slot;
100
+ }
101
+
102
+ //#endregion
103
+ export { mapSlotRefs, memberResolver, ownKeyRead, ownKeyRefusal, plainSlot, rowScope, unresolvedMember };
@@ -1,4 +1,4 @@
1
- //#region ../../internal/image-descriptor/dist/index.d.ts
1
+ //#region ../../internal/template-contracts/dist/responsive-image.d.ts
2
2
  /**
3
3
  * One image format's candidate set within a `ResponsiveImage`.
4
4
  *
@@ -0,0 +1,29 @@
1
+ import { isFindableKind } from "./findable.js";
2
+ import { isValueKind } from "./value-contracts.js";
3
+
4
+ //#region ../../internal/template-contracts/dist/row-planners.js
5
+ const POOLING_PRIMITIVES = [
6
+ "image",
7
+ "video",
8
+ "tour",
9
+ "document",
10
+ "media"
11
+ ];
12
+ function poolingPrimitiveOf(field) {
13
+ return POOLING_PRIMITIVES.includes(field.type ?? "") ? field.type : void 0;
14
+ }
15
+ function plannerForField(field) {
16
+ if (field.type === "list") {
17
+ const element = field.element?.type;
18
+ if (element === "select") return "select";
19
+ if (isFindableKind(element) || element === "object" || element === "row") return void 0;
20
+ if (poolingPrimitiveOf({ type: element }) !== void 0) return "assets";
21
+ return "list";
22
+ }
23
+ if (field.type === "text" || isValueKind(field.type)) return "text";
24
+ if (field.type === "select") return "choice";
25
+ return poolingPrimitiveOf(field);
26
+ }
27
+
28
+ //#endregion
29
+ export { POOLING_PRIMITIVES, plannerForField, poolingPrimitiveOf };
@@ -0,0 +1,133 @@
1
+ import { AddressMember, AddressValue } from "./address-value.js";
2
+ import { LIBRARY_TABLE_KEYS, REGISTRY_TABLE_KEYS, RegistryTable, RegistryTableKey, TABLES, TableField } from "./slot-catalog.js";
3
+ import { PoiRow } from "./poi-row.js";
4
+ import { ImageValue } from "./runtime-values.js";
5
+ import { MemberValueTypeOf, TableFieldsOf } from "./registry-shape.js";
6
+ import { RegistryTableRow } from "./table-members.js";
7
+ import { ComputeBinding } from "./compute.js";
8
+ import { SlotValue } from "./slot-value.js";
9
+ import { ElementRef, RowRef, SiblingSlot, SlotRef } from "./slot-ref.js";
10
+ import { DocumentMediaValue } from "./registry-facts.js";
11
+ //#region ../../internal/template-contracts/dist/row-ref.d.ts
12
+ /** The library key naming table `T`, where the library holds its rows. */
13
+ type LibraryKeyOf<T extends RegistryTable> = T extends keyof typeof LIBRARY_TABLE_KEYS ? (typeof LIBRARY_TABLE_KEYS)[T] : never;
14
+ /** The table a registry table key names — `units` for `property.units`, `contacts` for `library.contacts`. */
15
+ type TableOfKey<K extends RegistryTableKey> = { [T in RegistryTable]: K extends (typeof REGISTRY_TABLE_KEYS)[T] | LibraryKeyOf<T> ? T : never; }[RegistryTable];
16
+ /**
17
+ * The identity key a table's items carry in a section's content — `TABLES[t].idKey`,
18
+ * `unit_id` on a unit — or `id` for a table with no legacy entry. It does not move with the
19
+ * reading: only what a `compute()` sees does.
20
+ */
21
+ type TableIdKey<K extends RegistryTableKey> = TableOfKey<K> extends TableField ? (typeof TABLES)[TableOfKey<K>]["idKey"] : "id";
22
+ /**
23
+ * The keys a row slot's definition owns (`RowSlotDef`'s, ./row.ts). A row answers each
24
+ * from its definition — present or not — and never as a member, but where its table has
25
+ * a member of the same name (a unit's `label`), which the row answers instead.
26
+ */
27
+ declare const ROW_OWN_KEYS: readonly ["type", "label", "from", "source", "locked", "when"];
28
+ /** A key a row slot's definition owns — see {@link ROW_OWN_KEYS}. */
29
+ type RowOwnKey = (typeof ROW_OWN_KEYS)[number];
30
+ /**
31
+ * A row's identity — a fact row's id, or a content item's minted `id` — as a row slot
32
+ * and a selection hold it. `Table` rides a phantom, so a row read off another section's
33
+ * row or selection still offers its table's members.
34
+ */
35
+ type RowId<Table extends RegistryTableKey | null = RegistryTableKey | null> = string & {
36
+ readonly __row_table?: Table;
37
+ };
38
+ /** The table a row identity names, or `null`. */
39
+ type TableOfId<E> = E extends {
40
+ readonly __row_table?: infer C;
41
+ } ? (C extends RegistryTableKey ? C : null) : null;
42
+ type Members<T extends RegistryTable> = { [M in keyof TableFieldsOf<T>]: {
43
+ readonly value_type: MemberValueTypeOf<TableFieldsOf<T>[M]>;
44
+ }; };
45
+ /** What member `M` of a table's registry row holds, as the facts document holds it. */
46
+ type MemberRead<T extends RegistryTable, M> = M extends keyof RegistryTableRow<T> ? RegistryTableRow<T>[M] : never;
47
+ /** An item of a list-valued member, each media reference resolved to the image a slot renders. */
48
+ type ResolvedItem<I> = { [K in keyof I]: I[K] extends DocumentMediaValue | null ? ImageValue | Extract<I[K], null> : I[K]; };
49
+ /**
50
+ * The value a member resolves to in a slot sourced by it: a scalar may be absent, an
51
+ * image member resolves to the image value a slot renders, an image list to the list of
52
+ * them, a list of objects to its items with their images resolved, a list of scalars to
53
+ * its values, an address to the address value.
54
+ */
55
+ type MemberValue<D, Read> = D extends {
56
+ value_type: "text";
57
+ } ? string | null : D extends {
58
+ value_type: "number";
59
+ } ? number | null : D extends {
60
+ value_type: "image";
61
+ } ? ImageValue | null : D extends {
62
+ value_type: "image_list";
63
+ } ? ImageValue[] : D extends {
64
+ value_type: "text_list";
65
+ } ? string[] : D extends {
66
+ value_type: "number_list";
67
+ } ? number[] : D extends {
68
+ value_type: "row_list";
69
+ } ? Read extends readonly (infer I)[] ? ResolvedItem<I>[] : never : D extends {
70
+ value_type: "address";
71
+ } ? AddressValue | null : unknown;
72
+ /** The member refs an address-valued member answers, one per part, each a dotted path. */
73
+ type AddressPartRefs<M extends string> = { readonly [P in AddressMember]: RowRef<`${M}.${P}`, AddressValue[P]>; };
74
+ type MemberRef<T extends RegistryTable, M extends keyof Members<T> & string> = RowRef<M, MemberValue<Members<T>[M], MemberRead<T, M>>, MemberRead<T, M>> & (Members<T>[M] extends {
75
+ value_type: "address";
76
+ } ? AddressPartRefs<M> : unknown);
77
+ /**
78
+ * What a row of table `K` offers: one member ref per member of the table's registry row
79
+ * (`linkedTableFields`). A slot sourced by one fits its value (`MemberValue`); a
80
+ * `compute()` reading one receives what the facts document holds — an image's
81
+ * `{ asset_id }`, `null` for an unanswered member. The mapping only FILTERS the table's
82
+ * keys, so each member's doc comment is what an author reads hovering `unit.beds`.
83
+ */
84
+ type TableRow<K extends RegistryTableKey> = { readonly [M in keyof Members<TableOfKey<K>> & string]: MemberRef<TableOfKey<K>, M>; };
85
+ /**
86
+ * What a row `from` a table's list-valued member offers (`row({ from: unit.floor_plans,
87
+ * source: entry })`): one read-only member ref per key of the member's items, the row's
88
+ * own keys aside — an item has no table to write back to.
89
+ */
90
+ type MemberListRow<Item> = { readonly [M in Exclude<keyof Item & string, RowOwnKey>]-?: RowRef<M, Item[M]>; };
91
+ /** The item a list-valued member ref holds, its images resolved — or `never` for any other ref. */
92
+ type MemberListItem<From> = From extends RowRef<string, infer V, unknown> ? NonNullable<V> extends readonly (infer I)[] ? I extends object ? I : never : never : never;
93
+ /** The element of a list-valued value: a table row's identity keeps its table. */
94
+ type ValueElement<V> = NonNullable<V> extends readonly (infer E)[] ? ElementRef<E, TableOfId<E>> : ElementRef<never, null>;
95
+ /**
96
+ * The element an item function receives for a list sourced by `Source`: a table's row
97
+ * (typed by the table), a list-valued member's element, a written value,
98
+ * a found place, or a compute's or a slot's element. A written value's kind is declared
99
+ * by the item field that binds it — after the element is handed over — so its value
100
+ * type is left open, and that field's own kind holds it. A picked list and a list with
101
+ * no source have no element: their item holds the pick in its `from` field.
102
+ */
103
+ type ElementOf<Source> = Source extends {
104
+ readonly kind: "home";
105
+ readonly key: infer F;
106
+ } ? F extends RegistryTableKey ? ElementRef<RowId<F>, F> : ElementRef<never, null> : Source extends RowRef<string, infer V, unknown> ? ValueElement<V> : Source extends {
107
+ readonly kind: "fill";
108
+ readonly verb: "write";
109
+ } ? ElementRef<never, null> : Source extends {
110
+ readonly kind: "fill";
111
+ readonly verb: "find";
112
+ } ? ElementRef<PoiRow, null> : Source extends ComputeBinding<infer V> ? ValueElement<V> : Source extends SlotRef<string, string, infer V> ? ValueElement<V> : Source extends SiblingSlot ? ValueElement<SlotValue<Source>> : ElementRef<never, null>;
113
+ /** The table whose rows a list's elements are, or `null` — what a list's items are identified by. */
114
+ type ElementTableOf<Source> = ElementOf<Source> extends ElementRef<unknown, infer T> ? T : null;
115
+ /** The table a row identity value names, through a list or a nullable single value. */
116
+ type TableOfRowValue<V> = NonNullable<V> extends readonly (infer E)[] ? TableOfId<E> : TableOfId<NonNullable<V>>;
117
+ /**
118
+ * The fact table a row's origin holds a row of, where its type says one — an element of
119
+ * a table's rows, another section's row or list holding table rows, a sibling's, or a
120
+ * compute returning a row identity — or `null` where it says none (a pick, which
121
+ * chooses out of the row's own `from`). A row's `source` must name `from`'s table or
122
+ * none (./row.ts).
123
+ */
124
+ type OriginTableOf<Source> = Source extends ElementRef<infer V, infer T> ? T extends RegistryTableKey ? T : TableOfId<V> : Source extends ComputeBinding<infer V> ? TableOfRowValue<V> : Source extends SlotRef<string, string, infer V> ? TableOfRowValue<V> : Source extends SiblingSlot ? TableOfRowValue<SlotValue<Source>> : null;
125
+ /**
126
+ * What an address slot offers: one member ref per part and per coordinate
127
+ * (`ADDRESS_MEMBERS`), typed by the address's value and never writable — a part edited
128
+ * alone would describe a door its coordinates are not on. On the wire a member ref
129
+ * reads `{kind:"row", slot, field}` exactly as a row's does, `slot` naming the address.
130
+ */
131
+ type AddressMembers = { readonly [M in AddressMember]: RowRef<M, AddressValue[M]>; };
132
+ //#endregion
133
+ export { AddressMembers, AddressPartRefs, ElementOf, ElementTableOf, MemberListItem, MemberListRow, OriginTableOf, ROW_OWN_KEYS, RowId, RowOwnKey, TableIdKey, TableOfKey, TableRow };
@@ -0,0 +1,101 @@
1
+ import { isAddressMember } from "./address-value.js";
2
+ import { FACT_GRAPH, TABLES } from "./slot-catalog.js";
3
+ import { ROW_OF } from "./slot-ref.js";
4
+ import { fieldOf, linkedTableFields, memberValueType } from "./registry-shape.js";
5
+
6
+ //#region ../../internal/template-contracts/dist/row-ref.js
7
+ const ROW_OWN_KEYS = [
8
+ "type",
9
+ "label",
10
+ "from",
11
+ "source",
12
+ "locked",
13
+ "when"
14
+ ];
15
+ const ROW_OWN = new Set(ROW_OWN_KEYS);
16
+ const TABLE_OF = Symbol.for("@homepages/concrete:table-of");
17
+ function withTable(slot, table) {
18
+ return Object.defineProperty(slot, TABLE_OF, {
19
+ value: table,
20
+ enumerable: false
21
+ });
22
+ }
23
+ function carriedTable(x) {
24
+ if (typeof x !== "object" || x === null) return null;
25
+ const table = x[TABLE_OF];
26
+ return typeof table === "object" && table !== null ? table : null;
27
+ }
28
+ function tableMembers(key) {
29
+ if (key.reading === "registry") return Object.keys(linkedTableFields(key.table));
30
+ const row = FACT_GRAPH[key.table].row;
31
+ return Object.keys(row).filter((member) => member !== TABLES[key.table].idKey && !ROW_OWN.has(member));
32
+ }
33
+ function memberRef(row, field) {
34
+ return Object.freeze({
35
+ kind: "row",
36
+ field,
37
+ [ROW_OF]: row
38
+ });
39
+ }
40
+ function addressMemberRef(row, field) {
41
+ return new Proxy(memberRef(row, field), { get(target, key, receiver) {
42
+ if (typeof key === "string" && !(key in target) && isAddressMember(key)) return memberRef(row, `${field}.${key}`);
43
+ return Reflect.get(target, key, receiver);
44
+ } });
45
+ }
46
+ const ROW_DEFINITION = Symbol.for("@homepages/concrete:row:definition");
47
+ function rowDefinition(slot) {
48
+ const definition = slot[ROW_DEFINITION];
49
+ return typeof definition === "object" && definition !== null ? definition : slot;
50
+ }
51
+ function isAddressValued(table, member) {
52
+ if (table.reading === "legacy") return false;
53
+ const declaration = fieldOf(linkedTableFields(table.table), member);
54
+ return declaration !== void 0 && memberValueType(declaration) === "address";
55
+ }
56
+ function memberKindOf(table, member) {
57
+ if (table.reading === "legacy") {
58
+ const row = FACT_GRAPH[table.table].row;
59
+ return Object.hasOwn(row, member) ? String(row[member].value_type) : void 0;
60
+ }
61
+ const declaration = fieldOf(linkedTableFields(table.table), member);
62
+ return declaration === void 0 ? void 0 : String(memberValueType(declaration) ?? "");
63
+ }
64
+ const PROBED_KEYS = /* @__PURE__ */ new Set([
65
+ "then",
66
+ "toJSON",
67
+ "$$typeof",
68
+ "asymmetricMatch",
69
+ "nodeType",
70
+ "tagName",
71
+ "@@iterator"
72
+ ]);
73
+ function rowWithMembers(def, table, also = []) {
74
+ const members = table === null ? null : new Set(tableMembers(table));
75
+ const proxy = new Proxy(def, { get(target, key, receiver) {
76
+ if (key === ROW_DEFINITION) return target;
77
+ if (typeof key !== "string") return Reflect.get(target, key, receiver);
78
+ if (table !== null && members !== null) {
79
+ const tables = [table, ...also];
80
+ const kinds = tables.map((each) => each === table ? members.has(key) ? memberKindOf(table, key) : void 0 : memberKindOf(each, key));
81
+ if (kinds.every((kind) => kind === void 0)) return Reflect.get(target, key, receiver);
82
+ const misfit = kinds.findIndex((kind) => kind === void 0 || kind !== kinds[0]);
83
+ if (misfit === -1) return isAddressValued(table, key) ? addressMemberRef(proxy, key) : memberRef(proxy, key);
84
+ if (key in target || ROW_OWN.has(key)) return Reflect.get(target, key, receiver);
85
+ throw new Error(`row: "${String(target.label)}" reads the member "${key}", which its \`from\` table ${tables[misfit].table} ${kinds[misfit] === void 0 ? "lacks" : "holds at another kind"} — every table a row names carries every member its readers read, at one kind.`);
86
+ }
87
+ if (key in target || ROW_OWN.has(key)) return Reflect.get(target, key, receiver);
88
+ return PROBED_KEYS.has(key) ? void 0 : memberRef(proxy, key);
89
+ } });
90
+ return proxy;
91
+ }
92
+ function addressWithMembers(def) {
93
+ const proxy = new Proxy(def, { get(target, key, receiver) {
94
+ if (typeof key === "string" && !(key in target) && isAddressMember(key)) return memberRef(proxy, key);
95
+ return Reflect.get(target, key, receiver);
96
+ } });
97
+ return proxy;
98
+ }
99
+
100
+ //#endregion
101
+ export { ROW_DEFINITION, ROW_OWN_KEYS, TABLE_OF, addressWithMembers, carriedTable, rowDefinition, rowWithMembers, tableMembers, withTable };
@@ -1,26 +1,66 @@
1
+ import { tableKeyOf } from "./slot-catalog.js";
2
+
1
3
  //#region ../../internal/template-contracts/dist/row-sources.js
2
4
  function sourceRecord(source) {
3
5
  return source !== null && typeof source === "object" ? source : null;
4
6
  }
5
7
  function rowMemberOf(source) {
6
8
  const src = sourceRecord(source);
7
- if (src?.["kind"] !== "row") return null;
9
+ if (src?.["kind"] !== "row" || "slot" in src) return null;
8
10
  return typeof src["field"] === "string" ? src["field"] : null;
9
11
  }
10
- function usesRowSources(fields) {
11
- return Object.values(fields ?? {}).some((field) => {
12
- const kind = sourceRecord(field.source)?.["kind"];
13
- return kind === "row" || kind === "derived";
14
- });
12
+ function memberSourceOf(source) {
13
+ const src = sourceRecord(source);
14
+ if (src?.["kind"] !== "row") return null;
15
+ const { slot, field } = src;
16
+ if (typeof slot !== "string" || slot === "" || typeof field !== "string" || field === "") return null;
17
+ return {
18
+ slot,
19
+ field
20
+ };
21
+ }
22
+ function elementRowKeys(fields) {
23
+ return Object.entries(fields ?? {}).filter(([, field]) => field.type === "row" && sourceRecord(field.source)?.["kind"] === "element").map(([key]) => key);
15
24
  }
16
25
  function rowMemberSources(fields) {
26
+ const elementRows = new Set(elementRowKeys(fields));
17
27
  const map = {};
18
28
  for (const [key, field] of Object.entries(fields ?? {})) {
19
- const member = rowMemberOf(field.source);
29
+ const member = rowMemberOf(field.source) ?? elementMemberOf(field.source, elementRows);
20
30
  if (member !== null) map[key] = member;
21
31
  }
22
32
  return map;
23
33
  }
34
+ function elementMemberOf(source, elementRows) {
35
+ const member = memberSourceOf(source);
36
+ return member !== null && elementRows.has(member.slot) ? member.field : null;
37
+ }
38
+ function listItemFieldsOf(list) {
39
+ if (list.fields !== void 0) return list.fields;
40
+ if (list.element?.type === "object") return list.element.fields;
41
+ }
42
+ function listSourceOf(list) {
43
+ const src = sourceRecord(list.source);
44
+ if (src === null || src["kind"] === "authored") return { kind: "none" };
45
+ const { kind, key, section, slot, transform } = src;
46
+ if (kind === "home" && typeof key === "string") {
47
+ const table = tableKeyOf(key);
48
+ if (table !== null) return {
49
+ kind: "table",
50
+ table: table.table
51
+ };
52
+ }
53
+ if (kind === "section" && typeof section === "string" && typeof slot === "string") return {
54
+ kind: "section",
55
+ section,
56
+ slot
57
+ };
58
+ if (kind === "derived" && typeof transform === "string") return {
59
+ kind: "derived",
60
+ transform
61
+ };
62
+ return { kind: "other" };
63
+ }
24
64
 
25
65
  //#endregion
26
- export { rowMemberOf, rowMemberSources, usesRowSources };
66
+ export { elementRowKeys, listItemFieldsOf, listSourceOf, memberSourceOf, rowMemberOf, rowMemberSources };
@@ -0,0 +1,155 @@
1
+ import { RegistryTableKey } from "./slot-catalog.js";
2
+ import { ComputeBinding } from "./compute.js";
3
+ import { MemberListItem, MemberListRow, OriginTableOf, TableRow } from "./row-ref.js";
4
+ import { ComputeRead, ElementRef, RowRef, SiblingSlot, SiblingSource, SlotRef } from "./slot-ref.js";
5
+ import { PickFill } from "./fill-builders.js";
6
+ import { FillMark } from "./fill-declaration.js";
7
+ //#region ../../internal/template-contracts/dist/row.d.ts
8
+ /**
9
+ * A fact table, as a row's `from` — `fact.property.contacts`. It names the table by its
10
+ * registry key (`property.contacts`), which says its rows read as the facts document
11
+ * holds them.
12
+ */
13
+ type TableSource = {
14
+ readonly kind: "home";
15
+ readonly key: RegistryTableKey;
16
+ };
17
+ /**
18
+ * A table's list-valued member, as a row's `from` — `unit.floor_plans`, read off a row of
19
+ * the table. A row from it holds one of the member's items: real fact data with no table
20
+ * of its own, so it is only ever an item's element (`source: entry`) and never re-picked.
21
+ */
22
+ type MemberListSource = RowRef<string, readonly object[], unknown>;
23
+ /**
24
+ * A row's `from`: one table or list-valued member, or an ordered list of tables. `from: t`
25
+ * and `from: [t]` are one declaration. A row from several tables is a row of any of them,
26
+ * so each carries every member the row's readers read, at one kind.
27
+ */
28
+ type RowFromInput = TableSource | MemberListSource | readonly [TableSource, ...TableSource[]];
29
+ /**
30
+ * The fill a row takes: a pick out of its `from`. It names no candidates of its own —
31
+ * the row's table is what the model picks from, as the user does.
32
+ */
33
+ type RowFill = PickFill<{
34
+ readonly brief: string;
35
+ readonly reads?: readonly ComputeRead[];
36
+ readonly of?: never;
37
+ readonly unique?: boolean;
38
+ readonly none?: never;
39
+ }>;
40
+ /**
41
+ * Where a row comes from when nobody chooses it: inside an item the element, another
42
+ * section's row or a sibling row (it mirrors that row), a `compute()` returning one
43
+ * row's identity or `null` — or a `fill.pick` out of its `from`. A table is never an
44
+ * origin: it is the row's `from`, and a list is never one either — a list is read
45
+ * whole, so a list's first row is a `compute()` over the list.
46
+ */
47
+ type RowSourceInput = ElementRef | SlotRef | SiblingSlot | ComputeBinding<unknown> | RowFill | readonly [RowFill, ...RowFill[]];
48
+ /** The options `row()` takes. */
49
+ interface RowOptions<From extends RowFromInput, Source extends RowSourceInput | undefined> {
50
+ /** The row's name in the editor, on the bar the user re-picks it from. */
51
+ label: string;
52
+ /**
53
+ * The fact data: a table — the row's type and the set it is picked from — or a table's
54
+ * list-valued member; or an ordered list of tables, picked from as their union.
55
+ */
56
+ from: From;
57
+ /**
58
+ * Where the row comes from, which must hold a row of `from`: absent, the table's first
59
+ * row, which the user may re-pick; a `fill.pick`, the model's pick out of `from`, which
60
+ * the user may re-pick too; any other origin, the row it yields, which nobody re-picks.
61
+ */
62
+ source?: Source;
63
+ /** Hides the row's bar; its readers still read it. */
64
+ locked?: boolean;
65
+ /** The owner is not complete without a row here: at least one row of `from` is required. */
66
+ required?: boolean;
67
+ when?: string | readonly string[];
68
+ }
69
+ /**
70
+ * The serialized shape `row()` emits. `Table` is a phantom: the table whose row it
71
+ * holds, which types its value (`SlotValue`) and the members it offers.
72
+ */
73
+ interface RowSlotDef<Table extends RegistryTableKey | null = RegistryTableKey> {
74
+ type: "row";
75
+ locked?: true;
76
+ required?: true;
77
+ /**
78
+ * The table's registry key — the row's type and candidate set — or a list-valued
79
+ * member's, `<table>.<member>`. A row `from` several tables emits their keys, in order; its type names the first, whose members it reads.
80
+ */
81
+ from: Table extends RegistryTableKey ? Table : string;
82
+ source?: ElementRef | ComputeBinding<unknown> | {
83
+ kind: "section";
84
+ section: string;
85
+ slot: string;
86
+ } | SiblingSource;
87
+ label: string;
88
+ when?: string | readonly string[];
89
+ /** Phantom: the table whose row this is. Never present at runtime. */
90
+ readonly __table?: Table;
91
+ }
92
+ /**
93
+ * What `row()` returns: the slot definition, and the accessor reading its table's
94
+ * members. A member named like one of the row's own keys (a unit's `label`) types as
95
+ * both, so the row stays a slot; at runtime it is the member (./row-ref.ts
96
+ * `rowWithMembers`).
97
+ */
98
+ type RowOf<Table extends RegistryTableKey> = RowSlotDef<Table> & TableRow<Table> & FillMark;
99
+ /** What `row()` returns for a `from`: a table's row, or a list-valued member's item. */
100
+ type RowFrom<From> = From extends TableSource ? RowOf<From["key"]> : From extends readonly [infer First extends TableSource, ...TableSource[]] ? RowOf<First["key"]> : RowSlotDef<null> & MemberListRow<MemberListItem<From>> & FillMark;
101
+ /** Whether a slot-valued origin holds a list — another section's list slot, or a sibling list. */
102
+ type HoldsAList<Source> = Source extends SlotRef<string, string, infer V> ? NonNullable<V> extends readonly unknown[] ? true : false : Source extends SiblingSlot ? Source extends {
103
+ readonly type: "list";
104
+ } ? true : false : false;
105
+ /**
106
+ * A `source` the row's `from` admits: from a table, an origin holding no list whose table,
107
+ * where its type says one, is `from`'s own; from a list-valued member, the element of the
108
+ * list over it.
109
+ */
110
+ type FitsFrom<Source, From> = From extends readonly TableSource[] ? HoldsAList<Source> extends true ? never : [OriginTableOf<Source>] extends [From[number]["key"] | null] ? unknown : never : From extends TableSource ? HoldsAList<Source> extends true ? never : [OriginTableOf<Source>] extends [From["key"] | null] ? unknown : never : Source extends ElementRef ? unknown : never;
111
+ /**
112
+ * A row: one row of a table, held as a slot. `from` is the table — the row's type and
113
+ * the set it is picked from — and its value is the row's identity; the value `row()`
114
+ * returns reads the row's members: `agent.phone` is a member ref, legal as a reader's
115
+ * `source:` and in any `reads`. A reader's edit writes the member where the row stores
116
+ * it; a derived member is read-only. A member is read ONLY through a row: a table, a list or a pick hands out no
117
+ * member of its own.
118
+ *
119
+ * - `row({ from: fact.property.contacts })` holds the table's first row — the primary
120
+ * contact — which the user may re-pick.
121
+ * - `source: fill.pick({ brief })` lets the model pick the row out of `from`; the user
122
+ * may re-pick it.
123
+ * - inside an item function, `source: el` holds the item's own element, a row of `from`.
124
+ * - `source:` another section's row, or a sibling row, mirrors that row; a `compute(…)`
125
+ * holds the row it returns, or nothing — a list's first row among them
126
+ * (`compute({ reads: [agents] }, (rows) => rows[0] ?? null)`): a list is never a source.
127
+ * - `from: unit.floor_plans`, a table row's list-valued member, with `source: entry`
128
+ * inside the list over that member, holds one of its items and reads its keys
129
+ * (`plan.image`, `plan.floor`), each read-only.
130
+ *
131
+ * Siblings read it as they read any slot: as a field of the same object, or at the top
132
+ * level. A row the user re-picks is a field of an object, whose card shows its bar; a
133
+ * slot outside that object still reads its members, and another section mirrors it by
134
+ * the object's field ref (`Hero.slots.agent.fields.contact`). `locked: true` hides the
135
+ * row's bar and keeps the reads.
136
+ * @example
137
+ * ```ts
138
+ * import { fact, object, row, text } from "@homepages/concrete";
139
+ *
140
+ * const agent = row({ label: "Agent", from: fact.property.contacts });
141
+ * object({
142
+ * label: "Listing agent",
143
+ * fields: {
144
+ * agent,
145
+ * name: text.short({ label: "Name", source: agent.name }),
146
+ * phone: text.short({ label: "Phone", source: agent.phone }),
147
+ * },
148
+ * });
149
+ * ```
150
+ */
151
+ declare function row<const From extends RowFromInput, const Source extends RowSourceInput | undefined = undefined>(opts: RowOptions<From, Source> & {
152
+ source?: Source & FitsFrom<Source, From>;
153
+ }): RowFrom<From>;
154
+ //#endregion
155
+ export { MemberListSource, RowFill, RowFromInput, RowOf, RowOptions, RowSlotDef, RowSourceInput, TableSource, row };