@gem-sdk/core 1.58.0-dev.13 → 1.58.0-dev.134
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 -0
- package/dist/cjs/components/ComponentAnimation.js +1 -0
- package/dist/cjs/components/ComponentToolbarPreview.js +33 -19
- package/dist/cjs/components/ComponentWrapper.js +1 -0
- package/dist/cjs/components/ComponentWrapperPreview.js +1 -0
- package/dist/cjs/components/Empty.js +1 -0
- package/dist/cjs/components/InteractionSuffix.js +2 -1
- package/dist/cjs/components/Render.js +1 -0
- package/dist/cjs/components/Render.liquid.js +14 -5
- package/dist/cjs/components/RenderBlock.js +1 -0
- package/dist/cjs/components/RenderCustomCode.js +1 -0
- package/dist/cjs/components/RenderPreview.js +1 -0
- package/dist/cjs/components/RenderSection.js +1 -0
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +2 -1
- 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/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/SearchIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/WarningIcon.js +1 -0
- package/dist/cjs/components/resize/Resize.js +1 -0
- package/dist/cjs/components/resize/Spacing.js +1 -0
- package/dist/cjs/components/theme-section/CreateThemeSection.js +2 -1
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +1 -0
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +1 -0
- package/dist/cjs/components/toolbar/Tooltip.js +1 -0
- package/dist/cjs/contexts/AddonContext.js +1 -0
- package/dist/cjs/contexts/ArticleContext.js +1 -0
- package/dist/cjs/contexts/ArticleListContext.js +1 -0
- package/dist/cjs/contexts/BuilderComponent.js +1 -0
- package/dist/cjs/contexts/BuilderContext.js +1 -0
- package/dist/cjs/contexts/BuilderPreviewContext.js +1 -0
- package/dist/cjs/contexts/CartLineContext.js +1 -0
- package/dist/cjs/contexts/CollectionContext.js +1 -0
- package/dist/cjs/contexts/ModalContext.js +1 -0
- package/dist/cjs/contexts/PageContext.js +1 -0
- package/dist/cjs/contexts/ProductContext.js +17 -1
- package/dist/cjs/contexts/ProductListContext.js +1 -0
- package/dist/cjs/contexts/SectionContext.js +1 -0
- package/dist/cjs/contexts/ShopContext.js +1 -0
- package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +35 -0
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +4 -28
- package/dist/cjs/graphql/queries/articles.generated.js +1 -0
- package/dist/cjs/graphql/queries/preview-page.generated.js +9 -13
- package/dist/cjs/graphql/queries/shop-shopify.generated.js +11 -0
- package/dist/cjs/helpers/align.js +18 -0
- package/dist/cjs/helpers/backgroundImage.js +184 -0
- package/dist/cjs/helpers/compose-advance-style.js +57 -3
- package/dist/cjs/helpers/filter-toolbar-preview.js +1 -0
- package/dist/cjs/helpers/interaction/index.js +2 -1
- package/dist/cjs/helpers/is-empty-children.js +1 -0
- package/dist/cjs/helpers/layout.js +17 -0
- package/dist/cjs/helpers/prefetch-queries.js +5 -3
- package/dist/cjs/helpers/radius.js +3 -1
- package/dist/cjs/helpers/shadow.js +25 -0
- package/dist/cjs/helpers/size.js +30 -2
- package/dist/cjs/helpers/third-party/appConfig.js +70 -0
- package/dist/cjs/helpers/third-party/appSetting.js +345 -2
- package/dist/cjs/helpers/third-party/constant.js +11 -1
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +17 -1
- package/dist/cjs/helpers/typography.js +10 -1
- package/dist/cjs/hooks/animation/useAnimationActions.js +1 -0
- package/dist/cjs/hooks/animation/useAnimationConfig.js +1 -0
- package/dist/cjs/hooks/animation/useAnimationPreview.js +1 -0
- package/dist/cjs/hooks/animation/useAnimationTarget.js +1 -0
- package/dist/cjs/hooks/animation/useApplyAnimation.js +1 -0
- package/dist/cjs/hooks/articles/useArticlesQuery.js +1 -0
- package/dist/cjs/hooks/cart/use-add-to-cart.js +1 -0
- package/dist/cjs/hooks/cart/use-cart-data.js +1 -0
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +1 -0
- package/dist/cjs/hooks/cart/use-cart-note-update.js +1 -0
- package/dist/cjs/hooks/cart/use-create-cart.js +1 -0
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +1 -0
- package/dist/cjs/hooks/cart/use-update-cart-item.js +1 -0
- package/dist/cjs/hooks/shop/use-collection-query.js +1 -0
- package/dist/cjs/hooks/shop/use-collections-query.js +1 -0
- package/dist/cjs/hooks/shop/use-product-query.js +1 -0
- package/dist/cjs/hooks/shop/use-products-query.js +1 -0
- package/dist/cjs/hooks/shop/useShopifyLink.js +47 -0
- package/dist/cjs/hooks/shop.js +10 -0
- package/dist/cjs/hooks/use-current-device.js +1 -0
- package/dist/cjs/hooks/use-lazy-video.js +1 -0
- package/dist/cjs/hooks/useAnimations.js +1 -0
- package/dist/cjs/hooks/useCartId.js +1 -0
- package/dist/cjs/hooks/useCartLine.js +1 -0
- package/dist/cjs/hooks/useCartUI.js +1 -0
- package/dist/cjs/hooks/useCollection.js +1 -0
- package/dist/cjs/hooks/useFetchHandle.js +1 -0
- package/dist/cjs/hooks/useFormatMoney.js +1 -0
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +1 -0
- package/dist/cjs/hooks/useInteraction.js +1 -0
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +1 -0
- package/dist/cjs/hooks/useLoadScript.js +1 -0
- package/dist/cjs/hooks/useMoney.js +1 -0
- package/dist/cjs/hooks/usePrevious.js +1 -0
- package/dist/cjs/hooks/useProduct.js +28 -1
- package/dist/cjs/hooks/useProductList.js +1 -0
- package/dist/cjs/hooks/useSuspenseFetch.js +1 -0
- package/dist/cjs/hooks/useSwatchesOptions.js +1 -0
- package/dist/cjs/hooks/useToolbarPostPurchase.js +1 -0
- package/dist/cjs/index.js +28 -10
- package/dist/esm/components/AddOn.js +1 -0
- package/dist/esm/components/ComponentAnimation.js +1 -0
- package/dist/esm/components/ComponentToolbarPreview.js +33 -19
- package/dist/esm/components/ComponentWrapper.js +1 -0
- package/dist/esm/components/ComponentWrapperPreview.js +1 -0
- package/dist/esm/components/Empty.js +1 -0
- package/dist/esm/components/InteractionSuffix.js +2 -1
- package/dist/esm/components/Render.js +1 -0
- package/dist/esm/components/Render.liquid.js +14 -5
- package/dist/esm/components/RenderBlock.js +1 -0
- package/dist/esm/components/RenderCustomCode.js +1 -0
- package/dist/esm/components/RenderPreview.js +1 -0
- package/dist/esm/components/RenderSection.js +1 -0
- package/dist/esm/components/ai-generator/AIContentGenerator.js +2 -1
- 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/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/SearchIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/WarningIcon.js +1 -0
- package/dist/esm/components/resize/Resize.js +1 -0
- package/dist/esm/components/resize/Spacing.js +1 -0
- package/dist/esm/components/theme-section/CreateThemeSection.js +2 -1
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +1 -0
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +1 -0
- package/dist/esm/components/toolbar/Tooltip.js +1 -0
- package/dist/esm/contexts/AddonContext.js +1 -0
- package/dist/esm/contexts/ArticleContext.js +1 -0
- package/dist/esm/contexts/ArticleListContext.js +1 -0
- package/dist/esm/contexts/BuilderComponent.js +1 -0
- package/dist/esm/contexts/BuilderContext.js +1 -0
- package/dist/esm/contexts/BuilderPreviewContext.js +1 -0
- package/dist/esm/contexts/CartLineContext.js +1 -0
- package/dist/esm/contexts/CollectionContext.js +1 -0
- package/dist/esm/contexts/ModalContext.js +1 -0
- package/dist/esm/contexts/PageContext.js +1 -0
- package/dist/esm/contexts/ProductContext.js +17 -1
- package/dist/esm/contexts/ProductListContext.js +1 -0
- package/dist/esm/contexts/SectionContext.js +1 -0
- package/dist/esm/contexts/ShopContext.js +1 -0
- package/dist/esm/graphql/fragments/preview-theme-page.generated.js +33 -0
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +5 -28
- package/dist/esm/graphql/queries/articles.generated.js +1 -0
- package/dist/esm/graphql/queries/preview-page.generated.js +8 -12
- package/dist/esm/graphql/queries/shop-shopify.generated.js +9 -0
- package/dist/esm/helpers/align.js +18 -1
- package/dist/esm/helpers/backgroundImage.js +179 -0
- package/dist/esm/helpers/compose-advance-style.js +57 -3
- package/dist/esm/helpers/filter-toolbar-preview.js +1 -0
- package/dist/esm/helpers/interaction/index.js +2 -1
- package/dist/esm/helpers/is-empty-children.js +1 -0
- package/dist/esm/helpers/layout.js +17 -1
- package/dist/esm/helpers/prefetch-queries.js +5 -3
- package/dist/esm/helpers/radius.js +3 -1
- package/dist/esm/helpers/shadow.js +25 -1
- package/dist/esm/helpers/size.js +29 -3
- package/dist/esm/helpers/third-party/appConfig.js +61 -1
- package/dist/esm/helpers/third-party/appSetting.js +345 -2
- package/dist/esm/helpers/third-party/constant.js +12 -2
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +17 -1
- package/dist/esm/helpers/typography.js +10 -2
- package/dist/esm/hooks/animation/useAnimationActions.js +1 -0
- package/dist/esm/hooks/animation/useAnimationConfig.js +1 -0
- package/dist/esm/hooks/animation/useAnimationPreview.js +1 -0
- package/dist/esm/hooks/animation/useAnimationTarget.js +1 -0
- package/dist/esm/hooks/animation/useApplyAnimation.js +1 -0
- package/dist/esm/hooks/articles/useArticlesQuery.js +1 -0
- package/dist/esm/hooks/cart/use-add-to-cart.js +1 -0
- package/dist/esm/hooks/cart/use-cart-data.js +1 -0
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +1 -0
- package/dist/esm/hooks/cart/use-cart-note-update.js +1 -0
- package/dist/esm/hooks/cart/use-create-cart.js +1 -0
- package/dist/esm/hooks/cart/use-remove-cart-item.js +1 -0
- package/dist/esm/hooks/cart/use-update-cart-item.js +1 -0
- package/dist/esm/hooks/shop/use-collection-query.js +1 -0
- package/dist/esm/hooks/shop/use-collections-query.js +1 -0
- package/dist/esm/hooks/shop/use-product-query.js +1 -0
- package/dist/esm/hooks/shop/use-products-query.js +1 -0
- package/dist/esm/hooks/shop/useShopifyLink.js +45 -0
- package/dist/esm/hooks/shop.js +10 -1
- package/dist/esm/hooks/use-current-device.js +1 -0
- package/dist/esm/hooks/use-lazy-video.js +1 -0
- package/dist/esm/hooks/useAnimations.js +1 -0
- package/dist/esm/hooks/useCartId.js +1 -0
- package/dist/esm/hooks/useCartLine.js +1 -0
- package/dist/esm/hooks/useCartUI.js +1 -0
- package/dist/esm/hooks/useCollection.js +1 -0
- package/dist/esm/hooks/useFetchHandle.js +1 -0
- package/dist/esm/hooks/useFormatMoney.js +1 -0
- package/dist/esm/hooks/useInitialSwatchesOptions.js +1 -0
- package/dist/esm/hooks/useInteraction.js +1 -0
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +1 -0
- package/dist/esm/hooks/useLoadScript.js +1 -0
- package/dist/esm/hooks/useMoney.js +1 -0
- package/dist/esm/hooks/usePrevious.js +1 -0
- package/dist/esm/hooks/useProduct.js +27 -2
- package/dist/esm/hooks/useProductList.js +1 -0
- package/dist/esm/hooks/useSuspenseFetch.js +1 -0
- package/dist/esm/hooks/useSwatchesOptions.js +1 -0
- package/dist/esm/hooks/useToolbarPostPurchase.js +1 -0
- package/dist/esm/index.js +14 -11
- package/dist/types/index.d.ts +826 -263
- package/package.json +4 -4
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
3
|
import { useRef, useState } from 'react';
|
|
3
4
|
import { ThemeSectionTooltip } from './ThemeSectionTooltip.js';
|
|
4
5
|
import 'zustand';
|
|
5
6
|
import { useShopStore } from '../../contexts/ShopContext.js';
|
|
6
|
-
import '@gem-sdk/adapter-shopify';
|
|
7
7
|
import 'swr';
|
|
8
|
+
import '@gem-sdk/adapter-shopify';
|
|
8
9
|
import 'swr/mutation';
|
|
9
10
|
import 'swr/infinite';
|
|
10
11
|
import 'vanilla-lazyload';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useStore, createStore } from 'zustand';
|
|
3
3
|
import { useId, useMemo, useContext, createContext } from 'react';
|
|
4
|
+
import { useStore, createStore } from 'zustand';
|
|
4
5
|
import { flattenConnection } from '../helpers/flatten-connection.js';
|
|
5
6
|
import { checkInStock } from '../helpers/variant.js';
|
|
6
7
|
|
|
@@ -23,6 +24,21 @@ const createProductStoreProvider = (data)=>createStore((set, get)=>({
|
|
|
23
24
|
};
|
|
24
25
|
});
|
|
25
26
|
},
|
|
27
|
+
setUseProductCompareAtPrice: (value)=>{
|
|
28
|
+
set({
|
|
29
|
+
useProductCompareAtPrice: value
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
setShouldRequireUploadMessage: (value)=>{
|
|
33
|
+
set({
|
|
34
|
+
shouldRequireUploadMessage: value
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
setRequireUpload: (value)=>{
|
|
38
|
+
set({
|
|
39
|
+
requireUpload: value
|
|
40
|
+
});
|
|
41
|
+
},
|
|
26
42
|
addProperty: (data)=>{
|
|
27
43
|
const properties = get().properties;
|
|
28
44
|
if (!properties?.some((v)=>v.key === data.key)) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable */ const PreviewThemePageSelect = `
|
|
2
|
+
fragment PreviewThemePageSelect on PreviewThemePage {
|
|
3
|
+
id
|
|
4
|
+
name
|
|
5
|
+
handle
|
|
6
|
+
isMobile
|
|
7
|
+
sectionPosition
|
|
8
|
+
pageSections {
|
|
9
|
+
cid
|
|
10
|
+
component
|
|
11
|
+
id
|
|
12
|
+
}
|
|
13
|
+
dataSEO {
|
|
14
|
+
...DataSEOSelect
|
|
15
|
+
}
|
|
16
|
+
themeStyle {
|
|
17
|
+
id
|
|
18
|
+
data
|
|
19
|
+
name
|
|
20
|
+
}
|
|
21
|
+
analytic {
|
|
22
|
+
...AnalyticSelect
|
|
23
|
+
}
|
|
24
|
+
customCode {
|
|
25
|
+
...CustomCodeSelect
|
|
26
|
+
}
|
|
27
|
+
customFonts {
|
|
28
|
+
...CustomFontSelect
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export { PreviewThemePageSelect };
|
|
@@ -30,34 +30,11 @@
|
|
|
30
30
|
id
|
|
31
31
|
value
|
|
32
32
|
}
|
|
33
|
+
metafields {
|
|
34
|
+
key
|
|
35
|
+
value
|
|
36
|
+
}
|
|
33
37
|
}
|
|
34
38
|
`;
|
|
35
|
-
const PreviewThemePageSelect = `
|
|
36
|
-
fragment PreviewThemePageSelect on PublishedThemePage {
|
|
37
|
-
id
|
|
38
|
-
name
|
|
39
|
-
handle
|
|
40
|
-
isMobile
|
|
41
|
-
sectionPosition
|
|
42
|
-
pageSections {
|
|
43
|
-
...PublishedPageSectionSelect
|
|
44
|
-
}
|
|
45
|
-
themePageCustomSections {
|
|
46
|
-
...PublishedCustomSectionSelect
|
|
47
|
-
}
|
|
48
|
-
themePageDataSEO {
|
|
49
|
-
...DataSEOSelect
|
|
50
|
-
}
|
|
51
|
-
pageStyle {
|
|
52
|
-
...PublishedThemeStyleSelect
|
|
53
|
-
}
|
|
54
|
-
themePageAnalytic {
|
|
55
|
-
...AnalyticSelect
|
|
56
|
-
}
|
|
57
|
-
themePageCustomCode {
|
|
58
|
-
...CustomCodeSelect
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
`;
|
|
62
39
|
|
|
63
|
-
export {
|
|
40
|
+
export { PublishedThemePageSelect };
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import { PreviewThemePageSelect } from '../fragments/
|
|
2
|
-
import { PublishedPageSectionSelect } from '../fragments/published-page-section.generated.js';
|
|
3
|
-
import { PublishedCustomSectionSelect } from '../fragments/published-custom-section.generated.js';
|
|
1
|
+
import { PreviewThemePageSelect } from '../fragments/preview-theme-page.generated.js';
|
|
4
2
|
import { DataSeoSelect } from '../fragments/data-seo.generated.js';
|
|
5
|
-
import { PublishedThemeStyleSelect } from '../fragments/published-theme-style.generated.js';
|
|
6
3
|
import { AnalyticSelect } from '../fragments/analytic.generated.js';
|
|
7
4
|
import { CustomCodeSelect } from '../fragments/custom-code.generated.js';
|
|
5
|
+
import { CustomFontSelect } from '../fragments/custom-font.generated.js';
|
|
8
6
|
|
|
9
|
-
const
|
|
10
|
-
query
|
|
11
|
-
|
|
7
|
+
const PreviewThemePageDocument = `
|
|
8
|
+
query PreviewThemePage($pageType: PreviewThemePageType!, $handleURL: String) {
|
|
9
|
+
previewThemePage(pageType: $pageType, handleURL: $handleURL) {
|
|
12
10
|
...PreviewThemePageSelect
|
|
13
11
|
}
|
|
14
12
|
}
|
|
15
13
|
${PreviewThemePageSelect}
|
|
16
|
-
${PublishedPageSectionSelect}
|
|
17
|
-
${PublishedCustomSectionSelect}
|
|
18
14
|
${DataSeoSelect}
|
|
19
|
-
${PublishedThemeStyleSelect}
|
|
20
15
|
${AnalyticSelect}
|
|
21
|
-
${CustomCodeSelect}
|
|
16
|
+
${CustomCodeSelect}
|
|
17
|
+
${CustomFontSelect}`;
|
|
22
18
|
|
|
23
|
-
export {
|
|
19
|
+
export { PreviewThemePageDocument };
|
|
@@ -13,5 +13,22 @@ const convertTextAlignToJustify = (align)=>{
|
|
|
13
13
|
});
|
|
14
14
|
return result;
|
|
15
15
|
};
|
|
16
|
+
const getAlignmentClasses = (align)=>{
|
|
17
|
+
const breakpoints = [
|
|
18
|
+
'desktop',
|
|
19
|
+
'tablet',
|
|
20
|
+
'mobile'
|
|
21
|
+
];
|
|
22
|
+
return breakpoints.reduce((classes, bp)=>{
|
|
23
|
+
const prefix = bp === 'desktop' ? '' : `${bp}:`;
|
|
24
|
+
const alignment = align?.[bp];
|
|
25
|
+
if (alignment) {
|
|
26
|
+
classes[`${prefix}gp-justify-start`] = alignment === 'left';
|
|
27
|
+
classes[`${prefix}gp-justify-center`] = alignment === 'center';
|
|
28
|
+
classes[`${prefix}gp-justify-end`] = alignment === 'right';
|
|
29
|
+
}
|
|
30
|
+
return classes;
|
|
31
|
+
}, {});
|
|
32
|
+
};
|
|
16
33
|
|
|
17
|
-
export { convertTextAlignToJustify };
|
|
34
|
+
export { convertTextAlignToJustify, getAlignmentClasses };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { makeStyleResponsiveState } from './make-style.js';
|
|
2
|
+
|
|
3
|
+
const getStyleBackgroundImageByDevice = (backgroundImage, options)=>{
|
|
4
|
+
if (!backgroundImage) {
|
|
5
|
+
return {};
|
|
6
|
+
}
|
|
7
|
+
return {
|
|
8
|
+
...!options?.ignoreBackgroundImage ? {
|
|
9
|
+
...getStyleBgImageSource(backgroundImage, options)
|
|
10
|
+
} : {},
|
|
11
|
+
...!options?.ignoreBackgroundImageProperties ? {
|
|
12
|
+
...getStyleBgImagePosition(backgroundImage),
|
|
13
|
+
...getStyleBgImageSize(backgroundImage),
|
|
14
|
+
...getStyleBgImageRepeat(backgroundImage)
|
|
15
|
+
} : {},
|
|
16
|
+
...!options?.ignoreBgAttachment ? getStyleBgImageAttachment(backgroundImage) : {}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const getStyleBgImageSource = (backgroundImage, options)=>{
|
|
20
|
+
const bgImage = {
|
|
21
|
+
desktop: {
|
|
22
|
+
normal: getBgImageSourceByDevice(backgroundImage, 'desktop', 'normal', options),
|
|
23
|
+
hover: getBgImageSourceByDevice(backgroundImage, 'desktop', 'hover', options)
|
|
24
|
+
},
|
|
25
|
+
tablet: {
|
|
26
|
+
normal: getBgImageSourceByDevice(backgroundImage, 'tablet', 'normal', options),
|
|
27
|
+
hover: getBgImageSourceByDevice(backgroundImage, 'tablet', 'hover', options)
|
|
28
|
+
},
|
|
29
|
+
mobile: {
|
|
30
|
+
normal: getBgImageSourceByDevice(backgroundImage, 'mobile', 'normal', options),
|
|
31
|
+
hover: getBgImageSourceByDevice(backgroundImage, 'mobile', 'hover', options)
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return makeStyleResponsiveState('bgi', bgImage);
|
|
35
|
+
};
|
|
36
|
+
const getBgImageSourceByDevice = (backgroundImage, device, state, options)=>{
|
|
37
|
+
const stateValue = backgroundImage?.[device]?.[state];
|
|
38
|
+
if (!stateValue?.image?.src) return;
|
|
39
|
+
const backupFileKey = stateValue.image.backupFileKey;
|
|
40
|
+
const storage = stateValue.image.storage;
|
|
41
|
+
let imageByDevice = stateValue.image.src;
|
|
42
|
+
let newBackupFilekey = backupFileKey;
|
|
43
|
+
const shopifyHandleName = imageByDevice?.match(// eslint-disable-next-line
|
|
44
|
+
/\/files\/([^\/]+\.(jpg|jpeg|gif|png|webp|svg))/)?.[1];
|
|
45
|
+
if (backupFileKey && shopifyHandleName && shopifyHandleName !== backupFileKey) {
|
|
46
|
+
newBackupFilekey = shopifyHandleName;
|
|
47
|
+
}
|
|
48
|
+
if (storage === 'FILE_CONTENT') {
|
|
49
|
+
if (options?.liquid && newBackupFilekey) {
|
|
50
|
+
imageByDevice = `{{ "${newBackupFilekey.replace('.jpeg', '.jpg')}" | file_url }}`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (storage === 'THEME' || !storage) {
|
|
54
|
+
if (options?.liquid && newBackupFilekey) {
|
|
55
|
+
imageByDevice = `{{ "${newBackupFilekey}" | asset_url }}`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return imageByDevice ? `url(${imageByDevice})` : 'none';
|
|
59
|
+
};
|
|
60
|
+
const getStyleBgImagePosition = (backgroundImage)=>{
|
|
61
|
+
const bgPosition = {
|
|
62
|
+
desktop: {
|
|
63
|
+
normal: getBgImagePositionByDevice(backgroundImage, 'desktop', 'normal'),
|
|
64
|
+
hover: getBgImagePositionByDevice(backgroundImage, 'desktop', 'hover')
|
|
65
|
+
},
|
|
66
|
+
tablet: {
|
|
67
|
+
normal: getBgImagePositionByDevice(backgroundImage, 'tablet', 'normal'),
|
|
68
|
+
hover: getBgImagePositionByDevice(backgroundImage, 'tablet', 'hover')
|
|
69
|
+
},
|
|
70
|
+
mobile: {
|
|
71
|
+
normal: getBgImagePositionByDevice(backgroundImage, 'mobile', 'normal'),
|
|
72
|
+
hover: getBgImagePositionByDevice(backgroundImage, 'mobile', 'hover')
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return makeStyleResponsiveState('bgp', bgPosition);
|
|
76
|
+
};
|
|
77
|
+
const getBgImagePositionByDevice = (backgroundImage, device, state)=>{
|
|
78
|
+
const position = backgroundImage?.[device]?.[state]?.position;
|
|
79
|
+
return position && `${position.x}% ${position.y}%`;
|
|
80
|
+
};
|
|
81
|
+
const getStyleBgImageSize = (backgroundImage)=>{
|
|
82
|
+
const bgSize = {
|
|
83
|
+
desktop: {
|
|
84
|
+
normal: getBgImageSizeByDevice(backgroundImage, 'desktop', 'normal'),
|
|
85
|
+
hover: getBgImageSizeByDevice(backgroundImage, 'desktop', 'hover')
|
|
86
|
+
},
|
|
87
|
+
tablet: {
|
|
88
|
+
normal: getBgImageSizeByDevice(backgroundImage, 'tablet', 'normal'),
|
|
89
|
+
hover: getBgImageSizeByDevice(backgroundImage, 'tablet', 'hover')
|
|
90
|
+
},
|
|
91
|
+
mobile: {
|
|
92
|
+
normal: getBgImageSizeByDevice(backgroundImage, 'mobile', 'normal'),
|
|
93
|
+
hover: getBgImageSizeByDevice(backgroundImage, 'mobile', 'hover')
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return makeStyleResponsiveState('bgs', bgSize);
|
|
97
|
+
};
|
|
98
|
+
const getBgImageSizeByDevice = (backgroundImage, device, state)=>{
|
|
99
|
+
return backgroundImage?.[device]?.[state]?.size;
|
|
100
|
+
};
|
|
101
|
+
const getStyleBgImageRepeat = (backgroundImage)=>{
|
|
102
|
+
const bgRepeat = {
|
|
103
|
+
desktop: {
|
|
104
|
+
normal: getBgImageRepeatByDevice(backgroundImage, 'desktop', 'normal'),
|
|
105
|
+
hover: getBgImageRepeatByDevice(backgroundImage, 'desktop', 'hover')
|
|
106
|
+
},
|
|
107
|
+
tablet: {
|
|
108
|
+
normal: getBgImageRepeatByDevice(backgroundImage, 'tablet', 'normal'),
|
|
109
|
+
hover: getBgImageRepeatByDevice(backgroundImage, 'tablet', 'hover')
|
|
110
|
+
},
|
|
111
|
+
mobile: {
|
|
112
|
+
normal: getBgImageRepeatByDevice(backgroundImage, 'mobile', 'normal'),
|
|
113
|
+
hover: getBgImageRepeatByDevice(backgroundImage, 'mobile', 'hover')
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
return makeStyleResponsiveState('bgr', bgRepeat);
|
|
117
|
+
};
|
|
118
|
+
const getBgImageRepeatByDevice = (backgroundImage, device, state)=>{
|
|
119
|
+
return backgroundImage?.[device]?.[state]?.repeat;
|
|
120
|
+
};
|
|
121
|
+
const getStyleBgImageAttachment = (backgroundImage)=>{
|
|
122
|
+
const bgAttachment = {
|
|
123
|
+
desktop: {
|
|
124
|
+
normal: getBgImageAttachmentByDevice(backgroundImage, 'desktop', 'normal'),
|
|
125
|
+
hover: getBgImageAttachmentByDevice(backgroundImage, 'desktop', 'hover')
|
|
126
|
+
},
|
|
127
|
+
tablet: {
|
|
128
|
+
normal: getBgImageAttachmentByDevice(backgroundImage, 'tablet', 'normal'),
|
|
129
|
+
hover: getBgImageAttachmentByDevice(backgroundImage, 'tablet', 'hover')
|
|
130
|
+
},
|
|
131
|
+
mobile: {
|
|
132
|
+
normal: getBgImageAttachmentByDevice(backgroundImage, 'mobile', 'normal'),
|
|
133
|
+
hover: getBgImageAttachmentByDevice(backgroundImage, 'mobile', 'hover')
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
return makeStyleResponsiveState('bga', bgAttachment);
|
|
137
|
+
};
|
|
138
|
+
const getBgImageAttachmentByDevice = (backgroundImage, device, state)=>{
|
|
139
|
+
return backgroundImage?.[device]?.[state]?.attachment;
|
|
140
|
+
};
|
|
141
|
+
const composeBackgroundImageCss = (config, options = {})=>{
|
|
142
|
+
if (!config) return undefined;
|
|
143
|
+
const { device = 'desktop', state = 'normal', useLiquid = false } = options;
|
|
144
|
+
const styles = [];
|
|
145
|
+
const bgConfig = config?.[device]?.[state];
|
|
146
|
+
if (!bgConfig) return '';
|
|
147
|
+
// Handle background image source
|
|
148
|
+
if (bgConfig.image?.src) {
|
|
149
|
+
let imageUrl = bgConfig.image.src;
|
|
150
|
+
// Handle Shopify liquid transformations if needed
|
|
151
|
+
if (useLiquid && bgConfig.image.backupFileKey) {
|
|
152
|
+
if (bgConfig.image.storage === 'FILE_CONTENT') {
|
|
153
|
+
imageUrl = `{{ "${bgConfig.image.backupFileKey.replace('.jpeg', '.jpg')}" | file_url }}`;
|
|
154
|
+
} else if (bgConfig.image.storage === 'THEME' || !bgConfig.image.storage) {
|
|
155
|
+
imageUrl = `{{ "${bgConfig.image.backupFileKey}" | asset_url }}`;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
styles.push(`background-image: url(${imageUrl});`);
|
|
159
|
+
}
|
|
160
|
+
// Handle position
|
|
161
|
+
if (bgConfig.position) {
|
|
162
|
+
styles.push(`background-position: ${bgConfig.position.x}% ${bgConfig.position.y}%;`);
|
|
163
|
+
}
|
|
164
|
+
// Handle size
|
|
165
|
+
if (bgConfig.size) {
|
|
166
|
+
styles.push(`background-size: ${bgConfig.size};`);
|
|
167
|
+
}
|
|
168
|
+
// Handle repeat
|
|
169
|
+
if (bgConfig.repeat) {
|
|
170
|
+
styles.push(`background-repeat: ${bgConfig.repeat};`);
|
|
171
|
+
}
|
|
172
|
+
// Handle attachment
|
|
173
|
+
if (bgConfig.attachment) {
|
|
174
|
+
styles.push(`background-attachment: ${bgConfig.attachment};`);
|
|
175
|
+
}
|
|
176
|
+
return styles.join('\n ');
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export { composeBackgroundImageCss, getBgImageSourceByDevice, getStyleBackgroundImageByDevice, getStyleBgImageSource };
|
|
@@ -110,12 +110,66 @@ function composeAdvanceStyle(data, tag, pageType) {
|
|
|
110
110
|
Object.assign(styles, composeRadius(value));
|
|
111
111
|
}
|
|
112
112
|
if (attr === 'boxShadow') {
|
|
113
|
-
const
|
|
114
|
-
'Row',
|
|
113
|
+
const baseElements = [
|
|
115
114
|
'Section',
|
|
115
|
+
'Row',
|
|
116
116
|
'Text',
|
|
117
117
|
'Heading',
|
|
118
|
-
'Image'
|
|
118
|
+
'Image',
|
|
119
|
+
'Button',
|
|
120
|
+
'HeroBanner',
|
|
121
|
+
'ImageComparison',
|
|
122
|
+
'Countdown',
|
|
123
|
+
'Video'
|
|
124
|
+
];
|
|
125
|
+
const productElements = [
|
|
126
|
+
'ProductTitle',
|
|
127
|
+
'ProductDescription',
|
|
128
|
+
'ProductPrice',
|
|
129
|
+
'ProductVendor',
|
|
130
|
+
'Product',
|
|
131
|
+
'ProductSku',
|
|
132
|
+
'StockCounter',
|
|
133
|
+
'Sticky',
|
|
134
|
+
'ProductBadge',
|
|
135
|
+
'ProductViewMore',
|
|
136
|
+
'ProductButton',
|
|
137
|
+
'DynamicCheckout'
|
|
138
|
+
];
|
|
139
|
+
const boostElements = [
|
|
140
|
+
'Icon',
|
|
141
|
+
'IconListHoz',
|
|
142
|
+
'Line',
|
|
143
|
+
'IconList',
|
|
144
|
+
'IconListV2',
|
|
145
|
+
'Tabs',
|
|
146
|
+
'Accordion',
|
|
147
|
+
'Marquee',
|
|
148
|
+
'Breadcrumb'
|
|
149
|
+
];
|
|
150
|
+
const formElements = [
|
|
151
|
+
'Newsletter',
|
|
152
|
+
'ContactForm',
|
|
153
|
+
'TextField',
|
|
154
|
+
'FormTextarea',
|
|
155
|
+
'FormEmail',
|
|
156
|
+
'FormDropdown',
|
|
157
|
+
'FormCheckbox',
|
|
158
|
+
'SubmitButton'
|
|
159
|
+
];
|
|
160
|
+
const collectionElements = [
|
|
161
|
+
'CollectionTitle',
|
|
162
|
+
'CollectionDescription',
|
|
163
|
+
'CollectionBanner',
|
|
164
|
+
'CollectionToolbar',
|
|
165
|
+
'CollectionPaginator'
|
|
166
|
+
];
|
|
167
|
+
const listElementShadowV2 = [
|
|
168
|
+
...baseElements,
|
|
169
|
+
...productElements,
|
|
170
|
+
...boostElements,
|
|
171
|
+
...formElements,
|
|
172
|
+
...collectionElements
|
|
119
173
|
];
|
|
120
174
|
let hasBoxShadowV2 = hasBoxShadow;
|
|
121
175
|
if (listElementShadowV2.includes(tag || '')) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { useRef, useMemo, useCallback } from 'react';
|
|
2
3
|
import 'react/jsx-runtime';
|
|
3
4
|
import 'zustand';
|
|
4
|
-
import 'swr';
|
|
5
5
|
import { usePageStore } from '../../contexts/PageContext.js';
|
|
6
|
+
import 'swr';
|
|
6
7
|
import '@gem-sdk/adapter-shopify';
|
|
7
8
|
import 'swr/mutation';
|
|
8
9
|
import 'swr/infinite';
|
|
@@ -50,5 +50,21 @@ const convertOldLayout = (layout)=>{
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
|
+
const getLayoutClasses = (layout)=>{
|
|
54
|
+
const breakpoints = [
|
|
55
|
+
'desktop',
|
|
56
|
+
'tablet',
|
|
57
|
+
'mobile'
|
|
58
|
+
];
|
|
59
|
+
return breakpoints.reduce((classes, bp)=>{
|
|
60
|
+
const prefix = bp === 'desktop' ? '' : `${bp}:`;
|
|
61
|
+
const layoutValue = layout?.[bp];
|
|
62
|
+
if (layoutValue) {
|
|
63
|
+
classes[`${prefix}gp-flex-col`] = layoutValue === 'vertical';
|
|
64
|
+
classes[`${prefix}gp-flex-row`] = layoutValue === 'horizontal';
|
|
65
|
+
}
|
|
66
|
+
return classes;
|
|
67
|
+
}, {});
|
|
68
|
+
};
|
|
53
69
|
|
|
54
|
-
export { composeGridLayout, convertOldLayout, gridToArrayRegex, optionLayoutStyle };
|
|
70
|
+
export { composeGridLayout, convertOldLayout, getLayoutClasses, gridToArrayRegex, optionLayoutStyle };
|