@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,102 @@
1
+ //#region ../../internal/section-contracts/dist/catalog.js
2
+ const SECTION_CONTRACT_CATALOG = [
3
+ {
4
+ id: "reads-readable",
5
+ summary: "Every fact bucket a section reads is one an author may declare."
6
+ },
7
+ {
8
+ id: "produces-known-slot",
9
+ summary: "Every fill decision produces only slots the section declares."
10
+ },
11
+ {
12
+ id: "poi-curation",
13
+ summary: "A points-of-interest curation decision produces exactly one slot, a list of points of interest."
14
+ },
15
+ {
16
+ id: "list-fill",
17
+ summary: "A list fill declares what its origination mode needs, such as a count, a pick brief or an iterable facts array."
18
+ },
19
+ {
20
+ id: "choose-select",
21
+ summary: "A choose list fill over a record list needs exactly one select field with declared values on the row."
22
+ },
23
+ {
24
+ id: "name-title",
25
+ summary: "A name list fill needs its slot's title to name a capped text field that carries no fill of its own."
26
+ },
27
+ {
28
+ id: "pooling-field",
29
+ summary: "A list fill's item declares at most one unbound pooled asset field, and pool origination needs one."
30
+ },
31
+ {
32
+ id: "row-fill",
33
+ summary: "A list fill plans only unbound fields its record item declares, each with the decision type that field takes."
34
+ },
35
+ {
36
+ id: "count-bounds",
37
+ summary: "Every item count a decision requests fits the bounds of the slot or row field that holds the items."
38
+ },
39
+ {
40
+ id: "cap",
41
+ summary: "Every generated text value has one character budget, declared on its slot, and a fill cap may only be lower."
42
+ },
43
+ {
44
+ id: "display",
45
+ summary: "Display entries declare one origin and legal cases, and every slot variant gate names a declared case."
46
+ },
47
+ {
48
+ id: "display-evidence",
49
+ summary: "A filled display entry's pick references only real facts and has evidence to judge from."
50
+ },
51
+ {
52
+ id: "source",
53
+ summary: "Every slot and row field source names a known fact or its own compute binding, with a legal writeback."
54
+ },
55
+ {
56
+ id: "record-collection",
57
+ summary: "A fact-bound record list binds a registry collection and may only narrow its membership bounds."
58
+ },
59
+ {
60
+ id: "nested-slot-types",
61
+ summary: "Every field of a record item carries a known slot type."
62
+ },
63
+ {
64
+ id: "list-scalar",
65
+ summary: "A list declares exactly one legal item, a value element or a flat record of fields, with satisfiable bounds."
66
+ },
67
+ {
68
+ id: "select",
69
+ summary: "A select declares exactly one of values or options, and a creatable select's keys are normalized."
70
+ },
71
+ {
72
+ id: "option-source",
73
+ summary: "A select with an option source names a source the platform provides."
74
+ },
75
+ {
76
+ id: "url",
77
+ summary: "A url slot's accepts names a link kind or provider that a registered provider implements."
78
+ },
79
+ {
80
+ id: "source-filter",
81
+ summary: "A media slot's source filter names a filter the platform supports."
82
+ },
83
+ {
84
+ id: "sources",
85
+ summary: "Only a video slot declares sources, as a non-empty list of distinct known video sources."
86
+ },
87
+ {
88
+ id: "interpolation",
89
+ summary: "Every fact interpolated into fill prose names a fact path that exists."
90
+ },
91
+ {
92
+ id: "group",
93
+ summary: "Group ids are unique, every group names real slots, and no slot sits in two groups."
94
+ },
95
+ {
96
+ id: "row",
97
+ summary: "Every two-up row pairs adjacent short slots, and a record item's layout lists each field exactly once."
98
+ }
99
+ ];
100
+
101
+ //#endregion
102
+ export { SECTION_CONTRACT_CATALOG };
@@ -0,0 +1,24 @@
1
+ //#region ../../internal/section-contracts/dist/choose-select-contract.js
2
+ /**
3
+ * A `choose` list fill producing a record list needs exactly one `select`
4
+ * field declaring `values` on the row — the vocabulary the rows are picked from
5
+ * and the key the batched call is keyed on. A value item (the element IS the
6
+ * vocabulary) and every other mode pass untouched. Throws on the first violation.
7
+ */
8
+ function assertChooseSelectContract(schema, decision, sectionKey) {
9
+ const fill = decision;
10
+ if (fill.type !== "list-fill" || fill.mode !== "choose") return;
11
+ for (const slotId of decision.produces) {
12
+ const fields = schema.slots[slotId]?.fields;
13
+ if (fields === void 0) continue;
14
+ const declared = Object.keys(fields);
15
+ const selects = declared.filter((name) => isSelectVocabulary(fields[name]));
16
+ if (selects.length !== 1) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" chooses rows of "${slotId}", but the row declares no \`select\` field with \`values\` (found ${selects.length}; declared: ${declared.length > 0 ? declared.join(", ") : "none"}). Choose origination picks rows out of that one field's vocabulary — give the row exactly one \`select.of([...])\` field, or originate the rows another way.`);
17
+ }
18
+ }
19
+ function isSelectVocabulary(field) {
20
+ return field.type === "select" && Array.isArray(field.values);
21
+ }
22
+
23
+ //#endregion
24
+ export { assertChooseSelectContract };
@@ -0,0 +1,48 @@
1
+ //#region ../../internal/section-contracts/dist/count-bounds-contract.js
2
+ /**
3
+ * The requested range a `count:` value states, in the two shapes the grammar
4
+ * spells it: a literal generation target (`count: 4`) or a range
5
+ * (`count: { min, max }`, either end optional). Anything else declares no count.
6
+ */
7
+ function requestedCount(raw) {
8
+ if (typeof raw === "number") return { ceiling: raw };
9
+ if (typeof raw !== "object" || raw === null) return void 0;
10
+ const { min, max } = raw;
11
+ const requested = {};
12
+ if (typeof max === "number") requested.ceiling = max;
13
+ if (typeof min === "number") requested.floor = min;
14
+ return requested.ceiling === void 0 && requested.floor === void 0 ? void 0 : requested;
15
+ }
16
+ function checkAgainstBounds(requested, bounds, where, decisionId, sectionKey) {
17
+ if (bounds.max !== void 0) {
18
+ if (requested.ceiling !== void 0 && requested.ceiling > bounds.max) throw new Error(`Section "${sectionKey}": decision "${decisionId}" requests up to ${requested.ceiling} items but ${where} holds at most ${bounds.max}.`);
19
+ if (requested.floor !== void 0 && requested.floor > bounds.max) throw new Error(`Section "${sectionKey}": decision "${decisionId}" requests at least ${requested.floor} items but ${where} holds at most ${bounds.max}.`);
20
+ }
21
+ if (bounds.min !== void 0 && requested.ceiling !== void 0 && requested.ceiling < bounds.min) throw new Error(`Section "${sectionKey}": decision "${decisionId}" requests at most ${requested.ceiling} items but ${where} requires at least ${bounds.min}.`);
22
+ }
23
+ function checkNode(node, holder, slotId, field, decisionId, sectionKey) {
24
+ const where = field === void 0 ? `slot "${slotId}"` : `inner slot "${field}" of "${slotId}"`;
25
+ const requested = requestedCount(node.count);
26
+ if (requested) checkAgainstBounds(requested, holder, where, decisionId, sectionKey);
27
+ for (const [planned, plan] of Object.entries(node.fields ?? {})) {
28
+ const bounds = holder.fields?.[planned];
29
+ if (!bounds) continue;
30
+ checkNode(plan, bounds, slotId, planned, decisionId, sectionKey);
31
+ }
32
+ }
33
+ /**
34
+ * Every count a decision declares, at every level, against the bounds of
35
+ * whatever holds those items. Throws on the first violation; mirrors
36
+ * assertPoiCurationContract in signature and error-message style.
37
+ */
38
+ function assertCountBoundsContract(schema, decision, sectionKey) {
39
+ const node = decision;
40
+ for (const slotId of decision.produces) {
41
+ const slot = schema.slots[slotId];
42
+ if (!slot) continue;
43
+ checkNode(node, slot, slotId, void 0, decision.id, sectionKey);
44
+ }
45
+ }
46
+
47
+ //#endregion
48
+ export { assertCountBoundsContract };
@@ -0,0 +1,30 @@
1
+ import { DISPLAY_ENTRIES, VISIBILITY_CASES } from "../../template-contracts/dist/slot-catalog.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/display-contract.js
4
+ function assertDisplayContract(schema, sectionKey) {
5
+ const display = schema.display ?? {};
6
+ for (const entryKey of DISPLAY_ENTRIES) {
7
+ const entry = display[entryKey];
8
+ if (entry === void 0) continue;
9
+ if (new Set(entry.cases).size !== entry.cases.length) throw new Error(`Section "${sectionKey}": display ${entryKey} declares a duplicate case.`);
10
+ const origins = [entry.source, entry.fill].filter((o) => o !== void 0).length;
11
+ if (origins !== 1) throw new Error(`Section "${sectionKey}": display ${entryKey} declares ${origins === 0 ? "no origin" : "two origins"} — exactly one of \`source:\` or \`fill:\` decides it.`);
12
+ }
13
+ const visibility = display.visibility;
14
+ if (visibility !== void 0) {
15
+ const cases = [...visibility.cases].sort();
16
+ const pinned = [...VISIBILITY_CASES].sort();
17
+ if (cases.length !== pinned.length || cases.some((c, i) => c !== pinned[i])) throw new Error(`Section "${sectionKey}": display visibility must declare exactly the cases ${VISIBILITY_CASES.map((c) => `"${c}"`).join(" and ")} (either order — first is the failure posture); got [${visibility.cases.join(", ")}].`);
18
+ if (visibility.locked !== void 0) throw new Error(`Section "${sectionKey}": \`locked\` is illegal on display visibility — composition \`required\` is the only visibility lock.`);
19
+ }
20
+ const variantCases = display.variant?.cases;
21
+ for (const [slotId, slot] of Object.entries(schema.slots)) {
22
+ const gate = slot.variant;
23
+ if (gate == null) continue;
24
+ if (variantCases === void 0) throw new Error(`Section "${sectionKey}": slot "${slotId}" gates on a variant case but the section declares no display variant.`);
25
+ for (const c of gate.cases) if (!variantCases.includes(c)) throw new Error(`Section "${sectionKey}": slot "${slotId}" gates on case "${c}", which the display variant does not declare.`);
26
+ }
27
+ }
28
+
29
+ //#endregion
30
+ export { assertDisplayContract };
@@ -0,0 +1,17 @@
1
+ import { extractPaths } from "../../fact-interpolation/dist/index.js";
2
+ import { assertFactPath } from "./interpolation-contract.js";
3
+
4
+ //#region ../../internal/section-contracts/dist/display-evidence-contract.js
5
+ function assertDisplayEvidenceContract(schema, fillSpec, sectionKey) {
6
+ for (const [entryKey, entry] of Object.entries(schema.display ?? {})) {
7
+ if (entry?.fill === void 0) continue;
8
+ const subject = `display ${entryKey}'s \`pick\``;
9
+ const paths = extractPaths(entry.fill.pick);
10
+ for (const path of paths) assertFactPath(path, sectionKey, subject);
11
+ if (paths.length > 0 || (fillSpec.reads ?? []).length > 0) continue;
12
+ throw new Error(`Section "${sectionKey}": ${subject} names no evidence — the section declares no \`reads\` and the prose interpolates no \`\${facts.*}\`, so the model decides it from the always-on slice alone. Declare the fact bucket it judges (\`reads: ["photos"]\`) or interpolate the fact itself (\`\${facts.primary_contact_website_url}\`). A display decision is handed no other decision's output, however late it runs.`);
13
+ }
14
+ }
15
+
16
+ //#endregion
17
+ export { assertDisplayEvidenceContract };
@@ -0,0 +1,21 @@
1
+ import { flattenLayout } from "../../template-contracts/dist/layout.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/group-contract.js
4
+ function assertGroupContract(schema, sectionKey) {
5
+ const groups = schema.groups;
6
+ if (!groups || groups.length === 0) return;
7
+ const seenIds = /* @__PURE__ */ new Set();
8
+ const seenSlots = /* @__PURE__ */ new Set();
9
+ for (const group of groups) {
10
+ if (seenIds.has(group.id)) throw new Error(`Section "${sectionKey}": duplicate group id "${group.id}".`);
11
+ seenIds.add(group.id);
12
+ for (const member of flattenLayout(group.members)) {
13
+ if (!(member in schema.slots)) throw new Error(`Section "${sectionKey}": group "${group.id}" names unknown slot "${member}".`);
14
+ if (seenSlots.has(member)) throw new Error(`Section "${sectionKey}": slot "${member}" appears in more than one group.`);
15
+ seenSlots.add(member);
16
+ }
17
+ }
18
+ }
19
+
20
+ //#endregion
21
+ export { assertGroupContract };
@@ -0,0 +1,26 @@
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 { assertInterpolationContract } from "./interpolation-contract.js";
7
+ import { assertListFillContract } from "./list-fill-contract.js";
8
+ import { assertListScalarContract } from "./list-scalar-contract.js";
9
+ import { assertNameTitleContract } from "./name-title-contract.js";
10
+ import { assertNestedSlotTypes } from "./nested-slot-contract.js";
11
+ import { assertRecordCollectionContract } from "./record-collection-contract.js";
12
+ import { assertOptionSourceContract } from "./option-source-contract.js";
13
+ import { assertPoiCurationContract } from "./poi-curation-contract.js";
14
+ import { assertPoolingFieldContract } from "./pooling-field-contract.js";
15
+ import { assertRowContract } from "./row-contract.js";
16
+ import { assertRowFillContract } from "./row-fill-contract.js";
17
+ import { assertDisplayContract } from "./display-contract.js";
18
+ import { assertDisplayEvidenceContract } from "./display-evidence-contract.js";
19
+ import { assertSelectContract } from "./select-contract.js";
20
+ import { assertSourceContract } from "./source-contract.js";
21
+ import { assertSourceFilterContract } from "./source-filter-contract.js";
22
+ import { assertSourcesContract } from "./sources-contract.js";
23
+ import { assertUrlContract } from "./url-contract.js";
24
+ import { collectSectionContractViolations } from "./runners.js";
25
+
26
+ export { collectSectionContractViolations };
@@ -0,0 +1,48 @@
1
+ import { NAMESPACE, extractPaths } from "../../fact-interpolation/dist/index.js";
2
+ import { FACTS_INTERPOLABLE_ROOTS } from "../../fill-vocabulary/dist/facts.js";
3
+
4
+ //#region ../../internal/section-contracts/dist/interpolation-contract.js
5
+ function assertInterpolationContract(fillSpec, sectionKey) {
6
+ for (const decision of fillSpec.decisions) for (const text of stringsIn(decision)) for (const path of extractPaths(text)) assertFactPath(path, sectionKey, `fill-spec decision "${decision.id}"`);
7
+ }
8
+ function* stringsIn(value) {
9
+ if (typeof value === "string") yield value;
10
+ else if (Array.isArray(value)) for (const entry of value) yield* stringsIn(entry);
11
+ else if (value !== null && typeof value === "object") for (const entry of Object.values(value)) yield* stringsIn(entry);
12
+ }
13
+ /**
14
+ * Assert one extracted `${facts.*}` reference resolves, naming `subject` (e.g.
15
+ * `fill-spec decision "hero"`) as what wrote it.
16
+ *
17
+ * Exported because a fill-spec decision is not the only place a `${facts.*}`
18
+ * reference is authored and expanded: a `fill:` display entry's `pick` prose
19
+ * lives on the SCHEMA's display entry, never on the decision that names the
20
+ * entry, so the walk above never reaches it (`display-evidence-contract.ts`
21
+ * runs it there).
22
+ */
23
+ function assertFactPath(path, sectionKey, subject) {
24
+ const where = `${subject} interpolates \${${path}}`;
25
+ const [namespace, root, ...rest] = path.split(".");
26
+ if (namespace !== "facts") throw new Error(`Section "${sectionKey}": ${where}, but "${NAMESPACE}" is the only namespace a prompt may reference.`);
27
+ if (root === void 0) throw new Error(`Section "${sectionKey}": ${where}, which names no fact — write \${${NAMESPACE}.<fact>}.`);
28
+ let shape = Object.hasOwn(FACTS_INTERPOLABLE_ROOTS, root) ? FACTS_INTERPOLABLE_ROOTS[root] : void 0;
29
+ if (shape === void 0) throw new Error(`Section "${sectionKey}": ${where}, but "${root}" is not a fact the relevance slice carries (allowed: ${Object.keys(FACTS_INTERPOLABLE_ROOTS).join(", ")}). It would expand to nothing.`);
30
+ let walked = `${NAMESPACE}.${root}`;
31
+ for (const [index, segment] of rest.entries()) {
32
+ const remainder = rest.slice(index).join(".");
33
+ if (shape.kind === "scalar") throw new Error(`Section "${sectionKey}": ${where}, but "${walked}" is a scalar fact and has no "${remainder}" beneath it. It would expand to nothing.`);
34
+ if (shape.kind === "array") {
35
+ if (!IS_INDEX.test(segment)) throw new Error(`Section "${sectionKey}": ${where}, but "${walked}" is a list — a reference names it whole (it expands to JSON) or indexes it (\${${walked}.0.…}), and "${segment}" is neither. It would expand to nothing.`);
36
+ shape = shape.element;
37
+ } else {
38
+ const next = Object.hasOwn(shape.fields, segment) ? shape.fields[segment] : void 0;
39
+ if (next === void 0) throw new Error(`Section "${sectionKey}": ${where}, but "${walked}" has no "${segment}" beneath it (allowed: ${Object.keys(shape.fields).join(", ")}). It would expand to nothing.`);
40
+ shape = next;
41
+ }
42
+ walked = `${walked}.${segment}`;
43
+ }
44
+ }
45
+ const IS_INDEX = /^\d+$/;
46
+
47
+ //#endregion
48
+ export { assertFactPath, assertInterpolationContract };
@@ -0,0 +1,53 @@
1
+ import { FACTS_ARRAY_FIELDS, isIterableFactsField } from "../../fill-vocabulary/dist/facts.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/list-fill-contract.js
4
+ const NO_ABSTENTION_MODES = ["facts", "curate"];
5
+ const POOL_ORDERS = ["walkthrough"];
6
+ /**
7
+ * Whether each origination mode carries what it needs: `choose` a `{ min, max }`
8
+ * range, `extract` a `count` — a literal target or a band — and no `iterate`, `facts` an iterable
9
+ * property-facts array to walk, and `pool`/`curate` the prose brief that is
10
+ * their whole steer — and, for the two that originate without model discretion,
11
+ * that they declare no `none`. Throws on the first violation.
12
+ */
13
+ function assertListFillContract(decision, sectionKey) {
14
+ const fill = decision;
15
+ if (fill.type !== "list-fill") return;
16
+ const where = `Section "${sectionKey}": list fill "${decision.id}"`;
17
+ if (fill.none !== void 0 && NO_ABSTENTION_MODES.includes(String(fill.mode ?? "facts"))) throw new Error(`${where} declares \`none\`, but ${String(fill.mode ?? "facts")} origination has no discretion to abstain — its rows come from the facts or from the platform's place search. Drop \`none\`, or give a row field its own.`);
18
+ if (fill.order !== void 0) {
19
+ if (fill.mode !== "pool") throw new Error(`${where} declares \`order\`, which only pool origination reads.`);
20
+ if (!POOL_ORDERS.includes(String(fill.order))) throw new Error(`${where} declares order="${String(fill.order)}" (allowed: ${POOL_ORDERS.join(", ")}).`);
21
+ }
22
+ if (fill.mode === "choose") {
23
+ const range = fill.count;
24
+ if (typeof range?.min !== "number" || typeof range.max !== "number") throw new Error(`${where} chooses rows but declares no \`count: { min, max }\`.`);
25
+ return;
26
+ }
27
+ if (fill.mode === "name") {
28
+ const range = fill.count;
29
+ if (typeof range?.min !== "number" || typeof range.max !== "number") throw new Error(`${where} names rows but declares no \`count: { min, max }\`.`);
30
+ if (typeof fill.pick !== "string" || fill.pick.length === 0) throw new Error(`${where} names rows but declares no \`pick\` brief.`);
31
+ return;
32
+ }
33
+ if (fill.mode === "extract") {
34
+ if (fill.iterate !== void 0) throw new Error(`${where} generates rows against the facts slice, so it takes no \`iterate\` — declare a \`count\`, or \`mode: "facts"\` for one row per fact entry.`);
35
+ if (typeof fill.count === "number") return;
36
+ const band = fill.count;
37
+ if (typeof band?.min !== "number" || typeof band.max !== "number") throw new Error(`${where} generates rows but declares no \`count\` — a literal target, or \`{ min, max }\`.`);
38
+ if (band.min > band.max) throw new Error(`${where} declares count.min ${band.min} above count.max ${band.max} — a band the model can never answer inside.`);
39
+ return;
40
+ }
41
+ if (fill.mode === "pool" || fill.mode === "curate") {
42
+ if (typeof fill.pick !== "string" || fill.pick.length === 0) throw new Error(`${where} originates rows by ${fill.mode} but declares no \`pick\` brief.`);
43
+ return;
44
+ }
45
+ if (typeof fill.iterate !== "string") throw new Error(`${where} originates rows from facts but names no array to iterate.`);
46
+ assertIterable(fill.iterate, where);
47
+ }
48
+ function assertIterable(iterate, where) {
49
+ if (!isIterableFactsField(iterate)) throw new Error(`${where} iterate="${iterate}" is not an iterable facts array (allowed: ${FACTS_ARRAY_FIELDS.join(", ")}).`);
50
+ }
51
+
52
+ //#endregion
53
+ export { assertListFillContract };
@@ -0,0 +1,70 @@
1
+ //#region ../../internal/section-contracts/dist/list-scalar-contract.js
2
+ const LIST_ITEM_TYPES = /* @__PURE__ */ new Set([
3
+ "text",
4
+ "number",
5
+ "select",
6
+ "url",
7
+ "image",
8
+ "video",
9
+ "tour",
10
+ "poi",
11
+ "document"
12
+ ]);
13
+ function checkSelectListVocabulary(element, label, sectionKey) {
14
+ if (element.options != null) {
15
+ const source = element.options.source;
16
+ throw new Error(`Section "${sectionKey}": ${label} element is a \`select\` declaring ${source == null ? "`options`" : `\`options.source\` "${source}"`} — a select-list's vocabulary must be static \`values\`, which is the only form AI fill can read.`);
17
+ }
18
+ if (element.catalog != null) throw new Error(`Section "${sectionKey}": ${label} element is a \`select\` declaring \`catalog\` — a select-list's vocabulary must be static \`values\`, which is the only form AI fill can read.`);
19
+ if (!Array.isArray(element.values) || element.values.length === 0) throw new Error(`Section "${sectionKey}": ${label} element is a \`select\` with no \`values\` — a select-list's vocabulary must be a non-empty static \`values\` array.`);
20
+ }
21
+ function checkSingleItem(slot, label, sectionKey) {
22
+ if (slot.title !== void 0 || slot.layout !== void 0) {
23
+ const offending = slot.title !== void 0 ? "title" : "layout";
24
+ throw new Error(`Section "${sectionKey}": ${label} declares \`${offending}\` beside \`element\` — the row surface belongs to a record item (\`fields\`) only.`);
25
+ }
26
+ const element = slot.element;
27
+ if (element == null) throw new Error(`Section "${sectionKey}": ${label} must declare its item — \`element\` (a single slot) or \`fields\` (a record of slots).`);
28
+ if (!LIST_ITEM_TYPES.has(element.type ?? "")) throw new Error(`Section "${sectionKey}": ${label} element must be a single value primitive (${[...LIST_ITEM_TYPES].join("|")}) — never a list or a record, got "${element.type}".`);
29
+ if (element.type === "select") checkSelectListVocabulary(element, label, sectionKey);
30
+ const vocabulary = element.values;
31
+ if (slot.unique === true && Array.isArray(vocabulary)) {
32
+ const distinctCount = new Set(vocabulary.map((option) => typeof option === "string" ? option : option.value)).size;
33
+ if (typeof slot.max === "number" && slot.max > distinctCount) throw new Error(`Section "${sectionKey}": ${label} is \`unique\` with max ${slot.max} but its vocabulary has only ${distinctCount} distinct option(s) — max can never be reached.`);
34
+ if (typeof slot.min === "number" && slot.min > distinctCount) throw new Error(`Section "${sectionKey}": ${label} is \`unique\` with min ${slot.min} but its vocabulary has only ${distinctCount} distinct option(s) — min can never be satisfied.`);
35
+ }
36
+ }
37
+ const SCALAR_FIELD_TYPES = /* @__PURE__ */ new Set([
38
+ "text",
39
+ "number",
40
+ "select"
41
+ ]);
42
+ function checkRecordItem(slot, label, sectionKey) {
43
+ if (slot.unique !== void 0) throw new Error(`Section "${sectionKey}": ${label} declares \`unique\` beside \`fields\` — \`unique\` is select-element distinctness; a record item has no element vocabulary.`);
44
+ const fields = slot.fields ?? {};
45
+ const fieldIds = Object.keys(fields);
46
+ if (fieldIds.length === 1 && SCALAR_FIELD_TYPES.has(fields[fieldIds[0]]?.type ?? "")) throw new Error(`Section "${sectionKey}": ${label} declares a record of one scalar field "${fieldIds[0]}" — declare that field as the item instead.`);
47
+ for (const [fieldId, field] of Object.entries(fields)) {
48
+ if (field.type === "list" && field.fields != null) throw new Error(`Section "${sectionKey}": ${label} field "${fieldId}" may not be a record — identity is a flat 4-tuple, and a record field has no fifth element to address through.`);
49
+ if (field.type === "list") checkSingleItem(field, `${label} field "${fieldId}"`, sectionKey);
50
+ }
51
+ if (slot.title !== void 0 && !Object.hasOwn(fields, slot.title)) throw new Error(`Section "${sectionKey}": ${label} \`title\` names "${slot.title}", which is not a declared field.`);
52
+ for (const row of slot.layout ?? []) for (const fieldId of Array.isArray(row) ? row : [row]) if (!Object.hasOwn(fields, fieldId)) throw new Error(`Section "${sectionKey}": ${label} \`layout\` names "${fieldId}", which is not a declared field.`);
53
+ }
54
+ function checkListSlot(slot, label, sectionKey) {
55
+ if (slot.element != null && slot.fields != null) throw new Error(`Section "${sectionKey}": ${label} declares both \`element\` and \`fields\` — the item is exactly one of the two.`);
56
+ if (slot.fields != null) {
57
+ checkRecordItem(slot, label, sectionKey);
58
+ return;
59
+ }
60
+ checkSingleItem(slot, label, sectionKey);
61
+ }
62
+ function assertListScalarContract(schema, sectionKey) {
63
+ for (const [slotId, slotUnknown] of Object.entries(schema.slots)) {
64
+ const slot = slotUnknown;
65
+ if (slot.type === "list") checkListSlot(slot, `list "${slotId}"`, sectionKey);
66
+ }
67
+ }
68
+
69
+ //#endregion
70
+ export { assertListScalarContract };
@@ -0,0 +1,27 @@
1
+ //#region ../../internal/section-contracts/dist/name-title-contract.js
2
+ /**
3
+ * A `name` list fill producing a record list needs the slot's `title:` to name a
4
+ * `text` row field carrying a `cap` — the field the written name lands in, and
5
+ * the budget it is written to. Every other mode passes untouched. Throws on the
6
+ * first violation.
7
+ */
8
+ function assertNameTitleContract(schema, decision, sectionKey) {
9
+ const fill = decision;
10
+ if (fill.type !== "list-fill" || fill.mode !== "name") return;
11
+ for (const slotId of decision.produces) {
12
+ const slot = schema.slots[slotId];
13
+ const fields = slot?.fields;
14
+ if (fields === void 0) continue;
15
+ const where = `Section "${sectionKey}": list fill "${decision.id}" names rows of "${slotId}"`;
16
+ const title = slot.title;
17
+ if (title === void 0) throw new Error(`${where}, but the slot declares no \`title:\`. The written name lands in the titled field — name one with \`title: "<field>"\`, or originate the rows another way.`);
18
+ const field = fields[title];
19
+ if (field === void 0) throw new Error(`${where} by "${title}", which is not one of its declared fields.`);
20
+ if (field.type !== "text") throw new Error(`${where} by "${title}", which is a \`${String(field.type)}\` field — a written name needs a \`text\` field.`);
21
+ if (typeof field.cap !== "number") throw new Error(`${where} by "${title}", which declares no \`cap\` — a written name needs its character budget.`);
22
+ if (decision.fields?.[title] !== void 0) throw new Error(`${where} by "${title}", which also carries its own fill — the written name is that field's value, so it takes none.`);
23
+ }
24
+ }
25
+
26
+ //#endregion
27
+ export { assertNameTitleContract };
@@ -0,0 +1,12 @@
1
+ import { SLOT_TYPES } from "../../template-contracts/dist/slot-catalog.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/nested-slot-contract.js
4
+ function assertNestedSlotTypes(schema, sectionKey) {
5
+ for (const [slotId, slot] of Object.entries(schema.slots)) {
6
+ if (!slot.fields) continue;
7
+ for (const [childId, child] of Object.entries(slot.fields)) if (child.type != null && !SLOT_TYPES.includes(child.type)) throw new Error(`Section "${sectionKey}": list "${slotId}" item "${childId}" has unknown nested slot type "${child.type}".`);
8
+ }
9
+ }
10
+
11
+ //#endregion
12
+ export { assertNestedSlotTypes };
@@ -0,0 +1,22 @@
1
+ import { OPTION_SOURCES, isOptionSource } from "../../template-contracts/dist/slot-catalog.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/option-source-contract.js
4
+ function assertOptionSourceContract(schema, sectionKey) {
5
+ for (const [slotId, slot] of Object.entries(schema.slots)) {
6
+ check(slot, sectionKey, `select "${slotId}"`);
7
+ if (slot.element) check(slot.element, sectionKey, `list "${slotId}" element`);
8
+ if (slot.fields) for (const [fieldId, field] of Object.entries(slot.fields)) {
9
+ const label = `${slot.type ?? "?"} "${slotId}" field "${fieldId}"`;
10
+ check(field, sectionKey, label);
11
+ if (field.element) check(field.element, sectionKey, `${label} element`);
12
+ }
13
+ }
14
+ }
15
+ function check(slot, sectionKey, label) {
16
+ if (slot.type !== "select") return;
17
+ const source = slot.options?.source;
18
+ if (source !== void 0 && !isOptionSource(source)) throw new Error(`Section "${sectionKey}": ${label} declares unknown options.source ${JSON.stringify(source)} (allowed: ${OPTION_SOURCES.join(", ")}). No option provider answers to it, so the dropdown would be empty.`);
19
+ }
20
+
21
+ //#endregion
22
+ export { assertOptionSourceContract };
@@ -0,0 +1,18 @@
1
+ //#region ../../internal/section-contracts/dist/poi-curation-contract.js
2
+ function curates(decision) {
3
+ return decision.type === "list-fill" && decision.mode === "curate";
4
+ }
5
+ /** Whether this slot's items are POIs, at either spelling of a POI list. */
6
+ function holdsPois(slot) {
7
+ return slot.type === "list" && slot.element?.type === "poi";
8
+ }
9
+ function assertPoiCurationContract(schema, decision, sectionKey) {
10
+ if (!curates(decision)) return;
11
+ if (decision.produces.length !== 1) throw new Error(`Section "${sectionKey}": POI curation decision "${decision.id}" must produce exactly one slot (got [${decision.produces.join(", ")}]).`);
12
+ const slotId = decision.produces[0];
13
+ const slot = schema.slots[slotId];
14
+ if (slot && !holdsPois(slot)) throw new Error(`Section "${sectionKey}": POI curation decision "${decision.id}" produces "${slotId}" of type ${slot.type}; curation may only fill a list of POIs.`);
15
+ }
16
+
17
+ //#endregion
18
+ export { assertPoiCurationContract };
@@ -0,0 +1,30 @@
1
+ import { POOLING_PRIMITIVES, poolingPrimitiveOf } from "../../fill-vocabulary/dist/row-planners.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/pooling-field-contract.js
4
+ /**
5
+ * The unbound pooled-asset declarations one item carries, named as an author
6
+ * would find them: a record's field names, or `element` for a single-item list.
7
+ */
8
+ function poolingDeclarationsOf(slot) {
9
+ if (slot.fields !== void 0) return Object.entries(slot.fields).filter(([, field]) => field.source === void 0 && poolingPrimitiveOf(field) !== void 0).map(([name]) => name);
10
+ return poolingPrimitiveOf(slot.element ?? {}) !== void 0 ? ["element"] : [];
11
+ }
12
+ /**
13
+ * Rejects a record item declaring more than one pooling field, and pool
14
+ * origination over an item that declares no pooled asset at all. Throws on the
15
+ * first violation.
16
+ */
17
+ function assertPoolingFieldContract(schema, decision, sectionKey) {
18
+ if (decision.type !== "list-fill") return;
19
+ const { mode } = decision;
20
+ for (const slotId of decision.produces) {
21
+ const slot = schema.slots[slotId];
22
+ if (!slot) continue;
23
+ const pooling = poolingDeclarationsOf(slot);
24
+ if (pooling.length > 1) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" produces "${slotId}", whose item declares ${pooling.length} pooled fields (${pooling.join(", ")}) — a record item carries at most one, since the pool it draws from IS where its rows come from. Bind all but one to a fact with \`source:\`, or split the list.`);
25
+ if (mode === "pool" && pooling.length === 0) throw new Error(`Section "${sectionKey}": list fill "${decision.id}" originates rows from an asset pool, but "${slotId}" declares no ${POOLING_PRIMITIVES.join(" / ")} item.`);
26
+ }
27
+ }
28
+
29
+ //#endregion
30
+ export { assertPoolingFieldContract };
@@ -0,0 +1,24 @@
1
+ import { COLLECTIONS, collectionBounds, collectionForSlot } from "../../template-contracts/dist/slot-catalog.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/record-collection-contract.js
4
+ function assertRecordCollectionContract(schema, sectionKey) {
5
+ for (const [slotId, slotUnknown] of Object.entries(schema.slots)) {
6
+ const slot = slotUnknown;
7
+ if (slot.type !== "list" || slot.fields == null) continue;
8
+ const label = `list "${slotId}"`;
9
+ const source = slot.source;
10
+ if (source?.kind !== "direct") continue;
11
+ const collection = collectionForSlot(slot);
12
+ if (collection === null) {
13
+ const legal = Object.keys(COLLECTIONS).map((field) => `fact.property.${field}`).join(" / ");
14
+ throw new Error(`Section "${sectionKey}": ${label} source.field "${source.field ?? "?"}" is not a known collection. COLLECTIONS is a closed registry owned by @homepages/template-kit — a workspace cannot add to it. A direct-sourced collection may only bind a registry array (${legal}); for any other repeating data, drop \`source\` and give the slot a fill decision instead.`);
15
+ }
16
+ if (!COLLECTIONS[collection].ownership) throw new Error(`Section "${sectionKey}": ${label} collection "${collection}" declares no ownership in COLLECTIONS. COLLECTIONS is a closed registry owned by @homepages/template-kit — this is a kit defect, not something a workspace can fix.`);
17
+ const inherited = collectionBounds(collection);
18
+ if (inherited.max !== void 0 && slot.max !== void 0 && slot.max >= inherited.max) throw new Error(`Section "${sectionKey}": ${label} declares max ${slot.max}, but collection "${collection}" already caps membership at ${inherited.max}. An explicit max is legal only if it is strictly lower; drop it to inherit ${inherited.max}.`);
19
+ if (inherited.min !== void 0 && slot.min !== void 0 && slot.min <= inherited.min) throw new Error(`Section "${sectionKey}": ${label} declares min ${slot.min}, but collection "${collection}" already requires at least ${inherited.min}. An explicit min is legal only if it is strictly higher; drop it to inherit ${inherited.min}.`);
20
+ }
21
+ }
22
+
23
+ //#endregion
24
+ export { assertRecordCollectionContract };
@@ -0,0 +1,37 @@
1
+ import { flattenLayout, isShortSlot } from "../../template-contracts/dist/layout.js";
2
+
3
+ //#region ../../internal/section-contracts/dist/row-contract.js
4
+ function assertRowContract(schema, sectionKey) {
5
+ for (const group of schema.groups ?? []) assertRowPairs(group.members, schema.slots, `group "${group.id}"`, sectionKey);
6
+ for (const [slotId, slot] of Object.entries(schema.slots)) {
7
+ if (slot.type !== "list") continue;
8
+ if (!slot.layout) continue;
9
+ const label = `${slot.type} "${slotId}"`;
10
+ const itemFields = slot.fields ?? {};
11
+ assertRowPairs(slot.layout, itemFields, label, sectionKey);
12
+ const flat = flattenLayout(slot.layout);
13
+ const dup = flat.find((id, i) => flat.indexOf(id) !== i);
14
+ if (dup) throw new Error(`Section "${sectionKey}": ${label} layout lists "${dup}" more than once.`);
15
+ for (const id of flat) if (!(id in itemFields)) throw new Error(`Section "${sectionKey}": ${label} layout names unknown field "${id}".`);
16
+ for (const key of Object.keys(itemFields)) if (!flat.includes(key)) throw new Error(`Section "${sectionKey}": ${label} layout omits field "${key}".`);
17
+ }
18
+ }
19
+ function assertRowPairs(layout, slots, ctx, sectionKey) {
20
+ const order = Object.keys(slots);
21
+ for (const entry of layout) {
22
+ if (typeof entry === "string") continue;
23
+ const [a, b] = entry;
24
+ for (const id of [a, b]) {
25
+ const slot = slots[id];
26
+ if (!slot) throw new Error(`Section "${sectionKey}": ${ctx} row names unknown slot "${id}".`);
27
+ if (!isShortSlot({
28
+ type: slot.type ?? "",
29
+ size: slot.size
30
+ })) throw new Error(`Section "${sectionKey}": ${ctx} row pairs non-short slot "${id}" (type "${slot.type}"); only number/short-text slots may share a row.`);
31
+ }
32
+ if (order.indexOf(b) !== order.indexOf(a) + 1) throw new Error(`Section "${sectionKey}": ${ctx} row [${a}, ${b}] must be adjacent and in order; reorder the declaration so "${b}" immediately follows "${a}".`);
33
+ }
34
+ }
35
+
36
+ //#endregion
37
+ export { assertRowContract };