@jhits/plugin-blog 0.0.8 → 0.0.10
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/dist/api/categories.d.ts +8 -0
- package/dist/api/categories.d.ts.map +1 -0
- package/dist/api/categories.js +30 -0
- package/dist/api/check-title.d.ts +8 -0
- package/dist/api/check-title.d.ts.map +1 -0
- package/dist/api/check-title.js +47 -0
- package/dist/api/config-handler.d.ts +21 -0
- package/dist/api/config-handler.d.ts.map +1 -0
- package/dist/api/config-handler.js +46 -0
- package/dist/api/handler.d.ts +42 -0
- package/dist/api/handler.d.ts.map +1 -0
- package/dist/api/handler.js +331 -0
- package/dist/api/index.d.ts +12 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +12 -0
- package/dist/api/route.d.ts +50 -0
- package/dist/api/route.d.ts.map +1 -0
- package/dist/api/route.js +69 -0
- package/dist/api/router.d.ts +27 -0
- package/dist/api/router.d.ts.map +1 -0
- package/dist/api/router.js +98 -0
- package/dist/api-server.d.ts +9 -0
- package/dist/api-server.d.ts.map +1 -0
- package/dist/api-server.js +9 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +156 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/useBlog.d.ts +31 -0
- package/dist/hooks/useBlog.d.ts.map +1 -0
- package/dist/hooks/useBlog.js +57 -0
- package/dist/hooks/useBlogs.d.ts +39 -0
- package/dist/hooks/useBlogs.d.ts.map +1 -0
- package/dist/hooks/useBlogs.js +82 -0
- package/dist/hooks/useCategories.d.ts +9 -0
- package/dist/hooks/useCategories.d.ts.map +1 -0
- package/dist/hooks/useCategories.js +70 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +228 -0
- package/dist/index.server.d.ts +12 -0
- package/dist/index.server.d.ts.map +1 -0
- package/dist/index.server.js +10 -0
- package/dist/init.d.ts +40 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +41 -0
- package/dist/lib/blocks/BlockRenderer.d.ts +54 -0
- package/dist/lib/blocks/BlockRenderer.d.ts.map +1 -0
- package/dist/lib/blocks/BlockRenderer.js +54 -0
- package/dist/lib/blocks/index.d.ts +5 -0
- package/dist/lib/blocks/index.d.ts.map +1 -0
- package/dist/lib/blocks/index.js +4 -0
- package/dist/lib/config-storage.d.ts +30 -0
- package/dist/lib/config-storage.d.ts.map +1 -0
- package/dist/lib/config-storage.js +31 -0
- package/dist/lib/index.d.ts +8 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +7 -0
- package/dist/lib/layouts/blocks/ColumnsBlock.d.ts +25 -0
- package/dist/lib/layouts/blocks/ColumnsBlock.d.ts.map +1 -0
- package/dist/lib/layouts/blocks/ColumnsBlock.js +186 -0
- package/dist/lib/layouts/blocks/SectionBlock.d.ts +25 -0
- package/dist/lib/layouts/blocks/SectionBlock.d.ts.map +1 -0
- package/dist/lib/layouts/blocks/SectionBlock.js +44 -0
- package/dist/lib/layouts/blocks/index.d.ts +7 -0
- package/dist/lib/layouts/blocks/index.d.ts.map +1 -0
- package/dist/lib/layouts/blocks/index.js +6 -0
- package/dist/lib/layouts/index.d.ts +23 -0
- package/dist/lib/layouts/index.d.ts.map +1 -0
- package/dist/lib/layouts/index.js +45 -0
- package/dist/lib/layouts/registerLayoutBlocks.d.ts +9 -0
- package/dist/lib/layouts/registerLayoutBlocks.d.ts.map +1 -0
- package/dist/lib/layouts/registerLayoutBlocks.js +60 -0
- package/dist/lib/mappers/apiMapper.d.ts +66 -0
- package/dist/lib/mappers/apiMapper.d.ts.map +1 -0
- package/dist/lib/mappers/apiMapper.js +188 -0
- package/dist/lib/migration/index.d.ts +5 -0
- package/dist/lib/migration/index.d.ts.map +1 -0
- package/dist/lib/migration/index.js +4 -0
- package/dist/lib/migration/mapper.d.ts +37 -0
- package/dist/lib/migration/mapper.d.ts.map +1 -0
- package/dist/lib/migration/mapper.js +98 -0
- package/dist/lib/rich-text/RichTextEditor.d.ts +45 -0
- package/dist/lib/rich-text/RichTextEditor.d.ts.map +1 -0
- package/dist/lib/rich-text/RichTextEditor.js +556 -0
- package/dist/lib/rich-text/RichTextPreview.d.ts +16 -0
- package/dist/lib/rich-text/RichTextPreview.d.ts.map +1 -0
- package/dist/lib/rich-text/RichTextPreview.js +144 -0
- package/dist/lib/rich-text/index.d.ts +9 -0
- package/dist/lib/rich-text/index.d.ts.map +1 -0
- package/dist/lib/rich-text/index.js +6 -0
- package/dist/lib/utils/blockHelpers.d.ts +23 -0
- package/dist/lib/utils/blockHelpers.d.ts.map +1 -0
- package/dist/lib/utils/blockHelpers.js +65 -0
- package/dist/lib/utils/configValidation.d.ts +23 -0
- package/dist/lib/utils/configValidation.d.ts.map +1 -0
- package/dist/lib/utils/configValidation.js +111 -0
- package/dist/lib/utils/index.d.ts +7 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +6 -0
- package/dist/lib/utils/slugify.d.ts +25 -0
- package/dist/lib/utils/slugify.d.ts.map +1 -0
- package/dist/lib/utils/slugify.js +65 -0
- package/dist/registry/BlockRegistry.d.ts +62 -0
- package/dist/registry/BlockRegistry.d.ts.map +1 -0
- package/dist/registry/BlockRegistry.js +112 -0
- package/dist/registry/index.d.ts +6 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +4 -0
- package/dist/state/EditorContext.d.ts +45 -0
- package/dist/state/EditorContext.d.ts.map +1 -0
- package/dist/state/EditorContext.js +215 -0
- package/dist/state/index.d.ts +7 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +6 -0
- package/dist/state/reducer.d.ts +11 -0
- package/dist/state/reducer.d.ts.map +1 -0
- package/dist/state/reducer.js +599 -0
- package/dist/state/types.d.ts +162 -0
- package/dist/state/types.d.ts.map +1 -0
- package/dist/state/types.js +27 -0
- package/dist/types/block.d.ts +221 -0
- package/dist/types/block.d.ts.map +1 -0
- package/dist/types/block.js +6 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/post.d.ts +136 -0
- package/dist/types/post.d.ts.map +1 -0
- package/dist/types/post.js +5 -0
- package/dist/utils/client.d.ts +48 -0
- package/dist/utils/client.d.ts.map +1 -0
- package/dist/utils/client.js +77 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/views/CanvasEditor/BlockWrapper.d.ts +16 -0
- package/dist/views/CanvasEditor/BlockWrapper.d.ts.map +1 -0
- package/dist/views/CanvasEditor/BlockWrapper.js +285 -0
- package/dist/views/CanvasEditor/CanvasEditorView.d.ts +14 -0
- package/dist/views/CanvasEditor/CanvasEditorView.d.ts.map +1 -0
- package/dist/views/CanvasEditor/CanvasEditorView.js +215 -0
- package/dist/views/CanvasEditor/EditorBody.d.ts +22 -0
- package/dist/views/CanvasEditor/EditorBody.d.ts.map +1 -0
- package/dist/views/CanvasEditor/EditorBody.js +505 -0
- package/dist/views/CanvasEditor/EditorHeader.d.ts +18 -0
- package/dist/views/CanvasEditor/EditorHeader.d.ts.map +1 -0
- package/dist/views/CanvasEditor/EditorHeader.js +101 -0
- package/dist/views/CanvasEditor/LayoutContainer.d.ts +17 -0
- package/dist/views/CanvasEditor/LayoutContainer.d.ts.map +1 -0
- package/dist/views/CanvasEditor/LayoutContainer.js +222 -0
- package/dist/views/CanvasEditor/SaveConfirmationModal.d.ts +13 -0
- package/dist/views/CanvasEditor/SaveConfirmationModal.d.ts.map +1 -0
- package/dist/views/CanvasEditor/SaveConfirmationModal.js +78 -0
- package/dist/views/CanvasEditor/components/CustomBlockItem.d.ts +14 -0
- package/dist/views/CanvasEditor/components/CustomBlockItem.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/CustomBlockItem.js +44 -0
- package/dist/views/CanvasEditor/components/EditorCanvas.d.ts +29 -0
- package/dist/views/CanvasEditor/components/EditorCanvas.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/EditorCanvas.js +32 -0
- package/dist/views/CanvasEditor/components/EditorLibrary.d.ts +7 -0
- package/dist/views/CanvasEditor/components/EditorLibrary.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/EditorLibrary.js +25 -0
- package/dist/views/CanvasEditor/components/EditorSidebar.d.ts +13 -0
- package/dist/views/CanvasEditor/components/EditorSidebar.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/EditorSidebar.js +19 -0
- package/dist/views/CanvasEditor/components/ErrorBanner.d.ts +6 -0
- package/dist/views/CanvasEditor/components/ErrorBanner.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/ErrorBanner.js +8 -0
- package/dist/views/CanvasEditor/components/FeaturedMediaSection.d.ts +25 -0
- package/dist/views/CanvasEditor/components/FeaturedMediaSection.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/FeaturedMediaSection.js +199 -0
- package/dist/views/CanvasEditor/components/LibraryItem.d.ts +14 -0
- package/dist/views/CanvasEditor/components/LibraryItem.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/LibraryItem.js +43 -0
- package/dist/views/CanvasEditor/components/PrivacySettingsSection.d.ts +15 -0
- package/dist/views/CanvasEditor/components/PrivacySettingsSection.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/PrivacySettingsSection.js +70 -0
- package/dist/views/CanvasEditor/components/index.d.ts +21 -0
- package/dist/views/CanvasEditor/components/index.d.ts.map +1 -0
- package/dist/views/CanvasEditor/components/index.js +12 -0
- package/dist/views/CanvasEditor/hooks/index.d.ts +10 -0
- package/dist/views/CanvasEditor/hooks/index.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/index.js +9 -0
- package/dist/views/CanvasEditor/hooks/useHeroBlock.d.ts +8 -0
- package/dist/views/CanvasEditor/hooks/useHeroBlock.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/useHeroBlock.js +90 -0
- package/dist/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts +3 -0
- package/dist/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/useKeyboardShortcuts.js +119 -0
- package/dist/views/CanvasEditor/hooks/usePostLoader.d.ts +5 -0
- package/dist/views/CanvasEditor/hooks/usePostLoader.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/usePostLoader.js +32 -0
- package/dist/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts +2 -0
- package/dist/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/useRegisteredBlocks.js +47 -0
- package/dist/views/CanvasEditor/hooks/useUnsavedChanges.d.ts +25 -0
- package/dist/views/CanvasEditor/hooks/useUnsavedChanges.d.ts.map +1 -0
- package/dist/views/CanvasEditor/hooks/useUnsavedChanges.js +285 -0
- package/dist/views/CanvasEditor/index.d.ts +16 -0
- package/dist/views/CanvasEditor/index.d.ts.map +1 -0
- package/dist/views/CanvasEditor/index.js +9 -0
- package/dist/views/PostManager/EmptyState.d.ts +10 -0
- package/dist/views/PostManager/EmptyState.d.ts.map +1 -0
- package/dist/views/PostManager/EmptyState.js +12 -0
- package/dist/views/PostManager/PostActionsMenu.d.ts +12 -0
- package/dist/views/PostManager/PostActionsMenu.d.ts.map +1 -0
- package/dist/views/PostManager/PostActionsMenu.js +58 -0
- package/dist/views/PostManager/PostCards.d.ts +15 -0
- package/dist/views/PostManager/PostCards.d.ts.map +1 -0
- package/dist/views/PostManager/PostCards.js +77 -0
- package/dist/views/PostManager/PostFilters.d.ts +16 -0
- package/dist/views/PostManager/PostFilters.d.ts.map +1 -0
- package/dist/views/PostManager/PostFilters.js +10 -0
- package/dist/views/PostManager/PostManagerView.d.ts +11 -0
- package/dist/views/PostManager/PostManagerView.d.ts.map +1 -0
- package/dist/views/PostManager/PostManagerView.js +179 -0
- package/dist/views/PostManager/PostStats.d.ts +11 -0
- package/dist/views/PostManager/PostStats.d.ts.map +1 -0
- package/dist/views/PostManager/PostStats.js +46 -0
- package/dist/views/PostManager/PostTable.d.ts +15 -0
- package/dist/views/PostManager/PostTable.d.ts.map +1 -0
- package/dist/views/PostManager/PostTable.js +77 -0
- package/dist/views/PostManager/index.d.ts +12 -0
- package/dist/views/PostManager/index.d.ts.map +1 -0
- package/dist/views/PostManager/index.js +11 -0
- package/dist/views/Preview/PreviewBridgeView.d.ts +12 -0
- package/dist/views/Preview/PreviewBridgeView.d.ts.map +1 -0
- package/dist/views/Preview/PreviewBridgeView.js +11 -0
- package/dist/views/Preview/index.d.ts +6 -0
- package/dist/views/Preview/index.d.ts.map +1 -0
- package/dist/views/Preview/index.js +4 -0
- package/dist/views/Settings/SettingsView.d.ts +10 -0
- package/dist/views/Settings/SettingsView.d.ts.map +1 -0
- package/dist/views/Settings/SettingsView.js +113 -0
- package/dist/views/Settings/index.d.ts +6 -0
- package/dist/views/Settings/index.d.ts.map +1 -0
- package/dist/views/Settings/index.js +4 -0
- package/dist/views/SlugSEO/SlugSEOManagerView.d.ts +12 -0
- package/dist/views/SlugSEO/SlugSEOManagerView.d.ts.map +1 -0
- package/dist/views/SlugSEO/SlugSEOManagerView.js +11 -0
- package/dist/views/SlugSEO/index.d.ts +6 -0
- package/dist/views/SlugSEO/index.d.ts.map +1 -0
- package/dist/views/SlugSEO/index.js +4 -0
- package/package.json +4 -4
- package/src/hooks/index.d.ts +8 -0
- package/src/hooks/index.d.ts.map +1 -0
- package/src/hooks/index.js +7 -0
- package/src/hooks/useBlog.d.ts +31 -0
- package/src/hooks/useBlog.d.ts.map +1 -0
- package/src/hooks/useBlog.js +57 -0
- package/src/hooks/useBlogs.d.ts +39 -0
- package/src/hooks/useBlogs.d.ts.map +1 -0
- package/src/hooks/useBlogs.js +82 -0
- package/src/hooks/useCategories.d.ts +9 -0
- package/src/hooks/useCategories.d.ts.map +1 -0
- package/src/hooks/useCategories.js +70 -0
- package/src/index.d.ts +55 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +228 -0
- package/src/init.d.ts +40 -0
- package/src/init.d.ts.map +1 -0
- package/src/init.js +41 -0
- package/src/lib/blocks/BlockRenderer.d.ts +54 -0
- package/src/lib/blocks/BlockRenderer.d.ts.map +1 -0
- package/src/lib/blocks/BlockRenderer.js +54 -0
- package/src/lib/config-storage.d.ts +30 -0
- package/src/lib/config-storage.d.ts.map +1 -0
- package/src/lib/config-storage.js +31 -0
- package/src/lib/layouts/blocks/ColumnsBlock.d.ts +25 -0
- package/src/lib/layouts/blocks/ColumnsBlock.d.ts.map +1 -0
- package/src/lib/layouts/blocks/ColumnsBlock.js +182 -0
- package/src/lib/layouts/blocks/SectionBlock.d.ts +25 -0
- package/src/lib/layouts/blocks/SectionBlock.d.ts.map +1 -0
- package/src/lib/layouts/blocks/SectionBlock.js +44 -0
- package/src/lib/layouts/index.d.ts +23 -0
- package/src/lib/layouts/index.d.ts.map +1 -0
- package/src/lib/layouts/index.js +45 -0
- package/src/lib/layouts/registerLayoutBlocks.d.ts +9 -0
- package/src/lib/layouts/registerLayoutBlocks.d.ts.map +1 -0
- package/src/lib/layouts/registerLayoutBlocks.js +60 -0
- package/src/lib/mappers/apiMapper.d.ts +66 -0
- package/src/lib/mappers/apiMapper.d.ts.map +1 -0
- package/src/lib/mappers/apiMapper.js +191 -0
- package/src/lib/rich-text/RichTextEditor.d.ts +45 -0
- package/src/lib/rich-text/RichTextEditor.d.ts.map +1 -0
- package/src/lib/rich-text/RichTextEditor.js +564 -0
- package/src/lib/rich-text/RichTextPreview.d.ts +16 -0
- package/src/lib/rich-text/RichTextPreview.d.ts.map +1 -0
- package/src/lib/rich-text/RichTextPreview.js +144 -0
- package/src/lib/rich-text/index.d.ts +9 -0
- package/src/lib/rich-text/index.d.ts.map +1 -0
- package/src/lib/rich-text/index.js +6 -0
- package/src/lib/utils/blockHelpers.d.ts +23 -0
- package/src/lib/utils/blockHelpers.d.ts.map +1 -0
- package/src/lib/utils/blockHelpers.js +65 -0
- package/src/lib/utils/configValidation.d.ts +23 -0
- package/src/lib/utils/configValidation.d.ts.map +1 -0
- package/src/lib/utils/configValidation.js +113 -0
- package/src/registry/BlockRegistry.d.ts +62 -0
- package/src/registry/BlockRegistry.d.ts.map +1 -0
- package/src/registry/BlockRegistry.js +112 -0
- package/src/registry/index.d.ts +6 -0
- package/src/registry/index.d.ts.map +1 -0
- package/src/registry/index.js +4 -0
- package/src/state/EditorContext.d.ts +45 -0
- package/src/state/EditorContext.d.ts.map +1 -0
- package/src/state/EditorContext.js +215 -0
- package/src/state/index.d.ts +7 -0
- package/src/state/index.d.ts.map +1 -0
- package/src/state/index.js +6 -0
- package/src/state/reducer.d.ts +11 -0
- package/src/state/reducer.d.ts.map +1 -0
- package/src/state/reducer.js +443 -0
- package/src/state/types.d.ts +162 -0
- package/src/state/types.d.ts.map +1 -0
- package/src/state/types.js +27 -0
- package/src/types/block.d.ts +221 -0
- package/src/types/block.d.ts.map +1 -0
- package/src/types/block.js +6 -0
- package/src/types/index.d.ts +8 -0
- package/src/types/index.d.ts.map +1 -0
- package/src/types/index.js +5 -0
- package/src/types/post.d.ts +136 -0
- package/src/types/post.d.ts.map +1 -0
- package/src/types/post.js +5 -0
- package/src/utils/client.d.ts +48 -0
- package/src/utils/client.d.ts.map +1 -0
- package/src/utils/client.js +77 -0
- package/src/views/CanvasEditor/BlockWrapper.d.ts +16 -0
- package/src/views/CanvasEditor/BlockWrapper.d.ts.map +1 -0
- package/src/views/CanvasEditor/BlockWrapper.js +276 -0
- package/src/views/CanvasEditor/CanvasEditorView.d.ts +14 -0
- package/src/views/CanvasEditor/CanvasEditorView.d.ts.map +1 -0
- package/src/views/CanvasEditor/CanvasEditorView.js +209 -0
- package/src/views/CanvasEditor/EditorBody.d.ts +22 -0
- package/src/views/CanvasEditor/EditorBody.d.ts.map +1 -0
- package/src/views/CanvasEditor/EditorBody.js +505 -0
- package/src/views/CanvasEditor/EditorHeader.d.ts +18 -0
- package/src/views/CanvasEditor/EditorHeader.d.ts.map +1 -0
- package/src/views/CanvasEditor/EditorHeader.js +101 -0
- package/src/views/CanvasEditor/LayoutContainer.d.ts +17 -0
- package/src/views/CanvasEditor/LayoutContainer.d.ts.map +1 -0
- package/src/views/CanvasEditor/LayoutContainer.js +222 -0
- package/src/views/CanvasEditor/SaveConfirmationModal.d.ts +13 -0
- package/src/views/CanvasEditor/SaveConfirmationModal.d.ts.map +1 -0
- package/src/views/CanvasEditor/SaveConfirmationModal.js +78 -0
- package/src/views/CanvasEditor/components/CustomBlockItem.d.ts +14 -0
- package/src/views/CanvasEditor/components/CustomBlockItem.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/CustomBlockItem.js +44 -0
- package/src/views/CanvasEditor/components/EditorCanvas.d.ts +29 -0
- package/src/views/CanvasEditor/components/EditorCanvas.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/EditorCanvas.js +32 -0
- package/src/views/CanvasEditor/components/EditorLibrary.d.ts +7 -0
- package/src/views/CanvasEditor/components/EditorLibrary.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/EditorLibrary.js +25 -0
- package/src/views/CanvasEditor/components/EditorSidebar.d.ts +13 -0
- package/src/views/CanvasEditor/components/EditorSidebar.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/EditorSidebar.js +20 -0
- package/src/views/CanvasEditor/components/ErrorBanner.d.ts +6 -0
- package/src/views/CanvasEditor/components/ErrorBanner.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/ErrorBanner.js +8 -0
- package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts +25 -0
- package/src/views/CanvasEditor/components/FeaturedMediaSection.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/FeaturedMediaSection.js +182 -0
- package/src/views/CanvasEditor/components/LibraryItem.d.ts +14 -0
- package/src/views/CanvasEditor/components/LibraryItem.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/LibraryItem.js +43 -0
- package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts +15 -0
- package/src/views/CanvasEditor/components/PrivacySettingsSection.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/PrivacySettingsSection.js +63 -0
- package/src/views/CanvasEditor/components/index.d.ts +21 -0
- package/src/views/CanvasEditor/components/index.d.ts.map +1 -0
- package/src/views/CanvasEditor/components/index.js +12 -0
- package/src/views/CanvasEditor/hooks/index.d.ts +10 -0
- package/src/views/CanvasEditor/hooks/index.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/index.js +9 -0
- package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts +8 -0
- package/src/views/CanvasEditor/hooks/useHeroBlock.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/useHeroBlock.js +79 -0
- package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts +3 -0
- package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/useKeyboardShortcuts.js +114 -0
- package/src/views/CanvasEditor/hooks/usePostLoader.d.ts +5 -0
- package/src/views/CanvasEditor/hooks/usePostLoader.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/usePostLoader.js +32 -0
- package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts +2 -0
- package/src/views/CanvasEditor/hooks/useRegisteredBlocks.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/useRegisteredBlocks.js +47 -0
- package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts +25 -0
- package/src/views/CanvasEditor/hooks/useUnsavedChanges.d.ts.map +1 -0
- package/src/views/CanvasEditor/hooks/useUnsavedChanges.js +285 -0
- package/src/views/CanvasEditor/index.d.ts +16 -0
- package/src/views/CanvasEditor/index.d.ts.map +1 -0
- package/src/views/CanvasEditor/index.js +9 -0
- package/src/views/PostManager/EmptyState.d.ts +10 -0
- package/src/views/PostManager/EmptyState.d.ts.map +1 -0
- package/src/views/PostManager/EmptyState.js +12 -0
- package/src/views/PostManager/PostActionsMenu.d.ts +12 -0
- package/src/views/PostManager/PostActionsMenu.d.ts.map +1 -0
- package/src/views/PostManager/PostActionsMenu.js +58 -0
- package/src/views/PostManager/PostCards.d.ts +15 -0
- package/src/views/PostManager/PostCards.d.ts.map +1 -0
- package/src/views/PostManager/PostCards.js +79 -0
- package/src/views/PostManager/PostFilters.d.ts +16 -0
- package/src/views/PostManager/PostFilters.d.ts.map +1 -0
- package/src/views/PostManager/PostFilters.js +10 -0
- package/src/views/PostManager/PostManagerView.d.ts +11 -0
- package/src/views/PostManager/PostManagerView.d.ts.map +1 -0
- package/src/views/PostManager/PostManagerView.js +174 -0
- package/src/views/PostManager/PostStats.d.ts +11 -0
- package/src/views/PostManager/PostStats.d.ts.map +1 -0
- package/src/views/PostManager/PostStats.js +46 -0
- package/src/views/PostManager/PostTable.d.ts +15 -0
- package/src/views/PostManager/PostTable.d.ts.map +1 -0
- package/src/views/PostManager/PostTable.js +79 -0
- package/src/views/PostManager/index.d.ts +12 -0
- package/src/views/PostManager/index.d.ts.map +1 -0
- package/src/views/PostManager/index.js +11 -0
- package/src/views/Preview/PreviewBridgeView.d.ts +12 -0
- package/src/views/Preview/PreviewBridgeView.d.ts.map +1 -0
- package/src/views/Preview/PreviewBridgeView.js +11 -0
- package/src/views/Preview/index.d.ts +6 -0
- package/src/views/Preview/index.d.ts.map +1 -0
- package/src/views/Preview/index.js +4 -0
- package/src/views/Settings/SettingsView.d.ts +10 -0
- package/src/views/Settings/SettingsView.d.ts.map +1 -0
- package/src/views/Settings/SettingsView.js +111 -0
- package/src/views/Settings/index.d.ts +6 -0
- package/src/views/Settings/index.d.ts.map +1 -0
- package/src/views/Settings/index.js +4 -0
- package/src/views/SlugSEO/SlugSEOManagerView.d.ts +12 -0
- package/src/views/SlugSEO/SlugSEOManagerView.d.ts.map +1 -0
- package/src/views/SlugSEO/SlugSEOManagerView.js +11 -0
- package/src/views/SlugSEO/index.d.ts +6 -0
- package/src/views/SlugSEO/index.d.ts.map +1 -0
- package/src/views/SlugSEO/index.js +4 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor Body Component
|
|
3
|
+
* Primary root container for the editor canvas
|
|
4
|
+
* Acts as the main drop zone for blocks
|
|
5
|
+
*/
|
|
6
|
+
import { Block } from '../../types/block';
|
|
7
|
+
export interface EditorBodyProps {
|
|
8
|
+
blocks: Block[];
|
|
9
|
+
onBlockAdd: (type: string, index: number, containerId?: string) => void;
|
|
10
|
+
onBlockUpdate: (id: string, data: Partial<Block['data']>) => void;
|
|
11
|
+
onBlockDelete: (id: string) => void;
|
|
12
|
+
onBlockMove: (id: string, newIndex: number, containerId?: string) => void;
|
|
13
|
+
/** Enable dark mode for content area and wrappers (default: true) */
|
|
14
|
+
darkMode?: boolean;
|
|
15
|
+
/** Background colors for the editor */
|
|
16
|
+
backgroundColors?: {
|
|
17
|
+
light: string;
|
|
18
|
+
dark?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare function EditorBody({ blocks, onBlockAdd, onBlockUpdate, onBlockDelete, onBlockMove, darkMode, backgroundColors, }: EditorBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=EditorBody.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorBody.d.ts","sourceRoot":"","sources":["../../../src/views/CanvasEditor/EditorBody.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC;IAClE,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,gBAAgB,CAAC,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACL;AAED,wBAAgB,UAAU,CAAC,EACvB,MAAM,EACN,UAAU,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,QAAe,EACf,gBAAgB,GACnB,EAAE,eAAe,2CAuhBjB"}
|
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor Body Component
|
|
3
|
+
* Primary root container for the editor canvas
|
|
4
|
+
* Acts as the main drop zone for blocks
|
|
5
|
+
*/
|
|
6
|
+
'use client';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useState, useRef, Fragment, useEffect } from 'react';
|
|
9
|
+
import { Plus } from 'lucide-react';
|
|
10
|
+
import { BlockWrapper } from './BlockWrapper';
|
|
11
|
+
export function EditorBody({ blocks, onBlockAdd, onBlockUpdate, onBlockDelete, onBlockMove, darkMode = true, backgroundColors, }) {
|
|
12
|
+
// --- State ---
|
|
13
|
+
const [dragOverIndex, setDragOverIndex] = useState(null);
|
|
14
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
15
|
+
const [draggedBlockId, setDraggedBlockId] = useState(null);
|
|
16
|
+
const [dropIndicatorPosition, setDropIndicatorPosition] = useState(null);
|
|
17
|
+
const [calculatedInsertIndex, setCalculatedInsertIndex] = useState(null);
|
|
18
|
+
// --- Refs ---
|
|
19
|
+
const containerRef = useRef(null);
|
|
20
|
+
const blockRefs = useRef(new Map());
|
|
21
|
+
// --- Cleanup & Event Listeners ---
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const handleClearIndicator = () => {
|
|
24
|
+
setDropIndicatorPosition(null);
|
|
25
|
+
setDragOverIndex(null);
|
|
26
|
+
};
|
|
27
|
+
const container = containerRef.current;
|
|
28
|
+
if (container) {
|
|
29
|
+
container.addEventListener('clear-drop-indicator', handleClearIndicator);
|
|
30
|
+
return () => {
|
|
31
|
+
container.removeEventListener('clear-drop-indicator', handleClearIndicator);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}, []);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const handleGlobalDragEnd = () => {
|
|
37
|
+
setDropIndicatorPosition(null);
|
|
38
|
+
setDragOverIndex(null);
|
|
39
|
+
setIsDragging(false);
|
|
40
|
+
setDraggedBlockId(null);
|
|
41
|
+
setCalculatedInsertIndex(null);
|
|
42
|
+
};
|
|
43
|
+
document.addEventListener('dragend', handleGlobalDragEnd);
|
|
44
|
+
return () => {
|
|
45
|
+
document.removeEventListener('dragend', handleGlobalDragEnd);
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
// --- Helper Functions ---
|
|
49
|
+
const setBlockRef = (blockId) => (el) => {
|
|
50
|
+
if (el) {
|
|
51
|
+
blockRefs.current.set(blockId, el);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
blockRefs.current.delete(blockId);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
// --- Drag & Drop Logic ---
|
|
58
|
+
const handleDragStart = (e) => {
|
|
59
|
+
// This is called when dragging starts from the container
|
|
60
|
+
// The actual block drag start is handled in BlockWrapper
|
|
61
|
+
setIsDragging(true);
|
|
62
|
+
};
|
|
63
|
+
const handleDragOver = (e, index, element) => {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
// Check if we're dragging over a nested container - if so, clear our indicator
|
|
67
|
+
const target = e.target;
|
|
68
|
+
const nestedContainer = target.closest('[data-layout-container]');
|
|
69
|
+
if (nestedContainer && nestedContainer !== containerRef.current) {
|
|
70
|
+
// We're over a nested container, clear our indicator
|
|
71
|
+
setDropIndicatorPosition(null);
|
|
72
|
+
setDragOverIndex(null);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
setDragOverIndex(index);
|
|
76
|
+
// Calculate position for absolute drop indicator - always show between blocks
|
|
77
|
+
const container = containerRef.current;
|
|
78
|
+
if (container && element) {
|
|
79
|
+
requestAnimationFrame(() => {
|
|
80
|
+
// Double-check refs are still valid inside RAF callback
|
|
81
|
+
if (!containerRef.current)
|
|
82
|
+
return;
|
|
83
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
84
|
+
const elementRect = element.getBoundingClientRect();
|
|
85
|
+
const mouseY = e.clientY;
|
|
86
|
+
const relativeTop = mouseY - containerRect.top;
|
|
87
|
+
const elementTop = elementRect.top - containerRect.top;
|
|
88
|
+
const elementBottom = elementRect.bottom - containerRect.top;
|
|
89
|
+
const elementCenter = elementTop + elementRect.height / 2;
|
|
90
|
+
// Calculate width - use container width minus padding (32px on each side)
|
|
91
|
+
const padding = 32;
|
|
92
|
+
const width = containerRect.width - (padding * 2);
|
|
93
|
+
let finalTop;
|
|
94
|
+
// Determine if we should show above or below the element
|
|
95
|
+
if (relativeTop < elementCenter) {
|
|
96
|
+
// Show above this block - position between previous block and current block
|
|
97
|
+
if (index === 0) {
|
|
98
|
+
// First block - show at top of container (before first block)
|
|
99
|
+
finalTop = 0;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// Get previous block to find the gap
|
|
103
|
+
const prevBlock = blocks[index - 1];
|
|
104
|
+
const prevBlockEl = blockRefs.current.get(prevBlock.id);
|
|
105
|
+
if (prevBlockEl) {
|
|
106
|
+
const prevBlockRect = prevBlockEl.getBoundingClientRect();
|
|
107
|
+
const prevBlockBottom = prevBlockRect.bottom - containerRect.top;
|
|
108
|
+
// Position in the middle of the gap (mb-6 = 24px margin)
|
|
109
|
+
finalTop = prevBlockBottom + 12; // Half of the 24px gap
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
finalTop = elementTop;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
// Show below this block - position between current block and next block
|
|
118
|
+
if (index === blocks.length - 1) {
|
|
119
|
+
// Last block - show after it
|
|
120
|
+
finalTop = elementBottom;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// Get next block to find the gap
|
|
124
|
+
const nextBlock = blocks[index + 1];
|
|
125
|
+
const nextBlockEl = blockRefs.current.get(nextBlock.id);
|
|
126
|
+
if (nextBlockEl) {
|
|
127
|
+
const nextBlockRect = nextBlockEl.getBoundingClientRect();
|
|
128
|
+
const nextBlockTop = nextBlockRect.top - containerRect.top;
|
|
129
|
+
// Position in the middle of the gap
|
|
130
|
+
finalTop = elementBottom + (nextBlockTop - elementBottom) / 2;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
finalTop = elementBottom;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
setDropIndicatorPosition({
|
|
138
|
+
top: finalTop,
|
|
139
|
+
left: padding,
|
|
140
|
+
width: width,
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const handleDragLeave = (e) => {
|
|
146
|
+
// Only clear if we're actually leaving the container
|
|
147
|
+
// Check if we're moving to a child element (nested container)
|
|
148
|
+
const relatedTarget = e.relatedTarget;
|
|
149
|
+
if (!e.currentTarget.contains(relatedTarget)) {
|
|
150
|
+
// Check if relatedTarget is inside a nested LayoutContainer
|
|
151
|
+
const isMovingToNested = relatedTarget && relatedTarget.closest('[data-layout-container]');
|
|
152
|
+
if (!isMovingToNested) {
|
|
153
|
+
setDragOverIndex(null);
|
|
154
|
+
setDropIndicatorPosition(null);
|
|
155
|
+
setCalculatedInsertIndex(null);
|
|
156
|
+
setIsDragging(false);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const handleDrop = (e, index, containerId) => {
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
e.stopPropagation();
|
|
163
|
+
const dataTransferBlockId = e.dataTransfer.getData('block-id');
|
|
164
|
+
const globalBlockId = typeof window !== 'undefined' ? window.__DRAGGED_BLOCK_ID__ : null;
|
|
165
|
+
const blockId = dataTransferBlockId || globalBlockId;
|
|
166
|
+
const blockType = e.dataTransfer.getData('block-type');
|
|
167
|
+
console.log('[EditorBody] Drop Event:', {
|
|
168
|
+
index,
|
|
169
|
+
containerId,
|
|
170
|
+
dataTransferBlockId,
|
|
171
|
+
globalBlockId,
|
|
172
|
+
resolvedBlockId: blockId,
|
|
173
|
+
blockType,
|
|
174
|
+
currentBlocks: blocks.map(b => ({ id: b.id, type: b.type })),
|
|
175
|
+
rootBlockIds: blocks.map(b => b.id),
|
|
176
|
+
});
|
|
177
|
+
// Clear the global dragged block ID
|
|
178
|
+
if (typeof window !== 'undefined') {
|
|
179
|
+
window.__DRAGGED_BLOCK_ID__ = null;
|
|
180
|
+
}
|
|
181
|
+
if (blockId) {
|
|
182
|
+
// Moving existing block - check if it's in root or nested
|
|
183
|
+
const currentIndex = blocks.findIndex(b => b.id === blockId);
|
|
184
|
+
console.log('[EditorBody] Block location check:', {
|
|
185
|
+
blockId,
|
|
186
|
+
currentIndex,
|
|
187
|
+
isInRoot: currentIndex !== -1,
|
|
188
|
+
targetIndex: index,
|
|
189
|
+
containerId,
|
|
190
|
+
});
|
|
191
|
+
if (currentIndex !== -1) {
|
|
192
|
+
// Block is in root level - move to container or within root
|
|
193
|
+
if (containerId) {
|
|
194
|
+
// Moving from root to container
|
|
195
|
+
console.log('[EditorBody] Moving from root to container:', { blockId, index, containerId });
|
|
196
|
+
onBlockMove(blockId, index, containerId);
|
|
197
|
+
}
|
|
198
|
+
else if (currentIndex !== index) {
|
|
199
|
+
// Moving within root level
|
|
200
|
+
const targetIndex = currentIndex < index ? index - 1 : index;
|
|
201
|
+
console.log('[EditorBody] Moving within root:', { blockId, currentIndex, targetIndex });
|
|
202
|
+
onBlockMove(blockId, targetIndex);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
console.log('[EditorBody] Block already at target position, no move needed');
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
// Block is nested somewhere - need to move it to this location
|
|
210
|
+
console.log('[EditorBody] Moving nested block to root:', { blockId, index, containerId: containerId || 'root' });
|
|
211
|
+
// Pass undefined containerId to move to root
|
|
212
|
+
onBlockMove(blockId, index, undefined);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else if (blockType) {
|
|
216
|
+
// Adding new block from library
|
|
217
|
+
console.log('[EditorBody] Adding new block from library:', { blockType, index, containerId });
|
|
218
|
+
onBlockAdd(blockType, index, containerId);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
console.warn('[EditorBody] Drop event with no block ID or type!');
|
|
222
|
+
}
|
|
223
|
+
setDragOverIndex(null);
|
|
224
|
+
setIsDragging(false);
|
|
225
|
+
setDraggedBlockId(null);
|
|
226
|
+
setDropIndicatorPosition(null);
|
|
227
|
+
setCalculatedInsertIndex(null);
|
|
228
|
+
};
|
|
229
|
+
const handleBodyDragOver = (e) => {
|
|
230
|
+
e.preventDefault();
|
|
231
|
+
e.stopPropagation();
|
|
232
|
+
// Check if we're dragging over a nested container - if so, clear our indicator
|
|
233
|
+
const target = e.target;
|
|
234
|
+
const nestedContainer = target.closest('[data-layout-container]');
|
|
235
|
+
if (nestedContainer && nestedContainer !== containerRef.current) {
|
|
236
|
+
// We're over a nested container, clear our indicator
|
|
237
|
+
setDropIndicatorPosition(null);
|
|
238
|
+
setDragOverIndex(null);
|
|
239
|
+
setCalculatedInsertIndex(null);
|
|
240
|
+
setIsDragging(false);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
setIsDragging(true);
|
|
244
|
+
// Calculate drop indicator position based on mouse Y position relative to blocks
|
|
245
|
+
const container = containerRef.current;
|
|
246
|
+
if (container && blocks.length > 0) {
|
|
247
|
+
requestAnimationFrame(() => {
|
|
248
|
+
if (!containerRef.current)
|
|
249
|
+
return;
|
|
250
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
251
|
+
const mouseY = e.clientY;
|
|
252
|
+
const relativeTop = mouseY - containerRect.top;
|
|
253
|
+
const padding = 32;
|
|
254
|
+
const width = containerRect.width - (padding * 2);
|
|
255
|
+
// Find the closest insertion point based on block positions - always between blocks
|
|
256
|
+
let insertIndex = blocks.length; // Default to end
|
|
257
|
+
let indicatorTop = containerRect.height; // Default to bottom
|
|
258
|
+
// Check each block to find where to insert
|
|
259
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
260
|
+
const blockEl = blockRefs.current.get(blocks[i].id);
|
|
261
|
+
if (blockEl) {
|
|
262
|
+
const blockRect = blockEl.getBoundingClientRect();
|
|
263
|
+
const blockTop = blockRect.top - containerRect.top;
|
|
264
|
+
const blockBottom = blockRect.bottom - containerRect.top;
|
|
265
|
+
const blockCenter = blockTop + blockRect.height / 2;
|
|
266
|
+
// If mouse is above this block's center, insert before it
|
|
267
|
+
if (relativeTop < blockCenter) {
|
|
268
|
+
insertIndex = i;
|
|
269
|
+
if (i === 0) {
|
|
270
|
+
// First block - show at top
|
|
271
|
+
indicatorTop = 0;
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
// Get previous block to find the gap
|
|
275
|
+
const prevBlock = blocks[i - 1];
|
|
276
|
+
const prevBlockEl = blockRefs.current.get(prevBlock.id);
|
|
277
|
+
if (prevBlockEl) {
|
|
278
|
+
const prevBlockRect = prevBlockEl.getBoundingClientRect();
|
|
279
|
+
const prevBlockBottom = prevBlockRect.bottom - containerRect.top;
|
|
280
|
+
// Position in the middle of the gap
|
|
281
|
+
indicatorTop = prevBlockBottom + (blockTop - prevBlockBottom) / 2;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
indicatorTop = blockTop;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
// If mouse is below this block's center, check if we should insert after it
|
|
290
|
+
else if (i === blocks.length - 1 || relativeTop < blockBottom) {
|
|
291
|
+
insertIndex = i + 1;
|
|
292
|
+
if (i === blocks.length - 1) {
|
|
293
|
+
// Last block - show after it
|
|
294
|
+
indicatorTop = blockBottom;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
// Get next block to find the gap
|
|
298
|
+
const nextBlock = blocks[i + 1];
|
|
299
|
+
const nextBlockEl = blockRefs.current.get(nextBlock.id);
|
|
300
|
+
if (nextBlockEl) {
|
|
301
|
+
const nextBlockRect = nextBlockEl.getBoundingClientRect();
|
|
302
|
+
const nextBlockTop = nextBlockRect.top - containerRect.top;
|
|
303
|
+
// Position in the middle of the gap
|
|
304
|
+
indicatorTop = blockBottom + (nextBlockTop - blockBottom) / 2;
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
indicatorTop = blockBottom;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// If we didn't find a position, use the last block's bottom
|
|
315
|
+
if (insertIndex === blocks.length) {
|
|
316
|
+
const lastBlockEl = blockRefs.current.get(blocks[blocks.length - 1].id);
|
|
317
|
+
if (lastBlockEl) {
|
|
318
|
+
const lastBlockRect = lastBlockEl.getBoundingClientRect();
|
|
319
|
+
indicatorTop = lastBlockRect.bottom - containerRect.top;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
setCalculatedInsertIndex(insertIndex);
|
|
323
|
+
setDropIndicatorPosition({
|
|
324
|
+
top: indicatorTop,
|
|
325
|
+
left: padding,
|
|
326
|
+
width: width,
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
else if (container) {
|
|
331
|
+
// No blocks, show indicator at top
|
|
332
|
+
requestAnimationFrame(() => {
|
|
333
|
+
if (!containerRef.current)
|
|
334
|
+
return;
|
|
335
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
336
|
+
const padding = 32;
|
|
337
|
+
const width = containerRect.width - (padding * 2);
|
|
338
|
+
setCalculatedInsertIndex(0);
|
|
339
|
+
setDropIndicatorPosition({
|
|
340
|
+
top: 0,
|
|
341
|
+
left: padding,
|
|
342
|
+
width: width,
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
const handleBodyDrop = (e) => {
|
|
348
|
+
e.preventDefault();
|
|
349
|
+
e.stopPropagation();
|
|
350
|
+
const dataTransferBlockId = e.dataTransfer.getData('block-id');
|
|
351
|
+
const globalBlockId = typeof window !== 'undefined' ? window.__DRAGGED_BLOCK_ID__ : null;
|
|
352
|
+
const blockId = dataTransferBlockId || globalBlockId;
|
|
353
|
+
const blockType = e.dataTransfer.getData('block-type');
|
|
354
|
+
// Use the calculated insert index if available, otherwise calculate it now
|
|
355
|
+
let targetIndex = calculatedInsertIndex !== null ? calculatedInsertIndex : blocks.length;
|
|
356
|
+
// If we don't have a calculated index, calculate it based on mouse position
|
|
357
|
+
if (calculatedInsertIndex === null && containerRef.current && blocks.length > 0) {
|
|
358
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
359
|
+
const mouseY = e.clientY;
|
|
360
|
+
const relativeTop = mouseY - containerRect.top;
|
|
361
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
362
|
+
const blockEl = blockRefs.current.get(blocks[i].id);
|
|
363
|
+
if (blockEl) {
|
|
364
|
+
const blockRect = blockEl.getBoundingClientRect();
|
|
365
|
+
const blockTop = blockRect.top - containerRect.top;
|
|
366
|
+
const blockCenter = blockTop + blockRect.height / 2;
|
|
367
|
+
if (relativeTop < blockCenter) {
|
|
368
|
+
targetIndex = i;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
else if (i === blocks.length - 1) {
|
|
372
|
+
targetIndex = blocks.length;
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
console.log('[EditorBody] Body Drop Event:', {
|
|
379
|
+
dataTransferBlockId,
|
|
380
|
+
globalBlockId,
|
|
381
|
+
resolvedBlockId: blockId,
|
|
382
|
+
blockType,
|
|
383
|
+
calculatedInsertIndex,
|
|
384
|
+
targetIndex,
|
|
385
|
+
currentBlocksCount: blocks.length,
|
|
386
|
+
rootBlockIds: blocks.map(b => b.id),
|
|
387
|
+
});
|
|
388
|
+
// Clear the global dragged block ID
|
|
389
|
+
if (typeof window !== 'undefined') {
|
|
390
|
+
window.__DRAGGED_BLOCK_ID__ = null;
|
|
391
|
+
}
|
|
392
|
+
if (blockId) {
|
|
393
|
+
// Moving existing block to calculated position
|
|
394
|
+
const currentIndex = blocks.findIndex(b => b.id === blockId);
|
|
395
|
+
console.log('[EditorBody] Body drop - block location:', {
|
|
396
|
+
blockId,
|
|
397
|
+
currentIndex,
|
|
398
|
+
isInRoot: currentIndex !== -1,
|
|
399
|
+
targetIndex,
|
|
400
|
+
});
|
|
401
|
+
if (currentIndex !== -1) {
|
|
402
|
+
// Already in root, move to target position
|
|
403
|
+
if (currentIndex !== targetIndex) {
|
|
404
|
+
// Adjust for removal if moving forward
|
|
405
|
+
const adjustedIndex = currentIndex < targetIndex ? targetIndex - 1 : targetIndex;
|
|
406
|
+
console.log('[EditorBody] Moving within root:', { blockId, currentIndex, adjustedIndex });
|
|
407
|
+
onBlockMove(blockId, Math.max(0, adjustedIndex));
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
// Block is nested - move it to root level at target position
|
|
412
|
+
console.log('[EditorBody] Moving nested block to root:', { blockId, targetIndex });
|
|
413
|
+
onBlockMove(blockId, targetIndex, undefined);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
else if (blockType) {
|
|
417
|
+
// Adding new block at calculated position
|
|
418
|
+
console.log('[EditorBody] Adding new block:', { blockType, index: targetIndex });
|
|
419
|
+
onBlockAdd(blockType, targetIndex);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
console.warn('[EditorBody] Body drop with no block ID or type!');
|
|
423
|
+
}
|
|
424
|
+
setIsDragging(false);
|
|
425
|
+
setDragOverIndex(null);
|
|
426
|
+
setDraggedBlockId(null);
|
|
427
|
+
setDropIndicatorPosition(null);
|
|
428
|
+
setCalculatedInsertIndex(null);
|
|
429
|
+
};
|
|
430
|
+
return (_jsxs("div", { ref: containerRef, className: `relative w-full rounded-[2.5rem] border shadow-lg min-h-[400px] transition-all bg-transparent ${darkMode
|
|
431
|
+
? 'border-neutral-200 dark:border-neutral-800 shadow-neutral-200/50 dark:shadow-neutral-900/50'
|
|
432
|
+
: 'border-neutral-200 shadow-neutral-200/50'}`, onDragOver: handleBodyDragOver, onDrop: handleBodyDrop, onDragLeave: handleDragLeave, onDragStart: handleDragStart, onDragEnd: () => {
|
|
433
|
+
setDropIndicatorPosition(null);
|
|
434
|
+
setDragOverIndex(null);
|
|
435
|
+
setIsDragging(false);
|
|
436
|
+
setDraggedBlockId(null);
|
|
437
|
+
setCalculatedInsertIndex(null);
|
|
438
|
+
}, children: [dropIndicatorPosition && isDragging && (_jsx(DropIndicator, { position: dropIndicatorPosition, darkMode: darkMode })), _jsx("div", { className: "flex flex-col p-8", onDragOver: (e) => {
|
|
439
|
+
// Only handle if not over a block or nested container
|
|
440
|
+
const target = e.target;
|
|
441
|
+
const isOverBlock = target.closest('[data-block-wrapper]');
|
|
442
|
+
const isOverNestedContainer = target.closest('[data-layout-container]') && target.closest('[data-layout-container]') !== containerRef.current;
|
|
443
|
+
if (!isOverBlock && !isOverNestedContainer) {
|
|
444
|
+
handleBodyDragOver(e);
|
|
445
|
+
}
|
|
446
|
+
}, onDrop: (e) => {
|
|
447
|
+
// Only handle if not over a block or nested container
|
|
448
|
+
const target = e.target;
|
|
449
|
+
const isOverBlock = target.closest('[data-block-wrapper]');
|
|
450
|
+
const isOverNestedContainer = target.closest('[data-layout-container]') && target.closest('[data-layout-container]') !== containerRef.current;
|
|
451
|
+
if (!isOverBlock && !isOverNestedContainer) {
|
|
452
|
+
handleBodyDrop(e);
|
|
453
|
+
}
|
|
454
|
+
}, children: blocks.length === 0 ? (_jsx(EmptyState, { isDragging: isDragging, darkMode: darkMode })) : (blocks.map((block, index) => (_jsxs(Fragment, { children: [index > 0 && (_jsx("div", { className: `h-6 transition-all duration-200 ${isDragging && dragOverIndex === index
|
|
455
|
+
? 'bg-primary/5 border-y border-dashed border-primary/20 rounded-lg'
|
|
456
|
+
: 'bg-transparent'}` })), _jsx("div", { ref: setBlockRef(block.id), onDragOver: (e) => {
|
|
457
|
+
const blockEl = blockRefs.current.get(block.id);
|
|
458
|
+
if (blockEl) {
|
|
459
|
+
handleDragOver(e, index, blockEl);
|
|
460
|
+
}
|
|
461
|
+
}, onDragLeave: handleDragLeave, onDrop: (e) => handleDrop(e, index), className: "relative mb-6 last:mb-0", children: _jsx(BlockWrapper, { block: block, onUpdate: (data) => onBlockUpdate(block.id, data), onDelete: () => onBlockDelete(block.id), onMoveUp: index > 0 ? () => onBlockMove(block.id, index - 1) : undefined, onMoveDown: index < blocks.length - 1 ? () => onBlockMove(block.id, index + 1) : undefined, allBlocks: blocks }) })] }, block.id)))) })] }));
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Visual Line that shows where the block will land
|
|
465
|
+
*/
|
|
466
|
+
function DropIndicator({ position, darkMode }) {
|
|
467
|
+
return (_jsxs("div", { className: "absolute z-50 pointer-events-none", style: {
|
|
468
|
+
top: `${position.top - 12}px`,
|
|
469
|
+
left: `${position.left}px`,
|
|
470
|
+
width: `${position.width}px`,
|
|
471
|
+
height: '24px',
|
|
472
|
+
}, children: [_jsx("div", { className: `absolute inset-0 rounded-lg border border-dashed backdrop-blur-sm ${darkMode
|
|
473
|
+
? 'bg-primary/10 dark:bg-primary/20 border-primary dark:border-primary/60'
|
|
474
|
+
: 'bg-primary/10 border-primary'}` }), _jsx("div", { className: `absolute top-1/2 left-0 right-0 h-0.5 rounded-full transform -translate-y-1/2 ${darkMode ? 'bg-primary dark:bg-primary/80' : 'bg-primary'}` }), _jsx("div", { className: "absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2", children: _jsx("div", { className: `w-6 h-6 rounded-full flex items-center justify-center shadow-lg shadow-primary/30 ${darkMode ? 'bg-primary dark:bg-primary/90' : 'bg-primary'}`, children: _jsx("div", { className: `w-2 h-2 rounded-full ${darkMode ? 'bg-white dark:bg-neutral-900' : 'bg-white'}` }) }) })] }));
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Placeholder when the editor is empty
|
|
478
|
+
*/
|
|
479
|
+
function EmptyState({ isDragging, darkMode }) {
|
|
480
|
+
return (_jsxs("div", { className: `flex flex-col items-center justify-center py-20 px-8 rounded-2xl border border-dashed transition-all ${darkMode
|
|
481
|
+
? isDragging
|
|
482
|
+
? 'border-primary/30 bg-primary/5 dark:bg-primary/10'
|
|
483
|
+
: 'border-gray-200/50 dark:border-neutral-700/50 bg-neutral-50/50 dark:bg-neutral-800/30'
|
|
484
|
+
: isDragging
|
|
485
|
+
? 'border-primary/30 bg-primary/5'
|
|
486
|
+
: 'border-gray-200/50 bg-neutral-50/50'}`, children: [_jsx("div", { className: `p-4 rounded-full mb-4 transition-colors ${darkMode
|
|
487
|
+
? isDragging
|
|
488
|
+
? 'bg-primary/10 dark:bg-primary/20'
|
|
489
|
+
: 'bg-neutral-100 dark:bg-neutral-800'
|
|
490
|
+
: isDragging
|
|
491
|
+
? 'bg-primary/10'
|
|
492
|
+
: 'bg-neutral-100'}`, children: _jsx(Plus, { size: 24, className: `transition-colors ${darkMode
|
|
493
|
+
? isDragging
|
|
494
|
+
? 'text-primary'
|
|
495
|
+
: 'text-neutral-400 dark:text-neutral-500'
|
|
496
|
+
: isDragging
|
|
497
|
+
? 'text-primary'
|
|
498
|
+
: 'text-neutral-400'}` }) }), _jsx("p", { className: `text-sm font-black uppercase tracking-wider transition-colors ${darkMode
|
|
499
|
+
? isDragging
|
|
500
|
+
? 'text-primary'
|
|
501
|
+
: 'text-neutral-500 dark:text-neutral-400'
|
|
502
|
+
: isDragging
|
|
503
|
+
? 'text-primary'
|
|
504
|
+
: 'text-neutral-500'}`, children: isDragging ? 'Drop Block Here' : 'Drop a component here' }), _jsx("p", { className: `text-xs mt-2 ${darkMode ? 'text-neutral-400 dark:text-neutral-500' : 'text-neutral-400'}`, children: "Drag blocks from the library to get started" })] }));
|
|
505
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface EditorHeaderProps {
|
|
2
|
+
isLibraryOpen: boolean;
|
|
3
|
+
onLibraryToggle: () => void;
|
|
4
|
+
isPreviewMode: boolean;
|
|
5
|
+
onPreviewToggle: () => void;
|
|
6
|
+
isSidebarOpen: boolean;
|
|
7
|
+
onSidebarToggle: () => void;
|
|
8
|
+
isSaving: boolean;
|
|
9
|
+
onSave: (publish?: boolean) => Promise<void>;
|
|
10
|
+
onSaveError: (error: string | null) => void;
|
|
11
|
+
autoSaveEnabled?: boolean;
|
|
12
|
+
onAutoSaveToggle?: (enabled: boolean) => void;
|
|
13
|
+
isDirty?: boolean;
|
|
14
|
+
autoSaveCountdown?: number | null;
|
|
15
|
+
autoSaveStatus?: 'idle' | 'saving' | 'saved' | 'error';
|
|
16
|
+
}
|
|
17
|
+
export declare function EditorHeader({ isLibraryOpen, onLibraryToggle, isPreviewMode, onPreviewToggle, isSidebarOpen, onSidebarToggle, isSaving, onSave, onSaveError, autoSaveEnabled, onAutoSaveToggle, isDirty, autoSaveCountdown, autoSaveStatus, }: EditorHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=EditorHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorHeader.d.ts","sourceRoot":"","sources":["../../../src/views/CanvasEditor/EditorHeader.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;CAC1D;AAED,wBAAgB,YAAY,CAAC,EACzB,aAAa,EACb,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,EACb,eAAe,EACf,QAAQ,EACR,MAAM,EACN,WAAW,EACX,eAAuB,EACvB,gBAAgB,EAChB,OAAe,EACf,iBAAwB,EACxB,cAAuB,GAC1B,EAAE,iBAAiB,2CAmOnB"}
|