@homepages/concrete 8.0.0 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/CHANGELOG.md +1005 -0
  2. package/README.md +20 -9
  3. package/codemods/list-grammar.mjs +923 -0
  4. package/codemods/manifest.json +64 -0
  5. package/codemods/process-builders.mjs +198 -0
  6. package/codemods/slot-object.mjs +1097 -0
  7. package/codemods/steps/content-object-fields.mjs +324 -0
  8. package/codemods/steps/list-object-form.mjs +6 -7
  9. package/codemods/table-rows.mjs +568 -0
  10. package/codemods/unwrap-object-fields.mjs +310 -0
  11. package/codemods/viewer-slot-document.mjs +131 -0
  12. package/codemods/write-property-as-facts-document.mjs +716 -0
  13. package/codemods/write-the-address-line.mjs +255 -0
  14. package/codemods/write-the-registry-members.mjs +653 -0
  15. package/codemods/write-the-select-from.mjs +141 -0
  16. package/codemods/write-the-sole-from.mjs +369 -0
  17. package/codemods/write-the-table-from.mjs +267 -0
  18. package/codemods/write-the-whole-item.mjs +512 -0
  19. package/codemods/writeback-drop.mjs +168 -0
  20. package/codemods/written-contact-address.mjs +162 -0
  21. package/codemods/written-media-category.mjs +227 -0
  22. package/codemods/written-ref-kinds-name-the-layer.mjs +172 -0
  23. package/codemods/written-uploads-replace-pool-reads.mjs +454 -0
  24. package/codemods/written-uploads-sort-into-lists.mjs +405 -0
  25. package/codemods/written-uploads-stated-in-sorted-lists.mjs +295 -0
  26. package/codemods/written-video-sources-drop.mjs +144 -0
  27. package/codemods/written-without-pick-none.mjs +146 -0
  28. package/codemods/written-without-retired-knowledge.mjs +223 -0
  29. package/codemods/written-without-the-media-key.mjs +202 -0
  30. package/codemods/written-without-the-property-type.mjs +249 -0
  31. package/dist/artifact/playground/client/assets/index-BOYbgBnP.js +1259 -0
  32. package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +1 -0
  33. package/dist/artifact/playground/client/index.html +2 -2
  34. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
  35. package/dist/artifact/playground/host.mjs +61 -27
  36. package/dist/base.css +58 -1
  37. package/dist/cli/build/artifact.js +6 -9
  38. package/dist/cli/build/captures.js +2 -12
  39. package/dist/cli/build/esbuild.js +1 -25
  40. package/dist/cli/build/fixtures.js +2 -1
  41. package/dist/cli/build/icons.js +1 -1
  42. package/dist/cli/build/static.js +2 -2
  43. package/dist/cli/capture/capture.js +8 -9
  44. package/dist/cli/check/analyze.js +8 -1
  45. package/dist/cli/check/load-outdir.js +47 -0
  46. package/dist/cli/check/load-workspace.js +4 -4
  47. package/dist/cli/check/render/html.js +1 -2
  48. package/dist/cli/check/render/inputs.js +10 -3
  49. package/dist/cli/check/render/island-frames.js +2 -1
  50. package/dist/cli/check/render/marker-coverage.js +23 -15
  51. package/dist/cli/check/report.js +5 -0
  52. package/dist/cli/check/stages/bundles.js +1 -1
  53. package/dist/cli/check/stages/relations.js +1 -1
  54. package/dist/cli/check/stages/render.js +48 -33
  55. package/dist/cli/check/stages/sections.js +83 -31
  56. package/dist/cli/check/stages/workspace.js +2 -0
  57. package/dist/cli/check/template-key.js +16 -0
  58. package/dist/cli/commands.js +1 -1
  59. package/dist/cli/dev/crop.js +1 -1
  60. package/dist/cli/dev/fixture-ladders.js +96 -0
  61. package/dist/cli/dev/islands.js +12 -123
  62. package/dist/cli/dev/listen.js +20 -1
  63. package/dist/cli/dev/load-template.js +1 -1
  64. package/dist/cli/dev/server.js +35 -10
  65. package/dist/cli/dev/vite.js +9 -7
  66. package/dist/cli/dev/workspace-reader.js +16 -16
  67. package/dist/cli/media/derive.js +43 -57
  68. package/dist/cli/media/frame-rung-floor.js +0 -1
  69. package/dist/cli/property/index.js +1 -6
  70. package/dist/css/inline.js +1 -22
  71. package/dist/eslint/rules/no-marker-literal.js +1 -1
  72. package/dist/fixtures/load.js +16 -7
  73. package/dist/fixtures/media-plugin.js +17 -12
  74. package/dist/fixtures/media-store.js +115 -0
  75. package/dist/fixtures/property.js +345 -126
  76. package/dist/fixtures/resolve.js +260 -251
  77. package/dist/fixtures/rows.js +4 -11
  78. package/dist/fixtures.d.ts +234 -109
  79. package/dist/index.d.ts +25 -16
  80. package/dist/index.js +10 -6
  81. package/dist/islands/marker.js +2 -1
  82. package/dist/packages/external/concrete/package.js +1 -1
  83. package/dist/packages/internal/canvas-core/dist/island-host.js +62 -0
  84. package/dist/packages/internal/canvas-core/dist/island-shields.js +30 -0
  85. package/dist/packages/internal/capture-settle/dist/index.js +3 -0
  86. package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +13 -0
  87. package/dist/packages/internal/capture-settle/dist/island-markers.js +6 -0
  88. package/dist/packages/internal/capture-settle/dist/settle.js +150 -0
  89. package/dist/packages/internal/{image-ladder/dist/crop.js → crop-region/dist/index.js} +21 -20
  90. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +250 -46
  91. package/dist/packages/internal/fill-bake/dist/compute-reads.js +361 -4
  92. package/dist/packages/internal/fill-bake/dist/derive-source.js +25 -18
  93. package/dist/packages/internal/fill-bake/dist/index.js +9 -3
  94. package/dist/packages/internal/fill-bake/dist/item-merge.js +113 -0
  95. package/dist/packages/internal/fill-bake/dist/item-overrides.js +1 -0
  96. package/dist/packages/internal/fill-bake/dist/linked-merge.js +38 -0
  97. package/dist/packages/internal/fill-bake/dist/list-grammar.js +174 -0
  98. package/dist/packages/internal/fill-bake/dist/stored-row-reader.js +1 -0
  99. package/dist/packages/internal/fill-vocabulary/dist/holder.js +51 -0
  100. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +363 -0
  101. package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -23
  102. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +60 -0
  103. package/dist/packages/internal/format-geometry/dist/capture.js +11 -147
  104. package/dist/packages/internal/format-geometry/dist/format.d.ts +8 -2
  105. package/dist/packages/internal/format-geometry/dist/geometry.js +13 -2
  106. package/dist/packages/internal/image-ladder/dist/encode.js +27 -14
  107. package/dist/packages/internal/image-ladder/dist/index.js +3 -3
  108. package/dist/packages/internal/image-ladder/dist/policy.js +28 -53
  109. package/dist/packages/internal/island-runtime/dist/capture-holds.js +1 -1
  110. package/dist/packages/internal/island-runtime/dist/contract.d.ts +3 -12
  111. package/dist/packages/internal/island-runtime/dist/contract.js +2 -2
  112. package/dist/packages/internal/island-runtime/dist/index.d.ts +3 -7
  113. package/dist/packages/internal/island-runtime/dist/index.js +2 -1
  114. package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +1 -1
  115. package/dist/packages/internal/media-resolution/dist/crop-key.js +7 -0
  116. package/dist/packages/internal/media-resolution/dist/document.js +63 -0
  117. package/dist/packages/internal/media-resolution/dist/image.js +226 -0
  118. package/dist/packages/internal/media-resolution/dist/index.js +11 -0
  119. package/dist/packages/internal/media-resolution/dist/list.js +112 -0
  120. package/dist/packages/internal/media-resolution/dist/media.js +59 -0
  121. package/dist/packages/internal/media-resolution/dist/records.js +7 -0
  122. package/dist/packages/internal/media-resolution/dist/slot.js +37 -0
  123. package/dist/packages/internal/media-resolution/dist/store.js +19 -0
  124. package/dist/packages/internal/media-resolution/dist/tour.js +59 -0
  125. package/dist/packages/internal/media-resolution/dist/video.js +93 -0
  126. package/dist/packages/internal/property-facts/dist/registry-facts.js +245 -0
  127. package/dist/packages/internal/section-contracts/dist/cap-contract.js +8 -17
  128. package/dist/packages/internal/section-contracts/dist/catalog.js +34 -14
  129. package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +11 -2
  130. package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +21 -0
  131. package/dist/packages/internal/section-contracts/dist/fill-options.js +12 -0
  132. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +1 -5
  133. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +95 -0
  134. package/dist/packages/internal/section-contracts/dist/grammar-scope.js +154 -0
  135. package/dist/packages/internal/section-contracts/dist/index.js +7 -2
  136. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +2 -36
  137. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +12 -21
  138. package/dist/packages/internal/section-contracts/dist/list-source-contract.js +46 -0
  139. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +11 -2
  140. package/dist/packages/internal/section-contracts/dist/object-contract.js +92 -0
  141. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +9 -5
  142. package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +63 -0
  143. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -17
  144. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +80 -0
  145. package/dist/packages/internal/section-contracts/dist/row-source-contract.js +67 -0
  146. package/dist/packages/internal/section-contracts/dist/runners.js +77 -18
  147. package/dist/packages/internal/section-contracts/dist/select-contract.js +0 -8
  148. package/dist/packages/internal/section-contracts/dist/source-contract.js +89 -95
  149. package/dist/packages/internal/section-contracts/dist/sources-contract.js +47 -17
  150. package/dist/packages/internal/section-contracts/dist/table-member.js +16 -0
  151. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +39 -23
  152. package/dist/packages/internal/source-resolution/dist/index.js +113 -73
  153. package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +16 -0
  154. package/dist/packages/internal/street-address/dist/index.js +72 -0
  155. package/dist/packages/internal/template-artifact/dist/asset-mime.js +30 -0
  156. package/dist/packages/internal/template-artifact/dist/layout.js +1 -2
  157. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
  158. package/dist/packages/internal/template-artifact/dist/verify.js +12 -29
  159. package/dist/packages/internal/template-contracts/dist/address-value.d.ts +52 -0
  160. package/dist/packages/internal/template-contracts/dist/address-value.js +90 -0
  161. package/dist/packages/internal/template-contracts/dist/comparable-address.js +19 -0
  162. package/dist/{schema → packages/internal/template-contracts/dist}/compute.d.ts +29 -6
  163. package/dist/{schema → packages/internal/template-contracts/dist}/compute.js +11 -13
  164. package/dist/packages/internal/template-contracts/dist/content-pick.js +51 -0
  165. package/dist/packages/internal/template-contracts/dist/decision-fills.js +81 -0
  166. package/dist/packages/internal/template-contracts/dist/display-overrides.js +7 -0
  167. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +16 -5
  168. package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +24 -0
  169. package/dist/packages/internal/template-contracts/dist/fact-compute.js +30 -0
  170. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +44 -0
  171. package/dist/packages/internal/template-contracts/dist/fact-keys.js +88 -0
  172. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +290 -0
  173. package/dist/packages/internal/template-contracts/dist/fact-registry.js +598 -0
  174. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +10 -24
  175. package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +157 -0
  176. package/dist/packages/internal/template-contracts/dist/fill-builders.js +79 -0
  177. package/dist/packages/internal/template-contracts/dist/fill-declaration.d.ts +14 -0
  178. package/dist/{schema → packages/internal/template-contracts/dist}/fill-declaration.js +6 -5
  179. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +93 -0
  180. package/dist/packages/internal/template-contracts/dist/fill-spec.js +291 -0
  181. package/dist/packages/internal/template-contracts/dist/findable.js +8 -0
  182. package/dist/packages/internal/template-contracts/dist/floor-presets.js +13 -0
  183. package/dist/packages/internal/template-contracts/dist/icon-names.d.ts +5 -0
  184. package/dist/packages/internal/template-contracts/dist/icon-names.js +70 -0
  185. package/dist/packages/internal/template-contracts/dist/legacy-facts.js +167 -0
  186. package/dist/packages/internal/template-contracts/dist/list-editing.js +93 -0
  187. package/dist/packages/internal/template-contracts/dist/list.d.ts +215 -0
  188. package/dist/packages/internal/template-contracts/dist/list.js +258 -0
  189. package/dist/packages/internal/template-contracts/dist/markers.d.ts +2 -2
  190. package/dist/packages/internal/template-contracts/dist/media-candidates.js +38 -0
  191. package/dist/packages/internal/template-contracts/dist/mirror-kind.js +48 -0
  192. package/dist/packages/internal/template-contracts/dist/number-display.js +10 -0
  193. package/dist/packages/internal/template-contracts/dist/object.d.ts +89 -0
  194. package/dist/packages/internal/template-contracts/dist/object.js +131 -0
  195. package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +1 -1
  196. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.d.ts +1 -0
  197. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +162 -0
  198. package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +77 -0
  199. package/dist/packages/internal/template-contracts/dist/process-builders.js +73 -0
  200. package/dist/packages/internal/template-contracts/dist/read-graph.js +240 -0
  201. package/dist/packages/internal/template-contracts/dist/ref-locate.js +176 -0
  202. package/dist/packages/internal/template-contracts/dist/registry-aliases.js +77 -0
  203. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +270 -0
  204. package/dist/packages/internal/template-contracts/dist/registry-facts.js +202 -0
  205. package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +41 -0
  206. package/dist/packages/internal/template-contracts/dist/registry-shape.js +135 -0
  207. package/dist/packages/internal/template-contracts/dist/resolve-scope.js +103 -0
  208. package/dist/packages/internal/{image-descriptor/dist/index.d.ts → template-contracts/dist/responsive-image.d.ts} +1 -1
  209. package/dist/packages/internal/template-contracts/dist/row-planners.js +29 -0
  210. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +127 -0
  211. package/dist/packages/internal/template-contracts/dist/row-ref.js +101 -0
  212. package/dist/packages/internal/template-contracts/dist/row-sources.js +41 -5
  213. package/dist/packages/internal/template-contracts/dist/row.d.ts +155 -0
  214. package/dist/packages/internal/template-contracts/dist/row.js +84 -0
  215. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +97 -0
  216. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +782 -0
  217. package/dist/packages/internal/template-contracts/dist/slot-builders.js +233 -0
  218. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +233 -405
  219. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +331 -227
  220. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +21 -0
  221. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +155 -0
  222. package/dist/packages/internal/template-contracts/dist/slot-ref.js +76 -0
  223. package/dist/packages/internal/template-contracts/dist/slot-types.d.ts +163 -0
  224. package/dist/packages/internal/template-contracts/dist/slot-types.js +139 -0
  225. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +95 -0
  226. package/dist/packages/internal/template-contracts/dist/table-members.d.ts +25 -0
  227. package/dist/packages/internal/template-contracts/dist/table-members.js +90 -0
  228. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +5 -5
  229. package/dist/packages/internal/template-contracts/dist/value-contracts.js +15 -0
  230. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +2 -2
  231. package/dist/platform/fs.js +5 -2
  232. package/dist/playground/canvas-island-host.d.ts +11 -0
  233. package/dist/playground/canvas-island-host.js +29 -0
  234. package/dist/playground/canvas-markers.js +14 -0
  235. package/dist/playground-island-runtime.d.ts +3 -2
  236. package/dist/playground-island-runtime.js +3 -2
  237. package/dist/primitives/FrameShell.js +0 -1
  238. package/dist/primitives/Image.d.ts +5 -4
  239. package/dist/primitives/Tour.d.ts +1 -1
  240. package/dist/primitives/Video.d.ts +2 -2
  241. package/dist/primitives/index.d.ts +2 -3
  242. package/dist/primitives/picture-sources.js +2 -2
  243. package/dist/primitives/probe-context.js +2 -12
  244. package/dist/primitives/slot-address.d.ts +44 -0
  245. package/dist/primitives/slot-address.js +19 -0
  246. package/dist/primitives/slot-bindings.d.ts +65 -26
  247. package/dist/primitives/slot-bindings.js +104 -46
  248. package/dist/primitives/slot-document.d.ts +23 -18
  249. package/dist/primitives/slot-document.js +39 -14
  250. package/dist/primitives/slot-download.d.ts +39 -0
  251. package/dist/primitives/slot-download.js +39 -0
  252. package/dist/primitives/slot-list.d.ts +3 -3
  253. package/dist/primitives/slot-list.js +0 -2
  254. package/dist/primitives/slot-media.d.ts +24 -5
  255. package/dist/primitives/slot-media.js +6 -9
  256. package/dist/primitives/slot-object.d.ts +49 -0
  257. package/dist/primitives/slot-object.js +20 -0
  258. package/dist/primitives/slot-scalar.d.ts +27 -2
  259. package/dist/primitives/slot-scalar.js +50 -7
  260. package/dist/primitives/slot.d.ts +13 -6
  261. package/dist/primitives/slot.js +10 -3
  262. package/dist/rules/registry.js +25 -30
  263. package/dist/schema/define-schema.d.ts +4 -8
  264. package/dist/schema/define-schema.js +178 -79
  265. package/dist/schema/extract-fill-spec.js +2 -153
  266. package/dist/schema/fact.d.ts +57 -15
  267. package/dist/schema/fact.js +42 -7
  268. package/dist/schema/facts-view.d.ts +14 -0
  269. package/dist/schema/format.d.ts +1 -0
  270. package/dist/schema/format.js +2 -1
  271. package/dist/schema/manifest.js +24 -0
  272. package/dist/schema/property-facts.d.ts +8 -12
  273. package/dist/schema/section-props.d.ts +2 -66
  274. package/dist/schema/section-schema.d.ts +8 -11
  275. package/dist/schema/section-schema.js +27 -10
  276. package/dist/section/declare.d.ts +18 -7
  277. package/dist/section/declare.js +18 -5
  278. package/dist/section/materialize.js +3 -8
  279. package/dist/section/section.d.ts +12 -8
  280. package/dist/section/section.js +1 -1
  281. package/dist/template/logic-shim.d.ts +14 -7
  282. package/dist/template/logic-shim.js +14 -7
  283. package/dist/template/materialize.js +17 -18
  284. package/dist/template/mirror-types.js +30 -31
  285. package/dist/template/section-reads.js +85 -9
  286. package/guide/reference/cli/INDEX.md +2 -2
  287. package/guide/reference/cli/build.md +1 -1
  288. package/guide/reference/cli/check.md +1 -1
  289. package/guide/reference/cli/dev.md +1 -1
  290. package/guide/reference/cli/property-add.md +1 -1
  291. package/guide/reference/cli/property-list.md +2 -2
  292. package/guide/reference/cli/publish.md +1 -1
  293. package/guide/reference/cli/upgrade.md +1 -1
  294. package/guide/reference/rules/INDEX.md +29 -25
  295. package/package.json +9 -8
  296. package/dist/artifact/playground/client/assets/index-CckS2ONm.css +0 -1
  297. package/dist/artifact/playground/client/assets/index-Dn_xT16-.js +0 -1101
  298. package/dist/fixtures/canonical.d.ts +0 -166
  299. package/dist/fixtures/media.js +0 -163
  300. package/dist/packages/internal/fill-vocabulary/dist/origination.js +0 -51
  301. package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +0 -15
  302. package/dist/packages/internal/format-geometry/dist/index.js +0 -4
  303. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +0 -10
  304. package/dist/packages/internal/property-facts/dist/index.js +0 -3
  305. package/dist/packages/internal/property-facts/dist/property-facts-Cy7-O4p0.js +0 -189
  306. package/dist/packages/internal/section-contracts/dist/group-contract.js +0 -19
  307. package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +0 -24
  308. package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -22
  309. package/dist/packages/internal/template-contracts/dist/facts-view.js +0 -104
  310. package/dist/packages/internal/template-contracts/dist/select-key.js +0 -7
  311. package/dist/primitives/slot-group.d.ts +0 -40
  312. package/dist/primitives/slot-group.js +0 -36
  313. package/dist/schema/extract-used-facts.js +0 -34
  314. package/dist/schema/fill-builders.d.ts +0 -115
  315. package/dist/schema/fill-builders.js +0 -25
  316. package/dist/schema/fill-declaration.d.ts +0 -14
  317. package/dist/schema/fill-spec.js +0 -98
  318. package/dist/schema/layout.d.ts +0 -30
  319. package/dist/schema/layout.js +0 -14
  320. package/dist/schema/row-fields.js +0 -88
  321. package/dist/schema/row-ref.d.ts +0 -59
  322. package/dist/schema/row-ref.js +0 -28
  323. package/dist/schema/runtime-values.d.ts +0 -71
  324. package/dist/schema/section-nav.js +0 -14
  325. package/dist/schema/slot-builders.d.ts +0 -633
  326. package/dist/schema/slot-builders.js +0 -177
  327. package/dist/schema/slot-ref.d.ts +0 -79
  328. package/dist/schema/slot-ref.js +0 -41
  329. package/dist/schema/slot-types.d.ts +0 -111
  330. package/dist/schema/slot-types.js +0 -214
  331. package/dist/section/groups.js +0 -68
@@ -1,26 +1,40 @@
1
- import { COLLECTIONS } from "../packages/internal/template-contracts/dist/slot-catalog.js";
2
- import { getComputed } from "../schema/compute.js";
3
- import { isSerializedSlotRef } from "../schema/slot-ref.js";
4
- import { buildReadGraph } from "../template/section-reads.js";
5
- import { readFact } from "../packages/internal/template-contracts/dist/facts-view.js";
6
- import { buildDeriveFactsView } from "../packages/internal/property-facts/dist/derive-facts-view.js";
7
- import { bakeDisplayEntries, bakePropertyRefSlots, projectComputedRows, rowComputesOf } from "../packages/internal/fill-bake/dist/bake-property-ref.js";
1
+ import { normalizeAddressValue } from "../packages/internal/template-contracts/dist/address-value.js";
2
+ import { REGISTRY_TABLE_KEYS, declaredKinds, isEmailValue, isIsoDateValue, isMediaType, isPhoneValue } from "../packages/internal/template-contracts/dist/slot-catalog.js";
3
+ import { getComputed } from "../packages/internal/template-contracts/dist/compute.js";
4
+ import { heldRowTableOf, listTableOf, placementOf, rowTablesOf } from "../packages/internal/template-contracts/dist/ref-locate.js";
5
+ import { fillSpecFromSchema } from "../schema/extract-fill-spec.js";
6
+ import { elementRowKeys, listSourceOf, memberSourceOf } from "../packages/internal/template-contracts/dist/row-sources.js";
7
+ import { objectFieldSlotId } from "../packages/internal/template-contracts/dist/slot-overrides.js";
8
+ import { tableRowIds } from "../packages/internal/source-resolution/dist/index.js";
9
+ import { bakeDisplayEntries, bakePropertyRefSlots } from "../packages/internal/fill-bake/dist/bake-property-ref.js";
10
+ import { applyComputeReads } from "../packages/internal/fill-bake/dist/compute-reads.js";
8
11
  import "../packages/internal/fill-bake/dist/index.js";
9
12
  import { canonicalizeProperty, contactImageId } from "./property.js";
10
- import { blankForField, canonicalizeRows } from "./rows.js";
13
+ import { blankForField } from "./rows.js";
11
14
 
12
15
  //#region src/fixtures/resolve.ts
13
- const MEDIA_KINDS = /* @__PURE__ */ new Set([
14
- "image",
15
- "video",
16
- "tour",
17
- "document"
18
- ]);
16
+ const VALIDATED_KINDS = {
17
+ date: {
18
+ admits: (value) => value === null || isIsoDateValue(value),
19
+ expected: "a real calendar day written \"YYYY-MM-DD\", or null for none"
20
+ },
21
+ email: {
22
+ admits: (value) => value == null || value === "" || isEmailValue(value),
23
+ expected: "an email address"
24
+ },
25
+ phone: {
26
+ admits: (value) => value == null || value === "" || isPhoneValue(value),
27
+ expected: "a phone number a dialer can call"
28
+ }
29
+ };
19
30
  function emptyValueFor(type) {
20
- return type === "list" ? [] : null;
31
+ if (type === "list") return [];
32
+ return type === "object" ? {} : null;
21
33
  }
22
34
  function isEmptyValue(value, type) {
23
- return type === "list" ? Array.isArray(value) && value.length === 0 : value === null || value === void 0;
35
+ if (type === "list") return Array.isArray(value) && value.length === 0;
36
+ if (type === "object") return typeof value === "object" && value !== null && Object.keys(value).length === 0;
37
+ return value === null || value === void 0;
24
38
  }
25
39
  function uniquePlacements(placements) {
26
40
  const seen = /* @__PURE__ */ new Set();
@@ -51,29 +65,50 @@ function resolveFixture(loaded, options) {
51
65
  if (entriesByInstance.has(instance)) throw new Error(`Fixture "${loaded.id}" (${module}) states content twice for instance "${instance}".`);
52
66
  entriesByInstance.set(instance, entry);
53
67
  }
54
- const settled = /* @__PURE__ */ new Map();
55
- const byInstance = /* @__PURE__ */ new Map();
56
- for (const placement of computeOrder(placements)) {
57
- const resolved = resolveInstance(placement, entriesByInstance.get(placement.instance), {
58
- facts,
59
- media,
60
- module,
61
- fixtureId: loaded.id,
62
- log: options.log,
63
- violations,
64
- settled
65
- });
66
- byInstance.set(placement.instance, resolved);
67
- if (!settled.has(placement.key)) settled.set(placement.key, resolved.settled);
68
- }
68
+ const ctx = {
69
+ facts,
70
+ media,
71
+ module,
72
+ fixtureId: loaded.id,
73
+ log: options.log,
74
+ violations
75
+ };
76
+ const filled = placements.map((placement) => fillInstance(placement, entriesByInstance.get(placement.instance), ctx));
77
+ const pages = [{
78
+ id: "fixture",
79
+ sections: placements.map((p) => ({
80
+ section: p.key,
81
+ instance_id: p.instance
82
+ }))
83
+ }];
84
+ const settled = applyComputeReads({
85
+ contentDoc: { instances: filled.map((f) => f.instance) },
86
+ facts,
87
+ sections: new Map(filled.map((f) => [f.instance.instance_id, f.section])),
88
+ placement: placementOf(pages)
89
+ }).contentDoc;
69
90
  const instances = [];
70
91
  const provenance = {};
71
- for (const placement of placements) {
72
- const resolved = byInstance.get(placement.instance);
73
- if (resolved === void 0) continue;
74
- instances.push(resolved.instance);
75
- provenance[placement.instance] = resolved.provenance;
76
- }
92
+ settled.instances.forEach((instance, index) => {
93
+ const { placement, values } = filled[index];
94
+ const schemaSlots = placement.section.schema.slots;
95
+ const slots = {};
96
+ const provenanceOf = {};
97
+ for (const [id, def] of Object.entries(schemaSlots)) {
98
+ const cases = def.variant?.cases;
99
+ if (cases !== void 0 && (instance.variant === void 0 || !cases.includes(instance.variant))) continue;
100
+ slots[id] = instance.slots[id];
101
+ provenanceOf[id] = provenanceFor(def, id, values[id], slots[id], facts);
102
+ }
103
+ instances.push({
104
+ instance_id: instance.instance_id,
105
+ section_key: placement.section.key,
106
+ enabled: instance.enabled,
107
+ ...instance.variant === void 0 ? {} : { variant: instance.variant },
108
+ slots
109
+ });
110
+ provenance[instance.instance_id] = provenanceOf;
111
+ });
77
112
  return {
78
113
  resolved: {
79
114
  id: loaded.id,
@@ -88,254 +123,226 @@ function resolveFixture(loaded, options) {
88
123
  violations
89
124
  };
90
125
  }
91
- function computeOrder(placements) {
92
- const sections = /* @__PURE__ */ new Map();
93
- for (const placement of placements) if (!sections.has(placement.key)) sections.set(placement.key, placement.section);
94
- const rank = new Map(buildReadGraph(sections).order.map((key, index) => [key, index]));
95
- return [...placements].sort((a, b) => (rank.get(a.key) ?? 0) - (rank.get(b.key) ?? 0));
96
- }
97
- function valuesFor(reads, facts, settled, own) {
98
- return reads.map((ref) => {
99
- if (ref.kind === "fact") return readFact(facts, ref.key);
100
- if (ref.kind === "row") return void 0;
101
- if (ref.section === own?.section) return own.slots[ref.slot];
102
- const from = settled.get(ref.section);
103
- if (from === void 0) return void 0;
104
- if (ref.slot === "display.visibility") return from.visibility;
105
- if (ref.slot === "display.variant") return from.variant;
106
- return from.slots[ref.slot];
107
- });
108
- }
109
- function sameSectionOrder(sectionKey, declared) {
110
- const ordered = [];
111
- const visited = /* @__PURE__ */ new Set();
112
- const visit = (id) => {
113
- const slot = declared.get(id);
114
- if (slot === void 0 || visited.has(id)) return;
115
- visited.add(id);
116
- for (const ref of slot.reads) if (isSerializedSlotRef(ref) && ref.section === sectionKey) visit(ref.slot);
117
- ordered.push([id, slot]);
118
- };
119
- for (const id of declared.keys()) visit(id);
120
- return ordered;
121
- }
122
- function declaredReads(source) {
123
- if (typeof source !== "object" || source === null) return [];
124
- const reads = source.reads;
125
- return Array.isArray(reads) ? reads : [];
126
- }
127
- function runDeclared(fns, transform, values) {
128
- const fn = fns[transform];
129
- if (fn === void 0) return null;
126
+ function pickDecisions(schema) {
130
127
  try {
131
- return { value: fn(...values) };
128
+ return fillSpecFromSchema(schema).decisions;
132
129
  } catch {
133
- return null;
130
+ return [];
134
131
  }
135
132
  }
136
- function constantComputed(schema) {
137
- const declared = /* @__PURE__ */ new Set();
138
- const record = (source) => {
139
- const reads = declaredReads(source);
140
- const transform = source?.transform;
141
- if (reads.length > 0 && typeof transform === "string") declared.add(transform);
142
- };
143
- for (const slot of Object.values(schema.slots)) record(slot.source);
144
- const display = schema.meta.display;
145
- for (const entry of ["visibility", "variant"]) record(display?.[entry]?.source);
146
- return Object.fromEntries(Object.entries(getComputed(schema)).filter(([handle]) => !declared.has(handle)));
147
- }
148
- function resolveInstance(placement, entry, ctx) {
133
+ function fillInstance(placement, entry, ctx) {
149
134
  const section = placement.section;
150
135
  const { schema } = section;
151
- const bakeCtx = {
152
- computed: constantComputed(schema),
136
+ const schemaSlots = schema.slots;
137
+ const bakeContext = {
138
+ computed: getComputed(schema),
153
139
  section_key: section.key,
154
140
  log: ctx.log
155
141
  };
156
- const baked = bakePropertyRefSlots(schema, ctx.facts, bakeCtx);
157
- const display = schema.meta.display ?? {};
158
- const resolvedDisplay = bakeDisplayEntries({ display }, ctx.facts, bakeCtx);
159
- const computeFns = getComputed(schema);
160
- const factsView = buildDeriveFactsView(ctx.facts);
142
+ const decisions = pickDecisions(schema);
161
143
  const values = entry?.values ?? {};
162
- const slotPass = {
163
- placement,
164
- values,
165
- baked,
166
- computeFns,
167
- factsView,
168
- bakeCtx
144
+ const fill = {
145
+ decisions,
146
+ heldRows: {},
147
+ at: (slot) => ({
148
+ ...ctx,
149
+ instance: placement.instance,
150
+ slot
151
+ })
169
152
  };
170
- let ungated;
171
- for (const [entryName, entryDef] of Object.entries(display)) {
172
- const reads = declaredReads(entryDef?.source);
173
- const transform = entryDef?.source?.transform;
174
- if (reads.length === 0 || typeof transform !== "string") continue;
175
- let own;
176
- if (reads.some((ref) => isSerializedSlotRef(ref) && ref.section === section.key)) {
177
- ungated ??= buildSlots(slotPass, {
178
- ...ctx,
179
- violations: [],
180
- log: void 0
181
- }, null).slots;
182
- own = {
183
- section: section.key,
184
- slots: ungated
185
- };
186
- }
187
- const answered = runDeclared(computeFns, transform, valuesFor(reads, factsView, ctx.settled, own));
188
- const answer = typeof answered?.value === "string" ? answered.value : "";
189
- if (entryDef?.cases?.includes(answer) === true) resolvedDisplay[entryName] = answer;
190
- else delete resolvedDisplay[entryName];
153
+ const stated = {};
154
+ for (const [id, def] of Object.entries(schemaSlots)) {
155
+ const value = statedValue(fill, def, id, values[id], true);
156
+ if (value !== void 0) stated[id] = value;
157
+ reportRows(ctx, placement.instance, def, id, values[id]);
191
158
  }
192
- const visibility = resolvedDisplay.visibility ?? display.visibility?.cases?.[0];
193
- const enabled = typeof values.enabled === "boolean" ? values.enabled : visibility === void 0 ? true : visibility !== "hidden";
159
+ const bakeScope = {
160
+ decisions,
161
+ heldRows: fill.heldRows,
162
+ stored: stated
163
+ };
164
+ const baked = bakePropertyRefSlots(schema, ctx.facts, bakeContext, bakeScope);
165
+ const slots = {};
166
+ for (const [id, def] of Object.entries(schemaSlots)) slots[id] = slotValue(def, id, Object.hasOwn(baked, id) ? { value: baked[id] } : void 0, stated[id], decisions);
167
+ const display = schema.meta.display ?? {};
168
+ const baked_display = bakeDisplayEntries({
169
+ display,
170
+ slots: schemaSlots
171
+ }, ctx.facts, bakeContext, bakeScope);
172
+ const visibility = baked_display.visibility ?? display.visibility?.cases?.[0];
194
173
  const declaredCases = display.variant?.cases;
195
- let variant = resolvedDisplay.variant ?? declaredCases?.[0];
196
- if (typeof values.variant === "string") {
197
- if (declaredCases?.includes(values.variant) !== true) throw new Error(`Fixture "${ctx.fixtureId}" (${ctx.module}): content for "${placement.instance}" names variant "${values.variant}", which section "${section.key}" does not declare.`);
198
- variant = values.variant;
199
- }
200
- const { slots, provenance } = buildSlots(slotPass, ctx, { variant });
174
+ if (typeof values.variant === "string" && declaredCases?.includes(values.variant) !== true) throw new Error(`Fixture "${ctx.fixtureId}" (${ctx.module}): content for "${placement.instance}" names variant "${values.variant}", which section "${section.key}" does not declare.`);
175
+ const variant = typeof values.variant === "string" ? values.variant : baked_display.variant ?? declaredCases?.[0];
176
+ const overrides = {
177
+ ...typeof values.enabled === "boolean" ? { visibility: true } : {},
178
+ ...typeof values.variant === "string" ? { variant: true } : {}
179
+ };
201
180
  return {
181
+ placement,
202
182
  instance: {
203
183
  instance_id: placement.instance,
204
- section_key: section.key,
205
- enabled,
184
+ enabled: typeof values.enabled === "boolean" ? values.enabled : visibility === void 0 ? true : visibility !== "hidden",
206
185
  ...variant === void 0 ? {} : { variant },
207
- slots
208
- },
209
- provenance,
210
- settled: {
211
186
  slots,
212
- visibility: resolvedDisplay.visibility ?? display.visibility?.cases?.[0],
213
- variant
214
- }
187
+ ...Object.keys(overrides).length === 0 ? {} : { display_overrides: overrides }
188
+ },
189
+ section: {
190
+ localKey: section.key,
191
+ schema: {
192
+ slots: schema.slots,
193
+ display
194
+ },
195
+ bakeContext
196
+ },
197
+ values
215
198
  };
216
199
  }
217
- function buildSlots(pass, ctx, gate) {
218
- const { placement, values, baked, computeFns, factsView, bakeCtx } = pass;
219
- const section = placement.section;
220
- const slots = {};
221
- const provenance = {};
222
- const declared = /* @__PURE__ */ new Map();
223
- for (const [id, def] of Object.entries(section.schema.slots)) {
224
- const cases = def.variant?.cases;
225
- if (gate !== null && cases !== void 0 && (gate.variant === void 0 || !cases.includes(gate.variant))) continue;
226
- const source = def.source;
227
- if (source?.kind === "direct" && typeof source.field === "string") {
228
- const rows = baked[id] ?? null;
229
- const fields = def.type === "list" ? def.fields : void 0;
230
- slots[id] = fields === void 0 ? rows : enrichedRows(source.field, fields, rows, values[id], {
231
- ...ctx,
232
- instance: placement.instance,
233
- slot: id
234
- });
235
- provenance[id] = {
236
- kind: "fact",
237
- ref: source.field
238
- };
239
- continue;
240
- }
241
- if (source?.kind === "derived" && typeof source.transform === "string") {
242
- const reads = declaredReads(source);
243
- if (reads.length > 0) {
244
- const fields = def.type === "list" ? def.fields : void 0;
245
- declared.set(id, {
246
- transform: source.transform,
247
- reads,
248
- type: def.type,
249
- ...fields === void 0 ? {} : { fields }
250
- });
251
- }
252
- slots[id] = baked[id] ?? null;
253
- provenance[id] = {
254
- kind: "computed",
255
- ref: source.transform
200
+ function statedValue(fill, def, path, value, holds) {
201
+ if (value === void 0 || value === null) return void 0;
202
+ if (def.type === "row") {
203
+ if (typeof value !== "string") return void 0;
204
+ if (holds) fill.heldRows[path] = value;
205
+ return value;
206
+ }
207
+ if (def.type === "object") {
208
+ if (!isRecord(value)) return void 0;
209
+ return statedFields(fill, def.fields, path, value, holds);
210
+ }
211
+ if (def.type === "list" && def.element?.type === "object") {
212
+ if (!Array.isArray(value)) return void 0;
213
+ const fields = def.element.fields;
214
+ const table = filledListTable(def);
215
+ const elementRows = elementRowKeys(fields);
216
+ return value.map((item, i) => {
217
+ const record = isRecord(item) ? item : {};
218
+ const out = statedFields(fill, fields, path, record, false);
219
+ const held = elementRows.map((key) => record[key]).find((id) => typeof id === "string" && id !== "");
220
+ return {
221
+ id: table === null ? record["id"] ?? `${path}-${String(i + 1)}` : held ?? record["id"],
222
+ ...out
256
223
  };
257
- continue;
258
- }
259
- const stated = values[id];
260
- if (stated === void 0 || stated === null) {
261
- slots[id] = emptyValueFor(def.type);
262
- provenance[id] = { kind: "empty" };
263
- continue;
264
- }
265
- slots[id] = authoredValue(def, stated, {
266
- ...ctx,
267
- instance: placement.instance,
268
- slot: id
269
224
  });
270
- provenance[id] = { kind: "authored" };
271
225
  }
272
- const own = {
273
- section: section.key,
274
- slots
275
- };
276
- for (const [id, slot] of sameSectionOrder(section.key, declared)) {
277
- const value = runDeclared(computeFns, slot.transform, valuesFor(slot.reads, factsView, ctx.settled, own))?.value ?? emptyValueFor(slot.type);
278
- slots[id] = slot.fields === void 0 ? value : projectComputedRows(value, slot.fields, rowComputesOf(id, slot.fields, () => factsView, bakeCtx));
226
+ if (def.type === "list" && def.element?.type === "row") return Array.isArray(value) ? value.filter((id) => typeof id === "string") : void 0;
227
+ return authoredValue(def, value, fill.at(path));
228
+ }
229
+ function statedFields(fill, fields, path, value, holds) {
230
+ const out = {};
231
+ for (const [key, field] of Object.entries(fields)) {
232
+ const stated = statedValue(fill, field, objectFieldSlotId(path, key), value[key], holds);
233
+ if (stated !== void 0) out[key] = stated;
279
234
  }
280
- return {
281
- slots,
282
- provenance
283
- };
235
+ return out;
236
+ }
237
+ function filledListTable(def) {
238
+ if (listSourceOf(def).kind !== "none" || memberSourceOf(def.source) !== null) return null;
239
+ return listTableOf({ slots: {} }, def);
284
240
  }
285
- function enrichedRows(collection, fields, baked, stated, ctx) {
286
- if (!Array.isArray(baked)) return baked;
287
- if (!Object.hasOwn(COLLECTIONS, collection)) return baked;
288
- const idKey = COLLECTIONS[collection].idKey;
289
- const bakedRows = baked;
290
- const statedRows = Array.isArray(stated) ? stated : [];
291
- if (statedRows.length > bakedRows.length) ctx.violations.push({
241
+ function reportRows(ctx, instance, def, path, value) {
242
+ if (def.type !== "list" || !Array.isArray(value)) return;
243
+ if (listSourceOf(def).kind !== "table") return;
244
+ const table = listTableOf({ slots: {} }, def);
245
+ const carried = table === null ? 0 : tableRowIds(table, ctx.facts).length;
246
+ if (value.length <= carried) return;
247
+ ctx.violations.push({
292
248
  rule: "fixtures/rows-not-in-property",
293
249
  file: ctx.module,
294
- message: `fixture "${ctx.fixtureId}": "${ctx.instance}".${ctx.slot} states ${String(statedRows.length)} rows, but its property carries ${String(bakedRows.length)} — the rows of a bound list are the property's`
250
+ message: `fixture "${ctx.fixtureId}": "${instance}".${path} states ${String(value.length)} items, but its property carries ${String(carried)} — the rows of a list sourced by a table are the property's`
295
251
  });
296
- const blanks = {};
297
- for (const [field, fieldDef] of Object.entries(fields)) if (fieldDef.source === void 0) blanks[field] = blankForField(fieldDef);
298
- return bakedRows.map((row, index) => {
299
- if (typeof row !== "object" || row === null) return row;
300
- const bakedRow = row;
301
- const out = {
302
- [idKey]: bakedRow[idKey],
303
- ...blanks
304
- };
305
- for (const field of Object.keys(fields)) if (field in bakedRow) out[field] = bakedRow[field];
306
- const statedRow = statedRows[index];
307
- if (typeof statedRow !== "object" || statedRow === null || Array.isArray(statedRow)) return out;
308
- for (const [field, fieldDef] of Object.entries(fields)) {
309
- if (fieldDef.source !== void 0) continue;
310
- const value = statedRow[field];
311
- if (value === void 0 || value === null) continue;
312
- out[field] = authoredValue(fieldDef, value, ctx);
252
+ }
253
+ function slotValue(def, path, baked, stated, decisions) {
254
+ if (def.type === "object") {
255
+ const fields = def.fields;
256
+ const bakedFields = isRecord(baked?.value) ? baked.value : {};
257
+ const statedFields = isRecord(stated) ? stated : {};
258
+ const out = {};
259
+ for (const [key, field] of Object.entries(fields)) {
260
+ const fieldPath = objectFieldSlotId(path, key);
261
+ out[key] = Object.hasOwn(bakedFields, key) ? fieldValue(field, fieldPath, { value: bakedFields[key] }, statedFields[key], decisions) : fieldValue(field, fieldPath, void 0, statedFields[key], decisions);
313
262
  }
314
263
  return out;
264
+ }
265
+ if (def.type === "list" && def.element?.type === "object" && Array.isArray(baked?.value)) return itemsValue(def, path, baked.value, stated, decisions);
266
+ if (baked !== void 0) return baked.value ?? emptyValueFor(def.type);
267
+ if (def.source === void 0 && stated !== void 0) return stated;
268
+ return emptyValueFor(def.type);
269
+ }
270
+ function fieldValue(def, path, baked, stated, decisions) {
271
+ if (def.type === "object" || def.type === "list" && def.element?.type === "object" && Array.isArray(baked?.value)) return slotValue(def, path, baked, stated, decisions);
272
+ if (baked !== void 0) return baked.value;
273
+ if (def.source === void 0 && stated !== void 0) return stated;
274
+ return blankForField(def);
275
+ }
276
+ function itemsValue(def, path, items, stated, decisions) {
277
+ const fields = def.element?.fields ?? {};
278
+ const statedItems = Array.isArray(stated) ? stated.filter(isRecord) : [];
279
+ const byIdentity = listSourceOf(def).kind === "none" && memberSourceOf(def.source) === null;
280
+ return items.map((item, i) => {
281
+ const baked = isRecord(item) ? item : {};
282
+ const statedItem = byIdentity ? statedItems.find((candidate) => candidate["id"] === baked["id"]) : statedItems[i];
283
+ const out = { id: baked["id"] };
284
+ for (const [key, field] of Object.entries(fields)) out[key] = fieldValue(field, `${path}.${key}`, Object.hasOwn(baked, key) ? { value: baked[key] } : void 0, statedItem?.[key], decisions);
285
+ return out;
315
286
  });
316
287
  }
288
+ function storedTableKey(key) {
289
+ return key.reading === "legacy" ? key.table : REGISTRY_TABLE_KEYS[key.table];
290
+ }
291
+ function provenanceFor(def, id, stated, value, facts) {
292
+ const source = def.source;
293
+ if (def.type === "object") return { kind: "authored" };
294
+ if (def.type === "row") {
295
+ if (typeof stated === "string") return { kind: "authored" };
296
+ const table = heldRowTableOf(facts, rowTablesOf(def), typeof value === "string" ? value : null);
297
+ return table !== null ? {
298
+ kind: "fact",
299
+ ref: storedTableKey(table)
300
+ } : { kind: "empty" };
301
+ }
302
+ if (source?.kind === "home") return {
303
+ kind: "fact",
304
+ ref: String(source.key)
305
+ };
306
+ if (source?.kind === "derived") return {
307
+ kind: "computed",
308
+ ref: String(source.transform)
309
+ };
310
+ if (source?.kind === "section") return {
311
+ kind: "computed",
312
+ ref: id
313
+ };
314
+ const member = memberSourceOf(source);
315
+ if (member !== null) return {
316
+ kind: "fact",
317
+ ref: `${member.slot}.${member.field}`
318
+ };
319
+ if (source?.kind === "element") return {
320
+ kind: "fact",
321
+ ref: "element"
322
+ };
323
+ return isEmptyValue(value, def.type) ? { kind: "empty" } : { kind: "authored" };
324
+ }
325
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
317
326
  function authoredValue(def, value, ctx) {
318
- if (MEDIA_KINDS.has(def.type)) return mediaRef(def.type, value, ctx);
319
- if (def.type === "list") {
320
- if (!Array.isArray(value)) return value;
321
- if (def.fields !== void 0) {
322
- const fields = def.fields;
323
- return canonicalizeRows(def, value).map((row) => {
324
- if (typeof row !== "object" || row === null) return row;
325
- const out = { ...row };
326
- for (const [field, fieldDef] of Object.entries(fields)) if (out[field] !== null && out[field] !== void 0) out[field] = authoredValue(fieldDef, out[field], ctx);
327
- return out;
328
- });
329
- }
330
- if (def.element !== void 0) {
331
- const element = def.element;
332
- return value.map((item) => authoredValue(element, item, ctx));
333
- }
327
+ if (isMediaType(def.type)) return mediaRef(def, value, ctx);
328
+ if (def.type === "address") return normalizeAddressValue(value);
329
+ const validated = VALIDATED_KINDS[def.type];
330
+ if (validated !== void 0 && !validated.admits(value)) {
331
+ ctx.violations.push({
332
+ rule: "fixtures/value-invalid",
333
+ file: ctx.module,
334
+ message: `fixture "${ctx.fixtureId}": "${ctx.instance}".${ctx.slot} (${def.type}) states ${JSON.stringify(value)}; it takes ${validated.expected}`
335
+ });
336
+ return emptyValueFor(def.type);
337
+ }
338
+ if (def.type === "list" && Array.isArray(value) && def.element !== void 0 && def.element.type !== "object" && def.element.type !== "row") {
339
+ const element = def.element;
340
+ return value.map((item) => authoredValue(element, item, ctx)).filter((item) => item !== null && item !== void 0);
334
341
  }
335
342
  return value;
336
343
  }
337
344
  const CONTACT_IMAGE_FIELDS = /* @__PURE__ */ new Set([
338
- "avatar",
345
+ "headshot",
339
346
  "logo_dark",
340
347
  "logo_light"
341
348
  ]);
@@ -351,11 +358,13 @@ function contactImage(value) {
351
358
  field
352
359
  };
353
360
  }
354
- function mediaRef(kind, value, ctx) {
355
- const stated = kind === "image" ? contactImage(value) : null;
361
+ function mediaRef(def, value, ctx) {
362
+ const kind = def.type;
363
+ const kinds = declaredKinds(def);
364
+ const stated = kinds.includes("image") ? contactImage(value) : null;
356
365
  const id = stated?.id ?? (typeof value === "object" && value !== null ? value.id : void 0);
357
366
  const carried = typeof id === "string" ? ctx.media.get(id) : void 0;
358
- if (carried === void 0 || carried.kind !== kind) {
367
+ if (carried === void 0 || !kinds.includes(carried.kind)) {
359
368
  const what = stated !== null ? `the "${stated.field}" of contact "${stated.contact}", which its property does not carry` : typeof id === "string" ? `${kind} "${id}", which its property does not carry` : `a value that is not a ${kind} entry of its property`;
360
369
  ctx.violations.push({
361
370
  rule: "fixtures/media-not-in-property",
@@ -3,7 +3,9 @@ function blankForField(def) {
3
3
  switch (def.type) {
4
4
  case "text":
5
5
  case "select":
6
- case "url": return "";
6
+ case "url":
7
+ case "email":
8
+ case "phone": return "";
7
9
  case "video": return {
8
10
  video_id: "",
9
11
  url: "",
@@ -20,15 +22,6 @@ function blankForField(def) {
20
22
  default: return null;
21
23
  }
22
24
  }
23
- function canonicalizeRows(slot, value) {
24
- if (!Array.isArray(value)) return value;
25
- const blank = {};
26
- for (const [field, def] of Object.entries(slot.fields ?? {})) blank[field] = blankForField(def);
27
- return value.map((row) => typeof row === "object" && row !== null && !Array.isArray(row) ? {
28
- ...blank,
29
- ...row
30
- } : row);
31
- }
32
25
 
33
26
  //#endregion
34
- export { blankForField, canonicalizeRows };
27
+ export { blankForField };