@homepages/concrete 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +174 -0
  3. package/codemods/manifest.json +9 -0
  4. package/dist/artifact/playground/client/assets/index-BSA1yutg.css +1 -0
  5. package/dist/artifact/playground/client/assets/index-JloQyj8h.js +1101 -0
  6. package/dist/artifact/playground/client/index.html +13 -0
  7. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -0
  8. package/dist/artifact/playground/host.mjs +127 -0
  9. package/dist/asset-modules.d.ts +99 -0
  10. package/dist/base.css +220 -0
  11. package/dist/browser/site-config.d.ts +18 -0
  12. package/dist/browser/site-config.js +56 -0
  13. package/dist/browser/submit-lead.d.ts +98 -0
  14. package/dist/browser/submit-lead.js +188 -0
  15. package/dist/browser.d.ts +3 -0
  16. package/dist/browser.js +4 -0
  17. package/dist/cli/build/artifact.js +225 -0
  18. package/dist/cli/build/captures.js +67 -0
  19. package/dist/cli/build/esbuild.js +127 -0
  20. package/dist/cli/build/fixtures.js +96 -0
  21. package/dist/cli/build/icons.js +76 -0
  22. package/dist/cli/build/index.js +38 -0
  23. package/dist/cli/build/playground.js +31 -0
  24. package/dist/cli/build/sections.js +236 -0
  25. package/dist/cli/build/source.js +62 -0
  26. package/dist/cli/build/static.js +156 -0
  27. package/dist/cli/capture/bundle.js +37 -0
  28. package/dist/cli/capture/capture-browser.js +51 -0
  29. package/dist/cli/capture/capture.js +121 -0
  30. package/dist/cli/check/analyze.js +95 -0
  31. package/dist/cli/check/index.js +19 -0
  32. package/dist/cli/check/load-workspace.js +119 -0
  33. package/dist/cli/check/messages.js +16 -0
  34. package/dist/cli/check/render/class-conflicts.js +39 -0
  35. package/dist/cli/check/render/html.js +86 -0
  36. package/dist/cli/check/render/inputs.js +53 -0
  37. package/dist/cli/check/render/invariants.js +58 -0
  38. package/dist/cli/check/render/island-frames.js +72 -0
  39. package/dist/cli/check/render/marker-coverage.js +102 -0
  40. package/dist/cli/check/render/nav.js +64 -0
  41. package/dist/cli/check/report.js +73 -0
  42. package/dist/cli/check/stages/bundles.js +129 -0
  43. package/dist/cli/check/stages/composition.js +67 -0
  44. package/dist/cli/check/stages/contracts.js +22 -0
  45. package/dist/cli/check/stages/dependencies.js +261 -0
  46. package/dist/cli/check/stages/fixtures.js +74 -0
  47. package/dist/cli/check/stages/lint.js +41 -0
  48. package/dist/cli/check/stages/logic.js +63 -0
  49. package/dist/cli/check/stages/render.js +144 -0
  50. package/dist/cli/check/stages/sections.js +83 -0
  51. package/dist/cli/check/stages/stylesheet.js +31 -0
  52. package/dist/cli/check/stages/typecheck.js +68 -0
  53. package/dist/cli/check/stages/workspace.js +26 -0
  54. package/dist/cli/commands.js +342 -0
  55. package/dist/cli/currency/cache.js +89 -0
  56. package/dist/cli/currency/decide.js +65 -0
  57. package/dist/cli/currency/opt-out.js +16 -0
  58. package/dist/cli/currency/preamble.js +183 -0
  59. package/dist/cli/currency/prompt.js +28 -0
  60. package/dist/cli/currency/refresh.js +44 -0
  61. package/dist/cli/currency/resolve-latest.js +185 -0
  62. package/dist/cli/currency/version-order.js +38 -0
  63. package/dist/cli/dev/crop.js +22 -0
  64. package/dist/cli/dev/hmr.js +26 -0
  65. package/dist/cli/dev/http.js +129 -0
  66. package/dist/cli/dev/index.js +70 -0
  67. package/dist/cli/dev/islands.js +390 -0
  68. package/dist/cli/dev/load-template.js +46 -0
  69. package/dist/cli/dev/request-error.js +22 -0
  70. package/dist/cli/dev/server.js +307 -0
  71. package/dist/cli/dev/tsconfig-paths.js +95 -0
  72. package/dist/cli/dev/vite.js +85 -0
  73. package/dist/cli/dev/workspace-reader.js +274 -0
  74. package/dist/cli/io.d.ts +14 -0
  75. package/dist/cli/media/cache.js +125 -0
  76. package/dist/cli/media/derive.js +252 -0
  77. package/dist/cli/media/deriver-plugin.js +71 -0
  78. package/dist/cli/property/index.js +180 -0
  79. package/dist/cli/property/library.js +137 -0
  80. package/dist/cli/publish/client.js +119 -0
  81. package/dist/cli/publish/freshness.js +66 -0
  82. package/dist/cli/publish/git.js +43 -0
  83. package/dist/cli/publish/index.js +207 -0
  84. package/dist/cli/publish/pack.js +78 -0
  85. package/dist/cli/publish/report.js +98 -0
  86. package/dist/cli/publish/target.js +87 -0
  87. package/dist/cli/publish/wire.js +29 -0
  88. package/dist/cli/tar.js +87 -0
  89. package/dist/cli/upgrade/codemod.js +56 -0
  90. package/dist/cli/upgrade/index.js +263 -0
  91. package/dist/cli/upgrade/manifest.js +72 -0
  92. package/dist/cli/upgrade/plan.js +68 -0
  93. package/dist/cli/upgrade/stage.js +71 -0
  94. package/dist/cli/version.d.ts +12 -0
  95. package/dist/cli/version.js +15 -0
  96. package/dist/cli/workspace.js +108 -0
  97. package/dist/cli.d.ts +6 -0
  98. package/dist/cli.js +94 -0
  99. package/dist/css/compile.js +77 -0
  100. package/dist/css/graph.js +109 -0
  101. package/dist/css/inline.js +132 -0
  102. package/dist/css/rules.js +65 -0
  103. package/dist/design-system/format-variants.js +127 -0
  104. package/dist/eslint/authoring.js +46 -0
  105. package/dist/eslint/correctness.js +42 -0
  106. package/dist/eslint/rules/editor-declaration.js +103 -0
  107. package/dist/eslint/rules/editor-reason.js +135 -0
  108. package/dist/eslint/rules/island-imports.js +20 -0
  109. package/dist/eslint/rules/jsx-visitor.js +20 -0
  110. package/dist/eslint/rules/no-client-runtime.js +88 -0
  111. package/dist/eslint/rules/no-editor-globals.js +60 -0
  112. package/dist/eslint/rules/no-hard-coded-color.js +183 -0
  113. package/dist/eslint/rules/no-inline-style.js +24 -0
  114. package/dist/eslint/rules/no-marker-literal.js +37 -0
  115. package/dist/eslint/rules/no-nondeterminism.js +44 -0
  116. package/dist/eslint/rules/no-px-breakpoint.js +44 -0
  117. package/dist/eslint/rules/no-raw-values.js +45 -0
  118. package/dist/eslint/rules/serializable-props.js +95 -0
  119. package/dist/eslint.d.ts +6 -0
  120. package/dist/eslint.js +26 -0
  121. package/dist/fixtures/brand.d.ts +4 -0
  122. package/dist/fixtures/brand.js +9 -0
  123. package/dist/fixtures/bundle-rule.js +67 -0
  124. package/dist/fixtures/canonical.d.ts +149 -0
  125. package/dist/fixtures/image-dimensions.js +59 -0
  126. package/dist/fixtures/load.js +154 -0
  127. package/dist/fixtures/media-plugin.js +141 -0
  128. package/dist/fixtures/media.js +165 -0
  129. package/dist/fixtures/property.js +210 -0
  130. package/dist/fixtures/resolve.js +202 -0
  131. package/dist/fixtures/rows.js +108 -0
  132. package/dist/fixtures/synthesize-empties.js +42 -0
  133. package/dist/fixtures.d.ts +213 -0
  134. package/dist/fixtures.js +37 -0
  135. package/dist/index.d.ts +53 -0
  136. package/dist/index.js +37 -0
  137. package/dist/islands/client-module.js +97 -0
  138. package/dist/islands/marker.d.ts +43 -0
  139. package/dist/islands/marker.js +44 -0
  140. package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +687 -0
  141. package/dist/packages/external/concrete/package.js +5 -0
  142. package/dist/packages/internal/fact-interpolation/dist/index.js +22 -0
  143. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +111 -0
  144. package/dist/packages/internal/fill-bake/dist/display.js +9 -0
  145. package/dist/packages/internal/fill-bake/dist/index.js +6 -0
  146. package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +170 -0
  147. package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +32 -0
  148. package/dist/packages/internal/fill-vocabulary/dist/facts.js +131 -0
  149. package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +73 -0
  150. package/dist/packages/internal/format-geometry/dist/capture.js +404 -0
  151. package/dist/packages/internal/format-geometry/dist/format.d.ts +41 -0
  152. package/dist/packages/internal/format-geometry/dist/geometry.js +58 -0
  153. package/dist/packages/internal/format-geometry/dist/index.js +4 -0
  154. package/dist/packages/internal/image-descriptor/dist/index.d.ts +35 -0
  155. package/dist/packages/internal/image-ladder/dist/crop.js +82 -0
  156. package/dist/packages/internal/image-ladder/dist/encode.js +23 -0
  157. package/dist/packages/internal/image-ladder/dist/index.js +4 -0
  158. package/dist/packages/internal/image-ladder/dist/policy.js +102 -0
  159. package/dist/packages/internal/island-runtime/dist/capture-holds.d.ts +13 -0
  160. package/dist/packages/internal/island-runtime/dist/capture-holds.js +45 -0
  161. package/dist/packages/internal/island-runtime/dist/contract.d.ts +176 -0
  162. package/dist/packages/internal/island-runtime/dist/contract.js +94 -0
  163. package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +15 -0
  164. package/dist/packages/internal/island-runtime/dist/index.d.ts +103 -0
  165. package/dist/packages/internal/island-runtime/dist/index.js +163 -0
  166. package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +19 -0
  167. package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +39 -0
  168. package/dist/packages/internal/island-runtime/dist/use-editor.d.ts +22 -0
  169. package/dist/packages/internal/island-runtime/dist/use-editor.js +54 -0
  170. package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +105 -0
  171. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +25 -0
  172. package/dist/packages/internal/property-facts/dist/index.js +3 -0
  173. package/dist/packages/internal/property-facts/dist/property-facts-CSdkSuD7.js +181 -0
  174. package/dist/packages/internal/section-contracts/dist/cap-contract.js +59 -0
  175. package/dist/packages/internal/section-contracts/dist/catalog.js +102 -0
  176. package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +24 -0
  177. package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +48 -0
  178. package/dist/packages/internal/section-contracts/dist/display-contract.js +30 -0
  179. package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +17 -0
  180. package/dist/packages/internal/section-contracts/dist/group-contract.js +21 -0
  181. package/dist/packages/internal/section-contracts/dist/index.js +26 -0
  182. package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +48 -0
  183. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +53 -0
  184. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +70 -0
  185. package/dist/packages/internal/section-contracts/dist/name-title-contract.js +27 -0
  186. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +12 -0
  187. package/dist/packages/internal/section-contracts/dist/option-source-contract.js +22 -0
  188. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +18 -0
  189. package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +30 -0
  190. package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +24 -0
  191. package/dist/packages/internal/section-contracts/dist/row-contract.js +37 -0
  192. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +38 -0
  193. package/dist/packages/internal/section-contracts/dist/runners.js +181 -0
  194. package/dist/packages/internal/section-contracts/dist/select-contract.js +28 -0
  195. package/dist/packages/internal/section-contracts/dist/source-contract.js +48 -0
  196. package/dist/packages/internal/section-contracts/dist/source-filter-contract.js +15 -0
  197. package/dist/packages/internal/section-contracts/dist/sources-contract.js +28 -0
  198. package/dist/packages/internal/section-contracts/dist/url-contract.js +20 -0
  199. package/dist/packages/internal/source-resolution/dist/index.js +222 -0
  200. package/dist/packages/internal/template-artifact/dist/hash.js +50 -0
  201. package/dist/packages/internal/template-artifact/dist/index.js +7 -0
  202. package/dist/packages/internal/template-artifact/dist/layout.js +165 -0
  203. package/dist/packages/internal/template-artifact/dist/manifest.js +73 -0
  204. package/dist/packages/internal/template-artifact/dist/sha256.js +138 -0
  205. package/dist/packages/internal/template-artifact/dist/verify.js +275 -0
  206. package/dist/packages/internal/template-contracts/dist/collection-editing.js +38 -0
  207. package/dist/packages/internal/template-contracts/dist/content-categories.d.ts +10 -0
  208. package/dist/packages/internal/template-contracts/dist/content-categories.js +17 -0
  209. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +33 -0
  210. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +81 -0
  211. package/dist/packages/internal/template-contracts/dist/facts-view.js +136 -0
  212. package/dist/packages/internal/template-contracts/dist/layout.js +17 -0
  213. package/dist/packages/internal/template-contracts/dist/markers.d.ts +40 -0
  214. package/dist/packages/internal/template-contracts/dist/markers.js +41 -0
  215. package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +63 -0
  216. package/dist/packages/internal/template-contracts/dist/select-key.js +13 -0
  217. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +1112 -0
  218. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +1109 -0
  219. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +11 -0
  220. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +45 -0
  221. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +63 -0
  222. package/dist/playground/host/page-state.js +12 -0
  223. package/dist/playground/host/paths.js +9 -0
  224. package/dist/playground/layout.js +24 -0
  225. package/dist/playground/wire.js +36 -0
  226. package/dist/playground-island-runtime.d.ts +3 -0
  227. package/dist/playground-island-runtime.js +4 -0
  228. package/dist/primitives/FrameShell.d.ts +29 -0
  229. package/dist/primitives/FrameShell.js +34 -0
  230. package/dist/primitives/Image.d.ts +119 -0
  231. package/dist/primitives/Image.js +173 -0
  232. package/dist/primitives/Section.d.ts +22 -0
  233. package/dist/primitives/Section.js +26 -0
  234. package/dist/primitives/Tour.d.ts +43 -0
  235. package/dist/primitives/Tour.js +72 -0
  236. package/dist/primitives/Video.d.ts +57 -0
  237. package/dist/primitives/Video.js +116 -0
  238. package/dist/primitives/embed-playback.js +50 -0
  239. package/dist/primitives/index.d.ts +11 -0
  240. package/dist/primitives/marker-attrs.js +44 -0
  241. package/dist/primitives/object-fit.js +11 -0
  242. package/dist/primitives/picture-sources.d.ts +24 -0
  243. package/dist/primitives/picture-sources.js +52 -0
  244. package/dist/primitives/probe-context.js +24 -0
  245. package/dist/primitives/slot-bindings.d.ts +96 -0
  246. package/dist/primitives/slot-bindings.js +226 -0
  247. package/dist/primitives/slot-document.d.ts +35 -0
  248. package/dist/primitives/slot-document.js +37 -0
  249. package/dist/primitives/slot-group.d.ts +40 -0
  250. package/dist/primitives/slot-group.js +45 -0
  251. package/dist/primitives/slot-list.d.ts +21 -0
  252. package/dist/primitives/slot-list.js +23 -0
  253. package/dist/primitives/slot-media.d.ts +71 -0
  254. package/dist/primitives/slot-media.js +98 -0
  255. package/dist/primitives/slot-scalar.d.ts +53 -0
  256. package/dist/primitives/slot-scalar.js +98 -0
  257. package/dist/primitives/slot.d.ts +26 -0
  258. package/dist/primitives/slot.js +28 -0
  259. package/dist/rules/registry.js +479 -0
  260. package/dist/schema/compute.d.ts +22 -0
  261. package/dist/schema/compute.js +30 -0
  262. package/dist/schema/define-schema.d.ts +27 -0
  263. package/dist/schema/define-schema.js +73 -0
  264. package/dist/schema/extract-fill-spec.js +246 -0
  265. package/dist/schema/extract-used-facts.js +176 -0
  266. package/dist/schema/fact.d.ts +65 -0
  267. package/dist/schema/fact.js +33 -0
  268. package/dist/schema/fill-builders.d.ts +387 -0
  269. package/dist/schema/fill-builders.js +263 -0
  270. package/dist/schema/fill-declaration.d.ts +76 -0
  271. package/dist/schema/fill-declaration.js +43 -0
  272. package/dist/schema/fill-spec.d.ts +18 -0
  273. package/dist/schema/fill-spec.js +170 -0
  274. package/dist/schema/format-presets.d.ts +27 -0
  275. package/dist/schema/format-presets.js +76 -0
  276. package/dist/schema/format.d.ts +22 -0
  277. package/dist/schema/format.js +40 -0
  278. package/dist/schema/formats.d.ts +6 -0
  279. package/dist/schema/formats.js +7 -0
  280. package/dist/schema/layout.d.ts +32 -0
  281. package/dist/schema/layout.js +30 -0
  282. package/dist/schema/manifest.js +300 -0
  283. package/dist/schema/property-facts.d.ts +83 -0
  284. package/dist/schema/runtime-values.d.ts +88 -0
  285. package/dist/schema/section-nav.d.ts +38 -0
  286. package/dist/schema/section-nav.js +29 -0
  287. package/dist/schema/section-props.d.ts +98 -0
  288. package/dist/schema/section-schema.d.ts +53 -0
  289. package/dist/schema/section-schema.js +54 -0
  290. package/dist/schema/slot-builders.d.ts +497 -0
  291. package/dist/schema/slot-builders.js +331 -0
  292. package/dist/schema/slot-types.d.ts +110 -0
  293. package/dist/schema/slot-types.js +187 -0
  294. package/dist/section/declare.d.ts +44 -0
  295. package/dist/section/declare.js +27 -0
  296. package/dist/section/discovery.js +76 -0
  297. package/dist/section/groups.js +74 -0
  298. package/dist/section/materialize.js +28 -0
  299. package/dist/section/placements.js +28 -0
  300. package/dist/section/section.d.ts +69 -0
  301. package/dist/section/section.js +101 -0
  302. package/dist/site-analytics.d.ts +1 -0
  303. package/dist/site-analytics.js +15 -0
  304. package/dist/site-runtime/analytics.js +97 -0
  305. package/dist/site-runtime/site-integrations.js +97 -0
  306. package/dist/styles.css +60 -0
  307. package/dist/template/define-template.d.ts +139 -0
  308. package/dist/template/define-template.js +98 -0
  309. package/dist/template/logic-build.js +191 -0
  310. package/dist/template/logic-shim.d.ts +43 -0
  311. package/dist/template/logic-shim.js +52 -0
  312. package/dist/template/logic-transform.js +92 -0
  313. package/dist/template/materialize.js +107 -0
  314. package/dist/template/reconcile.d.ts +67 -0
  315. package/dist/template/reconcile.js +25 -0
  316. package/dist/template/running-copy.js +58 -0
  317. package/guide/reference/cli/INDEX.md +79 -0
  318. package/guide/reference/cli/build.md +48 -0
  319. package/guide/reference/cli/check.md +49 -0
  320. package/guide/reference/cli/dev.md +46 -0
  321. package/guide/reference/cli/property-add.md +53 -0
  322. package/guide/reference/cli/property-list.md +46 -0
  323. package/guide/reference/cli/publish.md +54 -0
  324. package/guide/reference/cli/upgrade.md +48 -0
  325. package/guide/reference/rules/INDEX.md +190 -0
  326. package/package.json +137 -0
  327. package/tsconfig.base.json +16 -0
@@ -0,0 +1,38 @@
1
+ import { EXECUTABLE_NESTED_TYPES, PLANNER_DECISION_TYPES, plannerForField } from "../../fill-vocabulary/dist/row-planners.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/row-fill-contract.js
4
+ function legalDecisionTypes(field) {
5
+ const planner = plannerForField(field);
6
+ return planner === void 0 ? [] : [PLANNER_DECISION_TYPES[planner]];
7
+ }
8
+ /**
9
+ * Every rule a list fill's per-field planners must satisfy against the row the
10
+ * schema declares. Throws on the first violation; a decision that plans no
11
+ * fields has nothing to cross-reference and passes.
12
+ */
13
+ function assertRowFillContract(schema, decision, sectionKey) {
14
+ const fill = decision;
15
+ if (fill.type !== "list-fill") return;
16
+ const planned = Object.entries(fill.fields ?? {});
17
+ if (planned.length === 0) return;
18
+ for (const slotId of decision.produces) {
19
+ const slot = schema.slots[slotId];
20
+ if (!slot) continue;
21
+ const rowFields = slot.fields;
22
+ if (rowFields === void 0) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" plans row fields but produces "${slotId}", whose items declare none; only a record list has fields to plan.`);
23
+ const declared = Object.keys(rowFields);
24
+ for (const [field, plan] of planned) {
25
+ const rowField = rowFields[field];
26
+ if (!rowField) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" field "${field}" is not a declared field of "${slotId}" (declared: ${declared.length > 0 ? declared.join(", ") : "none"}).`);
27
+ if (rowField.source) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}", which is source-bound (source.kind "${rowField.source.kind ?? "?"}") — the fact bakes it; drop the decision.`);
28
+ const legal = legalDecisionTypes(rowField);
29
+ if (!legal.includes(plan.type ?? "")) {
30
+ const takes = legal.length > 0 ? `that field takes ${legal.map((t) => `"${t}"`).join(" or ")}` : `that field's item content takes no fill decision (a row field is planned as ${EXECUTABLE_NESTED_TYPES.map((t) => `"${t}"`).join(", ")}, each on the item content that selects it)`;
31
+ throw new Error(`Section "${sectionKey}": list fill "${decision.id}" fills field "${field}" of "${slotId}" (type "${rowField.type}") with a "${plan.type}" decision; ${takes}.`);
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+ //#endregion
38
+ export { assertRowFillContract };
@@ -0,0 +1,181 @@
1
+ import { SECTION_CONTRACT_CATALOG } from "./catalog.js";
2
+ import { assertCapContract } from "./cap-contract.js";
3
+ import { assertChooseSelectContract } from "./choose-select-contract.js";
4
+ import { assertCountBoundsContract } from "./count-bounds-contract.js";
5
+ import { assertGroupContract } from "./group-contract.js";
6
+ import { FACTS_READABLE, isReadableFactsKey } from "../../fill-vocabulary/dist/facts.js";
7
+ import { assertInterpolationContract } from "./interpolation-contract.js";
8
+ import { assertListFillContract } from "./list-fill-contract.js";
9
+ import { assertListScalarContract } from "./list-scalar-contract.js";
10
+ import { assertNameTitleContract } from "./name-title-contract.js";
11
+ import { assertNestedSlotTypes } from "./nested-slot-contract.js";
12
+ import { assertRecordCollectionContract } from "./record-collection-contract.js";
13
+ import { assertOptionSourceContract } from "./option-source-contract.js";
14
+ import { assertPoiCurationContract } from "./poi-curation-contract.js";
15
+ import { assertPoolingFieldContract } from "./pooling-field-contract.js";
16
+ import { assertRowContract } from "./row-contract.js";
17
+ import { assertRowFillContract } from "./row-fill-contract.js";
18
+ import { assertDisplayContract } from "./display-contract.js";
19
+ import { assertDisplayEvidenceContract } from "./display-evidence-contract.js";
20
+ import { assertSelectContract } from "./select-contract.js";
21
+ import { assertSourceContract } from "./source-contract.js";
22
+ import { assertSourceFilterContract } from "./source-filter-contract.js";
23
+ import { assertSourcesContract } from "./sources-contract.js";
24
+ import { assertUrlContract } from "./url-contract.js";
25
+
26
+ //#region ../../internal/section-contracts/dist/runners.js
27
+ const bySection = (run) => ({
28
+ scope: "section",
29
+ run
30
+ });
31
+ const byDecision = (run) => ({
32
+ scope: "decision",
33
+ run
34
+ });
35
+ const CONTRACTS = {
36
+ "reads-readable": {
37
+ implementation: bySection(({ key, fillSpec }) => {
38
+ for (const r of fillSpec.reads ?? []) if (!isReadableFactsKey(r)) throw new Error(`Section "${key}": fill-spec reads "${r}" is not an author-declarable facts key (allowed: ${FACTS_READABLE.join(", ")}).`);
39
+ }),
40
+ assertions: []
41
+ },
42
+ "produces-known-slot": {
43
+ implementation: byDecision(({ key, schema }, d) => {
44
+ for (const produced of d.produces) if (!(produced in schema.slots)) throw new Error(`Section "${key}": fill-spec decision "${d.id}" produces unknown slot "${produced}".`);
45
+ }),
46
+ assertions: []
47
+ },
48
+ "poi-curation": {
49
+ implementation: byDecision(({ key, schema }, d) => assertPoiCurationContract(schema, d, key)),
50
+ assertions: [assertPoiCurationContract]
51
+ },
52
+ "list-fill": {
53
+ implementation: byDecision(({ key }, d) => assertListFillContract(d, key)),
54
+ assertions: [assertListFillContract]
55
+ },
56
+ "choose-select": {
57
+ implementation: byDecision(({ key, schema }, d) => assertChooseSelectContract(schema, d, key)),
58
+ assertions: [assertChooseSelectContract]
59
+ },
60
+ "name-title": {
61
+ implementation: byDecision(({ key, schema }, d) => assertNameTitleContract(schema, d, key)),
62
+ assertions: [assertNameTitleContract]
63
+ },
64
+ "pooling-field": {
65
+ implementation: byDecision(({ key, schema }, d) => assertPoolingFieldContract(schema, d, key)),
66
+ assertions: [assertPoolingFieldContract]
67
+ },
68
+ "row-fill": {
69
+ implementation: byDecision(({ key, schema }, d) => assertRowFillContract(schema, d, key)),
70
+ assertions: [assertRowFillContract]
71
+ },
72
+ "count-bounds": {
73
+ implementation: byDecision(({ key, schema }, d) => assertCountBoundsContract(schema, d, key)),
74
+ assertions: [assertCountBoundsContract]
75
+ },
76
+ cap: {
77
+ implementation: byDecision(({ key, schema }, d) => assertCapContract(schema, d, key)),
78
+ assertions: [assertCapContract]
79
+ },
80
+ display: {
81
+ implementation: bySection(({ key, schema }) => assertDisplayContract(schema, key)),
82
+ assertions: [assertDisplayContract]
83
+ },
84
+ "display-evidence": {
85
+ implementation: bySection(({ key, schema, fillSpec }) => assertDisplayEvidenceContract(schema, fillSpec, key)),
86
+ assertions: [assertDisplayEvidenceContract]
87
+ },
88
+ source: {
89
+ implementation: bySection(({ key, schema }) => assertSourceContract({
90
+ key,
91
+ slots: schema.slots
92
+ })),
93
+ assertions: [assertSourceContract]
94
+ },
95
+ "record-collection": {
96
+ implementation: bySection(({ key, schema }) => assertRecordCollectionContract(schema, key)),
97
+ assertions: [assertRecordCollectionContract]
98
+ },
99
+ "nested-slot-types": {
100
+ implementation: bySection(({ key, schema }) => assertNestedSlotTypes(schema, key)),
101
+ assertions: [assertNestedSlotTypes]
102
+ },
103
+ "list-scalar": {
104
+ implementation: bySection(({ key, schema }) => assertListScalarContract(schema, key)),
105
+ assertions: [assertListScalarContract]
106
+ },
107
+ select: {
108
+ implementation: bySection(({ key, schema }) => assertSelectContract(schema, key)),
109
+ assertions: [assertSelectContract]
110
+ },
111
+ "option-source": {
112
+ implementation: bySection(({ key, schema }) => assertOptionSourceContract(schema, key)),
113
+ assertions: [assertOptionSourceContract]
114
+ },
115
+ url: {
116
+ implementation: bySection(({ key, schema }) => assertUrlContract(schema, key)),
117
+ assertions: [assertUrlContract]
118
+ },
119
+ "source-filter": {
120
+ implementation: bySection(({ key, schema }) => assertSourceFilterContract(schema, key)),
121
+ assertions: [assertSourceFilterContract]
122
+ },
123
+ sources: {
124
+ implementation: bySection(({ key, schema }) => assertSourcesContract(schema, key)),
125
+ assertions: [assertSourcesContract]
126
+ },
127
+ interpolation: {
128
+ implementation: bySection(({ key, fillSpec }) => assertInterpolationContract(fillSpec, key)),
129
+ assertions: [assertInterpolationContract]
130
+ },
131
+ group: {
132
+ implementation: bySection(({ key, schema }) => assertGroupContract(schema, key)),
133
+ assertions: [assertGroupContract]
134
+ },
135
+ row: {
136
+ implementation: bySection(({ key, schema }) => assertRowContract(schema, key)),
137
+ assertions: [assertRowContract]
138
+ }
139
+ };
140
+ function toSectionRunner(implementation) {
141
+ if (implementation.scope === "section") return implementation.run;
142
+ const { run } = implementation;
143
+ return (input) => {
144
+ for (const decision of input.fillSpec.decisions) run(input, decision);
145
+ };
146
+ }
147
+ /** Every contract as one whole-section runner, keyed by id in catalog order. Each throws on its first violation. */
148
+ const SECTION_CONTRACT_RUNNERS = Object.fromEntries(SECTION_CONTRACT_CATALOG.map(({ id }) => [id, toSectionRunner(CONTRACTS[id].implementation)]));
149
+ /** The exported `assert*` functions each contract's runner calls, keyed by id in catalog order. */
150
+ const SECTION_CONTRACT_ASSERTIONS = Object.fromEntries(SECTION_CONTRACT_CATALOG.map(({ id }) => [id, CONTRACTS[id].assertions]));
151
+ /**
152
+ * Every contract violation of one section, in catalog order. A contract that
153
+ * throws contributes its message and every other contract still runs; a
154
+ * per-decision contract is guarded per decision, so it reports each failing
155
+ * decision. Never throws a contract's error.
156
+ */
157
+ function collectSectionContractViolations(input) {
158
+ const violations = [];
159
+ const attempt = (contract, run) => {
160
+ try {
161
+ run();
162
+ } catch (err) {
163
+ violations.push({
164
+ contract,
165
+ message: err instanceof Error ? err.message : String(err)
166
+ });
167
+ }
168
+ };
169
+ for (const { id } of SECTION_CONTRACT_CATALOG) {
170
+ const { implementation } = CONTRACTS[id];
171
+ if (implementation.scope === "section") {
172
+ attempt(id, () => implementation.run(input));
173
+ continue;
174
+ }
175
+ for (const decision of input.fillSpec.decisions) attempt(id, () => implementation.run(input, decision));
176
+ }
177
+ return violations;
178
+ }
179
+
180
+ //#endregion
181
+ export { collectSectionContractViolations };
@@ -0,0 +1,28 @@
1
+ import { normalizeSelectKey } from "../../template-contracts/dist/select-key.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/select-contract.js
4
+ function checkSelectSlot(slot, label, sectionKey) {
5
+ if (slot.type !== "select") return;
6
+ if (slot.values != null === (slot.options != null)) throw new Error(`Section "${sectionKey}": ${label} needs exactly one of \`values\` or \`options\`.`);
7
+ if (slot.creatable === true && Array.isArray(slot.values)) for (const entry of slot.values) {
8
+ const key = typeof entry === "string" ? entry : entry?.value;
9
+ if (typeof key !== "string") continue;
10
+ const normalized = normalizeSelectKey(key);
11
+ if (normalized !== key) throw new Error(`Section "${sectionKey}": ${label} is \`creatable\`, so its option keys must be normalized — "${key}" should be "${normalized}".`);
12
+ }
13
+ }
14
+ function assertSelectContract(schema, sectionKey) {
15
+ for (const [slotId, slotUnknown] of Object.entries(schema.slots)) {
16
+ const slot = slotUnknown;
17
+ checkSelectSlot(slot, `select "${slotId}"`, sectionKey);
18
+ if (slot.element != null) checkSelectSlot(slot.element, `list "${slotId}" element`, sectionKey);
19
+ if (slot.fields != null) for (const [fieldId, field] of Object.entries(slot.fields)) {
20
+ const label = `${slot.type ?? "?"} "${slotId}" field "${fieldId}"`;
21
+ checkSelectSlot(field, label, sectionKey);
22
+ if (field.element != null) checkSelectSlot(field.element, `${label} element`, sectionKey);
23
+ }
24
+ }
25
+ }
26
+
27
+ //#endregion
28
+ export { assertSelectContract };
@@ -0,0 +1,48 @@
1
+ import { COLLECTIONS, SOURCE_FIELDS, isWritableSourceField } from "../../template-contracts/dist/slot-catalog.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/source-contract.js
4
+ function rowContainerOf(desc) {
5
+ if (desc.value_type === "unit_list") return "unit";
6
+ if (desc.value_type === "contact_list") return "contact";
7
+ return null;
8
+ }
9
+ function assertOne(path, key, slot, rowContainer) {
10
+ const src = slot.source;
11
+ if (!src) {
12
+ if (slot.writeback !== void 0) throw new Error(`${path}: "writeback" without a source. Only a slot bound to a fact (a direct source) answers whether edits propagate — remove the key.`);
13
+ return;
14
+ }
15
+ if (src.kind === "direct") {
16
+ const def = SOURCE_FIELDS[src.field ?? ""];
17
+ if (!def) throw new Error(`${path}: unknown direct source field "${String(src.field)}"`);
18
+ const recordItemSlot = slot.type === "list" && slot.fields != null;
19
+ if (def.image && slot.type !== "image" && !recordItemSlot) throw new Error(`${path}: image source field "${src.field}" must sit on an image slot`);
20
+ if (Object.hasOwn(COLLECTIONS, src.field ?? "")) {
21
+ if (!recordItemSlot) throw new Error(`${path}: fact-collection source "${src.field}" needs a record item (a list declaring \`fields\`) — a fact row cannot project onto one slot.`);
22
+ }
23
+ if (rowContainer !== null && def.container !== rowContainer) throw new Error(`${path}: row-field source "${src.field}" belongs to the "${def.container}" container, but this list's rows resolve against "${rowContainer}" — a row field must bind a field of its own row.`);
24
+ if (typeof slot.writeback !== "boolean") throw new Error(`${path}: a direct source requires "writeback" (boolean) — declare whether edits propagate to "${src.field}".`);
25
+ if (slot.writeback === true && !isWritableSourceField(src.field ?? "")) throw new Error(`${path}: "writeback: true" on read-only source field "${src.field}" — the catalog has no write path for it; declare "writeback: false".`);
26
+ return;
27
+ }
28
+ if (src.kind !== "derived") return;
29
+ if (slot.writeback !== void 0) throw new Error(`${path}: "writeback" on a derived (compute) source. Nothing can write back through a derivation — remove the key.`);
30
+ if (src.transform !== key) throw new Error(`${path}: unknown transform "${String(src.transform)}". A "derived" source is a compute() binding, and its transform must equal its own slot key ("${key}") — it does not, which means the schema was hand-authored with a mismatched transform rather than produced by defineSchema's compute() path. Author a derived value with compute() ("slot({ source: compute((f) => …) })").`);
31
+ }
32
+ function assertSourceContract(schema) {
33
+ for (const [name, slot] of Object.entries(schema.slots)) {
34
+ assertOne(`${schema.key}.${name}`, name, slot, null);
35
+ if (slot.type !== "list" || slot.fields === void 0) continue;
36
+ const hostField = slot.source?.kind === "direct" ? slot.source.field : void 0;
37
+ const hostDesc = hostField !== void 0 ? SOURCE_FIELDS[hostField] : void 0;
38
+ const rowContainer = hostDesc !== void 0 ? rowContainerOf(hostDesc) : null;
39
+ for (const [fieldKey, rowField] of Object.entries(slot.fields)) {
40
+ const path = `${schema.key}.${name}.${fieldKey}`;
41
+ if (rowField.source?.kind === "direct" && rowContainer === null) throw new Error(hostDesc === void 0 ? `${path}: row-field source "${String(rowField.source.field)}" on a list that is not fact-bound — a per-field source resolves against the row an array source projects, so bind the list itself (or remove the field's source).` : `${path}: row-field source "${String(rowField.source.field)}" on a list bound to "${String(hostField)}", whose rows are not projected from catalog fields — such a row carries its own members, so name the member as the field's own key and drop \`source\`.`);
42
+ assertOne(path, fieldKey, rowField, rowContainer);
43
+ }
44
+ }
45
+ }
46
+
47
+ //#endregion
48
+ export { assertSourceContract };
@@ -0,0 +1,15 @@
1
+ import { SOURCE_FILTERS, isSourceFilter } from "../../template-contracts/dist/slot-catalog.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/source-filter-contract.js
4
+ function assertSourceFilterContract(schema, sectionKey) {
5
+ for (const [slotId, slot] of Object.entries(schema.slots)) check(slot, sectionKey, slotId);
6
+ }
7
+ function check(slot, sectionKey, path) {
8
+ const filter = slot.sourceFilter;
9
+ if (filter !== void 0 && !isSourceFilter(filter)) throw new Error(`Section "${sectionKey}": image "${path}" declares unknown sourceFilter ${JSON.stringify(filter)} (allowed: ${SOURCE_FILTERS.join(", ")}). An unknown tag silently falls back to the property photo pool.`);
10
+ if (slot.element) check(slot.element, sectionKey, `${path}.element`);
11
+ if (slot.fields) for (const [fieldId, field] of Object.entries(slot.fields)) check(field, sectionKey, `${path}.${fieldId}`);
12
+ }
13
+
14
+ //#endregion
15
+ export { assertSourceFilterContract };
@@ -0,0 +1,28 @@
1
+ import { VIDEO_SOURCES } from "../../template-contracts/dist/slot-catalog.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/sources-contract.js
4
+ function assertSourcesContract(schema, sectionKey) {
5
+ for (const [slotId, slotUnknown] of Object.entries(schema.slots)) check(slotUnknown, sectionKey, slotId);
6
+ }
7
+ function check(slotUnknown, sectionKey, path) {
8
+ const slot = slotUnknown;
9
+ if (slot.sources !== void 0) {
10
+ if (slot.type !== "video") throw new Error(`Section "${sectionKey}": slot "${path}" declares \`sources\`, but only a video slot may — a LIST of videos declares it on its item, not on the list. A url slot's link vocabulary is \`accepts\`.`);
11
+ validateSources(slot.sources, sectionKey, path);
12
+ }
13
+ if (slot.element) check(slot.element, sectionKey, `${path}.element`);
14
+ if (slot.fields) for (const [fieldId, field] of Object.entries(slot.fields)) check(field, sectionKey, `${path}.${fieldId}`);
15
+ }
16
+ function validateSources(sources, sectionKey, path) {
17
+ if (!Array.isArray(sources)) throw new Error(`Section "${sectionKey}": video "${path}" \`sources\` must be an array of ${VIDEO_SOURCES.join(" | ")}, got ${JSON.stringify(sources)}.`);
18
+ if (sources.length === 0) throw new Error(`Section "${sectionKey}": video "${path}" declares no source. A slot admitting nothing should not exist — omit \`sources\` for the upload-only default.`);
19
+ const seen = /* @__PURE__ */ new Set();
20
+ for (const source of sources) {
21
+ if (typeof source !== "string" || !VIDEO_SOURCES.includes(source)) throw new Error(`Section "${sectionKey}": video "${path}" declares unknown video source ${JSON.stringify(source)}. Use one of ${VIDEO_SOURCES.join(" | ")}.`);
22
+ if (seen.has(source)) throw new Error(`Section "${sectionKey}": video "${path}" lists duplicate source ${JSON.stringify(source)}.`);
23
+ seen.add(source);
24
+ }
25
+ }
26
+
27
+ //#endregion
28
+ export { assertSourcesContract };
@@ -0,0 +1,20 @@
1
+ import { LINK_KINDS, LINK_PROVIDERS, isLinkAccepts } from "../../template-contracts/dist/slot-catalog.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/url-contract.js
4
+ const KINDS_WITH_PROVIDERS = new Set(Object.values(LINK_PROVIDERS).map((p) => p.kind));
5
+ function assertUrlContract(schema, sectionKey) {
6
+ for (const [slotId, slotUnknown] of Object.entries(schema.slots)) check(slotUnknown, sectionKey, slotId);
7
+ }
8
+ function check(slotUnknown, sectionKey, path) {
9
+ const slot = slotUnknown;
10
+ if (slot.type === "url" && slot.accepts !== void 0) validateAccepts(slot.accepts, sectionKey, path);
11
+ if (slot.element) check(slot.element, sectionKey, `${path}.element`);
12
+ if (slot.fields) for (const [fieldId, field] of Object.entries(slot.fields)) check(field, sectionKey, `${path}.${fieldId}`);
13
+ }
14
+ function validateAccepts(accepts, sectionKey, path) {
15
+ if (typeof accepts !== "string" || !isLinkAccepts(accepts)) throw new Error(`Section "${sectionKey}": url "${path}" declares unknown accepts ${JSON.stringify(accepts)}. Use a link kind or a provider id from LINK_PROVIDERS.`);
16
+ if (LINK_KINDS.includes(accepts) && !KINDS_WITH_PROVIDERS.has(accepts)) throw new Error(`Section "${sectionKey}": url "${path}" declares accepts ${JSON.stringify(accepts)}, a link kind with no registered provider. No url can ever satisfy it — every value would be blanked.`);
17
+ }
18
+
19
+ //#endregion
20
+ export { assertUrlContract };
@@ -0,0 +1,222 @@
1
+ import { FACT_GRAPH, REFERRAL_IMAGE_FIELDS, SOURCE_FIELDS } from "../../template-contracts/dist/slot-catalog.js";
2
+ import { DEFAULT_FACTS_VIEW_YEAR, projectFactsView } from "../../template-contracts/dist/facts-view.js";
3
+
4
+ //#region ../../internal/source-resolution/dist/index.js
5
+ /**
6
+ * Extracts the {@link RowFieldSourceMap} from a slot's serialized row-field
7
+ * declarations (`fields`), keeping only direct-sourced entries. Returns
8
+ * `undefined` when nothing is declared — a pre-writeback schema — so callers
9
+ * fall back to the historical default row shape.
10
+ */
11
+ function rowFieldSources(fields) {
12
+ if (fields === void 0) return void 0;
13
+ const map = {};
14
+ for (const [key, field] of Object.entries(fields)) if (field.source?.kind === "direct" && typeof field.source.field === "string") map[key] = field.source.field;
15
+ return Object.keys(map).length > 0 ? map : void 0;
16
+ }
17
+ function primaryContact(facts) {
18
+ return facts.contacts?.find((c) => c.primary) ?? facts.contacts?.[0];
19
+ }
20
+ function contactsOf(facts) {
21
+ const raw = facts.contacts;
22
+ return Array.isArray(raw) ? raw : [];
23
+ }
24
+ function comparablesOf(facts) {
25
+ const raw = facts.comparables;
26
+ return Array.isArray(raw) ? raw : [];
27
+ }
28
+ const REFERRAL_FIELD_TO_CONTACT_KEY = {
29
+ name: "name",
30
+ title: "title",
31
+ org_name: "org_name",
32
+ email: "email",
33
+ phone: "phone",
34
+ website: "website_url",
35
+ instagram: "instagram_url",
36
+ linkedin: "linkedin_url",
37
+ x: "x_url",
38
+ facebook: "facebook_url",
39
+ headshot: "avatar_upload_id",
40
+ logo_dark: "logo_dark_upload_id",
41
+ logo_light: "logo_light_upload_id"
42
+ };
43
+ const REFERRAL_IMAGE_FIELD_SET = new Set(REFERRAL_IMAGE_FIELDS);
44
+ const LOGO_VARIANT_FALLBACK = {
45
+ logo_dark: {
46
+ other: "logo_light_upload_id",
47
+ mask: "black"
48
+ },
49
+ logo_light: {
50
+ other: "logo_dark_upload_id",
51
+ mask: "white"
52
+ }
53
+ };
54
+ function resolveContactCardField(contact, field) {
55
+ const key = REFERRAL_FIELD_TO_CONTACT_KEY[field];
56
+ if (key === void 0) return null;
57
+ const raw = contact?.[key] ?? null;
58
+ if (REFERRAL_IMAGE_FIELD_SET.has(field)) {
59
+ const assetId = typeof raw === "string" && raw.trim().length > 0 ? raw.trim() : null;
60
+ if (assetId !== null) return { asset_id: assetId };
61
+ const fb = LOGO_VARIANT_FALLBACK[field];
62
+ if (fb !== void 0) {
63
+ const otherRaw = contact?.[fb.other] ?? null;
64
+ const otherId = typeof otherRaw === "string" && otherRaw.trim().length > 0 ? otherRaw.trim() : null;
65
+ if (otherId !== null) return {
66
+ asset_id: otherId,
67
+ mask: fb.mask
68
+ };
69
+ }
70
+ return null;
71
+ }
72
+ if (raw === null || raw === void 0) return "";
73
+ return typeof raw === "string" ? raw : String(raw);
74
+ }
75
+ const PRIMARY_CONTACT_FACT_TO_CONTACT_KEY = {
76
+ primary_contact_name: "name",
77
+ primary_contact_title: "title",
78
+ primary_contact_bio: "bio",
79
+ primary_contact_email: "email",
80
+ primary_contact_phone: "phone",
81
+ primary_contact_address: "address",
82
+ primary_contact_website_url: "website_url",
83
+ primary_contact_avatar_upload_id: "avatar_upload_id",
84
+ primary_contact_logo_dark_upload_id: "logo_dark_upload_id",
85
+ primary_contact_logo_light_upload_id: "logo_light_upload_id",
86
+ primary_contact_instagram_url: "instagram_url",
87
+ primary_contact_linkedin_url: "linkedin_url",
88
+ primary_contact_x_url: "x_url",
89
+ primary_contact_facebook_url: "facebook_url"
90
+ };
91
+ function primaryContactFactValue(facts, factKey) {
92
+ const key = PRIMARY_CONTACT_FACT_TO_CONTACT_KEY[factKey];
93
+ if (key === void 0) return void 0;
94
+ const raw = primaryContact({ contacts: contactsOf(facts) })?.[key] ?? null;
95
+ return typeof raw === "string" ? raw : null;
96
+ }
97
+ function singleUnitLabelDefault(propertyType) {
98
+ switch (propertyType) {
99
+ case "single_family": return "Single Family";
100
+ case "condo_townhome": return "Condo";
101
+ case "multi_family":
102
+ case "investment": return null;
103
+ default: return null;
104
+ }
105
+ }
106
+ const CONTACT_ROW_DEFAULT_FIELDS = {
107
+ name: "name",
108
+ title: "title",
109
+ bio: "bio",
110
+ email: "email",
111
+ phone: "phone",
112
+ instagram: "instagram",
113
+ linkedin: "linkedin",
114
+ x: "x",
115
+ facebook: "facebook",
116
+ website: "website",
117
+ headshot: "headshot",
118
+ logo: "logo_dark"
119
+ };
120
+ function resolveContactRowField(c, field) {
121
+ return resolveContactScalar(c, field);
122
+ }
123
+ function buildContactsList(facts, fields) {
124
+ const mapping = fields ?? CONTACT_ROW_DEFAULT_FIELDS;
125
+ return contactsOf(facts).map((c) => {
126
+ const row = { id: c.id };
127
+ for (const [key, field] of Object.entries(mapping)) row[key] = resolveContactRowField(c, field);
128
+ return row;
129
+ });
130
+ }
131
+ function buildUnitsList(facts, fields) {
132
+ const fallback = singleUnitLabelDefault(facts.property_type);
133
+ return [...facts.units].sort((a, b) => a.position - b.position).map((u) => {
134
+ const base = {
135
+ ...u,
136
+ unit_label: u.unit_label ?? fallback
137
+ };
138
+ if (fields === void 0) return base;
139
+ const row = { ...base };
140
+ for (const [key, field] of Object.entries(fields)) row[key] = resolveUnitScalar(base, field);
141
+ return row;
142
+ });
143
+ }
144
+ function buildUnitFloorplanList(facts) {
145
+ return [...facts.units].sort((a, b) => a.position - b.position).map((u) => ({
146
+ unit_id: u.unit_id,
147
+ unit_label: u.unit_label,
148
+ floorplans: [...u.floor_plans].sort((a, b) => a.position - b.position)
149
+ }));
150
+ }
151
+ function buildComparablesList(facts) {
152
+ return comparablesOf(facts).map((row) => ({ ...row }));
153
+ }
154
+ const COLLECTION_PROJECTIONS = {
155
+ units: buildUnitsList,
156
+ contacts: buildContactsList,
157
+ comparables: buildComparablesList
158
+ };
159
+ function firstUnit(facts) {
160
+ if (facts.units.length === 0) return void 0;
161
+ return [...facts.units].sort((a, b) => a.position - b.position)[0];
162
+ }
163
+ function resolveUnitScalar(unit, field) {
164
+ switch (field) {
165
+ case "beds": return unit?.beds ?? null;
166
+ case "baths": return unit?.baths ?? null;
167
+ case "sqft": return unit?.sqft ?? null;
168
+ case "price": return unit?.price ?? null;
169
+ case "unit_label": return unit?.unit_label ?? null;
170
+ default: return null;
171
+ }
172
+ }
173
+ function resolvePropertyScalar(facts, field) {
174
+ if (field === "address") {
175
+ if (facts.address && typeof facts.address === "object") return facts.address.display ?? null;
176
+ return facts.address;
177
+ }
178
+ const part = ADDRESS_PARTS[field];
179
+ if (part !== void 0) return readAddressPart(facts.address, part);
180
+ const virtual = primaryContactFactValue(facts, field);
181
+ if (virtual !== void 0) return virtual;
182
+ return facts[field];
183
+ }
184
+ const CONTACT_FIELD_TO_CONTACT_KEY = Object.fromEntries(Object.entries(FACT_GRAPH).flatMap(([name, entry]) => {
185
+ if (entry.role !== "bindable" || entry.container !== "contact") return [];
186
+ const key = /^contacts\[\]\.(\w+)$/.exec(entry.path)?.[1];
187
+ return key === void 0 ? [] : [[name, key]];
188
+ }));
189
+ function resolveContactScalar(contact, field) {
190
+ if (REFERRAL_FIELD_TO_CONTACT_KEY[field] !== void 0) return resolveContactCardField(contact, field);
191
+ const key = CONTACT_FIELD_TO_CONTACT_KEY[field];
192
+ if (key === void 0) return null;
193
+ const raw = contact?.[key] ?? null;
194
+ if (typeof raw !== "string") return null;
195
+ const trimmed = raw.trim();
196
+ return trimmed.length > 0 ? trimmed : null;
197
+ }
198
+ function readFrom(field, ctx) {
199
+ const desc = SOURCE_FIELDS[field];
200
+ if (!desc) return null;
201
+ if (Object.hasOwn(COLLECTION_PROJECTIONS, field)) return COLLECTION_PROJECTIONS[field](ctx.facts, ctx.rowFields);
202
+ if (desc.container === "contact") return resolveContactScalar(ctx.contact ?? primaryContact(ctx.facts), field);
203
+ if (desc.container === "unit") return resolveUnitScalar(ctx.unit ?? firstUnit(ctx.facts), field);
204
+ return resolvePropertyScalar(ctx.facts, field);
205
+ }
206
+ const ADDRESS_PARTS = {
207
+ address_street: "street",
208
+ address_unit: "unit",
209
+ address_city: "city",
210
+ address_state: "state",
211
+ address_postal: "postal"
212
+ };
213
+ /** One part of the structured address, or null when absent or blank — an empty
214
+ * string never reaches a slot, so a section can test the value for presence. */
215
+ function readAddressPart(address, part) {
216
+ if (!address || typeof address !== "object") return null;
217
+ const trimmed = (address[part] ?? "").trim();
218
+ return trimmed.length > 0 ? trimmed : null;
219
+ }
220
+
221
+ //#endregion
222
+ export { COLLECTION_PROJECTIONS, buildComparablesList, buildContactsList, buildUnitFloorplanList, buildUnitsList, primaryContact, primaryContactFactValue, projectFactsView, readFrom, resolveContactCardField, rowFieldSources, singleUnitLabelDefault };
@@ -0,0 +1,50 @@
1
+ import { TEMPLATE_DIR, sectionDir } from "./layout.js";
2
+ import { sha256Hex } from "./sha256.js";
3
+
4
+ //#region ../../internal/template-artifact/dist/hash.js
5
+ const encoder = new TextEncoder();
6
+ /** SHA-256 over the sorted `<name>\0<sha256>\n` listing. Names must be unique. */
7
+ function listingDigest(entries) {
8
+ const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
9
+ for (let i = 1; i < sorted.length; i++) if (sorted[i].name === sorted[i - 1].name) throw new Error(`listingDigest: "${sorted[i].name}" is listed twice.`);
10
+ return sha256Hex(encoder.encode(sorted.map((entry) => `${entry.name}\0${entry.sha256}\n`).join("")));
11
+ }
12
+ /** The entries of `files` under `dir/`, named relative to it. */
13
+ function entriesUnder(files, dir) {
14
+ const prefix = `${dir}/`;
15
+ const out = [];
16
+ for (const [path, bytes] of files) if (path.startsWith(prefix)) out.push({
17
+ name: path.slice(prefix.length),
18
+ sha256: sha256Hex(bytes)
19
+ });
20
+ return out;
21
+ }
22
+ /** A section's content hash, over every artifact file under `sections/<key>/`. */
23
+ function sectionContentHash(files, key) {
24
+ const entries = entriesUnder(files, sectionDir(key));
25
+ if (entries.length === 0) throw new Error(`sectionContentHash: the artifact has no files under ${sectionDir(key)}/.`);
26
+ return listingDigest(entries);
27
+ }
28
+ /** The template's content hash, over every file under `template/` and each section's hash. */
29
+ function templateContentHash(files, sectionHashes) {
30
+ const entries = entriesUnder(files, TEMPLATE_DIR);
31
+ if (entries.length === 0) throw new Error(`templateContentHash: the artifact has no files under ${TEMPLATE_DIR}/.`);
32
+ for (const [key, hash] of sectionHashes) entries.push({
33
+ name: sectionDir(key),
34
+ sha256: hash
35
+ });
36
+ return listingDigest(entries);
37
+ }
38
+ /**
39
+ * The source digest: what a later publish compares the workspace against to decide
40
+ * whether this artifact is still the build of that tree.
41
+ */
42
+ function sourceDigest(files) {
43
+ return listingDigest(files.map((file) => ({
44
+ name: file.path,
45
+ sha256: sha256Hex(file.bytes)
46
+ })));
47
+ }
48
+
49
+ //#endregion
50
+ export { listingDigest, sectionContentHash, sourceDigest, templateContentHash };
@@ -0,0 +1,7 @@
1
+ import { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath } from "./layout.js";
2
+ import { sha256Hex } from "./sha256.js";
3
+ import { listingDigest, sectionContentHash, sourceDigest, templateContentHash } from "./hash.js";
4
+ import { ArtifactManifest, ArtifactScope, ArtifactSection, readArtifactSchema } from "./manifest.js";
5
+ import { verifyArtifact } from "./verify.js";
6
+
7
+ export { ASSET_URL_PREFIX, ArtifactManifest, CAPTURE_FILES, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTION_FILES, TEMPLATE_FILES, assetPath, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionContentHash, sectionPath, sourceDigest, staticPath, templateContentHash, templatePath, verifyArtifact };