@delmaredigital/payload-puck 0.6.12 → 0.6.14
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 -2
- package/dist/admin/EditWithPuckButton.js +64 -26
- package/dist/admin/EditWithPuckCell.d.ts +0 -1
- package/dist/admin/EditWithPuckCell.js +42 -14
- package/dist/admin/PuckEditorView.d.ts +1 -2
- package/dist/admin/PuckEditorView.js +117 -33
- package/dist/admin/client.d.ts +2 -3
- package/dist/admin/client.js +3 -5
- package/dist/admin/generateAdminComponents.d.ts +0 -1
- package/dist/admin/generateAdminComponents.js +6 -8
- package/dist/admin/index.d.ts +5 -6
- package/dist/admin/index.js +2 -3
- package/dist/ai/collections/AiContext.d.ts +0 -1
- package/dist/ai/collections/AiContext.js +55 -30
- package/dist/ai/collections/AiPrompts.d.ts +0 -1
- package/dist/ai/collections/AiPrompts.js +23 -20
- package/dist/ai/createAiApiRoutes.d.ts +0 -1
- package/dist/ai/createAiApiRoutes.js +27 -20
- package/dist/ai/createAiGenerate.d.ts +0 -1
- package/dist/ai/createAiGenerate.js +6 -9
- package/dist/ai/createAiPlugin.d.ts +0 -1
- package/dist/ai/createAiPlugin.js +6 -10
- package/dist/ai/hooks/useAiContext.d.ts +0 -1
- package/dist/ai/hooks/useAiContext.js +49 -40
- package/dist/ai/hooks/useAiPrompts.d.ts +0 -1
- package/dist/ai/hooks/useAiPrompts.js +32 -26
- package/dist/ai/index.d.ts +0 -1
- package/dist/ai/index.js +8 -11
- package/dist/ai/plugins/ContextEditorPanel.d.ts +1 -2
- package/dist/ai/plugins/ContextEditorPanel.js +398 -108
- package/dist/ai/plugins/PromptEditorPanel.d.ts +1 -2
- package/dist/ai/plugins/PromptEditorPanel.js +236 -52
- package/dist/ai/plugins/contextEditorPlugin.d.ts +0 -1
- package/dist/ai/plugins/contextEditorPlugin.js +11 -6
- package/dist/ai/plugins/promptApiRoutes.d.ts +0 -1
- package/dist/ai/plugins/promptApiRoutes.js +118 -51
- package/dist/ai/plugins/promptEditorPlugin.d.ts +0 -1
- package/dist/ai/plugins/promptEditorPlugin.js +11 -6
- package/dist/ai/presets/componentAiDefaults.d.ts +0 -1
- package/dist/ai/presets/componentAiDefaults.js +107 -84
- package/dist/ai/presets/index.d.ts +0 -1
- package/dist/ai/presets/index.js +11 -19
- package/dist/ai/presets/instructions/interactive.d.ts +0 -1
- package/dist/ai/presets/instructions/interactive.js +84 -76
- package/dist/ai/presets/instructions/layout.d.ts +0 -1
- package/dist/ai/presets/instructions/layout.js +121 -118
- package/dist/ai/presets/instructions/media.d.ts +0 -1
- package/dist/ai/presets/instructions/media.js +30 -30
- package/dist/ai/presets/instructions/pagePatterns.d.ts +0 -1
- package/dist/ai/presets/instructions/pagePatterns.js +3 -7
- package/dist/ai/presets/instructions/schemas.d.ts +0 -1
- package/dist/ai/presets/instructions/schemas.js +494 -138
- package/dist/ai/presets/instructions/typography.d.ts +0 -1
- package/dist/ai/presets/instructions/typography.js +37 -34
- package/dist/ai/tools/index.d.ts +0 -1
- package/dist/ai/tools/index.js +91 -56
- package/dist/ai/types.d.ts +0 -1
- package/dist/ai/types.js +6 -2
- package/dist/ai/utils/injectAiConfig.d.ts +0 -1
- package/dist/ai/utils/injectAiConfig.js +32 -41
- package/dist/api/createPuckApiRoutes.d.ts +1 -2
- package/dist/api/createPuckApiRoutes.js +122 -66
- package/dist/api/createPuckApiRoutesVersions.d.ts +1 -2
- package/dist/api/createPuckApiRoutesVersions.js +87 -38
- package/dist/api/createPuckApiRoutesWithId.d.ts +1 -2
- package/dist/api/createPuckApiRoutesWithId.js +165 -73
- package/dist/api/index.d.ts +5 -6
- package/dist/api/index.js +5 -7
- package/dist/api/payload-config.d.js +14 -0
- package/dist/api/types.d.ts +0 -1
- package/dist/api/types.js +3 -2
- package/dist/api/utils/mapRootProps.d.ts +1 -2
- package/dist/api/utils/mapRootProps.js +76 -45
- package/dist/collections/Templates.d.ts +0 -1
- package/dist/collections/Templates.js +23 -21
- package/dist/components/AccordionClient.d.ts +2 -3
- package/dist/components/AccordionClient.js +80 -23
- package/dist/components/AnimatedWrapper.d.ts +2 -3
- package/dist/components/AnimatedWrapper.js +30 -17
- package/dist/components/exports.d.ts +0 -1
- package/dist/components/exports.js +1 -3
- package/dist/components/index.d.ts +5 -6
- package/dist/components/index.js +6 -8
- package/dist/components/interactive/Accordion.d.ts +1 -2
- package/dist/components/interactive/Accordion.js +148 -56
- package/dist/components/interactive/Accordion.server.d.ts +1 -2
- package/dist/components/interactive/Accordion.server.js +24 -8
- package/dist/components/interactive/Button.d.ts +3 -4
- package/dist/components/interactive/Button.js +88 -44
- package/dist/components/interactive/Button.server.d.ts +2 -3
- package/dist/components/interactive/Button.server.js +39 -21
- package/dist/components/interactive/Card.d.ts +3 -4
- package/dist/components/interactive/Card.js +130 -40
- package/dist/components/interactive/Card.server.d.ts +3 -4
- package/dist/components/interactive/Card.server.js +71 -12
- package/dist/components/interactive/Divider.d.ts +1 -2
- package/dist/components/interactive/Divider.js +53 -27
- package/dist/components/interactive/Divider.server.d.ts +1 -2
- package/dist/components/interactive/Divider.server.js +27 -13
- package/dist/components/interactive/index.d.ts +4 -5
- package/dist/components/interactive/index.js +4 -6
- package/dist/components/layout/Container.d.ts +1 -2
- package/dist/components/layout/Container.js +100 -48
- package/dist/components/layout/Container.server.d.ts +1 -2
- package/dist/components/layout/Container.server.js +66 -20
- package/dist/components/layout/Flex.d.ts +2 -3
- package/dist/components/layout/Flex.js +123 -56
- package/dist/components/layout/Flex.server.d.ts +1 -2
- package/dist/components/layout/Flex.server.js +49 -15
- package/dist/components/layout/Grid.d.ts +1 -2
- package/dist/components/layout/Grid.js +92 -45
- package/dist/components/layout/Grid.server.d.ts +1 -2
- package/dist/components/layout/Grid.server.js +55 -15
- package/dist/components/layout/Section.d.ts +1 -2
- package/dist/components/layout/Section.js +146 -65
- package/dist/components/layout/Section.server.d.ts +1 -2
- package/dist/components/layout/Section.server.js +91 -29
- package/dist/components/layout/Spacer.d.ts +1 -2
- package/dist/components/layout/Spacer.js +79 -31
- package/dist/components/layout/Spacer.server.d.ts +1 -2
- package/dist/components/layout/Spacer.server.js +30 -10
- package/dist/components/layout/Template.d.ts +1 -2
- package/dist/components/layout/Template.js +57 -31
- package/dist/components/layout/Template.server.d.ts +1 -2
- package/dist/components/layout/Template.server.js +42 -12
- package/dist/components/layout/index.d.ts +8 -9
- package/dist/components/layout/index.js +7 -9
- package/dist/components/media/Image.d.ts +3 -4
- package/dist/components/media/Image.js +121 -40
- package/dist/components/media/Image.server.d.ts +3 -4
- package/dist/components/media/Image.server.js +75 -14
- package/dist/components/media/index.d.ts +1 -2
- package/dist/components/media/index.js +1 -3
- package/dist/components/typography/Heading.d.ts +2 -3
- package/dist/components/typography/Heading.js +44 -26
- package/dist/components/typography/Heading.server.d.ts +2 -3
- package/dist/components/typography/Heading.server.js +15 -11
- package/dist/components/typography/RichText.editor.d.ts +1 -2
- package/dist/components/typography/RichText.editor.js +43 -20
- package/dist/components/typography/RichText.server.d.ts +2 -3
- package/dist/components/typography/RichText.server.js +32 -15
- package/dist/components/typography/Text.d.ts +2 -3
- package/dist/components/typography/Text.js +48 -24
- package/dist/components/typography/Text.server.d.ts +2 -3
- package/dist/components/typography/Text.server.js +20 -9
- package/dist/components/typography/index.d.ts +4 -5
- package/dist/components/typography/index.js +4 -6
- package/dist/config/config.editor.d.ts +3 -4
- package/dist/config/config.editor.js +118 -55
- package/dist/config/index.d.ts +4 -5
- package/dist/config/index.js +61 -36
- package/dist/config/merge.d.ts +1 -2
- package/dist/config/merge.js +22 -27
- package/dist/config/presets.d.ts +4 -5
- package/dist/config/presets.js +194 -76
- package/dist/config/types.d.ts +0 -1
- package/dist/config/types.js +5 -3
- package/dist/editor/PuckEditor.d.ts +4 -5
- package/dist/editor/PuckEditor.js +161 -71
- package/dist/editor/PuckEditorImpl.client.d.ts +4 -5
- package/dist/editor/PuckEditorImpl.client.js +303 -153
- package/dist/editor/components/DarkModeStyles.d.ts +0 -1
- package/dist/editor/components/DarkModeStyles.js +10 -13
- package/dist/editor/components/HeaderActions.d.ts +0 -1
- package/dist/editor/components/HeaderActions.js +307 -65
- package/dist/editor/components/IframeWrapper.d.ts +1 -2
- package/dist/editor/components/IframeWrapper.js +81 -59
- package/dist/editor/components/LoadingState.d.ts +1 -2
- package/dist/editor/components/LoadingState.js +16 -4
- package/dist/editor/components/PreviewModal.d.ts +0 -1
- package/dist/editor/components/PreviewModal.js +233 -79
- package/dist/editor/components/PreviewModeToggle.d.ts +0 -1
- package/dist/editor/components/PreviewModeToggle.js +42 -16
- package/dist/editor/components/VersionHistory.d.ts +0 -1
- package/dist/editor/components/VersionHistory.js +218 -72
- package/dist/editor/hooks/useDarkMode.d.ts +0 -1
- package/dist/editor/hooks/useDarkMode.js +35 -24
- package/dist/editor/hooks/useUnsavedChanges.d.ts +0 -1
- package/dist/editor/hooks/useUnsavedChanges.js +7 -9
- package/dist/editor/index.d.ts +0 -1
- package/dist/editor/index.js +4 -7
- package/dist/editor/plugins/VersionHistoryPanel.d.ts +0 -1
- package/dist/editor/plugins/VersionHistoryPanel.js +235 -76
- package/dist/editor/plugins/index.d.ts +0 -1
- package/dist/editor/plugins/index.js +3 -5
- package/dist/editor/plugins/versionHistoryPlugin.d.ts +0 -1
- package/dist/editor/plugins/versionHistoryPlugin.js +9 -9
- package/dist/editor/utils/detectPageTree.d.ts +0 -1
- package/dist/editor/utils/detectPageTree.js +4 -6
- package/dist/editor/utils/index.d.ts +0 -1
- package/dist/editor/utils/index.js +0 -1
- package/dist/editor/utils/injectPageTreeFields.d.ts +0 -1
- package/dist/editor/utils/injectPageTreeFields.js +12 -10
- package/dist/endpoints/ai.d.ts +0 -1
- package/dist/endpoints/ai.js +57 -35
- package/dist/endpoints/context.d.ts +0 -1
- package/dist/endpoints/context.js +85 -41
- package/dist/endpoints/index.d.ts +0 -1
- package/dist/endpoints/index.js +152 -77
- package/dist/endpoints/postcss.d.js +4 -0
- package/dist/endpoints/prompts.d.ts +0 -1
- package/dist/endpoints/prompts.js +80 -40
- package/dist/endpoints/styles.d.ts +0 -1
- package/dist/endpoints/styles.js +33 -37
- package/dist/exports/client.d.ts +0 -1
- package/dist/exports/client.js +1 -3
- package/dist/exports/rsc.d.ts +0 -1
- package/dist/exports/rsc.js +1 -3
- package/dist/fields/AlignmentField.d.ts +1 -2
- package/dist/fields/AlignmentField.js +92 -31
- package/dist/fields/AnimationField.d.ts +2 -3
- package/dist/fields/AnimationField.js +557 -85
- package/dist/fields/BackgroundField.d.ts +2 -3
- package/dist/fields/BackgroundField.js +753 -121
- package/dist/fields/BorderField.d.ts +2 -3
- package/dist/fields/BorderField.js +274 -74
- package/dist/fields/ColorPickerField.d.ts +2 -3
- package/dist/fields/ColorPickerField.js +209 -69
- package/dist/fields/ContentAlignmentField.d.ts +1 -2
- package/dist/fields/ContentAlignmentField.js +160 -76
- package/dist/fields/DimensionsField.d.ts +2 -3
- package/dist/fields/DimensionsField.js +574 -147
- package/dist/fields/FlexAlignmentField.d.ts +2 -3
- package/dist/fields/FlexAlignmentField.js +188 -52
- package/dist/fields/FolderPickerField.d.ts +8 -2
- package/dist/fields/FolderPickerField.js +287 -76
- package/dist/fields/GradientEditor.d.ts +2 -3
- package/dist/fields/GradientEditor.js +461 -87
- package/dist/fields/LockedField.d.ts +15 -3
- package/dist/fields/LockedField.js +179 -50
- package/dist/fields/MarginField.d.ts +2 -3
- package/dist/fields/MarginField.js +143 -47
- package/dist/fields/MediaField.d.ts +1 -2
- package/dist/fields/MediaField.js +687 -187
- package/dist/fields/PaddingField.d.ts +2 -3
- package/dist/fields/PaddingField.js +143 -47
- package/dist/fields/PageSegmentField.d.ts +15 -3
- package/dist/fields/PageSegmentField.js +155 -55
- package/dist/fields/ResetField.d.ts +1 -2
- package/dist/fields/ResetField.js +58 -32
- package/dist/fields/ResponsiveField.d.ts +1 -2
- package/dist/fields/ResponsiveField.js +232 -91
- package/dist/fields/ResponsiveVisibilityField.d.ts +2 -3
- package/dist/fields/ResponsiveVisibilityField.js +118 -37
- package/dist/fields/SizeField.d.ts +3 -4
- package/dist/fields/SizeField.js +225 -53
- package/dist/fields/SlugPreviewField.d.ts +8 -2
- package/dist/fields/SlugPreviewField.js +64 -17
- package/dist/fields/TemplateField.d.ts +1 -2
- package/dist/fields/TemplateField.js +361 -121
- package/dist/fields/TransformField.d.ts +2 -3
- package/dist/fields/TransformField.js +516 -82
- package/dist/fields/VerticalAlignmentField.d.ts +1 -2
- package/dist/fields/VerticalAlignmentField.js +92 -31
- package/dist/fields/WidthField.d.ts +2 -3
- package/dist/fields/WidthField.js +277 -82
- package/dist/fields/index.d.ts +41 -42
- package/dist/fields/index.js +36 -44
- package/dist/fields/richtext/controls/ColorPickerControl.d.ts +13 -3
- package/dist/fields/richtext/controls/ColorPickerControl.js +211 -48
- package/dist/fields/richtext/controls/DropdownPortal.d.ts +2 -3
- package/dist/fields/richtext/controls/DropdownPortal.js +35 -5
- package/dist/fields/richtext/controls/FontSizeControl.d.ts +9 -2
- package/dist/fields/richtext/controls/FontSizeControl.js +108 -25
- package/dist/fields/richtext/controls/HighlightControl.d.ts +12 -2
- package/dist/fields/richtext/controls/HighlightControl.js +53 -18
- package/dist/fields/richtext/controls/index.d.ts +5 -6
- package/dist/fields/richtext/controls/index.js +7 -12
- package/dist/fields/richtext/controls/shared.d.ts +0 -1
- package/dist/fields/richtext/controls/shared.js +107 -64
- package/dist/fields/richtext/createRichTextField.d.ts +18 -5
- package/dist/fields/richtext/createRichTextField.js +112 -27
- package/dist/fields/richtext/extensions/FontSize.d.ts +0 -1
- package/dist/fields/richtext/extensions/FontSize.js +25 -21
- package/dist/fields/richtext/extensions/index.d.ts +1 -2
- package/dist/fields/richtext/extensions/index.js +1 -3
- package/dist/fields/richtext/index.d.ts +6 -7
- package/dist/fields/richtext/index.js +7 -9
- package/dist/fields/shared.d.ts +1 -2
- package/dist/fields/shared.js +914 -479
- package/dist/hooks/index.d.ts +2 -3
- package/dist/hooks/index.js +2 -4
- package/dist/hooks/useResponsiveStyles.d.ts +1 -2
- package/dist/hooks/useResponsiveStyles.js +35 -33
- package/dist/hooks/useScrollAnimation.d.ts +0 -1
- package/dist/hooks/useScrollAnimation.js +25 -25
- package/dist/index.d.ts +4 -5
- package/dist/index.js +4 -6
- package/dist/layouts/LayoutWrapper.d.ts +3 -4
- package/dist/layouts/LayoutWrapper.js +114 -52
- package/dist/layouts/defaults.d.ts +1 -2
- package/dist/layouts/defaults.js +22 -32
- package/dist/layouts/index.d.ts +4 -5
- package/dist/layouts/index.js +4 -5
- package/dist/layouts/types.d.ts +0 -1
- package/dist/layouts/types.js +3 -3
- package/dist/layouts/utils.d.ts +1 -2
- package/dist/layouts/utils.js +31 -41
- package/dist/next/index.d.ts +0 -1
- package/dist/next/index.js +30 -35
- package/dist/plugin/collections/Pages.d.ts +2 -3
- package/dist/plugin/collections/Pages.js +45 -44
- package/dist/plugin/fields/index.d.ts +3 -4
- package/dist/plugin/fields/index.js +99 -79
- package/dist/plugin/fields/types.d.ts +1 -2
- package/dist/plugin/fields/types.js +25 -3
- package/dist/plugin/hooks/index.d.ts +1 -2
- package/dist/plugin/hooks/index.js +1 -3
- package/dist/plugin/hooks/isHomepageUnique.d.ts +0 -1
- package/dist/plugin/hooks/isHomepageUnique.js +27 -20
- package/dist/plugin/index.d.ts +8 -9
- package/dist/plugin/index.js +189 -189
- package/dist/render/HybridPageRenderer.d.ts +2 -3
- package/dist/render/HybridPageRenderer.js +57 -11
- package/dist/render/PageRenderer.d.ts +2 -3
- package/dist/render/PageRenderer.js +30 -15
- package/dist/render/PuckEditor.client.d.ts +1 -2
- package/dist/render/PuckEditor.client.js +32 -17
- package/dist/render/index.d.ts +5 -6
- package/dist/render/index.js +4 -7
- package/dist/styles/puck-dark-mode.css +101 -0
- package/dist/theme/context.d.ts +2 -3
- package/dist/theme/context.js +20 -19
- package/dist/theme/defaults.d.ts +1 -2
- package/dist/theme/defaults.js +82 -38
- package/dist/theme/example.d.ts +1 -2
- package/dist/theme/example.js +67 -31
- package/dist/theme/index.d.ts +5 -6
- package/dist/theme/index.js +5 -6
- package/dist/theme/types.d.ts +0 -1
- package/dist/theme/types.js +5 -3
- package/dist/theme/utils.d.ts +1 -2
- package/dist/theme/utils.js +23 -26
- package/dist/types/index.d.ts +6 -7
- package/dist/types/index.js +2 -2
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/index.js +12 -23
- package/dist/utils/migration.d.ts +1 -2
- package/dist/utils/migration.js +42 -50
- package/dist/utils/validation.d.ts +1 -2
- package/dist/utils/validation.js +35 -44
- package/dist/version.d.ts +1 -2
- package/dist/version.js +1 -2
- package/dist/views/PuckConfigContext.d.ts +1 -2
- package/dist/views/PuckConfigContext.js +24 -11
- package/dist/views/PuckEditorView.d.ts +1 -2
- package/dist/views/PuckEditorView.js +105 -39
- package/dist/views/index.d.ts +0 -1
- package/dist/views/index.js +1 -3
- package/package.json +62 -42
- package/dist/admin/EditWithPuckButton.d.ts.map +0 -1
- package/dist/admin/EditWithPuckButton.js.map +0 -1
- package/dist/admin/EditWithPuckCell.d.ts.map +0 -1
- package/dist/admin/EditWithPuckCell.js.map +0 -1
- package/dist/admin/PuckEditorView.d.ts.map +0 -1
- package/dist/admin/PuckEditorView.js.map +0 -1
- package/dist/admin/client.d.ts.map +0 -1
- package/dist/admin/client.js.map +0 -1
- package/dist/admin/generateAdminComponents.d.ts.map +0 -1
- package/dist/admin/generateAdminComponents.js.map +0 -1
- package/dist/admin/index.d.ts.map +0 -1
- package/dist/admin/index.js.map +0 -1
- package/dist/ai/collections/AiContext.d.ts.map +0 -1
- package/dist/ai/collections/AiContext.js.map +0 -1
- package/dist/ai/collections/AiPrompts.d.ts.map +0 -1
- package/dist/ai/collections/AiPrompts.js.map +0 -1
- package/dist/ai/createAiApiRoutes.d.ts.map +0 -1
- package/dist/ai/createAiApiRoutes.js.map +0 -1
- package/dist/ai/createAiGenerate.d.ts.map +0 -1
- package/dist/ai/createAiGenerate.js.map +0 -1
- package/dist/ai/createAiPlugin.d.ts.map +0 -1
- package/dist/ai/createAiPlugin.js.map +0 -1
- package/dist/ai/hooks/useAiContext.d.ts.map +0 -1
- package/dist/ai/hooks/useAiContext.js.map +0 -1
- package/dist/ai/hooks/useAiPrompts.d.ts.map +0 -1
- package/dist/ai/hooks/useAiPrompts.js.map +0 -1
- package/dist/ai/index.d.ts.map +0 -1
- package/dist/ai/index.js.map +0 -1
- package/dist/ai/plugins/ContextEditorPanel.d.ts.map +0 -1
- package/dist/ai/plugins/ContextEditorPanel.js.map +0 -1
- package/dist/ai/plugins/PromptEditorPanel.d.ts.map +0 -1
- package/dist/ai/plugins/PromptEditorPanel.js.map +0 -1
- package/dist/ai/plugins/contextEditorPlugin.d.ts.map +0 -1
- package/dist/ai/plugins/contextEditorPlugin.js.map +0 -1
- package/dist/ai/plugins/promptApiRoutes.d.ts.map +0 -1
- package/dist/ai/plugins/promptApiRoutes.js.map +0 -1
- package/dist/ai/plugins/promptEditorPlugin.d.ts.map +0 -1
- package/dist/ai/plugins/promptEditorPlugin.js.map +0 -1
- package/dist/ai/presets/componentAiDefaults.d.ts.map +0 -1
- package/dist/ai/presets/componentAiDefaults.js.map +0 -1
- package/dist/ai/presets/index.d.ts.map +0 -1
- package/dist/ai/presets/index.js.map +0 -1
- package/dist/ai/presets/instructions/interactive.d.ts.map +0 -1
- package/dist/ai/presets/instructions/interactive.js.map +0 -1
- package/dist/ai/presets/instructions/layout.d.ts.map +0 -1
- package/dist/ai/presets/instructions/layout.js.map +0 -1
- package/dist/ai/presets/instructions/media.d.ts.map +0 -1
- package/dist/ai/presets/instructions/media.js.map +0 -1
- package/dist/ai/presets/instructions/pagePatterns.d.ts.map +0 -1
- package/dist/ai/presets/instructions/pagePatterns.js.map +0 -1
- package/dist/ai/presets/instructions/schemas.d.ts.map +0 -1
- package/dist/ai/presets/instructions/schemas.js.map +0 -1
- package/dist/ai/presets/instructions/typography.d.ts.map +0 -1
- package/dist/ai/presets/instructions/typography.js.map +0 -1
- package/dist/ai/tools/index.d.ts.map +0 -1
- package/dist/ai/tools/index.js.map +0 -1
- package/dist/ai/types.d.ts.map +0 -1
- package/dist/ai/types.js.map +0 -1
- package/dist/ai/utils/injectAiConfig.d.ts.map +0 -1
- package/dist/ai/utils/injectAiConfig.js.map +0 -1
- package/dist/api/createPuckApiRoutes.d.ts.map +0 -1
- package/dist/api/createPuckApiRoutes.js.map +0 -1
- package/dist/api/createPuckApiRoutesVersions.d.ts.map +0 -1
- package/dist/api/createPuckApiRoutesVersions.js.map +0 -1
- package/dist/api/createPuckApiRoutesWithId.d.ts.map +0 -1
- package/dist/api/createPuckApiRoutesWithId.js.map +0 -1
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js.map +0 -1
- package/dist/api/types.d.ts.map +0 -1
- package/dist/api/types.js.map +0 -1
- package/dist/api/utils/mapRootProps.d.ts.map +0 -1
- package/dist/api/utils/mapRootProps.js.map +0 -1
- package/dist/collections/Templates.d.ts.map +0 -1
- package/dist/collections/Templates.js.map +0 -1
- package/dist/components/AccordionClient.d.ts.map +0 -1
- package/dist/components/AccordionClient.js.map +0 -1
- package/dist/components/AnimatedWrapper.d.ts.map +0 -1
- package/dist/components/AnimatedWrapper.js.map +0 -1
- package/dist/components/exports.d.ts.map +0 -1
- package/dist/components/exports.js.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/interactive/Accordion.d.ts.map +0 -1
- package/dist/components/interactive/Accordion.js.map +0 -1
- package/dist/components/interactive/Accordion.server.d.ts.map +0 -1
- package/dist/components/interactive/Accordion.server.js.map +0 -1
- package/dist/components/interactive/Button.d.ts.map +0 -1
- package/dist/components/interactive/Button.js.map +0 -1
- package/dist/components/interactive/Button.server.d.ts.map +0 -1
- package/dist/components/interactive/Button.server.js.map +0 -1
- package/dist/components/interactive/Card.d.ts.map +0 -1
- package/dist/components/interactive/Card.js.map +0 -1
- package/dist/components/interactive/Card.server.d.ts.map +0 -1
- package/dist/components/interactive/Card.server.js.map +0 -1
- package/dist/components/interactive/Divider.d.ts.map +0 -1
- package/dist/components/interactive/Divider.js.map +0 -1
- package/dist/components/interactive/Divider.server.d.ts.map +0 -1
- package/dist/components/interactive/Divider.server.js.map +0 -1
- package/dist/components/interactive/index.d.ts.map +0 -1
- package/dist/components/interactive/index.js.map +0 -1
- package/dist/components/layout/Container.d.ts.map +0 -1
- package/dist/components/layout/Container.js.map +0 -1
- package/dist/components/layout/Container.server.d.ts.map +0 -1
- package/dist/components/layout/Container.server.js.map +0 -1
- package/dist/components/layout/Flex.d.ts.map +0 -1
- package/dist/components/layout/Flex.js.map +0 -1
- package/dist/components/layout/Flex.server.d.ts.map +0 -1
- package/dist/components/layout/Flex.server.js.map +0 -1
- package/dist/components/layout/Grid.d.ts.map +0 -1
- package/dist/components/layout/Grid.js.map +0 -1
- package/dist/components/layout/Grid.server.d.ts.map +0 -1
- package/dist/components/layout/Grid.server.js.map +0 -1
- package/dist/components/layout/Section.d.ts.map +0 -1
- package/dist/components/layout/Section.js.map +0 -1
- package/dist/components/layout/Section.server.d.ts.map +0 -1
- package/dist/components/layout/Section.server.js.map +0 -1
- package/dist/components/layout/Spacer.d.ts.map +0 -1
- package/dist/components/layout/Spacer.js.map +0 -1
- package/dist/components/layout/Spacer.server.d.ts.map +0 -1
- package/dist/components/layout/Spacer.server.js.map +0 -1
- package/dist/components/layout/Template.d.ts.map +0 -1
- package/dist/components/layout/Template.js.map +0 -1
- package/dist/components/layout/Template.server.d.ts.map +0 -1
- package/dist/components/layout/Template.server.js.map +0 -1
- package/dist/components/layout/index.d.ts.map +0 -1
- package/dist/components/layout/index.js.map +0 -1
- package/dist/components/media/Image.d.ts.map +0 -1
- package/dist/components/media/Image.js.map +0 -1
- package/dist/components/media/Image.server.d.ts.map +0 -1
- package/dist/components/media/Image.server.js.map +0 -1
- package/dist/components/media/index.d.ts.map +0 -1
- package/dist/components/media/index.js.map +0 -1
- package/dist/components/typography/Heading.d.ts.map +0 -1
- package/dist/components/typography/Heading.js.map +0 -1
- package/dist/components/typography/Heading.server.d.ts.map +0 -1
- package/dist/components/typography/Heading.server.js.map +0 -1
- package/dist/components/typography/RichText.editor.d.ts.map +0 -1
- package/dist/components/typography/RichText.editor.js.map +0 -1
- package/dist/components/typography/RichText.server.d.ts.map +0 -1
- package/dist/components/typography/RichText.server.js.map +0 -1
- package/dist/components/typography/Text.d.ts.map +0 -1
- package/dist/components/typography/Text.js.map +0 -1
- package/dist/components/typography/Text.server.d.ts.map +0 -1
- package/dist/components/typography/Text.server.js.map +0 -1
- package/dist/components/typography/index.d.ts.map +0 -1
- package/dist/components/typography/index.js.map +0 -1
- package/dist/config/config.editor.d.ts.map +0 -1
- package/dist/config/config.editor.js.map +0 -1
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js.map +0 -1
- package/dist/config/merge.d.ts.map +0 -1
- package/dist/config/merge.js.map +0 -1
- package/dist/config/presets.d.ts.map +0 -1
- package/dist/config/presets.js.map +0 -1
- package/dist/config/types.d.ts.map +0 -1
- package/dist/config/types.js.map +0 -1
- package/dist/editor/PuckEditor.d.ts.map +0 -1
- package/dist/editor/PuckEditor.js.map +0 -1
- package/dist/editor/PuckEditorImpl.client.d.ts.map +0 -1
- package/dist/editor/PuckEditorImpl.client.js.map +0 -1
- package/dist/editor/components/DarkModeStyles.d.ts.map +0 -1
- package/dist/editor/components/DarkModeStyles.js.map +0 -1
- package/dist/editor/components/HeaderActions.d.ts.map +0 -1
- package/dist/editor/components/HeaderActions.js.map +0 -1
- package/dist/editor/components/IframeWrapper.d.ts.map +0 -1
- package/dist/editor/components/IframeWrapper.js.map +0 -1
- package/dist/editor/components/LoadingState.d.ts.map +0 -1
- package/dist/editor/components/LoadingState.js.map +0 -1
- package/dist/editor/components/PreviewModal.d.ts.map +0 -1
- package/dist/editor/components/PreviewModal.js.map +0 -1
- package/dist/editor/components/PreviewModeToggle.d.ts.map +0 -1
- package/dist/editor/components/PreviewModeToggle.js.map +0 -1
- package/dist/editor/components/VersionHistory.d.ts.map +0 -1
- package/dist/editor/components/VersionHistory.js.map +0 -1
- package/dist/editor/hooks/useDarkMode.d.ts.map +0 -1
- package/dist/editor/hooks/useDarkMode.js.map +0 -1
- package/dist/editor/hooks/useUnsavedChanges.d.ts.map +0 -1
- package/dist/editor/hooks/useUnsavedChanges.js.map +0 -1
- package/dist/editor/index.d.ts.map +0 -1
- package/dist/editor/index.js.map +0 -1
- package/dist/editor/plugins/VersionHistoryPanel.d.ts.map +0 -1
- package/dist/editor/plugins/VersionHistoryPanel.js.map +0 -1
- package/dist/editor/plugins/index.d.ts.map +0 -1
- package/dist/editor/plugins/index.js.map +0 -1
- package/dist/editor/plugins/versionHistoryPlugin.d.ts.map +0 -1
- package/dist/editor/plugins/versionHistoryPlugin.js.map +0 -1
- package/dist/editor/utils/detectPageTree.d.ts.map +0 -1
- package/dist/editor/utils/detectPageTree.js.map +0 -1
- package/dist/editor/utils/index.d.ts.map +0 -1
- package/dist/editor/utils/index.js.map +0 -1
- package/dist/editor/utils/injectPageTreeFields.d.ts.map +0 -1
- package/dist/editor/utils/injectPageTreeFields.js.map +0 -1
- package/dist/endpoints/ai.d.ts.map +0 -1
- package/dist/endpoints/ai.js.map +0 -1
- package/dist/endpoints/context.d.ts.map +0 -1
- package/dist/endpoints/context.js.map +0 -1
- package/dist/endpoints/index.d.ts.map +0 -1
- package/dist/endpoints/index.js.map +0 -1
- package/dist/endpoints/prompts.d.ts.map +0 -1
- package/dist/endpoints/prompts.js.map +0 -1
- package/dist/endpoints/styles.d.ts.map +0 -1
- package/dist/endpoints/styles.js.map +0 -1
- package/dist/exports/client.d.ts.map +0 -1
- package/dist/exports/client.js.map +0 -1
- package/dist/exports/rsc.d.ts.map +0 -1
- package/dist/exports/rsc.js.map +0 -1
- package/dist/fields/AlignmentField.d.ts.map +0 -1
- package/dist/fields/AlignmentField.js.map +0 -1
- package/dist/fields/AnimationField.d.ts.map +0 -1
- package/dist/fields/AnimationField.js.map +0 -1
- package/dist/fields/BackgroundField.d.ts.map +0 -1
- package/dist/fields/BackgroundField.js.map +0 -1
- package/dist/fields/BorderField.d.ts.map +0 -1
- package/dist/fields/BorderField.js.map +0 -1
- package/dist/fields/ColorPickerField.d.ts.map +0 -1
- package/dist/fields/ColorPickerField.js.map +0 -1
- package/dist/fields/ContentAlignmentField.d.ts.map +0 -1
- package/dist/fields/ContentAlignmentField.js.map +0 -1
- package/dist/fields/DimensionsField.d.ts.map +0 -1
- package/dist/fields/DimensionsField.js.map +0 -1
- package/dist/fields/FlexAlignmentField.d.ts.map +0 -1
- package/dist/fields/FlexAlignmentField.js.map +0 -1
- package/dist/fields/FolderPickerField.d.ts.map +0 -1
- package/dist/fields/FolderPickerField.js.map +0 -1
- package/dist/fields/GradientEditor.d.ts.map +0 -1
- package/dist/fields/GradientEditor.js.map +0 -1
- package/dist/fields/LockedField.d.ts.map +0 -1
- package/dist/fields/LockedField.js.map +0 -1
- package/dist/fields/MarginField.d.ts.map +0 -1
- package/dist/fields/MarginField.js.map +0 -1
- package/dist/fields/MediaField.d.ts.map +0 -1
- package/dist/fields/MediaField.js.map +0 -1
- package/dist/fields/PaddingField.d.ts.map +0 -1
- package/dist/fields/PaddingField.js.map +0 -1
- package/dist/fields/PageSegmentField.d.ts.map +0 -1
- package/dist/fields/PageSegmentField.js.map +0 -1
- package/dist/fields/ResetField.d.ts.map +0 -1
- package/dist/fields/ResetField.js.map +0 -1
- package/dist/fields/ResponsiveField.d.ts.map +0 -1
- package/dist/fields/ResponsiveField.js.map +0 -1
- package/dist/fields/ResponsiveVisibilityField.d.ts.map +0 -1
- package/dist/fields/ResponsiveVisibilityField.js.map +0 -1
- package/dist/fields/SizeField.d.ts.map +0 -1
- package/dist/fields/SizeField.js.map +0 -1
- package/dist/fields/SlugPreviewField.d.ts.map +0 -1
- package/dist/fields/SlugPreviewField.js.map +0 -1
- package/dist/fields/TemplateField.d.ts.map +0 -1
- package/dist/fields/TemplateField.js.map +0 -1
- package/dist/fields/TransformField.d.ts.map +0 -1
- package/dist/fields/TransformField.js.map +0 -1
- package/dist/fields/VerticalAlignmentField.d.ts.map +0 -1
- package/dist/fields/VerticalAlignmentField.js.map +0 -1
- package/dist/fields/WidthField.d.ts.map +0 -1
- package/dist/fields/WidthField.js.map +0 -1
- package/dist/fields/index.d.ts.map +0 -1
- package/dist/fields/index.js.map +0 -1
- package/dist/fields/richtext/controls/ColorPickerControl.d.ts.map +0 -1
- package/dist/fields/richtext/controls/ColorPickerControl.js.map +0 -1
- package/dist/fields/richtext/controls/DropdownPortal.d.ts.map +0 -1
- package/dist/fields/richtext/controls/DropdownPortal.js.map +0 -1
- package/dist/fields/richtext/controls/FontSizeControl.d.ts.map +0 -1
- package/dist/fields/richtext/controls/FontSizeControl.js.map +0 -1
- package/dist/fields/richtext/controls/HighlightControl.d.ts.map +0 -1
- package/dist/fields/richtext/controls/HighlightControl.js.map +0 -1
- package/dist/fields/richtext/controls/index.d.ts.map +0 -1
- package/dist/fields/richtext/controls/index.js.map +0 -1
- package/dist/fields/richtext/controls/shared.d.ts.map +0 -1
- package/dist/fields/richtext/controls/shared.js.map +0 -1
- package/dist/fields/richtext/createRichTextField.d.ts.map +0 -1
- package/dist/fields/richtext/createRichTextField.js.map +0 -1
- package/dist/fields/richtext/extensions/FontSize.d.ts.map +0 -1
- package/dist/fields/richtext/extensions/FontSize.js.map +0 -1
- package/dist/fields/richtext/extensions/index.d.ts.map +0 -1
- package/dist/fields/richtext/extensions/index.js.map +0 -1
- package/dist/fields/richtext/index.d.ts.map +0 -1
- package/dist/fields/richtext/index.js.map +0 -1
- package/dist/fields/shared.d.ts.map +0 -1
- package/dist/fields/shared.js.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useResponsiveStyles.d.ts.map +0 -1
- package/dist/hooks/useResponsiveStyles.js.map +0 -1
- package/dist/hooks/useScrollAnimation.d.ts.map +0 -1
- package/dist/hooks/useScrollAnimation.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/layouts/LayoutWrapper.d.ts.map +0 -1
- package/dist/layouts/LayoutWrapper.js.map +0 -1
- package/dist/layouts/defaults.d.ts.map +0 -1
- package/dist/layouts/defaults.js.map +0 -1
- package/dist/layouts/index.d.ts.map +0 -1
- package/dist/layouts/index.js.map +0 -1
- package/dist/layouts/types.d.ts.map +0 -1
- package/dist/layouts/types.js.map +0 -1
- package/dist/layouts/utils.d.ts.map +0 -1
- package/dist/layouts/utils.js.map +0 -1
- package/dist/next/index.d.ts.map +0 -1
- package/dist/next/index.js.map +0 -1
- package/dist/plugin/collections/Pages.d.ts.map +0 -1
- package/dist/plugin/collections/Pages.js.map +0 -1
- package/dist/plugin/fields/index.d.ts.map +0 -1
- package/dist/plugin/fields/index.js.map +0 -1
- package/dist/plugin/fields/types.d.ts.map +0 -1
- package/dist/plugin/fields/types.js.map +0 -1
- package/dist/plugin/hooks/index.d.ts.map +0 -1
- package/dist/plugin/hooks/index.js.map +0 -1
- package/dist/plugin/hooks/isHomepageUnique.d.ts.map +0 -1
- package/dist/plugin/hooks/isHomepageUnique.js.map +0 -1
- package/dist/plugin/index.d.ts.map +0 -1
- package/dist/plugin/index.js.map +0 -1
- package/dist/render/HybridPageRenderer.d.ts.map +0 -1
- package/dist/render/HybridPageRenderer.js.map +0 -1
- package/dist/render/PageRenderer.d.ts.map +0 -1
- package/dist/render/PageRenderer.js.map +0 -1
- package/dist/render/PuckEditor.client.d.ts.map +0 -1
- package/dist/render/PuckEditor.client.js.map +0 -1
- package/dist/render/index.d.ts.map +0 -1
- package/dist/render/index.js.map +0 -1
- package/dist/theme/context.d.ts.map +0 -1
- package/dist/theme/context.js.map +0 -1
- package/dist/theme/defaults.d.ts.map +0 -1
- package/dist/theme/defaults.js.map +0 -1
- package/dist/theme/example.d.ts.map +0 -1
- package/dist/theme/example.js.map +0 -1
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/index.js.map +0 -1
- package/dist/theme/types.d.ts.map +0 -1
- package/dist/theme/types.js.map +0 -1
- package/dist/theme/utils.d.ts.map +0 -1
- package/dist/theme/utils.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/migration.d.ts.map +0 -1
- package/dist/utils/migration.js.map +0 -1
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/views/PuckConfigContext.d.ts.map +0 -1
- package/dist/views/PuckConfigContext.js.map +0 -1
- package/dist/views/PuckEditorView.d.ts.map +0 -1
- package/dist/views/PuckEditorView.js.map +0 -1
- package/dist/views/index.d.ts.map +0 -1
- package/dist/views/index.js.map +0 -1
|
@@ -4,6 +4,5 @@ interface PromptEditorPanelProps extends PromptEditorPluginOptions {
|
|
|
4
4
|
/**
|
|
5
5
|
* Panel component for managing AI prompts in the Puck editor sidebar
|
|
6
6
|
*/
|
|
7
|
-
export declare function PromptEditorPanel({ apiEndpoint, canEdit, canCreate, canDelete, }: PromptEditorPanelProps): import("react
|
|
7
|
+
export declare function PromptEditorPanel({ apiEndpoint, canEdit, canCreate, canDelete, }: PromptEditorPanelProps): import("react").JSX.Element;
|
|
8
8
|
export {};
|
|
9
|
-
//# sourceMappingURL=PromptEditorPanel.d.ts.map
|
|
@@ -5,15 +5,14 @@ import { Plus, Pencil, Trash2, GripVertical, Save, X } from 'lucide-react';
|
|
|
5
5
|
import { dispatchPromptsUpdated } from '../hooks/useAiPrompts.js';
|
|
6
6
|
/**
|
|
7
7
|
* Panel component for managing AI prompts in the Puck editor sidebar
|
|
8
|
-
*/
|
|
9
|
-
export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdit = true, canCreate = true, canDelete = true, }) {
|
|
8
|
+
*/ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdit = true, canCreate = true, canDelete = true }) {
|
|
10
9
|
const [prompts, setPrompts] = useState([]);
|
|
11
10
|
const [loading, setLoading] = useState(true);
|
|
12
11
|
const [error, setError] = useState(null);
|
|
13
12
|
const [editingPrompt, setEditingPrompt] = useState(null);
|
|
14
13
|
const [saving, setSaving] = useState(false);
|
|
15
14
|
// Fetch prompts on mount
|
|
16
|
-
const fetchPrompts = useCallback(async ()
|
|
15
|
+
const fetchPrompts = useCallback(async ()=>{
|
|
17
16
|
try {
|
|
18
17
|
setLoading(true);
|
|
19
18
|
setError(null);
|
|
@@ -23,21 +22,22 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
23
22
|
}
|
|
24
23
|
const data = await response.json();
|
|
25
24
|
setPrompts(data.docs || []);
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
25
|
+
} catch (err) {
|
|
28
26
|
setError(err instanceof Error ? err.message : 'Failed to load prompts');
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
27
|
+
} finally{
|
|
31
28
|
setLoading(false);
|
|
32
29
|
}
|
|
33
|
-
}, [
|
|
34
|
-
|
|
30
|
+
}, [
|
|
31
|
+
apiEndpoint
|
|
32
|
+
]);
|
|
33
|
+
useEffect(()=>{
|
|
35
34
|
fetchPrompts();
|
|
36
|
-
}, [
|
|
35
|
+
}, [
|
|
36
|
+
fetchPrompts
|
|
37
|
+
]);
|
|
37
38
|
// Save prompt (create or update)
|
|
38
|
-
const handleSave = async ()
|
|
39
|
-
if (!editingPrompt)
|
|
40
|
-
return;
|
|
39
|
+
const handleSave = async ()=>{
|
|
40
|
+
if (!editingPrompt) return;
|
|
41
41
|
try {
|
|
42
42
|
setSaving(true);
|
|
43
43
|
setError(null);
|
|
@@ -46,13 +46,15 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
46
46
|
const method = isNew ? 'POST' : 'PATCH';
|
|
47
47
|
const response = await fetch(url, {
|
|
48
48
|
method,
|
|
49
|
-
headers: {
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'application/json'
|
|
51
|
+
},
|
|
50
52
|
body: JSON.stringify({
|
|
51
53
|
label: editingPrompt.label,
|
|
52
54
|
prompt: editingPrompt.prompt,
|
|
53
55
|
category: editingPrompt.category,
|
|
54
|
-
order: editingPrompt.order
|
|
55
|
-
})
|
|
56
|
+
order: editingPrompt.order
|
|
57
|
+
})
|
|
56
58
|
});
|
|
57
59
|
if (!response.ok) {
|
|
58
60
|
throw new Error('Failed to save prompt');
|
|
@@ -61,22 +63,19 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
61
63
|
await fetchPrompts();
|
|
62
64
|
// Notify AI plugin to refresh its prompts
|
|
63
65
|
dispatchPromptsUpdated();
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
+
} catch (err) {
|
|
66
67
|
setError(err instanceof Error ? err.message : 'Failed to save prompt');
|
|
67
|
-
}
|
|
68
|
-
finally {
|
|
68
|
+
} finally{
|
|
69
69
|
setSaving(false);
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
// Delete prompt
|
|
73
|
-
const handleDelete = async (id)
|
|
74
|
-
if (!confirm('Are you sure you want to delete this prompt?'))
|
|
75
|
-
return;
|
|
73
|
+
const handleDelete = async (id)=>{
|
|
74
|
+
if (!confirm('Are you sure you want to delete this prompt?')) return;
|
|
76
75
|
try {
|
|
77
76
|
setError(null);
|
|
78
77
|
const response = await fetch(`${apiEndpoint}/${id}`, {
|
|
79
|
-
method: 'DELETE'
|
|
78
|
+
method: 'DELETE'
|
|
80
79
|
});
|
|
81
80
|
if (!response.ok) {
|
|
82
81
|
throw new Error('Failed to delete prompt');
|
|
@@ -84,8 +83,7 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
84
83
|
await fetchPrompts();
|
|
85
84
|
// Notify AI plugin to refresh its prompts
|
|
86
85
|
dispatchPromptsUpdated();
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
86
|
+
} catch (err) {
|
|
89
87
|
setError(err instanceof Error ? err.message : 'Failed to delete prompt');
|
|
90
88
|
}
|
|
91
89
|
};
|
|
@@ -97,19 +95,19 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
97
95
|
flexDirection: 'column',
|
|
98
96
|
gap: '12px',
|
|
99
97
|
height: '100%',
|
|
100
|
-
overflowY: 'auto'
|
|
98
|
+
overflowY: 'auto'
|
|
101
99
|
},
|
|
102
100
|
header: {
|
|
103
101
|
display: 'flex',
|
|
104
102
|
justifyContent: 'space-between',
|
|
105
103
|
alignItems: 'center',
|
|
106
|
-
marginBottom: '8px'
|
|
104
|
+
marginBottom: '8px'
|
|
107
105
|
},
|
|
108
106
|
title: {
|
|
109
107
|
fontSize: '14px',
|
|
110
108
|
fontWeight: 600,
|
|
111
109
|
color: 'var(--puck-color-grey-01)',
|
|
112
|
-
margin: 0
|
|
110
|
+
margin: 0
|
|
113
111
|
},
|
|
114
112
|
addButton: {
|
|
115
113
|
display: 'flex',
|
|
@@ -122,7 +120,7 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
122
120
|
backgroundColor: 'var(--puck-color-azure-12)',
|
|
123
121
|
border: 'none',
|
|
124
122
|
borderRadius: '4px',
|
|
125
|
-
cursor: 'pointer'
|
|
123
|
+
cursor: 'pointer'
|
|
126
124
|
},
|
|
127
125
|
promptItem: {
|
|
128
126
|
display: 'flex',
|
|
@@ -131,28 +129,28 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
131
129
|
padding: '12px',
|
|
132
130
|
backgroundColor: 'var(--puck-color-grey-12)',
|
|
133
131
|
borderRadius: '6px',
|
|
134
|
-
border: '1px solid var(--puck-color-grey-09)'
|
|
132
|
+
border: '1px solid var(--puck-color-grey-09)'
|
|
135
133
|
},
|
|
136
134
|
promptContent: {
|
|
137
135
|
flex: 1,
|
|
138
|
-
minWidth: 0
|
|
136
|
+
minWidth: 0
|
|
139
137
|
},
|
|
140
138
|
promptLabel: {
|
|
141
139
|
fontSize: '13px',
|
|
142
140
|
fontWeight: 500,
|
|
143
141
|
color: 'var(--puck-color-grey-02)',
|
|
144
|
-
marginBottom: '4px'
|
|
142
|
+
marginBottom: '4px'
|
|
145
143
|
},
|
|
146
144
|
promptText: {
|
|
147
145
|
fontSize: '12px',
|
|
148
146
|
color: 'var(--puck-color-grey-04)',
|
|
149
147
|
overflow: 'hidden',
|
|
150
148
|
textOverflow: 'ellipsis',
|
|
151
|
-
whiteSpace: 'nowrap'
|
|
149
|
+
whiteSpace: 'nowrap'
|
|
152
150
|
},
|
|
153
151
|
promptActions: {
|
|
154
152
|
display: 'flex',
|
|
155
|
-
gap: '4px'
|
|
153
|
+
gap: '4px'
|
|
156
154
|
},
|
|
157
155
|
iconButton: {
|
|
158
156
|
display: 'flex',
|
|
@@ -165,7 +163,7 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
165
163
|
border: 'none',
|
|
166
164
|
borderRadius: '4px',
|
|
167
165
|
cursor: 'pointer',
|
|
168
|
-
color: 'var(--puck-color-grey-05)'
|
|
166
|
+
color: 'var(--puck-color-grey-05)'
|
|
169
167
|
},
|
|
170
168
|
form: {
|
|
171
169
|
display: 'flex',
|
|
@@ -174,17 +172,17 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
174
172
|
padding: '16px',
|
|
175
173
|
backgroundColor: 'var(--puck-color-grey-11)',
|
|
176
174
|
borderRadius: '6px',
|
|
177
|
-
border: '1px solid var(--puck-color-grey-08)'
|
|
175
|
+
border: '1px solid var(--puck-color-grey-08)'
|
|
178
176
|
},
|
|
179
177
|
formField: {
|
|
180
178
|
display: 'flex',
|
|
181
179
|
flexDirection: 'column',
|
|
182
|
-
gap: '4px'
|
|
180
|
+
gap: '4px'
|
|
183
181
|
},
|
|
184
182
|
formLabel: {
|
|
185
183
|
fontSize: '12px',
|
|
186
184
|
fontWeight: 500,
|
|
187
|
-
color: 'var(--puck-color-grey-03)'
|
|
185
|
+
color: 'var(--puck-color-grey-03)'
|
|
188
186
|
},
|
|
189
187
|
formInput: {
|
|
190
188
|
padding: '8px 12px',
|
|
@@ -192,7 +190,7 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
192
190
|
backgroundColor: 'var(--puck-color-white)',
|
|
193
191
|
border: '1px solid var(--puck-color-grey-08)',
|
|
194
192
|
borderRadius: '4px',
|
|
195
|
-
color: 'var(--puck-color-grey-02)'
|
|
193
|
+
color: 'var(--puck-color-grey-02)'
|
|
196
194
|
},
|
|
197
195
|
formTextarea: {
|
|
198
196
|
padding: '8px 12px',
|
|
@@ -202,12 +200,12 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
202
200
|
borderRadius: '4px',
|
|
203
201
|
color: 'var(--puck-color-grey-02)',
|
|
204
202
|
resize: 'vertical',
|
|
205
|
-
minHeight: '80px'
|
|
203
|
+
minHeight: '80px'
|
|
206
204
|
},
|
|
207
205
|
formActions: {
|
|
208
206
|
display: 'flex',
|
|
209
207
|
gap: '8px',
|
|
210
|
-
justifyContent: 'flex-end'
|
|
208
|
+
justifyContent: 'flex-end'
|
|
211
209
|
},
|
|
212
210
|
saveButton: {
|
|
213
211
|
display: 'flex',
|
|
@@ -220,7 +218,7 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
220
218
|
backgroundColor: 'var(--puck-color-azure-04)',
|
|
221
219
|
border: 'none',
|
|
222
220
|
borderRadius: '4px',
|
|
223
|
-
cursor: 'pointer'
|
|
221
|
+
cursor: 'pointer'
|
|
224
222
|
},
|
|
225
223
|
cancelButton: {
|
|
226
224
|
display: 'flex',
|
|
@@ -233,7 +231,7 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
233
231
|
backgroundColor: 'var(--puck-color-grey-10)',
|
|
234
232
|
border: 'none',
|
|
235
233
|
borderRadius: '4px',
|
|
236
|
-
cursor: 'pointer'
|
|
234
|
+
cursor: 'pointer'
|
|
237
235
|
},
|
|
238
236
|
errorMessage: {
|
|
239
237
|
padding: '12px',
|
|
@@ -241,30 +239,216 @@ export function PromptEditorPanel({ apiEndpoint = '/api/puck/ai-prompts', canEdi
|
|
|
241
239
|
border: '1px solid var(--puck-color-red-08)',
|
|
242
240
|
borderRadius: '4px',
|
|
243
241
|
color: 'var(--puck-color-red-04)',
|
|
244
|
-
fontSize: '13px'
|
|
242
|
+
fontSize: '13px'
|
|
245
243
|
},
|
|
246
244
|
emptyState: {
|
|
247
245
|
textAlign: 'center',
|
|
248
246
|
padding: '24px',
|
|
249
247
|
color: 'var(--puck-color-grey-05)',
|
|
250
|
-
fontSize: '13px'
|
|
248
|
+
fontSize: '13px'
|
|
251
249
|
},
|
|
252
250
|
loading: {
|
|
253
251
|
textAlign: 'center',
|
|
254
252
|
padding: '24px',
|
|
255
253
|
color: 'var(--puck-color-grey-05)',
|
|
256
|
-
fontSize: '13px'
|
|
257
|
-
}
|
|
254
|
+
fontSize: '13px'
|
|
255
|
+
}
|
|
258
256
|
};
|
|
259
257
|
// Render loading state
|
|
260
258
|
if (loading) {
|
|
261
|
-
return
|
|
259
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
260
|
+
style: styles.container,
|
|
261
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
262
|
+
style: styles.loading,
|
|
263
|
+
children: "Loading prompts..."
|
|
264
|
+
})
|
|
265
|
+
});
|
|
262
266
|
}
|
|
263
267
|
// Render edit form
|
|
264
268
|
if (editingPrompt) {
|
|
265
|
-
return
|
|
269
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
270
|
+
style: styles.container,
|
|
271
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
272
|
+
style: styles.form,
|
|
273
|
+
children: [
|
|
274
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
275
|
+
style: styles.formField,
|
|
276
|
+
children: [
|
|
277
|
+
/*#__PURE__*/ _jsx("label", {
|
|
278
|
+
style: styles.formLabel,
|
|
279
|
+
children: "Label"
|
|
280
|
+
}),
|
|
281
|
+
/*#__PURE__*/ _jsx("input", {
|
|
282
|
+
type: "text",
|
|
283
|
+
style: styles.formInput,
|
|
284
|
+
value: editingPrompt.label || '',
|
|
285
|
+
onChange: (e)=>setEditingPrompt({
|
|
286
|
+
...editingPrompt,
|
|
287
|
+
label: e.target.value
|
|
288
|
+
}),
|
|
289
|
+
placeholder: "e.g., Landing page"
|
|
290
|
+
})
|
|
291
|
+
]
|
|
292
|
+
}),
|
|
293
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
294
|
+
style: styles.formField,
|
|
295
|
+
children: [
|
|
296
|
+
/*#__PURE__*/ _jsx("label", {
|
|
297
|
+
style: styles.formLabel,
|
|
298
|
+
children: "Prompt"
|
|
299
|
+
}),
|
|
300
|
+
/*#__PURE__*/ _jsx("textarea", {
|
|
301
|
+
style: styles.formTextarea,
|
|
302
|
+
value: editingPrompt.prompt || '',
|
|
303
|
+
onChange: (e)=>setEditingPrompt({
|
|
304
|
+
...editingPrompt,
|
|
305
|
+
prompt: e.target.value
|
|
306
|
+
}),
|
|
307
|
+
placeholder: "e.g., Create a landing page about our product..."
|
|
308
|
+
})
|
|
309
|
+
]
|
|
310
|
+
}),
|
|
311
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
312
|
+
style: styles.formField,
|
|
313
|
+
children: [
|
|
314
|
+
/*#__PURE__*/ _jsx("label", {
|
|
315
|
+
style: styles.formLabel,
|
|
316
|
+
children: "Category (optional)"
|
|
317
|
+
}),
|
|
318
|
+
/*#__PURE__*/ _jsx("input", {
|
|
319
|
+
type: "text",
|
|
320
|
+
style: styles.formInput,
|
|
321
|
+
value: editingPrompt.category || '',
|
|
322
|
+
onChange: (e)=>setEditingPrompt({
|
|
323
|
+
...editingPrompt,
|
|
324
|
+
category: e.target.value
|
|
325
|
+
}),
|
|
326
|
+
placeholder: "e.g., Marketing"
|
|
327
|
+
})
|
|
328
|
+
]
|
|
329
|
+
}),
|
|
330
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
331
|
+
style: styles.errorMessage,
|
|
332
|
+
children: error
|
|
333
|
+
}),
|
|
334
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
335
|
+
style: styles.formActions,
|
|
336
|
+
children: [
|
|
337
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
338
|
+
type: "button",
|
|
339
|
+
style: styles.cancelButton,
|
|
340
|
+
onClick: ()=>setEditingPrompt(null),
|
|
341
|
+
disabled: saving,
|
|
342
|
+
children: [
|
|
343
|
+
/*#__PURE__*/ _jsx(X, {
|
|
344
|
+
size: 14
|
|
345
|
+
}),
|
|
346
|
+
"Cancel"
|
|
347
|
+
]
|
|
348
|
+
}),
|
|
349
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
350
|
+
type: "button",
|
|
351
|
+
style: styles.saveButton,
|
|
352
|
+
onClick: handleSave,
|
|
353
|
+
disabled: saving || !editingPrompt.label || !editingPrompt.prompt,
|
|
354
|
+
children: [
|
|
355
|
+
/*#__PURE__*/ _jsx(Save, {
|
|
356
|
+
size: 14
|
|
357
|
+
}),
|
|
358
|
+
saving ? 'Saving...' : 'Save'
|
|
359
|
+
]
|
|
360
|
+
})
|
|
361
|
+
]
|
|
362
|
+
})
|
|
363
|
+
]
|
|
364
|
+
})
|
|
365
|
+
});
|
|
266
366
|
}
|
|
267
367
|
// Render prompt list
|
|
268
|
-
return
|
|
368
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
369
|
+
style: styles.container,
|
|
370
|
+
children: [
|
|
371
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
372
|
+
style: styles.header,
|
|
373
|
+
children: [
|
|
374
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
375
|
+
style: styles.title,
|
|
376
|
+
children: "Example Prompts"
|
|
377
|
+
}),
|
|
378
|
+
canCreate && /*#__PURE__*/ _jsxs("button", {
|
|
379
|
+
type: "button",
|
|
380
|
+
style: styles.addButton,
|
|
381
|
+
onClick: ()=>setEditingPrompt({
|
|
382
|
+
label: '',
|
|
383
|
+
prompt: ''
|
|
384
|
+
}),
|
|
385
|
+
children: [
|
|
386
|
+
/*#__PURE__*/ _jsx(Plus, {
|
|
387
|
+
size: 14
|
|
388
|
+
}),
|
|
389
|
+
"Add"
|
|
390
|
+
]
|
|
391
|
+
})
|
|
392
|
+
]
|
|
393
|
+
}),
|
|
394
|
+
error && /*#__PURE__*/ _jsx("div", {
|
|
395
|
+
style: styles.errorMessage,
|
|
396
|
+
children: error
|
|
397
|
+
}),
|
|
398
|
+
prompts.length === 0 ? /*#__PURE__*/ _jsxs("div", {
|
|
399
|
+
style: styles.emptyState,
|
|
400
|
+
children: [
|
|
401
|
+
"No prompts yet.",
|
|
402
|
+
canCreate && ' Click "Add" to create one.'
|
|
403
|
+
]
|
|
404
|
+
}) : prompts.map((prompt)=>/*#__PURE__*/ _jsxs("div", {
|
|
405
|
+
style: styles.promptItem,
|
|
406
|
+
children: [
|
|
407
|
+
/*#__PURE__*/ _jsx(GripVertical, {
|
|
408
|
+
size: 16,
|
|
409
|
+
style: {
|
|
410
|
+
color: 'var(--puck-color-grey-07)',
|
|
411
|
+
cursor: 'grab'
|
|
412
|
+
}
|
|
413
|
+
}),
|
|
414
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
415
|
+
style: styles.promptContent,
|
|
416
|
+
children: [
|
|
417
|
+
/*#__PURE__*/ _jsx("div", {
|
|
418
|
+
style: styles.promptLabel,
|
|
419
|
+
children: prompt.label
|
|
420
|
+
}),
|
|
421
|
+
/*#__PURE__*/ _jsx("div", {
|
|
422
|
+
style: styles.promptText,
|
|
423
|
+
children: prompt.prompt
|
|
424
|
+
})
|
|
425
|
+
]
|
|
426
|
+
}),
|
|
427
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
428
|
+
style: styles.promptActions,
|
|
429
|
+
children: [
|
|
430
|
+
canEdit && /*#__PURE__*/ _jsx("button", {
|
|
431
|
+
type: "button",
|
|
432
|
+
style: styles.iconButton,
|
|
433
|
+
onClick: ()=>setEditingPrompt(prompt),
|
|
434
|
+
title: "Edit prompt",
|
|
435
|
+
children: /*#__PURE__*/ _jsx(Pencil, {
|
|
436
|
+
size: 14
|
|
437
|
+
})
|
|
438
|
+
}),
|
|
439
|
+
canDelete && /*#__PURE__*/ _jsx("button", {
|
|
440
|
+
type: "button",
|
|
441
|
+
style: styles.iconButton,
|
|
442
|
+
onClick: ()=>handleDelete(prompt.id),
|
|
443
|
+
title: "Delete prompt",
|
|
444
|
+
children: /*#__PURE__*/ _jsx(Trash2, {
|
|
445
|
+
size: 14
|
|
446
|
+
})
|
|
447
|
+
})
|
|
448
|
+
]
|
|
449
|
+
})
|
|
450
|
+
]
|
|
451
|
+
}, prompt.id))
|
|
452
|
+
]
|
|
453
|
+
});
|
|
269
454
|
}
|
|
270
|
-
//# sourceMappingURL=PromptEditorPanel.js.map
|
|
@@ -27,14 +27,19 @@ import { ContextEditorPanel } from './ContextEditorPanel.js';
|
|
|
27
27
|
* canDelete: false, // Disable delete for non-admins
|
|
28
28
|
* })
|
|
29
29
|
* ```
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
const { apiEndpoint = '/api/puck/ai-context', canEdit = true, canCreate = true, canDelete = true, } = options;
|
|
30
|
+
*/ export function createContextEditorPlugin(options = {}) {
|
|
31
|
+
const { apiEndpoint = '/api/puck/ai-context', canEdit = true, canCreate = true, canDelete = true } = options;
|
|
33
32
|
return {
|
|
34
33
|
name: 'context-editor',
|
|
35
34
|
label: 'AI Context',
|
|
36
|
-
icon: _jsx(FileText, {
|
|
37
|
-
|
|
35
|
+
icon: /*#__PURE__*/ _jsx(FileText, {
|
|
36
|
+
size: 16
|
|
37
|
+
}),
|
|
38
|
+
render: ()=>/*#__PURE__*/ _jsx(ContextEditorPanel, {
|
|
39
|
+
apiEndpoint: apiEndpoint,
|
|
40
|
+
canEdit: canEdit,
|
|
41
|
+
canCreate: canCreate,
|
|
42
|
+
canDelete: canDelete
|
|
43
|
+
})
|
|
38
44
|
};
|
|
39
45
|
}
|
|
40
|
-
//# sourceMappingURL=contextEditorPlugin.js.map
|