@delmaredigital/payload-puck 0.6.12 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -1
- package/dist/admin/EditWithPuckButton.d.ts +1 -1
- package/dist/admin/EditWithPuckButton.d.ts.map +1 -1
- package/dist/admin/EditWithPuckButton.js +65 -25
- package/dist/admin/EditWithPuckButton.js.map +1 -1
- package/dist/admin/EditWithPuckCell.js +43 -13
- package/dist/admin/EditWithPuckCell.js.map +1 -1
- package/dist/admin/PuckEditorView.d.ts +1 -1
- package/dist/admin/PuckEditorView.d.ts.map +1 -1
- package/dist/admin/PuckEditorView.js +118 -32
- package/dist/admin/PuckEditorView.js.map +1 -1
- package/dist/admin/client.d.ts +2 -2
- package/dist/admin/client.d.ts.map +1 -1
- package/dist/admin/client.js +4 -4
- package/dist/admin/client.js.map +1 -1
- package/dist/admin/generateAdminComponents.js +7 -7
- package/dist/admin/generateAdminComponents.js.map +1 -1
- package/dist/admin/index.d.ts +5 -5
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +3 -2
- package/dist/admin/index.js.map +1 -1
- package/dist/ai/collections/AiContext.js +56 -29
- package/dist/ai/collections/AiContext.js.map +1 -1
- package/dist/ai/collections/AiPrompts.js +24 -19
- package/dist/ai/collections/AiPrompts.js.map +1 -1
- package/dist/ai/createAiApiRoutes.js +28 -19
- package/dist/ai/createAiApiRoutes.js.map +1 -1
- package/dist/ai/createAiGenerate.js +7 -8
- package/dist/ai/createAiGenerate.js.map +1 -1
- package/dist/ai/createAiPlugin.js +7 -9
- package/dist/ai/createAiPlugin.js.map +1 -1
- package/dist/ai/hooks/useAiContext.js +50 -39
- package/dist/ai/hooks/useAiContext.js.map +1 -1
- package/dist/ai/hooks/useAiPrompts.js +33 -25
- package/dist/ai/hooks/useAiPrompts.js.map +1 -1
- package/dist/ai/index.js +9 -10
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/plugins/ContextEditorPanel.d.ts +1 -1
- package/dist/ai/plugins/ContextEditorPanel.d.ts.map +1 -1
- package/dist/ai/plugins/ContextEditorPanel.js +399 -107
- package/dist/ai/plugins/ContextEditorPanel.js.map +1 -1
- package/dist/ai/plugins/PromptEditorPanel.d.ts +1 -1
- package/dist/ai/plugins/PromptEditorPanel.d.ts.map +1 -1
- package/dist/ai/plugins/PromptEditorPanel.js +237 -51
- package/dist/ai/plugins/PromptEditorPanel.js.map +1 -1
- package/dist/ai/plugins/contextEditorPlugin.js +12 -5
- package/dist/ai/plugins/contextEditorPlugin.js.map +1 -1
- package/dist/ai/plugins/promptApiRoutes.js +119 -50
- package/dist/ai/plugins/promptApiRoutes.js.map +1 -1
- package/dist/ai/plugins/promptEditorPlugin.js +12 -5
- package/dist/ai/plugins/promptEditorPlugin.js.map +1 -1
- package/dist/ai/presets/componentAiDefaults.js +108 -83
- package/dist/ai/presets/componentAiDefaults.js.map +1 -1
- package/dist/ai/presets/index.js +12 -18
- package/dist/ai/presets/index.js.map +1 -1
- package/dist/ai/presets/instructions/interactive.js +85 -75
- package/dist/ai/presets/instructions/interactive.js.map +1 -1
- package/dist/ai/presets/instructions/layout.js +122 -117
- package/dist/ai/presets/instructions/layout.js.map +1 -1
- package/dist/ai/presets/instructions/media.js +31 -29
- package/dist/ai/presets/instructions/media.js.map +1 -1
- package/dist/ai/presets/instructions/pagePatterns.js +4 -6
- package/dist/ai/presets/instructions/pagePatterns.js.map +1 -1
- package/dist/ai/presets/instructions/schemas.js +495 -137
- package/dist/ai/presets/instructions/schemas.js.map +1 -1
- package/dist/ai/presets/instructions/typography.js +38 -33
- package/dist/ai/presets/instructions/typography.js.map +1 -1
- package/dist/ai/tools/index.js +92 -55
- package/dist/ai/tools/index.js.map +1 -1
- package/dist/ai/types.js +7 -1
- package/dist/ai/types.js.map +1 -1
- package/dist/ai/utils/injectAiConfig.js +33 -40
- package/dist/ai/utils/injectAiConfig.js.map +1 -1
- package/dist/api/createPuckApiRoutes.d.ts +1 -1
- package/dist/api/createPuckApiRoutes.d.ts.map +1 -1
- package/dist/api/createPuckApiRoutes.js +123 -65
- package/dist/api/createPuckApiRoutes.js.map +1 -1
- package/dist/api/createPuckApiRoutesVersions.d.ts +1 -1
- package/dist/api/createPuckApiRoutesVersions.d.ts.map +1 -1
- package/dist/api/createPuckApiRoutesVersions.js +88 -37
- package/dist/api/createPuckApiRoutesVersions.js.map +1 -1
- package/dist/api/createPuckApiRoutesWithId.d.ts +1 -1
- package/dist/api/createPuckApiRoutesWithId.d.ts.map +1 -1
- package/dist/api/createPuckApiRoutesWithId.js +166 -72
- package/dist/api/createPuckApiRoutesWithId.js.map +1 -1
- package/dist/api/index.d.ts +5 -5
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +6 -6
- package/dist/api/index.js.map +1 -1
- package/dist/api/payload-config.d.js +15 -0
- package/dist/api/payload-config.d.js.map +1 -0
- package/dist/api/types.js +4 -1
- package/dist/api/types.js.map +1 -1
- package/dist/api/utils/mapRootProps.d.ts +1 -1
- package/dist/api/utils/mapRootProps.d.ts.map +1 -1
- package/dist/api/utils/mapRootProps.js +77 -44
- package/dist/api/utils/mapRootProps.js.map +1 -1
- package/dist/collections/Templates.js +24 -20
- package/dist/collections/Templates.js.map +1 -1
- package/dist/components/AccordionClient.d.ts +2 -2
- package/dist/components/AccordionClient.d.ts.map +1 -1
- package/dist/components/AccordionClient.js +81 -22
- package/dist/components/AccordionClient.js.map +1 -1
- package/dist/components/AnimatedWrapper.d.ts +2 -2
- package/dist/components/AnimatedWrapper.d.ts.map +1 -1
- package/dist/components/AnimatedWrapper.js +31 -16
- package/dist/components/AnimatedWrapper.js.map +1 -1
- package/dist/components/exports.js +2 -2
- package/dist/components/exports.js.map +1 -1
- package/dist/components/index.d.ts +5 -5
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +7 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/interactive/Accordion.d.ts +1 -1
- package/dist/components/interactive/Accordion.d.ts.map +1 -1
- package/dist/components/interactive/Accordion.js +149 -55
- package/dist/components/interactive/Accordion.js.map +1 -1
- package/dist/components/interactive/Accordion.server.d.ts +1 -1
- package/dist/components/interactive/Accordion.server.d.ts.map +1 -1
- package/dist/components/interactive/Accordion.server.js +25 -7
- package/dist/components/interactive/Accordion.server.js.map +1 -1
- package/dist/components/interactive/Button.d.ts +3 -3
- package/dist/components/interactive/Button.d.ts.map +1 -1
- package/dist/components/interactive/Button.js +89 -43
- package/dist/components/interactive/Button.js.map +1 -1
- package/dist/components/interactive/Button.server.d.ts +2 -2
- package/dist/components/interactive/Button.server.d.ts.map +1 -1
- package/dist/components/interactive/Button.server.js +40 -20
- package/dist/components/interactive/Button.server.js.map +1 -1
- package/dist/components/interactive/Card.d.ts +3 -3
- package/dist/components/interactive/Card.d.ts.map +1 -1
- package/dist/components/interactive/Card.js +131 -39
- package/dist/components/interactive/Card.js.map +1 -1
- package/dist/components/interactive/Card.server.d.ts +3 -3
- package/dist/components/interactive/Card.server.d.ts.map +1 -1
- package/dist/components/interactive/Card.server.js +72 -11
- package/dist/components/interactive/Card.server.js.map +1 -1
- package/dist/components/interactive/Divider.d.ts +1 -1
- package/dist/components/interactive/Divider.d.ts.map +1 -1
- package/dist/components/interactive/Divider.js +54 -26
- package/dist/components/interactive/Divider.js.map +1 -1
- package/dist/components/interactive/Divider.server.d.ts +1 -1
- package/dist/components/interactive/Divider.server.d.ts.map +1 -1
- package/dist/components/interactive/Divider.server.js +28 -12
- package/dist/components/interactive/Divider.server.js.map +1 -1
- package/dist/components/interactive/index.d.ts +4 -4
- package/dist/components/interactive/index.d.ts.map +1 -1
- package/dist/components/interactive/index.js +5 -5
- package/dist/components/interactive/index.js.map +1 -1
- package/dist/components/layout/Container.d.ts +1 -1
- package/dist/components/layout/Container.d.ts.map +1 -1
- package/dist/components/layout/Container.js +101 -47
- package/dist/components/layout/Container.js.map +1 -1
- package/dist/components/layout/Container.server.d.ts +1 -1
- package/dist/components/layout/Container.server.d.ts.map +1 -1
- package/dist/components/layout/Container.server.js +67 -19
- package/dist/components/layout/Container.server.js.map +1 -1
- package/dist/components/layout/Flex.d.ts +2 -2
- package/dist/components/layout/Flex.d.ts.map +1 -1
- package/dist/components/layout/Flex.js +124 -55
- package/dist/components/layout/Flex.js.map +1 -1
- package/dist/components/layout/Flex.server.d.ts +1 -1
- package/dist/components/layout/Flex.server.d.ts.map +1 -1
- package/dist/components/layout/Flex.server.js +50 -14
- package/dist/components/layout/Flex.server.js.map +1 -1
- package/dist/components/layout/Grid.d.ts +1 -1
- package/dist/components/layout/Grid.d.ts.map +1 -1
- package/dist/components/layout/Grid.js +93 -44
- package/dist/components/layout/Grid.js.map +1 -1
- package/dist/components/layout/Grid.server.d.ts +1 -1
- package/dist/components/layout/Grid.server.d.ts.map +1 -1
- package/dist/components/layout/Grid.server.js +56 -14
- package/dist/components/layout/Grid.server.js.map +1 -1
- package/dist/components/layout/Section.d.ts +1 -1
- package/dist/components/layout/Section.d.ts.map +1 -1
- package/dist/components/layout/Section.js +147 -64
- package/dist/components/layout/Section.js.map +1 -1
- package/dist/components/layout/Section.server.d.ts +1 -1
- package/dist/components/layout/Section.server.d.ts.map +1 -1
- package/dist/components/layout/Section.server.js +92 -28
- package/dist/components/layout/Section.server.js.map +1 -1
- package/dist/components/layout/Spacer.d.ts +1 -1
- package/dist/components/layout/Spacer.d.ts.map +1 -1
- package/dist/components/layout/Spacer.js +80 -30
- package/dist/components/layout/Spacer.js.map +1 -1
- package/dist/components/layout/Spacer.server.d.ts +1 -1
- package/dist/components/layout/Spacer.server.d.ts.map +1 -1
- package/dist/components/layout/Spacer.server.js +31 -9
- package/dist/components/layout/Spacer.server.js.map +1 -1
- package/dist/components/layout/Template.d.ts +1 -1
- package/dist/components/layout/Template.d.ts.map +1 -1
- package/dist/components/layout/Template.js +58 -30
- package/dist/components/layout/Template.js.map +1 -1
- package/dist/components/layout/Template.server.d.ts +1 -1
- package/dist/components/layout/Template.server.d.ts.map +1 -1
- package/dist/components/layout/Template.server.js +43 -11
- package/dist/components/layout/Template.server.js.map +1 -1
- package/dist/components/layout/index.d.ts +8 -8
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +8 -8
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/media/Image.d.ts +3 -3
- package/dist/components/media/Image.d.ts.map +1 -1
- package/dist/components/media/Image.js +122 -39
- package/dist/components/media/Image.js.map +1 -1
- package/dist/components/media/Image.server.d.ts +3 -3
- package/dist/components/media/Image.server.d.ts.map +1 -1
- package/dist/components/media/Image.server.js +76 -13
- package/dist/components/media/Image.server.js.map +1 -1
- package/dist/components/media/index.d.ts +1 -1
- package/dist/components/media/index.d.ts.map +1 -1
- package/dist/components/media/index.js +2 -2
- package/dist/components/media/index.js.map +1 -1
- package/dist/components/typography/Heading.d.ts +2 -2
- package/dist/components/typography/Heading.d.ts.map +1 -1
- package/dist/components/typography/Heading.js +45 -25
- package/dist/components/typography/Heading.js.map +1 -1
- package/dist/components/typography/Heading.server.d.ts +2 -2
- package/dist/components/typography/Heading.server.d.ts.map +1 -1
- package/dist/components/typography/Heading.server.js +16 -10
- package/dist/components/typography/Heading.server.js.map +1 -1
- package/dist/components/typography/RichText.editor.d.ts +1 -1
- package/dist/components/typography/RichText.editor.d.ts.map +1 -1
- package/dist/components/typography/RichText.editor.js +44 -19
- package/dist/components/typography/RichText.editor.js.map +1 -1
- package/dist/components/typography/RichText.server.d.ts +2 -2
- package/dist/components/typography/RichText.server.d.ts.map +1 -1
- package/dist/components/typography/RichText.server.js +33 -14
- package/dist/components/typography/RichText.server.js.map +1 -1
- package/dist/components/typography/Text.d.ts +2 -2
- package/dist/components/typography/Text.d.ts.map +1 -1
- package/dist/components/typography/Text.js +49 -23
- package/dist/components/typography/Text.js.map +1 -1
- package/dist/components/typography/Text.server.d.ts +2 -2
- package/dist/components/typography/Text.server.d.ts.map +1 -1
- package/dist/components/typography/Text.server.js +21 -8
- package/dist/components/typography/Text.server.js.map +1 -1
- package/dist/components/typography/index.d.ts +4 -4
- package/dist/components/typography/index.d.ts.map +1 -1
- package/dist/components/typography/index.js +5 -5
- package/dist/components/typography/index.js.map +1 -1
- package/dist/config/config.editor.d.ts +3 -3
- package/dist/config/config.editor.d.ts.map +1 -1
- package/dist/config/config.editor.js +119 -54
- package/dist/config/config.editor.js.map +1 -1
- package/dist/config/index.d.ts +4 -4
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +62 -35
- package/dist/config/index.js.map +1 -1
- package/dist/config/merge.d.ts +1 -1
- package/dist/config/merge.d.ts.map +1 -1
- package/dist/config/merge.js +23 -26
- package/dist/config/merge.js.map +1 -1
- package/dist/config/presets.d.ts +4 -4
- package/dist/config/presets.js +195 -75
- package/dist/config/presets.js.map +1 -1
- package/dist/config/types.js +6 -2
- package/dist/config/types.js.map +1 -1
- package/dist/editor/PuckEditor.d.ts +4 -4
- package/dist/editor/PuckEditor.d.ts.map +1 -1
- package/dist/editor/PuckEditor.js +162 -70
- package/dist/editor/PuckEditor.js.map +1 -1
- package/dist/editor/PuckEditorImpl.client.d.ts +4 -4
- package/dist/editor/PuckEditorImpl.client.d.ts.map +1 -1
- package/dist/editor/PuckEditorImpl.client.js +304 -152
- package/dist/editor/PuckEditorImpl.client.js.map +1 -1
- package/dist/editor/components/DarkModeStyles.js +11 -12
- package/dist/editor/components/DarkModeStyles.js.map +1 -1
- package/dist/editor/components/HeaderActions.js +308 -64
- package/dist/editor/components/HeaderActions.js.map +1 -1
- package/dist/editor/components/IframeWrapper.d.ts +1 -1
- package/dist/editor/components/IframeWrapper.d.ts.map +1 -1
- package/dist/editor/components/IframeWrapper.js +82 -58
- package/dist/editor/components/IframeWrapper.js.map +1 -1
- package/dist/editor/components/LoadingState.d.ts +1 -1
- package/dist/editor/components/LoadingState.d.ts.map +1 -1
- package/dist/editor/components/LoadingState.js +17 -3
- package/dist/editor/components/LoadingState.js.map +1 -1
- package/dist/editor/components/PreviewModal.js +234 -78
- package/dist/editor/components/PreviewModal.js.map +1 -1
- package/dist/editor/components/PreviewModeToggle.js +43 -15
- package/dist/editor/components/PreviewModeToggle.js.map +1 -1
- package/dist/editor/components/VersionHistory.js +219 -71
- package/dist/editor/components/VersionHistory.js.map +1 -1
- package/dist/editor/hooks/useDarkMode.js +36 -23
- package/dist/editor/hooks/useDarkMode.js.map +1 -1
- package/dist/editor/hooks/useUnsavedChanges.js +8 -8
- package/dist/editor/hooks/useUnsavedChanges.js.map +1 -1
- package/dist/editor/index.js +5 -6
- package/dist/editor/index.js.map +1 -1
- package/dist/editor/plugins/VersionHistoryPanel.js +236 -75
- package/dist/editor/plugins/VersionHistoryPanel.js.map +1 -1
- package/dist/editor/plugins/index.js +4 -4
- package/dist/editor/plugins/index.js.map +1 -1
- package/dist/editor/plugins/versionHistoryPlugin.js +10 -8
- package/dist/editor/plugins/versionHistoryPlugin.js.map +1 -1
- package/dist/editor/utils/detectPageTree.js +5 -5
- package/dist/editor/utils/detectPageTree.js.map +1 -1
- package/dist/editor/utils/index.js +1 -0
- package/dist/editor/utils/index.js.map +1 -1
- package/dist/editor/utils/injectPageTreeFields.js +13 -9
- package/dist/editor/utils/injectPageTreeFields.js.map +1 -1
- package/dist/endpoints/ai.js +58 -34
- package/dist/endpoints/ai.js.map +1 -1
- package/dist/endpoints/context.js +86 -40
- package/dist/endpoints/context.js.map +1 -1
- package/dist/endpoints/index.js +153 -76
- package/dist/endpoints/index.js.map +1 -1
- package/dist/endpoints/postcss.d.js +5 -0
- package/dist/endpoints/postcss.d.js.map +1 -0
- package/dist/endpoints/prompts.js +81 -39
- package/dist/endpoints/prompts.js.map +1 -1
- package/dist/endpoints/styles.js +34 -36
- package/dist/endpoints/styles.js.map +1 -1
- package/dist/exports/client.js +2 -2
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/rsc.js +2 -2
- package/dist/exports/rsc.js.map +1 -1
- package/dist/fields/AlignmentField.d.ts +1 -1
- package/dist/fields/AlignmentField.d.ts.map +1 -1
- package/dist/fields/AlignmentField.js +93 -30
- package/dist/fields/AlignmentField.js.map +1 -1
- package/dist/fields/AnimationField.d.ts +2 -2
- package/dist/fields/AnimationField.d.ts.map +1 -1
- package/dist/fields/AnimationField.js +558 -84
- package/dist/fields/AnimationField.js.map +1 -1
- package/dist/fields/BackgroundField.d.ts +2 -2
- package/dist/fields/BackgroundField.d.ts.map +1 -1
- package/dist/fields/BackgroundField.js +754 -120
- package/dist/fields/BackgroundField.js.map +1 -1
- package/dist/fields/BorderField.d.ts +2 -2
- package/dist/fields/BorderField.d.ts.map +1 -1
- package/dist/fields/BorderField.js +275 -73
- package/dist/fields/BorderField.js.map +1 -1
- package/dist/fields/ColorPickerField.d.ts +2 -2
- package/dist/fields/ColorPickerField.d.ts.map +1 -1
- package/dist/fields/ColorPickerField.js +210 -68
- package/dist/fields/ColorPickerField.js.map +1 -1
- package/dist/fields/ContentAlignmentField.d.ts +1 -1
- package/dist/fields/ContentAlignmentField.d.ts.map +1 -1
- package/dist/fields/ContentAlignmentField.js +161 -75
- package/dist/fields/ContentAlignmentField.js.map +1 -1
- package/dist/fields/DimensionsField.d.ts +2 -2
- package/dist/fields/DimensionsField.d.ts.map +1 -1
- package/dist/fields/DimensionsField.js +575 -146
- package/dist/fields/DimensionsField.js.map +1 -1
- package/dist/fields/FlexAlignmentField.d.ts +2 -2
- package/dist/fields/FlexAlignmentField.d.ts.map +1 -1
- package/dist/fields/FlexAlignmentField.js +189 -51
- package/dist/fields/FlexAlignmentField.js.map +1 -1
- package/dist/fields/FolderPickerField.d.ts +8 -1
- package/dist/fields/FolderPickerField.d.ts.map +1 -1
- package/dist/fields/FolderPickerField.js +288 -75
- package/dist/fields/FolderPickerField.js.map +1 -1
- package/dist/fields/GradientEditor.d.ts +2 -2
- package/dist/fields/GradientEditor.d.ts.map +1 -1
- package/dist/fields/GradientEditor.js +462 -86
- package/dist/fields/GradientEditor.js.map +1 -1
- package/dist/fields/LockedField.d.ts +15 -2
- package/dist/fields/LockedField.d.ts.map +1 -1
- package/dist/fields/LockedField.js +180 -49
- package/dist/fields/LockedField.js.map +1 -1
- package/dist/fields/MarginField.d.ts +2 -2
- package/dist/fields/MarginField.d.ts.map +1 -1
- package/dist/fields/MarginField.js +144 -46
- package/dist/fields/MarginField.js.map +1 -1
- package/dist/fields/MediaField.d.ts +1 -1
- package/dist/fields/MediaField.d.ts.map +1 -1
- package/dist/fields/MediaField.js +688 -186
- package/dist/fields/MediaField.js.map +1 -1
- package/dist/fields/PaddingField.d.ts +2 -2
- package/dist/fields/PaddingField.d.ts.map +1 -1
- package/dist/fields/PaddingField.js +144 -46
- package/dist/fields/PaddingField.js.map +1 -1
- package/dist/fields/PageSegmentField.d.ts +15 -2
- package/dist/fields/PageSegmentField.d.ts.map +1 -1
- package/dist/fields/PageSegmentField.js +156 -54
- package/dist/fields/PageSegmentField.js.map +1 -1
- package/dist/fields/ResetField.d.ts +1 -1
- package/dist/fields/ResetField.d.ts.map +1 -1
- package/dist/fields/ResetField.js +59 -31
- package/dist/fields/ResetField.js.map +1 -1
- package/dist/fields/ResponsiveField.d.ts +1 -1
- package/dist/fields/ResponsiveField.d.ts.map +1 -1
- package/dist/fields/ResponsiveField.js +233 -90
- package/dist/fields/ResponsiveField.js.map +1 -1
- package/dist/fields/ResponsiveVisibilityField.d.ts +2 -2
- package/dist/fields/ResponsiveVisibilityField.d.ts.map +1 -1
- package/dist/fields/ResponsiveVisibilityField.js +119 -36
- package/dist/fields/ResponsiveVisibilityField.js.map +1 -1
- package/dist/fields/SizeField.d.ts +3 -3
- package/dist/fields/SizeField.d.ts.map +1 -1
- package/dist/fields/SizeField.js +226 -52
- package/dist/fields/SizeField.js.map +1 -1
- package/dist/fields/SlugPreviewField.d.ts +8 -1
- package/dist/fields/SlugPreviewField.d.ts.map +1 -1
- package/dist/fields/SlugPreviewField.js +65 -16
- package/dist/fields/SlugPreviewField.js.map +1 -1
- package/dist/fields/TemplateField.d.ts +1 -1
- package/dist/fields/TemplateField.d.ts.map +1 -1
- package/dist/fields/TemplateField.js +362 -120
- package/dist/fields/TemplateField.js.map +1 -1
- package/dist/fields/TransformField.d.ts +2 -2
- package/dist/fields/TransformField.d.ts.map +1 -1
- package/dist/fields/TransformField.js +517 -81
- package/dist/fields/TransformField.js.map +1 -1
- package/dist/fields/VerticalAlignmentField.d.ts +1 -1
- package/dist/fields/VerticalAlignmentField.d.ts.map +1 -1
- package/dist/fields/VerticalAlignmentField.js +93 -30
- package/dist/fields/VerticalAlignmentField.js.map +1 -1
- package/dist/fields/WidthField.d.ts +2 -2
- package/dist/fields/WidthField.d.ts.map +1 -1
- package/dist/fields/WidthField.js +278 -81
- package/dist/fields/WidthField.js.map +1 -1
- package/dist/fields/index.d.ts +41 -41
- package/dist/fields/index.d.ts.map +1 -1
- package/dist/fields/index.js +37 -43
- package/dist/fields/index.js.map +1 -1
- package/dist/fields/richtext/controls/ColorPickerControl.d.ts +13 -2
- package/dist/fields/richtext/controls/ColorPickerControl.d.ts.map +1 -1
- package/dist/fields/richtext/controls/ColorPickerControl.js +212 -47
- package/dist/fields/richtext/controls/ColorPickerControl.js.map +1 -1
- package/dist/fields/richtext/controls/DropdownPortal.d.ts +2 -2
- package/dist/fields/richtext/controls/DropdownPortal.d.ts.map +1 -1
- package/dist/fields/richtext/controls/DropdownPortal.js +36 -4
- package/dist/fields/richtext/controls/DropdownPortal.js.map +1 -1
- package/dist/fields/richtext/controls/FontSizeControl.d.ts +9 -1
- package/dist/fields/richtext/controls/FontSizeControl.d.ts.map +1 -1
- package/dist/fields/richtext/controls/FontSizeControl.js +109 -24
- package/dist/fields/richtext/controls/FontSizeControl.js.map +1 -1
- package/dist/fields/richtext/controls/HighlightControl.d.ts +12 -1
- package/dist/fields/richtext/controls/HighlightControl.d.ts.map +1 -1
- package/dist/fields/richtext/controls/HighlightControl.js +54 -17
- package/dist/fields/richtext/controls/HighlightControl.js.map +1 -1
- package/dist/fields/richtext/controls/index.d.ts +5 -5
- package/dist/fields/richtext/controls/index.d.ts.map +1 -1
- package/dist/fields/richtext/controls/index.js +8 -11
- package/dist/fields/richtext/controls/index.js.map +1 -1
- package/dist/fields/richtext/controls/shared.js +108 -63
- package/dist/fields/richtext/controls/shared.js.map +1 -1
- package/dist/fields/richtext/createRichTextField.d.ts +18 -4
- package/dist/fields/richtext/createRichTextField.d.ts.map +1 -1
- package/dist/fields/richtext/createRichTextField.js +113 -26
- package/dist/fields/richtext/createRichTextField.js.map +1 -1
- package/dist/fields/richtext/extensions/FontSize.js +26 -20
- package/dist/fields/richtext/extensions/FontSize.js.map +1 -1
- package/dist/fields/richtext/extensions/index.d.ts +1 -1
- package/dist/fields/richtext/extensions/index.d.ts.map +1 -1
- package/dist/fields/richtext/extensions/index.js +2 -2
- package/dist/fields/richtext/extensions/index.js.map +1 -1
- package/dist/fields/richtext/index.d.ts +6 -6
- package/dist/fields/richtext/index.d.ts.map +1 -1
- package/dist/fields/richtext/index.js +8 -8
- package/dist/fields/richtext/index.js.map +1 -1
- package/dist/fields/shared.d.ts +1 -1
- package/dist/fields/shared.d.ts.map +1 -1
- package/dist/fields/shared.js +915 -478
- package/dist/fields/shared.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useResponsiveStyles.d.ts +1 -1
- package/dist/hooks/useResponsiveStyles.d.ts.map +1 -1
- package/dist/hooks/useResponsiveStyles.js +36 -32
- package/dist/hooks/useResponsiveStyles.js.map +1 -1
- package/dist/hooks/useScrollAnimation.js +26 -24
- package/dist/hooks/useScrollAnimation.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/layouts/LayoutWrapper.d.ts +3 -3
- package/dist/layouts/LayoutWrapper.d.ts.map +1 -1
- package/dist/layouts/LayoutWrapper.js +115 -51
- package/dist/layouts/LayoutWrapper.js.map +1 -1
- package/dist/layouts/defaults.d.ts +1 -1
- package/dist/layouts/defaults.d.ts.map +1 -1
- package/dist/layouts/defaults.js +23 -31
- package/dist/layouts/defaults.js.map +1 -1
- package/dist/layouts/index.d.ts +4 -4
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +5 -4
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/types.js +4 -2
- package/dist/layouts/types.js.map +1 -1
- package/dist/layouts/utils.d.ts +1 -1
- package/dist/layouts/utils.d.ts.map +1 -1
- package/dist/layouts/utils.js +32 -40
- package/dist/layouts/utils.js.map +1 -1
- package/dist/next/index.js +31 -34
- package/dist/next/index.js.map +1 -1
- package/dist/plugin/collections/Pages.d.ts +2 -2
- package/dist/plugin/collections/Pages.d.ts.map +1 -1
- package/dist/plugin/collections/Pages.js +46 -43
- package/dist/plugin/collections/Pages.js.map +1 -1
- package/dist/plugin/fields/index.d.ts +3 -3
- package/dist/plugin/fields/index.d.ts.map +1 -1
- package/dist/plugin/fields/index.js +100 -78
- package/dist/plugin/fields/index.js.map +1 -1
- package/dist/plugin/fields/types.d.ts +1 -1
- package/dist/plugin/fields/types.d.ts.map +1 -1
- package/dist/plugin/fields/types.js +26 -2
- package/dist/plugin/fields/types.js.map +1 -1
- package/dist/plugin/hooks/index.d.ts +1 -1
- package/dist/plugin/hooks/index.d.ts.map +1 -1
- package/dist/plugin/hooks/index.js +2 -2
- package/dist/plugin/hooks/index.js.map +1 -1
- package/dist/plugin/hooks/isHomepageUnique.js +28 -19
- package/dist/plugin/hooks/isHomepageUnique.js.map +1 -1
- package/dist/plugin/index.d.ts +8 -8
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +190 -188
- package/dist/plugin/index.js.map +1 -1
- package/dist/render/HybridPageRenderer.d.ts +2 -2
- package/dist/render/HybridPageRenderer.d.ts.map +1 -1
- package/dist/render/HybridPageRenderer.js +58 -10
- package/dist/render/HybridPageRenderer.js.map +1 -1
- package/dist/render/PageRenderer.d.ts +2 -2
- package/dist/render/PageRenderer.d.ts.map +1 -1
- package/dist/render/PageRenderer.js +31 -14
- package/dist/render/PageRenderer.js.map +1 -1
- package/dist/render/PuckEditor.client.d.ts +1 -1
- package/dist/render/PuckEditor.client.d.ts.map +1 -1
- package/dist/render/PuckEditor.client.js +33 -16
- package/dist/render/PuckEditor.client.js.map +1 -1
- package/dist/render/index.d.ts +5 -5
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +5 -6
- package/dist/render/index.js.map +1 -1
- package/dist/styles/puck-dark-mode.css +101 -0
- package/dist/theme/context.d.ts +2 -2
- package/dist/theme/context.d.ts.map +1 -1
- package/dist/theme/context.js +21 -18
- package/dist/theme/context.js.map +1 -1
- package/dist/theme/defaults.d.ts +1 -1
- package/dist/theme/defaults.d.ts.map +1 -1
- package/dist/theme/defaults.js +83 -37
- package/dist/theme/defaults.js.map +1 -1
- package/dist/theme/example.d.ts +1 -1
- package/dist/theme/example.d.ts.map +1 -1
- package/dist/theme/example.js +68 -30
- package/dist/theme/example.js.map +1 -1
- package/dist/theme/index.d.ts +5 -5
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +6 -5
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/types.js +6 -2
- package/dist/theme/types.js.map +1 -1
- package/dist/theme/utils.d.ts +1 -1
- package/dist/theme/utils.d.ts.map +1 -1
- package/dist/theme/utils.js +24 -25
- package/dist/theme/utils.js.map +1 -1
- package/dist/types/index.d.ts +6 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +13 -22
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/migration.d.ts +1 -1
- package/dist/utils/migration.d.ts.map +1 -1
- package/dist/utils/migration.js +43 -49
- package/dist/utils/migration.js.map +1 -1
- package/dist/utils/validation.d.ts +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +36 -43
- package/dist/utils/validation.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -1
- package/dist/version.js.map +1 -1
- package/dist/views/PuckConfigContext.d.ts +1 -1
- package/dist/views/PuckConfigContext.d.ts.map +1 -1
- package/dist/views/PuckConfigContext.js +25 -10
- package/dist/views/PuckConfigContext.js.map +1 -1
- package/dist/views/PuckEditorView.d.ts +1 -1
- package/dist/views/PuckEditorView.d.ts.map +1 -1
- package/dist/views/PuckEditorView.js +106 -38
- package/dist/views/PuckEditorView.js.map +1 -1
- package/dist/views/index.js +2 -2
- package/dist/views/index.js.map +1 -1
- package/package.json +62 -42
package/dist/fields/shared.js
CHANGED
|
@@ -3,44 +3,34 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Reusable field configurations and CSS utility maps for Puck components.
|
|
5
5
|
* These ensure consistency across all components.
|
|
6
|
-
*/
|
|
7
|
-
// =============================================================================
|
|
6
|
+
*/ // =============================================================================
|
|
8
7
|
// Utility Functions
|
|
9
8
|
// =============================================================================
|
|
10
9
|
/**
|
|
11
10
|
* Combines class names, filtering out falsy values
|
|
12
11
|
* A simple alternative to clsx/classnames for bundling purposes
|
|
13
|
-
*/
|
|
14
|
-
export function cn(...classes) {
|
|
12
|
+
*/ export function cn(...classes) {
|
|
15
13
|
return classes.filter(Boolean).join(' ');
|
|
16
14
|
}
|
|
17
15
|
/**
|
|
18
16
|
* Type guard to detect legacy WidthValue format
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
if (!value || typeof value !== 'object')
|
|
22
|
-
return false;
|
|
17
|
+
*/ export function isLegacyWidthValue(value) {
|
|
18
|
+
if (!value || typeof value !== 'object') return false;
|
|
23
19
|
const v = value;
|
|
24
|
-
return
|
|
25
|
-
typeof v.unit === 'string' &&
|
|
26
|
-
typeof v.mode === 'string' &&
|
|
27
|
-
!('minWidth' in v) &&
|
|
28
|
-
!('minHeight' in v) &&
|
|
29
|
-
!('maxHeight' in v));
|
|
20
|
+
return typeof v.maxWidth === 'number' && typeof v.unit === 'string' && typeof v.mode === 'string' && !('minWidth' in v) && !('minHeight' in v) && !('maxHeight' in v);
|
|
30
21
|
}
|
|
31
22
|
/**
|
|
32
23
|
* Migrate legacy WidthValue to new DimensionsValue format
|
|
33
|
-
*/
|
|
34
|
-
export function migrateWidthValue(legacy) {
|
|
24
|
+
*/ export function migrateWidthValue(legacy) {
|
|
35
25
|
return {
|
|
36
26
|
mode: legacy.mode,
|
|
37
27
|
alignment: legacy.alignment,
|
|
38
28
|
maxWidth: {
|
|
39
29
|
value: legacy.maxWidth,
|
|
40
30
|
unit: legacy.unit,
|
|
41
|
-
enabled: true
|
|
31
|
+
enabled: true
|
|
42
32
|
},
|
|
43
|
-
advancedMode: false
|
|
33
|
+
advancedMode: false
|
|
44
34
|
};
|
|
45
35
|
}
|
|
46
36
|
// =============================================================================
|
|
@@ -50,10 +40,19 @@ export const visibilityField = {
|
|
|
50
40
|
type: 'select',
|
|
51
41
|
label: 'Visibility',
|
|
52
42
|
options: [
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
{
|
|
44
|
+
label: 'Always Visible',
|
|
45
|
+
value: 'always'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: 'Authenticated Users Only',
|
|
49
|
+
value: 'authenticatedOnly'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: 'Guests Only',
|
|
53
|
+
value: 'guestOnly'
|
|
54
|
+
}
|
|
55
|
+
]
|
|
57
56
|
};
|
|
58
57
|
// =============================================================================
|
|
59
58
|
// Button Style Field
|
|
@@ -62,12 +61,27 @@ export const buttonStyleField = {
|
|
|
62
61
|
type: 'select',
|
|
63
62
|
label: 'Button Style',
|
|
64
63
|
options: [
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
|
|
64
|
+
{
|
|
65
|
+
label: 'Primary',
|
|
66
|
+
value: 'primary'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: 'Secondary',
|
|
70
|
+
value: 'secondary'
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: 'Outline',
|
|
74
|
+
value: 'outline'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: 'Ghost',
|
|
78
|
+
value: 'ghost'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: 'Link',
|
|
82
|
+
value: 'link'
|
|
83
|
+
}
|
|
84
|
+
]
|
|
71
85
|
};
|
|
72
86
|
// =============================================================================
|
|
73
87
|
// Button Variant Field
|
|
@@ -76,13 +90,31 @@ export const buttonVariantField = {
|
|
|
76
90
|
type: 'select',
|
|
77
91
|
label: 'Button Variant',
|
|
78
92
|
options: [
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
{
|
|
94
|
+
label: 'Default',
|
|
95
|
+
value: 'default'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
label: 'Destructive',
|
|
99
|
+
value: 'destructive'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: 'Outline',
|
|
103
|
+
value: 'outline'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: 'Secondary',
|
|
107
|
+
value: 'secondary'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
label: 'Ghost',
|
|
111
|
+
value: 'ghost'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: 'Link',
|
|
115
|
+
value: 'link'
|
|
116
|
+
}
|
|
117
|
+
]
|
|
86
118
|
};
|
|
87
119
|
// =============================================================================
|
|
88
120
|
// Button Size Field
|
|
@@ -91,11 +123,23 @@ export const buttonSizeField = {
|
|
|
91
123
|
type: 'select',
|
|
92
124
|
label: 'Size',
|
|
93
125
|
options: [
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
126
|
+
{
|
|
127
|
+
label: 'Small',
|
|
128
|
+
value: 'sm'
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
label: 'Default',
|
|
132
|
+
value: 'default'
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
label: 'Large',
|
|
136
|
+
value: 'lg'
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
label: 'Icon',
|
|
140
|
+
value: 'icon'
|
|
141
|
+
}
|
|
142
|
+
]
|
|
99
143
|
};
|
|
100
144
|
// =============================================================================
|
|
101
145
|
// Background Color Field (Preset Palette)
|
|
@@ -104,14 +148,35 @@ export const backgroundColorField = {
|
|
|
104
148
|
type: 'select',
|
|
105
149
|
label: 'Background Color',
|
|
106
150
|
options: [
|
|
107
|
-
{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
151
|
+
{
|
|
152
|
+
label: 'None',
|
|
153
|
+
value: 'none'
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
label: 'Background',
|
|
157
|
+
value: 'background'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
label: 'Card',
|
|
161
|
+
value: 'card'
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
label: 'Muted',
|
|
165
|
+
value: 'muted'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
label: 'Primary',
|
|
169
|
+
value: 'primary'
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
label: 'Secondary',
|
|
173
|
+
value: 'secondary'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
label: 'Accent',
|
|
177
|
+
value: 'accent'
|
|
178
|
+
}
|
|
179
|
+
]
|
|
115
180
|
};
|
|
116
181
|
// =============================================================================
|
|
117
182
|
// Text Color Field (Preset Palette)
|
|
@@ -120,12 +185,27 @@ export const textColorField = {
|
|
|
120
185
|
type: 'select',
|
|
121
186
|
label: 'Text Color',
|
|
122
187
|
options: [
|
|
123
|
-
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
|
|
188
|
+
{
|
|
189
|
+
label: 'Theme (Auto)',
|
|
190
|
+
value: 'default'
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
label: 'Foreground',
|
|
194
|
+
value: 'foreground'
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: 'Muted',
|
|
198
|
+
value: 'muted-foreground'
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
label: 'Primary',
|
|
202
|
+
value: 'primary'
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
label: 'Secondary',
|
|
206
|
+
value: 'secondary-foreground'
|
|
207
|
+
}
|
|
208
|
+
]
|
|
129
209
|
};
|
|
130
210
|
// =============================================================================
|
|
131
211
|
// Gap/Spacing Field
|
|
@@ -134,14 +214,35 @@ export const gapField = {
|
|
|
134
214
|
type: 'select',
|
|
135
215
|
label: 'Gap',
|
|
136
216
|
options: [
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
217
|
+
{
|
|
218
|
+
label: 'None',
|
|
219
|
+
value: 'none'
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
label: 'Extra Small',
|
|
223
|
+
value: 'xs'
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
label: 'Small',
|
|
227
|
+
value: 'sm'
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
label: 'Medium',
|
|
231
|
+
value: 'md'
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
label: 'Large',
|
|
235
|
+
value: 'lg'
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
label: 'Extra Large',
|
|
239
|
+
value: 'xl'
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
label: '2XL',
|
|
243
|
+
value: '2xl'
|
|
244
|
+
}
|
|
245
|
+
]
|
|
145
246
|
};
|
|
146
247
|
// =============================================================================
|
|
147
248
|
// Shadow Field
|
|
@@ -150,13 +251,31 @@ export const shadowField = {
|
|
|
150
251
|
type: 'select',
|
|
151
252
|
label: 'Shadow',
|
|
152
253
|
options: [
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
254
|
+
{
|
|
255
|
+
label: 'None',
|
|
256
|
+
value: 'none'
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
label: 'Small',
|
|
260
|
+
value: 'sm'
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
label: 'Medium',
|
|
264
|
+
value: 'md'
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
label: 'Large',
|
|
268
|
+
value: 'lg'
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
label: 'Extra Large',
|
|
272
|
+
value: 'xl'
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
label: '2XL',
|
|
276
|
+
value: '2xl'
|
|
277
|
+
}
|
|
278
|
+
]
|
|
160
279
|
};
|
|
161
280
|
// =============================================================================
|
|
162
281
|
// Spacer Height Field
|
|
@@ -165,14 +284,35 @@ export const spacerHeightField = {
|
|
|
165
284
|
type: 'select',
|
|
166
285
|
label: 'Height',
|
|
167
286
|
options: [
|
|
168
|
-
{
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
287
|
+
{
|
|
288
|
+
label: 'Extra Small (8px)',
|
|
289
|
+
value: 'xs'
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
label: 'Small (16px)',
|
|
293
|
+
value: 'sm'
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
label: 'Medium (32px)',
|
|
297
|
+
value: 'md'
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
label: 'Large (48px)',
|
|
301
|
+
value: 'lg'
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
label: 'Extra Large (64px)',
|
|
305
|
+
value: 'xl'
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
label: '2XL (96px)',
|
|
309
|
+
value: '2xl'
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
label: '3XL (128px)',
|
|
313
|
+
value: '3xl'
|
|
314
|
+
}
|
|
315
|
+
]
|
|
176
316
|
};
|
|
177
317
|
// =============================================================================
|
|
178
318
|
// Heading Level Field
|
|
@@ -181,13 +321,31 @@ export const headingLevelField = {
|
|
|
181
321
|
type: 'select',
|
|
182
322
|
label: 'Heading Level',
|
|
183
323
|
options: [
|
|
184
|
-
{
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
{
|
|
189
|
-
|
|
190
|
-
|
|
324
|
+
{
|
|
325
|
+
label: 'H1',
|
|
326
|
+
value: 'h1'
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
label: 'H2',
|
|
330
|
+
value: 'h2'
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
label: 'H3',
|
|
334
|
+
value: 'h3'
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
label: 'H4',
|
|
338
|
+
value: 'h4'
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
label: 'H5',
|
|
342
|
+
value: 'h5'
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
label: 'H6',
|
|
346
|
+
value: 'h6'
|
|
347
|
+
}
|
|
348
|
+
]
|
|
191
349
|
};
|
|
192
350
|
// =============================================================================
|
|
193
351
|
// Text Size Field
|
|
@@ -196,13 +354,31 @@ export const textSizeField = {
|
|
|
196
354
|
type: 'select',
|
|
197
355
|
label: 'Text Size',
|
|
198
356
|
options: [
|
|
199
|
-
{
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
|
|
357
|
+
{
|
|
358
|
+
label: 'Extra Small',
|
|
359
|
+
value: 'xs'
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
label: 'Small',
|
|
363
|
+
value: 'sm'
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
label: 'Base',
|
|
367
|
+
value: 'base'
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
label: 'Large',
|
|
371
|
+
value: 'lg'
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
label: 'Extra Large',
|
|
375
|
+
value: 'xl'
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
label: '2XL',
|
|
379
|
+
value: '2xl'
|
|
380
|
+
}
|
|
381
|
+
]
|
|
206
382
|
};
|
|
207
383
|
// =============================================================================
|
|
208
384
|
// Aspect Ratio Field
|
|
@@ -211,13 +387,31 @@ export const aspectRatioField = {
|
|
|
211
387
|
type: 'select',
|
|
212
388
|
label: 'Aspect Ratio',
|
|
213
389
|
options: [
|
|
214
|
-
{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
{
|
|
219
|
-
|
|
220
|
-
|
|
390
|
+
{
|
|
391
|
+
label: 'Auto',
|
|
392
|
+
value: 'auto'
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
label: 'Square (1:1)',
|
|
396
|
+
value: 'square'
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
label: 'Video (16:9)',
|
|
400
|
+
value: 'video'
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
label: 'Portrait (3:4)',
|
|
404
|
+
value: 'portrait'
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
label: 'Landscape (4:3)',
|
|
408
|
+
value: 'landscape'
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
label: 'Wide (21:9)',
|
|
412
|
+
value: 'wide'
|
|
413
|
+
}
|
|
414
|
+
]
|
|
221
415
|
};
|
|
222
416
|
// =============================================================================
|
|
223
417
|
// Divider Style Field
|
|
@@ -226,10 +420,19 @@ export const dividerStyleField = {
|
|
|
226
420
|
type: 'select',
|
|
227
421
|
label: 'Style',
|
|
228
422
|
options: [
|
|
229
|
-
{
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
423
|
+
{
|
|
424
|
+
label: 'Solid',
|
|
425
|
+
value: 'solid'
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
label: 'Dashed',
|
|
429
|
+
value: 'dashed'
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
label: 'Dotted',
|
|
433
|
+
value: 'dotted'
|
|
434
|
+
}
|
|
435
|
+
]
|
|
233
436
|
};
|
|
234
437
|
// =============================================================================
|
|
235
438
|
// Border Radius Field
|
|
@@ -238,14 +441,35 @@ export const borderRadiusField = {
|
|
|
238
441
|
type: 'select',
|
|
239
442
|
label: 'Border Radius',
|
|
240
443
|
options: [
|
|
241
|
-
{
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
{
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
444
|
+
{
|
|
445
|
+
label: 'None',
|
|
446
|
+
value: 'none'
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
label: 'Small',
|
|
450
|
+
value: 'sm'
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
label: 'Medium',
|
|
454
|
+
value: 'md'
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
label: 'Large',
|
|
458
|
+
value: 'lg'
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
label: 'Extra Large',
|
|
462
|
+
value: 'xl'
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
label: '2XL',
|
|
466
|
+
value: '2xl'
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
label: 'Full',
|
|
470
|
+
value: 'full'
|
|
471
|
+
}
|
|
472
|
+
]
|
|
249
473
|
};
|
|
250
474
|
// =============================================================================
|
|
251
475
|
// Columns Count Field
|
|
@@ -254,13 +478,31 @@ export const columnsCountField = {
|
|
|
254
478
|
type: 'select',
|
|
255
479
|
label: 'Columns',
|
|
256
480
|
options: [
|
|
257
|
-
{
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
{
|
|
262
|
-
|
|
263
|
-
|
|
481
|
+
{
|
|
482
|
+
label: '1 Column',
|
|
483
|
+
value: '1'
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
label: '2 Columns',
|
|
487
|
+
value: '2'
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
label: '3 Columns',
|
|
491
|
+
value: '3'
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
label: '4 Columns',
|
|
495
|
+
value: '4'
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
label: '5 Columns',
|
|
499
|
+
value: '5'
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
label: '6 Columns',
|
|
503
|
+
value: '6'
|
|
504
|
+
}
|
|
505
|
+
]
|
|
264
506
|
};
|
|
265
507
|
// =============================================================================
|
|
266
508
|
// Flex Direction Field
|
|
@@ -269,11 +511,23 @@ export const flexDirectionField = {
|
|
|
269
511
|
type: 'select',
|
|
270
512
|
label: 'Direction',
|
|
271
513
|
options: [
|
|
272
|
-
{
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
514
|
+
{
|
|
515
|
+
label: 'Row (Horizontal)',
|
|
516
|
+
value: 'row'
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
label: 'Column (Vertical)',
|
|
520
|
+
value: 'column'
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
label: 'Row Reverse',
|
|
524
|
+
value: 'row-reverse'
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
label: 'Column Reverse',
|
|
528
|
+
value: 'column-reverse'
|
|
529
|
+
}
|
|
530
|
+
]
|
|
277
531
|
};
|
|
278
532
|
// =============================================================================
|
|
279
533
|
// Flex Wrap Field
|
|
@@ -282,157 +536,152 @@ export const flexWrapField = {
|
|
|
282
536
|
type: 'select',
|
|
283
537
|
label: 'Wrap',
|
|
284
538
|
options: [
|
|
285
|
-
{
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
539
|
+
{
|
|
540
|
+
label: 'No Wrap',
|
|
541
|
+
value: 'nowrap'
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
label: 'Wrap',
|
|
545
|
+
value: 'wrap'
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
label: 'Wrap Reverse',
|
|
549
|
+
value: 'wrap-reverse'
|
|
550
|
+
}
|
|
551
|
+
]
|
|
289
552
|
};
|
|
290
553
|
// =============================================================================
|
|
291
554
|
// CSS Class Mappings
|
|
292
555
|
// =============================================================================
|
|
293
556
|
/**
|
|
294
557
|
* Maps alignment values to Tailwind classes
|
|
295
|
-
*/
|
|
296
|
-
export const alignmentMap = {
|
|
558
|
+
*/ export const alignmentMap = {
|
|
297
559
|
left: 'text-left',
|
|
298
560
|
center: 'text-center',
|
|
299
|
-
right: 'text-right'
|
|
561
|
+
right: 'text-right'
|
|
300
562
|
};
|
|
301
563
|
/**
|
|
302
564
|
* Maps background color values to Tailwind classes
|
|
303
|
-
*/
|
|
304
|
-
export const bgColorMap = {
|
|
565
|
+
*/ export const bgColorMap = {
|
|
305
566
|
none: '',
|
|
306
567
|
background: 'bg-background',
|
|
307
568
|
card: 'bg-card',
|
|
308
569
|
muted: 'bg-muted',
|
|
309
570
|
primary: 'bg-primary',
|
|
310
571
|
secondary: 'bg-secondary',
|
|
311
|
-
accent: 'bg-accent'
|
|
572
|
+
accent: 'bg-accent'
|
|
312
573
|
};
|
|
313
574
|
/**
|
|
314
575
|
* Maps text color values to Tailwind classes
|
|
315
|
-
*/
|
|
316
|
-
export const textColorMap = {
|
|
576
|
+
*/ export const textColorMap = {
|
|
317
577
|
default: 'text-inherit',
|
|
318
578
|
foreground: 'text-foreground',
|
|
319
579
|
'muted-foreground': 'text-muted-foreground',
|
|
320
580
|
primary: 'text-primary',
|
|
321
|
-
'secondary-foreground': 'text-secondary-foreground'
|
|
581
|
+
'secondary-foreground': 'text-secondary-foreground'
|
|
322
582
|
};
|
|
323
583
|
/**
|
|
324
584
|
* Maps gap values to Tailwind classes
|
|
325
|
-
*/
|
|
326
|
-
export const gapMap = {
|
|
585
|
+
*/ export const gapMap = {
|
|
327
586
|
none: 'gap-0',
|
|
328
587
|
xs: 'gap-1',
|
|
329
588
|
sm: 'gap-2',
|
|
330
589
|
md: 'gap-4',
|
|
331
590
|
lg: 'gap-6',
|
|
332
591
|
xl: 'gap-8',
|
|
333
|
-
'2xl': 'gap-12'
|
|
592
|
+
'2xl': 'gap-12'
|
|
334
593
|
};
|
|
335
594
|
/**
|
|
336
595
|
* Maps shadow values to Tailwind classes
|
|
337
|
-
*/
|
|
338
|
-
export const shadowMap = {
|
|
596
|
+
*/ export const shadowMap = {
|
|
339
597
|
none: '',
|
|
340
598
|
sm: 'shadow-sm',
|
|
341
599
|
md: 'shadow-md',
|
|
342
600
|
lg: 'shadow-lg',
|
|
343
601
|
xl: 'shadow-xl',
|
|
344
|
-
'2xl': 'shadow-2xl'
|
|
602
|
+
'2xl': 'shadow-2xl'
|
|
345
603
|
};
|
|
346
604
|
/**
|
|
347
605
|
* Maps spacer height values to Tailwind classes
|
|
348
|
-
*/
|
|
349
|
-
export const spacerHeightMap = {
|
|
606
|
+
*/ export const spacerHeightMap = {
|
|
350
607
|
xs: 'h-2',
|
|
351
608
|
sm: 'h-4',
|
|
352
609
|
md: 'h-8',
|
|
353
610
|
lg: 'h-12',
|
|
354
611
|
xl: 'h-16',
|
|
355
612
|
'2xl': 'h-24',
|
|
356
|
-
'3xl': 'h-32'
|
|
613
|
+
'3xl': 'h-32'
|
|
357
614
|
};
|
|
358
615
|
/**
|
|
359
616
|
* Maps heading level to Tailwind classes
|
|
360
|
-
*/
|
|
361
|
-
export const headingLevelMap = {
|
|
617
|
+
*/ export const headingLevelMap = {
|
|
362
618
|
h1: 'text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight',
|
|
363
619
|
h2: 'text-3xl md:text-4xl font-bold tracking-tight',
|
|
364
620
|
h3: 'text-2xl md:text-3xl font-semibold',
|
|
365
621
|
h4: 'text-xl md:text-2xl font-semibold',
|
|
366
622
|
h5: 'text-lg md:text-xl font-medium',
|
|
367
|
-
h6: 'text-base md:text-lg font-medium'
|
|
623
|
+
h6: 'text-base md:text-lg font-medium'
|
|
368
624
|
};
|
|
369
625
|
/**
|
|
370
626
|
* Maps text size to Tailwind classes
|
|
371
|
-
*/
|
|
372
|
-
export const textSizeMap = {
|
|
627
|
+
*/ export const textSizeMap = {
|
|
373
628
|
xs: 'text-xs',
|
|
374
629
|
sm: 'text-sm',
|
|
375
630
|
base: 'text-base',
|
|
376
631
|
lg: 'text-lg',
|
|
377
632
|
xl: 'text-xl',
|
|
378
|
-
'2xl': 'text-2xl'
|
|
633
|
+
'2xl': 'text-2xl'
|
|
379
634
|
};
|
|
380
635
|
/**
|
|
381
636
|
* Maps aspect ratio to Tailwind classes
|
|
382
|
-
*/
|
|
383
|
-
export const aspectRatioMap = {
|
|
637
|
+
*/ export const aspectRatioMap = {
|
|
384
638
|
auto: '',
|
|
385
639
|
square: 'aspect-square',
|
|
386
640
|
video: 'aspect-video',
|
|
387
641
|
portrait: 'aspect-[3/4]',
|
|
388
642
|
landscape: 'aspect-[4/3]',
|
|
389
|
-
wide: 'aspect-[21/9]'
|
|
643
|
+
wide: 'aspect-[21/9]'
|
|
390
644
|
};
|
|
391
645
|
/**
|
|
392
646
|
* Maps divider style to Tailwind classes
|
|
393
|
-
*/
|
|
394
|
-
export const dividerStyleMap = {
|
|
647
|
+
*/ export const dividerStyleMap = {
|
|
395
648
|
solid: 'border-solid',
|
|
396
649
|
dashed: 'border-dashed',
|
|
397
|
-
dotted: 'border-dotted'
|
|
650
|
+
dotted: 'border-dotted'
|
|
398
651
|
};
|
|
399
652
|
/**
|
|
400
653
|
* Maps border radius to Tailwind classes
|
|
401
|
-
*/
|
|
402
|
-
export const borderRadiusMap = {
|
|
654
|
+
*/ export const borderRadiusMap = {
|
|
403
655
|
none: 'rounded-none',
|
|
404
656
|
sm: 'rounded-sm',
|
|
405
657
|
md: 'rounded-md',
|
|
406
658
|
lg: 'rounded-lg',
|
|
407
659
|
xl: 'rounded-xl',
|
|
408
660
|
'2xl': 'rounded-2xl',
|
|
409
|
-
full: 'rounded-full'
|
|
661
|
+
full: 'rounded-full'
|
|
410
662
|
};
|
|
411
663
|
/**
|
|
412
664
|
* Maps columns count to Tailwind grid classes (responsive)
|
|
413
|
-
*/
|
|
414
|
-
export const columnsCountMap = {
|
|
665
|
+
*/ export const columnsCountMap = {
|
|
415
666
|
'1': 'grid-cols-1',
|
|
416
667
|
'2': 'grid-cols-1 md:grid-cols-2',
|
|
417
668
|
'3': 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
|
|
418
669
|
'4': 'grid-cols-1 md:grid-cols-2 lg:grid-cols-4',
|
|
419
670
|
'5': 'grid-cols-2 md:grid-cols-3 lg:grid-cols-5',
|
|
420
|
-
'6': 'grid-cols-2 md:grid-cols-3 lg:grid-cols-6'
|
|
671
|
+
'6': 'grid-cols-2 md:grid-cols-3 lg:grid-cols-6'
|
|
421
672
|
};
|
|
422
673
|
/**
|
|
423
674
|
* Maps flex direction to Tailwind classes
|
|
424
|
-
*/
|
|
425
|
-
export const flexDirectionMap = {
|
|
675
|
+
*/ export const flexDirectionMap = {
|
|
426
676
|
row: 'flex-row',
|
|
427
677
|
column: 'flex-col',
|
|
428
678
|
'row-reverse': 'flex-row-reverse',
|
|
429
|
-
'column-reverse': 'flex-col-reverse'
|
|
679
|
+
'column-reverse': 'flex-col-reverse'
|
|
430
680
|
};
|
|
431
681
|
/**
|
|
432
682
|
* Maps justify content to Tailwind classes
|
|
433
683
|
* Supports both short (start) and full (flex-start) values
|
|
434
|
-
*/
|
|
435
|
-
export const justifyContentMap = {
|
|
684
|
+
*/ export const justifyContentMap = {
|
|
436
685
|
start: 'justify-start',
|
|
437
686
|
'flex-start': 'justify-start',
|
|
438
687
|
center: 'justify-center',
|
|
@@ -443,68 +692,63 @@ export const justifyContentMap = {
|
|
|
443
692
|
around: 'justify-around',
|
|
444
693
|
'space-around': 'justify-around',
|
|
445
694
|
evenly: 'justify-evenly',
|
|
446
|
-
'space-evenly': 'justify-evenly'
|
|
695
|
+
'space-evenly': 'justify-evenly'
|
|
447
696
|
};
|
|
448
697
|
/**
|
|
449
698
|
* Maps align items to Tailwind classes
|
|
450
699
|
* Supports both short (start) and full (flex-start) values
|
|
451
|
-
*/
|
|
452
|
-
export const alignItemsMap = {
|
|
700
|
+
*/ export const alignItemsMap = {
|
|
453
701
|
start: 'items-start',
|
|
454
702
|
'flex-start': 'items-start',
|
|
455
703
|
center: 'items-center',
|
|
456
704
|
end: 'items-end',
|
|
457
705
|
'flex-end': 'items-end',
|
|
458
706
|
stretch: 'items-stretch',
|
|
459
|
-
baseline: 'items-baseline'
|
|
707
|
+
baseline: 'items-baseline'
|
|
460
708
|
};
|
|
461
709
|
/**
|
|
462
710
|
* Maps self-alignment to Tailwind classes (for grid/flex item alignment)
|
|
463
711
|
* Used by components like TextImageSplit for vertical self-alignment
|
|
464
|
-
*/
|
|
465
|
-
export const selfAlignmentMap = {
|
|
712
|
+
*/ export const selfAlignmentMap = {
|
|
466
713
|
start: 'self-start',
|
|
467
714
|
'flex-start': 'self-start',
|
|
468
715
|
center: 'self-center',
|
|
469
716
|
end: 'self-end',
|
|
470
717
|
'flex-end': 'self-end',
|
|
471
718
|
stretch: 'self-stretch',
|
|
472
|
-
auto: 'self-auto'
|
|
719
|
+
auto: 'self-auto'
|
|
473
720
|
};
|
|
474
721
|
/**
|
|
475
722
|
* Maps flex wrap to Tailwind classes
|
|
476
|
-
*/
|
|
477
|
-
export const flexWrapMap = {
|
|
723
|
+
*/ export const flexWrapMap = {
|
|
478
724
|
nowrap: 'flex-nowrap',
|
|
479
725
|
wrap: 'flex-wrap',
|
|
480
|
-
'wrap-reverse': 'flex-wrap-reverse'
|
|
726
|
+
'wrap-reverse': 'flex-wrap-reverse'
|
|
481
727
|
};
|
|
482
728
|
// =============================================================================
|
|
483
729
|
// Custom Style Value Utilities
|
|
484
730
|
// =============================================================================
|
|
485
731
|
/**
|
|
486
732
|
* Convert hex color to RGB components
|
|
487
|
-
*/
|
|
488
|
-
function hexToRgb(hex) {
|
|
733
|
+
*/ function hexToRgb(hex) {
|
|
489
734
|
const clean = hex.replace(/^#/, '');
|
|
490
|
-
if (clean.length !== 6)
|
|
491
|
-
return null;
|
|
735
|
+
if (clean.length !== 6) return null;
|
|
492
736
|
const r = parseInt(clean.substring(0, 2), 16);
|
|
493
737
|
const g = parseInt(clean.substring(2, 4), 16);
|
|
494
738
|
const b = parseInt(clean.substring(4, 6), 16);
|
|
495
|
-
if (isNaN(r) || isNaN(g) || isNaN(b))
|
|
496
|
-
|
|
497
|
-
|
|
739
|
+
if (isNaN(r) || isNaN(g) || isNaN(b)) return null;
|
|
740
|
+
return {
|
|
741
|
+
r,
|
|
742
|
+
g,
|
|
743
|
+
b
|
|
744
|
+
};
|
|
498
745
|
}
|
|
499
746
|
/**
|
|
500
747
|
* Convert ColorValue to CSS rgba string
|
|
501
|
-
*/
|
|
502
|
-
|
|
503
|
-
if (!color?.hex)
|
|
504
|
-
return undefined;
|
|
748
|
+
*/ export function colorValueToCSS(color) {
|
|
749
|
+
if (!color?.hex) return undefined;
|
|
505
750
|
const rgb = hexToRgb(color.hex);
|
|
506
|
-
if (!rgb)
|
|
507
|
-
return color.hex;
|
|
751
|
+
if (!rgb) return color.hex;
|
|
508
752
|
const opacity = (color.opacity ?? 100) / 100;
|
|
509
753
|
if (opacity === 1) {
|
|
510
754
|
return color.hex;
|
|
@@ -513,10 +757,8 @@ export function colorValueToCSS(color) {
|
|
|
513
757
|
}
|
|
514
758
|
/**
|
|
515
759
|
* Convert PaddingValue to CSS padding string
|
|
516
|
-
*/
|
|
517
|
-
|
|
518
|
-
if (!padding)
|
|
519
|
-
return undefined;
|
|
760
|
+
*/ export function paddingValueToCSS(padding) {
|
|
761
|
+
if (!padding) return undefined;
|
|
520
762
|
const { top, right, bottom, left, unit } = padding;
|
|
521
763
|
if (top === right && right === bottom && bottom === left) {
|
|
522
764
|
return `${top}${unit}`;
|
|
@@ -531,10 +773,8 @@ export function paddingValueToCSS(padding) {
|
|
|
531
773
|
}
|
|
532
774
|
/**
|
|
533
775
|
* Convert PaddingValue to CSS margin string (same structure, different property)
|
|
534
|
-
*/
|
|
535
|
-
|
|
536
|
-
if (!margin)
|
|
537
|
-
return undefined;
|
|
776
|
+
*/ export function marginValueToCSS(margin) {
|
|
777
|
+
if (!margin) return undefined;
|
|
538
778
|
const { top, right, bottom, left, unit } = margin;
|
|
539
779
|
if (top === right && right === bottom && bottom === left) {
|
|
540
780
|
return `${top}${unit}`;
|
|
@@ -549,10 +789,8 @@ export function marginValueToCSS(margin) {
|
|
|
549
789
|
}
|
|
550
790
|
/**
|
|
551
791
|
* Convert BorderValue to CSS properties object
|
|
552
|
-
*/
|
|
553
|
-
|
|
554
|
-
if (!border || border.style === 'none')
|
|
555
|
-
return undefined;
|
|
792
|
+
*/ export function borderValueToCSS(border) {
|
|
793
|
+
if (!border || border.style === 'none') return undefined;
|
|
556
794
|
const color = colorValueToCSS(border.color) || '#000000';
|
|
557
795
|
const style = {};
|
|
558
796
|
if (border.sides.top) {
|
|
@@ -582,20 +820,17 @@ export function borderValueToCSS(border) {
|
|
|
582
820
|
}
|
|
583
821
|
/**
|
|
584
822
|
* Convert WidthValue to CSS properties object
|
|
585
|
-
*/
|
|
586
|
-
|
|
587
|
-
if (!width)
|
|
588
|
-
return undefined;
|
|
823
|
+
*/ export function widthValueToCSS(width) {
|
|
824
|
+
if (!width) return undefined;
|
|
589
825
|
const style = {};
|
|
590
826
|
if (width.mode === 'full') {
|
|
591
827
|
style.width = '100%';
|
|
592
828
|
style.maxWidth = '100%';
|
|
593
|
-
}
|
|
594
|
-
else {
|
|
829
|
+
} else {
|
|
595
830
|
style.maxWidth = `${width.maxWidth}${width.unit}`;
|
|
596
831
|
style.width = '100%';
|
|
597
832
|
}
|
|
598
|
-
switch
|
|
833
|
+
switch(width.alignment){
|
|
599
834
|
case 'left':
|
|
600
835
|
style.marginLeft = '0';
|
|
601
836
|
style.marginRight = 'auto';
|
|
@@ -614,10 +849,8 @@ export function widthValueToCSS(width) {
|
|
|
614
849
|
/**
|
|
615
850
|
* Convert DimensionsValue to CSS properties object
|
|
616
851
|
* Handles both legacy WidthValue and new DimensionsValue formats
|
|
617
|
-
*/
|
|
618
|
-
|
|
619
|
-
if (!dimensions)
|
|
620
|
-
return undefined;
|
|
852
|
+
*/ export function dimensionsValueToCSS(dimensions) {
|
|
853
|
+
if (!dimensions) return undefined;
|
|
621
854
|
// Handle legacy WidthValue format
|
|
622
855
|
if (isLegacyWidthValue(dimensions)) {
|
|
623
856
|
return widthValueToCSS(dimensions);
|
|
@@ -628,8 +861,7 @@ export function dimensionsValueToCSS(dimensions) {
|
|
|
628
861
|
if (dim.mode === 'full') {
|
|
629
862
|
style.width = '100%';
|
|
630
863
|
style.maxWidth = '100%';
|
|
631
|
-
}
|
|
632
|
-
else {
|
|
864
|
+
} else {
|
|
633
865
|
style.width = '100%';
|
|
634
866
|
// Max Width (required)
|
|
635
867
|
if (dim.maxWidth?.enabled !== false && dim.maxWidth?.value > 0) {
|
|
@@ -648,7 +880,7 @@ export function dimensionsValueToCSS(dimensions) {
|
|
|
648
880
|
style.maxHeight = `${dim.maxHeight.value}${dim.maxHeight.unit}`;
|
|
649
881
|
}
|
|
650
882
|
// Alignment (via margin)
|
|
651
|
-
switch
|
|
883
|
+
switch(dim.alignment){
|
|
652
884
|
case 'left':
|
|
653
885
|
style.marginLeft = '0';
|
|
654
886
|
style.marginRight = 'auto';
|
|
@@ -666,12 +898,9 @@ export function dimensionsValueToCSS(dimensions) {
|
|
|
666
898
|
}
|
|
667
899
|
/**
|
|
668
900
|
* Get human-readable summary of dimensions
|
|
669
|
-
*/
|
|
670
|
-
|
|
671
|
-
if (
|
|
672
|
-
return 'auto';
|
|
673
|
-
if (dim.mode === 'full')
|
|
674
|
-
return '100%';
|
|
901
|
+
*/ export function getDimensionsSummary(dim) {
|
|
902
|
+
if (!dim) return 'auto';
|
|
903
|
+
if (dim.mode === 'full') return '100%';
|
|
675
904
|
const parts = [];
|
|
676
905
|
if (dim.maxWidth?.enabled && dim.maxWidth.value > 0) {
|
|
677
906
|
parts.push(`max: ${dim.maxWidth.value}${dim.maxWidth.unit}`);
|
|
@@ -689,8 +918,7 @@ export function getDimensionsSummary(dim) {
|
|
|
689
918
|
}
|
|
690
919
|
/**
|
|
691
920
|
* Combined style generator for layout components
|
|
692
|
-
*/
|
|
693
|
-
export function getCustomStyleObject(options) {
|
|
921
|
+
*/ export function getCustomStyleObject(options) {
|
|
694
922
|
const style = {};
|
|
695
923
|
const bgColor = colorValueToCSS(options.backgroundColor);
|
|
696
924
|
if (bgColor) {
|
|
@@ -720,20 +948,19 @@ export function getCustomStyleObject(options) {
|
|
|
720
948
|
}
|
|
721
949
|
/**
|
|
722
950
|
* Convert GradientValue to CSS gradient string
|
|
723
|
-
*/
|
|
724
|
-
export function gradientValueToCSS(gradient) {
|
|
951
|
+
*/ export function gradientValueToCSS(gradient) {
|
|
725
952
|
if (!gradient?.stops || gradient.stops.length === 0) {
|
|
726
953
|
return 'transparent';
|
|
727
954
|
}
|
|
728
955
|
// Sort stops by position
|
|
729
|
-
const sortedStops = [
|
|
956
|
+
const sortedStops = [
|
|
957
|
+
...gradient.stops
|
|
958
|
+
].sort((a, b)=>a.position - b.position);
|
|
730
959
|
// Convert stops to CSS format
|
|
731
|
-
const stopsCSS = sortedStops
|
|
732
|
-
.map((stop) => {
|
|
960
|
+
const stopsCSS = sortedStops.map((stop)=>{
|
|
733
961
|
const color = colorValueToCSS(stop.color) || 'transparent';
|
|
734
962
|
return `${color} ${stop.position}%`;
|
|
735
|
-
})
|
|
736
|
-
.join(', ');
|
|
963
|
+
}).join(', ');
|
|
737
964
|
if (gradient.type === 'radial') {
|
|
738
965
|
const shape = gradient.radialShape || 'circle';
|
|
739
966
|
const position = gradient.radialPosition || 'center';
|
|
@@ -744,8 +971,7 @@ export function gradientValueToCSS(gradient) {
|
|
|
744
971
|
}
|
|
745
972
|
/**
|
|
746
973
|
* Convert position value to CSS background-position
|
|
747
|
-
*/
|
|
748
|
-
function positionToCSS(position) {
|
|
974
|
+
*/ function positionToCSS(position) {
|
|
749
975
|
const positionMap = {
|
|
750
976
|
center: 'center',
|
|
751
977
|
top: 'top',
|
|
@@ -755,14 +981,13 @@ function positionToCSS(position) {
|
|
|
755
981
|
'top-left': 'top left',
|
|
756
982
|
'top-right': 'top right',
|
|
757
983
|
'bottom-left': 'bottom left',
|
|
758
|
-
'bottom-right': 'bottom right'
|
|
984
|
+
'bottom-right': 'bottom right'
|
|
759
985
|
};
|
|
760
986
|
return position ? positionMap[position] || 'center' : 'center';
|
|
761
987
|
}
|
|
762
988
|
/**
|
|
763
989
|
* Convert GradientMask direction to CSS gradient direction
|
|
764
|
-
*/
|
|
765
|
-
function maskDirectionToCSS(direction) {
|
|
990
|
+
*/ function maskDirectionToCSS(direction) {
|
|
766
991
|
const directionMap = {
|
|
767
992
|
'to-top': 'to top',
|
|
768
993
|
'to-bottom': 'to bottom',
|
|
@@ -772,14 +997,13 @@ function maskDirectionToCSS(direction) {
|
|
|
772
997
|
'to-top-right': 'to top right',
|
|
773
998
|
'to-bottom-left': 'to bottom left',
|
|
774
999
|
'to-bottom-right': 'to bottom right',
|
|
775
|
-
'from-center': 'radial'
|
|
1000
|
+
'from-center': 'radial'
|
|
776
1001
|
};
|
|
777
1002
|
return directionMap[direction] || 'to bottom';
|
|
778
1003
|
}
|
|
779
1004
|
/**
|
|
780
1005
|
* Convert GradientMask to CSS mask-image string
|
|
781
|
-
*/
|
|
782
|
-
function maskToCSS(mask) {
|
|
1006
|
+
*/ function maskToCSS(mask) {
|
|
783
1007
|
const startAlpha = (mask.startOpacity ?? 100) / 100;
|
|
784
1008
|
const endAlpha = (mask.endOpacity ?? 0) / 100;
|
|
785
1009
|
// Handle radial gradient for "from-center"
|
|
@@ -793,13 +1017,12 @@ function maskToCSS(mask) {
|
|
|
793
1017
|
/**
|
|
794
1018
|
* Convert BackgroundValue to CSS properties object
|
|
795
1019
|
* Returns both styles and metadata for advanced features like image opacity
|
|
796
|
-
*/
|
|
797
|
-
export function backgroundValueToCSS(bg) {
|
|
1020
|
+
*/ export function backgroundValueToCSS(bg) {
|
|
798
1021
|
if (!bg || bg.type === 'none') {
|
|
799
1022
|
return {};
|
|
800
1023
|
}
|
|
801
1024
|
const style = {};
|
|
802
|
-
switch
|
|
1025
|
+
switch(bg.type){
|
|
803
1026
|
case 'solid':
|
|
804
1027
|
if (bg.solid?.hex) {
|
|
805
1028
|
style.backgroundColor = colorValueToCSS(bg.solid);
|
|
@@ -821,15 +1044,12 @@ export function backgroundValueToCSS(bg) {
|
|
|
821
1044
|
if (bg.overlay?.enabled) {
|
|
822
1045
|
// Layer overlay on top of image using CSS multiple backgrounds
|
|
823
1046
|
// Use only backgroundImage to avoid shorthand/longhand conflicts
|
|
824
|
-
const overlayCSS = bg.overlay.type === 'solid'
|
|
825
|
-
? colorValueToCSS(bg.overlay.solid)
|
|
826
|
-
: gradientValueToCSS(bg.overlay.gradient);
|
|
1047
|
+
const overlayCSS = bg.overlay.type === 'solid' ? colorValueToCSS(bg.overlay.solid) : gradientValueToCSS(bg.overlay.gradient);
|
|
827
1048
|
// CSS background layering: first layer is on top
|
|
828
1049
|
// For solid color overlay, we need to use a gradient to make it a proper layer
|
|
829
1050
|
if (bg.overlay.type === 'solid' && overlayCSS) {
|
|
830
1051
|
style.backgroundImage = `linear-gradient(${overlayCSS}, ${overlayCSS}), url(${imageUrl})`;
|
|
831
|
-
}
|
|
832
|
-
else {
|
|
1052
|
+
} else {
|
|
833
1053
|
style.backgroundImage = `${overlayCSS}, url(${imageUrl})`;
|
|
834
1054
|
}
|
|
835
1055
|
// Use comma-separated values for each layer
|
|
@@ -837,8 +1057,7 @@ export function backgroundValueToCSS(bg) {
|
|
|
837
1057
|
style.backgroundPosition = `center, ${position}`;
|
|
838
1058
|
style.backgroundRepeat = `no-repeat, ${repeat}`;
|
|
839
1059
|
style.backgroundAttachment = `scroll, ${attachment}`;
|
|
840
|
-
}
|
|
841
|
-
else {
|
|
1060
|
+
} else {
|
|
842
1061
|
// No overlay, just the image
|
|
843
1062
|
style.backgroundImage = `url(${imageUrl})`;
|
|
844
1063
|
style.backgroundSize = size;
|
|
@@ -860,28 +1079,19 @@ export function backgroundValueToCSS(bg) {
|
|
|
860
1079
|
/**
|
|
861
1080
|
* Get image opacity from BackgroundValue (for consumer wrapper components)
|
|
862
1081
|
* Returns undefined if no image or opacity is 100%
|
|
863
|
-
*/
|
|
864
|
-
|
|
865
|
-
if (!bg || bg.type !== 'image' || !bg.image)
|
|
866
|
-
return undefined;
|
|
1082
|
+
*/ export function getBackgroundImageOpacity(bg) {
|
|
1083
|
+
if (!bg || bg.type !== 'image' || !bg.image) return undefined;
|
|
867
1084
|
const opacity = bg.image.opacity ?? 100;
|
|
868
1085
|
return opacity < 100 ? opacity / 100 : undefined;
|
|
869
1086
|
}
|
|
870
1087
|
/**
|
|
871
1088
|
* Check if any custom style values are set
|
|
872
|
-
*/
|
|
873
|
-
|
|
874
|
-
return !!(options.backgroundColor?.hex ||
|
|
875
|
-
options.textColor?.hex ||
|
|
876
|
-
options.padding ||
|
|
877
|
-
options.margin ||
|
|
878
|
-
(options.border && options.border.style !== 'none') ||
|
|
879
|
-
options.width);
|
|
1089
|
+
*/ export function hasCustomStyles(options) {
|
|
1090
|
+
return !!(options.backgroundColor?.hex || options.textColor?.hex || options.padding || options.margin || options.border && options.border.style !== 'none' || options.width);
|
|
880
1091
|
}
|
|
881
1092
|
/**
|
|
882
1093
|
* Default transform value
|
|
883
|
-
*/
|
|
884
|
-
export const DEFAULT_TRANSFORM = {
|
|
1094
|
+
*/ export const DEFAULT_TRANSFORM = {
|
|
885
1095
|
rotate: 0,
|
|
886
1096
|
scaleX: 1,
|
|
887
1097
|
scaleY: 1,
|
|
@@ -895,12 +1105,11 @@ export const DEFAULT_TRANSFORM = {
|
|
|
895
1105
|
enable3D: false,
|
|
896
1106
|
perspective: 1000,
|
|
897
1107
|
rotateX: 0,
|
|
898
|
-
rotateY: 0
|
|
1108
|
+
rotateY: 0
|
|
899
1109
|
};
|
|
900
1110
|
/**
|
|
901
1111
|
* Convert TransformOrigin to CSS transform-origin value
|
|
902
|
-
*/
|
|
903
|
-
function transformOriginToCSS(origin) {
|
|
1112
|
+
*/ function transformOriginToCSS(origin) {
|
|
904
1113
|
const originMap = {
|
|
905
1114
|
center: 'center',
|
|
906
1115
|
top: 'top',
|
|
@@ -910,16 +1119,14 @@ function transformOriginToCSS(origin) {
|
|
|
910
1119
|
'top-left': 'top left',
|
|
911
1120
|
'top-right': 'top right',
|
|
912
1121
|
'bottom-left': 'bottom left',
|
|
913
|
-
'bottom-right': 'bottom right'
|
|
1122
|
+
'bottom-right': 'bottom right'
|
|
914
1123
|
};
|
|
915
1124
|
return originMap[origin] || 'center';
|
|
916
1125
|
}
|
|
917
1126
|
/**
|
|
918
1127
|
* Convert TransformValue to CSS properties object
|
|
919
|
-
*/
|
|
920
|
-
|
|
921
|
-
if (!transform)
|
|
922
|
-
return undefined;
|
|
1128
|
+
*/ export function transformValueToCSS(transform) {
|
|
1129
|
+
if (!transform) return undefined;
|
|
923
1130
|
const style = {};
|
|
924
1131
|
const transforms = [];
|
|
925
1132
|
// Handle 3D perspective
|
|
@@ -948,8 +1155,7 @@ export function transformValueToCSS(transform) {
|
|
|
948
1155
|
if (transform.scaleX !== 1 || transform.scaleY !== 1) {
|
|
949
1156
|
if (transform.scaleX === transform.scaleY) {
|
|
950
1157
|
transforms.push(`scale(${transform.scaleX})`);
|
|
951
|
-
}
|
|
952
|
-
else {
|
|
1158
|
+
} else {
|
|
953
1159
|
transforms.push(`scale(${transform.scaleX}, ${transform.scaleY})`);
|
|
954
1160
|
}
|
|
955
1161
|
}
|
|
@@ -957,11 +1163,9 @@ export function transformValueToCSS(transform) {
|
|
|
957
1163
|
if (transform.skewX !== 0 || transform.skewY !== 0) {
|
|
958
1164
|
if (transform.skewX !== 0 && transform.skewY !== 0) {
|
|
959
1165
|
transforms.push(`skew(${transform.skewX}deg, ${transform.skewY}deg)`);
|
|
960
|
-
}
|
|
961
|
-
else if (transform.skewX !== 0) {
|
|
1166
|
+
} else if (transform.skewX !== 0) {
|
|
962
1167
|
transforms.push(`skewX(${transform.skewX}deg)`);
|
|
963
|
-
}
|
|
964
|
-
else {
|
|
1168
|
+
} else {
|
|
965
1169
|
transforms.push(`skewY(${transform.skewY}deg)`);
|
|
966
1170
|
}
|
|
967
1171
|
}
|
|
@@ -981,13 +1185,32 @@ export function transformValueToCSS(transform) {
|
|
|
981
1185
|
}
|
|
982
1186
|
/**
|
|
983
1187
|
* Breakpoint configuration with labels and pixel values
|
|
984
|
-
*/
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
{
|
|
1188
|
+
*/ export const BREAKPOINTS = [
|
|
1189
|
+
{
|
|
1190
|
+
key: 'xs',
|
|
1191
|
+
label: 'XS',
|
|
1192
|
+
minWidth: null
|
|
1193
|
+
},
|
|
1194
|
+
{
|
|
1195
|
+
key: 'sm',
|
|
1196
|
+
label: 'SM',
|
|
1197
|
+
minWidth: 640
|
|
1198
|
+
},
|
|
1199
|
+
{
|
|
1200
|
+
key: 'md',
|
|
1201
|
+
label: 'MD',
|
|
1202
|
+
minWidth: 768
|
|
1203
|
+
},
|
|
1204
|
+
{
|
|
1205
|
+
key: 'lg',
|
|
1206
|
+
label: 'LG',
|
|
1207
|
+
minWidth: 1024
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
key: 'xl',
|
|
1211
|
+
label: 'XL',
|
|
1212
|
+
minWidth: 1280
|
|
1213
|
+
}
|
|
991
1214
|
];
|
|
992
1215
|
// =============================================================================
|
|
993
1216
|
// Responsive CSS Helpers
|
|
@@ -995,26 +1218,19 @@ export const BREAKPOINTS = [
|
|
|
995
1218
|
/**
|
|
996
1219
|
* Type guard to check if a value is a ResponsiveValue (has breakpoint structure)
|
|
997
1220
|
* Checks for the required xs property which indicates mobile-first responsive value
|
|
998
|
-
*/
|
|
999
|
-
|
|
1000
|
-
if (!value || typeof value !== 'object')
|
|
1001
|
-
return false;
|
|
1221
|
+
*/ export function isResponsiveValue(value) {
|
|
1222
|
+
if (!value || typeof value !== 'object') return false;
|
|
1002
1223
|
return 'xs' in value;
|
|
1003
1224
|
}
|
|
1004
1225
|
/**
|
|
1005
1226
|
* Converts a camelCase property name to kebab-case CSS property
|
|
1006
|
-
*/
|
|
1007
|
-
|
|
1008
|
-
return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
1227
|
+
*/ function camelToKebab(str) {
|
|
1228
|
+
return str.replace(/[A-Z]/g, (letter)=>`-${letter.toLowerCase()}`);
|
|
1009
1229
|
}
|
|
1010
1230
|
/**
|
|
1011
1231
|
* Converts React.CSSProperties to a CSS string for use in style tags
|
|
1012
|
-
*/
|
|
1013
|
-
|
|
1014
|
-
return Object.entries(styles)
|
|
1015
|
-
.filter(([, value]) => value !== undefined && value !== null && value !== '')
|
|
1016
|
-
.map(([key, value]) => `${camelToKebab(key)}: ${value}`)
|
|
1017
|
-
.join('; ');
|
|
1232
|
+
*/ export function cssPropertiesToString(styles) {
|
|
1233
|
+
return Object.entries(styles).filter(([, value])=>value !== undefined && value !== null && value !== '').map(([key, value])=>`${camelToKebab(key)}: ${value}`).join('; ');
|
|
1018
1234
|
}
|
|
1019
1235
|
/**
|
|
1020
1236
|
* Converts a ResponsiveValue to CSS with media queries.
|
|
@@ -1040,18 +1256,20 @@ export function cssPropertiesToString(styles) {
|
|
|
1040
1256
|
* </>
|
|
1041
1257
|
* )
|
|
1042
1258
|
* ```
|
|
1043
|
-
*/
|
|
1044
|
-
export function responsiveValueToCSS(value, converter, uniqueId) {
|
|
1259
|
+
*/ export function responsiveValueToCSS(value, converter, uniqueId) {
|
|
1045
1260
|
// Handle null/undefined
|
|
1046
1261
|
if (value === null || value === undefined) {
|
|
1047
|
-
return {
|
|
1262
|
+
return {
|
|
1263
|
+
baseStyles: {},
|
|
1264
|
+
mediaQueryCSS: ''
|
|
1265
|
+
};
|
|
1048
1266
|
}
|
|
1049
1267
|
// If not responsive (single value), return as base styles only (can use inline)
|
|
1050
1268
|
if (!isResponsiveValue(value)) {
|
|
1051
1269
|
const styles = converter(value);
|
|
1052
1270
|
return {
|
|
1053
1271
|
baseStyles: styles || {},
|
|
1054
|
-
mediaQueryCSS: ''
|
|
1272
|
+
mediaQueryCSS: ''
|
|
1055
1273
|
};
|
|
1056
1274
|
}
|
|
1057
1275
|
// For responsive values, we need to put ALL styles in the <style> tag
|
|
@@ -1059,37 +1277,35 @@ export function responsiveValueToCSS(value, converter, uniqueId) {
|
|
|
1059
1277
|
// so media queries can't override inline styles. By putting everything
|
|
1060
1278
|
// in the style tag, CSS cascade works properly.
|
|
1061
1279
|
const cssRules = [];
|
|
1062
|
-
BREAKPOINTS.forEach((bp)
|
|
1280
|
+
BREAKPOINTS.forEach((bp)=>{
|
|
1063
1281
|
const bpValue = value[bp.key];
|
|
1064
|
-
if (bpValue === undefined)
|
|
1065
|
-
return;
|
|
1282
|
+
if (bpValue === undefined) return;
|
|
1066
1283
|
const cssProps = converter(bpValue);
|
|
1067
|
-
if (!cssProps)
|
|
1068
|
-
return;
|
|
1284
|
+
if (!cssProps) return;
|
|
1069
1285
|
const styleString = cssPropertiesToString(cssProps);
|
|
1070
|
-
if (!styleString)
|
|
1071
|
-
return;
|
|
1286
|
+
if (!styleString) return;
|
|
1072
1287
|
if (bp.key === 'xs') {
|
|
1073
1288
|
// Base styles go without media query
|
|
1074
1289
|
cssRules.push(`.${uniqueId} { ${styleString} }`);
|
|
1075
|
-
}
|
|
1076
|
-
else {
|
|
1290
|
+
} else {
|
|
1077
1291
|
// Breakpoint overrides go in media queries
|
|
1078
1292
|
cssRules.push(`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`);
|
|
1079
1293
|
}
|
|
1080
1294
|
});
|
|
1081
1295
|
// Return empty baseStyles - everything goes through the style tag
|
|
1082
|
-
return {
|
|
1296
|
+
return {
|
|
1297
|
+
baseStyles: {},
|
|
1298
|
+
mediaQueryCSS: cssRules.join('\n')
|
|
1299
|
+
};
|
|
1083
1300
|
}
|
|
1084
1301
|
/**
|
|
1085
1302
|
* Default visibility value (visible at all breakpoints)
|
|
1086
|
-
*/
|
|
1087
|
-
export const DEFAULT_VISIBILITY = {
|
|
1303
|
+
*/ export const DEFAULT_VISIBILITY = {
|
|
1088
1304
|
xs: true,
|
|
1089
1305
|
sm: true,
|
|
1090
1306
|
md: true,
|
|
1091
1307
|
lg: true,
|
|
1092
|
-
xl: true
|
|
1308
|
+
xl: true
|
|
1093
1309
|
};
|
|
1094
1310
|
/**
|
|
1095
1311
|
* Converts a VisibilityValue to CSS with display: none media queries.
|
|
@@ -1098,25 +1314,28 @@ export const DEFAULT_VISIBILITY = {
|
|
|
1098
1314
|
* @param visibility - The visibility settings per breakpoint
|
|
1099
1315
|
* @param uniqueId - Unique class name for targeting in media queries
|
|
1100
1316
|
* @returns CSS media queries string for hiding at specific breakpoints
|
|
1101
|
-
*/
|
|
1102
|
-
|
|
1103
|
-
if (!visibility)
|
|
1104
|
-
return '';
|
|
1317
|
+
*/ export function visibilityValueToCSS(visibility, uniqueId) {
|
|
1318
|
+
if (!visibility) return '';
|
|
1105
1319
|
const mediaQueries = [];
|
|
1106
1320
|
// Breakpoint min-widths for range calculations
|
|
1107
1321
|
const breakpointWidths = {
|
|
1108
|
-
xs: null,
|
|
1322
|
+
xs: null,
|
|
1109
1323
|
sm: 640,
|
|
1110
1324
|
md: 768,
|
|
1111
1325
|
lg: 1024,
|
|
1112
|
-
xl: 1280
|
|
1326
|
+
xl: 1280
|
|
1113
1327
|
};
|
|
1114
1328
|
// Get next breakpoint's min-width for max-width calculation
|
|
1115
|
-
const getNextBreakpointWidth = (bp)
|
|
1116
|
-
const order = [
|
|
1329
|
+
const getNextBreakpointWidth = (bp)=>{
|
|
1330
|
+
const order = [
|
|
1331
|
+
'xs',
|
|
1332
|
+
'sm',
|
|
1333
|
+
'md',
|
|
1334
|
+
'lg',
|
|
1335
|
+
'xl'
|
|
1336
|
+
];
|
|
1117
1337
|
const index = order.indexOf(bp);
|
|
1118
|
-
if (index === -1 || index === order.length - 1)
|
|
1119
|
-
return null;
|
|
1338
|
+
if (index === -1 || index === order.length - 1) return null;
|
|
1120
1339
|
return breakpointWidths[order[index + 1]];
|
|
1121
1340
|
};
|
|
1122
1341
|
// XS (0 to 639px)
|
|
@@ -1124,21 +1343,19 @@ export function visibilityValueToCSS(visibility, uniqueId) {
|
|
|
1124
1343
|
const nextWidth = getNextBreakpointWidth('xs');
|
|
1125
1344
|
if (nextWidth) {
|
|
1126
1345
|
mediaQueries.push(`@media (max-width: ${nextWidth - 1}px) { .${uniqueId} { display: none; } }`);
|
|
1127
|
-
}
|
|
1128
|
-
else {
|
|
1346
|
+
} else {
|
|
1129
1347
|
mediaQueries.push(`.${uniqueId} { display: none; }`);
|
|
1130
1348
|
}
|
|
1131
1349
|
}
|
|
1132
1350
|
// Other breakpoints (sm, md, lg, xl)
|
|
1133
|
-
BREAKPOINTS.slice(1).forEach((bp)
|
|
1351
|
+
BREAKPOINTS.slice(1).forEach((bp)=>{
|
|
1134
1352
|
if (visibility[bp.key] === false) {
|
|
1135
1353
|
const minWidth = breakpointWidths[bp.key];
|
|
1136
1354
|
const maxWidth = getNextBreakpointWidth(bp.key);
|
|
1137
1355
|
if (minWidth && maxWidth) {
|
|
1138
1356
|
// Range query (e.g., sm: 640-767px)
|
|
1139
1357
|
mediaQueries.push(`@media (min-width: ${minWidth}px) and (max-width: ${maxWidth - 1}px) { .${uniqueId} { display: none; } }`);
|
|
1140
|
-
}
|
|
1141
|
-
else if (minWidth) {
|
|
1358
|
+
} else if (minWidth) {
|
|
1142
1359
|
// Last breakpoint (xl: 1280px+)
|
|
1143
1360
|
mediaQueries.push(`@media (min-width: ${minWidth}px) { .${uniqueId} { display: none; } }`);
|
|
1144
1361
|
}
|
|
@@ -1146,8 +1363,7 @@ export function visibilityValueToCSS(visibility, uniqueId) {
|
|
|
1146
1363
|
});
|
|
1147
1364
|
return mediaQueries.join('\n');
|
|
1148
1365
|
}
|
|
1149
|
-
/** Map advanced easing to CSS cubic-bezier values */
|
|
1150
|
-
export const EASING_CSS_MAP = {
|
|
1366
|
+
/** Map advanced easing to CSS cubic-bezier values */ export const EASING_CSS_MAP = {
|
|
1151
1367
|
linear: 'linear',
|
|
1152
1368
|
ease: 'ease',
|
|
1153
1369
|
'ease-in': 'ease-in',
|
|
@@ -1161,31 +1377,101 @@ export const EASING_CSS_MAP = {
|
|
|
1161
1377
|
'back-in': 'cubic-bezier(0.6, -0.28, 0.735, 0.045)',
|
|
1162
1378
|
'back-out': 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
|
|
1163
1379
|
'back-in-out': 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
|
|
1164
|
-
elastic: 'cubic-bezier(0.68, -0.6, 0.32, 1.6)'
|
|
1380
|
+
elastic: 'cubic-bezier(0.68, -0.6, 0.32, 1.6)'
|
|
1165
1381
|
};
|
|
1166
1382
|
/**
|
|
1167
1383
|
* Animation presets organized by category for UI
|
|
1168
|
-
*/
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
{
|
|
1177
|
-
|
|
1178
|
-
|
|
1384
|
+
*/ export const ANIMATION_CATEGORIES = [
|
|
1385
|
+
{
|
|
1386
|
+
category: 'none',
|
|
1387
|
+
label: 'None',
|
|
1388
|
+
animations: [
|
|
1389
|
+
'none'
|
|
1390
|
+
]
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
category: 'fade',
|
|
1394
|
+
label: 'Fade',
|
|
1395
|
+
animations: [
|
|
1396
|
+
'fade-in',
|
|
1397
|
+
'fade-up',
|
|
1398
|
+
'fade-down',
|
|
1399
|
+
'fade-left',
|
|
1400
|
+
'fade-right',
|
|
1401
|
+
'fade-scale'
|
|
1402
|
+
]
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
category: 'scale',
|
|
1406
|
+
label: 'Scale',
|
|
1407
|
+
animations: [
|
|
1408
|
+
'scale-in',
|
|
1409
|
+
'scale-up',
|
|
1410
|
+
'scale-down',
|
|
1411
|
+
'scale-out'
|
|
1412
|
+
]
|
|
1413
|
+
},
|
|
1414
|
+
{
|
|
1415
|
+
category: 'slide',
|
|
1416
|
+
label: 'Slide',
|
|
1417
|
+
animations: [
|
|
1418
|
+
'slide-up',
|
|
1419
|
+
'slide-down',
|
|
1420
|
+
'slide-left',
|
|
1421
|
+
'slide-right'
|
|
1422
|
+
]
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
category: 'blur',
|
|
1426
|
+
label: 'Blur',
|
|
1427
|
+
animations: [
|
|
1428
|
+
'blur-in',
|
|
1429
|
+
'blur-up',
|
|
1430
|
+
'blur-down'
|
|
1431
|
+
]
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
category: 'rotate',
|
|
1435
|
+
label: 'Rotate',
|
|
1436
|
+
animations: [
|
|
1437
|
+
'rotate-in',
|
|
1438
|
+
'rotate-up',
|
|
1439
|
+
'rotate-down'
|
|
1440
|
+
]
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
category: 'bounce',
|
|
1444
|
+
label: 'Bounce',
|
|
1445
|
+
animations: [
|
|
1446
|
+
'bounce-in',
|
|
1447
|
+
'bounce-up',
|
|
1448
|
+
'bounce-down'
|
|
1449
|
+
]
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
category: 'flip',
|
|
1453
|
+
label: 'Flip',
|
|
1454
|
+
animations: [
|
|
1455
|
+
'flip-x',
|
|
1456
|
+
'flip-y'
|
|
1457
|
+
]
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
category: 'zoom',
|
|
1461
|
+
label: 'Zoom',
|
|
1462
|
+
animations: [
|
|
1463
|
+
'zoom-in',
|
|
1464
|
+
'zoom-out'
|
|
1465
|
+
]
|
|
1466
|
+
}
|
|
1179
1467
|
];
|
|
1180
1468
|
// =============================================================================
|
|
1181
1469
|
// Animation CSS Utilities
|
|
1182
1470
|
// =============================================================================
|
|
1183
1471
|
/**
|
|
1184
1472
|
* Convert AnimationOrigin to CSS transform-origin value
|
|
1185
|
-
*/
|
|
1186
|
-
|
|
1187
|
-
if (!origin)
|
|
1188
|
-
return 'center';
|
|
1473
|
+
*/ function animationOriginToCSS(origin) {
|
|
1474
|
+
if (!origin) return 'center';
|
|
1189
1475
|
const originMap = {
|
|
1190
1476
|
center: 'center',
|
|
1191
1477
|
top: 'top',
|
|
@@ -1195,39 +1481,36 @@ function animationOriginToCSS(origin) {
|
|
|
1195
1481
|
'top-left': 'top left',
|
|
1196
1482
|
'top-right': 'top right',
|
|
1197
1483
|
'bottom-left': 'bottom left',
|
|
1198
|
-
'bottom-right': 'bottom right'
|
|
1484
|
+
'bottom-right': 'bottom right'
|
|
1199
1485
|
};
|
|
1200
1486
|
return originMap[origin] || 'center';
|
|
1201
1487
|
}
|
|
1202
1488
|
/**
|
|
1203
1489
|
* Convert AnimationValue to CSS transition property (for custom mode)
|
|
1204
1490
|
* Returns undefined for preset mode - use getEntranceAnimationStyles instead
|
|
1205
|
-
*/
|
|
1206
|
-
|
|
1207
|
-
if (!anim || anim.mode !== 'custom')
|
|
1208
|
-
return undefined;
|
|
1491
|
+
*/ export function animationValueToCSS(anim) {
|
|
1492
|
+
if (!anim || anim.mode !== 'custom') return undefined;
|
|
1209
1493
|
const duration = anim.duration ?? 300;
|
|
1210
1494
|
const delay = anim.delay ?? 0;
|
|
1211
1495
|
const easing = anim.easing ?? 'ease';
|
|
1212
1496
|
const easingCSS = EASING_CSS_MAP[easing] || 'ease';
|
|
1213
1497
|
return {
|
|
1214
1498
|
transition: `all ${duration}ms ${easingCSS} ${delay}ms`,
|
|
1215
|
-
transitionProperty: 'opacity, transform, filter, background-color, color, border-color, box-shadow'
|
|
1499
|
+
transitionProperty: 'opacity, transform, filter, background-color, color, border-color, box-shadow'
|
|
1216
1500
|
};
|
|
1217
1501
|
}
|
|
1218
1502
|
/**
|
|
1219
1503
|
* Get initial and animate styles for entrance animations
|
|
1220
1504
|
* Returns inline CSS style objects that work without Tailwind compilation
|
|
1221
1505
|
* Supports all 27 animation presets with customizable intensity
|
|
1222
|
-
*/
|
|
1223
|
-
export function getEntranceAnimationStyles(anim) {
|
|
1506
|
+
*/ export function getEntranceAnimationStyles(anim) {
|
|
1224
1507
|
const defaultResult = {
|
|
1225
1508
|
initial: {},
|
|
1226
1509
|
animate: {},
|
|
1227
1510
|
duration: 500,
|
|
1228
1511
|
delay: 0,
|
|
1229
1512
|
easing: 'ease',
|
|
1230
|
-
origin: 'center'
|
|
1513
|
+
origin: 'center'
|
|
1231
1514
|
};
|
|
1232
1515
|
if (!anim || anim.mode !== 'preset' || anim.entrance === 'none') {
|
|
1233
1516
|
return defaultResult;
|
|
@@ -1237,114 +1520,249 @@ export function getEntranceAnimationStyles(anim) {
|
|
|
1237
1520
|
const easing = EASING_CSS_MAP[anim.easing ?? 'ease'] || 'ease';
|
|
1238
1521
|
const origin = animationOriginToCSS(anim.origin);
|
|
1239
1522
|
// Intensity values with defaults
|
|
1240
|
-
const distance = anim.distance ?? 24
|
|
1523
|
+
const distance = anim.distance ?? 24 // px
|
|
1524
|
+
;
|
|
1241
1525
|
const scaleFrom = anim.scaleFrom ?? 0.9;
|
|
1242
|
-
const rotateAngle = anim.rotateAngle ?? 15
|
|
1243
|
-
|
|
1526
|
+
const rotateAngle = anim.rotateAngle ?? 15 // degrees
|
|
1527
|
+
;
|
|
1528
|
+
const blurAmount = anim.blurAmount ?? 8 // px
|
|
1529
|
+
;
|
|
1244
1530
|
// Build animation styles based on preset
|
|
1245
1531
|
const entrance = anim.entrance ?? 'none';
|
|
1246
1532
|
let initial = {};
|
|
1247
1533
|
let animate = {};
|
|
1248
|
-
switch
|
|
1534
|
+
switch(entrance){
|
|
1249
1535
|
// ==================== FADE (6) ====================
|
|
1250
1536
|
case 'fade-in':
|
|
1251
|
-
initial = {
|
|
1252
|
-
|
|
1537
|
+
initial = {
|
|
1538
|
+
opacity: 0
|
|
1539
|
+
};
|
|
1540
|
+
animate = {
|
|
1541
|
+
opacity: 1
|
|
1542
|
+
};
|
|
1253
1543
|
break;
|
|
1254
1544
|
case 'fade-up':
|
|
1255
|
-
initial = {
|
|
1256
|
-
|
|
1545
|
+
initial = {
|
|
1546
|
+
opacity: 0,
|
|
1547
|
+
transform: `translateY(${distance}px)`
|
|
1548
|
+
};
|
|
1549
|
+
animate = {
|
|
1550
|
+
opacity: 1,
|
|
1551
|
+
transform: 'translateY(0)'
|
|
1552
|
+
};
|
|
1257
1553
|
break;
|
|
1258
1554
|
case 'fade-down':
|
|
1259
|
-
initial = {
|
|
1260
|
-
|
|
1555
|
+
initial = {
|
|
1556
|
+
opacity: 0,
|
|
1557
|
+
transform: `translateY(-${distance}px)`
|
|
1558
|
+
};
|
|
1559
|
+
animate = {
|
|
1560
|
+
opacity: 1,
|
|
1561
|
+
transform: 'translateY(0)'
|
|
1562
|
+
};
|
|
1261
1563
|
break;
|
|
1262
1564
|
case 'fade-left':
|
|
1263
|
-
initial = {
|
|
1264
|
-
|
|
1565
|
+
initial = {
|
|
1566
|
+
opacity: 0,
|
|
1567
|
+
transform: `translateX(${distance}px)`
|
|
1568
|
+
};
|
|
1569
|
+
animate = {
|
|
1570
|
+
opacity: 1,
|
|
1571
|
+
transform: 'translateX(0)'
|
|
1572
|
+
};
|
|
1265
1573
|
break;
|
|
1266
1574
|
case 'fade-right':
|
|
1267
|
-
initial = {
|
|
1268
|
-
|
|
1575
|
+
initial = {
|
|
1576
|
+
opacity: 0,
|
|
1577
|
+
transform: `translateX(-${distance}px)`
|
|
1578
|
+
};
|
|
1579
|
+
animate = {
|
|
1580
|
+
opacity: 1,
|
|
1581
|
+
transform: 'translateX(0)'
|
|
1582
|
+
};
|
|
1269
1583
|
break;
|
|
1270
1584
|
case 'fade-scale':
|
|
1271
|
-
initial = {
|
|
1272
|
-
|
|
1585
|
+
initial = {
|
|
1586
|
+
opacity: 0,
|
|
1587
|
+
transform: `scale(${scaleFrom})`
|
|
1588
|
+
};
|
|
1589
|
+
animate = {
|
|
1590
|
+
opacity: 1,
|
|
1591
|
+
transform: 'scale(1)'
|
|
1592
|
+
};
|
|
1273
1593
|
break;
|
|
1274
1594
|
// ==================== SCALE (4) ====================
|
|
1275
1595
|
case 'scale-in':
|
|
1276
|
-
initial = {
|
|
1277
|
-
|
|
1596
|
+
initial = {
|
|
1597
|
+
opacity: 0,
|
|
1598
|
+
transform: `scale(${scaleFrom})`
|
|
1599
|
+
};
|
|
1600
|
+
animate = {
|
|
1601
|
+
opacity: 1,
|
|
1602
|
+
transform: 'scale(1)'
|
|
1603
|
+
};
|
|
1278
1604
|
break;
|
|
1279
1605
|
case 'scale-up':
|
|
1280
|
-
initial = {
|
|
1281
|
-
|
|
1606
|
+
initial = {
|
|
1607
|
+
opacity: 0,
|
|
1608
|
+
transform: `scale(${scaleFrom}) translateY(${distance}px)`
|
|
1609
|
+
};
|
|
1610
|
+
animate = {
|
|
1611
|
+
opacity: 1,
|
|
1612
|
+
transform: 'scale(1) translateY(0)'
|
|
1613
|
+
};
|
|
1282
1614
|
break;
|
|
1283
1615
|
case 'scale-down':
|
|
1284
|
-
initial = {
|
|
1285
|
-
|
|
1616
|
+
initial = {
|
|
1617
|
+
opacity: 0,
|
|
1618
|
+
transform: `scale(${scaleFrom}) translateY(-${distance}px)`
|
|
1619
|
+
};
|
|
1620
|
+
animate = {
|
|
1621
|
+
opacity: 1,
|
|
1622
|
+
transform: 'scale(1) translateY(0)'
|
|
1623
|
+
};
|
|
1286
1624
|
break;
|
|
1287
1625
|
case 'scale-out':
|
|
1288
1626
|
// Scales from larger to normal
|
|
1289
|
-
initial = {
|
|
1290
|
-
|
|
1627
|
+
initial = {
|
|
1628
|
+
opacity: 0,
|
|
1629
|
+
transform: `scale(${2 - scaleFrom})`
|
|
1630
|
+
};
|
|
1631
|
+
animate = {
|
|
1632
|
+
opacity: 1,
|
|
1633
|
+
transform: 'scale(1)'
|
|
1634
|
+
};
|
|
1291
1635
|
break;
|
|
1292
1636
|
// ==================== SLIDE (4) ====================
|
|
1293
1637
|
case 'slide-up':
|
|
1294
|
-
initial = {
|
|
1295
|
-
|
|
1638
|
+
initial = {
|
|
1639
|
+
transform: `translateY(${distance}px)`
|
|
1640
|
+
};
|
|
1641
|
+
animate = {
|
|
1642
|
+
transform: 'translateY(0)'
|
|
1643
|
+
};
|
|
1296
1644
|
break;
|
|
1297
1645
|
case 'slide-down':
|
|
1298
|
-
initial = {
|
|
1299
|
-
|
|
1646
|
+
initial = {
|
|
1647
|
+
transform: `translateY(-${distance}px)`
|
|
1648
|
+
};
|
|
1649
|
+
animate = {
|
|
1650
|
+
transform: 'translateY(0)'
|
|
1651
|
+
};
|
|
1300
1652
|
break;
|
|
1301
1653
|
case 'slide-left':
|
|
1302
|
-
initial = {
|
|
1303
|
-
|
|
1654
|
+
initial = {
|
|
1655
|
+
transform: `translateX(${distance}px)`
|
|
1656
|
+
};
|
|
1657
|
+
animate = {
|
|
1658
|
+
transform: 'translateX(0)'
|
|
1659
|
+
};
|
|
1304
1660
|
break;
|
|
1305
1661
|
case 'slide-right':
|
|
1306
|
-
initial = {
|
|
1307
|
-
|
|
1662
|
+
initial = {
|
|
1663
|
+
transform: `translateX(-${distance}px)`
|
|
1664
|
+
};
|
|
1665
|
+
animate = {
|
|
1666
|
+
transform: 'translateX(0)'
|
|
1667
|
+
};
|
|
1308
1668
|
break;
|
|
1309
1669
|
// ==================== BLUR (3) ====================
|
|
1310
1670
|
case 'blur-in':
|
|
1311
|
-
initial = {
|
|
1312
|
-
|
|
1671
|
+
initial = {
|
|
1672
|
+
opacity: 0,
|
|
1673
|
+
filter: `blur(${blurAmount}px)`
|
|
1674
|
+
};
|
|
1675
|
+
animate = {
|
|
1676
|
+
opacity: 1,
|
|
1677
|
+
filter: 'blur(0)'
|
|
1678
|
+
};
|
|
1313
1679
|
break;
|
|
1314
1680
|
case 'blur-up':
|
|
1315
|
-
initial = {
|
|
1316
|
-
|
|
1681
|
+
initial = {
|
|
1682
|
+
opacity: 0,
|
|
1683
|
+
filter: `blur(${blurAmount}px)`,
|
|
1684
|
+
transform: `translateY(${distance}px)`
|
|
1685
|
+
};
|
|
1686
|
+
animate = {
|
|
1687
|
+
opacity: 1,
|
|
1688
|
+
filter: 'blur(0)',
|
|
1689
|
+
transform: 'translateY(0)'
|
|
1690
|
+
};
|
|
1317
1691
|
break;
|
|
1318
1692
|
case 'blur-down':
|
|
1319
|
-
initial = {
|
|
1320
|
-
|
|
1693
|
+
initial = {
|
|
1694
|
+
opacity: 0,
|
|
1695
|
+
filter: `blur(${blurAmount}px)`,
|
|
1696
|
+
transform: `translateY(-${distance}px)`
|
|
1697
|
+
};
|
|
1698
|
+
animate = {
|
|
1699
|
+
opacity: 1,
|
|
1700
|
+
filter: 'blur(0)',
|
|
1701
|
+
transform: 'translateY(0)'
|
|
1702
|
+
};
|
|
1321
1703
|
break;
|
|
1322
1704
|
// ==================== ROTATE (3) ====================
|
|
1323
1705
|
case 'rotate-in':
|
|
1324
|
-
initial = {
|
|
1325
|
-
|
|
1706
|
+
initial = {
|
|
1707
|
+
opacity: 0,
|
|
1708
|
+
transform: `rotate(${rotateAngle}deg) scale(${scaleFrom})`
|
|
1709
|
+
};
|
|
1710
|
+
animate = {
|
|
1711
|
+
opacity: 1,
|
|
1712
|
+
transform: 'rotate(0) scale(1)'
|
|
1713
|
+
};
|
|
1326
1714
|
break;
|
|
1327
1715
|
case 'rotate-up':
|
|
1328
|
-
initial = {
|
|
1329
|
-
|
|
1716
|
+
initial = {
|
|
1717
|
+
opacity: 0,
|
|
1718
|
+
transform: `rotate(${rotateAngle}deg) translateY(${distance}px)`
|
|
1719
|
+
};
|
|
1720
|
+
animate = {
|
|
1721
|
+
opacity: 1,
|
|
1722
|
+
transform: 'rotate(0) translateY(0)'
|
|
1723
|
+
};
|
|
1330
1724
|
break;
|
|
1331
1725
|
case 'rotate-down':
|
|
1332
|
-
initial = {
|
|
1333
|
-
|
|
1726
|
+
initial = {
|
|
1727
|
+
opacity: 0,
|
|
1728
|
+
transform: `rotate(-${rotateAngle}deg) translateY(-${distance}px)`
|
|
1729
|
+
};
|
|
1730
|
+
animate = {
|
|
1731
|
+
opacity: 1,
|
|
1732
|
+
transform: 'rotate(0) translateY(0)'
|
|
1733
|
+
};
|
|
1334
1734
|
break;
|
|
1335
1735
|
// ==================== BOUNCE (3) ====================
|
|
1336
1736
|
// These use spring/bounce easing by default for the effect
|
|
1337
1737
|
case 'bounce-in':
|
|
1338
|
-
initial = {
|
|
1339
|
-
|
|
1738
|
+
initial = {
|
|
1739
|
+
opacity: 0,
|
|
1740
|
+
transform: `scale(${scaleFrom * 0.8})`
|
|
1741
|
+
};
|
|
1742
|
+
animate = {
|
|
1743
|
+
opacity: 1,
|
|
1744
|
+
transform: 'scale(1)'
|
|
1745
|
+
};
|
|
1340
1746
|
break;
|
|
1341
1747
|
case 'bounce-up':
|
|
1342
|
-
initial = {
|
|
1343
|
-
|
|
1748
|
+
initial = {
|
|
1749
|
+
opacity: 0,
|
|
1750
|
+
transform: `translateY(${distance * 1.5}px)`
|
|
1751
|
+
};
|
|
1752
|
+
animate = {
|
|
1753
|
+
opacity: 1,
|
|
1754
|
+
transform: 'translateY(0)'
|
|
1755
|
+
};
|
|
1344
1756
|
break;
|
|
1345
1757
|
case 'bounce-down':
|
|
1346
|
-
initial = {
|
|
1347
|
-
|
|
1758
|
+
initial = {
|
|
1759
|
+
opacity: 0,
|
|
1760
|
+
transform: `translateY(-${distance * 1.5}px)`
|
|
1761
|
+
};
|
|
1762
|
+
animate = {
|
|
1763
|
+
opacity: 1,
|
|
1764
|
+
transform: 'translateY(0)'
|
|
1765
|
+
};
|
|
1348
1766
|
break;
|
|
1349
1767
|
// ==================== FLIP (2) ====================
|
|
1350
1768
|
// Flip uses perspective in transform for proper 3D effect
|
|
@@ -1353,36 +1771,48 @@ export function getEntranceAnimationStyles(anim) {
|
|
|
1353
1771
|
initial = {
|
|
1354
1772
|
transform: 'perspective(1000px) rotateX(-90deg)',
|
|
1355
1773
|
opacity: 0.2,
|
|
1356
|
-
backfaceVisibility: 'hidden'
|
|
1774
|
+
backfaceVisibility: 'hidden'
|
|
1357
1775
|
};
|
|
1358
1776
|
animate = {
|
|
1359
1777
|
transform: 'perspective(1000px) rotateX(0deg)',
|
|
1360
1778
|
opacity: 1,
|
|
1361
|
-
backfaceVisibility: 'hidden'
|
|
1779
|
+
backfaceVisibility: 'hidden'
|
|
1362
1780
|
};
|
|
1363
1781
|
break;
|
|
1364
1782
|
case 'flip-y':
|
|
1365
1783
|
initial = {
|
|
1366
1784
|
transform: 'perspective(1000px) rotateY(-90deg)',
|
|
1367
1785
|
opacity: 0.2,
|
|
1368
|
-
backfaceVisibility: 'hidden'
|
|
1786
|
+
backfaceVisibility: 'hidden'
|
|
1369
1787
|
};
|
|
1370
1788
|
animate = {
|
|
1371
1789
|
transform: 'perspective(1000px) rotateY(0deg)',
|
|
1372
1790
|
opacity: 1,
|
|
1373
|
-
backfaceVisibility: 'hidden'
|
|
1791
|
+
backfaceVisibility: 'hidden'
|
|
1374
1792
|
};
|
|
1375
1793
|
break;
|
|
1376
1794
|
// ==================== ZOOM (2) ====================
|
|
1377
1795
|
case 'zoom-in':
|
|
1378
1796
|
// Starts small, zooms to full size
|
|
1379
|
-
initial = {
|
|
1380
|
-
|
|
1797
|
+
initial = {
|
|
1798
|
+
opacity: 0,
|
|
1799
|
+
transform: `scale(${scaleFrom * 0.5})`
|
|
1800
|
+
};
|
|
1801
|
+
animate = {
|
|
1802
|
+
opacity: 1,
|
|
1803
|
+
transform: 'scale(1)'
|
|
1804
|
+
};
|
|
1381
1805
|
break;
|
|
1382
1806
|
case 'zoom-out':
|
|
1383
1807
|
// Starts large, zooms down to full size
|
|
1384
|
-
initial = {
|
|
1385
|
-
|
|
1808
|
+
initial = {
|
|
1809
|
+
opacity: 0,
|
|
1810
|
+
transform: `scale(${2.5 - scaleFrom})`
|
|
1811
|
+
};
|
|
1812
|
+
animate = {
|
|
1813
|
+
opacity: 1,
|
|
1814
|
+
transform: 'scale(1)'
|
|
1815
|
+
};
|
|
1386
1816
|
break;
|
|
1387
1817
|
default:
|
|
1388
1818
|
break;
|
|
@@ -1393,67 +1823,61 @@ export function getEntranceAnimationStyles(anim) {
|
|
|
1393
1823
|
duration,
|
|
1394
1824
|
delay,
|
|
1395
1825
|
easing,
|
|
1396
|
-
origin
|
|
1826
|
+
origin
|
|
1397
1827
|
};
|
|
1398
1828
|
}
|
|
1399
1829
|
/**
|
|
1400
1830
|
* Get default easing for animation category
|
|
1401
1831
|
* Bounce animations default to bounce easing, etc.
|
|
1402
|
-
*/
|
|
1403
|
-
|
|
1404
|
-
if (entrance.startsWith('
|
|
1405
|
-
|
|
1406
|
-
if (entrance.startsWith('flip-'))
|
|
1407
|
-
return 'back-out';
|
|
1408
|
-
if (entrance.startsWith('zoom-'))
|
|
1409
|
-
return 'ease-out';
|
|
1832
|
+
*/ export function getDefaultEasingForAnimation(entrance) {
|
|
1833
|
+
if (entrance.startsWith('bounce-')) return 'bounce';
|
|
1834
|
+
if (entrance.startsWith('flip-')) return 'back-out';
|
|
1835
|
+
if (entrance.startsWith('zoom-')) return 'ease-out';
|
|
1410
1836
|
return 'ease';
|
|
1411
1837
|
}
|
|
1412
1838
|
/**
|
|
1413
1839
|
* Get CSS custom properties for animation timing
|
|
1414
1840
|
* Useful for CSS-only animations with custom properties
|
|
1415
|
-
*/
|
|
1416
|
-
|
|
1417
|
-
if (!anim)
|
|
1418
|
-
return {};
|
|
1841
|
+
*/ export function getAnimationCSSVariables(anim) {
|
|
1842
|
+
if (!anim) return {};
|
|
1419
1843
|
const isPreset = anim.mode === 'preset';
|
|
1420
|
-
const duration = isPreset ?
|
|
1421
|
-
const delay = isPreset ?
|
|
1844
|
+
const duration = isPreset ? anim.entranceDuration ?? 500 : anim.duration ?? 300;
|
|
1845
|
+
const delay = isPreset ? anim.entranceDelay ?? 0 : anim.delay ?? 0;
|
|
1422
1846
|
const easing = anim.easing ?? 'ease';
|
|
1423
1847
|
const easingCSS = EASING_CSS_MAP[easing] || 'ease';
|
|
1424
1848
|
return {
|
|
1425
1849
|
'--animation-duration': `${duration}ms`,
|
|
1426
1850
|
'--animation-delay': `${delay}ms`,
|
|
1427
|
-
'--animation-easing': easingCSS
|
|
1851
|
+
'--animation-easing': easingCSS
|
|
1428
1852
|
};
|
|
1429
1853
|
}
|
|
1430
1854
|
/**
|
|
1431
1855
|
* Generate stagger delay for a specific child index
|
|
1432
1856
|
* Accounts for direction (forward, reverse, center, edges)
|
|
1433
|
-
*/
|
|
1434
|
-
|
|
1435
|
-
if (!config.enabled || totalChildren <= 1)
|
|
1436
|
-
return 0;
|
|
1857
|
+
*/ export function getStaggerDelay(config, index, totalChildren) {
|
|
1858
|
+
if (!config.enabled || totalChildren <= 1) return 0;
|
|
1437
1859
|
let effectiveIndex;
|
|
1438
|
-
switch
|
|
1860
|
+
switch(config.direction){
|
|
1439
1861
|
case 'forward':
|
|
1440
1862
|
effectiveIndex = index;
|
|
1441
1863
|
break;
|
|
1442
1864
|
case 'reverse':
|
|
1443
1865
|
effectiveIndex = totalChildren - 1 - index;
|
|
1444
1866
|
break;
|
|
1445
|
-
case 'center':
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1867
|
+
case 'center':
|
|
1868
|
+
{
|
|
1869
|
+
// Center starts from middle, animates outward
|
|
1870
|
+
const center = (totalChildren - 1) / 2;
|
|
1871
|
+
effectiveIndex = Math.abs(index - center);
|
|
1872
|
+
break;
|
|
1873
|
+
}
|
|
1874
|
+
case 'edges':
|
|
1875
|
+
{
|
|
1876
|
+
// Edges starts from outside, animates inward
|
|
1877
|
+
const center = (totalChildren - 1) / 2;
|
|
1878
|
+
effectiveIndex = center - Math.abs(index - center);
|
|
1879
|
+
break;
|
|
1880
|
+
}
|
|
1457
1881
|
default:
|
|
1458
1882
|
effectiveIndex = index;
|
|
1459
1883
|
}
|
|
@@ -1467,55 +1891,72 @@ export function getStaggerDelay(config, index, totalChildren) {
|
|
|
1467
1891
|
/**
|
|
1468
1892
|
* Generate CSS styles for staggered children
|
|
1469
1893
|
* Returns an object with CSS custom properties for each child
|
|
1470
|
-
*/
|
|
1471
|
-
export function generateStaggerStyles(config, totalChildren) {
|
|
1894
|
+
*/ export function generateStaggerStyles(config, totalChildren) {
|
|
1472
1895
|
if (!config?.enabled || totalChildren <= 1) {
|
|
1473
1896
|
return Array(totalChildren).fill({});
|
|
1474
1897
|
}
|
|
1475
|
-
return Array.from({
|
|
1898
|
+
return Array.from({
|
|
1899
|
+
length: totalChildren
|
|
1900
|
+
}, (_, i)=>{
|
|
1476
1901
|
const delay = getStaggerDelay(config, i, totalChildren);
|
|
1477
1902
|
return {
|
|
1478
1903
|
'--stagger-delay': `${delay}ms`,
|
|
1479
|
-
transitionDelay: `${delay}ms
|
|
1904
|
+
transitionDelay: `${delay}ms`
|
|
1480
1905
|
};
|
|
1481
1906
|
});
|
|
1482
1907
|
}
|
|
1483
1908
|
/**
|
|
1484
1909
|
* Check which intensity controls are relevant for an animation type
|
|
1485
|
-
*/
|
|
1486
|
-
export function getRelevantIntensityControls(entrance) {
|
|
1910
|
+
*/ export function getRelevantIntensityControls(entrance) {
|
|
1487
1911
|
const hasTranslate = [
|
|
1488
|
-
'fade-up',
|
|
1489
|
-
'
|
|
1490
|
-
'
|
|
1491
|
-
'
|
|
1492
|
-
'
|
|
1493
|
-
'
|
|
1912
|
+
'fade-up',
|
|
1913
|
+
'fade-down',
|
|
1914
|
+
'fade-left',
|
|
1915
|
+
'fade-right',
|
|
1916
|
+
'scale-up',
|
|
1917
|
+
'scale-down',
|
|
1918
|
+
'slide-up',
|
|
1919
|
+
'slide-down',
|
|
1920
|
+
'slide-left',
|
|
1921
|
+
'slide-right',
|
|
1922
|
+
'blur-up',
|
|
1923
|
+
'blur-down',
|
|
1924
|
+
'rotate-up',
|
|
1925
|
+
'rotate-down',
|
|
1926
|
+
'bounce-up',
|
|
1927
|
+
'bounce-down'
|
|
1494
1928
|
].includes(entrance);
|
|
1495
1929
|
const hasScale = [
|
|
1496
1930
|
'fade-scale',
|
|
1497
|
-
'scale-in',
|
|
1931
|
+
'scale-in',
|
|
1932
|
+
'scale-up',
|
|
1933
|
+
'scale-down',
|
|
1934
|
+
'scale-out',
|
|
1498
1935
|
'rotate-in',
|
|
1499
1936
|
'bounce-in',
|
|
1500
|
-
'zoom-in',
|
|
1937
|
+
'zoom-in',
|
|
1938
|
+
'zoom-out'
|
|
1501
1939
|
].includes(entrance);
|
|
1502
1940
|
const hasRotate = [
|
|
1503
|
-
'rotate-in',
|
|
1941
|
+
'rotate-in',
|
|
1942
|
+
'rotate-up',
|
|
1943
|
+
'rotate-down'
|
|
1504
1944
|
].includes(entrance);
|
|
1505
1945
|
const hasBlur = [
|
|
1506
|
-
'blur-in',
|
|
1946
|
+
'blur-in',
|
|
1947
|
+
'blur-up',
|
|
1948
|
+
'blur-down'
|
|
1507
1949
|
].includes(entrance);
|
|
1508
1950
|
return {
|
|
1509
1951
|
showDistance: hasTranslate,
|
|
1510
1952
|
showScale: hasScale,
|
|
1511
1953
|
showRotate: hasRotate,
|
|
1512
|
-
showBlur: hasBlur
|
|
1954
|
+
showBlur: hasBlur
|
|
1513
1955
|
};
|
|
1514
1956
|
}
|
|
1515
1957
|
/**
|
|
1516
1958
|
* Default animation value
|
|
1517
|
-
*/
|
|
1518
|
-
export const DEFAULT_ANIMATION = {
|
|
1959
|
+
*/ export const DEFAULT_ANIMATION = {
|
|
1519
1960
|
mode: 'preset',
|
|
1520
1961
|
entrance: 'none',
|
|
1521
1962
|
entranceDuration: 500,
|
|
@@ -1528,7 +1969,7 @@ export const DEFAULT_ANIMATION = {
|
|
|
1528
1969
|
easing: 'ease',
|
|
1529
1970
|
triggerOnScroll: true,
|
|
1530
1971
|
triggerThreshold: 0.1,
|
|
1531
|
-
triggerOnce: true
|
|
1972
|
+
triggerOnce: true
|
|
1532
1973
|
};
|
|
1533
1974
|
// =============================================================================
|
|
1534
1975
|
// Layout Components Disallow List (prevent recursion in slots)
|
|
@@ -1537,15 +1978,13 @@ export const layoutComponentsDisallow = [
|
|
|
1537
1978
|
'Container',
|
|
1538
1979
|
'Flex',
|
|
1539
1980
|
'Grid',
|
|
1540
|
-
'Section'
|
|
1981
|
+
'Section'
|
|
1541
1982
|
];
|
|
1542
1983
|
/**
|
|
1543
1984
|
* Convert SizeValue to CSS properties (only for custom mode)
|
|
1544
1985
|
* Server-safe utility for Button and other components
|
|
1545
|
-
*/
|
|
1546
|
-
|
|
1547
|
-
if (!size || size.mode !== 'custom')
|
|
1548
|
-
return undefined;
|
|
1986
|
+
*/ export function sizeValueToCSS(size) {
|
|
1987
|
+
if (!size || size.mode !== 'custom') return undefined;
|
|
1549
1988
|
const unit = size.unit || 'px';
|
|
1550
1989
|
const style = {};
|
|
1551
1990
|
if (size.height != null) {
|
|
@@ -1565,12 +2004,10 @@ export function sizeValueToCSS(size) {
|
|
|
1565
2004
|
* Get Tailwind size classes for preset modes
|
|
1566
2005
|
* Returns empty string for custom mode (CSS properties handle that)
|
|
1567
2006
|
* Server-safe utility for Button and other components
|
|
1568
|
-
*/
|
|
1569
|
-
|
|
1570
|
-
if (
|
|
1571
|
-
return sizeMap.default || '';
|
|
1572
|
-
if (size.mode === 'custom')
|
|
1573
|
-
return '';
|
|
2007
|
+
*/ export function getSizeClasses(size, sizeMap) {
|
|
2008
|
+
if (!size) return sizeMap.default || '';
|
|
2009
|
+
if (size.mode === 'custom') return '';
|
|
1574
2010
|
return sizeMap[size.mode] || sizeMap.default || '';
|
|
1575
2011
|
}
|
|
2012
|
+
|
|
1576
2013
|
//# sourceMappingURL=shared.js.map
|