@webiny/app-website-builder 6.6.0-alpha.0 → 6.6.0-alpha.2
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/CloneElement.d.ts +1 -0
- package/BaseEditor/commandHandlers/CloneElement.js +17 -0
- package/BaseEditor/commandHandlers/CloneElement.js.map +1 -0
- package/BaseEditor/commandHandlers/index.js +2 -1
- package/BaseEditor/commandHandlers/index.js.map +1 -1
- package/BaseEditor/commands.d.ts +3 -0
- package/BaseEditor/commands.js +2 -0
- package/BaseEditor/commands.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/AddressBar/usePreviewLink.js +4 -1
- package/BaseEditor/defaultConfig/Content/AddressBar/usePreviewLink.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/DropZoneManager.js.map +1 -1
- package/BaseEditor/defaultConfig/Content/Preview/Iframe.d.ts +2 -2
- package/BaseEditor/defaultConfig/Content/Preview/Overlays/ElementOverlays.d.ts +2 -2
- package/BaseEditor/defaultConfig/DefaultEditorConfig.js +9 -0
- package/BaseEditor/defaultConfig/DefaultEditorConfig.js.map +1 -1
- package/BaseEditor/defaultConfig/DocumentStateEditor/DocumentStateEditor.d.ts +2 -2
- package/BaseEditor/defaultConfig/ElementInputRenderers.js +4 -0
- package/BaseEditor/defaultConfig/ElementInputRenderers.js.map +1 -1
- package/BaseEditor/defaultConfig/Sidebar/ElementActions/CloneElementAction.d.ts +2 -0
- package/BaseEditor/defaultConfig/Sidebar/ElementActions/CloneElementAction.js +25 -0
- package/BaseEditor/defaultConfig/Sidebar/ElementActions/CloneElementAction.js.map +1 -0
- package/BaseEditor/defaultConfig/Sidebar/ElementActions/DeleteElementAction.d.ts +2 -0
- package/BaseEditor/defaultConfig/Sidebar/ElementActions/DeleteElementAction.js +26 -0
- package/BaseEditor/defaultConfig/Sidebar/ElementActions/DeleteElementAction.js.map +1 -0
- package/BaseEditor/defaultConfig/Sidebar/ElementPreview.js +12 -2
- package/BaseEditor/defaultConfig/Sidebar/ElementPreview.js.map +1 -1
- package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.js +1 -6
- package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.js.map +1 -1
- package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementSettings.js +11 -2
- package/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementSettings.js.map +1 -1
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundColor.d.ts +6 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundImage.d.ts +6 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundPosition.d.ts +6 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundScaling.d.ts +6 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Border/BorderColor.d.ts +2 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Border/BorderRadius.d.ts +2 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Border/BorderStyle.d.ts +2 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Border/BorderWidth.d.ts +2 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Layout/Alignment.d.ts +6 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Layout/LengthWithUnitInput.d.ts +2 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/MarginPadding/Margin.d.ts +2 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/MarginPadding/Padding.d.ts +2 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Visibility/Visibility.d.ts +2 -2
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/StyleProperties.js +7 -7
- package/BaseEditor/defaultConfig/Sidebar/StyleSettings/StyleProperties.js.map +1 -1
- package/BaseEditor/defaultConfig/Toolbar/Navigator/Navigator.d.ts +2 -2
- package/DocumentEditor/DocumentEditor.d.ts +14 -5
- package/DocumentEditor/DocumentEditor.js +10 -6
- package/DocumentEditor/DocumentEditor.js.map +1 -1
- package/DocumentEditor/StateInspector.d.ts +4 -2
- package/Extension.js +7 -1
- package/Extension.js.map +1 -1
- package/ecommerce/components/ResourcePage.d.ts +6 -2
- package/ecommerce/components/ResourcesList.d.ts +4 -4
- package/ecommerce/components/ResourcesPicker.d.ts +9 -4
- package/editorSdk/CommandBus.js.map +1 -1
- package/editorSdk/utils/$cloneElement.d.ts +2 -0
- package/editorSdk/utils/$cloneElement.js +112 -0
- package/editorSdk/utils/$cloneElement.js.map +1 -0
- package/editorSdk/utils/index.d.ts +1 -0
- package/editorSdk/utils/index.js +1 -0
- package/features/experiments/ExperimentsGateway.d.ts +30 -0
- package/features/experiments/ExperimentsGateway.js +326 -0
- package/features/experiments/ExperimentsGateway.js.map +1 -0
- package/features/experiments/abstractions.d.ts +25 -0
- package/features/experiments/abstractions.js +5 -0
- package/features/experiments/abstractions.js.map +1 -0
- package/features/experiments/feature.d.ts +3 -0
- package/features/experiments/feature.js +17 -0
- package/features/experiments/feature.js.map +1 -0
- package/features/experiments/index.d.ts +3 -0
- package/features/experiments/index.js +2 -0
- package/features/experiments/types.d.ts +61 -0
- package/features/experiments/types.js +0 -0
- package/inputRenderers/ColorPickerInput.d.ts +3 -0
- package/inputRenderers/ColorPickerInput.js +29 -0
- package/inputRenderers/ColorPickerInput.js.map +1 -0
- package/inputRenderers/FileInput.js +93 -8
- package/inputRenderers/FileInput.js.map +1 -1
- package/inputRenderers/LexicalInput/LexicalEditor.js +15 -8
- package/inputRenderers/LexicalInput/LexicalEditor.js.map +1 -1
- package/inputRenderers/LexicalInput/TypographyDropDown.js +3 -2
- package/inputRenderers/LexicalInput/TypographyDropDown.js.map +1 -1
- package/inputRenderers/LexicalInput/wbStaticToolbar.css +72 -103
- package/modules/AbTesting.d.ts +2 -0
- package/modules/AbTesting.js +19 -0
- package/modules/AbTesting.js.map +1 -0
- package/package.json +28 -28
- package/presentation/components/LanguageCodeTag.js +5 -4
- package/presentation/components/LanguageCodeTag.js.map +1 -1
- package/presentation/experiments/ExperimentForm/ExperimentFormPresenter.d.ts +30 -0
- package/presentation/experiments/ExperimentForm/ExperimentFormPresenter.js +202 -0
- package/presentation/experiments/ExperimentForm/ExperimentFormPresenter.js.map +1 -0
- package/presentation/experiments/ExperimentForm/abstractions/ExperimentFormPresenter.d.ts +65 -0
- package/presentation/experiments/ExperimentForm/abstractions/ExperimentFormPresenter.js +5 -0
- package/presentation/experiments/ExperimentForm/abstractions/ExperimentFormPresenter.js.map +1 -0
- package/presentation/experiments/ExperimentForm/components/ExperimentFormView.d.ts +12 -0
- package/presentation/experiments/ExperimentForm/components/ExperimentFormView.js +149 -0
- package/presentation/experiments/ExperimentForm/components/ExperimentFormView.js.map +1 -0
- package/presentation/experiments/ExperimentForm/components/VariantSplitRow.d.ts +17 -0
- package/presentation/experiments/ExperimentForm/components/VariantSplitRow.js +122 -0
- package/presentation/experiments/ExperimentForm/components/VariantSplitRow.js.map +1 -0
- package/presentation/experiments/ExperimentForm/feature.d.ts +3 -0
- package/presentation/experiments/ExperimentForm/feature.js +17 -0
- package/presentation/experiments/ExperimentForm/feature.js.map +1 -0
- package/presentation/experiments/ExperimentForm/index.d.ts +3 -0
- package/presentation/experiments/ExperimentForm/index.js +3 -0
- package/presentation/experiments/ExperimentsEditor/ExperimentsEditorDataSource.d.ts +18 -0
- package/presentation/experiments/ExperimentsEditor/ExperimentsEditorDataSource.js +25 -0
- package/presentation/experiments/ExperimentsEditor/ExperimentsEditorDataSource.js.map +1 -0
- package/presentation/experiments/ExperimentsEditor/ExperimentsEditorPresenter.d.ts +67 -0
- package/presentation/experiments/ExperimentsEditor/ExperimentsEditorPresenter.js +224 -0
- package/presentation/experiments/ExperimentsEditor/ExperimentsEditorPresenter.js.map +1 -0
- package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorDataSource.d.ts +10 -0
- package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorDataSource.js +5 -0
- package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorDataSource.js.map +1 -0
- package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorPresenter.d.ts +58 -0
- package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorPresenter.js +5 -0
- package/presentation/experiments/ExperimentsEditor/abstractions/ExperimentsEditorPresenter.js.map +1 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentIndicator.d.ts +15 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentIndicator.js +110 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentIndicator.js.map +1 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentPreviewToolbar.d.ts +9 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentPreviewToolbar.js +178 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentPreviewToolbar.js.map +1 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentsButton.d.ts +11 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentsButton.js +51 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentsButton.js.map +1 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentsSwitcher.d.ts +14 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentsSwitcher.js +147 -0
- package/presentation/experiments/ExperimentsEditor/components/ExperimentsSwitcher.js.map +1 -0
- package/presentation/experiments/ExperimentsEditor/feature.d.ts +3 -0
- package/presentation/experiments/ExperimentsEditor/feature.js +21 -0
- package/presentation/experiments/ExperimentsEditor/feature.js.map +1 -0
- package/presentation/experiments/ExperimentsEditor/index.d.ts +4 -0
- package/presentation/experiments/ExperimentsEditor/index.js +3 -0
- package/presentation/experiments/ExperimentsManager/ExperimentsManagerPresenter.d.ts +39 -0
- package/presentation/experiments/ExperimentsManager/ExperimentsManagerPresenter.js +219 -0
- package/presentation/experiments/ExperimentsManager/ExperimentsManagerPresenter.js.map +1 -0
- package/presentation/experiments/ExperimentsManager/abstractions/ExperimentsManagerPresenter.d.ts +52 -0
- package/presentation/experiments/ExperimentsManager/abstractions/ExperimentsManagerPresenter.js +5 -0
- package/presentation/experiments/ExperimentsManager/abstractions/ExperimentsManagerPresenter.js.map +1 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentCard.d.ts +10 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentCard.js +296 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentCard.js.map +1 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentsDrawerView.d.ts +2 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentsDrawerView.js +92 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentsDrawerView.js.map +1 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentsEmptyState.d.ts +6 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentsEmptyState.js +103 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentsEmptyState.js.map +1 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentsListView.d.ts +9 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentsListView.js +58 -0
- package/presentation/experiments/ExperimentsManager/components/ExperimentsListView.js.map +1 -0
- package/presentation/experiments/ExperimentsManager/feature.d.ts +3 -0
- package/presentation/experiments/ExperimentsManager/feature.js +17 -0
- package/presentation/experiments/ExperimentsManager/feature.js.map +1 -0
- package/presentation/experiments/ExperimentsManager/index.d.ts +4 -0
- package/presentation/experiments/ExperimentsManager/index.js +3 -0
- package/presentation/experiments/VariantPageEditorConfig.d.ts +7 -0
- package/presentation/experiments/VariantPageEditorConfig.js +26 -0
- package/presentation/experiments/VariantPageEditorConfig.js.map +1 -0
- package/presentation/experiments/config/ExperimentsEditorConfig.d.ts +8 -0
- package/presentation/experiments/config/ExperimentsEditorConfig.js +21 -0
- package/presentation/experiments/config/ExperimentsEditorConfig.js.map +1 -0
- package/presentation/experiments/config/VariantAutoSave.d.ts +5 -0
- package/presentation/experiments/config/VariantAutoSave.js +41 -0
- package/presentation/experiments/config/VariantAutoSave.js.map +1 -0
- package/presentation/experiments/shared/variantColors.d.ts +11 -0
- package/presentation/experiments/shared/variantColors.js +13 -0
- package/presentation/experiments/shared/variantColors.js.map +1 -0
- package/presentation/experiments/shared/variantDocument.d.ts +16 -0
- package/presentation/experiments/shared/variantDocument.js +31 -0
- package/presentation/experiments/shared/variantDocument.js.map +1 -0
- package/presentation/navigation/Extension.js +9 -5
- package/presentation/navigation/Extension.js.map +1 -1
- package/presentation/navigation/NextjsConfig/NextjsConfigDialog.d.ts +2 -2
- package/presentation/navigation/StarterKitConfigDialog.js +1 -1
- package/presentation/navigation/StarterKitConfigDialog.js.map +1 -1
- package/presentation/pages/CreatePage/CreatePageDialog.d.ts +2 -2
- package/presentation/pages/CreatePage/CreatePagePresenter.js +1 -1
- package/presentation/pages/CreatePage/CreatePagePresenter.js.map +1 -1
- package/presentation/pages/CreatePage/WithLanguageSelector.js +3 -3
- package/presentation/pages/CreatePage/WithLanguageSelector.js.map +1 -1
- package/presentation/pages/CreatePage/feature.js +3 -3
- package/presentation/pages/CreatePage/feature.js.map +1 -1
- package/presentation/pages/PageEditor/PageEditor.experiments.d.ts +2 -0
- package/presentation/pages/PageEditor/PageEditor.experiments.js +54 -0
- package/presentation/pages/PageEditor/PageEditor.experiments.js.map +1 -0
- package/presentation/pages/PageEditor/PageEditorSurface.d.ts +15 -0
- package/presentation/pages/PageEditor/PageEditorSurface.js +63 -0
- package/presentation/pages/PageEditor/PageEditorSurface.js.map +1 -0
- package/presentation/pages/PageEditor/TopBar/PageSettingsDrawer.d.ts +2 -2
- package/presentation/pages/PageEditor/pageDocument.d.ts +4 -0
- package/presentation/pages/PageEditor/pageDocument.js +15 -0
- package/presentation/pages/PageEditor/pageDocument.js.map +1 -0
- package/presentation/pages/PageList/components/BulkActions/BulkActionDelete.d.ts +2 -2
- package/presentation/pages/PageList/components/BulkActions/BulkActionDuplicate.d.ts +2 -2
- package/presentation/pages/PageList/components/BulkActions/BulkActionMovePage.d.ts +2 -2
- package/presentation/pages/PageList/components/BulkActions/BulkActionPublish.d.ts +2 -2
- package/presentation/pages/PageList/components/BulkActions/BulkActionUnpublish.d.ts +2 -2
- package/presentation/pages/PageList/components/DocumentList.d.ts +2 -2
- package/presentation/pages/PageList/components/PagesList.js +2 -1
- package/presentation/pages/PageList/components/PagesList.js.map +1 -1
- package/presentation/pages/PageList/components/Table/Table.d.ts +2 -2
- package/presentation/pages/PageList/components/WbPagesBreadcrumbs.d.ts +9 -0
- package/presentation/pages/PageList/components/WbPagesBreadcrumbs.js +40 -0
- package/presentation/pages/PageList/components/WbPagesBreadcrumbs.js.map +1 -0
- package/presentation/pages/TranslatePage/TranslatePageConfig.d.ts +1 -1
- package/presentation/pages/TranslatePage/TranslatePageConfig.js +6 -2
- package/presentation/pages/TranslatePage/TranslatePageConfig.js.map +1 -1
- package/presentation/pages/TranslatePage/TranslatePageDialog.js +22 -10
- package/presentation/pages/TranslatePage/TranslatePageDialog.js.map +1 -1
- package/presentation/pages/TranslatePage/translatePageSchema.d.ts +1 -1
- package/presentation/pages/TranslatePage/translatePageSchema.js +1 -1
- package/presentation/pages/TranslatePage/translatePageSchema.js.map +1 -1
- package/presentation/pages/TrashBin/WbTrashBin.d.ts +2 -2
- package/presentation/redirects/RedirectList/components/BulkActionDelete.d.ts +2 -2
- package/presentation/redirects/RedirectList/components/BulkActionMove.d.ts +2 -2
- package/presentation/redirects/RedirectList/components/CreateRedirectDialog.d.ts +2 -2
- package/presentation/redirects/RedirectList/components/DocumentList.d.ts +2 -2
- package/presentation/redirects/RedirectList/components/EditRedirectDialog.d.ts +2 -2
- package/presentation/redirects/RedirectList/components/Table/Table.d.ts +2 -2
- package/shared/fileManagerItemToValue.d.ts +8 -9
- package/shared/fileManagerItemToValue.js +22 -7
- package/shared/fileManagerItemToValue.js.map +1 -1
- package/inputRenderers/LexicalInput/icons/list-ol.js +0 -20
- package/inputRenderers/LexicalInput/icons/list-ol.js.map +0 -1
- package/inputRenderers/LexicalInput/icons/list-ol.svg +0 -1
- package/inputRenderers/LexicalInput/icons/list-ul.js +0 -18
- package/inputRenderers/LexicalInput/icons/list-ul.js.map +0 -1
- package/inputRenderers/LexicalInput/icons/list-ul.svg +0 -1
- package/static/svg/list-ol.d64946f3.svg +0 -1
- package/static/svg/list-ul.1d54da3f.svg +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CloneElement: () => null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useDocumentEditor } from "../../DocumentEditor/index.js";
|
|
3
|
+
import { Commands } from "../index.js";
|
|
4
|
+
import { $cloneElement } from "../../editorSdk/utils/index.js";
|
|
5
|
+
const CloneElement = ()=>{
|
|
6
|
+
const editor = useDocumentEditor();
|
|
7
|
+
useEffect(()=>editor.registerCommandHandler(Commands.CloneElement, (payload)=>{
|
|
8
|
+
const newId = $cloneElement(editor, payload.id);
|
|
9
|
+
if (newId) editor.executeCommand(Commands.SelectElement, {
|
|
10
|
+
id: newId
|
|
11
|
+
});
|
|
12
|
+
}), []);
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
export { CloneElement };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=CloneElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseEditor/commandHandlers/CloneElement.js","sources":["../../../src/BaseEditor/commandHandlers/CloneElement.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useDocumentEditor } from \"~/DocumentEditor/index.js\";\nimport { Commands } from \"~/BaseEditor/index.js\";\nimport { $cloneElement } from \"~/editorSdk/utils/index.js\";\n\nexport const CloneElement = () => {\n const editor = useDocumentEditor();\n\n useEffect(() => {\n return editor.registerCommandHandler(Commands.CloneElement, payload => {\n const newId = $cloneElement(editor, payload.id);\n if (newId) {\n editor.executeCommand(Commands.SelectElement, { id: newId });\n }\n });\n }, []);\n\n return null;\n};\n"],"names":["CloneElement","editor","useDocumentEditor","useEffect","Commands","payload","newId","$cloneElement"],"mappings":";;;;AAKO,MAAMA,eAAe;IACxB,MAAMC,SAASC;IAEfC,UAAU,IACCF,OAAO,sBAAsB,CAACG,SAAS,YAAY,EAAEC,CAAAA;YACxD,MAAMC,QAAQC,cAAcN,QAAQI,QAAQ,EAAE;YAC9C,IAAIC,OACAL,OAAO,cAAc,CAACG,SAAS,aAAa,EAAE;gBAAE,IAAIE;YAAM;QAElE,IACD,EAAE;IAEL,OAAO;AACX"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
+
import { CloneElement } from "./CloneElement.js";
|
|
2
3
|
import { CreateElement } from "./CreateElement.js";
|
|
3
4
|
import { DeleteElement } from "./DeleteElement.js";
|
|
4
5
|
import { MoveElement } from "./MoveElement.js";
|
|
5
6
|
import { DeselectElement } from "./DeselectElement.js";
|
|
6
7
|
import { SelectElement } from "./SelectElement.js";
|
|
7
8
|
import { HighlightElement } from "./HighlightElement.js";
|
|
8
|
-
const CommandHandlers = /*#__PURE__*/ react.memo(()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(CreateElement, null), /*#__PURE__*/ react.createElement(DeleteElement, null), /*#__PURE__*/ react.createElement(MoveElement, null), /*#__PURE__*/ react.createElement(DeselectElement, null), /*#__PURE__*/ react.createElement(SelectElement, null), /*#__PURE__*/ react.createElement(HighlightElement, null)));
|
|
9
|
+
const CommandHandlers = /*#__PURE__*/ react.memo(()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(CloneElement, null), /*#__PURE__*/ react.createElement(CreateElement, null), /*#__PURE__*/ react.createElement(DeleteElement, null), /*#__PURE__*/ react.createElement(MoveElement, null), /*#__PURE__*/ react.createElement(DeselectElement, null), /*#__PURE__*/ react.createElement(SelectElement, null), /*#__PURE__*/ react.createElement(HighlightElement, null)));
|
|
9
10
|
CommandHandlers.displayName = "CommandHandlers";
|
|
10
11
|
export { CommandHandlers };
|
|
11
12
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEditor/commandHandlers/index.js","sources":["../../../src/BaseEditor/commandHandlers/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { CreateElement } from \"./CreateElement.js\";\nimport { DeleteElement } from \"./DeleteElement.js\";\nimport { MoveElement } from \"./MoveElement.js\";\nimport { DeselectElement } from \"./DeselectElement.js\";\nimport { SelectElement } from \"./SelectElement.js\";\nimport { HighlightElement } from \"./HighlightElement.js\";\n\nexport const CommandHandlers = React.memo(() => {\n return (\n <>\n <CreateElement />\n <DeleteElement />\n <MoveElement />\n <DeselectElement />\n <SelectElement />\n <HighlightElement />\n </>\n );\n});\n\nCommandHandlers.displayName = \"CommandHandlers\";\n"],"names":["CommandHandlers","React","CreateElement","DeleteElement","MoveElement","DeselectElement","SelectElement","HighlightElement"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseEditor/commandHandlers/index.js","sources":["../../../src/BaseEditor/commandHandlers/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { CloneElement } from \"./CloneElement.js\";\nimport { CreateElement } from \"./CreateElement.js\";\nimport { DeleteElement } from \"./DeleteElement.js\";\nimport { MoveElement } from \"./MoveElement.js\";\nimport { DeselectElement } from \"./DeselectElement.js\";\nimport { SelectElement } from \"./SelectElement.js\";\nimport { HighlightElement } from \"./HighlightElement.js\";\n\nexport const CommandHandlers = React.memo(() => {\n return (\n <>\n <CloneElement />\n <CreateElement />\n <DeleteElement />\n <MoveElement />\n <DeselectElement />\n <SelectElement />\n <HighlightElement />\n </>\n );\n});\n\nCommandHandlers.displayName = \"CommandHandlers\";\n"],"names":["CommandHandlers","React","CloneElement","CreateElement","DeleteElement","MoveElement","DeselectElement","SelectElement","HighlightElement"],"mappings":";;;;;;;;AASO,MAAMA,kBAAkB,WAAHA,GAAGC,MAAAA,IAAU,CAAC,IAC/B,WAAP,GACI,wDACI,oBAACC,cAAYA,OAAAA,WAAAA,GACb,oBAACC,eAAaA,OAAAA,WAAAA,GACd,oBAACC,eAAaA,OAAAA,WAAAA,GACd,oBAACC,aAAWA,OAAAA,WAAAA,GACZ,oBAACC,iBAAeA,OAAAA,WAAAA,GAChB,oBAACC,eAAaA,OAAAA,WAAAA,GACd,oBAACC,kBAAgBA;AAK7BR,gBAAgB,WAAW,GAAG"}
|
package/BaseEditor/commands.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ElementFactoryCreateElementParams } from "@webiny/website-builder-sdk";
|
|
2
2
|
import type { WebsiteBuilderTheme } from "@webiny/website-builder-sdk/types/WebsiteBuilderTheme.js";
|
|
3
3
|
export declare const Commands: {
|
|
4
|
+
CloneElement: import("~/editorSdk/createCommand.js").Command<{
|
|
5
|
+
id: string;
|
|
6
|
+
}>;
|
|
4
7
|
CreateElement: import("~/editorSdk/createCommand.js").Command<{
|
|
5
8
|
componentName: string;
|
|
6
9
|
parentId: string;
|
package/BaseEditor/commands.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createCommand } from "../editorSdk/createCommand.js";
|
|
2
2
|
const CreateElement = createCommand("CREATE_ELEMENT");
|
|
3
3
|
const MoveElement = createCommand("MOVE_ELEMENT");
|
|
4
|
+
const CloneElement = createCommand("CLONE_ELEMENT");
|
|
4
5
|
const DeleteElement = createCommand("DELETE_ELEMENT");
|
|
5
6
|
const SelectElement = createCommand("SELECT_ELEMENT");
|
|
6
7
|
const HighlightElement = createCommand("HIGHLIGHT_ELEMENT");
|
|
@@ -10,6 +11,7 @@ const RefreshPreview = createCommand("REFRESH_PREVIEW");
|
|
|
10
11
|
const PreviewPatchElement = createCommand("PREVIEW_PATCH_ELEMENT");
|
|
11
12
|
const SendPreviewMessage = createCommand("SEND_PREVIEW_MESSAGE");
|
|
12
13
|
const Commands = {
|
|
14
|
+
CloneElement: CloneElement,
|
|
13
15
|
CreateElement: CreateElement,
|
|
14
16
|
DeleteElement: DeleteElement,
|
|
15
17
|
MoveElement: MoveElement,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEditor/commands.js","sources":["../../src/BaseEditor/commands.ts"],"sourcesContent":["import { createCommand } from \"~/editorSdk/createCommand.js\";\nimport type { ElementFactoryCreateElementParams } from \"@webiny/website-builder-sdk\";\nimport type { WebsiteBuilderTheme } from \"@webiny/website-builder-sdk/types/WebsiteBuilderTheme.js\";\n\nconst CreateElement = createCommand<{\n // Name of the component to use.\n componentName: string;\n // Parent element for the new element.\n parentId: string;\n // Parent element slot (e.g., `children`, `heroBanner`, `tabsList.0.content`).\n slot: string;\n // Index within the slot. Omit to append at the end.\n index?: number;\n // Bindings\n bindings?: ElementFactoryCreateElementParams[\"bindings\"];\n}>(\"CREATE_ELEMENT\");\n\nconst MoveElement = createCommand<{\n // ID of the element to move.\n elementId: string;\n // Parent element for the new element.\n parentId: string;\n // Parent element slot (e.g., `children`, `heroBanner`, `tabsList.0.content`).\n slot: string;\n // Index within the slot.\n index: number;\n}>(\"MOVE_ELEMENT\");\n\nconst DeleteElement = createCommand<{\n id: string;\n}>(\"DELETE_ELEMENT\");\n\nconst SelectElement = createCommand<{ id: string }>(\"SELECT_ELEMENT\");\n\nconst HighlightElement = createCommand<{ id: string }>(\"HIGHLIGHT_ELEMENT\");\n\nconst SetTheme = createCommand<{ theme: WebsiteBuilderTheme }>(\"SET_THEME\");\n\nconst DeselectElement = createCommand<never>(\"DESELECT_ELEMENT\");\n\nconst RefreshPreview = createCommand<never>(\"REFRESH_PREVIEW\");\n\nconst PreviewPatchElement = createCommand<{ elementId: string; patch: any[] }>(\n \"PREVIEW_PATCH_ELEMENT\"\n);\n\nconst SendPreviewMessage = createCommand<{ type: string; payload?: any }>(\"SEND_PREVIEW_MESSAGE\");\n\nexport const Commands = {\n CreateElement,\n DeleteElement,\n MoveElement,\n SelectElement,\n DeselectElement,\n HighlightElement,\n RefreshPreview,\n PreviewPatchElement,\n SendPreviewMessage,\n SetTheme\n};\n"],"names":["CreateElement","createCommand","MoveElement","DeleteElement","SelectElement","HighlightElement","SetTheme","DeselectElement","RefreshPreview","PreviewPatchElement","SendPreviewMessage","Commands"],"mappings":";AAIA,MAAMA,gBAAgBC,cAWnB;AAEH,MAAMC,cAAcD,cASjB;AAEH,MAAME,
|
|
1
|
+
{"version":3,"file":"BaseEditor/commands.js","sources":["../../src/BaseEditor/commands.ts"],"sourcesContent":["import { createCommand } from \"~/editorSdk/createCommand.js\";\nimport type { ElementFactoryCreateElementParams } from \"@webiny/website-builder-sdk\";\nimport type { WebsiteBuilderTheme } from \"@webiny/website-builder-sdk/types/WebsiteBuilderTheme.js\";\n\nconst CreateElement = createCommand<{\n // Name of the component to use.\n componentName: string;\n // Parent element for the new element.\n parentId: string;\n // Parent element slot (e.g., `children`, `heroBanner`, `tabsList.0.content`).\n slot: string;\n // Index within the slot. Omit to append at the end.\n index?: number;\n // Bindings\n bindings?: ElementFactoryCreateElementParams[\"bindings\"];\n}>(\"CREATE_ELEMENT\");\n\nconst MoveElement = createCommand<{\n // ID of the element to move.\n elementId: string;\n // Parent element for the new element.\n parentId: string;\n // Parent element slot (e.g., `children`, `heroBanner`, `tabsList.0.content`).\n slot: string;\n // Index within the slot.\n index: number;\n}>(\"MOVE_ELEMENT\");\n\nconst CloneElement = createCommand<{ id: string }>(\"CLONE_ELEMENT\");\n\nconst DeleteElement = createCommand<{\n id: string;\n}>(\"DELETE_ELEMENT\");\n\nconst SelectElement = createCommand<{ id: string }>(\"SELECT_ELEMENT\");\n\nconst HighlightElement = createCommand<{ id: string }>(\"HIGHLIGHT_ELEMENT\");\n\nconst SetTheme = createCommand<{ theme: WebsiteBuilderTheme }>(\"SET_THEME\");\n\nconst DeselectElement = createCommand<never>(\"DESELECT_ELEMENT\");\n\nconst RefreshPreview = createCommand<never>(\"REFRESH_PREVIEW\");\n\nconst PreviewPatchElement = createCommand<{ elementId: string; patch: any[] }>(\n \"PREVIEW_PATCH_ELEMENT\"\n);\n\nconst SendPreviewMessage = createCommand<{ type: string; payload?: any }>(\"SEND_PREVIEW_MESSAGE\");\n\nexport const Commands = {\n CloneElement,\n CreateElement,\n DeleteElement,\n MoveElement,\n SelectElement,\n DeselectElement,\n HighlightElement,\n RefreshPreview,\n PreviewPatchElement,\n SendPreviewMessage,\n SetTheme\n};\n"],"names":["CreateElement","createCommand","MoveElement","CloneElement","DeleteElement","SelectElement","HighlightElement","SetTheme","DeselectElement","RefreshPreview","PreviewPatchElement","SendPreviewMessage","Commands"],"mappings":";AAIA,MAAMA,gBAAgBC,cAWnB;AAEH,MAAMC,cAAcD,cASjB;AAEH,MAAME,eAAeF,cAA8B;AAEnD,MAAMG,gBAAgBH,cAEnB;AAEH,MAAMI,gBAAgBJ,cAA8B;AAEpD,MAAMK,mBAAmBL,cAA8B;AAEvD,MAAMM,WAAWN,cAA8C;AAE/D,MAAMO,kBAAkBP,cAAqB;AAE7C,MAAMQ,iBAAiBR,cAAqB;AAE5C,MAAMS,sBAAsBT,cACxB;AAGJ,MAAMU,qBAAqBV,cAA+C;AAEnE,MAAMW,WAAW;IACpBT,cAAAA;IACAH,eAAAA;IACAI,eAAAA;IACAF,aAAAA;IACAG,eAAAA;IACAG,iBAAAA;IACAF,kBAAAA;IACAG,gBAAAA;IACAC,qBAAAA;IACAC,oBAAAA;IACAJ,UAAAA;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEditor/defaultConfig/Content/AddressBar/usePreviewLink.js","sources":["../../../../../src/BaseEditor/defaultConfig/Content/AddressBar/usePreviewLink.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useIframeUrl } from \"~/BaseEditor/defaultConfig/Content/Preview/useIframeUrl.js\";\nimport { useSelectFromDocument } from \"~/BaseEditor/hooks/useSelectFromDocument.js\";\n\nexport const usePreviewLink = () => {\n const iframeUrl = useIframeUrl();\n const id = useSelectFromDocument(document => document.id);\n const path = useSelectFromDocument(document => document.properties.path);\n const documentType = useSelectFromDocument(document => document.metadata.documentType);\n\n return useMemo(() => {\n if (!iframeUrl) {\n return \"\";\n }\n const url = new URL(iframeUrl);\n\n // Remove all `wb.` params\n url.searchParams.forEach((_, key) => {\n if (key.startsWith(\"wb.\")) {\n url.searchParams.delete(key);\n }\n });\n\n // Add preview params\n url.searchParams.set(\"wb.preview\", \"true\");\n url.searchParams.set(\"wb.type\", documentType);\n url.searchParams.set(\"wb.id\", String(id));\n url.searchParams.set(\"wb.path\", path);\n return url.toString();\n }, [iframeUrl]);\n};\n"],"names":["usePreviewLink","iframeUrl","useIframeUrl","id","useSelectFromDocument","document","path","documentType","useMemo","url","URL","_","key","String"],"mappings":";;;AAIO,MAAMA,iBAAiB;IAC1B,MAAMC,YAAYC;IAClB,MAAMC,KAAKC,sBAAsBC,CAAAA,WAAYA,SAAS,EAAE;IACxD,MAAMC,OAAOF,sBAAsBC,CAAAA,WAAYA,SAAS,UAAU,CAAC,IAAI;IACvE,MAAME,eAAeH,sBAAsBC,CAAAA,WAAYA,SAAS,QAAQ,CAAC,YAAY;
|
|
1
|
+
{"version":3,"file":"BaseEditor/defaultConfig/Content/AddressBar/usePreviewLink.js","sources":["../../../../../src/BaseEditor/defaultConfig/Content/AddressBar/usePreviewLink.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useIframeUrl } from \"~/BaseEditor/defaultConfig/Content/Preview/useIframeUrl.js\";\nimport { useSelectFromDocument } from \"~/BaseEditor/hooks/useSelectFromDocument.js\";\n\nexport const usePreviewLink = () => {\n const iframeUrl = useIframeUrl();\n const id = useSelectFromDocument(document => document.id);\n const path = useSelectFromDocument(document => document.properties.path);\n const documentType = useSelectFromDocument(document => document.metadata.documentType);\n // // Set when the edited document is an A/B variant (see variantDocument.ts). When present, the\n // // preview must open the variant's draft — not the page the document borrows its identity from.\n // const previewVariantId = useSelectFromDocument(\n // document =>\n // (document.metadata as Record<string, any>).wbVariantPreviewId as string | undefined\n // );\n\n return useMemo(() => {\n if (!iframeUrl) {\n return \"\";\n }\n const url = new URL(iframeUrl);\n\n // Remove all `wb.` params\n url.searchParams.forEach((_, key) => {\n if (key.startsWith(\"wb.\")) {\n url.searchParams.delete(key);\n }\n });\n\n // if (previewVariantId) {\n // // Variant draft preview — the site renders this variant's draft content on its page.\n // url.searchParams.set(\"wb-variant-draft\", previewVariantId);\n // return url.toString();\n // }\n\n // Add preview params\n url.searchParams.set(\"wb.preview\", \"true\");\n url.searchParams.set(\"wb.type\", documentType);\n url.searchParams.set(\"wb.id\", String(id));\n url.searchParams.set(\"wb.path\", path);\n return url.toString();\n }, [iframeUrl, id, path, documentType /*previewVariantId*/]);\n};\n"],"names":["usePreviewLink","iframeUrl","useIframeUrl","id","useSelectFromDocument","document","path","documentType","useMemo","url","URL","_","key","String"],"mappings":";;;AAIO,MAAMA,iBAAiB;IAC1B,MAAMC,YAAYC;IAClB,MAAMC,KAAKC,sBAAsBC,CAAAA,WAAYA,SAAS,EAAE;IACxD,MAAMC,OAAOF,sBAAsBC,CAAAA,WAAYA,SAAS,UAAU,CAAC,IAAI;IACvE,MAAME,eAAeH,sBAAsBC,CAAAA,WAAYA,SAAS,QAAQ,CAAC,YAAY;IAQrF,OAAOG,QAAQ;QACX,IAAI,CAACP,WACD,OAAO;QAEX,MAAMQ,MAAM,IAAIC,IAAIT;QAGpBQ,IAAI,YAAY,CAAC,OAAO,CAAC,CAACE,GAAGC;YACzB,IAAIA,IAAI,UAAU,CAAC,QACfH,IAAI,YAAY,CAAC,MAAM,CAACG;QAEhC;QASAH,IAAI,YAAY,CAAC,GAAG,CAAC,cAAc;QACnCA,IAAI,YAAY,CAAC,GAAG,CAAC,WAAWF;QAChCE,IAAI,YAAY,CAAC,GAAG,CAAC,SAASI,OAAOV;QACrCM,IAAI,YAAY,CAAC,GAAG,CAAC,WAAWH;QAChC,OAAOG,IAAI,QAAQ;IACvB,GAAG;QAACR;QAAWE;QAAIG;QAAMC;KAAkC;AAC/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEditor/defaultConfig/Content/Preview/DropZoneManager.js","sources":["../../../../../src/BaseEditor/defaultConfig/Content/Preview/DropZoneManager.ts"],"sourcesContent":["import type { Box } from \"./Box.js\";\n\ntype DropPosition = number | null;\ntype MatchChangeCallback = (hasMatch: boolean) => void;\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 private matchCallbacks = new Set<MatchChangeCallback>();\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 subscribeToMatchChange(cb: MatchChangeCallback): () => void {\n this.matchCallbacks.add(cb);\n return () => this.matchCallbacks.delete(cb);\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 this.matchCallbacks.forEach(cb => cb(matchedId !== null));\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"],"names":["DropZoneManager","mouse","Map","Set","entry","id","cb","runDropzoneLoop","requestAnimationFrame","cancelAnimationFrame","scrollYOffset","threshold","mouseX","mouseY","matchedId","matchedPosition","matchedBox","candidates","box","canAccept","isWithinX","Math","eligible","c","uniqueDepths","a","b","winner","rangeLeft","Infinity","rangeRight","centerX","halfWidth","distFromCenter","depthIndex","isTarget","container","document"],"mappings":"AAiBO,MAAMA;IAQT,YAAoBC,KAA+B,CAAE;aAAjCA,KAAK,GAALA;aAPZ,KAAK,GAAG,IAAIC;aACZ,eAAe,GAAkB;aACjC,eAAe,GAAiB;aAChC,cAAc,GAAkB;aAChC,UAAU,GAAe;aACzB,cAAc,GAAG,IAAIC;IAEyB;IAEtD,SAASC,KAAoB,EAAE;QAC3B,IAAIA,AAAa,WAAbA,MAAM,EAAE,EACR;QAGJ,IAAI,CAAC,KAAK,CAAC,GAAG,CAACA,MAAM,EAAE,EAAEA;IAC7B;IAEA,WAAWC,EAAU,EAAE;QACnB,IAAI,CAAC,KAAK,CAAC,MAAM,CAACA;IACtB;IAEA,uBAAuBC,EAAuB,EAAc;QACxD,IAAI,CAAC,cAAc,CAAC,GAAG,CAACA;QACxB,OAAO,IAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAACA;IAC5C;IAEA,QAAQ;QACJ,MAAMC,kBAAkB;YACpB,IAAI,CAAC,IAAI;YACT,IAAI,CAAC,cAAc,GAAGC,sBAAsBD;QAChD;QACA,IAAI,CAAC,cAAc,GAAGC,sBAAsBD;IAChD;IAEA,OAAO;QACH,IAAI,IAAI,CAAC,cAAc,EACnBE,qBAAqB,IAAI,CAAC,cAAc;IAEhD;IAEA,yBAAyB;QACrB,IAAI,CAAC,IAAI,CAAC,UAAU,EAChB,OAAO;QAGX,OAAO;YACH,UAAU,IAAI,CAAC,UAAU,CAAC,QAAQ;YAClC,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;YAChC,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,GAAI,KAAI,CAAC,eAAe,IAAI;QAClE;IACJ;IAEA,OAAO;QACH,MAAMC,gBAAgB,IAAI,CAAC,eAAe;QAC1C,MAAMC,YAAY;QAClB,MAAMC,SAAS,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,MAAMC,SAAS,IAAI,CAAC,KAAK,CAAC,CAAC,GAAGH;QAE9B,IAAII,YAA2B;QAC/B,IAAIC,kBAAgC;QACpC,IAAIC,aAAyB;QAG7B,MAAMC,aACF,EAAE;QAEN,KAAK,MAAM,CAACZ,IAAI,EAAEa,GAAG,EAAEC,SAAS,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAE;YAC/C,MAAMC,YAAYR,UAAUM,IAAI,IAAI,IAAIN,UAAUM,IAAI,KAAK;YAE3D,IAAKE;gBAIL,IAAIC,KAAK,GAAG,CAACR,SAASK,IAAI,GAAG,KAAKP,WAC9BM,WAAW,IAAI,CAAC;oBAAEZ;oBAAIa;oBAAK,UAAU;oBAAGC;gBAAU;gBAGtD,IAAIE,KAAK,GAAG,CAACR,SAASK,IAAI,MAAM,KAAKP,WACjCM,WAAW,IAAI,CAAC;oBAAEZ;oBAAIa;oBAAK,UAAU;oBAAGC;gBAAU;;QAE1D;QAEA,IAAIF,WAAW,MAAM,GAAG,GAAG;YAEvB,MAAMK,WAAWL,WAAW,MAAM,CAACM,CAAAA,IAAK,CAACA,EAAE,SAAS,IAAIA,EAAE,SAAS;YAEnE,IAAID,SAAS,MAAM,GAAG,GAAG;gBACrB,MAAME,eAAe;uBAAI,IAAIrB,IAAImB,SAAS,GAAG,CAACC,CAAAA,IAAKA,EAAE,GAAG,CAAC,KAAK;iBAAG,CAAC,IAAI,CAClE,CAACE,GAAGC,IAAMA,IAAID;gBAGlB,IAAID,AAAwB,MAAxBA,aAAa,MAAM,EAAQ;oBAC3B,MAAMG,SAASL,QAAQ,CAAC,EAAE;oBAC1BR,YAAYa,OAAO,EAAE;oBACrBZ,kBAAkBY,OAAO,QAAQ;oBACjCX,aAAaW,OAAO,GAAG;gBAC3B,OAAO;oBAEH,IAAIC,YAAYC;
|
|
1
|
+
{"version":3,"file":"BaseEditor/defaultConfig/Content/Preview/DropZoneManager.js","sources":["../../../../../src/BaseEditor/defaultConfig/Content/Preview/DropZoneManager.ts"],"sourcesContent":["import type { Box } from \"./Box.js\";\n\ntype DropPosition = number | null;\ntype MatchChangeCallback = (hasMatch: boolean) => void;\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 private matchCallbacks = new Set<MatchChangeCallback>();\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 subscribeToMatchChange(cb: MatchChangeCallback): () => void {\n this.matchCallbacks.add(cb);\n return () => this.matchCallbacks.delete(cb);\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 this.matchCallbacks.forEach(cb => cb(matchedId !== null));\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"],"names":["DropZoneManager","mouse","Map","Set","entry","id","cb","runDropzoneLoop","requestAnimationFrame","cancelAnimationFrame","scrollYOffset","threshold","mouseX","mouseY","matchedId","matchedPosition","matchedBox","candidates","box","canAccept","isWithinX","Math","eligible","c","uniqueDepths","a","b","winner","rangeLeft","Infinity","rangeRight","centerX","halfWidth","distFromCenter","depthIndex","isTarget","container","document"],"mappings":"AAiBO,MAAMA;IAQT,YAAoBC,KAA+B,CAAE;aAAjCA,KAAK,GAALA;aAPZ,KAAK,GAAG,IAAIC;aACZ,eAAe,GAAkB;aACjC,eAAe,GAAiB;aAChC,cAAc,GAAkB;aAChC,UAAU,GAAe;aACzB,cAAc,GAAG,IAAIC;IAEyB;IAEtD,SAASC,KAAoB,EAAE;QAC3B,IAAIA,AAAa,WAAbA,MAAM,EAAE,EACR;QAGJ,IAAI,CAAC,KAAK,CAAC,GAAG,CAACA,MAAM,EAAE,EAAEA;IAC7B;IAEA,WAAWC,EAAU,EAAE;QACnB,IAAI,CAAC,KAAK,CAAC,MAAM,CAACA;IACtB;IAEA,uBAAuBC,EAAuB,EAAc;QACxD,IAAI,CAAC,cAAc,CAAC,GAAG,CAACA;QACxB,OAAO,IAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAACA;IAC5C;IAEA,QAAQ;QACJ,MAAMC,kBAAkB;YACpB,IAAI,CAAC,IAAI;YACT,IAAI,CAAC,cAAc,GAAGC,sBAAsBD;QAChD;QACA,IAAI,CAAC,cAAc,GAAGC,sBAAsBD;IAChD;IAEA,OAAO;QACH,IAAI,IAAI,CAAC,cAAc,EACnBE,qBAAqB,IAAI,CAAC,cAAc;IAEhD;IAEA,yBAAyB;QACrB,IAAI,CAAC,IAAI,CAAC,UAAU,EAChB,OAAO;QAGX,OAAO;YACH,UAAU,IAAI,CAAC,UAAU,CAAC,QAAQ;YAClC,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;YAChC,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,GAAI,KAAI,CAAC,eAAe,IAAI;QAClE;IACJ;IAEA,OAAO;QACH,MAAMC,gBAAgB,IAAI,CAAC,eAAe;QAC1C,MAAMC,YAAY;QAClB,MAAMC,SAAS,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,MAAMC,SAAS,IAAI,CAAC,KAAK,CAAC,CAAC,GAAGH;QAE9B,IAAII,YAA2B;QAC/B,IAAIC,kBAAgC;QACpC,IAAIC,aAAyB;QAG7B,MAAMC,aACF,EAAE;QAEN,KAAK,MAAM,CAACZ,IAAI,EAAEa,GAAG,EAAEC,SAAS,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAE;YAC/C,MAAMC,YAAYR,UAAUM,IAAI,IAAI,IAAIN,UAAUM,IAAI,KAAK;YAE3D,IAAKE;gBAIL,IAAIC,KAAK,GAAG,CAACR,SAASK,IAAI,GAAG,KAAKP,WAC9BM,WAAW,IAAI,CAAC;oBAAEZ;oBAAIa;oBAAK,UAAU;oBAAGC;gBAAU;gBAGtD,IAAIE,KAAK,GAAG,CAACR,SAASK,IAAI,MAAM,KAAKP,WACjCM,WAAW,IAAI,CAAC;oBAAEZ;oBAAIa;oBAAK,UAAU;oBAAGC;gBAAU;;QAE1D;QAEA,IAAIF,WAAW,MAAM,GAAG,GAAG;YAEvB,MAAMK,WAAWL,WAAW,MAAM,CAACM,CAAAA,IAAK,CAACA,EAAE,SAAS,IAAIA,EAAE,SAAS;YAEnE,IAAID,SAAS,MAAM,GAAG,GAAG;gBACrB,MAAME,eAAe;uBAAI,IAAIrB,IAAImB,SAAS,GAAG,CAACC,CAAAA,IAAKA,EAAE,GAAG,CAAC,KAAK;iBAAG,CAAC,IAAI,CAClE,CAACE,GAAGC,IAAMA,IAAID;gBAGlB,IAAID,AAAwB,MAAxBA,aAAa,MAAM,EAAQ;oBAC3B,MAAMG,SAASL,QAAQ,CAAC,EAAE;oBAC1BR,YAAYa,OAAO,EAAE;oBACrBZ,kBAAkBY,OAAO,QAAQ;oBACjCX,aAAaW,OAAO,GAAG;gBAC3B,OAAO;oBAEH,IAAIC,YAAYC,KAAQ;oBACxB,IAAIC,aAAa,MAAS;oBAC1B,KAAK,MAAMP,KAAKD,SAAU;wBACtBM,YAAYP,KAAK,GAAG,CAACO,WAAWL,EAAE,GAAG,CAAC,IAAI;wBAC1CO,aAAaT,KAAK,GAAG,CAACS,YAAYP,EAAE,GAAG,CAAC,KAAK;oBACjD;oBAEA,MAAMQ,UAAWH,AAAAA,CAAAA,YAAYE,UAAS,IAAK;oBAC3C,MAAME,YAAaF,AAAAA,CAAAA,aAAaF,SAAQ,IAAK;oBAG7C,MAAMK,iBACFD,YAAY,IAAIX,KAAK,GAAG,CAACT,SAASmB,WAAWC,YAAY;oBAG7D,MAAME,aAAab,KAAK,GAAG,CACvBA,KAAK,KAAK,CAACY,iBAAiBT,aAAa,MAAM,GAC/CA,aAAa,MAAM,GAAG;oBAG1B,MAAMG,SAASL,SAAS,IAAI,CAACC,CAAAA,IAAKA,EAAE,GAAG,CAAC,KAAK,KAAKC,YAAY,CAACU,WAAW;oBAC1E,IAAIP,QAAQ;wBACRb,YAAYa,OAAO,EAAE;wBACrBZ,kBAAkBY,OAAO,QAAQ;wBACjCX,aAAaW,OAAO,GAAG;oBAC3B;gBACJ;YACJ;QACJ;QAEA,IAAIb,cAAc,IAAI,CAAC,eAAe,IAAIC,oBAAoB,IAAI,CAAC,eAAe,EAAE;YAChF,IAAI,CAAC,eAAe,GAAGD;YACvB,IAAI,CAAC,eAAe,GAAGC;YACvB,IAAI,CAAC,UAAU,GAAGC;YAElB,IAAI,CAAC,cAAc,CAAC,OAAO,CAACV,CAAAA,KAAMA,GAAGQ,AAAc,SAAdA;YAErC,KAAK,MAAM,CAACT,IAAID,MAAM,IAAI,IAAI,CAAC,KAAK,CAAE;gBAClC,MAAM+B,WAAW9B,OAAOS;gBACxBV,MAAM,iBAAiB,CACnB+B,WAAW;oBAAE,KAAKnB;oBAAa,UAAUD;gBAAgB,IAAI;YAErE;QACJ;IACJ;IAEQ,kBAAkB;QACtB,MAAMqB,YAAYC,SAAS,cAAc,CAAC;QAC1C,IAAI,CAACD,WACD,OAAO;QAGX,OAAOA,UAAU,SAAS;IAC9B;AACJ"}
|
|
@@ -8,7 +8,7 @@ interface IframeProps {
|
|
|
8
8
|
viewportManager: ViewportManager;
|
|
9
9
|
onConnected: (messenger: Messenger) => void;
|
|
10
10
|
}
|
|
11
|
-
export declare const Iframe: (({ url, timestamp, ...props }: IframeProps) => React.JSX.Element) & {
|
|
12
|
-
|
|
11
|
+
export declare const Iframe: (({ url, timestamp, ...props }: IframeProps) => React.JSX.Element) & React.NamedExoticComponent<IframeProps> & {
|
|
12
|
+
readonly type: ({ url, timestamp, ...props }: IframeProps) => React.JSX.Element;
|
|
13
13
|
};
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const ElementOverlays: (() => React.JSX.Element) & {
|
|
3
|
-
|
|
2
|
+
export declare const ElementOverlays: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
|
|
3
|
+
readonly type: () => React.JSX.Element;
|
|
4
4
|
};
|
|
@@ -10,6 +10,8 @@ import { CommandHandlers } from "../commandHandlers/index.js";
|
|
|
10
10
|
import { ElementSettings } from "./Sidebar/ElementSettings/ElementSettings.js";
|
|
11
11
|
import { ElementInputRenderers } from "./ElementInputRenderers.js";
|
|
12
12
|
import { ContentPreviewConfig } from "./Content/ContentPreviewConfig.js";
|
|
13
|
+
import { CloneElementAction } from "./Sidebar/ElementActions/CloneElementAction.js";
|
|
14
|
+
import { DeleteElementAction } from "./Sidebar/ElementActions/DeleteElementAction.js";
|
|
13
15
|
const { Ui: Ui } = EditorConfig;
|
|
14
16
|
const ClickToActivate = ()=>/*#__PURE__*/ react.createElement(Ui.NoActiveElement, null, /*#__PURE__*/ react.createElement(SidebarEmptyState, {
|
|
15
17
|
message: "Select an element in the canvas to edit properties."
|
|
@@ -44,6 +46,13 @@ const DefaultEditorConfig = /*#__PURE__*/ react.memo(()=>/*#__PURE__*/ react.cre
|
|
|
44
46
|
name: "elementSettings",
|
|
45
47
|
group: "element",
|
|
46
48
|
element: /*#__PURE__*/ react.createElement(Ui.OnActiveElement, null, /*#__PURE__*/ react.createElement(ElementSettings, null))
|
|
49
|
+
}), /*#__PURE__*/ react.createElement(EditorConfig.ElementAction, {
|
|
50
|
+
name: "cloneElement",
|
|
51
|
+
element: /*#__PURE__*/ react.createElement(CloneElementAction, null)
|
|
52
|
+
}), /*#__PURE__*/ react.createElement(EditorConfig.ElementAction, {
|
|
53
|
+
name: "deleteElement",
|
|
54
|
+
element: /*#__PURE__*/ react.createElement(DeleteElementAction, null),
|
|
55
|
+
after: "cloneElement"
|
|
47
56
|
}))));
|
|
48
57
|
DefaultEditorConfig.displayName = "DefaultEditorConfig";
|
|
49
58
|
export { DefaultEditorConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEditor/defaultConfig/DefaultEditorConfig.js","sources":["../../../src/BaseEditor/defaultConfig/DefaultEditorConfig.tsx"],"sourcesContent":["import React from \"react\";\nimport { EditorConfig } from \"~/BaseEditor/config/index.js\";\nimport { SidebarEmptyState } from \"./Sidebar/SidebarEmptyState.js\";\nimport { StyleSettingsGroup } from \"./Sidebar/StyleSettings/StyleSettingsGroup.js\";\nimport { StyleProperties } from \"./Sidebar/StyleSettings/StyleProperties.js\";\nimport { ElementSettingsGroup } from \"./Sidebar/ElementSettings/ElementSettingsGroup.js\";\nimport { InsertElementsTab } from \"./Toolbar/InsertElements/InsertElementsTab.js\";\nimport { NavigatorTab } from \"./Toolbar/Navigator/NavigatorTab.js\";\nimport { CommandHandlers } from \"~/BaseEditor/commandHandlers/index.js\";\nimport { ElementSettings } from \"./Sidebar/ElementSettings/ElementSettings.js\";\nimport { ElementInputRenderers } from \"./ElementInputRenderers.js\";\nimport { ContentPreviewConfig } from \"./Content/ContentPreviewConfig.js\";\n\nconst { Ui } = EditorConfig;\n\nconst ClickToActivate = () => {\n return (\n <Ui.NoActiveElement>\n <SidebarEmptyState message={\"Select an element in the canvas to edit properties.\"} />\n </Ui.NoActiveElement>\n );\n};\n\nexport const DefaultEditorConfig = React.memo(() => {\n return (\n <>\n <CommandHandlers />\n <EditorConfig>\n <ElementInputRenderers />\n <ContentPreviewConfig />\n <Ui.Toolbar.Element\n name={\"insertElements\"}\n group={\"tabs\"}\n element={<InsertElementsTab />}\n />\n <Ui.Toolbar.Element name={\"navigator\"} group={\"tabs\"} element={<NavigatorTab />} />\n {/* Sidebar Groups */}\n <Ui.Sidebar.Group name={\"element\"} element={<ElementSettingsGroup />} />\n <Ui.Sidebar.Group name={\"style\"} element={<StyleSettingsGroup />} />\n {/* Style Settings Tab */}\n <Ui.Sidebar.Element\n name={\"styleSettings\"}\n group={\"style\"}\n element={\n <Ui.OnActiveElement>\n <StyleProperties />\n </Ui.OnActiveElement>\n }\n />\n <Ui.Sidebar.Element\n name={\"styleInactive\"}\n group={\"style\"}\n element={<ClickToActivate />}\n />\n {/* Element Settings Tab */}\n <Ui.Sidebar.Element\n name={\"elementInactive\"}\n group={\"element\"}\n element={<ClickToActivate />}\n />\n {/* This element renders element properties. */}\n <Ui.Sidebar.Element\n name={\"elementSettings\"}\n group={\"element\"}\n element={\n <Ui.OnActiveElement>\n <ElementSettings />\n </Ui.OnActiveElement>\n }\n />\n {/*<Ui.Sidebar.Element\n name={\"stateEditor\"}\n group={\"element\"}\n element={<DocumentStateEditor />}\n />*/}\n </EditorConfig>\n </>\n );\n});\n\nDefaultEditorConfig.displayName = \"DefaultEditorConfig\";\n"],"names":["Ui","EditorConfig","ClickToActivate","SidebarEmptyState","DefaultEditorConfig","React","CommandHandlers","ElementInputRenderers","ContentPreviewConfig","InsertElementsTab","NavigatorTab","ElementSettingsGroup","StyleSettingsGroup","StyleProperties","ElementSettings"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseEditor/defaultConfig/DefaultEditorConfig.js","sources":["../../../src/BaseEditor/defaultConfig/DefaultEditorConfig.tsx"],"sourcesContent":["import React from \"react\";\nimport { EditorConfig } from \"~/BaseEditor/config/index.js\";\nimport { SidebarEmptyState } from \"./Sidebar/SidebarEmptyState.js\";\nimport { StyleSettingsGroup } from \"./Sidebar/StyleSettings/StyleSettingsGroup.js\";\nimport { StyleProperties } from \"./Sidebar/StyleSettings/StyleProperties.js\";\nimport { ElementSettingsGroup } from \"./Sidebar/ElementSettings/ElementSettingsGroup.js\";\nimport { InsertElementsTab } from \"./Toolbar/InsertElements/InsertElementsTab.js\";\nimport { NavigatorTab } from \"./Toolbar/Navigator/NavigatorTab.js\";\nimport { CommandHandlers } from \"~/BaseEditor/commandHandlers/index.js\";\nimport { ElementSettings } from \"./Sidebar/ElementSettings/ElementSettings.js\";\nimport { ElementInputRenderers } from \"./ElementInputRenderers.js\";\nimport { ContentPreviewConfig } from \"./Content/ContentPreviewConfig.js\";\nimport { CloneElementAction } from \"./Sidebar/ElementActions/CloneElementAction.js\";\nimport { DeleteElementAction } from \"./Sidebar/ElementActions/DeleteElementAction.js\";\n\nconst { Ui } = EditorConfig;\n\nconst ClickToActivate = () => {\n return (\n <Ui.NoActiveElement>\n <SidebarEmptyState message={\"Select an element in the canvas to edit properties.\"} />\n </Ui.NoActiveElement>\n );\n};\n\nexport const DefaultEditorConfig = React.memo(() => {\n return (\n <>\n <CommandHandlers />\n <EditorConfig>\n <ElementInputRenderers />\n <ContentPreviewConfig />\n <Ui.Toolbar.Element\n name={\"insertElements\"}\n group={\"tabs\"}\n element={<InsertElementsTab />}\n />\n <Ui.Toolbar.Element name={\"navigator\"} group={\"tabs\"} element={<NavigatorTab />} />\n {/* Sidebar Groups */}\n <Ui.Sidebar.Group name={\"element\"} element={<ElementSettingsGroup />} />\n <Ui.Sidebar.Group name={\"style\"} element={<StyleSettingsGroup />} />\n {/* Style Settings Tab */}\n <Ui.Sidebar.Element\n name={\"styleSettings\"}\n group={\"style\"}\n element={\n <Ui.OnActiveElement>\n <StyleProperties />\n </Ui.OnActiveElement>\n }\n />\n <Ui.Sidebar.Element\n name={\"styleInactive\"}\n group={\"style\"}\n element={<ClickToActivate />}\n />\n {/* Element Settings Tab */}\n <Ui.Sidebar.Element\n name={\"elementInactive\"}\n group={\"element\"}\n element={<ClickToActivate />}\n />\n {/* This element renders element properties. */}\n <Ui.Sidebar.Element\n name={\"elementSettings\"}\n group={\"element\"}\n element={\n <Ui.OnActiveElement>\n <ElementSettings />\n </Ui.OnActiveElement>\n }\n />\n {/*<Ui.Sidebar.Element\n name={\"stateEditor\"}\n group={\"element\"}\n element={<DocumentStateEditor />}\n />*/}\n {/* Element Actions (dropdown menu items) */}\n <EditorConfig.ElementAction\n name={\"cloneElement\"}\n element={<CloneElementAction />}\n />\n <EditorConfig.ElementAction\n name={\"deleteElement\"}\n element={<DeleteElementAction />}\n after={\"cloneElement\"}\n />\n </EditorConfig>\n </>\n );\n});\n\nDefaultEditorConfig.displayName = \"DefaultEditorConfig\";\n"],"names":["Ui","EditorConfig","ClickToActivate","SidebarEmptyState","DefaultEditorConfig","React","CommandHandlers","ElementInputRenderers","ContentPreviewConfig","InsertElementsTab","NavigatorTab","ElementSettingsGroup","StyleSettingsGroup","StyleProperties","ElementSettings","CloneElementAction","DeleteElementAction"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,EAAEA,IAAAA,EAAE,EAAE,GAAGC;AAEf,MAAMC,kBAAkB,IACb,WAAP,GACI,oBAACF,GAAG,eAAe,sBACf,oBAACG,mBAAiBA;QAAC,SAAS;;AAKjC,MAAMC,sBAAsB,WAAHA,GAAGC,MAAAA,IAAU,CAAC,IACnC,WAAP,GACI,wDACI,oBAACC,iBAAeA,OAAAA,WAAAA,GAChB,oBAACL,cAAYA,MAAAA,WAAAA,GACT,oBAACM,uBAAqBA,OAAAA,WAAAA,GACtB,oBAACC,sBAAoBA,OAAAA,WAAAA,GACrB,oBAACR,GAAG,OAAO,CAAC,OAAO;QACf,MAAM;QACN,OAAO;QACP,uBAAS,oBAACS,mBAAiBA;sBAE/B,oBAACT,GAAG,OAAO,CAAC,OAAO;QAAC,MAAM;QAAa,OAAO;QAAQ,uBAAS,oBAACU,cAAYA;sBAE5E,oBAACV,GAAG,OAAO,CAAC,KAAK;QAAC,MAAM;QAAW,uBAAS,oBAACW,sBAAoBA;sBACjE,oBAACX,GAAG,OAAO,CAAC,KAAK;QAAC,MAAM;QAAS,uBAAS,oBAACY,oBAAkBA;sBAE7D,oBAACZ,GAAG,OAAO,CAAC,OAAO;QACf,MAAM;QACN,OAAO;QACP,uBACI,oBAACA,GAAG,eAAe,sBACf,oBAACa,iBAAeA;sBAI5B,oBAACb,GAAG,OAAO,CAAC,OAAO;QACf,MAAM;QACN,OAAO;QACP,uBAAS,oBAACE,iBAAeA;sBAG7B,oBAACF,GAAG,OAAO,CAAC,OAAO;QACf,MAAM;QACN,OAAO;QACP,uBAAS,oBAACE,iBAAeA;sBAG7B,oBAACF,GAAG,OAAO,CAAC,OAAO;QACf,MAAM;QACN,OAAO;QACP,uBACI,oBAACA,GAAG,eAAe,sBACf,oBAACc,iBAAeA;sBAU5B,oBAACb,aAAa,aAAa;QACvB,MAAM;QACN,uBAAS,oBAACc,oBAAkBA;sBAEhC,oBAACd,aAAa,aAAa;QACvB,MAAM;QACN,uBAAS,oBAACe,qBAAmBA;QAC7B,OAAO;;AAO3BZ,oBAAoB,WAAW,GAAG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const DocumentStateEditor: (() => React.JSX.Element) & {
|
|
3
|
-
|
|
2
|
+
export declare const DocumentStateEditor: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
|
|
3
|
+
readonly type: () => React.JSX.Element;
|
|
4
4
|
};
|
|
@@ -12,6 +12,7 @@ import { SelectInputRenderer } from "../../inputRenderers/SelectInput.js";
|
|
|
12
12
|
import { FileInputRenderer } from "../../inputRenderers/FileInput.js";
|
|
13
13
|
import { FragmentSelectorInputRenderer } from "../../inputRenderers/FragmentSelectorInput.js";
|
|
14
14
|
import { ObjectInputRenderer } from "../../inputRenderers/ObjectInput/ObjectInputRenderer.js";
|
|
15
|
+
import { ColorPickerInputRenderer } from "../../inputRenderers/ColorPickerInput.js";
|
|
15
16
|
const ElementInputRenderers = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(EditorConfig.ElementInput.Renderer, {
|
|
16
17
|
name: "Webiny/Slot",
|
|
17
18
|
component: SlotInputRenderer
|
|
@@ -45,6 +46,9 @@ const ElementInputRenderers = ()=>/*#__PURE__*/ react.createElement(react.Fragme
|
|
|
45
46
|
}), /*#__PURE__*/ react.createElement(EditorConfig.ElementInput.Renderer, {
|
|
46
47
|
name: "Webiny/Object",
|
|
47
48
|
component: ObjectInputRenderer
|
|
49
|
+
}), /*#__PURE__*/ react.createElement(EditorConfig.ElementInput.Renderer, {
|
|
50
|
+
name: "Webiny/ColorPicker",
|
|
51
|
+
component: ColorPickerInputRenderer
|
|
48
52
|
}));
|
|
49
53
|
export { ElementInputRenderers };
|
|
50
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEditor/defaultConfig/ElementInputRenderers.js","sources":["../../../src/BaseEditor/defaultConfig/ElementInputRenderers.tsx"],"sourcesContent":["import React from \"react\";\nimport { EditorConfig } from \"~/BaseEditor/index.js\";\nimport { TextInputRenderer } from \"~/inputRenderers/TextInput.js\";\nimport { NumberInputRenderer } from \"~/inputRenderers/NumberInput.js\";\nimport { BooleanInputRenderer } from \"~/inputRenderers/BooleanInput.js\";\nimport { TextareaInputRenderer } from \"~/inputRenderers/TextareaInput.js\";\nimport { LexicalInputRenderer } from \"~/inputRenderers/LexicalInput/LexicalInput.js\";\nimport { DefaultLexicalConfig } from \"~/inputRenderers/LexicalInput/DefaultLexicalConfig.js\";\nimport { SlotInputRenderer } from \"~/inputRenderers/SlotInput.js\";\nimport { GridLayoutInputRenderer } from \"~/inputRenderers/GridLayoutInput.js\";\nimport { SelectInputRenderer } from \"~/inputRenderers/SelectInput.js\";\nimport { FileInputRenderer } from \"~/inputRenderers/FileInput.js\";\nimport { FragmentSelectorInputRenderer } from \"~/inputRenderers/FragmentSelectorInput.js\";\nimport { ObjectInputRenderer } from \"~/inputRenderers/ObjectInput/ObjectInputRenderer.js\";\n\nexport const ElementInputRenderers = () => {\n return (\n <>\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Slot\"}\n component={SlotInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Input\"}\n component={TextInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Select\"}\n component={SelectInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Textarea\"}\n component={TextareaInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Number\"}\n component={NumberInputRenderer}\n />\n {/* Configure Lexical Editor*/}\n <DefaultLexicalConfig />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Lexical\"}\n component={LexicalInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Switch\"}\n component={BooleanInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/GridLayout\"}\n component={GridLayoutInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/FileManager\"}\n component={FileInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/FragmentSelector\"}\n component={FragmentSelectorInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Object\"}\n component={ObjectInputRenderer}\n />\n </>\n );\n};\n"],"names":["ElementInputRenderers","EditorConfig","SlotInputRenderer","TextInputRenderer","SelectInputRenderer","TextareaInputRenderer","NumberInputRenderer","DefaultLexicalConfig","LexicalInputRenderer","BooleanInputRenderer","GridLayoutInputRenderer","FileInputRenderer","FragmentSelectorInputRenderer","ObjectInputRenderer"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseEditor/defaultConfig/ElementInputRenderers.js","sources":["../../../src/BaseEditor/defaultConfig/ElementInputRenderers.tsx"],"sourcesContent":["import React from \"react\";\nimport { EditorConfig } from \"~/BaseEditor/index.js\";\nimport { TextInputRenderer } from \"~/inputRenderers/TextInput.js\";\nimport { NumberInputRenderer } from \"~/inputRenderers/NumberInput.js\";\nimport { BooleanInputRenderer } from \"~/inputRenderers/BooleanInput.js\";\nimport { TextareaInputRenderer } from \"~/inputRenderers/TextareaInput.js\";\nimport { LexicalInputRenderer } from \"~/inputRenderers/LexicalInput/LexicalInput.js\";\nimport { DefaultLexicalConfig } from \"~/inputRenderers/LexicalInput/DefaultLexicalConfig.js\";\nimport { SlotInputRenderer } from \"~/inputRenderers/SlotInput.js\";\nimport { GridLayoutInputRenderer } from \"~/inputRenderers/GridLayoutInput.js\";\nimport { SelectInputRenderer } from \"~/inputRenderers/SelectInput.js\";\nimport { FileInputRenderer } from \"~/inputRenderers/FileInput.js\";\nimport { FragmentSelectorInputRenderer } from \"~/inputRenderers/FragmentSelectorInput.js\";\nimport { ObjectInputRenderer } from \"~/inputRenderers/ObjectInput/ObjectInputRenderer.js\";\nimport { ColorPickerInputRenderer } from \"~/inputRenderers/ColorPickerInput.js\";\n\nexport const ElementInputRenderers = () => {\n return (\n <>\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Slot\"}\n component={SlotInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Input\"}\n component={TextInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Select\"}\n component={SelectInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Textarea\"}\n component={TextareaInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Number\"}\n component={NumberInputRenderer}\n />\n {/* Configure Lexical Editor*/}\n <DefaultLexicalConfig />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Lexical\"}\n component={LexicalInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Switch\"}\n component={BooleanInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/GridLayout\"}\n component={GridLayoutInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/FileManager\"}\n component={FileInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/FragmentSelector\"}\n component={FragmentSelectorInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/Object\"}\n component={ObjectInputRenderer}\n />\n <EditorConfig.ElementInput.Renderer\n name={\"Webiny/ColorPicker\"}\n component={ColorPickerInputRenderer}\n />\n </>\n );\n};\n"],"names":["ElementInputRenderers","EditorConfig","SlotInputRenderer","TextInputRenderer","SelectInputRenderer","TextareaInputRenderer","NumberInputRenderer","DefaultLexicalConfig","LexicalInputRenderer","BooleanInputRenderer","GridLayoutInputRenderer","FileInputRenderer","FragmentSelectorInputRenderer","ObjectInputRenderer","ColorPickerInputRenderer"],"mappings":";;;;;;;;;;;;;;;AAgBO,MAAMA,wBAAwB,IAC1B,WAAP,GACI,wDACI,oBAACC,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWC;sBAEf,oBAACD,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWE;sBAEf,oBAACF,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWG;sBAEf,oBAACH,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWI;sBAEf,oBAACJ,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWK;sBAGf,oBAACC,sBAAoBA,OAAAA,WAAAA,GACrB,oBAACN,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWO;sBAEf,oBAACP,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWQ;sBAEf,oBAACR,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWS;sBAEf,oBAACT,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWU;sBAEf,oBAACV,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWW;sBAEf,oBAACX,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWY;sBAEf,oBAACZ,aAAa,YAAY,CAAC,QAAQ;QAC/B,MAAM;QACN,WAAWa"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import react, { useCallback } from "react";
|
|
2
|
+
import { DropdownMenu } from "@webiny/admin-ui";
|
|
3
|
+
import { ReactComponent } from "@webiny/icons/content_copy.svg";
|
|
4
|
+
import { useActiveElement } from "../../../hooks/useActiveElement.js";
|
|
5
|
+
import { useDocumentEditor } from "../../../../DocumentEditor/index.js";
|
|
6
|
+
import { Commands } from "../../../index.js";
|
|
7
|
+
const CloneElementAction = ()=>{
|
|
8
|
+
const [element] = useActiveElement();
|
|
9
|
+
const editor = useDocumentEditor();
|
|
10
|
+
const onClick = useCallback(()=>{
|
|
11
|
+
if (element) editor.executeCommand(Commands.CloneElement, {
|
|
12
|
+
id: element.id
|
|
13
|
+
});
|
|
14
|
+
}, [
|
|
15
|
+
element?.id
|
|
16
|
+
]);
|
|
17
|
+
return /*#__PURE__*/ react.createElement(DropdownMenu.Item, {
|
|
18
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
19
|
+
text: "Clone",
|
|
20
|
+
onClick: onClick
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export { CloneElementAction };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=CloneElementAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseEditor/defaultConfig/Sidebar/ElementActions/CloneElementAction.js","sources":["../../../../../src/BaseEditor/defaultConfig/Sidebar/ElementActions/CloneElementAction.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { DropdownMenu } from \"@webiny/admin-ui\";\nimport { ReactComponent as ContentCopyIcon } from \"@webiny/icons/content_copy.svg\";\nimport { useActiveElement } from \"~/BaseEditor/hooks/useActiveElement.js\";\nimport { useDocumentEditor } from \"~/DocumentEditor/index.js\";\nimport { Commands } from \"~/BaseEditor/index.js\";\n\nexport const CloneElementAction = () => {\n const [element] = useActiveElement();\n const editor = useDocumentEditor();\n\n const onClick = useCallback(() => {\n if (element) {\n editor.executeCommand(Commands.CloneElement, { id: element.id });\n }\n }, [element?.id]);\n\n return <DropdownMenu.Item icon={<ContentCopyIcon />} text={\"Clone\"} onClick={onClick} />;\n};\n"],"names":["CloneElementAction","element","useActiveElement","editor","useDocumentEditor","onClick","useCallback","Commands","DropdownMenu","ContentCopyIcon"],"mappings":";;;;;;AAOO,MAAMA,qBAAqB;IAC9B,MAAM,CAACC,QAAQ,GAAGC;IAClB,MAAMC,SAASC;IAEf,MAAMC,UAAUC,YAAY;QACxB,IAAIL,SACAE,OAAO,cAAc,CAACI,SAAS,YAAY,EAAE;YAAE,IAAIN,QAAQ,EAAE;QAAC;IAEtE,GAAG;QAACA,SAAS;KAAG;IAEhB,OAAO,WAAP,GAAO,oBAACO,aAAa,IAAI;QAAC,oBAAM,oBAACC,gBAAeA;QAAK,MAAM;QAAS,SAASJ;;AACjF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import react, { useCallback } from "react";
|
|
2
|
+
import { DropdownMenu } from "@webiny/admin-ui";
|
|
3
|
+
import { ReactComponent } from "@webiny/icons/delete.svg";
|
|
4
|
+
import { useActiveElement } from "../../../hooks/useActiveElement.js";
|
|
5
|
+
import { useDocumentEditor } from "../../../../DocumentEditor/index.js";
|
|
6
|
+
import { Commands } from "../../../index.js";
|
|
7
|
+
const DeleteElementAction = ()=>{
|
|
8
|
+
const [element] = useActiveElement();
|
|
9
|
+
const editor = useDocumentEditor();
|
|
10
|
+
const onClick = useCallback(()=>{
|
|
11
|
+
if (element) editor.executeCommand(Commands.DeleteElement, {
|
|
12
|
+
id: element.id
|
|
13
|
+
});
|
|
14
|
+
}, [
|
|
15
|
+
element?.id
|
|
16
|
+
]);
|
|
17
|
+
return /*#__PURE__*/ react.createElement(DropdownMenu.Item, {
|
|
18
|
+
className: "text-destructive-primary [&_svg]:fill-destructive",
|
|
19
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
20
|
+
text: "Delete",
|
|
21
|
+
onClick: onClick
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export { DeleteElementAction };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=DeleteElementAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseEditor/defaultConfig/Sidebar/ElementActions/DeleteElementAction.js","sources":["../../../../../src/BaseEditor/defaultConfig/Sidebar/ElementActions/DeleteElementAction.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { DropdownMenu } from \"@webiny/admin-ui\";\nimport { ReactComponent as DeleteIcon } from \"@webiny/icons/delete.svg\";\nimport { useActiveElement } from \"~/BaseEditor/hooks/useActiveElement.js\";\nimport { useDocumentEditor } from \"~/DocumentEditor/index.js\";\nimport { Commands } from \"~/BaseEditor/index.js\";\n\nexport const DeleteElementAction = () => {\n const [element] = useActiveElement();\n const editor = useDocumentEditor();\n\n const onClick = useCallback(() => {\n if (element) {\n editor.executeCommand(Commands.DeleteElement, { id: element.id });\n }\n }, [element?.id]);\n\n return (\n <DropdownMenu.Item\n className={\"text-destructive-primary [&_svg]:fill-destructive\"}\n icon={<DeleteIcon />}\n text={\"Delete\"}\n onClick={onClick}\n />\n );\n};\n"],"names":["DeleteElementAction","element","useActiveElement","editor","useDocumentEditor","onClick","useCallback","Commands","DropdownMenu","DeleteIcon"],"mappings":";;;;;;AAOO,MAAMA,sBAAsB;IAC/B,MAAM,CAACC,QAAQ,GAAGC;IAClB,MAAMC,SAASC;IAEf,MAAMC,UAAUC,YAAY;QACxB,IAAIL,SACAE,OAAO,cAAc,CAACI,SAAS,aAAa,EAAE;YAAE,IAAIN,QAAQ,EAAE;QAAC;IAEvE,GAAG;QAACA,SAAS;KAAG;IAEhB,OAAO,WAAP,GACI,oBAACO,aAAa,IAAI;QACd,WAAW;QACX,oBAAM,oBAACC,gBAAUA;QACjB,MAAM;QACN,SAASJ;;AAGrB"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { useComponent } from "../../hooks/useComponent.js";
|
|
3
|
-
import { Icon } from "@webiny/admin-ui";
|
|
3
|
+
import { DropdownMenu, Icon, IconButton } from "@webiny/admin-ui";
|
|
4
4
|
import { InlineSvg } from "../Toolbar/InsertElements/InlineSvg.js";
|
|
5
|
+
import { ReactComponent } from "@webiny/icons/more_vert.svg";
|
|
6
|
+
import { ElementActions } from "../../config/ElementAction.js";
|
|
5
7
|
const ElementPreview = ({ element })=>{
|
|
6
8
|
const component = useComponent(element.component.name);
|
|
7
9
|
return /*#__PURE__*/ react.createElement("div", {
|
|
10
|
+
className: "flex items-center justify-between"
|
|
11
|
+
}, /*#__PURE__*/ react.createElement("div", {
|
|
8
12
|
className: "flex items-center gap-sm"
|
|
9
13
|
}, /*#__PURE__*/ react.createElement("div", {
|
|
10
14
|
className: "fill-accent-default"
|
|
@@ -16,7 +20,13 @@ const ElementPreview = ({ element })=>{
|
|
|
16
20
|
label: component.label ?? element.component.name
|
|
17
21
|
})), /*#__PURE__*/ react.createElement("span", {
|
|
18
22
|
className: "text-md font-semibold text-neutral-primary"
|
|
19
|
-
}, component.label ?? element.component.name))
|
|
23
|
+
}, component.label ?? element.component.name)), /*#__PURE__*/ react.createElement(DropdownMenu, {
|
|
24
|
+
trigger: /*#__PURE__*/ react.createElement(IconButton, {
|
|
25
|
+
variant: "ghost",
|
|
26
|
+
size: "sm",
|
|
27
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null)
|
|
28
|
+
})
|
|
29
|
+
}, /*#__PURE__*/ react.createElement(ElementActions, null)));
|
|
20
30
|
};
|
|
21
31
|
export { ElementPreview };
|
|
22
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEditor/defaultConfig/Sidebar/ElementPreview.js","sources":["../../../../src/BaseEditor/defaultConfig/Sidebar/ElementPreview.tsx"],"sourcesContent":["import React from \"react\";\nimport type { DocumentElement } from \"@webiny/website-builder-sdk\";\nimport { useComponent } from \"~/BaseEditor/hooks/useComponent.js\";\nimport { Icon } from \"@webiny/admin-ui\";\nimport { InlineSvg } from \"~/BaseEditor/defaultConfig/Toolbar/InsertElements/InlineSvg.js\";\n\ninterface ElementPreviewProps {\n element: DocumentElement;\n}\n\nexport const ElementPreview = ({ element }: ElementPreviewProps) => {\n const component = useComponent(element.component.name);\n\n return (\n <div className={\"flex items-center gap-sm\"}>\n
|
|
1
|
+
{"version":3,"file":"BaseEditor/defaultConfig/Sidebar/ElementPreview.js","sources":["../../../../src/BaseEditor/defaultConfig/Sidebar/ElementPreview.tsx"],"sourcesContent":["import React from \"react\";\nimport type { DocumentElement } from \"@webiny/website-builder-sdk\";\nimport { useComponent } from \"~/BaseEditor/hooks/useComponent.js\";\nimport { DropdownMenu, Icon, IconButton } from \"@webiny/admin-ui\";\nimport { InlineSvg } from \"~/BaseEditor/defaultConfig/Toolbar/InsertElements/InlineSvg.js\";\nimport { ReactComponent as MoreVerticalIcon } from \"@webiny/icons/more_vert.svg\";\nimport { ElementActions } from \"~/BaseEditor/config/ElementAction.js\";\n\ninterface ElementPreviewProps {\n element: DocumentElement;\n}\n\nexport const ElementPreview = ({ element }: ElementPreviewProps) => {\n const component = useComponent(element.component.name);\n\n return (\n <div className={\"flex items-center justify-between\"}>\n <div className={\"flex items-center gap-sm\"}>\n <div className={\"fill-accent-default\"}>\n {component.image && (\n <Icon\n icon={<InlineSvg src={component.image} />}\n size={\"md\"}\n label={component.label ?? element.component.name}\n />\n )}\n </div>\n <span className={\"text-md font-semibold text-neutral-primary\"}>\n {component.label ?? element.component.name}\n </span>\n </div>\n <DropdownMenu\n trigger={<IconButton variant={\"ghost\"} size={\"sm\"} icon={<MoreVerticalIcon />} />}\n >\n <ElementActions />\n </DropdownMenu>\n </div>\n );\n};\n"],"names":["ElementPreview","element","component","useComponent","Icon","InlineSvg","DropdownMenu","IconButton","MoreVerticalIcon","ElementActions"],"mappings":";;;;;;AAYO,MAAMA,iBAAiB,CAAC,EAAEC,OAAO,EAAuB;IAC3D,MAAMC,YAAYC,aAAaF,QAAQ,SAAS,CAAC,IAAI;IAErD,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QAAI,WAAW;OACXC,UAAU,KAAK,IAAI,WAAJ,GACZ,oBAACE,MAAIA;QACD,oBAAM,oBAACC,WAASA;YAAC,KAAKH,UAAU,KAAK;;QACrC,MAAM;QACN,OAAOA,UAAU,KAAK,IAAID,QAAQ,SAAS,CAAC,IAAI;uBAI5D,oBAAC;QAAK,WAAW;OACZC,UAAU,KAAK,IAAID,QAAQ,SAAS,CAAC,IAAI,kBAGlD,oBAACK,cAAYA;QACT,uBAAS,oBAACC,YAAUA;YAAC,SAAS;YAAS,MAAM;YAAM,oBAAM,oBAACC,gBAAgBA;;qBAE1E,oBAACC,gBAAcA;AAI/B"}
|
|
@@ -6,7 +6,6 @@ import { InputRenderer } from "./InputRenderer.js";
|
|
|
6
6
|
import { ComponentManifestToAstConverter } from "@webiny/website-builder-sdk";
|
|
7
7
|
import { useSelectFromDocument } from "../../../hooks/useSelectFromDocument.js";
|
|
8
8
|
import { InfoMessage } from "../InfoMessage.js";
|
|
9
|
-
import { ElementPreview } from "../ElementPreview.js";
|
|
10
9
|
const ElementInputs = makeDecoratable("ElementInputs", ({ element })=>{
|
|
11
10
|
const component = useComponent(element.component.name);
|
|
12
11
|
const bindings = useSelectFromDocument((document)=>document.bindings[element.id] ?? {
|
|
@@ -25,11 +24,7 @@ const ElementInputs = makeDecoratable("ElementInputs", ({ element })=>{
|
|
|
25
24
|
return /*#__PURE__*/ react.createElement(Grid, {
|
|
26
25
|
gap: "compact",
|
|
27
26
|
className: "pt-md px-sm"
|
|
28
|
-
}, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
29
|
-
span: 12
|
|
30
|
-
}, /*#__PURE__*/ react.createElement(ElementPreview, {
|
|
31
|
-
element: element
|
|
32
|
-
})), hasEditableInputs ? /*#__PURE__*/ react.createElement(react.Fragment, null) : /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
27
|
+
}, hasEditableInputs ? /*#__PURE__*/ react.createElement(react.Fragment, null) : /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
33
28
|
span: 12
|
|
34
29
|
}, /*#__PURE__*/ react.createElement(InfoMessage, {
|
|
35
30
|
message: "This element has no inputs."
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.js","sources":["../../../../../src/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Grid } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport type { DocumentElement } from \"@webiny/website-builder-sdk\";\nimport { useComponent } from \"~/BaseEditor/hooks/useComponent.js\";\nimport { InputRenderer } from \"./InputRenderer.js\";\nimport { ComponentManifestToAstConverter } from \"@webiny/website-builder-sdk\";\nimport { useSelectFromDocument } from \"~/BaseEditor/hooks/useSelectFromDocument.js\";\nimport { InfoMessage } from \"~/BaseEditor/defaultConfig/Sidebar/InfoMessage.js\";\
|
|
1
|
+
{"version":3,"file":"BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.js","sources":["../../../../../src/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementInputs.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Grid } from \"@webiny/admin-ui\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\nimport type { DocumentElement } from \"@webiny/website-builder-sdk\";\nimport { useComponent } from \"~/BaseEditor/hooks/useComponent.js\";\nimport { InputRenderer } from \"./InputRenderer.js\";\nimport { ComponentManifestToAstConverter } from \"@webiny/website-builder-sdk\";\nimport { useSelectFromDocument } from \"~/BaseEditor/hooks/useSelectFromDocument.js\";\nimport { InfoMessage } from \"~/BaseEditor/defaultConfig/Sidebar/InfoMessage.js\";\n\ninterface ElementInputsProps {\n element: DocumentElement;\n}\n\nexport const ElementInputs = makeDecoratable(\"ElementInputs\", ({ element }: ElementInputsProps) => {\n const component = useComponent(element.component.name);\n\n const bindings = useSelectFromDocument(\n document => {\n return document.bindings[element.id] ?? { inputs: {} };\n },\n [element.id]\n );\n\n const inputsAst = useMemo(() => {\n return ComponentManifestToAstConverter.convert(component.inputs ?? []);\n }, [component.name, element.id]);\n\n const hasEditableInputs = useMemo(() => {\n return inputsAst.filter(input => input.type !== \"slot\").length > 0;\n }, [inputsAst]);\n\n if (!element) {\n return null;\n }\n\n return (\n <Grid gap={\"compact\"} className={\"pt-md px-sm\"}>\n {!hasEditableInputs ? (\n <Grid.Column span={12}>\n <InfoMessage message={\"This element has no inputs.\"} />\n </Grid.Column>\n ) : (\n <></>\n )}\n\n <InputRenderer key={element.id} ast={inputsAst} bindings={bindings.inputs} />\n </Grid>\n );\n});\n\n// interface ElementInputProps {\n// element: DocumentElement;\n// input: ComponentInput;\n// }\n//\n// const ElementInput = ({ element, input }: ElementInputProps) => {\n// const Renderer = useInputRenderer(input.renderer || \"__unknown__\");\n//\n// const { value, onChange, onPreviewChange, setBindingType } = useInputValue(element, input);\n//\n// /* return (\n// <Renderer\n// value={value.static}\n// input={input}\n// onChange={onChange}\n// onPreviewChange={onPreviewChange}\n// />\n// );*/\n// if (value.expression) {\n// return (\n// <WithBindingToggle type={\"expression\"} setBindingType={setBindingType}>\n// <ExpressionRenderer\n// element={element}\n// value={value.expression}\n// onChange={onChange}\n// input={input}\n// />\n// </WithBindingToggle>\n// );\n// }\n//\n// return (\n// <WithBindingToggle type={\"static\"} setBindingType={setBindingType}>\n// <Renderer\n// value={value.static}\n// input={input}\n// onChange={onChange}\n// onPreviewChange={onPreviewChange}\n// />\n// </WithBindingToggle>\n// );\n// };\n"],"names":["ElementInputs","makeDecoratable","element","component","useComponent","bindings","useSelectFromDocument","document","inputsAst","useMemo","ComponentManifestToAstConverter","hasEditableInputs","input","Grid","InfoMessage","InputRenderer"],"mappings":";;;;;;;;AAcO,MAAMA,gBAAgBC,gBAAgB,iBAAiB,CAAC,EAAEC,OAAO,EAAsB;IAC1F,MAAMC,YAAYC,aAAaF,QAAQ,SAAS,CAAC,IAAI;IAErD,MAAMG,WAAWC,sBACbC,CAAAA,WACWA,SAAS,QAAQ,CAACL,QAAQ,EAAE,CAAC,IAAI;YAAE,QAAQ,CAAC;QAAE,GAEzD;QAACA,QAAQ,EAAE;KAAC;IAGhB,MAAMM,YAAYC,QAAQ,IACfC,gCAAgC,OAAO,CAACP,UAAU,MAAM,IAAI,EAAE,GACtE;QAACA,UAAU,IAAI;QAAED,QAAQ,EAAE;KAAC;IAE/B,MAAMS,oBAAoBF,QAAQ,IACvBD,UAAU,MAAM,CAACI,CAAAA,QAASA,AAAe,WAAfA,MAAM,IAAI,EAAa,MAAM,GAAG,GAClE;QAACJ;KAAU;IAEd,IAAI,CAACN,SACD,OAAO;IAGX,OAAO,WAAP,GACI,oBAACW,MAAIA;QAAC,KAAK;QAAW,WAAW;OAC5B,AAACF,oB,cAKE,4CALkB,WAApBA,GACE,oBAACE,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,aAAWA;QAAC,SAAS;SAG1B,cAGJ,oBAACC,eAAaA;QAAC,KAAKb,QAAQ,EAAE;QAAE,KAAKM;QAAW,UAAUH,SAAS,MAAM;;AAGrF"}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
+
import { Grid } from "@webiny/admin-ui";
|
|
2
3
|
import { useActiveElement } from "../../../hooks/useActiveElement.js";
|
|
3
4
|
import { ElementInputs } from "./ElementInputs.js";
|
|
5
|
+
import { ElementPreview } from "../ElementPreview.js";
|
|
4
6
|
const ElementSettings = ()=>{
|
|
5
7
|
const [element] = useActiveElement();
|
|
6
8
|
if (!element) return null;
|
|
7
|
-
return /*#__PURE__*/ react.createElement(
|
|
9
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Grid, {
|
|
10
|
+
gap: "compact",
|
|
11
|
+
className: "pt-md px-sm"
|
|
12
|
+
}, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
13
|
+
span: 12
|
|
14
|
+
}, /*#__PURE__*/ react.createElement(ElementPreview, {
|
|
8
15
|
element: element
|
|
9
|
-
})
|
|
16
|
+
}))), /*#__PURE__*/ react.createElement(ElementInputs, {
|
|
17
|
+
element: element
|
|
18
|
+
}));
|
|
10
19
|
};
|
|
11
20
|
export { ElementSettings };
|
|
12
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementSettings.js","sources":["../../../../../src/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementSettings.tsx"],"sourcesContent":["import React from \"react\";\nimport { useActiveElement } from \"~/BaseEditor/hooks/useActiveElement.js\";\nimport { ElementInputs } from \"./ElementInputs.js\";\n\nexport const ElementSettings = () => {\n const [element] = useActiveElement();\n\n if (!element) {\n return null;\n }\n\n return <ElementInputs element={element}
|
|
1
|
+
{"version":3,"file":"BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementSettings.js","sources":["../../../../../src/BaseEditor/defaultConfig/Sidebar/ElementSettings/ElementSettings.tsx"],"sourcesContent":["import React from \"react\";\nimport { Grid } from \"@webiny/admin-ui\";\nimport { useActiveElement } from \"~/BaseEditor/hooks/useActiveElement.js\";\nimport { ElementInputs } from \"./ElementInputs.js\";\nimport { ElementPreview } from \"../ElementPreview.js\";\n\nexport const ElementSettings = () => {\n const [element] = useActiveElement();\n\n if (!element) {\n return null;\n }\n\n return (\n <>\n <Grid gap={\"compact\"} className={\"pt-md px-sm\"}>\n <Grid.Column span={12}>\n <ElementPreview element={element} />\n </Grid.Column>\n </Grid>\n <ElementInputs element={element} />\n </>\n );\n};\n"],"names":["ElementSettings","element","useActiveElement","Grid","ElementPreview","ElementInputs"],"mappings":";;;;;AAMO,MAAMA,kBAAkB;IAC3B,MAAM,CAACC,QAAQ,GAAGC;IAElB,IAAI,CAACD,SACD,OAAO;IAGX,OAAO,WAAP,GACI,wDACI,oBAACE,MAAIA;QAAC,KAAK;QAAW,WAAW;qBAC7B,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,gBAAcA;QAAC,SAASH;wBAGjC,oBAACI,eAAaA;QAAC,SAASJ;;AAGpC"}
|
package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundColor.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export declare const BackgroundColor: (({ elementId }: {
|
|
3
3
|
elementId: string;
|
|
4
|
-
}) => React.JSX.Element) & {
|
|
5
|
-
|
|
4
|
+
}) => React.JSX.Element) & React.NamedExoticComponent<{
|
|
5
|
+
elementId: string;
|
|
6
|
+
}> & {
|
|
7
|
+
readonly type: ({ elementId }: {
|
|
8
|
+
elementId: string;
|
|
9
|
+
}) => React.JSX.Element;
|
|
6
10
|
};
|
package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundImage.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import React from "react";
|
|
|
2
2
|
export declare const parseValue: (value: string) => undefined;
|
|
3
3
|
export declare const BackgroundImage: (({ elementId }: {
|
|
4
4
|
elementId: string;
|
|
5
|
-
}) => React.JSX.Element) & {
|
|
6
|
-
|
|
5
|
+
}) => React.JSX.Element) & React.NamedExoticComponent<{
|
|
6
|
+
elementId: string;
|
|
7
|
+
}> & {
|
|
8
|
+
readonly type: ({ elementId }: {
|
|
9
|
+
elementId: string;
|
|
10
|
+
}) => React.JSX.Element;
|
|
7
11
|
};
|
package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundPosition.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export declare const BackgroundPosition: (({ elementId }: {
|
|
3
3
|
elementId: string;
|
|
4
|
-
}) => React.JSX.Element) & {
|
|
5
|
-
|
|
4
|
+
}) => React.JSX.Element) & React.NamedExoticComponent<{
|
|
5
|
+
elementId: string;
|
|
6
|
+
}> & {
|
|
7
|
+
readonly type: ({ elementId }: {
|
|
8
|
+
elementId: string;
|
|
9
|
+
}) => React.JSX.Element;
|
|
6
10
|
};
|
package/BaseEditor/defaultConfig/Sidebar/StyleSettings/Groups/Background/BackgroundScaling.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export declare const BackgroundScaling: (({ elementId }: {
|
|
3
3
|
elementId: string;
|
|
4
|
-
}) => React.JSX.Element) & {
|
|
5
|
-
|
|
4
|
+
}) => React.JSX.Element) & React.NamedExoticComponent<{
|
|
5
|
+
elementId: string;
|
|
6
|
+
}> & {
|
|
7
|
+
readonly type: ({ elementId }: {
|
|
8
|
+
elementId: string;
|
|
9
|
+
}) => React.JSX.Element;
|
|
6
10
|
};
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
interface BorderColorProps {
|
|
3
3
|
elementId: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const BorderColor: (({ elementId }: BorderColorProps) => React.JSX.Element) & {
|
|
6
|
-
|
|
5
|
+
export declare const BorderColor: (({ elementId }: BorderColorProps) => React.JSX.Element) & React.NamedExoticComponent<BorderColorProps> & {
|
|
6
|
+
readonly type: ({ elementId }: BorderColorProps) => React.JSX.Element;
|
|
7
7
|
};
|
|
8
8
|
export {};
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
interface BorderRadiusProps {
|
|
3
3
|
elementId: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const BorderRadius: (({ elementId }: BorderRadiusProps) => React.JSX.Element) & {
|
|
6
|
-
|
|
5
|
+
export declare const BorderRadius: (({ elementId }: BorderRadiusProps) => React.JSX.Element) & React.NamedExoticComponent<BorderRadiusProps> & {
|
|
6
|
+
readonly type: ({ elementId }: BorderRadiusProps) => React.JSX.Element;
|
|
7
7
|
};
|
|
8
8
|
export {};
|