@gem-sdk/core 1.53.0-dev.18 → 1.53.0-dev.186
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 +19 -4
- 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 +15 -1
- package/dist/cjs/helpers/interaction/index.js +45 -6
- package/dist/cjs/helpers/radius.js +11 -1
- package/dist/cjs/helpers/shadow.js +5 -4
- package/dist/cjs/helpers/third-party/appConfig.js +49 -0
- package/dist/cjs/helpers/third-party/appSetting.js +150 -35
- 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 +3 -2
- 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 +19 -4
- 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 +16 -2
- package/dist/esm/helpers/interaction/index.js +45 -6
- package/dist/esm/helpers/radius.js +11 -1
- package/dist/esm/helpers/shadow.js +5 -4
- package/dist/esm/helpers/third-party/appConfig.js +43 -1
- package/dist/esm/helpers/third-party/appSetting.js +150 -35
- 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 +3 -2
- package/dist/esm/hooks/animation/useApplyAnimation.js +5 -5
- package/dist/esm/index.js +3 -1
- package/dist/types/index.d.ts +371 -192
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx, Fragment
|
|
2
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
2
|
import 'zustand';
|
|
3
|
+
import 'react';
|
|
4
4
|
import 'swr';
|
|
5
5
|
import { usePageStore } from '../contexts/PageContext.js';
|
|
6
6
|
import '@gem-sdk/adapter-shopify';
|
|
@@ -15,98 +15,25 @@ import 'dayjs';
|
|
|
15
15
|
import { useInteraction } from '../helpers/interaction/index.js';
|
|
16
16
|
import '../helpers/convert.js';
|
|
17
17
|
|
|
18
|
-
const InteractionSuffix = ({
|
|
19
|
-
const { closeSelectOnPage } = useInteraction();
|
|
20
|
-
const
|
|
18
|
+
const InteractionSuffix = ({ uid })=>{
|
|
19
|
+
const { closeSelectOnPage, selectInteractionElement } = useInteraction();
|
|
20
|
+
const settingType = usePageStore((s)=>s.interactionData?.settingType || '');
|
|
21
21
|
const isSelectOnPage = usePageStore((s)=>s.interactionData?.isSelectOnPage);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
isCurrentInteractionTarget,
|
|
38
|
-
isCurrentInteractionTrigger
|
|
39
|
-
]);
|
|
40
|
-
const positionOffset = useMemo(()=>{
|
|
41
|
-
if (isCurrentInteractionTrigger && isCurrentInteractionTarget) {
|
|
42
|
-
return 80;
|
|
43
|
-
}
|
|
44
|
-
return 40;
|
|
45
|
-
}, [
|
|
46
|
-
isCurrentInteractionTrigger,
|
|
47
|
-
isCurrentInteractionTarget
|
|
48
|
-
]);
|
|
49
|
-
if (!isDisplay) {
|
|
50
|
-
return /*#__PURE__*/ jsx(Fragment, {});
|
|
51
|
-
}
|
|
52
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
53
|
-
children: [
|
|
54
|
-
isSelectOnPage && /*#__PURE__*/ jsx("button", {
|
|
55
|
-
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",
|
|
56
|
-
onClick: closeSelectOnPage,
|
|
57
|
-
children: "Use element"
|
|
58
|
-
}),
|
|
59
|
-
/*#__PURE__*/ jsx("div", {
|
|
60
|
-
className: "hidden gp-left-[-40px] gp-left-[-80px] gp-right-[-40px] gp-right-[-80px]"
|
|
61
|
-
}),
|
|
62
|
-
/*#__PURE__*/ jsxs("div", {
|
|
63
|
-
className: `gp-hidden gp-absolute interaction-suffix gp-gap-[8px] ${tag == 'Section' ? `gp-left-[-${positionOffset}px]` : `gp-right-[-${positionOffset}px]`}`,
|
|
64
|
-
children: [
|
|
65
|
-
isCurrentInteractionTrigger && /*#__PURE__*/ jsx("div", {
|
|
66
|
-
className: `gp-h-8 gp-rounded-[8px] gp-w-8 gp-bg-[#212121] gp-flex gp-justify-center gp-items-center `,
|
|
67
|
-
children: /*#__PURE__*/ jsx("svg", {
|
|
68
|
-
width: "16",
|
|
69
|
-
height: "16",
|
|
70
|
-
viewBox: "0 0 16 16",
|
|
71
|
-
fill: "none",
|
|
72
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
73
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
74
|
-
fillRule: "evenodd",
|
|
75
|
-
clipRule: "evenodd",
|
|
76
|
-
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",
|
|
77
|
-
fill: "#F9F9F9"
|
|
78
|
-
})
|
|
79
|
-
})
|
|
80
|
-
}),
|
|
81
|
-
isCurrentInteractionTarget && /*#__PURE__*/ jsx("div", {
|
|
82
|
-
className: `gp-h-8 min-w-8 gp-rounded-[8px] gp-w-8 gp-bg-[#212121] gp-flex gp-justify-center gp-items-center`,
|
|
83
|
-
children: /*#__PURE__*/ jsxs("svg", {
|
|
84
|
-
width: "16",
|
|
85
|
-
height: "16",
|
|
86
|
-
viewBox: "0 0 16 16",
|
|
87
|
-
fill: "none",
|
|
88
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
89
|
-
children: [
|
|
90
|
-
/*#__PURE__*/ jsx("path", {
|
|
91
|
-
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",
|
|
92
|
-
fill: "#F9F9F9"
|
|
93
|
-
}),
|
|
94
|
-
/*#__PURE__*/ jsx("path", {
|
|
95
|
-
fillRule: "evenodd",
|
|
96
|
-
clipRule: "evenodd",
|
|
97
|
-
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",
|
|
98
|
-
fill: "#F9F9F9"
|
|
99
|
-
}),
|
|
100
|
-
/*#__PURE__*/ jsx("path", {
|
|
101
|
-
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",
|
|
102
|
-
fill: "#F9F9F9"
|
|
103
|
-
})
|
|
104
|
-
]
|
|
105
|
-
})
|
|
106
|
-
})
|
|
107
|
-
]
|
|
108
|
-
})
|
|
109
|
-
]
|
|
22
|
+
const onClick = (e)=>{
|
|
23
|
+
selectInteractionElement({
|
|
24
|
+
$target: e.target,
|
|
25
|
+
componentUid: uid,
|
|
26
|
+
settingType
|
|
27
|
+
});
|
|
28
|
+
closeSelectOnPage();
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
31
|
+
children: isSelectOnPage && /*#__PURE__*/ jsx("button", {
|
|
32
|
+
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 ",
|
|
33
|
+
onClick: onClick,
|
|
34
|
+
"data-setup-interaction": true,
|
|
35
|
+
children: settingType === 'TRIGGER' ? 'Set as trigger' : 'Set as target'
|
|
36
|
+
})
|
|
110
37
|
});
|
|
111
38
|
};
|
|
112
39
|
|
|
@@ -31,7 +31,7 @@ const componentIconList = [
|
|
|
31
31
|
const componentUsingAdvanced = [
|
|
32
32
|
'IconList'
|
|
33
33
|
];
|
|
34
|
-
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, ...passProps })=>{
|
|
34
|
+
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, largeComponent = [], sizeLargeComponent = 50, ...passProps })=>{
|
|
35
35
|
const item = builder[uid];
|
|
36
36
|
const Component = components[item?.tag];
|
|
37
37
|
if (!Component) {
|
|
@@ -70,6 +70,8 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
70
70
|
advanced: item.advanced,
|
|
71
71
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
72
72
|
pageContext,
|
|
73
|
+
largeComponent,
|
|
74
|
+
sizeLargeComponent,
|
|
73
75
|
...passProps,
|
|
74
76
|
builderAttrs: {
|
|
75
77
|
...passProps.builderAttrs
|
|
@@ -81,7 +83,9 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
81
83
|
builder,
|
|
82
84
|
components,
|
|
83
85
|
customProps,
|
|
84
|
-
pageContext
|
|
86
|
+
pageContext,
|
|
87
|
+
largeComponent,
|
|
88
|
+
sizeLargeComponent
|
|
85
89
|
};
|
|
86
90
|
}),
|
|
87
91
|
children: !customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
@@ -93,11 +97,13 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
93
97
|
components,
|
|
94
98
|
customProps,
|
|
95
99
|
parentTag: item.tag,
|
|
96
|
-
pageContext
|
|
100
|
+
pageContext,
|
|
101
|
+
largeComponent,
|
|
102
|
+
sizeLargeComponent
|
|
97
103
|
}))) : ''
|
|
98
104
|
});
|
|
99
105
|
}, ()=>{
|
|
100
|
-
|
|
106
|
+
const liquid = Component({
|
|
101
107
|
builderProps: {
|
|
102
108
|
uid,
|
|
103
109
|
builderData: item
|
|
@@ -109,11 +115,20 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
109
115
|
isText: componentTexts.includes(item.tag) ? true : null,
|
|
110
116
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
111
117
|
pageContext,
|
|
118
|
+
largeComponent,
|
|
119
|
+
sizeLargeComponent,
|
|
112
120
|
...passProps,
|
|
113
121
|
builderAttrs: {
|
|
114
122
|
...passProps.builderAttrs
|
|
115
123
|
}
|
|
116
124
|
});
|
|
125
|
+
if (isLimitSize(liquid, sizeLargeComponent)) {
|
|
126
|
+
largeComponent.push({
|
|
127
|
+
uid: item.uid,
|
|
128
|
+
tag: item.tag
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return liquid;
|
|
117
132
|
});
|
|
118
133
|
} else {
|
|
119
134
|
liquid = template`<div gp-el-wrapper style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
@@ -130,6 +145,8 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
130
145
|
cssClass: item?.advanced?.cssClass
|
|
131
146
|
},
|
|
132
147
|
pageContext,
|
|
148
|
+
largeComponent,
|
|
149
|
+
sizeLargeComponent,
|
|
133
150
|
...passProps,
|
|
134
151
|
builderAttrs: {
|
|
135
152
|
...passProps.builderAttrs
|
|
@@ -141,7 +158,9 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
141
158
|
builder,
|
|
142
159
|
components,
|
|
143
160
|
customProps,
|
|
144
|
-
pageContext
|
|
161
|
+
pageContext,
|
|
162
|
+
largeComponent,
|
|
163
|
+
sizeLargeComponent
|
|
145
164
|
};
|
|
146
165
|
}),
|
|
147
166
|
children: !customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
@@ -153,11 +172,13 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
153
172
|
components,
|
|
154
173
|
customProps,
|
|
155
174
|
parentTag: item.tag,
|
|
156
|
-
pageContext
|
|
175
|
+
pageContext,
|
|
176
|
+
largeComponent,
|
|
177
|
+
sizeLargeComponent
|
|
157
178
|
}))) : ''
|
|
158
179
|
});
|
|
159
180
|
}, ()=>{
|
|
160
|
-
|
|
181
|
+
const liquid = Component({
|
|
161
182
|
builderProps: {
|
|
162
183
|
uid,
|
|
163
184
|
builderData: item
|
|
@@ -175,6 +196,13 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
175
196
|
...passProps.builderAttrs
|
|
176
197
|
}
|
|
177
198
|
});
|
|
199
|
+
if (isLimitSize(liquid, sizeLargeComponent)) {
|
|
200
|
+
largeComponent.push({
|
|
201
|
+
uid: item.uid,
|
|
202
|
+
tag: item.tag
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return liquid;
|
|
178
206
|
})}
|
|
179
207
|
</div>`;
|
|
180
208
|
}
|
|
@@ -299,5 +327,10 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
|
299
327
|
}
|
|
300
328
|
return liquid;
|
|
301
329
|
};
|
|
330
|
+
const isLimitSize = (liquid, size = 50)=>{
|
|
331
|
+
const textEncoder = new TextEncoder();
|
|
332
|
+
const byteSize = textEncoder.encode(liquid).length;
|
|
333
|
+
return byteSize >= size * 1024;
|
|
334
|
+
};
|
|
302
335
|
|
|
303
336
|
export { RenderChildren, WrapRenderChildren, Render as default };
|
|
@@ -54,22 +54,37 @@ const createPageStoreProvider = (data)=>createStore((set)=>({
|
|
|
54
54
|
selectType
|
|
55
55
|
}
|
|
56
56
|
}));
|
|
57
|
+
},
|
|
58
|
+
setInteractionSettingType: (settingType)=>{
|
|
59
|
+
set((state)=>({
|
|
60
|
+
interactionData: {
|
|
61
|
+
...state.interactionData,
|
|
62
|
+
settingType
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
},
|
|
66
|
+
setNumberOfProduct: (numberOfProduct)=>{
|
|
67
|
+
set({
|
|
68
|
+
numberOfProduct
|
|
69
|
+
});
|
|
57
70
|
}
|
|
58
71
|
}));
|
|
59
|
-
const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
|
|
72
|
+
const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, numberOfProduct, ...passProps })=>{
|
|
60
73
|
const store = useMemo(()=>createPageStoreProvider({
|
|
61
74
|
dynamicProduct,
|
|
62
75
|
dynamicCollection,
|
|
63
76
|
productOffers,
|
|
64
77
|
publicStoreFrontData,
|
|
65
78
|
interactionData: {
|
|
66
|
-
selectType: '
|
|
67
|
-
}
|
|
79
|
+
selectType: 'ELEMENT'
|
|
80
|
+
},
|
|
81
|
+
numberOfProduct
|
|
68
82
|
}), [
|
|
69
83
|
dynamicProduct,
|
|
70
84
|
dynamicCollection,
|
|
71
85
|
productOffers,
|
|
72
|
-
publicStoreFrontData
|
|
86
|
+
publicStoreFrontData,
|
|
87
|
+
numberOfProduct
|
|
73
88
|
]);
|
|
74
89
|
return /*#__PURE__*/ jsx(PageContext.Provider, {
|
|
75
90
|
...passProps,
|
|
@@ -51,10 +51,16 @@ const animations = ()=>{
|
|
|
51
51
|
'left',
|
|
52
52
|
'right'
|
|
53
53
|
].includes(direction ?? '') ? 'X' : 'Y';
|
|
54
|
-
|
|
54
|
+
let isNeg = [
|
|
55
55
|
'left',
|
|
56
56
|
'down'
|
|
57
57
|
].includes(direction ?? '') ? '-' : '';
|
|
58
|
+
if (reverse) {
|
|
59
|
+
isNeg = [
|
|
60
|
+
'left',
|
|
61
|
+
'down'
|
|
62
|
+
].includes(direction ?? '') ? '' : '-';
|
|
63
|
+
}
|
|
58
64
|
const preset = [
|
|
59
65
|
{
|
|
60
66
|
opacity: 0,
|
|
@@ -124,7 +130,10 @@ const animations = ()=>{
|
|
|
124
130
|
opacity: 1
|
|
125
131
|
}
|
|
126
132
|
];
|
|
127
|
-
|
|
133
|
+
let zoomPreset = zoomDirection === 'in' ? zoomInPreset : zoomOutPreset;
|
|
134
|
+
if (reverse) {
|
|
135
|
+
zoomPreset = zoomDirection === 'in' ? zoomOutPreset : zoomInPreset;
|
|
136
|
+
}
|
|
128
137
|
return generateAnimationInstance(target, reverse ? zoomPreset.reverse() : zoomPreset, {
|
|
129
138
|
...generateOptions(normalizedOptions, 700)
|
|
130
139
|
});
|
|
@@ -11,7 +11,9 @@ const getStyleBackgroundByDevice = (background, options)=>{
|
|
|
11
11
|
...getStyleBgColor(background)
|
|
12
12
|
} : {},
|
|
13
13
|
...!options?.ignoreBackgroundImage ? {
|
|
14
|
-
...getStyleBgImage(background, options)
|
|
14
|
+
...getStyleBgImage(background, options)
|
|
15
|
+
} : {},
|
|
16
|
+
...!options?.ignoreBackgroundImageProperties ? {
|
|
15
17
|
...getStyleBgPosition(background),
|
|
16
18
|
...getStyleBgSize(background),
|
|
17
19
|
...getStyleBgRepeat(background)
|
|
@@ -72,6 +74,9 @@ const getBgImageByDevice = (background, device, options)=>{
|
|
|
72
74
|
if (typeof imageByDevice === 'string') {
|
|
73
75
|
return `url(${imageByDevice})`;
|
|
74
76
|
}
|
|
77
|
+
if (imageByDevice !== undefined) {
|
|
78
|
+
return 'none';
|
|
79
|
+
}
|
|
75
80
|
};
|
|
76
81
|
const getStyleBgPosition = (background)=>{
|
|
77
82
|
const bgPosition = {
|
|
@@ -203,7 +208,7 @@ const getGradientBgrStyleForButton = (backgroundStyle)=>{
|
|
|
203
208
|
});
|
|
204
209
|
return bgrStyle;
|
|
205
210
|
};
|
|
206
|
-
const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage
|
|
211
|
+
const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage)=>{
|
|
207
212
|
if (!backgroundStyle) return;
|
|
208
213
|
const bgrStyle = {};
|
|
209
214
|
[
|
|
@@ -211,10 +216,10 @@ const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage = fa
|
|
|
211
216
|
'tablet',
|
|
212
217
|
'mobile'
|
|
213
218
|
].forEach((device)=>{
|
|
214
|
-
if (backgroundStyle[device]?.color?.includes(GRADIENT_BGR_KEY)) {
|
|
219
|
+
if (backgroundStyle[device]?.color?.includes(GRADIENT_BGR_KEY) && backgroundStyle[device]?.type !== 'video') {
|
|
215
220
|
Object.assign(bgrStyle, {
|
|
216
|
-
[`--bgc${device !== 'desktop' ? '-' + device : ''}`]:
|
|
217
|
-
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]: ignoreBackgroundImage ? `${backgroundStyle[device]?.color}` : `${getBgImageByDevice(backgroundStyle, device) || 'url()'}, ${backgroundStyle[device]?.color}`
|
|
221
|
+
[`--bgc${device !== 'desktop' ? '-' + device : ''}`]: backgroundStyle[device]?.color,
|
|
222
|
+
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]: !ignoreBackgroundImage?.[device] ? `${backgroundStyle[device]?.color}` : `${getBgImageByDevice(backgroundStyle, device) || 'url()'}, ${backgroundStyle[device]?.color}`
|
|
218
223
|
});
|
|
219
224
|
}
|
|
220
225
|
});
|
|
@@ -3,7 +3,7 @@ import { isColor } from './colors.js';
|
|
|
3
3
|
import { layoutComponent } from './constant.js';
|
|
4
4
|
import { makeStyleKey } from './make-style.js';
|
|
5
5
|
import { composeRadius, getCornerCSSFromGlobal } from './radius.js';
|
|
6
|
-
import {
|
|
6
|
+
import { getResponsiveStyleShadow, getStyleShadowState, getStyleShadow } from './shadow.js';
|
|
7
7
|
|
|
8
8
|
const composeSpacing = ({ source, spacing, type, suffix = '' })=>{
|
|
9
9
|
const { top, left, bottom, right } = spacing;
|
|
@@ -100,7 +100,21 @@ function composeAdvanceStyle(data, tag, pageType) {
|
|
|
100
100
|
Object.assign(styles, composeRadius(value));
|
|
101
101
|
}
|
|
102
102
|
if (attr === 'boxShadow') {
|
|
103
|
-
|
|
103
|
+
const listElementShadowV2 = [
|
|
104
|
+
'Row',
|
|
105
|
+
'Section',
|
|
106
|
+
'Text',
|
|
107
|
+
'Heading'
|
|
108
|
+
];
|
|
109
|
+
let hasBoxShadowV2 = hasBoxShadow;
|
|
110
|
+
if (listElementShadowV2.includes(tag || '')) {
|
|
111
|
+
hasBoxShadowV2 = {
|
|
112
|
+
desktop: value.desktop ?? {},
|
|
113
|
+
tablet: value.tablet ?? value.desktop ?? {},
|
|
114
|
+
mobile: value.mobile ?? value.tablet ?? value.desktop ?? {}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
Object.assign(styles, getResponsiveStyleShadow(value, 'box-shadow', hasBoxShadowV2 ?? hasBoxShadow));
|
|
104
118
|
}
|
|
105
119
|
if (composeAttr === 'desktop') {
|
|
106
120
|
switch(attr){
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
1
2
|
import 'react/jsx-runtime';
|
|
2
3
|
import 'zustand';
|
|
3
|
-
import 'react';
|
|
4
4
|
import 'swr';
|
|
5
5
|
import { usePageStore } from '../../contexts/PageContext.js';
|
|
6
6
|
import '@gem-sdk/adapter-shopify';
|
|
@@ -15,9 +15,17 @@ import 'dayjs';
|
|
|
15
15
|
import '../convert.js';
|
|
16
16
|
|
|
17
17
|
const useInteraction = ()=>{
|
|
18
|
+
const ref = useRef();
|
|
18
19
|
const setInteractionIsSelectOnPage = usePageStore((s)=>s.setInteractionIsSelectOnPage);
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
function findElementIncludingSelf(element, selector) {
|
|
21
|
+
if (!(element instanceof Document) && element?.matches(selector)) {
|
|
22
|
+
return element;
|
|
23
|
+
} else {
|
|
24
|
+
return element?.querySelector(selector);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const onListener = ({ event, selector, elementRef }, callback)=>{
|
|
28
|
+
const element = findElementIncludingSelf(elementRef?.current || ref.current || document, selector);
|
|
21
29
|
if (!element) return;
|
|
22
30
|
element.addEventListener(event, (e)=>{
|
|
23
31
|
const event = e;
|
|
@@ -25,8 +33,8 @@ const useInteraction = ()=>{
|
|
|
25
33
|
if (callback) callback(params);
|
|
26
34
|
});
|
|
27
35
|
};
|
|
28
|
-
const trigger = ({ event, data, selector })=>{
|
|
29
|
-
const element = document.querySelector(selector);
|
|
36
|
+
const trigger = ({ event, data, selector, element: elementParam })=>{
|
|
37
|
+
const element = elementParam || document.querySelector(selector);
|
|
30
38
|
if (!element) return;
|
|
31
39
|
const eventDispatch = new CustomEvent(event, {
|
|
32
40
|
bubbles: false,
|
|
@@ -45,6 +53,14 @@ const useInteraction = ()=>{
|
|
|
45
53
|
[key]: value
|
|
46
54
|
}));
|
|
47
55
|
};
|
|
56
|
+
const getInteractionPreviousData = (element, key)=>{
|
|
57
|
+
const interactionData = element.getAttribute('gp-data-interaction');
|
|
58
|
+
const interactionDataJson = JSON.parse(interactionData || '{}');
|
|
59
|
+
return {
|
|
60
|
+
previousData: interactionDataJson[key],
|
|
61
|
+
interactionDataJson
|
|
62
|
+
};
|
|
63
|
+
};
|
|
48
64
|
const closeSelectOnPage = ()=>{
|
|
49
65
|
setInteractionIsSelectOnPage(false);
|
|
50
66
|
const event = new CustomEvent('editor:interaction:change-select-on-page', {
|
|
@@ -53,11 +69,34 @@ const useInteraction = ()=>{
|
|
|
53
69
|
});
|
|
54
70
|
window.dispatchEvent(event);
|
|
55
71
|
};
|
|
72
|
+
const changeSelectMode = (mode)=>{
|
|
73
|
+
const event = new CustomEvent('editor:interaction:change-select-mode', {
|
|
74
|
+
bubbles: true,
|
|
75
|
+
detail: mode
|
|
76
|
+
});
|
|
77
|
+
window.dispatchEvent(event);
|
|
78
|
+
};
|
|
79
|
+
const selectInteractionElement = ({ componentUid, settingType, $target })=>{
|
|
80
|
+
const event = new CustomEvent('editor:interaction:select-element', {
|
|
81
|
+
bubbles: true,
|
|
82
|
+
detail: {
|
|
83
|
+
componentUid,
|
|
84
|
+
settingType,
|
|
85
|
+
$target
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
window.dispatchEvent(event);
|
|
89
|
+
};
|
|
56
90
|
return {
|
|
57
91
|
onListener,
|
|
58
92
|
trigger,
|
|
59
93
|
saveToElementInteractionData,
|
|
60
|
-
closeSelectOnPage
|
|
94
|
+
closeSelectOnPage,
|
|
95
|
+
ref,
|
|
96
|
+
findElementIncludingSelf,
|
|
97
|
+
getInteractionPreviousData,
|
|
98
|
+
changeSelectMode,
|
|
99
|
+
selectInteractionElement
|
|
61
100
|
};
|
|
62
101
|
};
|
|
63
102
|
|
|
@@ -25,7 +25,14 @@ const getRadiusCSSFromGlobal = (state, key, device)=>{
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
const getCustomRadius = (state, radius, device)=>{
|
|
28
|
-
|
|
28
|
+
const list = [
|
|
29
|
+
'custom',
|
|
30
|
+
'pill',
|
|
31
|
+
'rounded',
|
|
32
|
+
'single',
|
|
33
|
+
'none'
|
|
34
|
+
];
|
|
35
|
+
if (!radius || !state || !list.includes(radius?.radiusType ?? '')) return {};
|
|
29
36
|
const suffix = device && device !== 'desktop' ? devicesMapping?.[device] : '';
|
|
30
37
|
const mState = stateMapping?.[state];
|
|
31
38
|
return {
|
|
@@ -60,6 +67,7 @@ const composeRadiusState = (radiusValue, device)=>{
|
|
|
60
67
|
case 'circle':
|
|
61
68
|
case 'none':
|
|
62
69
|
case 'custom':
|
|
70
|
+
case 'rounded':
|
|
63
71
|
Object.assign(style, getCustomRadius('normal', radiusValue.normal, device));
|
|
64
72
|
break;
|
|
65
73
|
}
|
|
@@ -72,6 +80,7 @@ const composeRadiusState = (radiusValue, device)=>{
|
|
|
72
80
|
case 'circle':
|
|
73
81
|
case 'none':
|
|
74
82
|
case 'custom':
|
|
83
|
+
case 'rounded':
|
|
75
84
|
Object.assign(style, getCustomRadius('hover', radiusValue.hover, device));
|
|
76
85
|
break;
|
|
77
86
|
}
|
|
@@ -84,6 +93,7 @@ const composeRadiusState = (radiusValue, device)=>{
|
|
|
84
93
|
case 'circle':
|
|
85
94
|
case 'none':
|
|
86
95
|
case 'custom':
|
|
96
|
+
case 'rounded':
|
|
87
97
|
Object.assign(style, getCustomRadius('focus', radiusValue.focus, device));
|
|
88
98
|
break;
|
|
89
99
|
}
|
|
@@ -22,10 +22,11 @@ const getStyleShadow = (shadowStyle, isActiveState = false)=>{
|
|
|
22
22
|
let { state } = shadowStyle || {};
|
|
23
23
|
if (!state) state = 'normal';
|
|
24
24
|
if (!styleAppliedFor || !value) return {};
|
|
25
|
-
|
|
25
|
+
const isNoneValue = value.type === 'none';
|
|
26
|
+
if (typeof value.distance == 'undefined' && !isNoneValue) return {};
|
|
26
27
|
const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
|
|
27
28
|
return {
|
|
28
|
-
[`-${!isActiveState ? stateMapping?.[state] || '' : ''}-${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 + ' ' : ''}${getSingleColorVariable(value?.color)}` : 'none'
|
|
29
|
+
[`-${!isActiveState ? stateMapping?.[state] || '' : ''}-${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 + ' ' : ''}${getSingleColorVariable(value?.color)}` : 'none'
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
32
|
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow, screen)=>{
|
|
@@ -42,7 +43,7 @@ const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow, screen)=>{
|
|
|
42
43
|
}
|
|
43
44
|
return style;
|
|
44
45
|
};
|
|
45
|
-
const
|
|
46
|
+
const getResponsiveStyleShadow = (value, styleAppliedFor, isEnableShadow)=>{
|
|
46
47
|
if (!value) return undefined;
|
|
47
48
|
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
48
49
|
return {
|
|
@@ -60,4 +61,4 @@ const composeShadowCss = ({ hasBoxShadow, boxShadowValue, important })=>{
|
|
|
60
61
|
return `box-shadow: ${Math.cos(parseFloat(`${boxShadowValue?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${boxShadowValue?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${boxShadowValue?.blur} ${boxShadowValue?.spread + ' '}${getSingleColorVariable(boxShadowValue?.color)}${sub};`;
|
|
61
62
|
};
|
|
62
63
|
|
|
63
|
-
export { composeShadowCss,
|
|
64
|
+
export { composeShadowCss, getResponsiveStyleShadow, getStyleShadow, getStyleShadowState, parseValueWithUnit };
|
|
@@ -118,5 +118,47 @@ const WhatmoreShoppableVideosreelConfig = {
|
|
|
118
118
|
appId: '20db8a72-315a-4364-8885-64219ee48303'
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
|
+
const ProductOptionsCustomizerConfig = {
|
|
122
|
+
ProductOptionsCustomizer: {
|
|
123
|
+
appName: 'product-options-customizer',
|
|
124
|
+
appId: '6857ca6c-35eb-4b6f-9d58-a039f31d9406'
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const AppointmentBookingCowlendarConfig = {
|
|
128
|
+
AppointmentBookingCowlendar: {
|
|
129
|
+
appName: 'cowlendar-booking',
|
|
130
|
+
appId: '6d8b8f6a-9b3c-42b8-b2e6-a758c38d45bf'
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const SproutPlantTreesGrowSalesConfig = {
|
|
134
|
+
SproutPlantTreesGrowSales: {
|
|
135
|
+
appName: 'sprout-plant-trees',
|
|
136
|
+
appId: '7db5ee24-2195-4099-b98e-1547c600e4aa'
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const InstasellShoppableInstagramConfig = {
|
|
140
|
+
InstasellShoppableInstagram: {
|
|
141
|
+
appName: 'instasell-instagram-gallery',
|
|
142
|
+
appId: '38d643ac-410a-4b2c-a727-6125ff08e444'
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const BoldSubscriptionsConfig = {
|
|
146
|
+
BoldSubscriptions: {
|
|
147
|
+
appName: 'bold-subscriptions',
|
|
148
|
+
appId: '9ceb49f0-5fe5-4b5e-943d-f8af8985167d'
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const GrowaveConfig = {
|
|
152
|
+
Growave: {
|
|
153
|
+
appName: 'growave-loyalty-wishlist',
|
|
154
|
+
appId: 'b3d2efbe-110a-4e27-84a8-1f2ed63996a4'
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const KachingBundlesConfig = {
|
|
158
|
+
KachingBundles: {
|
|
159
|
+
appName: 'kaching-bundles',
|
|
160
|
+
appId: '6c637362-a106-4a32-94ac-94dcfd68cdb8'
|
|
161
|
+
}
|
|
162
|
+
};
|
|
121
163
|
|
|
122
|
-
export { BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig, WhatmoreShoppableVideosreelConfig, YotpoReviewsV3UgcConfig };
|
|
164
|
+
export { AppointmentBookingCowlendarConfig, BoldSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, EasyBundleBuilderSkailamaConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, GrowaveConfig, InstasellShoppableInstagramConfig, JunipProductReviewsUgcConfig, KachingBundlesConfig, KiteFreeGiftDiscountConfig, LoopSubscriptionsConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, ProductOptionsCustomizerConfig, PumperBundlesVolumeDiscountConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SelleasyConfig, ShopifyFormsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SproutPlantTreesGrowSalesConfig, SubifySubscriptionsConfig, UnlimitedBundlesDiscountsConfig, WhatmoreShoppableVideosreelConfig, YotpoReviewsV3UgcConfig };
|