@homepages/concrete 12.0.0 → 13.0.1

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 (311) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/README.md +8 -10
  3. package/codemods/fixtures-are-data.mjs +7 -0
  4. package/codemods/fixtures-list-properties.mjs +6 -0
  5. package/codemods/manifest.json +15 -0
  6. package/codemods/steps/fixtures-list-properties.mjs +16 -0
  7. package/codemods/steps/fixtures-to-data.mjs +41 -0
  8. package/dist/artifact/playground/client/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
  9. package/dist/artifact/playground/client/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
  10. package/dist/artifact/playground/client/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
  11. package/dist/artifact/playground/client/assets/index-Bmvcss4B.js +1338 -0
  12. package/dist/artifact/playground/client/assets/index-C01UCAWD.css +1 -0
  13. package/dist/artifact/playground/client/index.html +2 -2
  14. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
  15. package/dist/artifact/playground/host.mjs +110 -59
  16. package/dist/base.css +2 -2
  17. package/dist/cli/build/icons.js +1 -1
  18. package/dist/cli/build/index.js +11 -10
  19. package/dist/cli/build/manifest.js +44 -0
  20. package/dist/cli/build/record.js +123 -0
  21. package/dist/cli/build/sections.js +28 -18
  22. package/dist/cli/build/source.js +1 -1
  23. package/dist/cli/build/static.js +8 -5
  24. package/dist/cli/build/template-build.js +614 -0
  25. package/dist/cli/check/analyze.js +18 -1
  26. package/dist/cli/check/load-workspace.js +2 -2
  27. package/dist/cli/check/portable-names.js +1 -1
  28. package/dist/cli/check/render/corpus.js +119 -0
  29. package/dist/cli/check/render/invariants.js +1 -0
  30. package/dist/cli/check/stages/bundles.js +15 -18
  31. package/dist/cli/check/stages/composition.js +8 -25
  32. package/dist/cli/check/stages/fixtures.js +14 -10
  33. package/dist/cli/check/stages/logic.js +7 -23
  34. package/dist/cli/check/stages/render.js +12 -14
  35. package/dist/cli/check/stages/sections.js +22 -66
  36. package/dist/cli/check/stages/stylesheet.js +4 -26
  37. package/dist/cli/check/stages/workspace.js +27 -22
  38. package/dist/cli/commands.js +51 -23
  39. package/dist/cli/currency/preamble.js +1 -1
  40. package/dist/cli/currency/resolve-latest.js +3 -2
  41. package/dist/cli/dev/capture-browser.js +26 -0
  42. package/dist/cli/dev/fixture-schema.js +441 -0
  43. package/dist/cli/dev/folder-files.js +244 -0
  44. package/dist/cli/dev/index.js +7 -3
  45. package/dist/cli/dev/playground-server.js +34 -0
  46. package/dist/cli/dev/section-ladders.js +76 -0
  47. package/dist/cli/dev/server.js +120 -304
  48. package/dist/cli/install/background.js +16 -0
  49. package/dist/cli/install/index.js +45 -0
  50. package/dist/cli/install/tools.js +27 -0
  51. package/dist/cli/media/derive.js +19 -13
  52. package/dist/cli/media/deriver-plugin.js +14 -3
  53. package/dist/cli/property/fixture-list.js +46 -0
  54. package/dist/cli/property/index.js +12 -9
  55. package/dist/cli/property/library.js +12 -10
  56. package/dist/cli/publish/artifact.js +90 -0
  57. package/dist/cli/publish/captures.js +61 -0
  58. package/dist/cli/publish/fixtures.js +17 -0
  59. package/dist/cli/publish/index.js +10 -18
  60. package/dist/cli/{build → publish}/playground.js +3 -3
  61. package/dist/cli/publish/report.js +15 -33
  62. package/dist/cli/upgrade/codemod.d.ts +14 -0
  63. package/dist/cli/upgrade/fixture-conversion.d.ts +11 -0
  64. package/dist/cli/upgrade/fixture-conversion.js +54 -0
  65. package/dist/cli/upgrade/fixture-modules.js +125 -0
  66. package/dist/cli/upgrade/fixtures-to-data.d.ts +40 -0
  67. package/dist/cli/upgrade/fixtures-to-data.js +498 -0
  68. package/dist/cli/upgrade/index.js +18 -2
  69. package/dist/cli/upgrade/legacy-fixtures.d.ts +34 -0
  70. package/dist/cli/upgrade/legacy-fixtures.js +22 -0
  71. package/dist/cli/upgrade/stage.js +1 -1
  72. package/dist/cli/workspace-fixtures.js +80 -0
  73. package/dist/cli.js +1 -0
  74. package/dist/css/compile.js +9 -3
  75. package/dist/fixtures/bundle-rule.js +16 -16
  76. package/dist/fixtures/media-plugin.js +12 -33
  77. package/dist/fixtures/synthesize-empties.js +3 -2
  78. package/dist/index.d.ts +7 -7
  79. package/dist/{playground-island-runtime.d.ts → island-runtime.d.ts} +1 -2
  80. package/dist/{playground-island-runtime.js → island-runtime.js} +1 -2
  81. package/dist/islands/client-module.js +1 -1
  82. package/dist/{cli/dev → islands}/tsconfig-paths.js +2 -14
  83. package/dist/islands/wrap.js +40 -0
  84. package/dist/node_modules/.pnpm/acorn@8.18.0/node_modules/acorn/dist/acorn.js +5119 -0
  85. package/dist/packages/external/concrete/package.js +1 -1
  86. package/dist/packages/internal/bundle-evaluation/dist/cache.js +36 -0
  87. package/dist/packages/internal/bundle-evaluation/dist/evaluate.js +174 -0
  88. package/dist/packages/internal/bundle-evaluation/dist/index.js +5 -0
  89. package/dist/packages/internal/bundle-evaluation/dist/section-code.js +10 -0
  90. package/dist/packages/internal/capture-settle/dist/index.js +2 -2
  91. package/dist/packages/internal/capture-settle/dist/settle.js +88 -13
  92. package/dist/packages/internal/code-fingerprint/dist/index.js +57 -0
  93. package/dist/packages/internal/content-doc-ops/dist/index.js +176 -0
  94. package/dist/packages/internal/content-doc-ops/dist/made-rows.js +15 -0
  95. package/dist/packages/internal/deliverable-reads/dist/bootstrap.js +81 -0
  96. package/dist/packages/internal/deliverable-reads/dist/display.js +21 -0
  97. package/dist/packages/internal/deliverable-reads/dist/format.js +15 -0
  98. package/dist/packages/internal/deliverable-reads/dist/index.js +7 -0
  99. package/dist/packages/internal/deliverable-reads/dist/pages.js +29 -0
  100. package/dist/packages/internal/deliverable-reads/dist/requirements.js +72 -0
  101. package/dist/{cli/capture → packages/internal/download-files/dist}/bundle.js +8 -4
  102. package/dist/packages/internal/download-files/dist/capture-origin.js +126 -0
  103. package/dist/packages/internal/download-files/dist/capture-routes.js +139 -0
  104. package/dist/packages/internal/download-files/dist/capture-shell.js +38 -0
  105. package/dist/packages/internal/download-files/dist/capture.js +74 -0
  106. package/dist/packages/internal/download-files/dist/egress-watch.js +38 -0
  107. package/dist/packages/internal/download-files/dist/files.js +7 -0
  108. package/dist/packages/internal/download-files/dist/finish.js +35 -0
  109. package/dist/packages/internal/download-files/dist/fleet.js +94 -0
  110. package/dist/packages/internal/download-files/dist/format.js +40 -0
  111. package/dist/packages/internal/download-files/dist/make.js +105 -0
  112. package/dist/packages/internal/download-files/dist/master-tally.js +32 -0
  113. package/dist/packages/internal/download-files/dist/names.js +24 -0
  114. package/dist/packages/internal/download-files/dist/pdf-boxes.js +33 -0
  115. package/dist/packages/internal/download-files/dist/pdf-image-placements.js +194 -0
  116. package/dist/packages/internal/download-files/dist/pdf-images.js +289 -0
  117. package/dist/packages/internal/file-store/dist/files.js +8 -0
  118. package/dist/packages/internal/file-store/dist/lru.js +40 -0
  119. package/dist/packages/internal/file-store/dist/refusal.js +12 -0
  120. package/dist/packages/internal/file-store/dist/trees.js +151 -0
  121. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +1 -1
  122. package/dist/packages/internal/fill-bake/dist/compute-reads.js +47 -21
  123. package/dist/packages/internal/fill-bake/dist/index.js +5 -1
  124. package/dist/packages/internal/fill-bake/dist/item-merge.js +4 -3
  125. package/dist/packages/internal/fill-bake/dist/resolve-instance.js +9 -0
  126. package/dist/packages/internal/fill-bake/dist/resolve.js +3 -0
  127. package/dist/packages/internal/fill-bake/dist/round-trip.js +2 -0
  128. package/dist/packages/internal/fill-bake/dist/strip.js +6 -0
  129. package/dist/packages/internal/fill-vocabulary/dist/holder.js +1 -1
  130. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
  131. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +1 -1
  132. package/dist/packages/internal/island-runtime/dist/index.js +1 -10
  133. package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +5 -0
  134. package/dist/packages/internal/lead-fields/dist/ingest.js +72 -0
  135. package/dist/packages/internal/media-resolution/dist/video.js +6 -2
  136. package/dist/packages/internal/page-render/dist/addresses.js +57 -0
  137. package/dist/packages/internal/page-render/dist/index.js +6 -0
  138. package/dist/packages/internal/page-render/dist/kept.js +30 -0
  139. package/dist/packages/internal/page-render/dist/nav.js +42 -0
  140. package/dist/packages/internal/page-render/dist/render.js +152 -0
  141. package/dist/packages/internal/page-shell/dist/assemble.js +161 -0
  142. package/dist/packages/internal/page-shell/dist/escape.js +10 -0
  143. package/dist/packages/internal/page-shell/dist/frame.js +23 -0
  144. package/dist/packages/internal/page-shell/dist/index.js +26 -0
  145. package/dist/packages/internal/playground/dist/build-fingerprint.js +18 -0
  146. package/dist/packages/internal/playground/dist/fixture-conversions/list-names-properties.js +76 -0
  147. package/dist/packages/internal/playground/dist/fixture-formats.d.ts +37 -0
  148. package/dist/packages/internal/playground/dist/fixture-formats.js +20 -0
  149. package/dist/packages/internal/playground/dist/host/bootstrap.js +108 -0
  150. package/dist/packages/internal/playground/dist/host/built.js +202 -0
  151. package/dist/packages/internal/playground/dist/host/catalog-fixture.js +53 -0
  152. package/dist/packages/internal/playground/dist/host/download.js +34 -0
  153. package/dist/packages/internal/playground/dist/host/env.js +11 -0
  154. package/dist/packages/internal/playground/dist/host/everywhere-saves.js +353 -0
  155. package/dist/packages/internal/playground/dist/host/fixture-addresses.js +52 -0
  156. package/dist/packages/internal/playground/dist/host/fixture-documents.js +494 -0
  157. package/dist/packages/internal/playground/dist/host/fixture-operations.js +364 -0
  158. package/dist/packages/internal/playground/dist/host/fixture-units.js +93 -0
  159. package/dist/{fixtures → packages/internal/playground/dist/host}/image-dimensions.js +1 -1
  160. package/dist/packages/internal/playground/dist/host/leads.js +41 -0
  161. package/dist/packages/internal/playground/dist/host/media-saves.js +309 -0
  162. package/dist/{fixtures → packages/internal/playground/dist/host}/media-store.js +79 -26
  163. package/dist/packages/internal/playground/dist/host/overridable.js +9 -0
  164. package/dist/packages/internal/playground/dist/host/owned-saves.js +203 -0
  165. package/dist/{playground → packages/internal/playground/dist}/host/page-state.js +1 -1
  166. package/dist/packages/internal/playground/dist/host/program.js +54 -0
  167. package/dist/packages/internal/playground/dist/host/property-derive.js +216 -0
  168. package/dist/packages/internal/playground/dist/host/property-saves.js +74 -0
  169. package/dist/{fixtures → packages/internal/playground/dist/host}/property.js +88 -229
  170. package/dist/packages/internal/playground/dist/host/provenance.js +49 -0
  171. package/dist/packages/internal/playground/dist/host/resolve.js +553 -0
  172. package/dist/packages/internal/playground/dist/host/row-images.js +41 -0
  173. package/dist/{fixtures → packages/internal/playground/dist/host}/rows.js +1 -1
  174. package/dist/packages/internal/playground/dist/host/save.js +429 -0
  175. package/dist/packages/internal/playground/dist/host/serve.js +952 -0
  176. package/dist/packages/internal/playground/dist/host/site.js +79 -0
  177. package/dist/packages/internal/playground/dist/host/slots.js +202 -0
  178. package/dist/packages/internal/playground/dist/host/stated-content.js +93 -0
  179. package/dist/packages/internal/playground/dist/host/stored-fixtures.js +135 -0
  180. package/dist/packages/internal/playground/dist/host/violations.js +7 -0
  181. package/dist/packages/internal/playground/dist/jobs/lanes.js +24 -0
  182. package/dist/packages/internal/playground/dist/jobs/memory-queue.js +112 -0
  183. package/dist/packages/internal/playground/dist/jobs/probe.js +37 -0
  184. package/dist/packages/internal/playground/dist/jobs/queue.js +28 -0
  185. package/dist/packages/internal/playground/dist/jobs/runner.js +207 -0
  186. package/dist/packages/internal/playground/dist/layout.js +14 -0
  187. package/dist/packages/internal/playground/dist/platform.js +33 -0
  188. package/dist/packages/internal/playground/dist/server/changes.js +57 -0
  189. package/dist/packages/internal/playground/dist/server/crop.js +47 -0
  190. package/dist/packages/internal/playground/dist/server/derived-files.js +88 -0
  191. package/dist/packages/internal/playground/dist/server/download.js +158 -0
  192. package/dist/{cli/dev → packages/internal/playground/dist/server}/http.js +4 -12
  193. package/dist/packages/internal/playground/dist/server/jobs.js +29 -0
  194. package/dist/{cli/dev → packages/internal/playground/dist/server}/listen.js +4 -11
  195. package/dist/packages/internal/playground/dist/server/playground-server.js +424 -0
  196. package/dist/{cli/dev → packages/internal/playground/dist/server}/request-error.js +1 -1
  197. package/dist/packages/internal/playground/dist/server/size-ladders.js +170 -0
  198. package/dist/packages/internal/playground/dist/server/verification.js +75 -0
  199. package/dist/packages/internal/playground/dist/server/verify-build.js +139 -0
  200. package/dist/packages/internal/playground/dist/wire.js +78 -0
  201. package/dist/packages/internal/property-facts/dist/registry-facts.js +1 -1
  202. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +1 -1
  203. package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +1 -1
  204. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
  205. package/dist/packages/internal/site-files/dist/head.js +59 -0
  206. package/dist/packages/internal/site-files/dist/index.js +4 -0
  207. package/dist/packages/internal/site-files/dist/site.js +211 -0
  208. package/dist/packages/internal/static-assets-binding/dist/index.js +32 -0
  209. package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +38 -5
  210. package/dist/packages/internal/template-artifact/dist/asset-mime.js +8 -1
  211. package/dist/packages/internal/template-artifact/dist/build.js +148 -0
  212. package/dist/packages/internal/template-artifact/dist/composition.js +62 -0
  213. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  214. package/dist/packages/internal/template-artifact/dist/layout.js +48 -12
  215. package/dist/packages/internal/template-artifact/dist/manifest.js +3 -10
  216. package/dist/packages/internal/template-artifact/dist/verify.js +51 -31
  217. package/dist/packages/internal/template-contracts/dist/address-value.js +6 -1
  218. package/dist/packages/internal/template-contracts/dist/content-categories.js +10 -1
  219. package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +1 -1
  220. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +1 -1
  221. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +3 -3
  222. package/dist/packages/internal/template-contracts/dist/fact-registry.js +59 -32
  223. package/dist/packages/internal/template-contracts/dist/fill-spec.js +14 -1
  224. package/dist/packages/internal/template-contracts/dist/list.d.ts +3 -3
  225. package/dist/packages/internal/template-contracts/dist/media-candidates.js +67 -2
  226. package/dist/packages/internal/template-contracts/dist/media-offer.js +180 -0
  227. package/dist/packages/internal/template-contracts/dist/object.d.ts +2 -2
  228. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +9 -2
  229. package/dist/packages/internal/template-contracts/dist/read-graph.js +36 -2
  230. package/dist/packages/internal/template-contracts/dist/ref-locate.js +16 -1
  231. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +9 -10
  232. package/dist/packages/internal/template-contracts/dist/registry-facts.js +12 -1
  233. package/dist/packages/internal/template-contracts/dist/registry-graph.js +112 -0
  234. package/dist/packages/internal/template-contracts/dist/registry-shape.js +15 -2
  235. package/dist/packages/internal/template-contracts/dist/require-graph.js +300 -0
  236. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +3 -3
  237. package/dist/packages/internal/template-contracts/dist/row.d.ts +3 -3
  238. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +1 -1
  239. package/dist/{schema → packages/internal/template-contracts/dist}/section-nav.d.ts +1 -1
  240. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +4 -4
  241. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +3 -1
  242. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +24 -1
  243. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +26 -1
  244. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +1 -1
  245. package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -1
  246. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +1 -1
  247. package/dist/packages/internal/template-contracts/dist/table-members.js +7 -2
  248. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +1 -1
  249. package/dist/packages/internal/upload-formats/dist/heic.js +35 -0
  250. package/dist/packages/internal/upload-formats/dist/index.js +80 -0
  251. package/dist/packages/internal/upload-formats/dist/magic-bytes.js +293 -0
  252. package/dist/platform/paths.js +1 -0
  253. package/dist/platform/process.js +49 -1
  254. package/dist/rules/registry.js +27 -3
  255. package/dist/schema/fact.d.ts +2 -2
  256. package/dist/schema/facts-view.d.ts +1 -1
  257. package/dist/schema/section-props.d.ts +1 -1
  258. package/dist/schema/section-schema.d.ts +1 -1
  259. package/dist/schema/section-schema.js +1 -0
  260. package/dist/section/declare.d.ts +1 -1
  261. package/dist/section/discovery.js +6 -2
  262. package/dist/section/publish-shape.js +38 -0
  263. package/dist/section/section.d.ts +1 -1
  264. package/dist/template/define-template.d.ts +14 -4
  265. package/dist/template/define-template.js +2 -0
  266. package/dist/template/logic-shim.d.ts +1 -1
  267. package/dist/template/materialize.js +1 -1
  268. package/dist/template/running-copy.js +0 -1
  269. package/dist/template/section-reads.js +1 -1
  270. package/guide/reference/cli/INDEX.md +6 -5
  271. package/guide/reference/cli/build.md +10 -8
  272. package/guide/reference/cli/check.md +4 -2
  273. package/guide/reference/cli/dev.md +6 -2
  274. package/guide/reference/cli/install.md +41 -0
  275. package/guide/reference/cli/property-add.md +5 -4
  276. package/guide/reference/cli/property-list.md +2 -2
  277. package/guide/reference/cli/publish.md +5 -5
  278. package/guide/reference/cli/upgrade.md +1 -1
  279. package/guide/reference/rules/INDEX.md +8 -4
  280. package/package.json +14 -30
  281. package/dist/artifact/playground/client/assets/index-BcLGpWLR.js +0 -1266
  282. package/dist/artifact/playground/client/assets/index-CxWPYOH2.css +0 -1
  283. package/dist/cli/build/artifact.js +0 -220
  284. package/dist/cli/build/captures.js +0 -48
  285. package/dist/cli/build/fixtures.js +0 -92
  286. package/dist/cli/capture/capture-browser.js +0 -37
  287. package/dist/cli/capture/capture.js +0 -115
  288. package/dist/cli/check/render/inputs.js +0 -60
  289. package/dist/cli/check/render/nav.js +0 -31
  290. package/dist/cli/dev/crop.js +0 -20
  291. package/dist/cli/dev/fixture-ladders.js +0 -96
  292. package/dist/cli/dev/hmr.js +0 -26
  293. package/dist/cli/dev/islands.js +0 -234
  294. package/dist/cli/dev/load-template.js +0 -52
  295. package/dist/cli/dev/vite.js +0 -114
  296. package/dist/cli/dev/workspace-reader.js +0 -249
  297. package/dist/cli/publish/freshness.js +0 -64
  298. package/dist/fixtures/brand.d.ts +0 -4
  299. package/dist/fixtures/brand.js +0 -8
  300. package/dist/fixtures/load.js +0 -159
  301. package/dist/fixtures/resolve.js +0 -392
  302. package/dist/fixtures.d.ts +0 -429
  303. package/dist/fixtures.js +0 -23
  304. package/dist/packages/internal/canvas-core/dist/island-host.js +0 -62
  305. package/dist/packages/internal/canvas-core/dist/island-shields.js +0 -30
  306. package/dist/playground/canvas-island-host.d.ts +0 -11
  307. package/dist/playground/canvas-island-host.js +0 -29
  308. package/dist/playground/canvas-markers.js +0 -14
  309. package/dist/playground/host/paths.js +0 -8
  310. package/dist/playground/layout.js +0 -17
  311. package/dist/playground/wire.js +0 -28
@@ -0,0 +1,353 @@
1
+ import { normalizeAddressValue } from "../../../template-contracts/dist/address-value.js";
2
+ import { withSubsetOrder } from "../../../template-contracts/dist/media-candidates.js";
3
+ import { tableHome, tableNames } from "../../../template-contracts/dist/registry-shape.js";
4
+ import { pickedMediaField, propertyFacts } from "../../../template-contracts/dist/fact-registry.js";
5
+ import { tableFields } from "../../../template-contracts/dist/table-members.js";
6
+ import { comparableImageId, contactImageId } from "./property-derive.js";
7
+ import { HostRefusal } from "./env.js";
8
+ import { withMadeRows } from "../../../content-doc-ops/dist/made-rows.js";
9
+ import { factWrite } from "./property-saves.js";
10
+
11
+ //#region ../../internal/playground/dist/host/everywhere-saves.js
12
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
13
+ const NO_MEDIA = {
14
+ staged: /* @__PURE__ */ new Map(),
15
+ adoptedMember: (instance, slot) => {
16
+ throw new HostRefusal(422, `"${instance}.${slot}": this batch reads no section, so nothing adopts.`);
17
+ }
18
+ };
19
+ function applyEverywhere(target, property, ops, onContentOp, media = NO_MEDIA) {
20
+ const working = {
21
+ property: { ...property },
22
+ rowIds: /* @__PURE__ */ new Map(),
23
+ media,
24
+ committed: /* @__PURE__ */ new Set()
25
+ };
26
+ for (const sent of ops) {
27
+ const op = withMadeRows(sent, working.rowIds);
28
+ if (op.op === "set_slot" || op.op === "relink_slot") onContentOp(op);
29
+ else applyFactOp(target, working, op);
30
+ }
31
+ return {
32
+ property: working.property,
33
+ rowIds: working.rowIds,
34
+ committed: working.committed
35
+ };
36
+ }
37
+ function applyFactOp(target, working, op) {
38
+ switch (op.op) {
39
+ case "set_value":
40
+ working.property = factWrite(target, working.property, op.path, op.value);
41
+ return;
42
+ case "add_row":
43
+ addRow(working, op.home, op.path, op.value, op.temp_id);
44
+ return;
45
+ case "remove_row":
46
+ removeRow(working, op.home, op.path);
47
+ return;
48
+ case "pick":
49
+ pick(working, op.path, op.id);
50
+ return;
51
+ case "unpick":
52
+ unpick(working, op.path, op.id);
53
+ return;
54
+ case "order":
55
+ order(working, op.home, op.path, op.ids);
56
+ return;
57
+ case "set_list":
58
+ setList(working, op.path, op.list);
59
+ return;
60
+ case "clear_media":
61
+ clearMedia(working, op.path);
62
+ return;
63
+ case "commit_media":
64
+ commitMedia(working, op.path, op.media_id);
65
+ return;
66
+ case "adopt_media":
67
+ adoptMedia(working, op.instance_id, op.slot, op.row_id, op.media_id);
68
+ return;
69
+ }
70
+ }
71
+ const isTable = (name) => tableNames().includes(name);
72
+ function listDeclaration(key, path) {
73
+ const pages = propertyFacts.pages;
74
+ const declaration = (Object.hasOwn(pages, key) ? pages[key] : void 0)?.declaration;
75
+ if (declaration?.type !== "list") throw new HostRefusal(400, `"${path}" names no list the property holds.`);
76
+ return declaration;
77
+ }
78
+ function rowsOf(property, key) {
79
+ const rows = property[key];
80
+ return Array.isArray(rows) ? rows : [];
81
+ }
82
+ function fieldsOf(element, table) {
83
+ if (element.type === "object") return element.fields;
84
+ if (element.type === "row" && table !== null && isTable(table)) return tableFields(table);
85
+ return {};
86
+ }
87
+ function identityOf(element, item) {
88
+ if (!isRecord(item)) return null;
89
+ const picked = pickedMediaField(element);
90
+ if (picked !== null) return mediaIdOf(item[picked]);
91
+ if (typeof item["id"] === "string") return item["id"];
92
+ return mediaIdOf(item);
93
+ }
94
+ function mediaIdOf(value) {
95
+ if (typeof value === "string" && value !== "") return value;
96
+ if (!isRecord(value)) return null;
97
+ for (const key of ["media", "media_id"]) if (typeof value[key] === "string" && value[key] !== "") return value[key];
98
+ return null;
99
+ }
100
+ function isMediaPick(declaration) {
101
+ return [
102
+ "media",
103
+ "image",
104
+ "video",
105
+ "tour",
106
+ "document"
107
+ ].includes(declaration.type) && declaration.from !== void 0;
108
+ }
109
+ function isOwnedMedia(declaration) {
110
+ return [
111
+ "image",
112
+ "video",
113
+ "tour",
114
+ "document"
115
+ ].includes(declaration.type) && declaration.from === void 0;
116
+ }
117
+ function listAt(property, path) {
118
+ const parts = path.split(".");
119
+ const [key] = parts;
120
+ const top = listDeclaration(key, path);
121
+ if (parts.length === 1) return {
122
+ path,
123
+ element: top.element,
124
+ items: rowsOf(property, key),
125
+ write: (items) => ({
126
+ ...property,
127
+ [key]: [...items]
128
+ })
129
+ };
130
+ if (parts.length !== 3) throw new HostRefusal(400, `"${path}" names no list: a list is a fact, or a row's list member.`);
131
+ const [, rowId, member] = parts;
132
+ const field = fieldsOf(top.element, key)[member];
133
+ if (field?.type !== "list") throw new HostRefusal(400, `"${path}" names no list a ${key} row holds.`);
134
+ const rows = rowsOf(property, key);
135
+ const row = rows.find((r) => identityOf(top.element, r) === rowId);
136
+ if (!isRecord(row)) throw new HostRefusal(404, `The property document holds no ${key} row "${rowId}".`);
137
+ const items = Array.isArray(row[member]) ? row[member] : [];
138
+ return {
139
+ path,
140
+ element: field.element,
141
+ items,
142
+ write: (next) => ({
143
+ ...property,
144
+ [key]: rows.map((r) => r === row ? {
145
+ ...row,
146
+ [member]: [...next]
147
+ } : r)
148
+ })
149
+ };
150
+ }
151
+ function itemAt(property, path) {
152
+ const cut = path.lastIndexOf(".");
153
+ if (cut < 0) throw new HostRefusal(400, `"${path}" names no row or item.`);
154
+ return {
155
+ list: listAt(property, path.slice(0, cut)),
156
+ id: path.slice(cut + 1)
157
+ };
158
+ }
159
+ function documentValue(declaration, value, at) {
160
+ if (value === void 0) return null;
161
+ if (isOwnedMedia(declaration)) {
162
+ if (value === null) return null;
163
+ throw new HostRefusal(422, `${at}: a row's own image is set by committing a file staged for it, not by a value.`);
164
+ }
165
+ if (isMediaPick(declaration)) {
166
+ const id = mediaIdOf(value);
167
+ return id === null ? null : { media: id };
168
+ }
169
+ if (declaration.type === "address") return value === null ? null : normalizeAddressValue(value);
170
+ if (declaration.type === "list") return (Array.isArray(value) ? value : []).filter((entry) => entry !== null && entry !== void 0 && entry !== "").map((entry, i) => documentValue(declaration.element, entry, `${at}[${String(i)}]`));
171
+ if (declaration.type === "object") return isRecord(value) ? documentObject(declaration.fields, value, at) : null;
172
+ return value;
173
+ }
174
+ const isDerived = (declaration) => declaration.source?.kind === "compute";
175
+ function documentObject(fields, value, at) {
176
+ for (const name of Object.keys(value)) {
177
+ if (name === "id") continue;
178
+ const field = Object.hasOwn(fields, name) ? fields[name] : void 0;
179
+ if (field === void 0) throw new HostRefusal(400, `${at}: the item declares no field "${name}".`);
180
+ if (isDerived(field)) throw new HostRefusal(400, `${at}: "${name}" is derived, so no one writes it.`);
181
+ }
182
+ const out = {};
183
+ for (const [name, field] of Object.entries(fields)) {
184
+ if (isDerived(field)) continue;
185
+ out[name] = Object.hasOwn(value, name) ? documentValue(field, value[name], `${at}.${name}`) : field.type === "list" ? [] : null;
186
+ }
187
+ return out;
188
+ }
189
+ const newRowId = () => globalThis.crypto.randomUUID();
190
+ function addRow(working, home, path, value, tempId) {
191
+ const fields = isRecord(value) ? value : {};
192
+ if (home === "library") {
193
+ if (path !== "contacts" || !isTable(path) || tableHome(path) !== "library") throw new HostRefusal(400, `"${path}" names no list of the library.`);
194
+ const id = newRowId();
195
+ const row = {
196
+ id,
197
+ ...documentObject(tableFields(path), fields, `add_row "${path}"`)
198
+ };
199
+ working.property = {
200
+ ...working.property,
201
+ contacts: [...rowsOf(working.property, "contacts"), row]
202
+ };
203
+ working.rowIds.set(tempId, id);
204
+ return;
205
+ }
206
+ const list = listAt(working.property, path);
207
+ const { element } = list;
208
+ if (element.type !== "object") throw new HostRefusal(422, `"${path}" is a list of ${element.type === "row" ? "rows the library holds, so add one there and pick it" : "picks, so pick one"}.`);
209
+ const added = documentObject(element.fields, fields, `add_row "${path}"`);
210
+ const picked = pickedMediaField(element);
211
+ if (picked !== null) {
212
+ const reference = identityOf(element, added);
213
+ if (reference === null) throw new HostRefusal(400, `add_row "${path}": an item of this list is named by the ${picked} it picks; pick one.`);
214
+ const held = list.items.find((item) => identityOf(element, item) === reference);
215
+ working.property = held === void 0 ? list.write([added, ...list.items]) : list.write(list.items.map((item) => item === held ? {
216
+ ...item,
217
+ ...stated(added, fields)
218
+ } : item));
219
+ working.rowIds.set(tempId, reference);
220
+ return;
221
+ }
222
+ const id = newRowId();
223
+ working.property = list.write([{
224
+ id,
225
+ ...added
226
+ }, ...list.items]);
227
+ working.rowIds.set(tempId, id);
228
+ }
229
+ function stated(added, carried) {
230
+ return Object.fromEntries(Object.entries(added).filter(([name]) => Object.hasOwn(carried, name)));
231
+ }
232
+ function removeRow(working, home, path) {
233
+ if (home === "library" && path.split(".")[0] !== "contacts") throw new HostRefusal(400, `"${path}" names no row of the library.`);
234
+ const { list, id } = itemAt(working.property, path);
235
+ if (!list.items.some((item) => identityOf(list.element, item) === id)) throw new HostRefusal(404, `"${list.path}" holds no item "${id}".`);
236
+ working.property = list.write(list.items.filter((item) => identityOf(list.element, item) !== id));
237
+ }
238
+ function pick(working, path, id) {
239
+ const list = listAt(working.property, path);
240
+ const { element } = list;
241
+ if (element.type === "row") {
242
+ if (!list.items.some((item) => identityOf(element, item) === id)) throw new HostRefusal(404, `The fixture's library holds no ${path} row "${id}".`);
243
+ return;
244
+ }
245
+ if (!isMediaPick(element)) throw new HostRefusal(400, `"${path}" is not a list of picks.`);
246
+ if (list.items.some((item) => identityOf(element, item) === id)) return;
247
+ if (!rowsOf(working.property, "uploads").some((upload) => isRecord(upload) && upload["id"] === id)) throw new HostRefusal(404, `The property's uploads hold no "${id}" to pick.`);
248
+ working.property = list.write([...list.items, { media: id }]);
249
+ }
250
+ function unpick(working, path, id) {
251
+ const list = listAt(working.property, path);
252
+ if (list.element.type !== "row" && !isMediaPick(list.element)) throw new HostRefusal(400, `"${path}" is not a list of picks.`);
253
+ if (!list.items.some((item) => identityOf(list.element, item) === id)) return;
254
+ working.property = list.write(list.items.filter((item) => identityOf(list.element, item) !== id));
255
+ }
256
+ function order(working, home, path, ids) {
257
+ if (home === "library") throw new HostRefusal(422, `The fixture's library is its property's ${path}; order them on the property.`);
258
+ const list = listAt(working.property, path);
259
+ const held = list.items.map((item) => identityOf(list.element, item) ?? "");
260
+ const next = withSubsetOrder(held, ids);
261
+ const byId = new Map(list.items.map((item, i) => [held[i], item]));
262
+ if (next.every((id, i) => id === held[i])) return;
263
+ working.property = list.write(next.map((id) => byId.get(id)));
264
+ }
265
+ function setList(working, path, desired) {
266
+ if (path.split(".").length !== 3) throw new HostRefusal(400, `"${path}" names no list nested in a row.`);
267
+ const list = listAt(working.property, path);
268
+ const { element } = list;
269
+ if (desired.kind === "picks") {
270
+ if (!isMediaPick(element)) throw new HostRefusal(400, `"${path}" is not a list of picks.`);
271
+ const held = new Map(list.items.map((item) => [identityOf(element, item), item]));
272
+ working.property = list.write(desired.media_ids.map((id) => held.get(id) ?? { media: id }));
273
+ return;
274
+ }
275
+ if (element.type !== "object") return;
276
+ const unmatched = [...list.items];
277
+ const take = (id) => {
278
+ if (id === null) return void 0;
279
+ const at = unmatched.findIndex((item) => identityOf(element, item) === id);
280
+ return at < 0 ? void 0 : unmatched.splice(at, 1)[0];
281
+ };
282
+ const picked = pickedMediaField(element);
283
+ const next = desired.items.map((wanted, i) => {
284
+ const held = take(wanted.id) ?? (picked === null ? void 0 : take(mediaIdOf(wanted.fields[picked])));
285
+ const at = `set_list "${path}"[${String(i)}]`;
286
+ if (isRecord(held)) {
287
+ const edits = {};
288
+ for (const [name, value] of Object.entries(wanted.fields)) {
289
+ const field = Object.hasOwn(element.fields, name) ? element.fields[name] : void 0;
290
+ if (field === void 0) throw new HostRefusal(400, `${at}: the item declares no field "${name}".`);
291
+ edits[name] = documentValue(field, value === "" ? null : value, `${at}.${name}`);
292
+ }
293
+ return {
294
+ ...held,
295
+ ...edits
296
+ };
297
+ }
298
+ const fields = Object.fromEntries(Object.entries(wanted.fields).filter(([, value]) => value !== null));
299
+ const added = documentObject(element.fields, fields, at);
300
+ if (picked !== null) {
301
+ if (identityOf(element, added) === null) throw new HostRefusal(400, `${at}: an item of this list is named by the ${picked} it picks; pick one.`);
302
+ return added;
303
+ }
304
+ return {
305
+ id: newRowId(),
306
+ ...added
307
+ };
308
+ });
309
+ working.property = list.write(next);
310
+ }
311
+ function ownedRowFieldAt(property, path) {
312
+ const parts = path.split(".");
313
+ if (parts.length !== 3) throw new HostRefusal(400, `"${path}" is in no row, so nothing can own its media.`);
314
+ const [table, rowId, member] = parts;
315
+ const { list } = itemAt(property, `${table}.${rowId}`);
316
+ const field = fieldsOf(list.element, table)[member];
317
+ if (field === void 0 || !isOwnedMedia(field)) throw new HostRefusal(400, `"${path}" is not an owned media field.`);
318
+ const row = list.items.find((item) => identityOf(list.element, item) === rowId);
319
+ if (!isRecord(row)) throw new HostRefusal(404, `The property document holds no ${table} row "${rowId}".`);
320
+ return {
321
+ table,
322
+ rowId,
323
+ member,
324
+ kind: field.type,
325
+ heldId: table === "comparables" ? comparableImageId(rowId) : contactImageId(rowId, member),
326
+ held: row[member],
327
+ write: (value) => list.write(list.items.map((item) => item === row ? {
328
+ ...row,
329
+ [member]: value
330
+ } : item))
331
+ };
332
+ }
333
+ function clearMedia(working, path) {
334
+ const field = ownedRowFieldAt(working.property, path);
335
+ if (field.held === null || field.held === void 0) return;
336
+ working.property = field.write(null);
337
+ }
338
+ function commitMedia(working, path, mediaId) {
339
+ const field = ownedRowFieldAt(working.property, path);
340
+ if (mediaId === field.heldId && field.held !== null && field.held !== void 0) return;
341
+ const staged = working.media.staged.get(mediaId);
342
+ if (staged === void 0) throw new HostRefusal(404, `"${path}" holds no media "${mediaId}": no such file was uploaded for it in the property's folder or staged in the content fixture named.`);
343
+ if (staged.kind !== field.kind) throw new HostRefusal(415, `"${path}" holds ${field.kind === "image" ? "an" : "a"} ${field.kind}, and "${mediaId}" is ${staged.kind === "image" ? "an" : "a"} ${staged.kind}.`);
344
+ working.property = field.write(staged.file);
345
+ working.committed.add(mediaId);
346
+ }
347
+ function adoptMedia(working, instance, slot, rowId, mediaId) {
348
+ const member = working.media.adoptedMember(instance, slot);
349
+ commitMedia(working, `${member.table}.${rowId}.${member.member}`, mediaId);
350
+ }
351
+
352
+ //#endregion
353
+ export { applyEverywhere, ownedRowFieldAt };
@@ -0,0 +1,52 @@
1
+ import { ROUTES } from "../wire.js";
2
+ import { enabledPages } from "./page-state.js";
3
+
4
+ //#region ../../internal/playground/dist/host/fixture-addresses.js
5
+ function fixtureAddresses(plan, property, fixture) {
6
+ const { template } = plan;
7
+ const pages = enabledPages(fixture, template.pages);
8
+ if (template.output === "website") {
9
+ const paths = pages.map((page) => ({
10
+ page: page.id,
11
+ path: page.path ?? "/"
12
+ }));
13
+ return {
14
+ canvas: template.canvases.map((canvas) => ({
15
+ canvas: canvas.id,
16
+ href: ROUTES.canvas(property, fixture.id, canvas.id, null)
17
+ })),
18
+ live: paths.map(({ page, path }) => ({
19
+ page,
20
+ href: ROUTES.live(property, fixture.id, path)
21
+ })),
22
+ site: paths.map(({ page, path }) => ({
23
+ page,
24
+ href: ROUTES.site(property, fixture.id, path)
25
+ }))
26
+ };
27
+ }
28
+ const canvas = template.canvases.flatMap((c) => template.formats.map((format) => ({
29
+ canvas: c.id,
30
+ format: format.id,
31
+ href: ROUTES.canvas(property, fixture.id, c.id, format.id)
32
+ })));
33
+ if (!(plan.downloads === "made" || plan.downloads === "shipped" && fixture.capturable !== false) || pages.length === 0) return { canvas };
34
+ const pageImages = plan.downloads === "made" || template.output === "image";
35
+ return {
36
+ canvas,
37
+ download: template.formats.map((format) => ({
38
+ format: format.id,
39
+ href: ROUTES.download(property, fixture.id, { format: format.id }),
40
+ pages: pageImages ? pages.map((page) => ({
41
+ page: page.id,
42
+ href: ROUTES.download(property, fixture.id, {
43
+ format: format.id,
44
+ page: page.id
45
+ })
46
+ })) : []
47
+ }))
48
+ };
49
+ }
50
+
51
+ //#endregion
52
+ export { fixtureAddresses };