@delmaredigital/payload-puck 0.6.12 → 0.6.13
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 +50 -1
- package/dist/admin/EditWithPuckButton.d.ts +1 -1
- package/dist/admin/EditWithPuckButton.d.ts.map +1 -1
- package/dist/admin/EditWithPuckButton.js +65 -25
- package/dist/admin/EditWithPuckButton.js.map +1 -1
- package/dist/admin/EditWithPuckCell.js +43 -13
- package/dist/admin/EditWithPuckCell.js.map +1 -1
- package/dist/admin/PuckEditorView.d.ts +1 -1
- package/dist/admin/PuckEditorView.d.ts.map +1 -1
- package/dist/admin/PuckEditorView.js +118 -32
- package/dist/admin/PuckEditorView.js.map +1 -1
- package/dist/admin/client.d.ts +2 -2
- package/dist/admin/client.d.ts.map +1 -1
- package/dist/admin/client.js +4 -4
- package/dist/admin/client.js.map +1 -1
- package/dist/admin/generateAdminComponents.js +7 -7
- package/dist/admin/generateAdminComponents.js.map +1 -1
- package/dist/admin/index.d.ts +5 -5
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +3 -2
- package/dist/admin/index.js.map +1 -1
- package/dist/ai/collections/AiContext.js +56 -29
- package/dist/ai/collections/AiContext.js.map +1 -1
- package/dist/ai/collections/AiPrompts.js +24 -19
- package/dist/ai/collections/AiPrompts.js.map +1 -1
- package/dist/ai/createAiApiRoutes.js +28 -19
- package/dist/ai/createAiApiRoutes.js.map +1 -1
- package/dist/ai/createAiGenerate.js +7 -8
- package/dist/ai/createAiGenerate.js.map +1 -1
- package/dist/ai/createAiPlugin.js +7 -9
- package/dist/ai/createAiPlugin.js.map +1 -1
- package/dist/ai/hooks/useAiContext.js +50 -39
- package/dist/ai/hooks/useAiContext.js.map +1 -1
- package/dist/ai/hooks/useAiPrompts.js +33 -25
- package/dist/ai/hooks/useAiPrompts.js.map +1 -1
- package/dist/ai/index.js +9 -10
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/plugins/ContextEditorPanel.d.ts +1 -1
- package/dist/ai/plugins/ContextEditorPanel.d.ts.map +1 -1
- package/dist/ai/plugins/ContextEditorPanel.js +399 -107
- package/dist/ai/plugins/ContextEditorPanel.js.map +1 -1
- package/dist/ai/plugins/PromptEditorPanel.d.ts +1 -1
- package/dist/ai/plugins/PromptEditorPanel.d.ts.map +1 -1
- package/dist/ai/plugins/PromptEditorPanel.js +237 -51
- package/dist/ai/plugins/PromptEditorPanel.js.map +1 -1
- package/dist/ai/plugins/contextEditorPlugin.js +12 -5
- package/dist/ai/plugins/contextEditorPlugin.js.map +1 -1
- package/dist/ai/plugins/promptApiRoutes.js +119 -50
- package/dist/ai/plugins/promptApiRoutes.js.map +1 -1
- package/dist/ai/plugins/promptEditorPlugin.js +12 -5
- package/dist/ai/plugins/promptEditorPlugin.js.map +1 -1
- package/dist/ai/presets/componentAiDefaults.js +108 -83
- package/dist/ai/presets/componentAiDefaults.js.map +1 -1
- package/dist/ai/presets/index.js +12 -18
- package/dist/ai/presets/index.js.map +1 -1
- package/dist/ai/presets/instructions/interactive.js +85 -75
- package/dist/ai/presets/instructions/interactive.js.map +1 -1
- package/dist/ai/presets/instructions/layout.js +122 -117
- package/dist/ai/presets/instructions/layout.js.map +1 -1
- package/dist/ai/presets/instructions/media.js +31 -29
- package/dist/ai/presets/instructions/media.js.map +1 -1
- package/dist/ai/presets/instructions/pagePatterns.js +4 -6
- package/dist/ai/presets/instructions/pagePatterns.js.map +1 -1
- package/dist/ai/presets/instructions/schemas.js +495 -137
- package/dist/ai/presets/instructions/schemas.js.map +1 -1
- package/dist/ai/presets/instructions/typography.js +38 -33
- package/dist/ai/presets/instructions/typography.js.map +1 -1
- package/dist/ai/tools/index.js +92 -55
- package/dist/ai/tools/index.js.map +1 -1
- package/dist/ai/types.js +7 -1
- package/dist/ai/types.js.map +1 -1
- package/dist/ai/utils/injectAiConfig.js +33 -40
- package/dist/ai/utils/injectAiConfig.js.map +1 -1
- package/dist/api/createPuckApiRoutes.d.ts +1 -1
- package/dist/api/createPuckApiRoutes.d.ts.map +1 -1
- package/dist/api/createPuckApiRoutes.js +123 -65
- package/dist/api/createPuckApiRoutes.js.map +1 -1
- package/dist/api/createPuckApiRoutesVersions.d.ts +1 -1
- package/dist/api/createPuckApiRoutesVersions.d.ts.map +1 -1
- package/dist/api/createPuckApiRoutesVersions.js +88 -37
- package/dist/api/createPuckApiRoutesVersions.js.map +1 -1
- package/dist/api/createPuckApiRoutesWithId.d.ts +1 -1
- package/dist/api/createPuckApiRoutesWithId.d.ts.map +1 -1
- package/dist/api/createPuckApiRoutesWithId.js +166 -72
- package/dist/api/createPuckApiRoutesWithId.js.map +1 -1
- package/dist/api/index.d.ts +5 -5
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +6 -6
- package/dist/api/index.js.map +1 -1
- package/dist/api/payload-config.d.js +15 -0
- package/dist/api/payload-config.d.js.map +1 -0
- package/dist/api/types.js +4 -1
- package/dist/api/types.js.map +1 -1
- package/dist/api/utils/mapRootProps.d.ts +1 -1
- package/dist/api/utils/mapRootProps.d.ts.map +1 -1
- package/dist/api/utils/mapRootProps.js +77 -44
- package/dist/api/utils/mapRootProps.js.map +1 -1
- package/dist/collections/Templates.js +24 -20
- package/dist/collections/Templates.js.map +1 -1
- package/dist/components/AccordionClient.d.ts +2 -2
- package/dist/components/AccordionClient.d.ts.map +1 -1
- package/dist/components/AccordionClient.js +81 -22
- package/dist/components/AccordionClient.js.map +1 -1
- package/dist/components/AnimatedWrapper.d.ts +2 -2
- package/dist/components/AnimatedWrapper.d.ts.map +1 -1
- package/dist/components/AnimatedWrapper.js +31 -16
- package/dist/components/AnimatedWrapper.js.map +1 -1
- package/dist/components/exports.js +2 -2
- package/dist/components/exports.js.map +1 -1
- package/dist/components/index.d.ts +5 -5
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +7 -7
- package/dist/components/index.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 +149 -55
- 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/Accordion.server.js +25 -7
- package/dist/components/interactive/Accordion.server.js.map +1 -1
- package/dist/components/interactive/Button.d.ts +3 -3
- package/dist/components/interactive/Button.d.ts.map +1 -1
- package/dist/components/interactive/Button.js +89 -43
- package/dist/components/interactive/Button.js.map +1 -1
- package/dist/components/interactive/Button.server.d.ts +2 -2
- package/dist/components/interactive/Button.server.d.ts.map +1 -1
- package/dist/components/interactive/Button.server.js +40 -20
- package/dist/components/interactive/Button.server.js.map +1 -1
- package/dist/components/interactive/Card.d.ts +3 -3
- package/dist/components/interactive/Card.d.ts.map +1 -1
- package/dist/components/interactive/Card.js +131 -39
- package/dist/components/interactive/Card.js.map +1 -1
- package/dist/components/interactive/Card.server.d.ts +3 -3
- package/dist/components/interactive/Card.server.d.ts.map +1 -1
- package/dist/components/interactive/Card.server.js +72 -11
- package/dist/components/interactive/Card.server.js.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.js +54 -26
- package/dist/components/interactive/Divider.js.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/interactive/Divider.server.js +28 -12
- package/dist/components/interactive/Divider.server.js.map +1 -1
- package/dist/components/interactive/index.d.ts +4 -4
- package/dist/components/interactive/index.d.ts.map +1 -1
- package/dist/components/interactive/index.js +5 -5
- package/dist/components/interactive/index.js.map +1 -1
- package/dist/components/layout/Container.d.ts +1 -1
- package/dist/components/layout/Container.d.ts.map +1 -1
- package/dist/components/layout/Container.js +101 -47
- package/dist/components/layout/Container.js.map +1 -1
- package/dist/components/layout/Container.server.d.ts +1 -1
- package/dist/components/layout/Container.server.d.ts.map +1 -1
- package/dist/components/layout/Container.server.js +67 -19
- package/dist/components/layout/Container.server.js.map +1 -1
- package/dist/components/layout/Flex.d.ts +2 -2
- package/dist/components/layout/Flex.d.ts.map +1 -1
- package/dist/components/layout/Flex.js +124 -55
- package/dist/components/layout/Flex.js.map +1 -1
- package/dist/components/layout/Flex.server.d.ts +1 -1
- package/dist/components/layout/Flex.server.d.ts.map +1 -1
- package/dist/components/layout/Flex.server.js +50 -14
- package/dist/components/layout/Flex.server.js.map +1 -1
- package/dist/components/layout/Grid.d.ts +1 -1
- package/dist/components/layout/Grid.d.ts.map +1 -1
- package/dist/components/layout/Grid.js +93 -44
- package/dist/components/layout/Grid.js.map +1 -1
- package/dist/components/layout/Grid.server.d.ts +1 -1
- package/dist/components/layout/Grid.server.d.ts.map +1 -1
- package/dist/components/layout/Grid.server.js +56 -14
- package/dist/components/layout/Grid.server.js.map +1 -1
- package/dist/components/layout/Section.d.ts +1 -1
- package/dist/components/layout/Section.d.ts.map +1 -1
- package/dist/components/layout/Section.js +147 -64
- package/dist/components/layout/Section.js.map +1 -1
- package/dist/components/layout/Section.server.d.ts +1 -1
- package/dist/components/layout/Section.server.d.ts.map +1 -1
- package/dist/components/layout/Section.server.js +92 -28
- 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.js +80 -30
- package/dist/components/layout/Spacer.js.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/Spacer.server.js +31 -9
- package/dist/components/layout/Spacer.server.js.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.js +58 -30
- package/dist/components/layout/Template.js.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/layout/Template.server.js +43 -11
- package/dist/components/layout/Template.server.js.map +1 -1
- package/dist/components/layout/index.d.ts +8 -8
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +8 -8
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/media/Image.d.ts +3 -3
- package/dist/components/media/Image.d.ts.map +1 -1
- package/dist/components/media/Image.js +122 -39
- package/dist/components/media/Image.js.map +1 -1
- package/dist/components/media/Image.server.d.ts +3 -3
- package/dist/components/media/Image.server.d.ts.map +1 -1
- package/dist/components/media/Image.server.js +76 -13
- package/dist/components/media/Image.server.js.map +1 -1
- package/dist/components/media/index.d.ts +1 -1
- package/dist/components/media/index.d.ts.map +1 -1
- package/dist/components/media/index.js +2 -2
- package/dist/components/media/index.js.map +1 -1
- package/dist/components/typography/Heading.d.ts +2 -2
- package/dist/components/typography/Heading.d.ts.map +1 -1
- package/dist/components/typography/Heading.js +45 -25
- package/dist/components/typography/Heading.js.map +1 -1
- package/dist/components/typography/Heading.server.d.ts +2 -2
- package/dist/components/typography/Heading.server.d.ts.map +1 -1
- package/dist/components/typography/Heading.server.js +16 -10
- package/dist/components/typography/Heading.server.js.map +1 -1
- package/dist/components/typography/RichText.editor.d.ts +1 -1
- package/dist/components/typography/RichText.editor.d.ts.map +1 -1
- package/dist/components/typography/RichText.editor.js +44 -19
- package/dist/components/typography/RichText.editor.js.map +1 -1
- package/dist/components/typography/RichText.server.d.ts +2 -2
- package/dist/components/typography/RichText.server.d.ts.map +1 -1
- package/dist/components/typography/RichText.server.js +33 -14
- package/dist/components/typography/RichText.server.js.map +1 -1
- package/dist/components/typography/Text.d.ts +2 -2
- package/dist/components/typography/Text.d.ts.map +1 -1
- package/dist/components/typography/Text.js +49 -23
- package/dist/components/typography/Text.js.map +1 -1
- package/dist/components/typography/Text.server.d.ts +2 -2
- package/dist/components/typography/Text.server.d.ts.map +1 -1
- package/dist/components/typography/Text.server.js +21 -8
- package/dist/components/typography/Text.server.js.map +1 -1
- package/dist/components/typography/index.d.ts +4 -4
- package/dist/components/typography/index.d.ts.map +1 -1
- package/dist/components/typography/index.js +5 -5
- package/dist/components/typography/index.js.map +1 -1
- package/dist/config/config.editor.d.ts +3 -3
- package/dist/config/config.editor.d.ts.map +1 -1
- package/dist/config/config.editor.js +119 -54
- package/dist/config/config.editor.js.map +1 -1
- package/dist/config/index.d.ts +4 -4
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +62 -35
- package/dist/config/index.js.map +1 -1
- package/dist/config/merge.d.ts +1 -1
- package/dist/config/merge.d.ts.map +1 -1
- package/dist/config/merge.js +23 -26
- package/dist/config/merge.js.map +1 -1
- package/dist/config/presets.d.ts +4 -4
- package/dist/config/presets.js +195 -75
- package/dist/config/presets.js.map +1 -1
- package/dist/config/types.js +6 -2
- package/dist/config/types.js.map +1 -1
- package/dist/editor/PuckEditor.d.ts +4 -4
- package/dist/editor/PuckEditor.d.ts.map +1 -1
- package/dist/editor/PuckEditor.js +162 -70
- package/dist/editor/PuckEditor.js.map +1 -1
- package/dist/editor/PuckEditorImpl.client.d.ts +4 -4
- package/dist/editor/PuckEditorImpl.client.d.ts.map +1 -1
- package/dist/editor/PuckEditorImpl.client.js +304 -152
- package/dist/editor/PuckEditorImpl.client.js.map +1 -1
- package/dist/editor/components/DarkModeStyles.js +11 -12
- package/dist/editor/components/DarkModeStyles.js.map +1 -1
- package/dist/editor/components/HeaderActions.js +308 -64
- package/dist/editor/components/HeaderActions.js.map +1 -1
- package/dist/editor/components/IframeWrapper.d.ts +1 -1
- package/dist/editor/components/IframeWrapper.d.ts.map +1 -1
- package/dist/editor/components/IframeWrapper.js +82 -58
- package/dist/editor/components/IframeWrapper.js.map +1 -1
- package/dist/editor/components/LoadingState.d.ts +1 -1
- package/dist/editor/components/LoadingState.d.ts.map +1 -1
- package/dist/editor/components/LoadingState.js +17 -3
- package/dist/editor/components/LoadingState.js.map +1 -1
- package/dist/editor/components/PreviewModal.js +234 -78
- package/dist/editor/components/PreviewModal.js.map +1 -1
- package/dist/editor/components/PreviewModeToggle.js +43 -15
- package/dist/editor/components/PreviewModeToggle.js.map +1 -1
- package/dist/editor/components/VersionHistory.js +219 -71
- package/dist/editor/components/VersionHistory.js.map +1 -1
- package/dist/editor/hooks/useDarkMode.js +36 -23
- package/dist/editor/hooks/useDarkMode.js.map +1 -1
- package/dist/editor/hooks/useUnsavedChanges.js +8 -8
- package/dist/editor/hooks/useUnsavedChanges.js.map +1 -1
- package/dist/editor/index.js +5 -6
- package/dist/editor/index.js.map +1 -1
- package/dist/editor/plugins/VersionHistoryPanel.js +236 -75
- package/dist/editor/plugins/VersionHistoryPanel.js.map +1 -1
- package/dist/editor/plugins/index.js +4 -4
- package/dist/editor/plugins/index.js.map +1 -1
- package/dist/editor/plugins/versionHistoryPlugin.js +10 -8
- package/dist/editor/plugins/versionHistoryPlugin.js.map +1 -1
- package/dist/editor/utils/detectPageTree.js +5 -5
- package/dist/editor/utils/detectPageTree.js.map +1 -1
- package/dist/editor/utils/index.js +1 -0
- package/dist/editor/utils/index.js.map +1 -1
- package/dist/editor/utils/injectPageTreeFields.js +13 -9
- package/dist/editor/utils/injectPageTreeFields.js.map +1 -1
- package/dist/endpoints/ai.js +58 -34
- package/dist/endpoints/ai.js.map +1 -1
- package/dist/endpoints/context.js +86 -40
- package/dist/endpoints/context.js.map +1 -1
- package/dist/endpoints/index.js +153 -76
- package/dist/endpoints/index.js.map +1 -1
- package/dist/endpoints/postcss.d.js +5 -0
- package/dist/endpoints/postcss.d.js.map +1 -0
- package/dist/endpoints/prompts.js +81 -39
- package/dist/endpoints/prompts.js.map +1 -1
- package/dist/endpoints/styles.js +34 -36
- package/dist/endpoints/styles.js.map +1 -1
- package/dist/exports/client.js +2 -2
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/rsc.js +2 -2
- package/dist/exports/rsc.js.map +1 -1
- package/dist/fields/AlignmentField.d.ts +1 -1
- package/dist/fields/AlignmentField.d.ts.map +1 -1
- package/dist/fields/AlignmentField.js +93 -30
- package/dist/fields/AlignmentField.js.map +1 -1
- package/dist/fields/AnimationField.d.ts +2 -2
- package/dist/fields/AnimationField.d.ts.map +1 -1
- package/dist/fields/AnimationField.js +558 -84
- package/dist/fields/AnimationField.js.map +1 -1
- package/dist/fields/BackgroundField.d.ts +2 -2
- package/dist/fields/BackgroundField.d.ts.map +1 -1
- package/dist/fields/BackgroundField.js +754 -120
- package/dist/fields/BackgroundField.js.map +1 -1
- package/dist/fields/BorderField.d.ts +2 -2
- package/dist/fields/BorderField.d.ts.map +1 -1
- package/dist/fields/BorderField.js +275 -73
- package/dist/fields/BorderField.js.map +1 -1
- package/dist/fields/ColorPickerField.d.ts +2 -2
- package/dist/fields/ColorPickerField.d.ts.map +1 -1
- package/dist/fields/ColorPickerField.js +210 -68
- package/dist/fields/ColorPickerField.js.map +1 -1
- package/dist/fields/ContentAlignmentField.d.ts +1 -1
- package/dist/fields/ContentAlignmentField.d.ts.map +1 -1
- package/dist/fields/ContentAlignmentField.js +161 -75
- package/dist/fields/ContentAlignmentField.js.map +1 -1
- package/dist/fields/DimensionsField.d.ts +2 -2
- package/dist/fields/DimensionsField.d.ts.map +1 -1
- package/dist/fields/DimensionsField.js +575 -146
- package/dist/fields/DimensionsField.js.map +1 -1
- package/dist/fields/FlexAlignmentField.d.ts +2 -2
- package/dist/fields/FlexAlignmentField.d.ts.map +1 -1
- package/dist/fields/FlexAlignmentField.js +189 -51
- package/dist/fields/FlexAlignmentField.js.map +1 -1
- package/dist/fields/FolderPickerField.d.ts +8 -1
- package/dist/fields/FolderPickerField.d.ts.map +1 -1
- package/dist/fields/FolderPickerField.js +288 -75
- package/dist/fields/FolderPickerField.js.map +1 -1
- package/dist/fields/GradientEditor.d.ts +2 -2
- package/dist/fields/GradientEditor.d.ts.map +1 -1
- package/dist/fields/GradientEditor.js +462 -86
- package/dist/fields/GradientEditor.js.map +1 -1
- package/dist/fields/LockedField.d.ts +15 -2
- package/dist/fields/LockedField.d.ts.map +1 -1
- package/dist/fields/LockedField.js +180 -49
- package/dist/fields/LockedField.js.map +1 -1
- package/dist/fields/MarginField.d.ts +2 -2
- package/dist/fields/MarginField.d.ts.map +1 -1
- package/dist/fields/MarginField.js +144 -46
- package/dist/fields/MarginField.js.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 +688 -186
- package/dist/fields/MediaField.js.map +1 -1
- package/dist/fields/PaddingField.d.ts +2 -2
- package/dist/fields/PaddingField.d.ts.map +1 -1
- package/dist/fields/PaddingField.js +144 -46
- package/dist/fields/PaddingField.js.map +1 -1
- package/dist/fields/PageSegmentField.d.ts +15 -2
- package/dist/fields/PageSegmentField.d.ts.map +1 -1
- package/dist/fields/PageSegmentField.js +156 -54
- package/dist/fields/PageSegmentField.js.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 +59 -31
- 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 +233 -90
- package/dist/fields/ResponsiveField.js.map +1 -1
- package/dist/fields/ResponsiveVisibilityField.d.ts +2 -2
- package/dist/fields/ResponsiveVisibilityField.d.ts.map +1 -1
- package/dist/fields/ResponsiveVisibilityField.js +119 -36
- package/dist/fields/ResponsiveVisibilityField.js.map +1 -1
- package/dist/fields/SizeField.d.ts +3 -3
- package/dist/fields/SizeField.d.ts.map +1 -1
- package/dist/fields/SizeField.js +226 -52
- package/dist/fields/SizeField.js.map +1 -1
- package/dist/fields/SlugPreviewField.d.ts +8 -1
- package/dist/fields/SlugPreviewField.d.ts.map +1 -1
- package/dist/fields/SlugPreviewField.js +65 -16
- package/dist/fields/SlugPreviewField.js.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 +362 -120
- package/dist/fields/TemplateField.js.map +1 -1
- package/dist/fields/TransformField.d.ts +2 -2
- package/dist/fields/TransformField.d.ts.map +1 -1
- package/dist/fields/TransformField.js +517 -81
- 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/VerticalAlignmentField.js +93 -30
- package/dist/fields/VerticalAlignmentField.js.map +1 -1
- package/dist/fields/WidthField.d.ts +2 -2
- package/dist/fields/WidthField.d.ts.map +1 -1
- package/dist/fields/WidthField.js +278 -81
- package/dist/fields/WidthField.js.map +1 -1
- package/dist/fields/index.d.ts +41 -41
- package/dist/fields/index.d.ts.map +1 -1
- package/dist/fields/index.js +37 -43
- package/dist/fields/index.js.map +1 -1
- package/dist/fields/richtext/controls/ColorPickerControl.d.ts +13 -2
- package/dist/fields/richtext/controls/ColorPickerControl.d.ts.map +1 -1
- package/dist/fields/richtext/controls/ColorPickerControl.js +212 -47
- package/dist/fields/richtext/controls/ColorPickerControl.js.map +1 -1
- package/dist/fields/richtext/controls/DropdownPortal.d.ts +2 -2
- package/dist/fields/richtext/controls/DropdownPortal.d.ts.map +1 -1
- package/dist/fields/richtext/controls/DropdownPortal.js +36 -4
- package/dist/fields/richtext/controls/DropdownPortal.js.map +1 -1
- package/dist/fields/richtext/controls/FontSizeControl.d.ts +9 -1
- package/dist/fields/richtext/controls/FontSizeControl.d.ts.map +1 -1
- package/dist/fields/richtext/controls/FontSizeControl.js +109 -24
- package/dist/fields/richtext/controls/FontSizeControl.js.map +1 -1
- package/dist/fields/richtext/controls/HighlightControl.d.ts +12 -1
- package/dist/fields/richtext/controls/HighlightControl.d.ts.map +1 -1
- package/dist/fields/richtext/controls/HighlightControl.js +54 -17
- package/dist/fields/richtext/controls/HighlightControl.js.map +1 -1
- package/dist/fields/richtext/controls/index.d.ts +5 -5
- package/dist/fields/richtext/controls/index.d.ts.map +1 -1
- package/dist/fields/richtext/controls/index.js +8 -11
- package/dist/fields/richtext/controls/index.js.map +1 -1
- package/dist/fields/richtext/controls/shared.js +108 -63
- package/dist/fields/richtext/controls/shared.js.map +1 -1
- package/dist/fields/richtext/createRichTextField.d.ts +18 -4
- package/dist/fields/richtext/createRichTextField.d.ts.map +1 -1
- package/dist/fields/richtext/createRichTextField.js +113 -26
- package/dist/fields/richtext/createRichTextField.js.map +1 -1
- package/dist/fields/richtext/extensions/FontSize.js +26 -20
- package/dist/fields/richtext/extensions/FontSize.js.map +1 -1
- package/dist/fields/richtext/extensions/index.d.ts +1 -1
- package/dist/fields/richtext/extensions/index.d.ts.map +1 -1
- package/dist/fields/richtext/extensions/index.js +2 -2
- package/dist/fields/richtext/extensions/index.js.map +1 -1
- package/dist/fields/richtext/index.d.ts +6 -6
- package/dist/fields/richtext/index.d.ts.map +1 -1
- package/dist/fields/richtext/index.js +8 -8
- package/dist/fields/richtext/index.js.map +1 -1
- package/dist/fields/shared.d.ts +1 -1
- package/dist/fields/shared.d.ts.map +1 -1
- package/dist/fields/shared.js +915 -478
- package/dist/fields/shared.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useResponsiveStyles.d.ts +1 -1
- package/dist/hooks/useResponsiveStyles.d.ts.map +1 -1
- package/dist/hooks/useResponsiveStyles.js +36 -32
- package/dist/hooks/useResponsiveStyles.js.map +1 -1
- package/dist/hooks/useScrollAnimation.js +26 -24
- package/dist/hooks/useScrollAnimation.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/layouts/LayoutWrapper.d.ts +3 -3
- package/dist/layouts/LayoutWrapper.d.ts.map +1 -1
- package/dist/layouts/LayoutWrapper.js +115 -51
- package/dist/layouts/LayoutWrapper.js.map +1 -1
- package/dist/layouts/defaults.d.ts +1 -1
- package/dist/layouts/defaults.d.ts.map +1 -1
- package/dist/layouts/defaults.js +23 -31
- package/dist/layouts/defaults.js.map +1 -1
- package/dist/layouts/index.d.ts +4 -4
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +5 -4
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/types.js +4 -2
- package/dist/layouts/types.js.map +1 -1
- package/dist/layouts/utils.d.ts +1 -1
- package/dist/layouts/utils.d.ts.map +1 -1
- package/dist/layouts/utils.js +32 -40
- package/dist/layouts/utils.js.map +1 -1
- package/dist/next/index.js +31 -34
- package/dist/next/index.js.map +1 -1
- package/dist/plugin/collections/Pages.d.ts +2 -2
- package/dist/plugin/collections/Pages.d.ts.map +1 -1
- package/dist/plugin/collections/Pages.js +46 -43
- package/dist/plugin/collections/Pages.js.map +1 -1
- package/dist/plugin/fields/index.d.ts +3 -3
- package/dist/plugin/fields/index.d.ts.map +1 -1
- package/dist/plugin/fields/index.js +100 -78
- package/dist/plugin/fields/index.js.map +1 -1
- package/dist/plugin/fields/types.d.ts +1 -1
- package/dist/plugin/fields/types.d.ts.map +1 -1
- package/dist/plugin/fields/types.js +26 -2
- package/dist/plugin/fields/types.js.map +1 -1
- package/dist/plugin/hooks/index.d.ts +1 -1
- package/dist/plugin/hooks/index.d.ts.map +1 -1
- package/dist/plugin/hooks/index.js +2 -2
- package/dist/plugin/hooks/index.js.map +1 -1
- package/dist/plugin/hooks/isHomepageUnique.js +28 -19
- package/dist/plugin/hooks/isHomepageUnique.js.map +1 -1
- package/dist/plugin/index.d.ts +8 -8
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +190 -188
- package/dist/plugin/index.js.map +1 -1
- package/dist/render/HybridPageRenderer.d.ts +2 -2
- package/dist/render/HybridPageRenderer.d.ts.map +1 -1
- package/dist/render/HybridPageRenderer.js +58 -10
- package/dist/render/HybridPageRenderer.js.map +1 -1
- package/dist/render/PageRenderer.d.ts +2 -2
- package/dist/render/PageRenderer.d.ts.map +1 -1
- package/dist/render/PageRenderer.js +31 -14
- package/dist/render/PageRenderer.js.map +1 -1
- package/dist/render/PuckEditor.client.d.ts +1 -1
- package/dist/render/PuckEditor.client.d.ts.map +1 -1
- package/dist/render/PuckEditor.client.js +33 -16
- package/dist/render/PuckEditor.client.js.map +1 -1
- package/dist/render/index.d.ts +5 -5
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +5 -6
- package/dist/render/index.js.map +1 -1
- package/dist/styles/puck-dark-mode.css +101 -0
- package/dist/theme/context.d.ts +2 -2
- package/dist/theme/context.d.ts.map +1 -1
- package/dist/theme/context.js +21 -18
- package/dist/theme/context.js.map +1 -1
- package/dist/theme/defaults.d.ts +1 -1
- package/dist/theme/defaults.d.ts.map +1 -1
- package/dist/theme/defaults.js +83 -37
- package/dist/theme/defaults.js.map +1 -1
- package/dist/theme/example.d.ts +1 -1
- package/dist/theme/example.d.ts.map +1 -1
- package/dist/theme/example.js +68 -30
- package/dist/theme/example.js.map +1 -1
- package/dist/theme/index.d.ts +5 -5
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +6 -5
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/types.js +6 -2
- package/dist/theme/types.js.map +1 -1
- package/dist/theme/utils.d.ts +1 -1
- package/dist/theme/utils.d.ts.map +1 -1
- package/dist/theme/utils.js +24 -25
- package/dist/theme/utils.js.map +1 -1
- package/dist/types/index.d.ts +6 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +13 -22
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/migration.d.ts +1 -1
- package/dist/utils/migration.d.ts.map +1 -1
- package/dist/utils/migration.js +43 -49
- package/dist/utils/migration.js.map +1 -1
- package/dist/utils/validation.d.ts +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +36 -43
- package/dist/utils/validation.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -1
- package/dist/version.js.map +1 -1
- package/dist/views/PuckConfigContext.d.ts +1 -1
- package/dist/views/PuckConfigContext.d.ts.map +1 -1
- package/dist/views/PuckConfigContext.js +25 -10
- package/dist/views/PuckConfigContext.js.map +1 -1
- package/dist/views/PuckEditorView.d.ts +1 -1
- package/dist/views/PuckEditorView.d.ts.map +1 -1
- package/dist/views/PuckEditorView.js +106 -38
- package/dist/views/PuckEditorView.js.map +1 -1
- package/dist/views/index.js +2 -2
- package/dist/views/index.js.map +1 -1
- package/package.json +62 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../src/ai/presets/instructions/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,gFAAgF;AAChF,cAAc;AACd,gFAAgF;AAEhF,iCAAiC;AACjC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iCAAiC,EAAE;QACvE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,4BAA4B,EAAE;KACjG;IACD,QAAQ,EAAE,CAAC,KAAK,CAAC;CAClB,CAAA;AAED,iDAAiD;AACjD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC;IACjC,WAAW,EAAE,sDAAsD;CACpE,CAAA;AAED,4CAA4C;AAC5C,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,CAAC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EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,4BAA4B,EAAE;QAC/F,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAC7F,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;QACrE,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE;QACnE,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE;QAChG,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,CAAC;YAC1G,WAAW,EAAE,wBAAwB;SACtC;QACD,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,sBAAsB,EAAE;QAClE,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;QACxE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;QACrE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;KACtE;CACF,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/ai/presets/instructions/schemas.ts"],"sourcesContent":["/**\n * Shared JSON Schemas for AI Field Generation\n *\n * Puck Cloud requires JSON schemas for custom fields to know what format to generate.\n * These schemas are used across all component instruction files.\n */\n\n// =============================================================================\n// Basic Types\n// =============================================================================\n\n/** JSON Schema for ColorValue */\nexport const colorSchema = {\n type: 'object',\n properties: {\n hex: { type: 'string', description: 'Hex color code, e.g., \"#3b82f6\"' },\n opacity: { type: 'number', minimum: 0, maximum: 100, description: 'Opacity 0-100, default 100' },\n },\n required: ['hex'],\n}\n\n/** JSON Schema for Alignment (text alignment) */\nexport const alignmentSchema = {\n type: 'string',\n enum: ['left', 'center', 'right'],\n description: \"Text/content alignment: 'left', 'center', or 'right'\",\n}\n\n/** JSON Schema for JustifyContent (flex) */\nexport const justifyContentSchema = {\n type: 'string',\n enum: ['flex-start', 'center', 'flex-end', 'space-between', 'space-around'],\n description: 'Main-axis distribution: flex-start (default), center, flex-end, space-between, space-around',\n}\n\n/** JSON Schema for AlignItems (flex) */\nexport const alignItemsSchema = {\n type: 'string',\n enum: ['flex-start', 'center', 'flex-end', 'stretch'],\n description: 'Cross-axis alignment: flex-start, center, flex-end, stretch',\n}\n\n// =============================================================================\n// Padding/Margin Types\n// =============================================================================\n\n/** JSON Schema for PaddingValue (also used for margin) */\nexport const paddingSchema = {\n type: 'object',\n properties: {\n top: { type: 'number', description: 'Top padding in units' },\n right: { type: 'number', description: 'Right padding in units' },\n bottom: { type: 'number', description: 'Bottom padding in units' },\n left: { type: 'number', description: 'Left padding in units' },\n unit: { type: 'string', enum: ['px', 'rem', 'em', '%'], description: 'Unit for all values' },\n linked: { type: 'boolean', description: 'Whether all sides sync together' },\n },\n required: ['top', 'right', 'bottom', 'left', 'unit'],\n}\n\n/** JSON Schema for ResponsiveValue<PaddingValue> */\nexport const responsivePaddingSchema = {\n type: 'object',\n properties: {\n xs: { ...paddingSchema, description: 'Base (mobile) value - required' },\n sm: { ...paddingSchema, description: 'Small screens (640px+) - optional override' },\n md: { ...paddingSchema, description: 'Medium screens (768px+) - optional override' },\n lg: { ...paddingSchema, description: 'Large screens (1024px+) - optional override' },\n xl: { ...paddingSchema, description: 'Extra large screens (1280px+) - optional override' },\n },\n required: ['xs'],\n}\n\n// =============================================================================\n// Dimensions Types\n// =============================================================================\n\n/** JSON Schema for DimensionConstraint */\nexport const dimensionConstraintSchema = {\n type: 'object',\n properties: {\n value: { type: 'number', description: 'Numeric value' },\n unit: { type: 'string', enum: ['px', 'rem', '%', 'vw', 'vh'], description: 'CSS unit' },\n enabled: { type: 'boolean', description: 'Whether this constraint is active' },\n },\n required: ['value', 'unit', 'enabled'],\n}\n\n/** JSON Schema for DimensionsValue */\nexport const dimensionsSchema = {\n type: 'object',\n properties: {\n mode: { type: 'string', enum: ['full', 'contained', 'custom'], description: 'Width mode' },\n alignment: { type: 'string', enum: ['left', 'center', 'right'], description: 'Content alignment' },\n maxWidth: { ...dimensionConstraintSchema, description: 'Maximum width constraint' },\n minWidth: { ...dimensionConstraintSchema, description: 'Minimum width constraint (optional)' },\n minHeight: { ...dimensionConstraintSchema, description: 'Minimum height constraint (optional)' },\n maxHeight: { ...dimensionConstraintSchema, description: 'Maximum height constraint (optional)' },\n },\n required: ['mode', 'alignment', 'maxWidth'],\n}\n\n/** JSON Schema for ResponsiveValue<DimensionsValue> */\nexport const responsiveDimensionsSchema = {\n type: 'object',\n properties: {\n xs: { ...dimensionsSchema, description: 'Base (mobile) value - required' },\n sm: { ...dimensionsSchema, description: 'Small screens (640px+) - optional override' },\n md: { ...dimensionsSchema, description: 'Medium screens (768px+) - optional override' },\n lg: { ...dimensionsSchema, description: 'Large screens (1024px+) - optional override' },\n xl: { ...dimensionsSchema, description: 'Extra large screens (1280px+) - optional override' },\n },\n required: ['xs'],\n}\n\n// =============================================================================\n// Background Types\n// =============================================================================\n\n/** JSON Schema for GradientStop */\nexport const gradientStopSchema = {\n type: 'object',\n properties: {\n color: colorSchema,\n position: { type: 'number', minimum: 0, maximum: 100, description: 'Position 0-100%' },\n },\n required: ['color', 'position'],\n}\n\n/** JSON Schema for GradientValue */\nexport const gradientSchema = {\n type: 'object',\n properties: {\n type: { type: 'string', enum: ['linear', 'radial'], description: 'Gradient type' },\n angle: { type: 'number', minimum: 0, maximum: 360, description: 'Angle in degrees (linear)' },\n stops: { type: 'array', items: gradientStopSchema, description: 'Color stops' },\n radialShape: { type: 'string', enum: ['circle', 'ellipse'], description: 'Radial shape' },\n radialPosition: { type: 'string', enum: ['center', 'top', 'bottom', 'left', 'right'] },\n },\n required: ['type', 'stops'],\n}\n\n/** JSON Schema for BackgroundValue */\nexport const backgroundSchema = {\n type: 'object',\n properties: {\n type: { type: 'string', enum: ['none', 'solid', 'gradient', 'image'], description: 'Background type' },\n solid: { ...colorSchema, description: 'Solid color (when type=\"solid\")' },\n gradient: { ...gradientSchema, description: 'Gradient (when type=\"gradient\")' },\n // Note: image backgrounds require media selection, AI should use solid/gradient\n },\n required: ['type'],\n}\n\n// =============================================================================\n// Border Types\n// =============================================================================\n\n/** JSON Schema for BorderValue */\nexport const borderSchema = {\n type: 'object',\n properties: {\n style: { type: 'string', enum: ['none', 'solid', 'dashed', 'dotted'], description: 'Border style' },\n width: { type: 'number', description: 'Border width in pixels' },\n color: { ...colorSchema, description: 'Border color' },\n radius: { type: 'number', description: 'Border radius in pixels' },\n sides: {\n type: 'object',\n properties: {\n top: { type: 'boolean' },\n right: { type: 'boolean' },\n bottom: { type: 'boolean' },\n left: { type: 'boolean' },\n },\n description: 'Which sides have borders',\n },\n },\n required: ['style', 'width', 'radius', 'sides'],\n}\n\n// =============================================================================\n// Animation Types\n// =============================================================================\n\n/** JSON Schema for AnimationValue (simplified for AI) */\nexport const animationSchema = {\n type: 'object',\n properties: {\n mode: { type: 'string', enum: ['preset', 'custom'], description: 'Animation mode' },\n entrance: {\n type: 'string',\n enum: ['none', 'fade-in', 'fade-up', 'fade-down', 'fade-left', 'fade-right', 'fade-scale',\n 'scale-in', 'scale-up', 'scale-down', 'slide-up', 'slide-down', 'slide-left', 'slide-right'],\n description: 'Entrance animation preset',\n },\n entranceDuration: { type: 'number', description: 'Duration in ms, default 500' },\n entranceDelay: { type: 'number', description: 'Delay in ms, default 0' },\n triggerOnScroll: { type: 'boolean', description: 'Trigger when scrolled into view' },\n triggerOnce: { type: 'boolean', description: 'Only animate once' },\n },\n}\n\n// =============================================================================\n// Visibility Types\n// =============================================================================\n\n/** JSON Schema for VisibilityValue */\nexport const visibilitySchema = {\n type: 'object',\n properties: {\n xs: { type: 'boolean', description: 'Visible on mobile (default true)' },\n sm: { type: 'boolean', description: 'Visible on small screens 640px+' },\n md: { type: 'boolean', description: 'Visible on medium screens 768px+' },\n lg: { type: 'boolean', description: 'Visible on large screens 1024px+' },\n xl: { type: 'boolean', description: 'Visible on extra large screens 1280px+' },\n },\n required: ['xs'],\n}\n\n// =============================================================================\n// Size Types (for Button, etc.)\n// =============================================================================\n\n/** JSON Schema for SizeValue */\nexport const sizeSchema = {\n type: 'object',\n properties: {\n mode: { type: 'string', enum: ['sm', 'default', 'lg', 'custom'], description: 'Size preset or custom' },\n height: { type: 'number', description: 'Custom height in units (only when mode=\"custom\")' },\n paddingX: { type: 'number', description: 'Custom horizontal padding (only when mode=\"custom\")' },\n paddingY: { type: 'number', description: 'Custom vertical padding (only when mode=\"custom\")' },\n fontSize: { type: 'number', description: 'Custom font size (only when mode=\"custom\")' },\n unit: { type: 'string', enum: ['px', 'rem'], description: 'Unit for custom values' },\n },\n required: ['mode'],\n}\n\n// =============================================================================\n// Transform Types\n// =============================================================================\n\n/** JSON Schema for TransformValue */\nexport const transformSchema = {\n type: 'object',\n properties: {\n rotate: { type: 'number', minimum: -360, maximum: 360, description: 'Rotation in degrees' },\n scaleX: { type: 'number', minimum: 0.1, maximum: 3, description: 'Horizontal scale factor' },\n scaleY: { type: 'number', minimum: 0.1, maximum: 3, description: 'Vertical scale factor' },\n scaleLocked: { type: 'boolean', description: 'Lock X and Y scale together' },\n skewX: { type: 'number', minimum: -45, maximum: 45, description: 'Horizontal skew in degrees' },\n skewY: { type: 'number', minimum: -45, maximum: 45, description: 'Vertical skew in degrees' },\n translateX: { type: 'number', description: 'Horizontal translation' },\n translateY: { type: 'number', description: 'Vertical translation' },\n translateUnit: { type: 'string', enum: ['px', 'rem', '%'], description: 'Unit for translation' },\n origin: {\n type: 'string',\n enum: ['center', 'top', 'bottom', 'left', 'right', 'top-left', 'top-right', 'bottom-left', 'bottom-right'],\n description: 'Transform origin point',\n },\n enable3D: { type: 'boolean', description: 'Enable 3D transforms' },\n perspective: { type: 'number', description: '3D perspective in pixels' },\n rotateX: { type: 'number', description: '3D rotation around X axis' },\n rotateY: { type: 'number', description: '3D rotation around Y axis' },\n },\n}\n"],"names":["colorSchema","type","properties","hex","description","opacity","minimum","maximum","required","alignmentSchema","enum","justifyContentSchema","alignItemsSchema","paddingSchema","top","right","bottom","left","unit","linked","responsivePaddingSchema","xs","sm","md","lg","xl","dimensionConstraintSchema","value","enabled","dimensionsSchema","mode","alignment","maxWidth","minWidth","minHeight","maxHeight","responsiveDimensionsSchema","gradientStopSchema","color","position","gradientSchema","angle","stops","items","radialShape","radialPosition","backgroundSchema","solid","gradient","borderSchema","style","width","radius","sides","animationSchema","entrance","entranceDuration","entranceDelay","triggerOnScroll","triggerOnce","visibilitySchema","sizeSchema","height","paddingX","paddingY","fontSize","transformSchema","rotate","scaleX","scaleY","scaleLocked","skewX","skewY","translateX","translateY","translateUnit","origin","enable3D","perspective","rotateX","rotateY"],"mappings":"AAAA;;;;;CAKC,GAED,gFAAgF;AAChF,cAAc;AACd,gFAAgF;AAEhF,+BAA+B,GAC/B,OAAO,MAAMA,cAAc;IACzBC,MAAM;IACNC,YAAY;QACVC,KAAK;YAAEF,MAAM;YAAUG,aAAa;QAAkC;QACtEC,SAAS;YAAEJ,MAAM;YAAUK,SAAS;YAAGC,SAAS;YAAKH,aAAa;QAA6B;IACjG;IACAI,UAAU;QAAC;KAAM;AACnB,EAAC;AAED,+CAA+C,GAC/C,OAAO,MAAMC,kBAAkB;IAC7BR,MAAM;IACNS,MAAM;QAAC;QAAQ;QAAU;KAAQ;IACjCN,aAAa;AACf,EAAC;AAED,0CAA0C,GAC1C,OAAO,MAAMO,uBAAuB;IAClCV,MAAM;IACNS,MAAM;QAAC;QAAc;QAAU;QAAY;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Aa;QAA2B;QAC5FqE,YAAY;YAAExE,MAAM;YAAUG,aAAa;QAAyB;QACpEsE,YAAY;YAAEzE,MAAM;YAAUG,aAAa;QAAuB;QAClEuE,eAAe;YAAE1E,MAAM;YAAUS,MAAM;gBAAC;gBAAM;gBAAO;aAAI;YAAEN,aAAa;QAAuB;QAC/FwE,QAAQ;YACN3E,MAAM;YACNS,MAAM;gBAAC;gBAAU;gBAAO;gBAAU;gBAAQ;gBAAS;gBAAY;gBAAa;gBAAe;aAAe;YAC1GN,aAAa;QACf;QACAyE,UAAU;YAAE5E,MAAM;YAAWG,aAAa;QAAuB;QACjE0E,aAAa;YAAE7E,MAAM;YAAUG,aAAa;QAA2B;QACvE2E,SAAS;YAAE9E,MAAM;YAAUG,aAAa;QAA4B;QACpE4E,SAAS;YAAE/E,MAAM;YAAUG,aAAa;QAA4B;IACtE;AACF,EAAC"}
|
|
@@ -7,8 +7,7 @@ import { colorSchema, alignmentSchema } from './schemas.js';
|
|
|
7
7
|
* - Correct field names and values
|
|
8
8
|
* - When to use each component
|
|
9
9
|
* - How to compose them with other components
|
|
10
|
-
*/
|
|
11
|
-
export const typographyInstructions = {
|
|
10
|
+
*/ export const typographyInstructions = {
|
|
12
11
|
Heading: {
|
|
13
12
|
ai: {
|
|
14
13
|
instructions: `Heading component for titles and section headings.
|
|
@@ -33,34 +32,34 @@ COMMON PATTERNS:
|
|
|
33
32
|
COMPOSITION:
|
|
34
33
|
- Place inside Section > Container for centered section headings
|
|
35
34
|
- Place inside Flex (column) for grouped text content
|
|
36
|
-
- Pair with Text component for headline + description combos
|
|
35
|
+
- Pair with Text component for headline + description combos`
|
|
37
36
|
},
|
|
38
37
|
fields: {
|
|
39
38
|
text: {
|
|
40
39
|
ai: {
|
|
41
40
|
required: true,
|
|
42
|
-
instructions: 'The heading text content. Keep headlines concise and impactful - typically 3-8 words for h1/h2, can be longer for h3+.'
|
|
43
|
-
}
|
|
41
|
+
instructions: 'The heading text content. Keep headlines concise and impactful - typically 3-8 words for h1/h2, can be longer for h3+.'
|
|
42
|
+
}
|
|
44
43
|
},
|
|
45
44
|
level: {
|
|
46
45
|
ai: {
|
|
47
|
-
instructions: 'Heading level (h1-h6). Follow hierarchy: h1 once for page title, h2 for sections, h3 for subsections. Default: h2.'
|
|
48
|
-
}
|
|
46
|
+
instructions: 'Heading level (h1-h6). Follow hierarchy: h1 once for page title, h2 for sections, h3 for subsections. Default: h2.'
|
|
47
|
+
}
|
|
49
48
|
},
|
|
50
49
|
textColor: {
|
|
51
50
|
ai: {
|
|
52
51
|
instructions: `Optional text color. Use for emphasis or brand colors.
|
|
53
52
|
Example: { hex: '#3b82f6', opacity: 100 }`,
|
|
54
|
-
schema: colorSchema
|
|
55
|
-
}
|
|
53
|
+
schema: colorSchema
|
|
54
|
+
}
|
|
56
55
|
},
|
|
57
56
|
alignment: {
|
|
58
57
|
ai: {
|
|
59
58
|
instructions: "Text alignment: 'left', 'center', or 'right'. Use 'center' for hero/section headings, 'left' for content areas.",
|
|
60
|
-
schema: alignmentSchema
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
59
|
+
schema: alignmentSchema
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
64
63
|
},
|
|
65
64
|
Text: {
|
|
66
65
|
ai: {
|
|
@@ -85,34 +84,34 @@ COMMON PATTERNS:
|
|
|
85
84
|
COMPOSITION:
|
|
86
85
|
- Usually follows a Heading component
|
|
87
86
|
- Place inside Flex (column) with Heading for text blocks
|
|
88
|
-
- Place inside Card for card descriptions
|
|
87
|
+
- Place inside Card for card descriptions`
|
|
89
88
|
},
|
|
90
89
|
fields: {
|
|
91
90
|
content: {
|
|
92
91
|
ai: {
|
|
93
92
|
required: true,
|
|
94
|
-
instructions: 'The text content. Write clear, concise copy. Use line breaks for multiple paragraphs if needed.'
|
|
95
|
-
}
|
|
93
|
+
instructions: 'The text content. Write clear, concise copy. Use line breaks for multiple paragraphs if needed.'
|
|
94
|
+
}
|
|
96
95
|
},
|
|
97
96
|
size: {
|
|
98
97
|
ai: {
|
|
99
|
-
instructions: "Text size: 'xs', 'sm', 'base' (default), 'lg', 'xl'. Use 'lg' or 'xl' for hero subtitles, 'sm' for secondary text."
|
|
100
|
-
}
|
|
98
|
+
instructions: "Text size: 'xs', 'sm', 'base' (default), 'lg', 'xl'. Use 'lg' or 'xl' for hero subtitles, 'sm' for secondary text."
|
|
99
|
+
}
|
|
101
100
|
},
|
|
102
101
|
textColor: {
|
|
103
102
|
ai: {
|
|
104
103
|
instructions: `Optional text color. Use for emphasis or brand colors.
|
|
105
104
|
Example: { hex: '#64748b', opacity: 100 }`,
|
|
106
|
-
schema: colorSchema
|
|
107
|
-
}
|
|
105
|
+
schema: colorSchema
|
|
106
|
+
}
|
|
108
107
|
},
|
|
109
108
|
alignment: {
|
|
110
109
|
ai: {
|
|
111
110
|
instructions: "Text alignment: 'left', 'center', or 'right'. Match the alignment of the heading above it.",
|
|
112
|
-
schema: alignmentSchema
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
111
|
+
schema: alignmentSchema
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
116
115
|
},
|
|
117
116
|
RichText: {
|
|
118
117
|
ai: {
|
|
@@ -164,13 +163,15 @@ HTML STRUCTURE:
|
|
|
164
163
|
COMPOSITION:
|
|
165
164
|
- Place inside Container for constrained width
|
|
166
165
|
- Use in Accordion items for formatted FAQ answers
|
|
167
|
-
- Combine with Section backgrounds for contrast
|
|
166
|
+
- Combine with Section backgrounds for contrast`
|
|
168
167
|
},
|
|
169
168
|
fields: {
|
|
170
169
|
content: {
|
|
171
170
|
ai: {
|
|
172
171
|
required: true,
|
|
173
|
-
schema: {
|
|
172
|
+
schema: {
|
|
173
|
+
type: 'string'
|
|
174
|
+
},
|
|
174
175
|
instructions: `HTML content for the TipTap rich text editor. Structure with proper HTML tags:
|
|
175
176
|
- <p>Paragraph text</p>
|
|
176
177
|
- <p><span style="font-size: 1.5rem">Large text</span></p>
|
|
@@ -179,14 +180,18 @@ COMPOSITION:
|
|
|
179
180
|
- <ol><li>Numbered item</li></ol>
|
|
180
181
|
- <blockquote>Quote</blockquote>
|
|
181
182
|
- <a href="url">Link text</a>
|
|
182
|
-
- <strong>Bold</strong>, <em>Italic</em
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
183
|
+
- <strong>Bold</strong>, <em>Italic</em>`
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
187
188
|
};
|
|
188
189
|
/**
|
|
189
190
|
* Typography component names for reference
|
|
190
|
-
*/
|
|
191
|
-
|
|
191
|
+
*/ export const typographyComponents = [
|
|
192
|
+
'Heading',
|
|
193
|
+
'Text',
|
|
194
|
+
'RichText'
|
|
195
|
+
];
|
|
196
|
+
|
|
192
197
|
//# sourceMappingURL=typography.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../../src/ai/presets/instructions/typography.ts"],"sourcesContent":["import type { ComponentAiOverrides } from '../../types.js'\nimport { colorSchema, alignmentSchema } from './schemas.js'\n\n/**\n * Comprehensive AI instructions for typography components\n *\n * These instructions teach the AI:\n * - What each component is for\n * - Correct field names and values\n * - When to use each component\n * - How to compose them with other components\n */\nexport const typographyInstructions: ComponentAiOverrides = {\n Heading: {\n ai: {\n instructions: `Heading component for titles and section headings.\n\nPURPOSE:\n- Page titles, section headings, and subsection titles\n- Establishes content hierarchy and structure\n- Improves accessibility and SEO\n\nUSAGE GUIDELINES:\n- Use h1 ONLY ONCE per page for the main page title (in the hero section)\n- Use h2 for major section headings (Features, Testimonials, FAQ, etc.)\n- Use h3 for subsection headings or card titles within sections\n- Use h4-h6 rarely, only for deeply nested content\n\nCOMMON PATTERNS:\n- Hero headline: h1 level, centered alignment\n- Section title: h2 level, often centered\n- Card/feature title: h3 level, left or center aligned\n- Sidebar heading: h4 level\n\nCOMPOSITION:\n- Place inside Section > Container for centered section headings\n- Place inside Flex (column) for grouped text content\n- Pair with Text component for headline + description combos`,\n },\n fields: {\n text: {\n ai: {\n required: true,\n instructions:\n 'The heading text content. Keep headlines concise and impactful - typically 3-8 words for h1/h2, can be longer for h3+.',\n },\n },\n level: {\n ai: {\n instructions:\n 'Heading level (h1-h6). Follow hierarchy: h1 once for page title, h2 for sections, h3 for subsections. Default: h2.',\n },\n },\n textColor: {\n ai: {\n instructions: `Optional text color. Use for emphasis or brand colors.\nExample: { hex: '#3b82f6', opacity: 100 }`,\n schema: colorSchema,\n },\n },\n alignment: {\n ai: {\n instructions:\n \"Text alignment: 'left', 'center', or 'right'. Use 'center' for hero/section headings, 'left' for content areas.\",\n schema: alignmentSchema,\n },\n },\n },\n },\n\n Text: {\n ai: {\n instructions: `Text component for paragraphs and body content.\n\nPURPOSE:\n- Body text, descriptions, and supporting content\n- Single paragraphs or short text blocks\n- Subtitles and secondary text under headings\n\nUSAGE GUIDELINES:\n- Use for 1-3 paragraphs of plain text\n- For longer formatted content with lists/links, use RichText instead\n- Size options: xs, sm, base (default), lg, xl\n\nCOMMON PATTERNS:\n- Hero subtitle: lg or xl size, centered, below h1\n- Section description: base size, centered, below h2\n- Card description: sm or base size, left-aligned\n- Feature text: base size, often paired with heading\n\nCOMPOSITION:\n- Usually follows a Heading component\n- Place inside Flex (column) with Heading for text blocks\n- Place inside Card for card descriptions`,\n },\n fields: {\n content: {\n ai: {\n required: true,\n instructions:\n 'The text content. Write clear, concise copy. Use line breaks for multiple paragraphs if needed.',\n },\n },\n size: {\n ai: {\n instructions:\n \"Text size: 'xs', 'sm', 'base' (default), 'lg', 'xl'. Use 'lg' or 'xl' for hero subtitles, 'sm' for secondary text.\",\n },\n },\n textColor: {\n ai: {\n instructions: `Optional text color. Use for emphasis or brand colors.\nExample: { hex: '#64748b', opacity: 100 }`,\n schema: colorSchema,\n },\n },\n alignment: {\n ai: {\n instructions:\n \"Text alignment: 'left', 'center', or 'right'. Match the alignment of the heading above it.\",\n schema: alignmentSchema,\n },\n },\n },\n },\n\n RichText: {\n ai: {\n instructions: `RichText component - TipTap-powered rich text with advanced formatting.\n\nPURPOSE:\n- Long-form content with sophisticated formatting\n- Content needing font sizes, colors, highlights\n- Blog posts, about pages, formatted descriptions\n- Any content needing more than plain text\n\nUSAGE GUIDELINES:\n- Use RichText over Text when you need ANY formatting\n- Supports font sizes from xs to 5xl\n- Supports text colors with opacity\n- Supports highlights/background colors\n- Content is HTML with data attributes for styling\n\nTIPTAP FEATURES AVAILABLE:\n- Font sizes: text-xs, text-sm, text-base, text-lg, text-xl, text-2xl, text-3xl, text-4xl, text-5xl\n- Text colors: Any hex color with opacity (via data attributes)\n- Highlights: Background color highlights on text\n- Formatting: bold, italic, underline, strikethrough\n- Special: superscript, subscript\n- Blocks: blockquotes, code blocks\n- Lists: bullet lists, numbered lists\n- Links: clickable hyperlinks\n\nCOMMON PATTERNS:\n- Hero subtitle with large colorful text\n- Feature descriptions with highlights\n- Blog content with mixed formatting\n- FAQ answers with styled callouts\n- About page with branded text colors\n\nHTML STRUCTURE:\n- <p>Paragraph text</p>\n- <p><span style=\"font-size:...\">Sized text</span></p>\n- <p><span style=\"color:...\">Colored text</span></p>\n- <p><mark>Highlighted text</mark></p>\n- <ul><li>Bullet item</li></ul>\n- <ol><li>Numbered item</li></ol>\n- <blockquote>Quote text</blockquote>\n- <pre><code>Code block</code></pre>\n- <a href=\"url\">Link text</a>\n- <strong>Bold</strong>, <em>Italic</em>, <u>Underline</u>, <s>Strikethrough</s>\n- <sup>Superscript</sup>, <sub>Subscript</sub>\n\nCOMPOSITION:\n- Place inside Container for constrained width\n- Use in Accordion items for formatted FAQ answers\n- Combine with Section backgrounds for contrast`,\n },\n fields: {\n content: {\n ai: {\n required: true,\n schema: { type: 'string' },\n instructions: `HTML content for the TipTap rich text editor. Structure with proper HTML tags:\n- <p>Paragraph text</p>\n- <p><span style=\"font-size: 1.5rem\">Large text</span></p>\n- <p><span style=\"color: #3b82f6\">Colored text</span></p>\n- <ul><li>Bullet item</li></ul>\n- <ol><li>Numbered item</li></ol>\n- <blockquote>Quote</blockquote>\n- <a href=\"url\">Link text</a>\n- <strong>Bold</strong>, <em>Italic</em>`,\n },\n },\n },\n },\n}\n\n/**\n * Typography component names for reference\n */\nexport const typographyComponents = ['Heading', 'Text', 'RichText'] as const\n"],"names":["colorSchema","alignmentSchema","typographyInstructions","Heading","ai","instructions","fields","text","required","level","textColor","schema","alignment","Text","content","size","RichText","type","typographyComponents"],"mappings":"AACA,SAASA,WAAW,EAAEC,eAAe,QAAQ,eAAc;AAE3D;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAA+C;IAC1DC,SAAS;QACPC,IAAI;YACFC,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;4DAsBuC,CAAC;QACzD;QACAC,QAAQ;YACNC,MAAM;gBACJH,IAAI;oBACFI,UAAU;oBACVH,cACE;gBACJ;YACF;YACAI,OAAO;gBACLL,IAAI;oBACFC,cACE;gBACJ;YACF;YACAK,WAAW;gBACTN,IAAI;oBACFC,cAAc,CAAC;yCACgB,CAAC;oBAChCM,QAAQX;gBACV;YACF;YACAY,WAAW;gBACTR,IAAI;oBACFC,cACE;oBACFM,QAAQV;gBACV;YACF;QACF;IACF;IAEAY,MAAM;QACJT,IAAI;YACFC,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;yCAqBoB,CAAC;QACtC;QACAC,QAAQ;YACNQ,SAAS;gBACPV,IAAI;oBACFI,UAAU;oBACVH,cACE;gBACJ;YACF;YACAU,MAAM;gBACJX,IAAI;oBACFC,cACE;gBACJ;YACF;YACAK,WAAW;gBACTN,IAAI;oBACFC,cAAc,CAAC;yCACgB,CAAC;oBAChCM,QAAQX;gBACV;YACF;YACAY,WAAW;gBACTR,IAAI;oBACFC,cACE;oBACFM,QAAQV;gBACV;YACF;QACF;IACF;IAEAe,UAAU;QACRZ,IAAI;YACFC,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAgD0B,CAAC;QAC5C;QACAC,QAAQ;YACNQ,SAAS;gBACPV,IAAI;oBACFI,UAAU;oBACVG,QAAQ;wBAAEM,MAAM;oBAAS;oBACzBZ,cAAc,CAAC;;;;;;;;wCAQe,CAAC;gBACjC;YACF;QACF;IACF;AACF,EAAC;AAED;;CAEC,GACD,OAAO,MAAMa,uBAAuB;IAAC;IAAW;IAAQ;CAAW,CAAS"}
|
package/dist/ai/tools/index.js
CHANGED
|
@@ -19,8 +19,7 @@
|
|
|
19
19
|
* },
|
|
20
20
|
* })
|
|
21
21
|
* ```
|
|
22
|
-
*/
|
|
23
|
-
import { z } from 'zod';
|
|
22
|
+
*/ import { z } from 'zod';
|
|
24
23
|
/**
|
|
25
24
|
* Creates a set of AI tools for querying Payload CMS
|
|
26
25
|
*
|
|
@@ -47,34 +46,31 @@ import { z } from 'zod';
|
|
|
47
46
|
* },
|
|
48
47
|
* })
|
|
49
48
|
* ```
|
|
50
|
-
*/
|
|
51
|
-
export function createPayloadTools(config) {
|
|
49
|
+
*/ export function createPayloadTools(config) {
|
|
52
50
|
const tools = {};
|
|
53
51
|
// Collection query tools
|
|
54
52
|
if (config.collections) {
|
|
55
|
-
const collections = Array.isArray(config.collections)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
const collections = Array.isArray(config.collections) ? Object.fromEntries(config.collections.map((c)=>[
|
|
54
|
+
c,
|
|
55
|
+
`Items from the ${c} collection`
|
|
56
|
+
])) : config.collections;
|
|
57
|
+
for (const [slug, description] of Object.entries(collections)){
|
|
58
|
+
const toolName = `get${slug.charAt(0).toUpperCase()}${slug.slice(1).replace(/-([a-z])/g, (_, c)=>c.toUpperCase())}`;
|
|
60
59
|
tools[toolName] = {
|
|
61
60
|
description: `Query ${slug} collection. ${description}`,
|
|
62
61
|
inputSchema: z.object({
|
|
63
62
|
limit: z.number().optional().describe('Maximum number of items to return (default: 10)'),
|
|
64
|
-
where: z
|
|
65
|
-
|
|
66
|
-
.optional()
|
|
67
|
-
.describe('Payload where query for filtering results'),
|
|
68
|
-
search: z.string().optional().describe('Search term to filter by title/name fields'),
|
|
63
|
+
where: z.record(z.string(), z.unknown()).optional().describe('Payload where query for filtering results'),
|
|
64
|
+
search: z.string().optional().describe('Search term to filter by title/name fields')
|
|
69
65
|
}),
|
|
70
|
-
execute: async (input, context)
|
|
66
|
+
execute: async (input, context)=>{
|
|
71
67
|
if (!context?.payload) {
|
|
72
68
|
throw new Error('Payload instance not available in tool context');
|
|
73
69
|
}
|
|
74
70
|
const { payload } = context;
|
|
75
71
|
const query = {
|
|
76
72
|
collection: slug,
|
|
77
|
-
limit: input.limit || 10
|
|
73
|
+
limit: input.limit || 10
|
|
78
74
|
};
|
|
79
75
|
if (input.where) {
|
|
80
76
|
query.where = input.where;
|
|
@@ -83,15 +79,27 @@ export function createPayloadTools(config) {
|
|
|
83
79
|
if (input.search) {
|
|
84
80
|
query.where = {
|
|
85
81
|
or: [
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
{
|
|
83
|
+
title: {
|
|
84
|
+
contains: input.search
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: {
|
|
89
|
+
contains: input.search
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: {
|
|
94
|
+
contains: input.search
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
90
98
|
};
|
|
91
99
|
}
|
|
92
100
|
const result = await payload.find(query);
|
|
93
101
|
return result.docs;
|
|
94
|
-
}
|
|
102
|
+
}
|
|
95
103
|
};
|
|
96
104
|
}
|
|
97
105
|
}
|
|
@@ -103,38 +111,54 @@ export function createPayloadTools(config) {
|
|
|
103
111
|
inputSchema: z.object({
|
|
104
112
|
search: z.string().optional().describe('Search by filename or alt text'),
|
|
105
113
|
mimeType: z.string().optional().describe('Filter by MIME type (e.g., "image/jpeg")'),
|
|
106
|
-
limit: z.number().optional().describe('Maximum number of results (default: 10)')
|
|
114
|
+
limit: z.number().optional().describe('Maximum number of results (default: 10)')
|
|
107
115
|
}),
|
|
108
|
-
execute: async (input, context)
|
|
116
|
+
execute: async (input, context)=>{
|
|
109
117
|
if (!context?.payload) {
|
|
110
118
|
throw new Error('Payload instance not available in tool context');
|
|
111
119
|
}
|
|
112
120
|
const { payload } = context;
|
|
113
121
|
const query = {
|
|
114
122
|
collection: mediaCollection,
|
|
115
|
-
limit: input.limit || 10
|
|
123
|
+
limit: input.limit || 10
|
|
116
124
|
};
|
|
117
125
|
const conditions = [];
|
|
118
126
|
if (input.search) {
|
|
119
|
-
conditions.push({
|
|
127
|
+
conditions.push({
|
|
128
|
+
filename: {
|
|
129
|
+
contains: input.search
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
alt: {
|
|
133
|
+
contains: input.search
|
|
134
|
+
}
|
|
135
|
+
});
|
|
120
136
|
}
|
|
121
137
|
if (input.mimeType) {
|
|
122
|
-
conditions.push({
|
|
138
|
+
conditions.push({
|
|
139
|
+
mimeType: {
|
|
140
|
+
equals: input.mimeType
|
|
141
|
+
}
|
|
142
|
+
});
|
|
123
143
|
}
|
|
124
144
|
if (conditions.length > 0) {
|
|
125
|
-
query.where = input.search ? {
|
|
145
|
+
query.where = input.search ? {
|
|
146
|
+
or: conditions
|
|
147
|
+
} : {
|
|
148
|
+
and: conditions
|
|
149
|
+
};
|
|
126
150
|
}
|
|
127
151
|
const result = await payload.find(query);
|
|
128
|
-
return result.docs.map((doc)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
152
|
+
return result.docs.map((doc)=>({
|
|
153
|
+
id: doc.id,
|
|
154
|
+
url: doc.url,
|
|
155
|
+
filename: doc.filename,
|
|
156
|
+
alt: doc.alt,
|
|
157
|
+
width: doc.width,
|
|
158
|
+
height: doc.height,
|
|
159
|
+
mimeType: doc.mimeType
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
138
162
|
};
|
|
139
163
|
}
|
|
140
164
|
// Pages tool for internal linking
|
|
@@ -143,46 +167,59 @@ export function createPayloadTools(config) {
|
|
|
143
167
|
description: 'Look up existing pages for internal linking. Returns page titles, slugs, and URLs.',
|
|
144
168
|
inputSchema: z.object({
|
|
145
169
|
search: z.string().optional().describe('Search by page title'),
|
|
146
|
-
limit: z.number().optional().describe('Maximum number of results (default: 10)')
|
|
170
|
+
limit: z.number().optional().describe('Maximum number of results (default: 10)')
|
|
147
171
|
}),
|
|
148
|
-
execute: async (input, context)
|
|
172
|
+
execute: async (input, context)=>{
|
|
149
173
|
if (!context?.payload) {
|
|
150
174
|
throw new Error('Payload instance not available in tool context');
|
|
151
175
|
}
|
|
152
176
|
const { payload } = context;
|
|
153
177
|
const query = {
|
|
154
178
|
collection: config.pages,
|
|
155
|
-
limit: input.limit || 10
|
|
179
|
+
limit: input.limit || 10
|
|
156
180
|
};
|
|
157
181
|
if (input.search) {
|
|
158
182
|
query.where = {
|
|
159
|
-
or: [
|
|
183
|
+
or: [
|
|
184
|
+
{
|
|
185
|
+
title: {
|
|
186
|
+
contains: input.search
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
slug: {
|
|
191
|
+
contains: input.search
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
]
|
|
160
195
|
};
|
|
161
196
|
}
|
|
162
197
|
const result = await payload.find(query);
|
|
163
|
-
return result.docs.map((doc)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
198
|
+
return result.docs.map((doc)=>({
|
|
199
|
+
id: doc.id,
|
|
200
|
+
title: doc.title,
|
|
201
|
+
slug: doc.slug,
|
|
202
|
+
url: `/${doc.slug}`
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
170
205
|
};
|
|
171
206
|
}
|
|
172
207
|
// Globals tools
|
|
173
208
|
if (config.globals && config.globals.length > 0) {
|
|
174
|
-
for (const globalSlug of config.globals)
|
|
175
|
-
const toolName = `get${globalSlug.charAt(0).toUpperCase()}${globalSlug.slice(1).replace(/-([a-z])/g, (_, c)
|
|
209
|
+
for (const globalSlug of config.globals){
|
|
210
|
+
const toolName = `get${globalSlug.charAt(0).toUpperCase()}${globalSlug.slice(1).replace(/-([a-z])/g, (_, c)=>c.toUpperCase())}`;
|
|
176
211
|
tools[toolName] = {
|
|
177
212
|
description: `Get ${globalSlug} global data (site-wide settings/configuration)`,
|
|
178
213
|
inputSchema: z.object({}),
|
|
179
|
-
execute: async (_input, context)
|
|
214
|
+
execute: async (_input, context)=>{
|
|
180
215
|
if (!context?.payload) {
|
|
181
216
|
throw new Error('Payload instance not available in tool context');
|
|
182
217
|
}
|
|
183
218
|
const { payload } = context;
|
|
184
|
-
return await payload.findGlobal({
|
|
185
|
-
|
|
219
|
+
return await payload.findGlobal({
|
|
220
|
+
slug: globalSlug
|
|
221
|
+
});
|
|
222
|
+
}
|
|
186
223
|
};
|
|
187
224
|
}
|
|
188
225
|
}
|
|
@@ -207,8 +244,8 @@ export function createPayloadTools(config) {
|
|
|
207
244
|
* },
|
|
208
245
|
* })
|
|
209
246
|
* ```
|
|
210
|
-
*/
|
|
211
|
-
export function createTool(tool) {
|
|
247
|
+
*/ export function createTool(tool) {
|
|
212
248
|
return tool;
|
|
213
249
|
}
|
|
250
|
+
|
|
214
251
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ai/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAoEvB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG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AC,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzB,OAAO,EAAE,KAAK,EAAE,MAA6B,EAAE,OAAuB,EAAE,EAAE;oBACxE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;wBACtB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;oBACnE,CAAC;oBACD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;oBAE3B,OAAO,MAAM,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAA;gBACvD,CAAC;aACF,CAAA;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,UAAU,CAAkB,IAA6B;IACvE,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/ai/tools/index.ts"],"sourcesContent":["/**\n * Pre-built AI tools for Payload CMS integration\n *\n * These tools allow the AI to query your Payload database during page generation,\n * enabling it to use real content instead of placeholder text.\n *\n * @example\n * ```typescript\n * import { createPayloadTools } from '@delmaredigital/payload-puck/ai'\n *\n * createPuckPlugin({\n * ai: {\n * enabled: true,\n * tools: createPayloadTools({\n * collections: ['products', 'team-members', 'testimonials'],\n * media: true,\n * pages: 'pages',\n * }),\n * },\n * })\n * ```\n */\n\nimport { z } from 'zod'\nimport type { AiTool, AiToolContext } from '../types.js'\n\n// Input types for the tools\ninterface CollectionQueryInput {\n limit?: number\n where?: Record<string, unknown>\n search?: string\n}\n\ninterface MediaQueryInput {\n search?: string\n mimeType?: string\n limit?: number\n}\n\ninterface PagesQueryInput {\n search?: string\n limit?: number\n}\n\n/**\n * Configuration for createPayloadTools\n */\nexport interface PayloadToolsConfig {\n /**\n * Collections the AI can query.\n * Pass an array of collection slugs, or an object mapping slugs to descriptions.\n *\n * @example\n * ```typescript\n * // Simple - just collection names\n * collections: ['products', 'team-members']\n *\n * // With descriptions - helps AI understand when to use each\n * collections: {\n * products: 'Product catalog with name, price, description, and image',\n * 'team-members': 'Staff profiles with name, role, bio, and headshot',\n * }\n * ```\n */\n collections?: string[] | Record<string, string>\n\n /**\n * Enable media library tool.\n * When true, AI can search for images by filename or alt text.\n * @default false\n */\n media?: boolean | string // true uses 'media', string specifies collection slug\n\n /**\n * Pages collection slug for internal linking.\n * When set, AI can look up page URLs for navigation/links.\n */\n pages?: string\n\n /**\n * Globals the AI can read.\n * Useful for site settings, contact info, etc.\n *\n * @example\n * ```typescript\n * globals: ['site-settings', 'contact-info']\n * ```\n */\n globals?: string[]\n}\n\n/**\n * Creates a set of AI tools for querying Payload CMS\n *\n * IMPORTANT: These tools need the `payload` instance at runtime.\n * The plugin automatically injects `payload` into the tool execution context.\n *\n * @example\n * ```typescript\n * import { createPayloadTools } from '@delmaredigital/payload-puck/ai'\n *\n * createPuckPlugin({\n * ai: {\n * enabled: true,\n * context: 'You are building pages for Acme Corp...',\n * tools: createPayloadTools({\n * collections: {\n * products: 'Products with name, price, description, and image',\n * testimonials: 'Customer testimonials with quote, author, and company',\n * },\n * media: true,\n * pages: 'pages',\n * globals: ['site-settings'],\n * }),\n * },\n * })\n * ```\n */\nexport function createPayloadTools(config: PayloadToolsConfig): Record<string, AiTool<any, any>> {\n const tools: Record<string, AiTool<any, any>> = {}\n\n // Collection query tools\n if (config.collections) {\n const collections = Array.isArray(config.collections)\n ? Object.fromEntries(config.collections.map((c) => [c, `Items from the ${c} collection`]))\n : config.collections\n\n for (const [slug, description] of Object.entries(collections)) {\n const toolName = `get${slug.charAt(0).toUpperCase()}${slug.slice(1).replace(/-([a-z])/g, (_, c) => c.toUpperCase())}`\n\n tools[toolName] = {\n description: `Query ${slug} collection. ${description}`,\n inputSchema: z.object({\n limit: z.number().optional().describe('Maximum number of items to return (default: 10)'),\n where: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Payload where query for filtering results'),\n search: z.string().optional().describe('Search term to filter by title/name fields'),\n }),\n execute: async (input: CollectionQueryInput, context?: AiToolContext) => {\n if (!context?.payload) {\n throw new Error('Payload instance not available in tool context')\n }\n const { payload } = context\n\n const query: {\n collection: string\n limit: number\n where?: Record<string, unknown>\n } = {\n collection: slug,\n limit: input.limit || 10,\n }\n\n if (input.where) {\n query.where = input.where\n }\n\n // If search is provided, try common text fields\n if (input.search) {\n query.where = {\n or: [\n { title: { contains: input.search } },\n { name: { contains: input.search } },\n { label: { contains: input.search } },\n ],\n }\n }\n\n const result = await payload.find(query as any)\n return result.docs\n },\n }\n }\n }\n\n // Media library tool\n if (config.media) {\n const mediaCollection = typeof config.media === 'string' ? config.media : 'media'\n\n tools.getMedia = {\n description:\n 'Search the media library for images. Returns URLs and metadata for matching images.',\n inputSchema: z.object({\n search: z.string().optional().describe('Search by filename or alt text'),\n mimeType: z.string().optional().describe('Filter by MIME type (e.g., \"image/jpeg\")'),\n limit: z.number().optional().describe('Maximum number of results (default: 10)'),\n }),\n execute: async (input: MediaQueryInput, context?: AiToolContext) => {\n if (!context?.payload) {\n throw new Error('Payload instance not available in tool context')\n }\n const { payload } = context\n\n const query: {\n collection: string\n limit: number\n where?: Record<string, unknown>\n } = {\n collection: mediaCollection,\n limit: input.limit || 10,\n }\n\n const conditions: Record<string, unknown>[] = []\n\n if (input.search) {\n conditions.push(\n { filename: { contains: input.search } },\n { alt: { contains: input.search } }\n )\n }\n\n if (input.mimeType) {\n conditions.push({ mimeType: { equals: input.mimeType } })\n }\n\n if (conditions.length > 0) {\n query.where = input.search ? { or: conditions } : { and: conditions }\n }\n\n const result = await payload.find(query as any)\n return result.docs.map((doc: any) => ({\n id: doc.id,\n url: doc.url,\n filename: doc.filename,\n alt: doc.alt,\n width: doc.width,\n height: doc.height,\n mimeType: doc.mimeType,\n }))\n },\n }\n }\n\n // Pages tool for internal linking\n if (config.pages) {\n tools.getPages = {\n description:\n 'Look up existing pages for internal linking. Returns page titles, slugs, and URLs.',\n inputSchema: z.object({\n search: z.string().optional().describe('Search by page title'),\n limit: z.number().optional().describe('Maximum number of results (default: 10)'),\n }),\n execute: async (input: PagesQueryInput, context?: AiToolContext) => {\n if (!context?.payload) {\n throw new Error('Payload instance not available in tool context')\n }\n const { payload } = context\n\n const query: {\n collection: string\n limit: number\n where?: Record<string, unknown>\n } = {\n collection: config.pages!,\n limit: input.limit || 10,\n }\n\n if (input.search) {\n query.where = {\n or: [{ title: { contains: input.search } }, { slug: { contains: input.search } }],\n }\n }\n\n const result = await payload.find(query as any)\n return result.docs.map((doc: any) => ({\n id: doc.id,\n title: doc.title,\n slug: doc.slug,\n url: `/${doc.slug}`,\n }))\n },\n }\n }\n\n // Globals tools\n if (config.globals && config.globals.length > 0) {\n for (const globalSlug of config.globals) {\n const toolName = `get${globalSlug.charAt(0).toUpperCase()}${globalSlug.slice(1).replace(/-([a-z])/g, (_, c) => c.toUpperCase())}`\n\n tools[toolName] = {\n description: `Get ${globalSlug} global data (site-wide settings/configuration)`,\n inputSchema: z.object({}),\n execute: async (_input: Record<string, never>, context?: AiToolContext) => {\n if (!context?.payload) {\n throw new Error('Payload instance not available in tool context')\n }\n const { payload } = context\n\n return await payload.findGlobal({ slug: globalSlug })\n },\n }\n }\n }\n\n return tools\n}\n\n/**\n * Create a custom AI tool with proper typing\n *\n * @example\n * ```typescript\n * import { createTool } from '@delmaredigital/payload-puck/ai'\n * import { z } from 'zod'\n *\n * const getWeather = createTool({\n * description: 'Get current weather for a location',\n * inputSchema: z.object({\n * city: z.string().describe('City name'),\n * }),\n * execute: async ({ city }, context) => {\n * const response = await fetch(`https://api.weather.com/...`)\n * return response.json()\n * },\n * })\n * ```\n */\nexport function createTool<TInput, TOutput>(tool: AiTool<TInput, TOutput>): AiTool<TInput, TOutput> {\n return tool\n}\n"],"names":["z","createPayloadTools","config","tools","collections","Array","isArray","Object","fromEntries","map","c","slug","description","entries","toolName","charAt","toUpperCase","slice","replace","_","inputSchema","object","limit","number","optional","describe","where","record","string","unknown","search","execute","input","context","payload","Error","query","collection","or","title","contains","name","label","result","find","docs","media","mediaCollection","getMedia","mimeType","conditions","push","filename","alt","equals","length","and","doc","id","url","width","height","pages","getPages","globals","globalSlug","_input","findGlobal","createTool","tool"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;CAqBC,GAED,SAASA,CAAC,QAAQ,MAAK;AAoEvB;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BC,GACD,OAAO,SAASC,mBAAmBC,MAA0B;IAC3D,MAAMC,QAA0C,CAAC;IAEjD,yBAAyB;IACzB,IAAID,OAAOE,WAAW,EAAE;QACtB,MAAMA,cAAcC,MAAMC,OAAO,CAACJ,OAAOE,WAAW,IAChDG,OAAOC,WAAW,CAACN,OAAOE,WAAW,CAACK,GAAG,CAAC,CAACC,IAAM;gBAACA;gBAAG,CAAC,eAAe,EAAEA,EAAE,WAAW,CAAC;aAAC,KACtFR,OAAOE,WAAW;QAEtB,KAAK,MAAM,CAACO,MAAMC,YAAY,IAAIL,OAAOM,OAAO,CAACT,aAAc;YAC7D,MAAMU,WAAW,CAAC,GAAG,EAAEH,KAAKI,MAAM,CAAC,GAAGC,WAAW,KAAKL,KAAKM,KAAK,CAAC,GAAGC,OAAO,CAAC,aAAa,CAACC,GAAGT,IAAMA,EAAEM,WAAW,KAAK;YAErHb,KAAK,CAACW,SAAS,GAAG;gBAChBF,aAAa,CAAC,MAAM,EAAED,KAAK,aAAa,EAAEC,aAAa;gBACvDQ,aAAapB,EAAEqB,MAAM,CAAC;oBACpBC,OAAOtB,EAAEuB,MAAM,GAAGC,QAAQ,GAAGC,QAAQ,CAAC;oBACtCC,OAAO1B,EACJ2B,MAAM,CAAC3B,EAAE4B,MAAM,IAAI5B,EAAE6B,OAAO,IAC5BL,QAAQ,GACRC,QAAQ,CAAC;oBACZK,QAAQ9B,EAAE4B,MAAM,GAAGJ,QAAQ,GAAGC,QAAQ,CAAC;gBACzC;gBACAM,SAAS,OAAOC,OAA6BC;oBAC3C,IAAI,CAACA,SAASC,SAAS;wBACrB,M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MC,QAAQiC,UAAU,CAAC;wBAAExD,MAAMsD;oBAAW;gBACrD;YACF;QACF;IACF;IAEA,OAAO9D;AACT;AAEA;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,SAASiE,WAA4BC,IAA6B;IACvE,OAAOA;AACT"}
|
package/dist/ai/types.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Plugin System Integration Types
|
|
3
|
+
// =============================================================================
|
|
4
|
+
/**
|
|
5
|
+
* AI configuration for createPuckPlugin
|
|
6
|
+
*/ export { };
|
|
7
|
+
|
|
2
8
|
//# sourceMappingURL=types.js.map
|
package/dist/ai/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ai/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"sources":["../../src/ai/types.ts"],"sourcesContent":["import type { NextRequest } from 'next/server'\nimport type { Config as PuckConfig, Data as PuckData } from '@puckeditor/core'\nimport type { SanitizedConfig } from 'payload'\nimport type { PuckApiAuthHooks, AuthenticatedUser } from '../api/types.js'\n\n// =============================================================================\n// AI Tool Types\n// =============================================================================\n\n/**\n * Tool definition for AI agent\n *\n * Tools enable the AI to query your system for information,\n * executing functions directly on your server.\n *\n * @example\n * ```typescript\n * import { z } from 'zod'\n *\n * const getProducts: AiTool = {\n * description: 'Get a list of products',\n * inputSchema: z.object({\n * category: z.enum(['consumer', 'business']),\n * }),\n * execute: async ({ category }) => {\n * return await payload.find({ collection: 'products', where: { category } })\n * },\n * }\n * ```\n */\n/**\n * Context passed to tool execution\n * Contains the Payload instance for database operations\n */\nexport interface AiToolContext {\n /**\n * Payload CMS instance for database operations\n */\n payload: import('payload').Payload\n /**\n * The authenticated user making the request\n */\n user?: import('payload').User\n}\n\nexport interface AiTool<TInput = unknown, TOutput = unknown> {\n /**\n * A description that the agent will use to understand how to use this tool\n */\n description: string\n /**\n * The shape of the parameters provided to the execute function.\n * Must be a Zod object schema.\n */\n inputSchema: import('zod').ZodObject<any>\n /**\n * The execution function for the tool.\n * Will receive parameters provided by the agent that match the inputSchema.\n * The second parameter is optional execution context containing the Payload instance\n * (available when using createPuckPlugin with auto-registered endpoints).\n */\n execute: (params: TInput, context?: AiToolContext) => Promise<TOutput> | TOutput\n /**\n * Optional name for the tool\n */\n name?: string\n}\n\n// =============================================================================\n// AI Configuration Types\n// =============================================================================\n\n/**\n * AI-specific configuration options for the server-side handler\n */\nexport interface AiOptions {\n /**\n * System context and instructions for the AI agent.\n * Guides the AI's behavior and output.\n *\n * @example\n * ```typescript\n * context: `## Overview\n * We are Google. You help us build Google landing pages.\n *\n * ## Brand Guidelines\n * Our brand colors are:\n * - #4285F4 (primary)\n * - #DB4437\n *\n * ## Tone of Voice\n * - American English\n * - Professional but friendly`\n * ```\n */\n context?: string\n /**\n * Custom tools that enable the AI to execute server-side functions.\n * Tools allow the agent to query your database, fetch external data, etc.\n */\n tools?: Record<string, AiTool>\n /**\n * Custom Puck Cloud API key.\n * Defaults to PUCK_API_KEY environment variable.\n */\n apiKey?: string\n /**\n * Custom Puck Cloud host URL\n */\n host?: string\n}\n\n// =============================================================================\n// AI Field Configuration\n// =============================================================================\n\n/**\n * AI configuration for a Puck field\n *\n * Add to any field's configuration to control how the AI generates content for it.\n *\n * @example\n * ```typescript\n * fields: {\n * title: {\n * type: 'text',\n * ai: {\n * instructions: 'Always use sentence case',\n * required: true,\n * },\n * },\n * }\n * ```\n */\nexport interface AiFieldConfig {\n /**\n * Instructions for the AI when generating this field's value\n */\n instructions?: string\n /**\n * Whether this field is required for AI generation\n * (even if not present in defaultProps)\n */\n required?: boolean\n /**\n * Exclude this field from AI generation.\n * Useful for fields like media library references that AI can't populate.\n */\n exclude?: boolean\n /**\n * Custom JSON schema for the field.\n * Required for 'custom', 'external', or user-defined fields\n * where Puck AI cannot automatically infer the schema.\n */\n schema?: {\n type: string\n [key: string]: unknown\n }\n}\n\n/**\n * AI configuration for a Puck component\n *\n * @example\n * ```typescript\n * const HeadingConfig = {\n * ai: {\n * instructions: 'Always place this at the top of sections',\n * },\n * fields: { ... },\n * render: ({ title }) => <h1>{title}</h1>,\n * }\n * ```\n */\nexport interface AiComponentConfig {\n /**\n * Instructions for the AI when using this component\n */\n instructions?: string\n /**\n * Custom JSON schema for the entire component.\n * For when Puck can't infer from fields.\n */\n schema?: {\n type: 'object'\n parameters: Record<string, { type: string; [key: string]: unknown }>\n required?: string[]\n }\n}\n\n// =============================================================================\n// API Routes Configuration\n// =============================================================================\n\n/**\n * Configuration for Puck AI API routes\n *\n * @example\n * ```typescript\n * // app/api/puck/[...all]/route.ts\n * import { createPuckAiApiRoutes } from '@delmaredigital/payload-puck/ai'\n *\n * export const POST = createPuckAiApiRoutes({\n * payloadConfig: config,\n * auth: {\n * authenticate: async (request) => {\n * // Your auth implementation\n * },\n * },\n * ai: {\n * context: 'We are Acme Corp. You build our landing pages.',\n * },\n * })\n * ```\n */\nexport interface PuckAiRoutesConfig {\n /**\n * Payload configuration - import from @payload-config\n */\n payloadConfig: Promise<SanitizedConfig>\n /**\n * Authentication hooks (reuses existing pattern from API routes)\n */\n auth: PuckApiAuthHooks\n /**\n * AI-specific options\n */\n ai?: AiOptions\n /**\n * Custom error handler for logging/monitoring\n */\n onError?: (error: unknown, context: { operation: string; request: NextRequest }) => void\n}\n\n/**\n * Route handlers returned by createPuckAiApiRoutes\n */\nexport interface PuckAiRouteHandlers {\n POST: (request: NextRequest) => Promise<Response>\n}\n\n// =============================================================================\n// Headless Generation Configuration\n// =============================================================================\n\n/**\n * Configuration for headless AI page generation\n *\n * @example\n * ```typescript\n * const generatePage = createAiGenerate({\n * payloadConfig: config,\n * auth: { authenticate: async (req) => ... },\n * ai: { context: 'We are Acme Corp...' },\n * })\n *\n * const pageData = await generatePage({\n * prompt: 'Create a landing page for our new product',\n * puckConfig: editorConfig,\n * })\n * ```\n */\nexport interface AiGenerateConfig {\n /**\n * Payload configuration - import from @payload-config\n */\n payloadConfig: Promise<SanitizedConfig>\n /**\n * Authentication hooks\n */\n auth: PuckApiAuthHooks\n /**\n * AI-specific options\n */\n ai?: AiOptions\n}\n\n/**\n * Options for a single generation request\n */\nexport interface AiGenerateOptions {\n /**\n * Natural language prompt for generation\n */\n prompt: string\n /**\n * The Puck configuration with component definitions\n */\n puckConfig: PuckConfig\n /**\n * Optional authenticated user for the generation\n */\n user?: AuthenticatedUser\n /**\n * Existing Puck data to consider when actioning the prompt.\n * Use this to update an existing page rather than create from scratch.\n */\n pageData?: PuckData\n}\n\n/**\n * Function returned by createAiGenerate\n */\nexport type AiGenerateFunction = (options: AiGenerateOptions) => Promise<PuckData>\n\n// =============================================================================\n// Client Plugin Configuration\n// =============================================================================\n\n/**\n * Example prompt for the AI chat interface\n */\nexport interface AiExamplePrompt {\n /**\n * Display label for the prompt\n */\n label: string\n /**\n * The actual prompt text\n */\n prompt: string\n}\n\n/**\n * Configuration options for the AI plugin\n *\n * @example\n * ```typescript\n * const aiPlugin = createAiPlugin({\n * host: '/api/puck',\n * examplePrompts: [\n * { label: 'Landing page', prompt: 'Create a landing page about dogs' },\n * ],\n * })\n * ```\n */\nexport interface AiPluginOptions {\n /**\n * API host for AI requests.\n * @default '/api/puck'\n */\n host?: string\n /**\n * Example prompts to show in the chat interface.\n * Users can click these to quickly send common prompts.\n */\n examplePrompts?: AiExamplePrompt[]\n /**\n * Callback when user submits a prompt\n */\n onSubmit?: (prompt: string) => void\n}\n\n// =============================================================================\n// Config Injection Types\n// =============================================================================\n\n/**\n * AI configuration overrides for components\n *\n * Used with injectAiConfig to add AI metadata to existing component configs.\n *\n * @example\n * ```typescript\n * const overrides: ComponentAiOverrides = {\n * Heading: {\n * ai: {\n * instructions: 'Use for section titles',\n * },\n * fields: {\n * text: {\n * ai: { required: true },\n * },\n * },\n * },\n * }\n * ```\n */\nexport interface ComponentAiOverrides {\n [componentName: string]: {\n ai?: AiComponentConfig\n fields?: {\n [fieldName: string]: {\n ai?: AiFieldConfig\n }\n }\n }\n}\n\n// =============================================================================\n// Prompt Editor Plugin Types\n// =============================================================================\n\n/**\n * A stored AI prompt from the database\n */\nexport interface AiPrompt {\n id: string\n label: string\n prompt: string\n category?: string\n order?: number\n createdAt: string\n updatedAt: string\n}\n\n/**\n * A stored AI context entry from the database\n */\nexport interface AiContext {\n id: string\n name: string\n content: string\n category?: 'brand' | 'tone' | 'product' | 'industry' | 'technical' | 'patterns' | 'other'\n enabled: boolean\n order?: number\n createdAt: string\n updatedAt: string\n}\n\n/**\n * Configuration for the prompt editor plugin\n */\nexport interface PromptEditorPluginOptions {\n /**\n * API endpoint for prompt CRUD operations\n * @default '/api/puck/ai-prompts'\n */\n apiEndpoint?: string\n /**\n * Whether users can edit prompts in the panel\n * @default true\n */\n canEdit?: boolean\n /**\n * Whether to show the create button\n * @default true\n */\n canCreate?: boolean\n /**\n * Whether to show delete buttons\n * @default true\n */\n canDelete?: boolean\n}\n\n/**\n * Configuration for the context editor plugin\n */\nexport interface ContextEditorPluginOptions {\n /**\n * API endpoint for context CRUD operations\n * @default '/api/puck/ai-context'\n */\n apiEndpoint?: string\n /**\n * Whether users can edit context in the panel\n * @default true\n */\n canEdit?: boolean\n /**\n * Whether to show the create button\n * @default true\n */\n canCreate?: boolean\n /**\n * Whether to show delete buttons\n * @default true\n */\n canDelete?: boolean\n}\n\n// =============================================================================\n// Plugin System Integration Types\n// =============================================================================\n\n/**\n * AI configuration for createPuckPlugin\n */\nexport interface PuckPluginAiConfig {\n /**\n * Enable AI features\n * @default false\n */\n enabled?: boolean\n /**\n * System context for the AI agent\n */\n context?: string\n /**\n * Custom tools that enable the AI to execute server-side functions.\n * Tools allow the agent to query your database, fetch external data, etc.\n *\n * @example\n * ```typescript\n * import { z } from 'zod'\n *\n * createPuckPlugin({\n * ai: {\n * enabled: true,\n * tools: {\n * getProducts: {\n * description: 'Get products from the database',\n * inputSchema: z.object({ category: z.string() }),\n * execute: async ({ category }) => {\n * return await payload.find({ collection: 'products', where: { category } })\n * },\n * },\n * },\n * },\n * })\n * ```\n */\n tools?: Record<string, AiTool>\n /**\n * Example prompts for the chat interface\n */\n examplePrompts?: AiExamplePrompt[]\n /**\n * Auto-create puck-ai-prompts collection for storing prompts\n * @default false\n */\n promptsCollection?: boolean\n /**\n * Auto-create puck-ai-context collection for dynamic business context.\n * When enabled, context entries can be managed via Payload admin and\n * the Context Editor panel in the Puck editor.\n * @default false\n */\n contextCollection?: boolean\n /**\n * Custom component AI instructions to override or extend defaults.\n * When AI is enabled, built-in component instructions are auto-applied.\n * Use this to customize instructions for your brand/use case.\n *\n * @example\n * ```typescript\n * createPuckPlugin({\n * ai: {\n * enabled: true,\n * componentInstructions: {\n * Heading: {\n * ai: { instructions: 'Use our brand voice: professional but approachable' },\n * fields: {\n * text: { ai: { instructions: 'Keep under 8 words' } },\n * },\n * },\n * },\n * },\n * })\n * ```\n */\n componentInstructions?: ComponentAiOverrides\n}\n"],"names":[],"mappings":"AAwdA,gFAAgF;AAChF,kCAAkC;AAClC,gFAAgF;AAEhF;;CAEC,GACD,WA0EC"}
|