@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
@@ -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 { elementIdentityKey, 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,229 @@ 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 identityKey = elementIdentityKey(table?.table ?? null);
216
+ const elementRows = elementRowKeys(fields);
217
+ return value.map((item, i) => {
218
+ const record = isRecord(item) ? item : {};
219
+ const out = statedFields(fill, fields, path, record, false);
220
+ const held = elementRows.map((key) => record[key]).find((id) => typeof id === "string" && id !== "");
221
+ const id = table === null ? record["id"] ?? `${path}-${String(i + 1)}` : held ?? record[identityKey] ?? record["id"];
222
+ return {
223
+ [identityKey]: id,
224
+ ...out
256
225
  };
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
226
  });
270
- provenance[id] = { kind: "authored" };
271
227
  }
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));
228
+ if (def.type === "list" && def.element?.type === "row") return Array.isArray(value) ? value.filter((id) => typeof id === "string") : void 0;
229
+ return authoredValue(def, value, fill.at(path));
230
+ }
231
+ function statedFields(fill, fields, path, value, holds) {
232
+ const out = {};
233
+ for (const [key, field] of Object.entries(fields)) {
234
+ const stated = statedValue(fill, field, objectFieldSlotId(path, key), value[key], holds);
235
+ if (stated !== void 0) out[key] = stated;
279
236
  }
280
- return {
281
- slots,
282
- provenance
283
- };
237
+ return out;
238
+ }
239
+ function filledListTable(def) {
240
+ if (listSourceOf(def).kind !== "none" || memberSourceOf(def.source) !== null) return null;
241
+ return listTableOf({ slots: {} }, def);
284
242
  }
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({
243
+ function reportRows(ctx, instance, def, path, value) {
244
+ if (def.type !== "list" || !Array.isArray(value)) return;
245
+ if (listSourceOf(def).kind !== "table") return;
246
+ const table = listTableOf({ slots: {} }, def);
247
+ const carried = table === null ? 0 : tableRowIds(table, ctx.facts).length;
248
+ if (value.length <= carried) return;
249
+ ctx.violations.push({
292
250
  rule: "fixtures/rows-not-in-property",
293
251
  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`
252
+ 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
253
  });
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);
254
+ }
255
+ function slotValue(def, path, baked, stated, decisions) {
256
+ if (def.type === "object") {
257
+ const fields = def.fields;
258
+ const bakedFields = isRecord(baked?.value) ? baked.value : {};
259
+ const statedFields = isRecord(stated) ? stated : {};
260
+ const out = {};
261
+ for (const [key, field] of Object.entries(fields)) {
262
+ const fieldPath = objectFieldSlotId(path, key);
263
+ out[key] = Object.hasOwn(bakedFields, key) ? fieldValue(field, fieldPath, { value: bakedFields[key] }, statedFields[key], decisions) : fieldValue(field, fieldPath, void 0, statedFields[key], decisions);
313
264
  }
314
265
  return out;
266
+ }
267
+ if (def.type === "list" && def.element?.type === "object" && Array.isArray(baked?.value)) return itemsValue(def, path, baked.value, stated, decisions);
268
+ if (baked !== void 0) return baked.value ?? emptyValueFor(def.type);
269
+ if (def.source === void 0 && stated !== void 0) return stated;
270
+ return emptyValueFor(def.type);
271
+ }
272
+ function fieldValue(def, path, baked, stated, decisions) {
273
+ if (def.type === "object" || def.type === "list" && def.element?.type === "object" && Array.isArray(baked?.value)) return slotValue(def, path, baked, stated, decisions);
274
+ if (baked !== void 0) return baked.value;
275
+ if (def.source === void 0 && stated !== void 0) return stated;
276
+ return blankForField(def);
277
+ }
278
+ function itemsValue(def, path, items, stated, decisions) {
279
+ const fields = def.element?.fields ?? {};
280
+ const identityKey = elementIdentityKey(listTableOf({ slots: {} }, def)?.table ?? null);
281
+ const statedItems = Array.isArray(stated) ? stated.filter(isRecord) : [];
282
+ const byIdentity = listSourceOf(def).kind === "none" && memberSourceOf(def.source) === null;
283
+ return items.map((item, i) => {
284
+ const baked = isRecord(item) ? item : {};
285
+ const statedItem = byIdentity ? statedItems.find((candidate) => candidate[identityKey] === baked[identityKey]) : statedItems[i];
286
+ const out = { [identityKey]: baked[identityKey] };
287
+ 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);
288
+ return out;
315
289
  });
316
290
  }
291
+ function storedTableKey(key) {
292
+ return key.reading === "legacy" ? key.table : REGISTRY_TABLE_KEYS[key.table];
293
+ }
294
+ function provenanceFor(def, id, stated, value, facts) {
295
+ const source = def.source;
296
+ if (def.type === "object") return { kind: "authored" };
297
+ if (def.type === "row") {
298
+ if (typeof stated === "string") return { kind: "authored" };
299
+ const table = heldRowTableOf(facts, rowTablesOf(def), typeof value === "string" ? value : null);
300
+ return table !== null ? {
301
+ kind: "fact",
302
+ ref: storedTableKey(table)
303
+ } : { kind: "empty" };
304
+ }
305
+ if (source?.kind === "home") return {
306
+ kind: "fact",
307
+ ref: String(source.key)
308
+ };
309
+ if (source?.kind === "derived") return {
310
+ kind: "computed",
311
+ ref: String(source.transform)
312
+ };
313
+ if (source?.kind === "section") return {
314
+ kind: "computed",
315
+ ref: id
316
+ };
317
+ const member = memberSourceOf(source);
318
+ if (member !== null) return {
319
+ kind: "fact",
320
+ ref: `${member.slot}.${member.field}`
321
+ };
322
+ if (source?.kind === "element") return {
323
+ kind: "fact",
324
+ ref: "element"
325
+ };
326
+ return isEmptyValue(value, def.type) ? { kind: "empty" } : { kind: "authored" };
327
+ }
328
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
317
329
  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
- }
330
+ if (isMediaType(def.type)) return mediaRef(def, value, ctx);
331
+ if (def.type === "address") return normalizeAddressValue(value);
332
+ const validated = VALIDATED_KINDS[def.type];
333
+ if (validated !== void 0 && !validated.admits(value)) {
334
+ ctx.violations.push({
335
+ rule: "fixtures/value-invalid",
336
+ file: ctx.module,
337
+ message: `fixture "${ctx.fixtureId}": "${ctx.instance}".${ctx.slot} (${def.type}) states ${JSON.stringify(value)}; it takes ${validated.expected}`
338
+ });
339
+ return emptyValueFor(def.type);
340
+ }
341
+ if (def.type === "list" && Array.isArray(value) && def.element !== void 0 && def.element.type !== "object" && def.element.type !== "row") {
342
+ const element = def.element;
343
+ return value.map((item) => authoredValue(element, item, ctx)).filter((item) => item !== null && item !== void 0);
334
344
  }
335
345
  return value;
336
346
  }
337
347
  const CONTACT_IMAGE_FIELDS = /* @__PURE__ */ new Set([
338
- "avatar",
348
+ "headshot",
339
349
  "logo_dark",
340
350
  "logo_light"
341
351
  ]);
@@ -351,11 +361,13 @@ function contactImage(value) {
351
361
  field
352
362
  };
353
363
  }
354
- function mediaRef(kind, value, ctx) {
355
- const stated = kind === "image" ? contactImage(value) : null;
364
+ function mediaRef(def, value, ctx) {
365
+ const kind = def.type;
366
+ const kinds = declaredKinds(def);
367
+ const stated = kinds.includes("image") ? contactImage(value) : null;
356
368
  const id = stated?.id ?? (typeof value === "object" && value !== null ? value.id : void 0);
357
369
  const carried = typeof id === "string" ? ctx.media.get(id) : void 0;
358
- if (carried === void 0 || carried.kind !== kind) {
370
+ if (carried === void 0 || !kinds.includes(carried.kind)) {
359
371
  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
372
  ctx.violations.push({
361
373
  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 };