@gem-sdk/core 1.23.0-staging.24 → 1.23.0-staging.244

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.
Files changed (74) hide show
  1. package/dist/cjs/components/ComponentToolbarPreview.js +473 -0
  2. package/dist/cjs/components/ComponentWrapper.js +6 -1
  3. package/dist/cjs/components/ComponentWrapperPreview.js +51 -5
  4. package/dist/cjs/components/Render.liquid.js +62 -4
  5. package/dist/cjs/components/RenderCustomCode.js +2 -0
  6. package/dist/cjs/components/constant.js +7 -2
  7. package/dist/cjs/components/resize/Resize.js +16 -0
  8. package/dist/cjs/components/resize/Spacing.js +222 -0
  9. package/dist/cjs/components/theme-section/CreateThemeSection.js +117 -0
  10. package/dist/cjs/components/theme-section/ThemeSectionStatus.js +36 -0
  11. package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +102 -0
  12. package/dist/cjs/components/toolbar/Tooltip.js +22 -0
  13. package/dist/cjs/contexts/BuilderPreviewContext.js +39 -4
  14. package/dist/cjs/contexts/PageContext.js +44 -0
  15. package/dist/cjs/contexts/ShopContext.js +10 -0
  16. package/dist/cjs/helpers/animations.js +213 -0
  17. package/dist/cjs/helpers/background.js +108 -5
  18. package/dist/cjs/helpers/compose-advance-style.js +17 -7
  19. package/dist/cjs/helpers/filter-toolbar-preview.js +14 -0
  20. package/dist/cjs/helpers/icon-list.js +61 -0
  21. package/dist/cjs/helpers/is-empty-children.js +4 -1
  22. package/dist/cjs/helpers/make-style.js +9 -1
  23. package/dist/cjs/helpers/product.js +4 -1
  24. package/dist/cjs/helpers/queries/get-collection.js +7 -1
  25. package/dist/cjs/helpers/size.js +148 -0
  26. package/dist/cjs/helpers/typography.js +10 -9
  27. package/dist/cjs/hooks/animation/useAnimationActions.js +39 -0
  28. package/dist/cjs/hooks/animation/useAnimationConfig.js +29 -0
  29. package/dist/cjs/hooks/animation/useAnimationPreview.js +31 -0
  30. package/dist/cjs/hooks/animation/useAnimationTarget.js +120 -0
  31. package/dist/cjs/hooks/animation/useApplyAnimation.js +87 -0
  32. package/dist/cjs/hooks/useAnimations.js +26 -0
  33. package/dist/cjs/hooks/useProduct.js +22 -4
  34. package/dist/cjs/index.js +50 -0
  35. package/dist/cjs/types/animations.js +47 -0
  36. package/dist/cjs/web-components/src/helpers/styles/constant.js +9 -0
  37. package/dist/esm/components/ComponentToolbarPreview.js +471 -0
  38. package/dist/esm/components/ComponentWrapper.js +6 -1
  39. package/dist/esm/components/ComponentWrapperPreview.js +53 -7
  40. package/dist/esm/components/Render.liquid.js +62 -4
  41. package/dist/esm/components/RenderCustomCode.js +2 -0
  42. package/dist/esm/components/constant.js +7 -3
  43. package/dist/esm/components/resize/Resize.js +12 -0
  44. package/dist/esm/components/resize/Spacing.js +218 -0
  45. package/dist/esm/components/theme-section/CreateThemeSection.js +115 -0
  46. package/dist/esm/components/theme-section/ThemeSectionStatus.js +34 -0
  47. package/dist/esm/components/theme-section/ThemeSectionTooltip.js +100 -0
  48. package/dist/esm/components/toolbar/Tooltip.js +18 -0
  49. package/dist/esm/contexts/BuilderPreviewContext.js +39 -4
  50. package/dist/esm/contexts/PageContext.js +41 -0
  51. package/dist/esm/contexts/ShopContext.js +10 -0
  52. package/dist/esm/helpers/animations.js +211 -0
  53. package/dist/esm/helpers/background.js +104 -6
  54. package/dist/esm/helpers/compose-advance-style.js +17 -7
  55. package/dist/esm/helpers/filter-toolbar-preview.js +9 -0
  56. package/dist/esm/helpers/icon-list.js +58 -0
  57. package/dist/esm/helpers/is-empty-children.js +4 -1
  58. package/dist/esm/helpers/make-style.js +9 -2
  59. package/dist/esm/helpers/product.js +4 -1
  60. package/dist/esm/helpers/queries/get-collection.js +7 -1
  61. package/dist/esm/helpers/size.js +141 -1
  62. package/dist/esm/helpers/typography.js +10 -9
  63. package/dist/esm/hooks/animation/useAnimationActions.js +37 -0
  64. package/dist/esm/hooks/animation/useAnimationConfig.js +27 -0
  65. package/dist/esm/hooks/animation/useAnimationPreview.js +29 -0
  66. package/dist/esm/hooks/animation/useAnimationTarget.js +118 -0
  67. package/dist/esm/hooks/animation/useApplyAnimation.js +83 -0
  68. package/dist/esm/hooks/useAnimations.js +24 -0
  69. package/dist/esm/hooks/useProduct.js +22 -4
  70. package/dist/esm/index.js +8 -3
  71. package/dist/esm/types/animations.js +47 -0
  72. package/dist/esm/web-components/src/helpers/styles/constant.js +7 -0
  73. package/dist/types/index.d.ts +349 -38
  74. package/package.json +3 -3
@@ -0,0 +1,473 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ require('zustand');
6
+ var BuilderPreviewContext = require('../contexts/BuilderPreviewContext.js');
7
+ var ShopContext = require('../contexts/ShopContext.js');
8
+ require('@gem-sdk/adapter-shopify');
9
+ require('swr');
10
+ require('swr/mutation');
11
+ require('vanilla-lazyload');
12
+ require('../hooks/useCartUI.js');
13
+ var CreateThemeSection = require('./theme-section/CreateThemeSection.js');
14
+ var Tooltip = require('./toolbar/Tooltip.js');
15
+ var ThemeSectionStatus = require('./theme-section/ThemeSectionStatus.js');
16
+ var Resize = require('./resize/Resize.js');
17
+ require('../helpers/convert.js');
18
+
19
+ const SECTION_LIMIT = 25;
20
+ const notVisible = (el)=>{
21
+ const overflow = getComputedStyle(el).overflow;
22
+ return overflow !== 'visible';
23
+ };
24
+ const isSection = (el)=>{
25
+ const tag = el.getAttribute('data-component-tag');
26
+ return tag === 'Section';
27
+ };
28
+ const ComponentToolbarPreview = ({ ...props })=>{
29
+ const isThemeSection = props.isThemeSection;
30
+ const editingPageType = ShopContext.useShopStore((s)=>s.pageType);
31
+ const getParents = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.getParents);
32
+ const root = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.getItem('ROOT'));
33
+ const isThemeSectionEditor = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
34
+ const [activeAddSection, setActiveAddSection] = react.useState(null);
35
+ const [isShowParent, setIsShowParent] = react.useState(false);
36
+ const [isShowParentRevert, setIsShowParentRevert] = react.useState(false);
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
+ };
57
+ // Get parents
58
+ const onActiveComponent = react.useCallback((e)=>{
59
+ const detail = e.detail;
60
+ if (detail?.componentUid == props.uid) {
61
+ const currentParents = getParents(props.uid).filter((parent)=>{
62
+ if (parent.uid === 'ROOT') return false;
63
+ if (parent.tag === 'Section' && isThemeSectionEditor) return false;
64
+ if (parent.editorConfigs?.toolbar?.hide) return false;
65
+ if (parent.editorConfigs?.component?.noSetting) return false;
66
+ return true;
67
+ }).slice(0, 3);
68
+ setParents(currentParents);
69
+ } else {
70
+ setParents([]);
71
+ setIsShowParent(false);
72
+ }
73
+ }, [
74
+ setParents,
75
+ getParents,
76
+ props.uid,
77
+ isThemeSectionEditor
78
+ ]);
79
+ react.useEffect(()=>{
80
+ window.addEventListener('editor:active-component', onActiveComponent);
81
+ return ()=>{
82
+ window.removeEventListener('editor:active-component', onActiveComponent);
83
+ };
84
+ }, [
85
+ onActiveComponent
86
+ ]);
87
+ // End get parents
88
+ if (props.type === 'section') {
89
+ return null;
90
+ }
91
+ if (props.editorConfigs?.toolbar?.hide) {
92
+ return null;
93
+ }
94
+ const getSectionNumber = ()=>{
95
+ return root?.childrens?.length || 0;
96
+ };
97
+ const getIndexSection = ()=>{
98
+ if (props.tag !== 'Section') {
99
+ return -1;
100
+ }
101
+ if (root?.childrens?.length) {
102
+ return root.childrens.findIndex((sectionUid)=>sectionUid == props.uid);
103
+ }
104
+ return -1;
105
+ };
106
+ const onShowParent = (e)=>{
107
+ if (!parents.length) return;
108
+ const $target = (e?.target) || null;
109
+ const $toolbar = $target.closest('[data-toolbar-active]');
110
+ if (!$target || !$toolbar) return;
111
+ if (isShowParent) {
112
+ setIsShowParentRevert(false);
113
+ setIsShowParent(false);
114
+ } else {
115
+ const $parentOverflow = findOverflowParent($toolbar, $toolbar);
116
+ if ($parentOverflow) {
117
+ setIsShowParentRevert(true);
118
+ } else {
119
+ const rect = $toolbar.getBoundingClientRect();
120
+ if (rect.top < parents.length * 36) {
121
+ setIsShowParentRevert(true);
122
+ } else {
123
+ setIsShowParentRevert(false);
124
+ }
125
+ }
126
+ setIsShowParent(true);
127
+ }
128
+ const event = new CustomEvent('editor:toolbar:show-parents', {
129
+ bubbles: true,
130
+ detail: {
131
+ value: !isShowParent
132
+ }
133
+ });
134
+ window.dispatchEvent(event);
135
+ };
136
+ const onDelete = (e)=>{
137
+ e.preventDefault();
138
+ e.stopPropagation();
139
+ const event = new CustomEvent('editor:toolbar:delete-component', {
140
+ bubbles: true,
141
+ detail: {
142
+ componentUid: props.uid,
143
+ isThemeSection: isThemeSection
144
+ }
145
+ });
146
+ window.dispatchEvent(event);
147
+ return false;
148
+ };
149
+ const onDuplicate = (e)=>{
150
+ e.preventDefault();
151
+ e.stopPropagation();
152
+ if (getSectionNumber() >= SECTION_LIMIT && props.tag == 'Section') {
153
+ return false;
154
+ }
155
+ const event = new CustomEvent('editor:toolbar:duplicate-component', {
156
+ bubbles: true,
157
+ detail: {
158
+ componentUid: props.uid,
159
+ isThemeSection: isThemeSection
160
+ }
161
+ });
162
+ window.dispatchEvent(event);
163
+ return false;
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
+ };
176
+ const onZoomOut = (e)=>{
177
+ e.preventDefault();
178
+ e.stopPropagation();
179
+ const event = new CustomEvent('editor:toolbar:zoom-out-component', {
180
+ bubbles: true,
181
+ detail: {
182
+ componentUid: props.uid
183
+ }
184
+ });
185
+ window.dispatchEvent(event);
186
+ return false;
187
+ };
188
+ const closeAddSection = ()=>{
189
+ setActiveAddSection(null);
190
+ window.removeEventListener('editor:close-add-section-popup', closeAddSection);
191
+ };
192
+ const onAddSection = (e, position)=>{
193
+ e.preventDefault();
194
+ e.stopPropagation();
195
+ if (getSectionNumber() >= SECTION_LIMIT) {
196
+ return false;
197
+ }
198
+ const $target = e.target;
199
+ if ($target) {
200
+ setActiveAddSection(position);
201
+ const rect = $target.getBoundingClientRect();
202
+ const event = new CustomEvent('editor:toolbar:add-section', {
203
+ bubbles: true,
204
+ detail: {
205
+ componentUid: props.uid,
206
+ position,
207
+ top: rect.top + rect.height / 2
208
+ }
209
+ });
210
+ window.dispatchEvent(event);
211
+ window.addEventListener('editor:close-add-section-popup', closeAddSection);
212
+ }
213
+ return false;
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
+ };
222
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
223
+ children: [
224
+ !(props.tag == 'Section' && isThemeSectionEditor) && /*#__PURE__*/ jsxRuntime.jsxs("div", {
225
+ "data-toolbar": true,
226
+ "data-toolbar-section": props.tag == 'Section',
227
+ "data-toolbar-theme-section": props.tag == 'Section' && !!isThemeSection || isThemeSectionEditor,
228
+ "data-toolbar-limit": getIndexSection() >= SECTION_LIMIT,
229
+ children: [
230
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
231
+ "data-toolbar-show-parent": true,
232
+ onClick: (e)=>onShowParent(e),
233
+ "aria-hidden": "true",
234
+ children: [
235
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
236
+ "data-toolbar-icon-drag": true,
237
+ children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
238
+ width: "16",
239
+ height: "16",
240
+ viewBox: "0 0 16 16",
241
+ fill: "none",
242
+ children: [
243
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
244
+ d: "M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",
245
+ fill: "currentColor"
246
+ }),
247
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
248
+ d: "M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",
249
+ fill: "currentColor"
250
+ }),
251
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
252
+ d: "M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",
253
+ fill: "currentColor"
254
+ }),
255
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
256
+ d: "M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",
257
+ fill: "currentColor"
258
+ }),
259
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
260
+ d: "M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",
261
+ fill: "currentColor"
262
+ }),
263
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
264
+ d: "M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",
265
+ fill: "currentColor"
266
+ })
267
+ ]
268
+ })
269
+ }),
270
+ props.tag == 'Section' ? /*#__PURE__*/ jsxRuntime.jsx("div", {
271
+ "data-toolbar-name": true,
272
+ children: getSectionName()
273
+ }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
274
+ "data-toolbar-name": true,
275
+ children: toolbarName()
276
+ }),
277
+ props.tag !== 'Section' && parents.length > 0 && /*#__PURE__*/ jsxRuntime.jsx("div", {
278
+ "data-toolbar-icon-parent": true,
279
+ "data-toolbar-icon-parent-open": isShowParent,
280
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
281
+ width: "16",
282
+ height: "16",
283
+ viewBox: "0 0 16 16",
284
+ fill: "none",
285
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
286
+ d: "M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",
287
+ fill: "currentColor"
288
+ })
289
+ })
290
+ })
291
+ ]
292
+ }),
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", {
301
+ "data-toolbar-parent": true,
302
+ "data-parent-uid": parent.uid,
303
+ "data-toolbar-theme-section": isThemeSectionEditor,
304
+ "data-toolbar-parent-revert": isShowParentRevert,
305
+ style: {
306
+ top: !isShowParentRevert ? `${-36 * (index + 1)}px` // 32 height + 4 spacing
307
+ : `${36 * (index + 1)}px`
308
+ },
309
+ children: [
310
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
311
+ "data-toolbar-icon-drag": true,
312
+ children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
313
+ width: "16",
314
+ height: "16",
315
+ viewBox: "0 0 16 16",
316
+ fill: "none",
317
+ children: [
318
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
319
+ d: "M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",
320
+ fill: "currentColor"
321
+ }),
322
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
323
+ d: "M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",
324
+ fill: "currentColor"
325
+ }),
326
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
327
+ d: "M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",
328
+ fill: "currentColor"
329
+ }),
330
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
331
+ d: "M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",
332
+ fill: "currentColor"
333
+ }),
334
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
335
+ d: "M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",
336
+ fill: "currentColor"
337
+ }),
338
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
339
+ d: "M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",
340
+ fill: "currentColor"
341
+ })
342
+ ]
343
+ })
344
+ }),
345
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
346
+ "data-toolbar-name": true,
347
+ children: parent_label
348
+ })
349
+ ]
350
+ }, parent.uid);
351
+ }),
352
+ props.tag === 'Section' && !props.isThemeSection && editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
353
+ ...props
354
+ }),
355
+ props.tag == 'Sticky' && /*#__PURE__*/ jsxRuntime.jsx("div", {
356
+ "data-toolbar-zoom-out": true,
357
+ onClick: (e)=>onZoomOut(e),
358
+ "aria-hidden": "true",
359
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
360
+ width: "16",
361
+ height: "16",
362
+ viewBox: "0 0 16 16",
363
+ fill: "none",
364
+ xmlns: "http://www.w3.org/2000/svg",
365
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
366
+ fillRule: "evenodd",
367
+ clipRule: "evenodd",
368
+ d: "M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",
369
+ fill: "currentColor"
370
+ })
371
+ })
372
+ }),
373
+ /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
374
+ enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
375
+ text: "Page has reached Shopify’s 25 section-limit",
376
+ position: "bottom",
377
+ "data-toolbar-duplicate": true,
378
+ "data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
379
+ onClick: (e)=>onDuplicate(e),
380
+ "aria-hidden": "true",
381
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
382
+ width: "16",
383
+ height: "16",
384
+ viewBox: "0 0 16 16",
385
+ fill: "none",
386
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
387
+ fillRule: "evenodd",
388
+ clipRule: "evenodd",
389
+ d: "M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",
390
+ fill: "currentColor"
391
+ })
392
+ })
393
+ }),
394
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
395
+ "data-toolbar-delete": true,
396
+ onClick: (e)=>onDelete(e),
397
+ "aria-hidden": "true",
398
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
399
+ width: "16",
400
+ height: "16",
401
+ viewBox: "0 0 16 16",
402
+ fill: "none",
403
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
404
+ fillRule: "evenodd",
405
+ clipRule: "evenodd",
406
+ d: "M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",
407
+ fill: "currentColor"
408
+ })
409
+ })
410
+ })
411
+ ]
412
+ }),
413
+ editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatus, {
414
+ ...props
415
+ }),
416
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
417
+ "data-outline": true,
418
+ "data-outline-section": props.tag == 'Section',
419
+ "data-outline-theme-section": props.tag == 'Section' && !!isThemeSection || isThemeSectionEditor,
420
+ "data-outline-limit": getIndexSection() >= SECTION_LIMIT
421
+ }),
422
+ props.tag == 'Section' && !isThemeSectionEditor && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
423
+ children: [
424
+ /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
425
+ enable: getSectionNumber() >= SECTION_LIMIT,
426
+ text: "Page has reached Shopify’s 25 section-limit",
427
+ position: "top",
428
+ "data-toolbar-add-top": true,
429
+ "data-toolbar-disable": getSectionNumber() >= SECTION_LIMIT,
430
+ "data-toolbar-add-open": activeAddSection == 'above',
431
+ onClick: (e)=>onAddSection(e, 'above'),
432
+ "aria-hidden": "true",
433
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
434
+ width: "16",
435
+ height: "16",
436
+ viewBox: "0 0 16 16",
437
+ fill: "none",
438
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
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"
441
+ })
442
+ })
443
+ }),
444
+ /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
445
+ enable: getSectionNumber() >= SECTION_LIMIT,
446
+ text: "Page has reached Shopify’s 25 section-limit",
447
+ position: "top",
448
+ "data-toolbar-add-bottom": true,
449
+ "data-toolbar-disable": getSectionNumber() >= SECTION_LIMIT,
450
+ "data-toolbar-add-open": activeAddSection == 'below',
451
+ onClick: (e)=>onAddSection(e, 'below'),
452
+ "aria-hidden": "true",
453
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
454
+ width: "16",
455
+ height: "16",
456
+ viewBox: "0 0 16 16",
457
+ fill: "none",
458
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
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"
461
+ })
462
+ })
463
+ })
464
+ ]
465
+ }),
466
+ /*#__PURE__*/ jsxRuntime.jsx(Resize.default, {
467
+ ...props
468
+ })
469
+ ]
470
+ });
471
+ };
472
+
473
+ exports.ComponentToolbarPreview = ComponentToolbarPreview;
@@ -7,8 +7,12 @@ var react = require('react');
7
7
  var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
8
8
  var constant = require('./constant.js');
9
9
  var RenderCustomCode = require('./RenderCustomCode.js');
10
+ var useApplyAnimation = require('../hooks/animation/useApplyAnimation.js');
10
11
 
11
12
  const ComponentWrapper = ({ children, ...props })=>{
13
+ useApplyAnimation.default({
14
+ props
15
+ });
12
16
  if (props.type === 'section') return null;
13
17
  const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag);
14
18
  const advanced = props.advanced;
@@ -20,6 +24,7 @@ const ComponentWrapper = ({ children, ...props })=>{
20
24
  advanced: advanced
21
25
  }),
22
26
  /*#__PURE__*/ jsxRuntime.jsx(children.type, {
27
+ className: advanced?.cssClass,
23
28
  ...children.props,
24
29
  style,
25
30
  advanced
@@ -35,7 +40,7 @@ const ComponentWrapper = ({ children, ...props })=>{
35
40
  }),
36
41
  /*#__PURE__*/ jsxRuntime.jsx("div", {
37
42
  style: style,
38
- className: `${props.uid}`,
43
+ className: `${props.uid} ${advanced?.cssClass}`,
39
44
  children: children
40
45
  })
41
46
  ]
@@ -7,12 +7,31 @@ var react = require('react');
7
7
  var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
8
8
  var constant = require('./constant.js');
9
9
  var RenderCustomCode = require('./RenderCustomCode.js');
10
+ var ComponentToolbarPreview = require('./ComponentToolbarPreview.js');
11
+ var useApplyAnimation = require('../hooks/animation/useApplyAnimation.js');
10
12
 
11
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
+ });
12
28
  if (props.type === 'section') {
13
29
  return null;
14
30
  }
15
31
  const customProps = {};
32
+ if (props.tag === 'Section' && props.isThemeSection) {
33
+ customProps['data-theme-section'] = true;
34
+ }
16
35
  // Build editor configs
17
36
  if (props.editorConfigs) {
18
37
  const editorConfigs = props.editorConfigs;
@@ -43,6 +62,13 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
43
62
  if (editorConfigs.slots?.children) {
44
63
  customProps['data-slots-children'] = true;
45
64
  }
65
+ if (!editorConfigs.toolbar?.hide) {
66
+ customProps['data-toolbar-wrap'] = true;
67
+ }
68
+ }
69
+ // Show toolbar wrapper
70
+ if (!props?.editorConfigs?.toolbar?.hide) {
71
+ customProps['data-toolbar-wrap'] = true;
46
72
  }
47
73
  const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag);
48
74
  const advanced = props.advanced;
@@ -60,12 +86,18 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
60
86
  uid: props.uid,
61
87
  advanced: advanced
62
88
  }),
63
- /*#__PURE__*/ jsxRuntime.jsx(children.type, {
89
+ /*#__PURE__*/ jsxRuntime.jsxs(children.type, {
64
90
  className: advanced?.cssClass,
65
91
  ...children.props,
66
92
  style,
67
93
  builderAttrs,
68
- advanced
94
+ advanced,
95
+ children: [
96
+ children.props['children'],
97
+ /*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.ComponentToolbarPreview, {
98
+ ...props
99
+ })
100
+ ]
69
101
  })
70
102
  ]
71
103
  });
@@ -77,11 +109,25 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
77
109
  uid: props.uid,
78
110
  advanced: advanced
79
111
  }),
80
- /*#__PURE__*/ jsxRuntime.jsx("div", {
81
- style: style,
112
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
113
+ style: !constant.excludeApplyStyle.includes(props.tag) ? style : {
114
+ '--mb': style?.['--mb'],
115
+ '--mb-tablet': style?.['--mb-tablet'],
116
+ '--mb-mobile': style?.['--mb-mobile']
117
+ },
82
118
  className: `${props.uid} ${props.advanced?.cssClass ? props.advanced?.cssClass : ''}`,
83
119
  ...builderAttrs,
84
- children: children
120
+ children: [
121
+ !constant.excludeApplyStyle.includes(props.tag) && children,
122
+ /*#__PURE__*/ react.isValidElement(children) && constant.excludeApplyStyle.includes(props.tag) && /*#__PURE__*/ jsxRuntime.jsx(children.type, {
123
+ ...children.props,
124
+ style,
125
+ advanced
126
+ }),
127
+ /*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.ComponentToolbarPreview, {
128
+ ...props
129
+ })
130
+ ]
85
131
  })
86
132
  ]
87
133
  });