@gem-sdk/core 1.53.0-dev.16 → 1.53.0-dev.161
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 +58 -4
- package/dist/cjs/components/InteractionSuffix.js +19 -92
- package/dist/cjs/components/Render.liquid.js +40 -7
- package/dist/cjs/contexts/PageContext.js +9 -1
- package/dist/cjs/graphql/queries/published-shop-metas.js +15 -0
- package/dist/cjs/helpers/animations.js +11 -2
- package/dist/cjs/helpers/background.js +10 -5
- package/dist/cjs/helpers/compose-advance-style.js +6 -1
- package/dist/cjs/helpers/interaction/index.js +45 -6
- package/dist/cjs/helpers/radius.js +11 -1
- package/dist/cjs/helpers/shadow.js +4 -3
- package/dist/cjs/helpers/third-party/appConfig.js +49 -0
- package/dist/cjs/helpers/third-party/appSetting.js +155 -1
- package/dist/cjs/helpers/third-party/constant.js +8 -1
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +8 -1
- package/dist/cjs/helpers/typography.js +5 -2
- package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -1
- package/dist/cjs/hooks/animation/useApplyAnimation.js +5 -5
- package/dist/cjs/index.js +5 -1
- package/dist/esm/components/ComponentToolbarPreview.js +58 -4
- package/dist/esm/components/InteractionSuffix.js +20 -93
- package/dist/esm/components/Render.liquid.js +40 -7
- package/dist/esm/contexts/PageContext.js +9 -1
- package/dist/esm/graphql/queries/published-shop-metas.js +13 -0
- package/dist/esm/helpers/animations.js +11 -2
- package/dist/esm/helpers/background.js +10 -5
- package/dist/esm/helpers/compose-advance-style.js +7 -2
- package/dist/esm/helpers/interaction/index.js +45 -6
- package/dist/esm/helpers/radius.js +11 -1
- package/dist/esm/helpers/shadow.js +4 -3
- package/dist/esm/helpers/third-party/appConfig.js +43 -1
- package/dist/esm/helpers/third-party/appSetting.js +155 -1
- package/dist/esm/helpers/third-party/constant.js +9 -2
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +8 -1
- package/dist/esm/helpers/typography.js +5 -2
- package/dist/esm/hooks/animation/useAnimationConfig.js +2 -1
- package/dist/esm/hooks/animation/useApplyAnimation.js +5 -5
- package/dist/esm/index.js +3 -1
- package/dist/types/index.d.ts +358 -188
- package/package.json +3 -3
|
@@ -60,7 +60,31 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
60
60
|
editingPageType
|
|
61
61
|
]);
|
|
62
62
|
const isSelectOnPage = react.useMemo(()=>interactionData?.isSelectOnPage, [
|
|
63
|
-
interactionData
|
|
63
|
+
interactionData?.isSelectOnPage
|
|
64
|
+
]);
|
|
65
|
+
const settingType = react.useMemo(()=>interactionData?.settingType, [
|
|
66
|
+
interactionData?.settingType
|
|
67
|
+
]);
|
|
68
|
+
const isShowIconInteractionTarget = react.useMemo(()=>{
|
|
69
|
+
return interactionData?.item?.targets?.find((t)=>t.uid === props.uid && t?.type !== 'PAGE') && settingType === 'TARGET';
|
|
70
|
+
}, [
|
|
71
|
+
interactionData?.item?.targets,
|
|
72
|
+
props.uid,
|
|
73
|
+
settingType
|
|
74
|
+
]);
|
|
75
|
+
const isShowIconInteractionTrigger = react.useMemo(()=>{
|
|
76
|
+
return interactionData?.item?.self?.uid === props.uid && interactionData?.item?.self.type !== 'PAGE' && settingType === 'TRIGGER';
|
|
77
|
+
}, [
|
|
78
|
+
interactionData?.item?.self?.type,
|
|
79
|
+
interactionData?.item?.self?.uid,
|
|
80
|
+
props.uid,
|
|
81
|
+
settingType
|
|
82
|
+
]);
|
|
83
|
+
const isDisplayIconDrag = react.useMemo(()=>{
|
|
84
|
+
return !isShowIconInteractionTarget && !isShowIconInteractionTrigger;
|
|
85
|
+
}, [
|
|
86
|
+
isShowIconInteractionTarget,
|
|
87
|
+
isShowIconInteractionTrigger
|
|
64
88
|
]);
|
|
65
89
|
const { checkDisableDelete, getTooltipText, checkDisableDuplicate } = useToolbarPostPurchase.usePostPurchase(props.uid, props.tag || '');
|
|
66
90
|
const editProductElementList = [
|
|
@@ -338,7 +362,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
338
362
|
if (isShopifySection || isThemeSection && !isThemeSectionEditor) return false;
|
|
339
363
|
return constant.ableGenerateContentElements.includes(tag);
|
|
340
364
|
};
|
|
341
|
-
// if (!isActive) return null;
|
|
342
365
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
343
366
|
children: [
|
|
344
367
|
!(props.tag == 'Section' && isThemeSectionEditor) && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -353,7 +376,39 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
353
376
|
onClick: (e)=>onShowParent(e),
|
|
354
377
|
"aria-hidden": "true",
|
|
355
378
|
children: [
|
|
356
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
379
|
+
isShowIconInteractionTrigger && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
380
|
+
className: "gp-hidden gp-w-[12px] interaction-use-custom-element",
|
|
381
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
382
|
+
width: "12",
|
|
383
|
+
height: "13",
|
|
384
|
+
viewBox: "0 0 12 13",
|
|
385
|
+
fill: "none",
|
|
386
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
387
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
388
|
+
"fill-rule": "evenodd",
|
|
389
|
+
"clip-rule": "evenodd",
|
|
390
|
+
d: "M4.36799 0.430523C4.51596 0.205675 4.76709 0.0703125 5.03626 0.0703125H9.88576C10.2042 0.0703125 10.395 0.424378 10.2198 0.69034L8.36968 3.4992C8.28209 3.63218 8.37747 3.80922 8.53671 3.80922H10.749C11.1111 3.80922 11.2869 4.25204 11.0233 4.50036L3.03971 12.0217C2.7572 12.2878 2.29932 12.0361 2.37262 11.655L3.27994 6.93698C3.30366 6.81364 3.20915 6.69921 3.08354 6.69921H0.984651C0.66625 6.69921 0.475479 6.34529 0.650515 6.07932L4.36799 0.430523Z",
|
|
391
|
+
fill: "#F9F9F9"
|
|
392
|
+
})
|
|
393
|
+
})
|
|
394
|
+
}),
|
|
395
|
+
isShowIconInteractionTarget && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
396
|
+
className: "gp-hidden gp-w-[14px] interaction-use-custom-element",
|
|
397
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
398
|
+
width: "16",
|
|
399
|
+
height: "16",
|
|
400
|
+
viewBox: "0 0 16 16",
|
|
401
|
+
fill: "none",
|
|
402
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
403
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
404
|
+
"fill-rule": "evenodd",
|
|
405
|
+
"clip-rule": "evenodd",
|
|
406
|
+
d: "M7.32785 3.66159C7.87459 3.58351 8.25451 3.077 8.17643 2.53026C8.09836 1.98353 7.59184 1.6036 7.0451 1.68168C3.92866 2.12673 1.5332 4.80488 1.5332 8.04424C1.5332 11.594 4.41085 14.4716 7.9606 14.4716C11.1706 14.4716 13.8294 12.1194 14.3105 9.04446C14.3959 8.49881 14.0227 7.98727 13.4771 7.9019C12.9314 7.81654 12.4199 8.18967 12.3345 8.73531C12.0034 10.852 10.1702 12.4716 7.9606 12.4716C5.51541 12.4716 3.5332 10.4894 3.5332 8.04424C3.5332 5.81431 5.18273 3.96793 7.32785 3.66159ZM10.3432 1.97548C10.6232 1.69551 11.102 1.83654 11.1855 2.22355L11.6106 4.19339C11.6313 4.28936 11.7063 4.36432 11.8023 4.38503L13.7721 4.81013C14.1591 4.89365 14.3001 5.37247 14.0202 5.65243L12.3432 7.32945C12.1244 7.54819 11.8168 7.65338 11.5099 7.61436L10.1528 7.44178C9.84592 7.40276 9.53827 7.50795 9.31953 7.72669L8.66719 8.37903C8.35477 8.69145 7.86633 8.70954 7.57623 8.41943C7.28613 8.12933 7.30421 7.64089 7.61663 7.32847L8.26898 6.67613C8.48771 6.45739 8.5929 6.14974 8.55388 5.84287L8.38131 4.48575C8.34228 4.17888 8.44748 3.87123 8.66621 3.6525L10.3432 1.97548ZM8.19853 5.1916C8.35319 5.72179 8.04877 6.27697 7.51858 6.43163C6.83078 6.63226 6.32988 7.2683 6.32988 8.01873C6.32988 8.9316 7.06991 9.67164 7.98279 9.67164C8.73014 9.67164 9.36406 9.17486 9.56743 8.49131C9.72492 7.96195 10.2817 7.6605 10.8111 7.81799C11.3404 7.97548 11.6419 8.53227 11.4844 9.06163C11.0356 10.57 9.63916 11.6716 7.98279 11.6716C5.96535 11.6716 4.32988 10.0362 4.32988 8.01873C4.32988 6.35558 5.44054 4.95445 6.95851 4.51165C7.4887 4.35699 8.04387 4.66141 8.19853 5.1916Z",
|
|
407
|
+
fill: "#F9F9F9"
|
|
408
|
+
})
|
|
409
|
+
})
|
|
410
|
+
}),
|
|
411
|
+
isDisplayIconDrag && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
357
412
|
"data-toolbar-icon-drag": true,
|
|
358
413
|
children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
359
414
|
width: "16",
|
|
@@ -610,7 +665,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
610
665
|
]
|
|
611
666
|
}),
|
|
612
667
|
/*#__PURE__*/ jsxRuntime.jsx(InteractionSuffix.InteractionSuffix, {
|
|
613
|
-
tag: props.tag,
|
|
614
668
|
uid: props.uid
|
|
615
669
|
})
|
|
616
670
|
]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var react = require('react');
|
|
5
4
|
require('zustand');
|
|
5
|
+
require('react');
|
|
6
6
|
require('swr');
|
|
7
7
|
var PageContext = require('../contexts/PageContext.js');
|
|
8
8
|
require('@gem-sdk/adapter-shopify');
|
|
@@ -17,98 +17,25 @@ require('dayjs');
|
|
|
17
17
|
var index = require('../helpers/interaction/index.js');
|
|
18
18
|
require('../helpers/convert.js');
|
|
19
19
|
|
|
20
|
-
const InteractionSuffix = ({
|
|
21
|
-
const { closeSelectOnPage } = index.useInteraction();
|
|
22
|
-
const
|
|
20
|
+
const InteractionSuffix = ({ uid })=>{
|
|
21
|
+
const { closeSelectOnPage, selectInteractionElement } = index.useInteraction();
|
|
22
|
+
const settingType = PageContext.usePageStore((s)=>s.interactionData?.settingType || '');
|
|
23
23
|
const isSelectOnPage = PageContext.usePageStore((s)=>s.interactionData?.isSelectOnPage);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
isCurrentInteractionTarget,
|
|
40
|
-
isCurrentInteractionTrigger
|
|
41
|
-
]);
|
|
42
|
-
const positionOffset = react.useMemo(()=>{
|
|
43
|
-
if (isCurrentInteractionTrigger && isCurrentInteractionTarget) {
|
|
44
|
-
return 80;
|
|
45
|
-
}
|
|
46
|
-
return 40;
|
|
47
|
-
}, [
|
|
48
|
-
isCurrentInteractionTrigger,
|
|
49
|
-
isCurrentInteractionTarget
|
|
50
|
-
]);
|
|
51
|
-
if (!isDisplay) {
|
|
52
|
-
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
53
|
-
}
|
|
54
|
-
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
55
|
-
children: [
|
|
56
|
-
isSelectOnPage && /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
57
|
-
className: "gp-bg-[#F4F4F4] gp-px-2 gp-py-0.5 gp-rounded-lg gp-text-[#212121] gp-text-sm gp-font-medium gp-hidden interaction-use-element-btn",
|
|
58
|
-
onClick: closeSelectOnPage,
|
|
59
|
-
children: "Use element"
|
|
60
|
-
}),
|
|
61
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
62
|
-
className: "hidden gp-left-[-40px] gp-left-[-80px] gp-right-[-40px] gp-right-[-80px]"
|
|
63
|
-
}),
|
|
64
|
-
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
65
|
-
className: `gp-hidden gp-absolute interaction-suffix gp-gap-[8px] ${tag == 'Section' ? `gp-left-[-${positionOffset}px]` : `gp-right-[-${positionOffset}px]`}`,
|
|
66
|
-
children: [
|
|
67
|
-
isCurrentInteractionTrigger && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
68
|
-
className: `gp-h-8 gp-rounded-[8px] gp-w-8 gp-bg-[#212121] gp-flex gp-justify-center gp-items-center `,
|
|
69
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
70
|
-
width: "16",
|
|
71
|
-
height: "16",
|
|
72
|
-
viewBox: "0 0 16 16",
|
|
73
|
-
fill: "none",
|
|
74
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
75
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
76
|
-
fillRule: "evenodd",
|
|
77
|
-
clipRule: "evenodd",
|
|
78
|
-
d: "M12.9196 5.80449C13.0989 5.80449 13.1876 6.02216 13.0595 6.14749L4.83569 14.1892C4.69517 14.3267 4.46149 14.2002 4.49967 14.0074L5.50422 8.93537C5.53483 8.7808 5.41656 8.6368 5.25898 8.6368H3.08019C2.92551 8.6368 2.82938 8.46874 2.90779 8.33541L6.72099 1.85154C6.75692 1.79045 6.8225 1.75293 6.89338 1.75293H12.5729C12.7386 1.75293 12.8324 1.94273 12.7319 2.07435L10.1891 5.40272C10.0634 5.56724 10.1807 5.80449 10.3877 5.80449H12.9196Z",
|
|
79
|
-
fill: "#F9F9F9"
|
|
80
|
-
})
|
|
81
|
-
})
|
|
82
|
-
}),
|
|
83
|
-
isCurrentInteractionTarget && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
84
|
-
className: `gp-h-8 min-w-8 gp-rounded-[8px] gp-w-8 gp-bg-[#212121] gp-flex gp-justify-center gp-items-center`,
|
|
85
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
86
|
-
width: "16",
|
|
87
|
-
height: "16",
|
|
88
|
-
viewBox: "0 0 16 16",
|
|
89
|
-
fill: "none",
|
|
90
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
91
|
-
children: [
|
|
92
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
93
|
-
d: "M8.58987 2.11238C8.62815 2.66333 8.21254 3.141 7.66158 3.17928C6.73192 3.24386 5.84034 3.57396 5.09276 4.13034C4.34519 4.68673 3.77304 5.44602 3.44429 6.31801C3.11554 7.19 3.04401 8.13803 3.23821 9.04947C3.4324 9.96092 3.88415 10.7975 4.53978 11.4597C5.19541 12.122 6.02737 12.5821 6.93682 12.7854C7.84626 12.9888 8.79496 12.9268 9.67021 12.6068C10.5455 12.2869 11.3105 11.7224 11.8743 10.9804C12.4382 10.2385 12.7772 9.35025 12.8512 8.42129C12.895 7.87074 13.3768 7.45996 13.9273 7.50377C14.4779 7.54758 14.8887 8.0294 14.8449 8.57994C14.7406 9.8906 14.2622 11.1438 13.4667 12.1906C12.6711 13.2374 11.5918 14.0338 10.3569 14.4852C9.12204 14.9367 7.78353 15.0241 6.50041 14.7373C5.2173 14.4504 4.0435 13.8012 3.11848 12.8668C2.19345 11.9324 1.55609 10.7522 1.28211 9.46624C1.00813 8.1803 1.10905 6.84274 1.57287 5.61247C2.03669 4.3822 2.84393 3.31093 3.89867 2.52593C4.95342 1.74093 6.21133 1.27521 7.52297 1.18409C8.07393 1.14581 8.5516 1.56142 8.58987 2.11238Z",
|
|
94
|
-
fill: "#F9F9F9"
|
|
95
|
-
}),
|
|
96
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
97
|
-
fillRule: "evenodd",
|
|
98
|
-
clipRule: "evenodd",
|
|
99
|
-
d: "M11.9757 1.25658C12.184 1.31428 12.3452 1.47958 12.3976 1.68929L12.7872 3.24774L14.3457 3.63736C14.5554 3.68978 14.7207 3.85096 14.7784 4.05928C14.8361 4.2676 14.7773 4.49085 14.6244 4.64371L12.7167 6.55141C12.5677 6.70044 12.3514 6.76035 12.1469 6.70924L10.5688 6.3147L8.42436 8.45912C8.19005 8.69344 7.81015 8.69344 7.57583 8.45912C7.34152 8.22481 7.34152 7.84491 7.57583 7.61059L9.72025 5.46617L9.32572 3.88804C9.2746 3.68357 9.33451 3.46728 9.48354 3.31825L11.3912 1.41054C11.5441 1.25769 11.7674 1.19888 11.9757 1.25658ZM10.8795 5.15545L12.1084 5.46267L13.0266 4.54451L12.1469 4.3246C11.9319 4.27086 11.7641 4.10301 11.7104 3.88804L11.4904 3.0084L10.5723 3.92656L10.8795 5.15545Z",
|
|
100
|
-
fill: "#F9F9F9"
|
|
101
|
-
}),
|
|
102
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
103
|
-
d: "M7.35783 6.45343C7.87208 6.25201 8.12568 5.67185 7.92426 5.15761C7.72284 4.64336 7.14268 4.38976 6.62844 4.59118C6.05705 4.81498 5.55049 5.17772 5.15453 5.64655C4.75858 6.11538 4.4857 6.67552 4.36055 7.27631C4.23539 7.87709 4.26189 8.49961 4.43764 9.08758C4.6134 9.67555 4.93289 10.2105 5.36727 10.6439C5.80165 11.0774 6.33722 11.3958 6.92556 11.5702C7.51391 11.7445 8.13643 11.7695 8.73683 11.6427C9.33723 11.5158 9.89652 11.2413 10.3641 10.8439C10.8318 10.4465 11.1929 9.93885 11.4151 9.36679C11.615 8.85196 11.3597 8.27254 10.8449 8.07262C10.3301 7.87269 9.75066 8.12797 9.55073 8.6428C9.44887 8.9051 9.28329 9.1378 9.06901 9.3199C8.85474 9.50199 8.59851 9.62774 8.32352 9.68582C8.04853 9.7439 7.76341 9.73249 7.49394 9.65262C7.22445 9.57274 6.97907 9.42691 6.78001 9.22825C6.58093 9.0296 6.43446 8.78439 6.35386 8.51478C6.27327 8.24517 6.26112 7.9597 6.31851 7.6842C6.37591 7.4087 6.50102 7.1519 6.68251 6.93702C6.86399 6.72214 7.0961 6.55595 7.35783 6.45343Z",
|
|
104
|
-
fill: "#F9F9F9"
|
|
105
|
-
})
|
|
106
|
-
]
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
]
|
|
110
|
-
})
|
|
111
|
-
]
|
|
24
|
+
const onClick = (e)=>{
|
|
25
|
+
selectInteractionElement({
|
|
26
|
+
$target: e.target,
|
|
27
|
+
componentUid: uid,
|
|
28
|
+
settingType
|
|
29
|
+
});
|
|
30
|
+
closeSelectOnPage();
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
33
|
+
children: isSelectOnPage && /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
34
|
+
className: "gp-bg-[#F4F4F4] gp-px-2 gp-h-[24px] gp-py-0.5 gp-rounded-lg gp-text-[#212121] gp-text-xs gp-font-medium gp-hidden interaction-use-custom-element ",
|
|
35
|
+
onClick: onClick,
|
|
36
|
+
"data-setup-interaction": true,
|
|
37
|
+
children: settingType === 'TRIGGER' ? 'Set as trigger' : 'Set as target'
|
|
38
|
+
})
|
|
112
39
|
});
|
|
113
40
|
};
|
|
114
41
|
|
|
@@ -35,7 +35,7 @@ const componentIconList = [
|
|
|
35
35
|
const componentUsingAdvanced = [
|
|
36
36
|
'IconList'
|
|
37
37
|
];
|
|
38
|
-
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, ...passProps })=>{
|
|
38
|
+
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, largeComponent = [], sizeLargeComponent = 50, ...passProps })=>{
|
|
39
39
|
const item = builder[uid];
|
|
40
40
|
const Component = components[item?.tag];
|
|
41
41
|
if (!Component) {
|
|
@@ -74,6 +74,8 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
74
74
|
advanced: item.advanced,
|
|
75
75
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
76
76
|
pageContext,
|
|
77
|
+
largeComponent,
|
|
78
|
+
sizeLargeComponent,
|
|
77
79
|
...passProps,
|
|
78
80
|
builderAttrs: {
|
|
79
81
|
...passProps.builderAttrs
|
|
@@ -85,7 +87,9 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
85
87
|
builder,
|
|
86
88
|
components,
|
|
87
89
|
customProps,
|
|
88
|
-
pageContext
|
|
90
|
+
pageContext,
|
|
91
|
+
largeComponent,
|
|
92
|
+
sizeLargeComponent
|
|
89
93
|
};
|
|
90
94
|
}),
|
|
91
95
|
children: !constant.customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
@@ -97,11 +101,13 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
97
101
|
components,
|
|
98
102
|
customProps,
|
|
99
103
|
parentTag: item.tag,
|
|
100
|
-
pageContext
|
|
104
|
+
pageContext,
|
|
105
|
+
largeComponent,
|
|
106
|
+
sizeLargeComponent
|
|
101
107
|
}))) : ''
|
|
102
108
|
});
|
|
103
109
|
}, ()=>{
|
|
104
|
-
|
|
110
|
+
const liquid = Component({
|
|
105
111
|
builderProps: {
|
|
106
112
|
uid,
|
|
107
113
|
builderData: item
|
|
@@ -113,11 +119,20 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
113
119
|
isText: componentTexts.includes(item.tag) ? true : null,
|
|
114
120
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
115
121
|
pageContext,
|
|
122
|
+
largeComponent,
|
|
123
|
+
sizeLargeComponent,
|
|
116
124
|
...passProps,
|
|
117
125
|
builderAttrs: {
|
|
118
126
|
...passProps.builderAttrs
|
|
119
127
|
}
|
|
120
128
|
});
|
|
129
|
+
if (isLimitSize(liquid, sizeLargeComponent)) {
|
|
130
|
+
largeComponent.push({
|
|
131
|
+
uid: item.uid,
|
|
132
|
+
tag: item.tag
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return liquid;
|
|
121
136
|
});
|
|
122
137
|
} else {
|
|
123
138
|
liquid = render.template`<div gp-el-wrapper style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
@@ -134,6 +149,8 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
134
149
|
cssClass: item?.advanced?.cssClass
|
|
135
150
|
},
|
|
136
151
|
pageContext,
|
|
152
|
+
largeComponent,
|
|
153
|
+
sizeLargeComponent,
|
|
137
154
|
...passProps,
|
|
138
155
|
builderAttrs: {
|
|
139
156
|
...passProps.builderAttrs
|
|
@@ -145,7 +162,9 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
145
162
|
builder,
|
|
146
163
|
components,
|
|
147
164
|
customProps,
|
|
148
|
-
pageContext
|
|
165
|
+
pageContext,
|
|
166
|
+
largeComponent,
|
|
167
|
+
sizeLargeComponent
|
|
149
168
|
};
|
|
150
169
|
}),
|
|
151
170
|
children: !constant.customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
@@ -157,11 +176,13 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
157
176
|
components,
|
|
158
177
|
customProps,
|
|
159
178
|
parentTag: item.tag,
|
|
160
|
-
pageContext
|
|
179
|
+
pageContext,
|
|
180
|
+
largeComponent,
|
|
181
|
+
sizeLargeComponent
|
|
161
182
|
}))) : ''
|
|
162
183
|
});
|
|
163
184
|
}, ()=>{
|
|
164
|
-
|
|
185
|
+
const liquid = Component({
|
|
165
186
|
builderProps: {
|
|
166
187
|
uid,
|
|
167
188
|
builderData: item
|
|
@@ -179,6 +200,13 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
179
200
|
...passProps.builderAttrs
|
|
180
201
|
}
|
|
181
202
|
});
|
|
203
|
+
if (isLimitSize(liquid, sizeLargeComponent)) {
|
|
204
|
+
largeComponent.push({
|
|
205
|
+
uid: item.uid,
|
|
206
|
+
tag: item.tag
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return liquid;
|
|
182
210
|
})}
|
|
183
211
|
</div>`;
|
|
184
212
|
}
|
|
@@ -303,6 +331,11 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
|
303
331
|
}
|
|
304
332
|
return liquid;
|
|
305
333
|
};
|
|
334
|
+
const isLimitSize = (liquid, size = 50)=>{
|
|
335
|
+
const textEncoder = new TextEncoder();
|
|
336
|
+
const byteSize = textEncoder.encode(liquid).length;
|
|
337
|
+
return byteSize >= size * 1024;
|
|
338
|
+
};
|
|
306
339
|
|
|
307
340
|
exports.RenderChildren = RenderChildren;
|
|
308
341
|
exports.WrapRenderChildren = WrapRenderChildren;
|
|
@@ -56,6 +56,14 @@ const createPageStoreProvider = (data)=>zustand.createStore((set)=>({
|
|
|
56
56
|
selectType
|
|
57
57
|
}
|
|
58
58
|
}));
|
|
59
|
+
},
|
|
60
|
+
setInteractionSettingType: (settingType)=>{
|
|
61
|
+
set((state)=>({
|
|
62
|
+
interactionData: {
|
|
63
|
+
...state.interactionData,
|
|
64
|
+
settingType
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
59
67
|
}
|
|
60
68
|
}));
|
|
61
69
|
const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
|
|
@@ -65,7 +73,7 @@ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffe
|
|
|
65
73
|
productOffers,
|
|
66
74
|
publicStoreFrontData,
|
|
67
75
|
interactionData: {
|
|
68
|
-
selectType: '
|
|
76
|
+
selectType: 'ELEMENT'
|
|
69
77
|
}
|
|
70
78
|
}), [
|
|
71
79
|
dynamicProduct,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const PublishedShopMetasDocument = `
|
|
4
|
+
query PublishedShopMetas($keys: [String!]) {
|
|
5
|
+
publishedShopMetas(keys: $keys) {
|
|
6
|
+
id
|
|
7
|
+
createdAt
|
|
8
|
+
updatedAt
|
|
9
|
+
key
|
|
10
|
+
value
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports.PublishedShopMetasDocument = PublishedShopMetasDocument;
|
|
@@ -53,10 +53,16 @@ const animations = ()=>{
|
|
|
53
53
|
'left',
|
|
54
54
|
'right'
|
|
55
55
|
].includes(direction ?? '') ? 'X' : 'Y';
|
|
56
|
-
|
|
56
|
+
let isNeg = [
|
|
57
57
|
'left',
|
|
58
58
|
'down'
|
|
59
59
|
].includes(direction ?? '') ? '-' : '';
|
|
60
|
+
if (reverse) {
|
|
61
|
+
isNeg = [
|
|
62
|
+
'left',
|
|
63
|
+
'down'
|
|
64
|
+
].includes(direction ?? '') ? '' : '-';
|
|
65
|
+
}
|
|
60
66
|
const preset = [
|
|
61
67
|
{
|
|
62
68
|
opacity: 0,
|
|
@@ -126,7 +132,10 @@ const animations = ()=>{
|
|
|
126
132
|
opacity: 1
|
|
127
133
|
}
|
|
128
134
|
];
|
|
129
|
-
|
|
135
|
+
let zoomPreset = zoomDirection === 'in' ? zoomInPreset : zoomOutPreset;
|
|
136
|
+
if (reverse) {
|
|
137
|
+
zoomPreset = zoomDirection === 'in' ? zoomOutPreset : zoomInPreset;
|
|
138
|
+
}
|
|
130
139
|
return generateAnimationInstance(target, reverse ? zoomPreset.reverse() : zoomPreset, {
|
|
131
140
|
...generateOptions(normalizedOptions, 700)
|
|
132
141
|
});
|
|
@@ -13,7 +13,9 @@ const getStyleBackgroundByDevice = (background, options)=>{
|
|
|
13
13
|
...getStyleBgColor(background)
|
|
14
14
|
} : {},
|
|
15
15
|
...!options?.ignoreBackgroundImage ? {
|
|
16
|
-
...getStyleBgImage(background, options)
|
|
16
|
+
...getStyleBgImage(background, options)
|
|
17
|
+
} : {},
|
|
18
|
+
...!options?.ignoreBackgroundImageProperties ? {
|
|
17
19
|
...getStyleBgPosition(background),
|
|
18
20
|
...getStyleBgSize(background),
|
|
19
21
|
...getStyleBgRepeat(background)
|
|
@@ -74,6 +76,9 @@ const getBgImageByDevice = (background, device, options)=>{
|
|
|
74
76
|
if (typeof imageByDevice === 'string') {
|
|
75
77
|
return `url(${imageByDevice})`;
|
|
76
78
|
}
|
|
79
|
+
if (imageByDevice !== undefined) {
|
|
80
|
+
return 'none';
|
|
81
|
+
}
|
|
77
82
|
};
|
|
78
83
|
const getStyleBgPosition = (background)=>{
|
|
79
84
|
const bgPosition = {
|
|
@@ -205,7 +210,7 @@ const getGradientBgrStyleForButton = (backgroundStyle)=>{
|
|
|
205
210
|
});
|
|
206
211
|
return bgrStyle;
|
|
207
212
|
};
|
|
208
|
-
const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage
|
|
213
|
+
const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage)=>{
|
|
209
214
|
if (!backgroundStyle) return;
|
|
210
215
|
const bgrStyle = {};
|
|
211
216
|
[
|
|
@@ -213,10 +218,10 @@ const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage = fa
|
|
|
213
218
|
'tablet',
|
|
214
219
|
'mobile'
|
|
215
220
|
].forEach((device)=>{
|
|
216
|
-
if (backgroundStyle[device]?.color?.includes(GRADIENT_BGR_KEY)) {
|
|
221
|
+
if (backgroundStyle[device]?.color?.includes(GRADIENT_BGR_KEY) && backgroundStyle[device]?.type !== 'video') {
|
|
217
222
|
Object.assign(bgrStyle, {
|
|
218
|
-
[`--bgc${device !== 'desktop' ? '-' + device : ''}`]:
|
|
219
|
-
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]: ignoreBackgroundImage ? `${backgroundStyle[device]?.color}` : `${getBgImageByDevice(backgroundStyle, device) || 'url()'}, ${backgroundStyle[device]?.color}`
|
|
223
|
+
[`--bgc${device !== 'desktop' ? '-' + device : ''}`]: backgroundStyle[device]?.color,
|
|
224
|
+
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]: !ignoreBackgroundImage?.[device] ? `${backgroundStyle[device]?.color}` : `${getBgImageByDevice(backgroundStyle, device) || 'url()'}, ${backgroundStyle[device]?.color}`
|
|
220
225
|
});
|
|
221
226
|
}
|
|
222
227
|
});
|
|
@@ -102,7 +102,12 @@ function composeAdvanceStyle(data, tag, pageType) {
|
|
|
102
102
|
Object.assign(styles, radius.composeRadius(value));
|
|
103
103
|
}
|
|
104
104
|
if (attr === 'boxShadow') {
|
|
105
|
-
|
|
105
|
+
const hasBoxShadow = {
|
|
106
|
+
desktop: value.desktop ?? false,
|
|
107
|
+
tablet: value.tablet ?? value.desktop ?? false,
|
|
108
|
+
mobile: value.mobile ?? value.tablet ?? value.desktop ?? false
|
|
109
|
+
};
|
|
110
|
+
Object.assign(styles, shadow.getResponsiveStyleShadow(value, 'box-shadow', hasBoxShadow));
|
|
106
111
|
}
|
|
107
112
|
if (composeAttr === 'desktop') {
|
|
108
113
|
switch(attr){
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var react = require('react');
|
|
3
4
|
require('react/jsx-runtime');
|
|
4
5
|
require('zustand');
|
|
5
|
-
require('react');
|
|
6
6
|
require('swr');
|
|
7
7
|
var PageContext = require('../../contexts/PageContext.js');
|
|
8
8
|
require('@gem-sdk/adapter-shopify');
|
|
@@ -17,9 +17,17 @@ require('dayjs');
|
|
|
17
17
|
require('../convert.js');
|
|
18
18
|
|
|
19
19
|
const useInteraction = ()=>{
|
|
20
|
+
const ref = react.useRef();
|
|
20
21
|
const setInteractionIsSelectOnPage = PageContext.usePageStore((s)=>s.setInteractionIsSelectOnPage);
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
function findElementIncludingSelf(element, selector) {
|
|
23
|
+
if (!(element instanceof Document) && element?.matches(selector)) {
|
|
24
|
+
return element;
|
|
25
|
+
} else {
|
|
26
|
+
return element?.querySelector(selector);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const onListener = ({ event, selector, elementRef }, callback)=>{
|
|
30
|
+
const element = findElementIncludingSelf(elementRef?.current || ref.current || document, selector);
|
|
23
31
|
if (!element) return;
|
|
24
32
|
element.addEventListener(event, (e)=>{
|
|
25
33
|
const event = e;
|
|
@@ -27,8 +35,8 @@ const useInteraction = ()=>{
|
|
|
27
35
|
if (callback) callback(params);
|
|
28
36
|
});
|
|
29
37
|
};
|
|
30
|
-
const trigger = ({ event, data, selector })=>{
|
|
31
|
-
const element = document.querySelector(selector);
|
|
38
|
+
const trigger = ({ event, data, selector, element: elementParam })=>{
|
|
39
|
+
const element = elementParam || document.querySelector(selector);
|
|
32
40
|
if (!element) return;
|
|
33
41
|
const eventDispatch = new CustomEvent(event, {
|
|
34
42
|
bubbles: false,
|
|
@@ -47,6 +55,14 @@ const useInteraction = ()=>{
|
|
|
47
55
|
[key]: value
|
|
48
56
|
}));
|
|
49
57
|
};
|
|
58
|
+
const getInteractionPreviousData = (element, key)=>{
|
|
59
|
+
const interactionData = element.getAttribute('gp-data-interaction');
|
|
60
|
+
const interactionDataJson = JSON.parse(interactionData || '{}');
|
|
61
|
+
return {
|
|
62
|
+
previousData: interactionDataJson[key],
|
|
63
|
+
interactionDataJson
|
|
64
|
+
};
|
|
65
|
+
};
|
|
50
66
|
const closeSelectOnPage = ()=>{
|
|
51
67
|
setInteractionIsSelectOnPage(false);
|
|
52
68
|
const event = new CustomEvent('editor:interaction:change-select-on-page', {
|
|
@@ -55,11 +71,34 @@ const useInteraction = ()=>{
|
|
|
55
71
|
});
|
|
56
72
|
window.dispatchEvent(event);
|
|
57
73
|
};
|
|
74
|
+
const changeSelectMode = (mode)=>{
|
|
75
|
+
const event = new CustomEvent('editor:interaction:change-select-mode', {
|
|
76
|
+
bubbles: true,
|
|
77
|
+
detail: mode
|
|
78
|
+
});
|
|
79
|
+
window.dispatchEvent(event);
|
|
80
|
+
};
|
|
81
|
+
const selectInteractionElement = ({ componentUid, settingType, $target })=>{
|
|
82
|
+
const event = new CustomEvent('editor:interaction:select-element', {
|
|
83
|
+
bubbles: true,
|
|
84
|
+
detail: {
|
|
85
|
+
componentUid,
|
|
86
|
+
settingType,
|
|
87
|
+
$target
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
window.dispatchEvent(event);
|
|
91
|
+
};
|
|
58
92
|
return {
|
|
59
93
|
onListener,
|
|
60
94
|
trigger,
|
|
61
95
|
saveToElementInteractionData,
|
|
62
|
-
closeSelectOnPage
|
|
96
|
+
closeSelectOnPage,
|
|
97
|
+
ref,
|
|
98
|
+
findElementIncludingSelf,
|
|
99
|
+
getInteractionPreviousData,
|
|
100
|
+
changeSelectMode,
|
|
101
|
+
selectInteractionElement
|
|
63
102
|
};
|
|
64
103
|
};
|
|
65
104
|
|
|
@@ -27,7 +27,14 @@ const getRadiusCSSFromGlobal = (state, key, device)=>{
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
const getCustomRadius = (state, radius, device)=>{
|
|
30
|
-
|
|
30
|
+
const list = [
|
|
31
|
+
'custom',
|
|
32
|
+
'pill',
|
|
33
|
+
'rounded',
|
|
34
|
+
'single',
|
|
35
|
+
'none'
|
|
36
|
+
];
|
|
37
|
+
if (!radius || !state || !list.includes(radius?.radiusType ?? '')) return {};
|
|
31
38
|
const suffix = device && device !== 'desktop' ? constant.devicesMapping?.[device] : '';
|
|
32
39
|
const mState = constant.stateMapping?.[state];
|
|
33
40
|
return {
|
|
@@ -62,6 +69,7 @@ const composeRadiusState = (radiusValue, device)=>{
|
|
|
62
69
|
case 'circle':
|
|
63
70
|
case 'none':
|
|
64
71
|
case 'custom':
|
|
72
|
+
case 'rounded':
|
|
65
73
|
Object.assign(style, getCustomRadius('normal', radiusValue.normal, device));
|
|
66
74
|
break;
|
|
67
75
|
}
|
|
@@ -74,6 +82,7 @@ const composeRadiusState = (radiusValue, device)=>{
|
|
|
74
82
|
case 'circle':
|
|
75
83
|
case 'none':
|
|
76
84
|
case 'custom':
|
|
85
|
+
case 'rounded':
|
|
77
86
|
Object.assign(style, getCustomRadius('hover', radiusValue.hover, device));
|
|
78
87
|
break;
|
|
79
88
|
}
|
|
@@ -86,6 +95,7 @@ const composeRadiusState = (radiusValue, device)=>{
|
|
|
86
95
|
case 'circle':
|
|
87
96
|
case 'none':
|
|
88
97
|
case 'custom':
|
|
98
|
+
case 'rounded':
|
|
89
99
|
Object.assign(style, getCustomRadius('focus', radiusValue.focus, device));
|
|
90
100
|
break;
|
|
91
101
|
}
|
|
@@ -26,8 +26,9 @@ const getStyleShadow = (shadowStyle, isActiveState = false)=>{
|
|
|
26
26
|
if (!styleAppliedFor || !value) return {};
|
|
27
27
|
if (typeof value.distance == 'undefined') return {};
|
|
28
28
|
const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
|
|
29
|
+
const isNoneValue = value.type === 'none';
|
|
29
30
|
return {
|
|
30
|
-
[`-${!isActiveState ? constant.stateMapping?.[state] || '' : ''}-${getShortname.getShortName(styleAppliedFor)}${shadowStyle.screen ? `-${shadowStyle.screen}` : ''}`]: isEnableShadow ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${colors.getSingleColorVariable(value?.color)}` : 'none'
|
|
31
|
+
[`-${!isActiveState ? constant.stateMapping?.[state] || '' : ''}-${getShortname.getShortName(styleAppliedFor)}${shadowStyle.screen ? `-${shadowStyle.screen}` : ''}`]: isEnableShadow && !isNoneValue ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${colors.getSingleColorVariable(value?.color)}` : 'none'
|
|
31
32
|
};
|
|
32
33
|
};
|
|
33
34
|
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow, screen)=>{
|
|
@@ -44,7 +45,7 @@ const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow, screen)=>{
|
|
|
44
45
|
}
|
|
45
46
|
return style;
|
|
46
47
|
};
|
|
47
|
-
const
|
|
48
|
+
const getResponsiveStyleShadow = (value, styleAppliedFor, isEnableShadow)=>{
|
|
48
49
|
if (!value) return undefined;
|
|
49
50
|
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
50
51
|
return {
|
|
@@ -63,7 +64,7 @@ const composeShadowCss = ({ hasBoxShadow, boxShadowValue, important })=>{
|
|
|
63
64
|
};
|
|
64
65
|
|
|
65
66
|
exports.composeShadowCss = composeShadowCss;
|
|
66
|
-
exports.
|
|
67
|
+
exports.getResponsiveStyleShadow = getResponsiveStyleShadow;
|
|
67
68
|
exports.getStyleShadow = getStyleShadow;
|
|
68
69
|
exports.getStyleShadowState = getStyleShadowState;
|
|
69
70
|
exports.parseValueWithUnit = parseValueWithUnit;
|