@gravity-ui/page-constructor 6.3.2-alpha.0 → 6.3.2-alpha.3
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/build/cjs/blocks/CardLayout/index.d.ts +1 -1
- package/build/cjs/blocks/CardLayout/index.js.map +1 -1
- package/build/cjs/blocks/ContentLayout/index.d.ts +1 -1
- package/build/cjs/blocks/ExtendedFeatures/index.d.ts +1 -1
- package/build/cjs/blocks/FilterBlock/index.d.ts +1 -1
- package/build/cjs/blocks/Form/index.d.ts +1 -1
- package/build/cjs/blocks/Header/dynamic-form.d.ts +1 -1
- package/build/cjs/blocks/Header/dynamic-form.js.map +1 -1
- package/build/cjs/blocks/Header/index.d.ts +1 -1
- package/build/cjs/blocks/HeaderSlider/index.d.ts +1 -1
- package/build/cjs/blocks/Icons/index.d.ts +1 -1
- package/build/cjs/blocks/Info/index.d.ts +1 -1
- package/build/cjs/blocks/Map/index.d.ts +1 -1
- package/build/cjs/blocks/Media/index.d.ts +1 -1
- package/build/cjs/blocks/PromoFeaturesBlock/index.d.ts +1 -1
- package/build/cjs/blocks/Questions/index.d.ts +1 -1
- package/build/cjs/blocks/Share/index.d.ts +1 -1
- package/build/cjs/blocks/Slider/dynamic-form.d.ts +1 -1
- package/build/cjs/blocks/Slider/dynamic-form.js.map +1 -1
- package/build/cjs/blocks/Slider/index.d.ts +1 -1
- package/build/cjs/blocks/Table/index.d.ts +1 -1
- package/build/cjs/blocks/Tabs/index.d.ts +1 -1
- package/build/cjs/blocks/TestEditorBlock/form.d.ts +1 -1
- package/build/cjs/blocks/TestEditorBlock/form.js.map +1 -1
- package/build/cjs/blocks/TestEditorBlock/index.d.ts +1 -1
- package/build/cjs/common/postMessage.d.ts +4 -0
- package/build/cjs/common/postMessage.js +31 -0
- package/build/cjs/common/postMessage.js.map +1 -0
- package/build/cjs/common/store.d.ts +40 -0
- package/build/cjs/common/store.js +20 -0
- package/build/cjs/common/store.js.map +1 -0
- package/build/cjs/common/types/actions.d.ts +36 -0
- package/build/cjs/common/types/actions.js +3 -0
- package/build/cjs/common/types/actions.js.map +1 -0
- package/build/cjs/common/types/common.d.ts +5 -0
- package/build/cjs/common/types/common.js +3 -0
- package/build/cjs/common/types/common.js.map +1 -0
- package/build/cjs/common/types/forms.d.ts +97 -0
- package/build/cjs/common/types/forms.js +3 -0
- package/build/cjs/common/types/forms.js.map +1 -0
- package/build/cjs/common/types/index.d.ts +4 -0
- package/build/cjs/common/types/index.js +8 -0
- package/build/cjs/common/types/index.js.map +1 -0
- package/build/cjs/common/types/messages.d.ts +9 -0
- package/build/cjs/common/types/messages.js +3 -0
- package/build/cjs/common/types/messages.js.map +1 -0
- package/build/cjs/common/utils.d.ts +25 -0
- package/build/cjs/common/utils.js +22 -0
- package/build/cjs/common/utils.js.map +1 -0
- package/build/cjs/components/Image/dynamic-form.d.ts +1 -1
- package/build/cjs/components/Image/dynamic-form.js.map +1 -1
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/constructor-items.js.map +1 -1
- package/build/cjs/context/editorStoreContext/PCEditorStoreContext.d.ts +1 -1
- package/build/cjs/context/editorStoreContext/PCEditorStoreContext.js +1 -1
- package/build/cjs/context/editorStoreContext/PCEditorStoreContext.js.map +1 -1
- package/build/cjs/context/editorStoreContext/PCEditorStoreProvider.js +1 -1
- package/build/cjs/context/editorStoreContext/PCEditorStoreProvider.js.map +1 -1
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.css +0 -0
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.d.ts +9 -0
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.js +115 -0
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.css +76 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.d.ts +12 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.js +27 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.css +37 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.d.ts +11 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.js +68 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.d.ts +10 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js +22 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.css +3 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.d.ts +8 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js +13 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.d.ts +8 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.js +16 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.d.ts +10 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.js +12 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.css +6 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.d.ts +9 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js +35 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.css +3 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.d.ts +11 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.js +14 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.d.ts +8 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.js +13 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.d.ts +8 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js +13 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/utils.d.ts +3 -0
- package/build/cjs/editor-v2/components/DynamicForm/utils.js +23 -0
- package/build/cjs/editor-v2/components/DynamicForm/utils.js.map +1 -0
- package/build/cjs/editor-v2/components/Panels/Panels.css +24 -0
- package/build/cjs/editor-v2/components/Panels/Panels.d.ts +8 -0
- package/build/cjs/editor-v2/components/Panels/Panels.js +28 -0
- package/build/cjs/editor-v2/components/Panels/Panels.js.map +1 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.css +14 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.d.ts +10 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.js +13 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.js.map +1 -0
- package/build/cjs/editor-v2/components/Tabs/Tabs.css +31 -0
- package/build/cjs/editor-v2/components/Tabs/Tabs.d.ts +13 -0
- package/build/cjs/editor-v2/components/Tabs/Tabs.js +32 -0
- package/build/cjs/editor-v2/components/Tabs/Tabs.js.map +1 -0
- package/build/cjs/editor-v2/constants.d.ts +1 -0
- package/build/cjs/editor-v2/constants.js +5 -0
- package/build/cjs/editor-v2/constants.js.map +1 -0
- package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.css +22 -0
- package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.d.ts +4 -0
- package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.js +58 -0
- package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.js.map +1 -0
- package/build/cjs/editor-v2/containers/BlockConfigForm/BlockConfigForm.css +20 -0
- package/build/cjs/editor-v2/containers/BlockConfigForm/BlockConfigForm.d.ts +5 -0
- package/build/cjs/editor-v2/containers/BlockConfigForm/BlockConfigForm.js +28 -0
- package/build/cjs/editor-v2/containers/BlockConfigForm/BlockConfigForm.js.map +1 -0
- package/build/cjs/editor-v2/containers/BlocksList/BlocksList.css +52 -0
- package/build/cjs/editor-v2/containers/BlocksList/BlocksList.d.ts +2 -0
- package/build/cjs/editor-v2/containers/BlocksList/BlocksList.js +43 -0
- package/build/cjs/editor-v2/containers/BlocksList/BlocksList.js.map +1 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.css +38 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.d.ts +21 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.js +41 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.js.map +1 -0
- package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.css +9 -0
- package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.d.ts +5 -0
- package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.js +17 -0
- package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.js.map +1 -0
- package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.css +49 -0
- package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.d.ts +7 -0
- package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.js +34 -0
- package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.js.map +1 -0
- package/build/cjs/editor-v2/containers/Overlay/Overlay.css +64 -0
- package/build/cjs/editor-v2/containers/Overlay/Overlay.d.ts +6 -0
- package/build/cjs/editor-v2/containers/Overlay/Overlay.js +90 -0
- package/build/cjs/editor-v2/containers/Overlay/Overlay.js.map +1 -0
- package/build/cjs/editor-v2/containers/Source/Source.css +14 -0
- package/build/cjs/editor-v2/containers/Source/Source.d.ts +2 -0
- package/build/cjs/editor-v2/containers/Source/Source.js +28 -0
- package/build/cjs/editor-v2/containers/Source/Source.js.map +1 -0
- package/build/cjs/editor-v2/containers/SourceCode/SourceCode.css +37 -0
- package/build/cjs/editor-v2/containers/SourceCode/SourceCode.d.ts +6 -0
- package/build/cjs/editor-v2/containers/SourceCode/SourceCode.js +41 -0
- package/build/cjs/editor-v2/containers/SourceCode/SourceCode.js.map +1 -0
- package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.css +3 -0
- package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.d.ts +7 -0
- package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js +18 -0
- package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js.map +1 -0
- package/build/cjs/editor-v2/containers/Tree/DragContext.css +25 -0
- package/build/cjs/editor-v2/containers/Tree/DragContext.d.ts +14 -0
- package/build/cjs/editor-v2/containers/Tree/DragContext.js +49 -0
- package/build/cjs/editor-v2/containers/Tree/DragContext.js.map +1 -0
- package/build/cjs/editor-v2/containers/Tree/Tree.css +10 -0
- package/build/cjs/editor-v2/containers/Tree/Tree.d.ts +2 -0
- package/build/cjs/editor-v2/containers/Tree/Tree.js +36 -0
- package/build/cjs/editor-v2/containers/Tree/Tree.js.map +1 -0
- package/build/cjs/editor-v2/containers/Tree/TreeContent.css +12 -0
- package/build/cjs/editor-v2/containers/Tree/TreeContent.d.ts +16 -0
- package/build/cjs/editor-v2/containers/Tree/TreeContent.js +61 -0
- package/build/cjs/editor-v2/containers/Tree/TreeContent.js.map +1 -0
- package/build/cjs/editor-v2/containers/Tree/TreeItem.css +50 -0
- package/build/cjs/editor-v2/containers/Tree/TreeItem.d.ts +13 -0
- package/build/cjs/editor-v2/containers/Tree/TreeItem.js +144 -0
- package/build/cjs/editor-v2/containers/Tree/TreeItem.js.map +1 -0
- package/build/cjs/editor-v2/containers/Tree/index.d.ts +4 -0
- package/build/cjs/editor-v2/containers/Tree/index.js +10 -0
- package/build/cjs/editor-v2/containers/Tree/index.js.map +1 -0
- package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.css +13 -0
- package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.d.ts +3 -0
- package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.js +54 -0
- package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.js.map +1 -0
- package/build/cjs/editor-v2/containers/index.d.ts +7 -0
- package/build/cjs/editor-v2/containers/index.js +19 -0
- package/build/cjs/editor-v2/containers/index.js.map +1 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreContext.d.ts +7 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreContext.js +10 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreContext.js.map +1 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreProvider.d.ts +5 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreProvider.js +35 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreProvider.js.map +1 -0
- package/build/cjs/editor-v2/context/editorStore/index.d.ts +2 -0
- package/build/cjs/editor-v2/context/editorStore/index.js +6 -0
- package/build/cjs/editor-v2/context/editorStore/index.js.map +1 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeContext.d.ts +12 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeContext.js +14 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeContext.js.map +1 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeProvider.d.ts +7 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeProvider.js +21 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeProvider.js.map +1 -0
- package/build/cjs/editor-v2/context/iframeContext/index.d.ts +2 -0
- package/build/cjs/editor-v2/context/iframeContext/index.js +6 -0
- package/build/cjs/editor-v2/context/iframeContext/index.js.map +1 -0
- package/build/cjs/editor-v2/hooks/index.d.ts +2 -0
- package/build/cjs/editor-v2/hooks/index.js +8 -0
- package/build/cjs/editor-v2/hooks/index.js.map +1 -0
- package/build/cjs/editor-v2/hooks/useEditorTabs.d.ts +16 -0
- package/build/cjs/editor-v2/hooks/useEditorTabs.js +77 -0
- package/build/cjs/editor-v2/hooks/useEditorTabs.js.map +1 -0
- package/build/cjs/editor-v2/hooks/useMainEditorInitialize.d.ts +2 -0
- package/build/cjs/editor-v2/hooks/useMainEditorInitialize.js +31 -0
- package/build/cjs/editor-v2/hooks/useMainEditorInitialize.js.map +1 -0
- package/build/cjs/editor-v2/hooks/useMainEditorStore.d.ts +1 -0
- package/build/cjs/editor-v2/hooks/useMainEditorStore.js +13 -0
- package/build/cjs/editor-v2/hooks/useMainEditorStore.js.map +1 -0
- package/build/cjs/editor-v2/hooks/usePostMessageEvents.d.ts +6 -0
- package/build/cjs/editor-v2/hooks/usePostMessageEvents.js +19 -0
- package/build/cjs/editor-v2/hooks/usePostMessageEvents.js.map +1 -0
- package/build/cjs/editor-v2/index.d.ts +5 -0
- package/build/cjs/editor-v2/index.js +9 -0
- package/build/cjs/editor-v2/index.js.map +1 -0
- package/build/cjs/editor-v2/store.d.ts +48 -0
- package/build/cjs/editor-v2/store.js +181 -0
- package/build/cjs/editor-v2/store.js.map +1 -0
- package/build/cjs/editor-v2/styles/mixins.css +0 -0
- package/build/cjs/editor-v2/styles/root.css +9 -0
- package/build/cjs/editor-v2/styles/variables.css +0 -0
- package/build/cjs/editor-v2/utils/cn.d.ts +2 -0
- package/build/cjs/editor-v2/utils/cn.js +7 -0
- package/build/cjs/editor-v2/utils/cn.js.map +1 -0
- package/build/cjs/editor-v2/utils/code.d.ts +6 -0
- package/build/cjs/editor-v2/utils/code.js +13 -0
- package/build/cjs/editor-v2/utils/code.js.map +1 -0
- package/build/cjs/editor-v2/utils/index.d.ts +20 -0
- package/build/cjs/editor-v2/utils/index.js +161 -0
- package/build/cjs/editor-v2/utils/index.js.map +1 -0
- package/build/cjs/hooks/usePCEditorInitializeEvents.js.map +1 -1
- package/build/cjs/hooks/usePCEditorStore.d.ts +1 -1
- package/build/cjs/hooks/usePostMessageAPI.d.ts +1 -1
- package/build/cjs/hooks/usePostMessageAPI.js.map +1 -1
- package/build/cjs/sub-blocks/BackgroundCard/dynamic-form.d.ts +1 -1
- package/build/cjs/sub-blocks/BackgroundCard/dynamic-form.js.map +1 -1
- package/build/cjs/utils/form-generator.d.ts +1 -1
- package/build/cjs/utils/form-generator.js.map +1 -1
- package/build/esm/blocks/CardLayout/index.d.ts +1 -1
- package/build/esm/blocks/CardLayout/index.js.map +1 -1
- package/build/esm/blocks/ContentLayout/index.d.ts +1 -1
- package/build/esm/blocks/ExtendedFeatures/index.d.ts +1 -1
- package/build/esm/blocks/FilterBlock/index.d.ts +1 -1
- package/build/esm/blocks/Form/index.d.ts +1 -1
- package/build/esm/blocks/Header/dynamic-form.d.ts +1 -1
- package/build/esm/blocks/Header/dynamic-form.js.map +1 -1
- package/build/esm/blocks/Header/index.d.ts +1 -1
- package/build/esm/blocks/HeaderSlider/index.d.ts +1 -1
- package/build/esm/blocks/Icons/index.d.ts +1 -1
- package/build/esm/blocks/Info/index.d.ts +1 -1
- package/build/esm/blocks/Map/index.d.ts +1 -1
- package/build/esm/blocks/Media/index.d.ts +1 -1
- package/build/esm/blocks/PromoFeaturesBlock/index.d.ts +1 -1
- package/build/esm/blocks/Questions/index.d.ts +1 -1
- package/build/esm/blocks/Share/index.d.ts +1 -1
- package/build/esm/blocks/Slider/dynamic-form.d.ts +1 -1
- package/build/esm/blocks/Slider/dynamic-form.js.map +1 -1
- package/build/esm/blocks/Slider/index.d.ts +1 -1
- package/build/esm/blocks/Table/index.d.ts +1 -1
- package/build/esm/blocks/Tabs/index.d.ts +1 -1
- package/build/esm/blocks/TestEditorBlock/form.d.ts +1 -1
- package/build/esm/blocks/TestEditorBlock/form.js.map +1 -1
- package/build/esm/blocks/TestEditorBlock/index.d.ts +1 -1
- package/build/esm/common/postMessage.d.ts +4 -0
- package/build/esm/common/postMessage.js +25 -0
- package/build/esm/common/postMessage.js.map +1 -0
- package/build/esm/common/store.d.ts +40 -0
- package/build/esm/common/store.js +17 -0
- package/build/esm/common/store.js.map +1 -0
- package/build/esm/common/types/actions.d.ts +36 -0
- package/build/esm/common/types/actions.js +2 -0
- package/build/esm/common/types/actions.js.map +1 -0
- package/build/esm/common/types/common.d.ts +5 -0
- package/build/esm/common/types/common.js +2 -0
- package/build/esm/common/types/common.js.map +1 -0
- package/build/esm/common/types/forms.d.ts +97 -0
- package/build/esm/common/types/forms.js +2 -0
- package/build/esm/common/types/forms.js.map +1 -0
- package/build/esm/common/types/index.d.ts +4 -0
- package/build/esm/common/types/index.js +5 -0
- package/build/esm/common/types/index.js.map +1 -0
- package/build/esm/common/types/messages.d.ts +9 -0
- package/build/esm/common/types/messages.js +2 -0
- package/build/esm/common/types/messages.js.map +1 -0
- package/build/esm/common/utils.d.ts +25 -0
- package/build/esm/common/utils.js +17 -0
- package/build/esm/common/utils.js.map +1 -0
- package/build/esm/components/Image/dynamic-form.d.ts +1 -1
- package/build/esm/components/Image/dynamic-form.js.map +1 -1
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/constructor-items.js.map +1 -1
- package/build/esm/context/editorStoreContext/PCEditorStoreContext.d.ts +1 -1
- package/build/esm/context/editorStoreContext/PCEditorStoreContext.js +1 -1
- package/build/esm/context/editorStoreContext/PCEditorStoreContext.js.map +1 -1
- package/build/esm/context/editorStoreContext/PCEditorStoreProvider.js +1 -1
- package/build/esm/context/editorStoreContext/PCEditorStoreProvider.js.map +1 -1
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.css +0 -0
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.d.ts +10 -0
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.js +113 -0
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.css +76 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.d.ts +13 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.js +25 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.css +37 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.d.ts +12 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.js +66 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.d.ts +10 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js +19 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.css +3 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.d.ts +9 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js +11 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.d.ts +8 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.js +13 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.d.ts +10 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.js +9 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.css +6 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.d.ts +10 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js +33 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.css +3 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.d.ts +12 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.js +12 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.d.ts +8 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.js +10 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.d.ts +8 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js +10 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/utils.d.ts +3 -0
- package/build/esm/editor-v2/components/DynamicForm/utils.js +17 -0
- package/build/esm/editor-v2/components/DynamicForm/utils.js.map +1 -0
- package/build/esm/editor-v2/components/Panels/Panels.css +24 -0
- package/build/esm/editor-v2/components/Panels/Panels.d.ts +9 -0
- package/build/esm/editor-v2/components/Panels/Panels.js +24 -0
- package/build/esm/editor-v2/components/Panels/Panels.js.map +1 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.css +14 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.d.ts +11 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.js +9 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.js.map +1 -0
- package/build/esm/editor-v2/components/Tabs/Tabs.css +31 -0
- package/build/esm/editor-v2/components/Tabs/Tabs.d.ts +14 -0
- package/build/esm/editor-v2/components/Tabs/Tabs.js +30 -0
- package/build/esm/editor-v2/components/Tabs/Tabs.js.map +1 -0
- package/build/esm/editor-v2/constants.d.ts +1 -0
- package/build/esm/editor-v2/constants.js +2 -0
- package/build/esm/editor-v2/constants.js.map +1 -0
- package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.css +22 -0
- package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.d.ts +5 -0
- package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.js +56 -0
- package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.js.map +1 -0
- package/build/esm/editor-v2/containers/BlockConfigForm/BlockConfigForm.css +20 -0
- package/build/esm/editor-v2/containers/BlockConfigForm/BlockConfigForm.d.ts +6 -0
- package/build/esm/editor-v2/containers/BlockConfigForm/BlockConfigForm.js +26 -0
- package/build/esm/editor-v2/containers/BlockConfigForm/BlockConfigForm.js.map +1 -0
- package/build/esm/editor-v2/containers/BlocksList/BlocksList.css +52 -0
- package/build/esm/editor-v2/containers/BlocksList/BlocksList.d.ts +3 -0
- package/build/esm/editor-v2/containers/BlocksList/BlocksList.js +41 -0
- package/build/esm/editor-v2/containers/BlocksList/BlocksList.js.map +1 -0
- package/build/esm/editor-v2/containers/Editor/Editor.css +38 -0
- package/build/esm/editor-v2/containers/Editor/Editor.d.ts +22 -0
- package/build/esm/editor-v2/containers/Editor/Editor.js +37 -0
- package/build/esm/editor-v2/containers/Editor/Editor.js.map +1 -0
- package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.css +9 -0
- package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.d.ts +6 -0
- package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.js +15 -0
- package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.js.map +1 -0
- package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.css +49 -0
- package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.d.ts +8 -0
- package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.js +32 -0
- package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.js.map +1 -0
- package/build/esm/editor-v2/containers/Overlay/Overlay.css +64 -0
- package/build/esm/editor-v2/containers/Overlay/Overlay.d.ts +7 -0
- package/build/esm/editor-v2/containers/Overlay/Overlay.js +88 -0
- package/build/esm/editor-v2/containers/Overlay/Overlay.js.map +1 -0
- package/build/esm/editor-v2/containers/Source/Source.css +14 -0
- package/build/esm/editor-v2/containers/Source/Source.d.ts +3 -0
- package/build/esm/editor-v2/containers/Source/Source.js +26 -0
- package/build/esm/editor-v2/containers/Source/Source.js.map +1 -0
- package/build/esm/editor-v2/containers/SourceCode/SourceCode.css +37 -0
- package/build/esm/editor-v2/containers/SourceCode/SourceCode.d.ts +7 -0
- package/build/esm/editor-v2/containers/SourceCode/SourceCode.js +39 -0
- package/build/esm/editor-v2/containers/SourceCode/SourceCode.js.map +1 -0
- package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.css +3 -0
- package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.d.ts +8 -0
- package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js +14 -0
- package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js.map +1 -0
- package/build/esm/editor-v2/containers/Tree/DragContext.css +25 -0
- package/build/esm/editor-v2/containers/Tree/DragContext.d.ts +15 -0
- package/build/esm/editor-v2/containers/Tree/DragContext.js +45 -0
- package/build/esm/editor-v2/containers/Tree/DragContext.js.map +1 -0
- package/build/esm/editor-v2/containers/Tree/Tree.css +10 -0
- package/build/esm/editor-v2/containers/Tree/Tree.d.ts +3 -0
- package/build/esm/editor-v2/containers/Tree/Tree.js +34 -0
- package/build/esm/editor-v2/containers/Tree/Tree.js.map +1 -0
- package/build/esm/editor-v2/containers/Tree/TreeContent.css +12 -0
- package/build/esm/editor-v2/containers/Tree/TreeContent.d.ts +17 -0
- package/build/esm/editor-v2/containers/Tree/TreeContent.js +57 -0
- package/build/esm/editor-v2/containers/Tree/TreeContent.js.map +1 -0
- package/build/esm/editor-v2/containers/Tree/TreeItem.css +50 -0
- package/build/esm/editor-v2/containers/Tree/TreeItem.d.ts +14 -0
- package/build/esm/editor-v2/containers/Tree/TreeItem.js +140 -0
- package/build/esm/editor-v2/containers/Tree/TreeItem.js.map +1 -0
- package/build/esm/editor-v2/containers/Tree/index.d.ts +4 -0
- package/build/esm/editor-v2/containers/Tree/index.js +5 -0
- package/build/esm/editor-v2/containers/Tree/index.js.map +1 -0
- package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.css +13 -0
- package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.d.ts +4 -0
- package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.js +52 -0
- package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.js.map +1 -0
- package/build/esm/editor-v2/containers/index.d.ts +7 -0
- package/build/esm/editor-v2/containers/index.js +8 -0
- package/build/esm/editor-v2/containers/index.js.map +1 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreContext.d.ts +7 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreContext.js +6 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreContext.js.map +1 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreProvider.d.ts +5 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreProvider.js +30 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreProvider.js.map +1 -0
- package/build/esm/editor-v2/context/editorStore/index.d.ts +2 -0
- package/build/esm/editor-v2/context/editorStore/index.js +3 -0
- package/build/esm/editor-v2/context/editorStore/index.js.map +1 -0
- package/build/esm/editor-v2/context/iframeContext/IframeContext.d.ts +12 -0
- package/build/esm/editor-v2/context/iframeContext/IframeContext.js +10 -0
- package/build/esm/editor-v2/context/iframeContext/IframeContext.js.map +1 -0
- package/build/esm/editor-v2/context/iframeContext/IframeProvider.d.ts +7 -0
- package/build/esm/editor-v2/context/iframeContext/IframeProvider.js +16 -0
- package/build/esm/editor-v2/context/iframeContext/IframeProvider.js.map +1 -0
- package/build/esm/editor-v2/context/iframeContext/index.d.ts +2 -0
- package/build/esm/editor-v2/context/iframeContext/index.js +3 -0
- package/build/esm/editor-v2/context/iframeContext/index.js.map +1 -0
- package/build/esm/editor-v2/hooks/index.d.ts +2 -0
- package/build/esm/editor-v2/hooks/index.js +3 -0
- package/build/esm/editor-v2/hooks/index.js.map +1 -0
- package/build/esm/editor-v2/hooks/useEditorTabs.d.ts +16 -0
- package/build/esm/editor-v2/hooks/useEditorTabs.js +72 -0
- package/build/esm/editor-v2/hooks/useEditorTabs.js.map +1 -0
- package/build/esm/editor-v2/hooks/useMainEditorInitialize.d.ts +2 -0
- package/build/esm/editor-v2/hooks/useMainEditorInitialize.js +29 -0
- package/build/esm/editor-v2/hooks/useMainEditorInitialize.js.map +1 -0
- package/build/esm/editor-v2/hooks/useMainEditorStore.d.ts +1 -0
- package/build/esm/editor-v2/hooks/useMainEditorStore.js +8 -0
- package/build/esm/editor-v2/hooks/useMainEditorStore.js.map +1 -0
- package/build/esm/editor-v2/hooks/usePostMessageEvents.d.ts +6 -0
- package/build/esm/editor-v2/hooks/usePostMessageEvents.js +15 -0
- package/build/esm/editor-v2/hooks/usePostMessageEvents.js.map +1 -0
- package/build/esm/editor-v2/index.d.ts +5 -0
- package/build/esm/editor-v2/index.js +6 -0
- package/build/esm/editor-v2/index.js.map +1 -0
- package/build/esm/editor-v2/store.d.ts +48 -0
- package/build/esm/editor-v2/store.js +177 -0
- package/build/esm/editor-v2/store.js.map +1 -0
- package/build/esm/editor-v2/styles/mixins.css +0 -0
- package/build/esm/editor-v2/styles/root.css +9 -0
- package/build/esm/editor-v2/styles/variables.css +0 -0
- package/build/esm/editor-v2/utils/cn.d.ts +2 -0
- package/build/esm/editor-v2/utils/cn.js +4 -0
- package/build/esm/editor-v2/utils/cn.js.map +1 -0
- package/build/esm/editor-v2/utils/code.d.ts +6 -0
- package/build/esm/editor-v2/utils/code.js +9 -0
- package/build/esm/editor-v2/utils/code.js.map +1 -0
- package/build/esm/editor-v2/utils/index.d.ts +20 -0
- package/build/esm/editor-v2/utils/index.js +143 -0
- package/build/esm/editor-v2/utils/index.js.map +1 -0
- package/build/esm/hooks/usePCEditorInitializeEvents.js.map +1 -1
- package/build/esm/hooks/usePCEditorStore.d.ts +1 -1
- package/build/esm/hooks/usePostMessageAPI.d.ts +1 -1
- package/build/esm/hooks/usePostMessageAPI.js.map +1 -1
- package/build/esm/sub-blocks/BackgroundCard/dynamic-form.d.ts +1 -1
- package/build/esm/sub-blocks/BackgroundCard/dynamic-form.js.map +1 -1
- package/build/esm/utils/form-generator.d.ts +1 -1
- package/build/esm/utils/form-generator.js.map +1 -1
- package/package.json +1 -2
- package/widget/index.js +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context for iframe window
|
|
3
|
+
**/
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
export interface IframeContextProps {
|
|
6
|
+
iframeElement?: HTMLIFrameElement;
|
|
7
|
+
setIframeElement: (element: HTMLIFrameElement) => void;
|
|
8
|
+
url: string;
|
|
9
|
+
setUrl: (url: string) => void;
|
|
10
|
+
disableUrlField?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const IframeContext: React.Context<IframeContextProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IframeContext.js","sourceRoot":"../../../../../src","sources":["editor-v2/context/iframeContext/IframeContext.tsx"],"names":[],"mappings":"AAAA;;IAEI;AAEJ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAqB;IACjE,gBAAgB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC1B,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;IAChB,GAAG,EAAE,EAAE;CACV,CAAC,CAAC","sourcesContent":["/**\n * Context for iframe window\n **/\n\nimport * as React from 'react';\n\nexport interface IframeContextProps {\n iframeElement?: HTMLIFrameElement;\n setIframeElement: (element: HTMLIFrameElement) => void;\n url: string;\n setUrl: (url: string) => void;\n disableUrlField?: boolean;\n}\n\nexport const IframeContext = React.createContext<IframeContextProps>({\n setIframeElement: () => {},\n setUrl: () => {},\n url: '',\n});\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface IframeProviderProps extends React.PropsWithChildren {
|
|
3
|
+
initialUrl?: string;
|
|
4
|
+
disableUrlField?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const IframeProvider: ({ children, initialUrl, disableUrlField, }: IframeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { IframeContext } from "./IframeContext.js";
|
|
4
|
+
export const IframeProvider = ({ children, initialUrl = '', disableUrlField, }) => {
|
|
5
|
+
const [iframeElement, setIframeElement] = React.useState();
|
|
6
|
+
const [url, setUrl] = React.useState(initialUrl);
|
|
7
|
+
const setIframeElementFunc = (element) => setIframeElement(element);
|
|
8
|
+
return (_jsx(IframeContext.Provider, { value: {
|
|
9
|
+
url,
|
|
10
|
+
setUrl,
|
|
11
|
+
iframeElement,
|
|
12
|
+
setIframeElement: setIframeElementFunc,
|
|
13
|
+
disableUrlField,
|
|
14
|
+
}, children: children }));
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=IframeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IframeProvider.js","sourceRoot":"../../../../../src","sources":["editor-v2/context/iframeContext/IframeProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAC,2BAAwB;AAO9C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC3B,QAAQ,EACR,UAAU,GAAG,EAAE,EACf,eAAe,GACG,EAAE,EAAE;IACtB,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAqB,CAAC;IAC9E,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAEjD,MAAM,oBAAoB,GAAG,CAAC,OAA0B,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAEvF,OAAO,CACH,KAAC,aAAa,CAAC,QAAQ,IACnB,KAAK,EAAE;YACH,GAAG;YACH,MAAM;YACN,aAAa;YACb,gBAAgB,EAAE,oBAAoB;YACtC,eAAe;SAClB,YAEA,QAAQ,GACY,CAC5B,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {IframeContext} from './IframeContext';\n\ninterface IframeProviderProps extends React.PropsWithChildren {\n initialUrl?: string;\n disableUrlField?: boolean;\n}\n\nexport const IframeProvider = ({\n children,\n initialUrl = '',\n disableUrlField,\n}: IframeProviderProps) => {\n const [iframeElement, setIframeElement] = React.useState<HTMLIFrameElement>();\n const [url, setUrl] = React.useState(initialUrl);\n\n const setIframeElementFunc = (element: HTMLIFrameElement) => setIframeElement(element);\n\n return (\n <IframeContext.Provider\n value={{\n url,\n setUrl,\n iframeElement,\n setIframeElement: setIframeElementFunc,\n disableUrlField,\n }}\n >\n {children}\n </IframeContext.Provider>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../../src","sources":["editor-v2/context/iframeContext/index.ts"],"names":[],"mappings":"AAAA,mCAAgC;AAChC,oCAAiC","sourcesContent":["export * from './IframeContext';\nexport * from './IframeProvider';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../src","sources":["editor-v2/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,kCAA+B;AAC5D,OAAO,EAAC,kBAAkB,EAAC,gCAA6B","sourcesContent":["export {usePostMessageEvents} from './usePostMessageEvents';\nexport {useMainEditorStore} from './useMainEditorStore';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TabsItemProps } from "../components/Tabs/Tabs.js";
|
|
2
|
+
export declare const useEditorTabs: ({ leftTabs, rightTabs, }: {
|
|
3
|
+
leftTabs?: TabsItemProps[];
|
|
4
|
+
rightTabs?: TabsItemProps[];
|
|
5
|
+
}) => {
|
|
6
|
+
left: (TabsItemProps | {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
component: ({ className }: import("../containers/GlobalConfig/GlobalConfig.js").GlobalConfigProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
})[];
|
|
11
|
+
right: (TabsItemProps | {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
component: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
})[];
|
|
16
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Tabs from "../components/Tabs/Tabs.js";
|
|
4
|
+
import BlockConfigForm from "../containers/BlockConfigForm/BlockConfigForm.js";
|
|
5
|
+
import BlocksList from "../containers/BlocksList/BlocksList.js";
|
|
6
|
+
import GlobalConfig from "../containers/GlobalConfig/GlobalConfig.js";
|
|
7
|
+
import SourceCode from "../containers/SourceCode/SourceCode.js";
|
|
8
|
+
import Tree from "../containers/Tree/index.js";
|
|
9
|
+
export const useEditorTabs = ({ leftTabs, rightTabs, }) => {
|
|
10
|
+
const tabs = React.useMemo(() => ({
|
|
11
|
+
left: [
|
|
12
|
+
{
|
|
13
|
+
id: 'page',
|
|
14
|
+
title: 'PAGE',
|
|
15
|
+
component: () => (_jsx(Tabs, { items: [
|
|
16
|
+
{
|
|
17
|
+
id: 'blocks-list',
|
|
18
|
+
title: 'BLOCKS',
|
|
19
|
+
component: BlocksList,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'layers',
|
|
23
|
+
title: 'LAYERS',
|
|
24
|
+
component: Tree,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'source-code-yaml',
|
|
28
|
+
title: 'YAML',
|
|
29
|
+
component: () => _jsx(SourceCode, { format: "yaml" }),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'source-code-json',
|
|
33
|
+
title: 'JSON',
|
|
34
|
+
component: () => _jsx(SourceCode, { format: "json" }),
|
|
35
|
+
},
|
|
36
|
+
] })),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'navigation',
|
|
40
|
+
title: 'NAVIGATION',
|
|
41
|
+
component: GlobalConfig,
|
|
42
|
+
},
|
|
43
|
+
...(leftTabs || []),
|
|
44
|
+
],
|
|
45
|
+
right: [
|
|
46
|
+
{
|
|
47
|
+
id: 'edit',
|
|
48
|
+
title: 'EDIT',
|
|
49
|
+
component: () => (_jsx(Tabs, { items: [
|
|
50
|
+
{
|
|
51
|
+
id: 'block-config',
|
|
52
|
+
title: 'INPUTS',
|
|
53
|
+
component: BlockConfigForm,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'source-code-yaml',
|
|
57
|
+
title: 'YAML',
|
|
58
|
+
component: () => _jsx(SourceCode, { format: "yaml" }),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 'source-code-json',
|
|
62
|
+
title: 'JSON',
|
|
63
|
+
component: () => _jsx(SourceCode, { format: "json" }),
|
|
64
|
+
},
|
|
65
|
+
] })),
|
|
66
|
+
},
|
|
67
|
+
...(rightTabs || []),
|
|
68
|
+
],
|
|
69
|
+
}), [leftTabs, rightTabs]);
|
|
70
|
+
return tabs;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=useEditorTabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditorTabs.js","sourceRoot":"../../../../src","sources":["editor-v2/hooks/useEditorTabs.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,IAAqB,mCAAgC;AAC5D,OAAO,eAAe,yDAAsD;AAC5E,OAAO,UAAU,+CAA4C;AAC7D,OAAO,YAAY,mDAAgD;AACnE,OAAO,UAAU,+CAA4C;AAC7D,OAAO,IAAI,oCAA2B;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC1B,QAAQ,EACR,SAAS,GAIZ,EAAE,EAAE;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CACtB,GAAG,EAAE,CAAC,CAAC;QACH,IAAI,EAAE;YACF;gBACI,EAAE,EAAE,MAAM;gBACV,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,GAAG,EAAE,CAAC,CACb,KAAC,IAAI,IACD,KAAK,EAAE;wBACH;4BACI,EAAE,EAAE,aAAa;4BACjB,KAAK,EAAE,QAAQ;4BACf,SAAS,EAAE,UAAU;yBACxB;wBACD;4BACI,EAAE,EAAE,QAAQ;4BACZ,KAAK,EAAE,QAAQ;4BACf,SAAS,EAAE,IAAI;yBAClB;wBACD;4BACI,EAAE,EAAE,kBAAkB;4BACtB,KAAK,EAAE,MAAM;4BACb,SAAS,EAAE,GAAG,EAAE,CAAC,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,GAAG;yBAChD;wBACD;4BACI,EAAE,EAAE,kBAAkB;4BACtB,KAAK,EAAE,MAAM;4BACb,SAAS,EAAE,GAAG,EAAE,CAAC,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,GAAG;yBAChD;qBACJ,GACH,CACL;aACJ;YACD;gBACI,EAAE,EAAE,YAAY;gBAChB,KAAK,EAAE,YAAY;gBACnB,SAAS,EAAE,YAAY;aAC1B;YACD,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;SACtB;QACD,KAAK,EAAE;YACH;gBACI,EAAE,EAAE,MAAM;gBACV,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,GAAG,EAAE,CAAC,CACb,KAAC,IAAI,IACD,KAAK,EAAE;wBACH;4BACI,EAAE,EAAE,cAAc;4BAClB,KAAK,EAAE,QAAQ;4BACf,SAAS,EAAE,eAAe;yBAC7B;wBACD;4BACI,EAAE,EAAE,kBAAkB;4BACtB,KAAK,EAAE,MAAM;4BACb,SAAS,EAAE,GAAG,EAAE,CAAC,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,GAAG;yBAChD;wBACD;4BACI,EAAE,EAAE,kBAAkB;4BACtB,KAAK,EAAE,MAAM;4BACb,SAAS,EAAE,GAAG,EAAE,CAAC,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,GAAG;yBAChD;qBACJ,GACH,CACL;aACJ;YACD,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC;SACvB;KACJ,CAAC,EACF,CAAC,QAAQ,EAAE,SAAS,CAAC,CACxB,CAAC;IAEF,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport Tabs, {TabsItemProps} from '../components/Tabs/Tabs';\nimport BlockConfigForm from '../containers/BlockConfigForm/BlockConfigForm';\nimport BlocksList from '../containers/BlocksList/BlocksList';\nimport GlobalConfig from '../containers/GlobalConfig/GlobalConfig';\nimport SourceCode from '../containers/SourceCode/SourceCode';\nimport Tree from '../containers/Tree';\n\nexport const useEditorTabs = ({\n leftTabs,\n rightTabs,\n}: {\n leftTabs?: TabsItemProps[];\n rightTabs?: TabsItemProps[];\n}) => {\n const tabs = React.useMemo(\n () => ({\n left: [\n {\n id: 'page',\n title: 'PAGE',\n component: () => (\n <Tabs\n items={[\n {\n id: 'blocks-list',\n title: 'BLOCKS',\n component: BlocksList,\n },\n {\n id: 'layers',\n title: 'LAYERS',\n component: Tree,\n },\n {\n id: 'source-code-yaml',\n title: 'YAML',\n component: () => <SourceCode format=\"yaml\" />,\n },\n {\n id: 'source-code-json',\n title: 'JSON',\n component: () => <SourceCode format=\"json\" />,\n },\n ]}\n />\n ),\n },\n {\n id: 'navigation',\n title: 'NAVIGATION',\n component: GlobalConfig,\n },\n ...(leftTabs || []),\n ],\n right: [\n {\n id: 'edit',\n title: 'EDIT',\n component: () => (\n <Tabs\n items={[\n {\n id: 'block-config',\n title: 'INPUTS',\n component: BlockConfigForm,\n },\n {\n id: 'source-code-yaml',\n title: 'YAML',\n component: () => <SourceCode format=\"yaml\" />,\n },\n {\n id: 'source-code-json',\n title: 'JSON',\n component: () => <SourceCode format=\"json\" />,\n },\n ]}\n />\n ),\n },\n ...(rightTabs || []),\n ],\n }),\n [leftTabs, rightTabs],\n );\n\n return tabs;\n};\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { usePostMessageAPIListener } from "../../common/postMessage.js";
|
|
2
|
+
import { useMainEditorStore } from "./useMainEditorStore.js";
|
|
3
|
+
import { usePostMessageEvents } from "./usePostMessageEvents.js";
|
|
4
|
+
const useMainEditorInitialize = () => {
|
|
5
|
+
const { requestPostMessage } = usePostMessageEvents();
|
|
6
|
+
const { initialize, setConfig, setContent, manipulateOverlayMode, disableMode, insertBlock, reorderBlock, preInsertBlockType, preReorderBlockPath, } = useMainEditorStore();
|
|
7
|
+
usePostMessageAPIListener('ON_INIT', () => {
|
|
8
|
+
initialize();
|
|
9
|
+
requestPostMessage('GET_SUPPORTED_BLOCKS', {});
|
|
10
|
+
requestPostMessage('GET_INITIAL_CONTENT', {});
|
|
11
|
+
}, [requestPostMessage]);
|
|
12
|
+
usePostMessageAPIListener('ON_INITIAL_CONTENT', (data) => {
|
|
13
|
+
setContent(data);
|
|
14
|
+
});
|
|
15
|
+
usePostMessageAPIListener('ON_SUPPORTED_BLOCKS', (data) => {
|
|
16
|
+
setConfig(data);
|
|
17
|
+
});
|
|
18
|
+
usePostMessageAPIListener('ON_MOUSE_UP', ({ path, position }) => {
|
|
19
|
+
if (manipulateOverlayMode === 'insert' && path && position && preInsertBlockType) {
|
|
20
|
+
insertBlock(path, preInsertBlockType, ['left', 'top'].includes(position) ? 'prepend' : 'append');
|
|
21
|
+
}
|
|
22
|
+
if (manipulateOverlayMode === 'reorder' && path && position && preReorderBlockPath) {
|
|
23
|
+
reorderBlock(preReorderBlockPath, path, ['left', 'top'].includes(position) ? 'prepend' : 'append');
|
|
24
|
+
}
|
|
25
|
+
disableMode();
|
|
26
|
+
}, [preInsertBlockType, preReorderBlockPath]);
|
|
27
|
+
};
|
|
28
|
+
export default useMainEditorInitialize;
|
|
29
|
+
//# sourceMappingURL=useMainEditorInitialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMainEditorInitialize.js","sourceRoot":"../../../../src","sources":["editor-v2/hooks/useMainEditorInitialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAC,oCAAiC;AAEnE,OAAO,EAAC,kBAAkB,EAAC,gCAA6B;AACxD,OAAO,EAAC,oBAAoB,EAAC,kCAA+B;AAE5D,MAAM,uBAAuB,GAAG,GAAG,EAAE;IACjC,MAAM,EAAC,kBAAkB,EAAC,GAAG,oBAAoB,EAAE,CAAC;IACpD,MAAM,EACF,UAAU,EACV,SAAS,EACT,UAAU,EACV,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,GACtB,GAAG,kBAAkB,EAAE,CAAC;IAEzB,yBAAyB,CACrB,SAAS,EACT,GAAG,EAAE;QACD,UAAU,EAAE,CAAC;QACb,kBAAkB,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;QAC/C,kBAAkB,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;IAClD,CAAC,EACD,CAAC,kBAAkB,CAAC,CACvB,CAAC;IAEF,yBAAyB,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;QACrD,UAAU,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,yBAAyB,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,EAAE;QACtD,SAAS,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,yBAAyB,CACrB,aAAa,EACb,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAE,EAAE;QACjB,IAAI,qBAAqB,KAAK,QAAQ,IAAI,IAAI,IAAI,QAAQ,IAAI,kBAAkB,EAAE,CAAC;YAC/E,WAAW,CACP,IAAI,EACJ,kBAAkB,EAClB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAC5D,CAAC;QACN,CAAC;QACD,IAAI,qBAAqB,KAAK,SAAS,IAAI,IAAI,IAAI,QAAQ,IAAI,mBAAmB,EAAE,CAAC;YACjF,YAAY,CACR,mBAAmB,EACnB,IAAI,EACJ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAC5D,CAAC;QACN,CAAC;QACD,WAAW,EAAE,CAAC;IAClB,CAAC,EACD,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAC5C,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,uBAAuB,CAAC","sourcesContent":["import {usePostMessageAPIListener} from '../../common/postMessage';\n\nimport {useMainEditorStore} from './useMainEditorStore';\nimport {usePostMessageEvents} from './usePostMessageEvents';\n\nconst useMainEditorInitialize = () => {\n const {requestPostMessage} = usePostMessageEvents();\n const {\n initialize,\n setConfig,\n setContent,\n manipulateOverlayMode,\n disableMode,\n insertBlock,\n reorderBlock,\n preInsertBlockType,\n preReorderBlockPath,\n } = useMainEditorStore();\n\n usePostMessageAPIListener(\n 'ON_INIT',\n () => {\n initialize();\n requestPostMessage('GET_SUPPORTED_BLOCKS', {});\n requestPostMessage('GET_INITIAL_CONTENT', {});\n },\n [requestPostMessage],\n );\n\n usePostMessageAPIListener('ON_INITIAL_CONTENT', (data) => {\n setContent(data);\n });\n\n usePostMessageAPIListener('ON_SUPPORTED_BLOCKS', (data) => {\n setConfig(data);\n });\n\n usePostMessageAPIListener(\n 'ON_MOUSE_UP',\n ({path, position}) => {\n if (manipulateOverlayMode === 'insert' && path && position && preInsertBlockType) {\n insertBlock(\n path,\n preInsertBlockType,\n ['left', 'top'].includes(position) ? 'prepend' : 'append',\n );\n }\n if (manipulateOverlayMode === 'reorder' && path && position && preReorderBlockPath) {\n reorderBlock(\n preReorderBlockPath,\n path,\n ['left', 'top'].includes(position) ? 'prepend' : 'append',\n );\n }\n disableMode();\n },\n [preInsertBlockType, preReorderBlockPath],\n );\n};\n\nexport default useMainEditorInitialize;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useMainEditorStore: () => import("../store.js").EditorStore;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useStore } from 'zustand';
|
|
3
|
+
import { MainEditorStoreContext } from "../context/editorStore/index.js";
|
|
4
|
+
export const useMainEditorStore = () => {
|
|
5
|
+
const { state } = React.useContext(MainEditorStoreContext);
|
|
6
|
+
return useStore(state);
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=useMainEditorStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMainEditorStore.js","sourceRoot":"../../../../src","sources":["editor-v2/hooks/useMainEditorStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAC,sBAAsB,EAAC,wCAA+B;AAE9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAC,KAAK,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;IACzD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport {useStore} from 'zustand';\n\nimport {MainEditorStoreContext} from '../context/editorStore';\n\nexport const useMainEditorStore = () => {\n const {state} = React.useContext(MainEditorStoreContext);\n return useStore(state);\n};\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionMessageTypes } from "../../common/types/index.js";
|
|
2
|
+
interface UsePostMessageRequestReturn {
|
|
3
|
+
requestPostMessage: <K extends keyof ActionMessageTypes>(action: K, data: ActionMessageTypes[K]) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function usePostMessageEvents(): UsePostMessageRequestReturn;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { requestActionPostMessage } from "../../common/postMessage.js";
|
|
3
|
+
import { IframeContext } from "../context/iframeContext/index.js";
|
|
4
|
+
export function usePostMessageEvents() {
|
|
5
|
+
const { iframeElement } = React.useContext(IframeContext);
|
|
6
|
+
return {
|
|
7
|
+
requestPostMessage: (action, data) => {
|
|
8
|
+
if (iframeElement && iframeElement.contentWindow) {
|
|
9
|
+
return requestActionPostMessage(action, data, iframeElement.contentWindow);
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=usePostMessageEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePostMessageEvents.js","sourceRoot":"../../../../src","sources":["editor-v2/hooks/usePostMessageEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,wBAAwB,EAAC,oCAAiC;AAElE,OAAO,EAAC,aAAa,EAAC,0CAAiC;AASvD,MAAM,UAAU,oBAAoB;IAChC,MAAM,EAAC,aAAa,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAExD,OAAO;QACH,kBAAkB,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;YACjC,IAAI,aAAa,IAAI,aAAa,CAAC,aAAa,EAAE,CAAC;gBAC/C,OAAO,wBAAwB,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;YAC/E,CAAC;YAED,OAAO,SAAS,CAAC;QACrB,CAAC;KACJ,CAAC;AACN,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {requestActionPostMessage} from '../../common/postMessage';\nimport {ActionMessageTypes} from '../../common/types';\nimport {IframeContext} from '../context/iframeContext';\n\ninterface UsePostMessageRequestReturn {\n requestPostMessage: <K extends keyof ActionMessageTypes>(\n action: K,\n data: ActionMessageTypes[K],\n ) => void;\n}\n\nexport function usePostMessageEvents(): UsePostMessageRequestReturn {\n const {iframeElement} = React.useContext(IframeContext);\n\n return {\n requestPostMessage: (action, data) => {\n if (iframeElement && iframeElement.contentWindow) {\n return requestActionPostMessage(action, data, iframeElement.contentWindow);\n }\n\n return undefined;\n },\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../src","sources":["editor-v2/index.ts"],"names":[],"mappings":"AAAA,yCAAgC;AAChC,sCAA6B;AAC7B,iCAAwB;AACxB,iCAAwB;AACxB,+BAA4B","sourcesContent":["export * from '../common/types';\nexport * from './containers';\nexport * from './hooks';\nexport * from './utils';\nexport * from './constants';\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EditorState } from "../common/store.js";
|
|
2
|
+
import { DynamicFormValue } from "../common/types/index.js";
|
|
3
|
+
import { PageContentWithNavigation } from "../models/index.js";
|
|
4
|
+
export interface EditorMethods {
|
|
5
|
+
initialize(): void;
|
|
6
|
+
setSelectedBlock(path: number[] | null): void;
|
|
7
|
+
setHeight(height: number): void;
|
|
8
|
+
setDeviceWidth(deviceWidth: string): void;
|
|
9
|
+
setZoom(zoom: number): void;
|
|
10
|
+
increaseZoom(): void;
|
|
11
|
+
decreaseZoom(): void;
|
|
12
|
+
setConfig(data: Pick<EditorState, 'blocks' | 'subBlocks' | 'global'>): void;
|
|
13
|
+
setContent(data: PageContentWithNavigation): void;
|
|
14
|
+
insertBlock(path: number[], blockType: string, position?: 'prepend' | 'append'): void;
|
|
15
|
+
enableInsertMode(blockType: string): void;
|
|
16
|
+
enableReorderMode(path: number[]): void;
|
|
17
|
+
disableMode(): void;
|
|
18
|
+
updateField(path: string, value: DynamicFormValue): void;
|
|
19
|
+
deleteBlock(path: number[]): void;
|
|
20
|
+
duplicateBlock(path: number[]): void;
|
|
21
|
+
reorderBlock(path: number[], destination: number[], position?: 'prepend' | 'append'): void;
|
|
22
|
+
resetInitialize(): void;
|
|
23
|
+
resetBlocks(): void;
|
|
24
|
+
}
|
|
25
|
+
export type EditorStore = EditorState & EditorMethods;
|
|
26
|
+
export declare const createEditorStore: (overrideInitialState?: Partial<EditorState> | undefined) => import("zustand").UseBoundStore<Omit<Omit<Omit<import("zustand").StoreApi<EditorState & EditorMethods>, "subscribe"> & {
|
|
27
|
+
subscribe: {
|
|
28
|
+
(listener: (selectedState: EditorState & EditorMethods, previousSelectedState: EditorState & EditorMethods) => void): () => void;
|
|
29
|
+
<U>(selector: (state: EditorState & EditorMethods) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
30
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
31
|
+
fireImmediately?: boolean;
|
|
32
|
+
} | undefined): () => void;
|
|
33
|
+
};
|
|
34
|
+
}, "setState"> & {
|
|
35
|
+
setState<A extends string | {
|
|
36
|
+
type: string;
|
|
37
|
+
}>(partial: (EditorState & EditorMethods) | Partial<EditorState & EditorMethods> | ((state: EditorState & EditorMethods) => (EditorState & EditorMethods) | Partial<EditorState & EditorMethods>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
38
|
+
}, "persist"> & {
|
|
39
|
+
persist: {
|
|
40
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<EditorState & EditorMethods, EditorState & EditorMethods>>) => void;
|
|
41
|
+
clearStorage: () => void;
|
|
42
|
+
rehydrate: () => Promise<void> | void;
|
|
43
|
+
hasHydrated: () => boolean;
|
|
44
|
+
onHydrate: (fn: (state: EditorState & EditorMethods) => void) => () => void;
|
|
45
|
+
onFinishHydration: (fn: (state: EditorState & EditorMethods) => void) => () => void;
|
|
46
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<EditorState & EditorMethods, EditorState & EditorMethods>>;
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { initialStore } from "../common/store.js";
|
|
3
|
+
import { initializeStore } from "../common/utils.js";
|
|
4
|
+
import { ZOOM_STEPS } from "./constants.js";
|
|
5
|
+
import { duplicateArrayItem, generateChildrenPathFromArray, getDestinationShiftBeforeReorder, insert, isItemsNeighbours, modifyObjectByPath, removeFromArray, reorderArrayItems, } from "./utils/index.js";
|
|
6
|
+
export const createEditorStore = initializeStore(initialStore, (set, get) => ({
|
|
7
|
+
setHeight(height) {
|
|
8
|
+
// We have to add 200-500px, because of bottom padding or margin of last element
|
|
9
|
+
// which is not taken into calculation of final height
|
|
10
|
+
const newHeight = height + 500;
|
|
11
|
+
set((state) => ({ ...state, height: newHeight }));
|
|
12
|
+
},
|
|
13
|
+
setDeviceWidth(deviceWidth) {
|
|
14
|
+
set((state) => ({ ...state, deviceWidth }));
|
|
15
|
+
},
|
|
16
|
+
setZoom(zoom) {
|
|
17
|
+
if (zoom > 0) {
|
|
18
|
+
set((state) => ({ ...state, zoom }));
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
increaseZoom() {
|
|
22
|
+
const currentZoom = get().zoom;
|
|
23
|
+
for (const step of ZOOM_STEPS) {
|
|
24
|
+
if (currentZoom < step) {
|
|
25
|
+
get().setZoom(step);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
decreaseZoom() {
|
|
31
|
+
const currentZoom = get().zoom;
|
|
32
|
+
const reverseSteps = ZOOM_STEPS.slice().reverse();
|
|
33
|
+
for (const step of reverseSteps) {
|
|
34
|
+
if (currentZoom > step) {
|
|
35
|
+
get().setZoom(step);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
setConfig(data) {
|
|
41
|
+
set((state) => ({ ...state, ...data }));
|
|
42
|
+
},
|
|
43
|
+
insertBlock: (arrayPath, blockType, position = 'append') => {
|
|
44
|
+
if (position === 'append') {
|
|
45
|
+
// TODO: fix
|
|
46
|
+
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign
|
|
47
|
+
arrayPath[arrayPath.length - 1] = arrayPath[arrayPath.length - 1] + 1;
|
|
48
|
+
}
|
|
49
|
+
const blocksConfig = get().content.blocks;
|
|
50
|
+
const blocksData = get().blocks;
|
|
51
|
+
const foundBlock = blocksData.find(({ type }) => type === blockType);
|
|
52
|
+
const defaultValue = foundBlock && foundBlock.schema.default
|
|
53
|
+
? { ...foundBlock.schema.default, type: blockType }
|
|
54
|
+
: { type: blockType };
|
|
55
|
+
const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, (parentBlocks, index) => insert(parentBlocks, index, defaultValue));
|
|
56
|
+
set((state) => ({
|
|
57
|
+
...state,
|
|
58
|
+
content: { ...state.content, blocks: newBlocksConfig },
|
|
59
|
+
selectedBlock: arrayPath,
|
|
60
|
+
}));
|
|
61
|
+
},
|
|
62
|
+
enableInsertMode(blockType) {
|
|
63
|
+
set((state) => ({
|
|
64
|
+
...state,
|
|
65
|
+
manipulateOverlayMode: 'insert',
|
|
66
|
+
preInsertBlockType: blockType,
|
|
67
|
+
}));
|
|
68
|
+
},
|
|
69
|
+
disableMode() {
|
|
70
|
+
set((state) => ({
|
|
71
|
+
...state,
|
|
72
|
+
manipulateOverlayMode: false,
|
|
73
|
+
preInsertBlockType: undefined,
|
|
74
|
+
preReorderBlockPath: undefined,
|
|
75
|
+
}));
|
|
76
|
+
},
|
|
77
|
+
enableReorderMode(path) {
|
|
78
|
+
set((state) => ({
|
|
79
|
+
...state,
|
|
80
|
+
manipulateOverlayMode: 'reorder',
|
|
81
|
+
preReorderBlockPath: path,
|
|
82
|
+
}));
|
|
83
|
+
},
|
|
84
|
+
setContent(content) {
|
|
85
|
+
set((state) => ({
|
|
86
|
+
...state,
|
|
87
|
+
content: content,
|
|
88
|
+
}));
|
|
89
|
+
},
|
|
90
|
+
initialize() {
|
|
91
|
+
set((state) => ({
|
|
92
|
+
...state,
|
|
93
|
+
initialized: true,
|
|
94
|
+
}));
|
|
95
|
+
},
|
|
96
|
+
setSelectedBlock(path) {
|
|
97
|
+
set((state) => ({
|
|
98
|
+
...state,
|
|
99
|
+
selectedBlock: path,
|
|
100
|
+
}));
|
|
101
|
+
},
|
|
102
|
+
updateField(path, value) {
|
|
103
|
+
set((state) => {
|
|
104
|
+
const newConfig = _.set(state.content, path, value);
|
|
105
|
+
return {
|
|
106
|
+
...state,
|
|
107
|
+
content: newConfig,
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
deleteBlock: (arrayPath) => {
|
|
112
|
+
const blocksConfig = get().content.blocks;
|
|
113
|
+
const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, removeFromArray);
|
|
114
|
+
set((state) => ({
|
|
115
|
+
...state,
|
|
116
|
+
content: { ...state.content, blocks: newBlocksConfig },
|
|
117
|
+
selectedBlock: null,
|
|
118
|
+
}));
|
|
119
|
+
},
|
|
120
|
+
duplicateBlock: (arrayPath) => {
|
|
121
|
+
const blocksConfig = get().content.blocks;
|
|
122
|
+
const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, duplicateArrayItem);
|
|
123
|
+
set((state) => ({
|
|
124
|
+
...state,
|
|
125
|
+
content: { ...state.content, blocks: newBlocksConfig },
|
|
126
|
+
}));
|
|
127
|
+
},
|
|
128
|
+
reorderBlock: (arrayPath, destination, position = 'append') => {
|
|
129
|
+
// Create a copy of the destination array before any modifications
|
|
130
|
+
let finalDestinationPath = _.cloneDeep(destination);
|
|
131
|
+
if (position === 'append') {
|
|
132
|
+
// TODO: fix
|
|
133
|
+
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign
|
|
134
|
+
destination[destination.length - 1] = destination[destination.length - 1] + 1;
|
|
135
|
+
}
|
|
136
|
+
let newBlocksConfig;
|
|
137
|
+
const blocksConfig = get().content.blocks;
|
|
138
|
+
// Copy
|
|
139
|
+
const copiedBlock = _.get(blocksConfig, generateChildrenPathFromArray(arrayPath));
|
|
140
|
+
if (isItemsNeighbours(arrayPath, destination)) {
|
|
141
|
+
newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, (parentBlocks) => {
|
|
142
|
+
return reorderArrayItems(parentBlocks, arrayPath[arrayPath.length - 1], destination[destination.length - 1]);
|
|
143
|
+
});
|
|
144
|
+
if (position === 'append' &&
|
|
145
|
+
destination[destination.length - 1] < arrayPath[arrayPath.length - 1]) {
|
|
146
|
+
finalDestinationPath[finalDestinationPath.length - 1] =
|
|
147
|
+
finalDestinationPath[finalDestinationPath.length - 1] + 1;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const arrayDest = getDestinationShiftBeforeReorder(arrayPath, destination);
|
|
152
|
+
finalDestinationPath = _.cloneDeep(arrayDest);
|
|
153
|
+
// Delete
|
|
154
|
+
const blocksConfigWithoutBlock = modifyObjectByPath(blocksConfig, arrayPath, removeFromArray);
|
|
155
|
+
// Paste
|
|
156
|
+
newBlocksConfig = modifyObjectByPath(blocksConfigWithoutBlock, arrayDest, (parentBlocks, index) => insert(parentBlocks, index, copiedBlock));
|
|
157
|
+
}
|
|
158
|
+
set((state) => ({
|
|
159
|
+
...state,
|
|
160
|
+
content: { ...state.content, blocks: newBlocksConfig },
|
|
161
|
+
selectedBlock: finalDestinationPath,
|
|
162
|
+
}));
|
|
163
|
+
},
|
|
164
|
+
resetInitialize: () => {
|
|
165
|
+
set((state) => ({
|
|
166
|
+
...state,
|
|
167
|
+
initialized: false,
|
|
168
|
+
}));
|
|
169
|
+
},
|
|
170
|
+
resetBlocks: () => {
|
|
171
|
+
set((state) => ({
|
|
172
|
+
...state,
|
|
173
|
+
content: { ...state.content, blocks: [] },
|
|
174
|
+
}));
|
|
175
|
+
},
|
|
176
|
+
}));
|
|
177
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"../../../src","sources":["editor-v2/store.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAc,YAAY,EAAC,2BAAwB;AAE1D,OAAO,EAAC,eAAe,EAAC,2BAAwB;AAGhD,OAAO,EAAC,UAAU,EAAC,uBAAoB;AACvC,OAAO,EACH,kBAAkB,EAClB,6BAA6B,EAC7B,gCAAgC,EAChC,MAAM,EACN,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GACpB,yBAAgB;AA0BjB,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAC5C,YAAY,EACZ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACX,SAAS,CAAC,MAAc;QACpB,gFAAgF;QAChF,sDAAsD;QACtD,MAAM,SAAS,GAAG,MAAM,GAAG,GAAG,CAAC;QAC/B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,KAAK,EAAE,MAAM,EAAE,SAAS,EAAC,CAAC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AClB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACZ,GAAG,KAAK;YACR,WAAW,EAAE,KAAK;SACrB,CAAC,CAAC,CAAC;IACR,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QACd,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACZ,GAAG,KAAK;YACR,OAAO,EAAE,EAAC,GAAG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAC;SAC1C,CAAC,CAAC,CAAC;IACR,CAAC;CACJ,CAAC,CACL,CAAC","sourcesContent":["import _ from 'lodash';\n\nimport {EditorState, initialStore} from '../common/store';\nimport {DynamicFormValue} from '../common/types';\nimport {initializeStore} from '../common/utils';\nimport {ConstructorBlock, PageContentWithNavigation} from '../models';\n\nimport {ZOOM_STEPS} from './constants';\nimport {\n duplicateArrayItem,\n generateChildrenPathFromArray,\n getDestinationShiftBeforeReorder,\n insert,\n isItemsNeighbours,\n modifyObjectByPath,\n removeFromArray,\n reorderArrayItems,\n} from './utils';\n\nexport interface EditorMethods {\n initialize(): void;\n setSelectedBlock(path: number[] | null): void;\n setHeight(height: number): void;\n setDeviceWidth(deviceWidth: string): void;\n setZoom(zoom: number): void;\n increaseZoom(): void;\n decreaseZoom(): void;\n setConfig(data: Pick<EditorState, 'blocks' | 'subBlocks' | 'global'>): void;\n setContent(data: PageContentWithNavigation): void;\n insertBlock(path: number[], blockType: string, position?: 'prepend' | 'append'): void;\n enableInsertMode(blockType: string): void;\n enableReorderMode(path: number[]): void;\n disableMode(): void;\n updateField(path: string, value: DynamicFormValue): void;\n deleteBlock(path: number[]): void;\n duplicateBlock(path: number[]): void;\n reorderBlock(path: number[], destination: number[], position?: 'prepend' | 'append'): void;\n resetInitialize(): void;\n resetBlocks(): void;\n}\n\nexport type EditorStore = EditorState & EditorMethods;\n\nexport const createEditorStore = initializeStore<EditorState, EditorMethods>(\n initialStore,\n (set, get) => ({\n setHeight(height: number) {\n // We have to add 200-500px, because of bottom padding or margin of last element\n // which is not taken into calculation of final height\n const newHeight = height + 500;\n set((state) => ({...state, height: newHeight}));\n },\n setDeviceWidth(deviceWidth: string) {\n set((state) => ({...state, deviceWidth}));\n },\n setZoom(zoom) {\n if (zoom > 0) {\n set((state) => ({...state, zoom}));\n }\n },\n increaseZoom() {\n const currentZoom = get().zoom;\n\n for (const step of ZOOM_STEPS) {\n if (currentZoom < step) {\n get().setZoom(step);\n break;\n }\n }\n },\n decreaseZoom() {\n const currentZoom = get().zoom;\n const reverseSteps = ZOOM_STEPS.slice().reverse();\n\n for (const step of reverseSteps) {\n if (currentZoom > step) {\n get().setZoom(step);\n break;\n }\n }\n },\n setConfig(data) {\n set((state) => ({...state, ...data}));\n },\n insertBlock: (arrayPath, blockType, position = 'append') => {\n if (position === 'append') {\n // TODO: fix\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n arrayPath[arrayPath.length - 1] = arrayPath[arrayPath.length - 1] + 1;\n }\n\n const blocksConfig = get().content.blocks;\n const blocksData = get().blocks;\n\n const foundBlock = blocksData.find(({type}) => type === blockType);\n const defaultValue =\n foundBlock && foundBlock.schema.default\n ? {...foundBlock.schema.default, type: blockType}\n : {type: blockType};\n\n const newBlocksConfig = modifyObjectByPath(\n blocksConfig,\n arrayPath,\n (parentBlocks, index) =>\n insert(parentBlocks, index, defaultValue as ConstructorBlock),\n );\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: arrayPath,\n }));\n },\n enableInsertMode(blockType: string) {\n set((state) => ({\n ...state,\n manipulateOverlayMode: 'insert',\n preInsertBlockType: blockType,\n }));\n },\n disableMode() {\n set((state) => ({\n ...state,\n manipulateOverlayMode: false,\n preInsertBlockType: undefined,\n preReorderBlockPath: undefined,\n }));\n },\n enableReorderMode(path) {\n set((state) => ({\n ...state,\n manipulateOverlayMode: 'reorder',\n preReorderBlockPath: path,\n }));\n },\n setContent(content) {\n set((state) => ({\n ...state,\n content: content,\n }));\n },\n initialize() {\n set((state) => ({\n ...state,\n initialized: true,\n }));\n },\n setSelectedBlock(path) {\n set((state) => ({\n ...state,\n selectedBlock: path,\n }));\n },\n updateField(path, value) {\n set((state) => {\n const newConfig = _.set(state.content, path, value);\n return {\n ...state,\n content: newConfig,\n };\n });\n },\n deleteBlock: (arrayPath) => {\n const blocksConfig = get().content.blocks;\n\n const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, removeFromArray);\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: null,\n }));\n },\n duplicateBlock: (arrayPath) => {\n const blocksConfig = get().content.blocks;\n\n const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, duplicateArrayItem);\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n }));\n },\n reorderBlock: (arrayPath, destination, position = 'append') => {\n // Create a copy of the destination array before any modifications\n let finalDestinationPath: number[] = _.cloneDeep(destination);\n\n if (position === 'append') {\n // TODO: fix\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n destination[destination.length - 1] = destination[destination.length - 1] + 1;\n }\n\n let newBlocksConfig: ConstructorBlock[];\n const blocksConfig = get().content.blocks;\n // Copy\n const copiedBlock = _.get(blocksConfig, generateChildrenPathFromArray(arrayPath));\n\n if (isItemsNeighbours(arrayPath, destination)) {\n newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, (parentBlocks) => {\n return reorderArrayItems(\n parentBlocks,\n arrayPath[arrayPath.length - 1],\n destination[destination.length - 1],\n );\n });\n\n if (\n position === 'append' &&\n destination[destination.length - 1] < arrayPath[arrayPath.length - 1]\n ) {\n finalDestinationPath[finalDestinationPath.length - 1] =\n finalDestinationPath[finalDestinationPath.length - 1] + 1;\n }\n } else {\n const arrayDest = getDestinationShiftBeforeReorder(arrayPath, destination);\n finalDestinationPath = _.cloneDeep(arrayDest);\n\n // Delete\n const blocksConfigWithoutBlock = modifyObjectByPath(\n blocksConfig,\n arrayPath,\n removeFromArray,\n );\n // Paste\n newBlocksConfig = modifyObjectByPath(\n blocksConfigWithoutBlock,\n arrayDest,\n (parentBlocks, index) => insert(parentBlocks, index, copiedBlock),\n );\n }\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: finalDestinationPath,\n }));\n },\n resetInitialize: () => {\n set((state) => ({\n ...state,\n initialized: false,\n }));\n },\n resetBlocks: () => {\n set((state) => ({\n ...state,\n content: {...state.content, blocks: []},\n }));\n },\n }),\n);\n"]}
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
.g-root {
|
|
2
|
+
--g-color-base-selection: var(--g-color-private-black-200);
|
|
3
|
+
--g-color-base-selection-hover: var(--g-color-private-black-300);
|
|
4
|
+
--g-color-base-brand: var(--g-color-private-black-850-solid);
|
|
5
|
+
--g-color-base-brand-hover: var(--g-color-private-black-700-solid);
|
|
6
|
+
--g-color-text-brand-contrast: var(--g-color-text-light-primary);
|
|
7
|
+
--g-color-text-brand-heavy: var(--g-color-private-black-700-solid);
|
|
8
|
+
--g-color-line-brand: var(--g-color-text-primary);
|
|
9
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.js","sourceRoot":"../../../../src","sources":["editor-v2/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhD,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC,EAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAC,CAAC,CAAC","sourcesContent":["import {withNaming} from '@bem-react/classname';\n\nexport const EDITOR_NAMESPACE = 'pceditor-';\n\nexport const editorCn = withNaming({n: EDITOR_NAMESPACE, e: '__', m: '_'});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","sourceRoot":"../../../../src","sources":["editor-v2/utils/code.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAI3B,MAAM,UAAU,SAAS,CAAC,IAAY;IAClC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAgB,CAAC;IAEnD,OAAO;QACH,GAAG,WAAW;QACd,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;KAC9C,CAAC;AACN,CAAC","sourcesContent":["import yaml from 'js-yaml';\n\nimport {PageContent} from '../../models';\n\nexport function parseCode(code: string) {\n const pageContent = yaml.load(code) as PageContent;\n\n return {\n ...pageContent,\n blocks: pageContent.blocks?.filter(Boolean),\n };\n}\n"]}
|