@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,7 +1,7 @@
1
- import { isCollectionSlotType } from "../../../packages/internal/template-contracts/dist/slot-catalog.js";
1
+ import { isListSlotType } from "../../../packages/internal/template-contracts/dist/slot-catalog.js";
2
2
  import { describeError } from "../messages.js";
3
3
  import { renderInputs } from "../render/inputs.js";
4
- import { collectionEditing } from "../../../packages/internal/template-contracts/dist/collection-editing.js";
4
+ import { listEditing } from "../../../packages/internal/template-contracts/dist/list-editing.js";
5
5
  import { checkClassConflicts } from "../render/class-conflicts.js";
6
6
  import { parseHtml } from "../render/html.js";
7
7
  import { checkRenderInvariants } from "../render/invariants.js";
@@ -11,14 +11,30 @@ import { renderToStaticMarkup } from "react-dom/server";
11
11
 
12
12
  //#region src/cli/check/stages/render.ts
13
13
  function editingViewOf(spec) {
14
+ const fields = itemFieldsOf(spec);
14
15
  return {
15
16
  type: spec.type ?? "",
16
17
  ...spec.element !== void 0 ? { element: spec.element } : {},
17
- ...spec.fields !== void 0 ? { fields: spec.fields } : {}
18
+ ...fields !== void 0 ? { fields } : {}
18
19
  };
19
20
  }
20
- function fieldIsLocked(field) {
21
- return typeof field === "object" && field !== null && field.locked === true;
21
+ function itemFieldsOf(spec) {
22
+ const element = spec.element;
23
+ return element?.type === "object" && typeof element.fields === "object" && element.fields !== null ? element.fields : void 0;
24
+ }
25
+ function objectFieldsOf(spec) {
26
+ return spec.type === "object" && typeof spec.fields === "object" && spec.fields !== null ? spec.fields : void 0;
27
+ }
28
+ function fieldIsUnmarked(field) {
29
+ if (typeof field !== "object" || field === null) return false;
30
+ const { locked, type } = field;
31
+ return locked === true || type === "row";
32
+ }
33
+ function placementIsOwn(slots, placement) {
34
+ const owner = placement.owner === void 0 ? void 0 : slots[placement.owner];
35
+ if (owner === void 0) return false;
36
+ const fields = placement.inItem ? itemFieldsOf(owner) : objectFieldsOf(owner);
37
+ return fields !== void 0 && Object.hasOwn(fields, placement.field);
22
38
  }
23
39
  const INVARIANT_RULE = {
24
40
  "sentinel-text": "render/sentinel-text",
@@ -34,9 +50,9 @@ var SectionEvidence = class {
34
50
  entry;
35
51
  marked = /* @__PURE__ */ new Set();
36
52
  selectable = /* @__PURE__ */ new Set();
37
- unitWithItems = /* @__PURE__ */ new Set();
38
53
  rowFields = /* @__PURE__ */ new Map();
39
- escapedGroup = /* @__PURE__ */ new Set();
54
+ objectFields = /* @__PURE__ */ new Map();
55
+ escapedFields = /* @__PURE__ */ new Map();
40
56
  findings = /* @__PURE__ */ new Map();
41
57
  constructor(entry) {
42
58
  this.entry = entry;
@@ -50,10 +66,10 @@ var SectionEvidence = class {
50
66
  });
51
67
  }
52
68
  };
53
- function renderStage(ctx) {
69
+ async function renderStage(ctx) {
54
70
  const { composition, sections, corpus } = ctx;
55
- if (composition === void 0 || sections === void 0) return Promise.resolve({ skipped: "the sections stage could not materialize the placed sections" });
56
- if (corpus === void 0 || corpus.length === 0) return Promise.resolve({ skipped: "no fixture resolved, so the render corpus is empty" });
71
+ if (composition === void 0 || sections === void 0) return { skipped: "the sections stage could not materialize the placed sections" };
72
+ if (corpus === void 0 || corpus.length === 0) return { skipped: "no fixture resolved, so the render corpus is empty" };
57
73
  const assets = ctx.assets ?? /* @__PURE__ */ new Map();
58
74
  const imported = ctx.workspace?.assets ?? /* @__PURE__ */ new Map();
59
75
  const carriesMedia = (url) => {
@@ -61,7 +77,7 @@ function renderStage(ctx) {
61
77
  return assets.has(path) || imported.has(path);
62
78
  };
63
79
  const evidence = new Map(sections.map((entry) => [entry.key, new SectionEvidence(entry)]));
64
- for (const { corpus: { emptied }, instanceId, entry, props, where } of renderInputs(composition, sections, corpus)) {
80
+ for await (const { corpus: { emptied }, instanceId, entry, props, where } of renderInputs(composition, sections, corpus, ctx.assets)) {
65
81
  const proof = evidence.get(entry.key);
66
82
  if (proof === void 0) continue;
67
83
  const { section, schema } = proof.entry;
@@ -78,17 +94,12 @@ function renderStage(ctx) {
78
94
  const coverage = collectMarkerCoverage(parseHtml(first));
79
95
  for (const id of coverage.slotIds) proof.marked.add(id);
80
96
  for (const id of coverage.selectableSlotIds) proof.selectable.add(id);
81
- for (const [slotId, fields] of coverage.rowFieldsBySlot) {
82
- const seen = proof.rowFields.get(slotId) ?? /* @__PURE__ */ new Set();
97
+ for (const [found, into] of [[coverage.rowFieldsBySlot, proof.rowFields], [coverage.objectFieldsBySlot, proof.objectFields]]) for (const [slotId, fields] of found) {
98
+ const seen = into.get(slotId) ?? /* @__PURE__ */ new Set();
83
99
  for (const field of fields) seen.add(field);
84
- proof.rowFields.set(slotId, seen);
85
- }
86
- const groupOf = /* @__PURE__ */ new Map();
87
- for (const group of schema.groups ?? []) for (const member of group.members) groupOf.set(member, group.id);
88
- for (const [slotId, instances] of coverage.enclosingGroupsBySlot) {
89
- const group = groupOf.get(slotId);
90
- if (group !== void 0 && instances.some((groups) => !groups.has(group))) proof.escapedGroup.add(slotId);
100
+ into.set(slotId, seen);
91
101
  }
102
+ for (const placement of coverage.fieldPlacements) if (!placementIsOwn(schema.slots, placement)) proof.escapedFields.set(placement.field, placement);
92
103
  for (const conflict of checkClassConflicts(first)) proof.report("render/section-root-margin", `The section root carries margin utility "${conflict.token}". Zero margin on the root is what lets consecutive sections butt edge-to-edge; space content with padding instead.`);
93
104
  const slots = schema.slots;
94
105
  if (emptied !== void 0 && emptied.instance === instanceId && slots[emptied.slot]?.locked !== true && slots[emptied.slot] !== void 0) {
@@ -96,14 +107,11 @@ function renderStage(ctx) {
96
107
  else if (!coverage.selectableSlotIds.has(emptied.slot)) proof.report("render/missing-slot-marker", `Slot "${emptied.slot}" is selectable when it has a value, but every copy is flagged non-selectable when it is empty (${where}). Keep one rendering of the empty state selectable.`);
97
108
  }
98
109
  for (const [slotId, spec] of Object.entries(slots)) {
99
- if (!isCollectionSlotType(spec.type ?? "")) continue;
100
- const scopes = coverage.itemScopesBySlot.get(slotId) ?? [];
101
- const granularity = collectionEditing(editingViewOf(spec));
102
- if (granularity === "unit" && scopes.some((scope) => scope.indices.length > 0)) proof.unitWithItems.add(slotId);
103
- if (granularity !== "item" || spec.locked === true) continue;
110
+ if (!isListSlotType(spec.type ?? "")) continue;
111
+ if (listEditing(editingViewOf(spec)) !== "item" || spec.locked === true) continue;
104
112
  const rows = props.slots[slotId];
105
113
  if (!Array.isArray(rows)) continue;
106
- for (const problem of checkItemIndices(rows.length, scopes)) proof.report("render/missing-slot-marker", `Slot "${slotId}" (${spec.type ?? "collection"}): ${problem}. Render each row as a SlotGroup over bindItems(...), which emits the row index from the array position.`);
114
+ for (const problem of checkItemIndices(rows.length, coverage.itemScopesBySlot.get(slotId) ?? [])) proof.report("render/missing-slot-marker", `Slot "${slotId}" (${spec.type ?? "list"}): ${problem}. Render each item as a Slot.Object over bindItems(...), which emits the item index from the array position.`);
107
115
  }
108
116
  if (first !== second) {
109
117
  proof.report("render/determinism-drift", `${where} rendered differently twice from the same input. A section must be a pure function of its props: no clock, no random, no unstable iteration order.`);
@@ -120,23 +128,30 @@ function renderStage(ctx) {
120
128
  file: proof.entry.file,
121
129
  message
122
130
  });
123
- for (const slotId of proof.unitWithItems) at("render/unit-collection-item-marker", `Slot "${slotId}" declares a single-slot item, so it is edited as one card, but its rendering emits data-slot-item row markers the editor never uses. Declare the item as a record if its rows should be individually editable, or render the rows as plain elements.`);
124
131
  for (const [slotId, spec] of Object.entries(slots)) {
125
- if (spec.fields == null || spec.locked === true || !isCollectionSlotType(spec.type ?? "")) continue;
126
- const declared = Object.entries(spec.fields).filter(([, field]) => !fieldIsLocked(field)).map(([field]) => field);
127
- const seen = proof.rowFields.get(slotId) ?? /* @__PURE__ */ new Set();
132
+ if (spec.locked === true) continue;
133
+ const itemFields = isListSlotType(spec.type ?? "") ? itemFieldsOf(spec) : void 0;
134
+ const fields = itemFields ?? objectFieldsOf(spec);
135
+ if (fields === void 0) continue;
136
+ const declared = Object.entries(fields).filter(([, field]) => !fieldIsUnmarked(field)).map(([field]) => field);
137
+ const seen = (itemFields !== void 0 ? proof.rowFields : proof.objectFields).get(slotId) ?? /* @__PURE__ */ new Set();
128
138
  const missing = declared.filter((field) => !seen.has(field));
129
139
  if (missing.length === 0) continue;
130
- at("render/missing-slot-marker", `Row field${missing.length === 1 ? "" : "s"} ${missing.map((f) => `"${f}"`).join(", ")} of "${slotId}" never render as data-slot-field in any fixture, so the editor cannot select ${missing.length === 1 ? "it" : "them"} on any row. Render each row field through its binding, or declare it locked: true.`);
140
+ const names = missing.map((f) => `"${f}"`).join(", ");
141
+ const them = missing.length === 1 ? "it" : "them";
142
+ at("render/missing-slot-marker", itemFields !== void 0 ? `Item field${missing.length === 1 ? "" : "s"} ${names} of "${slotId}" never render as data-slot-field in any fixture, so the editor cannot select ${them} on any item. Render each item field through its binding, or declare it locked: true.` : `Field${missing.length === 1 ? "" : "s"} ${names} of object "${slotId}" never render as data-slot-field inside its Slot.Object in any fixture, so the editor cannot select ${them}. Render each field through its binding (slot.${slotId}.<field>) inside <Slot.Object slot={slot.${slotId}}>, or declare it locked: true.`);
143
+ }
144
+ for (const placement of proof.escapedFields.values()) {
145
+ const where = placement.owner === void 0 ? "outside every Slot.Object" : `inside "${placement.owner}"${placement.inItem ? "'s items" : ""}, which declares no such field`;
146
+ at("render/group-ancestry", `Field "${placement.field}" is marked ${where}, so the editor resolves it to the wrong card or to none. Render an object's fields inside its own Slot.Object — the top-level object's, or the item's — or render the outside copy with selectable={false}.`);
131
147
  }
132
- for (const slotId of proof.escapedGroup) at("render/group-ancestry", `Slot "${slotId}" belongs to a group but is marked on an element outside that group's element, so the editor resolves it to no group. Move the marked element inside the SlotGroup, or render the outside copy with selectable={false}.`);
133
148
  for (const [slotId, spec] of Object.entries(slots)) {
134
149
  if (spec.locked === true) continue;
135
150
  if (!proof.marked.has(slotId)) at("render/missing-slot-marker", `Slot "${slotId}" is editable but never renders as data-slot-id in any fixture, so the editor cannot select it. Render it through its own Slot primitive, which owns the marker.`);
136
151
  else if (!proof.selectable.has(slotId)) at("render/missing-slot-marker", `Slot "${slotId}" reaches the DOM only on elements flagged non-selectable, so the editor can never select it. Render at least one copy without selectable={false}.`);
137
152
  }
138
153
  }
139
- return Promise.resolve({ violations });
154
+ return { violations };
140
155
  }
141
156
 
142
157
  //#endregion
@@ -1,35 +1,84 @@
1
+ import { REGISTRY_TABLE_KEYS, tableKeyOf } from "../../../packages/internal/template-contracts/dist/slot-catalog.js";
2
+ import { tableColumnOfKey } from "../../../packages/internal/template-contracts/dist/registry-shape.js";
1
3
  import { declaringModule } from "../../../section/section.js";
4
+ import "../../../packages/internal/template-contracts/dist/table-members.js";
2
5
  import { isInsideRoot, workspacePath } from "../../../platform/paths.js";
3
- import { fillSpecFromSchema } from "../../../schema/extract-fill-spec.js";
4
6
  import { exportSite } from "../../../section/discovery.js";
5
7
  import { describeError } from "../messages.js";
6
- import { renderInstanceSlots } from "../../../fixtures/media.js";
8
+ import { fillSpecFromSchema } from "../../../schema/extract-fill-spec.js";
7
9
  import { TEMPLATE_FILE } from "../load-workspace.js";
8
- import { FillSpec } from "../../../schema/fill-spec.js";
10
+ import { FillSpec } from "../../../packages/internal/template-contracts/dist/fill-spec-schema.js";
9
11
  import { SectionSchema } from "../../../schema/section-schema.js";
10
- import { GroupDerivationError } from "../../../section/groups.js";
11
12
  import { materializeSection } from "../../../section/materialize.js";
12
13
  import { isAbsolute } from "node:path";
13
14
 
14
15
  //#region src/cli/check/stages/sections.ts
15
- const GROUP_RULE = {
16
- "slot-in-two-groups": "groups/slot-in-two-groups",
17
- "label-conflict": "groups/label-conflict",
18
- empty: "groups/empty"
19
- };
20
16
  function flatten(parsed, key) {
21
17
  const { meta, ...rest } = parsed;
22
18
  return {
23
19
  ...rest,
24
20
  anchor: meta.anchor ?? key,
25
- ...meta.display ? { display: meta.display } : {},
26
- ...meta.groups ? { groups: meta.groups } : {}
21
+ ...meta.display ? { display: meta.display } : {}
22
+ };
23
+ }
24
+ function stampItemOrder(object) {
25
+ object.item_order = Object.keys(object.fields);
26
+ for (const field of Object.values(object.fields)) {
27
+ const element = field.element;
28
+ if (field.type === "list" && element?.type === "object") stampItemOrder(element);
29
+ }
30
+ }
31
+ function heldTables(slot) {
32
+ const rowTables = (row) => row?.type === "row" ? [row.from].flat().flatMap((key) => tableKeyOf(key)?.table ?? []) : [];
33
+ if (slot.type === "row") return new Set(rowTables(slot));
34
+ if (slot.type !== "list") return /* @__PURE__ */ new Set();
35
+ return /* @__PURE__ */ new Set([...rowTables(slot.element), ...Object.values(slot.element?.fields ?? {}).flatMap(rowTables)]);
36
+ }
37
+ function wholeTableReads(schema) {
38
+ const found = [];
39
+ const visit = (path, slot) => {
40
+ if (slot === void 0) return;
41
+ if (slot.source?.kind === "derived") {
42
+ const held = heldTables(slot);
43
+ for (const read of slot.source.reads ?? []) {
44
+ const table = read.kind === "home" ? tableKeyOf(read.key) : null;
45
+ if (table !== null && !held.has(table.table)) found.push([
46
+ path,
47
+ String(read.key),
48
+ REGISTRY_TABLE_KEYS[table.table]
49
+ ]);
50
+ }
51
+ }
52
+ for (const [field, def] of Object.entries(slot.fields ?? {})) visit(`${path}.${field}`, def);
53
+ visit(path, slot.element);
54
+ };
55
+ for (const [key, slot] of Object.entries(schema.slots)) visit(key, slot);
56
+ for (const [entry, def] of Object.entries(schema.display ?? {})) visit(`display.${entry}`, def);
57
+ return found;
58
+ }
59
+ function rowProjectionLists(schema) {
60
+ const found = [];
61
+ const visit = (path, slot, locked) => {
62
+ if (slot === void 0) return;
63
+ const isLocked = locked || slot.locked === true;
64
+ if (slot.type === "list" && !isLocked && slot.element?.type !== "select" && slot.source?.kind === "derived") {
65
+ const required = new Set((slot.source.requires ?? []).map((read) => read.key));
66
+ const projected = /* @__PURE__ */ new Set();
67
+ for (const read of slot.source.reads ?? []) {
68
+ const column = read.kind === "home" && !required.has(read.key) ? tableColumnOfKey(read.key) : null;
69
+ if (column !== null) projected.add(column.tableKey);
70
+ }
71
+ for (const registryKey of projected) found.push([path, registryKey]);
72
+ }
73
+ for (const [field, def] of Object.entries(slot.fields ?? {})) visit(`${path}.${field}`, def, isLocked);
74
+ visit(path, slot.element, isLocked);
27
75
  };
76
+ for (const [key, slot] of Object.entries(schema.slots)) visit(key, slot, false);
77
+ return found;
28
78
  }
29
79
  function sectionsStage(ctx) {
30
80
  const { workspace, discovered, composition } = ctx;
31
81
  if (workspace === void 0 || discovered === void 0 || composition === void 0) return Promise.resolve({ skipped: "the composition stage could not derive the placed sections" });
32
- const corpus = ctx.corpus ?? [];
33
82
  const fileOf = (section) => {
34
83
  const exported = exportSite(discovered, section);
35
84
  if (exported !== void 0) return exported.module;
@@ -37,37 +86,37 @@ function sectionsStage(ctx) {
37
86
  return at !== void 0 && isAbsolute(at) && isInsideRoot(workspace.root, at) ? workspacePath(workspace.root, at) : TEMPLATE_FILE;
38
87
  };
39
88
  const violations = [];
89
+ const hints = [];
40
90
  const sections = [];
41
91
  for (const [key, section] of composition.sections) {
42
92
  const file = fileOf(section);
43
- const states = corpus.flatMap(({ fixture }) => fixture.contentDoc.instances.filter((instance) => instance.section_key === key).map((instance) => renderInstanceSlots(instance, section, fixture.media)));
44
- let materialized;
45
- try {
46
- materialized = materializeSection(section, states);
47
- } catch (cause) {
48
- violations.push(cause instanceof GroupDerivationError ? {
49
- rule: GROUP_RULE[cause.fault],
50
- file,
51
- message: cause.message
52
- } : {
53
- rule: "groups/probe-failed",
54
- file,
55
- message: `Section "${key}" throws under the groups probe: ${describeError(cause)}`
56
- });
57
- continue;
58
- }
93
+ const materialized = materializeSection(section);
59
94
  try {
60
95
  const parsed = SectionSchema.parse(materialized);
61
96
  parsed.slot_order = Object.keys(parsed.slots);
62
- for (const slot of Object.values(parsed.slots)) if (slot.type === "list" && slot.fields) slot.item_order = Object.keys(slot.fields);
97
+ for (const slot of Object.values(parsed.slots)) {
98
+ if (slot.type === "object") stampItemOrder(slot);
99
+ if (slot.type === "list" && slot.element?.type === "object") stampItemOrder(slot.element);
100
+ }
63
101
  const fillSpec = FillSpec.parse(fillSpecFromSchema(materialized));
102
+ const schema = flatten(parsed, key);
64
103
  sections.push({
65
104
  key,
66
105
  section,
67
106
  file,
68
- schema: flatten(parsed, key),
107
+ schema,
69
108
  fillSpec
70
109
  });
110
+ for (const [path, table, registryKey] of wholeTableReads(schema)) hints.push({
111
+ rule: "sections/whole-table-read",
112
+ file,
113
+ message: `Section "${key}": \`${path}\` computes from the whole table "${table}", so every member of it counts as used. If the value needs only some members, read those columns instead (\`fact.${registryKey}.<member>\`).`
114
+ });
115
+ for (const [path, registryKey] of rowProjectionLists(schema)) violations.push({
116
+ rule: "sections/row-projection-list",
117
+ file,
118
+ message: `Section "${key}": \`${path}\` computes its items from the columns of "${registryKey}", so an item loses its row: the user cannot tell which row it stands for, choose another, or edit the member where it lives. Hold the rows instead: an item holding a row \`from: fact.${registryKey}\`, its other fields reading members off that row, and a \`compute({ reads: [fact.${registryKey}] }, (rows) => …)\` returning the rows the list starts with as its source. Or, where the list is vocabulary nobody arranges, declare it \`locked: true\`.`
119
+ });
71
120
  } catch (cause) {
72
121
  violations.push({
73
122
  rule: "sections/schema-invalid",
@@ -77,7 +126,10 @@ function sectionsStage(ctx) {
77
126
  }
78
127
  }
79
128
  ctx.sections = sections;
80
- return Promise.resolve({ violations });
129
+ return Promise.resolve({
130
+ violations,
131
+ ...hints.length === 0 ? {} : { hints }
132
+ });
81
133
  }
82
134
 
83
135
  //#endregion
@@ -4,6 +4,7 @@ import { loadFixtures } from "../../../fixtures/load.js";
4
4
  import { listSourcePaths } from "../../build/source.js";
5
5
  import { crlfTextViolations } from "../line-endings.js";
6
6
  import { unportableNameViolations } from "../portable-names.js";
7
+ import { templateKeyViolations } from "../template-key.js";
7
8
 
8
9
  //#region src/cli/check/stages/workspace.ts
9
10
  async function workspaceStage(ctx) {
@@ -11,6 +12,7 @@ async function workspaceStage(ctx) {
11
12
  ctx.workspace = workspace;
12
13
  const violations = [...workspace.violations, ...await crlfTextViolations(ctx.root)];
13
14
  if (workspace.template !== null) {
15
+ violations.push(...templateKeyViolations(workspace.template, TEMPLATE_FILE));
14
16
  try {
15
17
  ctx.discovered = await discoverSections({
16
18
  root: ctx.root,
@@ -0,0 +1,16 @@
1
+ //#region src/cli/check/template-key.ts
2
+ function templateKeyForName(name) {
3
+ return name.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-");
4
+ }
5
+ function templateKeyViolations(template, module) {
6
+ const expected = templateKeyForName(template.name);
7
+ if (template.key === expected) return [];
8
+ return [{
9
+ rule: "workspace/key-not-name",
10
+ file: module,
11
+ message: `The template key "${template.key}" does not spell its name "${template.name}"; the key is the name in lowercase kebab-case, "${expected}". Renaming a published template's key makes it a different template in the catalog: rename the stored key with it, or pick a name that spells the key.`
12
+ }];
13
+ }
14
+
15
+ //#endregion
16
+ export { templateKeyForName, templateKeyViolations };
@@ -121,7 +121,7 @@ const DECLARED_COMMANDS = [
121
121
  when: "the library cannot be read from the registry and no earlier copy of it is cached"
122
122
  }],
123
123
  constraints: [
124
- "Prints one line per property on stdout: its slug, its description, then its property type, listing intent and non-zero counts.",
124
+ "Prints one line per property on stdout: its slug, its description, then its listing intent and non-zero counts.",
125
125
  "Reads the latest @homepages/sample-properties from the registry the workspace installs from, and caches each version per user under `XDG_CACHE_HOME`, else `~/.cache`.",
126
126
  "When the registry cannot be read, lists the newest cached version and says so on stderr."
127
127
  ]
@@ -1,4 +1,4 @@
1
- import { CROP_PARAM, croppedUrl, cutRegion as cutRegion$1, parseCropParam } from "../../packages/internal/image-ladder/dist/crop.js";
1
+ import { CROP_PARAM, croppedUrl, cutRegion as cutRegion$1, parseCropParam } from "../../packages/internal/crop-region/dist/index.js";
2
2
 
3
3
  //#region src/cli/dev/crop.ts
4
4
  function croppedMediaUrl(url, rect) {
@@ -0,0 +1,96 @@
1
+ import { cachedAuthorImage, deriveAuthorImage, masterHash } from "../media/derive.js";
2
+ import { FIXTURE_MEDIA_PATH } from "../../fixtures/media-plugin.js";
3
+ import { basename } from "node:path";
4
+
5
+ //#region src/cli/dev/fixture-ladders.ts
6
+ function servedLadder(derivation) {
7
+ const { responsive } = derivation.image;
8
+ if (responsive === null) return null;
9
+ const rehome = (srcset) => srcset.split(",").map((candidate) => {
10
+ const [url = "", ...descriptors] = candidate.trim().split(/\s+/);
11
+ return [`${FIXTURE_MEDIA_PATH}/${basename(url)}`, ...descriptors].join(" ");
12
+ }).join(", ");
13
+ return {
14
+ ...responsive,
15
+ sources: responsive.sources.map((source) => ({
16
+ ...source,
17
+ srcset: rehome(source.srcset)
18
+ }))
19
+ };
20
+ }
21
+ const errorText = (err) => err instanceof Error ? err.message : String(err);
22
+ function createFixtureLadders(options) {
23
+ const { cacheDir, log } = options;
24
+ const ready = /* @__PURE__ */ new Map();
25
+ const lookups = /* @__PURE__ */ new Map();
26
+ const rungs = /* @__PURE__ */ new Map();
27
+ let queue = Promise.resolve();
28
+ let reportedNoSharp = false;
29
+ let closed = false;
30
+ const adopt = (key, derivation) => {
31
+ const ladder = servedLadder(derivation);
32
+ if (ladder === null) return false;
33
+ for (const rung of derivation.derivatives) rungs.set(`${FIXTURE_MEDIA_PATH}/${rung.filename}`, rung);
34
+ ready.set(key, ladder);
35
+ return true;
36
+ };
37
+ const derive = async (key, path, bytes) => {
38
+ if (closed) return;
39
+ try {
40
+ const derivation = await deriveAuthorImage(path, bytes, {
41
+ cacheDir,
42
+ ...options.loadSharp === void 0 ? {} : { loadSharp: options.loadSharp }
43
+ });
44
+ if (closed) return;
45
+ if (derivation.passthrough) {
46
+ if (!reportedNoSharp) log.write("concrete dev: sharp is not installed, so images serve as their masters, without a responsive ladder.\n");
47
+ reportedNoSharp = true;
48
+ return;
49
+ }
50
+ if (adopt(key, derivation)) options.onReady();
51
+ } catch (err) {
52
+ log.write(`concrete dev: no responsive ladder for ${path}: ${errorText(err)}\n`);
53
+ }
54
+ };
55
+ const lookup = async (key, path, bytes) => {
56
+ let hit;
57
+ try {
58
+ hit = await cachedAuthorImage(path, bytes, { cacheDir });
59
+ } catch (err) {
60
+ log.write(`concrete dev: no responsive ladder for ${path}: ${errorText(err)}\n`);
61
+ return;
62
+ }
63
+ if (hit !== null) {
64
+ adopt(key, hit);
65
+ return;
66
+ }
67
+ queue = queue.then(() => derive(key, path, bytes));
68
+ };
69
+ const idle = async () => {
70
+ for (let seen = queue;; seen = queue) {
71
+ await seen;
72
+ if (seen === queue) return;
73
+ }
74
+ };
75
+ return {
76
+ async responsiveFor(path, bytes) {
77
+ const key = `${path}|${masterHash(bytes)}`;
78
+ let pending = lookups.get(key);
79
+ if (pending === void 0) {
80
+ pending = lookup(key, path, bytes);
81
+ lookups.set(key, pending);
82
+ }
83
+ await pending;
84
+ return ready.get(key) ?? null;
85
+ },
86
+ rung: (url) => rungs.get(url),
87
+ idle,
88
+ close() {
89
+ closed = true;
90
+ return idle();
91
+ }
92
+ };
93
+ }
94
+
95
+ //#endregion
96
+ export { createFixtureLadders };
@@ -1,8 +1,8 @@
1
- import { CAPTURE_ISLANDS_READY_GLOBAL } from "../../packages/internal/format-geometry/dist/capture.js";
2
- import "../../packages/internal/format-geometry/dist/index.js";
3
1
  import { hasClientDirective } from "../../islands/client-module.js";
4
2
  import { isWorkspaceFile, packageFile, toPosix } from "../../platform/paths.js";
5
3
  import { listDirSync } from "../../platform/fs.js";
4
+ import { CAPTURE_ISLANDS_READY_GLOBAL } from "../../packages/internal/capture-settle/dist/settle.js";
5
+ import "../../packages/internal/capture-settle/dist/index.js";
6
6
  import { readFileSync } from "node:fs";
7
7
  import nodePath, { dirname, extname, join, relative } from "node:path";
8
8
  import { mkdir, readFile, writeFile } from "node:fs/promises";
@@ -193,118 +193,9 @@ window.${CAPTURE_ISLANDS_READY_GLOBAL} = ready;
193
193
  ready.catch(() => {});
194
194
  `;
195
195
  }
196
- function canvasHostCore(runtimeSpecifier, modules) {
197
- return `${modules.head}
198
- import { hydrateIslands, unmountIslands } from ${JSON.stringify(runtimeSpecifier)};
199
- import { createElement, useLayoutEffect } from "react";
200
-
201
- // The shared canvas kernel's shield names: this script must speak the same spellings or
202
- // its shields never lift.
203
- const SHIELD_CLASS = "we-enh-shield";
204
- const SHIELD_ITEM_CLASS = "we-enh-shield--item";
205
- const LIVE_ATTR = "data-we-live";
206
- const ITEM_ATTR = "data-slot-item";
207
-
208
- const map = window.__TR_ISLAND_MAP || {};
209
- ${modules.importer}
210
-
211
- // Per-island hydration-commit signal, keyed by the \`editor\` object each load() clones —
212
- // never by island key, or N copies of one island would share one commit.
213
- const commitOf = new WeakMap();
214
-
215
- function withCommitSignal(component, signalCommit) {
216
- return function IslandCommitSignal(props) {
217
- useLayoutEffect(signalCommit, []);
218
- return createElement(component, props);
219
- };
220
- }
221
- ${REAL_COMPONENT}
222
- async function load(key) {
223
- const mod = await importIsland(key);
224
- let signalCommit;
225
- const committed = new Promise((resolve) => { signalCommit = resolve; });
226
- const editor = mod.editor ? { ...mod.editor } : undefined;
227
- if (editor) commitOf.set(editor, { committed, signalCommit });
228
- return { ...mod, editor, default: withCommitSignal(realComponent(mod), signalCommit) };
229
- }
230
-
231
- function makeShield(doc, itemShield) {
232
- const shield = doc.createElement("div");
233
- shield.className = itemShield ? SHIELD_CLASS + " " + SHIELD_ITEM_CLASS : SHIELD_CLASS;
234
- shield.setAttribute("aria-hidden", "true");
235
- return shield;
236
- }
237
-
238
- function installShield(surface, itemShield) {
239
- const doc = surface.ownerDocument;
240
- const win = doc.defaultView;
241
- const pos = win ? win.getComputedStyle(surface).position : "";
242
- if (!pos || pos === "static") surface.style.position = "relative";
243
- if (Array.from(surface.children).some((c) => c.classList.contains(SHIELD_CLASS))) return;
244
- surface.appendChild(makeShield(doc, itemShield));
245
- }
246
-
247
- // Shields derive from the island's own markup: an item shield per collection-item copy,
248
- // then a base shield per root box (the marker is display:contents).
249
- function shieldHandle(handle) {
250
- const editor = handle.editor;
251
- if (!editor || editor.live !== true) return;
252
- const root = handle.element;
253
- for (const itemEl of Array.from(root.querySelectorAll("[" + ITEM_ATTR + "]"))) installShield(itemEl, true);
254
- const doc = root.ownerDocument;
255
- const win = doc.defaultView;
256
- const display = win ? win.getComputedStyle(root).display : "";
257
- const baseEls = display === "contents" ? Array.from(root.children) : [root];
258
- for (const baseEl of baseEls) installShield(baseEl, false);
259
- }
260
-
261
- let styleInstalled = false;
262
- function ensureShieldStyle() {
263
- if (styleInstalled || document.getElementById("concrete-canvas-shield-style")) return;
264
- styleInstalled = true;
265
- const style = document.createElement("style");
266
- style.id = "concrete-canvas-shield-style";
267
- style.textContent =
268
- "." + SHIELD_CLASS + "{position:absolute;inset:0;z-index:1;cursor:pointer;background:transparent;}" +
269
- "." + SHIELD_ITEM_CLASS + "{z-index:2;}" +
270
- "[" + LIVE_ATTR + "] ." + SHIELD_CLASS + "{display:none;}";
271
- document.head.appendChild(style);
272
- }
273
-
274
- async function hydrateRoot(root) {
275
- ensureShieldStyle();
276
- const handles = await hydrateIslands({
277
- root,
278
- load,
279
- // The shield pass needs every handle the moment this settles.
280
- schedule: "eager",
281
- shouldHydrate: (ctx) => (ctx.editor ? ctx.editor.live === true : false),
282
- onError: (error, ctx) => {
283
- console.error(${JSON.stringify(`${modules.label}: canvas island failed to hydrate:`)}, ctx.key, error);
284
- if (ctx.editor) { const c = commitOf.get(ctx.editor); if (c) c.signalCommit(); }
285
- },
286
- });
287
- // React commits on a scheduler task; mutating its DOM before the commit makes it discard
288
- // the server tree, shields and all.
289
- await Promise.all(
290
- handles.map((h) => (h.editor ? commitOf.get(h.editor) : undefined)).filter((c) => c !== undefined).map((c) => c.committed),
291
- );
292
- for (const handle of handles) shieldHandle(handle);
293
- return handles;
294
- }
295
-
296
- function unmountRoot(root) {
297
- unmountIslands(root);
298
- root.querySelectorAll("." + SHIELD_CLASS).forEach((s) => s.remove());
299
- }
300
-
301
- window.__trCanvasIslands = { hydrateRoot, unmountRoot };
302
- void hydrateRoot(document.body);
303
- `;
304
- }
305
196
  function canvasHostSource(runtimeUrl, root, files) {
306
- return canvasHostCore(runtimeUrl, {
307
- head: `import RefreshRuntime from "/@react-refresh";
197
+ return `import RefreshRuntime from "/@react-refresh";
198
+ import { installCanvasIslandHost } from ${JSON.stringify(runtimeUrl)};
308
199
 
309
200
  // The React Refresh preamble. The React plugin compiles every client component to assert
310
201
  // it ran, and the canvas frame is not built by Vite's own html transform, so the one
@@ -315,15 +206,13 @@ if (!window.__vite_plugin_react_preamble_installed__) {
315
206
  window.$RefreshSig$ = () => (type) => type;
316
207
  window.__vite_plugin_react_preamble_installed__ = true;
317
208
  }
318
- `,
319
- importer: `${importers(root, files)}
320
- function importIsland(key) {
321
- const url = map[key];
322
- const importer = url ? modules[url] : undefined;
323
- return importer ? importer() : Promise.reject(new Error("concrete dev: no island module for " + key));
324
- }`,
325
- label: "concrete dev"
326
- });
209
+
210
+ ${importers(root, files)}
211
+ installCanvasIslandHost((url) => {
212
+ const importer = modules[url];
213
+ return importer ? importer() : Promise.reject(new Error("concrete dev: no island module at " + url));
214
+ }, "concrete dev");
215
+ `;
327
216
  }
328
217
  async function writeIslandHostScripts(root, files) {
329
218
  const dir = join(root, ".concrete", "dev");
@@ -333,7 +222,7 @@ async function writeIslandHostScripts(root, files) {
333
222
  const file = join(dir, name);
334
223
  await writeFile(file, source, "utf8");
335
224
  const version = createHash("sha256").update(source).digest("hex").slice(0, 12);
336
- return `${fsUrl(file)}?v=${version}`;
225
+ return `${fsUrl(file)}?h=${version}`;
337
226
  };
338
227
  return {
339
228
  canvas: await write("island-canvas-host.js", canvasHostSource(runtimeUrl, root, files)),