@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,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rich Text Preview Component
|
|
3
|
+
* Renders HTML content with client-provided styles
|
|
4
|
+
* Also supports plain text with formatting markers using the plugin-content parser
|
|
5
|
+
*/
|
|
6
|
+
'use client';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { parse, useParserConfig } from '@jhits/plugin-content';
|
|
10
|
+
/**
|
|
11
|
+
* Check if content is HTML or plain text with formatting markers
|
|
12
|
+
*/
|
|
13
|
+
function isHtmlContent(content) {
|
|
14
|
+
// If content contains HTML tags, it's HTML
|
|
15
|
+
if (/<[a-z][\s\S]*>/i.test(content)) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
// If content contains HTML entities, it's likely HTML
|
|
19
|
+
if (/&[a-z]+;/i.test(content)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
// Otherwise, it's plain text (potentially with formatting markers)
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
export function RichTextPreview({ content, formatting, className = '', }) {
|
|
26
|
+
// Handle empty content
|
|
27
|
+
if (!content || content.trim() === '') {
|
|
28
|
+
return _jsx("div", { className: className, children: "\u00A0" });
|
|
29
|
+
}
|
|
30
|
+
// Get parser config from context (provided by client app)
|
|
31
|
+
const parserConfig = useParserConfig();
|
|
32
|
+
// Check if content is HTML or plain text
|
|
33
|
+
const isHtml = isHtmlContent(content);
|
|
34
|
+
// If it's plain text, use the parser from plugin-content
|
|
35
|
+
if (!isHtml) {
|
|
36
|
+
const parsedContent = parse(content, false, parserConfig);
|
|
37
|
+
return (_jsx("div", { className: className, children: parsedContent }));
|
|
38
|
+
}
|
|
39
|
+
// Otherwise, continue with HTML rendering logic
|
|
40
|
+
// Apply client-provided styles to HTML content
|
|
41
|
+
const applyStyles = (html) => {
|
|
42
|
+
if (!formatting?.styles)
|
|
43
|
+
return html;
|
|
44
|
+
const styles = formatting.styles;
|
|
45
|
+
let styledHtml = html;
|
|
46
|
+
// Apply bold style - handle both <strong> and <b> tags
|
|
47
|
+
if (styles.bold) {
|
|
48
|
+
// Replace <strong> tags
|
|
49
|
+
styledHtml = styledHtml.replace(/<strong\b([^>]*)>/gi, (match, attrs) => {
|
|
50
|
+
// Check if class already exists
|
|
51
|
+
if (attrs && attrs.includes('class=')) {
|
|
52
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.bold}"`);
|
|
53
|
+
}
|
|
54
|
+
return `<strong class="${styles.bold}">`;
|
|
55
|
+
});
|
|
56
|
+
// Replace <b> tags
|
|
57
|
+
styledHtml = styledHtml.replace(/<b\b([^>]*)>/gi, (match, attrs) => {
|
|
58
|
+
if (attrs && attrs.includes('class=')) {
|
|
59
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.bold}"`);
|
|
60
|
+
}
|
|
61
|
+
return `<b class="${styles.bold}">`;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
// Apply italic style - handle both <em> and <i> tags
|
|
65
|
+
if (styles.italic) {
|
|
66
|
+
styledHtml = styledHtml.replace(/<em\b([^>]*)>/gi, (match, attrs) => {
|
|
67
|
+
if (attrs && attrs.includes('class=')) {
|
|
68
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.italic}"`);
|
|
69
|
+
}
|
|
70
|
+
return `<em class="${styles.italic}">`;
|
|
71
|
+
});
|
|
72
|
+
styledHtml = styledHtml.replace(/<i\b([^>]*)>/gi, (match, attrs) => {
|
|
73
|
+
if (attrs && attrs.includes('class=')) {
|
|
74
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.italic}"`);
|
|
75
|
+
}
|
|
76
|
+
return `<i class="${styles.italic}">`;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
// Apply underline style
|
|
80
|
+
if (styles.underline) {
|
|
81
|
+
styledHtml = styledHtml.replace(/<u\b([^>]*)>/gi, (match, attrs) => {
|
|
82
|
+
if (attrs && attrs.includes('class=')) {
|
|
83
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.underline}"`);
|
|
84
|
+
}
|
|
85
|
+
return `<u class="${styles.underline}">`;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// Apply link style
|
|
89
|
+
if (styles.link) {
|
|
90
|
+
styledHtml = styledHtml.replace(/<a\b([^>]*)>/gi, (match, attrs) => {
|
|
91
|
+
if (attrs && attrs.includes('class=')) {
|
|
92
|
+
return match.replace(/class="([^"]*)"/, `class="$1 ${styles.link}"`);
|
|
93
|
+
}
|
|
94
|
+
return match.replace('>', ` class="${styles.link}">`);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// Apply color classes to spans (preserve existing classes)
|
|
98
|
+
if (styles.colorClasses) {
|
|
99
|
+
Object.entries(styles.colorClasses).forEach(([color, colorClass]) => {
|
|
100
|
+
// Match spans that might have the color class already or need it added
|
|
101
|
+
const regex = new RegExp(`<span([^>]*)class="([^"]*)"([^>]*)>`, 'gi');
|
|
102
|
+
styledHtml = styledHtml.replace(regex, (match, beforeAttrs, existingClasses, afterAttrs) => {
|
|
103
|
+
// Don't add if class already exists
|
|
104
|
+
if (existingClasses.includes(colorClass)) {
|
|
105
|
+
return match;
|
|
106
|
+
}
|
|
107
|
+
// Add the color class
|
|
108
|
+
return `<span${beforeAttrs}class="${existingClasses} ${colorClass}"${afterAttrs}>`;
|
|
109
|
+
});
|
|
110
|
+
// Also handle spans without class attribute
|
|
111
|
+
const regexNoClass = new RegExp(`<span([^>]*)>`, 'gi');
|
|
112
|
+
styledHtml = styledHtml.replace(regexNoClass, (match, attrs) => {
|
|
113
|
+
// Only add if this span doesn't already have a class and we're looking for a specific color
|
|
114
|
+
if (!attrs.includes('class=')) {
|
|
115
|
+
return match.replace('>', ` class="${colorClass}">`);
|
|
116
|
+
}
|
|
117
|
+
return match;
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return styledHtml;
|
|
122
|
+
};
|
|
123
|
+
const styledContent = formatting ? applyStyles(content) : content;
|
|
124
|
+
// For rendering, we'll use a ref to set innerHTML only on the client side
|
|
125
|
+
// This avoids SSR issues while still allowing HTML rendering
|
|
126
|
+
const contentRef = React.useRef(null);
|
|
127
|
+
React.useEffect(() => {
|
|
128
|
+
if (contentRef.current && styledContent) {
|
|
129
|
+
contentRef.current.innerHTML = styledContent;
|
|
130
|
+
}
|
|
131
|
+
}, [styledContent]);
|
|
132
|
+
// For server-side rendering, render plain text
|
|
133
|
+
if (typeof window === 'undefined') {
|
|
134
|
+
const textContent = styledContent
|
|
135
|
+
.replace(/<[^>]*>/g, '')
|
|
136
|
+
.replace(/ /g, ' ')
|
|
137
|
+
.replace(/&/g, '&')
|
|
138
|
+
.replace(/</g, '<')
|
|
139
|
+
.replace(/>/g, '>')
|
|
140
|
+
.replace(/"/g, '"');
|
|
141
|
+
return (_jsx("div", { className: className, children: textContent || '\u00A0' }));
|
|
142
|
+
}
|
|
143
|
+
return (_jsx("div", { ref: contentRef, className: className }));
|
|
144
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rich Text Utilities
|
|
3
|
+
* Export rich text editor and preview components
|
|
4
|
+
*/
|
|
5
|
+
export { RichTextEditor } from './RichTextEditor';
|
|
6
|
+
export { RichTextPreview } from './RichTextPreview';
|
|
7
|
+
export type { RichTextFormattingConfig, RichTextEditorProps } from './RichTextEditor';
|
|
8
|
+
export type { RichTextPreviewProps } from './RichTextPreview';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/rich-text/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtF,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block Helper Utilities
|
|
3
|
+
* Functions for working with blocks, including nested structures
|
|
4
|
+
*/
|
|
5
|
+
import { Block } from '../../types/block';
|
|
6
|
+
/**
|
|
7
|
+
* Get child blocks from a container block
|
|
8
|
+
* Handles both Block[] and string[] formats
|
|
9
|
+
*/
|
|
10
|
+
export declare function getChildBlocks(block: Block, allBlocks?: Block[]): Block[];
|
|
11
|
+
/**
|
|
12
|
+
* Check if a block is a container (has children or is marked as container)
|
|
13
|
+
*/
|
|
14
|
+
export declare function isContainerBlock(block: Block, blockRegistry: {
|
|
15
|
+
get: (type: string) => {
|
|
16
|
+
isContainer?: boolean;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Find a block by ID recursively (including nested blocks)
|
|
21
|
+
*/
|
|
22
|
+
export declare function findBlockById(blocks: Block[], id: string): Block | null;
|
|
23
|
+
//# sourceMappingURL=blockHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockHelpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/blockHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,GAAE,KAAK,EAAO,GAAG,KAAK,EAAE,CAiC7E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE;IAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAA;CAAE,GAAG,OAAO,CAGvI;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAavE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block Helper Utilities
|
|
3
|
+
* Functions for working with blocks, including nested structures
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get child blocks from a container block
|
|
7
|
+
* Handles both Block[] and string[] formats
|
|
8
|
+
*/
|
|
9
|
+
export function getChildBlocks(block, allBlocks = []) {
|
|
10
|
+
if (!block.children || block.children.length === 0) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
// If children are Block objects, return them directly
|
|
14
|
+
if (block.children.length > 0 && typeof block.children[0] === 'object' && 'id' in block.children[0]) {
|
|
15
|
+
return block.children;
|
|
16
|
+
}
|
|
17
|
+
// If children are IDs, resolve them from allBlocks (recursively search nested blocks)
|
|
18
|
+
const childIds = block.children;
|
|
19
|
+
const resolvedBlocks = [];
|
|
20
|
+
function findBlockRecursive(blocks, id) {
|
|
21
|
+
for (const b of blocks) {
|
|
22
|
+
if (b.id === id)
|
|
23
|
+
return b;
|
|
24
|
+
if (b.children && Array.isArray(b.children) && b.children.length > 0) {
|
|
25
|
+
if (typeof b.children[0] === 'object') {
|
|
26
|
+
const found = findBlockRecursive(b.children, id);
|
|
27
|
+
if (found)
|
|
28
|
+
return found;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
childIds.forEach(id => {
|
|
35
|
+
const found = findBlockRecursive(allBlocks, id);
|
|
36
|
+
if (found)
|
|
37
|
+
resolvedBlocks.push(found);
|
|
38
|
+
});
|
|
39
|
+
return resolvedBlocks;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if a block is a container (has children or is marked as container)
|
|
43
|
+
*/
|
|
44
|
+
export function isContainerBlock(block, blockRegistry) {
|
|
45
|
+
const definition = blockRegistry.get(block.type);
|
|
46
|
+
return definition?.isContainer === true || (block.children !== undefined && block.children.length > 0);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Find a block by ID recursively (including nested blocks)
|
|
50
|
+
*/
|
|
51
|
+
export function findBlockById(blocks, id) {
|
|
52
|
+
for (const block of blocks) {
|
|
53
|
+
if (block.id === id) {
|
|
54
|
+
return block;
|
|
55
|
+
}
|
|
56
|
+
if (block.children && Array.isArray(block.children) && block.children.length > 0) {
|
|
57
|
+
if (typeof block.children[0] === 'object') {
|
|
58
|
+
const found = findBlockById(block.children, id);
|
|
59
|
+
if (found)
|
|
60
|
+
return found;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Configuration Validation Utilities
|
|
3
|
+
* Validates plugin configuration and custom blocks
|
|
4
|
+
*/
|
|
5
|
+
import { ClientBlockDefinition } from '../../types/block';
|
|
6
|
+
/**
|
|
7
|
+
* Check if a route requires the hero block
|
|
8
|
+
*/
|
|
9
|
+
export declare function routeRequiresHeroBlock(route: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Find hero block definition in custom blocks
|
|
12
|
+
*/
|
|
13
|
+
export declare function findHeroBlock(customBlocks: ClientBlockDefinition[]): ClientBlockDefinition | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Hook to validate hero block configuration
|
|
16
|
+
* Only validates for routes that require it, and waits for customBlocks to load
|
|
17
|
+
*
|
|
18
|
+
* @param route - Current route (e.g., 'posts', 'editor', 'new')
|
|
19
|
+
* @param customBlocks - Array of custom block definitions
|
|
20
|
+
* @param propsCustomBlocks - Custom blocks from props (for immediate validation)
|
|
21
|
+
*/
|
|
22
|
+
export declare function useHeroBlockValidation(route: string, customBlocks: ClientBlockDefinition[], propsCustomBlocks?: ClientBlockDefinition[]): void;
|
|
23
|
+
//# sourceMappingURL=configValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configValidation.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/configValidation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAO1D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,qBAAqB,EAAE,GAAG,qBAAqB,GAAG,SAAS,CAEtG;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,qBAAqB,EAAE,EACrC,iBAAiB,CAAC,EAAE,qBAAqB,EAAE,GAC5C,IAAI,CAgGN"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Configuration Validation Utilities
|
|
3
|
+
* Validates plugin configuration and custom blocks
|
|
4
|
+
*/
|
|
5
|
+
import { useEffect, useState, useMemo } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* Routes that require the hero block to be defined
|
|
8
|
+
*/
|
|
9
|
+
const ROUTES_REQUIRING_HERO_BLOCK = ['editor', 'new', 'preview'];
|
|
10
|
+
/**
|
|
11
|
+
* Check if a route requires the hero block
|
|
12
|
+
*/
|
|
13
|
+
export function routeRequiresHeroBlock(route) {
|
|
14
|
+
return ROUTES_REQUIRING_HERO_BLOCK.includes(route);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Find hero block definition in custom blocks
|
|
18
|
+
*/
|
|
19
|
+
export function findHeroBlock(customBlocks) {
|
|
20
|
+
return customBlocks.find(block => block.type === 'hero');
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Hook to validate hero block configuration
|
|
24
|
+
* Only validates for routes that require it, and waits for customBlocks to load
|
|
25
|
+
*
|
|
26
|
+
* @param route - Current route (e.g., 'posts', 'editor', 'new')
|
|
27
|
+
* @param customBlocks - Array of custom block definitions
|
|
28
|
+
* @param propsCustomBlocks - Custom blocks from props (for immediate validation)
|
|
29
|
+
*/
|
|
30
|
+
export function useHeroBlockValidation(route, customBlocks, propsCustomBlocks) {
|
|
31
|
+
const needsHeroBlock = useMemo(() => routeRequiresHeroBlock(route), [route]);
|
|
32
|
+
const heroBlockDefinition = useMemo(() => {
|
|
33
|
+
// Only search for hero block if route needs it
|
|
34
|
+
return needsHeroBlock ? findHeroBlock(customBlocks) : undefined;
|
|
35
|
+
}, [customBlocks, needsHeroBlock]);
|
|
36
|
+
// Track if we've given customBlocks time to load from window global
|
|
37
|
+
// This prevents false errors when customBlocks are loaded asynchronously
|
|
38
|
+
// Only track this if we actually need the hero block
|
|
39
|
+
const [hasCheckedForBlocks, setHasCheckedForBlocks] = useState(false);
|
|
40
|
+
// Give window global a chance to load before validating
|
|
41
|
+
// Only do this if the route needs the hero block
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
// Early return: Skip all validation logic if route doesn't need hero block
|
|
44
|
+
if (!needsHeroBlock) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (typeof window === 'undefined') {
|
|
48
|
+
setHasCheckedForBlocks(true); // Server-side, no need to wait
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// If props are provided, we can validate immediately
|
|
52
|
+
if (propsCustomBlocks && propsCustomBlocks.length > 0) {
|
|
53
|
+
setHasCheckedForBlocks(true);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// Check if window global is already available
|
|
57
|
+
if (window.__JHITS_PLUGIN_PROPS__?.['plugin-blog']?.customBlocks) {
|
|
58
|
+
setHasCheckedForBlocks(true);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// Retry mechanism: check multiple times with increasing delays
|
|
62
|
+
// This handles the case where BlogPluginInit's useEffect runs after BlogPlugin mounts
|
|
63
|
+
// BlogPluginInit runs initBlogPlugin in useEffect, which may execute after BlogPlugin's first render
|
|
64
|
+
let attempt = 0;
|
|
65
|
+
const maxAttempts = 6;
|
|
66
|
+
const delays = [50, 100, 200, 300, 500, 1000]; // Progressive delays: total ~2.15s
|
|
67
|
+
const timers = [];
|
|
68
|
+
const checkWithRetry = () => {
|
|
69
|
+
const windowGlobal = window.__JHITS_PLUGIN_PROPS__?.['plugin-blog']?.customBlocks;
|
|
70
|
+
if (windowGlobal && windowGlobal.length > 0) {
|
|
71
|
+
// Found it! Mark as checked
|
|
72
|
+
setHasCheckedForBlocks(true);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (attempt < maxAttempts) {
|
|
76
|
+
const timer = setTimeout(() => {
|
|
77
|
+
attempt++;
|
|
78
|
+
checkWithRetry();
|
|
79
|
+
}, delays[attempt]);
|
|
80
|
+
timers.push(timer);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// After all retries, mark as checked (even if not found)
|
|
84
|
+
// This prevents infinite waiting and allows validation to proceed
|
|
85
|
+
setHasCheckedForBlocks(true);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
// Start checking
|
|
89
|
+
checkWithRetry();
|
|
90
|
+
// Cleanup all timers
|
|
91
|
+
return () => {
|
|
92
|
+
timers.forEach(timer => clearTimeout(timer));
|
|
93
|
+
};
|
|
94
|
+
}, [propsCustomBlocks, needsHeroBlock]);
|
|
95
|
+
// Validate that Hero block is required (only for editor routes, and only after we've checked for blocks)
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
// Early return if route doesn't need hero block - no validation needed
|
|
98
|
+
if (!needsHeroBlock) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
// Only validate if:
|
|
102
|
+
// 1. We're in a route that needs the hero block (already checked above)
|
|
103
|
+
// 2. We've given customBlocks time to load (hasCheckedForBlocks is true)
|
|
104
|
+
// 3. The hero block is still not found
|
|
105
|
+
if (hasCheckedForBlocks && !heroBlockDefinition) {
|
|
106
|
+
console.error('[BlogPlugin] Hero block is REQUIRED but not found in customBlocks. ' +
|
|
107
|
+
'Please define a block with type: "hero" in your blog config. ' +
|
|
108
|
+
`Current route: "${route}"`);
|
|
109
|
+
}
|
|
110
|
+
}, [heroBlockDefinition, needsHeroBlock, hasCheckedForBlocks, route]);
|
|
111
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slug Utilities
|
|
3
|
+
* Functions for generating and validating URL slugs
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Convert a string to a URL-friendly slug
|
|
7
|
+
*/
|
|
8
|
+
export declare function slugify(text: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a slug from a title
|
|
11
|
+
* Automatically handles edge cases and ensures uniqueness
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateSlugFromTitle(title: string, existingSlugs?: string[]): string;
|
|
14
|
+
/**
|
|
15
|
+
* Validate a slug format
|
|
16
|
+
*/
|
|
17
|
+
export declare function isValidSlug(slug: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a slug collides with existing slugs
|
|
20
|
+
*/
|
|
21
|
+
export declare function checkSlugCollision(slug: string, existingSlugs: string[], excludeId?: string): {
|
|
22
|
+
isCollision: boolean;
|
|
23
|
+
conflictingId?: string;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=slugify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/slugify.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU5C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,GAAE,MAAM,EAAO,GAAG,MAAM,CAkBzF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIjD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG;IAC3F,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAkBA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slug Utilities
|
|
3
|
+
* Functions for generating and validating URL slugs
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Convert a string to a URL-friendly slug
|
|
7
|
+
*/
|
|
8
|
+
export function slugify(text) {
|
|
9
|
+
return text
|
|
10
|
+
.toString()
|
|
11
|
+
.toLowerCase()
|
|
12
|
+
.trim()
|
|
13
|
+
.replace(/\s+/g, '-') // Replace spaces with hyphens
|
|
14
|
+
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
|
|
15
|
+
.replace(/\-\-+/g, '-') // Replace multiple hyphens with single hyphen
|
|
16
|
+
.replace(/^-+/, '') // Trim hyphens from start
|
|
17
|
+
.replace(/-+$/, ''); // Trim hyphens from end
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generate a slug from a title
|
|
21
|
+
* Automatically handles edge cases and ensures uniqueness
|
|
22
|
+
*/
|
|
23
|
+
export function generateSlugFromTitle(title, existingSlugs = []) {
|
|
24
|
+
let baseSlug = slugify(title);
|
|
25
|
+
// If slug is empty after processing, use a fallback
|
|
26
|
+
if (!baseSlug) {
|
|
27
|
+
baseSlug = 'untitled-post';
|
|
28
|
+
}
|
|
29
|
+
// Check for collisions and append number if needed
|
|
30
|
+
let finalSlug = baseSlug;
|
|
31
|
+
let counter = 1;
|
|
32
|
+
while (existingSlugs.includes(finalSlug)) {
|
|
33
|
+
finalSlug = `${baseSlug}-${counter}`;
|
|
34
|
+
counter++;
|
|
35
|
+
}
|
|
36
|
+
return finalSlug;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Validate a slug format
|
|
40
|
+
*/
|
|
41
|
+
export function isValidSlug(slug) {
|
|
42
|
+
// Slug should be lowercase, alphanumeric with hyphens
|
|
43
|
+
const slugRegex = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
44
|
+
return slugRegex.test(slug) && slug.length > 0 && slug.length <= 200;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Check if a slug collides with existing slugs
|
|
48
|
+
*/
|
|
49
|
+
export function checkSlugCollision(slug, existingSlugs, excludeId) {
|
|
50
|
+
// Normalize the slug for comparison
|
|
51
|
+
const normalizedSlug = slug.toLowerCase().trim();
|
|
52
|
+
// Check against existing slugs (excluding current post if editing)
|
|
53
|
+
for (const existing of existingSlugs) {
|
|
54
|
+
if (existing.toLowerCase().trim() === normalizedSlug) {
|
|
55
|
+
// If we have an excludeId, we need to check if this is the same post
|
|
56
|
+
// This would require additional context (like a post ID map)
|
|
57
|
+
// For now, we'll return collision if it matches
|
|
58
|
+
return {
|
|
59
|
+
isCollision: true,
|
|
60
|
+
conflictingId: existing,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return { isCollision: false };
|
|
65
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block Registry
|
|
3
|
+
* Dynamic registry for all block types in the system
|
|
4
|
+
* Multi-Tenant Architecture: Blocks are provided by client applications
|
|
5
|
+
*
|
|
6
|
+
* The registry is a singleton that starts empty and is populated by client apps
|
|
7
|
+
*/
|
|
8
|
+
import { BlockTypeDefinition, BlockRegistry as IBlockRegistry, ClientBlockDefinition } from '../types/block';
|
|
9
|
+
/**
|
|
10
|
+
* Dynamic Block Registry Implementation
|
|
11
|
+
* No default blocks - all blocks must be registered by client applications
|
|
12
|
+
*/
|
|
13
|
+
declare class BlockRegistryImpl implements IBlockRegistry {
|
|
14
|
+
private _types;
|
|
15
|
+
get types(): Map<string, BlockTypeDefinition>;
|
|
16
|
+
/**
|
|
17
|
+
* Register a single block type
|
|
18
|
+
*/
|
|
19
|
+
register(definition: BlockTypeDefinition): void;
|
|
20
|
+
/**
|
|
21
|
+
* Register multiple client blocks at once
|
|
22
|
+
* This is the primary method for client applications to register their blocks
|
|
23
|
+
*/
|
|
24
|
+
registerClientBlocks(definitions: ClientBlockDefinition[]): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get block type definition by type string
|
|
27
|
+
*/
|
|
28
|
+
get(type: string): BlockTypeDefinition | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Get all registered block types
|
|
31
|
+
*/
|
|
32
|
+
getAll(): BlockTypeDefinition[];
|
|
33
|
+
/**
|
|
34
|
+
* Get block types filtered by category
|
|
35
|
+
*/
|
|
36
|
+
getByCategory(category: BlockTypeDefinition['category']): BlockTypeDefinition[];
|
|
37
|
+
/**
|
|
38
|
+
* Check if a block type is registered
|
|
39
|
+
*/
|
|
40
|
+
has(type: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Unregister a block type (useful for testing or dynamic loading)
|
|
43
|
+
*/
|
|
44
|
+
unregister(type: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Clear all registered block types
|
|
47
|
+
* Useful for testing or resetting the registry
|
|
48
|
+
*/
|
|
49
|
+
clear(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get count of registered blocks
|
|
52
|
+
*/
|
|
53
|
+
getCount(): number;
|
|
54
|
+
}
|
|
55
|
+
export declare const blockRegistry: BlockRegistryImpl;
|
|
56
|
+
export {};
|
|
57
|
+
/**
|
|
58
|
+
* NOTE: No default blocks are registered automatically.
|
|
59
|
+
* Client applications must call registerClientBlocks() to populate the registry.
|
|
60
|
+
* This ensures the editor is a true "shell" without hardcoded blocks.
|
|
61
|
+
*/
|
|
62
|
+
//# sourceMappingURL=BlockRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockRegistry.d.ts","sourceRoot":"","sources":["../../src/registry/BlockRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,mBAAmB,EACnB,aAAa,IAAI,cAAc,EAC/B,qBAAqB,EACxB,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,cAAM,iBAAkB,YAAW,cAAc;IAC7C,OAAO,CAAC,MAAM,CAA+C;IAE7D,IAAI,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAE5C;IAED;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI;IAa/C;;;OAGG;IACH,oBAAoB,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAmChE;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIlD;;OAEG;IACH,MAAM,IAAI,mBAAmB,EAAE;IAI/B;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG,mBAAmB,EAAE;IAI/E;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,QAAQ,IAAI,MAAM;CAGrB;AAGD,eAAO,MAAM,aAAa,mBAA0B,CAAC;;AAErD;;;;GAIG"}
|