@gem-sdk/pages 1.9.60 → 1.10.18
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/builder/Toolbox.js +11 -6
- package/dist/cjs/libs/shopify-cdn-with-google-fonts.js +1845 -0
- package/dist/cjs/pages/builder.js +8 -8
- package/dist/esm/components/builder/Toolbox.js +13 -8
- package/dist/esm/libs/shopify-cdn-with-google-fonts.js +1843 -0
- package/dist/esm/pages/builder.js +9 -9
- package/package.json +1 -1
|
@@ -13,14 +13,14 @@ var PopupManager = require('../components/builder/PopupManager.js');
|
|
|
13
13
|
|
|
14
14
|
const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData , pageType })=>{
|
|
15
15
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
16
|
-
const initState = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
const initState = react.useMemo(()=>({
|
|
17
|
+
ROOT: {
|
|
18
|
+
uid: 'ROOT',
|
|
19
|
+
tag: 'Root',
|
|
20
|
+
label: 'Root',
|
|
21
|
+
childrens: []
|
|
22
|
+
}
|
|
23
|
+
}), []);
|
|
24
24
|
react.useEffect(()=>{
|
|
25
25
|
setLoadSuccess(true);
|
|
26
26
|
}, []);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useMatchMutate, useShopStore, useBuilderPreviewStore, useSectionStore, useModalStore
|
|
3
|
-
import { memo,
|
|
2
|
+
import { useMatchMutate, useShopStore, useBuilderPreviewStore, useSectionStore, useModalStore } from '@gem-sdk/core';
|
|
3
|
+
import { memo, useCallback, useEffect } from 'react';
|
|
4
4
|
import { createFontUrl } from '../../libs/google-fonts.js';
|
|
5
5
|
import { genCSS } from '../../libs/helpers/gen-css.js';
|
|
6
6
|
import { getStorefrontApi } from '../../libs/get-storefront-api.js';
|
|
7
|
+
import { shopifyCdnWithGoogleFonts } from '../../libs/shopify-cdn-with-google-fonts.js';
|
|
7
8
|
|
|
8
9
|
const globalStyleId = 'global-style';
|
|
9
10
|
const globalFontId = 'google-font-builder';
|
|
@@ -20,7 +21,6 @@ const Toolbox = ()=>{
|
|
|
20
21
|
const addSection = useSectionStore((s)=>s.addSection);
|
|
21
22
|
const changeSwatches = useShopStore((s)=>s.changeSwatches);
|
|
22
23
|
const changeLayoutSettings = useShopStore((s)=>s.changeLayoutSettings);
|
|
23
|
-
const [initEventSuccess, setInitEventSuccess] = useState(false);
|
|
24
24
|
const clearModal = useModalStore((s)=>s.clearModal);
|
|
25
25
|
// Revalidate all query with key match query/
|
|
26
26
|
const onRevalidateQuery = useCallback(()=>{
|
|
@@ -48,6 +48,14 @@ const Toolbox = ()=>{
|
|
|
48
48
|
const themeStyle = genCSS(detail.data, detail.mobileOnly);
|
|
49
49
|
const font = Object.entries(detail.data?.font).map(([, value])=>{
|
|
50
50
|
return value;
|
|
51
|
+
}).map((item)=>{
|
|
52
|
+
if (item.type == 'custom') {
|
|
53
|
+
const isGoogleFont = shopifyCdnWithGoogleFonts.find((ggFont)=>ggFont.family == item.family);
|
|
54
|
+
if (isGoogleFont) {
|
|
55
|
+
return isGoogleFont;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return item;
|
|
51
59
|
});
|
|
52
60
|
const fontUrl = createFontUrl(font);
|
|
53
61
|
const globalStyle = document.getElementById(globalStyleId);
|
|
@@ -195,7 +203,6 @@ const Toolbox = ()=>{
|
|
|
195
203
|
window.addEventListener('set-global-style', onChangeGlobalStyle);
|
|
196
204
|
window.addEventListener('update-global-swatches-data', onChangeSwatchesData);
|
|
197
205
|
window.addEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
198
|
-
setInitEventSuccess(true);
|
|
199
206
|
return ()=>{
|
|
200
207
|
window.removeEventListener('update-shop-info', onChangeShopInfo);
|
|
201
208
|
window.removeEventListener('revalidate-query', onRevalidateQuery);
|
|
@@ -206,7 +213,7 @@ const Toolbox = ()=>{
|
|
|
206
213
|
window.removeEventListener('update-entity-prop', onUpdateEntityProp);
|
|
207
214
|
window.removeEventListener('set-global-style', onChangeGlobalStyle);
|
|
208
215
|
window.removeEventListener('update-global-swatches-data', onChangeSwatchesData);
|
|
209
|
-
window.
|
|
216
|
+
window.removeEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
210
217
|
};
|
|
211
218
|
}, [
|
|
212
219
|
onAddEntity,
|
|
@@ -221,9 +228,7 @@ const Toolbox = ()=>{
|
|
|
221
228
|
onChangeLayoutSettingData
|
|
222
229
|
]);
|
|
223
230
|
return /*#__PURE__*/ jsx("div", {
|
|
224
|
-
className:
|
|
225
|
-
toolbox: initEventSuccess
|
|
226
|
-
})
|
|
231
|
+
className: "toolbox"
|
|
227
232
|
});
|
|
228
233
|
};
|
|
229
234
|
var Toolbox$1 = /*#__PURE__*/ memo(Toolbox);
|