@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,4 +1,5 @@
1
- import { COLLECTIONS, acceptsLink } from "../packages/internal/template-contracts/dist/slot-catalog.js";
1
+ import { normalizeAddressValue } from "../packages/internal/template-contracts/dist/address-value.js";
2
+ import { OBJECT_BINDING_OWN_KEYS, acceptsLink, declaredKinds, isEmailValue, isIsoDateValue, isPhoneValue } from "../packages/internal/template-contracts/dist/slot-catalog.js";
2
3
 
3
4
  //#region src/primitives/slot-bindings.ts
4
5
  const blankVideo = () => ({
@@ -13,12 +14,6 @@ const blankTour = () => ({
13
14
  poster: "",
14
15
  alt: ""
15
16
  });
16
- function admitsLinkVideo(sources) {
17
- return Array.isArray(sources) && sources.includes("link");
18
- }
19
- function isLinkVideo(value) {
20
- return typeof value === "object" && value !== null && value.source === "link";
21
- }
22
17
  function isRecord(value) {
23
18
  return typeof value === "object" && value !== null && !Array.isArray(value);
24
19
  }
@@ -47,10 +42,13 @@ function normalizeImage(value) {
47
42
  return isRecord(value) && typeof value.url === "string" && value.url !== "" ? value : null;
48
43
  }
49
44
  function normalizeDocument(value) {
50
- return isRecord(value) && typeof value.url === "string" && value.url !== "" ? value : null;
45
+ if (!isRecord(value) || typeof value.url !== "string" || value.url === "") return null;
46
+ return typeof value.poster === "string" ? value : {
47
+ ...value,
48
+ poster: ""
49
+ };
51
50
  }
52
- function normalizeVideo(slot, value) {
53
- if (!admitsLinkVideo(slot.sources) && isLinkVideo(value)) return blankVideo();
51
+ function normalizeVideo(value) {
54
52
  if (!isRecord(value)) return blankVideo();
55
53
  return {
56
54
  ...value,
@@ -70,15 +68,44 @@ function normalizeTour(value) {
70
68
  alt: stringField(value.alt)
71
69
  };
72
70
  }
73
- function normalizeRow(fields, row, idKey) {
74
- const source = isRecord(row) ? row : {};
75
- const normalized = { [idKey]: stringField(source[idKey]) };
71
+ function normalizeMedia(slot, value) {
72
+ if (!isRecord(value) || typeof value.kind !== "string" || !declaredKinds({
73
+ type: "media",
74
+ kinds: slot.kinds
75
+ }).some((kind) => kind === value.kind)) return null;
76
+ switch (value.kind) {
77
+ case "image":
78
+ case "document": {
79
+ const normalized = value.kind === "image" ? normalizeImage(value) : normalizeDocument(value);
80
+ return normalized === null ? null : {
81
+ ...normalized,
82
+ kind: value.kind
83
+ };
84
+ }
85
+ case "video":
86
+ case "tour": {
87
+ const normalized = value.kind === "video" ? normalizeVideo(value) : normalizeTour(value);
88
+ return normalized.url === "" && normalized.poster === "" ? null : {
89
+ ...normalized,
90
+ kind: value.kind
91
+ };
92
+ }
93
+ default: return null;
94
+ }
95
+ }
96
+ const IDENTITY_KEYS = ["id"];
97
+ function normalizeFields(fields, value, identity) {
98
+ const source = isRecord(value) ? value : {};
99
+ const normalized = {};
100
+ if (identity) {
101
+ for (const key of IDENTITY_KEYS) if (typeof source[key] === "string") normalized[key] = source[key];
102
+ }
76
103
  for (const [field, def] of Object.entries(fields)) normalized[field] = normalizeValue(def, source[field]);
77
104
  return normalized;
78
105
  }
79
- function rowIdKey(source) {
80
- if (!isRecord(source) || source.kind !== "direct" || typeof source.field !== "string") return "id";
81
- return Object.hasOwn(COLLECTIONS, source.field) ? COLLECTIONS[source.field].idKey : "id";
106
+ function itemFieldsOf(def) {
107
+ const element = def?.element;
108
+ return element?.type === "object" && isRecord(element.fields) ? element.fields : void 0;
82
109
  }
83
110
  function normalizeValue(def, value) {
84
111
  const slot = def;
@@ -87,21 +114,26 @@ function normalizeValue(def, value) {
87
114
  case "select": return normalizeString(value);
88
115
  case "number": return normalizeNumber(value);
89
116
  case "url": return normalizeUrl(slot, value);
117
+ case "date": return isIsoDateValue(value) ? value : null;
118
+ case "email": return isEmailValue(value) ? value : "";
119
+ case "phone": return isPhoneValue(value) ? value : "";
90
120
  case "image": return normalizeImage(value);
91
- case "video": return normalizeVideo(slot, value);
121
+ case "video": return normalizeVideo(value);
92
122
  case "tour": return normalizeTour(value);
93
123
  case "document": return normalizeDocument(value);
124
+ case "media": return normalizeMedia(slot, value);
94
125
  case "poi": return isRecord(value) ? value : null;
126
+ case "address": return normalizeAddressValue(value);
127
+ case "object": return normalizeFields(isRecord(slot.fields) ? slot.fields : {}, value, false);
128
+ case "row": return typeof value === "string" && value !== "" ? value : null;
95
129
  case "list": {
96
130
  if (!Array.isArray(value)) return [];
97
- if (isRecord(slot.fields)) {
98
- const fields = slot.fields;
99
- const idKey = rowIdKey(slot.source);
100
- return value.map((row) => normalizeRow(fields, row, idKey));
101
- }
131
+ const fields = itemFieldsOf(slot);
132
+ if (fields !== void 0) return value.map((item) => normalizeFields(fields, item, true));
133
+ if (slot.element?.type === "row") return value.filter((id) => typeof id === "string" && id !== "");
102
134
  if (slot.element == null) return value;
103
135
  const element = slot.element;
104
- return (element.type === "video" && !admitsLinkVideo(element.sources) ? value.filter((member) => isRecord(member) && !isLinkVideo(member)) : value).map((member) => normalizeValue(element, member)).filter((member) => member !== null);
136
+ return value.map((member) => normalizeValue(element, member)).filter((member) => member !== null);
105
137
  }
106
138
  default: return value;
107
139
  }
@@ -113,32 +145,42 @@ function presentValue(def, value) {
113
145
  switch (def.type) {
114
146
  case "text":
115
147
  case "select":
116
- case "url": return value !== "";
148
+ case "url":
149
+ case "email":
150
+ case "phone": return value !== "";
151
+ case "date": return value !== null;
117
152
  case "number":
118
153
  case "image":
119
- case "document": return value !== null;
154
+ case "document":
155
+ case "media": return value !== null;
120
156
  case "video": return videoValuePresent(value);
121
157
  case "tour": return videoValuePresent(value);
122
158
  case "list": return Array.isArray(value) && value.length > 0;
123
- case "poi": return value !== null;
159
+ case "poi":
160
+ case "row":
161
+ case "address": return value !== null;
162
+ case "object": return fieldsPresent(isRecord(def.fields) ? def.fields : {}, value);
124
163
  default: return value != null && value !== "";
125
164
  }
126
165
  }
127
- function rowPresent(fields, row) {
128
- const source = isRecord(row) ? row : {};
166
+ function fieldsPresent(fields, value) {
167
+ const source = isRecord(value) ? value : {};
129
168
  return Object.entries(fields).some(([field, def]) => presentValue(def, source[field]));
130
169
  }
131
170
  function itemPresentValue(def, value) {
132
171
  const slot = def;
133
172
  if (slot.type !== "list") return true;
134
- if (isRecord(slot.fields)) return rowPresent(slot.fields, value);
173
+ const fields = itemFieldsOf(slot);
174
+ if (fields !== void 0) return fieldsPresent(fields, value);
135
175
  return slot.element == null ? value != null : presentValue(slot.element, value);
136
176
  }
137
177
  function bindSlots(schema, slots) {
138
178
  const bindings = {};
139
179
  for (const [id, def] of Object.entries(schema.slots)) {
140
180
  const value = normalizeValue(def, slots[id]);
181
+ const fields = objectFieldsOf(def);
141
182
  bindings[id] = {
183
+ ...fields === void 0 ? {} : bindRowFields(id, fields, value),
142
184
  id,
143
185
  def,
144
186
  value,
@@ -147,39 +189,55 @@ function bindSlots(schema, slots) {
147
189
  }
148
190
  return bindings;
149
191
  }
150
- function bindRowFields(binding, index) {
151
- const row = binding.value[index] ?? {};
192
+ function objectFieldsOf(def) {
193
+ const { type, fields } = def;
194
+ return type === "object" && isRecord(fields) ? fields : void 0;
195
+ }
196
+ const BINDING_OWN = new Set(OBJECT_BINDING_OWN_KEYS);
197
+ function bindRowFields(slot, defs, value, item, enclosing) {
198
+ const source = isRecord(value) ? value : {};
152
199
  const fields = {};
153
- for (const [field, def] of Object.entries(binding.def.fields)) {
154
- const value = normalizeValue(def, row[field]);
200
+ for (const [field, def] of Object.entries(defs)) {
201
+ if (BINDING_OWN.has(field)) continue;
202
+ const fieldValue = normalizeValue(def, source[field]);
155
203
  fields[field] = {
156
- slot: binding.id,
157
- item: index,
158
- field,
204
+ ...enclosing ?? {
205
+ slot,
206
+ ...item === void 0 ? {} : { item },
207
+ field
208
+ },
159
209
  def,
160
- value,
161
- present: presentValue(def, value)
210
+ value: fieldValue,
211
+ present: presentValue(def, fieldValue)
162
212
  };
163
213
  }
164
214
  return fields;
165
215
  }
166
- function isRecordItemDef(def) {
167
- if (typeof def !== "object" || def == null) return false;
168
- const { type, fields } = def;
169
- return type === "list" && isRecord(fields);
170
- }
171
216
  function bindItems(binding) {
172
217
  const values = binding.value ?? [];
173
218
  const slotName = "id" in binding ? binding.id : binding.field;
174
- const recordItem = isRecordItemDef(binding.def);
219
+ const objectFields = itemFieldsOf(binding.def);
220
+ const element = binding.def.element;
221
+ const enclosing = "id" in binding || objectFields === void 0 ? void 0 : fieldAddressOf(binding);
175
222
  return values.map((value, index) => ({
223
+ ...objectFields === void 0 ? {} : {
224
+ ...bindRowFields(slotName, objectFields, value, index, enclosing),
225
+ def: element
226
+ },
176
227
  slot: slotName,
177
228
  index,
178
229
  value,
179
230
  present: itemPresentValue(binding.def, value),
180
- ...recordItem ? { fields: bindRowFields(binding, index) } : {}
231
+ ...enclosing === void 0 ? {} : { enclosing }
181
232
  }));
182
233
  }
234
+ function fieldAddressOf(binding) {
235
+ return {
236
+ slot: binding.slot,
237
+ ...binding.item === void 0 ? {} : { item: binding.item },
238
+ field: binding.field
239
+ };
240
+ }
183
241
 
184
242
  //#endregion
185
- export { bindItems, bindSlots, isRecordItemDef, videoValuePresent };
243
+ export { bindItems, bindSlots, videoValuePresent };
@@ -1,35 +1,40 @@
1
1
  import { DocumentValue } from "../packages/internal/template-contracts/dist/document-value.js";
2
2
  import { ValueBinding } from "./slot-scalar.js";
3
- import { ComponentPropsWithoutRef, ElementType, ReactNode } from "react";
3
+ import { HTMLAttributes, ReactNode } from "react";
4
4
  //#region src/primitives/slot-document.d.ts
5
- type DocumentOwnProps<D> = {
5
+ type DocumentProps<D> = Omit<HTMLAttributes<HTMLElement>, "title" | "slot"> & {
6
6
  slot: ValueBinding<D> & {
7
7
  value: DocumentValue | null | undefined;
8
8
  };
9
- /** Author markup inside the marked element (an icon, the filename, a size
10
- * line) — rendered in every branch, absent value included. */
11
- children?: ReactNode;
9
+ /** Titles the `<iframe>` for assistive technology. Defaults to the file's name. */
10
+ title?: string;
11
+ /** Render inside the kit's frame — a clipped, relatively positioned wrapper the viewer
12
+ * fills edge to edge, tinted when there is nothing to show. It has NO geometry of its
13
+ * own: `className` lands on it and your classes are its whole box. `false` renders a
14
+ * bare `<iframe>` instead. Default `true`. */
15
+ frame?: boolean;
12
16
  /** `false` declines selection on THIS copy (a carousel clone, a responsive mirror) —
13
17
  * full identity stays, and the copy is still patched live. */
14
18
  selectable?: boolean;
15
19
  };
16
- type DocumentProps<D, As extends ElementType> = DocumentOwnProps<D> & {
17
- /** The element (or component) the document link lands on. Defaults to `a`. */
18
- as?: As;
19
- } & Omit<ComponentPropsWithoutRef<As>, keyof DocumentOwnProps<D> | "as">;
20
20
  /**
21
- * Slot.Document — renders the slot's document as one anchor, with the author's
22
- * children as its contents. Opens in a new tab by default (`target="_blank"`,
23
- * `rel="noopener noreferrer"`); both are ordinary props and an author may
24
- * override either.
21
+ * Slot.Document — embeds the slot's PDF in the browser's own viewer.
25
22
  *
26
- * An unfilled slot renders the same marked element with no `href` — a
27
- * placeholder that is still selectable in the editor, never a dead link.
28
- * Never a text leaf: the value is a URL in an attribute, and what the element
29
- * says is the author's markup.
23
+ * **Framed** (default): a wrapper — `relative`, clipped, tinted via
24
+ * `.concrete-image-frame` — that your `className` lands on and the viewer absolutely
25
+ * fills. Size the wrapper with your own classes, as for `Slot.Image` and `Slot.Tour`.
26
+ *
27
+ * **Empty is a neutral rect.** An unfilled slot, and a document that is not a PDF,
28
+ * render the frame alone: the browser has no inline viewer for any other format.
29
+ * Link to such a file with `Slot.Download`, or draw its first page with `Slot.Image`.
30
+ *
31
+ * Over an open-kind `media()` slot, narrow on the value's `kind` first and hand it the
32
+ * narrowed value, as `Slot.Video` takes it.
30
33
  */
31
34
  declare function SlotDocument<D extends {
32
35
  type: "document";
33
- }, As extends ElementType = "a">(props: DocumentProps<D, As>): ReactNode;
36
+ } | {
37
+ type: "media";
38
+ }>(props: DocumentProps<D>): ReactNode;
34
39
  //#endregion
35
40
  export { SlotDocument };
@@ -1,24 +1,49 @@
1
- import { useSlotProbe } from "./probe-context.js";
2
1
  import { ATTR_SLOT_UNSELECTABLE } from "../packages/internal/template-contracts/dist/markers.js";
3
2
  import { identityMarkerAttrs } from "./marker-attrs.js";
4
3
  import { jsx } from "react/jsx-runtime";
5
4
 
6
5
  //#region src/primitives/slot-document.tsx
6
+ const PDF = "application/pdf";
7
7
  function SlotDocument(props) {
8
- const { slot, as, children, selectable = true, ...rest } = props;
9
- useSlotProbe(slot);
10
- const Tag = as ?? "a";
11
- const url = slot.value?.url;
12
- return /* @__PURE__ */ jsx(Tag, {
13
- ...typeof url === "string" && url !== "" ? {
14
- href: url,
15
- target: "_blank",
16
- rel: "noopener noreferrer"
17
- } : {},
18
- ...rest,
8
+ const { slot, title, frame, className, selectable = true, ...rest } = props;
9
+ const markerAttrs = {
19
10
  ...identityMarkerAttrs(slot),
20
- ...selectable ? {} : { [ATTR_SLOT_UNSELECTABLE]: "" },
21
- children
11
+ ...selectable ? {} : { [ATTR_SLOT_UNSELECTABLE]: "" }
12
+ };
13
+ const value = slot.value;
14
+ const isPdf = value?.content_type.split(";")[0]?.trim().toLowerCase() === PDF;
15
+ const src = value && value.url !== "" && isPdf ? value.url : null;
16
+ const label = title ?? value?.filename ?? "";
17
+ const unframedCls = ["concrete-image-block", className].filter(Boolean).join(" ");
18
+ const viewer = src === null ? null : /* @__PURE__ */ jsx("iframe", {
19
+ src,
20
+ title: label || "Document",
21
+ loading: "lazy",
22
+ className: frame === false ? unframedCls : "absolute inset-0 h-full w-full",
23
+ ...frame === false ? {
24
+ ...rest,
25
+ ...markerAttrs
26
+ } : {}
27
+ });
28
+ if (frame === false) {
29
+ if (viewer) return viewer;
30
+ return /* @__PURE__ */ jsx("div", {
31
+ className: unframedCls,
32
+ role: "img",
33
+ "aria-label": label || void 0,
34
+ ...rest,
35
+ ...markerAttrs
36
+ });
37
+ }
38
+ return /* @__PURE__ */ jsx("div", {
39
+ className: ["concrete-image-frame concrete-image-block relative overflow-hidden", className].filter(Boolean).join(" "),
40
+ ...viewer ? {} : {
41
+ role: "img",
42
+ "aria-label": label || void 0
43
+ },
44
+ ...rest,
45
+ ...markerAttrs,
46
+ children: viewer
22
47
  });
23
48
  }
24
49
 
@@ -0,0 +1,39 @@
1
+ import { DocumentValue } from "../packages/internal/template-contracts/dist/document-value.js";
2
+ import { VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
3
+ import { ImageValue } from "../packages/internal/template-contracts/dist/runtime-values.js";
4
+ import { ValueBinding } from "./slot-scalar.js";
5
+ import { ComponentPropsWithoutRef, ElementType, ReactNode } from "react";
6
+ //#region src/primitives/slot-download.d.ts
7
+ type DownloadOwnProps<D> = {
8
+ slot: ValueBinding<D> & {
9
+ value: ImageValue | VideoValue | DocumentValue | null | undefined;
10
+ };
11
+ /** Author markup inside the marked element (an icon, the filename, a size
12
+ * line) — rendered in every branch, absent value included. */
13
+ children?: ReactNode;
14
+ /** `false` declines selection on THIS copy (a carousel clone, a responsive mirror) —
15
+ * full identity stays, and the copy is still patched live. */
16
+ selectable?: boolean;
17
+ };
18
+ type DownloadProps<D, As extends ElementType> = DownloadOwnProps<D> & {
19
+ /** The element (or component) the download link lands on. Defaults to `a`. */
20
+ as?: As;
21
+ } & Omit<ComponentPropsWithoutRef<As>, keyof DownloadOwnProps<D> | "as">;
22
+ /**
23
+ * Slot.Download — renders one anchor at the original of an image, video or
24
+ * document slot's asset, with the author's children as its contents. Opens in a
25
+ * new tab by default (`target="_blank"`, `rel="noopener noreferrer"`); both are
26
+ * ordinary props and an author may override either, or add `download`.
27
+ *
28
+ * An image links its uncropped picture whatever crop the slot shows, a video its
29
+ * hosted file, a document the file itself. A slot with nothing to hand over — an
30
+ * unfilled slot, or a video that is a provider link — renders the same marked
31
+ * element with no `href`: a placeholder that is still selectable in the editor,
32
+ * never a dead link. Never a text leaf: the value is a URL in an attribute, and
33
+ * what the element says is the author's markup.
34
+ */
35
+ declare function SlotDownload<D extends {
36
+ type: "image" | "video" | "document" | "media";
37
+ }, As extends ElementType = "a">(props: DownloadProps<D, As>): ReactNode;
38
+ //#endregion
39
+ export { SlotDownload };
@@ -0,0 +1,39 @@
1
+ import { ATTR_SLOT_UNSELECTABLE } from "../packages/internal/template-contracts/dist/markers.js";
2
+ import { identityMarkerAttrs } from "./marker-attrs.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+
5
+ //#region src/primitives/slot-download.tsx
6
+ function originalUrl(def, value) {
7
+ if (!value) return "";
8
+ const declared = def.type;
9
+ switch (declared === "media" ? value.kind : declared) {
10
+ case "image": {
11
+ const image = value;
12
+ return image.download_url || image.url;
13
+ }
14
+ case "video": {
15
+ const video = value;
16
+ return video.source === "link" ? "" : video.url;
17
+ }
18
+ default: return value.url;
19
+ }
20
+ }
21
+ function SlotDownload(props) {
22
+ const { slot, as, children, selectable = true, ...rest } = props;
23
+ const Tag = as ?? "a";
24
+ const url = originalUrl(slot.def, slot.value);
25
+ return /* @__PURE__ */ jsx(Tag, {
26
+ ...url !== "" ? {
27
+ href: url,
28
+ target: "_blank",
29
+ rel: "noopener noreferrer"
30
+ } : {},
31
+ ...rest,
32
+ ...identityMarkerAttrs(slot),
33
+ ...selectable ? {} : { [ATTR_SLOT_UNSELECTABLE]: "" },
34
+ children
35
+ });
36
+ }
37
+
38
+ //#endregion
39
+ export { SlotDownload };
@@ -2,14 +2,14 @@ import { FieldBinding, SlotBinding } from "./slot-bindings.js";
2
2
  import { ComponentProps, ElementType, ReactNode } from "react";
3
3
  //#region src/primitives/slot-list.d.ts
4
4
  type SlotListOwnProps<D> = {
5
- /** The collection to mark: a top-level slot binding, or a row field's collection
6
- * binding (a `list` declared inside a record item). */
5
+ /** The list to mark: a top-level slot binding, or an object field's list
6
+ * binding (a `list` declared inside an object). */
7
7
  slot: SlotBinding<D> | FieldBinding<D>;
8
8
  /** `false` declines selection on THIS copy (a carousel clone, a responsive
9
9
  * mirror) — full identity stays, and the copy is still patched live. */
10
10
  selectable?: boolean;
11
11
  /** The author's own markup — iteration is plain `bindItems(...).map(...)`; an empty
12
- * collection renders these children (a placeholder) inside the marked container. */
12
+ * list renders these children (a placeholder) inside the marked container. */
13
13
  children?: ReactNode;
14
14
  };
15
15
  type SlotListProps<D, As extends ElementType> = SlotListOwnProps<D> & {
@@ -1,4 +1,3 @@
1
- import { useSlotProbe } from "./probe-context.js";
2
1
  import { ATTR_SLOT_UNSELECTABLE } from "../packages/internal/template-contracts/dist/markers.js";
3
2
  import { identityMarkerAttrs } from "./marker-attrs.js";
4
3
  import { jsx } from "react/jsx-runtime";
@@ -6,7 +5,6 @@ import { jsx } from "react/jsx-runtime";
6
5
  //#region src/primitives/slot-list.tsx
7
6
  function SlotList(props) {
8
7
  const { slot, as, children, selectable = true, ...rest } = props;
9
- useSlotProbe(slot);
10
8
  const Container = as;
11
9
  const containerAttrs = {
12
10
  ...identityMarkerAttrs(slot),
@@ -1,6 +1,7 @@
1
- import { VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
1
+ import { DocumentValue } from "../packages/internal/template-contracts/dist/document-value.js";
2
2
  import { TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
3
- import { ImageValue } from "../schema/runtime-values.js";
3
+ import { VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
4
+ import { ImageValue, MediaValue } from "../packages/internal/template-contracts/dist/runtime-values.js";
4
5
  import { Image } from "./Image.js";
5
6
  import { ValueBinding } from "./slot-scalar.js";
6
7
  import { Tour } from "./Tour.js";
@@ -9,7 +10,7 @@ import { ComponentProps, ReactNode } from "react";
9
10
  //#region src/primitives/slot-media.d.ts
10
11
  type SlotImageProps<D> = Omit<ComponentProps<typeof Image>, "value" | "slot" | "mobileBreakpoint"> & {
11
12
  slot: ValueBinding<D> & {
12
- value: ImageValue | VideoValue | TourValue | null | undefined;
13
+ value: ImageValue | VideoValue | TourValue | DocumentValue | MediaValue | null | undefined;
13
14
  };
14
15
  /** `false` declines selection on THIS copy (a carousel clone, a responsive mirror) —
15
16
  * full identity stays, and the copy is still patched live. */
@@ -29,9 +30,18 @@ type SlotImageProps<D> = Omit<ComponentProps<typeof Image>, "value" | "slot" | "
29
30
  * repatches this element. A poster that does not exist yet — a transcode still running,
30
31
  * or a tour provider that published no thumbnail — renders `<Image>`'s ordinary empty
31
32
  * rect. `rendition` has no effect here: a poster carries no per-view crop.
33
+ *
34
+ * **Over a document slot it renders the document's first page**, the preview the
35
+ * platform renders from a PDF, titled by the file's name. A document with no preview
36
+ * — any other format, or a PDF whose preview has not been rendered yet — renders the
37
+ * empty rect.
38
+ *
39
+ * **Over an open-kind `media()` slot it draws whatever the value is** — the image
40
+ * itself, or the still of a video, tour or document, by the value's `kind` — so a
41
+ * gallery's thumbnails need no narrowing.
32
42
  */
33
43
  declare function SlotImage<D extends {
34
- type: "image" | "video" | "tour";
44
+ type: "image" | "video" | "tour" | "document" | "media";
35
45
  }>(props: SlotImageProps<D>): ReactNode;
36
46
  type SlotVideoProps<D> = Omit<ComponentProps<typeof Video>, "value" | "playback" | "slot"> & {
37
47
  slot: ValueBinding<D> & {
@@ -45,9 +55,15 @@ type SlotVideoProps<D> = Omit<ComponentProps<typeof Video>, "value" | "playback"
45
55
  * Slot.Video — binds `<Video>` to a slot: `playback` comes from the slot's own declared
46
56
  * `def`; `frame` and the rest are `<Video>`'s own props with its own defaults. See
47
57
  * `./Video.js` for the framed/unframed/poster-only render contract.
58
+ *
59
+ * Over an open-kind `media()` slot, narrow on the value's `kind` first and hand it the
60
+ * narrowed value — `value?.kind === "video" && <Slot.Video slot={{ ...slot, value }} />`.
61
+ * A `media()` slot declares no `playback`, so it plays as a plain controls player.
48
62
  */
49
63
  declare function SlotVideo<D extends {
50
64
  type: "video";
65
+ } | {
66
+ type: "media";
51
67
  }>(props: SlotVideoProps<D>): ReactNode;
52
68
  type SlotTourProps<D> = Omit<ComponentProps<typeof Tour>, "value" | "slot"> & {
53
69
  slot: ValueBinding<D> & {
@@ -62,10 +78,13 @@ type SlotTourProps<D> = Omit<ComponentProps<typeof Tour>, "value" | "slot"> & {
62
78
  * with its own defaults. See `./Tour.js` for the framed/unframed/empty render contract.
63
79
  *
64
80
  * Bind the SAME slot to `Slot.Image` to render the tour's thumbnail instead — or beside
65
- * this one, for two positions from one selection.
81
+ * this one, for two positions from one selection. Over an open-kind `media()` slot,
82
+ * narrow on the value's `kind` first and hand it the narrowed value, as `Slot.Video` takes it.
66
83
  */
67
84
  declare function SlotTour<D extends {
68
85
  type: "tour";
86
+ } | {
87
+ type: "media";
69
88
  }>(props: SlotTourProps<D>): ReactNode;
70
89
  //#endregion
71
90
  export { SlotImage, SlotTour, SlotVideo };
@@ -1,4 +1,3 @@
1
- import { useSlotProbe } from "./probe-context.js";
2
1
  import { ATTR_SLOT_UNSELECTABLE } from "../packages/internal/template-contracts/dist/markers.js";
3
2
  import { identityMarkerAttrs } from "./marker-attrs.js";
4
3
  import { Image } from "./Image.js";
@@ -17,23 +16,23 @@ function posterAsImage(value) {
17
16
  return {
18
17
  photo_id: "",
19
18
  url: value.poster,
20
- alt: value.alt,
19
+ alt: "alt" in value ? value.alt : value.filename,
21
20
  responsive: value.poster_responsive ?? null
22
21
  };
23
22
  }
24
- function isPosterSlot(def) {
25
- const type = def.type;
26
- return type === "video" || type === "tour";
23
+ function isPosterSlot(def, value) {
24
+ const declared = def.type;
25
+ const type = declared === "media" ? value?.kind : declared;
26
+ return type === "video" || type === "tour" || type === "document";
27
27
  }
28
28
  function SlotImage(props) {
29
29
  const { slot, selectable = true, ...rest } = props;
30
- useSlotProbe(slot);
31
30
  const markerAttrs = {
32
31
  ...identityMarkerAttrs(slot),
33
32
  ...selectable ? {} : { [ATTR_SLOT_UNSELECTABLE]: "" }
34
33
  };
35
34
  return /* @__PURE__ */ jsx(Image, {
36
- value: isPosterSlot(slot.def) && slot.value ? posterAsImage(slot.value) : slot.value,
35
+ value: isPosterSlot(slot.def, slot.value) && slot.value ? posterAsImage(slot.value) : slot.value,
37
36
  mobileBreakpoint: declaredMobileBreakpoint(slot.def),
38
37
  ...rest,
39
38
  ...markerAttrs
@@ -41,7 +40,6 @@ function SlotImage(props) {
41
40
  }
42
41
  function SlotVideo(props) {
43
42
  const { slot, selectable = true, ...rest } = props;
44
- useSlotProbe(slot);
45
43
  const markerAttrs = {
46
44
  ...identityMarkerAttrs(slot),
47
45
  ...selectable ? {} : { [ATTR_SLOT_UNSELECTABLE]: "" }
@@ -55,7 +53,6 @@ function SlotVideo(props) {
55
53
  }
56
54
  function SlotTour(props) {
57
55
  const { slot, selectable = true, ...rest } = props;
58
- useSlotProbe(slot);
59
56
  const markerAttrs = {
60
57
  ...identityMarkerAttrs(slot),
61
58
  ...selectable ? {} : { [ATTR_SLOT_UNSELECTABLE]: "" }
@@ -0,0 +1,49 @@
1
+ import { ComponentProps, ElementType, ReactNode } from "react";
2
+ //#region src/primitives/slot-object.d.ts
3
+ /** A top-level object's binding, as `Slot.Object` reads it: its id and its object definition. */
4
+ type ObjectTarget = {
5
+ readonly id: string;
6
+ readonly def: {
7
+ readonly type: "object";
8
+ };
9
+ };
10
+ /**
11
+ * An item of a list of objects, as `Slot.Object` reads it: its list, its index and its
12
+ * object definition — and, for an item of an object's list of objects, the enclosing
13
+ * field it marks as.
14
+ */
15
+ type ObjectItemTarget = {
16
+ readonly slot: string;
17
+ readonly index: number;
18
+ readonly def: {
19
+ readonly type: "object";
20
+ };
21
+ readonly enclosing?: {
22
+ readonly field: string;
23
+ };
24
+ };
25
+ type SlotObjectOwnProps = {
26
+ /** The object to mark: a top-level object's binding, or one `ItemBinding` of a list of objects. */
27
+ slot: ObjectTarget | ObjectItemTarget;
28
+ /** `false` declines selection on THIS copy (a carousel clone, a responsive
29
+ * mirror) — full identity stays, and the copy is still patched live. */
30
+ selectable?: boolean;
31
+ children: ReactNode;
32
+ };
33
+ type SlotObjectProps<As extends ElementType> = SlotObjectOwnProps & {
34
+ /** The element (or component) this primitive renders and marks. Defaults to `div`. */
35
+ as?: As;
36
+ } & Omit<ComponentProps<As>, "slot" | "selectable" | "children" | "as">;
37
+ /**
38
+ * Render `as` (a host element or component, `div` by default) carrying the object's
39
+ * marker: `<Slot.Object slot={slot.contact}>` emits `data-slot-id="contact"`, and
40
+ * `<Slot.Object slot={item}>` over an object item's `ItemBinding` emits
41
+ * `data-slot-item` — so the editor outlines and edits the container as one sidebar
42
+ * card. Render the object's fields inside it, each through its own binding
43
+ * (`slot.contact.phone`, `item.price`). Rendering the same object again
44
+ * (a clone slide, a second layout branch) is just another `Slot.Object` over the same
45
+ * binding; every copy is live.
46
+ */
47
+ declare function SlotObject<As extends ElementType = "div">(props: SlotObjectProps<As>): ReactNode;
48
+ //#endregion
49
+ export { SlotObject };