@gem-sdk/core 1.37.5 → 2.0.0-dev.832
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/AddOn.js +1 -18
- package/dist/cjs/components/ComponentToolbarPreview.js +1 -465
- package/dist/cjs/components/ComponentWrapper.js +1 -46
- package/dist/cjs/components/ComponentWrapperPreview.js +1 -136
- package/dist/cjs/components/Empty.js +1 -7
- package/dist/cjs/components/Render.js +1 -65
- package/dist/cjs/components/Render.liquid.js +14 -288
- package/dist/cjs/components/RenderBlock.js +1 -54
- package/dist/cjs/components/RenderCustomCode.js +3 -56
- package/dist/cjs/components/RenderPreview.js +1 -66
- package/dist/cjs/components/RenderSection.js +1 -23
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +1 -0
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +1 -0
- package/dist/cjs/components/ai-generator/components/PickProduct.js +1 -0
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +1 -0
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -0
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +1 -0
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +1 -0
- package/dist/cjs/components/animation/AnimationWrapper.js +1 -0
- package/dist/cjs/components/constant.js +1 -54
- package/dist/cjs/components/resize/Resize.js +1 -16
- package/dist/cjs/components/resize/Spacing.js +1 -248
- package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -56
- package/dist/cjs/components/theme-section/CreateThemeSection.js +1 -117
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +1 -36
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +1 -102
- package/dist/cjs/components/toolbar/Tooltip.js +1 -22
- package/dist/cjs/contexts/AddonContext.js +1 -36
- package/dist/cjs/contexts/BuilderComponent.js +1 -34
- package/dist/cjs/contexts/BuilderContext.js +1 -35
- package/dist/cjs/contexts/BuilderPreviewContext.js +1 -479
- package/dist/cjs/contexts/CartLineContext.js +1 -29
- package/dist/cjs/contexts/CollectionContext.js +1 -38
- package/dist/cjs/contexts/ModalContext.js +1 -47
- package/dist/cjs/contexts/PageContext.js +1 -44
- package/dist/cjs/contexts/ProductContext.js +1 -156
- package/dist/cjs/contexts/ProductListContext.js +1 -32
- package/dist/cjs/contexts/SectionContext.js +1 -53
- package/dist/cjs/contexts/ShopContext.js +1 -80
- package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-font.generated.js +2 -6
- package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
- package/dist/cjs/graphql/fragments/media.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-little.generated.js +11 -6
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product.generated.js +11 -6
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +3 -9
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
- package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +3 -7
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
- package/dist/cjs/graphql/queries/collection.generated.js +2 -14
- package/dist/cjs/graphql/queries/collections.generated.js +2 -9
- package/dist/cjs/graphql/queries/preview-page.generated.js +2 -14
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
- package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
- package/dist/cjs/graphql/queries/product-value-label.generated.js +2 -6
- package/dist/cjs/graphql/queries/product-variants.generated.js +2 -10
- package/dist/cjs/graphql/queries/products.generated.js +12 -17
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +2 -15
- package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +13 -0
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +34 -0
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +22 -0
- package/dist/cjs/helpers/GlobalEvent.js +1 -19
- package/dist/cjs/helpers/animations.js +1 -213
- package/dist/cjs/helpers/background.js +1 -230
- package/dist/cjs/helpers/borders.js +4 -183
- package/dist/cjs/helpers/carousel.js +1 -58
- package/dist/cjs/helpers/clone-deep.js +1 -5
- package/dist/cjs/helpers/cls.js +1 -16
- package/dist/cjs/helpers/colors.js +1 -184
- package/dist/cjs/helpers/compose-advance-style.js +1 -268
- package/dist/cjs/helpers/constant.js +1 -23
- package/dist/cjs/helpers/convert.js +1 -7
- package/dist/cjs/helpers/covert-entities-html.js +1 -19
- package/dist/cjs/helpers/css-variable.js +1 -7
- package/dist/cjs/helpers/email.js +1 -11
- package/dist/cjs/helpers/filter-toolbar-preview.js +1 -14
- package/dist/cjs/helpers/flatten-connection.js +1 -9
- package/dist/cjs/helpers/get-resonsive-value.js +1 -36
- package/dist/cjs/helpers/get-shortname.js +1 -92
- package/dist/cjs/helpers/icon-list.js +1 -61
- package/dist/cjs/helpers/is-browser.js +1 -9
- package/dist/cjs/helpers/is-defined.js +1 -7
- package/dist/cjs/helpers/is-empty-children.js +1 -15
- package/dist/cjs/helpers/is-safari.js +1 -9
- package/dist/cjs/helpers/layout.js +1 -59
- package/dist/cjs/helpers/load-script.js +1 -31
- package/dist/cjs/helpers/make-style.js +1 -163
- package/dist/cjs/helpers/normalize-builder-data.js +1 -23
- package/dist/cjs/helpers/prefetch-queries.js +1 -78
- package/dist/cjs/helpers/product.js +1 -48
- package/dist/cjs/helpers/queries/get-collection.js +1 -226
- package/dist/cjs/helpers/queries/get-collections.js +1 -21
- package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
- package/dist/cjs/helpers/queries/get-product.js +1 -154
- package/dist/cjs/helpers/queries/get-products.js +1 -163
- package/dist/cjs/helpers/query.js +1 -29
- package/dist/cjs/helpers/radius.js +6 -140
- package/dist/cjs/helpers/render.js +1 -76
- package/dist/cjs/helpers/shadow.js +1 -57
- package/dist/cjs/helpers/size.js +4 -183
- package/dist/cjs/helpers/spacing.js +1 -43
- package/dist/cjs/helpers/tracking/fpixel.js +1 -28
- package/dist/cjs/helpers/tracking/gtag.js +1 -93
- package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
- package/dist/cjs/helpers/typography.js +17 -126
- package/dist/cjs/helpers/variant.js +1 -11
- package/dist/cjs/hooks/animation/animations.js +1 -0
- package/dist/cjs/hooks/animation/useAnimationActions.js +1 -39
- package/dist/cjs/hooks/animation/useAnimationConfig.js +1 -29
- package/dist/cjs/hooks/animation/useAnimationPreview.js +1 -31
- package/dist/cjs/hooks/animation/useAnimationTarget.js +1 -120
- package/dist/cjs/hooks/animation/useApplyAnimation.js +1 -87
- package/dist/cjs/hooks/animation/useLivePageAnimation.js +1 -0
- package/dist/cjs/hooks/cart/use-add-to-cart.js +1 -20
- package/dist/cjs/hooks/cart/use-cart-data.js +1 -28
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +1 -20
- package/dist/cjs/hooks/cart/use-cart-note-update.js +1 -20
- package/dist/cjs/hooks/cart/use-create-cart.js +1 -22
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +1 -20
- package/dist/cjs/hooks/cart/use-update-cart-item.js +1 -20
- package/dist/cjs/hooks/shop/use-collection-query.js +1 -22
- package/dist/cjs/hooks/shop/use-collections-query.js +1 -17
- package/dist/cjs/hooks/shop/use-product-query.js +1 -22
- package/dist/cjs/hooks/shop/use-products-query.js +1 -23
- package/dist/cjs/hooks/shop.js +1 -126
- package/dist/cjs/hooks/use-current-device.js +1 -21
- package/dist/cjs/hooks/use-lazy-video.js +1 -15
- package/dist/cjs/hooks/useAnimations.js +1 -26
- package/dist/cjs/hooks/useCartId.js +1 -44
- package/dist/cjs/hooks/useCartLine.js +1 -11
- package/dist/cjs/hooks/useCartUI.js +1 -48
- package/dist/cjs/hooks/useCollection.js +1 -9
- package/dist/cjs/hooks/useFetchHandle.js +1 -13
- package/dist/cjs/hooks/useFormatMoney.js +1 -58
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +1 -113
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +1 -10
- package/dist/cjs/hooks/useLoadScript.js +1 -32
- package/dist/cjs/hooks/useMoney.js +1 -84
- package/dist/cjs/hooks/usePrevious.js +1 -19
- package/dist/cjs/hooks/useProduct.js +1 -206
- package/dist/cjs/hooks/useProductList.js +1 -21
- package/dist/cjs/hooks/useSuspenseFetch.js +1 -27
- package/dist/cjs/hooks/useSwatchesOptions.js +1 -41
- package/dist/cjs/hooks/useToolbarPostPurchase.js +1 -0
- package/dist/cjs/index.js +1 -361
- package/dist/cjs/types/animations.js +1 -47
- package/dist/cjs/types/appAPI.js +1 -0
- package/dist/cjs/types/global-style.js +1 -15
- package/dist/cjs/types/shop.js +1 -2
- package/dist/cjs/web-components/src/helpers/styles/constant.js +1 -9
- package/dist/esm/components/AddOn.js +1 -14
- package/dist/esm/components/ComponentToolbarPreview.js +1 -463
- package/dist/esm/components/ComponentWrapper.js +1 -42
- package/dist/esm/components/ComponentWrapperPreview.js +1 -132
- package/dist/esm/components/Empty.js +1 -3
- package/dist/esm/components/Render.js +1 -61
- package/dist/esm/components/Render.liquid.js +14 -282
- package/dist/esm/components/RenderBlock.js +1 -50
- package/dist/esm/components/RenderCustomCode.js +3 -52
- package/dist/esm/components/RenderPreview.js +1 -62
- package/dist/esm/components/RenderSection.js +1 -19
- package/dist/esm/components/ai-generator/AIContentGenerator.js +1 -0
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +1 -0
- package/dist/esm/components/ai-generator/components/PickProduct.js +1 -0
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +1 -0
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -0
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +1 -0
- package/dist/esm/components/ai-generator/icons/AIIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +1 -0
- package/dist/esm/components/animation/AnimationWrapper.js +1 -0
- package/dist/esm/components/constant.js +1 -50
- package/dist/esm/components/resize/Resize.js +1 -12
- package/dist/esm/components/resize/Spacing.js +1 -244
- package/dist/esm/components/src/product/helpers/variant-presets.js +1 -54
- package/dist/esm/components/theme-section/CreateThemeSection.js +1 -115
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +1 -34
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +1 -100
- package/dist/esm/components/toolbar/Tooltip.js +1 -18
- package/dist/esm/contexts/AddonContext.js +1 -32
- package/dist/esm/contexts/BuilderComponent.js +1 -31
- package/dist/esm/contexts/BuilderContext.js +1 -32
- package/dist/esm/contexts/BuilderPreviewContext.js +1 -476
- package/dist/esm/contexts/CartLineContext.js +1 -26
- package/dist/esm/contexts/CollectionContext.js +1 -35
- package/dist/esm/contexts/ModalContext.js +1 -44
- package/dist/esm/contexts/PageContext.js +1 -41
- package/dist/esm/contexts/ProductContext.js +1 -153
- package/dist/esm/contexts/ProductListContext.js +1 -28
- package/dist/esm/contexts/SectionContext.js +1 -49
- package/dist/esm/contexts/ShopContext.js +1 -77
- package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-font.generated.js +2 -4
- package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
- package/dist/esm/graphql/fragments/media.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-little.generated.js +11 -4
- package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/product.generated.js +11 -4
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +3 -6
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
- package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/variant.generated.js +2 -4
- package/dist/esm/graphql/mutations/page-view-up.generated.js +3 -5
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
- package/dist/esm/graphql/queries/collection.generated.js +8 -18
- package/dist/esm/graphql/queries/collections.generated.js +3 -8
- package/dist/esm/graphql/queries/preview-page.generated.js +8 -18
- package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
- package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
- package/dist/esm/graphql/queries/product-value-label.generated.js +2 -4
- package/dist/esm/graphql/queries/product-variants.generated.js +4 -10
- package/dist/esm/graphql/queries/products.generated.js +18 -20
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +9 -20
- package/dist/esm/graphql/queries/store-property.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +13 -0
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +34 -0
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +22 -0
- package/dist/esm/helpers/GlobalEvent.js +1 -15
- package/dist/esm/helpers/animations.js +1 -211
- package/dist/esm/helpers/background.js +1 -222
- package/dist/esm/helpers/borders.js +4 -175
- package/dist/esm/helpers/carousel.js +1 -54
- package/dist/esm/helpers/clone-deep.js +1 -3
- package/dist/esm/helpers/cls.js +1 -14
- package/dist/esm/helpers/colors.js +1 -169
- package/dist/esm/helpers/compose-advance-style.js +1 -261
- package/dist/esm/helpers/constant.js +1 -19
- package/dist/esm/helpers/convert.js +1 -4
- package/dist/esm/helpers/covert-entities-html.js +1 -17
- package/dist/esm/helpers/css-variable.js +1 -5
- package/dist/esm/helpers/email.js +1 -6
- package/dist/esm/helpers/filter-toolbar-preview.js +1 -9
- package/dist/esm/helpers/flatten-connection.js +1 -7
- package/dist/esm/helpers/get-resonsive-value.js +1 -31
- package/dist/esm/helpers/get-shortname.js +1 -90
- package/dist/esm/helpers/icon-list.js +1 -58
- package/dist/esm/helpers/is-browser.js +1 -5
- package/dist/esm/helpers/is-defined.js +1 -5
- package/dist/esm/helpers/is-empty-children.js +1 -10
- package/dist/esm/helpers/is-safari.js +1 -5
- package/dist/esm/helpers/layout.js +1 -54
- package/dist/esm/helpers/load-script.js +1 -29
- package/dist/esm/helpers/make-style.js +1 -149
- package/dist/esm/helpers/normalize-builder-data.js +1 -21
- package/dist/esm/helpers/prefetch-queries.js +1 -76
- package/dist/esm/helpers/product.js +1 -44
- package/dist/esm/helpers/queries/get-collection.js +1 -223
- package/dist/esm/helpers/queries/get-collections.js +1 -19
- package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
- package/dist/esm/helpers/queries/get-product.js +1 -150
- package/dist/esm/helpers/queries/get-products.js +1 -161
- package/dist/esm/helpers/query.js +1 -25
- package/dist/esm/helpers/radius.js +6 -132
- package/dist/esm/helpers/render.js +1 -68
- package/dist/esm/helpers/shadow.js +1 -52
- package/dist/esm/helpers/size.js +4 -171
- package/dist/esm/helpers/spacing.js +1 -40
- package/dist/esm/helpers/tracking/fpixel.js +1 -24
- package/dist/esm/helpers/tracking/gtag.js +1 -87
- package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
- package/dist/esm/helpers/typography.js +17 -116
- package/dist/esm/helpers/variant.js +1 -9
- package/dist/esm/hooks/animation/animations.js +1 -0
- package/dist/esm/hooks/animation/useAnimationActions.js +1 -37
- package/dist/esm/hooks/animation/useAnimationConfig.js +1 -27
- package/dist/esm/hooks/animation/useAnimationPreview.js +1 -29
- package/dist/esm/hooks/animation/useAnimationTarget.js +1 -118
- package/dist/esm/hooks/animation/useApplyAnimation.js +1 -83
- package/dist/esm/hooks/animation/useLivePageAnimation.js +1 -0
- package/dist/esm/hooks/cart/use-add-to-cart.js +1 -18
- package/dist/esm/hooks/cart/use-cart-data.js +1 -26
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +1 -18
- package/dist/esm/hooks/cart/use-cart-note-update.js +1 -18
- package/dist/esm/hooks/cart/use-create-cart.js +1 -20
- package/dist/esm/hooks/cart/use-remove-cart-item.js +1 -18
- package/dist/esm/hooks/cart/use-update-cart-item.js +1 -18
- package/dist/esm/hooks/shop/use-collection-query.js +1 -20
- package/dist/esm/hooks/shop/use-collections-query.js +1 -15
- package/dist/esm/hooks/shop/use-product-query.js +1 -20
- package/dist/esm/hooks/shop/use-products-query.js +1 -21
- package/dist/esm/hooks/shop.js +1 -111
- package/dist/esm/hooks/use-current-device.js +1 -19
- package/dist/esm/hooks/use-lazy-video.js +1 -13
- package/dist/esm/hooks/useAnimations.js +1 -24
- package/dist/esm/hooks/useCartId.js +1 -40
- package/dist/esm/hooks/useCartLine.js +1 -7
- package/dist/esm/hooks/useCartUI.js +1 -44
- package/dist/esm/hooks/useCollection.js +1 -7
- package/dist/esm/hooks/useFetchHandle.js +1 -11
- package/dist/esm/hooks/useFormatMoney.js +1 -56
- package/dist/esm/hooks/useInitialSwatchesOptions.js +1 -109
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +1 -6
- package/dist/esm/hooks/useLoadScript.js +1 -28
- package/dist/esm/hooks/useMoney.js +1 -80
- package/dist/esm/hooks/usePrevious.js +1 -17
- package/dist/esm/hooks/useProduct.js +1 -192
- package/dist/esm/hooks/useProductList.js +1 -16
- package/dist/esm/hooks/useSuspenseFetch.js +1 -23
- package/dist/esm/hooks/useSwatchesOptions.js +1 -37
- package/dist/esm/hooks/useToolbarPostPurchase.js +1 -0
- package/dist/esm/index.js +1 -100
- package/dist/esm/types/animations.js +1 -47
- package/dist/esm/types/appAPI.js +1 -0
- package/dist/esm/types/global-style.js +1 -12
- package/dist/esm/web-components/src/helpers/styles/constant.js +1 -7
- package/dist/types/index.d.ts +24802 -6237
- package/package.json +8 -3
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var AddonContext = require('../contexts/AddonContext.js');
|
|
7
|
-
var shop = require('../hooks/shop.js');
|
|
8
|
-
|
|
9
|
-
const AddOn = ({ name })=>{
|
|
10
|
-
const Comp = AddonContext.useAddon(name);
|
|
11
|
-
const plugins = shop.usePluginEnable();
|
|
12
|
-
if (!plugins?.includes(name)) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return /*#__PURE__*/ jsxRuntime.jsx(Comp, {});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
exports.default = AddOn;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),AddonContext=require("../contexts/AddonContext.js"),shop=require("../hooks/shop.js");const AddOn=({name:e})=>{let t=AddonContext.useAddon(e),n=shop.usePluginEnable();return n?.includes(e)?jsxRuntime.jsx(t,{}):null};exports.default=AddOn;
|
|
@@ -1,465 +1 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var react = require('react');
|
|
5
|
-
require('zustand');
|
|
6
|
-
var BuilderPreviewContext = require('../contexts/BuilderPreviewContext.js');
|
|
7
|
-
var ShopContext = require('../contexts/ShopContext.js');
|
|
8
|
-
require('@gem-sdk/adapter-shopify');
|
|
9
|
-
require('swr');
|
|
10
|
-
require('swr/mutation');
|
|
11
|
-
require('vanilla-lazyload');
|
|
12
|
-
require('../hooks/useCartUI.js');
|
|
13
|
-
var CreateThemeSection = require('./theme-section/CreateThemeSection.js');
|
|
14
|
-
var Tooltip = require('./toolbar/Tooltip.js');
|
|
15
|
-
var ThemeSectionStatus = require('./theme-section/ThemeSectionStatus.js');
|
|
16
|
-
var Resize = require('./resize/Resize.js');
|
|
17
|
-
require('../helpers/convert.js');
|
|
18
|
-
|
|
19
|
-
const SECTION_LIMIT = 25;
|
|
20
|
-
const notVisible = (el)=>{
|
|
21
|
-
const overflow = getComputedStyle(el).overflow;
|
|
22
|
-
return overflow !== 'visible';
|
|
23
|
-
};
|
|
24
|
-
const isSection = (el)=>{
|
|
25
|
-
const tag = el.getAttribute('data-component-tag');
|
|
26
|
-
return tag === 'Section';
|
|
27
|
-
};
|
|
28
|
-
const ComponentToolbarPreview = ({ ...props })=>{
|
|
29
|
-
const isThemeSection = props.isThemeSection;
|
|
30
|
-
const editingPageType = ShopContext.useShopStore((s)=>s.pageType);
|
|
31
|
-
const getParents = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.getParents);
|
|
32
|
-
const root = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.getItem('ROOT'));
|
|
33
|
-
const isThemeSectionEditor = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
|
|
34
|
-
const [activeAddSection, setActiveAddSection] = react.useState(null);
|
|
35
|
-
const [isShowParent, setIsShowParent] = react.useState(false);
|
|
36
|
-
const [isShowParentRevert, setIsShowParentRevert] = react.useState(false);
|
|
37
|
-
const [parents, setParents] = react.useState([]);
|
|
38
|
-
const isOverToolbarPosition = (el, parent)=>{
|
|
39
|
-
const parentLenght = parents.length;
|
|
40
|
-
const rect = el.getBoundingClientRect();
|
|
41
|
-
const rectP = parent.getBoundingClientRect();
|
|
42
|
-
// 36px = toolbar active height + 4 spaces
|
|
43
|
-
return rect.top - rectP.top < parentLenght * 36;
|
|
44
|
-
};
|
|
45
|
-
const findOverflowParent = (element, initEl)=>{
|
|
46
|
-
const thisEl = element;
|
|
47
|
-
const origEl = initEl || thisEl;
|
|
48
|
-
if (!thisEl) return;
|
|
49
|
-
if (isSection(thisEl)) return;
|
|
50
|
-
if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
|
|
51
|
-
if (thisEl.parentElement) {
|
|
52
|
-
return findOverflowParent(thisEl.parentElement, origEl);
|
|
53
|
-
} else {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
// Get parents
|
|
58
|
-
const onActiveComponent = react.useCallback((e)=>{
|
|
59
|
-
const detail = e.detail;
|
|
60
|
-
if (detail?.componentUid == props.uid) {
|
|
61
|
-
const currentParents = getParents(props.uid).filter((parent)=>{
|
|
62
|
-
if (parent.uid === 'ROOT') return false;
|
|
63
|
-
if (parent.tag === 'Section' && isThemeSectionEditor) return false;
|
|
64
|
-
if (parent.editorConfigs?.toolbar?.hide) return false;
|
|
65
|
-
if (parent.editorConfigs?.component?.noSetting) return false;
|
|
66
|
-
return true;
|
|
67
|
-
}).slice(0, 3);
|
|
68
|
-
setParents(currentParents);
|
|
69
|
-
} else {
|
|
70
|
-
setParents([]);
|
|
71
|
-
setIsShowParent(false);
|
|
72
|
-
}
|
|
73
|
-
}, [
|
|
74
|
-
setParents,
|
|
75
|
-
getParents,
|
|
76
|
-
props.uid,
|
|
77
|
-
isThemeSectionEditor
|
|
78
|
-
]);
|
|
79
|
-
react.useEffect(()=>{
|
|
80
|
-
window.addEventListener('editor:active-component', onActiveComponent);
|
|
81
|
-
return ()=>{
|
|
82
|
-
window.removeEventListener('editor:active-component', onActiveComponent);
|
|
83
|
-
};
|
|
84
|
-
}, [
|
|
85
|
-
onActiveComponent
|
|
86
|
-
]);
|
|
87
|
-
// End get parents
|
|
88
|
-
if (props.type === 'section') {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
if (props.editorConfigs?.toolbar?.hide) {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
const getSectionNumber = ()=>{
|
|
95
|
-
return root?.childrens?.length || 0;
|
|
96
|
-
};
|
|
97
|
-
const getIndexSection = ()=>{
|
|
98
|
-
if (props.tag !== 'Section') {
|
|
99
|
-
return -1;
|
|
100
|
-
}
|
|
101
|
-
if (root?.childrens?.length) {
|
|
102
|
-
return root.childrens.findIndex((sectionUid)=>sectionUid == props.uid);
|
|
103
|
-
}
|
|
104
|
-
return -1;
|
|
105
|
-
};
|
|
106
|
-
const onShowParent = (e)=>{
|
|
107
|
-
if (!parents.length) return;
|
|
108
|
-
const $target = (e?.target) || null;
|
|
109
|
-
const $toolbar = $target.closest('[data-toolbar-active]');
|
|
110
|
-
if (!$target || !$toolbar) return;
|
|
111
|
-
if (isShowParent) {
|
|
112
|
-
setIsShowParentRevert(false);
|
|
113
|
-
setIsShowParent(false);
|
|
114
|
-
} else {
|
|
115
|
-
const $parentOverflow = findOverflowParent($toolbar, $toolbar);
|
|
116
|
-
if ($parentOverflow) {
|
|
117
|
-
setIsShowParentRevert(true);
|
|
118
|
-
} else {
|
|
119
|
-
const rect = $toolbar.getBoundingClientRect();
|
|
120
|
-
if (rect.top < parents.length * 36) {
|
|
121
|
-
setIsShowParentRevert(true);
|
|
122
|
-
} else {
|
|
123
|
-
setIsShowParentRevert(false);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
setIsShowParent(true);
|
|
127
|
-
}
|
|
128
|
-
const event = new CustomEvent('editor:toolbar:show-parents', {
|
|
129
|
-
bubbles: true,
|
|
130
|
-
detail: {
|
|
131
|
-
value: !isShowParent
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
window.dispatchEvent(event);
|
|
135
|
-
};
|
|
136
|
-
const onDelete = (e)=>{
|
|
137
|
-
e.preventDefault();
|
|
138
|
-
e.stopPropagation();
|
|
139
|
-
const event = new CustomEvent('editor:toolbar:delete-component', {
|
|
140
|
-
bubbles: true,
|
|
141
|
-
detail: {
|
|
142
|
-
componentUid: props.uid,
|
|
143
|
-
isThemeSection: isThemeSection
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
window.dispatchEvent(event);
|
|
147
|
-
return false;
|
|
148
|
-
};
|
|
149
|
-
const onDuplicate = (e)=>{
|
|
150
|
-
e.preventDefault();
|
|
151
|
-
e.stopPropagation();
|
|
152
|
-
if (getSectionNumber() >= SECTION_LIMIT && props.tag == 'Section') {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
const event = new CustomEvent('editor:toolbar:duplicate-component', {
|
|
156
|
-
bubbles: true,
|
|
157
|
-
detail: {
|
|
158
|
-
componentUid: props.uid,
|
|
159
|
-
isThemeSection: isThemeSection
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
window.dispatchEvent(event);
|
|
163
|
-
return false;
|
|
164
|
-
};
|
|
165
|
-
const toolbarName = ()=>{
|
|
166
|
-
return props.customLabel || props.label;
|
|
167
|
-
};
|
|
168
|
-
const onZoomOut = (e)=>{
|
|
169
|
-
e.preventDefault();
|
|
170
|
-
e.stopPropagation();
|
|
171
|
-
const event = new CustomEvent('editor:toolbar:zoom-out-component', {
|
|
172
|
-
bubbles: true,
|
|
173
|
-
detail: {
|
|
174
|
-
componentUid: props.uid
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
window.dispatchEvent(event);
|
|
178
|
-
return false;
|
|
179
|
-
};
|
|
180
|
-
const closeAddSection = ()=>{
|
|
181
|
-
setActiveAddSection(null);
|
|
182
|
-
window.removeEventListener('editor:close-add-section-popup', closeAddSection);
|
|
183
|
-
};
|
|
184
|
-
const onAddSection = (e, position)=>{
|
|
185
|
-
e.preventDefault();
|
|
186
|
-
e.stopPropagation();
|
|
187
|
-
if (getSectionNumber() >= SECTION_LIMIT) {
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
|
-
const $target = e.target;
|
|
191
|
-
if ($target) {
|
|
192
|
-
setActiveAddSection(position);
|
|
193
|
-
const rect = $target.getBoundingClientRect();
|
|
194
|
-
const event = new CustomEvent('editor:toolbar:add-section', {
|
|
195
|
-
bubbles: true,
|
|
196
|
-
detail: {
|
|
197
|
-
componentUid: props.uid,
|
|
198
|
-
position,
|
|
199
|
-
top: rect.top + rect.height / 2
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
window.dispatchEvent(event);
|
|
203
|
-
window.addEventListener('editor:close-add-section-popup', closeAddSection);
|
|
204
|
-
}
|
|
205
|
-
return false;
|
|
206
|
-
};
|
|
207
|
-
const getSectionName = ()=>{
|
|
208
|
-
const checkRenamedSection = props.name && props.name === `Section ${props.uid}`;
|
|
209
|
-
if (getSectionNumber() >= SECTION_LIMIT - 5) {
|
|
210
|
-
return `${checkRenamedSection ? 'Section' : props?.name} ${getIndexSection() + 1}/${SECTION_LIMIT}`;
|
|
211
|
-
}
|
|
212
|
-
return checkRenamedSection ? `Section ${getIndexSection() + 1}` : props?.name;
|
|
213
|
-
};
|
|
214
|
-
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
215
|
-
children: [
|
|
216
|
-
!(props.tag == 'Section' && isThemeSectionEditor) && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
217
|
-
"data-toolbar": true,
|
|
218
|
-
"data-toolbar-section": props.tag == 'Section',
|
|
219
|
-
"data-toolbar-theme-section": props.tag == 'Section' && !!isThemeSection || isThemeSectionEditor,
|
|
220
|
-
"data-toolbar-limit": getIndexSection() >= SECTION_LIMIT,
|
|
221
|
-
children: [
|
|
222
|
-
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
223
|
-
"data-toolbar-show-parent": true,
|
|
224
|
-
onClick: (e)=>onShowParent(e),
|
|
225
|
-
"aria-hidden": "true",
|
|
226
|
-
children: [
|
|
227
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
228
|
-
"data-toolbar-icon-drag": true,
|
|
229
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
230
|
-
width: "16",
|
|
231
|
-
height: "16",
|
|
232
|
-
viewBox: "0 0 16 16",
|
|
233
|
-
fill: "none",
|
|
234
|
-
children: [
|
|
235
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
236
|
-
d: "M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",
|
|
237
|
-
fill: "currentColor"
|
|
238
|
-
}),
|
|
239
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
240
|
-
d: "M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",
|
|
241
|
-
fill: "currentColor"
|
|
242
|
-
}),
|
|
243
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
244
|
-
d: "M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",
|
|
245
|
-
fill: "currentColor"
|
|
246
|
-
}),
|
|
247
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
248
|
-
d: "M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",
|
|
249
|
-
fill: "currentColor"
|
|
250
|
-
}),
|
|
251
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
252
|
-
d: "M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",
|
|
253
|
-
fill: "currentColor"
|
|
254
|
-
}),
|
|
255
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
256
|
-
d: "M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",
|
|
257
|
-
fill: "currentColor"
|
|
258
|
-
})
|
|
259
|
-
]
|
|
260
|
-
})
|
|
261
|
-
}),
|
|
262
|
-
props.tag == 'Section' ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
263
|
-
"data-toolbar-name": true,
|
|
264
|
-
children: getSectionName()
|
|
265
|
-
}) : /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
266
|
-
"data-toolbar-name": true,
|
|
267
|
-
children: toolbarName()
|
|
268
|
-
}),
|
|
269
|
-
props.tag !== 'Section' && parents.length > 0 && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
270
|
-
"data-toolbar-icon-parent": true,
|
|
271
|
-
"data-toolbar-icon-parent-open": isShowParent,
|
|
272
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
273
|
-
width: "16",
|
|
274
|
-
height: "16",
|
|
275
|
-
viewBox: "0 0 16 16",
|
|
276
|
-
fill: "none",
|
|
277
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
278
|
-
d: "M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",
|
|
279
|
-
fill: "currentColor"
|
|
280
|
-
})
|
|
281
|
-
})
|
|
282
|
-
})
|
|
283
|
-
]
|
|
284
|
-
}),
|
|
285
|
-
isShowParent && parents.map((parent, index)=>{
|
|
286
|
-
// Update count columns of Row
|
|
287
|
-
const parentLength = parent?.childrens?.length ?? 0;
|
|
288
|
-
let parent_label = parent.label;
|
|
289
|
-
if (parent.label === 'Row') {
|
|
290
|
-
parent_label = parentLength <= 1 ? parent.label + ' ' + parentLength + ' col' : parent.label + ' ' + parentLength + ' cols';
|
|
291
|
-
}
|
|
292
|
-
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
293
|
-
"data-toolbar-parent": true,
|
|
294
|
-
"data-parent-uid": parent.uid,
|
|
295
|
-
"data-toolbar-theme-section": isThemeSectionEditor,
|
|
296
|
-
"data-toolbar-parent-revert": isShowParentRevert,
|
|
297
|
-
style: {
|
|
298
|
-
top: !isShowParentRevert ? `${-36 * (index + 1)}px` // 32 height + 4 spacing
|
|
299
|
-
: `${36 * (index + 1)}px`
|
|
300
|
-
},
|
|
301
|
-
children: [
|
|
302
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
303
|
-
"data-toolbar-icon-drag": true,
|
|
304
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
305
|
-
width: "16",
|
|
306
|
-
height: "16",
|
|
307
|
-
viewBox: "0 0 16 16",
|
|
308
|
-
fill: "none",
|
|
309
|
-
children: [
|
|
310
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
311
|
-
d: "M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",
|
|
312
|
-
fill: "currentColor"
|
|
313
|
-
}),
|
|
314
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
315
|
-
d: "M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",
|
|
316
|
-
fill: "currentColor"
|
|
317
|
-
}),
|
|
318
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
319
|
-
d: "M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",
|
|
320
|
-
fill: "currentColor"
|
|
321
|
-
}),
|
|
322
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
323
|
-
d: "M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",
|
|
324
|
-
fill: "currentColor"
|
|
325
|
-
}),
|
|
326
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
327
|
-
d: "M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",
|
|
328
|
-
fill: "currentColor"
|
|
329
|
-
}),
|
|
330
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
331
|
-
d: "M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",
|
|
332
|
-
fill: "currentColor"
|
|
333
|
-
})
|
|
334
|
-
]
|
|
335
|
-
})
|
|
336
|
-
}),
|
|
337
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
338
|
-
"data-toolbar-name": true,
|
|
339
|
-
children: parent_label
|
|
340
|
-
})
|
|
341
|
-
]
|
|
342
|
-
}, parent.uid);
|
|
343
|
-
}),
|
|
344
|
-
props.tag === 'Section' && !props.isThemeSection && editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
|
|
345
|
-
...props
|
|
346
|
-
}),
|
|
347
|
-
props.tag == 'Sticky' && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
348
|
-
"data-toolbar-zoom-out": true,
|
|
349
|
-
onClick: (e)=>onZoomOut(e),
|
|
350
|
-
"aria-hidden": "true",
|
|
351
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
352
|
-
width: "16",
|
|
353
|
-
height: "16",
|
|
354
|
-
viewBox: "0 0 16 16",
|
|
355
|
-
fill: "none",
|
|
356
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
357
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
358
|
-
fillRule: "evenodd",
|
|
359
|
-
clipRule: "evenodd",
|
|
360
|
-
d: "M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",
|
|
361
|
-
fill: "currentColor"
|
|
362
|
-
})
|
|
363
|
-
})
|
|
364
|
-
}),
|
|
365
|
-
/*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
|
|
366
|
-
enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
|
|
367
|
-
text: "Page has reached Shopify’s 25 section-limit",
|
|
368
|
-
position: "bottom",
|
|
369
|
-
"data-toolbar-duplicate": true,
|
|
370
|
-
"data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
|
|
371
|
-
onClick: (e)=>onDuplicate(e),
|
|
372
|
-
"aria-hidden": "true",
|
|
373
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
374
|
-
width: "16",
|
|
375
|
-
height: "16",
|
|
376
|
-
viewBox: "0 0 16 16",
|
|
377
|
-
fill: "none",
|
|
378
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
379
|
-
fillRule: "evenodd",
|
|
380
|
-
clipRule: "evenodd",
|
|
381
|
-
d: "M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",
|
|
382
|
-
fill: "currentColor"
|
|
383
|
-
})
|
|
384
|
-
})
|
|
385
|
-
}),
|
|
386
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
387
|
-
"data-toolbar-delete": true,
|
|
388
|
-
onClick: (e)=>onDelete(e),
|
|
389
|
-
"aria-hidden": "true",
|
|
390
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
391
|
-
width: "16",
|
|
392
|
-
height: "16",
|
|
393
|
-
viewBox: "0 0 16 16",
|
|
394
|
-
fill: "none",
|
|
395
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
396
|
-
fillRule: "evenodd",
|
|
397
|
-
clipRule: "evenodd",
|
|
398
|
-
d: "M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",
|
|
399
|
-
fill: "currentColor"
|
|
400
|
-
})
|
|
401
|
-
})
|
|
402
|
-
})
|
|
403
|
-
]
|
|
404
|
-
}),
|
|
405
|
-
editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatus, {
|
|
406
|
-
...props
|
|
407
|
-
}),
|
|
408
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
409
|
-
"data-outline": true,
|
|
410
|
-
"data-outline-section": props.tag == 'Section',
|
|
411
|
-
"data-outline-theme-section": props.tag == 'Section' && !!isThemeSection || isThemeSectionEditor,
|
|
412
|
-
"data-outline-limit": getIndexSection() >= SECTION_LIMIT
|
|
413
|
-
}),
|
|
414
|
-
props.tag == 'Section' && !isThemeSectionEditor && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
415
|
-
children: [
|
|
416
|
-
/*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
|
|
417
|
-
enable: getSectionNumber() >= SECTION_LIMIT,
|
|
418
|
-
text: "Page has reached Shopify’s 25 section-limit",
|
|
419
|
-
position: "top",
|
|
420
|
-
"data-toolbar-add-top": true,
|
|
421
|
-
"data-toolbar-disable": getSectionNumber() >= SECTION_LIMIT,
|
|
422
|
-
"data-toolbar-add-open": activeAddSection == 'above',
|
|
423
|
-
onClick: (e)=>onAddSection(e, 'above'),
|
|
424
|
-
"aria-hidden": "true",
|
|
425
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
426
|
-
width: "16",
|
|
427
|
-
height: "16",
|
|
428
|
-
viewBox: "0 0 16 16",
|
|
429
|
-
fill: "none",
|
|
430
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
431
|
-
d: "M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",
|
|
432
|
-
fill: "#212121"
|
|
433
|
-
})
|
|
434
|
-
})
|
|
435
|
-
}),
|
|
436
|
-
/*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
|
|
437
|
-
enable: getSectionNumber() >= SECTION_LIMIT,
|
|
438
|
-
text: "Page has reached Shopify’s 25 section-limit",
|
|
439
|
-
position: "top",
|
|
440
|
-
"data-toolbar-add-bottom": true,
|
|
441
|
-
"data-toolbar-disable": getSectionNumber() >= SECTION_LIMIT,
|
|
442
|
-
"data-toolbar-add-open": activeAddSection == 'below',
|
|
443
|
-
onClick: (e)=>onAddSection(e, 'below'),
|
|
444
|
-
"aria-hidden": "true",
|
|
445
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
446
|
-
width: "16",
|
|
447
|
-
height: "16",
|
|
448
|
-
viewBox: "0 0 16 16",
|
|
449
|
-
fill: "none",
|
|
450
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
451
|
-
d: "M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",
|
|
452
|
-
fill: "#212121"
|
|
453
|
-
})
|
|
454
|
-
})
|
|
455
|
-
})
|
|
456
|
-
]
|
|
457
|
-
}),
|
|
458
|
-
/*#__PURE__*/ jsxRuntime.jsx(Resize.default, {
|
|
459
|
-
...props
|
|
460
|
-
})
|
|
461
|
-
]
|
|
462
|
-
});
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
exports.ComponentToolbarPreview = ComponentToolbarPreview;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react");require("zustand");var BuilderPreviewContext=require("../contexts/BuilderPreviewContext.js"),ShopContext=require("../contexts/ShopContext.js");require("@gem-sdk/adapter-shopify"),require("swr"),require("swr/mutation"),require("vanilla-lazyload"),require("../hooks/useCartUI.js");var CreateThemeSection=require("./theme-section/CreateThemeSection.js"),AIContentGenerator=require("./ai-generator/AIContentGenerator.js"),AIGenContentLoading=require("./ai-generator/AIGenContentLoading.js"),Tooltip=require("./toolbar/Tooltip.js"),ThemeSectionStatus=require("./theme-section/ThemeSectionStatus.js"),useToolbarPostPurchase=require("../hooks/useToolbarPostPurchase.js"),Resize=require("./resize/Resize.js");require("../helpers/convert.js");const SECTION_LIMIT=25,notVisible=e=>{let t=getComputedStyle(e).overflow;return"visible"!==t},isSection=e=>{let t=e.getAttribute("data-component-tag");return"Section"===t},ComponentToolbarPreview=e=>{let t=e.isThemeSection,i=ShopContext.useShopStore(e=>e.pageType),o=BuilderPreviewContext.useBuilderPreviewStore(e=>e.getParents),n=BuilderPreviewContext.useBuilderPreviewStore(e=>e.getItem("ROOT")),r=BuilderPreviewContext.useBuilderPreviewStore(e=>e.isThemeSectionEditor),[a,l]=react.useState(null),[s,d]=react.useState(!1),[u,c]=react.useState(!1),[C,h]=react.useState([]),[x,m]=react.useState("top"),[p,j]=react.useState(!1),[b,g]=react.useState({width:"",text:""}),[v,S]=react.useState(!1),R=react.useMemo(()=>"POST_PURCHASE"===i,[i]),{checkDisableDelete:w,getTooltipText:f,checkDisableDuplicate:T}=useToolbarPostPurchase.usePostPurchase(e.uid,e.tag||""),P=(e,t)=>{let i=C.length,o=e.getBoundingClientRect(),n=t.getBoundingClientRect();return o.top-n.top<36*i},H=(e,t)=>{let i=t||e;if(e&&!isSection(e))return notVisible(e)&&P(t,e)?e:e.parentElement?H(e.parentElement,i):void 0},V=react.useCallback(()=>{if("Section"==e.tag)return"bottom";let t=document.querySelector('[data-toolbar-active="true"]');if(t){let e=t.getBoundingClientRect();e.top<60?m("bottom"):m("top")}},[e.tag]),M=react.useCallback(t=>{let i=t.detail;if(i?.componentUid==e.uid){V(),R&&(j(w()),g(f()),S(T()));let t=o(e.uid).filter(e=>!("ROOT"===e.uid||"Section"===e.tag&&r||e.editorConfigs?.toolbar?.hide||e.editorConfigs?.component?.noSetting)).slice(0,3);h(t)}else h([]),d(!1)},[e.uid,R,o,w,f,T,r,V]);if(react.useEffect(()=>(window.addEventListener("editor:active-component",M),()=>{window.removeEventListener("editor:active-component",M)}),[M]),"section"===e.type||e.editorConfigs?.toolbar?.hide)return null;let Z=()=>n?.childrens?.length||0,E=()=>"Section"!==e.tag?-1:n?.childrens?.length?n.childrens.findIndex(t=>t==e.uid):-1,L=e=>{if(!C.length)return;let t=e?.target||null,i=t.closest("[data-toolbar-active]");if(!t||!i)return;if(s)c(!1),d(!1);else{let e=H(i,i);if(e)c(!0);else{let e=i.getBoundingClientRect();e.top<36*C.length?c(!0):c(!1)}d(!0)}let o=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!s}});window.dispatchEvent(o)},B=i=>{i.preventDefault(),i.stopPropagation();let o=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:e.uid,isThemeSection:t}});return window.dispatchEvent(o),!1},q=i=>{if(i.preventDefault(),i.stopPropagation(),Z()>=25&&"Section"==e.tag)return!1;let o=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:e.uid,isThemeSection:t}});return window.dispatchEvent(o),!1},I=t=>{t.preventDefault(),t.stopPropagation();let i=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:e.uid}});return window.dispatchEvent(i),!1},A=()=>{l(null),window.removeEventListener("editor:close-add-section-popup",A)},k=(t,i)=>{if(t.preventDefault(),t.stopPropagation(),Z()>=25)return!1;let o=t.target;if(o){l(i);let t=o.getBoundingClientRect(),n=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:e.uid,position:i,top:t.top+t.height/2}});window.dispatchEvent(n),window.addEventListener("editor:close-add-section-popup",A)}return!1},y=()=>{let t=e.name&&e.name===`Section ${e.uid}`;return Z()>=20?`${t?"Section":e?.name} ${E()+1}/25`:t?`Section ${E()+1}`:e?.name};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!("Section"==e.tag&&r)&&jsxRuntime.jsxs("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==e.tag,"data-toolbar-theme-section":"Section"==e.tag&&!!t||r,"data-toolbar-limit":E()>=25,children:[jsxRuntime.jsxs("div",{"data-toolbar-show-parent":!0,onClick:e=>L(e),"aria-hidden":"true",children:[jsxRuntime.jsx("div",{"data-toolbar-icon-drag":!0,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==e.tag?jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:y()}):jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:e.customLabel||e.label}),"Section"!==e.tag&&C.length>0&&jsxRuntime.jsx("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":s,children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),s&&C.map((e,t)=>{let i=e?.childrens?.length??0,o=e.label;return"Row"===e.label&&(o=i<=1?e.label+" "+i+" col":e.label+" "+i+" cols"),jsxRuntime.jsxs("div",{"data-toolbar-parent":!0,"data-parent-uid":e.uid,"data-toolbar-theme-section":r,"data-toolbar-parent-revert":u,style:{top:u?`${36*(t+1)}px`:`${-36*(t+1)}px`},children:[jsxRuntime.jsx("div",{"data-toolbar-icon-drag":!0,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:o})]},e.uid)}),"Section"===e.tag&&!e.isThemeSection&&"STATIC"!==i&&"POST_PURCHASE"!==i&&25>E()&&jsxRuntime.jsx(CreateThemeSection.CreateThemeSection,{...e}),"Section"===e.tag&&jsxRuntime.jsx(AIContentGenerator.AIContentGenerator,{...e}),"Sticky"==e.tag&&jsxRuntime.jsx("div",{"data-toolbar-zoom-out":!0,onClick:e=>I(e),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),jsxRuntime.jsx(Tooltip.default,{enable:"Section"==e.tag&&Z()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==e.tag&&Z()>=25||v,onClick:v?void 0:e=>q(e),"aria-hidden":"true",className:v?"!gp-cursor-not-allowed":"",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),jsxRuntime.jsx(Tooltip.default,{"data-toolbar-delete":!0,onClick:e=>p?null:B(e),enable:p,"data-toolbar-disable":p,width:b.width,text:b.text,position:x,"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]},e.uid),"STATIC"!==i&&"POST_PURCHASE"!==i&&25>E()&&jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatusWrapper,{...e}),jsxRuntime.jsx("div",{"data-outline":!0,"data-outline-section":"Section"==e.tag,"data-outline-theme-section":"Section"==e.tag&&!!t||r,"data-outline-limit":E()>=25},"outline-"+e.uid),"Section"==e.tag&&!r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tooltip.default,{enable:Z()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":Z()>=25,"data-toolbar-add-open":"above"==a,onClick:e=>k(e,"above"),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),jsxRuntime.jsx(Tooltip.default,{enable:Z()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":Z()>=25,"data-toolbar-add-open":"below"==a,onClick:e=>k(e,"below"),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),"Section"===e.tag&&jsxRuntime.jsx(AIGenContentLoading.AIGenContentLoading,{...e}),jsxRuntime.jsx(Resize.default,{...e})]})};var ComponentToolbarPreview$1=react.memo(ComponentToolbarPreview);exports.default=ComponentToolbarPreview$1;
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var react = require('react');
|
|
7
|
-
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
8
|
-
var constant = require('./constant.js');
|
|
9
|
-
var RenderCustomCode = require('./RenderCustomCode.js');
|
|
10
|
-
|
|
11
|
-
const ComponentWrapper = ({ children, ...props })=>{
|
|
12
|
-
if (props.type === 'section') return null;
|
|
13
|
-
const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag);
|
|
14
|
-
const advanced = props.advanced;
|
|
15
|
-
if (constant.disableWrap.includes(props.tag) && /*#__PURE__*/ react.isValidElement(children)) {
|
|
16
|
-
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
17
|
-
children: [
|
|
18
|
-
/*#__PURE__*/ jsxRuntime.jsx(RenderCustomCode.default, {
|
|
19
|
-
uid: props.uid,
|
|
20
|
-
advanced: advanced
|
|
21
|
-
}),
|
|
22
|
-
/*#__PURE__*/ jsxRuntime.jsx(children.type, {
|
|
23
|
-
className: advanced?.cssClass,
|
|
24
|
-
...children.props,
|
|
25
|
-
style,
|
|
26
|
-
advanced
|
|
27
|
-
})
|
|
28
|
-
]
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
32
|
-
children: [
|
|
33
|
-
/*#__PURE__*/ jsxRuntime.jsx(RenderCustomCode.default, {
|
|
34
|
-
uid: props.uid,
|
|
35
|
-
advanced: advanced
|
|
36
|
-
}),
|
|
37
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
38
|
-
style: style,
|
|
39
|
-
className: `${props.uid} ${advanced?.cssClass}`,
|
|
40
|
-
children: children
|
|
41
|
-
})
|
|
42
|
-
]
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
exports.default = ComponentWrapper;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),composeAdvanceStyle=require("../helpers/compose-advance-style.js"),constant=require("./constant.js"),RenderCustomCode=require("./RenderCustomCode.js"),AnimationWrapper=require("./animation/AnimationWrapper.js");const ComponentWrapper=({children:e,pageType:t,...s})=>{if("section"===s.type)return null;let n=composeAdvanceStyle.composeAdvanceStyle(s.advanced,s.tag,t),a=s.advanced,{animation:r}=a??{},i=r?.desktop?.enabled||r?.tablet?.enabled||r?.mobile?.enabled,d=jsxRuntime.jsx("div",{style:n,className:`${s.uid} ${a?.cssClass}`,children:e});return constant.disableWrap.includes(s.tag)&&react.isValidElement(e)&&(d=jsxRuntime.jsx(e.type,{className:a?.cssClass,...e.props,style:n,advanced:a})),i&&(d=jsxRuntime.jsx(AnimationWrapper.default,{children:d,settings:r,tag:s.tag})),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(RenderCustomCode.default,{uid:s.uid,advanced:a}),d]})};exports.default=ComponentWrapper;
|