@gravity-ui/page-constructor 6.3.1 → 6.3.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -1
- package/build/cjs/blocks/Banner/Banner.js +2 -1
- package/build/cjs/blocks/Banner/Banner.js.map +1 -1
- package/build/cjs/blocks/Banner/index.d.ts +3 -0
- package/build/cjs/blocks/Banner/index.js +24 -0
- package/build/cjs/blocks/Banner/index.js.map +1 -0
- package/build/cjs/blocks/CardLayout/CardLayout.css +1 -0
- package/build/cjs/blocks/CardLayout/CardLayout.js +4 -3
- package/build/cjs/blocks/CardLayout/CardLayout.js.map +1 -1
- package/build/cjs/blocks/CardLayout/index.d.ts +5 -0
- package/build/cjs/blocks/CardLayout/index.js +186 -0
- package/build/cjs/blocks/CardLayout/index.js.map +1 -0
- package/build/cjs/blocks/Companies/Companies.js +2 -1
- package/build/cjs/blocks/Companies/Companies.js.map +1 -1
- package/build/cjs/blocks/Companies/index.d.ts +3 -0
- package/build/cjs/blocks/Companies/index.js +20 -0
- package/build/cjs/blocks/Companies/index.js.map +1 -0
- package/build/cjs/blocks/ContentLayout/ContentLayout.js +1 -1
- package/build/cjs/blocks/ContentLayout/ContentLayout.js.map +1 -1
- package/build/cjs/blocks/ContentLayout/index.d.ts +41 -0
- package/build/cjs/blocks/ContentLayout/index.js +81 -0
- package/build/cjs/blocks/ContentLayout/index.js.map +1 -0
- package/build/cjs/blocks/ContentLayout/schema.d.ts +1 -0
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +13 -12
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js.map +1 -1
- package/build/cjs/blocks/ExtendedFeatures/index.d.ts +58 -0
- package/build/cjs/blocks/ExtendedFeatures/index.js +77 -0
- package/build/cjs/blocks/ExtendedFeatures/index.js.map +1 -0
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +1 -0
- package/build/cjs/blocks/ExtendedFeatures/schema.js +1 -0
- package/build/cjs/blocks/ExtendedFeatures/schema.js.map +1 -1
- package/build/cjs/blocks/FilterBlock/FilterBlock.js +5 -5
- package/build/cjs/blocks/FilterBlock/FilterBlock.js.map +1 -1
- package/build/cjs/blocks/FilterBlock/index.d.ts +29 -0
- package/build/cjs/blocks/FilterBlock/index.js +98 -0
- package/build/cjs/blocks/FilterBlock/index.js.map +1 -0
- package/build/cjs/blocks/Form/index.d.ts +13 -0
- package/build/cjs/blocks/Form/index.js +20 -0
- package/build/cjs/blocks/Form/index.js.map +1 -0
- package/build/cjs/blocks/Header/dynamic-form.d.ts +2 -0
- package/build/cjs/blocks/Header/dynamic-form.js +731 -0
- package/build/cjs/blocks/Header/dynamic-form.js.map +1 -0
- package/build/cjs/blocks/Header/index.d.ts +20 -0
- package/build/cjs/blocks/Header/index.js +34 -0
- package/build/cjs/blocks/Header/index.js.map +1 -0
- package/build/cjs/blocks/HeaderSlider/HeaderSlider.js +2 -1
- package/build/cjs/blocks/HeaderSlider/HeaderSlider.js.map +1 -1
- package/build/cjs/blocks/HeaderSlider/index.d.ts +32 -0
- package/build/cjs/blocks/HeaderSlider/index.js +40 -0
- package/build/cjs/blocks/HeaderSlider/index.js.map +1 -0
- package/build/cjs/blocks/Icons/Icons.js +8 -6
- package/build/cjs/blocks/Icons/Icons.js.map +1 -1
- package/build/cjs/blocks/Icons/index.d.ts +20 -0
- package/build/cjs/blocks/Icons/index.js +64 -0
- package/build/cjs/blocks/Icons/index.js.map +1 -0
- package/build/cjs/blocks/Info/index.d.ts +22 -0
- package/build/cjs/blocks/Info/index.js +43 -0
- package/build/cjs/blocks/Info/index.js.map +1 -0
- package/build/cjs/blocks/Map/index.d.ts +12 -0
- package/build/cjs/blocks/Map/index.js +19 -0
- package/build/cjs/blocks/Map/index.js.map +1 -0
- package/build/cjs/blocks/Media/index.d.ts +39 -0
- package/build/cjs/blocks/Media/index.js +57 -0
- package/build/cjs/blocks/Media/index.js.map +1 -0
- package/build/cjs/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +15 -13
- package/build/cjs/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js.map +1 -1
- package/build/cjs/blocks/PromoFeaturesBlock/index.d.ts +22 -0
- package/build/cjs/blocks/PromoFeaturesBlock/index.js +49 -0
- package/build/cjs/blocks/PromoFeaturesBlock/index.js.map +1 -0
- package/build/cjs/blocks/Questions/Questions.js +6 -5
- package/build/cjs/blocks/Questions/Questions.js.map +1 -1
- package/build/cjs/blocks/Questions/index.d.ts +30 -0
- package/build/cjs/blocks/Questions/index.js +49 -0
- package/build/cjs/blocks/Questions/index.js.map +1 -0
- package/build/cjs/blocks/Share/Share.js +11 -10
- package/build/cjs/blocks/Share/Share.js.map +1 -1
- package/build/cjs/blocks/Share/index.d.ts +13 -0
- package/build/cjs/blocks/Share/index.js +20 -0
- package/build/cjs/blocks/Share/index.js.map +1 -0
- package/build/cjs/blocks/Slider/Slider.js +12 -10
- package/build/cjs/blocks/Slider/Slider.js.map +1 -1
- package/build/cjs/blocks/Slider/dynamic-form.d.ts +3 -0
- package/build/cjs/blocks/Slider/dynamic-form.js +226 -0
- package/build/cjs/blocks/Slider/dynamic-form.js.map +1 -0
- package/build/cjs/blocks/Slider/index.d.ts +28 -0
- package/build/cjs/blocks/Slider/index.js +47 -0
- package/build/cjs/blocks/Slider/index.js.map +1 -0
- package/build/cjs/blocks/Table/index.d.ts +18 -0
- package/build/cjs/blocks/Table/index.js +32 -0
- package/build/cjs/blocks/Table/index.js.map +1 -0
- package/build/cjs/blocks/Table/schema.d.ts +1 -0
- package/build/cjs/blocks/Table/schema.js +1 -0
- package/build/cjs/blocks/Table/schema.js.map +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js +4 -4
- package/build/cjs/blocks/Tabs/Tabs.js.map +1 -1
- package/build/cjs/blocks/Tabs/index.d.ts +17 -0
- package/build/cjs/blocks/Tabs/index.js +31 -0
- package/build/cjs/blocks/Tabs/index.js.map +1 -0
- package/build/cjs/blocks/TestEditorBlock/TestEditorBlock.d.ts +5 -0
- package/build/cjs/blocks/TestEditorBlock/TestEditorBlock.js +12 -0
- package/build/cjs/blocks/TestEditorBlock/TestEditorBlock.js.map +1 -0
- package/build/cjs/blocks/TestEditorBlock/form.d.ts +3 -0
- package/build/cjs/blocks/TestEditorBlock/form.js +91 -0
- package/build/cjs/blocks/TestEditorBlock/form.js.map +1 -0
- package/build/cjs/blocks/TestEditorBlock/index.d.ts +11 -0
- package/build/cjs/blocks/TestEditorBlock/index.js +18 -0
- package/build/cjs/blocks/TestEditorBlock/index.js.map +1 -0
- package/build/cjs/components/BlockBase/BlockBase.css +8 -16
- package/build/cjs/components/Image/dynamic-form.d.ts +2 -0
- package/build/cjs/components/Image/dynamic-form.js +85 -0
- package/build/cjs/components/Image/dynamic-form.js.map +1 -0
- package/build/cjs/components/editor/ItemWrap/ItemWrap.css +9 -0
- package/build/cjs/components/editor/ItemWrap/ItemWrap.d.ts +6 -0
- package/build/cjs/components/editor/ItemWrap/ItemWrap.js +12 -0
- package/build/cjs/components/editor/ItemWrap/ItemWrap.js.map +1 -0
- package/build/cjs/constructor-items.d.ts +22 -6
- package/build/cjs/constructor-items.js +80 -6
- package/build/cjs/constructor-items.js.map +1 -1
- package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +1 -1
- package/build/cjs/containers/PageConstructor/PageConstructor.js +18 -10
- package/build/cjs/containers/PageConstructor/PageConstructor.js.map +1 -1
- package/build/cjs/containers/PageConstructor/Provider.js +2 -0
- package/build/cjs/containers/PageConstructor/Provider.js.map +1 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css +10 -6
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +3 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js.map +1 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +7 -6
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js.map +1 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +2 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js.map +1 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorLoadable/ConstructorLoadable.js +2 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorLoadable/ConstructorLoadable.js.map +1 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorRow/ConstructorRow.js +1 -2
- package/build/cjs/containers/PageConstructor/components/ConstructorRow/ConstructorRow.js.map +1 -1
- package/build/cjs/context/blockIdContext/blockIdContext.d.ts +2 -2
- package/build/cjs/context/blockIdContext/blockIdContext.js +1 -1
- package/build/cjs/context/blockIdContext/blockIdContext.js.map +1 -1
- package/build/cjs/context/editorStoreContext/PCEditorStoreContext.d.ts +7 -0
- package/build/cjs/context/editorStoreContext/PCEditorStoreContext.js +10 -0
- package/build/cjs/context/editorStoreContext/PCEditorStoreContext.js.map +1 -0
- package/build/cjs/context/editorStoreContext/PCEditorStoreProvider.d.ts +5 -0
- package/build/cjs/context/editorStoreContext/PCEditorStoreProvider.js +34 -0
- package/build/cjs/context/editorStoreContext/PCEditorStoreProvider.js.map +1 -0
- package/build/cjs/context/editorStoreContext/index.d.ts +2 -0
- package/build/cjs/context/editorStoreContext/index.js +6 -0
- package/build/cjs/context/editorStoreContext/index.js.map +1 -0
- package/build/cjs/editor/components/CodeEditor/CodeEditor.d.ts +1 -2
- package/build/cjs/editor/components/CodeEditor/CodeEditor.js +5 -6
- package/build/cjs/editor/components/CodeEditor/CodeEditor.js.map +1 -1
- package/build/cjs/editor/data/templates/test-editor-block.json +18 -0
- package/build/cjs/grid/Grid/Grid.css +2 -6
- package/build/cjs/hooks/useAnalytics.js +1 -1
- package/build/cjs/hooks/useAnalytics.js.map +1 -1
- package/build/cjs/hooks/usePCEditorBlockMouseEvents.d.ts +8 -0
- package/build/cjs/hooks/usePCEditorBlockMouseEvents.js +50 -0
- package/build/cjs/hooks/usePCEditorBlockMouseEvents.js.map +1 -0
- package/build/cjs/hooks/usePCEditorBlockSelection.d.ts +2 -0
- package/build/cjs/hooks/usePCEditorBlockSelection.js +30 -0
- package/build/cjs/hooks/usePCEditorBlockSelection.js.map +1 -0
- package/build/cjs/hooks/usePCEditorInitializeEvents.d.ts +7 -0
- package/build/cjs/hooks/usePCEditorInitializeEvents.js +63 -0
- package/build/cjs/hooks/usePCEditorInitializeEvents.js.map +1 -0
- package/build/cjs/hooks/usePCEditorItemWrap.d.ts +10 -0
- package/build/cjs/hooks/usePCEditorItemWrap.js +21 -0
- package/build/cjs/hooks/usePCEditorItemWrap.js.map +1 -0
- package/build/cjs/hooks/usePCEditorStore.d.ts +1 -0
- package/build/cjs/hooks/usePCEditorStore.js +13 -0
- package/build/cjs/hooks/usePCEditorStore.js.map +1 -0
- package/build/cjs/hooks/usePostMessageAPI.d.ts +4 -0
- package/build/cjs/hooks/usePostMessageAPI.js +30 -0
- package/build/cjs/hooks/usePostMessageAPI.js.map +1 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -0
- package/build/cjs/models/constructor-items/blocks.js +1 -0
- package/build/cjs/models/constructor-items/blocks.js.map +1 -1
- package/build/cjs/models/constructor.d.ts +4 -1
- package/build/cjs/models/constructor.js.map +1 -1
- package/build/cjs/models/navigation.d.ts +2 -2
- package/build/cjs/models/navigation.js.map +1 -1
- package/build/cjs/navigation/components/DesktopNavigation/DesktopNavigation.js +1 -1
- package/build/cjs/navigation/components/DesktopNavigation/DesktopNavigation.js.map +1 -1
- package/build/cjs/navigation/components/Navigation/Navigation.d.ts +2 -2
- package/build/cjs/navigation/components/Navigation/Navigation.js +1 -1
- package/build/cjs/navigation/components/Navigation/Navigation.js.map +1 -1
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +4 -1
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js.map +1 -1
- package/build/cjs/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.js +4 -1
- package/build/cjs/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.js.map +1 -1
- package/build/cjs/navigation/containers/Layout/Layout.css +0 -1
- package/build/cjs/navigation/containers/Layout/Layout.js +1 -0
- package/build/cjs/navigation/containers/Layout/Layout.js.map +1 -1
- package/build/cjs/navigation/models.d.ts +1 -1
- package/build/cjs/navigation/models.js.map +1 -1
- package/build/cjs/schema/constants.js +2 -0
- package/build/cjs/schema/constants.js.map +1 -1
- package/build/cjs/schema/index.d.ts +256 -0
- package/build/cjs/schema/index.js +12 -6
- package/build/cjs/schema/index.js.map +1 -1
- package/build/cjs/sub-blocks/BackgroundCard/dynamic-form.d.ts +2 -0
- package/build/cjs/sub-blocks/BackgroundCard/dynamic-form.js +82 -0
- package/build/cjs/sub-blocks/BackgroundCard/dynamic-form.js.map +1 -0
- package/build/cjs/sub-blocks/BackgroundCard/index.d.ts +3 -0
- package/build/cjs/sub-blocks/BackgroundCard/index.js +22 -0
- package/build/cjs/sub-blocks/BackgroundCard/index.js.map +1 -0
- package/build/cjs/sub-blocks/BannerCard/BannerCard.js +2 -1
- package/build/cjs/sub-blocks/BannerCard/BannerCard.js.map +1 -1
- package/build/cjs/sub-blocks/BannerCard/index.d.ts +3 -0
- package/build/cjs/sub-blocks/BannerCard/index.js +24 -0
- package/build/cjs/sub-blocks/BannerCard/index.js.map +1 -0
- package/build/cjs/sub-blocks/BasicCard/index.d.ts +3 -0
- package/build/cjs/sub-blocks/BasicCard/index.js +20 -0
- package/build/cjs/sub-blocks/BasicCard/index.js.map +1 -0
- package/build/cjs/sub-blocks/Content/index.d.ts +3 -0
- package/build/cjs/sub-blocks/Content/index.js +20 -0
- package/build/cjs/sub-blocks/Content/index.js.map +1 -0
- package/build/cjs/sub-blocks/Content/schema.d.ts +1 -0
- package/build/cjs/sub-blocks/Content/schema.js +1 -0
- package/build/cjs/sub-blocks/Content/schema.js.map +1 -1
- package/build/cjs/sub-blocks/Divider/index.d.ts +3 -0
- package/build/cjs/sub-blocks/Divider/index.js +16 -0
- package/build/cjs/sub-blocks/Divider/index.js.map +1 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.js +1 -1
- package/build/cjs/sub-blocks/ImageCard/ImageCard.js.map +1 -1
- package/build/cjs/sub-blocks/ImageCard/index.d.ts +3 -0
- package/build/cjs/sub-blocks/ImageCard/index.js +20 -0
- package/build/cjs/sub-blocks/ImageCard/index.js.map +1 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js.map +1 -1
- package/build/cjs/sub-blocks/LayoutItem/index.d.ts +3 -0
- package/build/cjs/sub-blocks/LayoutItem/index.js +26 -0
- package/build/cjs/sub-blocks/LayoutItem/index.js.map +1 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +211 -206
- package/build/cjs/sub-blocks/LayoutItem/schema.js +6 -5
- package/build/cjs/sub-blocks/LayoutItem/schema.js.map +1 -1
- package/build/cjs/sub-blocks/MediaCard/index.d.ts +3 -0
- package/build/cjs/sub-blocks/MediaCard/index.js +23 -0
- package/build/cjs/sub-blocks/MediaCard/index.js.map +1 -0
- package/build/cjs/sub-blocks/PriceCard/index.d.ts +3 -0
- package/build/cjs/sub-blocks/PriceCard/index.js +33 -0
- package/build/cjs/sub-blocks/PriceCard/index.js.map +1 -0
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetailed.js +1 -1
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetailed.js.map +1 -1
- package/build/cjs/sub-blocks/PriceDetailed/index.d.ts +4 -0
- package/build/cjs/sub-blocks/PriceDetailed/index.js +35 -0
- package/build/cjs/sub-blocks/PriceDetailed/index.js.map +1 -0
- package/build/cjs/sub-blocks/Quote/index.d.ts +3 -0
- package/build/cjs/sub-blocks/Quote/index.js +23 -0
- package/build/cjs/sub-blocks/Quote/index.js.map +1 -0
- package/build/cjs/utils/editor.d.ts +2 -0
- package/build/cjs/utils/editor.js +25 -0
- package/build/cjs/utils/editor.js.map +1 -0
- package/build/cjs/utils/form-generator.d.ts +9 -0
- package/build/cjs/utils/form-generator.js +131 -0
- package/build/cjs/utils/form-generator.js.map +1 -0
- package/build/cjs/utils/index.d.ts +1 -0
- package/build/cjs/utils/index.js +1 -0
- package/build/cjs/utils/index.js.map +1 -1
- package/build/cjs/utils/navigation.d.ts +3 -0
- package/build/cjs/utils/navigation.js +14 -0
- package/build/cjs/utils/navigation.js.map +1 -0
- package/build/esm/blocks/Banner/Banner.js +2 -1
- package/build/esm/blocks/Banner/Banner.js.map +1 -1
- package/build/esm/blocks/Banner/index.d.ts +3 -0
- package/build/esm/blocks/Banner/index.js +21 -0
- package/build/esm/blocks/Banner/index.js.map +1 -0
- package/build/esm/blocks/CardLayout/CardLayout.css +1 -0
- package/build/esm/blocks/CardLayout/CardLayout.js +5 -4
- package/build/esm/blocks/CardLayout/CardLayout.js.map +1 -1
- package/build/esm/blocks/CardLayout/index.d.ts +5 -0
- package/build/esm/blocks/CardLayout/index.js +182 -0
- package/build/esm/blocks/CardLayout/index.js.map +1 -0
- package/build/esm/blocks/Companies/Companies.js +2 -1
- package/build/esm/blocks/Companies/Companies.js.map +1 -1
- package/build/esm/blocks/Companies/index.d.ts +3 -0
- package/build/esm/blocks/Companies/index.js +17 -0
- package/build/esm/blocks/Companies/index.js.map +1 -0
- package/build/esm/blocks/ContentLayout/ContentLayout.js +2 -2
- package/build/esm/blocks/ContentLayout/ContentLayout.js.map +1 -1
- package/build/esm/blocks/ContentLayout/index.d.ts +41 -0
- package/build/esm/blocks/ContentLayout/index.js +78 -0
- package/build/esm/blocks/ContentLayout/index.js.map +1 -0
- package/build/esm/blocks/ContentLayout/schema.d.ts +1 -0
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +14 -13
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js.map +1 -1
- package/build/esm/blocks/ExtendedFeatures/index.d.ts +58 -0
- package/build/esm/blocks/ExtendedFeatures/index.js +74 -0
- package/build/esm/blocks/ExtendedFeatures/index.js.map +1 -0
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +1 -0
- package/build/esm/blocks/ExtendedFeatures/schema.js +1 -0
- package/build/esm/blocks/ExtendedFeatures/schema.js.map +1 -1
- package/build/esm/blocks/FilterBlock/FilterBlock.js +6 -6
- package/build/esm/blocks/FilterBlock/FilterBlock.js.map +1 -1
- package/build/esm/blocks/FilterBlock/index.d.ts +29 -0
- package/build/esm/blocks/FilterBlock/index.js +95 -0
- package/build/esm/blocks/FilterBlock/index.js.map +1 -0
- package/build/esm/blocks/Form/index.d.ts +13 -0
- package/build/esm/blocks/Form/index.js +17 -0
- package/build/esm/blocks/Form/index.js.map +1 -0
- package/build/esm/blocks/Header/dynamic-form.d.ts +2 -0
- package/build/esm/blocks/Header/dynamic-form.js +728 -0
- package/build/esm/blocks/Header/dynamic-form.js.map +1 -0
- package/build/esm/blocks/Header/index.d.ts +20 -0
- package/build/esm/blocks/Header/index.js +31 -0
- package/build/esm/blocks/Header/index.js.map +1 -0
- package/build/esm/blocks/HeaderSlider/HeaderSlider.js +2 -1
- package/build/esm/blocks/HeaderSlider/HeaderSlider.js.map +1 -1
- package/build/esm/blocks/HeaderSlider/index.d.ts +32 -0
- package/build/esm/blocks/HeaderSlider/index.js +37 -0
- package/build/esm/blocks/HeaderSlider/index.js.map +1 -0
- package/build/esm/blocks/Icons/Icons.js +8 -6
- package/build/esm/blocks/Icons/Icons.js.map +1 -1
- package/build/esm/blocks/Icons/index.d.ts +20 -0
- package/build/esm/blocks/Icons/index.js +61 -0
- package/build/esm/blocks/Icons/index.js.map +1 -0
- package/build/esm/blocks/Info/index.d.ts +22 -0
- package/build/esm/blocks/Info/index.js +40 -0
- package/build/esm/blocks/Info/index.js.map +1 -0
- package/build/esm/blocks/Map/index.d.ts +12 -0
- package/build/esm/blocks/Map/index.js +16 -0
- package/build/esm/blocks/Map/index.js.map +1 -0
- package/build/esm/blocks/Media/index.d.ts +39 -0
- package/build/esm/blocks/Media/index.js +54 -0
- package/build/esm/blocks/Media/index.js.map +1 -0
- package/build/esm/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +15 -13
- package/build/esm/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js.map +1 -1
- package/build/esm/blocks/PromoFeaturesBlock/index.d.ts +22 -0
- package/build/esm/blocks/PromoFeaturesBlock/index.js +46 -0
- package/build/esm/blocks/PromoFeaturesBlock/index.js.map +1 -0
- package/build/esm/blocks/Questions/Questions.js +7 -6
- package/build/esm/blocks/Questions/Questions.js.map +1 -1
- package/build/esm/blocks/Questions/index.d.ts +30 -0
- package/build/esm/blocks/Questions/index.js +46 -0
- package/build/esm/blocks/Questions/index.js.map +1 -0
- package/build/esm/blocks/Share/Share.js +11 -10
- package/build/esm/blocks/Share/Share.js.map +1 -1
- package/build/esm/blocks/Share/index.d.ts +13 -0
- package/build/esm/blocks/Share/index.js +17 -0
- package/build/esm/blocks/Share/index.js.map +1 -0
- package/build/esm/blocks/Slider/Slider.js +12 -10
- package/build/esm/blocks/Slider/Slider.js.map +1 -1
- package/build/esm/blocks/Slider/dynamic-form.d.ts +3 -0
- package/build/esm/blocks/Slider/dynamic-form.js +223 -0
- package/build/esm/blocks/Slider/dynamic-form.js.map +1 -0
- package/build/esm/blocks/Slider/index.d.ts +28 -0
- package/build/esm/blocks/Slider/index.js +44 -0
- package/build/esm/blocks/Slider/index.js.map +1 -0
- package/build/esm/blocks/Table/index.d.ts +18 -0
- package/build/esm/blocks/Table/index.js +29 -0
- package/build/esm/blocks/Table/index.js.map +1 -0
- package/build/esm/blocks/Table/schema.d.ts +1 -0
- package/build/esm/blocks/Table/schema.js +1 -0
- package/build/esm/blocks/Table/schema.js.map +1 -1
- package/build/esm/blocks/Tabs/Tabs.js +5 -5
- package/build/esm/blocks/Tabs/Tabs.js.map +1 -1
- package/build/esm/blocks/Tabs/index.d.ts +17 -0
- package/build/esm/blocks/Tabs/index.js +28 -0
- package/build/esm/blocks/Tabs/index.js.map +1 -0
- package/build/esm/blocks/TestEditorBlock/TestEditorBlock.d.ts +5 -0
- package/build/esm/blocks/TestEditorBlock/TestEditorBlock.js +8 -0
- package/build/esm/blocks/TestEditorBlock/TestEditorBlock.js.map +1 -0
- package/build/esm/blocks/TestEditorBlock/form.d.ts +3 -0
- package/build/esm/blocks/TestEditorBlock/form.js +89 -0
- package/build/esm/blocks/TestEditorBlock/form.js.map +1 -0
- package/build/esm/blocks/TestEditorBlock/index.d.ts +11 -0
- package/build/esm/blocks/TestEditorBlock/index.js +14 -0
- package/build/esm/blocks/TestEditorBlock/index.js.map +1 -0
- package/build/esm/components/BlockBase/BlockBase.css +8 -16
- package/build/esm/components/Image/dynamic-form.d.ts +2 -0
- package/build/esm/components/Image/dynamic-form.js +81 -0
- package/build/esm/components/Image/dynamic-form.js.map +1 -0
- package/build/esm/components/editor/ItemWrap/ItemWrap.css +9 -0
- package/build/esm/components/editor/ItemWrap/ItemWrap.d.ts +7 -0
- package/build/esm/components/editor/ItemWrap/ItemWrap.js +11 -0
- package/build/esm/components/editor/ItemWrap/ItemWrap.js.map +1 -0
- package/build/esm/constructor-items.d.ts +22 -6
- package/build/esm/constructor-items.js +75 -1
- package/build/esm/constructor-items.js.map +1 -1
- package/build/esm/containers/PageConstructor/PageConstructor.d.ts +1 -1
- package/build/esm/containers/PageConstructor/PageConstructor.js +20 -12
- package/build/esm/containers/PageConstructor/PageConstructor.js.map +1 -1
- package/build/esm/containers/PageConstructor/Provider.js +2 -0
- package/build/esm/containers/PageConstructor/Provider.js.map +1 -1
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css +10 -6
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +3 -1
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js.map +1 -1
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +7 -6
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js.map +1 -1
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +2 -1
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js.map +1 -1
- package/build/esm/containers/PageConstructor/components/ConstructorLoadable/ConstructorLoadable.js +2 -1
- package/build/esm/containers/PageConstructor/components/ConstructorLoadable/ConstructorLoadable.js.map +1 -1
- package/build/esm/containers/PageConstructor/components/ConstructorRow/ConstructorRow.js +1 -2
- package/build/esm/containers/PageConstructor/components/ConstructorRow/ConstructorRow.js.map +1 -1
- package/build/esm/context/blockIdContext/blockIdContext.d.ts +2 -2
- package/build/esm/context/blockIdContext/blockIdContext.js +1 -1
- package/build/esm/context/blockIdContext/blockIdContext.js.map +1 -1
- package/build/esm/context/editorStoreContext/PCEditorStoreContext.d.ts +7 -0
- package/build/esm/context/editorStoreContext/PCEditorStoreContext.js +6 -0
- package/build/esm/context/editorStoreContext/PCEditorStoreContext.js.map +1 -0
- package/build/esm/context/editorStoreContext/PCEditorStoreProvider.d.ts +5 -0
- package/build/esm/context/editorStoreContext/PCEditorStoreProvider.js +29 -0
- package/build/esm/context/editorStoreContext/PCEditorStoreProvider.js.map +1 -0
- package/build/esm/context/editorStoreContext/index.d.ts +2 -0
- package/build/esm/context/editorStoreContext/index.js +3 -0
- package/build/esm/context/editorStoreContext/index.js.map +1 -0
- package/build/esm/editor/components/CodeEditor/CodeEditor.d.ts +1 -2
- package/build/esm/editor/components/CodeEditor/CodeEditor.js +4 -6
- package/build/esm/editor/components/CodeEditor/CodeEditor.js.map +1 -1
- package/build/esm/editor/data/templates/test-editor-block.json +18 -0
- package/build/esm/grid/Grid/Grid.css +2 -6
- package/build/esm/hooks/useAnalytics.js +1 -1
- package/build/esm/hooks/useAnalytics.js.map +1 -1
- package/build/esm/hooks/usePCEditorBlockMouseEvents.d.ts +8 -0
- package/build/esm/hooks/usePCEditorBlockMouseEvents.js +47 -0
- package/build/esm/hooks/usePCEditorBlockMouseEvents.js.map +1 -0
- package/build/esm/hooks/usePCEditorBlockSelection.d.ts +2 -0
- package/build/esm/hooks/usePCEditorBlockSelection.js +27 -0
- package/build/esm/hooks/usePCEditorBlockSelection.js.map +1 -0
- package/build/esm/hooks/usePCEditorInitializeEvents.d.ts +7 -0
- package/build/esm/hooks/usePCEditorInitializeEvents.js +58 -0
- package/build/esm/hooks/usePCEditorInitializeEvents.js.map +1 -0
- package/build/esm/hooks/usePCEditorItemWrap.d.ts +10 -0
- package/build/esm/hooks/usePCEditorItemWrap.js +17 -0
- package/build/esm/hooks/usePCEditorItemWrap.js.map +1 -0
- package/build/esm/hooks/usePCEditorStore.d.ts +1 -0
- package/build/esm/hooks/usePCEditorStore.js +8 -0
- package/build/esm/hooks/usePCEditorStore.js.map +1 -0
- package/build/esm/hooks/usePostMessageAPI.d.ts +4 -0
- package/build/esm/hooks/usePostMessageAPI.js +24 -0
- package/build/esm/hooks/usePostMessageAPI.js.map +1 -0
- package/build/esm/models/constructor-items/blocks.d.ts +1 -0
- package/build/esm/models/constructor-items/blocks.js +1 -0
- package/build/esm/models/constructor-items/blocks.js.map +1 -1
- package/build/esm/models/constructor.d.ts +4 -1
- package/build/esm/models/constructor.js.map +1 -1
- package/build/esm/models/navigation.d.ts +2 -2
- package/build/esm/models/navigation.js.map +1 -1
- package/build/esm/navigation/components/DesktopNavigation/DesktopNavigation.js +2 -2
- package/build/esm/navigation/components/DesktopNavigation/DesktopNavigation.js.map +1 -1
- package/build/esm/navigation/components/Navigation/Navigation.d.ts +2 -2
- package/build/esm/navigation/components/Navigation/Navigation.js +1 -1
- package/build/esm/navigation/components/Navigation/Navigation.js.map +1 -1
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +4 -1
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js.map +1 -1
- package/build/esm/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.js +4 -1
- package/build/esm/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.js.map +1 -1
- package/build/esm/navigation/containers/Layout/Layout.css +0 -1
- package/build/esm/navigation/containers/Layout/Layout.js +2 -1
- package/build/esm/navigation/containers/Layout/Layout.js.map +1 -1
- package/build/esm/navigation/models.d.ts +1 -1
- package/build/esm/navigation/models.js.map +1 -1
- package/build/esm/schema/constants.js +2 -0
- package/build/esm/schema/constants.js.map +1 -1
- package/build/esm/schema/index.d.ts +256 -0
- package/build/esm/schema/index.js +11 -5
- package/build/esm/schema/index.js.map +1 -1
- package/build/esm/sub-blocks/BackgroundCard/dynamic-form.d.ts +2 -0
- package/build/esm/sub-blocks/BackgroundCard/dynamic-form.js +79 -0
- package/build/esm/sub-blocks/BackgroundCard/dynamic-form.js.map +1 -0
- package/build/esm/sub-blocks/BackgroundCard/index.d.ts +3 -0
- package/build/esm/sub-blocks/BackgroundCard/index.js +19 -0
- package/build/esm/sub-blocks/BackgroundCard/index.js.map +1 -0
- package/build/esm/sub-blocks/BannerCard/BannerCard.js +2 -1
- package/build/esm/sub-blocks/BannerCard/BannerCard.js.map +1 -1
- package/build/esm/sub-blocks/BannerCard/index.d.ts +3 -0
- package/build/esm/sub-blocks/BannerCard/index.js +21 -0
- package/build/esm/sub-blocks/BannerCard/index.js.map +1 -0
- package/build/esm/sub-blocks/BasicCard/index.d.ts +3 -0
- package/build/esm/sub-blocks/BasicCard/index.js +17 -0
- package/build/esm/sub-blocks/BasicCard/index.js.map +1 -0
- package/build/esm/sub-blocks/Content/index.d.ts +3 -0
- package/build/esm/sub-blocks/Content/index.js +17 -0
- package/build/esm/sub-blocks/Content/index.js.map +1 -0
- package/build/esm/sub-blocks/Content/schema.d.ts +1 -0
- package/build/esm/sub-blocks/Content/schema.js +1 -0
- package/build/esm/sub-blocks/Content/schema.js.map +1 -1
- package/build/esm/sub-blocks/Divider/index.d.ts +3 -0
- package/build/esm/sub-blocks/Divider/index.js +13 -0
- package/build/esm/sub-blocks/Divider/index.js.map +1 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.js +1 -1
- package/build/esm/sub-blocks/ImageCard/ImageCard.js.map +1 -1
- package/build/esm/sub-blocks/ImageCard/index.d.ts +3 -0
- package/build/esm/sub-blocks/ImageCard/index.js +17 -0
- package/build/esm/sub-blocks/ImageCard/index.js.map +1 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js.map +1 -1
- package/build/esm/sub-blocks/LayoutItem/index.d.ts +3 -0
- package/build/esm/sub-blocks/LayoutItem/index.js +23 -0
- package/build/esm/sub-blocks/LayoutItem/index.js.map +1 -0
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +211 -206
- package/build/esm/sub-blocks/LayoutItem/schema.js +3 -2
- package/build/esm/sub-blocks/LayoutItem/schema.js.map +1 -1
- package/build/esm/sub-blocks/MediaCard/index.d.ts +3 -0
- package/build/esm/sub-blocks/MediaCard/index.js +20 -0
- package/build/esm/sub-blocks/MediaCard/index.js.map +1 -0
- package/build/esm/sub-blocks/PriceCard/index.d.ts +3 -0
- package/build/esm/sub-blocks/PriceCard/index.js +30 -0
- package/build/esm/sub-blocks/PriceCard/index.js.map +1 -0
- package/build/esm/sub-blocks/PriceDetailed/PriceDetailed.js +1 -1
- package/build/esm/sub-blocks/PriceDetailed/PriceDetailed.js.map +1 -1
- package/build/esm/sub-blocks/PriceDetailed/index.d.ts +4 -0
- package/build/esm/sub-blocks/PriceDetailed/index.js +32 -0
- package/build/esm/sub-blocks/PriceDetailed/index.js.map +1 -0
- package/build/esm/sub-blocks/Quote/index.d.ts +3 -0
- package/build/esm/sub-blocks/Quote/index.js +20 -0
- package/build/esm/sub-blocks/Quote/index.js.map +1 -0
- package/build/esm/utils/editor.d.ts +2 -0
- package/build/esm/utils/editor.js +21 -0
- package/build/esm/utils/editor.js.map +1 -0
- package/build/esm/utils/form-generator.d.ts +9 -0
- package/build/esm/utils/form-generator.js +126 -0
- package/build/esm/utils/form-generator.js.map +1 -0
- package/build/esm/utils/index.d.ts +1 -0
- package/build/esm/utils/index.js +1 -0
- package/build/esm/utils/index.js.map +1 -1
- package/build/esm/utils/navigation.d.ts +3 -0
- package/build/esm/utils/navigation.js +9 -0
- package/build/esm/utils/navigation.js.map +1 -0
- package/package.json +15 -3
- package/schema/index.js +1 -1
- package/server/models/constructor-items/blocks.d.ts +1 -0
- package/server/models/constructor-items/blocks.js +1 -0
- package/server/models/constructor.d.ts +4 -1
- package/server/models/navigation.d.ts +2 -2
- package/server/utils/index.d.ts +1 -0
- package/server/utils/index.js +1 -0
- package/server/utils/navigation.d.ts +3 -0
- package/server/utils/navigation.js +15 -0
- package/styles/mixins.scss +9 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import '@diplodoc/transform/dist/js/yfm
|
|
2
|
+
import '@diplodoc/transform/dist/js/yfm';
|
|
3
3
|
import { blockMap, navItemMap, subBlockMap } from "../../constructor-items.js";
|
|
4
4
|
import { CustomConfig, CustomItems, NavigationData, PageContent, ShouldRenderBlock } from "../../models/index.js";
|
|
5
5
|
import './PageConstructor.css';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import '@diplodoc/transform/dist/js/yfm
|
|
3
|
+
import '@diplodoc/transform/dist/js/yfm';
|
|
4
|
+
import { ThemeProvider } from '@gravity-ui/uikit';
|
|
4
5
|
import BackgroundMedia from "../../components/BackgroundMedia/BackgroundMedia.js";
|
|
5
6
|
import BrandFooter from "../../components/BrandFooter/BrandFooter.js";
|
|
6
7
|
import RootCn from "../../components/RootCn/index.js";
|
|
@@ -9,17 +10,26 @@ import { AnimateContext } from "../../context/animateContext/index.js";
|
|
|
9
10
|
import { InnerContext } from "../../context/innerContext/index.js";
|
|
10
11
|
import { ProjectSettingsContext } from "../../context/projectSettingsContext/index.js";
|
|
11
12
|
import { useTheme } from "../../context/theme/index.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
13
|
+
import { usePCEditorInitializeEvents } from "../../hooks/usePCEditorInitializeEvents.js";
|
|
14
|
+
import { usePCEditorStore } from "../../hooks/usePCEditorStore.js";
|
|
15
|
+
import { BlockTypes, HeaderBlockTypes, NavigationItemTypes, SubBlockTypes, } from "../../models/index.js";
|
|
14
16
|
import Layout from "../../navigation/containers/Layout/Layout.js";
|
|
15
|
-
import { block as cnBlock, getCustomItems, getCustomTypes,
|
|
16
|
-
import { ConstructorBlocks } from "./components/
|
|
17
|
-
import { ConstructorHeader } from "./components/ConstructorItem/index.js";
|
|
17
|
+
import { block as cnBlock, getCustomItems, getCustomTypes, getThemedValue } from "../../utils/index.js";
|
|
18
|
+
import { ConstructorBlocks } from "./components/index.js";
|
|
18
19
|
import { ConstructorRow } from "./components/ConstructorRow/index.js";
|
|
19
20
|
import './PageConstructor.css';
|
|
20
21
|
const b = cnBlock('page-constructor');
|
|
21
22
|
export const Constructor = (props) => {
|
|
22
23
|
const { content: { blocks = [], background } = {}, renderMenu, shouldRenderBlock, navigation, custom, isBranded, microdata, } = props;
|
|
24
|
+
const [content, setContent] = React.useState({
|
|
25
|
+
blocks,
|
|
26
|
+
background,
|
|
27
|
+
navigation,
|
|
28
|
+
});
|
|
29
|
+
const theme = useTheme();
|
|
30
|
+
const store = usePCEditorStore();
|
|
31
|
+
const { initialized } = store;
|
|
32
|
+
usePCEditorInitializeEvents({ initialContent: { blocks, background, navigation }, setContent });
|
|
23
33
|
const { context } = React.useMemo(() => ({
|
|
24
34
|
context: {
|
|
25
35
|
blockTypes: [...BlockTypes, ...getCustomTypes(['blocks', 'headers'], custom)],
|
|
@@ -46,15 +56,13 @@ export const Constructor = (props) => {
|
|
|
46
56
|
microdata,
|
|
47
57
|
},
|
|
48
58
|
}), [custom, shouldRenderBlock, microdata]);
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
const themedBackground = getThemedValue(background, theme);
|
|
53
|
-
return (_jsx(InnerContext.Provider, { value: context, children: _jsx(RootCn, { className: b(), children: _jsxs("div", { className: b('wrapper'), children: [themedBackground && (_jsx(BackgroundMedia, { ...themedBackground, className: b('background') })), _jsxs(Layout, { navigation: navigation, children: [renderMenu && renderMenu(), header && (_jsx(ConstructorHeader, { data: header, blockKey: BlockType.HeaderBlock })), _jsx(Grid, { children: restBlocks && (_jsx(ConstructorRow, { children: _jsx(ConstructorBlocks, { items: restBlocks }) })) })] }), isBranded && _jsx(BrandFooter, {})] }) }) }));
|
|
59
|
+
const restBlocks = content.blocks;
|
|
60
|
+
const themedBackground = getThemedValue(content.background, theme);
|
|
61
|
+
return (_jsx(InnerContext.Provider, { value: context, children: _jsx(RootCn, { className: b('', { ['with-editor']: initialized }), children: _jsxs("div", { className: b('wrapper'), children: [themedBackground && (_jsx(BackgroundMedia, { ...themedBackground, className: b('background') })), _jsxs(Layout, { navigation: content.navigation, children: [renderMenu && renderMenu(), restBlocks && (_jsx(ConstructorRow, { children: _jsx(ConstructorBlocks, { items: restBlocks }) }))] }), isBranded && _jsx(BrandFooter, {})] }) }) }));
|
|
54
62
|
};
|
|
55
63
|
export const PageConstructor = (props) => {
|
|
56
64
|
const { isAnimationEnabled = true } = React.useContext(ProjectSettingsContext);
|
|
57
65
|
const { content: { animated = isAnimationEnabled } = {}, ...rest } = props;
|
|
58
|
-
return (_jsx(AnimateContext.Provider, { value: { animated }, children: _jsx(Constructor, { content: props.content, ...rest }) }));
|
|
66
|
+
return (_jsx(ThemeProvider, { children: _jsx(AnimateContext.Provider, { value: { animated }, children: _jsx(Constructor, { content: props.content, ...rest }) }) }));
|
|
59
67
|
};
|
|
60
68
|
//# sourceMappingURL=PageConstructor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageConstructor.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/PageConstructor.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,
|
|
1
|
+
{"version":3,"file":"PageConstructor.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/PageConstructor.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,iCAAiC,CAAC;AACzC,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,eAAe,4DAAyD;AAC/E,OAAO,WAAW,oDAAiD;AACnE,OAAO,MAAM,yCAAgC;AAC7C,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAC,mCAAgC;AAC1E,OAAO,EAAC,cAAc,EAAC,8CAAqC;AAC5D,OAAO,EAAC,YAAY,EAAC,4CAAmC;AACxD,OAAO,EAAC,sBAAsB,EAAC,sDAA6C;AAC5E,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,2BAA2B,EAAC,mDAAgD;AACpF,OAAO,EAAC,gBAAgB,EAAC,wCAAqC;AAC9D,OAAO,EACH,UAAU,EAGV,gBAAgB,EAEhB,mBAAmB,EAInB,aAAa,GAChB,8BAAqB;AACtB,OAAO,MAAM,qDAAkD;AAC/D,OAAO,EAAC,KAAK,IAAI,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAC,6BAAoB;AAE7F,OAAO,EAAC,iBAAiB,EAAC,8BAAqB;AAC/C,OAAO,EAAC,cAAc,EAAC,6CAAoC;AAE3D,OAAO,uBAAuB,CAAC;AAE/B,MAAM,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAkBtC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAA2B,EAAE,EAAE;IACvD,MAAM,EACF,OAAO,EAAE,EAAC,MAAM,GAAG,EAAE,EAAE,UAAU,EAAC,GAAG,EAAE,EACvC,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,MAAM,EAC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C,QAAQ,IAAC,KAAK,EAAE,EAAC,QAAQ,EAAC,YACtC,KAAC,WAAW,IAAC,OAAO,EAAE,KAAK,CAAC,OAAO,KAAM,IAAI,GAAI,GAC3B,GACd,CACnB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport '@diplodoc/transform/dist/js/yfm';\nimport {ThemeProvider} from '@gravity-ui/uikit';\n\nimport BackgroundMedia from '../../components/BackgroundMedia/BackgroundMedia';\nimport BrandFooter from '../../components/BrandFooter/BrandFooter';\nimport RootCn from '../../components/RootCn';\nimport {blockMap, navItemMap, subBlockMap} from '../../constructor-items';\nimport {AnimateContext} from '../../context/animateContext';\nimport {InnerContext} from '../../context/innerContext';\nimport {ProjectSettingsContext} from '../../context/projectSettingsContext';\nimport {useTheme} from '../../context/theme';\nimport {usePCEditorInitializeEvents} from '../../hooks/usePCEditorInitializeEvents';\nimport {usePCEditorStore} from '../../hooks/usePCEditorStore';\nimport {\n BlockTypes,\n CustomConfig,\n CustomItems,\n HeaderBlockTypes,\n NavigationData,\n NavigationItemTypes,\n PageContent,\n PageContentWithNavigation,\n ShouldRenderBlock,\n SubBlockTypes,\n} from '../../models';\nimport Layout from '../../navigation/containers/Layout/Layout';\nimport {block as cnBlock, getCustomItems, getCustomTypes, getThemedValue} from '../../utils';\n\nimport {ConstructorBlocks} from './components';\nimport {ConstructorRow} from './components/ConstructorRow';\n\nimport './PageConstructor.scss';\n\nconst b = cnBlock('page-constructor');\n\nexport type ItemMap = typeof blockMap & typeof subBlockMap & CustomItems;\n\nexport type NavItemMap = typeof navItemMap & CustomItems;\n\nexport interface PageConstructorProps {\n content?: PageContent;\n shouldRenderBlock?: ShouldRenderBlock;\n custom?: CustomConfig;\n renderMenu?: () => React.ReactNode;\n navigation?: NavigationData;\n isBranded?: boolean;\n microdata?: {\n contentUpdatedDate?: string;\n };\n}\n\nexport const Constructor = (props: PageConstructorProps) => {\n const {\n content: {blocks = [], background} = {},\n renderMenu,\n shouldRenderBlock,\n navigation,\n custom,\n isBranded,\n microdata,\n } = props;\n\n const [content, setContent] = React.useState<PageContentWithNavigation>({\n blocks,\n background,\n navigation,\n });\n\n const theme = useTheme();\n\n const store = usePCEditorStore();\n const {initialized} = store;\n\n usePCEditorInitializeEvents({initialContent: {blocks, background, navigation}, setContent});\n\n const {context} = React.useMemo(\n () => ({\n context: {\n blockTypes: [...BlockTypes, ...getCustomTypes(['blocks', 'headers'], custom)],\n subBlockTypes: [...SubBlockTypes, ...getCustomTypes(['subBlocks'], custom)],\n headerBlockTypes: [...HeaderBlockTypes, ...getCustomTypes(['headers'], custom)],\n navigationBlockTypes: [\n ...NavigationItemTypes,\n ...getCustomTypes(['navigation'], custom),\n ],\n itemMap: {\n ...blockMap,\n ...subBlockMap,\n ...getCustomItems(['blocks', 'headers', 'subBlocks'], custom),\n },\n navItemMap: {\n ...navItemMap,\n ...getCustomItems(['navigation'], custom),\n },\n loadables: custom?.loadable,\n shouldRenderBlock,\n customization: {\n decorators: custom?.decorators,\n },\n microdata,\n },\n }),\n [custom, shouldRenderBlock, microdata],\n );\n\n const restBlocks = content.blocks;\n const themedBackground = getThemedValue(content.background, theme);\n\n return (\n <InnerContext.Provider value={context}>\n <RootCn className={b('', {['with-editor']: initialized})}>\n <div className={b('wrapper')}>\n {themedBackground && (\n <BackgroundMedia {...themedBackground} className={b('background')} />\n )}\n <Layout navigation={content.navigation}>\n {renderMenu && renderMenu()}\n {restBlocks && (\n <ConstructorRow>\n <ConstructorBlocks items={restBlocks} />\n </ConstructorRow>\n )}\n </Layout>\n {isBranded && <BrandFooter />}\n </div>\n </RootCn>\n </InnerContext.Provider>\n );\n};\n\nexport const PageConstructor = (props: PageConstructorProps) => {\n const {isAnimationEnabled = true} = React.useContext(ProjectSettingsContext);\n const {content: {animated = isAnimationEnabled} = {}, ...rest} = props;\n\n return (\n <ThemeProvider>\n <AnimateContext.Provider value={{animated}}>\n <Constructor content={props.content} {...rest} />\n </AnimateContext.Provider>\n </ThemeProvider>\n );\n};\n"]}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { DEFAULT_THEME } from "../../components/constants.js";
|
|
4
4
|
import { AnalyticsContext } from "../../context/analyticsContext/index.js";
|
|
5
|
+
import { PCEditorStoreProvider } from "../../context/editorStoreContext/index.js";
|
|
5
6
|
import { DEFAULT_FORMS_CONTEXT_VALUE, FormsContext, } from "../../context/formsContext/FormsContext.js";
|
|
6
7
|
import { ImageContext } from "../../context/imageContext/index.js";
|
|
7
8
|
import { LocaleContext } from "../../context/localeContext/index.js";
|
|
@@ -25,6 +26,7 @@ export const PageConstructorProvider = (props) => {
|
|
|
25
26
|
_jsx(AnalyticsContext.Provider, { value: analytics }),
|
|
26
27
|
_jsx(FormsContext.Provider, { value: forms }),
|
|
27
28
|
_jsx(SSRContext.Provider, { value: { isServer: ssrConfig?.isServer } }),
|
|
29
|
+
_jsx(PCEditorStoreProvider, {}),
|
|
28
30
|
].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);
|
|
29
31
|
/* eslint-enable react/jsx-key */
|
|
30
32
|
return _jsx(React.Fragment, { children: context });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/Provider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAC,sCAAmC;AACzD,OAAO,EAAC,gBAAgB,EAAwB,gDAAuC;AACvF,OAAO,EACH,2BAA2B,EAC3B,YAAY,GAEf,mDAAgD;AACjD,OAAO,EAAC,YAAY,EAAoB,4CAAmC;AAC3E,OAAO,EAAC,aAAa,EAAqB,6CAAoC;AAC9E,OAAO,EAAC,eAAe,EAAuB,+CAAsC;AACpF,OAAO,EAAC,WAAW,EAAmB,eAAe,EAAC,iDAA8C;AACpG,OAAO,EAAC,aAAa,EAA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AAK,EAAE,KAAK,GAAI;QACvC,KAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,GAAI;QAC7C,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAI;QACpD,KAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,GAAI;QAC5C,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS,GAAI;QAC/C,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,GAAI;QACvC,KAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC,GAAI;QAC/D,KAAC,qBAAqB,KAAG;KAC5B,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;IACpF,iCAAiC;IAEjC,OAAO,KAAC,KAAK,CAAC,QAAQ,cAAE,OAAO,GAAkB,CAAC;AACtD,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {DEFAULT_THEME} from '../../components/constants';\nimport {AnalyticsContext, AnalyticsContextProps} from '../../context/analyticsContext';\nimport {PCEditorStoreProvider} from '../../context/editorStoreContext';\nimport {\n DEFAULT_FORMS_CONTEXT_VALUE,\n FormsContext,\n FormsContextProps,\n} from '../../context/formsContext/FormsContext';\nimport {ImageContext, ImageContextProps} from '../../context/imageContext';\nimport {LocaleContext, LocaleContextProps} from '../../context/localeContext';\nimport {LocationContext, LocationContextProps} from '../../context/locationContext';\nimport {MapsContext, MapsContextType, initialMapValue} from '../../context/mapsContext/mapsContext';\nimport {MobileContext} from '../../context/mobileContext';\nimport {\n ProjectSettingsContext,\n ProjectSettingsContextProps,\n} from '../../context/projectSettingsContext';\nimport {SSRContext, SSRContextProps} from '../../context/ssrContext';\nimport {ThemeContext} from '../../context/theme';\nimport {Theme} from '../../models';\n\nexport interface PageConstructorProviderProps {\n isMobile?: boolean;\n locale?: LocaleContextProps;\n location?: LocationContextProps;\n ssrConfig?: SSRContextProps;\n theme?: Theme;\n mapsContext?: MapsContextType;\n projectSettings?: ProjectSettingsContextProps;\n analytics?: AnalyticsContextProps;\n forms?: FormsContextProps;\n image?: ImageContextProps;\n}\n\nexport const PageConstructorProvider = (\n props: React.PropsWithChildren<PageConstructorProviderProps>,\n) => {\n const {\n isMobile,\n mapsContext = initialMapValue,\n locale = {},\n location = {},\n analytics = {},\n ssrConfig = {},\n projectSettings = {},\n theme = DEFAULT_THEME,\n children,\n image = {},\n forms = DEFAULT_FORMS_CONTEXT_VALUE,\n } = props;\n\n /* eslint-disable react/jsx-key */\n const context = [\n <ThemeContext.Provider value={{theme}} />,\n <ProjectSettingsContext.Provider value={projectSettings} />,\n <LocaleContext.Provider value={locale} />,\n <ImageContext.Provider value={image} />,\n <LocationContext.Provider value={location} />,\n <MobileContext.Provider value={Boolean(isMobile)} />,\n <MapsContext.Provider value={mapsContext} />,\n <AnalyticsContext.Provider value={analytics} />,\n <FormsContext.Provider value={forms} />,\n <SSRContext.Provider value={{isServer: ssrConfig?.isServer}} />,\n <PCEditorStoreProvider />,\n ].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);\n /* eslint-enable react/jsx-key */\n\n return <React.Fragment>{context}</React.Fragment>;\n};\n"]}
|
package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
3
|
.pc-constructor-block.pc-constructor-block.pc-constructor-block.pc-constructor-block_indentTop_0 {
|
|
4
|
-
|
|
4
|
+
padding-top: 0;
|
|
5
5
|
}
|
|
6
6
|
.pc-constructor-block.pc-constructor-block.pc-constructor-block.pc-constructor-block_indentTop_xs {
|
|
7
|
-
|
|
7
|
+
padding-top: 16px;
|
|
8
8
|
}
|
|
9
9
|
.pc-constructor-block.pc-constructor-block.pc-constructor-block.pc-constructor-block_indentTop_s {
|
|
10
|
-
|
|
10
|
+
padding-top: 24px;
|
|
11
11
|
}
|
|
12
12
|
.pc-constructor-block.pc-constructor-block.pc-constructor-block.pc-constructor-block_indentTop_m {
|
|
13
|
-
|
|
13
|
+
padding-top: 32px;
|
|
14
14
|
}
|
|
15
15
|
.pc-constructor-block.pc-constructor-block.pc-constructor-block.pc-constructor-block_indentTop_l {
|
|
16
|
-
|
|
16
|
+
padding-top: 48px;
|
|
17
17
|
}
|
|
18
18
|
.pc-constructor-block.pc-constructor-block.pc-constructor-block.pc-constructor-block_indentTop_xl {
|
|
19
|
-
|
|
19
|
+
padding-top: 64px;
|
|
20
20
|
}
|
|
21
21
|
.pc-constructor-block.pc-constructor-block.pc-constructor-block.pc-constructor-block_indentBottom_0 {
|
|
22
22
|
padding-bottom: 0;
|
|
@@ -35,4 +35,8 @@ unpredictable css rules order in build */
|
|
|
35
35
|
}
|
|
36
36
|
.pc-constructor-block.pc-constructor-block.pc-constructor-block.pc-constructor-block_indentBottom_xl {
|
|
37
37
|
padding-bottom: 64px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.pc-page-constructor_with-editor .pc-constructor-block {
|
|
41
|
+
cursor: pointer;
|
|
38
42
|
}
|
package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js
CHANGED
|
@@ -3,12 +3,14 @@ import * as React from 'react';
|
|
|
3
3
|
import pick from "lodash/pick.js";
|
|
4
4
|
import BlockBase from "../../../../components/BlockBase/BlockBase.js";
|
|
5
5
|
import { BlockDecoration } from "../../../../customization/BlockDecoration.js";
|
|
6
|
+
import { usePCEditorItemWrap } from "../../../../hooks/usePCEditorItemWrap.js";
|
|
6
7
|
import { block } from "../../../../utils/index.js";
|
|
7
8
|
import './ConstructorBlock.css';
|
|
8
9
|
const b = block('constructor-block');
|
|
9
10
|
export const ConstructorBlock = ({ index = 0, data, children, }) => {
|
|
11
|
+
const { blockRef, adminBlockMouseEvents } = usePCEditorItemWrap(index);
|
|
10
12
|
const { type } = data;
|
|
11
13
|
const blockBaseProps = React.useMemo(() => pick(data, ['anchor', 'visible', 'resetPaddings', 'indent']), [data]);
|
|
12
|
-
return (_jsx(BlockDecoration, { type: type, index: index, ...blockBaseProps, children: _jsx(BlockBase, { className: b({ type }), ...blockBaseProps, children: children }) }));
|
|
14
|
+
return (_jsx("div", { ref: blockRef, ...adminBlockMouseEvents, children: _jsx(BlockDecoration, { type: type, index: index, ...blockBaseProps, children: _jsx(BlockBase, { className: b({ type }), ...blockBaseProps, children: children }) }) }));
|
|
13
15
|
};
|
|
14
16
|
//# sourceMappingURL=ConstructorBlock.js.map
|
package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstructorBlock.js","sourceRoot":"../../../../../../src","sources":["containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,IAAI,uBAAoB;AAE/B,OAAO,SAAS,sDAAmD;AACnE,OAAO,EAAC,eAAe,EAAC,qDAAkD;AAE1E,OAAO,EAAC,KAAK,EAAC,mCAA0B;AAExC,OAAO,wBAAwB,CAAC;AAMhC,MAAM,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAAC,CAAC;AAErC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC7B,KAAK,GAAG,CAAC,EACT,IAAI,EACJ,QAAQ,GACqC,EAAE,EAAE;IACjD,MAAM,EAAC,IAAI,EAAC,GAAG,IAAI,CAAC;IACpB,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAChC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC,EAClE,CAAC,IAAI,CAAC,CACT,CAAC;IAEF,OAAO,CACH,KAAC,eAAe,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,KAAM,cAAc,YACzD,KAAC,SAAS,IAAC,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAC,CAAC,KAAM,cAAc,YAC9C,QAAQ,GACD,GACE,
|
|
1
|
+
{"version":3,"file":"ConstructorBlock.js","sourceRoot":"../../../../../../src","sources":["containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,IAAI,uBAAoB;AAE/B,OAAO,SAAS,sDAAmD;AACnE,OAAO,EAAC,eAAe,EAAC,qDAAkD;AAC1E,OAAO,EAAC,mBAAmB,EAAC,iDAA8C;AAE1E,OAAO,EAAC,KAAK,EAAC,mCAA0B;AAExC,OAAO,wBAAwB,CAAC;AAMhC,MAAM,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAAC,CAAC;AAErC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC7B,KAAK,GAAG,CAAC,EACT,IAAI,EACJ,QAAQ,GACqC,EAAE,EAAE;IACjD,MAAM,EAAC,QAAQ,EAAE,qBAAqB,EAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAErE,MAAM,EAAC,IAAI,EAAC,GAAG,IAAI,CAAC;IACpB,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAChC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC,EAClE,CAAC,IAAI,CAAC,CACT,CAAC;IAEF,OAAO,CACH,cAAK,GAAG,EAAE,QAAQ,KAAM,qBAAqB,YACzC,KAAC,eAAe,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,KAAM,cAAc,YACzD,KAAC,SAAS,IAAC,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAC,CAAC,KAAM,cAAc,YAC9C,QAAQ,GACD,GACE,GAChB,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport pick from 'lodash/pick';\n\nimport BlockBase from '../../../../components/BlockBase/BlockBase';\nimport {BlockDecoration} from '../../../../customization/BlockDecoration';\nimport {usePCEditorItemWrap} from '../../../../hooks/usePCEditorItemWrap';\nimport {BlockDecorationProps, ConstructorBlock as ConstructorBlockType} from '../../../../models';\nimport {block} from '../../../../utils';\n\nimport './ConstructorBlock.scss';\n\ninterface ConstructorBlockProps extends Pick<BlockDecorationProps, 'index'> {\n data: ConstructorBlockType;\n}\n\nconst b = block('constructor-block');\n\nexport const ConstructorBlock = ({\n index = 0,\n data,\n children,\n}: React.PropsWithChildren<ConstructorBlockProps>) => {\n const {blockRef, adminBlockMouseEvents} = usePCEditorItemWrap(index);\n\n const {type} = data;\n const blockBaseProps = React.useMemo(\n () => pick(data, ['anchor', 'visible', 'resetPaddings', 'indent']),\n [data],\n );\n\n return (\n <div ref={blockRef} {...adminBlockMouseEvents}>\n <BlockDecoration type={type} index={index} {...blockBaseProps}>\n <BlockBase className={b({type})} {...blockBaseProps}>\n {children}\n </BlockBase>\n </BlockDecoration>\n </div>\n );\n};\n"]}
|
package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js
CHANGED
|
@@ -8,8 +8,9 @@ import { ConstructorBlock } from "../ConstructorBlock/ConstructorBlock.js";
|
|
|
8
8
|
import { ConstructorItem } from "../ConstructorItem/index.js";
|
|
9
9
|
import { ConstructorLoadable } from "../ConstructorLoadable/index.js";
|
|
10
10
|
export const ConstructorBlocks = ({ items }) => {
|
|
11
|
-
const { blockTypes, loadables, itemMap, shouldRenderBlock } = React.useContext(InnerContext);
|
|
12
|
-
const
|
|
11
|
+
const { blockTypes, subBlockTypes, loadables, itemMap, shouldRenderBlock } = React.useContext(InnerContext);
|
|
12
|
+
const allBlocks = [...blockTypes, ...subBlockTypes];
|
|
13
|
+
const renderer = (parentId = '', withoutConstructorBlockWrapper = false, item, index) => {
|
|
13
14
|
if (!itemMap[item.type]) {
|
|
14
15
|
return parentId ? null : (_jsx(BlockDecoration, { type: item.type, index: index, children: null }));
|
|
15
16
|
}
|
|
@@ -30,15 +31,15 @@ export const ConstructorBlocks = ({ items }) => {
|
|
|
30
31
|
else {
|
|
31
32
|
let children;
|
|
32
33
|
if ('children' in item && item.children) {
|
|
33
|
-
children = item.children.map(renderer.bind(null, blockId));
|
|
34
|
+
children = item.children.map(renderer.bind(null, blockId, true));
|
|
34
35
|
}
|
|
35
|
-
itemElement = (_jsx(ConstructorItem, { data: item, blockKey:
|
|
36
|
+
itemElement = (_jsx(ConstructorItem, { data: item, blockKey: index, children: children }, blockId));
|
|
36
37
|
}
|
|
37
|
-
return
|
|
38
|
+
return allBlocks.includes(item.type) && !withoutConstructorBlockWrapper ? (
|
|
38
39
|
//TODO: replace ConstructorBlock (and delete it) with BlockBase when all
|
|
39
40
|
// components relying on constructor inner structure like Slider or blog-constructor will be refactored
|
|
40
41
|
_jsx(ConstructorBlock, { data: item, index: index, children: itemElement }, blockId)) : (itemElement);
|
|
41
42
|
};
|
|
42
|
-
return _jsx(React.Fragment, { children: items.map(renderer.bind(null, '')) });
|
|
43
|
+
return _jsx(React.Fragment, { children: items.map(renderer.bind(null, '', false)) });
|
|
43
44
|
};
|
|
44
45
|
//# sourceMappingURL=ConstructorBlocks.js.map
|
package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstructorBlocks.js","sourceRoot":"../../../../../../src","sources":["containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,GAAG,sBAAmB;AAE7B,OAAO,EAAC,YAAY,EAAC,kDAAyC;AAC9D,OAAO,EAAC,eAAe,EAAC,qDAAkD;AAO1E,OAAO,EAAC,WAAW,EAAC,mCAA0B;AAC9C,OAAO,EAAC,gBAAgB,EAAC,gDAA6C;AACtE,OAAO,EAAC,eAAe,EAAC,oCAA2B;AACnD,OAAO,EAAC,mBAAmB,EAAC,wCAA+B;AAM3D,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IAC3E,MAAM,EAAC,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAC,
|
|
1
|
+
{"version":3,"file":"ConstructorBlocks.js","sourceRoot":"../../../../../../src","sources":["containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,GAAG,sBAAmB;AAE7B,OAAO,EAAC,YAAY,EAAC,kDAAyC;AAC9D,OAAO,EAAC,eAAe,EAAC,qDAAkD;AAO1E,OAAO,EAAC,WAAW,EAAC,mCAA0B;AAC9C,OAAO,EAAC,gBAAgB,EAAC,gDAA6C;AACtE,OAAO,EAAC,eAAe,EAAC,oCAA2B;AACnD,OAAO,EAAC,mBAAmB,EAAC,wCAA+B;AAM3D,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IAC3E,MAAM,EAAC,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAC,GACpE,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAEnC,MAAM,SAAS,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,aAAa,CAAC,CAAC;IAEpD,MAAM,QAAQ,GAAG,CACb,QAAQ,GAAG,EAAE,EACb,8BAA8B,GAAG,KAAK,EACtC,IAA0B,EAC1B,KAAa,EACY,EA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IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;YACrF,CAAC;YAED,WAAW,GAAG,CACV,KAAC,eAAe,IAAC,IAAI,EAAE,IAAI,EAAgB,QAAQ,EAAE,KAAK,YACrD,QAAQ,IADqB,OAAO,CAEvB,CACrB,CAAC;QACN,CAAC;QAED,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;QACtE,wEAAwE;QACxE,uGAAuG;QACvG,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,EAAgB,KAAK,EAAE,KAAK,YACnD,WAAW,IADmB,OAAO,CAEvB,CACtB,CAAC,CAAC,CAAC,CACA,WAAW,CACd,CAAC;IACN,CAAC,CAAC;IAEF,OAAO,KAAC,KAAK,CAAC,QAAQ,cAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,GAAkB,CAAC;AACxF,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport get from 'lodash/get';\n\nimport {InnerContext} from '../../../../context/innerContext';\nimport {BlockDecoration} from '../../../../customization/BlockDecoration';\nimport {\n BlockType,\n ConstructorBlock as ConstructorBlockType,\n LoadableProps,\n SubBlock,\n} from '../../../../models';\nimport {getBlockKey} from '../../../../utils';\nimport {ConstructorBlock} from '../ConstructorBlock/ConstructorBlock';\nimport {ConstructorItem} from '../ConstructorItem';\nimport {ConstructorLoadable} from '../ConstructorLoadable';\n\nexport interface ConstructorBlocksProps {\n items: ConstructorBlockType[];\n}\n\nexport const ConstructorBlocks: React.FC<ConstructorBlocksProps> = ({items}) => {\n const {blockTypes, subBlockTypes, loadables, itemMap, shouldRenderBlock} =\n React.useContext(InnerContext);\n\n const allBlocks = [...blockTypes, ...subBlockTypes];\n\n const renderer = (\n parentId = '',\n withoutConstructorBlockWrapper = false,\n item: ConstructorBlockType,\n index: number,\n ): React.ReactElement | null => {\n if (!itemMap[item.type]) {\n return parentId ? null : (\n <BlockDecoration type={item.type as BlockType} index={index}>\n {null}\n </BlockDecoration>\n );\n }\n\n let itemElement;\n const key = getBlockKey(item, index);\n const blockId = parentId ? `${parentId}_${key}` : key;\n if (shouldRenderBlock && !shouldRenderBlock(item, blockId)) {\n return null;\n }\n\n if ('loadable' in item && item.loadable) {\n const {source, serviceId, params} = item.loadable as LoadableProps;\n const config = get(loadables, source);\n\n if (!config) {\n return null;\n }\n\n itemElement = (\n <ConstructorLoadable\n block={item}\n key={blockId}\n blockKey={blockId}\n config={config}\n serviceId={serviceId}\n params={params}\n />\n );\n } else {\n let children;\n if ('children' in item && item.children) {\n children = (item.children as SubBlock[]).map(renderer.bind(null, blockId, true));\n }\n\n itemElement = (\n <ConstructorItem data={item} key={blockId} blockKey={index}>\n {children}\n </ConstructorItem>\n );\n }\n\n return allBlocks.includes(item.type) && !withoutConstructorBlockWrapper ? (\n //TODO: replace ConstructorBlock (and delete it) with BlockBase when all\n // components relying on constructor inner structure like Slider or blog-constructor will be refactored\n <ConstructorBlock data={item} key={blockId} index={index}>\n {itemElement}\n </ConstructorBlock>\n ) : (\n itemElement\n );\n };\n\n return <React.Fragment>{items.map(renderer.bind(null, '', false))}</React.Fragment>;\n};\n"]}
|
package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ConstructorBlock } from "../../../../models/index.js";
|
|
3
3
|
export interface ConstructorItemProps {
|
|
4
4
|
data: ConstructorBlock;
|
|
5
|
-
blockKey:
|
|
5
|
+
blockKey: number;
|
|
6
6
|
}
|
|
7
7
|
export declare const ConstructorItem: ({ data, blockKey, children, }: React.PropsWithChildren<ConstructorItemProps>) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare const ConstructorHeader: ({ data, blockKey, }: Pick<ConstructorItemProps, "data" | "blockKey">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,9 +5,10 @@ import { InnerContext } from "../../../../context/innerContext/index.js";
|
|
|
5
5
|
import { BlockDecoration } from "../../../../customization/BlockDecoration.js";
|
|
6
6
|
export const ConstructorItem = ({ data, blockKey, children, }) => {
|
|
7
7
|
const { itemMap } = React.useContext(InnerContext);
|
|
8
|
+
const parentId = React.useContext(BlockIdContext);
|
|
8
9
|
const { type, ...rest } = data;
|
|
9
10
|
const Component = itemMap[type];
|
|
10
|
-
return (_jsx(BlockIdContext.Provider, { value: blockKey, children: _jsx(Component, { ...rest, children: children }) }));
|
|
11
|
+
return (_jsx(BlockIdContext.Provider, { value: [...parentId, blockKey], children: _jsx(Component, { ...rest, children: children }) }, blockKey));
|
|
11
12
|
};
|
|
12
13
|
export const ConstructorHeader = ({ data, blockKey, }) => (_jsx(BlockDecoration, { type: data.type, children: _jsx(ConstructorItem, { data: data, blockKey: blockKey }, data.type) }));
|
|
13
14
|
//# sourceMappingURL=ConstructorItem.js.map
|
package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstructorItem.js","sourceRoot":"../../../../../../src","sources":["containers/PageConstructor/components/ConstructorItem/ConstructorItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,cAAc,EAAC,oDAA2C;AAClE,OAAO,EAAC,YAAY,EAAC,kDAAyC;AAC9D,OAAO,EAAC,eAAe,EAAC,qDAAkD;AAQ1E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC5B,IAAI,EACJ,QAAQ,EACR,QAAQ,GACoC,EAAE,EAAE;IAChD,MAAM,EAAC,OAAO,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,EAAC,IAAI,EAAE,GAAG,IAAI,EAAC,GAAG,IAAI,CAAC;IAE7B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAE7B,CAAC;IAEF,OAAO,CACH,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"ConstructorItem.js","sourceRoot":"../../../../../../src","sources":["containers/PageConstructor/components/ConstructorItem/ConstructorItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,cAAc,EAAC,oDAA2C;AAClE,OAAO,EAAC,YAAY,EAAC,kDAAyC;AAC9D,OAAO,EAAC,eAAe,EAAC,qDAAkD;AAQ1E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC5B,IAAI,EACJ,QAAQ,EACR,QAAQ,GACoC,EAAE,EAAE;IAChD,MAAM,EAAC,OAAO,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAClD,MAAM,EAAC,IAAI,EAAE,GAAG,IAAI,EAAC,GAAG,IAAI,CAAC;IAE7B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAE7B,CAAC;IAEF,OAAO,CACH,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,CAAC,GAAG,QAAQ,EAAE,QAAQ,CAAC,YACnD,KAAC,SAAS,OAAK,IAAI,YAAG,QAAQ,GAAa,IADe,QAAQ,CAE5C,CAC7B,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAC9B,IAAI,EACJ,QAAQ,GACsC,EAAE,EAAE,CAAC,CACnD,KAAC,eAAe,IAAC,IAAI,EAAE,IAAI,CAAC,IAAiB,YACzC,KAAC,eAAe,IAAC,IAAI,EAAE,IAAI,EAAkB,QAAQ,EAAE,QAAQ,IAA7B,IAAI,CAAC,IAAI,CAAwB,GACrD,CACrB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BlockIdContext} from '../../../../context/blockIdContext';\nimport {InnerContext} from '../../../../context/innerContext';\nimport {BlockDecoration} from '../../../../customization/BlockDecoration';\nimport {BlockType, ConstructorBlock} from '../../../../models';\n\nexport interface ConstructorItemProps {\n data: ConstructorBlock;\n blockKey: number;\n}\n\nexport const ConstructorItem = ({\n data,\n blockKey,\n children,\n}: React.PropsWithChildren<ConstructorItemProps>) => {\n const {itemMap} = React.useContext(InnerContext);\n const parentId = React.useContext(BlockIdContext);\n const {type, ...rest} = data;\n\n const Component = itemMap[type] as React.ComponentType<\n React.ComponentProps<(typeof itemMap)[typeof type]>\n >;\n\n return (\n <BlockIdContext.Provider value={[...parentId, blockKey]} key={blockKey}>\n <Component {...rest}>{children}</Component>\n </BlockIdContext.Provider>\n );\n};\n\nexport const ConstructorHeader = ({\n data,\n blockKey,\n}: Pick<ConstructorItemProps, 'data' | 'blockKey'>) => (\n <BlockDecoration type={data.type as BlockType}>\n <ConstructorItem data={data} key={data.type} blockKey={blockKey} />\n </BlockDecoration>\n);\n"]}
|
package/build/esm/containers/PageConstructor/components/ConstructorLoadable/ConstructorLoadable.js
CHANGED
|
@@ -9,6 +9,7 @@ export const ConstructorLoadable = (props) => {
|
|
|
9
9
|
const { type } = block;
|
|
10
10
|
const { fetch, component: ChildComponent } = config;
|
|
11
11
|
const Component = itemMap[type];
|
|
12
|
-
|
|
12
|
+
const parentId = React.useContext(BlockIdContext);
|
|
13
|
+
return (_jsx(BlockIdContext.Provider, { value: [...parentId, Number(blockKey)], children: _jsx(Loadable, { block: block, blockKey: blockKey, Component: Component, ChildComponent: ChildComponent, fetch: fetch, serviceId: serviceId, params: params }, blockKey) }, blockKey));
|
|
13
14
|
};
|
|
14
15
|
//# sourceMappingURL=ConstructorLoadable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstructorLoadable.js","sourceRoot":"../../../../../../src","sources":["containers/PageConstructor/components/ConstructorLoadable/ConstructorLoadable.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,cAAc,EAAC,oDAA2C;AAClE,OAAO,EAAC,YAAY,EAAC,kDAAyC;AAE9D,OAAO,QAAmC,sCAAmC;AAO7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAA+B,EAAE,EAAE;IACnE,MAAM,EAAC,OAAO,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,EAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAC3D,MAAM,EAAC,IAAI,EAAC,GAAG,KAAK,CAAC;IACrB,MAAM,EAAC,KAAK,EAAE,SAAS,EAAE,cAAc,EAAC,GAAG,MAAM,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAE7B,CAAC;
|
|
1
|
+
{"version":3,"file":"ConstructorLoadable.js","sourceRoot":"../../../../../../src","sources":["containers/PageConstructor/components/ConstructorLoadable/ConstructorLoadable.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,cAAc,EAAC,oDAA2C;AAClE,OAAO,EAAC,YAAY,EAAC,kDAAyC;AAE9D,OAAO,QAAmC,sCAAmC;AAO7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAA+B,EAAE,EAAE;IACnE,MAAM,EAAC,OAAO,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,EAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAC3D,MAAM,EAAC,IAAI,EAAC,GAAG,KAAK,CAAC;IACrB,MAAM,EAAC,KAAK,EAAE,SAAS,EAAE,cAAc,EAAC,GAAG,MAAM,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAE7B,CAAC;IACF,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAElD,OAAO,CACH,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,CAAC,GAAG,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,YAC3D,KAAC,QAAQ,IAEL,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,IAPT,QAAQ,CAQf,IAVgE,QAAQ,CAWpD,CAC7B,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BlockIdContext} from '../../../../context/blockIdContext';\nimport {InnerContext} from '../../../../context/innerContext';\nimport {LoadableConfigItem} from '../../../../models';\nimport Loadable, {LoadableComponentsProps} from '../../../Loadable/Loadable';\n\ninterface ConstructorLoadableProps\n extends Omit<LoadableComponentsProps, 'Component' | 'ChildComponent' | 'fetch'> {\n config: LoadableConfigItem;\n}\n\nexport const ConstructorLoadable = (props: ConstructorLoadableProps) => {\n const {itemMap} = React.useContext(InnerContext);\n const {block, blockKey, config, serviceId, params} = props;\n const {type} = block;\n const {fetch, component: ChildComponent} = config;\n const Component = itemMap[type] as React.Component<\n React.ComponentProps<(typeof itemMap)[typeof type]>\n >;\n const parentId = React.useContext(BlockIdContext);\n\n return (\n <BlockIdContext.Provider value={[...parentId, Number(blockKey)]} key={blockKey}>\n <Loadable\n key={blockKey}\n block={block}\n blockKey={blockKey}\n Component={Component}\n ChildComponent={ChildComponent}\n fetch={fetch}\n serviceId={serviceId}\n params={params}\n />\n </BlockIdContext.Provider>\n );\n};\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Col, Row } from "../../../../grid/index.js";
|
|
3
2
|
import { block } from "../../../../utils/index.js";
|
|
4
3
|
import './ConstructorRow.css';
|
|
5
4
|
const b = block('constructor-row');
|
|
6
|
-
export const ConstructorRow = ({ children }) => children ?
|
|
5
|
+
export const ConstructorRow = ({ children }) => children ? _jsx("div", { className: b(), children: children }) : null;
|
|
7
6
|
//# sourceMappingURL=ConstructorRow.js.map
|
package/build/esm/containers/PageConstructor/components/ConstructorRow/ConstructorRow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstructorRow.js","sourceRoot":"../../../../../../src","sources":["containers/PageConstructor/components/ConstructorRow/ConstructorRow.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"ConstructorRow.js","sourceRoot":"../../../../../../src","sources":["containers/PageConstructor/components/ConstructorRow/ConstructorRow.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,KAAK,EAAC,mCAA0B;AAExC,OAAO,sBAAsB,CAAC;AAE9B,MAAM,CAAC,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAEnC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAC,QAAQ,EAA8B,EAAE,EAAE,CACtE,QAAQ,CAAC,CAAC,CAAC,cAAK,SAAS,EAAE,CAAC,EAAE,YAAG,QAAQ,GAAO,CAAC,CAAC,CAAC,IAAI,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {block} from '../../../../utils';\n\nimport './ConstructorRow.scss';\n\nconst b = block('constructor-row');\n\nexport const ConstructorRow = ({children}: React.PropsWithChildren<{}>) =>\n children ? <div className={b()}>{children}</div> : null;\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export type BlockIdContextProp =
|
|
3
|
-
export declare const BlockIdContext: React.Context<
|
|
2
|
+
export type BlockIdContextProp = number[];
|
|
3
|
+
export declare const BlockIdContext: React.Context<BlockIdContextProp>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockIdContext.js","sourceRoot":"../../../../src","sources":["context/blockIdContext/blockIdContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nexport type BlockIdContextProp =
|
|
1
|
+
{"version":3,"file":"blockIdContext.js","sourceRoot":"../../../../src","sources":["context/blockIdContext/blockIdContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nexport type BlockIdContextProp = number[];\n\nexport const BlockIdContext = React.createContext<BlockIdContextProp>([]);\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StoreApi } from 'zustand';
|
|
3
|
+
import { EditorState } from "../../../common/store.js";
|
|
4
|
+
export interface PCEditorStoreContextProps {
|
|
5
|
+
state: StoreApi<EditorState>;
|
|
6
|
+
}
|
|
7
|
+
export declare const PCEditorStoreContext: React.Context<PCEditorStoreContextProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PCEditorStoreContext.js","sourceRoot":"../../../../src","sources":["context/editorStoreContext/PCEditorStoreContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAc,mBAAmB,EAAC,iCAA8B;AAMvE,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC,aAAa,CAA4B;IAC/E,KAAK,EAAE,mBAAmB,EAAE;CAC/B,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {StoreApi} from 'zustand';\n\nimport {EditorState, createPCEditorStore} from '../../../common/store';\n\nexport interface PCEditorStoreContextProps {\n state: StoreApi<EditorState>;\n}\n\nexport const PCEditorStoreContext = React.createContext<PCEditorStoreContextProps>({\n state: createPCEditorStore(),\n});\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { createPCEditorStore } from "../../../common/store.js";
|
|
4
|
+
import { PCEditorStoreContext } from "./PCEditorStoreContext.js";
|
|
5
|
+
export const PCEditorStoreProvider = ({ children }) => {
|
|
6
|
+
const storeRef = React.useRef();
|
|
7
|
+
const syncStore = React.useCallback((message) => {
|
|
8
|
+
if (storeRef.current && message.state) {
|
|
9
|
+
storeRef.current.setState(message.state);
|
|
10
|
+
}
|
|
11
|
+
}, []);
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
const onMessage = (e) => {
|
|
14
|
+
const message = e.data;
|
|
15
|
+
syncStore(message);
|
|
16
|
+
};
|
|
17
|
+
window.addEventListener('message', onMessage);
|
|
18
|
+
return () => {
|
|
19
|
+
window.removeEventListener('message', onMessage);
|
|
20
|
+
};
|
|
21
|
+
}, [syncStore]);
|
|
22
|
+
if (!storeRef.current) {
|
|
23
|
+
storeRef.current = createPCEditorStore();
|
|
24
|
+
}
|
|
25
|
+
return (_jsx(PCEditorStoreContext.Provider, { value: {
|
|
26
|
+
state: storeRef.current,
|
|
27
|
+
}, children: children }));
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=PCEditorStoreProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PCEditorStoreProvider.js","sourceRoot":"../../../../src","sources":["context/editorStoreContext/PCEditorStoreProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAc,mBAAmB,EAAC,iCAA8B;AAGvE,OAAO,EAAC,oBAAoB,EAAC,kCAA+B;AAI5D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAC,QAAQ,EAA6B,EAAE,EAAE;IAC5E,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAyB,CAAC;IAEvD,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,OAAyB,EAAE,EAAE;QAC9D,IAAI,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YACpC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,MAAM,SAAS,GAAG,CAAC,CAAe,EAAE,EAAE;YAClC,MAAM,OAAO,GAAG,CAAC,CAAC,IAAwB,CAAC;YAC3C,SAAS,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAE9C,OAAO,GAAG,EAAE;YACR,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrD,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpB,QAAQ,CAAC,OAAO,GAAG,mBAAmB,EAAE,CAAC;IAC7C,CAAC;IAED,OAAO,CACH,KAAC,oBAAoB,CAAC,QAAQ,IAC1B,KAAK,EAAE;YACH,KAAK,EAAE,QAAQ,CAAC,OAAO;SAC1B,YAEA,QAAQ,GACmB,CACnC,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {StoreApi} from 'zustand';\n\nimport {EditorState, createPCEditorStore} from '../../../common/store';\nimport {StoreSyncMessage} from '../../../common/types';\n\nimport {PCEditorStoreContext} from './PCEditorStoreContext';\n\ninterface PCEditorStoreProviderProps extends React.PropsWithChildren {}\n\nexport const PCEditorStoreProvider = ({children}: PCEditorStoreProviderProps) => {\n const storeRef = React.useRef<StoreApi<EditorState>>();\n\n const syncStore = React.useCallback((message: StoreSyncMessage) => {\n if (storeRef.current && message.state) {\n storeRef.current.setState(message.state);\n }\n }, []);\n\n React.useEffect(() => {\n const onMessage = (e: MessageEvent) => {\n const message = e.data as StoreSyncMessage;\n syncStore(message);\n };\n\n window.addEventListener('message', onMessage);\n\n return () => {\n window.removeEventListener('message', onMessage);\n };\n }, [syncStore]);\n\n if (!storeRef.current) {\n storeRef.current = createPCEditorStore();\n }\n\n return (\n <PCEditorStoreContext.Provider\n value={{\n state: storeRef.current,\n }}\n >\n {children}\n </PCEditorStoreContext.Provider>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../src","sources":["context/editorStoreContext/index.ts"],"names":[],"mappings":"AAAA,0CAAuC;AACvC,2CAAwC","sourcesContent":["export * from './PCEditorStoreContext';\nexport * from './PCEditorStoreProvider';\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { PageContent } from "../../../models/index.js";
|
|
3
2
|
import { CodeEditorMessageProps } from "../../utils/validation.js";
|
|
4
3
|
import './CodeEditor.css';
|
|
@@ -10,5 +9,5 @@ interface CodeEditorProps {
|
|
|
10
9
|
onChange: (content: PageContent) => void;
|
|
11
10
|
message?: CodeEditorMessageProps;
|
|
12
11
|
}
|
|
13
|
-
export declare const CodeEditor:
|
|
12
|
+
export declare const CodeEditor: ({ onChange, validator, fullscreenModeOn, onFullscreenModeOnUpdate, code, }: CodeEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
export {};
|
|
@@ -11,8 +11,7 @@ import { parseCode } from "../../utils/code.js";
|
|
|
11
11
|
import { options } from "./constants.js";
|
|
12
12
|
import './CodeEditor.css';
|
|
13
13
|
const b = block('code-editor');
|
|
14
|
-
const
|
|
15
|
-
export const CodeEditor = React.memo(({ onChange, validator, fullscreenModeOn, onFullscreenModeOnUpdate, code }) => {
|
|
14
|
+
export const CodeEditor = ({ onChange, validator, fullscreenModeOn, onFullscreenModeOnUpdate, code, }) => {
|
|
16
15
|
const [message, setMessage] = React.useState(() => validator(code));
|
|
17
16
|
const { theme = Theme.Light } = React.useContext(EditorContext);
|
|
18
17
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -20,8 +19,7 @@ export const CodeEditor = React.memo(({ onChange, validator, fullscreenModeOn, o
|
|
|
20
19
|
const validationResult = validator(newCode);
|
|
21
20
|
setMessage(validationResult);
|
|
22
21
|
onChange(parseCode(newCode));
|
|
23
|
-
},
|
|
24
|
-
return (_jsxs("div", { className: b({ fullscreen: fullscreenModeOn }), children: [_jsx("div", { className: b('header'), children: _jsx(Button, { view: "flat-secondary", onClick: () => onFullscreenModeOnUpdate(!fullscreenModeOn), children: _jsx(Icon, { data: fullscreenModeOn ? ChevronsCollapseUpRight : ChevronsExpandUpRight, size: 16 }) }) }), _jsx("div", { className: b('code'), children: _jsx(MonacoEditor, {
|
|
25
|
-
}
|
|
26
|
-
CodeEditor.displayName = 'CodeEditor';
|
|
22
|
+
}, 200), [onChange, validator]);
|
|
23
|
+
return (_jsxs("div", { className: b({ fullscreen: fullscreenModeOn }), children: [_jsx("div", { className: b('header'), children: _jsx(Button, { view: "flat-secondary", onClick: () => onFullscreenModeOnUpdate(!fullscreenModeOn), children: _jsx(Icon, { data: fullscreenModeOn ? ChevronsCollapseUpRight : ChevronsExpandUpRight, size: 16 }) }) }), _jsx("div", { className: b('code'), children: _jsx(MonacoEditor, { value: code, language: "yaml", options: options, onChange: onChangeWithValidation, theme: theme === Theme.Dark ? 'vs-dark' : 'vs' }, String(fullscreenModeOn)) }), _jsx("div", { className: b('footer'), children: message && (_jsx("div", { className: b('message-container'), children: _jsx("div", { className: b('message', { status: message.status }), children: message.text }) })) })] }));
|
|
24
|
+
};
|
|
27
25
|
//# sourceMappingURL=CodeEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.js","sourceRoot":"../../../../../src","sources":["editor/components/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CodeEditor.js","sourceRoot":"../../../../../src","sources":["editor/components/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,uBAAuB,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,QAAQ,2BAAwB;AACvC,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAc,KAAK,EAAC,iCAAwB;AACnD,OAAO,EAAC,KAAK,EAAC,gCAAuB;AACrC,OAAO,EAAC,aAAa,EAAC,yBAAsB;AAC5C,OAAO,EAAC,SAAS,EAAC,4BAAyB;AAG3C,OAAO,EAAC,OAAO,EAAC,uBAAoB;AAEpC,OAAO,kBAAkB,CAAC;AAE1B,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;AAW/B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,wBAAwB,EACxB,IAAI,GACU,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,MAAM,EAAC,KAAK,GAAG,KAAK,CAAC,KAAK,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAE9D,uDAAuD;IACvD,MAAM,sBAAsB,GAAG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,CACT,GACC,IACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport {ChevronsCollapseUpRight, ChevronsExpandUpRight} from '@gravity-ui/icons';\nimport {Button, Icon} from '@gravity-ui/uikit';\nimport debounce from 'lodash/debounce';\nimport MonacoEditor from 'react-monaco-editor';\n\nimport {PageContent, Theme} from '../../../models';\nimport {block} from '../../../utils';\nimport {EditorContext} from '../../context';\nimport {parseCode} from '../../utils/code';\nimport {CodeEditorMessageProps} from '../../utils/validation';\n\nimport {options} from './constants';\n\nimport './CodeEditor.scss';\n\nconst b = block('code-editor');\n\ninterface CodeEditorProps {\n code: string;\n fullscreenModeOn: boolean;\n validator: (code: string) => CodeEditorMessageProps;\n onFullscreenModeOnUpdate: (fullscreenModeOn: boolean) => void;\n onChange: (content: PageContent) => void;\n message?: CodeEditorMessageProps;\n}\n\nexport const CodeEditor = ({\n onChange,\n validator,\n fullscreenModeOn,\n onFullscreenModeOnUpdate,\n code,\n}: CodeEditorProps) => {\n const [message, setMessage] = React.useState(() => validator(code));\n const {theme = Theme.Light} = React.useContext(EditorContext);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const onChangeWithValidation = React.useCallback(\n debounce((newCode: string) => {\n const validationResult = validator(newCode);\n\n setMessage(validationResult);\n onChange(parseCode(newCode));\n }, 200),\n [onChange, validator],\n );\n\n return (\n <div className={b({fullscreen: fullscreenModeOn})}>\n <div className={b('header')}>\n <Button\n view=\"flat-secondary\"\n onClick={() => onFullscreenModeOnUpdate(!fullscreenModeOn)}\n >\n <Icon\n data={fullscreenModeOn ? ChevronsCollapseUpRight : ChevronsExpandUpRight}\n size={16}\n />\n </Button>\n </div>\n <div className={b('code')}>\n <MonacoEditor\n key={String(fullscreenModeOn)}\n value={code}\n language=\"yaml\"\n options={options}\n onChange={onChangeWithValidation}\n theme={theme === Theme.Dark ? 'vs-dark' : 'vs'}\n />\n </div>\n <div className={b('footer')}>\n {message && (\n <div className={b('message-container')}>\n <div className={b('message', {status: message.status})}>{message.text}</div>\n </div>\n )}\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template": {
|
|
3
|
+
"type": "test-editor-block",
|
|
4
|
+
"title": "Lorem ipsum dolor sit amet",
|
|
5
|
+
"table": {
|
|
6
|
+
"content": [
|
|
7
|
+
["Lorem", "ipsum 1", "dolor 2", "sit 3"],
|
|
8
|
+
["Lorem 1", "0", "0", "0"],
|
|
9
|
+
["Lorem 2", "0", "0", "1"],
|
|
10
|
+
["Lorem 3", "0", "0", "1"],
|
|
11
|
+
["Lorem 4", "0", "1", "1"],
|
|
12
|
+
["Lorem 5", "1", "1", "1"]
|
|
13
|
+
],
|
|
14
|
+
"legend": ["ipsum 1", "ipsum 2"],
|
|
15
|
+
"justify": ["start", "center", "center", "center"]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|