@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.
- package/README.md +331 -16
- package/dist/admin/PuckEditorView.d.ts +1 -1
- package/dist/admin/PuckEditorView.d.ts.map +1 -1
- package/dist/ai/collections/AiContext.d.ts +16 -0
- package/dist/ai/collections/AiContext.d.ts.map +1 -0
- package/dist/ai/collections/AiContext.js +87 -0
- package/dist/ai/collections/AiContext.js.map +1 -0
- package/dist/ai/collections/AiPrompts.d.ts +10 -0
- package/dist/ai/collections/AiPrompts.d.ts.map +1 -0
- package/dist/ai/collections/AiPrompts.js +63 -0
- package/dist/ai/collections/AiPrompts.js.map +1 -0
- package/dist/ai/createAiApiRoutes.d.ts +40 -0
- package/dist/ai/createAiApiRoutes.d.ts.map +1 -0
- package/dist/ai/createAiApiRoutes.js +106 -0
- package/dist/ai/createAiApiRoutes.js.map +1 -0
- package/dist/ai/createAiGenerate.d.ts +65 -0
- package/dist/ai/createAiGenerate.d.ts.map +1 -0
- package/dist/ai/createAiGenerate.js +106 -0
- package/dist/ai/createAiGenerate.js.map +1 -0
- package/dist/ai/createAiPlugin.d.ts +39 -0
- package/dist/ai/createAiPlugin.d.ts.map +1 -0
- package/dist/ai/createAiPlugin.js +61 -0
- package/dist/ai/createAiPlugin.js.map +1 -0
- package/dist/ai/hooks/useAiContext.d.ts +63 -0
- package/dist/ai/hooks/useAiContext.d.ts.map +1 -0
- package/dist/ai/hooks/useAiContext.js +146 -0
- package/dist/ai/hooks/useAiContext.js.map +1 -0
- package/dist/ai/hooks/useAiPrompts.d.ts +25 -0
- package/dist/ai/hooks/useAiPrompts.d.ts.map +1 -0
- package/dist/ai/hooks/useAiPrompts.js +74 -0
- package/dist/ai/hooks/useAiPrompts.js.map +1 -0
- package/dist/ai/index.d.ts +51 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +69 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/plugins/ContextEditorPanel.d.ts +9 -0
- package/dist/ai/plugins/ContextEditorPanel.d.ts.map +1 -0
- package/dist/ai/plugins/ContextEditorPanel.js +399 -0
- package/dist/ai/plugins/ContextEditorPanel.js.map +1 -0
- package/dist/ai/plugins/PromptEditorPanel.d.ts +9 -0
- package/dist/ai/plugins/PromptEditorPanel.d.ts.map +1 -0
- package/dist/ai/plugins/PromptEditorPanel.js +270 -0
- package/dist/ai/plugins/PromptEditorPanel.js.map +1 -0
- package/dist/ai/plugins/contextEditorPlugin.d.ts +30 -0
- package/dist/ai/plugins/contextEditorPlugin.d.ts.map +1 -0
- package/dist/ai/plugins/contextEditorPlugin.js +40 -0
- package/dist/ai/plugins/contextEditorPlugin.js.map +1 -0
- package/dist/ai/plugins/promptApiRoutes.d.ts +68 -0
- package/dist/ai/plugins/promptApiRoutes.d.ts.map +1 -0
- package/dist/ai/plugins/promptApiRoutes.js +181 -0
- package/dist/ai/plugins/promptApiRoutes.js.map +1 -0
- package/dist/ai/plugins/promptEditorPlugin.d.ts +29 -0
- package/dist/ai/plugins/promptEditorPlugin.d.ts.map +1 -0
- package/dist/ai/plugins/promptEditorPlugin.js +39 -0
- package/dist/ai/plugins/promptEditorPlugin.js.map +1 -0
- package/dist/ai/presets/componentAiDefaults.d.ts +40 -0
- package/dist/ai/presets/componentAiDefaults.d.ts.map +1 -0
- package/dist/ai/presets/componentAiDefaults.js +239 -0
- package/dist/ai/presets/componentAiDefaults.js.map +1 -0
- package/dist/ai/presets/index.d.ts +94 -0
- package/dist/ai/presets/index.d.ts.map +1 -0
- package/dist/ai/presets/index.js +110 -0
- package/dist/ai/presets/index.js.map +1 -0
- package/dist/ai/presets/instructions/interactive.d.ts +15 -0
- package/dist/ai/presets/instructions/interactive.d.ts.map +1 -0
- package/dist/ai/presets/instructions/interactive.js +334 -0
- package/dist/ai/presets/instructions/interactive.js.map +1 -0
- package/dist/ai/presets/instructions/layout.d.ts +16 -0
- package/dist/ai/presets/instructions/layout.d.ts.map +1 -0
- package/dist/ai/presets/instructions/layout.js +486 -0
- package/dist/ai/presets/instructions/layout.js.map +1 -0
- package/dist/ai/presets/instructions/media.d.ts +15 -0
- package/dist/ai/presets/instructions/media.d.ts.map +1 -0
- package/dist/ai/presets/instructions/media.js +136 -0
- package/dist/ai/presets/instructions/media.js.map +1 -0
- package/dist/ai/presets/instructions/pagePatterns.d.ts +20 -0
- package/dist/ai/presets/instructions/pagePatterns.d.ts.map +1 -0
- package/dist/ai/presets/instructions/pagePatterns.js +290 -0
- package/dist/ai/presets/instructions/pagePatterns.js.map +1 -0
- package/dist/ai/presets/instructions/schemas.d.ts +1247 -0
- package/dist/ai/presets/instructions/schemas.d.ts.map +1 -0
- package/dist/ai/presets/instructions/schemas.js +240 -0
- package/dist/ai/presets/instructions/schemas.js.map +1 -0
- package/dist/ai/presets/instructions/typography.d.ts +16 -0
- package/dist/ai/presets/instructions/typography.d.ts.map +1 -0
- package/dist/ai/presets/instructions/typography.js +192 -0
- package/dist/ai/presets/instructions/typography.js.map +1 -0
- package/dist/ai/tools/index.d.ts +116 -0
- package/dist/ai/tools/index.d.ts.map +1 -0
- package/dist/ai/tools/index.js +214 -0
- package/dist/ai/tools/index.js.map +1 -0
- package/dist/ai/types.d.ts +507 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +2 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/ai/utils/injectAiConfig.d.ts +67 -0
- package/dist/ai/utils/injectAiConfig.d.ts.map +1 -0
- package/dist/ai/utils/injectAiConfig.js +216 -0
- package/dist/ai/utils/injectAiConfig.js.map +1 -0
- package/dist/api/createPuckApiRoutesWithId.d.ts.map +1 -1
- package/dist/api/createPuckApiRoutesWithId.js +12 -5
- package/dist/api/createPuckApiRoutesWithId.js.map +1 -1
- package/dist/api/types.d.ts +1 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/components/exports.d.ts +1 -1
- package/dist/components/exports.d.ts.map +1 -1
- package/dist/components/exports.js +1 -1
- package/dist/components/exports.js.map +1 -1
- package/dist/components/interactive/Accordion.d.ts +1 -1
- package/dist/components/interactive/Accordion.d.ts.map +1 -1
- package/dist/components/interactive/Accordion.js +4 -4
- package/dist/components/interactive/Accordion.js.map +1 -1
- package/dist/components/interactive/Accordion.server.d.ts +1 -1
- package/dist/components/interactive/Accordion.server.d.ts.map +1 -1
- package/dist/components/interactive/Button.d.ts +1 -1
- package/dist/components/interactive/Button.d.ts.map +1 -1
- package/dist/components/interactive/Button.server.d.ts +2 -3
- package/dist/components/interactive/Button.server.d.ts.map +1 -1
- package/dist/components/interactive/Button.server.js +1 -2
- package/dist/components/interactive/Button.server.js.map +1 -1
- package/dist/components/interactive/Card.d.ts +1 -1
- package/dist/components/interactive/Card.d.ts.map +1 -1
- package/dist/components/interactive/Card.server.d.ts +1 -1
- package/dist/components/interactive/Card.server.d.ts.map +1 -1
- package/dist/components/interactive/Divider.d.ts +1 -1
- package/dist/components/interactive/Divider.d.ts.map +1 -1
- package/dist/components/interactive/Divider.server.d.ts +1 -1
- package/dist/components/interactive/Divider.server.d.ts.map +1 -1
- package/dist/components/layout/Container.d.ts +3 -1
- package/dist/components/layout/Container.d.ts.map +1 -1
- package/dist/components/layout/Container.js +16 -2
- package/dist/components/layout/Container.js.map +1 -1
- package/dist/components/layout/Container.server.d.ts +3 -1
- package/dist/components/layout/Container.server.d.ts.map +1 -1
- package/dist/components/layout/Container.server.js +5 -2
- package/dist/components/layout/Container.server.js.map +1 -1
- package/dist/components/layout/Flex.d.ts +3 -1
- package/dist/components/layout/Flex.d.ts.map +1 -1
- package/dist/components/layout/Flex.js +18 -2
- package/dist/components/layout/Flex.js.map +1 -1
- package/dist/components/layout/Flex.server.d.ts +3 -1
- package/dist/components/layout/Flex.server.d.ts.map +1 -1
- package/dist/components/layout/Flex.server.js +5 -2
- package/dist/components/layout/Flex.server.js.map +1 -1
- package/dist/components/layout/Grid.d.ts +3 -1
- package/dist/components/layout/Grid.d.ts.map +1 -1
- package/dist/components/layout/Grid.js +15 -2
- package/dist/components/layout/Grid.js.map +1 -1
- package/dist/components/layout/Grid.server.d.ts +3 -1
- package/dist/components/layout/Grid.server.d.ts.map +1 -1
- package/dist/components/layout/Grid.server.js +5 -2
- package/dist/components/layout/Grid.server.js.map +1 -1
- package/dist/components/layout/Section.d.ts +3 -1
- package/dist/components/layout/Section.d.ts.map +1 -1
- package/dist/components/layout/Section.js +32 -5
- package/dist/components/layout/Section.js.map +1 -1
- package/dist/components/layout/Section.server.d.ts +3 -1
- package/dist/components/layout/Section.server.d.ts.map +1 -1
- package/dist/components/layout/Section.server.js +16 -4
- package/dist/components/layout/Section.server.js.map +1 -1
- package/dist/components/layout/Spacer.d.ts +1 -1
- package/dist/components/layout/Spacer.d.ts.map +1 -1
- package/dist/components/layout/Spacer.server.d.ts +1 -1
- package/dist/components/layout/Spacer.server.d.ts.map +1 -1
- package/dist/components/layout/Template.d.ts +1 -1
- package/dist/components/layout/Template.d.ts.map +1 -1
- package/dist/components/layout/Template.server.d.ts +1 -1
- package/dist/components/layout/Template.server.d.ts.map +1 -1
- package/dist/components/media/Image.d.ts +1 -1
- package/dist/components/media/Image.d.ts.map +1 -1
- package/dist/components/media/Image.server.d.ts +1 -1
- package/dist/components/media/Image.server.d.ts.map +1 -1
- package/dist/components/typography/Heading.d.ts +1 -1
- package/dist/components/typography/Heading.d.ts.map +1 -1
- package/dist/components/typography/Heading.server.d.ts +1 -1
- package/dist/components/typography/Heading.server.d.ts.map +1 -1
- package/dist/components/typography/RichText.editor.d.ts +15 -2
- package/dist/components/typography/RichText.editor.d.ts.map +1 -1
- package/dist/components/typography/RichText.editor.js +18 -11
- package/dist/components/typography/RichText.editor.js.map +1 -1
- package/dist/components/typography/RichText.server.d.ts +3 -2
- package/dist/components/typography/RichText.server.d.ts.map +1 -1
- package/dist/components/typography/RichText.server.js +10 -5
- package/dist/components/typography/RichText.server.js.map +1 -1
- package/dist/components/typography/Text.d.ts +1 -1
- package/dist/components/typography/Text.d.ts.map +1 -1
- package/dist/components/typography/Text.server.d.ts +1 -1
- package/dist/components/typography/Text.server.d.ts.map +1 -1
- package/dist/components/typography/index.d.ts +1 -1
- package/dist/components/typography/index.d.ts.map +1 -1
- package/dist/components/typography/index.js +1 -1
- package/dist/components/typography/index.js.map +1 -1
- package/dist/config/config.editor.d.ts +4 -4
- package/dist/config/config.editor.d.ts.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/merge.d.ts +1 -1
- package/dist/config/merge.d.ts.map +1 -1
- package/dist/config/presets.d.ts +15 -15
- package/dist/config/presets.d.ts.map +1 -1
- package/dist/editor/PuckEditor.d.ts +88 -2
- package/dist/editor/PuckEditor.d.ts.map +1 -1
- package/dist/editor/PuckEditor.js +41 -13
- package/dist/editor/PuckEditor.js.map +1 -1
- package/dist/editor/PuckEditorImpl.client.d.ts +49 -4
- package/dist/editor/PuckEditorImpl.client.d.ts.map +1 -1
- package/dist/editor/PuckEditorImpl.client.js +191 -14
- package/dist/editor/PuckEditorImpl.client.js.map +1 -1
- package/dist/editor/ai-plugin-overrides.css +20 -0
- package/dist/editor/components/HeaderActions.d.ts +7 -2
- package/dist/editor/components/HeaderActions.d.ts.map +1 -1
- package/dist/editor/components/HeaderActions.js +16 -3
- package/dist/editor/components/HeaderActions.js.map +1 -1
- package/dist/editor/components/IframeWrapper.d.ts +13 -0
- package/dist/editor/components/IframeWrapper.d.ts.map +1 -1
- package/dist/editor/components/IframeWrapper.js +60 -4
- package/dist/editor/components/IframeWrapper.js.map +1 -1
- package/dist/editor/components/PreviewModal.d.ts +9 -1
- package/dist/editor/components/PreviewModal.d.ts.map +1 -1
- package/dist/editor/components/PreviewModal.js +36 -1
- package/dist/editor/components/PreviewModal.js.map +1 -1
- package/dist/editor/index.d.ts +4 -0
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/index.js +4 -0
- package/dist/editor/index.js.map +1 -1
- package/dist/editor/plugins/VersionHistoryPanel.d.ts +43 -0
- package/dist/editor/plugins/VersionHistoryPanel.d.ts.map +1 -0
- package/dist/editor/plugins/VersionHistoryPanel.js +303 -0
- package/dist/editor/plugins/VersionHistoryPanel.js.map +1 -0
- package/dist/editor/plugins/index.d.ts +6 -3
- package/dist/editor/plugins/index.d.ts.map +1 -1
- package/dist/editor/plugins/index.js +7 -3
- package/dist/editor/plugins/index.js.map +1 -1
- package/dist/editor/plugins/versionHistoryPlugin.d.ts +37 -0
- package/dist/editor/plugins/versionHistoryPlugin.d.ts.map +1 -0
- package/dist/editor/plugins/versionHistoryPlugin.js +36 -0
- package/dist/editor/plugins/versionHistoryPlugin.js.map +1 -0
- package/dist/editor/utils/detectPageTree.d.ts +1 -1
- package/dist/editor/utils/detectPageTree.d.ts.map +1 -1
- package/dist/editor/utils/injectPageTreeFields.d.ts +1 -1
- package/dist/editor/utils/injectPageTreeFields.d.ts.map +1 -1
- package/dist/endpoints/ai.d.ts +36 -0
- package/dist/endpoints/ai.d.ts.map +1 -0
- package/dist/endpoints/ai.js +315 -0
- package/dist/endpoints/ai.js.map +1 -0
- package/dist/endpoints/context.d.ts +30 -0
- package/dist/endpoints/context.d.ts.map +1 -0
- package/dist/endpoints/context.js +123 -0
- package/dist/endpoints/context.js.map +1 -0
- package/dist/endpoints/prompts.d.ts +28 -0
- package/dist/endpoints/prompts.d.ts.map +1 -0
- package/dist/endpoints/prompts.js +118 -0
- package/dist/endpoints/prompts.js.map +1 -0
- package/dist/endpoints/styles.d.ts +19 -0
- package/dist/endpoints/styles.d.ts.map +1 -0
- package/dist/endpoints/styles.js +116 -0
- package/dist/endpoints/styles.js.map +1 -0
- package/dist/fields/AlignmentField.d.ts +1 -1
- package/dist/fields/AlignmentField.d.ts.map +1 -1
- package/dist/fields/AlignmentField.js +1 -0
- package/dist/fields/AlignmentField.js.map +1 -1
- package/dist/fields/AnimationField.d.ts +1 -1
- package/dist/fields/AnimationField.d.ts.map +1 -1
- package/dist/fields/BackgroundField.d.ts +1 -1
- package/dist/fields/BackgroundField.d.ts.map +1 -1
- package/dist/fields/BackgroundField.js +9 -4
- package/dist/fields/BackgroundField.js.map +1 -1
- package/dist/fields/BorderField.d.ts +1 -1
- package/dist/fields/BorderField.d.ts.map +1 -1
- package/dist/fields/BorderField.js +1 -0
- package/dist/fields/BorderField.js.map +1 -1
- package/dist/fields/ColorPickerField.d.ts +1 -1
- package/dist/fields/ColorPickerField.d.ts.map +1 -1
- package/dist/fields/ColorPickerField.js +4 -2
- package/dist/fields/ColorPickerField.js.map +1 -1
- package/dist/fields/ContentAlignmentField.d.ts +66 -0
- package/dist/fields/ContentAlignmentField.d.ts.map +1 -0
- package/dist/fields/ContentAlignmentField.js +255 -0
- package/dist/fields/ContentAlignmentField.js.map +1 -0
- package/dist/fields/DimensionsField.d.ts +1 -1
- package/dist/fields/DimensionsField.d.ts.map +1 -1
- package/dist/fields/DimensionsField.js +8 -2
- package/dist/fields/DimensionsField.js.map +1 -1
- package/dist/fields/FlexAlignmentField.d.ts +1 -1
- package/dist/fields/FlexAlignmentField.d.ts.map +1 -1
- package/dist/fields/FolderPickerField.d.ts +1 -1
- package/dist/fields/FolderPickerField.d.ts.map +1 -1
- package/dist/fields/GradientEditor.d.ts.map +1 -1
- package/dist/fields/GradientEditor.js +3 -0
- package/dist/fields/GradientEditor.js.map +1 -1
- package/dist/fields/LockedField.d.ts +1 -1
- package/dist/fields/LockedField.d.ts.map +1 -1
- package/dist/fields/MarginField.d.ts +1 -1
- package/dist/fields/MarginField.d.ts.map +1 -1
- package/dist/fields/MediaField.d.ts +1 -1
- package/dist/fields/MediaField.d.ts.map +1 -1
- package/dist/fields/MediaField.js +3 -2
- package/dist/fields/MediaField.js.map +1 -1
- package/dist/fields/PaddingField.d.ts +1 -1
- package/dist/fields/PaddingField.d.ts.map +1 -1
- package/dist/fields/PageSegmentField.d.ts +1 -1
- package/dist/fields/PageSegmentField.d.ts.map +1 -1
- package/dist/fields/ResetField.d.ts +1 -1
- package/dist/fields/ResetField.d.ts.map +1 -1
- package/dist/fields/ResetField.js +1 -1
- package/dist/fields/ResetField.js.map +1 -1
- package/dist/fields/ResponsiveField.d.ts +1 -1
- package/dist/fields/ResponsiveField.d.ts.map +1 -1
- package/dist/fields/ResponsiveField.js +5 -2
- package/dist/fields/ResponsiveField.js.map +1 -1
- package/dist/fields/ResponsiveVisibilityField.d.ts +1 -1
- package/dist/fields/ResponsiveVisibilityField.d.ts.map +1 -1
- package/dist/fields/ResponsiveVisibilityField.js +4 -3
- package/dist/fields/ResponsiveVisibilityField.js.map +1 -1
- package/dist/fields/SizeField.d.ts +3 -25
- package/dist/fields/SizeField.d.ts.map +1 -1
- package/dist/fields/SizeField.js +8 -34
- package/dist/fields/SizeField.js.map +1 -1
- package/dist/fields/SlugPreviewField.d.ts +1 -1
- package/dist/fields/SlugPreviewField.d.ts.map +1 -1
- package/dist/fields/TemplateField.d.ts +1 -1
- package/dist/fields/TemplateField.d.ts.map +1 -1
- package/dist/fields/TemplateField.js +1 -1
- package/dist/fields/TemplateField.js.map +1 -1
- package/dist/fields/TransformField.d.ts +1 -1
- package/dist/fields/TransformField.d.ts.map +1 -1
- package/dist/fields/TransformField.js +2 -0
- package/dist/fields/TransformField.js.map +1 -1
- package/dist/fields/VerticalAlignmentField.d.ts +1 -1
- package/dist/fields/VerticalAlignmentField.d.ts.map +1 -1
- package/dist/fields/WidthField.d.ts +1 -1
- package/dist/fields/WidthField.d.ts.map +1 -1
- package/dist/fields/index.d.ts +8 -36
- package/dist/fields/index.d.ts.map +1 -1
- package/dist/fields/index.js +20 -78
- package/dist/fields/index.js.map +1 -1
- package/dist/fields/richtext/controls/ColorPickerControl.d.ts +16 -0
- package/dist/fields/richtext/controls/ColorPickerControl.d.ts.map +1 -0
- package/dist/fields/richtext/controls/ColorPickerControl.js +116 -0
- package/dist/fields/richtext/controls/ColorPickerControl.js.map +1 -0
- package/dist/fields/richtext/controls/DropdownPortal.d.ts +17 -0
- package/dist/fields/richtext/controls/DropdownPortal.d.ts.map +1 -0
- package/dist/fields/richtext/controls/DropdownPortal.js +90 -0
- package/dist/fields/richtext/controls/DropdownPortal.js.map +1 -0
- package/dist/fields/richtext/controls/FontSizeControl.d.ts +8 -0
- package/dist/fields/richtext/controls/FontSizeControl.d.ts.map +1 -0
- package/dist/fields/richtext/controls/FontSizeControl.js +62 -0
- package/dist/fields/richtext/controls/FontSizeControl.js.map +1 -0
- package/dist/fields/richtext/controls/HighlightControl.d.ts +9 -0
- package/dist/fields/richtext/controls/HighlightControl.d.ts.map +1 -0
- package/dist/fields/richtext/controls/HighlightControl.js +44 -0
- package/dist/fields/richtext/controls/HighlightControl.js.map +1 -0
- package/dist/fields/richtext/controls/index.d.ts +11 -0
- package/dist/fields/richtext/controls/index.d.ts.map +1 -0
- package/dist/fields/richtext/controls/index.js +16 -0
- package/dist/fields/richtext/controls/index.js.map +1 -0
- package/dist/fields/richtext/controls/shared.d.ts +97 -0
- package/dist/fields/richtext/controls/shared.d.ts.map +1 -0
- package/dist/fields/richtext/controls/shared.js +344 -0
- package/dist/fields/richtext/controls/shared.js.map +1 -0
- package/dist/fields/richtext/createRichTextField.d.ts +165 -0
- package/dist/fields/richtext/createRichTextField.d.ts.map +1 -0
- package/dist/fields/richtext/createRichTextField.js +139 -0
- package/dist/fields/richtext/createRichTextField.js.map +1 -0
- package/dist/fields/richtext/extensions/FontSize.d.ts +23 -0
- package/dist/fields/richtext/extensions/FontSize.d.ts.map +1 -0
- package/dist/fields/richtext/extensions/FontSize.js +47 -0
- package/dist/fields/richtext/extensions/FontSize.js.map +1 -0
- package/dist/fields/richtext/extensions/index.d.ts +5 -0
- package/dist/fields/richtext/extensions/index.d.ts.map +1 -0
- package/dist/fields/richtext/extensions/index.js +5 -0
- package/dist/fields/richtext/extensions/index.js.map +1 -0
- package/dist/fields/richtext/index.d.ts +14 -0
- package/dist/fields/richtext/index.d.ts.map +1 -0
- package/dist/fields/richtext/index.js +19 -0
- package/dist/fields/richtext/index.js.map +1 -0
- package/dist/fields/richtext/richtext-menu.css +50 -0
- package/dist/fields/shared.d.ts +27 -1
- package/dist/fields/shared.d.ts.map +1 -1
- package/dist/fields/shared.js +34 -0
- package/dist/fields/shared.js.map +1 -1
- package/dist/layouts/types.d.ts +30 -0
- package/dist/layouts/types.d.ts.map +1 -1
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +111 -1
- package/dist/plugin/index.js.map +1 -1
- package/dist/render/HybridPageRenderer.d.ts +1 -1
- package/dist/render/HybridPageRenderer.d.ts.map +1 -1
- package/dist/render/PageRenderer.d.ts +1 -1
- package/dist/render/PageRenderer.d.ts.map +1 -1
- package/dist/render/PageRenderer.js +1 -1
- package/dist/render/PageRenderer.js.map +1 -1
- package/dist/render/PuckEditor.client.d.ts +2 -2
- package/dist/render/PuckEditor.client.d.ts.map +1 -1
- package/dist/render/PuckEditor.client.js +2 -2
- package/dist/render/PuckEditor.client.js.map +1 -1
- package/dist/types/index.d.ts +36 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/views/PuckConfigContext.d.ts +56 -2
- package/dist/views/PuckConfigContext.d.ts.map +1 -1
- package/dist/views/PuckConfigContext.js +6 -3
- package/dist/views/PuckConfigContext.js.map +1 -1
- package/dist/views/PuckEditorView.d.ts.map +1 -1
- package/dist/views/PuckEditorView.js +23 -1
- package/dist/views/PuckEditorView.js.map +1 -1
- package/package.json +34 -10
- package/dist/components/typography/RichText.d.ts +0 -20
- package/dist/components/typography/RichText.d.ts.map +0 -1
- package/dist/components/typography/RichText.js +0 -73
- package/dist/components/typography/RichText.js.map +0 -1
- package/dist/fields/TiptapField.d.ts +0 -40
- package/dist/fields/TiptapField.d.ts.map +0 -1
- package/dist/fields/TiptapField.js +0 -857
- package/dist/fields/TiptapField.js.map +0 -1
- package/dist/fields/TiptapModal.d.ts +0 -10
- package/dist/fields/TiptapModal.d.ts.map +0 -1
- package/dist/fields/TiptapModal.js +0 -114
- package/dist/fields/TiptapModal.js.map +0 -1
- package/dist/fields/TiptapModalField.d.ts +0 -23
- package/dist/fields/TiptapModalField.d.ts.map +0 -1
- package/dist/fields/TiptapModalField.js +0 -55
- package/dist/fields/TiptapModalField.js.map +0 -1
- package/dist/fields/richtext-output.css +0 -219
- 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
|
-
| `@
|
|
32
|
-
| `payload` | >= 3.
|
|
33
|
-
| `@payloadcms/next` | >= 3.
|
|
34
|
-
| `next` | >=
|
|
35
|
-
| `react` | >=
|
|
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 @
|
|
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:
|
|
123
|
-
|
|
124
|
-
|
|
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** |
|
|
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
|
-
| **
|
|
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
|
|
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 '@
|
|
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
|
-
| `
|
|
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 +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,
|
|
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
|