@delmaredigital/payload-puck 0.1.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +293 -1237
- package/dist/admin/EditWithPuckButton.d.ts +74 -0
- package/dist/admin/EditWithPuckButton.d.ts.map +1 -0
- package/dist/admin/EditWithPuckButton.js +114 -0
- package/dist/admin/EditWithPuckButton.js.map +1 -0
- package/dist/admin/EditWithPuckCell.d.ts +43 -0
- package/dist/admin/EditWithPuckCell.d.ts.map +1 -0
- package/dist/admin/EditWithPuckCell.js +66 -0
- package/dist/admin/EditWithPuckCell.js.map +1 -0
- package/dist/admin/PuckEditorView.d.ts +85 -0
- package/dist/admin/PuckEditorView.d.ts.map +1 -0
- package/dist/admin/PuckEditorView.js +135 -0
- package/dist/admin/PuckEditorView.js.map +1 -0
- package/dist/admin/client.d.ts +8 -104
- package/dist/admin/client.d.ts.map +1 -0
- package/dist/admin/client.js +14 -176
- package/dist/admin/client.js.map +1 -0
- package/dist/admin/generateAdminComponents.d.ts +51 -0
- package/dist/admin/generateAdminComponents.d.ts.map +1 -0
- package/dist/admin/generateAdminComponents.js +42 -0
- package/dist/admin/generateAdminComponents.js.map +1 -0
- package/dist/admin/index.d.ts +14 -150
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +17 -30
- package/dist/admin/index.js.map +1 -0
- package/dist/api/createPuckApiRoutes.d.ts +31 -0
- package/dist/api/createPuckApiRoutes.d.ts.map +1 -0
- package/dist/api/createPuckApiRoutes.js +193 -0
- package/dist/api/createPuckApiRoutes.js.map +1 -0
- package/dist/api/createPuckApiRoutesVersions.d.ts +28 -0
- package/dist/api/createPuckApiRoutesVersions.d.ts.map +1 -0
- package/dist/api/createPuckApiRoutesVersions.js +144 -0
- package/dist/api/createPuckApiRoutesVersions.js.map +1 -0
- package/dist/api/createPuckApiRoutesWithId.d.ts +34 -0
- package/dist/api/createPuckApiRoutesWithId.d.ts.map +1 -0
- package/dist/api/createPuckApiRoutesWithId.js +251 -0
- package/dist/api/createPuckApiRoutesWithId.js.map +1 -0
- package/dist/api/index.d.ts +11 -431
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +40 -587
- package/dist/api/index.js.map +1 -0
- package/dist/api/types.d.ts +302 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +2 -0
- package/dist/api/types.js.map +1 -0
- package/dist/api/utils/mapRootProps.d.ts +76 -0
- package/dist/api/utils/mapRootProps.d.ts.map +1 -0
- package/dist/api/utils/mapRootProps.js +169 -0
- package/dist/api/utils/mapRootProps.js.map +1 -0
- package/dist/collections/Templates.d.ts +9 -0
- package/dist/collections/Templates.d.ts.map +1 -0
- package/dist/collections/Templates.js +62 -0
- package/dist/collections/Templates.js.map +1 -0
- package/dist/components/AccordionClient.d.ts +20 -0
- package/dist/components/AccordionClient.d.ts.map +1 -0
- package/dist/components/AccordionClient.js +67 -0
- package/dist/components/AccordionClient.js.map +1 -0
- package/dist/components/AnimatedWrapper.d.ts +33 -0
- package/dist/components/AnimatedWrapper.d.ts.map +1 -0
- package/dist/components/AnimatedWrapper.js +61 -0
- package/dist/components/AnimatedWrapper.js.map +1 -0
- package/dist/components/exports.d.ts +54 -0
- package/dist/components/exports.d.ts.map +1 -0
- package/dist/components/exports.js +71 -0
- package/dist/components/exports.js.map +1 -0
- package/dist/components/index.d.ts +8 -219
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +15 -9155
- package/dist/components/index.js.map +1 -0
- package/dist/components/interactive/Accordion.d.ts +28 -0
- package/dist/components/interactive/Accordion.d.ts.map +1 -0
- package/dist/components/interactive/Accordion.js +159 -0
- package/dist/components/interactive/Accordion.js.map +1 -0
- package/dist/components/interactive/Accordion.server.d.ts +29 -0
- package/dist/components/interactive/Accordion.server.d.ts.map +1 -0
- package/dist/components/interactive/Accordion.server.js +30 -0
- package/dist/components/interactive/Accordion.server.js.map +1 -0
- package/dist/components/interactive/Button.d.ts +26 -0
- package/dist/components/interactive/Button.d.ts.map +1 -0
- package/dist/components/interactive/Button.js +133 -0
- package/dist/components/interactive/Button.js.map +1 -0
- package/dist/components/interactive/Button.server.d.ts +28 -0
- package/dist/components/interactive/Button.server.d.ts.map +1 -0
- package/dist/components/interactive/Button.server.js +96 -0
- package/dist/components/interactive/Button.server.js.map +1 -0
- package/dist/components/interactive/Card.d.ts +27 -0
- package/dist/components/interactive/Card.d.ts.map +1 -0
- package/dist/components/interactive/Card.js +128 -0
- package/dist/components/interactive/Card.js.map +1 -0
- package/dist/components/interactive/Card.server.d.ts +29 -0
- package/dist/components/interactive/Card.server.d.ts.map +1 -0
- package/dist/components/interactive/Card.server.js +77 -0
- package/dist/components/interactive/Card.server.js.map +1 -0
- package/dist/components/interactive/Divider.d.ts +18 -0
- package/dist/components/interactive/Divider.d.ts.map +1 -0
- package/dist/components/interactive/Divider.js +68 -0
- package/dist/components/interactive/Divider.js.map +1 -0
- package/dist/components/interactive/Divider.server.d.ts +20 -0
- package/dist/components/interactive/Divider.server.d.ts.map +1 -0
- package/dist/components/interactive/Divider.server.js +50 -0
- package/dist/components/interactive/Divider.server.js.map +1 -0
- package/dist/components/interactive/index.d.ts +10 -0
- package/dist/components/interactive/index.d.ts.map +1 -0
- package/dist/components/interactive/index.js +10 -0
- package/dist/components/interactive/index.js.map +1 -0
- package/dist/components/layout/Container.d.ts +29 -0
- package/dist/components/layout/Container.d.ts.map +1 -0
- package/dist/components/layout/Container.js +166 -0
- package/dist/components/layout/Container.js.map +1 -0
- package/dist/components/layout/Container.server.d.ts +32 -0
- package/dist/components/layout/Container.server.d.ts.map +1 -0
- package/dist/components/layout/Container.server.js +105 -0
- package/dist/components/layout/Container.server.js.map +1 -0
- package/dist/components/layout/Flex.d.ts +36 -0
- package/dist/components/layout/Flex.d.ts.map +1 -0
- package/dist/components/layout/Flex.js +183 -0
- package/dist/components/layout/Flex.js.map +1 -0
- package/dist/components/layout/Flex.server.d.ts +36 -0
- package/dist/components/layout/Flex.server.d.ts.map +1 -0
- package/dist/components/layout/Flex.server.js +97 -0
- package/dist/components/layout/Flex.server.js.map +1 -0
- package/dist/components/layout/Grid.d.ts +31 -0
- package/dist/components/layout/Grid.d.ts.map +1 -0
- package/dist/components/layout/Grid.js +164 -0
- package/dist/components/layout/Grid.js.map +1 -0
- package/dist/components/layout/Grid.server.d.ts +32 -0
- package/dist/components/layout/Grid.server.d.ts.map +1 -0
- package/dist/components/layout/Grid.server.js +92 -0
- package/dist/components/layout/Grid.server.js.map +1 -0
- package/dist/components/layout/Section.d.ts +35 -0
- package/dist/components/layout/Section.d.ts.map +1 -0
- package/dist/components/layout/Section.js +212 -0
- package/dist/components/layout/Section.js.map +1 -0
- package/dist/components/layout/Section.server.d.ts +35 -0
- package/dist/components/layout/Section.server.d.ts.map +1 -0
- package/dist/components/layout/Section.server.js +144 -0
- package/dist/components/layout/Section.server.js.map +1 -0
- package/dist/components/layout/Spacer.d.ts +18 -0
- package/dist/components/layout/Spacer.d.ts.map +1 -0
- package/dist/components/layout/Spacer.js +99 -0
- package/dist/components/layout/Spacer.js.map +1 -0
- package/dist/components/layout/Spacer.server.d.ts +21 -0
- package/dist/components/layout/Spacer.server.d.ts.map +1 -0
- package/dist/components/layout/Spacer.server.js +61 -0
- package/dist/components/layout/Spacer.server.js.map +1 -0
- package/dist/components/layout/Template.d.ts +35 -0
- package/dist/components/layout/Template.d.ts.map +1 -0
- package/dist/components/layout/Template.js +124 -0
- package/dist/components/layout/Template.js.map +1 -0
- package/dist/components/layout/Template.server.d.ts +32 -0
- package/dist/components/layout/Template.server.d.ts.map +1 -0
- package/dist/components/layout/Template.server.js +75 -0
- package/dist/components/layout/Template.server.js.map +1 -0
- package/dist/components/layout/index.d.ts +14 -0
- package/dist/components/layout/index.d.ts.map +1 -0
- package/dist/components/layout/index.js +13 -0
- package/dist/components/layout/index.js.map +1 -0
- package/dist/components/media/Image.d.ts +30 -0
- package/dist/components/media/Image.d.ts.map +1 -0
- package/dist/components/media/Image.js +123 -0
- package/dist/components/media/Image.js.map +1 -0
- package/dist/components/media/Image.server.d.ts +28 -0
- package/dist/components/media/Image.server.d.ts.map +1 -0
- package/dist/components/media/Image.server.js +76 -0
- package/dist/components/media/Image.server.js.map +1 -0
- package/dist/components/media/index.d.ts +7 -0
- package/dist/components/media/index.d.ts.map +1 -0
- package/dist/components/media/index.js +7 -0
- package/dist/components/media/index.js.map +1 -0
- package/dist/components/typography/Heading.d.ts +21 -0
- package/dist/components/typography/Heading.d.ts.map +1 -0
- package/dist/components/typography/Heading.js +71 -0
- package/dist/components/typography/Heading.js.map +1 -0
- package/dist/components/typography/Heading.server.d.ts +21 -0
- package/dist/components/typography/Heading.server.d.ts.map +1 -0
- package/dist/components/typography/Heading.server.js +49 -0
- package/dist/components/typography/Heading.server.js.map +1 -0
- package/dist/components/typography/RichText.d.ts +20 -0
- package/dist/components/typography/RichText.d.ts.map +1 -0
- package/dist/components/typography/RichText.editor.d.ts +11 -0
- package/dist/components/typography/RichText.editor.d.ts.map +1 -0
- package/dist/components/typography/RichText.editor.js +67 -0
- package/dist/components/typography/RichText.editor.js.map +1 -0
- package/dist/components/typography/RichText.js +73 -0
- package/dist/components/typography/RichText.js.map +1 -0
- package/dist/components/typography/RichText.server.d.ts +22 -0
- package/dist/components/typography/RichText.server.d.ts.map +1 -0
- package/dist/components/typography/RichText.server.js +52 -0
- package/dist/components/typography/RichText.server.js.map +1 -0
- package/dist/components/typography/Text.d.ts +20 -0
- package/dist/components/typography/Text.d.ts.map +1 -0
- package/dist/components/typography/Text.js +61 -0
- package/dist/components/typography/Text.js.map +1 -0
- package/dist/components/typography/Text.server.d.ts +21 -0
- package/dist/components/typography/Text.server.d.ts.map +1 -0
- package/dist/components/typography/Text.server.js +39 -0
- package/dist/components/typography/Text.server.js.map +1 -0
- package/dist/components/typography/index.d.ts +10 -0
- package/dist/components/typography/index.d.ts.map +1 -0
- package/dist/components/typography/index.js +10 -0
- package/dist/components/typography/index.js.map +1 -0
- package/dist/config/config.editor.d.ts +15 -56
- package/dist/config/config.editor.d.ts.map +1 -0
- package/dist/config/config.editor.js +125 -9364
- package/dist/config/config.editor.js.map +1 -0
- package/dist/config/index.d.ts +7 -33
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +110 -2028
- package/dist/config/index.js.map +1 -0
- package/dist/config/merge.d.ts +23 -0
- package/dist/config/merge.d.ts.map +1 -0
- package/dist/config/merge.js +80 -0
- package/dist/config/merge.js.map +1 -0
- package/dist/config/presets.d.ts +342 -0
- package/dist/config/presets.d.ts.map +1 -0
- package/dist/config/presets.js +247 -0
- package/dist/config/presets.js.map +1 -0
- package/dist/editor/PuckEditor.client.d.ts +131 -0
- package/dist/editor/PuckEditor.client.d.ts.map +1 -0
- package/dist/editor/PuckEditor.client.js +42 -0
- package/dist/editor/PuckEditor.client.js.map +1 -0
- package/dist/editor/PuckEditorCore.client.d.ts +141 -0
- package/dist/editor/PuckEditorCore.client.d.ts.map +1 -0
- package/dist/editor/PuckEditorCore.client.js +306 -0
- package/dist/editor/PuckEditorCore.client.js.map +1 -0
- package/dist/editor/components/HeaderActions.d.ts +109 -0
- package/dist/editor/components/HeaderActions.d.ts.map +1 -0
- package/dist/editor/components/HeaderActions.js +254 -0
- package/dist/editor/components/HeaderActions.js.map +1 -0
- package/dist/editor/components/IframeWrapper.d.ts +77 -0
- package/dist/editor/components/IframeWrapper.d.ts.map +1 -0
- package/dist/editor/components/IframeWrapper.js +257 -0
- package/dist/editor/components/IframeWrapper.js.map +1 -0
- package/dist/editor/components/LoadingState.d.ts +14 -0
- package/dist/editor/components/LoadingState.d.ts.map +1 -0
- package/dist/editor/components/LoadingState.js +12 -0
- package/dist/editor/components/LoadingState.js.map +1 -0
- package/dist/editor/components/PreviewModal.d.ts +54 -0
- package/dist/editor/components/PreviewModal.d.ts.map +1 -0
- package/dist/editor/components/PreviewModal.js +298 -0
- package/dist/editor/components/PreviewModal.js.map +1 -0
- package/dist/editor/components/VersionHistory.d.ts +44 -0
- package/dist/editor/components/VersionHistory.d.ts.map +1 -0
- package/dist/editor/components/VersionHistory.js +308 -0
- package/dist/editor/components/VersionHistory.js.map +1 -0
- package/dist/editor/hooks/useUnsavedChanges.d.ts +27 -0
- package/dist/editor/hooks/useUnsavedChanges.d.ts.map +1 -0
- package/dist/editor/hooks/useUnsavedChanges.js +55 -0
- package/dist/editor/hooks/useUnsavedChanges.js.map +1 -0
- package/dist/editor/index.d.ts +16 -756
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +49 -4533
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/plugins/index.d.ts +12 -0
- package/dist/editor/plugins/index.d.ts.map +1 -0
- package/dist/editor/plugins/index.js +12 -0
- package/dist/editor/plugins/index.js.map +1 -0
- package/dist/endpoints/index.d.ts +46 -0
- package/dist/endpoints/index.d.ts.map +1 -0
- package/dist/endpoints/index.js +204 -0
- package/dist/endpoints/index.js.map +1 -0
- package/dist/exports/client.d.ts +19 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +21 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/rsc.d.ts +19 -0
- package/dist/exports/rsc.d.ts.map +1 -0
- package/dist/exports/rsc.js +19 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/fields/AlignmentField.d.ts +36 -0
- package/dist/fields/AlignmentField.d.ts.map +1 -0
- package/dist/fields/AlignmentField.js +120 -0
- package/dist/fields/AlignmentField.js.map +1 -0
- package/dist/fields/AnimationField.d.ts +44 -0
- package/dist/fields/AnimationField.d.ts.map +1 -0
- package/dist/fields/AnimationField.js +329 -0
- package/dist/fields/AnimationField.js.map +1 -0
- package/dist/fields/BackgroundField.d.ts +40 -0
- package/dist/fields/BackgroundField.d.ts.map +1 -0
- package/dist/fields/BackgroundField.js +413 -0
- package/dist/fields/BackgroundField.js.map +1 -0
- package/dist/fields/BorderField.d.ts +29 -0
- package/dist/fields/BorderField.d.ts.map +1 -0
- package/dist/fields/BorderField.js +264 -0
- package/dist/fields/BorderField.js.map +1 -0
- package/dist/fields/ColorPickerField.d.ts +43 -0
- package/dist/fields/ColorPickerField.d.ts.map +1 -0
- package/dist/fields/ColorPickerField.js +285 -0
- package/dist/fields/ColorPickerField.js.map +1 -0
- package/dist/fields/DimensionsField.d.ts +43 -0
- package/dist/fields/DimensionsField.d.ts.map +1 -0
- package/dist/fields/DimensionsField.js +532 -0
- package/dist/fields/DimensionsField.js.map +1 -0
- package/dist/fields/FlexAlignmentField.d.ts +61 -0
- package/dist/fields/FlexAlignmentField.d.ts.map +1 -0
- package/dist/fields/FlexAlignmentField.js +166 -0
- package/dist/fields/FlexAlignmentField.js.map +1 -0
- package/dist/fields/FolderPickerField.d.ts +17 -0
- package/dist/fields/FolderPickerField.d.ts.map +1 -0
- package/dist/fields/FolderPickerField.js +282 -0
- package/dist/fields/FolderPickerField.js.map +1 -0
- package/dist/fields/GradientEditor.d.ts +22 -0
- package/dist/fields/GradientEditor.d.ts.map +1 -0
- package/dist/fields/GradientEditor.js +322 -0
- package/dist/fields/GradientEditor.js.map +1 -0
- package/dist/fields/LockedField.d.ts +67 -0
- package/dist/fields/LockedField.d.ts.map +1 -0
- package/dist/fields/LockedField.js +170 -0
- package/dist/fields/LockedField.js.map +1 -0
- package/dist/fields/MarginField.d.ts +31 -0
- package/dist/fields/MarginField.d.ts.map +1 -0
- package/dist/fields/MarginField.js +233 -0
- package/dist/fields/MarginField.js.map +1 -0
- package/dist/fields/MediaField.d.ts +33 -0
- package/dist/fields/MediaField.d.ts.map +1 -0
- package/dist/fields/MediaField.js +677 -0
- package/dist/fields/MediaField.js.map +1 -0
- package/dist/fields/PaddingField.d.ts +29 -0
- package/dist/fields/PaddingField.d.ts.map +1 -0
- package/dist/fields/PaddingField.js +232 -0
- package/dist/fields/PaddingField.js.map +1 -0
- package/dist/fields/PageSegmentField.d.ts +17 -0
- package/dist/fields/PageSegmentField.d.ts.map +1 -0
- package/dist/fields/PageSegmentField.js +92 -0
- package/dist/fields/PageSegmentField.js.map +1 -0
- package/dist/fields/ResetField.d.ts +27 -0
- package/dist/fields/ResetField.d.ts.map +1 -0
- package/dist/fields/ResetField.js +122 -0
- package/dist/fields/ResetField.js.map +1 -0
- package/dist/fields/ResponsiveField.d.ts +38 -0
- package/dist/fields/ResponsiveField.d.ts.map +1 -0
- package/dist/fields/ResponsiveField.js +275 -0
- package/dist/fields/ResponsiveField.js.map +1 -0
- package/dist/fields/ResponsiveVisibilityField.d.ts +34 -0
- package/dist/fields/ResponsiveVisibilityField.d.ts.map +1 -0
- package/dist/fields/ResponsiveVisibilityField.js +145 -0
- package/dist/fields/ResponsiveVisibilityField.js.map +1 -0
- package/dist/fields/SizeField.d.ts +54 -0
- package/dist/fields/SizeField.d.ts.map +1 -0
- package/dist/fields/SizeField.js +255 -0
- package/dist/fields/SizeField.js.map +1 -0
- package/dist/fields/SlugPreviewField.d.ts +16 -0
- package/dist/fields/SlugPreviewField.d.ts.map +1 -0
- package/dist/fields/SlugPreviewField.js +49 -0
- package/dist/fields/SlugPreviewField.js.map +1 -0
- package/dist/fields/TemplateField.d.ts +31 -0
- package/dist/fields/TemplateField.d.ts.map +1 -0
- package/dist/fields/TemplateField.js +428 -0
- package/dist/fields/TemplateField.js.map +1 -0
- package/dist/fields/TiptapField.d.ts +40 -0
- package/dist/fields/TiptapField.d.ts.map +1 -0
- package/dist/fields/TiptapField.js +857 -0
- package/dist/fields/TiptapField.js.map +1 -0
- package/dist/fields/TiptapModal.d.ts +10 -0
- package/dist/fields/TiptapModal.d.ts.map +1 -0
- package/dist/fields/TiptapModal.js +114 -0
- package/dist/fields/TiptapModal.js.map +1 -0
- package/dist/fields/TiptapModalField.d.ts +23 -0
- package/dist/fields/TiptapModalField.d.ts.map +1 -0
- package/dist/fields/TiptapModalField.js +55 -0
- package/dist/fields/TiptapModalField.js.map +1 -0
- package/dist/fields/TransformField.d.ts +31 -0
- package/dist/fields/TransformField.d.ts.map +1 -0
- package/dist/fields/TransformField.js +384 -0
- package/dist/fields/TransformField.js.map +1 -0
- package/dist/fields/VerticalAlignmentField.d.ts +35 -0
- package/dist/fields/VerticalAlignmentField.d.ts.map +1 -0
- package/dist/fields/VerticalAlignmentField.js +120 -0
- package/dist/fields/VerticalAlignmentField.js.map +1 -0
- package/dist/fields/WidthField.d.ts +28 -0
- package/dist/fields/WidthField.d.ts.map +1 -0
- package/dist/fields/WidthField.js +339 -0
- package/dist/fields/WidthField.js.map +1 -0
- package/dist/fields/index.d.ts +44 -559
- package/dist/fields/index.d.ts.map +1 -0
- package/dist/fields/index.js +91 -7685
- package/dist/fields/index.js.map +1 -0
- package/dist/fields/richtext-output.css +219 -0
- package/dist/{shared-DeNKN95N.d.mts → fields/shared.d.ts} +114 -133
- package/dist/fields/shared.d.ts.map +1 -0
- package/dist/fields/shared.js +1542 -0
- package/dist/fields/shared.js.map +1 -0
- package/dist/fields/{index.css → tiptap-styles.css} +75 -166
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +8 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useResponsiveStyles.d.ts +51 -0
- package/dist/hooks/useResponsiveStyles.d.ts.map +1 -0
- package/dist/hooks/useResponsiveStyles.js +149 -0
- package/dist/hooks/useResponsiveStyles.js.map +1 -0
- package/dist/hooks/useScrollAnimation.d.ts +56 -0
- package/dist/hooks/useScrollAnimation.d.ts.map +1 -0
- package/dist/hooks/useScrollAnimation.js +116 -0
- package/dist/hooks/useScrollAnimation.js.map +1 -0
- package/dist/index.d.ts +66 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -568
- package/dist/index.js.map +1 -0
- package/dist/layouts/LayoutWrapper.d.ts +33 -0
- package/dist/layouts/LayoutWrapper.d.ts.map +1 -0
- package/dist/layouts/LayoutWrapper.js +112 -0
- package/dist/layouts/LayoutWrapper.js.map +1 -0
- package/dist/layouts/defaults.d.ts +40 -0
- package/dist/layouts/defaults.d.ts.map +1 -0
- package/dist/layouts/defaults.js +106 -0
- package/dist/layouts/defaults.js.map +1 -0
- package/dist/layouts/index.d.ts +27 -94
- package/dist/layouts/index.d.ts.map +1 -0
- package/dist/layouts/index.js +30 -393
- package/dist/layouts/index.js.map +1 -0
- package/dist/{types-D7D3rZ1J.d.ts → layouts/types.d.ts} +8 -11
- package/dist/layouts/types.d.ts.map +1 -0
- package/dist/layouts/types.js +7 -0
- package/dist/layouts/types.js.map +1 -0
- package/dist/layouts/utils.d.ts +42 -0
- package/dist/layouts/utils.d.ts.map +1 -0
- package/dist/layouts/utils.js +83 -0
- package/dist/layouts/utils.js.map +1 -0
- package/dist/plugin/collections/Pages.d.ts +8 -0
- package/dist/plugin/collections/Pages.d.ts.map +1 -0
- package/dist/plugin/collections/Pages.js +117 -0
- package/dist/plugin/collections/Pages.js.map +1 -0
- package/dist/plugin/fields/index.d.ts +153 -0
- package/dist/plugin/fields/index.d.ts.map +1 -0
- package/dist/plugin/fields/index.js +364 -0
- package/dist/plugin/fields/index.js.map +1 -0
- package/dist/plugin/fields/types.d.ts +108 -0
- package/dist/plugin/fields/types.d.ts.map +1 -0
- package/dist/plugin/fields/types.js +7 -0
- package/dist/plugin/fields/types.js.map +1 -0
- package/dist/plugin/index.d.ts +13 -255
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +276 -553
- package/dist/plugin/index.js.map +1 -0
- package/dist/render/HybridPageRenderer.d.ts +85 -0
- package/dist/render/HybridPageRenderer.d.ts.map +1 -0
- package/dist/render/HybridPageRenderer.js +29 -0
- package/dist/render/HybridPageRenderer.js.map +1 -0
- package/dist/render/PageRenderer.d.ts +51 -0
- package/dist/render/PageRenderer.d.ts.map +1 -0
- package/dist/render/PageRenderer.js +61 -0
- package/dist/render/PageRenderer.js.map +1 -0
- package/dist/render/PuckEditor.client.d.ts +66 -0
- package/dist/render/PuckEditor.client.d.ts.map +1 -0
- package/dist/render/PuckEditor.client.js +66 -0
- package/dist/render/PuckEditor.client.js.map +1 -0
- package/dist/render/index.d.ts +8 -106
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +10 -2162
- package/dist/render/index.js.map +1 -0
- package/dist/theme/context.d.ts +59 -0
- package/dist/theme/context.d.ts.map +1 -0
- package/dist/theme/context.js +73 -0
- package/dist/theme/context.js.map +1 -0
- package/dist/theme/defaults.d.ts +39 -0
- package/dist/theme/defaults.d.ts.map +1 -0
- package/dist/theme/defaults.js +72 -0
- package/dist/theme/defaults.js.map +1 -0
- package/dist/theme/example.d.ts +30 -0
- package/dist/theme/example.d.ts.map +1 -0
- package/dist/theme/example.js +89 -0
- package/dist/theme/example.js.map +1 -0
- package/dist/theme/index.d.ts +17 -140
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +34 -200
- package/dist/theme/index.js.map +1 -0
- package/dist/{types-_6MvjyKv.d.ts → theme/types.d.ts} +8 -9
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/theme/types.js +9 -0
- package/dist/theme/types.js.map +1 -0
- package/dist/theme/utils.d.ts +30 -0
- package/dist/theme/utils.d.ts.map +1 -0
- package/dist/theme/utils.js +84 -0
- package/dist/theme/utils.js.map +1 -0
- package/dist/{index-CQu6SzDg.d.mts → types/index.d.ts} +120 -115
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +23 -257
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +56 -425
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/{index.d.mts → migration.d.ts} +16 -112
- package/dist/utils/migration.d.ts.map +1 -0
- package/dist/utils/migration.js +309 -0
- package/dist/utils/migration.js.map +1 -0
- package/dist/utils/validation.d.ts +89 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +247 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/views/PuckConfigContext.d.ts +71 -0
- package/dist/views/PuckConfigContext.d.ts.map +1 -0
- package/dist/views/PuckConfigContext.js +45 -0
- package/dist/views/PuckConfigContext.js.map +1 -0
- package/dist/views/PuckEditorClient.d.ts +73 -0
- package/dist/views/PuckEditorClient.d.ts.map +1 -0
- package/dist/views/PuckEditorClient.js +130 -0
- package/dist/views/PuckEditorClient.js.map +1 -0
- package/dist/views/PuckEditorView.d.ts +19 -0
- package/dist/views/PuckEditorView.d.ts.map +1 -0
- package/dist/views/PuckEditorView.js +106 -0
- package/dist/views/PuckEditorView.js.map +1 -0
- package/dist/views/index.d.ts +10 -0
- package/dist/views/index.d.ts.map +1 -0
- package/dist/views/index.js +10 -0
- package/dist/views/index.js.map +1 -0
- package/package.json +50 -72
- package/dist/AccordionClient.d.mts +0 -24
- package/dist/AccordionClient.d.ts +0 -24
- package/dist/AccordionClient.js +0 -786
- package/dist/AccordionClient.mjs +0 -784
- package/dist/AnimatedWrapper.d.mts +0 -30
- package/dist/AnimatedWrapper.d.ts +0 -30
- package/dist/AnimatedWrapper.js +0 -379
- package/dist/AnimatedWrapper.mjs +0 -377
- package/dist/admin/client.d.mts +0 -108
- package/dist/admin/client.mjs +0 -173
- package/dist/admin/index.d.mts +0 -157
- package/dist/admin/index.mjs +0 -29
- package/dist/api/index.d.mts +0 -460
- package/dist/api/index.mjs +0 -578
- package/dist/components/index.css +0 -339
- package/dist/components/index.d.mts +0 -222
- package/dist/components/index.mjs +0 -9109
- package/dist/config/config.editor.css +0 -339
- package/dist/config/config.editor.d.mts +0 -153
- package/dist/config/config.editor.mjs +0 -9347
- package/dist/config/index.d.mts +0 -68
- package/dist/config/index.mjs +0 -2008
- package/dist/editor/index.d.mts +0 -784
- package/dist/editor/index.mjs +0 -4500
- package/dist/fields/index.d.mts +0 -600
- package/dist/fields/index.mjs +0 -7569
- package/dist/index-CoUQnyC3.d.ts +0 -327
- package/dist/index.d.mts +0 -6
- package/dist/index.mjs +0 -555
- package/dist/layouts/index.d.mts +0 -96
- package/dist/layouts/index.mjs +0 -378
- package/dist/plugin/index.d.mts +0 -289
- package/dist/plugin/index.mjs +0 -555
- package/dist/render/index.d.mts +0 -109
- package/dist/render/index.mjs +0 -2140
- package/dist/shared-DeNKN95N.d.ts +0 -546
- package/dist/theme/index.d.mts +0 -155
- package/dist/theme/index.mjs +0 -186
- package/dist/types-D7D3rZ1J.d.mts +0 -116
- package/dist/types-_6MvjyKv.d.mts +0 -104
- package/dist/utils/index.mjs +0 -412
- package/dist/utils-DaRs9t0J.d.mts +0 -85
- package/dist/utils-gAvt0Vhw.d.ts +0 -85
- package/examples/README.md +0 -247
- package/examples/api/puck/pages/[id]/route.ts +0 -64
- package/examples/api/puck/pages/[id]/versions/route.ts +0 -47
- package/examples/api/puck/pages/route.ts +0 -45
- package/examples/app/(frontend)/page.tsx +0 -94
- package/examples/app/(manage)/layout.tsx +0 -31
- package/examples/app/[...slug]/page.tsx +0 -101
- package/examples/app/pages/[id]/edit/page.tsx +0 -148
- package/examples/components/CustomBanner.tsx +0 -368
- package/examples/config/custom-config.ts +0 -223
- package/examples/config/payload.config.example.ts +0 -64
- package/examples/lib/puck-layouts.ts +0 -258
- package/examples/lib/puck-theme.ts +0 -94
- package/examples/styles/puck-theme.css +0 -171
package/dist/editor/index.mjs
DELETED
|
@@ -1,4500 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { ArrowLeft, MousePointer, MousePointerClick, Check, AlertTriangle, Eye, ExternalLink, Loader2, Save, Upload, X, History, ChevronDown, RotateCcw } from 'lucide-react';
|
|
3
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { memo, useCallback, useMemo, useEffect, useState, useRef, createContext, createElement } from 'react';
|
|
6
|
-
import { clsx } from 'clsx';
|
|
7
|
-
import { twMerge } from 'tailwind-merge';
|
|
8
|
-
import { createUsePuck, Render, Puck } from '@measured/puck';
|
|
9
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
10
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
11
|
-
import { cva } from 'class-variance-authority';
|
|
12
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
13
|
-
import { useRouter, useParams, useSearchParams } from 'next/navigation';
|
|
14
|
-
import '@measured/puck/puck.css';
|
|
15
|
-
import headingAnalyzer from '@measured/puck-plugin-heading-analyzer';
|
|
16
|
-
export { default as headingAnalyzer } from '@measured/puck-plugin-heading-analyzer';
|
|
17
|
-
import '@measured/puck-plugin-heading-analyzer/dist/index.css';
|
|
18
|
-
import dynamic from 'next/dynamic';
|
|
19
|
-
|
|
20
|
-
var __defProp = Object.defineProperty;
|
|
21
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
22
|
-
var __esm = (fn, res) => function __init() {
|
|
23
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
24
|
-
};
|
|
25
|
-
var __export = (target, all) => {
|
|
26
|
-
for (var name in all)
|
|
27
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
-
};
|
|
29
|
-
function LoadingState({ message = "Loading editor..." }) {
|
|
30
|
-
return /* @__PURE__ */ jsx("div", { className: "h-screen flex items-center justify-center bg-gray-50", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
31
|
-
/* @__PURE__ */ jsx(Loader2, { className: "h-8 w-8 animate-spin text-gray-600 mx-auto mb-4" }),
|
|
32
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-600", children: message })
|
|
33
|
-
] }) });
|
|
34
|
-
}
|
|
35
|
-
var init_LoadingState = __esm({
|
|
36
|
-
"src/editor/components/LoadingState.tsx"() {
|
|
37
|
-
"use client";
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
var VersionHistory;
|
|
41
|
-
var init_VersionHistory = __esm({
|
|
42
|
-
"src/editor/components/VersionHistory.tsx"() {
|
|
43
|
-
"use client";
|
|
44
|
-
VersionHistory = memo(function VersionHistory2({
|
|
45
|
-
pageId,
|
|
46
|
-
apiEndpoint = "/api/puck/pages",
|
|
47
|
-
onRestore,
|
|
48
|
-
disabled
|
|
49
|
-
}) {
|
|
50
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
51
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
52
|
-
const [isRestoring, setIsRestoring] = useState(false);
|
|
53
|
-
const [versions, setVersions] = useState([]);
|
|
54
|
-
const [error, setError] = useState(null);
|
|
55
|
-
const [isAvailable, setIsAvailable] = useState(null);
|
|
56
|
-
const dropdownRef = useRef(null);
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
async function checkAvailability() {
|
|
59
|
-
try {
|
|
60
|
-
const response = await fetch(`${apiEndpoint}/${pageId}/versions?limit=1`, {
|
|
61
|
-
method: "GET"
|
|
62
|
-
});
|
|
63
|
-
setIsAvailable(response.status !== 404);
|
|
64
|
-
} catch {
|
|
65
|
-
setIsAvailable(false);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
checkAvailability();
|
|
69
|
-
}, [apiEndpoint, pageId]);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
function handleClickOutside(event) {
|
|
72
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
73
|
-
setIsOpen(false);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
77
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
78
|
-
}, []);
|
|
79
|
-
const fetchVersions = useCallback(async () => {
|
|
80
|
-
setIsLoading(true);
|
|
81
|
-
setError(null);
|
|
82
|
-
try {
|
|
83
|
-
const response = await fetch(`${apiEndpoint}/${pageId}/versions?limit=20`);
|
|
84
|
-
if (!response.ok) {
|
|
85
|
-
throw new Error("Failed to fetch versions");
|
|
86
|
-
}
|
|
87
|
-
const data = await response.json();
|
|
88
|
-
setVersions(data.docs || []);
|
|
89
|
-
} catch (err) {
|
|
90
|
-
setError(err instanceof Error ? err.message : "Failed to load versions");
|
|
91
|
-
console.error("Error fetching versions:", err);
|
|
92
|
-
} finally {
|
|
93
|
-
setIsLoading(false);
|
|
94
|
-
}
|
|
95
|
-
}, [apiEndpoint, pageId]);
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
if (isOpen) {
|
|
98
|
-
fetchVersions();
|
|
99
|
-
}
|
|
100
|
-
}, [isOpen, fetchVersions]);
|
|
101
|
-
const handleRestore = useCallback(
|
|
102
|
-
async (version) => {
|
|
103
|
-
if (!confirm(`Restore this version from ${formatDate(version.updatedAt)}? This will overwrite current changes.`)) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
setIsRestoring(true);
|
|
107
|
-
try {
|
|
108
|
-
const response = await fetch(`${apiEndpoint}/${pageId}/versions`, {
|
|
109
|
-
method: "POST",
|
|
110
|
-
headers: { "Content-Type": "application/json" },
|
|
111
|
-
body: JSON.stringify({ versionId: version.id })
|
|
112
|
-
});
|
|
113
|
-
if (!response.ok) {
|
|
114
|
-
throw new Error("Failed to restore version");
|
|
115
|
-
}
|
|
116
|
-
onRestore?.(version);
|
|
117
|
-
setIsOpen(false);
|
|
118
|
-
window.location.reload();
|
|
119
|
-
} catch (err) {
|
|
120
|
-
setError(err instanceof Error ? err.message : "Failed to restore version");
|
|
121
|
-
console.error("Error restoring version:", err);
|
|
122
|
-
} finally {
|
|
123
|
-
setIsRestoring(false);
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
[apiEndpoint, pageId, onRestore]
|
|
127
|
-
);
|
|
128
|
-
function formatDate(dateStr) {
|
|
129
|
-
const date = new Date(dateStr);
|
|
130
|
-
const now = /* @__PURE__ */ new Date();
|
|
131
|
-
const diffMs = now.getTime() - date.getTime();
|
|
132
|
-
const diffMins = Math.floor(diffMs / 6e4);
|
|
133
|
-
const diffHours = Math.floor(diffMs / 36e5);
|
|
134
|
-
const diffDays = Math.floor(diffMs / 864e5);
|
|
135
|
-
if (diffMins < 1) return "Just now";
|
|
136
|
-
if (diffMins < 60) return `${diffMins}m ago`;
|
|
137
|
-
if (diffHours < 24) return `${diffHours}h ago`;
|
|
138
|
-
if (diffDays < 7) return `${diffDays}d ago`;
|
|
139
|
-
return date.toLocaleDateString();
|
|
140
|
-
}
|
|
141
|
-
function formatTime(dateStr) {
|
|
142
|
-
const date = new Date(dateStr);
|
|
143
|
-
return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
144
|
-
}
|
|
145
|
-
if (isAvailable !== true) {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
const baseBtn = "inline-flex items-center whitespace-nowrap px-3 py-1.5 text-sm font-medium rounded-md transition-colors";
|
|
149
|
-
const secondaryBtn = `${baseBtn} text-gray-700 bg-white border border-gray-300 hover:bg-gray-100`;
|
|
150
|
-
return /* @__PURE__ */ jsxs("div", { ref: dropdownRef, className: "relative", children: [
|
|
151
|
-
/* @__PURE__ */ jsxs(
|
|
152
|
-
"button",
|
|
153
|
-
{
|
|
154
|
-
type: "button",
|
|
155
|
-
onClick: () => setIsOpen(!isOpen),
|
|
156
|
-
disabled,
|
|
157
|
-
className: `${secondaryBtn} disabled:opacity-50 disabled:cursor-not-allowed`,
|
|
158
|
-
children: [
|
|
159
|
-
/* @__PURE__ */ jsx(History, { className: "h-4 w-4 mr-1 flex-shrink-0" }),
|
|
160
|
-
"History",
|
|
161
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3 ml-1 flex-shrink-0" })
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
),
|
|
165
|
-
isOpen && /* @__PURE__ */ jsxs(
|
|
166
|
-
"div",
|
|
167
|
-
{
|
|
168
|
-
className: "absolute top-full right-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg z-50 w-80 max-h-[400px] overflow-hidden",
|
|
169
|
-
children: [
|
|
170
|
-
/* @__PURE__ */ jsxs(
|
|
171
|
-
"div",
|
|
172
|
-
{
|
|
173
|
-
className: "border-b border-gray-200 flex items-center justify-between px-4 py-3",
|
|
174
|
-
children: [
|
|
175
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm text-gray-900", children: "Version History" }),
|
|
176
|
-
/* @__PURE__ */ jsx(
|
|
177
|
-
"button",
|
|
178
|
-
{
|
|
179
|
-
type: "button",
|
|
180
|
-
onClick: () => setIsOpen(false),
|
|
181
|
-
className: "text-gray-400 hover:text-gray-600 transition-colors p-1",
|
|
182
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
183
|
-
}
|
|
184
|
-
)
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
),
|
|
188
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-[340px] overflow-y-auto", children: isLoading ? /* @__PURE__ */ jsx(
|
|
189
|
-
"div",
|
|
190
|
-
{
|
|
191
|
-
className: "flex items-center justify-center p-8",
|
|
192
|
-
children: /* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 animate-spin text-gray-400" })
|
|
193
|
-
}
|
|
194
|
-
) : error ? /* @__PURE__ */ jsx(
|
|
195
|
-
"div",
|
|
196
|
-
{
|
|
197
|
-
className: "text-sm text-red-600 p-4 text-center",
|
|
198
|
-
children: error
|
|
199
|
-
}
|
|
200
|
-
) : versions.length === 0 ? /* @__PURE__ */ jsx(
|
|
201
|
-
"div",
|
|
202
|
-
{
|
|
203
|
-
className: "text-sm text-gray-500 p-4 text-center",
|
|
204
|
-
children: "No version history available"
|
|
205
|
-
}
|
|
206
|
-
) : /* @__PURE__ */ jsx("div", { className: "p-2", children: versions.map((version, index) => /* @__PURE__ */ jsxs(
|
|
207
|
-
"div",
|
|
208
|
-
{
|
|
209
|
-
className: "hover:bg-gray-50 rounded-md transition-colors flex items-center justify-between px-3 py-2.5 gap-3",
|
|
210
|
-
children: [
|
|
211
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
212
|
-
/* @__PURE__ */ jsxs(
|
|
213
|
-
"div",
|
|
214
|
-
{
|
|
215
|
-
className: "flex items-center gap-2",
|
|
216
|
-
children: [
|
|
217
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-gray-900", children: formatDate(version.updatedAt) }),
|
|
218
|
-
index === 0 && /* @__PURE__ */ jsx(
|
|
219
|
-
"span",
|
|
220
|
-
{
|
|
221
|
-
className: "text-xs font-medium rounded-full px-2 py-0.5 bg-blue-100 text-blue-700",
|
|
222
|
-
children: "Current"
|
|
223
|
-
}
|
|
224
|
-
),
|
|
225
|
-
version.version._status === "published" && /* @__PURE__ */ jsx(
|
|
226
|
-
"span",
|
|
227
|
-
{
|
|
228
|
-
className: "text-xs font-medium rounded-full px-2 py-0.5 bg-green-100 text-green-700",
|
|
229
|
-
children: "Published"
|
|
230
|
-
}
|
|
231
|
-
),
|
|
232
|
-
version.autosave && /* @__PURE__ */ jsx(
|
|
233
|
-
"span",
|
|
234
|
-
{
|
|
235
|
-
className: "text-xs text-gray-400",
|
|
236
|
-
title: "Autosaved",
|
|
237
|
-
children: "(auto)"
|
|
238
|
-
}
|
|
239
|
-
)
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
),
|
|
243
|
-
/* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500 mt-0.5", children: [
|
|
244
|
-
formatTime(version.updatedAt),
|
|
245
|
-
version.version.title && /* @__PURE__ */ jsxs("span", { children: [
|
|
246
|
-
" \xB7 ",
|
|
247
|
-
version.version.title
|
|
248
|
-
] })
|
|
249
|
-
] })
|
|
250
|
-
] }),
|
|
251
|
-
index > 0 && /* @__PURE__ */ jsxs(
|
|
252
|
-
"button",
|
|
253
|
-
{
|
|
254
|
-
type: "button",
|
|
255
|
-
onClick: () => handleRestore(version),
|
|
256
|
-
disabled: isRestoring,
|
|
257
|
-
className: "text-xs font-medium text-blue-600 hover:text-blue-800 transition-colors disabled:opacity-50 flex items-center gap-1 px-2 py-1 flex-shrink-0",
|
|
258
|
-
children: [
|
|
259
|
-
isRestoring ? /* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx(RotateCcw, { className: "h-3 w-3" }),
|
|
260
|
-
"Restore"
|
|
261
|
-
]
|
|
262
|
-
}
|
|
263
|
-
),
|
|
264
|
-
index === 0 && /* @__PURE__ */ jsx("span", { className: "text-gray-400 flex-shrink-0", children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) })
|
|
265
|
-
]
|
|
266
|
-
},
|
|
267
|
-
version.id
|
|
268
|
-
)) }) })
|
|
269
|
-
]
|
|
270
|
-
}
|
|
271
|
-
)
|
|
272
|
-
] });
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
function cn(...inputs) {
|
|
277
|
-
return twMerge(clsx(inputs));
|
|
278
|
-
}
|
|
279
|
-
var init_utils = __esm({
|
|
280
|
-
"src/lib/utils.ts"() {
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
var usePuck, HeaderActions;
|
|
284
|
-
var init_HeaderActions = __esm({
|
|
285
|
-
"src/editor/components/HeaderActions.tsx"() {
|
|
286
|
-
"use client";
|
|
287
|
-
init_VersionHistory();
|
|
288
|
-
init_utils();
|
|
289
|
-
usePuck = createUsePuck();
|
|
290
|
-
HeaderActions = memo(function HeaderActions2({
|
|
291
|
-
children,
|
|
292
|
-
onBack,
|
|
293
|
-
onPreview,
|
|
294
|
-
onSave,
|
|
295
|
-
onPublish,
|
|
296
|
-
isSaving,
|
|
297
|
-
hasUnsavedChanges,
|
|
298
|
-
lastSaved,
|
|
299
|
-
documentStatus,
|
|
300
|
-
wasPublished,
|
|
301
|
-
actionsStart,
|
|
302
|
-
actionsEnd,
|
|
303
|
-
showSaveDraft = true,
|
|
304
|
-
showViewPage = true,
|
|
305
|
-
showInteractiveToggle = false,
|
|
306
|
-
showPreviewButton = true,
|
|
307
|
-
onOpenPreview,
|
|
308
|
-
showVersionHistory = true,
|
|
309
|
-
pageId,
|
|
310
|
-
apiEndpoint = "/api/puck/pages",
|
|
311
|
-
saveError,
|
|
312
|
-
onDismissError
|
|
313
|
-
}) {
|
|
314
|
-
const appState = usePuck((s) => s.appState);
|
|
315
|
-
const dispatch = usePuck((s) => s.dispatch);
|
|
316
|
-
const isInteractive = appState.ui.previewMode === "interactive";
|
|
317
|
-
const togglePreviewMode = useCallback(() => {
|
|
318
|
-
dispatch({
|
|
319
|
-
type: "setUi",
|
|
320
|
-
ui: {
|
|
321
|
-
previewMode: isInteractive ? "edit" : "interactive"
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}, [dispatch, isInteractive]);
|
|
325
|
-
const handleSaveClick = useCallback(() => {
|
|
326
|
-
onSave(appState.data);
|
|
327
|
-
}, [onSave, appState.data]);
|
|
328
|
-
const handlePublishClick = useCallback(() => {
|
|
329
|
-
if (onPublish) {
|
|
330
|
-
onPublish(appState.data);
|
|
331
|
-
}
|
|
332
|
-
}, [onPublish, appState.data]);
|
|
333
|
-
const btnBase = "inline-flex items-center whitespace-nowrap text-sm font-medium rounded-md transition-colors";
|
|
334
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
335
|
-
actionsStart,
|
|
336
|
-
/* @__PURE__ */ jsxs(
|
|
337
|
-
"button",
|
|
338
|
-
{
|
|
339
|
-
type: "button",
|
|
340
|
-
onClick: onBack,
|
|
341
|
-
className: cn(btnBase, "px-3 py-1.5 bg-white text-gray-700 border border-gray-300 rounded hover:bg-gray-50"),
|
|
342
|
-
children: [
|
|
343
|
-
/* @__PURE__ */ jsx(ArrowLeft, { className: "h-4 w-4 mr-1 flex-shrink-0" }),
|
|
344
|
-
"Back"
|
|
345
|
-
]
|
|
346
|
-
}
|
|
347
|
-
),
|
|
348
|
-
documentStatus && (() => {
|
|
349
|
-
const isPublished = documentStatus === "published";
|
|
350
|
-
const hasUnpublishedChanges = documentStatus === "draft" && wasPublished;
|
|
351
|
-
let badgeLabel;
|
|
352
|
-
if (isPublished) {
|
|
353
|
-
badgeLabel = "Published";
|
|
354
|
-
} else if (hasUnpublishedChanges) {
|
|
355
|
-
badgeLabel = "Unpublished Changes";
|
|
356
|
-
} else {
|
|
357
|
-
badgeLabel = "Draft";
|
|
358
|
-
}
|
|
359
|
-
return /* @__PURE__ */ jsx(
|
|
360
|
-
"span",
|
|
361
|
-
{
|
|
362
|
-
className: cn(
|
|
363
|
-
"px-2.5 py-1 border rounded-full text-xs font-medium whitespace-nowrap",
|
|
364
|
-
isPublished && "bg-green-100 text-green-800 border-green-300",
|
|
365
|
-
hasUnpublishedChanges && "bg-orange-100 text-orange-700 border-orange-200",
|
|
366
|
-
!isPublished && !hasUnpublishedChanges && "bg-amber-100 text-amber-700 border-amber-200"
|
|
367
|
-
),
|
|
368
|
-
children: badgeLabel
|
|
369
|
-
}
|
|
370
|
-
);
|
|
371
|
-
})(),
|
|
372
|
-
showInteractiveToggle && /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
373
|
-
/* @__PURE__ */ jsxs(
|
|
374
|
-
"button",
|
|
375
|
-
{
|
|
376
|
-
type: "button",
|
|
377
|
-
onClick: () => isInteractive && togglePreviewMode(),
|
|
378
|
-
className: cn(
|
|
379
|
-
"inline-flex items-center gap-1 text-xs font-medium rounded transition-colors px-2.5 py-1.5 border",
|
|
380
|
-
!isInteractive ? "bg-blue-500 text-white border-blue-500" : "bg-gray-100 text-gray-500 border-gray-200"
|
|
381
|
-
),
|
|
382
|
-
children: [
|
|
383
|
-
/* @__PURE__ */ jsx(MousePointer, { className: "h-3.5 w-3.5" }),
|
|
384
|
-
"Edit"
|
|
385
|
-
]
|
|
386
|
-
}
|
|
387
|
-
),
|
|
388
|
-
/* @__PURE__ */ jsxs(
|
|
389
|
-
"button",
|
|
390
|
-
{
|
|
391
|
-
type: "button",
|
|
392
|
-
onClick: () => !isInteractive && togglePreviewMode(),
|
|
393
|
-
className: cn(
|
|
394
|
-
"inline-flex items-center gap-1 text-xs font-medium rounded transition-colors px-2.5 py-1.5 border",
|
|
395
|
-
isInteractive ? "bg-blue-500 text-white border-blue-500" : "bg-gray-100 text-gray-500 border-gray-200"
|
|
396
|
-
),
|
|
397
|
-
children: [
|
|
398
|
-
/* @__PURE__ */ jsx(MousePointerClick, { className: "h-3.5 w-3.5" }),
|
|
399
|
-
"Interactive"
|
|
400
|
-
]
|
|
401
|
-
}
|
|
402
|
-
)
|
|
403
|
-
] }),
|
|
404
|
-
lastSaved && !saveError && /* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500 flex items-center gap-1 whitespace-nowrap", children: [
|
|
405
|
-
/* @__PURE__ */ jsx(Check, { className: "h-3 w-3 flex-shrink-0" }),
|
|
406
|
-
"Saved ",
|
|
407
|
-
lastSaved.toLocaleTimeString()
|
|
408
|
-
] }),
|
|
409
|
-
hasUnsavedChanges && !saveError && /* @__PURE__ */ jsx("span", { className: "text-xs text-amber-600 font-medium whitespace-nowrap", children: "Unsaved" }),
|
|
410
|
-
saveError && /* @__PURE__ */ jsxs(
|
|
411
|
-
"button",
|
|
412
|
-
{
|
|
413
|
-
type: "button",
|
|
414
|
-
onClick: () => {
|
|
415
|
-
},
|
|
416
|
-
className: "flex items-center gap-1.5 px-2.5 py-1.5 bg-red-50 border border-red-200 rounded-md text-red-700 text-xs font-medium",
|
|
417
|
-
children: [
|
|
418
|
-
/* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4 text-red-500 flex-shrink-0" }),
|
|
419
|
-
"Error"
|
|
420
|
-
]
|
|
421
|
-
}
|
|
422
|
-
),
|
|
423
|
-
saveError && /* @__PURE__ */ jsx(
|
|
424
|
-
"div",
|
|
425
|
-
{
|
|
426
|
-
className: "fixed inset-0 z-[9999] flex items-center justify-center bg-black/50",
|
|
427
|
-
onClick: onDismissError,
|
|
428
|
-
children: /* @__PURE__ */ jsxs(
|
|
429
|
-
"div",
|
|
430
|
-
{
|
|
431
|
-
className: "bg-white rounded-lg shadow-xl max-w-md w-full mx-4 overflow-hidden",
|
|
432
|
-
onClick: (e) => e.stopPropagation(),
|
|
433
|
-
children: [
|
|
434
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-5 py-4 border-b border-gray-200 bg-red-50", children: [
|
|
435
|
-
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 w-10 h-10 rounded-full bg-red-100 flex items-center justify-center", children: /* @__PURE__ */ jsx(AlertTriangle, { className: "h-5 w-5 text-red-600" }) }),
|
|
436
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
437
|
-
/* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-gray-900", children: "Save Failed" }),
|
|
438
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "Unable to save your changes" })
|
|
439
|
-
] })
|
|
440
|
-
] }),
|
|
441
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 py-4", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-700", children: saveError }) }),
|
|
442
|
-
/* @__PURE__ */ jsx("div", { className: "px-5 py-4 bg-gray-50 border-t border-gray-200 flex justify-end", children: /* @__PURE__ */ jsx(
|
|
443
|
-
"button",
|
|
444
|
-
{
|
|
445
|
-
type: "button",
|
|
446
|
-
onClick: onDismissError,
|
|
447
|
-
className: "px-4 py-2 bg-gray-900 text-white text-sm font-medium rounded-md hover:bg-gray-800 transition-colors",
|
|
448
|
-
children: "Close"
|
|
449
|
-
}
|
|
450
|
-
) })
|
|
451
|
-
]
|
|
452
|
-
}
|
|
453
|
-
)
|
|
454
|
-
}
|
|
455
|
-
),
|
|
456
|
-
showPreviewButton && onOpenPreview && /* @__PURE__ */ jsxs(
|
|
457
|
-
"button",
|
|
458
|
-
{
|
|
459
|
-
type: "button",
|
|
460
|
-
onClick: onOpenPreview,
|
|
461
|
-
disabled: isSaving,
|
|
462
|
-
className: cn(
|
|
463
|
-
btnBase,
|
|
464
|
-
"px-3 py-1.5 bg-blue-600 text-white border border-blue-600 rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
465
|
-
),
|
|
466
|
-
children: [
|
|
467
|
-
/* @__PURE__ */ jsx(Eye, { className: "h-4 w-4 mr-1 flex-shrink-0" }),
|
|
468
|
-
"Preview"
|
|
469
|
-
]
|
|
470
|
-
}
|
|
471
|
-
),
|
|
472
|
-
showViewPage && /* @__PURE__ */ jsxs(
|
|
473
|
-
"button",
|
|
474
|
-
{
|
|
475
|
-
type: "button",
|
|
476
|
-
onClick: onPreview,
|
|
477
|
-
className: cn(btnBase, "px-3 py-1.5 bg-white text-gray-700 border border-gray-300 rounded hover:bg-gray-50"),
|
|
478
|
-
children: [
|
|
479
|
-
/* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4 mr-1 flex-shrink-0" }),
|
|
480
|
-
"View"
|
|
481
|
-
]
|
|
482
|
-
}
|
|
483
|
-
),
|
|
484
|
-
showVersionHistory && pageId && /* @__PURE__ */ jsx(
|
|
485
|
-
VersionHistory,
|
|
486
|
-
{
|
|
487
|
-
pageId,
|
|
488
|
-
apiEndpoint,
|
|
489
|
-
disabled: isSaving
|
|
490
|
-
}
|
|
491
|
-
),
|
|
492
|
-
showSaveDraft && /* @__PURE__ */ jsxs(
|
|
493
|
-
"button",
|
|
494
|
-
{
|
|
495
|
-
type: "button",
|
|
496
|
-
onClick: handleSaveClick,
|
|
497
|
-
disabled: isSaving || !hasUnsavedChanges,
|
|
498
|
-
className: cn(
|
|
499
|
-
btnBase,
|
|
500
|
-
"px-3 py-1.5 bg-white text-gray-700 border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
501
|
-
),
|
|
502
|
-
children: [
|
|
503
|
-
isSaving ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-1 flex-shrink-0 animate-spin" }) : /* @__PURE__ */ jsx(Save, { className: "h-4 w-4 mr-1 flex-shrink-0" }),
|
|
504
|
-
"Save"
|
|
505
|
-
]
|
|
506
|
-
}
|
|
507
|
-
),
|
|
508
|
-
onPublish && /* @__PURE__ */ jsxs(
|
|
509
|
-
"button",
|
|
510
|
-
{
|
|
511
|
-
type: "button",
|
|
512
|
-
onClick: handlePublishClick,
|
|
513
|
-
disabled: isSaving,
|
|
514
|
-
className: cn(
|
|
515
|
-
btnBase,
|
|
516
|
-
"px-3 py-1.5 bg-blue-600 text-white border border-blue-600 rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
517
|
-
),
|
|
518
|
-
children: [
|
|
519
|
-
isSaving ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-1 flex-shrink-0 animate-spin" }) : /* @__PURE__ */ jsx(Upload, { className: "h-4 w-4 mr-1 flex-shrink-0" }),
|
|
520
|
-
"Publish"
|
|
521
|
-
]
|
|
522
|
-
}
|
|
523
|
-
),
|
|
524
|
-
actionsEnd,
|
|
525
|
-
!onPublish && children
|
|
526
|
-
] });
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
// src/fields/shared.ts
|
|
532
|
-
function cn2(...classes) {
|
|
533
|
-
return classes.filter(Boolean).join(" ");
|
|
534
|
-
}
|
|
535
|
-
function isLegacyWidthValue(value) {
|
|
536
|
-
if (!value || typeof value !== "object") return false;
|
|
537
|
-
const v = value;
|
|
538
|
-
return typeof v.maxWidth === "number" && typeof v.unit === "string" && typeof v.mode === "string" && !("minWidth" in v) && !("minHeight" in v) && !("maxHeight" in v);
|
|
539
|
-
}
|
|
540
|
-
function hexToRgb(hex) {
|
|
541
|
-
const clean = hex.replace(/^#/, "");
|
|
542
|
-
if (clean.length !== 6) return null;
|
|
543
|
-
const r = parseInt(clean.substring(0, 2), 16);
|
|
544
|
-
const g = parseInt(clean.substring(2, 4), 16);
|
|
545
|
-
const b = parseInt(clean.substring(4, 6), 16);
|
|
546
|
-
if (isNaN(r) || isNaN(g) || isNaN(b)) return null;
|
|
547
|
-
return { r, g, b };
|
|
548
|
-
}
|
|
549
|
-
function colorValueToCSS(color) {
|
|
550
|
-
if (!color?.hex) return void 0;
|
|
551
|
-
const rgb = hexToRgb(color.hex);
|
|
552
|
-
if (!rgb) return color.hex;
|
|
553
|
-
const opacity = (color.opacity ?? 100) / 100;
|
|
554
|
-
if (opacity === 1) {
|
|
555
|
-
return color.hex;
|
|
556
|
-
}
|
|
557
|
-
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${opacity})`;
|
|
558
|
-
}
|
|
559
|
-
function paddingValueToCSS(padding) {
|
|
560
|
-
if (!padding) return void 0;
|
|
561
|
-
const { top, right, bottom, left, unit } = padding;
|
|
562
|
-
if (top === right && right === bottom && bottom === left) {
|
|
563
|
-
return `${top}${unit}`;
|
|
564
|
-
}
|
|
565
|
-
if (top === bottom && left === right) {
|
|
566
|
-
return `${top}${unit} ${right}${unit}`;
|
|
567
|
-
}
|
|
568
|
-
if (left === right) {
|
|
569
|
-
return `${top}${unit} ${right}${unit} ${bottom}${unit}`;
|
|
570
|
-
}
|
|
571
|
-
return `${top}${unit} ${right}${unit} ${bottom}${unit} ${left}${unit}`;
|
|
572
|
-
}
|
|
573
|
-
function marginValueToCSS(margin) {
|
|
574
|
-
if (!margin) return void 0;
|
|
575
|
-
const { top, right, bottom, left, unit } = margin;
|
|
576
|
-
if (top === right && right === bottom && bottom === left) {
|
|
577
|
-
return `${top}${unit}`;
|
|
578
|
-
}
|
|
579
|
-
if (top === bottom && left === right) {
|
|
580
|
-
return `${top}${unit} ${right}${unit}`;
|
|
581
|
-
}
|
|
582
|
-
if (left === right) {
|
|
583
|
-
return `${top}${unit} ${right}${unit} ${bottom}${unit}`;
|
|
584
|
-
}
|
|
585
|
-
return `${top}${unit} ${right}${unit} ${bottom}${unit} ${left}${unit}`;
|
|
586
|
-
}
|
|
587
|
-
function borderValueToCSS(border) {
|
|
588
|
-
if (!border || border.style === "none") return void 0;
|
|
589
|
-
const color = colorValueToCSS(border.color) || "#000000";
|
|
590
|
-
const style = {};
|
|
591
|
-
if (border.sides.top) {
|
|
592
|
-
style.borderTopWidth = `${border.width}px`;
|
|
593
|
-
style.borderTopStyle = border.style;
|
|
594
|
-
style.borderTopColor = color;
|
|
595
|
-
}
|
|
596
|
-
if (border.sides.right) {
|
|
597
|
-
style.borderRightWidth = `${border.width}px`;
|
|
598
|
-
style.borderRightStyle = border.style;
|
|
599
|
-
style.borderRightColor = color;
|
|
600
|
-
}
|
|
601
|
-
if (border.sides.bottom) {
|
|
602
|
-
style.borderBottomWidth = `${border.width}px`;
|
|
603
|
-
style.borderBottomStyle = border.style;
|
|
604
|
-
style.borderBottomColor = color;
|
|
605
|
-
}
|
|
606
|
-
if (border.sides.left) {
|
|
607
|
-
style.borderLeftWidth = `${border.width}px`;
|
|
608
|
-
style.borderLeftStyle = border.style;
|
|
609
|
-
style.borderLeftColor = color;
|
|
610
|
-
}
|
|
611
|
-
if (border.radius > 0) {
|
|
612
|
-
style.borderRadius = `${border.radius}px`;
|
|
613
|
-
}
|
|
614
|
-
return Object.keys(style).length > 0 ? style : void 0;
|
|
615
|
-
}
|
|
616
|
-
function widthValueToCSS(width) {
|
|
617
|
-
if (!width) return void 0;
|
|
618
|
-
const style = {};
|
|
619
|
-
if (width.mode === "full") {
|
|
620
|
-
style.width = "100%";
|
|
621
|
-
style.maxWidth = "100%";
|
|
622
|
-
} else {
|
|
623
|
-
style.maxWidth = `${width.maxWidth}${width.unit}`;
|
|
624
|
-
style.width = "100%";
|
|
625
|
-
}
|
|
626
|
-
switch (width.alignment) {
|
|
627
|
-
case "left":
|
|
628
|
-
style.marginLeft = "0";
|
|
629
|
-
style.marginRight = "auto";
|
|
630
|
-
break;
|
|
631
|
-
case "center":
|
|
632
|
-
style.marginLeft = "auto";
|
|
633
|
-
style.marginRight = "auto";
|
|
634
|
-
break;
|
|
635
|
-
case "right":
|
|
636
|
-
style.marginLeft = "auto";
|
|
637
|
-
style.marginRight = "0";
|
|
638
|
-
break;
|
|
639
|
-
}
|
|
640
|
-
return style;
|
|
641
|
-
}
|
|
642
|
-
function dimensionsValueToCSS(dimensions) {
|
|
643
|
-
if (!dimensions) return void 0;
|
|
644
|
-
if (isLegacyWidthValue(dimensions)) {
|
|
645
|
-
return widthValueToCSS(dimensions);
|
|
646
|
-
}
|
|
647
|
-
const dim = dimensions;
|
|
648
|
-
const style = {};
|
|
649
|
-
if (dim.mode === "full") {
|
|
650
|
-
style.width = "100%";
|
|
651
|
-
style.maxWidth = "100%";
|
|
652
|
-
} else {
|
|
653
|
-
style.width = "100%";
|
|
654
|
-
if (dim.maxWidth?.enabled !== false && dim.maxWidth?.value > 0) {
|
|
655
|
-
style.maxWidth = `${dim.maxWidth.value}${dim.maxWidth.unit}`;
|
|
656
|
-
}
|
|
657
|
-
if (dim.minWidth?.enabled && dim.minWidth.value > 0) {
|
|
658
|
-
style.minWidth = `${dim.minWidth.value}${dim.minWidth.unit}`;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
if (dim.minHeight?.enabled && dim.minHeight.value > 0) {
|
|
662
|
-
style.minHeight = `${dim.minHeight.value}${dim.minHeight.unit}`;
|
|
663
|
-
}
|
|
664
|
-
if (dim.maxHeight?.enabled && dim.maxHeight.value > 0) {
|
|
665
|
-
style.maxHeight = `${dim.maxHeight.value}${dim.maxHeight.unit}`;
|
|
666
|
-
}
|
|
667
|
-
switch (dim.alignment) {
|
|
668
|
-
case "left":
|
|
669
|
-
style.marginLeft = "0";
|
|
670
|
-
style.marginRight = "auto";
|
|
671
|
-
break;
|
|
672
|
-
case "center":
|
|
673
|
-
style.marginLeft = "auto";
|
|
674
|
-
style.marginRight = "auto";
|
|
675
|
-
break;
|
|
676
|
-
case "right":
|
|
677
|
-
style.marginLeft = "auto";
|
|
678
|
-
style.marginRight = "0";
|
|
679
|
-
break;
|
|
680
|
-
}
|
|
681
|
-
return style;
|
|
682
|
-
}
|
|
683
|
-
function gradientValueToCSS(gradient) {
|
|
684
|
-
if (!gradient?.stops || gradient.stops.length === 0) {
|
|
685
|
-
return "transparent";
|
|
686
|
-
}
|
|
687
|
-
const sortedStops = [...gradient.stops].sort((a, b) => a.position - b.position);
|
|
688
|
-
const stopsCSS = sortedStops.map((stop) => {
|
|
689
|
-
const color = colorValueToCSS(stop.color) || "transparent";
|
|
690
|
-
return `${color} ${stop.position}%`;
|
|
691
|
-
}).join(", ");
|
|
692
|
-
if (gradient.type === "radial") {
|
|
693
|
-
const shape = gradient.radialShape || "circle";
|
|
694
|
-
const position = gradient.radialPosition || "center";
|
|
695
|
-
return `radial-gradient(${shape} at ${position}, ${stopsCSS})`;
|
|
696
|
-
}
|
|
697
|
-
return `linear-gradient(${gradient.angle}deg, ${stopsCSS})`;
|
|
698
|
-
}
|
|
699
|
-
function positionToCSS(position) {
|
|
700
|
-
const positionMap = {
|
|
701
|
-
center: "center",
|
|
702
|
-
top: "top",
|
|
703
|
-
bottom: "bottom",
|
|
704
|
-
left: "left",
|
|
705
|
-
right: "right",
|
|
706
|
-
"top-left": "top left",
|
|
707
|
-
"top-right": "top right",
|
|
708
|
-
"bottom-left": "bottom left",
|
|
709
|
-
"bottom-right": "bottom right"
|
|
710
|
-
};
|
|
711
|
-
return position ? positionMap[position] || "center" : "center";
|
|
712
|
-
}
|
|
713
|
-
function maskDirectionToCSS(direction) {
|
|
714
|
-
const directionMap = {
|
|
715
|
-
"to-top": "to top",
|
|
716
|
-
"to-bottom": "to bottom",
|
|
717
|
-
"to-left": "to left",
|
|
718
|
-
"to-right": "to right",
|
|
719
|
-
"to-top-left": "to top left",
|
|
720
|
-
"to-top-right": "to top right",
|
|
721
|
-
"to-bottom-left": "to bottom left",
|
|
722
|
-
"to-bottom-right": "to bottom right",
|
|
723
|
-
"from-center": "radial"
|
|
724
|
-
// Not used for linear, handled separately in maskToCSS
|
|
725
|
-
};
|
|
726
|
-
return directionMap[direction] || "to bottom";
|
|
727
|
-
}
|
|
728
|
-
function maskToCSS(mask) {
|
|
729
|
-
const startAlpha = (mask.startOpacity ?? 100) / 100;
|
|
730
|
-
const endAlpha = (mask.endOpacity ?? 0) / 100;
|
|
731
|
-
if (mask.direction === "from-center") {
|
|
732
|
-
return `radial-gradient(circle at center, rgba(0,0,0,${startAlpha}) ${mask.startPosition}%, rgba(0,0,0,${endAlpha}) ${mask.endPosition}%)`;
|
|
733
|
-
}
|
|
734
|
-
const direction = maskDirectionToCSS(mask.direction);
|
|
735
|
-
return `linear-gradient(${direction}, rgba(0,0,0,${startAlpha}) ${mask.startPosition}%, rgba(0,0,0,${endAlpha}) ${mask.endPosition}%)`;
|
|
736
|
-
}
|
|
737
|
-
function backgroundValueToCSS(bg) {
|
|
738
|
-
if (!bg || bg.type === "none") {
|
|
739
|
-
return {};
|
|
740
|
-
}
|
|
741
|
-
const style = {};
|
|
742
|
-
switch (bg.type) {
|
|
743
|
-
case "solid":
|
|
744
|
-
if (bg.solid?.hex) {
|
|
745
|
-
style.backgroundColor = colorValueToCSS(bg.solid);
|
|
746
|
-
}
|
|
747
|
-
break;
|
|
748
|
-
case "gradient":
|
|
749
|
-
if (bg.gradient && bg.gradient.stops && bg.gradient.stops.length > 0) {
|
|
750
|
-
style.background = gradientValueToCSS(bg.gradient);
|
|
751
|
-
}
|
|
752
|
-
break;
|
|
753
|
-
case "image":
|
|
754
|
-
if (bg.image?.media?.url) {
|
|
755
|
-
const imageUrl = bg.image.media.url;
|
|
756
|
-
const size = bg.image.size || "cover";
|
|
757
|
-
const position = positionToCSS(bg.image.position);
|
|
758
|
-
const repeat = bg.image.repeat || "no-repeat";
|
|
759
|
-
const attachment = bg.image.attachment || "scroll";
|
|
760
|
-
if (bg.overlay?.enabled) {
|
|
761
|
-
const overlayCSS = bg.overlay.type === "solid" ? colorValueToCSS(bg.overlay.solid) : gradientValueToCSS(bg.overlay.gradient);
|
|
762
|
-
if (bg.overlay.type === "solid" && overlayCSS) {
|
|
763
|
-
style.backgroundImage = `linear-gradient(${overlayCSS}, ${overlayCSS}), url(${imageUrl})`;
|
|
764
|
-
} else {
|
|
765
|
-
style.backgroundImage = `${overlayCSS}, url(${imageUrl})`;
|
|
766
|
-
}
|
|
767
|
-
style.backgroundSize = `auto, ${size}`;
|
|
768
|
-
style.backgroundPosition = `center, ${position}`;
|
|
769
|
-
style.backgroundRepeat = `no-repeat, ${repeat}`;
|
|
770
|
-
style.backgroundAttachment = `scroll, ${attachment}`;
|
|
771
|
-
} else {
|
|
772
|
-
style.backgroundImage = `url(${imageUrl})`;
|
|
773
|
-
style.backgroundSize = size;
|
|
774
|
-
style.backgroundPosition = position;
|
|
775
|
-
style.backgroundRepeat = repeat;
|
|
776
|
-
style.backgroundAttachment = attachment;
|
|
777
|
-
}
|
|
778
|
-
if (bg.image.mask?.enabled) {
|
|
779
|
-
const maskCSS = maskToCSS(bg.image.mask);
|
|
780
|
-
style.maskImage = maskCSS;
|
|
781
|
-
style.WebkitMaskImage = maskCSS;
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
break;
|
|
785
|
-
}
|
|
786
|
-
return style;
|
|
787
|
-
}
|
|
788
|
-
function transformOriginToCSS(origin) {
|
|
789
|
-
const originMap = {
|
|
790
|
-
center: "center",
|
|
791
|
-
top: "top",
|
|
792
|
-
bottom: "bottom",
|
|
793
|
-
left: "left",
|
|
794
|
-
right: "right",
|
|
795
|
-
"top-left": "top left",
|
|
796
|
-
"top-right": "top right",
|
|
797
|
-
"bottom-left": "bottom left",
|
|
798
|
-
"bottom-right": "bottom right"
|
|
799
|
-
};
|
|
800
|
-
return originMap[origin] || "center";
|
|
801
|
-
}
|
|
802
|
-
function transformValueToCSS(transform) {
|
|
803
|
-
if (!transform) return void 0;
|
|
804
|
-
const style = {};
|
|
805
|
-
const transforms = [];
|
|
806
|
-
if (transform.enable3D && transform.perspective) {
|
|
807
|
-
style.perspective = `${transform.perspective}px`;
|
|
808
|
-
}
|
|
809
|
-
if (transform.translateX !== 0 || transform.translateY !== 0) {
|
|
810
|
-
transforms.push(
|
|
811
|
-
`translate(${transform.translateX}${transform.translateUnit}, ${transform.translateY}${transform.translateUnit})`
|
|
812
|
-
);
|
|
813
|
-
}
|
|
814
|
-
if (transform.rotate !== 0) {
|
|
815
|
-
transforms.push(`rotate(${transform.rotate}deg)`);
|
|
816
|
-
}
|
|
817
|
-
if (transform.enable3D) {
|
|
818
|
-
if (transform.rotateX && transform.rotateX !== 0) {
|
|
819
|
-
transforms.push(`rotateX(${transform.rotateX}deg)`);
|
|
820
|
-
}
|
|
821
|
-
if (transform.rotateY && transform.rotateY !== 0) {
|
|
822
|
-
transforms.push(`rotateY(${transform.rotateY}deg)`);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
if (transform.scaleX !== 1 || transform.scaleY !== 1) {
|
|
826
|
-
if (transform.scaleX === transform.scaleY) {
|
|
827
|
-
transforms.push(`scale(${transform.scaleX})`);
|
|
828
|
-
} else {
|
|
829
|
-
transforms.push(`scale(${transform.scaleX}, ${transform.scaleY})`);
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
if (transform.skewX !== 0 || transform.skewY !== 0) {
|
|
833
|
-
if (transform.skewX !== 0 && transform.skewY !== 0) {
|
|
834
|
-
transforms.push(`skew(${transform.skewX}deg, ${transform.skewY}deg)`);
|
|
835
|
-
} else if (transform.skewX !== 0) {
|
|
836
|
-
transforms.push(`skewX(${transform.skewX}deg)`);
|
|
837
|
-
} else {
|
|
838
|
-
transforms.push(`skewY(${transform.skewY}deg)`);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
if (transforms.length > 0) {
|
|
842
|
-
style.transform = transforms.join(" ");
|
|
843
|
-
}
|
|
844
|
-
if (transform.origin !== "center") {
|
|
845
|
-
style.transformOrigin = transformOriginToCSS(transform.origin);
|
|
846
|
-
}
|
|
847
|
-
if (transform.enable3D) {
|
|
848
|
-
style.transformStyle = "preserve-3d";
|
|
849
|
-
}
|
|
850
|
-
return Object.keys(style).length > 0 ? style : void 0;
|
|
851
|
-
}
|
|
852
|
-
function isResponsiveValue(value) {
|
|
853
|
-
if (!value || typeof value !== "object") return false;
|
|
854
|
-
return "xs" in value;
|
|
855
|
-
}
|
|
856
|
-
function camelToKebab(str) {
|
|
857
|
-
return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
858
|
-
}
|
|
859
|
-
function cssPropertiesToString(styles) {
|
|
860
|
-
return Object.entries(styles).filter(([, value]) => value !== void 0 && value !== null && value !== "").map(([key, value]) => `${camelToKebab(key)}: ${value}`).join("; ");
|
|
861
|
-
}
|
|
862
|
-
function responsiveValueToCSS(value, converter, uniqueId) {
|
|
863
|
-
if (value === null || value === void 0) {
|
|
864
|
-
return { baseStyles: {}, mediaQueryCSS: "" };
|
|
865
|
-
}
|
|
866
|
-
if (!isResponsiveValue(value)) {
|
|
867
|
-
const styles = converter(value);
|
|
868
|
-
return {
|
|
869
|
-
baseStyles: styles || {},
|
|
870
|
-
mediaQueryCSS: ""
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
const mediaQueries = [];
|
|
874
|
-
let baseStyles = {};
|
|
875
|
-
BREAKPOINTS.forEach((bp) => {
|
|
876
|
-
const bpValue = value[bp.key];
|
|
877
|
-
if (bpValue === void 0) return;
|
|
878
|
-
const cssProps = converter(bpValue);
|
|
879
|
-
if (!cssProps) return;
|
|
880
|
-
if (bp.key === "xs") {
|
|
881
|
-
baseStyles = cssProps;
|
|
882
|
-
} else {
|
|
883
|
-
const styleString = cssPropertiesToString(cssProps);
|
|
884
|
-
if (styleString) {
|
|
885
|
-
mediaQueries.push(
|
|
886
|
-
`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
|
|
887
|
-
);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
});
|
|
891
|
-
return { baseStyles, mediaQueryCSS: mediaQueries.join("\n") };
|
|
892
|
-
}
|
|
893
|
-
function visibilityValueToCSS(visibility, uniqueId) {
|
|
894
|
-
if (!visibility) return "";
|
|
895
|
-
const mediaQueries = [];
|
|
896
|
-
const breakpointWidths = {
|
|
897
|
-
xs: null,
|
|
898
|
-
// 0px
|
|
899
|
-
sm: 640,
|
|
900
|
-
md: 768,
|
|
901
|
-
lg: 1024,
|
|
902
|
-
xl: 1280
|
|
903
|
-
};
|
|
904
|
-
const getNextBreakpointWidth = (bp) => {
|
|
905
|
-
const order = ["xs", "sm", "md", "lg", "xl"];
|
|
906
|
-
const index = order.indexOf(bp);
|
|
907
|
-
if (index === -1 || index === order.length - 1) return null;
|
|
908
|
-
return breakpointWidths[order[index + 1]];
|
|
909
|
-
};
|
|
910
|
-
if (visibility.xs === false) {
|
|
911
|
-
const nextWidth = getNextBreakpointWidth("xs");
|
|
912
|
-
if (nextWidth) {
|
|
913
|
-
mediaQueries.push(`@media (max-width: ${nextWidth - 1}px) { .${uniqueId} { display: none; } }`);
|
|
914
|
-
} else {
|
|
915
|
-
mediaQueries.push(`.${uniqueId} { display: none; }`);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
BREAKPOINTS.slice(1).forEach((bp) => {
|
|
919
|
-
if (visibility[bp.key] === false) {
|
|
920
|
-
const minWidth = breakpointWidths[bp.key];
|
|
921
|
-
const maxWidth = getNextBreakpointWidth(bp.key);
|
|
922
|
-
if (minWidth && maxWidth) {
|
|
923
|
-
mediaQueries.push(
|
|
924
|
-
`@media (min-width: ${minWidth}px) and (max-width: ${maxWidth - 1}px) { .${uniqueId} { display: none; } }`
|
|
925
|
-
);
|
|
926
|
-
} else if (minWidth) {
|
|
927
|
-
mediaQueries.push(
|
|
928
|
-
`@media (min-width: ${minWidth}px) { .${uniqueId} { display: none; } }`
|
|
929
|
-
);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
});
|
|
933
|
-
return mediaQueries.join("\n");
|
|
934
|
-
}
|
|
935
|
-
function animationOriginToCSS(origin) {
|
|
936
|
-
if (!origin) return "center";
|
|
937
|
-
const originMap = {
|
|
938
|
-
center: "center",
|
|
939
|
-
top: "top",
|
|
940
|
-
bottom: "bottom",
|
|
941
|
-
left: "left",
|
|
942
|
-
right: "right",
|
|
943
|
-
"top-left": "top left",
|
|
944
|
-
"top-right": "top right",
|
|
945
|
-
"bottom-left": "bottom left",
|
|
946
|
-
"bottom-right": "bottom right"
|
|
947
|
-
};
|
|
948
|
-
return originMap[origin] || "center";
|
|
949
|
-
}
|
|
950
|
-
function animationValueToCSS(anim) {
|
|
951
|
-
if (!anim || anim.mode !== "custom") return void 0;
|
|
952
|
-
const duration = anim.duration ?? 300;
|
|
953
|
-
const delay = anim.delay ?? 0;
|
|
954
|
-
const easing = anim.easing ?? "ease";
|
|
955
|
-
const easingCSS = EASING_CSS_MAP[easing] || "ease";
|
|
956
|
-
return {
|
|
957
|
-
transition: `all ${duration}ms ${easingCSS} ${delay}ms`,
|
|
958
|
-
transitionProperty: "opacity, transform, filter, background-color, color, border-color, box-shadow"
|
|
959
|
-
};
|
|
960
|
-
}
|
|
961
|
-
function getEntranceAnimationStyles(anim) {
|
|
962
|
-
const defaultResult = {
|
|
963
|
-
initial: {},
|
|
964
|
-
animate: {},
|
|
965
|
-
duration: 500,
|
|
966
|
-
delay: 0,
|
|
967
|
-
easing: "ease",
|
|
968
|
-
origin: "center"
|
|
969
|
-
};
|
|
970
|
-
if (!anim || anim.mode !== "preset" || anim.entrance === "none") {
|
|
971
|
-
return defaultResult;
|
|
972
|
-
}
|
|
973
|
-
const duration = anim.entranceDuration ?? 500;
|
|
974
|
-
const delay = anim.entranceDelay ?? 0;
|
|
975
|
-
const easing = EASING_CSS_MAP[anim.easing ?? "ease"] || "ease";
|
|
976
|
-
const origin = animationOriginToCSS(anim.origin);
|
|
977
|
-
const distance = anim.distance ?? 24;
|
|
978
|
-
const scaleFrom = anim.scaleFrom ?? 0.9;
|
|
979
|
-
const rotateAngle = anim.rotateAngle ?? 15;
|
|
980
|
-
const blurAmount = anim.blurAmount ?? 8;
|
|
981
|
-
const entrance = anim.entrance ?? "none";
|
|
982
|
-
let initial = {};
|
|
983
|
-
let animate = {};
|
|
984
|
-
switch (entrance) {
|
|
985
|
-
// ==================== FADE (6) ====================
|
|
986
|
-
case "fade-in":
|
|
987
|
-
initial = { opacity: 0 };
|
|
988
|
-
animate = { opacity: 1 };
|
|
989
|
-
break;
|
|
990
|
-
case "fade-up":
|
|
991
|
-
initial = { opacity: 0, transform: `translateY(${distance}px)` };
|
|
992
|
-
animate = { opacity: 1, transform: "translateY(0)" };
|
|
993
|
-
break;
|
|
994
|
-
case "fade-down":
|
|
995
|
-
initial = { opacity: 0, transform: `translateY(-${distance}px)` };
|
|
996
|
-
animate = { opacity: 1, transform: "translateY(0)" };
|
|
997
|
-
break;
|
|
998
|
-
case "fade-left":
|
|
999
|
-
initial = { opacity: 0, transform: `translateX(${distance}px)` };
|
|
1000
|
-
animate = { opacity: 1, transform: "translateX(0)" };
|
|
1001
|
-
break;
|
|
1002
|
-
case "fade-right":
|
|
1003
|
-
initial = { opacity: 0, transform: `translateX(-${distance}px)` };
|
|
1004
|
-
animate = { opacity: 1, transform: "translateX(0)" };
|
|
1005
|
-
break;
|
|
1006
|
-
case "fade-scale":
|
|
1007
|
-
initial = { opacity: 0, transform: `scale(${scaleFrom})` };
|
|
1008
|
-
animate = { opacity: 1, transform: "scale(1)" };
|
|
1009
|
-
break;
|
|
1010
|
-
// ==================== SCALE (4) ====================
|
|
1011
|
-
case "scale-in":
|
|
1012
|
-
initial = { opacity: 0, transform: `scale(${scaleFrom})` };
|
|
1013
|
-
animate = { opacity: 1, transform: "scale(1)" };
|
|
1014
|
-
break;
|
|
1015
|
-
case "scale-up":
|
|
1016
|
-
initial = { opacity: 0, transform: `scale(${scaleFrom}) translateY(${distance}px)` };
|
|
1017
|
-
animate = { opacity: 1, transform: "scale(1) translateY(0)" };
|
|
1018
|
-
break;
|
|
1019
|
-
case "scale-down":
|
|
1020
|
-
initial = { opacity: 0, transform: `scale(${scaleFrom}) translateY(-${distance}px)` };
|
|
1021
|
-
animate = { opacity: 1, transform: "scale(1) translateY(0)" };
|
|
1022
|
-
break;
|
|
1023
|
-
case "scale-out":
|
|
1024
|
-
initial = { opacity: 0, transform: `scale(${2 - scaleFrom})` };
|
|
1025
|
-
animate = { opacity: 1, transform: "scale(1)" };
|
|
1026
|
-
break;
|
|
1027
|
-
// ==================== SLIDE (4) ====================
|
|
1028
|
-
case "slide-up":
|
|
1029
|
-
initial = { transform: `translateY(${distance}px)` };
|
|
1030
|
-
animate = { transform: "translateY(0)" };
|
|
1031
|
-
break;
|
|
1032
|
-
case "slide-down":
|
|
1033
|
-
initial = { transform: `translateY(-${distance}px)` };
|
|
1034
|
-
animate = { transform: "translateY(0)" };
|
|
1035
|
-
break;
|
|
1036
|
-
case "slide-left":
|
|
1037
|
-
initial = { transform: `translateX(${distance}px)` };
|
|
1038
|
-
animate = { transform: "translateX(0)" };
|
|
1039
|
-
break;
|
|
1040
|
-
case "slide-right":
|
|
1041
|
-
initial = { transform: `translateX(-${distance}px)` };
|
|
1042
|
-
animate = { transform: "translateX(0)" };
|
|
1043
|
-
break;
|
|
1044
|
-
// ==================== BLUR (3) ====================
|
|
1045
|
-
case "blur-in":
|
|
1046
|
-
initial = { opacity: 0, filter: `blur(${blurAmount}px)` };
|
|
1047
|
-
animate = { opacity: 1, filter: "blur(0)" };
|
|
1048
|
-
break;
|
|
1049
|
-
case "blur-up":
|
|
1050
|
-
initial = { opacity: 0, filter: `blur(${blurAmount}px)`, transform: `translateY(${distance}px)` };
|
|
1051
|
-
animate = { opacity: 1, filter: "blur(0)", transform: "translateY(0)" };
|
|
1052
|
-
break;
|
|
1053
|
-
case "blur-down":
|
|
1054
|
-
initial = { opacity: 0, filter: `blur(${blurAmount}px)`, transform: `translateY(-${distance}px)` };
|
|
1055
|
-
animate = { opacity: 1, filter: "blur(0)", transform: "translateY(0)" };
|
|
1056
|
-
break;
|
|
1057
|
-
// ==================== ROTATE (3) ====================
|
|
1058
|
-
case "rotate-in":
|
|
1059
|
-
initial = { opacity: 0, transform: `rotate(${rotateAngle}deg) scale(${scaleFrom})` };
|
|
1060
|
-
animate = { opacity: 1, transform: "rotate(0) scale(1)" };
|
|
1061
|
-
break;
|
|
1062
|
-
case "rotate-up":
|
|
1063
|
-
initial = { opacity: 0, transform: `rotate(${rotateAngle}deg) translateY(${distance}px)` };
|
|
1064
|
-
animate = { opacity: 1, transform: "rotate(0) translateY(0)" };
|
|
1065
|
-
break;
|
|
1066
|
-
case "rotate-down":
|
|
1067
|
-
initial = { opacity: 0, transform: `rotate(-${rotateAngle}deg) translateY(-${distance}px)` };
|
|
1068
|
-
animate = { opacity: 1, transform: "rotate(0) translateY(0)" };
|
|
1069
|
-
break;
|
|
1070
|
-
// ==================== BOUNCE (3) ====================
|
|
1071
|
-
// These use spring/bounce easing by default for the effect
|
|
1072
|
-
case "bounce-in":
|
|
1073
|
-
initial = { opacity: 0, transform: `scale(${scaleFrom * 0.8})` };
|
|
1074
|
-
animate = { opacity: 1, transform: "scale(1)" };
|
|
1075
|
-
break;
|
|
1076
|
-
case "bounce-up":
|
|
1077
|
-
initial = { opacity: 0, transform: `translateY(${distance * 1.5}px)` };
|
|
1078
|
-
animate = { opacity: 1, transform: "translateY(0)" };
|
|
1079
|
-
break;
|
|
1080
|
-
case "bounce-down":
|
|
1081
|
-
initial = { opacity: 0, transform: `translateY(-${distance * 1.5}px)` };
|
|
1082
|
-
animate = { opacity: 1, transform: "translateY(0)" };
|
|
1083
|
-
break;
|
|
1084
|
-
// ==================== FLIP (2) ====================
|
|
1085
|
-
// Flip uses perspective in transform for proper 3D effect
|
|
1086
|
-
// Starts from -90deg (tilted back) so the flip motion is visible
|
|
1087
|
-
case "flip-x":
|
|
1088
|
-
initial = {
|
|
1089
|
-
transform: "perspective(1000px) rotateX(-90deg)",
|
|
1090
|
-
opacity: 0.2,
|
|
1091
|
-
backfaceVisibility: "hidden"
|
|
1092
|
-
};
|
|
1093
|
-
animate = {
|
|
1094
|
-
transform: "perspective(1000px) rotateX(0deg)",
|
|
1095
|
-
opacity: 1,
|
|
1096
|
-
backfaceVisibility: "hidden"
|
|
1097
|
-
};
|
|
1098
|
-
break;
|
|
1099
|
-
case "flip-y":
|
|
1100
|
-
initial = {
|
|
1101
|
-
transform: "perspective(1000px) rotateY(-90deg)",
|
|
1102
|
-
opacity: 0.2,
|
|
1103
|
-
backfaceVisibility: "hidden"
|
|
1104
|
-
};
|
|
1105
|
-
animate = {
|
|
1106
|
-
transform: "perspective(1000px) rotateY(0deg)",
|
|
1107
|
-
opacity: 1,
|
|
1108
|
-
backfaceVisibility: "hidden"
|
|
1109
|
-
};
|
|
1110
|
-
break;
|
|
1111
|
-
// ==================== ZOOM (2) ====================
|
|
1112
|
-
case "zoom-in":
|
|
1113
|
-
initial = { opacity: 0, transform: `scale(${scaleFrom * 0.5})` };
|
|
1114
|
-
animate = { opacity: 1, transform: "scale(1)" };
|
|
1115
|
-
break;
|
|
1116
|
-
case "zoom-out":
|
|
1117
|
-
initial = { opacity: 0, transform: `scale(${2.5 - scaleFrom})` };
|
|
1118
|
-
animate = { opacity: 1, transform: "scale(1)" };
|
|
1119
|
-
break;
|
|
1120
|
-
}
|
|
1121
|
-
return {
|
|
1122
|
-
initial,
|
|
1123
|
-
animate,
|
|
1124
|
-
duration,
|
|
1125
|
-
delay,
|
|
1126
|
-
easing,
|
|
1127
|
-
origin
|
|
1128
|
-
};
|
|
1129
|
-
}
|
|
1130
|
-
var alignmentMap, shadowMap, headingLevelMap, textSizeMap, aspectRatioMap, dividerStyleMap, justifyContentMap, alignItemsMap, BREAKPOINTS, EASING_CSS_MAP;
|
|
1131
|
-
var init_shared = __esm({
|
|
1132
|
-
"src/fields/shared.ts"() {
|
|
1133
|
-
alignmentMap = {
|
|
1134
|
-
left: "text-left",
|
|
1135
|
-
center: "text-center",
|
|
1136
|
-
right: "text-right"
|
|
1137
|
-
};
|
|
1138
|
-
shadowMap = {
|
|
1139
|
-
none: "",
|
|
1140
|
-
sm: "shadow-sm",
|
|
1141
|
-
md: "shadow-md",
|
|
1142
|
-
lg: "shadow-lg",
|
|
1143
|
-
xl: "shadow-xl",
|
|
1144
|
-
"2xl": "shadow-2xl"
|
|
1145
|
-
};
|
|
1146
|
-
headingLevelMap = {
|
|
1147
|
-
h1: "text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight",
|
|
1148
|
-
h2: "text-3xl md:text-4xl font-bold tracking-tight",
|
|
1149
|
-
h3: "text-2xl md:text-3xl font-semibold",
|
|
1150
|
-
h4: "text-xl md:text-2xl font-semibold",
|
|
1151
|
-
h5: "text-lg md:text-xl font-medium",
|
|
1152
|
-
h6: "text-base md:text-lg font-medium"
|
|
1153
|
-
};
|
|
1154
|
-
textSizeMap = {
|
|
1155
|
-
xs: "text-xs",
|
|
1156
|
-
sm: "text-sm",
|
|
1157
|
-
base: "text-base",
|
|
1158
|
-
lg: "text-lg",
|
|
1159
|
-
xl: "text-xl",
|
|
1160
|
-
"2xl": "text-2xl"
|
|
1161
|
-
};
|
|
1162
|
-
aspectRatioMap = {
|
|
1163
|
-
auto: "",
|
|
1164
|
-
square: "aspect-square",
|
|
1165
|
-
video: "aspect-video",
|
|
1166
|
-
portrait: "aspect-[3/4]",
|
|
1167
|
-
landscape: "aspect-[4/3]",
|
|
1168
|
-
wide: "aspect-[21/9]"
|
|
1169
|
-
};
|
|
1170
|
-
dividerStyleMap = {
|
|
1171
|
-
solid: "border-solid",
|
|
1172
|
-
dashed: "border-dashed",
|
|
1173
|
-
dotted: "border-dotted"
|
|
1174
|
-
};
|
|
1175
|
-
justifyContentMap = {
|
|
1176
|
-
start: "justify-start",
|
|
1177
|
-
"flex-start": "justify-start",
|
|
1178
|
-
center: "justify-center",
|
|
1179
|
-
end: "justify-end",
|
|
1180
|
-
"flex-end": "justify-end",
|
|
1181
|
-
between: "justify-between",
|
|
1182
|
-
"space-between": "justify-between",
|
|
1183
|
-
around: "justify-around",
|
|
1184
|
-
"space-around": "justify-around",
|
|
1185
|
-
evenly: "justify-evenly",
|
|
1186
|
-
"space-evenly": "justify-evenly"
|
|
1187
|
-
};
|
|
1188
|
-
alignItemsMap = {
|
|
1189
|
-
start: "items-start",
|
|
1190
|
-
"flex-start": "items-start",
|
|
1191
|
-
center: "items-center",
|
|
1192
|
-
end: "items-end",
|
|
1193
|
-
"flex-end": "items-end",
|
|
1194
|
-
stretch: "items-stretch",
|
|
1195
|
-
baseline: "items-baseline"
|
|
1196
|
-
};
|
|
1197
|
-
BREAKPOINTS = [
|
|
1198
|
-
{ key: "xs", label: "XS", minWidth: null },
|
|
1199
|
-
{ key: "sm", label: "SM", minWidth: 640 },
|
|
1200
|
-
{ key: "md", label: "MD", minWidth: 768 },
|
|
1201
|
-
{ key: "lg", label: "LG", minWidth: 1024 },
|
|
1202
|
-
{ key: "xl", label: "XL", minWidth: 1280 }
|
|
1203
|
-
];
|
|
1204
|
-
EASING_CSS_MAP = {
|
|
1205
|
-
linear: "linear",
|
|
1206
|
-
ease: "ease",
|
|
1207
|
-
"ease-in": "ease-in",
|
|
1208
|
-
"ease-out": "ease-out",
|
|
1209
|
-
"ease-in-out": "ease-in-out",
|
|
1210
|
-
spring: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
|
|
1211
|
-
"spring-gentle": "cubic-bezier(0.34, 1.56, 0.64, 1)",
|
|
1212
|
-
bounce: "cubic-bezier(0.68, -0.55, 0.265, 1.55)",
|
|
1213
|
-
"bounce-in": "cubic-bezier(0.6, -0.28, 0.735, 0.045)",
|
|
1214
|
-
"bounce-out": "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
|
|
1215
|
-
"back-in": "cubic-bezier(0.6, -0.28, 0.735, 0.045)",
|
|
1216
|
-
"back-out": "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
|
|
1217
|
-
"back-in-out": "cubic-bezier(0.68, -0.55, 0.265, 1.55)",
|
|
1218
|
-
elastic: "cubic-bezier(0.68, -0.6, 0.32, 1.6)"
|
|
1219
|
-
};
|
|
1220
|
-
}
|
|
1221
|
-
});
|
|
1222
|
-
var usePuck2, DEFAULT_LAYOUT_CONFIG, IframeWrapper;
|
|
1223
|
-
var init_IframeWrapper = __esm({
|
|
1224
|
-
"src/editor/components/IframeWrapper.tsx"() {
|
|
1225
|
-
"use client";
|
|
1226
|
-
init_shared();
|
|
1227
|
-
usePuck2 = createUsePuck();
|
|
1228
|
-
DEFAULT_LAYOUT_CONFIG = {
|
|
1229
|
-
background: "#ffffff",
|
|
1230
|
-
isDark: false
|
|
1231
|
-
};
|
|
1232
|
-
IframeWrapper = memo(function IframeWrapper2({
|
|
1233
|
-
children,
|
|
1234
|
-
document: iframeDoc,
|
|
1235
|
-
layouts,
|
|
1236
|
-
layoutStyles,
|
|
1237
|
-
layoutKey = "pageLayout",
|
|
1238
|
-
defaultLayout: defaultLayout2 = "default"
|
|
1239
|
-
}) {
|
|
1240
|
-
const appState = usePuck2((s) => s.appState);
|
|
1241
|
-
const isInteractive = appState.ui.previewMode === "interactive";
|
|
1242
|
-
const rootProps = appState.data.root?.props;
|
|
1243
|
-
const layoutValue = rootProps?.[layoutKey] || defaultLayout2;
|
|
1244
|
-
const showHeaderOverride = rootProps?.showHeader;
|
|
1245
|
-
const showFooterOverride = rootProps?.showFooter;
|
|
1246
|
-
const pageBackground = rootProps?.pageBackground;
|
|
1247
|
-
const layoutConfigMap = useMemo(() => {
|
|
1248
|
-
if (layouts) {
|
|
1249
|
-
const map = {};
|
|
1250
|
-
for (const layout of layouts) {
|
|
1251
|
-
map[layout.value] = {
|
|
1252
|
-
background: layout.editorBackground ?? "#ffffff",
|
|
1253
|
-
isDark: layout.editorDarkMode ?? false,
|
|
1254
|
-
header: layout.header,
|
|
1255
|
-
footer: layout.footer,
|
|
1256
|
-
stickyHeaderHeight: layout.stickyHeaderHeight
|
|
1257
|
-
};
|
|
1258
|
-
}
|
|
1259
|
-
return map;
|
|
1260
|
-
}
|
|
1261
|
-
if (layoutStyles) {
|
|
1262
|
-
return layoutStyles;
|
|
1263
|
-
}
|
|
1264
|
-
return { default: DEFAULT_LAYOUT_CONFIG };
|
|
1265
|
-
}, [layouts, layoutStyles]);
|
|
1266
|
-
const layoutConfig = layoutConfigMap[layoutValue] || layoutConfigMap[defaultLayout2] || DEFAULT_LAYOUT_CONFIG;
|
|
1267
|
-
useEffect(() => {
|
|
1268
|
-
if (!iframeDoc) return;
|
|
1269
|
-
const body = iframeDoc.body;
|
|
1270
|
-
const html = iframeDoc.documentElement;
|
|
1271
|
-
if (pageBackground) {
|
|
1272
|
-
const bgStyles = backgroundValueToCSS(pageBackground);
|
|
1273
|
-
body.style.background = "";
|
|
1274
|
-
body.style.backgroundColor = "";
|
|
1275
|
-
body.style.backgroundImage = "";
|
|
1276
|
-
Object.assign(body.style, bgStyles);
|
|
1277
|
-
} else {
|
|
1278
|
-
body.style.background = layoutConfig.background;
|
|
1279
|
-
}
|
|
1280
|
-
body.style.backgroundAttachment = "fixed";
|
|
1281
|
-
body.style.minHeight = "100vh";
|
|
1282
|
-
if (layoutConfig.isDark) {
|
|
1283
|
-
html.classList.add("dark");
|
|
1284
|
-
html.classList.remove("light");
|
|
1285
|
-
body.style.color = "#ffffff";
|
|
1286
|
-
} else {
|
|
1287
|
-
html.classList.remove("dark");
|
|
1288
|
-
html.classList.add("light");
|
|
1289
|
-
body.style.color = "#1f2937";
|
|
1290
|
-
}
|
|
1291
|
-
const RICHTEXT_STYLES_ID = "puck-richtext-output-styles";
|
|
1292
|
-
if (!iframeDoc.getElementById(RICHTEXT_STYLES_ID)) {
|
|
1293
|
-
const style = iframeDoc.createElement("style");
|
|
1294
|
-
style.id = RICHTEXT_STYLES_ID;
|
|
1295
|
-
style.textContent = `
|
|
1296
|
-
/* Rich Text Output Styles for Puck Preview */
|
|
1297
|
-
.richtext-output {
|
|
1298
|
-
font-size: 1.125rem;
|
|
1299
|
-
line-height: 1.75;
|
|
1300
|
-
color: inherit;
|
|
1301
|
-
}
|
|
1302
|
-
.richtext-output h1 {
|
|
1303
|
-
margin-top: 2rem;
|
|
1304
|
-
margin-bottom: 1rem;
|
|
1305
|
-
font-weight: 700;
|
|
1306
|
-
font-size: 2.25rem;
|
|
1307
|
-
line-height: 1.2;
|
|
1308
|
-
}
|
|
1309
|
-
.richtext-output h1:first-child { margin-top: 0; }
|
|
1310
|
-
.richtext-output h2 {
|
|
1311
|
-
margin-top: 2rem;
|
|
1312
|
-
margin-bottom: 1rem;
|
|
1313
|
-
font-weight: 700;
|
|
1314
|
-
font-size: 1.875rem;
|
|
1315
|
-
line-height: 1.25;
|
|
1316
|
-
}
|
|
1317
|
-
.richtext-output h2:first-child { margin-top: 0; }
|
|
1318
|
-
.richtext-output h3 {
|
|
1319
|
-
margin-top: 2rem;
|
|
1320
|
-
margin-bottom: 1rem;
|
|
1321
|
-
font-weight: 700;
|
|
1322
|
-
font-size: 1.5rem;
|
|
1323
|
-
line-height: 1.3;
|
|
1324
|
-
}
|
|
1325
|
-
.richtext-output h3:first-child { margin-top: 0; }
|
|
1326
|
-
.richtext-output h4 {
|
|
1327
|
-
margin-top: 2rem;
|
|
1328
|
-
margin-bottom: 1rem;
|
|
1329
|
-
font-weight: 700;
|
|
1330
|
-
font-size: 1.25rem;
|
|
1331
|
-
line-height: 1.35;
|
|
1332
|
-
}
|
|
1333
|
-
.richtext-output h4:first-child { margin-top: 0; }
|
|
1334
|
-
.richtext-output p {
|
|
1335
|
-
margin-bottom: 1.25rem;
|
|
1336
|
-
}
|
|
1337
|
-
.richtext-output p:last-child { margin-bottom: 0; }
|
|
1338
|
-
.richtext-output ul {
|
|
1339
|
-
margin-bottom: 1.25rem;
|
|
1340
|
-
padding-left: 2rem;
|
|
1341
|
-
list-style-type: disc !important;
|
|
1342
|
-
}
|
|
1343
|
-
.richtext-output ol {
|
|
1344
|
-
margin-bottom: 1.25rem;
|
|
1345
|
-
padding-left: 2rem;
|
|
1346
|
-
list-style-type: decimal !important;
|
|
1347
|
-
}
|
|
1348
|
-
.richtext-output li {
|
|
1349
|
-
margin-bottom: 0.5rem;
|
|
1350
|
-
display: list-item !important;
|
|
1351
|
-
}
|
|
1352
|
-
.richtext-output li::marker {
|
|
1353
|
-
color: currentColor;
|
|
1354
|
-
}
|
|
1355
|
-
.richtext-output ul ul,
|
|
1356
|
-
.richtext-output ol ul {
|
|
1357
|
-
list-style-type: circle !important;
|
|
1358
|
-
margin-top: 0.5rem;
|
|
1359
|
-
margin-bottom: 0;
|
|
1360
|
-
}
|
|
1361
|
-
.richtext-output ul ul ul,
|
|
1362
|
-
.richtext-output ol ul ul {
|
|
1363
|
-
list-style-type: square !important;
|
|
1364
|
-
}
|
|
1365
|
-
.richtext-output ol ol,
|
|
1366
|
-
.richtext-output ul ol {
|
|
1367
|
-
list-style-type: lower-alpha !important;
|
|
1368
|
-
margin-top: 0.5rem;
|
|
1369
|
-
margin-bottom: 0;
|
|
1370
|
-
}
|
|
1371
|
-
.richtext-output blockquote {
|
|
1372
|
-
margin: 1.5rem 0;
|
|
1373
|
-
padding-left: 1.5rem;
|
|
1374
|
-
border-left: 4px solid #e5e7eb;
|
|
1375
|
-
font-style: italic;
|
|
1376
|
-
}
|
|
1377
|
-
.richtext-output a {
|
|
1378
|
-
color: #2563eb;
|
|
1379
|
-
text-decoration: underline;
|
|
1380
|
-
}
|
|
1381
|
-
.richtext-output a:hover { opacity: 0.8; }
|
|
1382
|
-
.richtext-output code {
|
|
1383
|
-
background-color: #f3f4f6;
|
|
1384
|
-
padding: 0.125rem 0.25rem;
|
|
1385
|
-
border-radius: 0.25rem;
|
|
1386
|
-
font-size: 0.875rem;
|
|
1387
|
-
}
|
|
1388
|
-
.richtext-output mark {
|
|
1389
|
-
background-color: #fef08a;
|
|
1390
|
-
padding: 0.125rem 0.25rem;
|
|
1391
|
-
border-radius: 0.125rem;
|
|
1392
|
-
}
|
|
1393
|
-
.richtext-output s,
|
|
1394
|
-
.richtext-output strike {
|
|
1395
|
-
text-decoration: line-through;
|
|
1396
|
-
}
|
|
1397
|
-
@media (max-width: 768px) {
|
|
1398
|
-
.richtext-output { font-size: 1rem; }
|
|
1399
|
-
.richtext-output h1 { font-size: 1.875rem; }
|
|
1400
|
-
.richtext-output h2 { font-size: 1.5rem; }
|
|
1401
|
-
.richtext-output h3 { font-size: 1.25rem; }
|
|
1402
|
-
}
|
|
1403
|
-
`;
|
|
1404
|
-
iframeDoc.head.appendChild(style);
|
|
1405
|
-
}
|
|
1406
|
-
}, [iframeDoc, layoutConfig, pageBackground]);
|
|
1407
|
-
const LayoutHeader = layoutConfig.header;
|
|
1408
|
-
const LayoutFooter = layoutConfig.footer;
|
|
1409
|
-
const shouldShowHeader = showHeaderOverride === "hide" ? false : showHeaderOverride === "show" ? !!LayoutHeader : !!LayoutHeader;
|
|
1410
|
-
const shouldShowFooter = showFooterOverride === "hide" ? false : showFooterOverride === "show" ? !!LayoutFooter : !!LayoutFooter;
|
|
1411
|
-
if (shouldShowHeader || shouldShowFooter) {
|
|
1412
|
-
const contentStyle = {
|
|
1413
|
-
flex: 1,
|
|
1414
|
-
position: "relative",
|
|
1415
|
-
// Add padding-top for sticky headers so content doesn't render behind them
|
|
1416
|
-
...shouldShowHeader && layoutConfig.stickyHeaderHeight && { paddingTop: layoutConfig.stickyHeaderHeight }
|
|
1417
|
-
};
|
|
1418
|
-
const headerFooterStyle = isInteractive ? {} : { pointerEvents: "none" };
|
|
1419
|
-
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", minHeight: "100vh" }, children: [
|
|
1420
|
-
shouldShowHeader && LayoutHeader && /* @__PURE__ */ jsx("div", { style: headerFooterStyle, children: /* @__PURE__ */ jsx(LayoutHeader, {}) }),
|
|
1421
|
-
/* @__PURE__ */ jsx("div", { style: contentStyle, children }),
|
|
1422
|
-
shouldShowFooter && LayoutFooter && /* @__PURE__ */ jsx("div", { style: headerFooterStyle, children: /* @__PURE__ */ jsx(LayoutFooter, {}) })
|
|
1423
|
-
] });
|
|
1424
|
-
}
|
|
1425
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1426
|
-
});
|
|
1427
|
-
}
|
|
1428
|
-
});
|
|
1429
|
-
var Dialog, DialogPortal, DialogOverlay, DialogContent, DialogContentFullscreen, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
1430
|
-
var init_dialog = __esm({
|
|
1431
|
-
"src/components/ui/dialog.tsx"() {
|
|
1432
|
-
"use client";
|
|
1433
|
-
init_utils();
|
|
1434
|
-
Dialog = DialogPrimitive.Root;
|
|
1435
|
-
DialogPortal = DialogPrimitive.Portal;
|
|
1436
|
-
DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1437
|
-
DialogPrimitive.Overlay,
|
|
1438
|
-
{
|
|
1439
|
-
ref,
|
|
1440
|
-
className: cn(
|
|
1441
|
-
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
1442
|
-
className
|
|
1443
|
-
),
|
|
1444
|
-
...props
|
|
1445
|
-
}
|
|
1446
|
-
));
|
|
1447
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
1448
|
-
DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
1449
|
-
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
1450
|
-
/* @__PURE__ */ jsxs(
|
|
1451
|
-
DialogPrimitive.Content,
|
|
1452
|
-
{
|
|
1453
|
-
ref,
|
|
1454
|
-
className: cn(
|
|
1455
|
-
"fixed left-[50%] top-[50%] z-50 flex flex-col w-full max-w-4xl translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg max-h-[85vh] overflow-hidden p-6",
|
|
1456
|
-
className
|
|
1457
|
-
),
|
|
1458
|
-
...props,
|
|
1459
|
-
children: [
|
|
1460
|
-
children,
|
|
1461
|
-
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
1462
|
-
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
1463
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
1464
|
-
] })
|
|
1465
|
-
]
|
|
1466
|
-
}
|
|
1467
|
-
)
|
|
1468
|
-
] }));
|
|
1469
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
1470
|
-
DialogContentFullscreen = React.forwardRef(({ className, children, hideCloseButton = false, accessibleTitle = "Dialog", ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
1471
|
-
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
1472
|
-
/* @__PURE__ */ jsxs(
|
|
1473
|
-
DialogPrimitive.Content,
|
|
1474
|
-
{
|
|
1475
|
-
ref,
|
|
1476
|
-
className: cn(
|
|
1477
|
-
"fixed inset-0 z-50 flex flex-col bg-background duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
1478
|
-
className
|
|
1479
|
-
),
|
|
1480
|
-
...props,
|
|
1481
|
-
children: [
|
|
1482
|
-
/* @__PURE__ */ jsx(DialogPrimitive.Title, { className: "sr-only", children: accessibleTitle }),
|
|
1483
|
-
children,
|
|
1484
|
-
!hideCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
1485
|
-
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
1486
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
1487
|
-
] })
|
|
1488
|
-
]
|
|
1489
|
-
}
|
|
1490
|
-
)
|
|
1491
|
-
] }));
|
|
1492
|
-
DialogContentFullscreen.displayName = "DialogContentFullscreen";
|
|
1493
|
-
DialogHeader = ({
|
|
1494
|
-
className,
|
|
1495
|
-
...props
|
|
1496
|
-
}) => /* @__PURE__ */ jsx(
|
|
1497
|
-
"div",
|
|
1498
|
-
{
|
|
1499
|
-
className: cn(
|
|
1500
|
-
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
1501
|
-
className
|
|
1502
|
-
),
|
|
1503
|
-
...props
|
|
1504
|
-
}
|
|
1505
|
-
);
|
|
1506
|
-
DialogHeader.displayName = "DialogHeader";
|
|
1507
|
-
DialogFooter = ({
|
|
1508
|
-
className,
|
|
1509
|
-
...props
|
|
1510
|
-
}) => /* @__PURE__ */ jsx(
|
|
1511
|
-
"div",
|
|
1512
|
-
{
|
|
1513
|
-
className: cn(
|
|
1514
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
1515
|
-
className
|
|
1516
|
-
),
|
|
1517
|
-
...props
|
|
1518
|
-
}
|
|
1519
|
-
);
|
|
1520
|
-
DialogFooter.displayName = "DialogFooter";
|
|
1521
|
-
DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1522
|
-
DialogPrimitive.Title,
|
|
1523
|
-
{
|
|
1524
|
-
ref,
|
|
1525
|
-
className: cn(
|
|
1526
|
-
"text-lg font-semibold leading-none tracking-tight",
|
|
1527
|
-
className
|
|
1528
|
-
),
|
|
1529
|
-
...props
|
|
1530
|
-
}
|
|
1531
|
-
));
|
|
1532
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
1533
|
-
DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1534
|
-
DialogPrimitive.Description,
|
|
1535
|
-
{
|
|
1536
|
-
ref,
|
|
1537
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
1538
|
-
...props
|
|
1539
|
-
}
|
|
1540
|
-
));
|
|
1541
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
1542
|
-
}
|
|
1543
|
-
});
|
|
1544
|
-
|
|
1545
|
-
// src/layouts/defaults.ts
|
|
1546
|
-
var defaultLayout, landingLayout, fullWidthLayout, DEFAULT_LAYOUTS;
|
|
1547
|
-
var init_defaults = __esm({
|
|
1548
|
-
"src/layouts/defaults.ts"() {
|
|
1549
|
-
defaultLayout = {
|
|
1550
|
-
value: "default",
|
|
1551
|
-
label: "Default",
|
|
1552
|
-
description: "Standard page layout with contained content width",
|
|
1553
|
-
classes: {
|
|
1554
|
-
wrapper: "",
|
|
1555
|
-
container: "mx-auto px-4 sm:px-6 lg:px-8",
|
|
1556
|
-
content: ""
|
|
1557
|
-
},
|
|
1558
|
-
maxWidth: "1200px",
|
|
1559
|
-
fullWidth: false
|
|
1560
|
-
};
|
|
1561
|
-
landingLayout = {
|
|
1562
|
-
value: "landing",
|
|
1563
|
-
label: "Landing",
|
|
1564
|
-
description: "Full-width sections with no global container constraints",
|
|
1565
|
-
classes: {
|
|
1566
|
-
wrapper: "",
|
|
1567
|
-
container: "",
|
|
1568
|
-
content: ""
|
|
1569
|
-
},
|
|
1570
|
-
fullWidth: true
|
|
1571
|
-
};
|
|
1572
|
-
fullWidthLayout = {
|
|
1573
|
-
value: "full-width",
|
|
1574
|
-
label: "Full Width",
|
|
1575
|
-
description: "Content spans the full viewport width",
|
|
1576
|
-
classes: {
|
|
1577
|
-
wrapper: "w-full",
|
|
1578
|
-
container: "w-full",
|
|
1579
|
-
content: ""
|
|
1580
|
-
},
|
|
1581
|
-
maxWidth: "100%",
|
|
1582
|
-
fullWidth: true
|
|
1583
|
-
};
|
|
1584
|
-
DEFAULT_LAYOUTS = [
|
|
1585
|
-
defaultLayout,
|
|
1586
|
-
landingLayout,
|
|
1587
|
-
fullWidthLayout
|
|
1588
|
-
];
|
|
1589
|
-
}
|
|
1590
|
-
});
|
|
1591
|
-
|
|
1592
|
-
// src/layouts/utils.ts
|
|
1593
|
-
function getLayout(layouts, value, fallback = "default") {
|
|
1594
|
-
const layout = layouts.find((l) => l.value === value);
|
|
1595
|
-
if (layout) return layout;
|
|
1596
|
-
if (value !== fallback) {
|
|
1597
|
-
return layouts.find((l) => l.value === fallback);
|
|
1598
|
-
}
|
|
1599
|
-
return layouts[0];
|
|
1600
|
-
}
|
|
1601
|
-
function layoutsToOptions(layouts) {
|
|
1602
|
-
return layouts.map(({ value, label, description }) => ({
|
|
1603
|
-
value,
|
|
1604
|
-
label,
|
|
1605
|
-
description
|
|
1606
|
-
}));
|
|
1607
|
-
}
|
|
1608
|
-
var init_utils2 = __esm({
|
|
1609
|
-
"src/layouts/utils.ts"() {
|
|
1610
|
-
init_defaults();
|
|
1611
|
-
}
|
|
1612
|
-
});
|
|
1613
|
-
function LayoutWrapper({ children, layout, className, overrides }) {
|
|
1614
|
-
if (!layout) {
|
|
1615
|
-
if (overrides?.background) {
|
|
1616
|
-
const bgStyles = backgroundValueToCSS(overrides.background);
|
|
1617
|
-
return /* @__PURE__ */ jsx("div", { style: { minHeight: "100vh", ...bgStyles }, children });
|
|
1618
|
-
}
|
|
1619
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1620
|
-
}
|
|
1621
|
-
const Header = layout.header;
|
|
1622
|
-
const Footer = layout.footer;
|
|
1623
|
-
const shouldShowHeader = overrides?.showHeader === "hide" ? false : overrides?.showHeader === "show" ? true : !!Header;
|
|
1624
|
-
const shouldShowFooter = overrides?.showFooter === "hide" ? false : overrides?.showFooter === "show" ? true : !!Footer;
|
|
1625
|
-
const useStickyFooter = layout.stickyFooter !== false;
|
|
1626
|
-
const mainStyle = {
|
|
1627
|
-
...layout.stickyHeaderHeight && shouldShowHeader ? { paddingTop: layout.stickyHeaderHeight } : {},
|
|
1628
|
-
...useStickyFooter ? stickyFooterMainStyle : {}
|
|
1629
|
-
};
|
|
1630
|
-
const outerBackgroundStyles = overrides?.background ? backgroundValueToCSS(overrides.background) : {
|
|
1631
|
-
...layout.styles?.wrapper?.background !== void 0 ? { background: layout.styles.wrapper.background } : {},
|
|
1632
|
-
...layout.styles?.wrapper?.backgroundAttachment !== void 0 ? { backgroundAttachment: layout.styles.wrapper.backgroundAttachment } : {}
|
|
1633
|
-
};
|
|
1634
|
-
const effectiveMaxWidth = overrides?.maxWidth && overrides.maxWidth !== "default" ? overrides.maxWidth : layout.maxWidth;
|
|
1635
|
-
const wrapWithStickyFooter = (content) => {
|
|
1636
|
-
if (useStickyFooter) {
|
|
1637
|
-
return /* @__PURE__ */ jsx("div", { style: { ...stickyFooterContainerStyle, ...outerBackgroundStyles }, children: content });
|
|
1638
|
-
}
|
|
1639
|
-
const hasBackground = Object.keys(outerBackgroundStyles).length > 0;
|
|
1640
|
-
if (hasBackground) {
|
|
1641
|
-
return /* @__PURE__ */ jsx("div", { style: { minHeight: "100vh", ...outerBackgroundStyles }, children: content });
|
|
1642
|
-
}
|
|
1643
|
-
return /* @__PURE__ */ jsx(Fragment, { children: content });
|
|
1644
|
-
};
|
|
1645
|
-
if (layout.wrapper) {
|
|
1646
|
-
const CustomWrapper = layout.wrapper;
|
|
1647
|
-
return wrapWithStickyFooter(
|
|
1648
|
-
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1649
|
-
shouldShowHeader && Header && /* @__PURE__ */ jsx(Header, {}),
|
|
1650
|
-
/* @__PURE__ */ jsx("main", { style: Object.keys(mainStyle).length > 0 ? mainStyle : void 0, children: /* @__PURE__ */ jsx(CustomWrapper, { children }) }),
|
|
1651
|
-
shouldShowFooter && Footer && /* @__PURE__ */ jsx(Footer, {})
|
|
1652
|
-
] })
|
|
1653
|
-
);
|
|
1654
|
-
}
|
|
1655
|
-
const wrapperStyle = {
|
|
1656
|
-
...layout.styles?.wrapper
|
|
1657
|
-
};
|
|
1658
|
-
const containerStyle = {
|
|
1659
|
-
...effectiveMaxWidth && !layout.fullWidth ? { maxWidth: effectiveMaxWidth } : {},
|
|
1660
|
-
...layout.styles?.container
|
|
1661
|
-
};
|
|
1662
|
-
const contentStyle = {
|
|
1663
|
-
...layout.styles?.content
|
|
1664
|
-
};
|
|
1665
|
-
const dataAttrs = {
|
|
1666
|
-
"data-layout": layout.value,
|
|
1667
|
-
...layout.dataAttributes
|
|
1668
|
-
};
|
|
1669
|
-
if (layout.fullWidth) {
|
|
1670
|
-
return wrapWithStickyFooter(
|
|
1671
|
-
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1672
|
-
shouldShowHeader && Header && /* @__PURE__ */ jsx(Header, {}),
|
|
1673
|
-
/* @__PURE__ */ jsx(
|
|
1674
|
-
"main",
|
|
1675
|
-
{
|
|
1676
|
-
className: [layout.classes?.wrapper, className].filter(Boolean).join(" ") || void 0,
|
|
1677
|
-
style: {
|
|
1678
|
-
...mainStyle,
|
|
1679
|
-
...Object.keys(wrapperStyle).length > 0 ? wrapperStyle : {}
|
|
1680
|
-
},
|
|
1681
|
-
...dataAttrs,
|
|
1682
|
-
children
|
|
1683
|
-
}
|
|
1684
|
-
),
|
|
1685
|
-
shouldShowFooter && Footer && /* @__PURE__ */ jsx(Footer, {})
|
|
1686
|
-
] })
|
|
1687
|
-
);
|
|
1688
|
-
}
|
|
1689
|
-
return wrapWithStickyFooter(
|
|
1690
|
-
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1691
|
-
shouldShowHeader && Header && /* @__PURE__ */ jsx(Header, {}),
|
|
1692
|
-
/* @__PURE__ */ jsx(
|
|
1693
|
-
"main",
|
|
1694
|
-
{
|
|
1695
|
-
className: layout.classes?.wrapper || void 0,
|
|
1696
|
-
style: {
|
|
1697
|
-
...mainStyle,
|
|
1698
|
-
...Object.keys(wrapperStyle).length > 0 ? wrapperStyle : {}
|
|
1699
|
-
},
|
|
1700
|
-
...dataAttrs,
|
|
1701
|
-
children: /* @__PURE__ */ jsx(
|
|
1702
|
-
"div",
|
|
1703
|
-
{
|
|
1704
|
-
className: [layout.classes?.container, className].filter(Boolean).join(" ") || void 0,
|
|
1705
|
-
style: Object.keys(containerStyle).length > 0 ? containerStyle : void 0,
|
|
1706
|
-
children: /* @__PURE__ */ jsx(
|
|
1707
|
-
"div",
|
|
1708
|
-
{
|
|
1709
|
-
className: layout.classes?.content || void 0,
|
|
1710
|
-
style: Object.keys(contentStyle).length > 0 ? contentStyle : void 0,
|
|
1711
|
-
children
|
|
1712
|
-
}
|
|
1713
|
-
)
|
|
1714
|
-
}
|
|
1715
|
-
)
|
|
1716
|
-
}
|
|
1717
|
-
),
|
|
1718
|
-
shouldShowFooter && Footer && /* @__PURE__ */ jsx(Footer, {})
|
|
1719
|
-
] })
|
|
1720
|
-
);
|
|
1721
|
-
}
|
|
1722
|
-
var stickyFooterContainerStyle, stickyFooterMainStyle;
|
|
1723
|
-
var init_LayoutWrapper = __esm({
|
|
1724
|
-
"src/layouts/LayoutWrapper.tsx"() {
|
|
1725
|
-
init_shared();
|
|
1726
|
-
stickyFooterContainerStyle = {
|
|
1727
|
-
minHeight: "100vh",
|
|
1728
|
-
display: "flex",
|
|
1729
|
-
flexDirection: "column"
|
|
1730
|
-
};
|
|
1731
|
-
stickyFooterMainStyle = {
|
|
1732
|
-
flex: 1
|
|
1733
|
-
};
|
|
1734
|
-
}
|
|
1735
|
-
});
|
|
1736
|
-
|
|
1737
|
-
// src/layouts/index.ts
|
|
1738
|
-
var init_layouts = __esm({
|
|
1739
|
-
"src/layouts/index.ts"() {
|
|
1740
|
-
init_defaults();
|
|
1741
|
-
init_utils2();
|
|
1742
|
-
init_LayoutWrapper();
|
|
1743
|
-
}
|
|
1744
|
-
});
|
|
1745
|
-
function useScrollAnimation(options = {}) {
|
|
1746
|
-
const {
|
|
1747
|
-
triggerOnScroll = true,
|
|
1748
|
-
threshold = 0.1,
|
|
1749
|
-
once = true,
|
|
1750
|
-
rootMargin = "0px",
|
|
1751
|
-
delay = 0
|
|
1752
|
-
} = options;
|
|
1753
|
-
const ref = useRef(null);
|
|
1754
|
-
const [isInView, setIsInView] = useState(false);
|
|
1755
|
-
const [hasAnimated, setHasAnimated] = useState(false);
|
|
1756
|
-
const timeoutRef = useRef(null);
|
|
1757
|
-
const hasMountedRef = useRef(false);
|
|
1758
|
-
const reset = useCallback(() => {
|
|
1759
|
-
setIsInView(false);
|
|
1760
|
-
setHasAnimated(false);
|
|
1761
|
-
hasMountedRef.current = false;
|
|
1762
|
-
if (timeoutRef.current) {
|
|
1763
|
-
clearTimeout(timeoutRef.current);
|
|
1764
|
-
timeoutRef.current = null;
|
|
1765
|
-
}
|
|
1766
|
-
}, []);
|
|
1767
|
-
useEffect(() => {
|
|
1768
|
-
if (!triggerOnScroll) {
|
|
1769
|
-
if (hasMountedRef.current) return;
|
|
1770
|
-
hasMountedRef.current = true;
|
|
1771
|
-
requestAnimationFrame(() => {
|
|
1772
|
-
requestAnimationFrame(() => {
|
|
1773
|
-
if (delay > 0) {
|
|
1774
|
-
timeoutRef.current = setTimeout(() => {
|
|
1775
|
-
setIsInView(true);
|
|
1776
|
-
setHasAnimated(true);
|
|
1777
|
-
}, delay);
|
|
1778
|
-
} else {
|
|
1779
|
-
setIsInView(true);
|
|
1780
|
-
setHasAnimated(true);
|
|
1781
|
-
}
|
|
1782
|
-
});
|
|
1783
|
-
});
|
|
1784
|
-
return;
|
|
1785
|
-
}
|
|
1786
|
-
if (once && hasAnimated) {
|
|
1787
|
-
return;
|
|
1788
|
-
}
|
|
1789
|
-
const element = ref.current;
|
|
1790
|
-
if (!element) return;
|
|
1791
|
-
if (typeof IntersectionObserver === "undefined") {
|
|
1792
|
-
setIsInView(true);
|
|
1793
|
-
setHasAnimated(true);
|
|
1794
|
-
return;
|
|
1795
|
-
}
|
|
1796
|
-
const observer = new IntersectionObserver(
|
|
1797
|
-
(entries) => {
|
|
1798
|
-
const [entry] = entries;
|
|
1799
|
-
const inView = entry.isIntersecting;
|
|
1800
|
-
if (inView) {
|
|
1801
|
-
if (delay > 0) {
|
|
1802
|
-
timeoutRef.current = setTimeout(() => {
|
|
1803
|
-
setIsInView(true);
|
|
1804
|
-
setHasAnimated(true);
|
|
1805
|
-
}, delay);
|
|
1806
|
-
} else {
|
|
1807
|
-
setIsInView(true);
|
|
1808
|
-
setHasAnimated(true);
|
|
1809
|
-
}
|
|
1810
|
-
if (once) {
|
|
1811
|
-
observer.disconnect();
|
|
1812
|
-
}
|
|
1813
|
-
} else if (!once) {
|
|
1814
|
-
if (timeoutRef.current) {
|
|
1815
|
-
clearTimeout(timeoutRef.current);
|
|
1816
|
-
timeoutRef.current = null;
|
|
1817
|
-
}
|
|
1818
|
-
setIsInView(false);
|
|
1819
|
-
}
|
|
1820
|
-
},
|
|
1821
|
-
{
|
|
1822
|
-
threshold,
|
|
1823
|
-
rootMargin
|
|
1824
|
-
}
|
|
1825
|
-
);
|
|
1826
|
-
observer.observe(element);
|
|
1827
|
-
return () => {
|
|
1828
|
-
observer.disconnect();
|
|
1829
|
-
if (timeoutRef.current) {
|
|
1830
|
-
clearTimeout(timeoutRef.current);
|
|
1831
|
-
timeoutRef.current = null;
|
|
1832
|
-
}
|
|
1833
|
-
};
|
|
1834
|
-
}, [triggerOnScroll, threshold, once, rootMargin, delay, hasAnimated]);
|
|
1835
|
-
return {
|
|
1836
|
-
ref,
|
|
1837
|
-
isInView,
|
|
1838
|
-
hasAnimated,
|
|
1839
|
-
reset
|
|
1840
|
-
};
|
|
1841
|
-
}
|
|
1842
|
-
var init_useScrollAnimation = __esm({
|
|
1843
|
-
"src/hooks/useScrollAnimation.ts"() {
|
|
1844
|
-
"use client";
|
|
1845
|
-
}
|
|
1846
|
-
});
|
|
1847
|
-
function AnimatedWrapper({
|
|
1848
|
-
animation,
|
|
1849
|
-
children,
|
|
1850
|
-
className,
|
|
1851
|
-
style,
|
|
1852
|
-
as: Component = "div"
|
|
1853
|
-
}) {
|
|
1854
|
-
const hasAnimation = animation && (animation.mode === "preset" && animation.entrance && animation.entrance !== "none" || animation.mode === "custom");
|
|
1855
|
-
if (!hasAnimation) {
|
|
1856
|
-
if (className || style) {
|
|
1857
|
-
return /* @__PURE__ */ jsx(Component, { className, style, children });
|
|
1858
|
-
}
|
|
1859
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1860
|
-
}
|
|
1861
|
-
const { ref, isInView } = useScrollAnimation({
|
|
1862
|
-
triggerOnScroll: animation.triggerOnScroll ?? true,
|
|
1863
|
-
threshold: animation.triggerThreshold ?? 0.1,
|
|
1864
|
-
once: animation.triggerOnce ?? true,
|
|
1865
|
-
rootMargin: animation.triggerMargin
|
|
1866
|
-
});
|
|
1867
|
-
if (animation.mode === "preset") {
|
|
1868
|
-
const { initial, animate, duration, delay, easing, origin } = getEntranceAnimationStyles(animation);
|
|
1869
|
-
const animationStyles = isInView ? animate : initial;
|
|
1870
|
-
const transitionProperties = [
|
|
1871
|
-
`opacity ${duration}ms ${easing} ${delay}ms`,
|
|
1872
|
-
`transform ${duration}ms ${easing} ${delay}ms`,
|
|
1873
|
-
`filter ${duration}ms ${easing} ${delay}ms`
|
|
1874
|
-
].join(", ");
|
|
1875
|
-
return /* @__PURE__ */ jsx(
|
|
1876
|
-
Component,
|
|
1877
|
-
{
|
|
1878
|
-
ref,
|
|
1879
|
-
className,
|
|
1880
|
-
style: {
|
|
1881
|
-
...style,
|
|
1882
|
-
...animationStyles,
|
|
1883
|
-
transition: transitionProperties,
|
|
1884
|
-
transformOrigin: origin
|
|
1885
|
-
},
|
|
1886
|
-
children
|
|
1887
|
-
}
|
|
1888
|
-
);
|
|
1889
|
-
}
|
|
1890
|
-
const customStyles = animationValueToCSS(animation);
|
|
1891
|
-
return /* @__PURE__ */ jsx(
|
|
1892
|
-
Component,
|
|
1893
|
-
{
|
|
1894
|
-
ref,
|
|
1895
|
-
className,
|
|
1896
|
-
style: {
|
|
1897
|
-
...style,
|
|
1898
|
-
...customStyles,
|
|
1899
|
-
// Apply opacity for visibility-based transitions
|
|
1900
|
-
opacity: isInView ? 1 : 0
|
|
1901
|
-
},
|
|
1902
|
-
children
|
|
1903
|
-
}
|
|
1904
|
-
);
|
|
1905
|
-
}
|
|
1906
|
-
var init_AnimatedWrapper = __esm({
|
|
1907
|
-
"src/components/AnimatedWrapper.tsx"() {
|
|
1908
|
-
"use client";
|
|
1909
|
-
init_useScrollAnimation();
|
|
1910
|
-
init_shared();
|
|
1911
|
-
}
|
|
1912
|
-
});
|
|
1913
|
-
function generateUniqueId() {
|
|
1914
|
-
return `c${(++idCounter).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
1915
|
-
}
|
|
1916
|
-
var idCounter, defaultProps, ContainerConfig;
|
|
1917
|
-
var init_Container_server = __esm({
|
|
1918
|
-
"src/components/layout/Container.server.tsx"() {
|
|
1919
|
-
init_shared();
|
|
1920
|
-
init_AnimatedWrapper();
|
|
1921
|
-
idCounter = 0;
|
|
1922
|
-
defaultProps = {
|
|
1923
|
-
content: [],
|
|
1924
|
-
background: null,
|
|
1925
|
-
customPadding: null,
|
|
1926
|
-
dimensions: null,
|
|
1927
|
-
border: null,
|
|
1928
|
-
margin: null,
|
|
1929
|
-
animation: null,
|
|
1930
|
-
innerBackground: null,
|
|
1931
|
-
innerPadding: null,
|
|
1932
|
-
innerBorder: null,
|
|
1933
|
-
visibility: null
|
|
1934
|
-
};
|
|
1935
|
-
ContainerConfig = {
|
|
1936
|
-
label: "Container",
|
|
1937
|
-
fields: {
|
|
1938
|
-
content: { type: "slot" }
|
|
1939
|
-
},
|
|
1940
|
-
defaultProps,
|
|
1941
|
-
render: ({
|
|
1942
|
-
content: Content2,
|
|
1943
|
-
background,
|
|
1944
|
-
customPadding,
|
|
1945
|
-
dimensions,
|
|
1946
|
-
border,
|
|
1947
|
-
margin,
|
|
1948
|
-
animation,
|
|
1949
|
-
innerBackground,
|
|
1950
|
-
innerPadding,
|
|
1951
|
-
innerBorder,
|
|
1952
|
-
visibility
|
|
1953
|
-
}) => {
|
|
1954
|
-
const uniqueId = generateUniqueId();
|
|
1955
|
-
const outerClass = `puck-container-outer-${uniqueId}`;
|
|
1956
|
-
const innerClass = `puck-container-inner-${uniqueId}`;
|
|
1957
|
-
const mediaQueries = [];
|
|
1958
|
-
const outerBackgroundStyles = backgroundValueToCSS(background);
|
|
1959
|
-
const outerStyles = {
|
|
1960
|
-
...outerBackgroundStyles
|
|
1961
|
-
};
|
|
1962
|
-
const outerPaddingResult = responsiveValueToCSS(
|
|
1963
|
-
customPadding,
|
|
1964
|
-
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
1965
|
-
outerClass
|
|
1966
|
-
);
|
|
1967
|
-
Object.assign(outerStyles, outerPaddingResult.baseStyles);
|
|
1968
|
-
if (outerPaddingResult.mediaQueryCSS) {
|
|
1969
|
-
mediaQueries.push(outerPaddingResult.mediaQueryCSS);
|
|
1970
|
-
}
|
|
1971
|
-
const outerBorderStyles = borderValueToCSS(border);
|
|
1972
|
-
if (outerBorderStyles) {
|
|
1973
|
-
Object.assign(outerStyles, outerBorderStyles);
|
|
1974
|
-
}
|
|
1975
|
-
const marginResult = responsiveValueToCSS(
|
|
1976
|
-
margin,
|
|
1977
|
-
(v) => ({ margin: marginValueToCSS(v) }),
|
|
1978
|
-
outerClass
|
|
1979
|
-
);
|
|
1980
|
-
Object.assign(outerStyles, marginResult.baseStyles);
|
|
1981
|
-
if (marginResult.mediaQueryCSS) {
|
|
1982
|
-
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
1983
|
-
}
|
|
1984
|
-
const innerBackgroundStyles = backgroundValueToCSS(innerBackground);
|
|
1985
|
-
const innerStyles = {
|
|
1986
|
-
...innerBackgroundStyles
|
|
1987
|
-
};
|
|
1988
|
-
const dimensionsResult = responsiveValueToCSS(
|
|
1989
|
-
dimensions,
|
|
1990
|
-
dimensionsValueToCSS,
|
|
1991
|
-
innerClass
|
|
1992
|
-
);
|
|
1993
|
-
Object.assign(innerStyles, dimensionsResult.baseStyles);
|
|
1994
|
-
if (dimensionsResult.mediaQueryCSS) {
|
|
1995
|
-
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
1996
|
-
}
|
|
1997
|
-
const innerPaddingResult = responsiveValueToCSS(
|
|
1998
|
-
innerPadding,
|
|
1999
|
-
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
2000
|
-
innerClass
|
|
2001
|
-
);
|
|
2002
|
-
Object.assign(innerStyles, innerPaddingResult.baseStyles);
|
|
2003
|
-
if (innerPaddingResult.mediaQueryCSS) {
|
|
2004
|
-
mediaQueries.push(innerPaddingResult.mediaQueryCSS);
|
|
2005
|
-
}
|
|
2006
|
-
const innerBorderStyles = borderValueToCSS(innerBorder);
|
|
2007
|
-
if (innerBorderStyles) {
|
|
2008
|
-
Object.assign(innerStyles, innerBorderStyles);
|
|
2009
|
-
}
|
|
2010
|
-
const visibilityCSS = visibilityValueToCSS(visibility, outerClass);
|
|
2011
|
-
if (visibilityCSS) {
|
|
2012
|
-
mediaQueries.push(visibilityCSS);
|
|
2013
|
-
}
|
|
2014
|
-
const contentClasses = cn2("px-4", innerClass);
|
|
2015
|
-
const hasInnerStyles = Object.keys(innerStyles).length > 0;
|
|
2016
|
-
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
2017
|
-
const ContentSlot = Content2;
|
|
2018
|
-
return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
|
|
2019
|
-
allMediaQueryCSS && /* @__PURE__ */ jsx("style", { children: allMediaQueryCSS }),
|
|
2020
|
-
/* @__PURE__ */ jsx("div", { className: outerClass, style: outerStyles, children: hasInnerStyles ? /* @__PURE__ */ jsx("div", { className: contentClasses, style: innerStyles, children: /* @__PURE__ */ jsx(ContentSlot, {}) }) : /* @__PURE__ */ jsx(ContentSlot, { className: contentClasses, style: innerStyles }) })
|
|
2021
|
-
] });
|
|
2022
|
-
}
|
|
2023
|
-
};
|
|
2024
|
-
}
|
|
2025
|
-
});
|
|
2026
|
-
function generateUniqueId2() {
|
|
2027
|
-
return `f${(++idCounter2).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
2028
|
-
}
|
|
2029
|
-
var idCounter2, flexDirectionMap, flexWrapMap, defaultProps2, FlexConfig;
|
|
2030
|
-
var init_Flex_server = __esm({
|
|
2031
|
-
"src/components/layout/Flex.server.tsx"() {
|
|
2032
|
-
init_shared();
|
|
2033
|
-
init_AnimatedWrapper();
|
|
2034
|
-
idCounter2 = 0;
|
|
2035
|
-
flexDirectionMap = {
|
|
2036
|
-
row: "flex-row",
|
|
2037
|
-
column: "flex-col",
|
|
2038
|
-
"row-reverse": "flex-row-reverse",
|
|
2039
|
-
"column-reverse": "flex-col-reverse"
|
|
2040
|
-
};
|
|
2041
|
-
flexWrapMap = {
|
|
2042
|
-
wrap: "flex-wrap",
|
|
2043
|
-
nowrap: "flex-nowrap",
|
|
2044
|
-
"wrap-reverse": "flex-wrap-reverse"
|
|
2045
|
-
};
|
|
2046
|
-
defaultProps2 = {
|
|
2047
|
-
content: [],
|
|
2048
|
-
direction: "row",
|
|
2049
|
-
justifyContent: null,
|
|
2050
|
-
alignItems: null,
|
|
2051
|
-
gap: 24,
|
|
2052
|
-
wrap: "wrap",
|
|
2053
|
-
background: null,
|
|
2054
|
-
customPadding: null,
|
|
2055
|
-
margin: null,
|
|
2056
|
-
dimensions: null,
|
|
2057
|
-
border: null,
|
|
2058
|
-
animation: null,
|
|
2059
|
-
visibility: null
|
|
2060
|
-
};
|
|
2061
|
-
FlexConfig = {
|
|
2062
|
-
label: "Flex",
|
|
2063
|
-
fields: {
|
|
2064
|
-
content: { type: "slot" }
|
|
2065
|
-
},
|
|
2066
|
-
defaultProps: defaultProps2,
|
|
2067
|
-
render: ({
|
|
2068
|
-
content: Content2,
|
|
2069
|
-
direction,
|
|
2070
|
-
justifyContent,
|
|
2071
|
-
alignItems,
|
|
2072
|
-
gap,
|
|
2073
|
-
wrap,
|
|
2074
|
-
background,
|
|
2075
|
-
customPadding,
|
|
2076
|
-
margin,
|
|
2077
|
-
dimensions,
|
|
2078
|
-
border,
|
|
2079
|
-
animation,
|
|
2080
|
-
visibility
|
|
2081
|
-
}) => {
|
|
2082
|
-
const uniqueId = generateUniqueId2();
|
|
2083
|
-
const wrapperClass = `puck-flex-${uniqueId}`;
|
|
2084
|
-
const contentClass = `puck-flex-content-${uniqueId}`;
|
|
2085
|
-
const mediaQueries = [];
|
|
2086
|
-
const backgroundStyles = backgroundValueToCSS(background);
|
|
2087
|
-
const wrapperStyles = {
|
|
2088
|
-
...backgroundStyles
|
|
2089
|
-
};
|
|
2090
|
-
const paddingResult = responsiveValueToCSS(
|
|
2091
|
-
customPadding,
|
|
2092
|
-
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
2093
|
-
wrapperClass
|
|
2094
|
-
);
|
|
2095
|
-
Object.assign(wrapperStyles, paddingResult.baseStyles);
|
|
2096
|
-
if (paddingResult.mediaQueryCSS) {
|
|
2097
|
-
mediaQueries.push(paddingResult.mediaQueryCSS);
|
|
2098
|
-
}
|
|
2099
|
-
const borderStyles = borderValueToCSS(border);
|
|
2100
|
-
if (borderStyles) {
|
|
2101
|
-
Object.assign(wrapperStyles, borderStyles);
|
|
2102
|
-
}
|
|
2103
|
-
const marginResult = responsiveValueToCSS(
|
|
2104
|
-
margin,
|
|
2105
|
-
(v) => ({ margin: marginValueToCSS(v) }),
|
|
2106
|
-
wrapperClass
|
|
2107
|
-
);
|
|
2108
|
-
Object.assign(wrapperStyles, marginResult.baseStyles);
|
|
2109
|
-
if (marginResult.mediaQueryCSS) {
|
|
2110
|
-
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
2111
|
-
}
|
|
2112
|
-
const dimensionsResult = responsiveValueToCSS(
|
|
2113
|
-
dimensions,
|
|
2114
|
-
dimensionsValueToCSS,
|
|
2115
|
-
contentClass
|
|
2116
|
-
);
|
|
2117
|
-
const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
|
|
2118
|
-
if (visibilityCSS) {
|
|
2119
|
-
mediaQueries.push(visibilityCSS);
|
|
2120
|
-
}
|
|
2121
|
-
const contentClasses = cn2(
|
|
2122
|
-
"flex w-full min-h-[50px]",
|
|
2123
|
-
flexDirectionMap[direction],
|
|
2124
|
-
justifyContent && justifyContentMap[justifyContent],
|
|
2125
|
-
alignItems && alignItemsMap[alignItems],
|
|
2126
|
-
flexWrapMap[wrap],
|
|
2127
|
-
"[&>*]:min-w-0",
|
|
2128
|
-
contentClass
|
|
2129
|
-
);
|
|
2130
|
-
const contentStyles = {
|
|
2131
|
-
gap,
|
|
2132
|
-
...dimensionsResult.baseStyles
|
|
2133
|
-
};
|
|
2134
|
-
if (dimensionsResult.mediaQueryCSS) {
|
|
2135
|
-
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
2136
|
-
}
|
|
2137
|
-
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
2138
|
-
const ContentSlot = Content2;
|
|
2139
|
-
return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
|
|
2140
|
-
allMediaQueryCSS && /* @__PURE__ */ jsx("style", { children: allMediaQueryCSS }),
|
|
2141
|
-
/* @__PURE__ */ jsx("div", { className: wrapperClass, style: wrapperStyles, children: /* @__PURE__ */ jsx(ContentSlot, { className: contentClasses, style: contentStyles }) })
|
|
2142
|
-
] });
|
|
2143
|
-
}
|
|
2144
|
-
};
|
|
2145
|
-
}
|
|
2146
|
-
});
|
|
2147
|
-
function generateUniqueId3() {
|
|
2148
|
-
return `g${(++idCounter3).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
2149
|
-
}
|
|
2150
|
-
var idCounter3, defaultProps3, GridConfig;
|
|
2151
|
-
var init_Grid_server = __esm({
|
|
2152
|
-
"src/components/layout/Grid.server.tsx"() {
|
|
2153
|
-
init_shared();
|
|
2154
|
-
init_AnimatedWrapper();
|
|
2155
|
-
idCounter3 = 0;
|
|
2156
|
-
defaultProps3 = {
|
|
2157
|
-
content: [],
|
|
2158
|
-
numColumns: 3,
|
|
2159
|
-
gap: 24,
|
|
2160
|
-
background: null,
|
|
2161
|
-
customPadding: null,
|
|
2162
|
-
dimensions: null,
|
|
2163
|
-
border: null,
|
|
2164
|
-
margin: null,
|
|
2165
|
-
animation: null,
|
|
2166
|
-
visibility: null
|
|
2167
|
-
};
|
|
2168
|
-
GridConfig = {
|
|
2169
|
-
label: "Grid",
|
|
2170
|
-
fields: {
|
|
2171
|
-
content: { type: "slot" }
|
|
2172
|
-
},
|
|
2173
|
-
defaultProps: defaultProps3,
|
|
2174
|
-
render: ({
|
|
2175
|
-
content: Content2,
|
|
2176
|
-
numColumns,
|
|
2177
|
-
gap,
|
|
2178
|
-
background,
|
|
2179
|
-
customPadding,
|
|
2180
|
-
dimensions,
|
|
2181
|
-
border,
|
|
2182
|
-
margin,
|
|
2183
|
-
animation,
|
|
2184
|
-
visibility
|
|
2185
|
-
}) => {
|
|
2186
|
-
const uniqueId = generateUniqueId3();
|
|
2187
|
-
const wrapperClass = `puck-grid-${uniqueId}`;
|
|
2188
|
-
const contentClass = `puck-grid-content-${uniqueId}`;
|
|
2189
|
-
const mediaQueries = [];
|
|
2190
|
-
const backgroundStyles = backgroundValueToCSS(background);
|
|
2191
|
-
const wrapperStyles = {
|
|
2192
|
-
...backgroundStyles
|
|
2193
|
-
};
|
|
2194
|
-
const paddingResult = responsiveValueToCSS(
|
|
2195
|
-
customPadding,
|
|
2196
|
-
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
2197
|
-
wrapperClass
|
|
2198
|
-
);
|
|
2199
|
-
Object.assign(wrapperStyles, paddingResult.baseStyles);
|
|
2200
|
-
if (paddingResult.mediaQueryCSS) {
|
|
2201
|
-
mediaQueries.push(paddingResult.mediaQueryCSS);
|
|
2202
|
-
}
|
|
2203
|
-
const borderStyles = borderValueToCSS(border);
|
|
2204
|
-
if (borderStyles) {
|
|
2205
|
-
Object.assign(wrapperStyles, borderStyles);
|
|
2206
|
-
}
|
|
2207
|
-
const marginResult = responsiveValueToCSS(
|
|
2208
|
-
margin,
|
|
2209
|
-
(v) => ({ margin: marginValueToCSS(v) }),
|
|
2210
|
-
wrapperClass
|
|
2211
|
-
);
|
|
2212
|
-
Object.assign(wrapperStyles, marginResult.baseStyles);
|
|
2213
|
-
if (marginResult.mediaQueryCSS) {
|
|
2214
|
-
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
2215
|
-
}
|
|
2216
|
-
const dimensionsResult = responsiveValueToCSS(
|
|
2217
|
-
dimensions,
|
|
2218
|
-
dimensionsValueToCSS,
|
|
2219
|
-
contentClass
|
|
2220
|
-
);
|
|
2221
|
-
const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
|
|
2222
|
-
if (visibilityCSS) {
|
|
2223
|
-
mediaQueries.push(visibilityCSS);
|
|
2224
|
-
}
|
|
2225
|
-
const contentClasses = cn2(
|
|
2226
|
-
"flex flex-col w-full",
|
|
2227
|
-
"md:grid",
|
|
2228
|
-
contentClass
|
|
2229
|
-
);
|
|
2230
|
-
const contentStyles = {
|
|
2231
|
-
gap,
|
|
2232
|
-
...dimensionsResult.baseStyles
|
|
2233
|
-
};
|
|
2234
|
-
if (dimensionsResult.mediaQueryCSS) {
|
|
2235
|
-
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
2236
|
-
}
|
|
2237
|
-
const gridStyles = {
|
|
2238
|
-
...contentStyles,
|
|
2239
|
-
"--grid-cols": numColumns
|
|
2240
|
-
};
|
|
2241
|
-
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
2242
|
-
const ContentSlot = Content2;
|
|
2243
|
-
return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
|
|
2244
|
-
allMediaQueryCSS && /* @__PURE__ */ jsx("style", { children: allMediaQueryCSS }),
|
|
2245
|
-
/* @__PURE__ */ jsxs("div", { className: wrapperClass, style: wrapperStyles, children: [
|
|
2246
|
-
/* @__PURE__ */ jsx(ContentSlot, { className: contentClasses, style: gridStyles }),
|
|
2247
|
-
/* @__PURE__ */ jsx("style", { children: `
|
|
2248
|
-
@media (min-width: 768px) {
|
|
2249
|
-
.flex.md\\:grid {
|
|
2250
|
-
grid-template-columns: repeat(var(--grid-cols), 1fr);
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
` })
|
|
2254
|
-
] })
|
|
2255
|
-
] });
|
|
2256
|
-
}
|
|
2257
|
-
};
|
|
2258
|
-
}
|
|
2259
|
-
});
|
|
2260
|
-
function generateUniqueId4() {
|
|
2261
|
-
return `s${(++idCounter4).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
2262
|
-
}
|
|
2263
|
-
var idCounter4, defaultProps4, SectionConfig;
|
|
2264
|
-
var init_Section_server = __esm({
|
|
2265
|
-
"src/components/layout/Section.server.tsx"() {
|
|
2266
|
-
init_shared();
|
|
2267
|
-
init_AnimatedWrapper();
|
|
2268
|
-
idCounter4 = 0;
|
|
2269
|
-
defaultProps4 = {
|
|
2270
|
-
id: "",
|
|
2271
|
-
content: [],
|
|
2272
|
-
background: null,
|
|
2273
|
-
fullWidth: false,
|
|
2274
|
-
customPadding: null,
|
|
2275
|
-
dimensions: null,
|
|
2276
|
-
border: null,
|
|
2277
|
-
margin: null,
|
|
2278
|
-
animation: null,
|
|
2279
|
-
visibility: null
|
|
2280
|
-
};
|
|
2281
|
-
SectionConfig = {
|
|
2282
|
-
label: "Section",
|
|
2283
|
-
fields: {
|
|
2284
|
-
content: { type: "slot" }
|
|
2285
|
-
},
|
|
2286
|
-
defaultProps: defaultProps4,
|
|
2287
|
-
render: ({
|
|
2288
|
-
id,
|
|
2289
|
-
content: Content2,
|
|
2290
|
-
background,
|
|
2291
|
-
fullWidth,
|
|
2292
|
-
customPadding,
|
|
2293
|
-
dimensions,
|
|
2294
|
-
border,
|
|
2295
|
-
margin,
|
|
2296
|
-
animation,
|
|
2297
|
-
visibility
|
|
2298
|
-
}) => {
|
|
2299
|
-
const uniqueId = generateUniqueId4();
|
|
2300
|
-
const sectionClass = `puck-section-${uniqueId}`;
|
|
2301
|
-
const contentClass = `puck-section-content-${uniqueId}`;
|
|
2302
|
-
const mediaQueries = [];
|
|
2303
|
-
const backgroundStyles = backgroundValueToCSS(background);
|
|
2304
|
-
const sectionStyles = {
|
|
2305
|
-
...backgroundStyles
|
|
2306
|
-
};
|
|
2307
|
-
const paddingResult = responsiveValueToCSS(
|
|
2308
|
-
customPadding,
|
|
2309
|
-
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
2310
|
-
sectionClass
|
|
2311
|
-
);
|
|
2312
|
-
Object.assign(sectionStyles, paddingResult.baseStyles);
|
|
2313
|
-
if (paddingResult.mediaQueryCSS) {
|
|
2314
|
-
mediaQueries.push(paddingResult.mediaQueryCSS);
|
|
2315
|
-
}
|
|
2316
|
-
const borderStyles = borderValueToCSS(border);
|
|
2317
|
-
if (borderStyles) {
|
|
2318
|
-
Object.assign(sectionStyles, borderStyles);
|
|
2319
|
-
}
|
|
2320
|
-
const marginResult = responsiveValueToCSS(
|
|
2321
|
-
margin,
|
|
2322
|
-
(v) => ({ margin: marginValueToCSS(v) }),
|
|
2323
|
-
sectionClass
|
|
2324
|
-
);
|
|
2325
|
-
Object.assign(sectionStyles, marginResult.baseStyles);
|
|
2326
|
-
if (marginResult.mediaQueryCSS) {
|
|
2327
|
-
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
2328
|
-
}
|
|
2329
|
-
const visibilityCSS = visibilityValueToCSS(visibility, sectionClass);
|
|
2330
|
-
if (visibilityCSS) {
|
|
2331
|
-
mediaQueries.push(visibilityCSS);
|
|
2332
|
-
}
|
|
2333
|
-
const sectionClasses = cn2("relative w-full", sectionClass);
|
|
2334
|
-
const dimensionsResult = responsiveValueToCSS(
|
|
2335
|
-
dimensions,
|
|
2336
|
-
dimensionsValueToCSS,
|
|
2337
|
-
contentClass
|
|
2338
|
-
);
|
|
2339
|
-
if (dimensionsResult.mediaQueryCSS) {
|
|
2340
|
-
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
2341
|
-
}
|
|
2342
|
-
const contentClasses = cn2(
|
|
2343
|
-
"relative z-10",
|
|
2344
|
-
// Only apply preset content width if no dimensions set
|
|
2345
|
-
!dimensions && !fullWidth && "max-w-[1200px] mx-auto px-4",
|
|
2346
|
-
contentClass
|
|
2347
|
-
);
|
|
2348
|
-
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
2349
|
-
const ContentSlot = Content2;
|
|
2350
|
-
return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
|
|
2351
|
-
allMediaQueryCSS && /* @__PURE__ */ jsx("style", { children: allMediaQueryCSS }),
|
|
2352
|
-
/* @__PURE__ */ jsx(
|
|
2353
|
-
"section",
|
|
2354
|
-
{
|
|
2355
|
-
id: id || void 0,
|
|
2356
|
-
className: sectionClasses,
|
|
2357
|
-
style: sectionStyles,
|
|
2358
|
-
children: /* @__PURE__ */ jsx(ContentSlot, { className: contentClasses, style: dimensionsResult.baseStyles })
|
|
2359
|
-
}
|
|
2360
|
-
)
|
|
2361
|
-
] });
|
|
2362
|
-
}
|
|
2363
|
-
};
|
|
2364
|
-
}
|
|
2365
|
-
});
|
|
2366
|
-
function generateUniqueId5() {
|
|
2367
|
-
return `sp${(++idCounter5).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
2368
|
-
}
|
|
2369
|
-
var idCounter5, heightMap, widthMap, defaultProps5, SpacerConfig;
|
|
2370
|
-
var init_Spacer_server = __esm({
|
|
2371
|
-
"src/components/layout/Spacer.server.tsx"() {
|
|
2372
|
-
init_shared();
|
|
2373
|
-
idCounter5 = 0;
|
|
2374
|
-
heightMap = {
|
|
2375
|
-
"8px": "h-2",
|
|
2376
|
-
"16px": "h-4",
|
|
2377
|
-
"24px": "h-6",
|
|
2378
|
-
"32px": "h-8",
|
|
2379
|
-
"48px": "h-12",
|
|
2380
|
-
"64px": "h-16",
|
|
2381
|
-
"80px": "h-20",
|
|
2382
|
-
"96px": "h-24",
|
|
2383
|
-
"128px": "h-32"
|
|
2384
|
-
};
|
|
2385
|
-
widthMap = {
|
|
2386
|
-
"8px": "w-2",
|
|
2387
|
-
"16px": "w-4",
|
|
2388
|
-
"24px": "w-6",
|
|
2389
|
-
"32px": "w-8",
|
|
2390
|
-
"48px": "w-12",
|
|
2391
|
-
"64px": "w-16",
|
|
2392
|
-
"80px": "w-20",
|
|
2393
|
-
"96px": "w-24",
|
|
2394
|
-
"128px": "w-32"
|
|
2395
|
-
};
|
|
2396
|
-
defaultProps5 = {
|
|
2397
|
-
size: "24px",
|
|
2398
|
-
direction: "vertical",
|
|
2399
|
-
visibility: null
|
|
2400
|
-
};
|
|
2401
|
-
SpacerConfig = {
|
|
2402
|
-
label: "Spacer",
|
|
2403
|
-
defaultProps: defaultProps5,
|
|
2404
|
-
render: ({ size, direction, visibility }) => {
|
|
2405
|
-
const uniqueId = generateUniqueId5();
|
|
2406
|
-
const wrapperClass = `puck-spacer-${uniqueId}`;
|
|
2407
|
-
const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
|
|
2408
|
-
const getClasses = () => {
|
|
2409
|
-
const heightClass = heightMap[size] || "h-6";
|
|
2410
|
-
const widthClass = widthMap[size] || "w-6";
|
|
2411
|
-
if (direction === "vertical") {
|
|
2412
|
-
return `block ${heightClass} w-full`;
|
|
2413
|
-
}
|
|
2414
|
-
if (direction === "horizontal") {
|
|
2415
|
-
return `inline-block ${widthClass} h-full`;
|
|
2416
|
-
}
|
|
2417
|
-
return `block ${heightClass} ${widthClass}`;
|
|
2418
|
-
};
|
|
2419
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2420
|
-
visibilityCSS && /* @__PURE__ */ jsx("style", { children: visibilityCSS }),
|
|
2421
|
-
/* @__PURE__ */ jsx("div", { className: cn2(getClasses(), wrapperClass), "aria-hidden": "true" })
|
|
2422
|
-
] });
|
|
2423
|
-
}
|
|
2424
|
-
};
|
|
2425
|
-
}
|
|
2426
|
-
});
|
|
2427
|
-
function generateUniqueId6() {
|
|
2428
|
-
return `t${(++idCounter6).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
2429
|
-
}
|
|
2430
|
-
var idCounter6, defaultProps6, TemplateServerConfig;
|
|
2431
|
-
var init_Template_server = __esm({
|
|
2432
|
-
"src/components/layout/Template.server.tsx"() {
|
|
2433
|
-
init_shared();
|
|
2434
|
-
idCounter6 = 0;
|
|
2435
|
-
defaultProps6 = {
|
|
2436
|
-
content: [],
|
|
2437
|
-
templateId: null,
|
|
2438
|
-
dimensions: null,
|
|
2439
|
-
customPadding: null,
|
|
2440
|
-
margin: null,
|
|
2441
|
-
visibility: null
|
|
2442
|
-
};
|
|
2443
|
-
TemplateServerConfig = {
|
|
2444
|
-
label: "Template",
|
|
2445
|
-
fields: {
|
|
2446
|
-
// In server config, templateId is just for reference (no loading UI)
|
|
2447
|
-
templateId: {
|
|
2448
|
-
type: "text",
|
|
2449
|
-
label: "Template ID"
|
|
2450
|
-
},
|
|
2451
|
-
content: {
|
|
2452
|
-
type: "slot"
|
|
2453
|
-
}
|
|
2454
|
-
},
|
|
2455
|
-
defaultProps: defaultProps6,
|
|
2456
|
-
render: ({ content: Content2, dimensions, customPadding, margin, visibility }) => {
|
|
2457
|
-
const uniqueId = generateUniqueId6();
|
|
2458
|
-
const wrapperClass = `puck-template-${uniqueId}`;
|
|
2459
|
-
const contentClass = `puck-template-content-${uniqueId}`;
|
|
2460
|
-
const mediaQueries = [];
|
|
2461
|
-
const wrapperStyles = {};
|
|
2462
|
-
const paddingResult = responsiveValueToCSS(
|
|
2463
|
-
customPadding,
|
|
2464
|
-
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
2465
|
-
wrapperClass
|
|
2466
|
-
);
|
|
2467
|
-
Object.assign(wrapperStyles, paddingResult.baseStyles);
|
|
2468
|
-
if (paddingResult.mediaQueryCSS) {
|
|
2469
|
-
mediaQueries.push(paddingResult.mediaQueryCSS);
|
|
2470
|
-
}
|
|
2471
|
-
const marginResult = responsiveValueToCSS(
|
|
2472
|
-
margin,
|
|
2473
|
-
(v) => ({ margin: marginValueToCSS(v) }),
|
|
2474
|
-
wrapperClass
|
|
2475
|
-
);
|
|
2476
|
-
Object.assign(wrapperStyles, marginResult.baseStyles);
|
|
2477
|
-
if (marginResult.mediaQueryCSS) {
|
|
2478
|
-
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
2479
|
-
}
|
|
2480
|
-
const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
|
|
2481
|
-
if (visibilityCSS) {
|
|
2482
|
-
mediaQueries.push(visibilityCSS);
|
|
2483
|
-
}
|
|
2484
|
-
const dimensionsResult = responsiveValueToCSS(
|
|
2485
|
-
dimensions,
|
|
2486
|
-
dimensionsValueToCSS,
|
|
2487
|
-
contentClass
|
|
2488
|
-
);
|
|
2489
|
-
if (dimensionsResult.mediaQueryCSS) {
|
|
2490
|
-
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
2491
|
-
}
|
|
2492
|
-
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
2493
|
-
const ContentSlot = Content2;
|
|
2494
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2495
|
-
allMediaQueryCSS && /* @__PURE__ */ jsx("style", { children: allMediaQueryCSS }),
|
|
2496
|
-
/* @__PURE__ */ jsx(
|
|
2497
|
-
"div",
|
|
2498
|
-
{
|
|
2499
|
-
className: cn2("template-wrapper", wrapperClass),
|
|
2500
|
-
style: Object.keys(wrapperStyles).length > 0 ? wrapperStyles : void 0,
|
|
2501
|
-
children: /* @__PURE__ */ jsx(ContentSlot, { className: contentClass, style: dimensionsResult.baseStyles })
|
|
2502
|
-
}
|
|
2503
|
-
)
|
|
2504
|
-
] });
|
|
2505
|
-
}
|
|
2506
|
-
};
|
|
2507
|
-
}
|
|
2508
|
-
});
|
|
2509
|
-
var defaultProps7, HeadingConfig;
|
|
2510
|
-
var init_Heading_server = __esm({
|
|
2511
|
-
"src/components/typography/Heading.server.tsx"() {
|
|
2512
|
-
init_shared();
|
|
2513
|
-
init_AnimatedWrapper();
|
|
2514
|
-
defaultProps7 = {
|
|
2515
|
-
text: "Heading Text",
|
|
2516
|
-
level: "h2",
|
|
2517
|
-
alignment: null,
|
|
2518
|
-
textColor: null,
|
|
2519
|
-
dimensions: null,
|
|
2520
|
-
animation: null,
|
|
2521
|
-
margin: null,
|
|
2522
|
-
customPadding: null
|
|
2523
|
-
};
|
|
2524
|
-
HeadingConfig = {
|
|
2525
|
-
label: "Heading",
|
|
2526
|
-
defaultProps: defaultProps7,
|
|
2527
|
-
render: ({ text, level, alignment, textColor, dimensions, animation, margin, customPadding }) => {
|
|
2528
|
-
const tag = level || "h2";
|
|
2529
|
-
const alignmentValue = alignment ?? "left";
|
|
2530
|
-
const classes = cn2(
|
|
2531
|
-
headingLevelMap[level] || headingLevelMap.h2,
|
|
2532
|
-
alignmentMap[alignmentValue] || alignmentMap.left
|
|
2533
|
-
);
|
|
2534
|
-
const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
|
|
2535
|
-
const style = {
|
|
2536
|
-
...dimensionsStyles
|
|
2537
|
-
};
|
|
2538
|
-
const marginCSS = marginValueToCSS(margin);
|
|
2539
|
-
if (marginCSS) {
|
|
2540
|
-
style.margin = marginCSS;
|
|
2541
|
-
}
|
|
2542
|
-
const paddingCSS = paddingValueToCSS(customPadding);
|
|
2543
|
-
if (paddingCSS) {
|
|
2544
|
-
style.padding = paddingCSS;
|
|
2545
|
-
}
|
|
2546
|
-
const colorCSS = colorValueToCSS(textColor);
|
|
2547
|
-
if (colorCSS) {
|
|
2548
|
-
style.color = colorCSS;
|
|
2549
|
-
}
|
|
2550
|
-
const headingElement = createElement(tag, { className: classes, style: Object.keys(style).length > 0 ? style : void 0 }, text);
|
|
2551
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: headingElement });
|
|
2552
|
-
}
|
|
2553
|
-
};
|
|
2554
|
-
}
|
|
2555
|
-
});
|
|
2556
|
-
var defaultProps8, TextConfig;
|
|
2557
|
-
var init_Text_server = __esm({
|
|
2558
|
-
"src/components/typography/Text.server.tsx"() {
|
|
2559
|
-
init_shared();
|
|
2560
|
-
init_AnimatedWrapper();
|
|
2561
|
-
defaultProps8 = {
|
|
2562
|
-
content: "Enter your text here...",
|
|
2563
|
-
size: "base",
|
|
2564
|
-
alignment: null,
|
|
2565
|
-
textColor: null,
|
|
2566
|
-
dimensions: null,
|
|
2567
|
-
animation: null,
|
|
2568
|
-
margin: null,
|
|
2569
|
-
customPadding: null
|
|
2570
|
-
};
|
|
2571
|
-
TextConfig = {
|
|
2572
|
-
label: "Text",
|
|
2573
|
-
defaultProps: defaultProps8,
|
|
2574
|
-
render: ({ content, size, alignment, textColor, dimensions, animation, margin, customPadding }) => {
|
|
2575
|
-
const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
|
|
2576
|
-
const style = {
|
|
2577
|
-
...dimensionsStyles
|
|
2578
|
-
};
|
|
2579
|
-
const marginCSS = marginValueToCSS(margin);
|
|
2580
|
-
if (marginCSS) {
|
|
2581
|
-
style.margin = marginCSS;
|
|
2582
|
-
}
|
|
2583
|
-
const paddingCSS = paddingValueToCSS(customPadding);
|
|
2584
|
-
if (paddingCSS) {
|
|
2585
|
-
style.padding = paddingCSS;
|
|
2586
|
-
}
|
|
2587
|
-
const colorCSS = colorValueToCSS(textColor);
|
|
2588
|
-
if (colorCSS) {
|
|
2589
|
-
style.color = colorCSS;
|
|
2590
|
-
}
|
|
2591
|
-
const alignmentValue = alignment ?? "left";
|
|
2592
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx(
|
|
2593
|
-
"p",
|
|
2594
|
-
{
|
|
2595
|
-
className: cn2(
|
|
2596
|
-
textSizeMap[size] || textSizeMap.base,
|
|
2597
|
-
alignmentMap[alignmentValue] || alignmentMap.left
|
|
2598
|
-
),
|
|
2599
|
-
style: Object.keys(style).length > 0 ? style : void 0,
|
|
2600
|
-
children: content
|
|
2601
|
-
}
|
|
2602
|
-
) });
|
|
2603
|
-
}
|
|
2604
|
-
};
|
|
2605
|
-
}
|
|
2606
|
-
});
|
|
2607
|
-
var defaultProps9, RichTextConfig;
|
|
2608
|
-
var init_RichText_server = __esm({
|
|
2609
|
-
"src/components/typography/RichText.server.tsx"() {
|
|
2610
|
-
init_shared();
|
|
2611
|
-
init_AnimatedWrapper();
|
|
2612
|
-
defaultProps9 = {
|
|
2613
|
-
content: "<p>Enter your content here...</p>",
|
|
2614
|
-
alignment: null,
|
|
2615
|
-
textColor: null,
|
|
2616
|
-
dimensions: null,
|
|
2617
|
-
animation: null,
|
|
2618
|
-
margin: null,
|
|
2619
|
-
customPadding: null
|
|
2620
|
-
};
|
|
2621
|
-
RichTextConfig = {
|
|
2622
|
-
label: "Rich Text",
|
|
2623
|
-
defaultProps: defaultProps9,
|
|
2624
|
-
render: ({ content, alignment, textColor, dimensions, animation, margin, customPadding }) => {
|
|
2625
|
-
const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
|
|
2626
|
-
const style = {
|
|
2627
|
-
...dimensionsStyles
|
|
2628
|
-
};
|
|
2629
|
-
const marginCSS = marginValueToCSS(margin);
|
|
2630
|
-
if (marginCSS) {
|
|
2631
|
-
style.margin = marginCSS;
|
|
2632
|
-
}
|
|
2633
|
-
const customPaddingCSS = paddingValueToCSS(customPadding);
|
|
2634
|
-
if (customPaddingCSS) {
|
|
2635
|
-
style.padding = customPaddingCSS;
|
|
2636
|
-
}
|
|
2637
|
-
const colorCSS = colorValueToCSS(textColor);
|
|
2638
|
-
if (colorCSS) {
|
|
2639
|
-
style.color = colorCSS;
|
|
2640
|
-
}
|
|
2641
|
-
const alignmentValue = alignment ?? "left";
|
|
2642
|
-
const alignmentClass = alignmentMap[alignmentValue] || alignmentMap.left;
|
|
2643
|
-
if (!content || content === "<p></p>") {
|
|
2644
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("section", { className: cn2("relative overflow-hidden px-4", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: "prose dark:prose-invert", children: /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("em", { children: "No content available" }) }) }) }) });
|
|
2645
|
-
}
|
|
2646
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("section", { className: cn2("relative overflow-hidden px-4", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx(
|
|
2647
|
-
"div",
|
|
2648
|
-
{
|
|
2649
|
-
className: "prose dark:prose-invert",
|
|
2650
|
-
dangerouslySetInnerHTML: { __html: content }
|
|
2651
|
-
}
|
|
2652
|
-
) }) });
|
|
2653
|
-
}
|
|
2654
|
-
};
|
|
2655
|
-
}
|
|
2656
|
-
});
|
|
2657
|
-
function generateUniqueId7() {
|
|
2658
|
-
return `i${(++idCounter7).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
2659
|
-
}
|
|
2660
|
-
var idCounter7, defaultProps10, ImageConfig;
|
|
2661
|
-
var init_Image_server = __esm({
|
|
2662
|
-
"src/components/media/Image.server.tsx"() {
|
|
2663
|
-
init_shared();
|
|
2664
|
-
init_AnimatedWrapper();
|
|
2665
|
-
idCounter7 = 0;
|
|
2666
|
-
defaultProps10 = {
|
|
2667
|
-
image: null,
|
|
2668
|
-
alt: "",
|
|
2669
|
-
aspectRatio: "auto",
|
|
2670
|
-
link: "",
|
|
2671
|
-
openInNewTab: false,
|
|
2672
|
-
margin: null,
|
|
2673
|
-
border: null,
|
|
2674
|
-
dimensions: null,
|
|
2675
|
-
alignment: null,
|
|
2676
|
-
transform: null,
|
|
2677
|
-
animation: null,
|
|
2678
|
-
customPadding: null,
|
|
2679
|
-
visibility: null
|
|
2680
|
-
};
|
|
2681
|
-
ImageConfig = {
|
|
2682
|
-
label: "Image",
|
|
2683
|
-
defaultProps: defaultProps10,
|
|
2684
|
-
render: ({ image, alt, aspectRatio, link, openInNewTab, dimensions, alignment, margin, border, transform, animation, customPadding, visibility }) => {
|
|
2685
|
-
const uniqueId = generateUniqueId7();
|
|
2686
|
-
const wrapperClass = `puck-image-${uniqueId}`;
|
|
2687
|
-
const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
|
|
2688
|
-
const dimensionsStyles = dimensionsValueToCSS(dimensions);
|
|
2689
|
-
const style = {
|
|
2690
|
-
...dimensionsStyles
|
|
2691
|
-
};
|
|
2692
|
-
const marginCSS = marginValueToCSS(margin);
|
|
2693
|
-
if (marginCSS) {
|
|
2694
|
-
style.margin = marginCSS;
|
|
2695
|
-
}
|
|
2696
|
-
const paddingCSS = paddingValueToCSS(customPadding);
|
|
2697
|
-
if (paddingCSS) {
|
|
2698
|
-
style.padding = paddingCSS;
|
|
2699
|
-
}
|
|
2700
|
-
const borderStyles = borderValueToCSS(border);
|
|
2701
|
-
if (borderStyles) {
|
|
2702
|
-
Object.assign(style, borderStyles);
|
|
2703
|
-
}
|
|
2704
|
-
const transformStyles = transformValueToCSS(transform);
|
|
2705
|
-
if (transformStyles) {
|
|
2706
|
-
Object.assign(style, transformStyles);
|
|
2707
|
-
}
|
|
2708
|
-
const alignmentValue = alignment ?? "center";
|
|
2709
|
-
const alignmentClasses = cn2(
|
|
2710
|
-
"flex",
|
|
2711
|
-
alignmentValue === "left" && "justify-start",
|
|
2712
|
-
alignmentValue === "center" && "justify-center",
|
|
2713
|
-
alignmentValue === "right" && "justify-end"
|
|
2714
|
-
);
|
|
2715
|
-
if (!image?.url) {
|
|
2716
|
-
return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
|
|
2717
|
-
visibilityCSS && /* @__PURE__ */ jsx("style", { children: visibilityCSS }),
|
|
2718
|
-
/* @__PURE__ */ jsx("div", { className: cn2("py-4 px-4", wrapperClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsx(
|
|
2719
|
-
"div",
|
|
2720
|
-
{
|
|
2721
|
-
className: cn2(
|
|
2722
|
-
"relative overflow-hidden rounded-lg w-full max-w-md bg-muted flex items-center justify-center min-h-[200px]",
|
|
2723
|
-
aspectRatioMap[aspectRatio] || ""
|
|
2724
|
-
),
|
|
2725
|
-
children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "No image selected" })
|
|
2726
|
-
}
|
|
2727
|
-
) }) })
|
|
2728
|
-
] });
|
|
2729
|
-
}
|
|
2730
|
-
const imageElement = aspectRatio === "auto" ? /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden rounded-lg w-full", children: /* @__PURE__ */ jsx(
|
|
2731
|
-
"img",
|
|
2732
|
-
{
|
|
2733
|
-
src: image.url,
|
|
2734
|
-
alt: alt || image.alt || "",
|
|
2735
|
-
className: "w-full h-auto object-cover"
|
|
2736
|
-
}
|
|
2737
|
-
) }) : /* @__PURE__ */ jsx("div", { className: cn2("relative overflow-hidden rounded-lg w-full", aspectRatioMap[aspectRatio]), children: /* @__PURE__ */ jsx(
|
|
2738
|
-
"img",
|
|
2739
|
-
{
|
|
2740
|
-
src: image.url,
|
|
2741
|
-
alt: alt || image.alt || "",
|
|
2742
|
-
className: "absolute inset-0 w-full h-full object-cover"
|
|
2743
|
-
}
|
|
2744
|
-
) });
|
|
2745
|
-
const content = link ? /* @__PURE__ */ jsx(
|
|
2746
|
-
"a",
|
|
2747
|
-
{
|
|
2748
|
-
href: link,
|
|
2749
|
-
target: openInNewTab ? "_blank" : void 0,
|
|
2750
|
-
rel: openInNewTab ? "noopener noreferrer" : void 0,
|
|
2751
|
-
className: "block transition-opacity hover:opacity-90",
|
|
2752
|
-
children: imageElement
|
|
2753
|
-
}
|
|
2754
|
-
) : imageElement;
|
|
2755
|
-
return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
|
|
2756
|
-
visibilityCSS && /* @__PURE__ */ jsx("style", { children: visibilityCSS }),
|
|
2757
|
-
/* @__PURE__ */ jsx("div", { className: cn2("py-4 px-4", wrapperClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: content }) })
|
|
2758
|
-
] });
|
|
2759
|
-
}
|
|
2760
|
-
};
|
|
2761
|
-
}
|
|
2762
|
-
});
|
|
2763
|
-
var buttonVariants, Button;
|
|
2764
|
-
var init_button = __esm({
|
|
2765
|
-
"src/components/ui/button.tsx"() {
|
|
2766
|
-
init_utils();
|
|
2767
|
-
buttonVariants = cva(
|
|
2768
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
2769
|
-
{
|
|
2770
|
-
variants: {
|
|
2771
|
-
variant: {
|
|
2772
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
2773
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
2774
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
2775
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
2776
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
2777
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
2778
|
-
},
|
|
2779
|
-
size: {
|
|
2780
|
-
default: "h-10 px-4 py-2",
|
|
2781
|
-
sm: "h-8 px-3 text-xs",
|
|
2782
|
-
lg: "h-11 px-8",
|
|
2783
|
-
icon: "h-10 w-10 p-2",
|
|
2784
|
-
"icon-sm": "h-8 w-8 p-1.5"
|
|
2785
|
-
}
|
|
2786
|
-
},
|
|
2787
|
-
defaultVariants: {
|
|
2788
|
-
variant: "default",
|
|
2789
|
-
size: "default"
|
|
2790
|
-
}
|
|
2791
|
-
}
|
|
2792
|
-
);
|
|
2793
|
-
Button = React.forwardRef(
|
|
2794
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
2795
|
-
const Comp = asChild ? Slot : "button";
|
|
2796
|
-
return /* @__PURE__ */ jsx(
|
|
2797
|
-
Comp,
|
|
2798
|
-
{
|
|
2799
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
2800
|
-
ref,
|
|
2801
|
-
...props
|
|
2802
|
-
}
|
|
2803
|
-
);
|
|
2804
|
-
}
|
|
2805
|
-
);
|
|
2806
|
-
Button.displayName = "Button";
|
|
2807
|
-
}
|
|
2808
|
-
});
|
|
2809
|
-
var Input;
|
|
2810
|
-
var init_input = __esm({
|
|
2811
|
-
"src/components/ui/input.tsx"() {
|
|
2812
|
-
init_utils();
|
|
2813
|
-
Input = React.forwardRef(
|
|
2814
|
-
({ className, type, ...props }, ref) => {
|
|
2815
|
-
return /* @__PURE__ */ jsx(
|
|
2816
|
-
"input",
|
|
2817
|
-
{
|
|
2818
|
-
type,
|
|
2819
|
-
className: cn(
|
|
2820
|
-
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
2821
|
-
className
|
|
2822
|
-
),
|
|
2823
|
-
ref,
|
|
2824
|
-
...props
|
|
2825
|
-
}
|
|
2826
|
-
);
|
|
2827
|
-
}
|
|
2828
|
-
);
|
|
2829
|
-
Input.displayName = "Input";
|
|
2830
|
-
}
|
|
2831
|
-
});
|
|
2832
|
-
var labelVariants, Label;
|
|
2833
|
-
var init_label = __esm({
|
|
2834
|
-
"src/components/ui/label.tsx"() {
|
|
2835
|
-
"use client";
|
|
2836
|
-
init_utils();
|
|
2837
|
-
labelVariants = cva(
|
|
2838
|
-
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
2839
|
-
);
|
|
2840
|
-
Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2841
|
-
LabelPrimitive.Root,
|
|
2842
|
-
{
|
|
2843
|
-
ref,
|
|
2844
|
-
className: cn(labelVariants(), className),
|
|
2845
|
-
...props
|
|
2846
|
-
}
|
|
2847
|
-
));
|
|
2848
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
2849
|
-
}
|
|
2850
|
-
});
|
|
2851
|
-
function SizeFieldInner({
|
|
2852
|
-
value,
|
|
2853
|
-
onChange,
|
|
2854
|
-
label = "Size",
|
|
2855
|
-
readOnly,
|
|
2856
|
-
showHeight = true,
|
|
2857
|
-
showFontSize = true
|
|
2858
|
-
}) {
|
|
2859
|
-
const currentValue = value || DEFAULT_VALUE;
|
|
2860
|
-
const handleModeChange = useCallback((mode) => {
|
|
2861
|
-
if (mode === "custom") {
|
|
2862
|
-
onChange({
|
|
2863
|
-
mode,
|
|
2864
|
-
...CUSTOM_DEFAULTS
|
|
2865
|
-
});
|
|
2866
|
-
} else {
|
|
2867
|
-
onChange({ mode });
|
|
2868
|
-
}
|
|
2869
|
-
}, [onChange]);
|
|
2870
|
-
const handleValueChange = useCallback((field, val) => {
|
|
2871
|
-
onChange({
|
|
2872
|
-
...currentValue,
|
|
2873
|
-
[field]: val
|
|
2874
|
-
});
|
|
2875
|
-
}, [currentValue, onChange]);
|
|
2876
|
-
const handleUnitChange = useCallback((unit) => {
|
|
2877
|
-
onChange({
|
|
2878
|
-
...currentValue,
|
|
2879
|
-
unit
|
|
2880
|
-
});
|
|
2881
|
-
}, [currentValue, onChange]);
|
|
2882
|
-
const handleClear = useCallback(() => {
|
|
2883
|
-
onChange(null);
|
|
2884
|
-
}, [onChange]);
|
|
2885
|
-
const presets = [
|
|
2886
|
-
{ mode: "sm", label: "SM" },
|
|
2887
|
-
{ mode: "default", label: "Default" },
|
|
2888
|
-
{ mode: "lg", label: "LG" },
|
|
2889
|
-
{ mode: "custom", label: "Custom" }
|
|
2890
|
-
];
|
|
2891
|
-
return /* @__PURE__ */ jsxs("div", { className: "puck-field space-y-3", children: [
|
|
2892
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2893
|
-
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium text-foreground", children: label }),
|
|
2894
|
-
value && !readOnly && /* @__PURE__ */ jsx(
|
|
2895
|
-
Button,
|
|
2896
|
-
{
|
|
2897
|
-
type: "button",
|
|
2898
|
-
variant: "ghost",
|
|
2899
|
-
size: "icon-sm",
|
|
2900
|
-
onClick: handleClear,
|
|
2901
|
-
className: "text-muted-foreground hover:text-destructive",
|
|
2902
|
-
title: "Reset to default",
|
|
2903
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
2904
|
-
}
|
|
2905
|
-
)
|
|
2906
|
-
] }),
|
|
2907
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: presets.map(({ mode, label: modeLabel }) => {
|
|
2908
|
-
const isActive = currentValue.mode === mode;
|
|
2909
|
-
return /* @__PURE__ */ jsx(
|
|
2910
|
-
Button,
|
|
2911
|
-
{
|
|
2912
|
-
type: "button",
|
|
2913
|
-
variant: isActive ? "default" : "secondary",
|
|
2914
|
-
size: "sm",
|
|
2915
|
-
onClick: () => handleModeChange(mode),
|
|
2916
|
-
disabled: readOnly,
|
|
2917
|
-
className: cn(
|
|
2918
|
-
"text-xs",
|
|
2919
|
-
isActive && "bg-primary hover:bg-primary/90"
|
|
2920
|
-
),
|
|
2921
|
-
children: modeLabel
|
|
2922
|
-
},
|
|
2923
|
-
mode
|
|
2924
|
-
);
|
|
2925
|
-
}) }),
|
|
2926
|
-
currentValue.mode === "custom" && /* @__PURE__ */ jsxs("div", { className: "space-y-3 p-3 bg-muted/50 rounded-md", children: [
|
|
2927
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2928
|
-
/* @__PURE__ */ jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground flex-shrink-0", children: "Unit:" }),
|
|
2929
|
-
/* @__PURE__ */ jsx("div", { className: "flex gap-1", children: ["px", "rem"].map((unit) => {
|
|
2930
|
-
const isActive = (currentValue.unit || "px") === unit;
|
|
2931
|
-
return /* @__PURE__ */ jsx(
|
|
2932
|
-
Button,
|
|
2933
|
-
{
|
|
2934
|
-
type: "button",
|
|
2935
|
-
variant: isActive ? "default" : "outline",
|
|
2936
|
-
size: "sm",
|
|
2937
|
-
onClick: () => handleUnitChange(unit),
|
|
2938
|
-
disabled: readOnly,
|
|
2939
|
-
className: cn(
|
|
2940
|
-
"text-xs font-mono h-7 px-2",
|
|
2941
|
-
isActive && "bg-primary hover:bg-primary/90"
|
|
2942
|
-
),
|
|
2943
|
-
children: unit
|
|
2944
|
-
},
|
|
2945
|
-
unit
|
|
2946
|
-
);
|
|
2947
|
-
}) })
|
|
2948
|
-
] }),
|
|
2949
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
2950
|
-
showHeight && /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
2951
|
-
/* @__PURE__ */ jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Height" }),
|
|
2952
|
-
/* @__PURE__ */ jsx(
|
|
2953
|
-
Input,
|
|
2954
|
-
{
|
|
2955
|
-
type: "number",
|
|
2956
|
-
min: 0,
|
|
2957
|
-
value: currentValue.height ?? CUSTOM_DEFAULTS.height,
|
|
2958
|
-
onChange: (e) => handleValueChange("height", parseInt(e.target.value, 10) || 0),
|
|
2959
|
-
disabled: readOnly,
|
|
2960
|
-
className: "h-8 text-sm font-mono"
|
|
2961
|
-
}
|
|
2962
|
-
)
|
|
2963
|
-
] }),
|
|
2964
|
-
showFontSize && /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
2965
|
-
/* @__PURE__ */ jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Font Size" }),
|
|
2966
|
-
/* @__PURE__ */ jsx(
|
|
2967
|
-
Input,
|
|
2968
|
-
{
|
|
2969
|
-
type: "number",
|
|
2970
|
-
min: 0,
|
|
2971
|
-
value: currentValue.fontSize ?? CUSTOM_DEFAULTS.fontSize,
|
|
2972
|
-
onChange: (e) => handleValueChange("fontSize", parseInt(e.target.value, 10) || 0),
|
|
2973
|
-
disabled: readOnly,
|
|
2974
|
-
className: "h-8 text-sm font-mono"
|
|
2975
|
-
}
|
|
2976
|
-
)
|
|
2977
|
-
] }),
|
|
2978
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
2979
|
-
/* @__PURE__ */ jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Padding X" }),
|
|
2980
|
-
/* @__PURE__ */ jsx(
|
|
2981
|
-
Input,
|
|
2982
|
-
{
|
|
2983
|
-
type: "number",
|
|
2984
|
-
min: 0,
|
|
2985
|
-
value: currentValue.paddingX ?? CUSTOM_DEFAULTS.paddingX,
|
|
2986
|
-
onChange: (e) => handleValueChange("paddingX", parseInt(e.target.value, 10) || 0),
|
|
2987
|
-
disabled: readOnly,
|
|
2988
|
-
className: "h-8 text-sm font-mono"
|
|
2989
|
-
}
|
|
2990
|
-
)
|
|
2991
|
-
] }),
|
|
2992
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
2993
|
-
/* @__PURE__ */ jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Padding Y" }),
|
|
2994
|
-
/* @__PURE__ */ jsx(
|
|
2995
|
-
Input,
|
|
2996
|
-
{
|
|
2997
|
-
type: "number",
|
|
2998
|
-
min: 0,
|
|
2999
|
-
value: currentValue.paddingY ?? CUSTOM_DEFAULTS.paddingY,
|
|
3000
|
-
onChange: (e) => handleValueChange("paddingY", parseInt(e.target.value, 10) || 0),
|
|
3001
|
-
disabled: readOnly,
|
|
3002
|
-
className: "h-8 text-sm font-mono"
|
|
3003
|
-
}
|
|
3004
|
-
)
|
|
3005
|
-
] })
|
|
3006
|
-
] }),
|
|
3007
|
-
/* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground font-mono pt-1 border-t border-border/50", children: [
|
|
3008
|
-
showHeight && `h: ${currentValue.height ?? CUSTOM_DEFAULTS.height}${currentValue.unit || "px"}`,
|
|
3009
|
-
showHeight && " | ",
|
|
3010
|
-
`p: ${currentValue.paddingY ?? CUSTOM_DEFAULTS.paddingY}${currentValue.unit || "px"} ${currentValue.paddingX ?? CUSTOM_DEFAULTS.paddingX}${currentValue.unit || "px"}`,
|
|
3011
|
-
showFontSize && ` | font: ${currentValue.fontSize ?? CUSTOM_DEFAULTS.fontSize}${currentValue.unit || "px"}`
|
|
3012
|
-
] })
|
|
3013
|
-
] })
|
|
3014
|
-
] });
|
|
3015
|
-
}
|
|
3016
|
-
function sizeValueToCSS(size) {
|
|
3017
|
-
if (!size || size.mode !== "custom") return void 0;
|
|
3018
|
-
const unit = size.unit || "px";
|
|
3019
|
-
const style = {};
|
|
3020
|
-
if (size.height != null) {
|
|
3021
|
-
style.height = `${size.height}${unit}`;
|
|
3022
|
-
}
|
|
3023
|
-
if (size.paddingX != null || size.paddingY != null) {
|
|
3024
|
-
const py = size.paddingY ?? 0;
|
|
3025
|
-
const px = size.paddingX ?? 0;
|
|
3026
|
-
style.padding = `${py}${unit} ${px}${unit}`;
|
|
3027
|
-
}
|
|
3028
|
-
if (size.fontSize != null) {
|
|
3029
|
-
style.fontSize = `${size.fontSize}${unit}`;
|
|
3030
|
-
}
|
|
3031
|
-
return Object.keys(style).length > 0 ? style : void 0;
|
|
3032
|
-
}
|
|
3033
|
-
function getSizeClasses(size, sizeMap) {
|
|
3034
|
-
if (!size) return sizeMap.default || "";
|
|
3035
|
-
if (size.mode === "custom") return "";
|
|
3036
|
-
return sizeMap[size.mode] || sizeMap.default || "";
|
|
3037
|
-
}
|
|
3038
|
-
var DEFAULT_VALUE, CUSTOM_DEFAULTS;
|
|
3039
|
-
var init_SizeField = __esm({
|
|
3040
|
-
"src/fields/SizeField.tsx"() {
|
|
3041
|
-
"use client";
|
|
3042
|
-
init_button();
|
|
3043
|
-
init_input();
|
|
3044
|
-
init_label();
|
|
3045
|
-
init_utils();
|
|
3046
|
-
DEFAULT_VALUE = {
|
|
3047
|
-
mode: "default"
|
|
3048
|
-
};
|
|
3049
|
-
CUSTOM_DEFAULTS = {
|
|
3050
|
-
height: 40,
|
|
3051
|
-
paddingX: 16,
|
|
3052
|
-
paddingY: 8,
|
|
3053
|
-
fontSize: 14,
|
|
3054
|
-
unit: "px"
|
|
3055
|
-
};
|
|
3056
|
-
memo(SizeFieldInner);
|
|
3057
|
-
}
|
|
3058
|
-
});
|
|
3059
|
-
|
|
3060
|
-
// src/theme/defaults.ts
|
|
3061
|
-
var DEFAULT_BUTTON_VARIANTS, DEFAULT_CTA_BUTTON_VARIANTS, DEFAULT_CTA_BACKGROUND_STYLES, DEFAULT_COLOR_PRESETS, DEFAULT_FOCUS_RING, DEFAULT_THEME;
|
|
3062
|
-
var init_defaults2 = __esm({
|
|
3063
|
-
"src/theme/defaults.ts"() {
|
|
3064
|
-
DEFAULT_BUTTON_VARIANTS = {
|
|
3065
|
-
default: { classes: "bg-primary text-primary-foreground hover:bg-primary/90" },
|
|
3066
|
-
secondary: { classes: "bg-secondary text-secondary-foreground hover:bg-secondary/80" },
|
|
3067
|
-
outline: { classes: "border border-input bg-background hover:bg-accent hover:text-accent-foreground" },
|
|
3068
|
-
ghost: { classes: "bg-transparent hover:bg-accent hover:text-accent-foreground" },
|
|
3069
|
-
destructive: { classes: "bg-destructive text-destructive-foreground hover:bg-destructive/90" },
|
|
3070
|
-
link: { classes: "text-primary underline-offset-4 hover:underline bg-transparent" }
|
|
3071
|
-
};
|
|
3072
|
-
DEFAULT_CTA_BUTTON_VARIANTS = {
|
|
3073
|
-
primary: { classes: "bg-primary text-primary-foreground hover:bg-primary/90" },
|
|
3074
|
-
secondary: { classes: "bg-secondary text-secondary-foreground hover:bg-secondary/80" },
|
|
3075
|
-
outline: { classes: "border border-input bg-background hover:bg-accent hover:text-accent-foreground" },
|
|
3076
|
-
ghost: { classes: "bg-transparent hover:bg-accent hover:text-accent-foreground" },
|
|
3077
|
-
link: { classes: "text-primary underline-offset-4 hover:underline bg-transparent" }
|
|
3078
|
-
};
|
|
3079
|
-
DEFAULT_CTA_BACKGROUND_STYLES = {
|
|
3080
|
-
default: "bg-muted",
|
|
3081
|
-
dark: "bg-foreground text-background",
|
|
3082
|
-
light: "bg-background"
|
|
3083
|
-
};
|
|
3084
|
-
DEFAULT_COLOR_PRESETS = [
|
|
3085
|
-
{ hex: "#ffffff", label: "White" },
|
|
3086
|
-
{ hex: "#f9fafb", label: "Gray 50" },
|
|
3087
|
-
{ hex: "#f3f4f6", label: "Gray 100" },
|
|
3088
|
-
{ hex: "#1f2937", label: "Gray 800" },
|
|
3089
|
-
{ hex: "#111827", label: "Gray 900" },
|
|
3090
|
-
{ hex: "#000000", label: "Black" },
|
|
3091
|
-
{ hex: "#3b82f6", label: "Blue" },
|
|
3092
|
-
{ hex: "#10b981", label: "Green" },
|
|
3093
|
-
{ hex: "#f59e0b", label: "Amber" },
|
|
3094
|
-
{ hex: "#ef4444", label: "Red" }
|
|
3095
|
-
];
|
|
3096
|
-
DEFAULT_FOCUS_RING = "focus:ring-ring";
|
|
3097
|
-
DEFAULT_THEME = {
|
|
3098
|
-
buttonVariants: DEFAULT_BUTTON_VARIANTS,
|
|
3099
|
-
ctaButtonVariants: DEFAULT_CTA_BUTTON_VARIANTS,
|
|
3100
|
-
ctaBackgroundStyles: DEFAULT_CTA_BACKGROUND_STYLES,
|
|
3101
|
-
colorPresets: DEFAULT_COLOR_PRESETS,
|
|
3102
|
-
focusRingColor: DEFAULT_FOCUS_RING
|
|
3103
|
-
};
|
|
3104
|
-
}
|
|
3105
|
-
});
|
|
3106
|
-
|
|
3107
|
-
// src/theme/utils.ts
|
|
3108
|
-
function resolveTheme(config) {
|
|
3109
|
-
if (!config) return DEFAULT_THEME;
|
|
3110
|
-
return {
|
|
3111
|
-
buttonVariants: mergeVariants(DEFAULT_BUTTON_VARIANTS, config.buttonVariants),
|
|
3112
|
-
ctaButtonVariants: mergeVariants(DEFAULT_CTA_BUTTON_VARIANTS, config.ctaButtonVariants),
|
|
3113
|
-
ctaBackgroundStyles: mergeBackgroundStyles(
|
|
3114
|
-
DEFAULT_CTA_BACKGROUND_STYLES,
|
|
3115
|
-
config.ctaBackgroundStyles
|
|
3116
|
-
),
|
|
3117
|
-
colorPresets: resolveColorPresets(config),
|
|
3118
|
-
focusRingColor: config.focusRingColor ?? DEFAULT_FOCUS_RING
|
|
3119
|
-
};
|
|
3120
|
-
}
|
|
3121
|
-
function mergeVariants(defaults, overrides) {
|
|
3122
|
-
if (!overrides) return defaults;
|
|
3123
|
-
const result = { ...defaults };
|
|
3124
|
-
for (const key of Object.keys(overrides)) {
|
|
3125
|
-
const override = overrides[key];
|
|
3126
|
-
if (override) {
|
|
3127
|
-
result[key] = override;
|
|
3128
|
-
}
|
|
3129
|
-
}
|
|
3130
|
-
return result;
|
|
3131
|
-
}
|
|
3132
|
-
function mergeBackgroundStyles(defaults, overrides) {
|
|
3133
|
-
if (!overrides) return defaults;
|
|
3134
|
-
return { ...defaults, ...overrides };
|
|
3135
|
-
}
|
|
3136
|
-
function resolveColorPresets(config) {
|
|
3137
|
-
if (!config.colorPresets) {
|
|
3138
|
-
return DEFAULT_COLOR_PRESETS;
|
|
3139
|
-
}
|
|
3140
|
-
if (config.extendColorPresets) {
|
|
3141
|
-
return [...DEFAULT_COLOR_PRESETS, ...config.colorPresets];
|
|
3142
|
-
}
|
|
3143
|
-
return config.colorPresets;
|
|
3144
|
-
}
|
|
3145
|
-
function getVariantClasses(variants, variant, fallback = "default") {
|
|
3146
|
-
const config = variants[variant];
|
|
3147
|
-
if (config?.classes) {
|
|
3148
|
-
return config.classes;
|
|
3149
|
-
}
|
|
3150
|
-
const fallbackConfig = variants[fallback];
|
|
3151
|
-
return fallbackConfig?.classes ?? "";
|
|
3152
|
-
}
|
|
3153
|
-
var init_utils3 = __esm({
|
|
3154
|
-
"src/theme/utils.ts"() {
|
|
3155
|
-
init_defaults2();
|
|
3156
|
-
}
|
|
3157
|
-
});
|
|
3158
|
-
var sizeStyles, alignmentWrapperMap, defaultProps11, ButtonConfig;
|
|
3159
|
-
var init_Button_server = __esm({
|
|
3160
|
-
"src/components/interactive/Button.server.tsx"() {
|
|
3161
|
-
init_shared();
|
|
3162
|
-
init_AnimatedWrapper();
|
|
3163
|
-
init_SizeField();
|
|
3164
|
-
init_defaults2();
|
|
3165
|
-
init_utils3();
|
|
3166
|
-
sizeStyles = {
|
|
3167
|
-
sm: "h-8 px-3 text-sm",
|
|
3168
|
-
default: "h-10 px-4",
|
|
3169
|
-
lg: "h-12 px-8 text-lg"
|
|
3170
|
-
};
|
|
3171
|
-
alignmentWrapperMap = {
|
|
3172
|
-
left: "text-left",
|
|
3173
|
-
center: "text-center",
|
|
3174
|
-
right: "text-right"
|
|
3175
|
-
};
|
|
3176
|
-
defaultProps11 = {
|
|
3177
|
-
text: "Click Me",
|
|
3178
|
-
link: "",
|
|
3179
|
-
variant: "default",
|
|
3180
|
-
size: null,
|
|
3181
|
-
openInNewTab: "no",
|
|
3182
|
-
margin: null,
|
|
3183
|
-
customBackgroundColor: null,
|
|
3184
|
-
customTextColor: null,
|
|
3185
|
-
customBorder: null,
|
|
3186
|
-
alignment: null,
|
|
3187
|
-
transform: null,
|
|
3188
|
-
animation: null,
|
|
3189
|
-
customPadding: null
|
|
3190
|
-
};
|
|
3191
|
-
ButtonConfig = {
|
|
3192
|
-
label: "Button",
|
|
3193
|
-
defaultProps: defaultProps11,
|
|
3194
|
-
render: ({ text, link, variant, size, openInNewTab, alignment, margin, customBackgroundColor, customTextColor, customBorder, transform, animation, customPadding }) => {
|
|
3195
|
-
const hasCustomBackground = customBackgroundColor?.hex;
|
|
3196
|
-
const hasCustomTextColor = customTextColor?.hex;
|
|
3197
|
-
const hasCustomPadding = customPadding;
|
|
3198
|
-
const hasCustomSize = size?.mode === "custom";
|
|
3199
|
-
const variantClasses = getVariantClasses(DEFAULT_BUTTON_VARIANTS, variant, "default");
|
|
3200
|
-
const sizeClasses = getSizeClasses(size, sizeStyles);
|
|
3201
|
-
const buttonClasses = cn2(
|
|
3202
|
-
"inline-flex items-center justify-center font-medium transition-colors",
|
|
3203
|
-
`focus:outline-none focus:ring-2 focus:ring-offset-2 ${DEFAULT_FOCUS_RING}`,
|
|
3204
|
-
"disabled:opacity-50 disabled:pointer-events-none",
|
|
3205
|
-
// Only apply variant styles if no custom background/text color
|
|
3206
|
-
!hasCustomBackground && !hasCustomTextColor && variantClasses,
|
|
3207
|
-
// Only apply background portion of variant if no custom background
|
|
3208
|
-
hasCustomBackground && !hasCustomTextColor && "hover:opacity-90",
|
|
3209
|
-
// Only apply size classes if not using custom size or custom padding
|
|
3210
|
-
!hasCustomPadding && !hasCustomSize && sizeClasses,
|
|
3211
|
-
// Apply rounded-md unless custom border has radius
|
|
3212
|
-
!customBorder?.radius && "rounded-md"
|
|
3213
|
-
);
|
|
3214
|
-
const buttonStyle = {};
|
|
3215
|
-
if (hasCustomBackground) {
|
|
3216
|
-
buttonStyle.backgroundColor = colorValueToCSS(customBackgroundColor);
|
|
3217
|
-
}
|
|
3218
|
-
if (hasCustomTextColor) {
|
|
3219
|
-
buttonStyle.color = colorValueToCSS(customTextColor);
|
|
3220
|
-
}
|
|
3221
|
-
const borderStyles = borderValueToCSS(customBorder);
|
|
3222
|
-
if (borderStyles) {
|
|
3223
|
-
Object.assign(buttonStyle, borderStyles);
|
|
3224
|
-
}
|
|
3225
|
-
const customSizeStyles = sizeValueToCSS(size);
|
|
3226
|
-
if (customSizeStyles) {
|
|
3227
|
-
Object.assign(buttonStyle, customSizeStyles);
|
|
3228
|
-
}
|
|
3229
|
-
const paddingCSS = paddingValueToCSS(customPadding);
|
|
3230
|
-
if (paddingCSS) {
|
|
3231
|
-
buttonStyle.padding = paddingCSS;
|
|
3232
|
-
}
|
|
3233
|
-
const transformStyles = transformValueToCSS(transform);
|
|
3234
|
-
if (transformStyles) {
|
|
3235
|
-
Object.assign(buttonStyle, transformStyles);
|
|
3236
|
-
}
|
|
3237
|
-
const buttonElement = link ? /* @__PURE__ */ jsx(
|
|
3238
|
-
"a",
|
|
3239
|
-
{
|
|
3240
|
-
href: link,
|
|
3241
|
-
target: openInNewTab === "yes" ? "_blank" : void 0,
|
|
3242
|
-
rel: openInNewTab === "yes" ? "noopener noreferrer" : void 0,
|
|
3243
|
-
className: buttonClasses,
|
|
3244
|
-
style: buttonStyle,
|
|
3245
|
-
children: text
|
|
3246
|
-
}
|
|
3247
|
-
) : /* @__PURE__ */ jsx("button", { type: "button", className: buttonClasses, style: buttonStyle, children: text });
|
|
3248
|
-
const wrapperStyle = {};
|
|
3249
|
-
const marginCSS = marginValueToCSS(margin);
|
|
3250
|
-
if (marginCSS) {
|
|
3251
|
-
wrapperStyle.margin = marginCSS;
|
|
3252
|
-
}
|
|
3253
|
-
const alignmentValue = alignment ?? "left";
|
|
3254
|
-
return /* @__PURE__ */ jsx(
|
|
3255
|
-
AnimatedWrapper,
|
|
3256
|
-
{
|
|
3257
|
-
animation,
|
|
3258
|
-
className: alignmentWrapperMap[alignmentValue] || alignmentWrapperMap.left,
|
|
3259
|
-
style: wrapperStyle,
|
|
3260
|
-
children: buttonElement
|
|
3261
|
-
}
|
|
3262
|
-
);
|
|
3263
|
-
}
|
|
3264
|
-
};
|
|
3265
|
-
}
|
|
3266
|
-
});
|
|
3267
|
-
var defaultProps12, CardConfig;
|
|
3268
|
-
var init_Card_server = __esm({
|
|
3269
|
-
"src/components/interactive/Card.server.tsx"() {
|
|
3270
|
-
init_shared();
|
|
3271
|
-
init_AnimatedWrapper();
|
|
3272
|
-
defaultProps12 = {
|
|
3273
|
-
image: null,
|
|
3274
|
-
heading: "Card Heading",
|
|
3275
|
-
text: "Card description text goes here.",
|
|
3276
|
-
link: "",
|
|
3277
|
-
openInNewTab: false,
|
|
3278
|
-
shadow: "md",
|
|
3279
|
-
margin: null,
|
|
3280
|
-
background: null,
|
|
3281
|
-
border: null,
|
|
3282
|
-
dimensions: null,
|
|
3283
|
-
alignment: null,
|
|
3284
|
-
transform: null,
|
|
3285
|
-
animation: null,
|
|
3286
|
-
customPadding: null
|
|
3287
|
-
};
|
|
3288
|
-
CardConfig = {
|
|
3289
|
-
label: "Card",
|
|
3290
|
-
defaultProps: defaultProps12,
|
|
3291
|
-
render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, customPadding }) => {
|
|
3292
|
-
const hasBorderRadius = border?.radius && border.radius > 0;
|
|
3293
|
-
const cardClasses = cn2(
|
|
3294
|
-
"overflow-hidden transition-all bg-card",
|
|
3295
|
-
!hasBorderRadius && "rounded-lg",
|
|
3296
|
-
shadowMap[shadow] || "",
|
|
3297
|
-
link && "hover:shadow-lg cursor-pointer"
|
|
3298
|
-
);
|
|
3299
|
-
const wrapperStyle = {};
|
|
3300
|
-
const marginCSS = marginValueToCSS(margin);
|
|
3301
|
-
if (marginCSS) {
|
|
3302
|
-
wrapperStyle.margin = marginCSS;
|
|
3303
|
-
}
|
|
3304
|
-
const dimensionsStyles = dimensionsValueToCSS(dimensions);
|
|
3305
|
-
if (dimensionsStyles) {
|
|
3306
|
-
Object.assign(wrapperStyle, dimensionsStyles);
|
|
3307
|
-
}
|
|
3308
|
-
const transformStyles = transformValueToCSS(transform);
|
|
3309
|
-
if (transformStyles) {
|
|
3310
|
-
Object.assign(wrapperStyle, transformStyles);
|
|
3311
|
-
}
|
|
3312
|
-
const alignmentValue = alignment ?? "left";
|
|
3313
|
-
const alignmentClasses = cn2(
|
|
3314
|
-
"flex",
|
|
3315
|
-
alignmentValue === "left" && "justify-start",
|
|
3316
|
-
alignmentValue === "center" && "justify-center",
|
|
3317
|
-
alignmentValue === "right" && "justify-end"
|
|
3318
|
-
);
|
|
3319
|
-
const backgroundStyles = backgroundValueToCSS(background);
|
|
3320
|
-
const cardStyle = {
|
|
3321
|
-
...backgroundStyles
|
|
3322
|
-
};
|
|
3323
|
-
const borderStyles = borderValueToCSS(border);
|
|
3324
|
-
if (borderStyles) {
|
|
3325
|
-
Object.assign(cardStyle, borderStyles);
|
|
3326
|
-
}
|
|
3327
|
-
const paddingCSS = paddingValueToCSS(customPadding);
|
|
3328
|
-
if (paddingCSS) {
|
|
3329
|
-
cardStyle.padding = paddingCSS;
|
|
3330
|
-
}
|
|
3331
|
-
const cardContent = /* @__PURE__ */ jsxs("div", { className: cardClasses, style: cardStyle, children: [
|
|
3332
|
-
image?.url ? /* @__PURE__ */ jsx("div", { className: "relative aspect-video w-full overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
3333
|
-
"img",
|
|
3334
|
-
{
|
|
3335
|
-
src: image.url,
|
|
3336
|
-
alt: image.alt || heading || "",
|
|
3337
|
-
className: "w-full h-full object-cover"
|
|
3338
|
-
}
|
|
3339
|
-
) }) : /* @__PURE__ */ jsx("div", { className: "aspect-video w-full bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "No image" }) }),
|
|
3340
|
-
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
3341
|
-
heading && /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-foreground mb-2", children: heading }),
|
|
3342
|
-
text && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: text })
|
|
3343
|
-
] })
|
|
3344
|
-
] });
|
|
3345
|
-
if (link) {
|
|
3346
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsx(
|
|
3347
|
-
"a",
|
|
3348
|
-
{
|
|
3349
|
-
href: link,
|
|
3350
|
-
target: openInNewTab ? "_blank" : void 0,
|
|
3351
|
-
rel: openInNewTab ? "noopener noreferrer" : void 0,
|
|
3352
|
-
className: "block",
|
|
3353
|
-
style: wrapperStyle,
|
|
3354
|
-
children: cardContent
|
|
3355
|
-
}
|
|
3356
|
-
) }) });
|
|
3357
|
-
}
|
|
3358
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsx("div", { style: wrapperStyle, children: cardContent }) }) });
|
|
3359
|
-
}
|
|
3360
|
-
};
|
|
3361
|
-
}
|
|
3362
|
-
});
|
|
3363
|
-
var defaultProps13, DividerConfig;
|
|
3364
|
-
var init_Divider_server = __esm({
|
|
3365
|
-
"src/components/interactive/Divider.server.tsx"() {
|
|
3366
|
-
init_shared();
|
|
3367
|
-
init_AnimatedWrapper();
|
|
3368
|
-
defaultProps13 = {
|
|
3369
|
-
style: "solid",
|
|
3370
|
-
color: null,
|
|
3371
|
-
margin: null,
|
|
3372
|
-
dimensions: null,
|
|
3373
|
-
transform: null,
|
|
3374
|
-
animation: null,
|
|
3375
|
-
customPadding: null
|
|
3376
|
-
};
|
|
3377
|
-
DividerConfig = {
|
|
3378
|
-
label: "Divider",
|
|
3379
|
-
defaultProps: defaultProps13,
|
|
3380
|
-
render: ({ style, color, dimensions, margin, transform, animation, customPadding }) => {
|
|
3381
|
-
const dimensionsStyles = dimensionsValueToCSS(dimensions);
|
|
3382
|
-
const wrapperStyle = {
|
|
3383
|
-
...dimensionsStyles
|
|
3384
|
-
};
|
|
3385
|
-
const marginCSS = marginValueToCSS(margin);
|
|
3386
|
-
if (marginCSS) {
|
|
3387
|
-
wrapperStyle.margin = marginCSS;
|
|
3388
|
-
}
|
|
3389
|
-
const paddingCSS = paddingValueToCSS(customPadding);
|
|
3390
|
-
if (paddingCSS) {
|
|
3391
|
-
wrapperStyle.padding = paddingCSS;
|
|
3392
|
-
}
|
|
3393
|
-
const transformStyles = transformValueToCSS(transform);
|
|
3394
|
-
if (transformStyles) {
|
|
3395
|
-
Object.assign(wrapperStyle, transformStyles);
|
|
3396
|
-
}
|
|
3397
|
-
const customColor = colorValueToCSS(color);
|
|
3398
|
-
const hrStyle = customColor ? { borderColor: customColor } : void 0;
|
|
3399
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { className: "px-4", style: Object.keys(wrapperStyle).length > 0 ? wrapperStyle : void 0, children: /* @__PURE__ */ jsx(
|
|
3400
|
-
"hr",
|
|
3401
|
-
{
|
|
3402
|
-
className: cn2(
|
|
3403
|
-
"border-t border-border",
|
|
3404
|
-
dividerStyleMap[style] || dividerStyleMap.solid
|
|
3405
|
-
),
|
|
3406
|
-
style: hrStyle
|
|
3407
|
-
}
|
|
3408
|
-
) }) });
|
|
3409
|
-
}
|
|
3410
|
-
};
|
|
3411
|
-
}
|
|
3412
|
-
});
|
|
3413
|
-
function AccordionItem({
|
|
3414
|
-
item,
|
|
3415
|
-
isOpen,
|
|
3416
|
-
onToggle,
|
|
3417
|
-
textColorCSS
|
|
3418
|
-
}) {
|
|
3419
|
-
const textStyle = textColorCSS ? { color: textColorCSS } : {};
|
|
3420
|
-
return /* @__PURE__ */ jsxs("div", { className: "border-b border-border last:border-b-0", children: [
|
|
3421
|
-
/* @__PURE__ */ jsxs(
|
|
3422
|
-
"button",
|
|
3423
|
-
{
|
|
3424
|
-
type: "button",
|
|
3425
|
-
onClick: onToggle,
|
|
3426
|
-
className: "flex w-full items-center justify-between py-4 px-4 text-left font-medium transition-all hover:bg-muted/50 text-foreground",
|
|
3427
|
-
style: textStyle,
|
|
3428
|
-
children: [
|
|
3429
|
-
/* @__PURE__ */ jsx("span", { children: item.title }),
|
|
3430
|
-
/* @__PURE__ */ jsx(
|
|
3431
|
-
ChevronDown,
|
|
3432
|
-
{
|
|
3433
|
-
className: cn2(
|
|
3434
|
-
"h-4 w-4 shrink-0 transition-transform duration-200",
|
|
3435
|
-
isOpen && "rotate-180"
|
|
3436
|
-
)
|
|
3437
|
-
}
|
|
3438
|
-
)
|
|
3439
|
-
]
|
|
3440
|
-
}
|
|
3441
|
-
),
|
|
3442
|
-
/* @__PURE__ */ jsx(
|
|
3443
|
-
"div",
|
|
3444
|
-
{
|
|
3445
|
-
className: cn2(
|
|
3446
|
-
"overflow-hidden transition-all duration-200",
|
|
3447
|
-
isOpen ? "max-h-[1000px] opacity-100" : "max-h-0 opacity-0"
|
|
3448
|
-
),
|
|
3449
|
-
children: /* @__PURE__ */ jsx(
|
|
3450
|
-
"div",
|
|
3451
|
-
{
|
|
3452
|
-
className: "px-4 pb-4 text-muted-foreground",
|
|
3453
|
-
style: textColorCSS ? { color: textColorCSS } : void 0,
|
|
3454
|
-
children: item.content
|
|
3455
|
-
}
|
|
3456
|
-
)
|
|
3457
|
-
}
|
|
3458
|
-
)
|
|
3459
|
-
] });
|
|
3460
|
-
}
|
|
3461
|
-
function AccordionClient({
|
|
3462
|
-
items,
|
|
3463
|
-
allowMultiple,
|
|
3464
|
-
textColor,
|
|
3465
|
-
margin,
|
|
3466
|
-
background,
|
|
3467
|
-
dimensions,
|
|
3468
|
-
transform,
|
|
3469
|
-
animation,
|
|
3470
|
-
customPadding
|
|
3471
|
-
}) {
|
|
3472
|
-
const [openItems, setOpenItems] = useState(() => {
|
|
3473
|
-
const initialOpen = /* @__PURE__ */ new Set();
|
|
3474
|
-
items?.forEach((item, index) => {
|
|
3475
|
-
if (item.defaultOpen) {
|
|
3476
|
-
initialOpen.add(index);
|
|
3477
|
-
}
|
|
3478
|
-
});
|
|
3479
|
-
return initialOpen;
|
|
3480
|
-
});
|
|
3481
|
-
const handleToggle = (index) => {
|
|
3482
|
-
setOpenItems((prev) => {
|
|
3483
|
-
const newSet = new Set(prev);
|
|
3484
|
-
if (newSet.has(index)) {
|
|
3485
|
-
newSet.delete(index);
|
|
3486
|
-
} else {
|
|
3487
|
-
if (!allowMultiple) {
|
|
3488
|
-
newSet.clear();
|
|
3489
|
-
}
|
|
3490
|
-
newSet.add(index);
|
|
3491
|
-
}
|
|
3492
|
-
return newSet;
|
|
3493
|
-
});
|
|
3494
|
-
};
|
|
3495
|
-
const textColorCSS = colorValueToCSS(textColor);
|
|
3496
|
-
const dimensionsStyles = dimensionsValueToCSS(dimensions);
|
|
3497
|
-
const accordionClasses = "rounded-lg border border-border overflow-hidden bg-card";
|
|
3498
|
-
const backgroundStyles = backgroundValueToCSS(background);
|
|
3499
|
-
const accordionStyle = backgroundStyles && Object.keys(backgroundStyles).length > 0 ? backgroundStyles : {};
|
|
3500
|
-
const style = {
|
|
3501
|
-
...dimensionsStyles
|
|
3502
|
-
};
|
|
3503
|
-
const marginCSS = marginValueToCSS(margin);
|
|
3504
|
-
if (marginCSS) {
|
|
3505
|
-
style.margin = marginCSS;
|
|
3506
|
-
}
|
|
3507
|
-
const paddingCSS = paddingValueToCSS(customPadding);
|
|
3508
|
-
if (paddingCSS) {
|
|
3509
|
-
style.padding = paddingCSS;
|
|
3510
|
-
}
|
|
3511
|
-
const transformStyles = transformValueToCSS(transform);
|
|
3512
|
-
if (transformStyles) {
|
|
3513
|
-
Object.assign(style, transformStyles);
|
|
3514
|
-
}
|
|
3515
|
-
if (!items || items.length === 0) {
|
|
3516
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { className: "px-4", style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: accordionClasses, style: accordionStyle, children: /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-muted-foreground", children: "No accordion items. Add items in the editor." }) }) }) });
|
|
3517
|
-
}
|
|
3518
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { className: "px-4", style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: accordionClasses, style: accordionStyle, children: items.map((item, index) => /* @__PURE__ */ jsx(
|
|
3519
|
-
AccordionItem,
|
|
3520
|
-
{
|
|
3521
|
-
item,
|
|
3522
|
-
isOpen: openItems.has(index),
|
|
3523
|
-
onToggle: () => handleToggle(index),
|
|
3524
|
-
textColorCSS
|
|
3525
|
-
},
|
|
3526
|
-
index
|
|
3527
|
-
)) }) }) });
|
|
3528
|
-
}
|
|
3529
|
-
var init_AccordionClient = __esm({
|
|
3530
|
-
"src/components/AccordionClient.tsx"() {
|
|
3531
|
-
"use client";
|
|
3532
|
-
init_shared();
|
|
3533
|
-
init_AnimatedWrapper();
|
|
3534
|
-
}
|
|
3535
|
-
});
|
|
3536
|
-
var defaultProps14, AccordionConfig;
|
|
3537
|
-
var init_Accordion_server = __esm({
|
|
3538
|
-
"src/components/interactive/Accordion.server.tsx"() {
|
|
3539
|
-
init_AccordionClient();
|
|
3540
|
-
defaultProps14 = {
|
|
3541
|
-
items: [
|
|
3542
|
-
{
|
|
3543
|
-
title: "What is this?",
|
|
3544
|
-
content: "This is an accordion component that can expand and collapse.",
|
|
3545
|
-
defaultOpen: false
|
|
3546
|
-
},
|
|
3547
|
-
{
|
|
3548
|
-
title: "How do I use it?",
|
|
3549
|
-
content: "Click on each item to expand or collapse it.",
|
|
3550
|
-
defaultOpen: false
|
|
3551
|
-
}
|
|
3552
|
-
],
|
|
3553
|
-
allowMultiple: false,
|
|
3554
|
-
textColor: null,
|
|
3555
|
-
margin: null,
|
|
3556
|
-
background: null,
|
|
3557
|
-
dimensions: null,
|
|
3558
|
-
transform: null,
|
|
3559
|
-
animation: null,
|
|
3560
|
-
customPadding: null
|
|
3561
|
-
};
|
|
3562
|
-
AccordionConfig = {
|
|
3563
|
-
label: "Accordion",
|
|
3564
|
-
defaultProps: defaultProps14,
|
|
3565
|
-
render: (props) => /* @__PURE__ */ jsx(
|
|
3566
|
-
AccordionClient,
|
|
3567
|
-
{
|
|
3568
|
-
items: props.items,
|
|
3569
|
-
allowMultiple: props.allowMultiple,
|
|
3570
|
-
textColor: props.textColor,
|
|
3571
|
-
margin: props.margin,
|
|
3572
|
-
background: props.background,
|
|
3573
|
-
dimensions: props.dimensions,
|
|
3574
|
-
transform: props.transform,
|
|
3575
|
-
animation: props.animation,
|
|
3576
|
-
customPadding: props.customPadding
|
|
3577
|
-
}
|
|
3578
|
-
)
|
|
3579
|
-
};
|
|
3580
|
-
}
|
|
3581
|
-
});
|
|
3582
|
-
|
|
3583
|
-
// src/config/merge.ts
|
|
3584
|
-
var init_merge = __esm({
|
|
3585
|
-
"src/config/merge.ts"() {
|
|
3586
|
-
}
|
|
3587
|
-
});
|
|
3588
|
-
function createConfig(layouts = DEFAULT_LAYOUTS) {
|
|
3589
|
-
const layoutOptions = layoutsToOptions(layouts);
|
|
3590
|
-
return {
|
|
3591
|
-
root: {
|
|
3592
|
-
fields: {
|
|
3593
|
-
title: {
|
|
3594
|
-
type: "text",
|
|
3595
|
-
label: "Page Title"
|
|
3596
|
-
},
|
|
3597
|
-
pageLayout: {
|
|
3598
|
-
type: "select",
|
|
3599
|
-
label: "Page Layout",
|
|
3600
|
-
options: layoutOptions.map(({ value, label }) => ({ value, label }))
|
|
3601
|
-
}
|
|
3602
|
-
},
|
|
3603
|
-
defaultProps: {
|
|
3604
|
-
title: "New Page",
|
|
3605
|
-
pageLayout: "default"
|
|
3606
|
-
},
|
|
3607
|
-
render: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children })
|
|
3608
|
-
},
|
|
3609
|
-
categories: {
|
|
3610
|
-
layout: {
|
|
3611
|
-
title: "Layout",
|
|
3612
|
-
components: ["Container", "Flex", "Grid", "Section", "Spacer", "Template"],
|
|
3613
|
-
defaultExpanded: true
|
|
3614
|
-
},
|
|
3615
|
-
typography: {
|
|
3616
|
-
title: "Typography",
|
|
3617
|
-
components: ["Heading", "Text", "RichText"]
|
|
3618
|
-
},
|
|
3619
|
-
media: {
|
|
3620
|
-
title: "Media",
|
|
3621
|
-
components: ["Image"]
|
|
3622
|
-
},
|
|
3623
|
-
interactive: {
|
|
3624
|
-
title: "Interactive",
|
|
3625
|
-
components: ["Button", "Card", "Divider", "Accordion"]
|
|
3626
|
-
}
|
|
3627
|
-
},
|
|
3628
|
-
components: {
|
|
3629
|
-
// Layout
|
|
3630
|
-
Container: ContainerConfig,
|
|
3631
|
-
Flex: FlexConfig,
|
|
3632
|
-
Grid: GridConfig,
|
|
3633
|
-
Section: SectionConfig,
|
|
3634
|
-
Spacer: SpacerConfig,
|
|
3635
|
-
Template: TemplateServerConfig,
|
|
3636
|
-
// Typography
|
|
3637
|
-
Heading: HeadingConfig,
|
|
3638
|
-
Text: TextConfig,
|
|
3639
|
-
RichText: RichTextConfig,
|
|
3640
|
-
// Media
|
|
3641
|
-
Image: ImageConfig,
|
|
3642
|
-
// Interactive
|
|
3643
|
-
Button: ButtonConfig,
|
|
3644
|
-
Card: CardConfig,
|
|
3645
|
-
Divider: DividerConfig,
|
|
3646
|
-
Accordion: AccordionConfig
|
|
3647
|
-
}
|
|
3648
|
-
};
|
|
3649
|
-
}
|
|
3650
|
-
var baseConfig;
|
|
3651
|
-
var init_config = __esm({
|
|
3652
|
-
"src/config/index.tsx"() {
|
|
3653
|
-
init_layouts();
|
|
3654
|
-
init_Container_server();
|
|
3655
|
-
init_Flex_server();
|
|
3656
|
-
init_Grid_server();
|
|
3657
|
-
init_Section_server();
|
|
3658
|
-
init_Spacer_server();
|
|
3659
|
-
init_Template_server();
|
|
3660
|
-
init_Heading_server();
|
|
3661
|
-
init_Text_server();
|
|
3662
|
-
init_RichText_server();
|
|
3663
|
-
init_Image_server();
|
|
3664
|
-
init_Button_server();
|
|
3665
|
-
init_Card_server();
|
|
3666
|
-
init_Divider_server();
|
|
3667
|
-
init_Accordion_server();
|
|
3668
|
-
init_merge();
|
|
3669
|
-
init_layouts();
|
|
3670
|
-
baseConfig = createConfig(DEFAULT_LAYOUTS);
|
|
3671
|
-
}
|
|
3672
|
-
});
|
|
3673
|
-
function PageRenderer({
|
|
3674
|
-
data,
|
|
3675
|
-
config = baseConfig,
|
|
3676
|
-
wrapper: Wrapper,
|
|
3677
|
-
className,
|
|
3678
|
-
layouts = DEFAULT_LAYOUTS
|
|
3679
|
-
}) {
|
|
3680
|
-
if (!data || !data.content) {
|
|
3681
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx("p", { children: "No content available" }) });
|
|
3682
|
-
}
|
|
3683
|
-
const content = /* @__PURE__ */ jsx(Render, { config, data });
|
|
3684
|
-
const rootProps = data.root?.props;
|
|
3685
|
-
const overrides = {
|
|
3686
|
-
showHeader: rootProps?.showHeader,
|
|
3687
|
-
showFooter: rootProps?.showFooter,
|
|
3688
|
-
background: rootProps?.pageBackground,
|
|
3689
|
-
maxWidth: rootProps?.pageMaxWidth
|
|
3690
|
-
};
|
|
3691
|
-
let result = content;
|
|
3692
|
-
if (Wrapper) {
|
|
3693
|
-
result = /* @__PURE__ */ jsx(Wrapper, { children: result });
|
|
3694
|
-
} else {
|
|
3695
|
-
const pageLayout = rootProps?.pageLayout;
|
|
3696
|
-
const layout = pageLayout ? getLayout(layouts, pageLayout) : void 0;
|
|
3697
|
-
if (layout) {
|
|
3698
|
-
result = /* @__PURE__ */ jsx(LayoutWrapper, { layout, className, overrides, children: result });
|
|
3699
|
-
} else if (className || overrides.background) {
|
|
3700
|
-
result = /* @__PURE__ */ jsx(LayoutWrapper, { className, overrides, children: result });
|
|
3701
|
-
}
|
|
3702
|
-
}
|
|
3703
|
-
return result;
|
|
3704
|
-
}
|
|
3705
|
-
var init_PageRenderer = __esm({
|
|
3706
|
-
"src/render/PageRenderer.tsx"() {
|
|
3707
|
-
init_config();
|
|
3708
|
-
init_layouts();
|
|
3709
|
-
}
|
|
3710
|
-
});
|
|
3711
|
-
var PreviewModal;
|
|
3712
|
-
var init_PreviewModal = __esm({
|
|
3713
|
-
"src/editor/components/PreviewModal.tsx"() {
|
|
3714
|
-
"use client";
|
|
3715
|
-
init_dialog();
|
|
3716
|
-
init_utils();
|
|
3717
|
-
init_PageRenderer();
|
|
3718
|
-
PreviewModal = memo(function PreviewModal2({
|
|
3719
|
-
isOpen,
|
|
3720
|
-
onClose,
|
|
3721
|
-
data,
|
|
3722
|
-
pageTitle,
|
|
3723
|
-
onOpenInNewTab,
|
|
3724
|
-
layouts,
|
|
3725
|
-
hasUnsavedChanges = false,
|
|
3726
|
-
onSave,
|
|
3727
|
-
isSaving = false
|
|
3728
|
-
}) {
|
|
3729
|
-
const [pendingNavigation, setPendingNavigation] = useState(null);
|
|
3730
|
-
const [isNavigating, setIsNavigating] = useState(false);
|
|
3731
|
-
const handleContentClick = useCallback((e) => {
|
|
3732
|
-
const target = e.target;
|
|
3733
|
-
const anchor = target.closest("a");
|
|
3734
|
-
if (anchor) {
|
|
3735
|
-
const href = anchor.getAttribute("href");
|
|
3736
|
-
if (href?.startsWith("#") && !href.includes("/")) {
|
|
3737
|
-
return;
|
|
3738
|
-
}
|
|
3739
|
-
e.preventDefault();
|
|
3740
|
-
e.stopPropagation();
|
|
3741
|
-
if (href) {
|
|
3742
|
-
setPendingNavigation(href);
|
|
3743
|
-
}
|
|
3744
|
-
}
|
|
3745
|
-
}, []);
|
|
3746
|
-
const handleNavigate = useCallback((saveFirst) => {
|
|
3747
|
-
if (!pendingNavigation) return;
|
|
3748
|
-
const navigate = () => {
|
|
3749
|
-
setIsNavigating(true);
|
|
3750
|
-
onClose();
|
|
3751
|
-
window.location.href = pendingNavigation;
|
|
3752
|
-
};
|
|
3753
|
-
if (saveFirst && onSave) {
|
|
3754
|
-
onSave().then(navigate).catch(() => {
|
|
3755
|
-
setIsNavigating(false);
|
|
3756
|
-
});
|
|
3757
|
-
} else {
|
|
3758
|
-
navigate();
|
|
3759
|
-
}
|
|
3760
|
-
}, [pendingNavigation, onClose, onSave]);
|
|
3761
|
-
const handleCancelNavigation = useCallback(() => {
|
|
3762
|
-
setPendingNavigation(null);
|
|
3763
|
-
}, []);
|
|
3764
|
-
return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs(
|
|
3765
|
-
DialogContentFullscreen,
|
|
3766
|
-
{
|
|
3767
|
-
hideCloseButton: true,
|
|
3768
|
-
accessibleTitle: `Preview: ${pageTitle || "Page"}`,
|
|
3769
|
-
className: "p-0",
|
|
3770
|
-
children: [
|
|
3771
|
-
/* @__PURE__ */ jsxs("div", { className: "fixed top-1/2 right-4 -translate-y-1/2 z-[9998] flex flex-col gap-2 items-end", children: [
|
|
3772
|
-
/* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-lg border border-gray-200 p-2 flex flex-col gap-1", children: [
|
|
3773
|
-
/* @__PURE__ */ jsxs(
|
|
3774
|
-
"button",
|
|
3775
|
-
{
|
|
3776
|
-
type: "button",
|
|
3777
|
-
onClick: onClose,
|
|
3778
|
-
className: "flex items-center gap-2 px-3 py-2 text-sm font-medium text-white bg-gray-900 hover:bg-gray-800 rounded-md transition-colors",
|
|
3779
|
-
title: "Close preview (Esc)",
|
|
3780
|
-
children: [
|
|
3781
|
-
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
3782
|
-
"Close Preview"
|
|
3783
|
-
]
|
|
3784
|
-
}
|
|
3785
|
-
),
|
|
3786
|
-
onOpenInNewTab && /* @__PURE__ */ jsxs(
|
|
3787
|
-
"button",
|
|
3788
|
-
{
|
|
3789
|
-
type: "button",
|
|
3790
|
-
onClick: onOpenInNewTab,
|
|
3791
|
-
className: "flex items-center gap-2 px-3 py-2 text-sm text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-md transition-colors",
|
|
3792
|
-
title: "Open published page in new tab",
|
|
3793
|
-
children: [
|
|
3794
|
-
/* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4" }),
|
|
3795
|
-
"View Page"
|
|
3796
|
-
]
|
|
3797
|
-
}
|
|
3798
|
-
)
|
|
3799
|
-
] }),
|
|
3800
|
-
hasUnsavedChanges && /* @__PURE__ */ jsx("div", { className: "bg-amber-100 text-amber-700 px-3 py-1.5 rounded-full text-xs font-medium shadow-sm", children: "Unsaved changes" })
|
|
3801
|
-
] }),
|
|
3802
|
-
/* @__PURE__ */ jsx(
|
|
3803
|
-
"div",
|
|
3804
|
-
{
|
|
3805
|
-
className: "h-full overflow-auto bg-white",
|
|
3806
|
-
onClickCapture: handleContentClick,
|
|
3807
|
-
children: data ? /* @__PURE__ */ jsx(PageRenderer, { data, layouts }) : /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-full text-gray-500", children: "No content to preview" })
|
|
3808
|
-
}
|
|
3809
|
-
),
|
|
3810
|
-
pendingNavigation && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center bg-black/50", children: /* @__PURE__ */ jsxs(
|
|
3811
|
-
"div",
|
|
3812
|
-
{
|
|
3813
|
-
className: "bg-white rounded-lg shadow-xl max-w-md w-full mx-4 overflow-hidden",
|
|
3814
|
-
onClick: (e) => e.stopPropagation(),
|
|
3815
|
-
children: [
|
|
3816
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-5 py-4 border-b border-gray-200 bg-amber-50", children: [
|
|
3817
|
-
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 w-10 h-10 rounded-full bg-amber-100 flex items-center justify-center", children: /* @__PURE__ */ jsx(AlertTriangle, { className: "h-5 w-5 text-amber-600" }) }),
|
|
3818
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
3819
|
-
/* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-gray-900", children: "Navigate away?" }),
|
|
3820
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "This will close the preview" })
|
|
3821
|
-
] })
|
|
3822
|
-
] }),
|
|
3823
|
-
/* @__PURE__ */ jsxs("div", { className: "px-5 py-4", children: [
|
|
3824
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-700 mb-2", children: "You're about to navigate to:" }),
|
|
3825
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-mono bg-gray-100 px-3 py-2 rounded text-gray-800 break-all", children: pendingNavigation }),
|
|
3826
|
-
hasUnsavedChanges && /* @__PURE__ */ jsx("p", { className: "text-sm text-amber-600 mt-3 font-medium", children: "You have unsaved changes that will be lost." })
|
|
3827
|
-
] }),
|
|
3828
|
-
/* @__PURE__ */ jsxs("div", { className: "px-5 py-4 bg-gray-50 border-t border-gray-200 flex flex-col sm:flex-row gap-2 sm:justify-end", children: [
|
|
3829
|
-
/* @__PURE__ */ jsx(
|
|
3830
|
-
"button",
|
|
3831
|
-
{
|
|
3832
|
-
type: "button",
|
|
3833
|
-
onClick: handleCancelNavigation,
|
|
3834
|
-
disabled: isNavigating || isSaving,
|
|
3835
|
-
className: "px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors disabled:opacity-50",
|
|
3836
|
-
children: "Cancel"
|
|
3837
|
-
}
|
|
3838
|
-
),
|
|
3839
|
-
hasUnsavedChanges && onSave && /* @__PURE__ */ jsx(
|
|
3840
|
-
"button",
|
|
3841
|
-
{
|
|
3842
|
-
type: "button",
|
|
3843
|
-
onClick: () => handleNavigate(true),
|
|
3844
|
-
disabled: isNavigating || isSaving,
|
|
3845
|
-
className: "px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 transition-colors disabled:opacity-50",
|
|
3846
|
-
children: isSaving ? "Saving..." : "Save & Navigate"
|
|
3847
|
-
}
|
|
3848
|
-
),
|
|
3849
|
-
/* @__PURE__ */ jsx(
|
|
3850
|
-
"button",
|
|
3851
|
-
{
|
|
3852
|
-
type: "button",
|
|
3853
|
-
onClick: () => handleNavigate(false),
|
|
3854
|
-
disabled: isNavigating || isSaving,
|
|
3855
|
-
className: cn(
|
|
3856
|
-
"px-4 py-2 text-sm font-medium rounded-md transition-colors disabled:opacity-50",
|
|
3857
|
-
hasUnsavedChanges ? "text-red-700 bg-red-50 border border-red-200 hover:bg-red-100" : "text-white bg-gray-900 hover:bg-gray-800"
|
|
3858
|
-
),
|
|
3859
|
-
children: isNavigating ? "Navigating..." : hasUnsavedChanges ? "Navigate without saving" : "Navigate"
|
|
3860
|
-
}
|
|
3861
|
-
)
|
|
3862
|
-
] })
|
|
3863
|
-
]
|
|
3864
|
-
}
|
|
3865
|
-
) })
|
|
3866
|
-
]
|
|
3867
|
-
}
|
|
3868
|
-
) });
|
|
3869
|
-
});
|
|
3870
|
-
}
|
|
3871
|
-
});
|
|
3872
|
-
function useUnsavedChanges() {
|
|
3873
|
-
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
|
|
3874
|
-
const hasUnsavedChangesRef = useRef(hasUnsavedChanges);
|
|
3875
|
-
hasUnsavedChangesRef.current = hasUnsavedChanges;
|
|
3876
|
-
useEffect(() => {
|
|
3877
|
-
const handleBeforeUnload = (e) => {
|
|
3878
|
-
if (hasUnsavedChangesRef.current) {
|
|
3879
|
-
e.preventDefault();
|
|
3880
|
-
e.returnValue = "";
|
|
3881
|
-
}
|
|
3882
|
-
};
|
|
3883
|
-
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
3884
|
-
return () => window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
3885
|
-
}, []);
|
|
3886
|
-
const markClean = useCallback(() => {
|
|
3887
|
-
hasUnsavedChangesRef.current = false;
|
|
3888
|
-
setHasUnsavedChanges(false);
|
|
3889
|
-
}, []);
|
|
3890
|
-
const markDirty = useCallback(() => {
|
|
3891
|
-
hasUnsavedChangesRef.current = true;
|
|
3892
|
-
setHasUnsavedChanges(true);
|
|
3893
|
-
}, []);
|
|
3894
|
-
return {
|
|
3895
|
-
hasUnsavedChanges,
|
|
3896
|
-
markClean,
|
|
3897
|
-
markDirty
|
|
3898
|
-
};
|
|
3899
|
-
}
|
|
3900
|
-
var init_useUnsavedChanges = __esm({
|
|
3901
|
-
"src/editor/hooks/useUnsavedChanges.ts"() {
|
|
3902
|
-
"use client";
|
|
3903
|
-
}
|
|
3904
|
-
});
|
|
3905
|
-
function ThemeProvider({ children, theme }) {
|
|
3906
|
-
const resolvedTheme = useMemo(() => resolveTheme(theme), [theme]);
|
|
3907
|
-
const value = useMemo(
|
|
3908
|
-
() => ({
|
|
3909
|
-
theme: resolvedTheme
|
|
3910
|
-
}),
|
|
3911
|
-
[resolvedTheme]
|
|
3912
|
-
);
|
|
3913
|
-
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value, children });
|
|
3914
|
-
}
|
|
3915
|
-
var ThemeContext;
|
|
3916
|
-
var init_context = __esm({
|
|
3917
|
-
"src/theme/context.tsx"() {
|
|
3918
|
-
"use client";
|
|
3919
|
-
init_defaults2();
|
|
3920
|
-
init_utils3();
|
|
3921
|
-
ThemeContext = createContext(null);
|
|
3922
|
-
}
|
|
3923
|
-
});
|
|
3924
|
-
|
|
3925
|
-
// src/theme/example.ts
|
|
3926
|
-
var init_example = __esm({
|
|
3927
|
-
"src/theme/example.ts"() {
|
|
3928
|
-
}
|
|
3929
|
-
});
|
|
3930
|
-
|
|
3931
|
-
// src/theme/index.ts
|
|
3932
|
-
var init_theme = __esm({
|
|
3933
|
-
"src/theme/index.ts"() {
|
|
3934
|
-
init_context();
|
|
3935
|
-
init_defaults2();
|
|
3936
|
-
init_utils3();
|
|
3937
|
-
init_example();
|
|
3938
|
-
}
|
|
3939
|
-
});
|
|
3940
|
-
|
|
3941
|
-
// src/editor/PuckEditorCore.client.tsx
|
|
3942
|
-
var PuckEditorCore_client_exports = {};
|
|
3943
|
-
__export(PuckEditorCore_client_exports, {
|
|
3944
|
-
PuckEditorCore: () => PuckEditorCore
|
|
3945
|
-
});
|
|
3946
|
-
function PuckEditorCore({
|
|
3947
|
-
pageId,
|
|
3948
|
-
initialData,
|
|
3949
|
-
config,
|
|
3950
|
-
pageTitle,
|
|
3951
|
-
pageSlug,
|
|
3952
|
-
apiEndpoint = "/api/puck/pages",
|
|
3953
|
-
backUrl,
|
|
3954
|
-
previewUrl,
|
|
3955
|
-
enableViewports = true,
|
|
3956
|
-
plugins,
|
|
3957
|
-
layouts,
|
|
3958
|
-
layoutStyles,
|
|
3959
|
-
layoutKey = "pageLayout",
|
|
3960
|
-
headerActionsStart,
|
|
3961
|
-
headerActionsEnd,
|
|
3962
|
-
overrides: customOverrides,
|
|
3963
|
-
onSaveSuccess,
|
|
3964
|
-
onSaveError,
|
|
3965
|
-
onChange: onChangeProp,
|
|
3966
|
-
initialStatus,
|
|
3967
|
-
theme
|
|
3968
|
-
}) {
|
|
3969
|
-
const router = useRouter();
|
|
3970
|
-
const [isSaving, setIsSaving] = useState(false);
|
|
3971
|
-
const [lastSaved, setLastSaved] = useState(null);
|
|
3972
|
-
const [saveError, setSaveError] = useState(null);
|
|
3973
|
-
const [documentStatus, setDocumentStatus] = useState(initialStatus);
|
|
3974
|
-
const [wasPublished, setWasPublished] = useState(initialStatus === "published");
|
|
3975
|
-
const { hasUnsavedChanges, markClean, markDirty } = useUnsavedChanges();
|
|
3976
|
-
const [isPreviewOpen, setIsPreviewOpen] = useState(false);
|
|
3977
|
-
const dataWithSlug = useMemo(() => {
|
|
3978
|
-
const data = initialData;
|
|
3979
|
-
return {
|
|
3980
|
-
...data,
|
|
3981
|
-
root: {
|
|
3982
|
-
...data.root,
|
|
3983
|
-
props: {
|
|
3984
|
-
...data.root?.props,
|
|
3985
|
-
slug: data.root?.props?.slug || pageSlug
|
|
3986
|
-
}
|
|
3987
|
-
}
|
|
3988
|
-
};
|
|
3989
|
-
}, [initialData, pageSlug]);
|
|
3990
|
-
const latestDataRef = useRef(dataWithSlug);
|
|
3991
|
-
const handleSave = useCallback(
|
|
3992
|
-
async (data) => {
|
|
3993
|
-
setIsSaving(true);
|
|
3994
|
-
const typedData = data;
|
|
3995
|
-
try {
|
|
3996
|
-
const response = await fetch(`${apiEndpoint}/${pageId}`, {
|
|
3997
|
-
method: "PATCH",
|
|
3998
|
-
headers: { "Content-Type": "application/json" },
|
|
3999
|
-
body: JSON.stringify({
|
|
4000
|
-
puckData: data,
|
|
4001
|
-
title: typedData.root?.props?.title || pageTitle,
|
|
4002
|
-
slug: typedData.root?.props?.slug || pageSlug,
|
|
4003
|
-
draft: true
|
|
4004
|
-
// Save as draft, don't publish
|
|
4005
|
-
})
|
|
4006
|
-
});
|
|
4007
|
-
if (!response.ok) {
|
|
4008
|
-
const errorData = await response.json();
|
|
4009
|
-
const errorMessage = errorData.error || errorData.message || "Failed to save page";
|
|
4010
|
-
const err = new Error(errorMessage);
|
|
4011
|
-
err.field = errorData.field;
|
|
4012
|
-
err.details = errorData.details;
|
|
4013
|
-
throw err;
|
|
4014
|
-
}
|
|
4015
|
-
setLastSaved(/* @__PURE__ */ new Date());
|
|
4016
|
-
setSaveError(null);
|
|
4017
|
-
setDocumentStatus("draft");
|
|
4018
|
-
markClean();
|
|
4019
|
-
onSaveSuccess?.(data);
|
|
4020
|
-
} catch (error) {
|
|
4021
|
-
console.error("Error saving page:", error);
|
|
4022
|
-
setSaveError(error instanceof Error ? error.message : "Unknown error");
|
|
4023
|
-
onSaveError?.(error instanceof Error ? error : new Error("Unknown error"));
|
|
4024
|
-
} finally {
|
|
4025
|
-
setIsSaving(false);
|
|
4026
|
-
}
|
|
4027
|
-
},
|
|
4028
|
-
[apiEndpoint, pageId, pageTitle, pageSlug, markClean, onSaveSuccess, onSaveError]
|
|
4029
|
-
);
|
|
4030
|
-
const handlePublish = useCallback(
|
|
4031
|
-
async (data) => {
|
|
4032
|
-
setIsSaving(true);
|
|
4033
|
-
const typedData = data;
|
|
4034
|
-
try {
|
|
4035
|
-
const response = await fetch(`${apiEndpoint}/${pageId}`, {
|
|
4036
|
-
method: "PATCH",
|
|
4037
|
-
headers: { "Content-Type": "application/json" },
|
|
4038
|
-
body: JSON.stringify({
|
|
4039
|
-
puckData: data,
|
|
4040
|
-
title: typedData.root?.props?.title || pageTitle,
|
|
4041
|
-
slug: typedData.root?.props?.slug || pageSlug,
|
|
4042
|
-
status: "published"
|
|
4043
|
-
})
|
|
4044
|
-
});
|
|
4045
|
-
if (!response.ok) {
|
|
4046
|
-
const errorData = await response.json();
|
|
4047
|
-
const errorMessage = errorData.error || errorData.message || "Failed to publish page";
|
|
4048
|
-
const err = new Error(errorMessage);
|
|
4049
|
-
err.field = errorData.field;
|
|
4050
|
-
err.details = errorData.details;
|
|
4051
|
-
throw err;
|
|
4052
|
-
}
|
|
4053
|
-
setLastSaved(/* @__PURE__ */ new Date());
|
|
4054
|
-
setSaveError(null);
|
|
4055
|
-
setDocumentStatus("published");
|
|
4056
|
-
setWasPublished(true);
|
|
4057
|
-
markClean();
|
|
4058
|
-
onSaveSuccess?.(data);
|
|
4059
|
-
} catch (error) {
|
|
4060
|
-
console.error("Error publishing page:", error);
|
|
4061
|
-
setSaveError(error instanceof Error ? error.message : "Unknown error");
|
|
4062
|
-
onSaveError?.(error instanceof Error ? error : new Error("Unknown error"));
|
|
4063
|
-
} finally {
|
|
4064
|
-
setIsSaving(false);
|
|
4065
|
-
}
|
|
4066
|
-
},
|
|
4067
|
-
[apiEndpoint, pageId, pageTitle, pageSlug, markClean, onSaveSuccess, onSaveError]
|
|
4068
|
-
);
|
|
4069
|
-
const handleChange = useCallback(
|
|
4070
|
-
(data) => {
|
|
4071
|
-
latestDataRef.current = data;
|
|
4072
|
-
markDirty();
|
|
4073
|
-
onChangeProp?.(data);
|
|
4074
|
-
},
|
|
4075
|
-
[markDirty, onChangeProp]
|
|
4076
|
-
);
|
|
4077
|
-
const handleBack = useCallback(() => {
|
|
4078
|
-
if (hasUnsavedChanges) {
|
|
4079
|
-
if (!confirm("You have unsaved changes. Are you sure you want to leave?")) {
|
|
4080
|
-
return;
|
|
4081
|
-
}
|
|
4082
|
-
}
|
|
4083
|
-
if (backUrl) {
|
|
4084
|
-
router.push(backUrl);
|
|
4085
|
-
} else {
|
|
4086
|
-
router.back();
|
|
4087
|
-
}
|
|
4088
|
-
}, [hasUnsavedChanges, router, backUrl]);
|
|
4089
|
-
const handlePreview = useCallback(() => {
|
|
4090
|
-
const currentSlug = latestDataRef.current?.root?.props?.slug || pageSlug;
|
|
4091
|
-
let url;
|
|
4092
|
-
if (typeof previewUrl === "function") {
|
|
4093
|
-
url = previewUrl(currentSlug);
|
|
4094
|
-
} else if (previewUrl) {
|
|
4095
|
-
url = previewUrl;
|
|
4096
|
-
} else {
|
|
4097
|
-
url = `/${currentSlug}`;
|
|
4098
|
-
}
|
|
4099
|
-
window.open(url, "_blank");
|
|
4100
|
-
}, [pageSlug, previewUrl]);
|
|
4101
|
-
const handleOpenPreview = useCallback(() => {
|
|
4102
|
-
setIsPreviewOpen(true);
|
|
4103
|
-
}, []);
|
|
4104
|
-
const handleSaveFromPreview = useCallback(async () => {
|
|
4105
|
-
const data = latestDataRef.current;
|
|
4106
|
-
setIsSaving(true);
|
|
4107
|
-
try {
|
|
4108
|
-
const response = await fetch(`${apiEndpoint}/${pageId}`, {
|
|
4109
|
-
method: "PATCH",
|
|
4110
|
-
headers: { "Content-Type": "application/json" },
|
|
4111
|
-
body: JSON.stringify({
|
|
4112
|
-
puckData: data,
|
|
4113
|
-
title: data?.root?.props?.title || pageTitle,
|
|
4114
|
-
slug: data?.root?.props?.slug || pageSlug,
|
|
4115
|
-
draft: true
|
|
4116
|
-
})
|
|
4117
|
-
});
|
|
4118
|
-
if (!response.ok) {
|
|
4119
|
-
const errorData = await response.json();
|
|
4120
|
-
const errorMessage = errorData.error || errorData.message || "Failed to save page";
|
|
4121
|
-
throw new Error(errorMessage);
|
|
4122
|
-
}
|
|
4123
|
-
setLastSaved(/* @__PURE__ */ new Date());
|
|
4124
|
-
setSaveError(null);
|
|
4125
|
-
setDocumentStatus("draft");
|
|
4126
|
-
markClean();
|
|
4127
|
-
onSaveSuccess?.(data);
|
|
4128
|
-
} catch (error) {
|
|
4129
|
-
console.error("Error saving page:", error);
|
|
4130
|
-
setSaveError(error instanceof Error ? error.message : "Unknown error");
|
|
4131
|
-
onSaveError?.(error instanceof Error ? error : new Error("Unknown error"));
|
|
4132
|
-
throw error;
|
|
4133
|
-
} finally {
|
|
4134
|
-
setIsSaving(false);
|
|
4135
|
-
}
|
|
4136
|
-
}, [apiEndpoint, pageId, pageTitle, pageSlug, markClean, onSaveSuccess, onSaveError]);
|
|
4137
|
-
const overrides = useMemo(
|
|
4138
|
-
() => ({
|
|
4139
|
-
headerActions: ({ children }) => /* @__PURE__ */ jsx(
|
|
4140
|
-
HeaderActions,
|
|
4141
|
-
{
|
|
4142
|
-
onBack: handleBack,
|
|
4143
|
-
onPreview: handlePreview,
|
|
4144
|
-
onSave: handleSave,
|
|
4145
|
-
onPublish: handlePublish,
|
|
4146
|
-
onOpenPreview: handleOpenPreview,
|
|
4147
|
-
isSaving,
|
|
4148
|
-
hasUnsavedChanges,
|
|
4149
|
-
lastSaved,
|
|
4150
|
-
documentStatus,
|
|
4151
|
-
wasPublished,
|
|
4152
|
-
actionsStart: headerActionsStart,
|
|
4153
|
-
actionsEnd: headerActionsEnd,
|
|
4154
|
-
pageId,
|
|
4155
|
-
apiEndpoint,
|
|
4156
|
-
saveError,
|
|
4157
|
-
onDismissError: () => setSaveError(null),
|
|
4158
|
-
children
|
|
4159
|
-
}
|
|
4160
|
-
),
|
|
4161
|
-
// Always wrap iframe for richtext styles injection and theme-aware background
|
|
4162
|
-
iframe: ({ children, document: document2 }) => /* @__PURE__ */ jsx(IframeWrapper, { document: document2, layouts, layoutStyles, layoutKey, children }),
|
|
4163
|
-
// Merge custom overrides
|
|
4164
|
-
...customOverrides
|
|
4165
|
-
}),
|
|
4166
|
-
[
|
|
4167
|
-
handleBack,
|
|
4168
|
-
handlePreview,
|
|
4169
|
-
handleSave,
|
|
4170
|
-
handlePublish,
|
|
4171
|
-
handleOpenPreview,
|
|
4172
|
-
isSaving,
|
|
4173
|
-
hasUnsavedChanges,
|
|
4174
|
-
lastSaved,
|
|
4175
|
-
saveError,
|
|
4176
|
-
documentStatus,
|
|
4177
|
-
wasPublished,
|
|
4178
|
-
headerActionsStart,
|
|
4179
|
-
headerActionsEnd,
|
|
4180
|
-
pageId,
|
|
4181
|
-
apiEndpoint,
|
|
4182
|
-
layouts,
|
|
4183
|
-
layoutStyles,
|
|
4184
|
-
layoutKey,
|
|
4185
|
-
customOverrides
|
|
4186
|
-
]
|
|
4187
|
-
);
|
|
4188
|
-
const defaultPlugins = [headingAnalyzer];
|
|
4189
|
-
const resolvedPlugins = useMemo(() => {
|
|
4190
|
-
if (plugins === false) return void 0;
|
|
4191
|
-
if (!plugins || plugins.length === 0) return defaultPlugins;
|
|
4192
|
-
return [...defaultPlugins, ...plugins];
|
|
4193
|
-
}, [plugins]);
|
|
4194
|
-
const editorContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4195
|
-
/* @__PURE__ */ jsx("div", { className: "h-screen", children: /* @__PURE__ */ jsx(
|
|
4196
|
-
Puck,
|
|
4197
|
-
{
|
|
4198
|
-
config,
|
|
4199
|
-
data: dataWithSlug,
|
|
4200
|
-
onChange: handleChange,
|
|
4201
|
-
onPublish: handlePublish,
|
|
4202
|
-
headerTitle: `${pageTitle} /${pageSlug}`,
|
|
4203
|
-
plugins: resolvedPlugins,
|
|
4204
|
-
viewports: enableViewports ? DEFAULT_VIEWPORTS : void 0,
|
|
4205
|
-
overrides
|
|
4206
|
-
}
|
|
4207
|
-
) }),
|
|
4208
|
-
/* @__PURE__ */ jsx(
|
|
4209
|
-
PreviewModal,
|
|
4210
|
-
{
|
|
4211
|
-
isOpen: isPreviewOpen,
|
|
4212
|
-
onClose: () => setIsPreviewOpen(false),
|
|
4213
|
-
data: latestDataRef.current,
|
|
4214
|
-
pageTitle,
|
|
4215
|
-
onOpenInNewTab: handlePreview,
|
|
4216
|
-
layouts,
|
|
4217
|
-
hasUnsavedChanges,
|
|
4218
|
-
onSave: handleSaveFromPreview,
|
|
4219
|
-
isSaving
|
|
4220
|
-
}
|
|
4221
|
-
)
|
|
4222
|
-
] });
|
|
4223
|
-
if (theme) {
|
|
4224
|
-
return /* @__PURE__ */ jsx(ThemeProvider, { theme, children: editorContent });
|
|
4225
|
-
}
|
|
4226
|
-
return editorContent;
|
|
4227
|
-
}
|
|
4228
|
-
var DEFAULT_VIEWPORTS;
|
|
4229
|
-
var init_PuckEditorCore_client = __esm({
|
|
4230
|
-
"src/editor/PuckEditorCore.client.tsx"() {
|
|
4231
|
-
"use client";
|
|
4232
|
-
init_HeaderActions();
|
|
4233
|
-
init_IframeWrapper();
|
|
4234
|
-
init_PreviewModal();
|
|
4235
|
-
init_useUnsavedChanges();
|
|
4236
|
-
init_theme();
|
|
4237
|
-
DEFAULT_VIEWPORTS = [
|
|
4238
|
-
{
|
|
4239
|
-
width: 360,
|
|
4240
|
-
height: "auto",
|
|
4241
|
-
label: "Mobile",
|
|
4242
|
-
icon: "Smartphone"
|
|
4243
|
-
},
|
|
4244
|
-
{
|
|
4245
|
-
width: 768,
|
|
4246
|
-
height: "auto",
|
|
4247
|
-
label: "Tablet",
|
|
4248
|
-
icon: "Tablet"
|
|
4249
|
-
},
|
|
4250
|
-
{
|
|
4251
|
-
width: 1280,
|
|
4252
|
-
height: "auto",
|
|
4253
|
-
label: "Desktop",
|
|
4254
|
-
icon: "Monitor"
|
|
4255
|
-
}
|
|
4256
|
-
];
|
|
4257
|
-
}
|
|
4258
|
-
});
|
|
4259
|
-
|
|
4260
|
-
// src/editor/PuckEditor.client.tsx
|
|
4261
|
-
var PuckEditor_client_exports = {};
|
|
4262
|
-
__export(PuckEditor_client_exports, {
|
|
4263
|
-
PuckEditor: () => PuckEditor
|
|
4264
|
-
});
|
|
4265
|
-
function PuckEditor({
|
|
4266
|
-
pageId,
|
|
4267
|
-
initialData,
|
|
4268
|
-
config,
|
|
4269
|
-
pageTitle,
|
|
4270
|
-
pageSlug,
|
|
4271
|
-
apiEndpoint,
|
|
4272
|
-
backUrl,
|
|
4273
|
-
previewUrl,
|
|
4274
|
-
enableViewports,
|
|
4275
|
-
plugins,
|
|
4276
|
-
layouts,
|
|
4277
|
-
layoutStyles,
|
|
4278
|
-
layoutKey,
|
|
4279
|
-
headerActionsStart,
|
|
4280
|
-
headerActionsEnd,
|
|
4281
|
-
overrides,
|
|
4282
|
-
onSaveSuccess,
|
|
4283
|
-
onSaveError,
|
|
4284
|
-
onChange,
|
|
4285
|
-
initialStatus,
|
|
4286
|
-
theme
|
|
4287
|
-
}) {
|
|
4288
|
-
return /* @__PURE__ */ jsx(
|
|
4289
|
-
PuckEditorCore2,
|
|
4290
|
-
{
|
|
4291
|
-
pageId,
|
|
4292
|
-
initialData,
|
|
4293
|
-
config,
|
|
4294
|
-
pageTitle,
|
|
4295
|
-
pageSlug,
|
|
4296
|
-
apiEndpoint,
|
|
4297
|
-
backUrl,
|
|
4298
|
-
previewUrl,
|
|
4299
|
-
enableViewports,
|
|
4300
|
-
plugins,
|
|
4301
|
-
layouts,
|
|
4302
|
-
layoutStyles,
|
|
4303
|
-
layoutKey,
|
|
4304
|
-
headerActionsStart,
|
|
4305
|
-
headerActionsEnd,
|
|
4306
|
-
overrides,
|
|
4307
|
-
onSaveSuccess,
|
|
4308
|
-
onSaveError,
|
|
4309
|
-
onChange,
|
|
4310
|
-
initialStatus,
|
|
4311
|
-
theme
|
|
4312
|
-
}
|
|
4313
|
-
);
|
|
4314
|
-
}
|
|
4315
|
-
var PuckEditorCore2;
|
|
4316
|
-
var init_PuckEditor_client = __esm({
|
|
4317
|
-
"src/editor/PuckEditor.client.tsx"() {
|
|
4318
|
-
"use client";
|
|
4319
|
-
init_LoadingState();
|
|
4320
|
-
PuckEditorCore2 = dynamic(
|
|
4321
|
-
() => Promise.resolve().then(() => (init_PuckEditorCore_client(), PuckEditorCore_client_exports)).then((mod) => mod.PuckEditorCore),
|
|
4322
|
-
{
|
|
4323
|
-
ssr: false,
|
|
4324
|
-
loading: () => /* @__PURE__ */ jsx(LoadingState, {})
|
|
4325
|
-
}
|
|
4326
|
-
);
|
|
4327
|
-
}
|
|
4328
|
-
});
|
|
4329
|
-
|
|
4330
|
-
// src/editor/index.ts
|
|
4331
|
-
init_PuckEditor_client();
|
|
4332
|
-
init_PuckEditorCore_client();
|
|
4333
|
-
function PuckEditorView({
|
|
4334
|
-
config,
|
|
4335
|
-
collectionSlug = "pages",
|
|
4336
|
-
apiBasePath = "/api/puck",
|
|
4337
|
-
backUrl,
|
|
4338
|
-
previewUrl,
|
|
4339
|
-
layoutStyles,
|
|
4340
|
-
layoutKey = "pageLayout",
|
|
4341
|
-
plugins,
|
|
4342
|
-
onSaveSuccess,
|
|
4343
|
-
onSaveError
|
|
4344
|
-
}) {
|
|
4345
|
-
const params = useParams();
|
|
4346
|
-
const searchParams = useSearchParams();
|
|
4347
|
-
const pageId = params?.id || searchParams?.get("id") || "";
|
|
4348
|
-
const [page, setPage] = useState(null);
|
|
4349
|
-
const [loading, setLoading] = useState(true);
|
|
4350
|
-
const [error, setError] = useState(null);
|
|
4351
|
-
const [PuckEditor2, setPuckEditor] = useState(null);
|
|
4352
|
-
useEffect(() => {
|
|
4353
|
-
Promise.resolve().then(() => (init_PuckEditor_client(), PuckEditor_client_exports)).then((mod) => {
|
|
4354
|
-
setPuckEditor(() => mod.PuckEditor);
|
|
4355
|
-
});
|
|
4356
|
-
}, []);
|
|
4357
|
-
useEffect(() => {
|
|
4358
|
-
async function fetchPage() {
|
|
4359
|
-
if (!pageId) {
|
|
4360
|
-
setError("No page ID provided");
|
|
4361
|
-
setLoading(false);
|
|
4362
|
-
return;
|
|
4363
|
-
}
|
|
4364
|
-
try {
|
|
4365
|
-
setLoading(true);
|
|
4366
|
-
const response = await fetch(`${apiBasePath}/${collectionSlug}/${pageId}`);
|
|
4367
|
-
if (!response.ok) {
|
|
4368
|
-
const data2 = await response.json().catch(() => ({}));
|
|
4369
|
-
throw new Error(data2.error || `Failed to fetch page: ${response.status}`);
|
|
4370
|
-
}
|
|
4371
|
-
const data = await response.json();
|
|
4372
|
-
setPage(data.doc);
|
|
4373
|
-
} catch (err) {
|
|
4374
|
-
setError(err instanceof Error ? err.message : "An error occurred");
|
|
4375
|
-
} finally {
|
|
4376
|
-
setLoading(false);
|
|
4377
|
-
}
|
|
4378
|
-
}
|
|
4379
|
-
fetchPage();
|
|
4380
|
-
}, [pageId, apiBasePath, collectionSlug]);
|
|
4381
|
-
const computedBackUrl = backUrl || `/admin/collections/${collectionSlug}`;
|
|
4382
|
-
if (loading || !PuckEditor2) {
|
|
4383
|
-
return /* @__PURE__ */ jsx("div", { style: {
|
|
4384
|
-
display: "flex",
|
|
4385
|
-
height: "100vh",
|
|
4386
|
-
alignItems: "center",
|
|
4387
|
-
justifyContent: "center",
|
|
4388
|
-
backgroundColor: "#0f0f0f",
|
|
4389
|
-
color: "#fff"
|
|
4390
|
-
}, children: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
4391
|
-
/* @__PURE__ */ jsx("div", { style: {
|
|
4392
|
-
width: "32px",
|
|
4393
|
-
height: "32px",
|
|
4394
|
-
border: "3px solid #333",
|
|
4395
|
-
borderTopColor: "#fff",
|
|
4396
|
-
borderRadius: "50%",
|
|
4397
|
-
animation: "spin 1s linear infinite",
|
|
4398
|
-
margin: "0 auto 16px"
|
|
4399
|
-
} }),
|
|
4400
|
-
/* @__PURE__ */ jsx("p", { style: { color: "#888" }, children: "Loading editor..." }),
|
|
4401
|
-
/* @__PURE__ */ jsx("style", { children: `
|
|
4402
|
-
@keyframes spin {
|
|
4403
|
-
to { transform: rotate(360deg); }
|
|
4404
|
-
}
|
|
4405
|
-
` })
|
|
4406
|
-
] }) });
|
|
4407
|
-
}
|
|
4408
|
-
if (error) {
|
|
4409
|
-
return /* @__PURE__ */ jsx("div", { style: {
|
|
4410
|
-
display: "flex",
|
|
4411
|
-
height: "100vh",
|
|
4412
|
-
alignItems: "center",
|
|
4413
|
-
justifyContent: "center",
|
|
4414
|
-
backgroundColor: "#0f0f0f",
|
|
4415
|
-
color: "#fff"
|
|
4416
|
-
}, children: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
4417
|
-
/* @__PURE__ */ jsx("p", { style: { color: "#f87171", marginBottom: "16px" }, children: error }),
|
|
4418
|
-
/* @__PURE__ */ jsxs(
|
|
4419
|
-
"a",
|
|
4420
|
-
{
|
|
4421
|
-
href: computedBackUrl,
|
|
4422
|
-
style: {
|
|
4423
|
-
color: "#60a5fa",
|
|
4424
|
-
textDecoration: "underline"
|
|
4425
|
-
},
|
|
4426
|
-
children: [
|
|
4427
|
-
"Back to ",
|
|
4428
|
-
collectionSlug
|
|
4429
|
-
]
|
|
4430
|
-
}
|
|
4431
|
-
)
|
|
4432
|
-
] }) });
|
|
4433
|
-
}
|
|
4434
|
-
if (!page) {
|
|
4435
|
-
return /* @__PURE__ */ jsx("div", { style: {
|
|
4436
|
-
display: "flex",
|
|
4437
|
-
height: "100vh",
|
|
4438
|
-
alignItems: "center",
|
|
4439
|
-
justifyContent: "center",
|
|
4440
|
-
backgroundColor: "#0f0f0f",
|
|
4441
|
-
color: "#fff"
|
|
4442
|
-
}, children: /* @__PURE__ */ jsxs("div", { style: { textAlign: "center" }, children: [
|
|
4443
|
-
/* @__PURE__ */ jsx("p", { style: { color: "#888", marginBottom: "16px" }, children: "Page not found" }),
|
|
4444
|
-
/* @__PURE__ */ jsxs(
|
|
4445
|
-
"a",
|
|
4446
|
-
{
|
|
4447
|
-
href: computedBackUrl,
|
|
4448
|
-
style: {
|
|
4449
|
-
color: "#60a5fa",
|
|
4450
|
-
textDecoration: "underline"
|
|
4451
|
-
},
|
|
4452
|
-
children: [
|
|
4453
|
-
"Back to ",
|
|
4454
|
-
collectionSlug
|
|
4455
|
-
]
|
|
4456
|
-
}
|
|
4457
|
-
)
|
|
4458
|
-
] }) });
|
|
4459
|
-
}
|
|
4460
|
-
const initialData = page.puckData || {
|
|
4461
|
-
root: {
|
|
4462
|
-
props: {
|
|
4463
|
-
title: page.title || "New Page"
|
|
4464
|
-
}
|
|
4465
|
-
},
|
|
4466
|
-
content: [],
|
|
4467
|
-
zones: {}
|
|
4468
|
-
};
|
|
4469
|
-
return /* @__PURE__ */ jsx(
|
|
4470
|
-
PuckEditor2,
|
|
4471
|
-
{
|
|
4472
|
-
pageId: page.id,
|
|
4473
|
-
initialData,
|
|
4474
|
-
config,
|
|
4475
|
-
pageTitle: page.title,
|
|
4476
|
-
pageSlug: page.slug,
|
|
4477
|
-
apiEndpoint: `${apiBasePath}/${collectionSlug}`,
|
|
4478
|
-
backUrl: computedBackUrl,
|
|
4479
|
-
previewUrl,
|
|
4480
|
-
layoutStyles,
|
|
4481
|
-
layoutKey,
|
|
4482
|
-
plugins,
|
|
4483
|
-
onSaveSuccess,
|
|
4484
|
-
onSaveError,
|
|
4485
|
-
initialStatus: page._status
|
|
4486
|
-
}
|
|
4487
|
-
);
|
|
4488
|
-
}
|
|
4489
|
-
|
|
4490
|
-
// src/editor/index.ts
|
|
4491
|
-
init_HeaderActions();
|
|
4492
|
-
init_IframeWrapper();
|
|
4493
|
-
init_LoadingState();
|
|
4494
|
-
init_PreviewModal();
|
|
4495
|
-
init_VersionHistory();
|
|
4496
|
-
init_useUnsavedChanges();
|
|
4497
|
-
|
|
4498
|
-
export { HeaderActions, IframeWrapper, LoadingState, PreviewModal, PuckEditor, PuckEditorCore, PuckEditorView, VersionHistory, useUnsavedChanges };
|
|
4499
|
-
//# sourceMappingURL=index.mjs.map
|
|
4500
|
-
//# sourceMappingURL=index.mjs.map
|