payload-canvas 0.4.0 → 0.5.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 (468) hide show
  1. package/README.md +625 -153
  2. package/dist/admin/AiKeyField.d.ts +8 -0
  3. package/dist/admin/AiKeyField.js +54 -0
  4. package/dist/admin/BuilderTab.js +4 -1
  5. package/dist/admin/DocumentEditView.d.ts +9 -0
  6. package/dist/admin/DocumentEditView.js +45 -0
  7. package/dist/admin/LayoutField.d.ts +2 -2
  8. package/dist/admin/LayoutField.js +10 -7
  9. package/dist/admin/TemplateConditionsField.d.ts +9 -0
  10. package/dist/admin/TemplateConditionsField.js +22 -0
  11. package/dist/admin/aiKeyField.scss +58 -0
  12. package/dist/admin/client.d.ts +3 -0
  13. package/dist/admin/client.js +6 -0
  14. package/dist/admin/diff/changes.js +5 -0
  15. package/dist/admin/editor/Canvas.js +20 -5
  16. package/dist/admin/editor/Editor.d.ts +3 -1
  17. package/dist/admin/editor/Editor.js +6 -3
  18. package/dist/admin/editor/Inspector.js +75 -28
  19. package/dist/admin/editor/Library.js +40 -15
  20. package/dist/admin/editor/Outline.js +21 -16
  21. package/dist/admin/editor/Overlay.js +8 -3
  22. package/dist/admin/editor/actions.d.ts +10 -2
  23. package/dist/admin/editor/actions.js +18 -3
  24. package/dist/admin/editor/assistant/AssistantPanel.js +3 -1
  25. package/dist/admin/editor/classes/ClassManager.d.ts +4 -0
  26. package/dist/admin/editor/classes/ClassManager.js +56 -0
  27. package/dist/admin/editor/classes/controller.d.ts +112 -0
  28. package/dist/admin/editor/classes/controller.js +326 -0
  29. package/dist/admin/editor/classes/manager.scss +262 -0
  30. package/dist/admin/editor/classes/managerModel.d.ts +5 -0
  31. package/dist/admin/editor/classes/managerModel.js +27 -0
  32. package/dist/admin/editor/comments/CommentLayer.d.ts +2 -0
  33. package/dist/admin/editor/comments/CommentLayer.js +143 -0
  34. package/dist/admin/editor/comments/CommentsPanel.d.ts +8 -0
  35. package/dist/admin/editor/comments/CommentsPanel.js +73 -0
  36. package/dist/admin/editor/comments/Thread.d.ts +26 -0
  37. package/dist/admin/editor/comments/Thread.js +84 -0
  38. package/dist/admin/editor/comments/comments.scss +539 -0
  39. package/dist/admin/editor/comments/controller.d.ts +48 -0
  40. package/dist/admin/editor/comments/controller.js +142 -0
  41. package/dist/admin/editor/contentMode.d.ts +17 -0
  42. package/dist/admin/editor/contentMode.js +37 -0
  43. package/dist/admin/editor/dnd/DropOutlines.d.ts +1 -0
  44. package/dist/admin/editor/dnd/DropOutlines.js +73 -0
  45. package/dist/admin/editor/dnd/dnd.scss +43 -0
  46. package/dist/admin/editor/dnd/mode.d.ts +4 -0
  47. package/dist/admin/editor/dnd/mode.js +39 -0
  48. package/dist/admin/editor/editor.scss +13 -58
  49. package/dist/admin/editor/empty/EmptyStart.js +18 -66
  50. package/dist/admin/editor/fields/AddButton.d.ts +15 -0
  51. package/dist/admin/editor/fields/AddButton.js +14 -0
  52. package/dist/admin/editor/fields/ArrayField.js +3 -2
  53. package/dist/admin/editor/fields/CheckedInputs.d.ts +1 -0
  54. package/dist/admin/editor/fields/ConditionRows.d.ts +19 -0
  55. package/dist/admin/editor/fields/ConditionRows.js +137 -0
  56. package/dist/admin/editor/fields/ListWhereField.d.ts +8 -0
  57. package/dist/admin/editor/fields/ListWhereField.js +20 -0
  58. package/dist/admin/editor/fields/QueryFiltersField.d.ts +18 -0
  59. package/dist/admin/editor/fields/QueryFiltersField.js +41 -0
  60. package/dist/admin/editor/fields/RelatedField.d.ts +19 -0
  61. package/dist/admin/editor/fields/RelatedField.js +44 -0
  62. package/dist/admin/editor/fields/SortField.d.ts +13 -0
  63. package/dist/admin/editor/fields/SortField.js +37 -0
  64. package/dist/admin/editor/fields/WhereField.d.ts +12 -4
  65. package/dist/admin/editor/fields/WhereField.js +33 -53
  66. package/dist/admin/editor/fields/collectionFields.d.ts +6 -0
  67. package/dist/admin/editor/fields/collectionFields.js +15 -0
  68. package/dist/admin/editor/fields/conditions.d.ts +99 -0
  69. package/dist/admin/editor/fields/conditions.js +339 -0
  70. package/dist/admin/editor/fields/fields.scss +232 -9
  71. package/dist/admin/editor/fields/listOptions.d.ts +44 -0
  72. package/dist/admin/editor/fields/listOptions.js +111 -0
  73. package/dist/admin/editor/fields/queryFilterRows.d.ts +8 -0
  74. package/dist/admin/editor/fields/queryFilterRows.js +29 -0
  75. package/dist/admin/editor/fields/whereRows.d.ts +11 -12
  76. package/dist/admin/editor/fields/whereRows.js +83 -34
  77. package/dist/admin/editor/icons.d.ts +16 -1
  78. package/dist/admin/editor/icons.js +30 -1
  79. package/dist/admin/editor/inline.js +9 -0
  80. package/dist/admin/editor/insert/InsertHandle.js +4 -1
  81. package/dist/admin/editor/insert/picker.d.ts +3 -1
  82. package/dist/admin/editor/insert/picker.js +17 -10
  83. package/dist/admin/editor/insert/spots.d.ts +12 -1
  84. package/dist/admin/editor/insert/spots.js +49 -10
  85. package/dist/admin/editor/layout/LeftPanel.js +11 -6
  86. package/dist/admin/editor/live/useMultiplayer.js +9 -1
  87. package/dist/admin/editor/menu/blockMenu.js +27 -17
  88. package/dist/admin/editor/names.js +11 -3
  89. package/dist/admin/editor/renderField.d.ts +3 -1
  90. package/dist/admin/editor/renderField.js +63 -12
  91. package/dist/admin/editor/runtime.d.ts +14 -0
  92. package/dist/admin/editor/runtime.js +67 -6
  93. package/dist/admin/editor/sections/ComponentFields.d.ts +8 -0
  94. package/dist/admin/editor/sections/ComponentFields.js +116 -0
  95. package/dist/admin/editor/sections/PropertyControls.d.ts +18 -0
  96. package/dist/admin/editor/sections/PropertyControls.js +65 -0
  97. package/dist/admin/editor/sections/components.d.ts +29 -0
  98. package/dist/admin/editor/sections/components.js +112 -0
  99. package/dist/admin/editor/sections/components.scss +238 -0
  100. package/dist/admin/editor/sections/variants.d.ts +32 -0
  101. package/dist/admin/editor/sections/variants.js +59 -0
  102. package/dist/admin/editor/sections/variants.scss +90 -0
  103. package/dist/admin/editor/shortcuts.d.ts +4 -1
  104. package/dist/admin/editor/shortcuts.js +19 -3
  105. package/dist/admin/editor/store.d.ts +18 -0
  106. package/dist/admin/editor/store.js +46 -0
  107. package/dist/admin/editor/styles/ClassBar.d.ts +14 -0
  108. package/dist/admin/editor/styles/ClassBar.js +90 -0
  109. package/dist/admin/editor/styles/ClassCss.d.ts +4 -0
  110. package/dist/admin/editor/styles/ClassCss.js +28 -0
  111. package/dist/admin/editor/styles/ClassDialog.d.ts +2 -0
  112. package/dist/admin/editor/styles/ClassDialog.js +151 -0
  113. package/dist/admin/editor/styles/ColorPicker.js +5 -2
  114. package/dist/admin/editor/styles/RawClasses.d.ts +26 -1
  115. package/dist/admin/editor/styles/RawClasses.js +184 -32
  116. package/dist/admin/editor/styles/StylesPanel.d.ts +3 -3
  117. package/dist/admin/editor/styles/StylesPanel.js +53 -14
  118. package/dist/admin/editor/styles/VariantBar.js +2 -2
  119. package/dist/admin/editor/styles/classEdit.d.ts +4 -0
  120. package/dist/admin/editor/styles/classEdit.js +20 -0
  121. package/dist/admin/editor/styles/classes.scss +381 -0
  122. package/dist/admin/editor/styles/context.d.ts +19 -6
  123. package/dist/admin/editor/styles/context.js +24 -6
  124. package/dist/admin/editor/styles/controls.d.ts +3 -1
  125. package/dist/admin/editor/styles/controls.js +30 -12
  126. package/dist/admin/editor/styles/popover.d.ts +6 -0
  127. package/dist/admin/editor/styles/popover.js +5 -5
  128. package/dist/admin/editor/styles/styles.scss +26 -104
  129. package/dist/admin/editor/styles/suggestions.d.ts +22 -0
  130. package/dist/admin/editor/styles/suggestions.js +77 -0
  131. package/dist/admin/editor/styles/tokens.js +14 -0
  132. package/dist/admin/editor/templates/Bindable.js +86 -57
  133. package/dist/admin/editor/templates/SamplePicker.js +1 -1
  134. package/dist/admin/editor/templates/Visibility.d.ts +9 -0
  135. package/dist/admin/editor/templates/Visibility.js +54 -0
  136. package/dist/admin/editor/templates/binding.d.ts +2 -2
  137. package/dist/admin/editor/templates/binding.js +2 -2
  138. package/dist/admin/editor/templates/templates.scss +27 -0
  139. package/dist/admin/editor/templates/visibilityRows.d.ts +22 -0
  140. package/dist/admin/editor/templates/visibilityRows.js +83 -0
  141. package/dist/admin/editor/topbar/ContentModeToggle.d.ts +5 -0
  142. package/dist/admin/editor/topbar/ContentModeToggle.js +26 -0
  143. package/dist/admin/editor/topbar/DocumentActions.d.ts +1 -1
  144. package/dist/admin/editor/topbar/DocumentActions.js +5 -4
  145. package/dist/admin/editor/topbar/DocumentTitle.js +7 -2
  146. package/dist/admin/editor/topbar/TopBar.js +15 -3
  147. package/dist/admin/editor/topbar/contentMode.scss +35 -0
  148. package/dist/admin/editor/topbar/topbar.scss +3 -1
  149. package/dist/admin/formChoice.d.ts +3 -0
  150. package/dist/admin/formChoice.js +10 -0
  151. package/dist/admin/layoutField.scss +69 -0
  152. package/dist/admin/screen/BuilderScreen.d.ts +6 -1
  153. package/dist/admin/screen/BuilderScreen.js +4 -3
  154. package/dist/admin/server/BuilderView.js +10 -3
  155. package/dist/admin/templateConditions.scss +24 -0
  156. package/dist/ai/adapters/anthropic.js +17 -4
  157. package/dist/ai/adapters/cloudflare-gateway.js +7 -1
  158. package/dist/ai/adapters/cloudflare-workers-ai.js +2 -0
  159. package/dist/ai/adapters/openai-compatible.js +1 -0
  160. package/dist/ai/adapters/openrouter.js +2 -0
  161. package/dist/ai/config.d.ts +24 -4
  162. package/dist/ai/config.js +27 -8
  163. package/dist/ai/endpoint.d.ts +5 -2
  164. package/dist/ai/endpoint.js +31 -26
  165. package/dist/ai/images/cloudflare-workers-ai.js +6 -2
  166. package/dist/ai/images/openai.js +8 -3
  167. package/dist/ai/images/openrouter.js +6 -2
  168. package/dist/ai/images/service.d.ts +10 -4
  169. package/dist/ai/images/service.js +23 -7
  170. package/dist/ai/openai-format.d.ts +7 -0
  171. package/dist/ai/openai-format.js +17 -5
  172. package/dist/ai/prompt.d.ts +8 -0
  173. package/dist/ai/prompt.js +25 -5
  174. package/dist/ai/settings/index.d.ts +62 -0
  175. package/dist/ai/settings/index.js +264 -0
  176. package/dist/ai/settings/secret.d.ts +11 -0
  177. package/dist/ai/settings/secret.js +46 -0
  178. package/dist/ai/settings/shared.d.ts +22 -0
  179. package/dist/ai/settings/shared.js +3 -0
  180. package/dist/ai/tools.d.ts +3 -0
  181. package/dist/ai/tools.js +79 -15
  182. package/dist/ai/types.d.ts +43 -0
  183. package/dist/blocks/builtins/adjacentLinks.d.ts +5 -0
  184. package/dist/blocks/builtins/adjacentLinks.js +76 -0
  185. package/dist/blocks/builtins/carousel.d.ts +2 -29
  186. package/dist/blocks/builtins/carousel.js +44 -51
  187. package/dist/blocks/builtins/disclosure.d.ts +2 -1
  188. package/dist/blocks/builtins/disclosure.js +22 -32
  189. package/dist/blocks/builtins/embed.d.ts +15 -0
  190. package/dist/blocks/builtins/embed.js +47 -0
  191. package/dist/blocks/builtins/faq.d.ts +1 -1
  192. package/dist/blocks/builtins/faq.js +2 -2
  193. package/dist/blocks/builtins/filterLink.d.ts +1 -19
  194. package/dist/blocks/builtins/filterLink.js +9 -50
  195. package/dist/blocks/builtins/icon.d.ts +2 -0
  196. package/dist/blocks/builtins/icon.js +8 -8
  197. package/dist/blocks/builtins/index.d.ts +18 -13
  198. package/dist/blocks/builtins/index.js +43 -22
  199. package/dist/blocks/builtins/marquee.d.ts +5 -0
  200. package/dist/blocks/builtins/marquee.js +68 -0
  201. package/dist/blocks/builtins/popup.d.ts +5 -0
  202. package/dist/blocks/builtins/popup.js +83 -0
  203. package/dist/blocks/builtins/sectionRef.d.ts +16 -2
  204. package/dist/blocks/builtins/sectionRef.js +34 -12
  205. package/dist/blocks/builtins/shared.d.ts +18 -23
  206. package/dist/blocks/builtins/shared.js +34 -42
  207. package/dist/blocks/builtins/tableOfContents.d.ts +4 -0
  208. package/dist/blocks/builtins/tableOfContents.js +12 -18
  209. package/dist/blocks/builtins/tabs.d.ts +6 -0
  210. package/dist/blocks/builtins/tabs.js +87 -0
  211. package/dist/blocks/client/adjacentLinks.d.ts +4 -0
  212. package/dist/blocks/client/adjacentLinks.js +4 -0
  213. package/dist/blocks/client/carousel.d.ts +45 -0
  214. package/dist/blocks/client/carousel.js +53 -0
  215. package/dist/blocks/client/embed.d.ts +21 -0
  216. package/dist/blocks/client/embed.js +23 -0
  217. package/dist/blocks/client/field.d.ts +7 -0
  218. package/dist/blocks/client/field.js +8 -0
  219. package/dist/blocks/client/filterLink.d.ts +19 -0
  220. package/dist/blocks/client/filterLink.js +30 -0
  221. package/dist/blocks/client/helpers.d.ts +21 -0
  222. package/dist/blocks/client/helpers.js +24 -0
  223. package/dist/blocks/client/marquee.d.ts +14 -0
  224. package/dist/blocks/client/marquee.js +25 -0
  225. package/dist/blocks/client/menu.d.ts +46 -0
  226. package/dist/blocks/client/menu.js +49 -0
  227. package/dist/blocks/client/popup.d.ts +15 -0
  228. package/dist/blocks/client/popup.js +16 -0
  229. package/dist/blocks/client/tabs.d.ts +10 -0
  230. package/dist/blocks/client/tabs.js +11 -0
  231. package/dist/blocks/defaults.d.ts +15 -52
  232. package/dist/blocks/defaults.js +203 -437
  233. package/dist/blocks/index.d.ts +1 -2
  234. package/dist/blocks/index.js +1 -2
  235. package/dist/classes/actions.d.ts +97 -0
  236. package/dist/classes/actions.js +296 -0
  237. package/dist/classes/collection.d.ts +5 -0
  238. package/dist/classes/collection.js +189 -0
  239. package/dist/classes/config.d.ts +34 -0
  240. package/dist/classes/config.js +8 -0
  241. package/dist/classes/endpoints.d.ts +2 -0
  242. package/dist/classes/endpoints.js +120 -0
  243. package/dist/classes/index.d.ts +36 -0
  244. package/dist/classes/index.js +42 -0
  245. package/dist/classes/mcp.d.ts +6 -0
  246. package/dist/classes/mcp.js +161 -0
  247. package/dist/classes/shared.d.ts +131 -0
  248. package/dist/classes/shared.js +300 -0
  249. package/dist/classes/sheet.d.ts +34 -0
  250. package/dist/classes/sheet.js +126 -0
  251. package/dist/classes/usage.d.ts +57 -0
  252. package/dist/classes/usage.js +208 -0
  253. package/dist/comments/collection.d.ts +38 -0
  254. package/dist/comments/collection.js +226 -0
  255. package/dist/comments/config.d.ts +15 -0
  256. package/dist/comments/config.js +2 -0
  257. package/dist/comments/index.d.ts +20 -0
  258. package/dist/comments/index.js +22 -0
  259. package/dist/comments/shared.d.ts +54 -0
  260. package/dist/comments/shared.js +104 -0
  261. package/dist/core/bindings.d.ts +77 -32
  262. package/dist/core/bindings.js +319 -134
  263. package/dist/core/blockNames.d.ts +9 -0
  264. package/dist/core/blockNames.js +11 -0
  265. package/dist/core/blocks.d.ts +21 -8
  266. package/dist/core/blocks.js +37 -16
  267. package/dist/core/classes.d.ts +16 -8
  268. package/dist/core/classes.js +31 -27
  269. package/dist/core/components.d.ts +72 -0
  270. package/dist/core/components.js +294 -0
  271. package/dist/core/contentMode.d.ts +27 -0
  272. package/dist/core/contentMode.js +0 -0
  273. package/dist/core/dropTarget.d.ts +11 -0
  274. package/dist/core/dropTarget.js +24 -1
  275. package/dist/core/fields.d.ts +5 -0
  276. package/dist/core/fields.js +11 -0
  277. package/dist/core/headings.d.ts +5 -2
  278. package/dist/core/headings.js +14 -6
  279. package/dist/core/index.d.ts +8 -3
  280. package/dist/core/index.js +8 -3
  281. package/dist/core/layers.d.ts +9 -0
  282. package/dist/core/layers.js +29 -0
  283. package/dist/core/operations.d.ts +6 -0
  284. package/dist/core/operations.js +85 -24
  285. package/dist/core/payloadBlocks.js +5 -1
  286. package/dist/core/references.js +28 -0
  287. package/dist/core/schema.js +20 -6
  288. package/dist/core/sectionOrigin.d.ts +6 -0
  289. package/dist/core/sectionOrigin.js +21 -0
  290. package/dist/core/sections.d.ts +72 -0
  291. package/dist/core/sections.js +331 -0
  292. package/dist/core/templateChoice.d.ts +24 -0
  293. package/dist/core/templateChoice.js +43 -0
  294. package/dist/core/tree.js +18 -6
  295. package/dist/core/types.d.ts +148 -18
  296. package/dist/core/validate.d.ts +4 -1
  297. package/dist/core/validate.js +28 -11
  298. package/dist/core/visibility.d.ts +63 -0
  299. package/dist/core/visibility.js +214 -0
  300. package/dist/core/whereValues.d.ts +22 -0
  301. package/dist/core/whereValues.js +43 -0
  302. package/dist/css/classes.d.ts +16 -0
  303. package/dist/css/classes.js +172 -0
  304. package/dist/css/index.d.ts +32 -1
  305. package/dist/css/index.js +64 -5
  306. package/dist/css/tokens.d.ts +10 -0
  307. package/dist/css/tokens.js +23 -10
  308. package/dist/index.d.ts +5 -2
  309. package/dist/index.js +6 -1
  310. package/dist/live/contentMode.d.ts +24 -0
  311. package/dist/live/contentMode.js +39 -0
  312. package/dist/live/endpoints.js +3 -0
  313. package/dist/live/session.d.ts +5 -0
  314. package/dist/live/session.js +8 -0
  315. package/dist/live/types.d.ts +16 -1
  316. package/dist/mcp/index.d.ts +10 -1
  317. package/dist/mcp/index.js +146 -54
  318. package/dist/mcp/shared.d.ts +93 -3
  319. package/dist/mcp/shared.js +211 -15
  320. package/dist/plugin/hook.d.ts +7 -1
  321. package/dist/plugin/hook.js +30 -4
  322. package/dist/plugin/index.d.ts +19 -8
  323. package/dist/plugin/index.js +89 -20
  324. package/dist/plugin/links.d.ts +24 -0
  325. package/dist/plugin/links.js +27 -0
  326. package/dist/plugin/listCollections.d.ts +9 -7
  327. package/dist/plugin/listCollections.js +30 -21
  328. package/dist/plugin/sections.d.ts +14 -7
  329. package/dist/plugin/sections.js +69 -23
  330. package/dist/plugin/sectionsUsedIn.d.ts +6 -0
  331. package/dist/plugin/sectionsUsedIn.js +24 -0
  332. package/dist/plugin/templateEndpoint.d.ts +9 -0
  333. package/dist/plugin/templateEndpoint.js +49 -0
  334. package/dist/plugin/templates.js +23 -8
  335. package/dist/protocol/index.d.ts +16 -1
  336. package/dist/react/canvas/BuilderCanvas.js +144 -21
  337. package/dist/react/canvas/classes.d.ts +17 -0
  338. package/dist/react/canvas/classes.js +102 -0
  339. package/dist/react/canvas/controls.d.ts +31 -0
  340. package/dist/react/canvas/controls.js +75 -0
  341. package/dist/react/canvas/fetchDocs.d.ts +2 -2
  342. package/dist/react/canvas/fetchDocs.js +16 -8
  343. package/dist/react/canvas/measure.d.ts +9 -0
  344. package/dist/react/canvas/measure.js +106 -7
  345. package/dist/react/canvas/resolveLayout.d.ts +1 -1
  346. package/dist/react/canvas/resolveLayout.js +4 -3
  347. package/dist/react/canvas/thumbnail/ThumbnailCanvas.js +17 -4
  348. package/dist/react/classes/ClassesStyle.d.ts +27 -0
  349. package/dist/react/classes/ClassesStyle.js +27 -0
  350. package/dist/react/components/Button.d.ts +2 -11
  351. package/dist/react/components/Button.js +8 -43
  352. package/dist/react/components/CollectionList.d.ts +4 -1
  353. package/dist/react/components/CollectionList.js +10 -3
  354. package/dist/react/components/Container.d.ts +5 -2
  355. package/dist/react/components/Container.js +7 -4
  356. package/dist/react/components/Field.js +3 -14
  357. package/dist/react/components/Link.d.ts +1 -1
  358. package/dist/react/components/Link.js +5 -3
  359. package/dist/react/components/List.d.ts +1 -1
  360. package/dist/react/components/List.js +2 -2
  361. package/dist/react/components/Menu.d.ts +10 -1
  362. package/dist/react/components/Menu.js +39 -12
  363. package/dist/react/components/RichText.d.ts +3 -4
  364. package/dist/react/components/RichText.js +5 -5
  365. package/dist/react/components/builtins/Accordion.d.ts +4 -3
  366. package/dist/react/components/builtins/Accordion.js +6 -5
  367. package/dist/react/components/builtins/AdjacentLinks.d.ts +11 -0
  368. package/dist/react/components/builtins/AdjacentLinks.js +20 -0
  369. package/dist/react/components/builtins/Carousel.d.ts +21 -10
  370. package/dist/react/components/builtins/Carousel.js +175 -100
  371. package/dist/react/components/builtins/Disclosure.d.ts +4 -3
  372. package/dist/react/components/builtins/Disclosure.js +6 -5
  373. package/dist/react/components/builtins/Embed.d.ts +11 -0
  374. package/dist/react/components/builtins/Embed.js +23 -0
  375. package/dist/react/components/builtins/EmbedHtml.d.ts +15 -0
  376. package/dist/react/components/builtins/EmbedHtml.js +51 -0
  377. package/dist/react/components/builtins/EmbedPreview.d.ts +34 -0
  378. package/dist/react/components/builtins/EmbedPreview.js +105 -0
  379. package/dist/react/components/builtins/FilterLink.d.ts +1 -1
  380. package/dist/react/components/builtins/FilterLink.js +4 -4
  381. package/dist/react/components/builtins/Marquee.d.ts +8 -0
  382. package/dist/react/components/builtins/Marquee.js +15 -0
  383. package/dist/react/components/builtins/Popup.d.ts +26 -0
  384. package/dist/react/components/builtins/Popup.js +146 -0
  385. package/dist/react/components/builtins/SectionRef.d.ts +4 -3
  386. package/dist/react/components/builtins/SectionRef.js +9 -5
  387. package/dist/react/components/builtins/Tab.d.ts +7 -0
  388. package/dist/react/components/builtins/Tab.js +21 -0
  389. package/dist/react/components/builtins/TableOfContents.d.ts +17 -3
  390. package/dist/react/components/builtins/TableOfContents.js +22 -7
  391. package/dist/react/components/builtins/Tabs.d.ts +17 -0
  392. package/dist/react/components/builtins/Tabs.js +71 -0
  393. package/dist/react/components/builtins/index.d.ts +37 -20
  394. package/dist/react/components/builtins/index.js +54 -20
  395. package/dist/react/components/builtins/tabsContext.d.ts +12 -0
  396. package/dist/react/components/builtins/tabsContext.js +6 -0
  397. package/dist/react/components/index.js +11 -8
  398. package/dist/react/components/lazy.d.ts +32 -0
  399. package/dist/react/components/lazy.js +20 -0
  400. package/dist/react/components/lazyBlock.d.ts +17 -0
  401. package/dist/react/components/lazyBlock.js +23 -0
  402. package/dist/react/index.d.ts +6 -3
  403. package/dist/react/index.js +5 -2
  404. package/dist/react/render/RenderLayout.d.ts +9 -7
  405. package/dist/react/render/RenderLayout.js +96 -45
  406. package/dist/react/render/canvasMode.d.ts +13 -0
  407. package/dist/react/render/canvasMode.js +13 -0
  408. package/dist/react/render/canvasServer.js +4 -3
  409. package/dist/react/render/canvasServerTypes.d.ts +5 -0
  410. package/dist/react/render/lists.d.ts +36 -4
  411. package/dist/react/render/lists.js +132 -15
  412. package/dist/react/render/marks.d.ts +15 -0
  413. package/dist/react/render/marks.js +23 -0
  414. package/dist/react/render/payload.d.ts +8 -1
  415. package/dist/react/render/payload.js +12 -3
  416. package/dist/react/render/preview.d.ts +11 -0
  417. package/dist/react/render/preview.js +13 -0
  418. package/dist/react/render/relations.d.ts +10 -0
  419. package/dist/react/render/relations.js +39 -0
  420. package/dist/react/render/resolve.d.ts +8 -4
  421. package/dist/react/render/resolve.js +11 -5
  422. package/dist/react/render/reveal.d.ts +17 -0
  423. package/dist/react/render/reveal.js +39 -0
  424. package/dist/react/render/sections.d.ts +11 -5
  425. package/dist/react/render/sections.js +52 -24
  426. package/dist/react/render/templates.d.ts +47 -0
  427. package/dist/react/render/templates.js +139 -0
  428. package/dist/react/render/types.d.ts +62 -5
  429. package/dist/react/server.d.ts +2 -37
  430. package/dist/react/server.js +8 -133
  431. package/dist/react/theme/ThemeLiveLoader.d.ts +4 -0
  432. package/dist/react/theme/ThemeLiveLoader.js +5 -0
  433. package/dist/react/theme/ThemeStyle.js +1 -1
  434. package/dist/theme/admin/Variables.d.ts +11 -0
  435. package/dist/theme/admin/Variables.js +115 -0
  436. package/dist/theme/admin/fields.scss +113 -0
  437. package/dist/theme/client.d.ts +1 -0
  438. package/dist/theme/client.js +2 -0
  439. package/dist/theme/css.d.ts +6 -1
  440. package/dist/theme/css.js +12 -4
  441. package/dist/theme/global.js +83 -0
  442. package/dist/theme/index.d.ts +1 -0
  443. package/dist/theme/index.js +1 -0
  444. package/dist/theme/server.d.ts +15 -0
  445. package/dist/theme/server.js +43 -0
  446. package/dist/theme/usage.d.ts +23 -0
  447. package/dist/theme/usage.js +68 -0
  448. package/dist/theme/variables.d.ts +72 -0
  449. package/dist/theme/variables.js +231 -0
  450. package/package.json +4 -2
  451. package/dist/admin/editor/styles/SiteClasses.d.ts +0 -9
  452. package/dist/admin/editor/styles/SiteClasses.js +0 -31
  453. package/dist/blocks/builtins/headingId.d.ts +0 -15
  454. package/dist/blocks/builtins/headingId.js +0 -36
  455. package/dist/blocks/builtins/lightbox.d.ts +0 -43
  456. package/dist/blocks/builtins/lightbox.js +0 -93
  457. package/dist/blocks/builtins/mediaBackdrop.d.ts +0 -11
  458. package/dist/blocks/builtins/mediaBackdrop.js +0 -79
  459. package/dist/react/components/Quote.d.ts +0 -3
  460. package/dist/react/components/Quote.js +0 -12
  461. package/dist/react/components/Spacer.d.ts +0 -3
  462. package/dist/react/components/Spacer.js +0 -6
  463. package/dist/react/components/builtins/BackdropVideo.d.ts +0 -13
  464. package/dist/react/components/builtins/BackdropVideo.js +0 -16
  465. package/dist/react/components/builtins/Lightbox.d.ts +0 -45
  466. package/dist/react/components/builtins/Lightbox.js +0 -252
  467. package/dist/react/components/builtins/MediaBackdrop.d.ts +0 -14
  468. package/dist/react/components/builtins/MediaBackdrop.js +0 -61
package/dist/mcp/index.js CHANGED
@@ -8,15 +8,18 @@
8
8
  // `overrideAccess: false`. Writes are commits to the document's live session, the same path as
9
9
  // the editor's own edits, so AI changes merge with people's edits as they happen.
10
10
  import { z } from 'zod';
11
- import { COLLECTION_LIST_BLOCK, REPEAT_BLOCK, DEFAULT_TEMPLATES_SLUG, FIELD_BLOCK, TEMPLATE_CONDITIONS_FIELD, TEMPLATE_DEFAULT_FIELD, TEMPLATE_LAYOUT_FIELD, TEMPLATE_PREVIEW_FIELD, TEMPLATE_TARGET_FIELD, templateConditions, withoutBoundRequired, } from '../core/bindings.js';
11
+ import { COLLECTION_LIST_BLOCK, REPEAT_BLOCK, DEFAULT_TEMPLATES_SLUG, FIELD_BLOCK, TEMPLATE_CONDITIONS_FIELD, TEMPLATE_DEFAULT_FIELD, TEMPLATE_LAYOUT_FIELD, TEMPLATE_PREVIEW_FIELD, TEMPLATE_PRIORITY_FIELD, TEMPLATE_TARGET_FIELD, templateConditions, withoutBoundRequired, } from '../core/bindings.js';
12
12
  import { createId } from '../core/ids.js';
13
+ import { VISIBILITY_OPERATORS } from '../core/visibility.js';
13
14
  import { blockJsonSchema } from '../core/schema.js';
14
- import { getBlockDefinition, sectionsWithDefaultClassNames, sectionsWithVariants } from '../core/blocks.js';
15
+ import { checkSectionVariants, getBlockDefinition, sectionsWithDefaultClassNames } from '../core/blocks.js';
16
+ import { findSectionVersion } from '../core/sections.js';
15
17
  import { localeSettingsOf, localizedKeys, resolveLayoutLocale, stampLocale, untranslatedKeys } from '../core/locale.js';
16
18
  import { normalizeLayout, subtreeIds, walkBlocks } from '../core/tree.js';
17
19
  import { runPropValidators } from '../core/fieldValidate.js';
18
20
  import { validateLayout } from '../core/validate.js';
19
21
  import { actorFromUser, splitLayoutErrors, userLabel } from '../live/apply.js';
22
+ import { canEditDesign } from '../live/contentMode.js';
20
23
  import { fieldRegistryOf, propAccessCheck } from '../live/fieldChecks.js';
21
24
  import { builderConfigOf } from '../live/document.js';
22
25
  import { DRAFT_NOT_READABLE_MESSAGE, liveReadProblem, withLiveReadCheck } from '../live/draftAccess.js';
@@ -27,16 +30,22 @@ import { builderViewPath, documentPath, draftPreviewPath } from '../plugin/links
27
30
  import { siteCssConfigOf } from '../plugin/index.js';
28
31
  import { listableCollections, prepareBlocks } from '../plugin/listCollections.js';
29
32
  import { getStyleTokens } from '../css/index.js';
30
- import { findSection, loadSavedSections, savedSectionsConfigOf } from '../plugin/sections.js';
33
+ import { themeVariablesOf, withThemeVariables } from '../theme/server.js';
34
+ import { describeVariables, variableTokens, VARIABLES_NOTE } from '../theme/variables.js';
35
+ import { DEFAULT_SAVED_SECTIONS_SLUG, loadSavedSections, savedSectionsConfigOf } from '../plugin/sections.js';
31
36
  import { templatesConfigOf } from '../plugin/templates.js';
32
37
  import { generateImageToMedia, imageServiceOf } from '../ai/images/service.js';
33
38
  import { IMAGE_ASPECT_RATIOS } from '../ai/images/ratios.js';
34
- import { BINDINGS_GUIDE, describeBlock, layoutGuide, outline, repairRootParents, sectionInsertOps, withNewIds } from './shared.js';
39
+ import { SECTION_REF_BLOCK } from '../blocks/builtins/sectionRef.js';
40
+ import { classesConfigOf, loadClasses, mergeSiteClasses } from '../classes/index.js';
41
+ import { classMcpTools } from '../classes/mcp.js';
42
+ import { BINDINGS_GUIDE, changeSummary, componentListing, contextOnlyWarnings, describeBlock, layoutGuide, missingContent, missingContentHint, outline, repairRootParents, sectionInsertOps, sectionToInsert, touchedIds, variantsListing, withNewIds, } from './shared.js';
35
43
  // ---------------------------------------------------------------------------
36
44
  // Texts for the AI. Tool descriptions are prompts: keep them exact and complete.
37
45
  // ---------------------------------------------------------------------------
46
+ /** The long format guide. listBlocks returns it (`guide`), so tool descriptions stay short. */
38
47
  const LAYOUT_GUIDE = layoutGuide('listBlocks');
39
- const NO_DIRECT_EDIT = 'Do not change the layout field with updateDocument or patchLayout: those skip this format\'s checks and do not reach open editors.';
48
+ const NO_DIRECT_EDIT = 'Builder layouts change only through applyOperations and insertSection. Never write the layout field with updateDocument or patchLayout: they skip these checks and do not reach open editors.';
40
49
  // ---------------------------------------------------------------------------
41
50
  // Zod schemas for arguments
42
51
  // ---------------------------------------------------------------------------
@@ -45,7 +54,14 @@ const NO_DIRECT_EDIT = 'Do not change the layout field with updateDocument or pa
45
54
  * exact error, so the spec lives in core/motion.ts only. Layout guide: MOTION.
46
55
  */
47
56
  const motionArg = z.record(z.string(), z.unknown());
48
- const MOTION_HINT = 'Animations: { enter?, hover?, press?, scroll?, loop? }, each kind { preset, ...options }, e.g. { "enter": { "preset": "fade-up" } } (see MOTION in the layout guide).';
57
+ const MOTION_HINT = 'Animations: { enter?, hover?, press?, scroll?, loop? }, each kind { preset, ...options }, e.g. { "enter": { "preset": "fade-up" } } (MOTION in the listBlocks guide).';
58
+ /**
59
+ * `visibility` is a loose object here too: the operations check it (core/visibility.ts) and return
60
+ * the exact error. The format is VISIBILITY in the bindings guide (listBlocks).
61
+ */
62
+ const visibilityArg = z
63
+ .record(z.string(), z.unknown())
64
+ .describe(`{ match?: "all" | "any", conditions: [{ field, operator, value?, valueField?, count? }] }. Operators: ${VISIBILITY_OPERATORS.join(', ')}. Shows the block only when the conditions match the current document: only in templates and in list or repeat items (on a normal page it does nothing). Full format: VISIBILITY in the listBlocks bindings guide.`);
49
65
  const attrsArg = z
50
66
  .object({
51
67
  id: z.string().nullable().optional().describe('The element id, for "#id" links. Unique in the layout. Letters, digits, - and _, starting with a letter.'),
@@ -69,10 +85,16 @@ const blockSchema = z
69
85
  bindings: z.record(z.string(), z.string()).optional().describe('Prop path -> document field path (templates and list items).'),
70
86
  slots: z.record(z.string(), z.array(z.record(z.string(), z.unknown()))).optional().describe('Child blocks by slot name. Children have the same shape.'),
71
87
  hidden: z.boolean().optional(),
88
+ editableItems: z.boolean().optional().describe('Content mode: true lets editors without design rights duplicate, delete and reorder the direct children of this block (FAQ items, cards). Set it on the list, not the items.'),
72
89
  label: z.string().optional().describe('Name for editors, shown in the outline (e.g. "Hero"). Never rendered. Give each top-level section one.'),
73
90
  motion: motionArg.optional().describe(MOTION_HINT),
74
91
  attrs: attrsArg.optional(),
75
- slotClassName: z.record(z.string(), z.string()).optional().describe('Tailwind classes of a slot\'s own element, by slot name. Only slots marked "classes" in listBlocks take them.'),
92
+ visibility: visibilityArg.optional(),
93
+ partClassName: z.record(z.string(), z.string()).optional().describe('Tailwind classes of the block\'s inner elements, by part name. Only the "parts" listed in listBlocks take them.'),
94
+ section: z
95
+ .object({ id: z.string().min(1), variant: z.string().optional() })
96
+ .optional()
97
+ .describe('Set by insertSection on the root block of a ready-made section. Keep it when you copy the block; never set it yourself.'),
76
98
  })
77
99
  .passthrough();
78
100
  const operationSchema = z.discriminatedUnion('type', [
@@ -93,7 +115,10 @@ const operationSchema = z.discriminatedUnion('type', [
93
115
  props: z.record(z.string(), z.unknown()).optional().describe('Merged into the existing props (shallow). Other props stay.'),
94
116
  unsetProps: z.array(z.string()).optional().describe('Prop names to delete.'),
95
117
  className: z.string().nullable().optional().describe('Replaces ALL classes. Send the full class list. null removes it.'),
118
+ addClassName: z.string().optional().describe('Classes to add, space-separated, e.g. "shadow-lg md:p-8". Other classes stay. Runs after className and removeClassName.'),
119
+ removeClassName: z.string().optional().describe('Classes to remove, space-separated, exact match ("p-4" leaves "md:p-4"). Other classes stay.'),
96
120
  hidden: z.boolean().optional(),
121
+ editableItems: z.boolean().optional().describe('Content mode: true lets editors without design rights duplicate, delete and reorder the direct children of this block (FAQ items, cards). Set it on the list, not the items.'),
97
122
  label: z.string().nullable().optional().describe('Name for editors (outline). null or "" removes it.'),
98
123
  bindings: z
99
124
  .record(z.string(), z.string().nullable())
@@ -104,10 +129,11 @@ const operationSchema = z.discriminatedUnion('type', [
104
129
  .optional()
105
130
  .describe(`${MOTION_HINT} Merges per kind: a kind you send replaces that kind, null removes a kind, kinds you leave out stay. null removes all motion.`),
106
131
  attrs: attrsArg.nullable().optional().describe('HTML attributes. A key replaces that key, null removes it. null removes all.'),
107
- slotClassName: z
132
+ visibility: visibilityArg.nullable().optional().describe('Visibility conditions (format as in insert). Replaces all conditions; null removes them.'),
133
+ partClassName: z
108
134
  .record(z.string(), z.string().nullable())
109
135
  .optional()
110
- .describe('Classes of a slot\'s own element, by slot name. Each slot given replaces its classes; null removes them.'),
136
+ .describe('Classes of the block\'s inner elements, by part name (the "parts" in listBlocks). Each part given replaces its classes; null removes them.'),
111
137
  locale: z
112
138
  .string()
113
139
  .optional()
@@ -192,25 +218,38 @@ async function siteClassesOf(req) {
192
218
  const site = req?.payload?.config ? siteCssConfigOf(req.payload) : null;
193
219
  if (!site)
194
220
  return {};
195
- const list = await getStyleTokens(site.css)
221
+ const code = await getStyleTokens(await withThemeVariables(req.payload, site.css))
196
222
  .then((tokens) => tokens.siteClasses ?? [])
197
223
  .catch(() => []);
224
+ // The editable classes (the classes collection) first; code classes they replace are left out.
225
+ const editable = req && classesConfigOf(req.payload) ? await loadClasses(req).catch(() => []) : [];
226
+ const list = mergeSiteClasses(editable, code);
198
227
  if (list.length === 0)
199
228
  return {};
200
229
  return {
201
230
  siteClasses: list.map(({ name, label, group }) => ({ name, ...(label ? { label } : {}), ...(group ? { group } : {}) })),
202
- siteClassesNote: "The site's own classes (its look: type styles, buttons, cards, surfaces). Prefer them in className over rebuilding the same look from utilities.",
231
+ siteClassesNote: "The site's own classes (its look: type styles, buttons, cards, surfaces). Prefer them in className over rebuilding the same look from utilities." +
232
+ (editable.length > 0 ? ' listClasses shows their styles; upsertClass changes a class for every block that uses it.' : ''),
203
233
  };
204
234
  }
235
+ /** The theme's design variables for `listBlocks`, or nothing without them. */
236
+ async function variablesOf(req) {
237
+ if (!req?.payload?.config)
238
+ return {};
239
+ const list = variableTokens(await themeVariablesOf(req.payload));
240
+ return list.length > 0 ? { variables: describeVariables(list), variablesNote: VARIABLES_NOTE } : {};
241
+ }
205
242
  export function builderMcpTools(options) {
206
243
  const templateTargets = Object.entries(options.collections).filter(([, c]) => c.templates).map(([slug]) => slug);
207
244
  const templatesSlug = templateTargets.length > 0 ? (options.templates?.slug ?? DEFAULT_TEMPLATES_SLUG) : null;
208
245
  const listable = listableCollections(options.collections, options.listCollections);
209
- // The same block list the plugin validates against (collection list: the collections with a url and `listCollections`).
210
- const blocks = prepareBlocks(options.blocks, listable);
246
+ // The same block list the plugin validates against (collection list: the collections with a url
247
+ // and `listCollections`; the live saved section block, which the plugin adds when saved sections are on).
248
+ const blocks = prepareBlocks(options.blocks, listable, DEFAULT_SAVED_SECTIONS_SLUG);
211
249
  // A section block without a className gets its type's default classes, as in the plugin.
212
- // Each variant is a section of its own (`<id>/<variant id>`).
213
- const sections = sectionsWithDefaultClassNames(sectionsWithVariants(options.sections ?? []), blocks);
250
+ // Variants stay under their section (core/sections.ts); insertSection takes `variant`.
251
+ checkSectionVariants(options.sections ?? []);
252
+ const sections = sectionsWithDefaultClassNames(options.sections ?? [], blocks);
214
253
  const collections = templatesSlug
215
254
  ? { ...options.collections, [templatesSlug]: { field: TEMPLATE_LAYOUT_FIELD } }
216
255
  : options.collections;
@@ -220,10 +259,19 @@ export function builderMcpTools(options) {
220
259
  const fieldOf = (collection) => collections[collection]?.field ?? 'layout';
221
260
  const apiKeyCollection = options.apiKeyCollection ?? 'payload-mcp-api-keys';
222
261
  const keyNames = new Map();
223
- const collectionArg = z
262
+ const collectionEnum = z
224
263
  .enum(slugs)
225
264
  .describe(`Collection of the page. One of: ${slugs.join(', ')}.` +
226
265
  (templatesSlug ? ` "${templatesSlug}" holds templates (layouts for every document of a collection).` : ''));
266
+ // With one builder collection the argument may be left out. The default fills it in before the
267
+ // toolkit's scope check reads it.
268
+ const collectionArg = slugs.length === 1 ? collectionEnum.default(slugs[0]) : collectionEnum;
269
+ /**
270
+ * True when the collection's layouts render without a current document (normal pages): there,
271
+ * bindings and visibility outside list and repeat items do nothing. Templates and saved sections
272
+ * (which may go into templates) are left out.
273
+ */
274
+ const rendersWithoutDocument = (req, collection) => collection !== templatesSlug && collection !== savedSectionsConfigOf(req.payload)?.slug;
227
275
  const idArg = z.string().min(1).describe('Document id (from findDocument or searchContent).');
228
276
  const localeArg = z
229
277
  .string()
@@ -286,6 +334,7 @@ export function builderMcpTools(options) {
286
334
  ops,
287
335
  blocks,
288
336
  localization: localizationOf(req, collection),
337
+ contentOnly: !(await canEditDesign(req)),
289
338
  // As for people's edits, inside the commit: the user may still read the draft; field access
290
339
  // of block props; a Payload blocks field: and no value the user may not read, in any state.
291
340
  access: withLiveReadCheck(req, target, withBlocksReadCheck(req, target, propAccessCheck(req, {
@@ -299,6 +348,24 @@ export function builderMcpTools(options) {
299
348
  });
300
349
  return result;
301
350
  };
351
+ /**
352
+ * The warnings of a commit for the blocks it touched (publish-only problems, unknown keys, and
353
+ * bindings or visibility that do nothing on a normal page), plus how many other blocks have
354
+ * warnings. Required props that a binding fills are left out, as in validateLayout.
355
+ */
356
+ const touchedWarnings = (req, collection, result) => {
357
+ const touched = touchedIds(result.ops);
358
+ const all = [
359
+ ...withoutBoundRequired(result.warnings, result.layout),
360
+ ...(rendersWithoutDocument(req, collection) ? contextOnlyWarnings(result.layout) : []),
361
+ ];
362
+ const own = all.filter((warning) => warning.blockId !== undefined && touched.has(warning.blockId));
363
+ const elsewhere = all.length - own.length;
364
+ return {
365
+ ...(own.length > 0 ? { warnings: own.slice(0, 30) } : {}),
366
+ ...(elsewhere > 0 ? { otherWarnings: `${elsewhere} warning${elsewhere === 1 ? '' : 's'} on blocks this call did not change (validateLayout lists them).` } : {}),
367
+ };
368
+ };
302
369
  /** The app's sections, then the saved sections the request's user can read (when turned on). */
303
370
  const allSections = async (req) => {
304
371
  const saved = savedSectionsConfigOf(req.payload);
@@ -337,15 +404,16 @@ export function builderMcpTools(options) {
337
404
  name: 'listBlocks',
338
405
  routing: { kind: 'collection', action: 'read' },
339
406
  description: [
340
- 'Lists every block type you can use in page layouts: label, description, props, slots (which child types they accept) and an example. Call this before you build or edit a layout.',
341
- 'To build whole page parts (hero, features, pricing, call to action, footer), PREFER ready-made sections: listSections, then insertSection. They are designed and tested. Use single blocks for small additions and edits.',
342
- `Dynamic blocks: "${FIELD_BLOCK}" shows one field of the current document (templates), "${COLLECTION_LIST_BLOCK}" lists documents of a collection and repeats its "item" slot per document, "${REPEAT_BLOCK}" repeats its "item" slot per row of an array or hasMany field of the current document. Blocks inside a template or a list item can bind props to document fields with "bindings" (see getBindingSources).`,
343
- LAYOUT_GUIDE,
407
+ 'Lists every block type you can use in page layouts: label, description, props, slots (which child types they accept), parts and an example, plus the site\'s own classes and design variables (named colors, sizes and fonts). Call it once before you build or edit a layout: its `guide` is the layout format (block keys, ids, positions, classes, motion presets, HTML attrs, canonical form) and `bindings` the binding and VISIBILITY format.',
408
+ 'For whole page parts (hero, features, pricing, call to action, footer), PREFER ready-made sections: listSections, then insertSection. Use single blocks for small additions and edits.',
409
+ `Dynamic blocks: "${FIELD_BLOCK}" shows one field of the current document (templates), "${COLLECTION_LIST_BLOCK}" lists documents of a collection and repeats its "item" slot per document, "${REPEAT_BLOCK}" repeats its "item" slot per row of an array or hasMany field of the current document.`,
344
410
  ].join('\n\n'),
345
411
  parameters: { collection: collectionArg },
346
412
  handler: async (_args, req) => text({
413
+ guide: LAYOUT_GUIDE,
347
414
  blocks: blocks.map(describeBlock),
348
415
  ...(await siteClassesOf(req)),
416
+ ...(await variablesOf(req)),
349
417
  sections: sections.length,
350
418
  bindings: BINDINGS_GUIDE,
351
419
  ...(templatesSlug ? { templates: { collection: templatesSlug, targets: templateTargets } } : {}),
@@ -370,8 +438,9 @@ export function builderMcpTools(options) {
370
438
  routing: { kind: 'collection', action: 'read' },
371
439
  description: [
372
440
  'Lists ready-made sections (heroes, features, testimonials, calls to action, contact, footers, …) with an outline of their blocks. Sections are the best way to build a page: insert them with insertSection, then change their text, images and classes with applyOperations "update". Set `full: true` to get the complete block JSON of each section.',
373
- 'A section can come in variants (other versions of the same section): they follow it in the list with an id like "hero/split" and `variantOf: "hero"`. Pick the version that fits the page.',
441
+ 'A section can come in variants (other versions of the same section, e.g. a split hero): they are listed under it in `variants`. Pick the version that fits the page and pass its id as `variant` to insertSection.',
374
442
  'The list also has the sections people saved on this site. They have `saved: true` and an id like "saved:12".',
443
+ 'A saved section with `component: true` is a component: insertSection puts in a copy that stays in sync with it, and each copy sets its own `values` for the listed `properties` (text, richText as plain text, image as an upload id, link as a URL or { type, url }, visible as true/false). A property left out shows its `default`.',
375
444
  ].join('\n'),
376
445
  parameters: {
377
446
  collection: collectionArg,
@@ -387,10 +456,11 @@ export function builderMcpTools(options) {
387
456
  id: s.id,
388
457
  label: s.label,
389
458
  ...(s.savedId !== undefined ? { saved: true } : {}),
390
- ...(s.variantOf ? { variantOf: s.variantOf } : {}),
391
459
  ...(s.category ? { category: s.category } : {}),
392
460
  ...(s.description ? { description: s.description } : {}),
393
461
  ...(args.full ? { blocks: s.blocks } : { outline: outline(s.blocks).join('\n') }),
462
+ ...variantsListing(s, args.full === true),
463
+ ...componentListing(s, blocks),
394
464
  })),
395
465
  });
396
466
  },
@@ -401,7 +471,8 @@ export function builderMcpTools(options) {
401
471
  description: [
402
472
  'Inserts a ready-made or saved section (from listSections) into the draft of a document. All block ids are regenerated. Saves a draft about a second later (never publishes). People with the page open in the editor see the section appear live.',
403
473
  'Default position: the end of the page. Set parentId/slot/index to insert elsewhere (index = final index in the target list).',
404
- 'Returns the inserted blocks with their NEW ids. Then adjust their text and classes with applyOperations "update".',
474
+ 'Returns the inserted blocks with their NEW ids, and `needsContent`: blocks whose image, form or other upload or relationship is still empty (fill them with generateImage, an existing upload, or findDocument). Then adjust text and classes with applyOperations "update".',
475
+ 'Components (`component: true` in listSections) go in as one copy that stays in sync: pass `values` ({ <property name>: value }) for its properties. To change a copy later, "update" its props.values. linked: false inserts plain blocks the page can change freely (values still fill them).',
405
476
  ].join('\n'),
406
477
  parameters: {
407
478
  collection: collectionArg,
@@ -409,18 +480,32 @@ export function builderMcpTools(options) {
409
480
  sectionId: z
410
481
  .string()
411
482
  .min(1)
412
- .describe('The section from listSections: its id (e.g. "hero", the variant "hero/split" or "saved:12") or its exact name.'),
483
+ .describe('The section from listSections: its id (e.g. "hero" or "saved:12") or its exact name.'),
484
+ variant: z.string().optional().describe('A variant id from the section\'s `variants` in listSections, e.g. "split". Leave it out for the section itself.'),
413
485
  parentId: z.string().nullable().optional().describe('Parent block id. Default null (page root).'),
414
486
  slot: z.string().optional().describe('Slot of the parent. Default "children".'),
415
487
  index: z.number().int().min(0).optional().describe('Final index in the target list. Default: append.'),
488
+ values: z
489
+ .record(z.string(), z.unknown())
490
+ .optional()
491
+ .describe('Components only: values for its properties, by property name (see `properties` in listSections).'),
492
+ linked: z
493
+ .boolean()
494
+ .optional()
495
+ .describe('Saved sections only. true: a copy that stays in sync with the saved section (default for components). false: plain blocks.'),
416
496
  },
417
497
  handler: async (args, req) => {
418
498
  const all = await allSections(req);
419
- const section = findSection(all, String(args.sectionId));
420
- if (!section) {
499
+ const found = findSectionVersion(all, String(args.sectionId), typeof args.variant === 'string' ? args.variant : undefined);
500
+ if (typeof found === 'string')
501
+ return fail(found);
502
+ if (!found) {
421
503
  const known = all.map((s) => (s.savedId !== undefined ? `${s.id} ("${s.label}")` : s.id));
422
504
  return fail(`Unknown section "${String(args.sectionId)}". Known sections: ${known.join(', ') || 'none'}.`);
423
505
  }
506
+ const section = sectionToInsert(found, blocks, { values: args.values, linked: typeof args.linked === 'boolean' ? args.linked : null });
507
+ if (typeof section === 'string')
508
+ return fail(section);
424
509
  const collection = String(args.collection);
425
510
  const result = await apply(req, collection, String(args.id), (layout) => sectionInsertOps(layout, section, {
426
511
  parentId: args.parentId,
@@ -430,13 +515,20 @@ export function builderMcpTools(options) {
430
515
  if (!result.ok)
431
516
  return fail(result.error, result.errors);
432
517
  const inserted = result.ops.flatMap((op) => (op.type === 'insert' ? [op.block] : []));
518
+ const needsContent = missingContent(inserted, blocks);
519
+ const warnings = touchedWarnings(req, collection, result);
433
520
  return text({
434
521
  ok: true,
435
522
  section: section.id,
523
+ ...(section.blocks[0]?.type === SECTION_REF_BLOCK ? { linked: true } : {}),
524
+ ...(section.blocks[0]?.section?.variant ? { variant: section.blocks[0].section.variant } : {}),
436
525
  seq: result.seq,
437
526
  inserted,
438
527
  insertedIds: inserted.flatMap((b) => subtreeIds(b)),
439
- ...(result.warnings.length > 0 ? { warnings: result.warnings } : {}),
528
+ ...(needsContent.length > 0
529
+ ? { needsContent, needsContentHint: missingContentHint(needsContent, { generateImage: Boolean(imageServiceOf(req.payload)?.adapter) }) }
530
+ : {}),
531
+ ...warnings,
440
532
  });
441
533
  },
442
534
  };
@@ -503,13 +595,12 @@ export function builderMcpTools(options) {
503
595
  name: 'applyOperations',
504
596
  routing: { kind: 'collection', action: 'update' },
505
597
  description: [
506
- 'Edits the layout of a document with a list of operations, applied in order, all or nothing. Saves a draft about a second later (never publishes). People with the page open in the editor see each change live.',
507
- 'Operations: insert { block, to }, move { id, to }, remove { id }, duplicate { id, newId? }, update { id, props?, unsetProps?, className?, hidden?, bindings?, label?, motion?, attrs?, slotClassName? }. "update" merges props and bindings; className REPLACES all classes, so send the full list. `motion` (animations, see MOTION below) merges per kind: a kind replaces that kind, null removes it, null alone removes all. `attrs` (HTML id, ariaLabel, ariaHidden) merges per key; null removes a key. `slotClassName` merges per slot; null removes the classes of a slot.',
508
- 'Templates are edited the same way: collection = the templates collection, id = the template id from listTemplates.',
509
- 'If any operation fails, nothing is saved and the error names the failing operation. Call getLayout for current ids first. The result is validated against the block schemas: missing required props are allowed in drafts (warnings), wrong types are errors. insert and move refuse a block that a slot does not accept, also deeper inside (for example no button or form anywhere inside a link). insert, move and duplicate refuse to add a block to a slot that already holds its maxBlocks (listBlocks).',
510
- 'Localized sites: with `locale`, "update" props change that locale\'s values of localized props (a translation); other props and everything else (insert, move, remove, classes) change every locale. Blocks you insert with `locale` hold their localized props in that locale only: the default locale stays empty until someone writes it (required props then block publishing). Without `locale` they hold the default locale\'s values. Sections (insertSection) keep their own text.',
598
+ 'Edits the draft layout of a document (a page, or a template: collection = the templates collection, id from listTemplates) with operations, applied in order, all or nothing. Saves a draft about a second later (never publishes). People with the page open see each change live.',
599
+ 'Operations: insert { block, to }, move { id, to }, remove { id }, duplicate { id, newId? }, update { id, props?, unsetProps?, className?, addClassName?, removeClassName?, hidden?, label?, bindings?, visibility?, motion?, attrs?, partClassName? }. update merges props and bindings (null removes a binding); className REPLACES all classes, while addClassName and removeClassName (space-separated) change single classes and keep the rest; visibility replaces all conditions; motion merges per kind, attrs per key, partClassName per part; null removes.',
600
+ 'Position { parentId (null = page root), slot? (default "children"), index }: index is the FINAL index in the target list (for a move in the same list, count after the block leaves). New ids: "b_" plus 6 lowercase letters or digits. Get current ids with getLayout. The block format, motion presets and visibility are in the listBlocks `guide`.',
601
+ 'Errors name the failing operation, and nothing is saved: wrong prop types, a block type a slot (or a slot further up) does not accept, a full slot (maxBlocks). The result lists `changes` (id, type, changed keys, the new className) and `warnings` for the blocks it touched: allowed in drafts but they block publishing (for example an empty required prop); "no-effect" warnings mark keys that do nothing there.',
602
+ 'Localized sites: with `locale`, update props write that locale\'s values of localized props; everything else changes every locale. Blocks inserted with `locale` hold their localized props in that locale only (the default locale stays empty until written). Without `locale`: the default locale.',
511
603
  NO_DIRECT_EDIT,
512
- LAYOUT_GUIDE,
513
604
  ].join('\n\n'),
514
605
  parameters: {
515
606
  collection: collectionArg,
@@ -527,29 +618,27 @@ export function builderMcpTools(options) {
527
618
  const ops = args.operations.map((op) => op.type === 'duplicate' && !op.newId ? { ...op, newId: createId() } : op);
528
619
  // New blocks are written in the locale too: an AI that works in German writes German.
529
620
  // A root parentId models send as text ("__PAGE_ROOT__", "root") becomes null, as in insertSection.
530
- const result = await apply(req, collection, String(args.id), (layout) => stampLocale(repairRootParents(layout, ops).ops, at.locale, at.settings, { inserts: true }));
621
+ let before = { version: 1, blocks: [] };
622
+ const result = await apply(req, collection, String(args.id), (layout) => {
623
+ before = layout;
624
+ return stampLocale(repairRootParents(layout, ops).ops, at.locale, at.settings, { inserts: true });
625
+ });
531
626
  if (!result.ok)
532
627
  return fail(result.error, result.errors);
533
- const changed = new Set();
534
- for (const op of result.ops) {
535
- if (op.type === 'insert')
536
- subtreeIds(op.block).forEach((id) => changed.add(id));
537
- else if (op.type === 'move' || op.type === 'update')
538
- changed.add(op.id);
539
- }
540
628
  return text({
541
629
  ok: true,
542
630
  seq: result.seq,
543
631
  applied: result.ops.length,
544
- changedIds: [...changed],
545
- ...(result.warnings.length > 0 ? { warnings: result.warnings } : {}),
632
+ changedIds: [...touchedIds(result.ops)],
633
+ changes: changeSummary(before, result.layout, result.ops),
634
+ ...touchedWarnings(req, collection, result),
546
635
  });
547
636
  },
548
637
  };
549
638
  const validateLayoutTool = {
550
639
  name: 'validateLayout',
551
640
  routing: { kind: 'collection', action: 'read' },
552
- description: 'Checks a layout against the block schemas without saving. Pass `layout` (the JSON object) to check a layout you wrote, or only `id` to check the document\'s current draft. Returns `errors` (block a save) and `warnings` (allowed in drafts, but they block publishing: missing required props, values outside their limits, slots with fewer blocks than their minBlocks, messages from the validate functions of props; unknown props never block).',
641
+ description: 'Checks a layout against the block schemas without saving. Pass `layout` (the JSON object) to check a layout you wrote, or only `id` to check the document\'s current draft. Returns `errors` (block a save) and `warnings` (allowed in drafts, but they block publishing: missing required props, values outside their limits, slots with fewer blocks than their minBlocks, messages from the validate functions of props; unknown props and "no-effect" keys, such as visibility on a normal page, never block).',
553
642
  parameters: {
554
643
  collection: collectionArg,
555
644
  id: idArg.optional(),
@@ -606,6 +695,8 @@ export function builderMcpTools(options) {
606
695
  localization,
607
696
  })));
608
697
  }
698
+ if (blocking.length === 0 && rendersWithoutDocument(req, String(args.collection)))
699
+ warnings.push(...contextOnlyWarnings(normalizeLayout(layout)));
609
700
  return text({ valid: blocking.length === 0, errors: blocking, warnings });
610
701
  },
611
702
  };
@@ -650,7 +741,7 @@ export function builderMcpTools(options) {
650
741
  'Returns the media `id`, `url`, size and alt text. To show it on a page, set the id as the image prop of a block with applyOperations "update" (getBlockSchema shows the prop name; the default image block uses "image").',
651
742
  ].join('\n\n'),
652
743
  parameters: {
653
- collection: z.enum([mediaCollection]).describe(`The upload collection. Always "${mediaCollection}".`),
744
+ collection: z.enum([mediaCollection]).default(mediaCollection).describe(`The upload collection. Always "${mediaCollection}" (may be left out).`),
654
745
  prompt: z.string().min(3).max(4000).describe('What the image shows, in detail.'),
655
746
  aspectRatio: z
656
747
  .enum(IMAGE_ASPECT_RATIOS)
@@ -682,18 +773,20 @@ export function builderMcpTools(options) {
682
773
  });
683
774
  },
684
775
  };
685
- const tools = [listBlocks, getBlockSchema, listSections, insertSection, getLayout, applyOperationsTool, validateLayoutTool, getPreviewUrl, generateImage];
776
+ // Editable classes: listClasses, getClass, upsertClass, deleteClass.
777
+ const classTools = options.classes === false ? [] : classMcpTools(options.classes);
778
+ const tools = [listBlocks, getBlockSchema, listSections, insertSection, getLayout, applyOperationsTool, validateLayoutTool, getPreviewUrl, generateImage, ...classTools];
686
779
  if (!templatesSlug)
687
780
  return tools;
688
781
  const listTemplates = {
689
782
  name: 'listTemplates',
690
783
  routing: { kind: 'collection', action: 'read' },
691
784
  description: [
692
- `Lists the templates: layouts that render every document of a collection (${templateTargets.join(', ')}). A document uses its own template (its "template" field), else the first published template (by name) whose "${TEMPLATE_CONDITIONS_FIELD}" (a Payload where query against the document, e.g. { "tier": { "equals": "vip" } }) match it, else its collection's default template.`,
693
- `To edit a template, call getLayout and applyOperations with collection "${templatesSlug}" and the template id. Bind props to the document's fields with "bindings" (getBindingSources lists the fields). To create a template, use createDocument on "${templatesSlug}" with { name, ${TEMPLATE_TARGET_FIELD}, ${TEMPLATE_DEFAULT_FIELD} } and optional ${TEMPLATE_CONDITIONS_FIELD}.`,
785
+ `Lists the templates: layouts that render every document of a collection (${templateTargets.join(', ')}). A document uses its own template (its "template" field), else the published template with the highest "${TEMPLATE_PRIORITY_FIELD}" whose "${TEMPLATE_CONDITIONS_FIELD}" (a Payload where query against the document, e.g. { "featured": { "equals": true } }) match it (equal priority: the older template), else its collection's default template.`,
786
+ `To edit a template, call getLayout and applyOperations with collection "${templatesSlug}" and the template id. Bind props to the document's fields with "bindings" (getBindingSources lists the fields). To create a template, use createDocument on "${templatesSlug}" with { name, ${TEMPLATE_TARGET_FIELD}, ${TEMPLATE_DEFAULT_FIELD} } and optional ${TEMPLATE_CONDITIONS_FIELD} and ${TEMPLATE_PRIORITY_FIELD}.`,
694
787
  ].join('\n'),
695
788
  parameters: {
696
- collection: z.enum([templatesSlug]).describe(`Always "${templatesSlug}".`),
789
+ collection: z.enum([templatesSlug]).default(templatesSlug).describe(`Always "${templatesSlug}" (may be left out).`),
697
790
  target: z.enum(templateTargets).optional().describe('Only templates for this collection.'),
698
791
  },
699
792
  handler: async (args, req) => {
@@ -717,6 +810,7 @@ export function builderMcpTools(options) {
717
810
  target: doc[TEMPLATE_TARGET_FIELD],
718
811
  isDefault: doc[TEMPLATE_DEFAULT_FIELD] === true,
719
812
  ...(templateConditions(doc) ? { conditions: templateConditions(doc) } : {}),
813
+ ...(typeof doc[TEMPLATE_PRIORITY_FIELD] === 'number' && doc[TEMPLATE_PRIORITY_FIELD] !== 0 ? { priority: doc[TEMPLATE_PRIORITY_FIELD] } : {}),
720
814
  ...(doc[TEMPLATE_PREVIEW_FIELD] ? { previewDocument: doc[TEMPLATE_PREVIEW_FIELD] } : {}),
721
815
  ...(doc._status ? { status: doc._status } : {}),
722
816
  blocks: normalizeLayout(doc[TEMPLATE_LAYOUT_FIELD]).blocks.length,
@@ -736,18 +830,16 @@ export function builderMcpTools(options) {
736
830
  routing: { kind: 'collection', action: 'read' },
737
831
  description: [
738
832
  'Lists the fields of a collection that block props can bind to, as dot paths (e.g. "title", "featuredImage", "author.name", "categories.title"). Relationship and upload fields include the related document\'s fields (one level).',
739
- BINDINGS_GUIDE,
833
+ 'The result\'s `guide` explains bindings (paths, $url, $item, $index, $parent, $page, fallbacks, formatters, template strings) and VISIBILITY conditions. Both work only in templates and inside collection list or repeat items.',
740
834
  ].join('\n'),
741
835
  parameters: {
742
- collection: z
743
- .enum(sourceSlugs)
744
- .describe(`A template target or a collection a list can show. One of: ${sourceSlugs.join(', ')}.`),
836
+ collection: ((arg) => (sourceSlugs.length === 1 ? arg.default(sourceSlugs[0]) : arg))(z.enum(sourceSlugs).describe(`A template target or a collection a list can show. One of: ${sourceSlugs.join(', ')}.`)),
745
837
  },
746
838
  handler: async (args, req) => {
747
839
  const sources = templatesConfigOf(req.payload)?.sources[String(args.collection)];
748
840
  if (!sources)
749
841
  return fail(`No bindable fields for "${String(args.collection)}". Is websiteBuilder configured with templates?`);
750
- return text({ collection: args.collection, fields: sources });
842
+ return text({ collection: args.collection, fields: sources, guide: BINDINGS_GUIDE });
751
843
  },
752
844
  };
753
845
  return [...tools, listTemplates, getBindingSources];
@@ -1,4 +1,5 @@
1
1
  import type { Block, BlockDefinition, Layout, Operation, SectionDefinition } from '../core/types.js';
2
+ import type { LayoutError } from '../core/validate.js';
2
3
  /**
3
4
  * How block animations ("motion") are written, for AI models. The preset lists come from
4
5
  * MOTION_PRESET_INFO, so they cannot drift from the editor and the checks.
@@ -53,7 +54,6 @@ export declare function describeBlock(def: BlockDefinition): {
53
54
  hasMany?: boolean | undefined;
54
55
  options?: string[] | undefined;
55
56
  relationTo?: string | string[] | undefined;
56
- holds?: string | undefined;
57
57
  }[];
58
58
  slots: {
59
59
  [k: string]: {
@@ -61,12 +61,16 @@ export declare function describeBlock(def: BlockDefinition): {
61
61
  accepts: string | string[];
62
62
  minBlocks?: number | undefined;
63
63
  maxBlocks?: number | undefined;
64
- classes?: string | undefined;
65
64
  };
66
65
  };
67
66
  onlyInside?: string[] | undefined;
68
67
  className?: string | undefined;
69
68
  defaultClassName?: string | undefined;
69
+ parts?: {
70
+ name: string;
71
+ label: string;
72
+ defaultClassName?: string | undefined;
73
+ }[] | undefined;
70
74
  example?: Omit<Partial<Block>, "id"> | undefined;
71
75
  } | {
72
76
  type: string;
@@ -80,13 +84,99 @@ export declare function describeBlock(def: BlockDefinition): {
80
84
  hasMany?: boolean | undefined;
81
85
  options?: string[] | undefined;
82
86
  relationTo?: string | string[] | undefined;
83
- holds?: string | undefined;
84
87
  }[];
85
88
  slots: string;
86
89
  onlyInside?: string[] | undefined;
87
90
  className?: string | undefined;
88
91
  defaultClassName?: string | undefined;
92
+ parts?: {
93
+ name: string;
94
+ label: string;
95
+ defaultClassName?: string | undefined;
96
+ }[] | undefined;
89
97
  example?: Omit<Partial<Block>, "id"> | undefined;
90
98
  };
99
+ /**
100
+ * `variants` of a `listSections` entry (MCP and the assistant): each variant's id, label,
101
+ * description and outline (`full`: its block JSON). Empty when the section has none.
102
+ */
103
+ export declare function variantsListing(section: SectionDefinition, full: boolean): {
104
+ variants?: Record<string, unknown>[];
105
+ };
91
106
  /** One line per block (indented by depth), with the start of its text, for a short section summary. */
92
107
  export declare function outline(blocks: Block[], depth?: number): string[];
108
+ /** One operation of a batch, for tool results. */
109
+ export type ChangeSummary = {
110
+ op: Operation['type'];
111
+ id: string;
112
+ type: string;
113
+ /** insert and move: where the block went. */
114
+ to?: {
115
+ parentId: string | null;
116
+ slot?: string;
117
+ index: number;
118
+ };
119
+ /** insert: how many blocks the inserted subtree holds, when more than one. */
120
+ blocks?: number;
121
+ /** update: what changed ("props.text", "className", "visibility", ...). */
122
+ changed?: string[];
123
+ /** update with class changes: the block's class list after the batch ("" when it has none). */
124
+ className?: string;
125
+ };
126
+ /**
127
+ * A short list of what an operation batch did, one entry per operation: ids, block types, and for
128
+ * updates the keys they changed. `before` and `after` are the layouts around the batch, `ops` the
129
+ * applied operations (duplicates as inserts).
130
+ */
131
+ export declare function changeSummary(before: Layout, after: Layout, ops: readonly Operation[]): ChangeSummary[];
132
+ /** The block ids an operation batch touched: inserted blocks with their children, moved and updated blocks. */
133
+ export declare function touchedIds(ops: readonly Operation[]): Set<string>;
134
+ /** A block prop that is still empty and needs an upload or a document. */
135
+ export type MissingContent = {
136
+ id: string;
137
+ type: string;
138
+ prop: string;
139
+ field: 'upload' | 'relationship';
140
+ relationTo: string | string[];
141
+ };
142
+ /**
143
+ * Blocks in `list` (children included) whose main upload or relationship prop is empty: an image
144
+ * block without an image, a form block without a form. Per block type that is the first upload or
145
+ * relationship field and every required one. Props hidden by their field's condition, bound props
146
+ * and hasMany fields are left out.
147
+ */
148
+ export declare function missingContent(list: readonly Block[], definitions: readonly BlockDefinition[]): MissingContent[];
149
+ /** What to do about `missingContent`, for tool results. `generateImage`: the tool that makes images is there. */
150
+ export declare function missingContentHint(missing: readonly MissingContent[], options: {
151
+ generateImage: boolean;
152
+ }): string;
153
+ /**
154
+ * Warnings for `visibility` and `bindings` that do nothing: on a normal page nothing checks them
155
+ * (there is no current document), so the block always shows and bound props keep their own value.
156
+ * They work in templates and inside the "item" slot of a collection list or repeat. `only`: report
157
+ * these block ids only.
158
+ */
159
+ export declare function contextOnlyWarnings(layout: Layout, only?: ReadonlySet<string>): LayoutError[];
160
+ export declare const CONTEXT_ONLY_VISIBILITY = "visibility does nothing here: it only applies in templates and in collection list or repeat items. On a normal page the block always shows. Remove it, or set \"hidden\": true to hide the block.";
161
+ export declare const CONTEXT_ONLY_BINDINGS = "bindings do nothing here: they only apply in templates and in collection list or repeat items. On a normal page the props keep their own values. Write the values into props instead.";
162
+ /**
163
+ * `listSections` fields of a component (a saved section with properties): `component: true` and
164
+ * its properties with their type and default. Nothing for other sections.
165
+ */
166
+ export declare function componentListing(section: SectionDefinition, blocks: readonly BlockDefinition[]): {
167
+ component?: true;
168
+ properties?: Array<{
169
+ name: string;
170
+ type: string;
171
+ default?: unknown;
172
+ }>;
173
+ };
174
+ /**
175
+ * The section `insertSection` puts in. A component (or `linked: true`) goes in as one copy that
176
+ * stays in sync (a `sectionRef` block) with `values`; else the section's blocks go in as plain
177
+ * blocks, with `values` put into them. Returns the problem as text.
178
+ */
179
+ export declare function sectionToInsert(section: SectionDefinition, blocks: readonly BlockDefinition[], options: {
180
+ values?: unknown;
181
+ linked?: boolean | null;
182
+ }): SectionDefinition | string;