@gem-sdk/core 1.23.0-staging.321 → 1.23.0-staging.324

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.
@@ -13,9 +13,9 @@ require('../hooks/useCartUI.js');
13
13
  var CreateThemeSection = require('./theme-section/CreateThemeSection.js');
14
14
  var Tooltip = require('./toolbar/Tooltip.js');
15
15
  var ThemeSectionStatus = require('./theme-section/ThemeSectionStatus.js');
16
- var Resize = require('./resize/Resize.js');
17
16
  require('../helpers/convert.js');
18
17
 
18
+ // import Resize from './resize/Resize';
19
19
  const SECTION_LIMIT = 25;
20
20
  const notVisible = (el)=>{
21
21
  const overflow = getComputedStyle(el).overflow;
@@ -462,9 +462,6 @@ const ComponentToolbarPreview = ({ ...props })=>{
462
462
  })
463
463
  })
464
464
  ]
465
- }),
466
- /*#__PURE__*/ jsxRuntime.jsx(Resize.default, {
467
- ...props
468
465
  })
469
466
  ]
470
467
  });
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const convertHTML = (str)=>{
4
+ const symbols = {
5
+ '&': '&',
6
+ '&lt;': '<',
7
+ '&gt;': '>',
8
+ '&nbsp;': ' '
9
+ };
10
+ let newStr = str;
11
+ for(const symbol in symbols){
12
+ if (str.indexOf(symbol) >= 0) {
13
+ newStr = newStr.replaceAll(symbol, symbols[symbol]);
14
+ }
15
+ }
16
+ return newStr;
17
+ };
18
+
19
+ exports.convertHTML = convertHTML;
package/dist/cjs/index.js CHANGED
@@ -60,6 +60,7 @@ var background = require('./helpers/background.js');
60
60
  var query = require('./helpers/query.js');
61
61
  var composeAdvanceStyle = require('./helpers/compose-advance-style.js');
62
62
  var iconList = require('./helpers/icon-list.js');
63
+ var covertEntitiesHtml = require('./helpers/covert-entities-html.js');
63
64
  var useAddToCart = require('./hooks/cart/use-add-to-cart.js');
64
65
  var useCartData = require('./hooks/cart/use-cart-data.js');
65
66
  var useCartDiscountCodesUpdate = require('./hooks/cart/use-cart-discount-codes-update.js');
@@ -262,6 +263,7 @@ exports.removePaddingYInStyle = composeAdvanceStyle.removePaddingYInStyle;
262
263
  exports.splitStyle = composeAdvanceStyle.splitStyle;
263
264
  exports.composePositionLineHeight = iconList.composePositionLineHeight;
264
265
  exports.composePostionIconList = iconList.composePostionIconList;
266
+ exports.convertHTML = covertEntitiesHtml.convertHTML;
265
267
  exports.useAddToCart = useAddToCart.useAddToCart;
266
268
  exports.useCartData = useCartData.useCartData;
267
269
  exports.useCartDiscountCodesUpdate = useCartDiscountCodesUpdate.useCartDiscountCodesUpdate;
@@ -11,9 +11,9 @@ import '../hooks/useCartUI.js';
11
11
  import { CreateThemeSection } from './theme-section/CreateThemeSection.js';
12
12
  import Tooltip from './toolbar/Tooltip.js';
13
13
  import { ThemeSectionStatus } from './theme-section/ThemeSectionStatus.js';
14
- import Resize from './resize/Resize.js';
15
14
  import '../helpers/convert.js';
16
15
 
16
+ // import Resize from './resize/Resize';
17
17
  const SECTION_LIMIT = 25;
18
18
  const notVisible = (el)=>{
19
19
  const overflow = getComputedStyle(el).overflow;
@@ -460,9 +460,6 @@ const ComponentToolbarPreview = ({ ...props })=>{
460
460
  })
461
461
  })
462
462
  ]
463
- }),
464
- /*#__PURE__*/ jsx(Resize, {
465
- ...props
466
463
  })
467
464
  ]
468
465
  });
@@ -0,0 +1,17 @@
1
+ const convertHTML = (str)=>{
2
+ const symbols = {
3
+ '&amp;': '&',
4
+ '&lt;': '<',
5
+ '&gt;': '>',
6
+ '&nbsp;': ' '
7
+ };
8
+ let newStr = str;
9
+ for(const symbol in symbols){
10
+ if (str.indexOf(symbol) >= 0) {
11
+ newStr = newStr.replaceAll(symbol, symbols[symbol]);
12
+ }
13
+ }
14
+ return newStr;
15
+ };
16
+
17
+ export { convertHTML };
package/dist/esm/index.js CHANGED
@@ -61,6 +61,7 @@ export { GRADIENT_BGR_KEY, composeBackgroundCss, getBgImageByDevice, getGradient
61
61
  export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey } from './helpers/query.js';
62
62
  export { composeAdvanceStyle, filterAttrInStyle, filterCornerInStyle, removeAttrInStyle, removePaddingYInStyle, splitStyle } from './helpers/compose-advance-style.js';
63
63
  export { composePositionLineHeight, composePostionIconList } from './helpers/icon-list.js';
64
+ export { convertHTML } from './helpers/covert-entities-html.js';
64
65
  export { useAddToCart } from './hooks/cart/use-add-to-cart.js';
65
66
  export { useCartData } from './hooks/cart/use-cart-data.js';
66
67
  export { useCartDiscountCodesUpdate } from './hooks/cart/use-cart-discount-codes-update.js';
@@ -15980,6 +15980,8 @@ declare const composePositionLineHeight: ({ compose, lineHeight, device, positio
15980
15980
  iconWidth?: Partial<Record<NameDevices$1, number>> | undefined;
15981
15981
  }) => void;
15982
15982
 
15983
+ declare const convertHTML: (str: string) => string;
15984
+
15983
15985
  type Func$6 = ReturnType<typeof addToCartOperation>;
15984
15986
  type Response$6 = Awaited<ReturnType<Func$6>>;
15985
15987
  type Args$5 = Parameters<Func$6>[0];
@@ -16217,4 +16219,4 @@ type PublishedThemePageSelectFragment = Pick<PublishedThemePage, 'id' | 'name' |
16217
16219
 
16218
16220
  declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
16219
16221
 
16220
- export { AddOn, AddonProvider, AddonProviderProps, AliReviewsWidgetType, AlignItemProp, AlignProp, AnimationBaseSetting, AnimationConfig, AnimationDirectionType, AnimationEasingType, AnimationFadeSettingType, AnimationSetting, AnimationSettingType, AnimationShakeSettingType, AnimationSlideSettingType, AnimationTrigger, AnimationTriggerType, AnimationType, AnimationZoomDirectionType, AnimationZoomSettingType, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlTriggerAction, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, DynamicCollection, DynamicProduct, ExtractState, FeraReviewsV3WidgetType, FeraReviewsWidgetType, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GRADIENT_BGR_KEY, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, GrowaveWidgetType, HSLAColorType, HSLColorType, HexColorType, ImageShape$1 as ImageShape, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LaiProductReviewsAdvancedWidgetType, LaiProductReviewsWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices$1 as NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OmnisendWidgetType, OpinewDesignWidgetType, OpinewWidgetType, OptionNormalStyle, OptionSpecialStyle, Options, PageContext, PageProvider, PageProviderProps, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveKey, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, ScaleByDirection, SectionData, SectionEntity, SectionProvider, SectionProviderProps, SettingByAnimationType, SettingByAnimationValues, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeSettingGlobal, SizeType, SpacingType, StampedWidgetType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TriggerConfig, TrustooWidgetType, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, UltimateSalesBoostWidgetType, VariantSelectFragment, VitalsWidgetType, WiserWidgetType, WrapRenderChildren, YotpoReviewsWidgetType, animations, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeBackgroundCss, composeBorderCss, composeCornerCss, composeGridLayout, composeMemo, composePositionLineHeight, composePostionIconList, composeRadius, composeRadiusResponsive, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertOldLayout, dataStringify, fetchMedias, fetchVariants, filterAttrInStyle, filterCornerInStyle, filterToolbarPreview, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getAspectRatioGlobalSize, getBgImageByDevice, getBorderStyle, getCarouselContainerHeight, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getGlobalSizeGap, getGradientBgrStyleByDevice, getGradientBgrStyleForButton, getHeightByShapeGlobalSize, getPaddingGlobalSize, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, getWidthByShapeGlobalSize, getWidthHeightGlobalSize, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isColumnDirectionExist, isDefined, isEmptyChildren, isLocalEnv, isSafari, loadScript, makeAspectRatio, makeContainerWidthOrHeight, makeDotGapToCarouselStyle, makeFixedBgAttachment, makeGlobalSize, makeGlobalSizeHeightResponsive, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleState, makeStyleWithDefault, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, removeAttrInStyle, removeNullUndefined, removePaddingYInStyle, splitStyle, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckAvailableVariantInStock, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useInitialSwatchesOptions, useIsSampleProduct, useIsStorefrontProduct, useIsSyncProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, useMoneyFormat, usePageStore, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
16222
+ export { AddOn, AddonProvider, AddonProviderProps, AliReviewsWidgetType, AlignItemProp, AlignProp, AnimationBaseSetting, AnimationConfig, AnimationDirectionType, AnimationEasingType, AnimationFadeSettingType, AnimationSetting, AnimationSettingType, AnimationShakeSettingType, AnimationSlideSettingType, AnimationTrigger, AnimationTriggerType, AnimationType, AnimationZoomDirectionType, AnimationZoomSettingType, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlTriggerAction, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, DynamicCollection, DynamicProduct, ExtractState, FeraReviewsV3WidgetType, FeraReviewsWidgetType, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GRADIENT_BGR_KEY, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, GrowaveWidgetType, HSLAColorType, HSLColorType, HexColorType, ImageShape$1 as ImageShape, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LaiProductReviewsAdvancedWidgetType, LaiProductReviewsWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices$1 as NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OmnisendWidgetType, OpinewDesignWidgetType, OpinewWidgetType, OptionNormalStyle, OptionSpecialStyle, Options, PageContext, PageProvider, PageProviderProps, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveKey, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, ScaleByDirection, SectionData, SectionEntity, SectionProvider, SectionProviderProps, SettingByAnimationType, SettingByAnimationValues, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeSettingGlobal, SizeType, SpacingType, StampedWidgetType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TriggerConfig, TrustooWidgetType, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, UltimateSalesBoostWidgetType, VariantSelectFragment, VitalsWidgetType, WiserWidgetType, WrapRenderChildren, YotpoReviewsWidgetType, animations, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeBackgroundCss, composeBorderCss, composeCornerCss, composeGridLayout, composeMemo, composePositionLineHeight, composePostionIconList, composeRadius, composeRadiusResponsive, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertHTML, convertOldLayout, dataStringify, fetchMedias, fetchVariants, filterAttrInStyle, filterCornerInStyle, filterToolbarPreview, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getAspectRatioGlobalSize, getBgImageByDevice, getBorderStyle, getCarouselContainerHeight, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getGlobalSizeGap, getGradientBgrStyleByDevice, getGradientBgrStyleForButton, getHeightByShapeGlobalSize, getPaddingGlobalSize, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, getWidthByShapeGlobalSize, getWidthHeightGlobalSize, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isColumnDirectionExist, isDefined, isEmptyChildren, isLocalEnv, isSafari, loadScript, makeAspectRatio, makeContainerWidthOrHeight, makeDotGapToCarouselStyle, makeFixedBgAttachment, makeGlobalSize, makeGlobalSizeHeightResponsive, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleState, makeStyleWithDefault, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, removeAttrInStyle, removeNullUndefined, removePaddingYInStyle, splitStyle, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckAvailableVariantInStock, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useInitialSwatchesOptions, useIsSampleProduct, useIsStorefrontProduct, useIsSyncProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, useMoneyFormat, usePageStore, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.23.0-staging.321",
3
+ "version": "1.23.0-staging.324",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var Spacing = require('./Spacing.js');
7
-
8
- function Resize(props) {
9
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
10
- children: /*#__PURE__*/ jsxRuntime.jsx(Spacing.default, {
11
- ...props
12
- })
13
- });
14
- }
15
-
16
- exports.default = Resize;
@@ -1,195 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var react = require('react');
7
- require('zustand');
8
- var BuilderPreviewContext = require('../../contexts/BuilderPreviewContext.js');
9
- require('swr');
10
- require('@gem-sdk/adapter-shopify');
11
- require('swr/mutation');
12
- require('vanilla-lazyload');
13
- require('../../hooks/useCartUI.js');
14
- require('react-transition-group');
15
- require('@gem-sdk/core');
16
- require('../../helpers/convert.js');
17
-
18
- function Spacing(props) {
19
- const isThemeSectionEditor = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
20
- const $bottomDrag = react.useRef(null);
21
- const $bottomBg = react.useRef(null);
22
- const delayMouseMove = react.useRef(null);
23
- const isDragging = react.useRef(false);
24
- const startY = react.useRef(0);
25
- const marginBottom = react.useRef(0);
26
- const getNewValueMargin = (event)=>{
27
- const top = event.clientY;
28
- const diffY = Math.ceil(top - startY.current);
29
- const currentValue = marginBottom.current || 0;
30
- const newValue = currentValue + diffY >= 0 ? `${currentValue + diffY}px` : `0px`;
31
- return {
32
- newValue
33
- };
34
- };
35
- const onMouseMoveDocument = (event)=>{
36
- if ($bottomDrag.current && $bottomBg.current) {
37
- // $bottomDrag.current.
38
- const { newValue } = getNewValueMargin(event);
39
- $bottomBg.current.style.height = newValue;
40
- $bottomDrag.current.style.top = newValue;
41
- const $component = $bottomDrag.current.closest('[data-toolbar-wrap]');
42
- if ($component) {
43
- $component.style.marginBottom = newValue;
44
- }
45
- }
46
- };
47
- const onMouseUpDocument = ()=>{
48
- endDrag();
49
- };
50
- const startDrag = ()=>{
51
- if (delayMouseMove.current) clearTimeout(delayMouseMove.current);
52
- delayMouseMove.current = setTimeout(()=>{
53
- isDragging.current = true;
54
- const event = new CustomEvent('editor:toolbar:resize-spacing', {
55
- bubbles: true,
56
- detail: {
57
- value: true
58
- }
59
- });
60
- window.dispatchEvent(event);
61
- document.addEventListener('mousemove', onMouseMoveDocument);
62
- document.addEventListener('mouseup', onMouseUpDocument);
63
- }, 100);
64
- };
65
- const endDrag = ()=>{
66
- if (delayMouseMove.current) clearTimeout(delayMouseMove.current);
67
- isDragging.current = false;
68
- const event = new CustomEvent('editor:toolbar:resize-spacing', {
69
- bubbles: true,
70
- detail: {
71
- value: false
72
- }
73
- });
74
- window.dispatchEvent(event);
75
- if ($bottomDrag.current) {
76
- const style = getComputedStyle($bottomDrag.current);
77
- const marginBottom = style.top;
78
- const event = new CustomEvent('editor:toolbar:change-margin-bottom', {
79
- bubbles: true,
80
- detail: {
81
- componentUid: props.uid,
82
- marginBottom
83
- }
84
- });
85
- window.dispatchEvent(event);
86
- }
87
- const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
88
- if ($component) {
89
- $component.style.marginBottom = '';
90
- }
91
- document.removeEventListener('mousemove', onMouseMoveDocument);
92
- document.removeEventListener('mouseup', onMouseUpDocument);
93
- };
94
- const onMouseDown = (event)=>{
95
- if ($bottomDrag.current) {
96
- const style = getComputedStyle($bottomDrag.current);
97
- startY.current = event.clientY;
98
- marginBottom.current = parseFloat(style.top);
99
- startDrag();
100
- }
101
- };
102
- const onMouseUp = ()=>{
103
- endDrag();
104
- };
105
- const getChildrenByAttrSelector = ($el, attrSelector)=>{
106
- const childLen = $el.children.length;
107
- if (childLen) {
108
- for(let i = 0; i < childLen; i++){
109
- const children = $el.children[i];
110
- if (children) {
111
- const is = children.getAttribute(attrSelector);
112
- if (is) {
113
- return children;
114
- }
115
- }
116
- }
117
- }
118
- };
119
- const isLayoutElement = (el)=>{
120
- const tag = el.getAttribute('data-component-tag');
121
- return tag === 'Row' || tag === 'Product';
122
- };
123
- const updateSpacing = react.useCallback(()=>{
124
- const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
125
- if (!$component) return;
126
- const toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
127
- if (!toolbar) return;
128
- const isActive = toolbar.getAttribute('data-toolbar-active');
129
- if (!isActive) return;
130
- const style = getComputedStyle($component);
131
- const $spacing = getChildrenByAttrSelector($component, 'data-spacing');
132
- const $marginBottom = ($spacing?.querySelector('[data-spacing-margin-bottom]')) || null;
133
- if ($marginBottom) {
134
- if ($bottomBg.current && $bottomDrag.current) {
135
- let value = style.marginBottom;
136
- if (parseFloat(value) < 0) {
137
- value = '0';
138
- }
139
- $bottomBg.current.style.height = value;
140
- $bottomDrag.current.style.top = value;
141
- $marginBottom.setAttribute('data-spacing-margin-bottom-active', 'true');
142
- if (isLayoutElement($component)) {
143
- $bottomBg.current.style.left = '0';
144
- } else {
145
- const paddingLeft = style.paddingLeft;
146
- const leftValue = `-${paddingLeft}`;
147
- const translateCss = `translate(${leftValue}, -100%)`;
148
- $bottomBg.current.style.left = leftValue;
149
- $bottomDrag.current.style.transform = translateCss;
150
- }
151
- }
152
- }
153
- }, []);
154
- react.useEffect(()=>{
155
- updateSpacing();
156
- });
157
- react.useEffect(()=>{
158
- window.addEventListener('editor:toolbar:update-margin-bottom', updateSpacing);
159
- window.addEventListener('editor:toolbar:update-padding-left', updateSpacing);
160
- return ()=>{
161
- window.removeEventListener('editor:toolbar:update-margin-bottom', updateSpacing);
162
- window.removeEventListener('editor:toolbar:update-padding-left', updateSpacing);
163
- };
164
- }, [
165
- updateSpacing
166
- ]);
167
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
168
- children: props.tag !== 'Section' && /*#__PURE__*/ jsxRuntime.jsx("div", {
169
- "data-spacing": true,
170
- "data-spacing-theme-section": isThemeSectionEditor,
171
- className: "absolute w-full bottom-0",
172
- children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
173
- "data-spacing-margin-bottom": true,
174
- children: [
175
- /*#__PURE__*/ jsxRuntime.jsx("div", {
176
- "data-spacing-margin-bottom-bg": true,
177
- ref: $bottomBg,
178
- children: /*#__PURE__*/ jsxRuntime.jsx("div", {
179
- "data-spacing-margin-bottom-value": true
180
- })
181
- }),
182
- /*#__PURE__*/ jsxRuntime.jsx("div", {
183
- ref: $bottomDrag,
184
- "data-spacing-margin-bottom-drag": true,
185
- onMouseDown: onMouseDown,
186
- onMouseUp: onMouseUp,
187
- role: "presentation"
188
- })
189
- ]
190
- })
191
- })
192
- });
193
- }
194
-
195
- exports.default = Spacing;
@@ -1,12 +0,0 @@
1
- import { jsx, Fragment } from 'react/jsx-runtime';
2
- import Spacing from './Spacing.js';
3
-
4
- function Resize(props) {
5
- return /*#__PURE__*/ jsx(Fragment, {
6
- children: /*#__PURE__*/ jsx(Spacing, {
7
- ...props
8
- })
9
- });
10
- }
11
-
12
- export { Resize as default };
@@ -1,191 +0,0 @@
1
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import { useRef, useCallback, useEffect } from 'react';
3
- import 'zustand';
4
- import { useBuilderPreviewStore } from '../../contexts/BuilderPreviewContext.js';
5
- import 'swr';
6
- import '@gem-sdk/adapter-shopify';
7
- import 'swr/mutation';
8
- import 'vanilla-lazyload';
9
- import '../../hooks/useCartUI.js';
10
- import 'react-transition-group';
11
- import '@gem-sdk/core';
12
- import '../../helpers/convert.js';
13
-
14
- function Spacing(props) {
15
- const isThemeSectionEditor = useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
16
- const $bottomDrag = useRef(null);
17
- const $bottomBg = useRef(null);
18
- const delayMouseMove = useRef(null);
19
- const isDragging = useRef(false);
20
- const startY = useRef(0);
21
- const marginBottom = useRef(0);
22
- const getNewValueMargin = (event)=>{
23
- const top = event.clientY;
24
- const diffY = Math.ceil(top - startY.current);
25
- const currentValue = marginBottom.current || 0;
26
- const newValue = currentValue + diffY >= 0 ? `${currentValue + diffY}px` : `0px`;
27
- return {
28
- newValue
29
- };
30
- };
31
- const onMouseMoveDocument = (event)=>{
32
- if ($bottomDrag.current && $bottomBg.current) {
33
- // $bottomDrag.current.
34
- const { newValue } = getNewValueMargin(event);
35
- $bottomBg.current.style.height = newValue;
36
- $bottomDrag.current.style.top = newValue;
37
- const $component = $bottomDrag.current.closest('[data-toolbar-wrap]');
38
- if ($component) {
39
- $component.style.marginBottom = newValue;
40
- }
41
- }
42
- };
43
- const onMouseUpDocument = ()=>{
44
- endDrag();
45
- };
46
- const startDrag = ()=>{
47
- if (delayMouseMove.current) clearTimeout(delayMouseMove.current);
48
- delayMouseMove.current = setTimeout(()=>{
49
- isDragging.current = true;
50
- const event = new CustomEvent('editor:toolbar:resize-spacing', {
51
- bubbles: true,
52
- detail: {
53
- value: true
54
- }
55
- });
56
- window.dispatchEvent(event);
57
- document.addEventListener('mousemove', onMouseMoveDocument);
58
- document.addEventListener('mouseup', onMouseUpDocument);
59
- }, 100);
60
- };
61
- const endDrag = ()=>{
62
- if (delayMouseMove.current) clearTimeout(delayMouseMove.current);
63
- isDragging.current = false;
64
- const event = new CustomEvent('editor:toolbar:resize-spacing', {
65
- bubbles: true,
66
- detail: {
67
- value: false
68
- }
69
- });
70
- window.dispatchEvent(event);
71
- if ($bottomDrag.current) {
72
- const style = getComputedStyle($bottomDrag.current);
73
- const marginBottom = style.top;
74
- const event = new CustomEvent('editor:toolbar:change-margin-bottom', {
75
- bubbles: true,
76
- detail: {
77
- componentUid: props.uid,
78
- marginBottom
79
- }
80
- });
81
- window.dispatchEvent(event);
82
- }
83
- const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
84
- if ($component) {
85
- $component.style.marginBottom = '';
86
- }
87
- document.removeEventListener('mousemove', onMouseMoveDocument);
88
- document.removeEventListener('mouseup', onMouseUpDocument);
89
- };
90
- const onMouseDown = (event)=>{
91
- if ($bottomDrag.current) {
92
- const style = getComputedStyle($bottomDrag.current);
93
- startY.current = event.clientY;
94
- marginBottom.current = parseFloat(style.top);
95
- startDrag();
96
- }
97
- };
98
- const onMouseUp = ()=>{
99
- endDrag();
100
- };
101
- const getChildrenByAttrSelector = ($el, attrSelector)=>{
102
- const childLen = $el.children.length;
103
- if (childLen) {
104
- for(let i = 0; i < childLen; i++){
105
- const children = $el.children[i];
106
- if (children) {
107
- const is = children.getAttribute(attrSelector);
108
- if (is) {
109
- return children;
110
- }
111
- }
112
- }
113
- }
114
- };
115
- const isLayoutElement = (el)=>{
116
- const tag = el.getAttribute('data-component-tag');
117
- return tag === 'Row' || tag === 'Product';
118
- };
119
- const updateSpacing = useCallback(()=>{
120
- const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
121
- if (!$component) return;
122
- const toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
123
- if (!toolbar) return;
124
- const isActive = toolbar.getAttribute('data-toolbar-active');
125
- if (!isActive) return;
126
- const style = getComputedStyle($component);
127
- const $spacing = getChildrenByAttrSelector($component, 'data-spacing');
128
- const $marginBottom = ($spacing?.querySelector('[data-spacing-margin-bottom]')) || null;
129
- if ($marginBottom) {
130
- if ($bottomBg.current && $bottomDrag.current) {
131
- let value = style.marginBottom;
132
- if (parseFloat(value) < 0) {
133
- value = '0';
134
- }
135
- $bottomBg.current.style.height = value;
136
- $bottomDrag.current.style.top = value;
137
- $marginBottom.setAttribute('data-spacing-margin-bottom-active', 'true');
138
- if (isLayoutElement($component)) {
139
- $bottomBg.current.style.left = '0';
140
- } else {
141
- const paddingLeft = style.paddingLeft;
142
- const leftValue = `-${paddingLeft}`;
143
- const translateCss = `translate(${leftValue}, -100%)`;
144
- $bottomBg.current.style.left = leftValue;
145
- $bottomDrag.current.style.transform = translateCss;
146
- }
147
- }
148
- }
149
- }, []);
150
- useEffect(()=>{
151
- updateSpacing();
152
- });
153
- useEffect(()=>{
154
- window.addEventListener('editor:toolbar:update-margin-bottom', updateSpacing);
155
- window.addEventListener('editor:toolbar:update-padding-left', updateSpacing);
156
- return ()=>{
157
- window.removeEventListener('editor:toolbar:update-margin-bottom', updateSpacing);
158
- window.removeEventListener('editor:toolbar:update-padding-left', updateSpacing);
159
- };
160
- }, [
161
- updateSpacing
162
- ]);
163
- return /*#__PURE__*/ jsx(Fragment, {
164
- children: props.tag !== 'Section' && /*#__PURE__*/ jsx("div", {
165
- "data-spacing": true,
166
- "data-spacing-theme-section": isThemeSectionEditor,
167
- className: "absolute w-full bottom-0",
168
- children: /*#__PURE__*/ jsxs("div", {
169
- "data-spacing-margin-bottom": true,
170
- children: [
171
- /*#__PURE__*/ jsx("div", {
172
- "data-spacing-margin-bottom-bg": true,
173
- ref: $bottomBg,
174
- children: /*#__PURE__*/ jsx("div", {
175
- "data-spacing-margin-bottom-value": true
176
- })
177
- }),
178
- /*#__PURE__*/ jsx("div", {
179
- ref: $bottomDrag,
180
- "data-spacing-margin-bottom-drag": true,
181
- onMouseDown: onMouseDown,
182
- onMouseUp: onMouseUp,
183
- role: "presentation"
184
- })
185
- ]
186
- })
187
- })
188
- });
189
- }
190
-
191
- export { Spacing as default };