@delmaredigital/payload-puck 0.4.0 → 0.6.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 (427) hide show
  1. package/README.md +331 -16
  2. package/dist/admin/PuckEditorView.d.ts +1 -1
  3. package/dist/admin/PuckEditorView.d.ts.map +1 -1
  4. package/dist/ai/collections/AiContext.d.ts +16 -0
  5. package/dist/ai/collections/AiContext.d.ts.map +1 -0
  6. package/dist/ai/collections/AiContext.js +87 -0
  7. package/dist/ai/collections/AiContext.js.map +1 -0
  8. package/dist/ai/collections/AiPrompts.d.ts +10 -0
  9. package/dist/ai/collections/AiPrompts.d.ts.map +1 -0
  10. package/dist/ai/collections/AiPrompts.js +63 -0
  11. package/dist/ai/collections/AiPrompts.js.map +1 -0
  12. package/dist/ai/createAiApiRoutes.d.ts +40 -0
  13. package/dist/ai/createAiApiRoutes.d.ts.map +1 -0
  14. package/dist/ai/createAiApiRoutes.js +106 -0
  15. package/dist/ai/createAiApiRoutes.js.map +1 -0
  16. package/dist/ai/createAiGenerate.d.ts +65 -0
  17. package/dist/ai/createAiGenerate.d.ts.map +1 -0
  18. package/dist/ai/createAiGenerate.js +106 -0
  19. package/dist/ai/createAiGenerate.js.map +1 -0
  20. package/dist/ai/createAiPlugin.d.ts +39 -0
  21. package/dist/ai/createAiPlugin.d.ts.map +1 -0
  22. package/dist/ai/createAiPlugin.js +61 -0
  23. package/dist/ai/createAiPlugin.js.map +1 -0
  24. package/dist/ai/hooks/useAiContext.d.ts +63 -0
  25. package/dist/ai/hooks/useAiContext.d.ts.map +1 -0
  26. package/dist/ai/hooks/useAiContext.js +146 -0
  27. package/dist/ai/hooks/useAiContext.js.map +1 -0
  28. package/dist/ai/hooks/useAiPrompts.d.ts +25 -0
  29. package/dist/ai/hooks/useAiPrompts.d.ts.map +1 -0
  30. package/dist/ai/hooks/useAiPrompts.js +74 -0
  31. package/dist/ai/hooks/useAiPrompts.js.map +1 -0
  32. package/dist/ai/index.d.ts +51 -0
  33. package/dist/ai/index.d.ts.map +1 -0
  34. package/dist/ai/index.js +69 -0
  35. package/dist/ai/index.js.map +1 -0
  36. package/dist/ai/plugins/ContextEditorPanel.d.ts +9 -0
  37. package/dist/ai/plugins/ContextEditorPanel.d.ts.map +1 -0
  38. package/dist/ai/plugins/ContextEditorPanel.js +399 -0
  39. package/dist/ai/plugins/ContextEditorPanel.js.map +1 -0
  40. package/dist/ai/plugins/PromptEditorPanel.d.ts +9 -0
  41. package/dist/ai/plugins/PromptEditorPanel.d.ts.map +1 -0
  42. package/dist/ai/plugins/PromptEditorPanel.js +270 -0
  43. package/dist/ai/plugins/PromptEditorPanel.js.map +1 -0
  44. package/dist/ai/plugins/contextEditorPlugin.d.ts +30 -0
  45. package/dist/ai/plugins/contextEditorPlugin.d.ts.map +1 -0
  46. package/dist/ai/plugins/contextEditorPlugin.js +40 -0
  47. package/dist/ai/plugins/contextEditorPlugin.js.map +1 -0
  48. package/dist/ai/plugins/promptApiRoutes.d.ts +68 -0
  49. package/dist/ai/plugins/promptApiRoutes.d.ts.map +1 -0
  50. package/dist/ai/plugins/promptApiRoutes.js +181 -0
  51. package/dist/ai/plugins/promptApiRoutes.js.map +1 -0
  52. package/dist/ai/plugins/promptEditorPlugin.d.ts +29 -0
  53. package/dist/ai/plugins/promptEditorPlugin.d.ts.map +1 -0
  54. package/dist/ai/plugins/promptEditorPlugin.js +39 -0
  55. package/dist/ai/plugins/promptEditorPlugin.js.map +1 -0
  56. package/dist/ai/presets/componentAiDefaults.d.ts +40 -0
  57. package/dist/ai/presets/componentAiDefaults.d.ts.map +1 -0
  58. package/dist/ai/presets/componentAiDefaults.js +239 -0
  59. package/dist/ai/presets/componentAiDefaults.js.map +1 -0
  60. package/dist/ai/presets/index.d.ts +94 -0
  61. package/dist/ai/presets/index.d.ts.map +1 -0
  62. package/dist/ai/presets/index.js +110 -0
  63. package/dist/ai/presets/index.js.map +1 -0
  64. package/dist/ai/presets/instructions/interactive.d.ts +15 -0
  65. package/dist/ai/presets/instructions/interactive.d.ts.map +1 -0
  66. package/dist/ai/presets/instructions/interactive.js +334 -0
  67. package/dist/ai/presets/instructions/interactive.js.map +1 -0
  68. package/dist/ai/presets/instructions/layout.d.ts +16 -0
  69. package/dist/ai/presets/instructions/layout.d.ts.map +1 -0
  70. package/dist/ai/presets/instructions/layout.js +486 -0
  71. package/dist/ai/presets/instructions/layout.js.map +1 -0
  72. package/dist/ai/presets/instructions/media.d.ts +15 -0
  73. package/dist/ai/presets/instructions/media.d.ts.map +1 -0
  74. package/dist/ai/presets/instructions/media.js +136 -0
  75. package/dist/ai/presets/instructions/media.js.map +1 -0
  76. package/dist/ai/presets/instructions/pagePatterns.d.ts +20 -0
  77. package/dist/ai/presets/instructions/pagePatterns.d.ts.map +1 -0
  78. package/dist/ai/presets/instructions/pagePatterns.js +290 -0
  79. package/dist/ai/presets/instructions/pagePatterns.js.map +1 -0
  80. package/dist/ai/presets/instructions/schemas.d.ts +1247 -0
  81. package/dist/ai/presets/instructions/schemas.d.ts.map +1 -0
  82. package/dist/ai/presets/instructions/schemas.js +240 -0
  83. package/dist/ai/presets/instructions/schemas.js.map +1 -0
  84. package/dist/ai/presets/instructions/typography.d.ts +16 -0
  85. package/dist/ai/presets/instructions/typography.d.ts.map +1 -0
  86. package/dist/ai/presets/instructions/typography.js +192 -0
  87. package/dist/ai/presets/instructions/typography.js.map +1 -0
  88. package/dist/ai/tools/index.d.ts +116 -0
  89. package/dist/ai/tools/index.d.ts.map +1 -0
  90. package/dist/ai/tools/index.js +214 -0
  91. package/dist/ai/tools/index.js.map +1 -0
  92. package/dist/ai/types.d.ts +507 -0
  93. package/dist/ai/types.d.ts.map +1 -0
  94. package/dist/ai/types.js +2 -0
  95. package/dist/ai/types.js.map +1 -0
  96. package/dist/ai/utils/injectAiConfig.d.ts +67 -0
  97. package/dist/ai/utils/injectAiConfig.d.ts.map +1 -0
  98. package/dist/ai/utils/injectAiConfig.js +216 -0
  99. package/dist/ai/utils/injectAiConfig.js.map +1 -0
  100. package/dist/api/createPuckApiRoutesWithId.d.ts.map +1 -1
  101. package/dist/api/createPuckApiRoutesWithId.js +12 -5
  102. package/dist/api/createPuckApiRoutesWithId.js.map +1 -1
  103. package/dist/api/types.d.ts +1 -1
  104. package/dist/api/types.d.ts.map +1 -1
  105. package/dist/components/exports.d.ts +1 -1
  106. package/dist/components/exports.d.ts.map +1 -1
  107. package/dist/components/exports.js +1 -1
  108. package/dist/components/exports.js.map +1 -1
  109. package/dist/components/interactive/Accordion.d.ts +1 -1
  110. package/dist/components/interactive/Accordion.d.ts.map +1 -1
  111. package/dist/components/interactive/Accordion.js +4 -4
  112. package/dist/components/interactive/Accordion.js.map +1 -1
  113. package/dist/components/interactive/Accordion.server.d.ts +1 -1
  114. package/dist/components/interactive/Accordion.server.d.ts.map +1 -1
  115. package/dist/components/interactive/Button.d.ts +1 -1
  116. package/dist/components/interactive/Button.d.ts.map +1 -1
  117. package/dist/components/interactive/Button.server.d.ts +2 -3
  118. package/dist/components/interactive/Button.server.d.ts.map +1 -1
  119. package/dist/components/interactive/Button.server.js +1 -2
  120. package/dist/components/interactive/Button.server.js.map +1 -1
  121. package/dist/components/interactive/Card.d.ts +1 -1
  122. package/dist/components/interactive/Card.d.ts.map +1 -1
  123. package/dist/components/interactive/Card.server.d.ts +1 -1
  124. package/dist/components/interactive/Card.server.d.ts.map +1 -1
  125. package/dist/components/interactive/Divider.d.ts +1 -1
  126. package/dist/components/interactive/Divider.d.ts.map +1 -1
  127. package/dist/components/interactive/Divider.server.d.ts +1 -1
  128. package/dist/components/interactive/Divider.server.d.ts.map +1 -1
  129. package/dist/components/layout/Container.d.ts +3 -1
  130. package/dist/components/layout/Container.d.ts.map +1 -1
  131. package/dist/components/layout/Container.js +16 -2
  132. package/dist/components/layout/Container.js.map +1 -1
  133. package/dist/components/layout/Container.server.d.ts +3 -1
  134. package/dist/components/layout/Container.server.d.ts.map +1 -1
  135. package/dist/components/layout/Container.server.js +5 -2
  136. package/dist/components/layout/Container.server.js.map +1 -1
  137. package/dist/components/layout/Flex.d.ts +3 -1
  138. package/dist/components/layout/Flex.d.ts.map +1 -1
  139. package/dist/components/layout/Flex.js +18 -2
  140. package/dist/components/layout/Flex.js.map +1 -1
  141. package/dist/components/layout/Flex.server.d.ts +3 -1
  142. package/dist/components/layout/Flex.server.d.ts.map +1 -1
  143. package/dist/components/layout/Flex.server.js +5 -2
  144. package/dist/components/layout/Flex.server.js.map +1 -1
  145. package/dist/components/layout/Grid.d.ts +3 -1
  146. package/dist/components/layout/Grid.d.ts.map +1 -1
  147. package/dist/components/layout/Grid.js +15 -2
  148. package/dist/components/layout/Grid.js.map +1 -1
  149. package/dist/components/layout/Grid.server.d.ts +3 -1
  150. package/dist/components/layout/Grid.server.d.ts.map +1 -1
  151. package/dist/components/layout/Grid.server.js +5 -2
  152. package/dist/components/layout/Grid.server.js.map +1 -1
  153. package/dist/components/layout/Section.d.ts +3 -1
  154. package/dist/components/layout/Section.d.ts.map +1 -1
  155. package/dist/components/layout/Section.js +32 -5
  156. package/dist/components/layout/Section.js.map +1 -1
  157. package/dist/components/layout/Section.server.d.ts +3 -1
  158. package/dist/components/layout/Section.server.d.ts.map +1 -1
  159. package/dist/components/layout/Section.server.js +16 -4
  160. package/dist/components/layout/Section.server.js.map +1 -1
  161. package/dist/components/layout/Spacer.d.ts +1 -1
  162. package/dist/components/layout/Spacer.d.ts.map +1 -1
  163. package/dist/components/layout/Spacer.server.d.ts +1 -1
  164. package/dist/components/layout/Spacer.server.d.ts.map +1 -1
  165. package/dist/components/layout/Template.d.ts +1 -1
  166. package/dist/components/layout/Template.d.ts.map +1 -1
  167. package/dist/components/layout/Template.server.d.ts +1 -1
  168. package/dist/components/layout/Template.server.d.ts.map +1 -1
  169. package/dist/components/media/Image.d.ts +1 -1
  170. package/dist/components/media/Image.d.ts.map +1 -1
  171. package/dist/components/media/Image.server.d.ts +1 -1
  172. package/dist/components/media/Image.server.d.ts.map +1 -1
  173. package/dist/components/typography/Heading.d.ts +1 -1
  174. package/dist/components/typography/Heading.d.ts.map +1 -1
  175. package/dist/components/typography/Heading.server.d.ts +1 -1
  176. package/dist/components/typography/Heading.server.d.ts.map +1 -1
  177. package/dist/components/typography/RichText.editor.d.ts +15 -2
  178. package/dist/components/typography/RichText.editor.d.ts.map +1 -1
  179. package/dist/components/typography/RichText.editor.js +18 -11
  180. package/dist/components/typography/RichText.editor.js.map +1 -1
  181. package/dist/components/typography/RichText.server.d.ts +3 -2
  182. package/dist/components/typography/RichText.server.d.ts.map +1 -1
  183. package/dist/components/typography/RichText.server.js +10 -5
  184. package/dist/components/typography/RichText.server.js.map +1 -1
  185. package/dist/components/typography/Text.d.ts +1 -1
  186. package/dist/components/typography/Text.d.ts.map +1 -1
  187. package/dist/components/typography/Text.server.d.ts +1 -1
  188. package/dist/components/typography/Text.server.d.ts.map +1 -1
  189. package/dist/components/typography/index.d.ts +1 -1
  190. package/dist/components/typography/index.d.ts.map +1 -1
  191. package/dist/components/typography/index.js +1 -1
  192. package/dist/components/typography/index.js.map +1 -1
  193. package/dist/config/config.editor.d.ts +4 -4
  194. package/dist/config/config.editor.d.ts.map +1 -1
  195. package/dist/config/index.d.ts +1 -1
  196. package/dist/config/index.d.ts.map +1 -1
  197. package/dist/config/merge.d.ts +1 -1
  198. package/dist/config/merge.d.ts.map +1 -1
  199. package/dist/config/presets.d.ts +15 -15
  200. package/dist/config/presets.d.ts.map +1 -1
  201. package/dist/editor/PuckEditor.d.ts +88 -2
  202. package/dist/editor/PuckEditor.d.ts.map +1 -1
  203. package/dist/editor/PuckEditor.js +41 -13
  204. package/dist/editor/PuckEditor.js.map +1 -1
  205. package/dist/editor/PuckEditorImpl.client.d.ts +49 -4
  206. package/dist/editor/PuckEditorImpl.client.d.ts.map +1 -1
  207. package/dist/editor/PuckEditorImpl.client.js +191 -14
  208. package/dist/editor/PuckEditorImpl.client.js.map +1 -1
  209. package/dist/editor/ai-plugin-overrides.css +20 -0
  210. package/dist/editor/components/HeaderActions.d.ts +7 -2
  211. package/dist/editor/components/HeaderActions.d.ts.map +1 -1
  212. package/dist/editor/components/HeaderActions.js +16 -3
  213. package/dist/editor/components/HeaderActions.js.map +1 -1
  214. package/dist/editor/components/IframeWrapper.d.ts +13 -0
  215. package/dist/editor/components/IframeWrapper.d.ts.map +1 -1
  216. package/dist/editor/components/IframeWrapper.js +60 -4
  217. package/dist/editor/components/IframeWrapper.js.map +1 -1
  218. package/dist/editor/components/PreviewModal.d.ts +9 -1
  219. package/dist/editor/components/PreviewModal.d.ts.map +1 -1
  220. package/dist/editor/components/PreviewModal.js +36 -1
  221. package/dist/editor/components/PreviewModal.js.map +1 -1
  222. package/dist/editor/index.d.ts +4 -0
  223. package/dist/editor/index.d.ts.map +1 -1
  224. package/dist/editor/index.js +4 -0
  225. package/dist/editor/index.js.map +1 -1
  226. package/dist/editor/plugins/VersionHistoryPanel.d.ts +43 -0
  227. package/dist/editor/plugins/VersionHistoryPanel.d.ts.map +1 -0
  228. package/dist/editor/plugins/VersionHistoryPanel.js +303 -0
  229. package/dist/editor/plugins/VersionHistoryPanel.js.map +1 -0
  230. package/dist/editor/plugins/index.d.ts +6 -3
  231. package/dist/editor/plugins/index.d.ts.map +1 -1
  232. package/dist/editor/plugins/index.js +7 -3
  233. package/dist/editor/plugins/index.js.map +1 -1
  234. package/dist/editor/plugins/versionHistoryPlugin.d.ts +37 -0
  235. package/dist/editor/plugins/versionHistoryPlugin.d.ts.map +1 -0
  236. package/dist/editor/plugins/versionHistoryPlugin.js +36 -0
  237. package/dist/editor/plugins/versionHistoryPlugin.js.map +1 -0
  238. package/dist/editor/utils/detectPageTree.d.ts +1 -1
  239. package/dist/editor/utils/detectPageTree.d.ts.map +1 -1
  240. package/dist/editor/utils/injectPageTreeFields.d.ts +1 -1
  241. package/dist/editor/utils/injectPageTreeFields.d.ts.map +1 -1
  242. package/dist/endpoints/ai.d.ts +36 -0
  243. package/dist/endpoints/ai.d.ts.map +1 -0
  244. package/dist/endpoints/ai.js +315 -0
  245. package/dist/endpoints/ai.js.map +1 -0
  246. package/dist/endpoints/context.d.ts +30 -0
  247. package/dist/endpoints/context.d.ts.map +1 -0
  248. package/dist/endpoints/context.js +123 -0
  249. package/dist/endpoints/context.js.map +1 -0
  250. package/dist/endpoints/prompts.d.ts +28 -0
  251. package/dist/endpoints/prompts.d.ts.map +1 -0
  252. package/dist/endpoints/prompts.js +118 -0
  253. package/dist/endpoints/prompts.js.map +1 -0
  254. package/dist/endpoints/styles.d.ts +19 -0
  255. package/dist/endpoints/styles.d.ts.map +1 -0
  256. package/dist/endpoints/styles.js +116 -0
  257. package/dist/endpoints/styles.js.map +1 -0
  258. package/dist/fields/AlignmentField.d.ts +1 -1
  259. package/dist/fields/AlignmentField.d.ts.map +1 -1
  260. package/dist/fields/AlignmentField.js +1 -0
  261. package/dist/fields/AlignmentField.js.map +1 -1
  262. package/dist/fields/AnimationField.d.ts +1 -1
  263. package/dist/fields/AnimationField.d.ts.map +1 -1
  264. package/dist/fields/BackgroundField.d.ts +1 -1
  265. package/dist/fields/BackgroundField.d.ts.map +1 -1
  266. package/dist/fields/BackgroundField.js +9 -4
  267. package/dist/fields/BackgroundField.js.map +1 -1
  268. package/dist/fields/BorderField.d.ts +1 -1
  269. package/dist/fields/BorderField.d.ts.map +1 -1
  270. package/dist/fields/BorderField.js +1 -0
  271. package/dist/fields/BorderField.js.map +1 -1
  272. package/dist/fields/ColorPickerField.d.ts +1 -1
  273. package/dist/fields/ColorPickerField.d.ts.map +1 -1
  274. package/dist/fields/ColorPickerField.js +4 -2
  275. package/dist/fields/ColorPickerField.js.map +1 -1
  276. package/dist/fields/ContentAlignmentField.d.ts +66 -0
  277. package/dist/fields/ContentAlignmentField.d.ts.map +1 -0
  278. package/dist/fields/ContentAlignmentField.js +255 -0
  279. package/dist/fields/ContentAlignmentField.js.map +1 -0
  280. package/dist/fields/DimensionsField.d.ts +1 -1
  281. package/dist/fields/DimensionsField.d.ts.map +1 -1
  282. package/dist/fields/DimensionsField.js +8 -2
  283. package/dist/fields/DimensionsField.js.map +1 -1
  284. package/dist/fields/FlexAlignmentField.d.ts +1 -1
  285. package/dist/fields/FlexAlignmentField.d.ts.map +1 -1
  286. package/dist/fields/FolderPickerField.d.ts +1 -1
  287. package/dist/fields/FolderPickerField.d.ts.map +1 -1
  288. package/dist/fields/GradientEditor.d.ts.map +1 -1
  289. package/dist/fields/GradientEditor.js +3 -0
  290. package/dist/fields/GradientEditor.js.map +1 -1
  291. package/dist/fields/LockedField.d.ts +1 -1
  292. package/dist/fields/LockedField.d.ts.map +1 -1
  293. package/dist/fields/MarginField.d.ts +1 -1
  294. package/dist/fields/MarginField.d.ts.map +1 -1
  295. package/dist/fields/MediaField.d.ts +1 -1
  296. package/dist/fields/MediaField.d.ts.map +1 -1
  297. package/dist/fields/MediaField.js +3 -2
  298. package/dist/fields/MediaField.js.map +1 -1
  299. package/dist/fields/PaddingField.d.ts +1 -1
  300. package/dist/fields/PaddingField.d.ts.map +1 -1
  301. package/dist/fields/PageSegmentField.d.ts +1 -1
  302. package/dist/fields/PageSegmentField.d.ts.map +1 -1
  303. package/dist/fields/ResetField.d.ts +1 -1
  304. package/dist/fields/ResetField.d.ts.map +1 -1
  305. package/dist/fields/ResetField.js +1 -1
  306. package/dist/fields/ResetField.js.map +1 -1
  307. package/dist/fields/ResponsiveField.d.ts +1 -1
  308. package/dist/fields/ResponsiveField.d.ts.map +1 -1
  309. package/dist/fields/ResponsiveField.js +5 -2
  310. package/dist/fields/ResponsiveField.js.map +1 -1
  311. package/dist/fields/ResponsiveVisibilityField.d.ts +1 -1
  312. package/dist/fields/ResponsiveVisibilityField.d.ts.map +1 -1
  313. package/dist/fields/ResponsiveVisibilityField.js +4 -3
  314. package/dist/fields/ResponsiveVisibilityField.js.map +1 -1
  315. package/dist/fields/SizeField.d.ts +3 -25
  316. package/dist/fields/SizeField.d.ts.map +1 -1
  317. package/dist/fields/SizeField.js +8 -34
  318. package/dist/fields/SizeField.js.map +1 -1
  319. package/dist/fields/SlugPreviewField.d.ts +1 -1
  320. package/dist/fields/SlugPreviewField.d.ts.map +1 -1
  321. package/dist/fields/TemplateField.d.ts +1 -1
  322. package/dist/fields/TemplateField.d.ts.map +1 -1
  323. package/dist/fields/TemplateField.js +1 -1
  324. package/dist/fields/TemplateField.js.map +1 -1
  325. package/dist/fields/TransformField.d.ts +1 -1
  326. package/dist/fields/TransformField.d.ts.map +1 -1
  327. package/dist/fields/TransformField.js +2 -0
  328. package/dist/fields/TransformField.js.map +1 -1
  329. package/dist/fields/VerticalAlignmentField.d.ts +1 -1
  330. package/dist/fields/VerticalAlignmentField.d.ts.map +1 -1
  331. package/dist/fields/WidthField.d.ts +1 -1
  332. package/dist/fields/WidthField.d.ts.map +1 -1
  333. package/dist/fields/index.d.ts +8 -36
  334. package/dist/fields/index.d.ts.map +1 -1
  335. package/dist/fields/index.js +20 -78
  336. package/dist/fields/index.js.map +1 -1
  337. package/dist/fields/richtext/controls/ColorPickerControl.d.ts +16 -0
  338. package/dist/fields/richtext/controls/ColorPickerControl.d.ts.map +1 -0
  339. package/dist/fields/richtext/controls/ColorPickerControl.js +116 -0
  340. package/dist/fields/richtext/controls/ColorPickerControl.js.map +1 -0
  341. package/dist/fields/richtext/controls/DropdownPortal.d.ts +17 -0
  342. package/dist/fields/richtext/controls/DropdownPortal.d.ts.map +1 -0
  343. package/dist/fields/richtext/controls/DropdownPortal.js +90 -0
  344. package/dist/fields/richtext/controls/DropdownPortal.js.map +1 -0
  345. package/dist/fields/richtext/controls/FontSizeControl.d.ts +8 -0
  346. package/dist/fields/richtext/controls/FontSizeControl.d.ts.map +1 -0
  347. package/dist/fields/richtext/controls/FontSizeControl.js +62 -0
  348. package/dist/fields/richtext/controls/FontSizeControl.js.map +1 -0
  349. package/dist/fields/richtext/controls/HighlightControl.d.ts +9 -0
  350. package/dist/fields/richtext/controls/HighlightControl.d.ts.map +1 -0
  351. package/dist/fields/richtext/controls/HighlightControl.js +44 -0
  352. package/dist/fields/richtext/controls/HighlightControl.js.map +1 -0
  353. package/dist/fields/richtext/controls/index.d.ts +11 -0
  354. package/dist/fields/richtext/controls/index.d.ts.map +1 -0
  355. package/dist/fields/richtext/controls/index.js +16 -0
  356. package/dist/fields/richtext/controls/index.js.map +1 -0
  357. package/dist/fields/richtext/controls/shared.d.ts +97 -0
  358. package/dist/fields/richtext/controls/shared.d.ts.map +1 -0
  359. package/dist/fields/richtext/controls/shared.js +344 -0
  360. package/dist/fields/richtext/controls/shared.js.map +1 -0
  361. package/dist/fields/richtext/createRichTextField.d.ts +165 -0
  362. package/dist/fields/richtext/createRichTextField.d.ts.map +1 -0
  363. package/dist/fields/richtext/createRichTextField.js +139 -0
  364. package/dist/fields/richtext/createRichTextField.js.map +1 -0
  365. package/dist/fields/richtext/extensions/FontSize.d.ts +23 -0
  366. package/dist/fields/richtext/extensions/FontSize.d.ts.map +1 -0
  367. package/dist/fields/richtext/extensions/FontSize.js +47 -0
  368. package/dist/fields/richtext/extensions/FontSize.js.map +1 -0
  369. package/dist/fields/richtext/extensions/index.d.ts +5 -0
  370. package/dist/fields/richtext/extensions/index.d.ts.map +1 -0
  371. package/dist/fields/richtext/extensions/index.js +5 -0
  372. package/dist/fields/richtext/extensions/index.js.map +1 -0
  373. package/dist/fields/richtext/index.d.ts +14 -0
  374. package/dist/fields/richtext/index.d.ts.map +1 -0
  375. package/dist/fields/richtext/index.js +19 -0
  376. package/dist/fields/richtext/index.js.map +1 -0
  377. package/dist/fields/richtext/richtext-menu.css +50 -0
  378. package/dist/fields/shared.d.ts +27 -1
  379. package/dist/fields/shared.d.ts.map +1 -1
  380. package/dist/fields/shared.js +34 -0
  381. package/dist/fields/shared.js.map +1 -1
  382. package/dist/layouts/types.d.ts +30 -0
  383. package/dist/layouts/types.d.ts.map +1 -1
  384. package/dist/plugin/index.d.ts +1 -0
  385. package/dist/plugin/index.d.ts.map +1 -1
  386. package/dist/plugin/index.js +111 -1
  387. package/dist/plugin/index.js.map +1 -1
  388. package/dist/render/HybridPageRenderer.d.ts +1 -1
  389. package/dist/render/HybridPageRenderer.d.ts.map +1 -1
  390. package/dist/render/PageRenderer.d.ts +1 -1
  391. package/dist/render/PageRenderer.d.ts.map +1 -1
  392. package/dist/render/PageRenderer.js +1 -1
  393. package/dist/render/PageRenderer.js.map +1 -1
  394. package/dist/render/PuckEditor.client.d.ts +2 -2
  395. package/dist/render/PuckEditor.client.d.ts.map +1 -1
  396. package/dist/render/PuckEditor.client.js +2 -2
  397. package/dist/render/PuckEditor.client.js.map +1 -1
  398. package/dist/types/index.d.ts +36 -11
  399. package/dist/types/index.d.ts.map +1 -1
  400. package/dist/version.d.ts +1 -1
  401. package/dist/version.js +1 -1
  402. package/dist/views/PuckConfigContext.d.ts +56 -2
  403. package/dist/views/PuckConfigContext.d.ts.map +1 -1
  404. package/dist/views/PuckConfigContext.js +6 -3
  405. package/dist/views/PuckConfigContext.js.map +1 -1
  406. package/dist/views/PuckEditorView.d.ts.map +1 -1
  407. package/dist/views/PuckEditorView.js +23 -1
  408. package/dist/views/PuckEditorView.js.map +1 -1
  409. package/package.json +34 -10
  410. package/dist/components/typography/RichText.d.ts +0 -20
  411. package/dist/components/typography/RichText.d.ts.map +0 -1
  412. package/dist/components/typography/RichText.js +0 -73
  413. package/dist/components/typography/RichText.js.map +0 -1
  414. package/dist/fields/TiptapField.d.ts +0 -40
  415. package/dist/fields/TiptapField.d.ts.map +0 -1
  416. package/dist/fields/TiptapField.js +0 -857
  417. package/dist/fields/TiptapField.js.map +0 -1
  418. package/dist/fields/TiptapModal.d.ts +0 -10
  419. package/dist/fields/TiptapModal.d.ts.map +0 -1
  420. package/dist/fields/TiptapModal.js +0 -114
  421. package/dist/fields/TiptapModal.js.map +0 -1
  422. package/dist/fields/TiptapModalField.d.ts +0 -23
  423. package/dist/fields/TiptapModalField.d.ts.map +0 -1
  424. package/dist/fields/TiptapModalField.js +0 -55
  425. package/dist/fields/TiptapModalField.js.map +0 -1
  426. package/dist/fields/richtext-output.css +0 -219
  427. package/dist/fields/tiptap-styles.css +0 -248
package/README.md CHANGED
@@ -17,6 +17,7 @@ A PayloadCMS plugin for integrating [Puck](https://puckeditor.com) visual page b
17
17
  - [Layouts](#layouts)
18
18
  - [Page-Tree Integration](#page-tree-integration)
19
19
  - [Hybrid Integration](#hybrid-integration)
20
+ - [AI Integration](#ai-integration)
20
21
  - [Advanced Configuration](#advanced-configuration)
21
22
  - [License](#license)
22
23
 
@@ -28,17 +29,19 @@ A PayloadCMS plugin for integrating [Puck](https://puckeditor.com) visual page b
28
29
 
29
30
  | Dependency | Version | Purpose |
30
31
  |------------|---------|---------|
31
- | `@measured/puck` | >= 0.20.0 | Visual editor core |
32
- | `payload` | >= 3.0.0 | CMS backend |
33
- | `@payloadcms/next` | >= 3.0.0 | Payload Next.js integration |
34
- | `next` | >= 14.0.0 | React framework |
35
- | `react` | >= 18.0.0 | UI library |
32
+ | `@puckeditor/core` | >= 0.21.0 | Visual editor core |
33
+ | `payload` | >= 3.69.0 | CMS backend |
34
+ | `@payloadcms/next` | >= 3.69.0 | Payload Next.js integration |
35
+ | `next` | >= 15.4.8 | React framework |
36
+ | `react` | >= 19.2.1 | UI library |
36
37
  | `@tailwindcss/typography` | >= 0.5.0 | RichText component styling |
37
38
 
39
+ > **Note:** Puck 0.21+ moved from `@measured/puck` to `@puckeditor/core`. This plugin requires the new package scope.
40
+
38
41
  ### Install
39
42
 
40
43
  ```bash
41
- pnpm add @delmaredigital/payload-puck @measured/puck
44
+ pnpm add @delmaredigital/payload-puck @puckeditor/core
42
45
  ```
43
46
 
44
47
  ---
@@ -112,16 +115,23 @@ import { notFound } from 'next/navigation'
112
115
  import type { Metadata } from 'next'
113
116
 
114
117
  // Fetch page by slug (or homepage if no slug)
118
+ // Only returns published pages - unpublished pages will 404
115
119
  async function getPage(slug?: string[]) {
116
120
  const payload = await getPayload({ config })
117
121
  const slugPath = slug?.join('/') || ''
118
122
 
119
123
  // Try to find by slug, or find homepage
124
+ // Filter for published pages only (_status: 'published')
120
125
  const { docs } = await payload.find({
121
126
  collection: 'pages',
122
- where: slugPath
123
- ? { slug: { equals: slugPath } }
124
- : { isHomepage: { equals: true } },
127
+ where: {
128
+ and: [
129
+ { _status: { equals: 'published' } },
130
+ slugPath
131
+ ? { slug: { equals: slugPath } }
132
+ : { isHomepage: { equals: true } },
133
+ ],
134
+ },
125
135
  limit: 1,
126
136
  })
127
137
 
@@ -285,6 +295,11 @@ The editor uses Payload's native draft system. The plugin automatically enables
285
295
  }
286
296
  ```
287
297
 
298
+ The editor header provides:
299
+ - **Save** - Saves as draft without publishing
300
+ - **Publish** - Publishes the page (sets `_status: 'published'`)
301
+ - **Unpublish** - Reverts a published page to draft status (appears only when published)
302
+
288
303
  ---
289
304
 
290
305
  ## Components
@@ -306,7 +321,7 @@ The editor uses Payload's native draft system. The plugin automatically enables
306
321
  |-----------|-------------|
307
322
  | **Heading** | H1-H6 headings with size and alignment |
308
323
  | **Text** | Paragraph text with styling options |
309
- | **RichText** | TipTap-powered WYSIWYG editor |
324
+ | **RichText** | Puck's native richtext editor with enhancements: font sizes, text colors with opacity, highlights, superscript/subscript, and inline editing on canvas |
310
325
 
311
326
  ### Media & Interactive
312
327
 
@@ -316,7 +331,20 @@ The editor uses Payload's native draft system. The plugin automatically enables
316
331
  | **Button** | Styled button/link with variants |
317
332
  | **Card** | Content card with optional image |
318
333
  | **Divider** | Horizontal rule with styles |
319
- | **Accordion** | Expandable content sections |
334
+ | **Accordion** | Expandable content sections (first item opens by default) |
335
+
336
+ ### Semantic HTML Elements
337
+
338
+ Layout components (Section, Flex, Container, Grid) support semantic HTML output for better SEO and accessibility:
339
+
340
+ | Component | Available Elements |
341
+ |-----------|-------------------|
342
+ | **Section** | `section`, `article`, `aside`, `nav`, `header`, `footer`, `main`, `div` |
343
+ | **Flex** | `div`, `nav`, `ul`, `ol`, `aside`, `section` |
344
+ | **Container** | `div`, `article`, `aside`, `section` |
345
+ | **Grid** | `div`, `ul`, `ol` |
346
+
347
+ Select the appropriate HTML element in the component's sidebar to output semantic markup.
320
348
 
321
349
  ### Responsive Controls
322
350
 
@@ -324,6 +352,7 @@ Layout components support per-breakpoint customization:
324
352
  - **Dimensions** - Width, max-width, height constraints
325
353
  - **Padding/Margin** - Spacing per breakpoint
326
354
  - **Visibility** - Show/hide at specific breakpoints
355
+ - **Viewport Preview** - Mobile, Tablet, Desktop, and Full Width options
327
356
 
328
357
  ---
329
358
 
@@ -336,13 +365,15 @@ All fields are imported from `@delmaredigital/payload-puck/fields`.
336
365
  | Field | Description |
337
366
  |-------|-------------|
338
367
  | **MediaField** | Payload media library integration |
339
- | **TiptapField** | Rich text editor with formatting |
368
+ | **RichTextField** | Puck's native richtext with enhancements (colors, font sizes, highlights) |
340
369
  | **ColorPickerField** | Color picker with opacity and presets |
341
370
  | **BackgroundField** | Solid colors, gradients, images |
342
371
  | **PaddingField / MarginField** | Visual spacing editors |
343
372
  | **BorderField** | Border width, style, color, radius |
344
373
  | **DimensionsField** | Width/height with constraints |
345
- | **AlignmentField** | Text alignment options |
374
+ | **AlignmentField** | Text alignment (left, center, right) |
375
+ | **ContentAlignmentField** | Visual 3x3 grid selector for positioning (d-pad style) |
376
+ | **SizeField** | Preset sizes (sm, default, lg) with custom mode |
346
377
  | **AnimationField** | Entrance animations |
347
378
  | **ResponsiveVisibilityField** | Show/hide per breakpoint |
348
379
  | **FolderPickerField** | Hierarchical folder selection (page-tree) |
@@ -375,9 +406,46 @@ import {
375
406
  dimensionsValueToCSS,
376
407
  animationValueToCSS,
377
408
  visibilityValueToCSS,
409
+ alignmentToFlexCSS,
410
+ alignmentToGridCSS,
411
+ sizeValueToCSS,
412
+ getSizeClasses,
378
413
  } from '@delmaredigital/payload-puck/fields'
379
414
  ```
380
415
 
416
+ ### ContentAlignmentField Example
417
+
418
+ The ContentAlignmentField provides a visual 3x3 grid selector for content positioning:
419
+
420
+ ```typescript
421
+ import {
422
+ createContentAlignmentField,
423
+ alignmentToFlexCSS,
424
+ alignmentToGridCSS,
425
+ } from '@delmaredigital/payload-puck/fields'
426
+
427
+ const BannerConfig = {
428
+ fields: {
429
+ contentPosition: createContentAlignmentField({ label: 'Content Position' }),
430
+ },
431
+ render: ({ contentPosition }) => (
432
+ <div style={{
433
+ display: 'flex',
434
+ minHeight: '400px',
435
+ ...alignmentToFlexCSS(contentPosition), // Converts to justify-content + align-items
436
+ }}>
437
+ <div>Positioned content</div>
438
+ </div>
439
+ ),
440
+ }
441
+ ```
442
+
443
+ Helper functions:
444
+ - `alignmentToFlexCSS()` - For Flexbox containers (`justify-content` + `align-items`)
445
+ - `alignmentToGridCSS()` - For Grid containers (`justify-content` + `align-content`)
446
+ - `alignmentToPlaceSelfCSS()` - For individual grid items (`place-self`)
447
+ - `alignmentToTailwind()` - Returns Tailwind classes (`justify-* items-*`)
448
+
381
449
  ---
382
450
 
383
451
  ## Building Custom Components
@@ -417,7 +485,7 @@ export const puckConfig: Config = {
417
485
  Build custom components with pre-built fields:
418
486
 
419
487
  ```typescript
420
- import type { ComponentConfig } from '@measured/puck'
488
+ import type { ComponentConfig } from '@puckeditor/core'
421
489
  import {
422
490
  createMediaField,
423
491
  createBackgroundField,
@@ -539,8 +607,11 @@ This is the recommended pattern for Payload apps. The provider wraps only the ad
539
607
  | `createBorderField()` | Border styling |
540
608
  | `createDimensionsField()` | Width/height constraints |
541
609
  | `createAnimationField()` | Entrance animations |
542
- | `createAlignmentField()` | Text alignment |
543
- | `createTiptapField()` | Inline rich text editor |
610
+ | `createAlignmentField()` | Text alignment (left, center, right) |
611
+ | `createContentAlignmentField()` | Visual 3x3 grid positioning selector |
612
+ | `createSizeField()` | Size presets with custom mode |
613
+ | `createRichTextField()` | Puck's native richtext with colors, font sizes, highlights |
614
+ | `createResponsiveVisibilityField()` | Show/hide per breakpoint |
544
615
 
545
616
  ### CSS Helper Functions
546
617
 
@@ -554,12 +625,17 @@ import {
554
625
  borderValueToCSS,
555
626
  dimensionsValueToCSS,
556
627
  colorValueToCSS,
628
+ alignmentToFlexCSS,
629
+ alignmentToGridCSS,
630
+ sizeValueToCSS,
557
631
  } from '@delmaredigital/payload-puck/fields'
558
632
 
559
633
  const style = {
560
634
  background: backgroundValueToCSS(props.background),
561
635
  padding: paddingValueToCSS(props.padding),
562
636
  ...dimensionsValueToCSS(props.dimensions),
637
+ ...alignmentToFlexCSS(props.contentAlignment),
638
+ ...sizeValueToCSS(props.size),
563
639
  }
564
640
  ```
565
641
 
@@ -772,6 +848,196 @@ import { LegacyBlockRenderer } from '@/components/LegacyBlockRenderer'
772
848
 
773
849
  ---
774
850
 
851
+ ## AI Integration
852
+
853
+ > **Early Preview:** While Puck's AI features are powerful, this plugin's implementation is still in early stages and under active development. Expect changes as we refine the integration.
854
+
855
+ The plugin integrates with [Puck AI](https://puckeditor.com/docs/integrating-puck/ai) to enable AI-assisted page generation. Users can describe what they want in natural language, and the AI builds complete page layouts using your components.
856
+
857
+ ### Requirements
858
+
859
+ - `PUCK_API_KEY` environment variable (from [Puck Cloud](https://puckeditor.com))
860
+ - AI features require `@puckeditor/plugin-ai` and `@puckeditor/cloud-client` (bundled with the plugin)
861
+
862
+ ### Quick Start
863
+
864
+ Enable AI in your plugin configuration:
865
+
866
+ ```typescript
867
+ createPuckPlugin({
868
+ pagesCollection: 'pages',
869
+ ai: {
870
+ enabled: true,
871
+ context: 'We are Acme Corp, a B2B SaaS company. Use professional language.',
872
+ },
873
+ })
874
+ ```
875
+
876
+ This automatically:
877
+ - Registers the AI chat endpoint at `/api/puck/ai`
878
+ - Adds the AI chat plugin to the editor
879
+ - Applies comprehensive component instructions for better generation quality
880
+
881
+ ### Dynamic Business Context
882
+
883
+ Instead of hardcoding context in your config, you can manage it through Payload admin:
884
+
885
+ ```typescript
886
+ createPuckPlugin({
887
+ ai: {
888
+ enabled: true,
889
+ contextCollection: true, // Creates puck-ai-context collection
890
+ },
891
+ })
892
+ ```
893
+
894
+ This creates a `puck-ai-context` collection where you can add entries for:
895
+ - **Brand Guidelines** - Colors, fonts, brand voice
896
+ - **Tone of Voice** - How to communicate
897
+ - **Product Information** - What you sell/offer
898
+ - **Industry Context** - Your market and audience
899
+ - **Technical Requirements** - Specific constraints
900
+ - **Page Patterns** - Common layout structures
901
+
902
+ Context entries can be enabled/disabled and ordered. The AI receives all enabled entries sorted by order.
903
+
904
+ ### Context Editor Plugin
905
+
906
+ When `contextCollection: true`, a "Context" panel appears in the Puck plugin rail. Users can view, create, edit, and toggle context entries directly in the editor without visiting Payload admin.
907
+
908
+ ### Prompt Management
909
+
910
+ Store reusable prompts in Payload:
911
+
912
+ ```typescript
913
+ createPuckPlugin({
914
+ ai: {
915
+ enabled: true,
916
+ promptsCollection: true, // Creates puck-ai-prompts collection
917
+ examplePrompts: [
918
+ { label: 'Landing page', prompt: 'Create a landing page for...' },
919
+ ],
920
+ },
921
+ })
922
+ ```
923
+
924
+ Prompts from the collection appear in the AI chat interface. A "Prompts" panel in the plugin rail allows in-editor prompt management.
925
+
926
+ ### Custom Tools
927
+
928
+ Enable the AI to query your data:
929
+
930
+ ```typescript
931
+ import { z } from 'zod'
932
+
933
+ createPuckPlugin({
934
+ ai: {
935
+ enabled: true,
936
+ tools: {
937
+ getProducts: {
938
+ description: 'Get products from the database',
939
+ inputSchema: z.object({ category: z.string() }),
940
+ execute: async ({ category }, { payload }) => {
941
+ return await payload.find({
942
+ collection: 'products',
943
+ where: { category: { equals: category } },
944
+ })
945
+ },
946
+ },
947
+ },
948
+ },
949
+ })
950
+ ```
951
+
952
+ Tools receive a context object with the Payload instance and authenticated user.
953
+
954
+ ### AI Configuration Options
955
+
956
+ | Option | Default | Description |
957
+ |--------|---------|-------------|
958
+ | `enabled` | `false` | Enable AI features |
959
+ | `context` | `undefined` | Static system context for the AI |
960
+ | `contextCollection` | `false` | Create `puck-ai-context` collection for dynamic context |
961
+ | `promptsCollection` | `false` | Create `puck-ai-prompts` collection for reusable prompts |
962
+ | `examplePrompts` | `[]` | Static example prompts for the chat interface |
963
+ | `tools` | `undefined` | Custom tools for AI to query your system |
964
+ | `componentInstructions` | `undefined` | Override default component AI instructions |
965
+
966
+ ### Component Instructions
967
+
968
+ The plugin includes comprehensive instructions for all built-in components, teaching the AI:
969
+ - Correct field names and values
970
+ - Component composition patterns
971
+ - Page structure best practices (Hero → Features → CTA flow)
972
+ - Semantic HTML usage
973
+
974
+ To customize or extend:
975
+
976
+ ```typescript
977
+ createPuckPlugin({
978
+ ai: {
979
+ enabled: true,
980
+ componentInstructions: {
981
+ Heading: {
982
+ ai: { instructions: 'Use our brand voice: professional but approachable' },
983
+ fields: {
984
+ text: { ai: { instructions: 'Keep under 8 words' } },
985
+ },
986
+ },
987
+ },
988
+ },
989
+ })
990
+ ```
991
+
992
+ ### Standalone API Routes
993
+
994
+ For custom implementations outside the plugin:
995
+
996
+ ```typescript
997
+ // app/api/puck/[...all]/route.ts
998
+ import { createPuckAiApiRoutes } from '@delmaredigital/payload-puck/ai'
999
+ import config from '@payload-config'
1000
+
1001
+ export const POST = createPuckAiApiRoutes({
1002
+ payloadConfig: config,
1003
+ auth: {
1004
+ authenticate: async (request) => {
1005
+ // Your auth implementation
1006
+ return { user: { id: '...' } }
1007
+ },
1008
+ },
1009
+ ai: {
1010
+ context: 'Your business context...',
1011
+ },
1012
+ })
1013
+ ```
1014
+
1015
+ ### AI Exports
1016
+
1017
+ ```typescript
1018
+ import {
1019
+ // Plugins
1020
+ createAiPlugin,
1021
+ createPromptEditorPlugin,
1022
+ createContextEditorPlugin,
1023
+
1024
+ // Hooks
1025
+ useAiPrompts,
1026
+ useAiContext,
1027
+
1028
+ // Config utilities
1029
+ injectAiConfig,
1030
+ comprehensiveComponentAiConfig,
1031
+ pagePatternSystemContext,
1032
+
1033
+ // API routes
1034
+ createPuckAiApiRoutes,
1035
+ createAiGenerate,
1036
+ } from '@delmaredigital/payload-puck/ai'
1037
+ ```
1038
+
1039
+ ---
1040
+
775
1041
  ## Advanced Configuration
776
1042
 
777
1043
  ### Plugin Options
@@ -785,6 +1051,8 @@ import { LegacyBlockRenderer } from '@/components/LegacyBlockRenderer'
785
1051
  | `adminViewPath` | `'/puck-editor'` | Path for the editor (full path: `/admin/puck-editor/:collection/:id`) |
786
1052
  | `pageTreeIntegration` | auto-detect | Integration with `@delmaredigital/payload-page-tree` |
787
1053
  | `layouts` | `undefined` | Layout definitions for page templates |
1054
+ | `editorStylesheet` | `undefined` | Path to CSS file for editor iframe styling (e.g., `'src/app/globals.css'`) |
1055
+ | `editorStylesheetUrls` | `[]` | Additional stylesheet URLs for the editor (e.g., Google Fonts) |
788
1056
 
789
1057
  ```typescript
790
1058
  createPuckPlugin({
@@ -812,6 +1080,52 @@ createPuckPlugin({
812
1080
  })
813
1081
  ```
814
1082
 
1083
+ ### Editor Stylesheet (Iframe Styling)
1084
+
1085
+ The Puck editor renders page content in an iframe. By default, this iframe doesn't have access to your frontend's CSS (Tailwind utilities, CSS variables, fonts). The `editorStylesheet` option solves this by compiling and serving your CSS.
1086
+
1087
+ **How it works:**
1088
+ 1. You specify your CSS file path in the plugin config
1089
+ 2. The plugin creates an endpoint at `/api/puck/styles`
1090
+ 3. On first request, the CSS is compiled with PostCSS/Tailwind and cached
1091
+ 4. The iframe loads this compiled CSS
1092
+
1093
+ ```typescript
1094
+ createPuckPlugin({
1095
+ pagesCollection: 'pages',
1096
+ // Your frontend's main CSS file
1097
+ editorStylesheet: 'src/app/(frontend)/globals.css',
1098
+ // External stylesheets (Google Fonts, etc.)
1099
+ editorStylesheetUrls: [
1100
+ 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'
1101
+ ],
1102
+ })
1103
+ ```
1104
+
1105
+ Then update your `PuckConfigProvider` to use the compiled stylesheet:
1106
+
1107
+ ```typescript
1108
+ <PuckConfigProvider
1109
+ config={editorConfig}
1110
+ layouts={siteLayouts}
1111
+ editorStylesheets={[
1112
+ '/api/puck/styles', // Plugin-created endpoint
1113
+ 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'
1114
+ ]}
1115
+ >
1116
+ {children}
1117
+ </PuckConfigProvider>
1118
+ ```
1119
+
1120
+ **Requirements:**
1121
+ - `postcss` must be installed in your project
1122
+ - For Tailwind v4: `@tailwindcss/postcss`
1123
+ - For Tailwind v3: `tailwindcss`
1124
+
1125
+ The CSS is compiled at runtime (cached after first request) using your project's PostCSS/Tailwind installation.
1126
+
1127
+ ---
1128
+
815
1129
  ### Custom API Routes (Advanced)
816
1130
 
817
1131
  The built-in endpoints handle most use cases. Only disable them if you need custom authentication or middleware.
@@ -845,6 +1159,7 @@ See the JSDoc in `@delmaredigital/payload-puck/api` for usage examples.
845
1159
  | `@delmaredigital/payload-puck/theme` | `ThemeProvider`, theme utilities |
846
1160
  | `@delmaredigital/payload-puck/layouts` | Layout definitions, `LayoutWrapper` |
847
1161
  | `@delmaredigital/payload-puck/api` | API route factories (for custom implementations) |
1162
+ | `@delmaredigital/payload-puck/ai` | AI plugins, hooks, config utilities, API routes |
848
1163
  | `@delmaredigital/payload-puck/admin/client` | `EditWithPuckButton`, `EditWithPuckCell` |
849
1164
 
850
1165
  ---
@@ -1,4 +1,4 @@
1
- import type { Config as PuckConfig, Data, Plugin as PuckPlugin } from '@measured/puck';
1
+ import type { Config as PuckConfig, Data, Plugin as PuckPlugin } from '@puckeditor/core';
2
2
  /**
3
3
  * Props for the PuckEditorView component
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"PuckEditorView.d.ts","sourceRoot":"","sources":["../../src/admin/PuckEditorView.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,IAAI,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEtF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,EAAE,UAAU,CAAA;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,CAAA;IAChD;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IACtE;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,GAAG,KAAK,CAAA;IAC9B;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACpC;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACrC;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,cAAwB,EACxB,WAAyB,EACzB,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAwB,EACxB,OAAO,EACP,aAAa,EACb,WAAW,GACZ,EAAE,mBAAmB,2CAkKrB;AAED,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"PuckEditorView.d.ts","sourceRoot":"","sources":["../../src/admin/PuckEditorView.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,IAAI,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAExF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,EAAE,UAAU,CAAA;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,CAAA;IAChD;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IACtE;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,GAAG,KAAK,CAAA;IAC9B;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IACpC;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACrC;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,cAAwB,EACxB,WAAyB,EACzB,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAwB,EACxB,OAAO,EACP,aAAa,EACb,WAAW,GACZ,EAAE,mBAAmB,2CAkKrB;AAED,eAAe,cAAc,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { CollectionConfig } from 'payload';
2
+ /**
3
+ * AI Context Collection
4
+ *
5
+ * Stores business context entries for the AI chat interface.
6
+ * These context entries are concatenated and sent to the AI system prompt
7
+ * to help it understand your brand, tone, and requirements.
8
+ *
9
+ * @example Creating context entries in Payload admin:
10
+ * - "Brand Guidelines" - Colors, fonts, brand voice
11
+ * - "Tone of Voice" - How to communicate
12
+ * - "Product Information" - What you sell/offer
13
+ * - "Industry Context" - Your market and audience
14
+ */
15
+ export declare const AiContextCollection: CollectionConfig;
16
+ //# sourceMappingURL=AiContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiContext.d.ts","sourceRoot":"","sources":["../../../src/ai/collections/AiContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBA0EjC,CAAA"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * AI Context Collection
3
+ *
4
+ * Stores business context entries for the AI chat interface.
5
+ * These context entries are concatenated and sent to the AI system prompt
6
+ * to help it understand your brand, tone, and requirements.
7
+ *
8
+ * @example Creating context entries in Payload admin:
9
+ * - "Brand Guidelines" - Colors, fonts, brand voice
10
+ * - "Tone of Voice" - How to communicate
11
+ * - "Product Information" - What you sell/offer
12
+ * - "Industry Context" - Your market and audience
13
+ */
14
+ export const AiContextCollection = {
15
+ slug: 'puck-ai-context',
16
+ labels: {
17
+ singular: 'AI Context',
18
+ plural: 'AI Contexts',
19
+ },
20
+ admin: {
21
+ group: 'Puck',
22
+ useAsTitle: 'name',
23
+ defaultColumns: ['name', 'category', 'enabled', 'order', 'updatedAt'],
24
+ hidden: false, // Visible in admin for context management
25
+ description: 'Business context for AI page generation. Add entries for brand guidelines, tone of voice, product info, etc.',
26
+ },
27
+ access: {
28
+ // Default: authenticated users can manage context
29
+ read: ({ req }) => Boolean(req.user),
30
+ create: ({ req }) => Boolean(req.user),
31
+ update: ({ req }) => Boolean(req.user),
32
+ delete: ({ req }) => Boolean(req.user),
33
+ },
34
+ fields: [
35
+ {
36
+ name: 'name',
37
+ type: 'text',
38
+ required: true,
39
+ admin: {
40
+ description: 'Name for this context block (e.g., "Brand Guidelines", "Tone of Voice")',
41
+ },
42
+ },
43
+ {
44
+ name: 'content',
45
+ type: 'textarea',
46
+ required: true,
47
+ admin: {
48
+ description: 'The context content in markdown format. Use headers (##) to organize, lists for guidelines, etc.',
49
+ rows: 12,
50
+ },
51
+ },
52
+ {
53
+ name: 'category',
54
+ type: 'select',
55
+ options: [
56
+ { label: 'Brand Guidelines', value: 'brand' },
57
+ { label: 'Tone of Voice', value: 'tone' },
58
+ { label: 'Product Information', value: 'product' },
59
+ { label: 'Industry Context', value: 'industry' },
60
+ { label: 'Technical Requirements', value: 'technical' },
61
+ { label: 'Page Patterns', value: 'patterns' },
62
+ { label: 'Other', value: 'other' },
63
+ ],
64
+ admin: {
65
+ description: 'Category for organizing context blocks',
66
+ },
67
+ },
68
+ {
69
+ name: 'enabled',
70
+ type: 'checkbox',
71
+ defaultValue: true,
72
+ admin: {
73
+ description: 'Include this context in AI prompts. Uncheck to temporarily disable.',
74
+ },
75
+ },
76
+ {
77
+ name: 'order',
78
+ type: 'number',
79
+ defaultValue: 0,
80
+ admin: {
81
+ description: 'Order in the context (lower numbers appear earlier in the prompt)',
82
+ },
83
+ },
84
+ ],
85
+ timestamps: true,
86
+ };
87
+ //# sourceMappingURL=AiContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiContext.js","sourceRoot":"","sources":["../../../src/ai/collections/AiContext.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqB;IACnD,IAAI,EAAE,iBAAiB;IACvB,MAAM,EAAE;QACN,QAAQ,EAAE,YAAY;QACtB,MAAM,EAAE,aAAa;KACtB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,MAAM;QAClB,cAAc,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC;QACrE,MAAM,EAAE,KAAK,EAAE,0CAA0C;QACzD,WAAW,EACT,8GAA8G;KACjH;IACD,MAAM,EAAE;QACN,kDAAkD;QAClD,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACpC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACtC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACtC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;KACvC;IACD,MAAM,EAAE;QACN;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE;gBACL,WAAW,EAAE,yEAAyE;aACvF;SACF;QACD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE;gBACL,WAAW,EACT,kGAAkG;gBACpG,IAAI,EAAE,EAAE;aACT;SACF;QACD;YACE,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE;gBAC7C,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE;gBACzC,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,SAAS,EAAE;gBAClD,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,UAAU,EAAE;gBAChD,EAAE,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,WAAW,EAAE;gBACvD,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,EAAE;gBAC7C,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;aACnC;YACD,KAAK,EAAE;gBACL,WAAW,EAAE,wCAAwC;aACtD;SACF;QACD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,UAAU;YAChB,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE;gBACL,WAAW,EAAE,qEAAqE;aACnF;SACF;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,CAAC;YACf,KAAK,EAAE;gBACL,WAAW,EAAE,mEAAmE;aACjF;SACF;KACF;IACD,UAAU,EAAE,IAAI;CACjB,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { CollectionConfig } from 'payload';
2
+ /**
3
+ * AI Prompts Collection
4
+ *
5
+ * Stores example prompts for the AI chat interface.
6
+ * These prompts are displayed in the Puck editor for users to quickly
7
+ * start common AI generation tasks.
8
+ */
9
+ export declare const AiPromptsCollection: CollectionConfig;
10
+ //# sourceMappingURL=AiPrompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiPrompts.d.ts","sourceRoot":"","sources":["../../../src/ai/collections/AiPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBAsDjC,CAAA"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * AI Prompts Collection
3
+ *
4
+ * Stores example prompts for the AI chat interface.
5
+ * These prompts are displayed in the Puck editor for users to quickly
6
+ * start common AI generation tasks.
7
+ */
8
+ export const AiPromptsCollection = {
9
+ slug: 'puck-ai-prompts',
10
+ labels: {
11
+ singular: 'AI Prompt',
12
+ plural: 'AI Prompts',
13
+ },
14
+ admin: {
15
+ group: 'Puck',
16
+ useAsTitle: 'label',
17
+ defaultColumns: ['label', 'category', 'order', 'updatedAt'],
18
+ hidden: false, // Visible in admin for prompt management
19
+ },
20
+ access: {
21
+ // Default: authenticated users can manage prompts
22
+ read: ({ req }) => Boolean(req.user),
23
+ create: ({ req }) => Boolean(req.user),
24
+ update: ({ req }) => Boolean(req.user),
25
+ delete: ({ req }) => Boolean(req.user),
26
+ },
27
+ fields: [
28
+ {
29
+ name: 'label',
30
+ type: 'text',
31
+ required: true,
32
+ admin: {
33
+ description: 'Display label for the prompt (e.g., "Landing page")',
34
+ },
35
+ },
36
+ {
37
+ name: 'prompt',
38
+ type: 'textarea',
39
+ required: true,
40
+ admin: {
41
+ description: 'The actual prompt text sent to the AI',
42
+ rows: 4,
43
+ },
44
+ },
45
+ {
46
+ name: 'category',
47
+ type: 'text',
48
+ admin: {
49
+ description: 'Optional category for grouping prompts (e.g., "Marketing", "Product")',
50
+ },
51
+ },
52
+ {
53
+ name: 'order',
54
+ type: 'number',
55
+ defaultValue: 0,
56
+ admin: {
57
+ description: 'Display order (lower numbers appear first)',
58
+ },
59
+ },
60
+ ],
61
+ timestamps: true,
62
+ };
63
+ //# sourceMappingURL=AiPrompts.js.map