@webiny/app-website-builder 6.0.0 → 6.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BaseEditor/commandHandlers/CreateElement.js +8 -1
- package/BaseEditor/commandHandlers/CreateElement.js.map +1 -1
- package/BaseEditor/commandHandlers/DeleteElement.js +8 -3
- package/BaseEditor/commandHandlers/DeleteElement.js.map +1 -1
- package/BaseEditor/commandHandlers/MoveElement.js +12 -1
- package/BaseEditor/commandHandlers/MoveElement.js.map +1 -1
- package/BaseEditor/commands.d.ts +4 -0
- package/BaseEditor/commands.js +2 -0
- package/BaseEditor/commands.js.map +1 -1
- package/BaseEditor/config/EditorConfig.d.ts +494 -2
- package/BaseEditor/config/EditorConfig.js +20 -5
- package/BaseEditor/config/EditorConfig.js.map +1 -1
- package/BaseEditor/config/Element.d.ts +2 -2
- package/BaseEditor/config/Element.js.map +1 -1
- package/BaseEditor/config/ElementOverlay.d.ts +18 -0
- package/BaseEditor/config/ElementOverlay.js +49 -0
- package/BaseEditor/config/ElementOverlay.js.map +1 -0
- package/BaseEditor/config/IconButton.d.ts +1 -1
- package/BaseEditor/config/IconButton.js.map +1 -1
- package/BaseEditor/config/IsNotReadOnly.d.ts +5 -0
- package/BaseEditor/config/IsNotReadOnly.js +13 -0
- package/BaseEditor/config/IsNotReadOnly.js.map +1 -0
- package/BaseEditor/config/IsReadOnly.d.ts +5 -0
- package/BaseEditor/config/IsReadOnly.js +13 -0
- package/BaseEditor/config/IsReadOnly.js.map +1 -0
- package/BaseEditor/config/Layout.js +13 -4
- package/BaseEditor/config/Layout.js.map +1 -1
- package/BaseEditor/config/Sidebar/Layout.js +2 -0
- package/BaseEditor/config/Sidebar/Layout.js.map +1 -1
- package/BaseEditor/config/Sidebar/Tab.d.ts +1 -1
- package/BaseEditor/config/Sidebar/Tab.js +1 -1
- package/BaseEditor/config/Sidebar/Tab.js.map +1 -1
- package/BaseEditor/config/Toolbar/Layout.js +1 -1
- package/BaseEditor/config/Toolbar/Layout.js.map +1 -1
- package/BaseEditor/config/Toolbar/Toolbar.js +2 -1
- package/BaseEditor/config/Toolbar/Toolbar.js.map +1 -1
- package/BaseEditor/config/TopBar/Layout.js +1 -0
- package/BaseEditor/config/TopBar/Layout.js.map +1 -1
- package/BaseEditor/config/TopBar/MenuItem.d.ts +1 -1
- package/BaseEditor/config/TopBar/MenuItem.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/{Preview → AddressBar}/AddressBar.js +7 -6
- package/BaseEditor/defaultConfig/Content/AddressBar/AddressBar.js.map +1 -0
- package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/PreviewDomain.js +2 -2
- package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/RefreshPreview.js +2 -2
- package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/usePreviewLink.js +2 -2
- package/BaseEditor/defaultConfig/Content/Breadcrumbs/Breadcrumbs.js +2 -1
- package/BaseEditor/defaultConfig/Content/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Breadcrumbs/styles.js +9 -67
- package/BaseEditor/defaultConfig/Content/Breadcrumbs/styles.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/ContentPreviewConfig.d.ts +2 -0
- package/BaseEditor/defaultConfig/Content/ContentPreviewConfig.js +22 -0
- package/BaseEditor/defaultConfig/Content/ContentPreviewConfig.js.map +1 -0
- package/BaseEditor/defaultConfig/Content/Preview/DropZoneManager.d.ts +1 -0
- package/BaseEditor/defaultConfig/Content/Preview/DropZoneManager.js +54 -11
- package/BaseEditor/defaultConfig/Content/Preview/DropZoneManager.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/Iframe.js +27 -13
- package/BaseEditor/defaultConfig/Content/Preview/Iframe.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/KeyboardShortcuts.js +4 -11
- package/BaseEditor/defaultConfig/Content/Preview/KeyboardShortcuts.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementDropLines.d.ts +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementDropLines.js +44 -4
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementDropLines.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementOverlay.d.ts +1 -10
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementOverlay.js +13 -8
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementOverlay.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementOverlayProvider.d.ts +16 -0
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementOverlayProvider.js +19 -0
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementOverlayProvider.js.map +1 -0
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementOverlays.js +9 -10
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementOverlays.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/Preview.js +2 -3
- package/BaseEditor/defaultConfig/Content/Preview/Preview.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/PreviewContainer.d.ts +6 -0
- package/BaseEditor/defaultConfig/Content/Preview/PreviewContainer.js +16 -0
- package/BaseEditor/defaultConfig/Content/Preview/PreviewContainer.js.map +1 -0
- package/BaseEditor/defaultConfig/Content/Preview/PreviewEvents.js +36 -1
- package/BaseEditor/defaultConfig/Content/Preview/PreviewEvents.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/useElementComponentManifest.d.ts +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/useElementComponentManifest.js +6 -5
- package/BaseEditor/defaultConfig/Content/Preview/useElementComponentManifest.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/useIframeUrl.js +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/useIframeUrl.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/useProximityDropzone.d.ts +2 -1
- package/BaseEditor/defaultConfig/Content/Preview/useProximityDropzone.js +4 -2
- package/BaseEditor/defaultConfig/Content/Preview/useProximityDropzone.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/useResponsiveContainer.d.ts +3 -3
- package/BaseEditor/defaultConfig/Content/Preview/useResponsiveContainer.js +18 -13
- package/BaseEditor/defaultConfig/Content/Preview/useResponsiveContainer.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/{Preview/usePreviewDomain.js → usePreviewDomain.js} +1 -1
- package/BaseEditor/defaultConfig/DefaultEditorConfig.js +2 -9
- package/BaseEditor/defaultConfig/DefaultEditorConfig.js.map +1 -1
- package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.d.ts +19 -1
- package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.js +3 -2
- package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.js.map +1 -1
- package/BaseEditor/defaultConfig/Sidebar/ElementSettings/useBindingsForElement.d.ts +11 -11
- package/BaseEditor/defaultConfig/Sidebar/ElementSettings/useInputValue.js +15 -4
- package/BaseEditor/defaultConfig/Sidebar/ElementSettings/useInputValue.js.map +1 -1
- package/BaseEditor/defaultConfig/Toolbar/InsertElements/useComponentGroups.js +3 -2
- package/BaseEditor/defaultConfig/Toolbar/InsertElements/useComponentGroups.js.map +1 -1
- package/BaseEditor/hooks/useCreateElement.d.ts +5 -0
- package/BaseEditor/hooks/useCreateElement.js +14 -0
- package/BaseEditor/hooks/useCreateElement.js.map +1 -0
- package/BaseEditor/hooks/useDeleteElement.d.ts +3 -0
- package/BaseEditor/hooks/useDeleteElement.js +16 -0
- package/BaseEditor/hooks/useDeleteElement.js.map +1 -0
- package/BaseEditor/hooks/useElementInputs.d.ts +10 -0
- package/BaseEditor/hooks/useElementInputs.js +33 -0
- package/BaseEditor/hooks/useElementInputs.js.map +1 -0
- package/BaseEditor/hooks/useElementOverlay.d.ts +1 -0
- package/BaseEditor/hooks/useElementOverlay.js +3 -0
- package/BaseEditor/hooks/useElementOverlay.js.map +1 -0
- package/BaseEditor/hooks/useHighlightedElement.d.ts +2 -0
- package/BaseEditor/hooks/useHighlightedElement.js +26 -0
- package/BaseEditor/hooks/useHighlightedElement.js.map +1 -0
- package/BaseEditor/hooks/useReservedUISpace.d.ts +10 -0
- package/BaseEditor/hooks/useReservedUISpace.js +48 -0
- package/BaseEditor/hooks/useReservedUISpace.js.map +1 -0
- package/BaseEditor/hooks/useUpdateElement.d.ts +3 -0
- package/BaseEditor/hooks/useUpdateElement.js +14 -0
- package/BaseEditor/hooks/useUpdateElement.js.map +1 -0
- package/DocumentEditor/StateInspector.js +16 -43
- package/DocumentEditor/StateInspector.js.map +1 -1
- package/Extension.js +1 -8
- package/Extension.js.map +1 -1
- package/components/TrashBin/adapters/TrashBinBulkActionsGraphQLGateway.d.ts +16 -0
- package/components/TrashBin/adapters/TrashBinBulkActionsGraphQLGateway.js +30 -0
- package/components/TrashBin/adapters/TrashBinBulkActionsGraphQLGateway.js.map +1 -0
- package/components/TrashBin/adapters/TrashBinDeletePageGraphQLGateway.d.ts +11 -0
- package/components/TrashBin/adapters/TrashBinDeletePageGraphQLGateway.js +30 -0
- package/components/TrashBin/adapters/TrashBinDeletePageGraphQLGateway.js.map +1 -0
- package/components/TrashBin/adapters/TrashBinItemMapper.d.ts +5 -0
- package/components/TrashBin/adapters/TrashBinItemMapper.js +18 -0
- package/components/TrashBin/adapters/TrashBinItemMapper.js.map +1 -0
- package/components/TrashBin/adapters/TrashBinListPagesGraphQLGateway.d.ts +16 -0
- package/components/TrashBin/adapters/TrashBinListPagesGraphQLGateway.js +32 -0
- package/components/TrashBin/adapters/TrashBinListPagesGraphQLGateway.js.map +1 -0
- package/components/TrashBin/adapters/TrashBinRestorePageGraphQLGateway.d.ts +14 -0
- package/components/TrashBin/adapters/TrashBinRestorePageGraphQLGateway.js +30 -0
- package/components/TrashBin/adapters/TrashBinRestorePageGraphQLGateway.js.map +1 -0
- package/components/TrashBin/adapters/graphql/bulkActionsMutation.d.ts +15 -0
- package/components/TrashBin/adapters/graphql/bulkActionsMutation.js +20 -0
- package/components/TrashBin/adapters/graphql/bulkActionsMutation.js.map +1 -0
- package/components/TrashBin/adapters/graphql/listQuery.d.ts +21 -0
- package/components/TrashBin/adapters/graphql/listQuery.js +20 -0
- package/components/TrashBin/adapters/graphql/listQuery.js.map +1 -0
- package/components/TrashBin/adapters/graphql/permanentDeleteMutation.d.ts +15 -0
- package/components/TrashBin/adapters/graphql/permanentDeleteMutation.js +18 -0
- package/components/TrashBin/adapters/graphql/permanentDeleteMutation.js.map +1 -0
- package/components/TrashBin/adapters/graphql/restoreMutation.d.ts +14 -0
- package/components/TrashBin/adapters/graphql/restoreMutation.js +20 -0
- package/components/TrashBin/adapters/graphql/restoreMutation.js.map +1 -0
- package/components/TrashBin/adapters/index.d.ts +6 -0
- package/components/TrashBin/adapters/index.js +8 -0
- package/components/TrashBin/adapters/index.js.map +1 -0
- package/components/TrashBin/adapters/usePageFields.d.ts +1 -0
- package/components/TrashBin/adapters/usePageFields.js +14 -0
- package/components/TrashBin/adapters/usePageFields.js.map +1 -0
- package/components/TrashBin/components/TrashBin.d.ts +2 -0
- package/components/TrashBin/components/TrashBin.js +70 -0
- package/components/TrashBin/components/TrashBin.js.map +1 -0
- package/components/TrashBin/components/TrashBin.styled.d.ts +13 -0
- package/components/TrashBin/components/TrashBin.styled.js +44 -0
- package/components/TrashBin/components/TrashBin.styled.js.map +1 -0
- package/components/TrashBin/components/TrashBinButton.d.ts +5 -0
- package/components/TrashBin/components/TrashBinButton.js +17 -0
- package/components/TrashBin/components/TrashBinButton.js.map +1 -0
- package/components/TrashBin/components/index.d.ts +1 -0
- package/components/TrashBin/components/index.js +3 -0
- package/components/TrashBin/components/index.js.map +1 -0
- package/components/TrashBin/index.d.ts +1 -0
- package/components/TrashBin/index.js +3 -0
- package/components/TrashBin/index.js.map +1 -0
- package/editorSdk/Editor.d.ts +6 -0
- package/editorSdk/Editor.js +8 -1
- package/editorSdk/Editor.js.map +1 -1
- package/editorSdk/utils/$createElement.d.ts +2 -1
- package/editorSdk/utils/$createElement.js +40 -1
- package/editorSdk/utils/$createElement.js.map +1 -1
- package/editorSdk/utils/$deleteElement.d.ts +2 -2
- package/editorSdk/utils/$deleteElement.js +58 -14
- package/editorSdk/utils/$deleteElement.js.map +1 -1
- package/editorSdk/utils/$getElementInputValues.d.ts +5 -0
- package/editorSdk/utils/$getElementInputValues.js +76 -0
- package/editorSdk/utils/$getElementInputValues.js.map +1 -0
- package/editorSdk/utils/$getElementsOfType.d.ts +2 -0
- package/editorSdk/utils/$getElementsOfType.js +5 -0
- package/editorSdk/utils/$getElementsOfType.js.map +1 -0
- package/editorSdk/utils/$getFirstElementOfType.d.ts +2 -0
- package/editorSdk/utils/$getFirstElementOfType.js +5 -0
- package/editorSdk/utils/$getFirstElementOfType.js.map +1 -0
- package/editorSdk/utils/$moveElement.d.ts +3 -2
- package/editorSdk/utils/$moveElement.js +14 -1
- package/editorSdk/utils/$moveElement.js.map +1 -1
- package/editorSdk/utils/$previewElementInputs.d.ts +6 -0
- package/editorSdk/utils/$previewElementInputs.js +39 -0
- package/editorSdk/utils/$previewElementInputs.js.map +1 -0
- package/editorSdk/utils/$updateElementInputs.d.ts +7 -0
- package/editorSdk/utils/$updateElementInputs.js +50 -0
- package/editorSdk/utils/$updateElementInputs.js.map +1 -0
- package/editorSdk/utils/executeOnChange.d.ts +33 -0
- package/editorSdk/utils/executeOnChange.js +246 -0
- package/editorSdk/utils/executeOnChange.js.map +1 -0
- package/editorSdk/utils/index.d.ts +6 -0
- package/editorSdk/utils/index.js +6 -0
- package/editorSdk/utils/index.js.map +1 -1
- package/exports/admin/website-builder/page/editor.d.ts +34 -2
- package/exports/admin/website-builder/page/editor.js +34 -2
- package/exports/admin/website-builder/page/editor.js.map +1 -1
- package/exports/admin/website-builder.d.ts +1 -0
- package/exports/admin/website-builder.js +1 -0
- package/exports/admin/website-builder.js.map +1 -1
- package/features/pages/deletePage/DeletePage.test.js +2 -1
- package/features/pages/deletePage/DeletePage.test.js.map +1 -1
- package/features/pages/deletePage/DeletePageGqlGateway.d.ts +2 -1
- package/features/pages/deletePage/DeletePageGqlGateway.js +3 -2
- package/features/pages/deletePage/DeletePageGqlGateway.js.map +1 -1
- package/features/pages/deletePage/DeletePageRepository.d.ts +1 -1
- package/features/pages/deletePage/DeletePageRepository.js +2 -2
- package/features/pages/deletePage/DeletePageRepository.js.map +1 -1
- package/features/pages/deletePage/DeletePageUseCase.js +1 -1
- package/features/pages/deletePage/DeletePageUseCase.js.map +1 -1
- package/features/pages/deletePage/IDeletePageGateway.d.ts +1 -1
- package/features/pages/deletePage/IDeletePageGateway.js.map +1 -1
- package/features/pages/deletePage/IDeletePageRepository.d.ts +1 -1
- package/features/pages/deletePage/IDeletePageRepository.js.map +1 -1
- package/features/pages/deletePage/IDeletePageUseCase.d.ts +1 -0
- package/features/pages/deletePage/IDeletePageUseCase.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/modules/pages/PageEditor/DefaultPageEditorConfig.js +6 -5
- package/modules/pages/PageEditor/DefaultPageEditorConfig.js.map +1 -1
- package/modules/pages/PageEditor/PageAutoSave.js +5 -5
- package/modules/pages/PageEditor/PageAutoSave.js.map +1 -1
- package/modules/pages/PageEditor/PageEditorConfig.d.ts +569 -88
- package/modules/pages/PageEditor/PageEditorConfig.js +23 -3
- package/modules/pages/PageEditor/PageEditorConfig.js.map +1 -1
- package/modules/pages/PageEditor/PageSettings/PageSettings.d.ts +30 -0
- package/modules/pages/PageEditor/PageSettings/PageSettings.js +84 -0
- package/modules/pages/PageEditor/PageSettings/PageSettings.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/PageSettingsConfig.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/PageSettingsConfig.js +98 -0
- package/modules/pages/PageEditor/PageSettings/PageSettingsConfig.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralImage.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralImage.js +31 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralImage.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralPath.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralPath.js +16 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralPath.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralSnippet.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralSnippet.js +14 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralSnippet.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralTags.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralTags.js +14 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralTags.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralTitle.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralTitle.js +16 -0
- package/modules/pages/PageEditor/PageSettings/elements/GeneralTitle.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SchemaEditor.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SchemaEditor.js +31 -0
- package/modules/pages/PageEditor/PageSettings/elements/SchemaEditor.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoCanonicalUrl.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoCanonicalUrl.js +26 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoCanonicalUrl.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoDescription.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoDescription.js +15 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoDescription.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoMetaTags.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoMetaTags.js +18 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoMetaTags.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoNoFollow.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoNoFollow.js +16 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoNoFollow.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoNoIndex.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoNoIndex.js +16 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoNoIndex.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoTitle.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoTitle.js +15 -0
- package/modules/pages/PageEditor/PageSettings/elements/SeoTitle.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialDescription.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialDescription.js +15 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialDescription.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialImage.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialImage.js +31 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialImage.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialMetaTags.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialMetaTags.js +18 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialMetaTags.js.map +1 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialTitle.d.ts +2 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialTitle.js +15 -0
- package/modules/pages/PageEditor/PageSettings/elements/SocialTitle.js.map +1 -0
- package/modules/pages/PageEditor/TopBar/RevisionsMenu.js.map +1 -1
- package/modules/pages/PageEditor/TopBar/Settings/PageSettingsDialog.d.ts +2 -0
- package/modules/pages/PageEditor/TopBar/Settings/PageSettingsDialog.js +37 -0
- package/modules/pages/PageEditor/TopBar/Settings/PageSettingsDialog.js.map +1 -0
- package/modules/pages/PageEditor/TopBar/Settings/PageSettingsDrawer.d.ts +3 -0
- package/modules/pages/PageEditor/TopBar/Settings/PageSettingsDrawer.js +73 -0
- package/modules/pages/PageEditor/TopBar/Settings/PageSettingsDrawer.js.map +1 -0
- package/modules/pages/PageEditor/TopBar/Settings/SettingsDialogBody.d.ts +5 -1
- package/modules/pages/PageEditor/TopBar/Settings/SettingsDialogBody.js +15 -229
- package/modules/pages/PageEditor/TopBar/Settings/SettingsDialogBody.js.map +1 -1
- package/modules/pages/PageEditor/TopBar/SettingsButton.d.ts +6 -0
- package/modules/pages/PageEditor/TopBar/SettingsButton.js +45 -27
- package/modules/pages/PageEditor/TopBar/SettingsButton.js.map +1 -1
- package/modules/pages/PageEditor/TopBar/Title.js +10 -0
- package/modules/pages/PageEditor/TopBar/Title.js.map +1 -1
- package/modules/pages/PageEditor/usePageEditorConfig.d.ts +20 -0
- package/modules/pages/PageEditor/usePageEditorConfig.js +13 -0
- package/modules/pages/PageEditor/usePageEditorConfig.js.map +1 -0
- package/modules/pages/PagesList/components/BulkActions/BulkActionDelete.js +2 -1
- package/modules/pages/PagesList/components/BulkActions/BulkActionDelete.js.map +1 -1
- package/modules/pages/PagesList/components/Main/CreatePage/CreatePage.js +9 -1
- package/modules/pages/PagesList/components/Main/CreatePage/CreatePage.js.map +1 -1
- package/modules/pages/PagesList/components/Table/Actions/Delete.js +1 -1
- package/modules/pages/PagesList/components/Table/Actions/Delete.js.map +1 -1
- package/modules/pages/PagesList/hooks/useDeletePageConfirmationDialog.js +4 -3
- package/modules/pages/PagesList/hooks/useDeletePageConfirmationDialog.js.map +1 -1
- package/modules/pages/PagesList/hooks/usePagePreviewLink.js +1 -1
- package/modules/pages/PagesList/hooks/usePagePreviewLink.js.map +1 -1
- package/modules/pages/PagesListConfig.js +4 -0
- package/modules/pages/PagesListConfig.js.map +1 -1
- package/modules/pages/configs/list/Browser/PageAction.d.ts +1 -0
- package/modules/pages/configs/list/Browser/PageAction.js +3 -1
- package/modules/pages/configs/list/Browser/PageAction.js.map +1 -1
- package/modules/pages/configs/list/Browser/index.d.ts +1 -0
- package/modules/pages/configs/list/PageListConfig.d.ts +2 -0
- package/modules/redirects/configs/list/Browser/RedirectAction.d.ts +1 -0
- package/modules/redirects/configs/list/Browser/RedirectAction.js +3 -1
- package/modules/redirects/configs/list/Browser/RedirectAction.js.map +1 -1
- package/modules/redirects/configs/list/Browser/index.d.ts +1 -0
- package/modules/redirects/configs/list/RedirectListConfig.d.ts +1 -0
- package/package.json +35 -42
- package/presentation/navigation/NextjsConfig/markdownComponents.js +3 -1
- package/presentation/navigation/NextjsConfig/markdownComponents.js.map +1 -1
- package/types.d.ts +1 -0
- package/types.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/AddressBar.js.map +0 -1
- /package/BaseEditor/defaultConfig/Content/{Preview → AddressBar}/AddressBar.d.ts +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview → AddressBar}/BreakpointSelector.d.ts +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview → AddressBar}/BreakpointSelector.js +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview → AddressBar}/BreakpointSelector.js.map +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/OpenInNewTab.d.ts +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/OpenInNewTab.js +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/OpenInNewTab.js.map +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/PreviewDomain.d.ts +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/PreviewDomain.js.map +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/PreviewInNewTab.d.ts +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/PreviewInNewTab.js +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/PreviewInNewTab.js.map +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/RefreshPreview.d.ts +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/RefreshPreview.js.map +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/usePreviewLink.d.ts +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/AddressBar → AddressBar}/usePreviewLink.js.map +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/usePreviewDomain.d.ts → usePreviewDomain.d.ts} +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/usePreviewDomain.js.map → usePreviewDomain.js.map} +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/useSubscribeToLocalStorage.d.ts → useSubscribeToLocalStorage.d.ts} +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/useSubscribeToLocalStorage.js → useSubscribeToLocalStorage.js} +0 -0
- /package/BaseEditor/defaultConfig/Content/{Preview/useSubscribeToLocalStorage.js.map → useSubscribeToLocalStorage.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["css","breadcrumbs","
|
|
1
|
+
{"version":3,"names":["css","breadcrumbs","process","env","NODE_ENV","name","styles","toString","_EMOTION_STRINGIFIED_CSS_ERROR__"],"sources":["styles.ts"],"sourcesContent":["import { css } from \"@emotion/css\";\n\nexport const breadcrumbs = css({\n display: \"flex\",\n zIndex: 100,\n flexDirection: \"row\",\n padding: 0,\n position: \"absolute\",\n left: 300,\n bottom: 0,\n width: \"calc(100% - 600px)\",\n height: \"31px\",\n backgroundColor: \"var(--color-neutral-dimmed)\",\n borderTop: \"1px solid var( --color-neutral-dimmed)\",\n fontSize: \"12px\",\n overflow: \"hidden\",\n \"> li\": {\n cursor: \"pointer\",\n display: \"flex\",\n \"& .element\": {\n color: \"var(--text-neutral-strong)\",\n textDecoration: \"none\",\n textTransform: \"capitalize\",\n padding: \"5px 0 5px 30px\",\n background: \"hsla(300, 2%, calc(92% - var(--element-count) * 1%), 1)\",\n position: \"relative\",\n display: \"block\"\n },\n \"& .element::after\": {\n content: '\" \"',\n display: \"block\",\n width: \"0\",\n height: \"0\",\n borderTop: \"50px solid transparent\",\n borderBottom: \"50px solid transparent\",\n borderLeft: \"20px solid hsla(300, 2%, calc(92% - var(--element-count) * 1%), 1) \",\n position: \"absolute\",\n top: \"50%\",\n marginTop: \"-50px\",\n left: \"100%\",\n zIndex: 2\n },\n \"& .element::before\": {\n content: '\" \"',\n display: \"block\",\n width: \"0\",\n height: \"0\",\n borderTop: \"50px solid transparent\",\n borderBottom: \"50px solid transparent\",\n borderLeft: \"20px solid hsla(0, 0%, 100%, 1)\",\n position: \"absolute\",\n top: \"50%\",\n marginTop: \"-50px\",\n marginLeft: \"1px\",\n left: \"100%\",\n zIndex: 1\n }\n },\n \"& li:first-child .element\": { paddingLeft: \"10px\" },\n\n // Handle active state\n \"& li .element:hover\": {\n background: \"var(--color-neutral-muted)\"\n },\n \"& li .element:hover:after\": {\n borderLeftColor: \"var(--color-neutral-muted) !important\"\n }\n});\n"],"mappings":";AAAA,SAASA,GAAG,QAAQ,cAAc;AAElC,OAAO,MAAMC,WAAW,gBAAGD,GAAG,CAAAE,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,QAAA,EAAAC;AAAA,CAiE7B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { EditorConfig } from "../../index.js";
|
|
3
|
+
import { Breadcrumbs } from "./Breadcrumbs/index.js";
|
|
4
|
+
import { DocumentPreview } from "./Preview/DocumentPreview.js";
|
|
5
|
+
import { AddressBar } from "./AddressBar/AddressBar.js";
|
|
6
|
+
export const ContentPreviewConfig = () => {
|
|
7
|
+
const {
|
|
8
|
+
Ui
|
|
9
|
+
} = EditorConfig;
|
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Ui.Content.Element, {
|
|
11
|
+
name: "addressBar",
|
|
12
|
+
element: /*#__PURE__*/React.createElement(AddressBar, null)
|
|
13
|
+
}), /*#__PURE__*/React.createElement(Ui.Content.Element, {
|
|
14
|
+
name: "iframe",
|
|
15
|
+
element: /*#__PURE__*/React.createElement(DocumentPreview, null)
|
|
16
|
+
}), /*#__PURE__*/React.createElement(Ui.Content.Element, {
|
|
17
|
+
name: "breadcrumbs",
|
|
18
|
+
element: /*#__PURE__*/React.createElement(Ui.IsNotReadOnly, null, /*#__PURE__*/React.createElement(Breadcrumbs, null))
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=ContentPreviewConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","EditorConfig","Breadcrumbs","DocumentPreview","AddressBar","ContentPreviewConfig","Ui","createElement","Fragment","Content","Element","name","element","IsNotReadOnly"],"sources":["ContentPreviewConfig.tsx"],"sourcesContent":["import React from \"react\";\nimport { EditorConfig } from \"~/BaseEditor/index.js\";\nimport { Breadcrumbs } from \"./Breadcrumbs/index.js\";\nimport { DocumentPreview } from \"./Preview/DocumentPreview.js\";\nimport { AddressBar } from \"./AddressBar/AddressBar.js\";\n\nexport const ContentPreviewConfig = () => {\n const { Ui } = EditorConfig;\n\n return (\n <>\n <Ui.Content.Element name=\"addressBar\" element={<AddressBar />} />\n <Ui.Content.Element name=\"iframe\" element={<DocumentPreview />} />\n <Ui.Content.Element\n name={\"breadcrumbs\"}\n element={\n <Ui.IsNotReadOnly>\n <Breadcrumbs />\n </Ui.IsNotReadOnly>\n }\n />\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY;AACrB,SAASC,WAAW;AACpB,SAASC,eAAe;AACxB,SAASC,UAAU;AAEnB,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACtC,MAAM;IAAEC;EAAG,CAAC,GAAGL,YAAY;EAE3B,oBACID,KAAA,CAAAO,aAAA,CAAAP,KAAA,CAAAQ,QAAA,qBACIR,KAAA,CAAAO,aAAA,CAACD,EAAE,CAACG,OAAO,CAACC,OAAO;IAACC,IAAI,EAAC,YAAY;IAACC,OAAO,eAAEZ,KAAA,CAAAO,aAAA,CAACH,UAAU,MAAE;EAAE,CAAE,CAAC,eACjEJ,KAAA,CAAAO,aAAA,CAACD,EAAE,CAACG,OAAO,CAACC,OAAO;IAACC,IAAI,EAAC,QAAQ;IAACC,OAAO,eAAEZ,KAAA,CAAAO,aAAA,CAACJ,eAAe,MAAE;EAAE,CAAE,CAAC,eAClEH,KAAA,CAAAO,aAAA,CAACD,EAAE,CAACG,OAAO,CAACC,OAAO;IACfC,IAAI,EAAE,aAAc;IACpBC,OAAO,eACHZ,KAAA,CAAAO,aAAA,CAACD,EAAE,CAACO,aAAa,qBACbb,KAAA,CAAAO,aAAA,CAACL,WAAW,MAAE,CACA;EACrB,CACJ,CACH,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -46,24 +46,67 @@ export class DropZoneManager {
|
|
|
46
46
|
let matchedId = null;
|
|
47
47
|
let matchedPosition = null;
|
|
48
48
|
let matchedBox = null;
|
|
49
|
+
|
|
50
|
+
// Collect all candidate matches with their canAccept callback.
|
|
51
|
+
const candidates = [];
|
|
49
52
|
for (const [id, {
|
|
50
|
-
box
|
|
53
|
+
box,
|
|
54
|
+
canAccept
|
|
51
55
|
}] of this.zones) {
|
|
52
56
|
const isWithinX = mouseX >= box.left && mouseX <= box.right;
|
|
53
57
|
if (!isWithinX) {
|
|
54
58
|
continue;
|
|
55
59
|
}
|
|
56
|
-
if (mouseY
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
if (Math.abs(mouseY - box.top) <= threshold) {
|
|
61
|
+
candidates.push({
|
|
62
|
+
id,
|
|
63
|
+
box,
|
|
64
|
+
position: 0,
|
|
65
|
+
canAccept
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (Math.abs(mouseY - box.bottom) <= threshold) {
|
|
69
|
+
candidates.push({
|
|
70
|
+
id,
|
|
71
|
+
box,
|
|
72
|
+
position: 1,
|
|
73
|
+
canAccept
|
|
74
|
+
});
|
|
61
75
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
}
|
|
77
|
+
if (candidates.length > 0) {
|
|
78
|
+
// Filter to only eligible candidates.
|
|
79
|
+
const eligible = candidates.filter(c => !c.canAccept || c.canAccept());
|
|
80
|
+
if (eligible.length > 0) {
|
|
81
|
+
const uniqueDepths = [...new Set(eligible.map(c => c.box.depth))].sort((a, b) => b - a);
|
|
82
|
+
if (uniqueDepths.length === 1) {
|
|
83
|
+
const winner = eligible[0];
|
|
84
|
+
matchedId = winner.id;
|
|
85
|
+
matchedPosition = winner.position;
|
|
86
|
+
matchedBox = winner.box;
|
|
87
|
+
} else {
|
|
88
|
+
// Use X position to select depth band among eligible candidates only.
|
|
89
|
+
let rangeLeft = Infinity;
|
|
90
|
+
let rangeRight = -Infinity;
|
|
91
|
+
for (const c of eligible) {
|
|
92
|
+
rangeLeft = Math.min(rangeLeft, c.box.left);
|
|
93
|
+
rangeRight = Math.max(rangeRight, c.box.right);
|
|
94
|
+
}
|
|
95
|
+
const centerX = (rangeLeft + rangeRight) / 2;
|
|
96
|
+
const halfWidth = (rangeRight - rangeLeft) / 2;
|
|
97
|
+
|
|
98
|
+
// 0 at center, 1 at edges.
|
|
99
|
+
const distFromCenter = halfWidth > 0 ? Math.abs(mouseX - centerX) / halfWidth : 0;
|
|
100
|
+
|
|
101
|
+
// Map distance to depth index: center → 0 (deepest), edges → last (shallowest).
|
|
102
|
+
const depthIndex = Math.min(Math.floor(distFromCenter * uniqueDepths.length), uniqueDepths.length - 1);
|
|
103
|
+
const winner = eligible.find(c => c.box.depth === uniqueDepths[depthIndex]);
|
|
104
|
+
if (winner) {
|
|
105
|
+
matchedId = winner.id;
|
|
106
|
+
matchedPosition = winner.position;
|
|
107
|
+
matchedBox = winner.box;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
67
110
|
}
|
|
68
111
|
}
|
|
69
112
|
if (matchedId !== this.currentTargetId || matchedPosition !== this.currentPosition) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DropZoneManager","zones","Map","currentTargetId","currentPosition","animationFrame","currentBox","constructor","mouse","register","entry","id","set","unregister","delete","start","runDropzoneLoop","tick","requestAnimationFrame","stop","cancelAnimationFrame","getLastMatchedPosition","parentId","slot","parentSlot","index","parentIndex","scrollYOffset","getScrollOffset","threshold","mouseX","x","mouseY","y","matchedId","matchedPosition","matchedBox","box","isWithinX","left","right","top","bottom","isTarget","onProximityChange","position","container","document","getElementById","scrollTop"],"sources":["DropZoneManager.ts"],"sourcesContent":["import type { Box } from \"./Box.js\";\n\ntype DropPosition = number | null;\n\nexport interface DropZoneProximity {\n box: Box;\n position: DropPosition;\n}\n\ninterface DropzoneEntry {\n id: string;\n box: Box;\n onProximityChange: (proximity: DropZoneProximity | null) => void;\n}\n\nexport class DropZoneManager {\n private zones = new Map<string, DropzoneEntry>();\n private currentTargetId: string | null = null;\n private currentPosition: DropPosition = null;\n private animationFrame: number | null = null;\n private currentBox: Box | null = null;\n\n constructor(private mouse: { x: number; y: number }) {}\n\n register(entry: DropzoneEntry) {\n if (entry.id === \"root\") {\n return;\n }\n\n this.zones.set(entry.id, entry);\n }\n\n unregister(id: string) {\n this.zones.delete(id);\n }\n\n start() {\n const runDropzoneLoop = () => {\n this.tick();\n this.animationFrame = requestAnimationFrame(runDropzoneLoop);\n };\n this.animationFrame = requestAnimationFrame(runDropzoneLoop);\n }\n\n stop() {\n if (this.animationFrame) {\n cancelAnimationFrame(this.animationFrame);\n }\n }\n\n getLastMatchedPosition() {\n if (!this.currentBox) {\n return null;\n }\n\n return {\n parentId: this.currentBox.parentId,\n slot: this.currentBox.parentSlot,\n index: this.currentBox.parentIndex + (this.currentPosition ?? 0)\n };\n }\n\n tick() {\n const scrollYOffset = this.getScrollOffset();\n const threshold = 10;\n const mouseX = this.mouse.x;\n const mouseY = this.mouse.y + scrollYOffset;\n\n let matchedId: string | null = null;\n let matchedPosition: DropPosition = null;\n let matchedBox: Box | null = null;\n\n for (const [id, { box }] of this.zones) {\n const isWithinX = mouseX >= box.left && mouseX <= box.right;\n\n if (!isWithinX) {\n continue;\n }\n\n if (mouseY >= box.top - threshold && mouseY <= box.top + threshold) {\n matchedId = id;\n matchedPosition = 0; // before\n matchedBox = box;\n break;\n }\n\n if (mouseY >= box.bottom - threshold && mouseY <= box.bottom + threshold) {\n matchedId = id;\n matchedPosition = 1; // after\n matchedBox = box;\n break;\n }\n }\n\n if (matchedId !== this.currentTargetId || matchedPosition !== this.currentPosition) {\n this.currentTargetId = matchedId;\n this.currentPosition = matchedPosition;\n this.currentBox = matchedBox;\n\n for (const [id, entry] of this.zones) {\n const isTarget = id === matchedId;\n entry.onProximityChange(\n isTarget ? { box: matchedBox!, position: matchedPosition } : null\n );\n }\n }\n }\n\n private getScrollOffset() {\n const container = document.getElementById(\"preview-container\");\n if (!container) {\n return 0;\n }\n\n return container.scrollTop;\n }\n}\n"],"mappings":"AAeA,OAAO,MAAMA,eAAe,CAAC;EACjBC,KAAK,GAAG,IAAIC,GAAG,CAAwB,CAAC;EACxCC,eAAe,GAAkB,IAAI;EACrCC,eAAe,GAAiB,IAAI;EACpCC,cAAc,GAAkB,IAAI;EACpCC,UAAU,GAAe,IAAI;EAErCC,WAAWA,CAASC,KAA+B,EAAE;IAAA,KAAjCA,KAA+B,GAA/BA,KAA+B;EAAG;EAEtDC,QAAQA,C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,EAAG;IACtB,MAAMkB,SAAS,GAAGC,QAAQ,CAACC,cAAc,CAAC,mBAAmB,CAAC;IAC9D,IAAI,CAACF,SAAS,EAAE;MACZ,OAAO,CAAC;IACZ;IAEA,OAAOA,SAAS,CAACG,SAAS;EAC9B;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["DropZoneManager","zones","Map","currentTargetId","currentPosition","animationFrame","currentBox","constructor","mouse","register","entry","id","set","unregister","delete","start","runDropzoneLoop","tick","requestAnimationFrame","stop","cancelAnimationFrame","getLastMatchedPosition","parentId","slot","parentSlot","index","parentIndex","scrollYOffset","getScrollOffset","threshold","mouseX","x","mouseY","y","matchedId","matchedPosition","matchedBox","candidates","box","canAccept","isWithinX","left","right","Math","abs","top","push","position","bottom","length","eligible","filter","c","uniqueDepths","Set","map","depth","sort","a","b","winner","rangeLeft","Infinity","rangeRight","min","max","centerX","halfWidth","distFromCenter","depthIndex","floor","find","isTarget","onProximityChange","container","document","getElementById","scrollTop"],"sources":["DropZoneManager.ts"],"sourcesContent":["import type { Box } from \"./Box.js\";\n\ntype DropPosition = number | null;\n\nexport interface DropZoneProximity {\n box: Box;\n position: DropPosition;\n}\n\ninterface DropzoneEntry {\n id: string;\n box: Box;\n canAccept?: () => boolean;\n onProximityChange: (proximity: DropZoneProximity | null) => void;\n}\n\nexport class DropZoneManager {\n private zones = new Map<string, DropzoneEntry>();\n private currentTargetId: string | null = null;\n private currentPosition: DropPosition = null;\n private animationFrame: number | null = null;\n private currentBox: Box | null = null;\n\n constructor(private mouse: { x: number; y: number }) {}\n\n register(entry: DropzoneEntry) {\n if (entry.id === \"root\") {\n return;\n }\n\n this.zones.set(entry.id, entry);\n }\n\n unregister(id: string) {\n this.zones.delete(id);\n }\n\n start() {\n const runDropzoneLoop = () => {\n this.tick();\n this.animationFrame = requestAnimationFrame(runDropzoneLoop);\n };\n this.animationFrame = requestAnimationFrame(runDropzoneLoop);\n }\n\n stop() {\n if (this.animationFrame) {\n cancelAnimationFrame(this.animationFrame);\n }\n }\n\n getLastMatchedPosition() {\n if (!this.currentBox) {\n return null;\n }\n\n return {\n parentId: this.currentBox.parentId,\n slot: this.currentBox.parentSlot,\n index: this.currentBox.parentIndex + (this.currentPosition ?? 0)\n };\n }\n\n tick() {\n const scrollYOffset = this.getScrollOffset();\n const threshold = 10;\n const mouseX = this.mouse.x;\n const mouseY = this.mouse.y + scrollYOffset;\n\n let matchedId: string | null = null;\n let matchedPosition: DropPosition = null;\n let matchedBox: Box | null = null;\n\n // Collect all candidate matches with their canAccept callback.\n const candidates: { id: string; box: Box; position: number; canAccept?: () => boolean }[] =\n [];\n\n for (const [id, { box, canAccept }] of this.zones) {\n const isWithinX = mouseX >= box.left && mouseX <= box.right;\n\n if (!isWithinX) {\n continue;\n }\n\n if (Math.abs(mouseY - box.top) <= threshold) {\n candidates.push({ id, box, position: 0, canAccept });\n }\n\n if (Math.abs(mouseY - box.bottom) <= threshold) {\n candidates.push({ id, box, position: 1, canAccept });\n }\n }\n\n if (candidates.length > 0) {\n // Filter to only eligible candidates.\n const eligible = candidates.filter(c => !c.canAccept || c.canAccept());\n\n if (eligible.length > 0) {\n const uniqueDepths = [...new Set(eligible.map(c => c.box.depth))].sort(\n (a, b) => b - a\n );\n\n if (uniqueDepths.length === 1) {\n const winner = eligible[0];\n matchedId = winner.id;\n matchedPosition = winner.position;\n matchedBox = winner.box;\n } else {\n // Use X position to select depth band among eligible candidates only.\n let rangeLeft = Infinity;\n let rangeRight = -Infinity;\n for (const c of eligible) {\n rangeLeft = Math.min(rangeLeft, c.box.left);\n rangeRight = Math.max(rangeRight, c.box.right);\n }\n\n const centerX = (rangeLeft + rangeRight) / 2;\n const halfWidth = (rangeRight - rangeLeft) / 2;\n\n // 0 at center, 1 at edges.\n const distFromCenter =\n halfWidth > 0 ? Math.abs(mouseX - centerX) / halfWidth : 0;\n\n // Map distance to depth index: center → 0 (deepest), edges → last (shallowest).\n const depthIndex = Math.min(\n Math.floor(distFromCenter * uniqueDepths.length),\n uniqueDepths.length - 1\n );\n\n const winner = eligible.find(c => c.box.depth === uniqueDepths[depthIndex]);\n if (winner) {\n matchedId = winner.id;\n matchedPosition = winner.position;\n matchedBox = winner.box;\n }\n }\n }\n }\n\n if (matchedId !== this.currentTargetId || matchedPosition !== this.currentPosition) {\n this.currentTargetId = matchedId;\n this.currentPosition = matchedPosition;\n this.currentBox = matchedBox;\n\n for (const [id, entry] of this.zones) {\n const isTarget = id === matchedId;\n entry.onProximityChange(\n isTarget ? { box: matchedBox!, position: matchedPosition } : null\n );\n }\n }\n }\n\n private getScrollOffset() {\n const container = document.getElementById(\"preview-container\");\n if (!container) {\n return 0;\n }\n\n return container.scrollTop;\n }\n}\n"],"mappings":"AAgBA,OAAO,MAAMA,eAAe,CAAC;EACjBC,KAAK,GAAG,IAAIC,GAAG,CAAwB,CAAC;EACxCC,eAAe,GAAkB,IAAI;EACrCC,eAAe,GAAiB,IAAI;EACpCC,cAAc,GAAkB,IAAI;EACpCC,UAAU,GAAe,IAAI;EAErCC,WAAWA,CAASC,KAA+B,EAAE;IAAA,KAAjCA,KAA+B,GAA/BA,KAA+B;EAAG;EAEtDC,QAAQA,CAACC,KAAoB,EAAE;IAC3B,IAAIA,KAAK,CAACC,EAAE,KAAK,MAAM,EAAE;MACrB;IACJ;IAEA,IAAI,CAACV,KAAK,CAACW,GAAG,CAACF,KAAK,CAACC,EAAE,EAAED,KAAK,CAAC;EACnC;EAEAG,UAAUA,CAACF,EAAU,EAAE;IACnB,IAAI,CAACV,KAAK,CAACa,MAAM,CAACH,EAAE,CAAC;EACzB;EAEAI,KAAKA,CAAA,EAAG;IACJ,MAAMC,eAAe,GAAGA,CAAA,KAAM;MAC1B,IAAI,CAACC,IAAI,CAAC,CAAC;MACX,IAAI,CAACZ,cAAc,GAAGa,qBAAqB,CAACF,eAAe,CAAC;IAChE,CAAC;IACD,IAAI,CAACX,cAAc,GAAGa,qBAAqB,CAACF,eAAe,CAAC;EAChE;EAEAG,IAAIA,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EW,QAAQ,EAAEZ;QAAgB,CAAC,GAAG,IACjE,CAAC;MACL;IACJ;EACJ;EAEQP,eAAeA,CAAA,EAAG;IACtB,MAAM8C,SAAS,GAAGC,QAAQ,CAACC,cAAc,CAAC,mBAAmB,CAAC;IAC9D,IAAI,CAACF,SAAS,EAAE;MACZ,OAAO,CAAC;IACZ;IAEA,OAAOA,SAAS,CAACG,SAAS;EAC9B;AACJ","ignoreList":[]}
|
|
@@ -1,33 +1,45 @@
|
|
|
1
|
-
import React, { useMemo, useRef } from "react";
|
|
2
|
-
import { OverlayLoader } from "@webiny/admin-ui";
|
|
1
|
+
import React, { useEffect, useMemo, useRef } from "react";
|
|
2
|
+
import { cn, OverlayLoader } from "@webiny/admin-ui";
|
|
3
3
|
import { observer } from "mobx-react-lite";
|
|
4
4
|
import { ElementOverlays } from "./Overlays/ElementOverlays.js";
|
|
5
5
|
import { ConnectEditorToPreview } from "../../../../DocumentEditor/ConnectEditorToPreview.js";
|
|
6
6
|
import { useResponsiveContainer } from "./useResponsiveContainer.js";
|
|
7
7
|
import { usePreviewData } from "../../../hooks/usePreviewData.js";
|
|
8
|
+
import { useSelectFromEditor } from "../../../hooks/useSelectFromEditor.js";
|
|
9
|
+
import { PreviewContainer } from "./PreviewContainer.js";
|
|
8
10
|
export const Iframe = observer(({
|
|
9
11
|
url,
|
|
10
12
|
timestamp,
|
|
11
13
|
...props
|
|
12
14
|
}) => {
|
|
13
15
|
const iframeRef = useRef(null);
|
|
14
|
-
const
|
|
16
|
+
const previewBodyRef = useRef(null);
|
|
17
|
+
const previewWidth = useResponsiveContainer(props.viewportManager);
|
|
15
18
|
const {
|
|
16
19
|
viewport
|
|
17
20
|
} = usePreviewData();
|
|
21
|
+
const editor = useSelectFromEditor(state => ({
|
|
22
|
+
isReadOnly: state.isReadOnly,
|
|
23
|
+
reservedHeight: state.uiReservedSpace.height
|
|
24
|
+
}));
|
|
25
|
+
const isReadOnly = editor.isReadOnly;
|
|
26
|
+
|
|
27
|
+
// When preview width changes, we need to force calculation of the iframe scrollHeight
|
|
28
|
+
// by reducing the height of its parent div to the current viewport height.
|
|
29
|
+
// Otherwise, the iframe grows to fill the parent div, and will not report the correct content height.
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (previewBodyRef.current) {
|
|
32
|
+
const minHeight = `calc(100vh - ${editor.reservedHeight}px)`;
|
|
33
|
+
previewBodyRef.current.style.minHeight = minHeight;
|
|
34
|
+
}
|
|
35
|
+
}, [previewWidth]);
|
|
18
36
|
const iframeUrl = useMemo(() => {
|
|
19
37
|
const localUrl = new URL(url);
|
|
20
38
|
localUrl.searchParams.set("wb.ts", timestamp.toString());
|
|
21
39
|
return localUrl.toString();
|
|
22
40
|
}, [url, timestamp]);
|
|
23
|
-
return /*#__PURE__*/React.createElement(
|
|
24
|
-
id: "preview-container",
|
|
41
|
+
return /*#__PURE__*/React.createElement(PreviewContainer, {
|
|
25
42
|
key: iframeUrl
|
|
26
|
-
/* Height = viewport height - top bar - address bar - breadcrumbs. */,
|
|
27
|
-
style: {
|
|
28
|
-
height: "calc(100vh - 43px - 50px - 31px)"
|
|
29
|
-
},
|
|
30
|
-
className: "relative flex flex-col items-center w-full overflow-auto"
|
|
31
43
|
}, /*#__PURE__*/React.createElement(ConnectEditorToPreview, {
|
|
32
44
|
iframeRef: iframeRef,
|
|
33
45
|
onConnected: props.onConnected
|
|
@@ -38,15 +50,17 @@ export const Iframe = observer(({
|
|
|
38
50
|
className: "bg-neutral-base"
|
|
39
51
|
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
40
52
|
id: "preview-body",
|
|
53
|
+
ref: previewBodyRef,
|
|
54
|
+
className: "outline outline-neutral-dimmed shadow-sm transition-[width,min-height] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)] ",
|
|
41
55
|
style: {
|
|
42
56
|
position: "relative",
|
|
43
|
-
width:
|
|
57
|
+
width: `${previewWidth}px`,
|
|
44
58
|
minHeight: `${viewport.scrollHeight}px`
|
|
45
59
|
}
|
|
46
|
-
}, /*#__PURE__*/React.createElement(ElementOverlays, null), /*#__PURE__*/React.createElement("iframe", {
|
|
60
|
+
}, !isReadOnly ? /*#__PURE__*/React.createElement(ElementOverlays, null) : null, /*#__PURE__*/React.createElement("iframe", {
|
|
47
61
|
scrolling: "no",
|
|
48
62
|
id: "preview-iframe",
|
|
49
|
-
className: "absolute block top-0 left-0 w-full w-h-full bg-white border-none min-h-[inherit] pointer-events-none",
|
|
63
|
+
className: cn("absolute block top-0 left-0 w-full w-h-full bg-white border-none min-h-[inherit]", isReadOnly ? "pointer-events-auto" : "pointer-events-none"),
|
|
50
64
|
src: iframeUrl,
|
|
51
65
|
ref: iframeRef,
|
|
52
66
|
sandbox: "allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","useRef","OverlayLoader","observer","ElementOverlays","ConnectEditorToPreview","useResponsiveContainer","usePreviewData","Iframe","url","timestamp","props","iframeRef","
|
|
1
|
+
{"version":3,"names":["React","useEffect","useMemo","useRef","cn","OverlayLoader","observer","ElementOverlays","ConnectEditorToPreview","useResponsiveContainer","usePreviewData","useSelectFromEditor","PreviewContainer","Iframe","url","timestamp","props","iframeRef","previewBodyRef","previewWidth","viewportManager","viewport","editor","state","isReadOnly","reservedHeight","uiReservedSpace","height","current","minHeight","style","iframeUrl","localUrl","URL","searchParams","set","toString","createElement","key","onConnected","showLoading","size","variant","text","className","id","ref","position","width","scrollHeight","scrolling","src","sandbox","displayName"],"sources":["Iframe.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef } from \"react\";\nimport type { Messenger } from \"@webiny/website-builder-sdk\";\nimport { cn, OverlayLoader } from \"@webiny/admin-ui\";\nimport type { ViewportManager } from \"@webiny/website-builder-sdk\";\nimport { observer } from \"mobx-react-lite\";\nimport { ElementOverlays } from \"./Overlays/ElementOverlays.js\";\nimport { ConnectEditorToPreview } from \"~/DocumentEditor/ConnectEditorToPreview.js\";\nimport { useResponsiveContainer } from \"~/BaseEditor/defaultConfig/Content/Preview/useResponsiveContainer.js\";\nimport { usePreviewData } from \"~/BaseEditor/hooks/usePreviewData.js\";\nimport { useSelectFromEditor } from \"~/BaseEditor/hooks/useSelectFromEditor.js\";\nimport { PreviewContainer } from \"./PreviewContainer.js\";\n\ninterface IframeProps {\n url: string;\n timestamp: number;\n showLoading: boolean;\n viewportManager: ViewportManager;\n onConnected: (messenger: Messenger) => void;\n}\n\nexport const Iframe = observer(({ url, timestamp, ...props }: IframeProps) => {\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const previewBodyRef = useRef<HTMLDivElement>(null);\n const previewWidth = useResponsiveContainer(props.viewportManager);\n const { viewport } = usePreviewData();\n const editor = useSelectFromEditor(state => ({\n isReadOnly: state.isReadOnly,\n reservedHeight: state.uiReservedSpace.height\n }));\n\n const isReadOnly = editor.isReadOnly;\n\n // When preview width changes, we need to force calculation of the iframe scrollHeight\n // by reducing the height of its parent div to the current viewport height.\n // Otherwise, the iframe grows to fill the parent div, and will not report the correct content height.\n useEffect(() => {\n if (previewBodyRef.current) {\n const minHeight = `calc(100vh - ${editor.reservedHeight}px)`;\n previewBodyRef.current.style.minHeight = minHeight;\n }\n }, [previewWidth]);\n\n const iframeUrl = useMemo(() => {\n const localUrl = new URL(url);\n localUrl.searchParams.set(\"wb.ts\", timestamp.toString());\n return localUrl.toString();\n }, [url, timestamp]);\n\n return (\n <PreviewContainer key={iframeUrl}>\n <ConnectEditorToPreview iframeRef={iframeRef} onConnected={props.onConnected} />\n {props.showLoading ? (\n <OverlayLoader\n size=\"lg\"\n variant=\"accent\"\n text=\"Loading preview...\"\n className={\"bg-neutral-base\"}\n />\n ) : null}\n {/* Content wrapper - sized by iframe content */}\n <div\n id={\"preview-body\"}\n ref={previewBodyRef}\n className={\n \"outline outline-neutral-dimmed shadow-sm transition-[width,min-height] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)] \"\n }\n style={{\n position: \"relative\",\n width: `${previewWidth}px`,\n minHeight: `${viewport.scrollHeight}px`\n }}\n >\n {!isReadOnly ? <ElementOverlays /> : null}\n <iframe\n scrolling=\"no\"\n id={\"preview-iframe\"}\n className={cn(\n \"absolute block top-0 left-0 w-full w-h-full bg-white border-none min-h-[inherit]\",\n isReadOnly ? \"pointer-events-auto\" : \"pointer-events-none\"\n )}\n src={iframeUrl}\n ref={iframeRef}\n sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\"\n />\n </div>\n </PreviewContainer>\n );\n});\n\nIframe.displayName = \"Iframe\";\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAEzD,SAASC,EAAE,EAAEC,aAAa,QAAQ,kBAAkB;AAEpD,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,eAAe;AACxB,SAASC,sBAAsB;AAC/B,SAASC,sBAAsB;AAC/B,SAASC,cAAc;AACvB,SAASC,mBAAmB;AAC5B,SAASC,gBAAgB;AAUzB,OAAO,MAAMC,MAAM,GAAGP,QAAQ,CAAC,CAAC;EAAEQ,GAAG;EAAEC,SAAS;EAAE,GAAGC;AAAmB,CAAC,KAAK;EAC1E,MAAMC,SAAS,GAAGd,MAAM,CAAoB,IAAI,CAAC;EACjD,MAAMe,cAAc,GAAGf,MAAM,CAAiB,IAAI,CAAC;EACnD,MAAMgB,YAAY,GAAGV,sBAAsB,CAACO,KAAK,CAACI,eAAe,CAAC;EAClE,MAAM;IAAEC;EAAS,CAAC,GAAGX,cAAc,CAAC,CAAC;EACrC,MAAMY,MAAM,GAAGX,mBAAmB,CAACY,KAAK,KAAK;IACzCC,UAAU,EAAED,KAAK,CAACC,UAAU;IAC5BC,cAAc,EAAEF,KAAK,CAACG,eAAe,CAACC;EAC1C,CAAC,CAAC,CAAC;EAEH,MAAMH,UAAU,GAAGF,MAAM,CAACE,UAAU;;EAEpC;EACA;EACA;EACAvB,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qC,aAAA,CAAC9B,eAAe,MAAE,CAAC,GAAG,IAAI,eACzCP,KAAA,CAAAqC,aAAA;IACIa,SAAS,EAAC,IAAI;IACdL,EAAE,EAAE,gBAAiB;IACrBD,SAAS,EAAExC,EAAE,CACT,kFAAkF,EAClFoB,UAAU,GAAG,qBAAqB,GAAG,qBACzC,CAAE;IACF2B,GAAG,EAAEpB,SAAU;IACfe,GAAG,EAAE7B,SAAU;IACfmC,OAAO,EAAC;EAA0F,CACrG,CACA,CACS,CAAC;AAE3B,CAAC,CAAC;AAEFvC,MAAM,CAACwC,WAAW,GAAG,QAAQ","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect } from "react";
|
|
2
2
|
import { useDocumentEditor } from "../../../../DocumentEditor/index.js";
|
|
3
3
|
import { useKeyHandler } from "../../../hooks/useKeyHandler.js";
|
|
4
|
-
import { $getActiveElementId
|
|
4
|
+
import { $getActiveElementId } from "../../../../editorSdk/utils/index.js";
|
|
5
5
|
import { Commands } from "../../../index.js";
|
|
6
6
|
export const KeyboardShortcuts = () => {
|
|
7
7
|
const editor = useDocumentEditor();
|
|
@@ -12,16 +12,9 @@ export const KeyboardShortcuts = () => {
|
|
|
12
12
|
const deleteActiveElement = useCallback(() => {
|
|
13
13
|
const activeElementId = $getActiveElementId(editor);
|
|
14
14
|
if (activeElementId) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
if (manifest.canDelete !== false) {
|
|
20
|
-
editor.executeCommand(Commands.DeselectElement);
|
|
21
|
-
editor.executeCommand(Commands.DeleteElement, {
|
|
22
|
-
id: activeElementId
|
|
23
|
-
});
|
|
24
|
-
}
|
|
15
|
+
editor.executeCommand(Commands.DeleteElement, {
|
|
16
|
+
id: activeElementId
|
|
17
|
+
});
|
|
25
18
|
}
|
|
26
19
|
}, []);
|
|
27
20
|
const deactivateElement = useCallback(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useEffect","useDocumentEditor","useKeyHandler","$getActiveElementId","
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useDocumentEditor","useKeyHandler","$getActiveElementId","Commands","KeyboardShortcuts","editor","addKeyHandler","removeKeyHandler","deleteActiveElement","activeElementId","executeCommand","DeleteElement","id","deactivateElement","DeselectElement","e","preventDefault","undo","redo"],"sources":["KeyboardShortcuts.tsx"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\nimport { useDocumentEditor } from \"~/DocumentEditor/index.js\";\nimport { useKeyHandler } from \"~/BaseEditor/hooks/useKeyHandler.js\";\nimport { $getActiveElementId } from \"~/editorSdk/utils/index.js\";\nimport { Commands } from \"~/BaseEditor/index.js\";\n\nexport const KeyboardShortcuts = () => {\n const editor = useDocumentEditor();\n const { addKeyHandler, removeKeyHandler } = useKeyHandler();\n\n const deleteActiveElement = useCallback(() => {\n const activeElementId = $getActiveElementId(editor);\n if (activeElementId) {\n editor.executeCommand(Commands.DeleteElement, { id: activeElementId });\n }\n }, []);\n\n const deactivateElement = useCallback(() => {\n editor.executeCommand(Commands.DeselectElement);\n }, []);\n\n useEffect(() => {\n addKeyHandler(\"Escape\", e => {\n e.preventDefault();\n deactivateElement();\n });\n\n addKeyHandler(\"Backspace\", e => {\n e.preventDefault();\n deleteActiveElement();\n });\n\n addKeyHandler(\"Delete\", e => {\n e.preventDefault();\n deleteActiveElement();\n });\n\n addKeyHandler(\"mod+z\", e => {\n e.preventDefault();\n editor.undo();\n });\n\n addKeyHandler(\"mod+shift+z\", e => {\n e.preventDefault();\n editor.redo();\n });\n\n return () => {\n removeKeyHandler(\"Escape\");\n removeKeyHandler(\"Backspace\");\n removeKeyHandler(\"Delete\");\n removeKeyHandler(\"mod+z\");\n removeKeyHandler(\"mod+shift+z\");\n };\n }, []);\n\n return null;\n};\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,QAAQ,OAAO;AAC9C,SAASC,iBAAiB;AAC1B,SAASC,a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AClBX,MAAM,CAACa,IAAI,CAAC,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO,MAAM;MACTX,gBAAgB,CAAC,QAAQ,CAAC;MAC1BA,gBAAgB,CAAC,WAAW,CAAC;MAC7BA,gBAAgB,CAAC,QAAQ,CAAC;MAC1BA,gBAAgB,CAAC,OAAO,CAAC;MACzBA,gBAAgB,CAAC,aAAa,CAAC;IACnC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
|
|
@@ -5,5 +5,5 @@ interface ElementDropZonesProps {
|
|
|
5
5
|
previewBox: Box;
|
|
6
6
|
isFirst: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare const ElementDropLines: ({ editorBox, previewBox, isFirst }: ElementDropZonesProps) => React.JSX.Element
|
|
8
|
+
export declare const ElementDropLines: ({ editorBox, previewBox, isFirst }: ElementDropZonesProps) => React.JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from "react";
|
|
1
|
+
import React, { useCallback, useMemo, useRef } from "react";
|
|
2
2
|
import { useDragLayer } from "react-dnd";
|
|
3
3
|
import { DropLine } from "./DropLine.js";
|
|
4
4
|
import { useIsDragging } from "../useIsDragging.js";
|
|
@@ -6,6 +6,7 @@ import { useProximityDropzone } from "../useProximityDropzone.js";
|
|
|
6
6
|
import { useElementComponentManifest } from "../useElementComponentManifest.js";
|
|
7
7
|
import { ComponentManifestToAstConverter } from "@webiny/website-builder-sdk";
|
|
8
8
|
import { findMatchingAstNode } from "@webiny/website-builder-sdk";
|
|
9
|
+
import { DevToolsSection } from "@webiny/app-admin";
|
|
9
10
|
export const ElementDropLines = ({
|
|
10
11
|
editorBox,
|
|
11
12
|
previewBox,
|
|
@@ -14,11 +15,41 @@ export const ElementDropLines = ({
|
|
|
14
15
|
const componentManifest = useElementComponentManifest(previewBox.parentId);
|
|
15
16
|
const draggingItem = useDragLayer(monitor => monitor.getItem());
|
|
16
17
|
const isDragging = draggingItem && draggingItem.id === previewBox.id;
|
|
18
|
+
|
|
19
|
+
// Keep a ref so the canAccept callback always sees the latest dragging item
|
|
20
|
+
// without causing re-registrations.
|
|
21
|
+
const draggingItemRef = useRef(draggingItem);
|
|
22
|
+
draggingItemRef.current = draggingItem;
|
|
23
|
+
const componentManifestRef = useRef(componentManifest);
|
|
24
|
+
componentManifestRef.current = componentManifest;
|
|
25
|
+
const canAccept = useCallback(() => {
|
|
26
|
+
const item = draggingItemRef.current;
|
|
27
|
+
|
|
28
|
+
// If nothing is being dragged, don't filter out candidates.
|
|
29
|
+
if (!item) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
const manifest = componentManifestRef.current;
|
|
33
|
+
const inputsAst = ComponentManifestToAstConverter.convert(manifest?.inputs ?? []);
|
|
34
|
+
const targetNode = findMatchingAstNode(editorBox.parentSlot, inputsAst);
|
|
35
|
+
if (!targetNode) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
if (targetNode.type === "slot") {
|
|
39
|
+
const slotInput = targetNode.input;
|
|
40
|
+
const whitelistedComponents = slotInput.components;
|
|
41
|
+
if (whitelistedComponents && whitelistedComponents.length > 0) {
|
|
42
|
+
return whitelistedComponents.includes(item.componentName);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}, [editorBox.parentSlot]);
|
|
17
47
|
const {
|
|
18
48
|
proximity
|
|
19
49
|
} = useProximityDropzone({
|
|
20
50
|
id: previewBox.id,
|
|
21
|
-
box: editorBox
|
|
51
|
+
box: editorBox,
|
|
52
|
+
canAccept
|
|
22
53
|
});
|
|
23
54
|
const anyElementDragged = useIsDragging();
|
|
24
55
|
const hoverBefore = proximity?.position === 0;
|
|
@@ -41,7 +72,16 @@ export const ElementDropLines = ({
|
|
|
41
72
|
canAcceptComponent = whitelistedComponents.includes(draggingItem?.componentName);
|
|
42
73
|
}
|
|
43
74
|
}
|
|
44
|
-
return
|
|
75
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DevToolsSection, {
|
|
76
|
+
name: "draggingElement",
|
|
77
|
+
group: "Editor",
|
|
78
|
+
views: "raw",
|
|
79
|
+
data: {
|
|
80
|
+
proximity,
|
|
81
|
+
canAcceptComponent,
|
|
82
|
+
targetInputNode
|
|
83
|
+
}
|
|
84
|
+
}), anyElementDragged ? /*#__PURE__*/React.createElement(React.Fragment, null, !isDragging && isFirst && /*#__PURE__*/React.createElement(DropLine, {
|
|
45
85
|
label: elementLabel,
|
|
46
86
|
top: previewBox.top,
|
|
47
87
|
left: previewBox.left,
|
|
@@ -55,7 +95,7 @@ export const ElementDropLines = ({
|
|
|
55
95
|
width: previewBox.width,
|
|
56
96
|
visible: hoverAfter && canAcceptComponent,
|
|
57
97
|
dimmed: false
|
|
58
|
-
})) : null;
|
|
98
|
+
})) : null);
|
|
59
99
|
};
|
|
60
100
|
|
|
61
101
|
//# sourceMappingURL=ElementDropLines.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","useDragLayer","DropLine","useIsDragging","useProximityDropzone","useElementComponentManifest","ComponentManifestToAstConverter","findMatchingAstNode","ElementDropLines","editorBox","previewBox","isFirst","componentManifest","parentId","draggingItem","monitor","getItem","isDragging","id","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","useRef","useDragLayer","DropLine","useIsDragging","useProximityDropzone","useElementComponentManifest","ComponentManifestToAstConverter","findMatchingAstNode","DevToolsSection","ElementDropLines","editorBox","previewBox","isFirst","componentManifest","parentId","draggingItem","monitor","getItem","isDragging","id","draggingItemRef","current","componentManifestRef","canAccept","item","manifest","inputsAst","convert","inputs","targetNode","parentSlot","type","slotInput","input","whitelistedComponents","components","length","includes","componentName","proximity","box","anyElementDragged","hoverBefore","position","hoverAfter","elementLabel","label","name","targetInputNode","undefined","canAcceptComponent","createElement","Fragment","group","views","data","top","left","width","visible","dimmed","bottom"],"sources":["ElementDropLines.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useRef } from \"react\";\nimport { useDragLayer } from \"react-dnd\";\nimport { DropLine } from \"./DropLine.js\";\nimport { useIsDragging } from \"../useIsDragging.js\";\nimport { useProximityDropzone } from \"../useProximityDropzone.js\";\nimport type { Box } from \"../Box.js\";\nimport { useElementComponentManifest } from \"~/BaseEditor/defaultConfig/Content/Preview/useElementComponentManifest.js\";\nimport { ComponentManifestToAstConverter } from \"@webiny/website-builder-sdk\";\nimport { findMatchingAstNode } from \"@webiny/website-builder-sdk\";\nimport type { SlotInput } from \"@webiny/website-builder-sdk\";\nimport { DevToolsSection } from \"@webiny/app-admin\";\n\ninterface ElementDropZonesProps {\n editorBox: Box;\n previewBox: Box;\n isFirst: boolean;\n}\n\nexport const ElementDropLines = ({ editorBox, previewBox, isFirst }: ElementDropZonesProps) => {\n const componentManifest = useElementComponentManifest(previewBox.parentId);\n const draggingItem = useDragLayer(monitor => monitor.getItem());\n const isDragging = draggingItem && draggingItem.id === previewBox.id;\n\n // Keep a ref so the canAccept callback always sees the latest dragging item\n // without causing re-registrations.\n const draggingItemRef = useRef(draggingItem);\n draggingItemRef.current = draggingItem;\n const componentManifestRef = useRef(componentManifest);\n componentManifestRef.current = componentManifest;\n\n const canAccept = useCallback(() => {\n const item = draggingItemRef.current;\n\n // If nothing is being dragged, don't filter out candidates.\n if (!item) {\n return true;\n }\n\n const manifest = componentManifestRef.current;\n const inputsAst = ComponentManifestToAstConverter.convert(manifest?.inputs ?? []);\n const targetNode = findMatchingAstNode(editorBox.parentSlot, inputsAst);\n\n if (!targetNode) {\n return false;\n }\n\n if (targetNode.type === \"slot\") {\n const slotInput = targetNode.input as SlotInput;\n const whitelistedComponents = slotInput.components;\n if (whitelistedComponents && whitelistedComponents.length > 0) {\n return whitelistedComponents.includes(item.componentName);\n }\n }\n\n return true;\n }, [editorBox.parentSlot]);\n\n const { proximity } = useProximityDropzone({\n id: previewBox.id,\n box: editorBox,\n canAccept\n });\n\n const anyElementDragged = useIsDragging();\n const hoverBefore = proximity?.position === 0;\n const hoverAfter = proximity?.position === 1;\n const elementLabel = componentManifest?.label ?? componentManifest?.name ?? \"\";\n\n const targetInputNode = useMemo(() => {\n if (!proximity?.box.parentSlot) {\n return undefined;\n }\n\n const inputsAst = ComponentManifestToAstConverter.convert(componentManifest?.inputs ?? []);\n return findMatchingAstNode(proximity?.box.parentSlot, inputsAst);\n }, [proximity?.box.parentSlot]);\n\n // Figure out if we are allowed to drop the current item into the dropzone.\n let canAcceptComponent = !!targetInputNode;\n if (draggingItem && targetInputNode && targetInputNode.type === \"slot\") {\n const slotInput = targetInputNode.input as SlotInput;\n const whitelistedComponents = slotInput.components;\n if (whitelistedComponents && whitelistedComponents.length > 0) {\n canAcceptComponent = whitelistedComponents.includes(draggingItem?.componentName);\n }\n }\n\n return (\n <>\n <DevToolsSection\n name={\"draggingElement\"}\n group={\"Editor\"}\n views={\"raw\"}\n data={{\n proximity,\n canAcceptComponent,\n targetInputNode\n }}\n />\n {anyElementDragged ? (\n <>\n {!isDragging && isFirst && (\n <DropLine\n label={elementLabel}\n top={previewBox.top}\n left={previewBox.left}\n width={previewBox.width}\n visible={hoverBefore && canAcceptComponent}\n dimmed={false}\n />\n )}\n {!isDragging && (\n <DropLine\n label={elementLabel}\n top={previewBox.bottom - 2}\n left={previewBox.left}\n width={previewBox.width}\n visible={hoverAfter && canAcceptComponent}\n dimmed={false}\n />\n )}\n </>\n ) : null}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC3D,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,QAAQ;AACjB,SAASC,aAAa;AACtB,SAASC,oBAAoB;AAE7B,SAASC,2BAA2B;AACpC,SAASC,+BAA+B,QAAQ,6BAA6B;AAC7E,SAASC,mBAAmB,QAAQ,6BAA6B;AAEjE,SAASC,eAAe,QAAQ,mBA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,QAAQ,CAACtB,YAAY,EAAEuB,aAAa,CAAC;IACpF;EACJ;EAEA,oBACIzC,KAAA,CAAAsD,aAAA,CAAAtD,KAAA,CAAAuD,QAAA,qBACIvD,KAAA,CAAAsD,aAAA,CAAC3C,eAAe;IACZuC,IAAI,EAAE,iBAAkB;IACxBM,KAAK,EAAE,QAAS;IAChBC,KAAK,EAAE,KAAM;IACbC,IAAI,EAAE;MACFhB,SAAS;MACTW,kBAAkB;MAClBF;IACJ;EAAE,CACL,CAAC,EACDP,iBAAiB,gBACd5C,KAAA,CAAAsD,aAAA,CAAAtD,KAAA,CAAAuD,QAAA,QACK,CAAClC,UAAU,IAAIN,OAAO,iBACnBf,KAAA,CAAAsD,aAAA,CAACjD,QAAQ;IACL4C,KAAK,EAAED,YAAa;IACpBW,GAAG,EAAE7C,UAAU,CAAC6C,GAAI;IACpBC,IAAI,EAAE9C,UAAU,CAAC8C,IAAK;IACtBC,KAAK,EAAE/C,UAAU,CAAC+C,KAAM;IACxBC,OAAO,EAAEjB,WAAW,IAAIQ,kBAAmB;IAC3CU,MAAM,EAAE;EAAM,CACjB,CACJ,EACA,CAAC1C,UAAU,iBACRrB,KAAA,CAAAsD,aAAA,CAACjD,QAAQ;IACL4C,KAAK,EAAED,YAAa;IACpBW,GAAG,EAAE7C,UAAU,CAACkD,MAAM,GAAG,CAAE;IAC3BJ,IAAI,EAAE9C,UAAU,CAAC8C,IAAK;IACtBC,KAAK,EAAE/C,UAAU,CAAC+C,KAAM;IACxBC,OAAO,EAAEf,UAAU,IAAIM,kBAAmB;IAC1CU,MAAM,EAAE;EAAM,CACjB,CAEP,CAAC,GACH,IACN,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
interface ElementOverlayProps {
|
|
4
|
-
elementId: string;
|
|
5
|
-
isSelected: boolean;
|
|
6
|
-
isHighlighted: boolean;
|
|
7
|
-
previewBox: Box;
|
|
8
|
-
editorBox: Box;
|
|
9
|
-
}
|
|
10
|
-
export declare const ElementOverlay: React.MemoExoticComponent<({ previewBox, elementId, isSelected, isHighlighted }: ElementOverlayProps) => React.JSX.Element | null>;
|
|
11
|
-
export {};
|
|
2
|
+
export declare const ElementOverlay: React.MemoExoticComponent<() => React.JSX.Element | null>;
|
|
@@ -4,16 +4,17 @@ import { useDocumentEditor } from "../../../../../DocumentEditor/index.js";
|
|
|
4
4
|
import { $highlightElement, $selectElement } from "../../../../../editorSdk/utils/index.js";
|
|
5
5
|
import { Draggable } from "../../../../components/Draggable.js";
|
|
6
6
|
import { useIsDragging } from "../useIsDragging.js";
|
|
7
|
-
import { useElementComponentManifest } from "../useElementComponentManifest.js";
|
|
8
7
|
import { useStyles } from "../../../Sidebar/StyleSettings/useStyles.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
elementId,
|
|
12
|
-
isSelected,
|
|
13
|
-
isHighlighted
|
|
14
|
-
}) => {
|
|
8
|
+
import { useElementOverlay } from "./ElementOverlayProvider.js";
|
|
9
|
+
export const ElementOverlay = /*#__PURE__*/React.memo(() => {
|
|
15
10
|
const editor = useDocumentEditor();
|
|
16
|
-
const
|
|
11
|
+
const {
|
|
12
|
+
elementId,
|
|
13
|
+
isSelected,
|
|
14
|
+
isHighlighted,
|
|
15
|
+
componentManifest,
|
|
16
|
+
box: previewBox
|
|
17
|
+
} = useElementOverlay();
|
|
17
18
|
const onClick = useCallback(event => {
|
|
18
19
|
event.stopPropagation();
|
|
19
20
|
$selectElement(editor, elementId);
|
|
@@ -23,6 +24,10 @@ export const ElementOverlay = /*#__PURE__*/React.memo(({
|
|
|
23
24
|
$highlightElement(editor, elementId);
|
|
24
25
|
}, []);
|
|
25
26
|
const unsetHighlighted = useCallback(event => {
|
|
27
|
+
const relatedTarget = event.relatedTarget;
|
|
28
|
+
if (relatedTarget && typeof relatedTarget.closest === "function" && relatedTarget.closest('[data-role="element-overlay"]')) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
26
31
|
event.stopPropagation();
|
|
27
32
|
$highlightElement(editor, null);
|
|
28
33
|
}, []);
|