@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
|
@@ -10,10 +10,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
10
10
|
* - Gradient stops list with color pickers and position sliders
|
|
11
11
|
* - Add/remove stop buttons
|
|
12
12
|
* - Visual gradient preview bar
|
|
13
|
-
*/
|
|
14
|
-
import { useCallback, memo, useState } from 'react';
|
|
13
|
+
*/ import React, { useCallback, memo, useState } from 'react';
|
|
15
14
|
import { Plus, Trash2 } from 'lucide-react';
|
|
16
|
-
import { colorValueToCSS } from './shared';
|
|
15
|
+
import { colorValueToCSS } from './shared.js';
|
|
17
16
|
// =============================================================================
|
|
18
17
|
// Default Values
|
|
19
18
|
// =============================================================================
|
|
@@ -21,11 +20,23 @@ const DEFAULT_GRADIENT = {
|
|
|
21
20
|
type: 'linear',
|
|
22
21
|
angle: 90,
|
|
23
22
|
stops: [
|
|
24
|
-
{
|
|
25
|
-
|
|
23
|
+
{
|
|
24
|
+
color: {
|
|
25
|
+
hex: '#000000',
|
|
26
|
+
opacity: 100
|
|
27
|
+
},
|
|
28
|
+
position: 0
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
color: {
|
|
32
|
+
hex: '#ffffff',
|
|
33
|
+
opacity: 100
|
|
34
|
+
},
|
|
35
|
+
position: 100
|
|
36
|
+
}
|
|
26
37
|
],
|
|
27
38
|
radialShape: 'circle',
|
|
28
|
-
radialPosition: 'center'
|
|
39
|
+
radialPosition: 'center'
|
|
29
40
|
};
|
|
30
41
|
// =============================================================================
|
|
31
42
|
// Styles
|
|
@@ -34,29 +45,29 @@ const styles = {
|
|
|
34
45
|
container: {
|
|
35
46
|
display: 'flex',
|
|
36
47
|
flexDirection: 'column',
|
|
37
|
-
gap: '16px'
|
|
48
|
+
gap: '16px'
|
|
38
49
|
},
|
|
39
50
|
preview: {
|
|
40
51
|
height: '48px',
|
|
41
52
|
borderRadius: '6px',
|
|
42
|
-
border: '1px solid var(--theme-elevation-150)'
|
|
53
|
+
border: '1px solid var(--theme-elevation-150)'
|
|
43
54
|
},
|
|
44
55
|
row: {
|
|
45
56
|
display: 'flex',
|
|
46
57
|
alignItems: 'center',
|
|
47
58
|
flexWrap: 'wrap',
|
|
48
|
-
gap: '8px'
|
|
59
|
+
gap: '8px'
|
|
49
60
|
},
|
|
50
61
|
label: {
|
|
51
62
|
fontSize: '12px',
|
|
52
63
|
color: 'var(--theme-elevation-500)',
|
|
53
64
|
width: '48px',
|
|
54
|
-
flexShrink: 0
|
|
65
|
+
flexShrink: 0
|
|
55
66
|
},
|
|
56
67
|
buttonGroup: {
|
|
57
68
|
display: 'flex',
|
|
58
69
|
flexWrap: 'wrap',
|
|
59
|
-
gap: '4px'
|
|
70
|
+
gap: '4px'
|
|
60
71
|
},
|
|
61
72
|
button: {
|
|
62
73
|
height: '28px',
|
|
@@ -66,7 +77,7 @@ const styles = {
|
|
|
66
77
|
borderRadius: '4px',
|
|
67
78
|
backgroundColor: 'var(--theme-bg)',
|
|
68
79
|
color: 'var(--theme-elevation-700)',
|
|
69
|
-
cursor: 'pointer'
|
|
80
|
+
cursor: 'pointer'
|
|
70
81
|
},
|
|
71
82
|
buttonActive: {
|
|
72
83
|
height: '28px',
|
|
@@ -76,20 +87,20 @@ const styles = {
|
|
|
76
87
|
borderRadius: '4px',
|
|
77
88
|
backgroundColor: 'var(--theme-elevation-800)',
|
|
78
89
|
color: 'var(--theme-bg)',
|
|
79
|
-
cursor: 'pointer'
|
|
90
|
+
cursor: 'pointer'
|
|
80
91
|
},
|
|
81
92
|
slider: {
|
|
82
93
|
flex: 1,
|
|
83
94
|
height: '6px',
|
|
84
95
|
accentColor: 'var(--theme-elevation-800)',
|
|
85
|
-
cursor: 'pointer'
|
|
96
|
+
cursor: 'pointer'
|
|
86
97
|
},
|
|
87
98
|
sliderValue: {
|
|
88
99
|
fontSize: '12px',
|
|
89
100
|
fontFamily: 'monospace',
|
|
90
101
|
color: 'var(--theme-elevation-500)',
|
|
91
102
|
width: '40px',
|
|
92
|
-
textAlign: 'right'
|
|
103
|
+
textAlign: 'right'
|
|
93
104
|
},
|
|
94
105
|
select: {
|
|
95
106
|
flex: 1,
|
|
@@ -100,12 +111,12 @@ const styles = {
|
|
|
100
111
|
borderRadius: '4px',
|
|
101
112
|
backgroundColor: 'var(--theme-input-bg)',
|
|
102
113
|
color: 'var(--theme-elevation-800)',
|
|
103
|
-
cursor: 'pointer'
|
|
114
|
+
cursor: 'pointer'
|
|
104
115
|
},
|
|
105
116
|
stopsHeader: {
|
|
106
117
|
display: 'flex',
|
|
107
118
|
alignItems: 'center',
|
|
108
|
-
justifyContent: 'space-between'
|
|
119
|
+
justifyContent: 'space-between'
|
|
109
120
|
},
|
|
110
121
|
addButton: {
|
|
111
122
|
display: 'flex',
|
|
@@ -118,12 +129,12 @@ const styles = {
|
|
|
118
129
|
borderRadius: '4px',
|
|
119
130
|
backgroundColor: 'var(--theme-bg)',
|
|
120
131
|
color: 'var(--theme-elevation-700)',
|
|
121
|
-
cursor: 'pointer'
|
|
132
|
+
cursor: 'pointer'
|
|
122
133
|
},
|
|
123
134
|
stopsList: {
|
|
124
135
|
display: 'flex',
|
|
125
136
|
flexDirection: 'column',
|
|
126
|
-
gap: '8px'
|
|
137
|
+
gap: '8px'
|
|
127
138
|
},
|
|
128
139
|
stopItem: {
|
|
129
140
|
display: 'flex',
|
|
@@ -132,13 +143,13 @@ const styles = {
|
|
|
132
143
|
padding: '8px',
|
|
133
144
|
backgroundColor: 'var(--theme-elevation-50)',
|
|
134
145
|
borderRadius: '6px',
|
|
135
|
-
overflow: 'hidden'
|
|
146
|
+
overflow: 'hidden'
|
|
136
147
|
},
|
|
137
148
|
stopRow: {
|
|
138
149
|
display: 'flex',
|
|
139
150
|
alignItems: 'center',
|
|
140
151
|
flexWrap: 'wrap',
|
|
141
|
-
gap: '8px'
|
|
152
|
+
gap: '8px'
|
|
142
153
|
},
|
|
143
154
|
colorPicker: {
|
|
144
155
|
width: '28px',
|
|
@@ -147,7 +158,7 @@ const styles = {
|
|
|
147
158
|
border: '1px solid var(--theme-elevation-150)',
|
|
148
159
|
borderRadius: '4px',
|
|
149
160
|
cursor: 'pointer',
|
|
150
|
-
flexShrink: 0
|
|
161
|
+
flexShrink: 0
|
|
151
162
|
},
|
|
152
163
|
hexInput: {
|
|
153
164
|
width: '80px',
|
|
@@ -159,7 +170,7 @@ const styles = {
|
|
|
159
170
|
border: '1px solid var(--theme-elevation-150)',
|
|
160
171
|
borderRadius: '4px',
|
|
161
172
|
backgroundColor: 'var(--theme-input-bg)',
|
|
162
|
-
color: 'var(--theme-elevation-800)'
|
|
173
|
+
color: 'var(--theme-elevation-800)'
|
|
163
174
|
},
|
|
164
175
|
swatch: {
|
|
165
176
|
width: '28px',
|
|
@@ -168,22 +179,22 @@ const styles = {
|
|
|
168
179
|
border: '1px solid var(--theme-elevation-150)',
|
|
169
180
|
flexShrink: 0,
|
|
170
181
|
position: 'relative',
|
|
171
|
-
overflow: 'hidden'
|
|
182
|
+
overflow: 'hidden'
|
|
172
183
|
},
|
|
173
184
|
checkerboard: {
|
|
174
185
|
position: 'absolute',
|
|
175
186
|
inset: 0,
|
|
176
187
|
backgroundImage: 'linear-gradient(45deg, #e0e0e0 25%, transparent 25%), linear-gradient(-45deg, #e0e0e0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e0e0e0 75%), linear-gradient(-45deg, transparent 75%, #e0e0e0 75%)',
|
|
177
188
|
backgroundSize: '8px 8px',
|
|
178
|
-
backgroundPosition: '0 0, 0 4px, 4px -4px, -4px 0px'
|
|
189
|
+
backgroundPosition: '0 0, 0 4px, 4px -4px, -4px 0px'
|
|
179
190
|
},
|
|
180
191
|
colorOverlay: {
|
|
181
192
|
position: 'absolute',
|
|
182
|
-
inset: 0
|
|
193
|
+
inset: 0
|
|
183
194
|
},
|
|
184
195
|
spacer: {
|
|
185
196
|
flex: 1,
|
|
186
|
-
minWidth: 0
|
|
197
|
+
minWidth: 0
|
|
187
198
|
},
|
|
188
199
|
deleteButton: {
|
|
189
200
|
padding: '4px',
|
|
@@ -192,20 +203,20 @@ const styles = {
|
|
|
192
203
|
backgroundColor: 'transparent',
|
|
193
204
|
color: 'var(--theme-elevation-500)',
|
|
194
205
|
cursor: 'pointer',
|
|
195
|
-
flexShrink: 0
|
|
206
|
+
flexShrink: 0
|
|
196
207
|
},
|
|
197
208
|
stopLabel: {
|
|
198
209
|
fontSize: '12px',
|
|
199
210
|
color: 'var(--theme-elevation-500)',
|
|
200
211
|
width: '48px',
|
|
201
|
-
flexShrink: 0
|
|
212
|
+
flexShrink: 0
|
|
202
213
|
},
|
|
203
214
|
rangeSlider: {
|
|
204
215
|
flex: 1,
|
|
205
216
|
height: '6px',
|
|
206
217
|
minWidth: 0,
|
|
207
218
|
accentColor: 'var(--theme-elevation-800)',
|
|
208
|
-
cursor: 'pointer'
|
|
219
|
+
cursor: 'pointer'
|
|
209
220
|
},
|
|
210
221
|
rangeValue: {
|
|
211
222
|
fontSize: '12px',
|
|
@@ -213,26 +224,25 @@ const styles = {
|
|
|
213
224
|
color: 'var(--theme-elevation-500)',
|
|
214
225
|
width: '32px',
|
|
215
226
|
textAlign: 'right',
|
|
216
|
-
flexShrink: 0
|
|
217
|
-
}
|
|
227
|
+
flexShrink: 0
|
|
228
|
+
}
|
|
218
229
|
};
|
|
219
230
|
// =============================================================================
|
|
220
231
|
// Helper Functions
|
|
221
232
|
// =============================================================================
|
|
222
233
|
/**
|
|
223
234
|
* Generates CSS gradient string for preview
|
|
224
|
-
*/
|
|
225
|
-
function getGradientPreviewCSS(gradient) {
|
|
235
|
+
*/ function getGradientPreviewCSS(gradient) {
|
|
226
236
|
if (!gradient.stops || gradient.stops.length === 0) {
|
|
227
237
|
return 'linear-gradient(90deg, #ccc 0%, #999 100%)';
|
|
228
238
|
}
|
|
229
|
-
const sortedStops = [
|
|
230
|
-
|
|
231
|
-
|
|
239
|
+
const sortedStops = [
|
|
240
|
+
...gradient.stops
|
|
241
|
+
].sort((a, b)=>a.position - b.position);
|
|
242
|
+
const stopsCSS = sortedStops.map((stop)=>{
|
|
232
243
|
const color = colorValueToCSS(stop.color) || 'transparent';
|
|
233
244
|
return `${color} ${stop.position}%`;
|
|
234
|
-
})
|
|
235
|
-
.join(', ');
|
|
245
|
+
}).join(', ');
|
|
236
246
|
if (gradient.type === 'radial') {
|
|
237
247
|
const shape = gradient.radialShape || 'circle';
|
|
238
248
|
const position = gradient.radialPosition || 'center';
|
|
@@ -240,86 +250,452 @@ function getGradientPreviewCSS(gradient) {
|
|
|
240
250
|
}
|
|
241
251
|
return `linear-gradient(${gradient.angle}deg, ${stopsCSS})`;
|
|
242
252
|
}
|
|
243
|
-
function GradientStopEditorInner({ stop, index, canDelete, onColorChange, onPositionChange, onDelete, readOnly
|
|
253
|
+
function GradientStopEditorInner({ stop, index, canDelete, onColorChange, onPositionChange, onDelete, readOnly }) {
|
|
244
254
|
const [hexInput, setHexInput] = useState(stop.color.hex);
|
|
245
|
-
const handleColorPickerChange = useCallback((e)
|
|
255
|
+
const handleColorPickerChange = useCallback((e)=>{
|
|
246
256
|
const newHex = e.target.value;
|
|
247
257
|
setHexInput(newHex);
|
|
248
|
-
onColorChange(index, {
|
|
249
|
-
|
|
250
|
-
|
|
258
|
+
onColorChange(index, {
|
|
259
|
+
...stop.color,
|
|
260
|
+
hex: newHex
|
|
261
|
+
});
|
|
262
|
+
}, [
|
|
263
|
+
index,
|
|
264
|
+
stop.color,
|
|
265
|
+
onColorChange
|
|
266
|
+
]);
|
|
267
|
+
const handleHexInputChange = useCallback((e)=>{
|
|
251
268
|
const input = e.target.value;
|
|
252
269
|
setHexInput(input);
|
|
253
270
|
// Validate hex format
|
|
254
271
|
const clean = input.replace(/^#/, '');
|
|
255
272
|
if (/^[0-9A-Fa-f]{6}$/.test(clean)) {
|
|
256
|
-
onColorChange(index, {
|
|
273
|
+
onColorChange(index, {
|
|
274
|
+
...stop.color,
|
|
275
|
+
hex: `#${clean.toLowerCase()}`
|
|
276
|
+
});
|
|
257
277
|
}
|
|
258
|
-
}, [
|
|
259
|
-
|
|
278
|
+
}, [
|
|
279
|
+
index,
|
|
280
|
+
stop.color,
|
|
281
|
+
onColorChange
|
|
282
|
+
]);
|
|
283
|
+
const handleOpacityChange = useCallback((e)=>{
|
|
260
284
|
const newOpacity = parseInt(e.target.value, 10);
|
|
261
|
-
onColorChange(index, {
|
|
262
|
-
|
|
263
|
-
|
|
285
|
+
onColorChange(index, {
|
|
286
|
+
...stop.color,
|
|
287
|
+
opacity: newOpacity
|
|
288
|
+
});
|
|
289
|
+
}, [
|
|
290
|
+
index,
|
|
291
|
+
stop.color,
|
|
292
|
+
onColorChange
|
|
293
|
+
]);
|
|
294
|
+
const handlePositionChange = useCallback((e)=>{
|
|
264
295
|
const newPosition = parseInt(e.target.value, 10);
|
|
265
296
|
onPositionChange(index, Math.max(0, Math.min(100, newPosition)));
|
|
266
|
-
}, [
|
|
297
|
+
}, [
|
|
298
|
+
index,
|
|
299
|
+
onPositionChange
|
|
300
|
+
]);
|
|
267
301
|
const previewColor = colorValueToCSS(stop.color) || 'transparent';
|
|
268
302
|
const opacity = stop.color.opacity ?? 100;
|
|
269
|
-
return
|
|
303
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
304
|
+
style: styles.stopItem,
|
|
305
|
+
children: [
|
|
306
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
307
|
+
style: styles.stopRow,
|
|
308
|
+
children: [
|
|
309
|
+
/*#__PURE__*/ _jsx("input", {
|
|
310
|
+
type: "color",
|
|
311
|
+
value: stop.color.hex,
|
|
312
|
+
onChange: handleColorPickerChange,
|
|
313
|
+
disabled: readOnly,
|
|
314
|
+
style: styles.colorPicker
|
|
315
|
+
}),
|
|
316
|
+
/*#__PURE__*/ _jsx("input", {
|
|
317
|
+
type: "text",
|
|
318
|
+
value: hexInput,
|
|
319
|
+
onChange: handleHexInputChange,
|
|
320
|
+
placeholder: "#000000",
|
|
321
|
+
disabled: readOnly,
|
|
322
|
+
style: styles.hexInput
|
|
323
|
+
}),
|
|
324
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
325
|
+
style: styles.swatch,
|
|
326
|
+
title: `${previewColor} at ${opacity}% opacity`,
|
|
327
|
+
children: [
|
|
328
|
+
/*#__PURE__*/ _jsx("div", {
|
|
329
|
+
style: styles.checkerboard
|
|
330
|
+
}),
|
|
331
|
+
/*#__PURE__*/ _jsx("div", {
|
|
332
|
+
style: {
|
|
333
|
+
...styles.colorOverlay,
|
|
334
|
+
backgroundColor: previewColor
|
|
335
|
+
}
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
}),
|
|
339
|
+
/*#__PURE__*/ _jsx("div", {
|
|
340
|
+
style: styles.spacer
|
|
341
|
+
}),
|
|
342
|
+
canDelete && !readOnly && /*#__PURE__*/ _jsx("button", {
|
|
343
|
+
type: "button",
|
|
344
|
+
onClick: ()=>onDelete(index),
|
|
345
|
+
style: styles.deleteButton,
|
|
346
|
+
title: "Remove stop",
|
|
347
|
+
children: /*#__PURE__*/ _jsx(Trash2, {
|
|
348
|
+
style: {
|
|
349
|
+
width: '16px',
|
|
350
|
+
height: '16px'
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
})
|
|
354
|
+
]
|
|
355
|
+
}),
|
|
356
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
357
|
+
style: styles.stopRow,
|
|
358
|
+
children: [
|
|
359
|
+
/*#__PURE__*/ _jsx("label", {
|
|
360
|
+
style: styles.stopLabel,
|
|
361
|
+
children: "Pos"
|
|
362
|
+
}),
|
|
363
|
+
/*#__PURE__*/ _jsx("input", {
|
|
364
|
+
type: "range",
|
|
365
|
+
min: "0",
|
|
366
|
+
max: "100",
|
|
367
|
+
value: stop.position,
|
|
368
|
+
onChange: handlePositionChange,
|
|
369
|
+
disabled: readOnly,
|
|
370
|
+
style: styles.rangeSlider
|
|
371
|
+
}),
|
|
372
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
373
|
+
style: styles.rangeValue,
|
|
374
|
+
children: [
|
|
375
|
+
stop.position,
|
|
376
|
+
"%"
|
|
377
|
+
]
|
|
378
|
+
})
|
|
379
|
+
]
|
|
380
|
+
}),
|
|
381
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
382
|
+
style: styles.stopRow,
|
|
383
|
+
children: [
|
|
384
|
+
/*#__PURE__*/ _jsx("label", {
|
|
385
|
+
style: styles.stopLabel,
|
|
386
|
+
children: "Alpha"
|
|
387
|
+
}),
|
|
388
|
+
/*#__PURE__*/ _jsx("input", {
|
|
389
|
+
type: "range",
|
|
390
|
+
min: "0",
|
|
391
|
+
max: "100",
|
|
392
|
+
value: opacity,
|
|
393
|
+
onChange: handleOpacityChange,
|
|
394
|
+
disabled: readOnly,
|
|
395
|
+
style: styles.rangeSlider
|
|
396
|
+
}),
|
|
397
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
398
|
+
style: styles.rangeValue,
|
|
399
|
+
children: [
|
|
400
|
+
opacity,
|
|
401
|
+
"%"
|
|
402
|
+
]
|
|
403
|
+
})
|
|
404
|
+
]
|
|
405
|
+
})
|
|
406
|
+
]
|
|
407
|
+
});
|
|
270
408
|
}
|
|
271
|
-
const GradientStopEditor = memo(GradientStopEditorInner);
|
|
409
|
+
const GradientStopEditor = /*#__PURE__*/ memo(GradientStopEditorInner);
|
|
272
410
|
// =============================================================================
|
|
273
411
|
// GradientEditor Component
|
|
274
412
|
// =============================================================================
|
|
275
413
|
function GradientEditorInner({ value, onChange, readOnly }) {
|
|
276
414
|
const currentValue = value || DEFAULT_GRADIENT;
|
|
277
415
|
// Handle gradient type change
|
|
278
|
-
const handleTypeChange = useCallback((type)
|
|
279
|
-
onChange({
|
|
280
|
-
|
|
416
|
+
const handleTypeChange = useCallback((type)=>{
|
|
417
|
+
onChange({
|
|
418
|
+
...currentValue,
|
|
419
|
+
type
|
|
420
|
+
});
|
|
421
|
+
}, [
|
|
422
|
+
currentValue,
|
|
423
|
+
onChange
|
|
424
|
+
]);
|
|
281
425
|
// Handle angle change
|
|
282
|
-
const handleAngleChange = useCallback((e)
|
|
426
|
+
const handleAngleChange = useCallback((e)=>{
|
|
283
427
|
const angle = parseInt(e.target.value, 10);
|
|
284
|
-
onChange({
|
|
285
|
-
|
|
428
|
+
onChange({
|
|
429
|
+
...currentValue,
|
|
430
|
+
angle
|
|
431
|
+
});
|
|
432
|
+
}, [
|
|
433
|
+
currentValue,
|
|
434
|
+
onChange
|
|
435
|
+
]);
|
|
286
436
|
// Handle radial shape change
|
|
287
|
-
const handleRadialShapeChange = useCallback((e)
|
|
288
|
-
onChange({
|
|
289
|
-
|
|
437
|
+
const handleRadialShapeChange = useCallback((e)=>{
|
|
438
|
+
onChange({
|
|
439
|
+
...currentValue,
|
|
440
|
+
radialShape: e.target.value
|
|
441
|
+
});
|
|
442
|
+
}, [
|
|
443
|
+
currentValue,
|
|
444
|
+
onChange
|
|
445
|
+
]);
|
|
290
446
|
// Handle radial position change
|
|
291
|
-
const handleRadialPositionChange = useCallback((e)
|
|
292
|
-
onChange({
|
|
293
|
-
|
|
447
|
+
const handleRadialPositionChange = useCallback((e)=>{
|
|
448
|
+
onChange({
|
|
449
|
+
...currentValue,
|
|
450
|
+
radialPosition: e.target.value
|
|
451
|
+
});
|
|
452
|
+
}, [
|
|
453
|
+
currentValue,
|
|
454
|
+
onChange
|
|
455
|
+
]);
|
|
294
456
|
// Handle stop color change
|
|
295
|
-
const handleStopColorChange = useCallback((index, color)
|
|
296
|
-
const newStops = [
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
457
|
+
const handleStopColorChange = useCallback((index, color)=>{
|
|
458
|
+
const newStops = [
|
|
459
|
+
...currentValue.stops
|
|
460
|
+
];
|
|
461
|
+
newStops[index] = {
|
|
462
|
+
...newStops[index],
|
|
463
|
+
color
|
|
464
|
+
};
|
|
465
|
+
onChange({
|
|
466
|
+
...currentValue,
|
|
467
|
+
stops: newStops
|
|
468
|
+
});
|
|
469
|
+
}, [
|
|
470
|
+
currentValue,
|
|
471
|
+
onChange
|
|
472
|
+
]);
|
|
300
473
|
// Handle stop position change
|
|
301
|
-
const handleStopPositionChange = useCallback((index, position)
|
|
302
|
-
const newStops = [
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
474
|
+
const handleStopPositionChange = useCallback((index, position)=>{
|
|
475
|
+
const newStops = [
|
|
476
|
+
...currentValue.stops
|
|
477
|
+
];
|
|
478
|
+
newStops[index] = {
|
|
479
|
+
...newStops[index],
|
|
480
|
+
position
|
|
481
|
+
};
|
|
482
|
+
onChange({
|
|
483
|
+
...currentValue,
|
|
484
|
+
stops: newStops
|
|
485
|
+
});
|
|
486
|
+
}, [
|
|
487
|
+
currentValue,
|
|
488
|
+
onChange
|
|
489
|
+
]);
|
|
306
490
|
// Handle add stop
|
|
307
|
-
const handleAddStop = useCallback(()
|
|
491
|
+
const handleAddStop = useCallback(()=>{
|
|
308
492
|
const newPosition = currentValue.stops.length > 0 ? 50 : 0;
|
|
309
493
|
const newStop = {
|
|
310
|
-
color: {
|
|
311
|
-
|
|
494
|
+
color: {
|
|
495
|
+
hex: '#888888',
|
|
496
|
+
opacity: 100
|
|
497
|
+
},
|
|
498
|
+
position: newPosition
|
|
312
499
|
};
|
|
313
|
-
onChange({
|
|
314
|
-
|
|
500
|
+
onChange({
|
|
501
|
+
...currentValue,
|
|
502
|
+
stops: [
|
|
503
|
+
...currentValue.stops,
|
|
504
|
+
newStop
|
|
505
|
+
]
|
|
506
|
+
});
|
|
507
|
+
}, [
|
|
508
|
+
currentValue,
|
|
509
|
+
onChange
|
|
510
|
+
]);
|
|
315
511
|
// Handle delete stop
|
|
316
|
-
const handleDeleteStop = useCallback((index)
|
|
317
|
-
const newStops = currentValue.stops.filter((_, i)
|
|
318
|
-
onChange({
|
|
319
|
-
|
|
512
|
+
const handleDeleteStop = useCallback((index)=>{
|
|
513
|
+
const newStops = currentValue.stops.filter((_, i)=>i !== index);
|
|
514
|
+
onChange({
|
|
515
|
+
...currentValue,
|
|
516
|
+
stops: newStops
|
|
517
|
+
});
|
|
518
|
+
}, [
|
|
519
|
+
currentValue,
|
|
520
|
+
onChange
|
|
521
|
+
]);
|
|
320
522
|
const previewCSS = getGradientPreviewCSS(currentValue);
|
|
321
523
|
const canDeleteStops = currentValue.stops.length > 2;
|
|
322
|
-
return
|
|
524
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
525
|
+
style: styles.container,
|
|
526
|
+
children: [
|
|
527
|
+
/*#__PURE__*/ _jsx("div", {
|
|
528
|
+
style: {
|
|
529
|
+
...styles.preview,
|
|
530
|
+
background: previewCSS
|
|
531
|
+
}
|
|
532
|
+
}),
|
|
533
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
534
|
+
style: styles.row,
|
|
535
|
+
children: [
|
|
536
|
+
/*#__PURE__*/ _jsx("label", {
|
|
537
|
+
style: styles.label,
|
|
538
|
+
children: "Type"
|
|
539
|
+
}),
|
|
540
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
541
|
+
style: styles.buttonGroup,
|
|
542
|
+
children: [
|
|
543
|
+
/*#__PURE__*/ _jsx("button", {
|
|
544
|
+
type: "button",
|
|
545
|
+
onClick: ()=>handleTypeChange('linear'),
|
|
546
|
+
disabled: readOnly,
|
|
547
|
+
style: currentValue.type === 'linear' ? styles.buttonActive : styles.button,
|
|
548
|
+
children: "Linear"
|
|
549
|
+
}),
|
|
550
|
+
/*#__PURE__*/ _jsx("button", {
|
|
551
|
+
type: "button",
|
|
552
|
+
onClick: ()=>handleTypeChange('radial'),
|
|
553
|
+
disabled: readOnly,
|
|
554
|
+
style: currentValue.type === 'radial' ? styles.buttonActive : styles.button,
|
|
555
|
+
children: "Radial"
|
|
556
|
+
})
|
|
557
|
+
]
|
|
558
|
+
})
|
|
559
|
+
]
|
|
560
|
+
}),
|
|
561
|
+
currentValue.type === 'linear' && /*#__PURE__*/ _jsxs("div", {
|
|
562
|
+
style: styles.row,
|
|
563
|
+
children: [
|
|
564
|
+
/*#__PURE__*/ _jsx("label", {
|
|
565
|
+
style: styles.label,
|
|
566
|
+
children: "Angle"
|
|
567
|
+
}),
|
|
568
|
+
/*#__PURE__*/ _jsx("input", {
|
|
569
|
+
type: "range",
|
|
570
|
+
min: "0",
|
|
571
|
+
max: "360",
|
|
572
|
+
value: currentValue.angle,
|
|
573
|
+
onChange: handleAngleChange,
|
|
574
|
+
disabled: readOnly,
|
|
575
|
+
style: styles.slider
|
|
576
|
+
}),
|
|
577
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
578
|
+
style: styles.sliderValue,
|
|
579
|
+
children: [
|
|
580
|
+
currentValue.angle,
|
|
581
|
+
"deg"
|
|
582
|
+
]
|
|
583
|
+
})
|
|
584
|
+
]
|
|
585
|
+
}),
|
|
586
|
+
currentValue.type === 'radial' && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
587
|
+
children: [
|
|
588
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
589
|
+
style: styles.row,
|
|
590
|
+
children: [
|
|
591
|
+
/*#__PURE__*/ _jsx("label", {
|
|
592
|
+
style: styles.label,
|
|
593
|
+
children: "Shape"
|
|
594
|
+
}),
|
|
595
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
596
|
+
value: currentValue.radialShape || 'circle',
|
|
597
|
+
onChange: handleRadialShapeChange,
|
|
598
|
+
disabled: readOnly,
|
|
599
|
+
style: styles.select,
|
|
600
|
+
children: [
|
|
601
|
+
/*#__PURE__*/ _jsx("option", {
|
|
602
|
+
value: "circle",
|
|
603
|
+
children: "Circle"
|
|
604
|
+
}),
|
|
605
|
+
/*#__PURE__*/ _jsx("option", {
|
|
606
|
+
value: "ellipse",
|
|
607
|
+
children: "Ellipse"
|
|
608
|
+
})
|
|
609
|
+
]
|
|
610
|
+
})
|
|
611
|
+
]
|
|
612
|
+
}),
|
|
613
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
614
|
+
style: styles.row,
|
|
615
|
+
children: [
|
|
616
|
+
/*#__PURE__*/ _jsx("label", {
|
|
617
|
+
style: styles.label,
|
|
618
|
+
children: "Position"
|
|
619
|
+
}),
|
|
620
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
621
|
+
value: currentValue.radialPosition || 'center',
|
|
622
|
+
onChange: handleRadialPositionChange,
|
|
623
|
+
disabled: readOnly,
|
|
624
|
+
style: styles.select,
|
|
625
|
+
children: [
|
|
626
|
+
/*#__PURE__*/ _jsx("option", {
|
|
627
|
+
value: "center",
|
|
628
|
+
children: "Center"
|
|
629
|
+
}),
|
|
630
|
+
/*#__PURE__*/ _jsx("option", {
|
|
631
|
+
value: "top",
|
|
632
|
+
children: "Top"
|
|
633
|
+
}),
|
|
634
|
+
/*#__PURE__*/ _jsx("option", {
|
|
635
|
+
value: "bottom",
|
|
636
|
+
children: "Bottom"
|
|
637
|
+
}),
|
|
638
|
+
/*#__PURE__*/ _jsx("option", {
|
|
639
|
+
value: "left",
|
|
640
|
+
children: "Left"
|
|
641
|
+
}),
|
|
642
|
+
/*#__PURE__*/ _jsx("option", {
|
|
643
|
+
value: "right",
|
|
644
|
+
children: "Right"
|
|
645
|
+
})
|
|
646
|
+
]
|
|
647
|
+
})
|
|
648
|
+
]
|
|
649
|
+
})
|
|
650
|
+
]
|
|
651
|
+
}),
|
|
652
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
653
|
+
style: {
|
|
654
|
+
display: 'flex',
|
|
655
|
+
flexDirection: 'column',
|
|
656
|
+
gap: '8px'
|
|
657
|
+
},
|
|
658
|
+
children: [
|
|
659
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
660
|
+
style: styles.stopsHeader,
|
|
661
|
+
children: [
|
|
662
|
+
/*#__PURE__*/ _jsx("label", {
|
|
663
|
+
style: styles.label,
|
|
664
|
+
children: "Color Stops"
|
|
665
|
+
}),
|
|
666
|
+
!readOnly && /*#__PURE__*/ _jsxs("button", {
|
|
667
|
+
type: "button",
|
|
668
|
+
onClick: handleAddStop,
|
|
669
|
+
style: styles.addButton,
|
|
670
|
+
children: [
|
|
671
|
+
/*#__PURE__*/ _jsx(Plus, {
|
|
672
|
+
style: {
|
|
673
|
+
width: '12px',
|
|
674
|
+
height: '12px'
|
|
675
|
+
}
|
|
676
|
+
}),
|
|
677
|
+
"Add Stop"
|
|
678
|
+
]
|
|
679
|
+
})
|
|
680
|
+
]
|
|
681
|
+
}),
|
|
682
|
+
/*#__PURE__*/ _jsx("div", {
|
|
683
|
+
style: styles.stopsList,
|
|
684
|
+
children: currentValue.stops.map((stop, index)=>/*#__PURE__*/ _jsx(GradientStopEditor, {
|
|
685
|
+
stop: stop,
|
|
686
|
+
index: index,
|
|
687
|
+
canDelete: canDeleteStops,
|
|
688
|
+
onColorChange: handleStopColorChange,
|
|
689
|
+
onPositionChange: handleStopPositionChange,
|
|
690
|
+
onDelete: handleDeleteStop,
|
|
691
|
+
readOnly: readOnly
|
|
692
|
+
}, index))
|
|
693
|
+
})
|
|
694
|
+
]
|
|
695
|
+
})
|
|
696
|
+
]
|
|
697
|
+
});
|
|
323
698
|
}
|
|
324
|
-
export const GradientEditor = memo(GradientEditorInner);
|
|
699
|
+
export const GradientEditor = /*#__PURE__*/ memo(GradientEditorInner);
|
|
700
|
+
|
|
325
701
|
//# sourceMappingURL=GradientEditor.js.map
|