@gem-sdk/core 1.23.0-staging.33 → 1.23.0-staging.331
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/ComponentToolbarPreview.js +63 -36
- package/dist/cjs/components/ComponentWrapper.js +2 -1
- package/dist/cjs/components/ComponentWrapperPreview.js +29 -2
- package/dist/cjs/components/Render.liquid.js +60 -6
- package/dist/cjs/components/constant.js +7 -2
- package/dist/cjs/components/theme-section/CreateThemeSection.js +3 -4
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +3 -2
- package/dist/cjs/contexts/BuilderPreviewContext.js +12 -9
- package/dist/cjs/contexts/PageContext.js +44 -0
- package/dist/cjs/helpers/animations.js +213 -0
- package/dist/cjs/helpers/background.js +81 -19
- package/dist/cjs/helpers/carousel.js +58 -0
- package/dist/cjs/helpers/colors.js +1 -0
- package/dist/cjs/helpers/compose-advance-style.js +65 -7
- package/dist/cjs/helpers/covert-entities-html.js +19 -0
- package/dist/cjs/helpers/icon-list.js +61 -0
- package/dist/cjs/helpers/make-style.js +21 -5
- package/dist/cjs/helpers/product.js +4 -1
- package/dist/cjs/helpers/queries/get-collection.js +8 -2
- package/dist/cjs/helpers/size.js +123 -17
- package/dist/cjs/helpers/typography.js +1 -1
- package/dist/cjs/helpers/variant.js +5 -2
- package/dist/cjs/hooks/animation/useAnimationActions.js +39 -0
- package/dist/cjs/hooks/animation/useAnimationConfig.js +29 -0
- package/dist/cjs/hooks/animation/useAnimationPreview.js +31 -0
- package/dist/cjs/hooks/animation/useAnimationTarget.js +120 -0
- package/dist/cjs/hooks/animation/useApplyAnimation.js +87 -0
- package/dist/cjs/hooks/useAnimations.js +26 -0
- package/dist/cjs/hooks/useProduct.js +15 -4
- package/dist/cjs/index.js +55 -0
- package/dist/cjs/types/animations.js +47 -0
- package/dist/cjs/web-components/src/helpers/styles/constant.js +9 -0
- package/dist/esm/components/ComponentToolbarPreview.js +63 -36
- package/dist/esm/components/ComponentWrapper.js +2 -1
- package/dist/esm/components/ComponentWrapperPreview.js +31 -4
- package/dist/esm/components/Render.liquid.js +60 -6
- package/dist/esm/components/constant.js +7 -3
- package/dist/esm/components/theme-section/CreateThemeSection.js +3 -4
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +3 -2
- package/dist/esm/contexts/BuilderPreviewContext.js +12 -9
- package/dist/esm/contexts/PageContext.js +41 -0
- package/dist/esm/helpers/animations.js +211 -0
- package/dist/esm/helpers/background.js +78 -20
- package/dist/esm/helpers/carousel.js +54 -0
- package/dist/esm/helpers/colors.js +1 -0
- package/dist/esm/helpers/compose-advance-style.js +62 -8
- package/dist/esm/helpers/covert-entities-html.js +17 -0
- package/dist/esm/helpers/icon-list.js +58 -0
- package/dist/esm/helpers/make-style.js +20 -6
- package/dist/esm/helpers/product.js +4 -1
- package/dist/esm/helpers/queries/get-collection.js +8 -2
- package/dist/esm/helpers/size.js +119 -18
- package/dist/esm/helpers/typography.js +1 -1
- package/dist/esm/helpers/variant.js +5 -2
- package/dist/esm/hooks/animation/useAnimationActions.js +37 -0
- package/dist/esm/hooks/animation/useAnimationConfig.js +27 -0
- package/dist/esm/hooks/animation/useAnimationPreview.js +29 -0
- package/dist/esm/hooks/animation/useAnimationTarget.js +118 -0
- package/dist/esm/hooks/animation/useApplyAnimation.js +83 -0
- package/dist/esm/hooks/useAnimations.js +24 -0
- package/dist/esm/hooks/useProduct.js +15 -4
- package/dist/esm/index.js +10 -4
- package/dist/esm/types/animations.js +47 -0
- package/dist/esm/web-components/src/helpers/styles/constant.js +7 -0
- package/dist/types/index.d.ts +6463 -67
- package/package.json +2 -2
- package/dist/cjs/components/resize/Resize.js +0 -16
- package/dist/cjs/components/resize/Spacing.js +0 -138
- package/dist/esm/components/resize/Resize.js +0 -12
- package/dist/esm/components/resize/Spacing.js +0 -134
|
@@ -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;
|
|
@@ -25,24 +25,6 @@ const isSection = (el)=>{
|
|
|
25
25
|
const tag = el.getAttribute('data-component-tag');
|
|
26
26
|
return tag === 'Section';
|
|
27
27
|
};
|
|
28
|
-
const isOverToolbarPosition = (el, parent)=>{
|
|
29
|
-
const rect = el.getBoundingClientRect();
|
|
30
|
-
const rectP = parent.getBoundingClientRect();
|
|
31
|
-
// 32px = toolbar active height
|
|
32
|
-
return rect.top - rectP.top < 32 + 1;
|
|
33
|
-
};
|
|
34
|
-
const findOverflowParent = (element, initEl)=>{
|
|
35
|
-
const thisEl = element;
|
|
36
|
-
const origEl = initEl || thisEl;
|
|
37
|
-
if (!thisEl) return;
|
|
38
|
-
if (isSection(thisEl)) return;
|
|
39
|
-
if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
|
|
40
|
-
if (thisEl.parentElement) {
|
|
41
|
-
return findOverflowParent(thisEl.parentElement, origEl);
|
|
42
|
-
} else {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
28
|
const ComponentToolbarPreview = ({ ...props })=>{
|
|
47
29
|
const isThemeSection = props.isThemeSection;
|
|
48
30
|
const editingPageType = ShopContext.useShopStore((s)=>s.pageType);
|
|
@@ -53,13 +35,32 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
53
35
|
const [isShowParent, setIsShowParent] = react.useState(false);
|
|
54
36
|
const [isShowParentRevert, setIsShowParentRevert] = react.useState(false);
|
|
55
37
|
const [parents, setParents] = react.useState([]);
|
|
38
|
+
const isOverToolbarPosition = (el, parent)=>{
|
|
39
|
+
const parentLenght = parents.length;
|
|
40
|
+
const rect = el.getBoundingClientRect();
|
|
41
|
+
const rectP = parent.getBoundingClientRect();
|
|
42
|
+
// 36px = toolbar active height + 4 spaces
|
|
43
|
+
return rect.top - rectP.top < parentLenght * 36;
|
|
44
|
+
};
|
|
45
|
+
const findOverflowParent = (element, initEl)=>{
|
|
46
|
+
const thisEl = element;
|
|
47
|
+
const origEl = initEl || thisEl;
|
|
48
|
+
if (!thisEl) return;
|
|
49
|
+
if (isSection(thisEl)) return;
|
|
50
|
+
if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
|
|
51
|
+
if (thisEl.parentElement) {
|
|
52
|
+
return findOverflowParent(thisEl.parentElement, origEl);
|
|
53
|
+
} else {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
56
57
|
// Get parents
|
|
57
58
|
const onActiveComponent = react.useCallback((e)=>{
|
|
58
59
|
const detail = e.detail;
|
|
59
60
|
if (detail?.componentUid == props.uid) {
|
|
60
61
|
const currentParents = getParents(props.uid).filter((parent)=>{
|
|
61
62
|
if (parent.uid === 'ROOT') return false;
|
|
62
|
-
if (parent.tag === 'Section') return false;
|
|
63
|
+
if (parent.tag === 'Section' && isThemeSectionEditor) return false;
|
|
63
64
|
if (parent.editorConfigs?.toolbar?.hide) return false;
|
|
64
65
|
if (parent.editorConfigs?.component?.noSetting) return false;
|
|
65
66
|
return true;
|
|
@@ -72,7 +73,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
72
73
|
}, [
|
|
73
74
|
setParents,
|
|
74
75
|
getParents,
|
|
75
|
-
props.uid
|
|
76
|
+
props.uid,
|
|
77
|
+
isThemeSectionEditor
|
|
76
78
|
]);
|
|
77
79
|
react.useEffect(()=>{
|
|
78
80
|
window.addEventListener('editor:active-component', onActiveComponent);
|
|
@@ -115,7 +117,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
115
117
|
setIsShowParentRevert(true);
|
|
116
118
|
} else {
|
|
117
119
|
const rect = $toolbar.getBoundingClientRect();
|
|
118
|
-
if (rect.top < parents.length *
|
|
120
|
+
if (rect.top < parents.length * 36) {
|
|
119
121
|
setIsShowParentRevert(true);
|
|
120
122
|
} else {
|
|
121
123
|
setIsShowParentRevert(false);
|
|
@@ -160,6 +162,17 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
160
162
|
window.dispatchEvent(event);
|
|
161
163
|
return false;
|
|
162
164
|
};
|
|
165
|
+
const toolbarName = ()=>{
|
|
166
|
+
const tag = props.tag;
|
|
167
|
+
if (tag === 'IconListV2') {
|
|
168
|
+
return 'Item list';
|
|
169
|
+
}
|
|
170
|
+
if (tag === 'IconList') {
|
|
171
|
+
return 'Advanced list';
|
|
172
|
+
}
|
|
173
|
+
const name = props.customLabel || props.label;
|
|
174
|
+
return name;
|
|
175
|
+
};
|
|
163
176
|
const onZoomOut = (e)=>{
|
|
164
177
|
e.preventDefault();
|
|
165
178
|
e.stopPropagation();
|
|
@@ -199,6 +212,13 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
199
212
|
}
|
|
200
213
|
return false;
|
|
201
214
|
};
|
|
215
|
+
const getSectionName = ()=>{
|
|
216
|
+
const checkRenamedSection = props.name && props.name === `Section ${props.uid}`;
|
|
217
|
+
if (getSectionNumber() >= SECTION_LIMIT - 5) {
|
|
218
|
+
return `${checkRenamedSection ? 'Section' : props?.name} ${getIndexSection() + 1}/${SECTION_LIMIT}`;
|
|
219
|
+
}
|
|
220
|
+
return checkRenamedSection ? `Section ${getIndexSection() + 1}` : props?.name;
|
|
221
|
+
};
|
|
202
222
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
203
223
|
children: [
|
|
204
224
|
!(props.tag == 'Section' && isThemeSectionEditor) && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -249,10 +269,10 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
249
269
|
}),
|
|
250
270
|
props.tag == 'Section' ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
251
271
|
"data-toolbar-name": true,
|
|
252
|
-
children:
|
|
272
|
+
children: getSectionName()
|
|
253
273
|
}) : /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
254
274
|
"data-toolbar-name": true,
|
|
255
|
-
children:
|
|
275
|
+
children: toolbarName()
|
|
256
276
|
}),
|
|
257
277
|
props.tag !== 'Section' && parents.length > 0 && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
258
278
|
"data-toolbar-icon-parent": true,
|
|
@@ -270,12 +290,21 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
270
290
|
})
|
|
271
291
|
]
|
|
272
292
|
}),
|
|
273
|
-
isShowParent && parents.map((parent, index)
|
|
293
|
+
isShowParent && parents.map((parent, index)=>{
|
|
294
|
+
// Update count columns of Row
|
|
295
|
+
const parentLength = parent?.childrens?.length ?? 0;
|
|
296
|
+
let parent_label = parent.label;
|
|
297
|
+
if (parent.label === 'Row') {
|
|
298
|
+
parent_label = parentLength <= 1 ? parent.label + ' ' + parentLength + ' col' : parent.label + ' ' + parentLength + ' cols';
|
|
299
|
+
}
|
|
300
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
274
301
|
"data-toolbar-parent": true,
|
|
275
302
|
"data-parent-uid": parent.uid,
|
|
276
303
|
"data-toolbar-theme-section": isThemeSectionEditor,
|
|
304
|
+
"data-toolbar-parent-revert": isShowParentRevert,
|
|
277
305
|
style: {
|
|
278
|
-
top: !isShowParentRevert ? `${-
|
|
306
|
+
top: !isShowParentRevert ? `${-36 * (index + 1)}px` // 32 height + 4 spacing
|
|
307
|
+
: `${36 * (index + 1)}px`
|
|
279
308
|
},
|
|
280
309
|
children: [
|
|
281
310
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -315,11 +344,12 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
315
344
|
}),
|
|
316
345
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
317
346
|
"data-toolbar-name": true,
|
|
318
|
-
children:
|
|
347
|
+
children: parent_label
|
|
319
348
|
})
|
|
320
349
|
]
|
|
321
|
-
}, parent.uid)
|
|
322
|
-
|
|
350
|
+
}, parent.uid);
|
|
351
|
+
}),
|
|
352
|
+
props.tag === 'Section' && !props.isThemeSection && editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
|
|
323
353
|
...props
|
|
324
354
|
}),
|
|
325
355
|
props.tag == 'Sticky' && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -406,8 +436,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
406
436
|
viewBox: "0 0 16 16",
|
|
407
437
|
fill: "none",
|
|
408
438
|
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
409
|
-
d: "M8.
|
|
410
|
-
fill: "
|
|
439
|
+
d: "M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",
|
|
440
|
+
fill: "#212121"
|
|
411
441
|
})
|
|
412
442
|
})
|
|
413
443
|
}),
|
|
@@ -426,15 +456,12 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
426
456
|
viewBox: "0 0 16 16",
|
|
427
457
|
fill: "none",
|
|
428
458
|
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
429
|
-
d: "M8.
|
|
430
|
-
fill: "
|
|
459
|
+
d: "M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",
|
|
460
|
+
fill: "#212121"
|
|
431
461
|
})
|
|
432
462
|
})
|
|
433
463
|
})
|
|
434
464
|
]
|
|
435
|
-
}),
|
|
436
|
-
/*#__PURE__*/ jsxRuntime.jsx(Resize.default, {
|
|
437
|
-
...props
|
|
438
465
|
})
|
|
439
466
|
]
|
|
440
467
|
});
|
|
@@ -20,6 +20,7 @@ const ComponentWrapper = ({ children, ...props })=>{
|
|
|
20
20
|
advanced: advanced
|
|
21
21
|
}),
|
|
22
22
|
/*#__PURE__*/ jsxRuntime.jsx(children.type, {
|
|
23
|
+
className: advanced?.cssClass,
|
|
23
24
|
...children.props,
|
|
24
25
|
style,
|
|
25
26
|
advanced
|
|
@@ -35,7 +36,7 @@ const ComponentWrapper = ({ children, ...props })=>{
|
|
|
35
36
|
}),
|
|
36
37
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
37
38
|
style: style,
|
|
38
|
-
className: `${props.uid}`,
|
|
39
|
+
className: `${props.uid} ${advanced?.cssClass}`,
|
|
39
40
|
children: children
|
|
40
41
|
})
|
|
41
42
|
]
|
|
@@ -8,8 +8,23 @@ var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
|
8
8
|
var constant = require('./constant.js');
|
|
9
9
|
var RenderCustomCode = require('./RenderCustomCode.js');
|
|
10
10
|
var ComponentToolbarPreview = require('./ComponentToolbarPreview.js');
|
|
11
|
+
var useApplyAnimation = require('../hooks/animation/useApplyAnimation.js');
|
|
11
12
|
|
|
12
13
|
const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
14
|
+
react.useEffect(()=>{
|
|
15
|
+
const event = new CustomEvent('editor:component:render', {
|
|
16
|
+
bubbles: true,
|
|
17
|
+
detail: {
|
|
18
|
+
componentUid: props.uid
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
window.dispatchEvent(event);
|
|
22
|
+
}, [
|
|
23
|
+
props.uid
|
|
24
|
+
]);
|
|
25
|
+
useApplyAnimation.default({
|
|
26
|
+
props
|
|
27
|
+
});
|
|
13
28
|
if (props.type === 'section') {
|
|
14
29
|
return null;
|
|
15
30
|
}
|
|
@@ -23,6 +38,9 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
23
38
|
if (editorConfigs.placeholder?.notAppendBeforeAfter) {
|
|
24
39
|
customProps['data-placeholder-not-append-before-after'] = true;
|
|
25
40
|
}
|
|
41
|
+
if (editorConfigs.placeholder?.notAppendLeftRight) {
|
|
42
|
+
customProps['data-placeholder-not-append-left-right'] = true;
|
|
43
|
+
}
|
|
26
44
|
if (editorConfigs.toolbar?.parent) {
|
|
27
45
|
customProps['data-toolbar-parent'] = true;
|
|
28
46
|
}
|
|
@@ -95,11 +113,20 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
95
113
|
advanced: advanced
|
|
96
114
|
}),
|
|
97
115
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
98
|
-
style: style
|
|
116
|
+
style: !constant.excludeApplyStyle.includes(props.tag) ? style : {
|
|
117
|
+
'--mb': style?.['--mb'],
|
|
118
|
+
'--mb-tablet': style?.['--mb-tablet'],
|
|
119
|
+
'--mb-mobile': style?.['--mb-mobile']
|
|
120
|
+
},
|
|
99
121
|
className: `${props.uid} ${props.advanced?.cssClass ? props.advanced?.cssClass : ''}`,
|
|
100
122
|
...builderAttrs,
|
|
101
123
|
children: [
|
|
102
|
-
children,
|
|
124
|
+
!constant.excludeApplyStyle.includes(props.tag) && children,
|
|
125
|
+
/*#__PURE__*/ react.isValidElement(children) && constant.excludeApplyStyle.includes(props.tag) && /*#__PURE__*/ jsxRuntime.jsx(children.type, {
|
|
126
|
+
...children.props,
|
|
127
|
+
style,
|
|
128
|
+
advanced
|
|
129
|
+
}),
|
|
103
130
|
/*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.ComponentToolbarPreview, {
|
|
104
131
|
...props
|
|
105
132
|
})
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var makeStyle = require('../helpers/make-style.js');
|
|
5
6
|
require('react');
|
|
6
7
|
require('react/jsx-runtime');
|
|
7
8
|
require('zustand');
|
|
@@ -13,7 +14,7 @@ require('../hooks/useCartUI.js');
|
|
|
13
14
|
require('react-transition-group');
|
|
14
15
|
require('@gem-sdk/core');
|
|
15
16
|
var render = require('../helpers/render.js');
|
|
16
|
-
require('../helpers/convert.js');
|
|
17
|
+
var convert = require('../helpers/convert.js');
|
|
17
18
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
18
19
|
var constant = require('./constant.js');
|
|
19
20
|
|
|
@@ -24,6 +25,13 @@ const componentTexts = [
|
|
|
24
25
|
'Text',
|
|
25
26
|
'Heading'
|
|
26
27
|
];
|
|
28
|
+
const componentIconList = [
|
|
29
|
+
'IconListV2',
|
|
30
|
+
'IconList'
|
|
31
|
+
];
|
|
32
|
+
const componentUsingAdvanced = [
|
|
33
|
+
'IconList'
|
|
34
|
+
];
|
|
27
35
|
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, ...passProps })=>{
|
|
28
36
|
const item = builder[uid];
|
|
29
37
|
const Component = components[item?.tag];
|
|
@@ -104,7 +112,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
104
112
|
});
|
|
105
113
|
});
|
|
106
114
|
} else {
|
|
107
|
-
liquid = render.template`<div style="${style}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
115
|
+
liquid = render.template`<div style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
108
116
|
${render.RenderIf(item?.childrens?.length, ()=>{
|
|
109
117
|
return Component({
|
|
110
118
|
builderProps: {
|
|
@@ -114,6 +122,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
114
122
|
styles: item.styles,
|
|
115
123
|
setting: item.settings,
|
|
116
124
|
advanced: {
|
|
125
|
+
...componentUsingAdvanced.includes(item.tag) ? item?.advanced : {},
|
|
117
126
|
cssClass: item?.advanced?.cssClass
|
|
118
127
|
},
|
|
119
128
|
pageContext,
|
|
@@ -153,6 +162,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
153
162
|
},
|
|
154
163
|
pageContext,
|
|
155
164
|
isText: componentTexts.includes(item.tag) ? true : null,
|
|
165
|
+
style: componentIconList.includes(item.tag) ? style : null,
|
|
156
166
|
...passProps
|
|
157
167
|
});
|
|
158
168
|
})}
|
|
@@ -161,6 +171,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
161
171
|
const { cssCode, jsCode } = RenderCustomCode(item);
|
|
162
172
|
if (cssCode) liquid += cssCode;
|
|
163
173
|
if (jsCode) liquid += jsCode;
|
|
174
|
+
liquid = appendAnimation(item, liquid);
|
|
164
175
|
return {
|
|
165
176
|
liquid,
|
|
166
177
|
extraFiles: customProps.extraFiles
|
|
@@ -190,13 +201,56 @@ const RenderCustomCode = (item)=>{
|
|
|
190
201
|
jsCode
|
|
191
202
|
};
|
|
192
203
|
};
|
|
204
|
+
const appendAnimation = (props, liquid)=>{
|
|
205
|
+
const { advanced, tag } = props;
|
|
206
|
+
const { animation } = advanced ?? {};
|
|
207
|
+
const enableAnimation = animation?.desktop?.enabled || animation?.tablet?.enabled || animation?.mobile?.enabled;
|
|
208
|
+
if (!enableAnimation || !animation?.desktop?.triggerConfig) return liquid;
|
|
209
|
+
const getAnimationType = (settings, type)=>{
|
|
210
|
+
return settings?.triggerConfig?.[type]?.animation ?? 'none';
|
|
211
|
+
};
|
|
212
|
+
const getSettingsByDevice = (device)=>{
|
|
213
|
+
if (device === 'desktop') return animation?.desktop;
|
|
214
|
+
else if (device === 'tablet') return animation?.tablet ?? animation?.desktop;
|
|
215
|
+
else if (device === 'mobile') return animation?.mobile ?? animation?.tablet ?? animation?.desktop;
|
|
216
|
+
return animation?.desktop;
|
|
217
|
+
};
|
|
218
|
+
const getInitOpacity = (device)=>+!(getSettingsByDevice(device)?.enabled && ![
|
|
219
|
+
'shake',
|
|
220
|
+
'none'
|
|
221
|
+
].includes(getAnimationType(getSettingsByDevice(device), 'appear')));
|
|
222
|
+
const opacityObject = {
|
|
223
|
+
desktop: getInitOpacity('desktop'),
|
|
224
|
+
tablet: getInitOpacity('tablet'),
|
|
225
|
+
mobile: getInitOpacity('mobile')
|
|
226
|
+
};
|
|
227
|
+
const inheritParentStyle = {
|
|
228
|
+
all: tag === 'Section' ? '' : 'inherit',
|
|
229
|
+
position: 'static'
|
|
230
|
+
};
|
|
231
|
+
return render.template`
|
|
232
|
+
${render.RenderIf(convert.isLocalEnv, `<script src="{{ 'gp-animation.js' | asset_url }}" defer="defer"></script>`, `<script src="${convert.baseAssetURL}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
233
|
+
<gp-animation
|
|
234
|
+
gp-data='${JSON.stringify({
|
|
235
|
+
config: animation,
|
|
236
|
+
tag
|
|
237
|
+
})}'
|
|
238
|
+
style="${{
|
|
239
|
+
...inheritParentStyle
|
|
240
|
+
}}"
|
|
241
|
+
>
|
|
242
|
+
<div style="${{
|
|
243
|
+
...makeStyle.makeStyleResponsive('op', opacityObject)
|
|
244
|
+
}}">${liquid}</div>
|
|
245
|
+
</gp-animation>
|
|
246
|
+
`;
|
|
247
|
+
};
|
|
193
248
|
const RenderChildren = (props)=>{
|
|
194
249
|
const data = Render(props);
|
|
195
250
|
// Append to prop parent
|
|
196
251
|
for(const key in data.extraFiles){
|
|
197
252
|
if (Object.prototype.hasOwnProperty.call(data.extraFiles, key)) {
|
|
198
|
-
|
|
199
|
-
props.customProps.extraFiles[key] = value;
|
|
253
|
+
props.customProps.extraFiles[key] = data.extraFiles[key];
|
|
200
254
|
}
|
|
201
255
|
}
|
|
202
256
|
// Fix limit 256kb
|
|
@@ -205,7 +259,7 @@ const RenderChildren = (props)=>{
|
|
|
205
259
|
if (Math.ceil(size / 1024) >= 180) {
|
|
206
260
|
const fileName = `gp-section-snippet-${props.uid}`;
|
|
207
261
|
props.customProps.extraFiles[fileName] = data.liquid;
|
|
208
|
-
return `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant %}`;
|
|
262
|
+
return `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
|
|
209
263
|
}
|
|
210
264
|
return data.liquid;
|
|
211
265
|
};
|
|
@@ -222,7 +276,7 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
|
222
276
|
if (Math.ceil(size / 1024) >= 180) {
|
|
223
277
|
const fileName = `gp-section-snippet-${uid + i}`;
|
|
224
278
|
customProps.extraFiles[fileName] = code;
|
|
225
|
-
liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant %}`;
|
|
279
|
+
liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
|
|
226
280
|
} else {
|
|
227
281
|
liquid += code;
|
|
228
282
|
}
|
|
@@ -20,7 +20,6 @@ const disableWrap = [
|
|
|
20
20
|
'Header',
|
|
21
21
|
'HeroBanner',
|
|
22
22
|
'Icon',
|
|
23
|
-
'IconList',
|
|
24
23
|
'HTMLCode',
|
|
25
24
|
'IconListHoz',
|
|
26
25
|
'IconListItem',
|
|
@@ -35,7 +34,8 @@ const disableWrap = [
|
|
|
35
34
|
'Product',
|
|
36
35
|
'ProductImages',
|
|
37
36
|
'ProductImagesV2',
|
|
38
|
-
'Sticky'
|
|
37
|
+
'Sticky',
|
|
38
|
+
'Heading'
|
|
39
39
|
];
|
|
40
40
|
const customRenderChildren = [
|
|
41
41
|
'Accordion',
|
|
@@ -44,6 +44,11 @@ const customRenderChildren = [
|
|
|
44
44
|
'IconList',
|
|
45
45
|
'Tabs'
|
|
46
46
|
];
|
|
47
|
+
const excludeApplyStyle = [
|
|
48
|
+
'IconListV2',
|
|
49
|
+
'IconList'
|
|
50
|
+
];
|
|
47
51
|
|
|
48
52
|
exports.customRenderChildren = customRenderChildren;
|
|
49
53
|
exports.disableWrap = disableWrap;
|
|
54
|
+
exports.excludeApplyStyle = excludeApplyStyle;
|
|
@@ -15,15 +15,14 @@ require('../../helpers/convert.js');
|
|
|
15
15
|
const SHOW_TOOLTIP_TIMEOUT = 600;
|
|
16
16
|
const NUMBER_OF_THEME_SECTION_CREATED_TO_SHOW_TOOLTIP = 1;
|
|
17
17
|
const LIMIT_PLANS = [
|
|
18
|
+
'starter',
|
|
18
19
|
'trial',
|
|
19
20
|
'trial2022'
|
|
20
21
|
];
|
|
21
22
|
const CreateThemeSection = ({ ...props })=>{
|
|
22
|
-
const isThemeSection = props.isThemeSection;
|
|
23
23
|
const shopPlan = ShopContext.useShopStore((s)=>s.plan);
|
|
24
24
|
const createThemeSectionCount = ShopContext.useShopStore((s)=>s.createThemeSectionCount);
|
|
25
25
|
const isLimit = LIMIT_PLANS.includes(shopPlan ?? '');
|
|
26
|
-
const isRenderCreateThemeSection = props.tag === 'Section' && !isThemeSection;
|
|
27
26
|
const isRenderTooltip = isLimit || createThemeSectionCount === undefined || createThemeSectionCount < NUMBER_OF_THEME_SECTION_CREATED_TO_SHOW_TOOLTIP;
|
|
28
27
|
const timeoutRef = react.useRef();
|
|
29
28
|
const [isShowTooltip, setIsShowTooltip] = react.useState(false);
|
|
@@ -71,11 +70,11 @@ const CreateThemeSection = ({ ...props })=>{
|
|
|
71
70
|
onMouseEnter: showTooltip,
|
|
72
71
|
onMouseLeave: hideTooltip,
|
|
73
72
|
children: [
|
|
74
|
-
|
|
73
|
+
isRenderTooltip && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
75
74
|
"data-toolbar-create-theme-section": true,
|
|
76
75
|
children: "You can create reusable sections"
|
|
77
76
|
}),
|
|
78
|
-
|
|
77
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
79
78
|
"data-toolbar-active-create-theme-section-wrapper": true,
|
|
80
79
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
81
80
|
"data-toolbar-active-create-theme-section": true,
|
|
@@ -29,8 +29,9 @@ const transitions = {
|
|
|
29
29
|
};
|
|
30
30
|
const ThemeSectionTooltip = ({ isShow, isLimit, isRender, children, onMouseEnter, onMouseLeave, onActions })=>{
|
|
31
31
|
const nodeRef = react.useRef(null);
|
|
32
|
+
const actionBtnLabel = isLimit ? 'Upgrade to create Theme Section' : 'Create Theme Section';
|
|
32
33
|
const openHelpCenter = ()=>{
|
|
33
|
-
const url = '
|
|
34
|
+
const url = 'https://help.gempages.net/articles/theme-section';
|
|
34
35
|
window.open(url, '_blank');
|
|
35
36
|
};
|
|
36
37
|
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
@@ -80,7 +81,7 @@ const ThemeSectionTooltip = ({ isShow, isLimit, isRender, children, onMouseEnter
|
|
|
80
81
|
children: [
|
|
81
82
|
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
82
83
|
onClick: (e)=>onActions(e),
|
|
83
|
-
children:
|
|
84
|
+
children: actionBtnLabel
|
|
84
85
|
}),
|
|
85
86
|
isLimit && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
86
87
|
onClick: openHelpCenter,
|
|
@@ -412,15 +412,18 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.creat
|
|
|
412
412
|
}
|
|
413
413
|
return parents;
|
|
414
414
|
},
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
415
|
+
updateItemName: (id, name)=>{
|
|
416
|
+
const state = get().state;
|
|
417
|
+
const item = state[id];
|
|
418
|
+
if (item) {
|
|
419
|
+
item.name = name;
|
|
420
|
+
set({
|
|
421
|
+
state: {
|
|
422
|
+
...state,
|
|
423
|
+
[id]: cloneDeep.cloneDeep(item)
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
}
|
|
424
427
|
}
|
|
425
428
|
}));
|
|
426
429
|
const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, lazy, ...passProps })=>{
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var zustand = require('zustand');
|
|
6
|
+
|
|
7
|
+
const PageContext = /*#__PURE__*/ react.createContext(null);
|
|
8
|
+
const createPageStoreProvider = (data)=>zustand.createStore((set)=>({
|
|
9
|
+
...data,
|
|
10
|
+
setDynamicProduct: (data)=>{
|
|
11
|
+
set({
|
|
12
|
+
dynamicProduct: data
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
setDynamicCollection: (data)=>{
|
|
16
|
+
set({
|
|
17
|
+
dynamicCollection: data
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
const PageProvider = ({ children, dynamicProduct, dynamicCollection, ...passProps })=>{
|
|
22
|
+
const store = react.useMemo(()=>createPageStoreProvider({
|
|
23
|
+
dynamicProduct,
|
|
24
|
+
dynamicCollection
|
|
25
|
+
}), [
|
|
26
|
+
dynamicProduct,
|
|
27
|
+
dynamicCollection
|
|
28
|
+
]);
|
|
29
|
+
return /*#__PURE__*/ jsxRuntime.jsx(PageContext.Provider, {
|
|
30
|
+
...passProps,
|
|
31
|
+
value: store,
|
|
32
|
+
children: children
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const usePageStore = (selector, equalityFn)=>{
|
|
36
|
+
const store = react.useContext(PageContext);
|
|
37
|
+
if (!store) {
|
|
38
|
+
throw new Error('usePageStore must be used within a PageProvider');
|
|
39
|
+
}
|
|
40
|
+
return zustand.useStore(store, selector, equalityFn);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.PageProvider = PageProvider;
|
|
44
|
+
exports.usePageStore = usePageStore;
|