@gem-sdk/pages 1.42.3-staging.0 → 1.43.0-dev.80
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/Toolbar.js +34 -31
- package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +2 -2
- package/dist/cjs/libs/helpers/gen-css.js +12 -2
- package/dist/cjs/libs/helpers/gen-fonts.js +12 -5
- package/dist/cjs/pages/builder.js +5 -3
- package/dist/esm/components/builder/Toolbar.js +34 -31
- package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +2 -2
- package/dist/esm/libs/helpers/gen-css.js +12 -2
- package/dist/esm/libs/helpers/gen-fonts.js +12 -5
- package/dist/esm/pages/builder.js +5 -3
- package/dist/types/index.d.ts +5 -2
- package/package.json +5 -5
|
@@ -85,7 +85,7 @@ const Toolbar = ()=>{
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
const setHoverComponent = react.useCallback(({ $component, componentUid, focus,
|
|
88
|
+
const setHoverComponent = react.useCallback(({ $component, componentUid, focus, isPreventSection, isParent })=>{
|
|
89
89
|
if (!$component && !componentUid) return;
|
|
90
90
|
if (!$component) {
|
|
91
91
|
const $c = document.querySelector(`[data-uid="${componentUid}"]`);
|
|
@@ -102,7 +102,7 @@ const Toolbar = ()=>{
|
|
|
102
102
|
const $btnAddTop = getChildrenByAttrSelector($component, 'data-toolbar-add-top');
|
|
103
103
|
const $btnAddBottom = getChildrenByAttrSelector($component, 'data-toolbar-add-bottom');
|
|
104
104
|
const $themeSectionStatus = getChildrenByAttrSelector($component, 'data-theme-section-status');
|
|
105
|
-
if (
|
|
105
|
+
if (isPreventSection && $themeSectionStatus) {
|
|
106
106
|
$themeSectionStatus.setAttribute('data-theme-section-status-active', 'true');
|
|
107
107
|
}
|
|
108
108
|
if ($toolbar) {
|
|
@@ -124,7 +124,7 @@ const Toolbar = ()=>{
|
|
|
124
124
|
if (isParent) {
|
|
125
125
|
$outline.setAttribute('data-outline-parent-hover', 'true');
|
|
126
126
|
}
|
|
127
|
-
if (
|
|
127
|
+
if (isPreventSection) {
|
|
128
128
|
$outline.setAttribute('data-outline-overlay-theme-section', 'true');
|
|
129
129
|
}
|
|
130
130
|
if (focus) {
|
|
@@ -379,25 +379,25 @@ const Toolbar = ()=>{
|
|
|
379
379
|
countShowOnboarding,
|
|
380
380
|
onCloseOnboarding
|
|
381
381
|
]);
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
|
|
385
|
-
// check element fetch data: product, product list
|
|
386
|
-
if (!$component) {
|
|
387
|
-
const isLoading = document.querySelector(`.gp-loading-placeholder`);
|
|
388
|
-
if (!isLoading) {
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
if (isLoading) {
|
|
392
|
-
// await element onload
|
|
393
|
-
$component = await waitForElementToExist(`${productId ? `[data-product-id="${productId}"] ` : ''}[data-uid="${componentUid}"]`, 15000);
|
|
394
|
-
}
|
|
382
|
+
const getSelectorComponent = ({ componentUid, productId, marqueeKey })=>{
|
|
383
|
+
if (marqueeKey) {
|
|
384
|
+
return `[marquee-item-key="${marqueeKey}"] [data-uid="${componentUid}"]`;
|
|
395
385
|
}
|
|
396
|
-
|
|
397
|
-
|
|
386
|
+
return `${productId ? `[data-product-id="${productId}"][data-uid="${componentUid}"], [data-product-id="${productId}"] [data-uid="${componentUid}"]` : `[data-uid="${componentUid}"]`}`;
|
|
387
|
+
};
|
|
388
|
+
const setActiveComponent = react.useCallback(async ({ componentUid, productId, timeAwait = 600, forceReActive, marqueeKey })=>{
|
|
389
|
+
if (!componentUid) return;
|
|
390
|
+
const selector = getSelectorComponent({
|
|
391
|
+
componentUid,
|
|
392
|
+
productId,
|
|
393
|
+
marqueeKey
|
|
394
|
+
});
|
|
395
|
+
const $component = await waitForElementToExist(selector, timeAwait);
|
|
396
|
+
if (!$component) return;
|
|
397
|
+
if (!forceReActive && componentUid == currentComponentActive.current?.componentUid && productId == currentComponentActive.current?.productId && marqueeKey == currentComponentActive.current?.marqueeKey) return;
|
|
398
|
+
if (!forceReActive && componentUid !== currentComponentActive.current?.componentUid || productId !== currentComponentActive.current?.productId || marqueeKey !== currentComponentActive.current?.marqueeKey) {
|
|
399
|
+
removeActiveComponent();
|
|
398
400
|
}
|
|
399
|
-
if (!forceReActive && componentUid == currentComponentActive.current?.componentUid && productId == currentComponentActive.current?.productId) return;
|
|
400
|
-
if (componentUid !== currentComponentActive.current?.componentUid || productId !== currentComponentActive.current?.productId || forceReActive) removeActiveComponent();
|
|
401
401
|
const $toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
|
|
402
402
|
const $outline = getChildrenByAttrSelector($component, 'data-outline');
|
|
403
403
|
const $btnAddTop = getChildrenByAttrSelector($component, 'data-toolbar-add-top');
|
|
@@ -405,7 +405,8 @@ const Toolbar = ()=>{
|
|
|
405
405
|
if ($toolbar) {
|
|
406
406
|
currentComponentActive.current = {
|
|
407
407
|
componentUid,
|
|
408
|
-
productId
|
|
408
|
+
productId,
|
|
409
|
+
marqueeKey
|
|
409
410
|
};
|
|
410
411
|
$toolbar.removeAttribute('style');
|
|
411
412
|
$toolbar.setAttribute('data-toolbar-active', 'true');
|
|
@@ -424,8 +425,9 @@ const Toolbar = ()=>{
|
|
|
424
425
|
if ($btnAddBottom) {
|
|
425
426
|
$btnAddBottom.setAttribute('data-toolbar-add-active', 'true');
|
|
426
427
|
}
|
|
428
|
+
const isChildOfMarquee = !!$component.closest('[data-component-tag="Marquee"]');
|
|
427
429
|
// Active same element in product list
|
|
428
|
-
if (productId) {
|
|
430
|
+
if (productId || isChildOfMarquee) {
|
|
429
431
|
const $relatedElements = document.querySelectorAll(`[data-uid="${componentUid}"]`);
|
|
430
432
|
if ($relatedElements?.length) {
|
|
431
433
|
$relatedElements.forEach(($relatedElement)=>{
|
|
@@ -632,23 +634,23 @@ const Toolbar = ()=>{
|
|
|
632
634
|
}
|
|
633
635
|
}
|
|
634
636
|
}
|
|
635
|
-
const $
|
|
636
|
-
if ($
|
|
637
|
+
const $preventSection = $target.closest('[data-theme-section]') || $target.closest('[data-shopify-section]');
|
|
638
|
+
if ($preventSection) {
|
|
637
639
|
setHoverComponent({
|
|
638
|
-
$component: $
|
|
640
|
+
$component: $preventSection,
|
|
639
641
|
focus: true,
|
|
640
|
-
|
|
642
|
+
isPreventSection: true
|
|
641
643
|
});
|
|
642
644
|
} else {
|
|
643
645
|
return;
|
|
644
646
|
}
|
|
645
647
|
}
|
|
646
|
-
const $
|
|
647
|
-
if ($
|
|
648
|
+
const $preventSection = $target.closest('[data-theme-section]') || $target.closest('[data-shopify-section]');
|
|
649
|
+
if ($preventSection) {
|
|
648
650
|
setHoverComponent({
|
|
649
|
-
$component: $
|
|
651
|
+
$component: $preventSection,
|
|
650
652
|
focus: true,
|
|
651
|
-
|
|
653
|
+
isPreventSection: true
|
|
652
654
|
});
|
|
653
655
|
} else {
|
|
654
656
|
setHoverComponent({
|
|
@@ -675,7 +677,8 @@ const Toolbar = ()=>{
|
|
|
675
677
|
if (detail?.componentUid) {
|
|
676
678
|
setActiveComponent({
|
|
677
679
|
componentUid: detail.componentUid,
|
|
678
|
-
productId: detail.productId
|
|
680
|
+
productId: detail.productId,
|
|
681
|
+
marqueeKey: detail.marqueeKey
|
|
679
682
|
});
|
|
680
683
|
} else {
|
|
681
684
|
removeActiveComponent();
|
|
@@ -89,12 +89,12 @@ const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
|
89
89
|
}),
|
|
90
90
|
ACTIONS_DATA.map((action)=>{
|
|
91
91
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
92
|
-
className: `gp-relative gp-mx-1 gp-h-[60px] gp-w-[172px] w375:gp-w-auto w576:gp-w-auto gp-cursor-pointer gp-flex-col gp-items-center gp-justify-center gp-rounded-[3px] gp-bg-[#F4F4F4] hover:gp-bg-black/10 ${isInput ? 'gp-hidden' : 'gp-flex'}`,
|
|
92
|
+
className: `gp-relative gp-mx-1 gp-h-[60px] mobile:gp-h-[72px] gp-w-[172px] w375:gp-w-auto w576:gp-w-auto gp-cursor-pointer gp-flex-col gp-items-center gp-justify-center gp-rounded-[3px] gp-bg-[#F4F4F4] hover:gp-bg-black/10 ${isInput ? 'gp-hidden' : 'gp-flex'}`,
|
|
93
93
|
id: action.id,
|
|
94
94
|
"aria-hidden": true,
|
|
95
95
|
children: [
|
|
96
96
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
97
|
-
className: "gp-mb-[4px] gp-flex gp-gap-2 gp-text-[14px] gp-font-medium gp-text-[#212121]",
|
|
97
|
+
className: "gp-mb-[4px] gp-flex gp-gap-2 gp-text-[14px] gp-font-medium gp-text-[#212121] mobile:gp-flex-col mobile:gp-items-center mobile:gp-gap-0",
|
|
98
98
|
children: [
|
|
99
99
|
action.title,
|
|
100
100
|
action.hasAILogo && /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
@@ -63,7 +63,15 @@ const getValueByDevice = (data, device)=>{
|
|
|
63
63
|
key,
|
|
64
64
|
value?.family
|
|
65
65
|
];
|
|
66
|
-
}))
|
|
66
|
+
})),
|
|
67
|
+
theme: {
|
|
68
|
+
font: Object.fromEntries(Object.entries(data?.theme?.font ?? {}).map(([key, value])=>{
|
|
69
|
+
return [
|
|
70
|
+
key,
|
|
71
|
+
value?.family
|
|
72
|
+
];
|
|
73
|
+
}))
|
|
74
|
+
}
|
|
67
75
|
};
|
|
68
76
|
return deviceData;
|
|
69
77
|
};
|
|
@@ -80,7 +88,9 @@ const genCSSVariable = (deviceData)=>{
|
|
|
80
88
|
if (value === undefined) return undefined;
|
|
81
89
|
if ([
|
|
82
90
|
'font-heading',
|
|
83
|
-
'font-body'
|
|
91
|
+
'font-body',
|
|
92
|
+
'theme-font-heading',
|
|
93
|
+
'theme-font-body'
|
|
84
94
|
].includes(key)) {
|
|
85
95
|
return `--g-${key}: ${quoteFontName(value)}`;
|
|
86
96
|
}
|
|
@@ -18,7 +18,14 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
18
18
|
if (Object.prototype.hasOwnProperty.call(groupSetting, attr)) {
|
|
19
19
|
const value = groupSetting[attr];
|
|
20
20
|
if (value) {
|
|
21
|
-
|
|
21
|
+
let customFontFamily = value.custom?.fontFamily;
|
|
22
|
+
if (typeof customFontFamily === 'string') {
|
|
23
|
+
customFontFamily = {
|
|
24
|
+
value: value.custom?.fontFamily || '',
|
|
25
|
+
type: 'google'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const fontFamily = customFontFamily?.value;
|
|
22
29
|
let customFontVariants = value.custom?.fontVariants;
|
|
23
30
|
if (!customFontVariants?.length) {
|
|
24
31
|
customFontVariants = [
|
|
@@ -35,9 +42,9 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
35
42
|
});
|
|
36
43
|
const customFontWeight = value.custom?.fontWeight && variants.includes(value.custom?.fontWeight) ? value.custom?.fontWeight : variants[0];
|
|
37
44
|
if (customFontWeight) {
|
|
38
|
-
const isExist = fonts.find((item)=>item.family ==
|
|
45
|
+
const isExist = fonts.find((item)=>item.family == fontFamily && item.variants.includes(customFontWeight));
|
|
39
46
|
if (!isExist) {
|
|
40
|
-
const isFontFamily = fonts.find((item)=>item.family ==
|
|
47
|
+
const isFontFamily = fonts.find((item)=>item.family == fontFamily);
|
|
41
48
|
if (isFontFamily) {
|
|
42
49
|
isFontFamily.variants.push(customFontWeight);
|
|
43
50
|
} else {
|
|
@@ -50,10 +57,10 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
59
|
fonts.push({
|
|
53
|
-
family:
|
|
60
|
+
family: fontFamily || '',
|
|
54
61
|
variants: fontVariants,
|
|
55
62
|
subsets: [],
|
|
56
|
-
type:
|
|
63
|
+
type: customFontFamily.type
|
|
57
64
|
});
|
|
58
65
|
}
|
|
59
66
|
}
|
|
@@ -15,7 +15,7 @@ var AddSectionImageToLayout = require('../components/image-to-layout/AddSectionI
|
|
|
15
15
|
var Toolbar = require('../components/builder/Toolbar.js');
|
|
16
16
|
var SwitchView = require('../components/builder/SwitchView.js');
|
|
17
17
|
|
|
18
|
-
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar })=>{
|
|
18
|
+
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, isOriginTemplate })=>{
|
|
19
19
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
20
20
|
const isDisableHeaderFooter = ()=>{
|
|
21
21
|
return isThemeSectionEditor;
|
|
@@ -73,7 +73,8 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
73
73
|
className: "gp-h-[40px] bg-[#f4f4f4]",
|
|
74
74
|
children: /*#__PURE__*/ jsxRuntime.jsx(SwitchView.default, {})
|
|
75
75
|
}) : /*#__PURE__*/ jsxRuntime.jsx(Header.default, {
|
|
76
|
-
pageType: pageType
|
|
76
|
+
pageType: pageType,
|
|
77
|
+
isOriginTemplate: isOriginTemplate
|
|
77
78
|
})),
|
|
78
79
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
79
80
|
id: "storefront",
|
|
@@ -96,7 +97,8 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
96
97
|
id: "visual-content"
|
|
97
98
|
}),
|
|
98
99
|
!isDisableHeaderFooter() && !hiddenToolbar && /*#__PURE__*/ jsxRuntime.jsx(Footer.default, {
|
|
99
|
-
pageType: pageType
|
|
100
|
+
pageType: pageType,
|
|
101
|
+
isOriginTemplate: isOriginTemplate
|
|
100
102
|
})
|
|
101
103
|
]
|
|
102
104
|
})
|
|
@@ -81,7 +81,7 @@ const Toolbar = ()=>{
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
const setHoverComponent = useCallback(({ $component, componentUid, focus,
|
|
84
|
+
const setHoverComponent = useCallback(({ $component, componentUid, focus, isPreventSection, isParent })=>{
|
|
85
85
|
if (!$component && !componentUid) return;
|
|
86
86
|
if (!$component) {
|
|
87
87
|
const $c = document.querySelector(`[data-uid="${componentUid}"]`);
|
|
@@ -98,7 +98,7 @@ const Toolbar = ()=>{
|
|
|
98
98
|
const $btnAddTop = getChildrenByAttrSelector($component, 'data-toolbar-add-top');
|
|
99
99
|
const $btnAddBottom = getChildrenByAttrSelector($component, 'data-toolbar-add-bottom');
|
|
100
100
|
const $themeSectionStatus = getChildrenByAttrSelector($component, 'data-theme-section-status');
|
|
101
|
-
if (
|
|
101
|
+
if (isPreventSection && $themeSectionStatus) {
|
|
102
102
|
$themeSectionStatus.setAttribute('data-theme-section-status-active', 'true');
|
|
103
103
|
}
|
|
104
104
|
if ($toolbar) {
|
|
@@ -120,7 +120,7 @@ const Toolbar = ()=>{
|
|
|
120
120
|
if (isParent) {
|
|
121
121
|
$outline.setAttribute('data-outline-parent-hover', 'true');
|
|
122
122
|
}
|
|
123
|
-
if (
|
|
123
|
+
if (isPreventSection) {
|
|
124
124
|
$outline.setAttribute('data-outline-overlay-theme-section', 'true');
|
|
125
125
|
}
|
|
126
126
|
if (focus) {
|
|
@@ -375,25 +375,25 @@ const Toolbar = ()=>{
|
|
|
375
375
|
countShowOnboarding,
|
|
376
376
|
onCloseOnboarding
|
|
377
377
|
]);
|
|
378
|
-
const
|
|
379
|
-
if (
|
|
380
|
-
|
|
381
|
-
// check element fetch data: product, product list
|
|
382
|
-
if (!$component) {
|
|
383
|
-
const isLoading = document.querySelector(`.gp-loading-placeholder`);
|
|
384
|
-
if (!isLoading) {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
if (isLoading) {
|
|
388
|
-
// await element onload
|
|
389
|
-
$component = await waitForElementToExist(`${productId ? `[data-product-id="${productId}"] ` : ''}[data-uid="${componentUid}"]`, 15000);
|
|
390
|
-
}
|
|
378
|
+
const getSelectorComponent = ({ componentUid, productId, marqueeKey })=>{
|
|
379
|
+
if (marqueeKey) {
|
|
380
|
+
return `[marquee-item-key="${marqueeKey}"] [data-uid="${componentUid}"]`;
|
|
391
381
|
}
|
|
392
|
-
|
|
393
|
-
|
|
382
|
+
return `${productId ? `[data-product-id="${productId}"][data-uid="${componentUid}"], [data-product-id="${productId}"] [data-uid="${componentUid}"]` : `[data-uid="${componentUid}"]`}`;
|
|
383
|
+
};
|
|
384
|
+
const setActiveComponent = useCallback(async ({ componentUid, productId, timeAwait = 600, forceReActive, marqueeKey })=>{
|
|
385
|
+
if (!componentUid) return;
|
|
386
|
+
const selector = getSelectorComponent({
|
|
387
|
+
componentUid,
|
|
388
|
+
productId,
|
|
389
|
+
marqueeKey
|
|
390
|
+
});
|
|
391
|
+
const $component = await waitForElementToExist(selector, timeAwait);
|
|
392
|
+
if (!$component) return;
|
|
393
|
+
if (!forceReActive && componentUid == currentComponentActive.current?.componentUid && productId == currentComponentActive.current?.productId && marqueeKey == currentComponentActive.current?.marqueeKey) return;
|
|
394
|
+
if (!forceReActive && componentUid !== currentComponentActive.current?.componentUid || productId !== currentComponentActive.current?.productId || marqueeKey !== currentComponentActive.current?.marqueeKey) {
|
|
395
|
+
removeActiveComponent();
|
|
394
396
|
}
|
|
395
|
-
if (!forceReActive && componentUid == currentComponentActive.current?.componentUid && productId == currentComponentActive.current?.productId) return;
|
|
396
|
-
if (componentUid !== currentComponentActive.current?.componentUid || productId !== currentComponentActive.current?.productId || forceReActive) removeActiveComponent();
|
|
397
397
|
const $toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
|
|
398
398
|
const $outline = getChildrenByAttrSelector($component, 'data-outline');
|
|
399
399
|
const $btnAddTop = getChildrenByAttrSelector($component, 'data-toolbar-add-top');
|
|
@@ -401,7 +401,8 @@ const Toolbar = ()=>{
|
|
|
401
401
|
if ($toolbar) {
|
|
402
402
|
currentComponentActive.current = {
|
|
403
403
|
componentUid,
|
|
404
|
-
productId
|
|
404
|
+
productId,
|
|
405
|
+
marqueeKey
|
|
405
406
|
};
|
|
406
407
|
$toolbar.removeAttribute('style');
|
|
407
408
|
$toolbar.setAttribute('data-toolbar-active', 'true');
|
|
@@ -420,8 +421,9 @@ const Toolbar = ()=>{
|
|
|
420
421
|
if ($btnAddBottom) {
|
|
421
422
|
$btnAddBottom.setAttribute('data-toolbar-add-active', 'true');
|
|
422
423
|
}
|
|
424
|
+
const isChildOfMarquee = !!$component.closest('[data-component-tag="Marquee"]');
|
|
423
425
|
// Active same element in product list
|
|
424
|
-
if (productId) {
|
|
426
|
+
if (productId || isChildOfMarquee) {
|
|
425
427
|
const $relatedElements = document.querySelectorAll(`[data-uid="${componentUid}"]`);
|
|
426
428
|
if ($relatedElements?.length) {
|
|
427
429
|
$relatedElements.forEach(($relatedElement)=>{
|
|
@@ -628,23 +630,23 @@ const Toolbar = ()=>{
|
|
|
628
630
|
}
|
|
629
631
|
}
|
|
630
632
|
}
|
|
631
|
-
const $
|
|
632
|
-
if ($
|
|
633
|
+
const $preventSection = $target.closest('[data-theme-section]') || $target.closest('[data-shopify-section]');
|
|
634
|
+
if ($preventSection) {
|
|
633
635
|
setHoverComponent({
|
|
634
|
-
$component: $
|
|
636
|
+
$component: $preventSection,
|
|
635
637
|
focus: true,
|
|
636
|
-
|
|
638
|
+
isPreventSection: true
|
|
637
639
|
});
|
|
638
640
|
} else {
|
|
639
641
|
return;
|
|
640
642
|
}
|
|
641
643
|
}
|
|
642
|
-
const $
|
|
643
|
-
if ($
|
|
644
|
+
const $preventSection = $target.closest('[data-theme-section]') || $target.closest('[data-shopify-section]');
|
|
645
|
+
if ($preventSection) {
|
|
644
646
|
setHoverComponent({
|
|
645
|
-
$component: $
|
|
647
|
+
$component: $preventSection,
|
|
646
648
|
focus: true,
|
|
647
|
-
|
|
649
|
+
isPreventSection: true
|
|
648
650
|
});
|
|
649
651
|
} else {
|
|
650
652
|
setHoverComponent({
|
|
@@ -671,7 +673,8 @@ const Toolbar = ()=>{
|
|
|
671
673
|
if (detail?.componentUid) {
|
|
672
674
|
setActiveComponent({
|
|
673
675
|
componentUid: detail.componentUid,
|
|
674
|
-
productId: detail.productId
|
|
676
|
+
productId: detail.productId,
|
|
677
|
+
marqueeKey: detail.marqueeKey
|
|
675
678
|
});
|
|
676
679
|
} else {
|
|
677
680
|
removeActiveComponent();
|
|
@@ -85,12 +85,12 @@ const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
|
85
85
|
}),
|
|
86
86
|
ACTIONS_DATA.map((action)=>{
|
|
87
87
|
return /*#__PURE__*/ jsxs("div", {
|
|
88
|
-
className: `gp-relative gp-mx-1 gp-h-[60px] gp-w-[172px] w375:gp-w-auto w576:gp-w-auto gp-cursor-pointer gp-flex-col gp-items-center gp-justify-center gp-rounded-[3px] gp-bg-[#F4F4F4] hover:gp-bg-black/10 ${isInput ? 'gp-hidden' : 'gp-flex'}`,
|
|
88
|
+
className: `gp-relative gp-mx-1 gp-h-[60px] mobile:gp-h-[72px] gp-w-[172px] w375:gp-w-auto w576:gp-w-auto gp-cursor-pointer gp-flex-col gp-items-center gp-justify-center gp-rounded-[3px] gp-bg-[#F4F4F4] hover:gp-bg-black/10 ${isInput ? 'gp-hidden' : 'gp-flex'}`,
|
|
89
89
|
id: action.id,
|
|
90
90
|
"aria-hidden": true,
|
|
91
91
|
children: [
|
|
92
92
|
/*#__PURE__*/ jsxs("div", {
|
|
93
|
-
className: "gp-mb-[4px] gp-flex gp-gap-2 gp-text-[14px] gp-font-medium gp-text-[#212121]",
|
|
93
|
+
className: "gp-mb-[4px] gp-flex gp-gap-2 gp-text-[14px] gp-font-medium gp-text-[#212121] mobile:gp-flex-col mobile:gp-items-center mobile:gp-gap-0",
|
|
94
94
|
children: [
|
|
95
95
|
action.title,
|
|
96
96
|
action.hasAILogo && /*#__PURE__*/ jsxs("svg", {
|
|
@@ -61,7 +61,15 @@ const getValueByDevice = (data, device)=>{
|
|
|
61
61
|
key,
|
|
62
62
|
value?.family
|
|
63
63
|
];
|
|
64
|
-
}))
|
|
64
|
+
})),
|
|
65
|
+
theme: {
|
|
66
|
+
font: Object.fromEntries(Object.entries(data?.theme?.font ?? {}).map(([key, value])=>{
|
|
67
|
+
return [
|
|
68
|
+
key,
|
|
69
|
+
value?.family
|
|
70
|
+
];
|
|
71
|
+
}))
|
|
72
|
+
}
|
|
65
73
|
};
|
|
66
74
|
return deviceData;
|
|
67
75
|
};
|
|
@@ -78,7 +86,9 @@ const genCSSVariable = (deviceData)=>{
|
|
|
78
86
|
if (value === undefined) return undefined;
|
|
79
87
|
if ([
|
|
80
88
|
'font-heading',
|
|
81
|
-
'font-body'
|
|
89
|
+
'font-body',
|
|
90
|
+
'theme-font-heading',
|
|
91
|
+
'theme-font-body'
|
|
82
92
|
].includes(key)) {
|
|
83
93
|
return `--g-${key}: ${quoteFontName(value)}`;
|
|
84
94
|
}
|
|
@@ -16,7 +16,14 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
16
16
|
if (Object.prototype.hasOwnProperty.call(groupSetting, attr)) {
|
|
17
17
|
const value = groupSetting[attr];
|
|
18
18
|
if (value) {
|
|
19
|
-
|
|
19
|
+
let customFontFamily = value.custom?.fontFamily;
|
|
20
|
+
if (typeof customFontFamily === 'string') {
|
|
21
|
+
customFontFamily = {
|
|
22
|
+
value: value.custom?.fontFamily || '',
|
|
23
|
+
type: 'google'
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const fontFamily = customFontFamily?.value;
|
|
20
27
|
let customFontVariants = value.custom?.fontVariants;
|
|
21
28
|
if (!customFontVariants?.length) {
|
|
22
29
|
customFontVariants = [
|
|
@@ -33,9 +40,9 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
33
40
|
});
|
|
34
41
|
const customFontWeight = value.custom?.fontWeight && variants.includes(value.custom?.fontWeight) ? value.custom?.fontWeight : variants[0];
|
|
35
42
|
if (customFontWeight) {
|
|
36
|
-
const isExist = fonts.find((item)=>item.family ==
|
|
43
|
+
const isExist = fonts.find((item)=>item.family == fontFamily && item.variants.includes(customFontWeight));
|
|
37
44
|
if (!isExist) {
|
|
38
|
-
const isFontFamily = fonts.find((item)=>item.family ==
|
|
45
|
+
const isFontFamily = fonts.find((item)=>item.family == fontFamily);
|
|
39
46
|
if (isFontFamily) {
|
|
40
47
|
isFontFamily.variants.push(customFontWeight);
|
|
41
48
|
} else {
|
|
@@ -48,10 +55,10 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
fonts.push({
|
|
51
|
-
family:
|
|
58
|
+
family: fontFamily || '',
|
|
52
59
|
variants: fontVariants,
|
|
53
60
|
subsets: [],
|
|
54
|
-
type:
|
|
61
|
+
type: customFontFamily.type
|
|
55
62
|
});
|
|
56
63
|
}
|
|
57
64
|
}
|
|
@@ -13,7 +13,7 @@ import AddSectionImageToLayout from '../components/image-to-layout/AddSectionIma
|
|
|
13
13
|
import Toolbar from '../components/builder/Toolbar.js';
|
|
14
14
|
import Devices from '../components/builder/SwitchView.js';
|
|
15
15
|
|
|
16
|
-
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar })=>{
|
|
16
|
+
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, isOriginTemplate })=>{
|
|
17
17
|
const [loadSuccess, setLoadSuccess] = useState(false);
|
|
18
18
|
const isDisableHeaderFooter = ()=>{
|
|
19
19
|
return isThemeSectionEditor;
|
|
@@ -71,7 +71,8 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
71
71
|
className: "gp-h-[40px] bg-[#f4f4f4]",
|
|
72
72
|
children: /*#__PURE__*/ jsx(Devices, {})
|
|
73
73
|
}) : /*#__PURE__*/ jsx(Header, {
|
|
74
|
-
pageType: pageType
|
|
74
|
+
pageType: pageType,
|
|
75
|
+
isOriginTemplate: isOriginTemplate
|
|
75
76
|
})),
|
|
76
77
|
/*#__PURE__*/ jsx("div", {
|
|
77
78
|
id: "storefront",
|
|
@@ -94,7 +95,8 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
94
95
|
id: "visual-content"
|
|
95
96
|
}),
|
|
96
97
|
!isDisableHeaderFooter() && !hiddenToolbar && /*#__PURE__*/ jsx(Footer, {
|
|
97
|
-
pageType: pageType
|
|
98
|
+
pageType: pageType,
|
|
99
|
+
isOriginTemplate: isOriginTemplate
|
|
98
100
|
})
|
|
99
101
|
]
|
|
100
102
|
})
|
package/dist/types/index.d.ts
CHANGED
|
@@ -176,13 +176,16 @@ type BuilderPageProps = {
|
|
|
176
176
|
editorImageToLayout?: boolean;
|
|
177
177
|
isThemeSectionEditor?: boolean;
|
|
178
178
|
hiddenToolbar?: boolean;
|
|
179
|
+
isOriginTemplate?: boolean;
|
|
179
180
|
};
|
|
180
181
|
declare const BuilderPage: React.FC<BuilderPageProps>;
|
|
181
182
|
|
|
182
183
|
declare const getStaticPaths: GetStaticPaths;
|
|
183
184
|
|
|
185
|
+
type TypographyV2FontFamilyType = 'google' | 'custom' | 'theme';
|
|
186
|
+
|
|
184
187
|
type FontItem = {
|
|
185
|
-
type:
|
|
188
|
+
type: TypographyV2FontFamilyType;
|
|
186
189
|
family: string;
|
|
187
190
|
variants: string[];
|
|
188
191
|
subsets: string[];
|
|
@@ -193,7 +196,7 @@ type FontOption = {
|
|
|
193
196
|
effect?: string;
|
|
194
197
|
};
|
|
195
198
|
declare function getFonts(fonts: FontItem[], option?: FontOption, isImportFontByUrl?: boolean): Promise<string>;
|
|
196
|
-
declare const getFontFromGlobalStyle: (data?: string) => Promise<string
|
|
199
|
+
declare const getFontFromGlobalStyle: (data?: string) => "" | Promise<string>;
|
|
197
200
|
|
|
198
201
|
declare const getFontsFromDataBuilder: (dataBuilder: Record<string, any>) => FontItem[];
|
|
199
202
|
declare const getFontFromGroupSetting: (fonts: FontItem[], groupSetting: Record<string, any>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0-dev.80",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"next": "latest"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gem-sdk/core": "1.
|
|
30
|
-
"@gem-sdk/plugin-cookie-bar": "1.
|
|
31
|
-
"@gem-sdk/plugin-quick-view": "1.
|
|
32
|
-
"@gem-sdk/plugin-sticky-add-to-cart": "1.
|
|
29
|
+
"@gem-sdk/core": "1.43.0-dev.80",
|
|
30
|
+
"@gem-sdk/plugin-cookie-bar": "1.43.0-dev.80",
|
|
31
|
+
"@gem-sdk/plugin-quick-view": "1.43.0-dev.80",
|
|
32
|
+
"@gem-sdk/plugin-sticky-add-to-cart": "1.43.0-dev.80"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"next": ">=13"
|