@gem-sdk/pages 1.23.0-staging.34 → 1.23.0-staging.344

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 (36) hide show
  1. package/dist/cjs/components/builder/Toolbar.js +244 -76
  2. package/dist/cjs/components/builder/Toolbox.js +106 -53
  3. package/dist/cjs/components/builder/toolbar/Onboarding.js +110 -0
  4. package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +1 -7
  5. package/dist/cjs/components/image-to-layout/DropElement.js +128 -87
  6. package/dist/cjs/components/image-to-layout/ImageToLayout.js +2 -8
  7. package/dist/cjs/libs/api/get-home-page-props-v2.js +3 -1
  8. package/dist/cjs/libs/api/get-static-page-props-preview.js +3 -1
  9. package/dist/cjs/libs/google-fonts.js +6 -1
  10. package/dist/cjs/libs/helpers/gen-fonts.js +15 -4
  11. package/dist/cjs/pages/builder.js +43 -41
  12. package/dist/cjs/pages/collection-detail.js +12 -10
  13. package/dist/cjs/pages/product-detail.js +18 -16
  14. package/dist/cjs/pages/static-v2.js +14 -12
  15. package/dist/cjs/pages/static.js +13 -11
  16. package/dist/esm/components/builder/Toolbar.js +245 -77
  17. package/dist/esm/components/builder/Toolbox.js +107 -54
  18. package/dist/esm/components/builder/toolbar/Onboarding.js +106 -0
  19. package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +1 -7
  20. package/dist/esm/components/image-to-layout/DropElement.js +128 -87
  21. package/dist/esm/components/image-to-layout/ImageToLayout.js +2 -8
  22. package/dist/esm/libs/api/get-home-page-props-v2.js +4 -2
  23. package/dist/esm/libs/api/get-static-page-props-preview.js +4 -2
  24. package/dist/esm/libs/google-fonts.js +6 -1
  25. package/dist/esm/libs/helpers/gen-fonts.js +15 -4
  26. package/dist/esm/pages/builder.js +44 -42
  27. package/dist/esm/pages/collection-detail.js +13 -11
  28. package/dist/esm/pages/product-detail.js +19 -17
  29. package/dist/esm/pages/static-v2.js +15 -13
  30. package/dist/esm/pages/static.js +14 -12
  31. package/dist/types/index.d.ts +1 -0
  32. package/package.json +3 -3
  33. package/dist/cjs/components/image-to-layout/ImageToLayoutInput.js +0 -193
  34. package/dist/cjs/components/image-to-layout/PagesSuggestion.js +0 -80
  35. package/dist/esm/components/image-to-layout/ImageToLayoutInput.js +0 -191
  36. package/dist/esm/components/image-to-layout/PagesSuggestion.js +0 -78
@@ -2,36 +2,69 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var jsxRuntime = require('react/jsx-runtime');
5
6
  var react = require('react');
7
+ var Onboarding = require('./toolbar/Onboarding.js');
6
8
 
7
9
  const TOOLBAR_HOVER_HEIGHT = 24;
8
10
  const TOOLBAR_ACTIVE_HEIGHT = 32;
11
+ const isPopup = (el)=>{
12
+ const tag = el.getAttribute('data-component-tag');
13
+ return tag === 'Dialog';
14
+ };
15
+ const isSticky = (el)=>{
16
+ const tag = el.getAttribute('data-component-tag');
17
+ return tag === 'Sticky';
18
+ };
9
19
  const Toolbar = ()=>{
10
20
  const currentComponentActive = react.useRef(null);
11
21
  const isDragging = react.useRef(false);
12
- const obsActiveComponent = react.useRef();
22
+ const stopWatchReRenderComponent = react.useRef();
13
23
  const isResizeSpacing = react.useRef(false);
24
+ const [isOnboarding, setIsOnboarding] = react.useState(false);
25
+ const [countShowOnboarding, setCountShowOnboarding] = react.useState(0);
26
+ const [onboardingPosition, setOnboardingPosition] = react.useState('bottom');
27
+ const timeoutRef = react.useRef(null);
28
+ const timeoutOnboarding = 5000;
14
29
  /* Functions */ const changePositionToolbar = ({ state, $toolbar, $component })=>{
15
30
  const $parentOverflow = findOverflowParent($component, $toolbar);
31
+ const rect = $toolbar.getBoundingClientRect();
32
+ const rectComponent = $component.getBoundingClientRect();
33
+ const windowWidth = window.innerWidth;
16
34
  if ($parentOverflow) {
17
- const rect = $component.getBoundingClientRect();
18
- if (rect?.height <= 60) {
35
+ if (rectComponent?.height <= 60) {
19
36
  $toolbar.setAttribute(`data-toolbar-${state}-revert`, 'true');
20
37
  } else {
21
38
  $toolbar.setAttribute(`data-toolbar-${state}-inside`, 'true');
22
39
  }
40
+ // fix toolbar overflow right side
41
+ if (rectComponent.left + rect.width > windowWidth) {
42
+ $toolbar.setAttribute(`data-toolbar-${state}-overflow`, 'true');
43
+ }
23
44
  } else {
24
- const rectComponent = $component.getBoundingClientRect();
25
- if (rectComponent.top < TOOLBAR_ACTIVE_HEIGHT + 1) {
45
+ if (rect.top < TOOLBAR_ACTIVE_HEIGHT + 1) {
26
46
  if (rectComponent?.height <= 60) {
27
47
  $toolbar.setAttribute(`data-toolbar-${state}-revert`, 'true');
28
48
  } else {
29
49
  $toolbar.setAttribute(`data-toolbar-${state}-inside`, 'true');
30
50
  }
31
51
  }
52
+ // fix toolbar overflow right side
53
+ if (rectComponent.left + rect.width > windowWidth) {
54
+ $toolbar.setAttribute(`data-toolbar-${state}-overflow`, 'true');
55
+ }
56
+ }
57
+ // fix Popup overflow right position
58
+ const popupEl = $component?.closest('[aria-label="Dialog body"]');
59
+ if (popupEl) {
60
+ const rectPopupEl = popupEl.getBoundingClientRect();
61
+ const popupElRightPosition = rectPopupEl.left + rectPopupEl.width - 20;
62
+ if (rectComponent.left + rect.width > popupElRightPosition) {
63
+ $toolbar.setAttribute(`data-toolbar-${state}-overflow`, 'true');
64
+ }
32
65
  }
33
66
  };
34
- const setHoverComponent = react.useCallback(({ $component, componentUid, focus, isThemeSection })=>{
67
+ const setHoverComponent = react.useCallback(({ $component, componentUid, focus, isThemeSection, isParent })=>{
35
68
  if (!$component && !componentUid) return;
36
69
  if (!$component) {
37
70
  const $c = document.querySelector(`[data-uid="${componentUid}"]`);
@@ -53,7 +86,9 @@ const Toolbar = ()=>{
53
86
  }
54
87
  if ($toolbar) {
55
88
  $toolbar.removeAttribute('style');
56
- $toolbar.setAttribute('data-toolbar-hover', 'true');
89
+ if (!isParent) {
90
+ $toolbar.setAttribute('data-toolbar-hover', 'true');
91
+ }
57
92
  if (focus) {
58
93
  $toolbar.setAttribute('data-toolbar-hover-focus', 'true');
59
94
  }
@@ -65,6 +100,9 @@ const Toolbar = ()=>{
65
100
  }
66
101
  if ($outline) {
67
102
  $outline.setAttribute('data-outline-hover', 'true');
103
+ if (isParent) {
104
+ $outline.setAttribute('data-outline-parent-hover', 'true');
105
+ }
68
106
  if (isThemeSection) {
69
107
  $outline.setAttribute('data-outline-overlay-theme-section', 'true');
70
108
  }
@@ -73,10 +111,14 @@ const Toolbar = ()=>{
73
111
  }
74
112
  }
75
113
  if ($btnAddTop) {
76
- $btnAddTop.setAttribute('data-toolbar-add-hover', 'true');
114
+ if (!isParent) {
115
+ $btnAddTop.setAttribute('data-toolbar-add-hover', 'true');
116
+ }
77
117
  }
78
118
  if ($btnAddBottom) {
79
- $btnAddBottom.setAttribute('data-toolbar-add-hover', 'true');
119
+ if (!isParent) {
120
+ $btnAddBottom.setAttribute('data-toolbar-add-hover', 'true');
121
+ }
80
122
  }
81
123
  }, []);
82
124
  const setHoverComponentParents = react.useCallback(({ $component, componentUid })=>{
@@ -85,12 +127,13 @@ const Toolbar = ()=>{
85
127
  if (!$c) return;
86
128
  $component = $c;
87
129
  }
88
- const $parents = getDOMElementParents($component, '[data-uid][data-component-type="component"]:not([data-component-no-setting])');
130
+ const $parents = getDOMElementParents($component, '[data-uid][data-component-type="component"]:not([data-component-no-setting])', 1);
89
131
  if ($parents.length) {
90
132
  for (const $parent of $parents){
91
133
  if ($parent) {
92
134
  setHoverComponent({
93
- $component: $parent
135
+ $component: $parent,
136
+ isParent: true
94
137
  });
95
138
  }
96
139
  }
@@ -167,7 +210,9 @@ const Toolbar = ()=>{
167
210
  'data-toolbar-hover-revert',
168
211
  'data-toolbar-hover-inside',
169
212
  'data-outline-hover',
170
- 'data-toolbar-add-hover'
213
+ 'data-toolbar-add-hover',
214
+ 'data-outline-parent-hover',
215
+ 'data-toolbar-hover-overflow'
171
216
  ];
172
217
  const $elms = document.querySelectorAll(clearAttrs.map((attr)=>`[${attr}]`).join(','));
173
218
  if ($elms) {
@@ -179,6 +224,21 @@ const Toolbar = ()=>{
179
224
  }, [
180
225
  removeHoverOverlayComponent
181
226
  ]);
227
+ const onCloseOnboarding = react.useCallback(()=>{
228
+ timeoutRef.current && clearTimeout(timeoutRef.current);
229
+ if (countShowOnboarding > 0) {
230
+ const eventCreate = new CustomEvent('editor:toolbar:close-onboarding', {
231
+ bubbles: true,
232
+ detail: {
233
+ close: 'close Onboarding'
234
+ }
235
+ });
236
+ window.dispatchEvent(eventCreate);
237
+ setIsOnboarding(false);
238
+ }
239
+ }, [
240
+ countShowOnboarding
241
+ ]);
182
242
  const removeActiveComponent = react.useCallback(()=>{
183
243
  currentComponentActive.current = null;
184
244
  const clearAttrs = [
@@ -189,7 +249,8 @@ const Toolbar = ()=>{
189
249
  'data-toolbar-active-inside',
190
250
  'data-spacing-margin-bottom-active',
191
251
  'data-toolbar-force-hover',
192
- 'data-outline-force-hover'
252
+ 'data-outline-force-hover',
253
+ 'data-toolbar-active-overflow'
193
254
  ];
194
255
  const $elms = document.querySelectorAll(clearAttrs.map((attr)=>`[${attr}]`).join(','));
195
256
  if ($elms) {
@@ -198,37 +259,32 @@ const Toolbar = ()=>{
198
259
  });
199
260
  }
200
261
  setFocusTextEditor(false);
201
- if (obsActiveComponent.current) obsActiveComponent.current.disconnect();
202
- }, []);
262
+ if (stopWatchReRenderComponent.current) stopWatchReRenderComponent.current();
263
+ onCloseOnboarding();
264
+ }, [
265
+ onCloseOnboarding
266
+ ]);
203
267
  const watchComponentReRender = ($el, callback)=>{
204
- const parent = $el.parentNode;
205
- if (!parent) return;
206
- if (obsActiveComponent.current) obsActiveComponent.current.disconnect();
207
- obsActiveComponent.current = new MutationObserver((mutations)=>{
208
- for (const mutation of mutations){
209
- mutation.removedNodes.forEach((el)=>{
210
- if (el === $el) {
211
- if (obsActiveComponent.current) obsActiveComponent.current.disconnect();
212
- setTimeout(()=>{
213
- callback();
214
- }, 0);
215
- }
216
- });
268
+ // editor:component:render
269
+ const onComponentReRender = (e)=>{
270
+ const detail = e.detail;
271
+ if (detail?.componentUid == currentComponentActive.current?.componentUid) {
272
+ callback();
217
273
  }
218
- });
219
- obsActiveComponent.current.observe(parent, {
220
- childList: true
221
- });
274
+ };
275
+ window.removeEventListener('editor:component:render', onComponentReRender);
276
+ window.addEventListener('editor:component:render', onComponentReRender);
222
277
  const $images = $el.querySelectorAll('img');
223
278
  if ($images?.length) {
224
279
  $images.forEach(($img)=>{
225
280
  $img.addEventListener('load', ()=>{
226
- setTimeout(()=>{
227
- callback();
228
- }, 0);
281
+ callback();
229
282
  });
230
283
  });
231
284
  }
285
+ stopWatchReRenderComponent.current = ()=>{
286
+ window.removeEventListener('editor:component:render', onComponentReRender);
287
+ };
232
288
  };
233
289
  const setActiveComponentSpacing = react.useCallback(({ $component })=>{
234
290
  if (!$component) return;
@@ -239,46 +295,94 @@ const Toolbar = ()=>{
239
295
  const $bg = $marginBottom.querySelector('[data-spacing-margin-bottom-bg]') || null;
240
296
  const $drag = $marginBottom.querySelector('[data-spacing-margin-bottom-drag]') || null;
241
297
  if ($bg && $drag) {
242
- const value = style.marginBottom;
298
+ let value = style.marginBottom;
299
+ if (parseFloat(value) < 0) {
300
+ value = '0';
301
+ }
243
302
  $bg.style.height = value;
244
303
  $drag.style.top = value;
245
304
  $marginBottom.setAttribute('data-spacing-margin-bottom-active', 'true');
305
+ if (isLayoutElement($component)) {
306
+ $bg.style.left = '0';
307
+ } else {
308
+ const paddingLeft = style.paddingLeft;
309
+ const leftValue = `-${paddingLeft}`;
310
+ const translateCss = `translate(${leftValue}, -100%)`;
311
+ $bg.style.left = leftValue;
312
+ $drag.style.transform = translateCss;
313
+ }
246
314
  }
247
315
  }
248
316
  }, []);
249
- const setActiveComponentForceHoverSection = react.useCallback(($component, value)=>{
250
- const $section = $component.closest('[data-toolbar-wrap][data-component-tag="Section"]');
251
- if ($section) {
252
- if (value) {
253
- const $toolbar = getChildrenByAttrSelector($section, 'data-toolbar');
254
- const $outline = getChildrenByAttrSelector($section, 'data-outline');
255
- if ($toolbar) {
256
- $toolbar.setAttribute('data-toolbar-force-hover', 'true');
257
- changePositionToolbar({
258
- $toolbar,
259
- $component,
260
- state: 'hover'
261
- });
262
- }
263
- if ($outline) {
264
- $outline.setAttribute('data-outline-force-hover', 'true');
265
- }
266
- } else {
267
- const $toolbar = getChildrenByAttrSelector($section, 'data-toolbar');
268
- const $outline = getChildrenByAttrSelector($section, 'data-outline');
269
- if ($toolbar) {
270
- $toolbar.removeAttribute('data-toolbar-force-hover');
271
- }
272
- if ($outline) {
273
- $outline.removeAttribute('data-outline-force-hover');
317
+ const calculateOnboardingPosition = ()=>{
318
+ const toolbar = document.querySelector('[data-toolbar-active]');
319
+ const toolbarOnboading = document.querySelector('[data-toolbar-onboarding]');
320
+ if (toolbar && toolbarOnboading) {
321
+ toolbarOnboading?.removeAttribute('data-onboarding-active');
322
+ setTimeout(()=>{
323
+ const rect = toolbar.getBoundingClientRect();
324
+ const rectTop = rect.top || 0;
325
+ const rectOnboading = toolbarOnboading?.getBoundingClientRect();
326
+ const onboardingHeight = rectOnboading?.height || 0;
327
+ const $iframe = parent.document.querySelector('.iframe');
328
+ const $iframeWin = $iframe?.contentWindow;
329
+ const iframeWinScrollY = $iframeWin?.scrollY || 0;
330
+ const iframeHeight = $iframe?.clientHeight || 0;
331
+ if (rectTop + onboardingHeight > iframeHeight) {
332
+ const oboardingTop = rect.top + iframeWinScrollY - onboardingHeight - 8;
333
+ toolbarOnboading?.setAttribute('style', `top: ${oboardingTop}px;left: ${rect.left}px;`);
334
+ setOnboardingPosition('top');
335
+ if ($iframeWin && oboardingTop < rect.top + iframeWinScrollY) {
336
+ setTimeout(()=>{
337
+ const toTop = oboardingTop - 20;
338
+ $iframeWin.scrollTo({
339
+ top: toTop,
340
+ behavior: 'smooth'
341
+ });
342
+ }, 200);
343
+ }
344
+ } else {
345
+ const oboardingTop = rect.top + iframeWinScrollY + rect.height + 8;
346
+ toolbarOnboading?.setAttribute('style', `top: ${oboardingTop}px;left: ${rect.left}px;`);
347
+ setOnboardingPosition('bottom');
274
348
  }
275
- }
349
+ setCountShowOnboarding((countShowOnboarding)=>countShowOnboarding + 1);
350
+ toolbarOnboading?.setAttribute('data-onboarding-active', 'true');
351
+ }, 100);
276
352
  }
277
- }, []);
353
+ };
354
+ const setToolbarOnboarding = react.useCallback(({ $component })=>{
355
+ if (!$component) return;
356
+ if (isSection($component) || isPopup($component) || isSticky($component)) return;
357
+ const toolbarOnboading = document.querySelector('[data-toolbar-onboarding]');
358
+ // only show one time
359
+ if (countShowOnboarding == 0) {
360
+ calculateOnboardingPosition();
361
+ } else {
362
+ onCloseOnboarding();
363
+ toolbarOnboading?.removeAttribute('data-onboarding-active');
364
+ }
365
+ }, [
366
+ countShowOnboarding,
367
+ onCloseOnboarding
368
+ ]);
278
369
  const setActiveComponent = react.useCallback(async ({ componentUid, productId, timeAwait = 500, forceReActive })=>{
279
370
  if (!componentUid) return;
280
- const $component = await waitForElementToExist(`${productId ? `[data-product-id="${productId}"] ` : ''}[data-uid="${componentUid}"]`, timeAwait);
281
- if (!$component) return;
371
+ let $component = await waitForElementToExist(`${productId ? `[data-product-id="${productId}"] ` : ''}[data-uid="${componentUid}"]`, timeAwait);
372
+ // check element fetch data: product, product list
373
+ if (!$component) {
374
+ const isLoading = document.querySelector(`.gp-loading-placeholder`);
375
+ if (!isLoading) {
376
+ return;
377
+ }
378
+ if (isLoading) {
379
+ // await element onload
380
+ $component = await waitForElementToExist(`${productId ? `[data-product-id="${productId}"] ` : ''}[data-uid="${componentUid}"]`, 15000);
381
+ }
382
+ }
383
+ if (!$component) {
384
+ return;
385
+ }
282
386
  if (!forceReActive && componentUid == currentComponentActive.current?.componentUid && productId == currentComponentActive.current?.productId) return;
283
387
  if (componentUid !== currentComponentActive.current?.componentUid || productId !== currentComponentActive.current?.productId || forceReActive) removeActiveComponent();
284
388
  const $toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
@@ -322,7 +426,14 @@ const Toolbar = ()=>{
322
426
  setActiveComponentSpacing({
323
427
  $component
324
428
  });
325
- setActiveComponentForceHoverSection($component, true);
429
+ timeoutRef.current && clearTimeout(timeoutRef.current);
430
+ timeoutRef.current = setTimeout(()=>{
431
+ if ($component) {
432
+ setToolbarOnboarding({
433
+ $component
434
+ });
435
+ }
436
+ }, timeoutOnboarding);
326
437
  removeHoverComponent();
327
438
  // Reactive when component re-render
328
439
  watchComponentReRender($component, ()=>{
@@ -336,8 +447,8 @@ const Toolbar = ()=>{
336
447
  }, [
337
448
  removeActiveComponent,
338
449
  removeHoverComponent,
339
- setActiveComponentForceHoverSection,
340
- setActiveComponentSpacing
450
+ setActiveComponentSpacing,
451
+ setToolbarOnboarding
341
452
  ]);
342
453
  const setFocusTextEditor = async (value)=>{
343
454
  if (!value) {
@@ -460,7 +571,7 @@ const Toolbar = ()=>{
460
571
  if (isDragging.current) return;
461
572
  if (isResizeSpacing.current) return;
462
573
  const $target = e.target;
463
- if (!$target) {
574
+ if (!$target || typeof $target.closest !== 'function') {
464
575
  removeHoverOverlayComponent();
465
576
  return;
466
577
  }
@@ -603,6 +714,46 @@ const Toolbar = ()=>{
603
714
  }, [
604
715
  removeHoverComponent
605
716
  ]);
717
+ const setHoverParentComponent = (uid, type)=>{
718
+ if (!uid) return;
719
+ const $parentComponents = document.querySelectorAll(`[data-uid="${uid}"]`);
720
+ if ($parentComponents.length) {
721
+ $parentComponents.forEach(($parentComponent)=>{
722
+ const $outline = getChildrenByAttrSelector($parentComponent, 'data-outline');
723
+ if ($outline) {
724
+ if (type === 'in') {
725
+ $outline.setAttribute('data-outline-force-hover', 'true');
726
+ $outline.setAttribute('data-outline-force-overlay', 'true');
727
+ } else {
728
+ $outline.removeAttribute('data-outline-force-hover');
729
+ $outline.removeAttribute('data-outline-force-overlay');
730
+ }
731
+ }
732
+ });
733
+ }
734
+ };
735
+ const onHoverComponent = react.useCallback((e)=>{
736
+ if (isDragging.current) return;
737
+ const detail = e.detail;
738
+ if (detail?.componentUid) {
739
+ setHoverParentComponent(detail?.componentUid, detail?.type);
740
+ }
741
+ }, [
742
+ isDragging
743
+ ]);
744
+ const onToolbarOnboarding = react.useCallback((e)=>{
745
+ const detail = e.detail;
746
+ if (detail?.isNewUser) {
747
+ setIsOnboarding(true);
748
+ }
749
+ }, []);
750
+ const onWindowResize = react.useCallback(()=>{
751
+ if (isOnboarding) {
752
+ calculateOnboardingPosition();
753
+ }
754
+ }, [
755
+ isOnboarding
756
+ ]);
606
757
  /* Register event */ react.useEffect(()=>{
607
758
  document.addEventListener('mousemove', onMouseMove);
608
759
  window.addEventListener('editor:active-component', onActiveComponent);
@@ -611,6 +762,9 @@ const Toolbar = ()=>{
611
762
  window.addEventListener('editor:is-editing-text-editor', onIsEditingTextEditor);
612
763
  window.addEventListener('editor:toolbar:show-parents', onShowParents);
613
764
  window.addEventListener('editor:toolbar:resize-spacing', onResizeSpacing);
765
+ window.addEventListener('editor:hover-component', onHoverComponent);
766
+ window.addEventListener('editor:toolbar-onboarding', onToolbarOnboarding);
767
+ window.addEventListener('resize', onWindowResize);
614
768
  return ()=>{
615
769
  document.removeEventListener('mousemove', onMouseMove);
616
770
  window.removeEventListener('editor:active-component', onActiveComponent);
@@ -619,6 +773,9 @@ const Toolbar = ()=>{
619
773
  window.removeEventListener('editor:is-editing-text-editor', onIsEditingTextEditor);
620
774
  window.removeEventListener('editor:toolbar:show-parents', onShowParents);
621
775
  window.removeEventListener('editor:toolbar:resize-spacing', onResizeSpacing);
776
+ window.removeEventListener('editor:hover-component', onHoverComponent);
777
+ window.removeEventListener('editor:toolbar-onboarding', onToolbarOnboarding);
778
+ window.removeEventListener('resize', onWindowResize);
622
779
  };
623
780
  }, [
624
781
  onMouseMove,
@@ -627,9 +784,16 @@ const Toolbar = ()=>{
627
784
  onIsDragging,
628
785
  onIsEditingTextEditor,
629
786
  onShowParents,
630
- onResizeSpacing
787
+ onResizeSpacing,
788
+ onHoverComponent,
789
+ onToolbarOnboarding,
790
+ onWindowResize
631
791
  ]);
632
- return null;
792
+ return isOnboarding && /*#__PURE__*/ jsxRuntime.jsx(Onboarding.default, {
793
+ enable: true,
794
+ position: onboardingPosition,
795
+ onCloseOnboarding: onCloseOnboarding
796
+ });
633
797
  };
634
798
  const getDOMElementParents = ($el, selector, limit)=>{
635
799
  // Set up a parent array
@@ -673,11 +837,11 @@ const getChildrenByAttrSelector = ($el, attrSelector)=>{
673
837
  }
674
838
  }
675
839
  };
676
- const isOverParent = ({ current, parent, index, revert })=>{
840
+ const isOverParent = ({ current, parent: parent1, index, revert })=>{
677
841
  for(let i = 0; i < index; i++){
678
- let is = current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent.top && current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent.top + parent.height || current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent.top + parent.height && current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent.top;
842
+ let is = current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent1.top && current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent1.top + parent1.height || current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent1.top + parent1.height && current.top - (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent1.top;
679
843
  if (revert) {
680
- is = current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent.bottom && current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent.bottom - parent.height || current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent.bottom - parent.height && current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent.bottom;
844
+ is = current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent1.bottom && current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent1.bottom - parent1.height || current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i >= parent1.bottom - parent1.height && current.bottom + (TOOLBAR_HOVER_HEIGHT - 1) * i <= parent1.bottom;
681
845
  }
682
846
  if (is) return true;
683
847
  }
@@ -708,9 +872,13 @@ const isSection = (el)=>{
708
872
  const tag = el.getAttribute('data-component-tag');
709
873
  return tag === 'Section';
710
874
  };
711
- const isOverToolbarPosition = (el, parent)=>{
875
+ const isLayoutElement = (el)=>{
876
+ const tag = el.getAttribute('data-component-tag');
877
+ return tag === 'Row' || tag === 'Product';
878
+ };
879
+ const isOverToolbarPosition = (el, parent1)=>{
712
880
  const rect = el.getBoundingClientRect();
713
- const rectP = parent.getBoundingClientRect();
881
+ const rectP = parent1.getBoundingClientRect();
714
882
  // 32px = toolbar active height
715
883
  return rect.top - rectP.top < TOOLBAR_ACTIVE_HEIGHT + 1;
716
884
  };