@gem-sdk/core 1.38.0 → 2.0.0-dev.832

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 (329) hide show
  1. package/dist/cjs/components/AddOn.js +1 -18
  2. package/dist/cjs/components/ComponentToolbarPreview.js +1 -465
  3. package/dist/cjs/components/ComponentWrapper.js +1 -46
  4. package/dist/cjs/components/ComponentWrapperPreview.js +1 -136
  5. package/dist/cjs/components/Empty.js +1 -7
  6. package/dist/cjs/components/Render.js +1 -65
  7. package/dist/cjs/components/Render.liquid.js +14 -288
  8. package/dist/cjs/components/RenderBlock.js +1 -54
  9. package/dist/cjs/components/RenderCustomCode.js +3 -56
  10. package/dist/cjs/components/RenderPreview.js +1 -66
  11. package/dist/cjs/components/RenderSection.js +1 -23
  12. package/dist/cjs/components/ai-generator/AIContentGenerator.js +1 -0
  13. package/dist/cjs/components/ai-generator/AIGenContentLoading.js +1 -0
  14. package/dist/cjs/components/ai-generator/components/PickProduct.js +1 -0
  15. package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +1 -0
  16. package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -0
  17. package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +1 -0
  18. package/dist/cjs/components/ai-generator/icons/AIIcon.js +1 -0
  19. package/dist/cjs/components/ai-generator/icons/CloseIcon.js +1 -0
  20. package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +1 -0
  21. package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +1 -0
  22. package/dist/cjs/components/animation/AnimationWrapper.js +1 -0
  23. package/dist/cjs/components/constant.js +1 -54
  24. package/dist/cjs/components/resize/Resize.js +1 -16
  25. package/dist/cjs/components/resize/Spacing.js +1 -248
  26. package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -56
  27. package/dist/cjs/components/theme-section/CreateThemeSection.js +1 -117
  28. package/dist/cjs/components/theme-section/ThemeSectionStatus.js +1 -36
  29. package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +1 -102
  30. package/dist/cjs/components/toolbar/Tooltip.js +1 -22
  31. package/dist/cjs/contexts/AddonContext.js +1 -36
  32. package/dist/cjs/contexts/BuilderComponent.js +1 -34
  33. package/dist/cjs/contexts/BuilderContext.js +1 -35
  34. package/dist/cjs/contexts/BuilderPreviewContext.js +1 -479
  35. package/dist/cjs/contexts/CartLineContext.js +1 -29
  36. package/dist/cjs/contexts/CollectionContext.js +1 -38
  37. package/dist/cjs/contexts/ModalContext.js +1 -47
  38. package/dist/cjs/contexts/PageContext.js +1 -44
  39. package/dist/cjs/contexts/ProductContext.js +1 -156
  40. package/dist/cjs/contexts/ProductListContext.js +1 -32
  41. package/dist/cjs/contexts/SectionContext.js +1 -53
  42. package/dist/cjs/contexts/ShopContext.js +1 -80
  43. package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
  44. package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
  45. package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
  46. package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
  47. package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
  48. package/dist/cjs/graphql/fragments/custom-font.generated.js +2 -6
  49. package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
  50. package/dist/cjs/graphql/fragments/media.generated.js +2 -6
  51. package/dist/cjs/graphql/fragments/product-little.generated.js +11 -6
  52. package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
  53. package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
  54. package/dist/cjs/graphql/fragments/product.generated.js +11 -6
  55. package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
  56. package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
  57. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +3 -9
  58. package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
  59. package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
  60. package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
  61. package/dist/cjs/graphql/mutations/page-view-up.generated.js +3 -7
  62. package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
  63. package/dist/cjs/graphql/queries/collection.generated.js +2 -14
  64. package/dist/cjs/graphql/queries/collections.generated.js +2 -9
  65. package/dist/cjs/graphql/queries/preview-page.generated.js +2 -14
  66. package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
  67. package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
  68. package/dist/cjs/graphql/queries/product-value-label.generated.js +2 -6
  69. package/dist/cjs/graphql/queries/product-variants.generated.js +2 -10
  70. package/dist/cjs/graphql/queries/products.generated.js +12 -17
  71. package/dist/cjs/graphql/queries/published-theme-pages.generated.js +2 -15
  72. package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
  73. package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +13 -0
  74. package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +34 -0
  75. package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +22 -0
  76. package/dist/cjs/helpers/GlobalEvent.js +1 -19
  77. package/dist/cjs/helpers/animations.js +1 -213
  78. package/dist/cjs/helpers/background.js +1 -230
  79. package/dist/cjs/helpers/borders.js +4 -183
  80. package/dist/cjs/helpers/carousel.js +1 -58
  81. package/dist/cjs/helpers/clone-deep.js +1 -5
  82. package/dist/cjs/helpers/cls.js +1 -16
  83. package/dist/cjs/helpers/colors.js +1 -184
  84. package/dist/cjs/helpers/compose-advance-style.js +1 -268
  85. package/dist/cjs/helpers/constant.js +1 -23
  86. package/dist/cjs/helpers/convert.js +1 -7
  87. package/dist/cjs/helpers/covert-entities-html.js +1 -19
  88. package/dist/cjs/helpers/css-variable.js +1 -7
  89. package/dist/cjs/helpers/email.js +1 -11
  90. package/dist/cjs/helpers/filter-toolbar-preview.js +1 -14
  91. package/dist/cjs/helpers/flatten-connection.js +1 -9
  92. package/dist/cjs/helpers/get-resonsive-value.js +1 -36
  93. package/dist/cjs/helpers/get-shortname.js +1 -92
  94. package/dist/cjs/helpers/icon-list.js +1 -61
  95. package/dist/cjs/helpers/is-browser.js +1 -9
  96. package/dist/cjs/helpers/is-defined.js +1 -7
  97. package/dist/cjs/helpers/is-empty-children.js +1 -15
  98. package/dist/cjs/helpers/is-safari.js +1 -9
  99. package/dist/cjs/helpers/layout.js +1 -59
  100. package/dist/cjs/helpers/load-script.js +1 -31
  101. package/dist/cjs/helpers/make-style.js +1 -163
  102. package/dist/cjs/helpers/normalize-builder-data.js +1 -23
  103. package/dist/cjs/helpers/prefetch-queries.js +1 -78
  104. package/dist/cjs/helpers/product.js +1 -48
  105. package/dist/cjs/helpers/queries/get-collection.js +1 -226
  106. package/dist/cjs/helpers/queries/get-collections.js +1 -21
  107. package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
  108. package/dist/cjs/helpers/queries/get-product.js +1 -154
  109. package/dist/cjs/helpers/queries/get-products.js +1 -163
  110. package/dist/cjs/helpers/query.js +1 -29
  111. package/dist/cjs/helpers/radius.js +6 -140
  112. package/dist/cjs/helpers/render.js +1 -76
  113. package/dist/cjs/helpers/shadow.js +1 -57
  114. package/dist/cjs/helpers/size.js +4 -183
  115. package/dist/cjs/helpers/spacing.js +1 -43
  116. package/dist/cjs/helpers/tracking/fpixel.js +1 -28
  117. package/dist/cjs/helpers/tracking/gtag.js +1 -93
  118. package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
  119. package/dist/cjs/helpers/typography.js +17 -126
  120. package/dist/cjs/helpers/variant.js +1 -11
  121. package/dist/cjs/hooks/animation/animations.js +1 -0
  122. package/dist/cjs/hooks/animation/useAnimationActions.js +1 -39
  123. package/dist/cjs/hooks/animation/useAnimationConfig.js +1 -29
  124. package/dist/cjs/hooks/animation/useAnimationPreview.js +1 -31
  125. package/dist/cjs/hooks/animation/useAnimationTarget.js +1 -120
  126. package/dist/cjs/hooks/animation/useApplyAnimation.js +1 -87
  127. package/dist/cjs/hooks/animation/useLivePageAnimation.js +1 -0
  128. package/dist/cjs/hooks/cart/use-add-to-cart.js +1 -20
  129. package/dist/cjs/hooks/cart/use-cart-data.js +1 -28
  130. package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +1 -20
  131. package/dist/cjs/hooks/cart/use-cart-note-update.js +1 -20
  132. package/dist/cjs/hooks/cart/use-create-cart.js +1 -22
  133. package/dist/cjs/hooks/cart/use-remove-cart-item.js +1 -20
  134. package/dist/cjs/hooks/cart/use-update-cart-item.js +1 -20
  135. package/dist/cjs/hooks/shop/use-collection-query.js +1 -22
  136. package/dist/cjs/hooks/shop/use-collections-query.js +1 -17
  137. package/dist/cjs/hooks/shop/use-product-query.js +1 -22
  138. package/dist/cjs/hooks/shop/use-products-query.js +1 -23
  139. package/dist/cjs/hooks/shop.js +1 -126
  140. package/dist/cjs/hooks/use-current-device.js +1 -21
  141. package/dist/cjs/hooks/use-lazy-video.js +1 -15
  142. package/dist/cjs/hooks/useAnimations.js +1 -26
  143. package/dist/cjs/hooks/useCartId.js +1 -44
  144. package/dist/cjs/hooks/useCartLine.js +1 -11
  145. package/dist/cjs/hooks/useCartUI.js +1 -48
  146. package/dist/cjs/hooks/useCollection.js +1 -9
  147. package/dist/cjs/hooks/useFetchHandle.js +1 -13
  148. package/dist/cjs/hooks/useFormatMoney.js +1 -58
  149. package/dist/cjs/hooks/useInitialSwatchesOptions.js +1 -113
  150. package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +1 -10
  151. package/dist/cjs/hooks/useLoadScript.js +1 -32
  152. package/dist/cjs/hooks/useMoney.js +1 -84
  153. package/dist/cjs/hooks/usePrevious.js +1 -19
  154. package/dist/cjs/hooks/useProduct.js +1 -206
  155. package/dist/cjs/hooks/useProductList.js +1 -21
  156. package/dist/cjs/hooks/useSuspenseFetch.js +1 -27
  157. package/dist/cjs/hooks/useSwatchesOptions.js +1 -41
  158. package/dist/cjs/hooks/useToolbarPostPurchase.js +1 -0
  159. package/dist/cjs/index.js +1 -361
  160. package/dist/cjs/types/animations.js +1 -47
  161. package/dist/cjs/types/appAPI.js +1 -0
  162. package/dist/cjs/types/global-style.js +1 -15
  163. package/dist/cjs/types/shop.js +1 -2
  164. package/dist/cjs/web-components/src/helpers/styles/constant.js +1 -9
  165. package/dist/esm/components/AddOn.js +1 -14
  166. package/dist/esm/components/ComponentToolbarPreview.js +1 -463
  167. package/dist/esm/components/ComponentWrapper.js +1 -42
  168. package/dist/esm/components/ComponentWrapperPreview.js +1 -132
  169. package/dist/esm/components/Empty.js +1 -3
  170. package/dist/esm/components/Render.js +1 -61
  171. package/dist/esm/components/Render.liquid.js +14 -282
  172. package/dist/esm/components/RenderBlock.js +1 -50
  173. package/dist/esm/components/RenderCustomCode.js +3 -52
  174. package/dist/esm/components/RenderPreview.js +1 -62
  175. package/dist/esm/components/RenderSection.js +1 -19
  176. package/dist/esm/components/ai-generator/AIContentGenerator.js +1 -0
  177. package/dist/esm/components/ai-generator/AIGenContentLoading.js +1 -0
  178. package/dist/esm/components/ai-generator/components/PickProduct.js +1 -0
  179. package/dist/esm/components/ai-generator/components/ToneAndVoice.js +1 -0
  180. package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -0
  181. package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +1 -0
  182. package/dist/esm/components/ai-generator/icons/AIIcon.js +1 -0
  183. package/dist/esm/components/ai-generator/icons/CloseIcon.js +1 -0
  184. package/dist/esm/components/ai-generator/icons/DropdownIcon.js +1 -0
  185. package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +1 -0
  186. package/dist/esm/components/animation/AnimationWrapper.js +1 -0
  187. package/dist/esm/components/constant.js +1 -50
  188. package/dist/esm/components/resize/Resize.js +1 -12
  189. package/dist/esm/components/resize/Spacing.js +1 -244
  190. package/dist/esm/components/src/product/helpers/variant-presets.js +1 -54
  191. package/dist/esm/components/theme-section/CreateThemeSection.js +1 -115
  192. package/dist/esm/components/theme-section/ThemeSectionStatus.js +1 -34
  193. package/dist/esm/components/theme-section/ThemeSectionTooltip.js +1 -100
  194. package/dist/esm/components/toolbar/Tooltip.js +1 -18
  195. package/dist/esm/contexts/AddonContext.js +1 -32
  196. package/dist/esm/contexts/BuilderComponent.js +1 -31
  197. package/dist/esm/contexts/BuilderContext.js +1 -32
  198. package/dist/esm/contexts/BuilderPreviewContext.js +1 -476
  199. package/dist/esm/contexts/CartLineContext.js +1 -26
  200. package/dist/esm/contexts/CollectionContext.js +1 -35
  201. package/dist/esm/contexts/ModalContext.js +1 -44
  202. package/dist/esm/contexts/PageContext.js +1 -41
  203. package/dist/esm/contexts/ProductContext.js +1 -153
  204. package/dist/esm/contexts/ProductListContext.js +1 -28
  205. package/dist/esm/contexts/SectionContext.js +1 -49
  206. package/dist/esm/contexts/ShopContext.js +1 -77
  207. package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
  208. package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
  209. package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
  210. package/dist/esm/graphql/fragments/collection.generated.js +2 -4
  211. package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
  212. package/dist/esm/graphql/fragments/custom-font.generated.js +2 -4
  213. package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
  214. package/dist/esm/graphql/fragments/media.generated.js +2 -4
  215. package/dist/esm/graphql/fragments/product-little.generated.js +11 -4
  216. package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
  217. package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
  218. package/dist/esm/graphql/fragments/product.generated.js +11 -4
  219. package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
  220. package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
  221. package/dist/esm/graphql/fragments/published-theme-page.generated.js +3 -6
  222. package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
  223. package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
  224. package/dist/esm/graphql/fragments/variant.generated.js +2 -4
  225. package/dist/esm/graphql/mutations/page-view-up.generated.js +3 -5
  226. package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
  227. package/dist/esm/graphql/queries/collection.generated.js +8 -18
  228. package/dist/esm/graphql/queries/collections.generated.js +3 -8
  229. package/dist/esm/graphql/queries/preview-page.generated.js +8 -18
  230. package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
  231. package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
  232. package/dist/esm/graphql/queries/product-value-label.generated.js +2 -4
  233. package/dist/esm/graphql/queries/product-variants.generated.js +4 -10
  234. package/dist/esm/graphql/queries/products.generated.js +18 -20
  235. package/dist/esm/graphql/queries/published-theme-pages.generated.js +9 -20
  236. package/dist/esm/graphql/queries/store-property.generated.js +2 -4
  237. package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +13 -0
  238. package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +34 -0
  239. package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +22 -0
  240. package/dist/esm/helpers/GlobalEvent.js +1 -15
  241. package/dist/esm/helpers/animations.js +1 -211
  242. package/dist/esm/helpers/background.js +1 -222
  243. package/dist/esm/helpers/borders.js +4 -175
  244. package/dist/esm/helpers/carousel.js +1 -54
  245. package/dist/esm/helpers/clone-deep.js +1 -3
  246. package/dist/esm/helpers/cls.js +1 -14
  247. package/dist/esm/helpers/colors.js +1 -169
  248. package/dist/esm/helpers/compose-advance-style.js +1 -261
  249. package/dist/esm/helpers/constant.js +1 -19
  250. package/dist/esm/helpers/convert.js +1 -4
  251. package/dist/esm/helpers/covert-entities-html.js +1 -17
  252. package/dist/esm/helpers/css-variable.js +1 -5
  253. package/dist/esm/helpers/email.js +1 -6
  254. package/dist/esm/helpers/filter-toolbar-preview.js +1 -9
  255. package/dist/esm/helpers/flatten-connection.js +1 -7
  256. package/dist/esm/helpers/get-resonsive-value.js +1 -31
  257. package/dist/esm/helpers/get-shortname.js +1 -90
  258. package/dist/esm/helpers/icon-list.js +1 -58
  259. package/dist/esm/helpers/is-browser.js +1 -5
  260. package/dist/esm/helpers/is-defined.js +1 -5
  261. package/dist/esm/helpers/is-empty-children.js +1 -10
  262. package/dist/esm/helpers/is-safari.js +1 -5
  263. package/dist/esm/helpers/layout.js +1 -54
  264. package/dist/esm/helpers/load-script.js +1 -29
  265. package/dist/esm/helpers/make-style.js +1 -149
  266. package/dist/esm/helpers/normalize-builder-data.js +1 -21
  267. package/dist/esm/helpers/prefetch-queries.js +1 -76
  268. package/dist/esm/helpers/product.js +1 -44
  269. package/dist/esm/helpers/queries/get-collection.js +1 -223
  270. package/dist/esm/helpers/queries/get-collections.js +1 -19
  271. package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
  272. package/dist/esm/helpers/queries/get-product.js +1 -150
  273. package/dist/esm/helpers/queries/get-products.js +1 -161
  274. package/dist/esm/helpers/query.js +1 -25
  275. package/dist/esm/helpers/radius.js +6 -132
  276. package/dist/esm/helpers/render.js +1 -68
  277. package/dist/esm/helpers/shadow.js +1 -52
  278. package/dist/esm/helpers/size.js +4 -171
  279. package/dist/esm/helpers/spacing.js +1 -40
  280. package/dist/esm/helpers/tracking/fpixel.js +1 -24
  281. package/dist/esm/helpers/tracking/gtag.js +1 -87
  282. package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
  283. package/dist/esm/helpers/typography.js +17 -116
  284. package/dist/esm/helpers/variant.js +1 -9
  285. package/dist/esm/hooks/animation/animations.js +1 -0
  286. package/dist/esm/hooks/animation/useAnimationActions.js +1 -37
  287. package/dist/esm/hooks/animation/useAnimationConfig.js +1 -27
  288. package/dist/esm/hooks/animation/useAnimationPreview.js +1 -29
  289. package/dist/esm/hooks/animation/useAnimationTarget.js +1 -118
  290. package/dist/esm/hooks/animation/useApplyAnimation.js +1 -83
  291. package/dist/esm/hooks/animation/useLivePageAnimation.js +1 -0
  292. package/dist/esm/hooks/cart/use-add-to-cart.js +1 -18
  293. package/dist/esm/hooks/cart/use-cart-data.js +1 -26
  294. package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +1 -18
  295. package/dist/esm/hooks/cart/use-cart-note-update.js +1 -18
  296. package/dist/esm/hooks/cart/use-create-cart.js +1 -20
  297. package/dist/esm/hooks/cart/use-remove-cart-item.js +1 -18
  298. package/dist/esm/hooks/cart/use-update-cart-item.js +1 -18
  299. package/dist/esm/hooks/shop/use-collection-query.js +1 -20
  300. package/dist/esm/hooks/shop/use-collections-query.js +1 -15
  301. package/dist/esm/hooks/shop/use-product-query.js +1 -20
  302. package/dist/esm/hooks/shop/use-products-query.js +1 -21
  303. package/dist/esm/hooks/shop.js +1 -111
  304. package/dist/esm/hooks/use-current-device.js +1 -19
  305. package/dist/esm/hooks/use-lazy-video.js +1 -13
  306. package/dist/esm/hooks/useAnimations.js +1 -24
  307. package/dist/esm/hooks/useCartId.js +1 -40
  308. package/dist/esm/hooks/useCartLine.js +1 -7
  309. package/dist/esm/hooks/useCartUI.js +1 -44
  310. package/dist/esm/hooks/useCollection.js +1 -7
  311. package/dist/esm/hooks/useFetchHandle.js +1 -11
  312. package/dist/esm/hooks/useFormatMoney.js +1 -56
  313. package/dist/esm/hooks/useInitialSwatchesOptions.js +1 -109
  314. package/dist/esm/hooks/useIsomorphicLayoutEffect.js +1 -6
  315. package/dist/esm/hooks/useLoadScript.js +1 -28
  316. package/dist/esm/hooks/useMoney.js +1 -80
  317. package/dist/esm/hooks/usePrevious.js +1 -17
  318. package/dist/esm/hooks/useProduct.js +1 -192
  319. package/dist/esm/hooks/useProductList.js +1 -16
  320. package/dist/esm/hooks/useSuspenseFetch.js +1 -23
  321. package/dist/esm/hooks/useSwatchesOptions.js +1 -37
  322. package/dist/esm/hooks/useToolbarPostPurchase.js +1 -0
  323. package/dist/esm/index.js +1 -100
  324. package/dist/esm/types/animations.js +1 -47
  325. package/dist/esm/types/appAPI.js +1 -0
  326. package/dist/esm/types/global-style.js +1 -12
  327. package/dist/esm/web-components/src/helpers/styles/constant.js +1 -7
  328. package/dist/types/index.d.ts +24803 -6239
  329. package/package.json +8 -3
@@ -1,463 +1 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { useState, useCallback, useEffect } from 'react';
3
- import 'zustand';
4
- import { useBuilderPreviewStore } from '../contexts/BuilderPreviewContext.js';
5
- import { useShopStore } from '../contexts/ShopContext.js';
6
- import '@gem-sdk/adapter-shopify';
7
- import 'swr';
8
- import 'swr/mutation';
9
- import 'vanilla-lazyload';
10
- import '../hooks/useCartUI.js';
11
- import { CreateThemeSection } from './theme-section/CreateThemeSection.js';
12
- import Tooltip from './toolbar/Tooltip.js';
13
- import { ThemeSectionStatus } from './theme-section/ThemeSectionStatus.js';
14
- import Resize from './resize/Resize.js';
15
- import '../helpers/convert.js';
16
-
17
- const SECTION_LIMIT = 25;
18
- const notVisible = (el)=>{
19
- const overflow = getComputedStyle(el).overflow;
20
- return overflow !== 'visible';
21
- };
22
- const isSection = (el)=>{
23
- const tag = el.getAttribute('data-component-tag');
24
- return tag === 'Section';
25
- };
26
- const ComponentToolbarPreview = ({ ...props })=>{
27
- const isThemeSection = props.isThemeSection;
28
- const editingPageType = useShopStore((s)=>s.pageType);
29
- const getParents = useBuilderPreviewStore((s)=>s.getParents);
30
- const root = useBuilderPreviewStore((s)=>s.getItem('ROOT'));
31
- const isThemeSectionEditor = useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
32
- const [activeAddSection, setActiveAddSection] = useState(null);
33
- const [isShowParent, setIsShowParent] = useState(false);
34
- const [isShowParentRevert, setIsShowParentRevert] = useState(false);
35
- const [parents, setParents] = useState([]);
36
- const isOverToolbarPosition = (el, parent)=>{
37
- const parentLenght = parents.length;
38
- const rect = el.getBoundingClientRect();
39
- const rectP = parent.getBoundingClientRect();
40
- // 36px = toolbar active height + 4 spaces
41
- return rect.top - rectP.top < parentLenght * 36;
42
- };
43
- const findOverflowParent = (element, initEl)=>{
44
- const thisEl = element;
45
- const origEl = initEl || thisEl;
46
- if (!thisEl) return;
47
- if (isSection(thisEl)) return;
48
- if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
49
- if (thisEl.parentElement) {
50
- return findOverflowParent(thisEl.parentElement, origEl);
51
- } else {
52
- return;
53
- }
54
- };
55
- // Get parents
56
- const onActiveComponent = useCallback((e)=>{
57
- const detail = e.detail;
58
- if (detail?.componentUid == props.uid) {
59
- const currentParents = getParents(props.uid).filter((parent)=>{
60
- if (parent.uid === 'ROOT') return false;
61
- if (parent.tag === 'Section' && isThemeSectionEditor) return false;
62
- if (parent.editorConfigs?.toolbar?.hide) return false;
63
- if (parent.editorConfigs?.component?.noSetting) return false;
64
- return true;
65
- }).slice(0, 3);
66
- setParents(currentParents);
67
- } else {
68
- setParents([]);
69
- setIsShowParent(false);
70
- }
71
- }, [
72
- setParents,
73
- getParents,
74
- props.uid,
75
- isThemeSectionEditor
76
- ]);
77
- useEffect(()=>{
78
- window.addEventListener('editor:active-component', onActiveComponent);
79
- return ()=>{
80
- window.removeEventListener('editor:active-component', onActiveComponent);
81
- };
82
- }, [
83
- onActiveComponent
84
- ]);
85
- // End get parents
86
- if (props.type === 'section') {
87
- return null;
88
- }
89
- if (props.editorConfigs?.toolbar?.hide) {
90
- return null;
91
- }
92
- const getSectionNumber = ()=>{
93
- return root?.childrens?.length || 0;
94
- };
95
- const getIndexSection = ()=>{
96
- if (props.tag !== 'Section') {
97
- return -1;
98
- }
99
- if (root?.childrens?.length) {
100
- return root.childrens.findIndex((sectionUid)=>sectionUid == props.uid);
101
- }
102
- return -1;
103
- };
104
- const onShowParent = (e)=>{
105
- if (!parents.length) return;
106
- const $target = (e?.target) || null;
107
- const $toolbar = $target.closest('[data-toolbar-active]');
108
- if (!$target || !$toolbar) return;
109
- if (isShowParent) {
110
- setIsShowParentRevert(false);
111
- setIsShowParent(false);
112
- } else {
113
- const $parentOverflow = findOverflowParent($toolbar, $toolbar);
114
- if ($parentOverflow) {
115
- setIsShowParentRevert(true);
116
- } else {
117
- const rect = $toolbar.getBoundingClientRect();
118
- if (rect.top < parents.length * 36) {
119
- setIsShowParentRevert(true);
120
- } else {
121
- setIsShowParentRevert(false);
122
- }
123
- }
124
- setIsShowParent(true);
125
- }
126
- const event = new CustomEvent('editor:toolbar:show-parents', {
127
- bubbles: true,
128
- detail: {
129
- value: !isShowParent
130
- }
131
- });
132
- window.dispatchEvent(event);
133
- };
134
- const onDelete = (e)=>{
135
- e.preventDefault();
136
- e.stopPropagation();
137
- const event = new CustomEvent('editor:toolbar:delete-component', {
138
- bubbles: true,
139
- detail: {
140
- componentUid: props.uid,
141
- isThemeSection: isThemeSection
142
- }
143
- });
144
- window.dispatchEvent(event);
145
- return false;
146
- };
147
- const onDuplicate = (e)=>{
148
- e.preventDefault();
149
- e.stopPropagation();
150
- if (getSectionNumber() >= SECTION_LIMIT && props.tag == 'Section') {
151
- return false;
152
- }
153
- const event = new CustomEvent('editor:toolbar:duplicate-component', {
154
- bubbles: true,
155
- detail: {
156
- componentUid: props.uid,
157
- isThemeSection: isThemeSection
158
- }
159
- });
160
- window.dispatchEvent(event);
161
- return false;
162
- };
163
- const toolbarName = ()=>{
164
- return props.customLabel || props.label;
165
- };
166
- const onZoomOut = (e)=>{
167
- e.preventDefault();
168
- e.stopPropagation();
169
- const event = new CustomEvent('editor:toolbar:zoom-out-component', {
170
- bubbles: true,
171
- detail: {
172
- componentUid: props.uid
173
- }
174
- });
175
- window.dispatchEvent(event);
176
- return false;
177
- };
178
- const closeAddSection = ()=>{
179
- setActiveAddSection(null);
180
- window.removeEventListener('editor:close-add-section-popup', closeAddSection);
181
- };
182
- const onAddSection = (e, position)=>{
183
- e.preventDefault();
184
- e.stopPropagation();
185
- if (getSectionNumber() >= SECTION_LIMIT) {
186
- return false;
187
- }
188
- const $target = e.target;
189
- if ($target) {
190
- setActiveAddSection(position);
191
- const rect = $target.getBoundingClientRect();
192
- const event = new CustomEvent('editor:toolbar:add-section', {
193
- bubbles: true,
194
- detail: {
195
- componentUid: props.uid,
196
- position,
197
- top: rect.top + rect.height / 2
198
- }
199
- });
200
- window.dispatchEvent(event);
201
- window.addEventListener('editor:close-add-section-popup', closeAddSection);
202
- }
203
- return false;
204
- };
205
- const getSectionName = ()=>{
206
- const checkRenamedSection = props.name && props.name === `Section ${props.uid}`;
207
- if (getSectionNumber() >= SECTION_LIMIT - 5) {
208
- return `${checkRenamedSection ? 'Section' : props?.name} ${getIndexSection() + 1}/${SECTION_LIMIT}`;
209
- }
210
- return checkRenamedSection ? `Section ${getIndexSection() + 1}` : props?.name;
211
- };
212
- return /*#__PURE__*/ jsxs(Fragment, {
213
- children: [
214
- !(props.tag == 'Section' && isThemeSectionEditor) && /*#__PURE__*/ jsxs("div", {
215
- "data-toolbar": true,
216
- "data-toolbar-section": props.tag == 'Section',
217
- "data-toolbar-theme-section": props.tag == 'Section' && !!isThemeSection || isThemeSectionEditor,
218
- "data-toolbar-limit": getIndexSection() >= SECTION_LIMIT,
219
- children: [
220
- /*#__PURE__*/ jsxs("div", {
221
- "data-toolbar-show-parent": true,
222
- onClick: (e)=>onShowParent(e),
223
- "aria-hidden": "true",
224
- children: [
225
- /*#__PURE__*/ jsx("div", {
226
- "data-toolbar-icon-drag": true,
227
- children: /*#__PURE__*/ jsxs("svg", {
228
- width: "16",
229
- height: "16",
230
- viewBox: "0 0 16 16",
231
- fill: "none",
232
- children: [
233
- /*#__PURE__*/ jsx("path", {
234
- 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",
235
- fill: "currentColor"
236
- }),
237
- /*#__PURE__*/ jsx("path", {
238
- 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",
239
- fill: "currentColor"
240
- }),
241
- /*#__PURE__*/ jsx("path", {
242
- 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",
243
- fill: "currentColor"
244
- }),
245
- /*#__PURE__*/ jsx("path", {
246
- 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",
247
- fill: "currentColor"
248
- }),
249
- /*#__PURE__*/ jsx("path", {
250
- 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",
251
- fill: "currentColor"
252
- }),
253
- /*#__PURE__*/ jsx("path", {
254
- 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",
255
- fill: "currentColor"
256
- })
257
- ]
258
- })
259
- }),
260
- props.tag == 'Section' ? /*#__PURE__*/ jsx("div", {
261
- "data-toolbar-name": true,
262
- children: getSectionName()
263
- }) : /*#__PURE__*/ jsx("div", {
264
- "data-toolbar-name": true,
265
- children: toolbarName()
266
- }),
267
- props.tag !== 'Section' && parents.length > 0 && /*#__PURE__*/ jsx("div", {
268
- "data-toolbar-icon-parent": true,
269
- "data-toolbar-icon-parent-open": isShowParent,
270
- children: /*#__PURE__*/ jsx("svg", {
271
- width: "16",
272
- height: "16",
273
- viewBox: "0 0 16 16",
274
- fill: "none",
275
- children: /*#__PURE__*/ jsx("path", {
276
- 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",
277
- fill: "currentColor"
278
- })
279
- })
280
- })
281
- ]
282
- }),
283
- isShowParent && parents.map((parent, index)=>{
284
- // Update count columns of Row
285
- const parentLength = parent?.childrens?.length ?? 0;
286
- let parent_label = parent.label;
287
- if (parent.label === 'Row') {
288
- parent_label = parentLength <= 1 ? parent.label + ' ' + parentLength + ' col' : parent.label + ' ' + parentLength + ' cols';
289
- }
290
- return /*#__PURE__*/ jsxs("div", {
291
- "data-toolbar-parent": true,
292
- "data-parent-uid": parent.uid,
293
- "data-toolbar-theme-section": isThemeSectionEditor,
294
- "data-toolbar-parent-revert": isShowParentRevert,
295
- style: {
296
- top: !isShowParentRevert ? `${-36 * (index + 1)}px` // 32 height + 4 spacing
297
- : `${36 * (index + 1)}px`
298
- },
299
- children: [
300
- /*#__PURE__*/ jsx("div", {
301
- "data-toolbar-icon-drag": true,
302
- children: /*#__PURE__*/ jsxs("svg", {
303
- width: "16",
304
- height: "16",
305
- viewBox: "0 0 16 16",
306
- fill: "none",
307
- children: [
308
- /*#__PURE__*/ jsx("path", {
309
- 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",
310
- fill: "currentColor"
311
- }),
312
- /*#__PURE__*/ jsx("path", {
313
- 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",
314
- fill: "currentColor"
315
- }),
316
- /*#__PURE__*/ jsx("path", {
317
- 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",
318
- fill: "currentColor"
319
- }),
320
- /*#__PURE__*/ jsx("path", {
321
- 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",
322
- fill: "currentColor"
323
- }),
324
- /*#__PURE__*/ jsx("path", {
325
- 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",
326
- fill: "currentColor"
327
- }),
328
- /*#__PURE__*/ jsx("path", {
329
- 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",
330
- fill: "currentColor"
331
- })
332
- ]
333
- })
334
- }),
335
- /*#__PURE__*/ jsx("div", {
336
- "data-toolbar-name": true,
337
- children: parent_label
338
- })
339
- ]
340
- }, parent.uid);
341
- }),
342
- props.tag === 'Section' && !props.isThemeSection && editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(CreateThemeSection, {
343
- ...props
344
- }),
345
- props.tag == 'Sticky' && /*#__PURE__*/ jsx("div", {
346
- "data-toolbar-zoom-out": true,
347
- onClick: (e)=>onZoomOut(e),
348
- "aria-hidden": "true",
349
- children: /*#__PURE__*/ jsx("svg", {
350
- width: "16",
351
- height: "16",
352
- viewBox: "0 0 16 16",
353
- fill: "none",
354
- xmlns: "http://www.w3.org/2000/svg",
355
- children: /*#__PURE__*/ jsx("path", {
356
- fillRule: "evenodd",
357
- clipRule: "evenodd",
358
- 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",
359
- fill: "currentColor"
360
- })
361
- })
362
- }),
363
- /*#__PURE__*/ jsx(Tooltip, {
364
- enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
365
- text: "Page has reached Shopify’s 25 section-limit",
366
- position: "bottom",
367
- "data-toolbar-duplicate": true,
368
- "data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
369
- onClick: (e)=>onDuplicate(e),
370
- "aria-hidden": "true",
371
- children: /*#__PURE__*/ jsx("svg", {
372
- width: "16",
373
- height: "16",
374
- viewBox: "0 0 16 16",
375
- fill: "none",
376
- children: /*#__PURE__*/ jsx("path", {
377
- fillRule: "evenodd",
378
- clipRule: "evenodd",
379
- 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",
380
- fill: "currentColor"
381
- })
382
- })
383
- }),
384
- /*#__PURE__*/ jsx("div", {
385
- "data-toolbar-delete": true,
386
- onClick: (e)=>onDelete(e),
387
- "aria-hidden": "true",
388
- children: /*#__PURE__*/ jsx("svg", {
389
- width: "16",
390
- height: "16",
391
- viewBox: "0 0 16 16",
392
- fill: "none",
393
- children: /*#__PURE__*/ jsx("path", {
394
- fillRule: "evenodd",
395
- clipRule: "evenodd",
396
- 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",
397
- fill: "currentColor"
398
- })
399
- })
400
- })
401
- ]
402
- }),
403
- editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(ThemeSectionStatus, {
404
- ...props
405
- }),
406
- /*#__PURE__*/ jsx("div", {
407
- "data-outline": true,
408
- "data-outline-section": props.tag == 'Section',
409
- "data-outline-theme-section": props.tag == 'Section' && !!isThemeSection || isThemeSectionEditor,
410
- "data-outline-limit": getIndexSection() >= SECTION_LIMIT
411
- }),
412
- props.tag == 'Section' && !isThemeSectionEditor && /*#__PURE__*/ jsxs(Fragment, {
413
- children: [
414
- /*#__PURE__*/ jsx(Tooltip, {
415
- enable: getSectionNumber() >= SECTION_LIMIT,
416
- text: "Page has reached Shopify’s 25 section-limit",
417
- position: "top",
418
- "data-toolbar-add-top": true,
419
- "data-toolbar-disable": getSectionNumber() >= SECTION_LIMIT,
420
- "data-toolbar-add-open": activeAddSection == 'above',
421
- onClick: (e)=>onAddSection(e, 'above'),
422
- "aria-hidden": "true",
423
- children: /*#__PURE__*/ jsx("svg", {
424
- width: "16",
425
- height: "16",
426
- viewBox: "0 0 16 16",
427
- fill: "none",
428
- children: /*#__PURE__*/ jsx("path", {
429
- 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",
430
- fill: "#212121"
431
- })
432
- })
433
- }),
434
- /*#__PURE__*/ jsx(Tooltip, {
435
- enable: getSectionNumber() >= SECTION_LIMIT,
436
- text: "Page has reached Shopify’s 25 section-limit",
437
- position: "top",
438
- "data-toolbar-add-bottom": true,
439
- "data-toolbar-disable": getSectionNumber() >= SECTION_LIMIT,
440
- "data-toolbar-add-open": activeAddSection == 'below',
441
- onClick: (e)=>onAddSection(e, 'below'),
442
- "aria-hidden": "true",
443
- children: /*#__PURE__*/ jsx("svg", {
444
- width: "16",
445
- height: "16",
446
- viewBox: "0 0 16 16",
447
- fill: "none",
448
- children: /*#__PURE__*/ jsx("path", {
449
- 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",
450
- fill: "#212121"
451
- })
452
- })
453
- })
454
- ]
455
- }),
456
- /*#__PURE__*/ jsx(Resize, {
457
- ...props
458
- })
459
- ]
460
- });
461
- };
462
-
463
- export { ComponentToolbarPreview };
1
+ import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{memo as i,useState as n,useMemo as l,useCallback as a,useEffect as r}from"react";import"zustand";import{useBuilderPreviewStore as d}from"../contexts/BuilderPreviewContext.js";import{useShopStore as C}from"../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr";import"swr/mutation";import"vanilla-lazyload";import"../hooks/useCartUI.js";import{CreateThemeSection as c}from"./theme-section/CreateThemeSection.js";import{AIContentGenerator as p}from"./ai-generator/AIContentGenerator.js";import{AIGenContentLoading as s}from"./ai-generator/AIGenContentLoading.js";import h from"./toolbar/Tooltip.js";import{ThemeSectionStatusWrapper as u}from"./theme-section/ThemeSectionStatus.js";import{usePostPurchase as m}from"../hooks/useToolbarPostPurchase.js";import b from"./resize/Resize.js";import"../helpers/convert.js";let SECTION_LIMIT=25,notVisible=t=>{let e=getComputedStyle(t).overflow;return"visible"!==e},isSection=t=>{let e=t.getAttribute("data-component-tag");return"Section"===e},ComponentToolbarPreview=i=>{let g=i.isThemeSection,v=C(t=>t.pageType),f=d(t=>t.getParents),w=d(t=>t.getItem("ROOT")),S=d(t=>t.isThemeSectionEditor),[H,V]=n(null),[T,x]=n(!1),[M,Z]=n(!1),[E,P]=n([]),[L,R]=n("top"),[B,j]=n(!1),[y,k]=n({width:"",text:""}),[I,U]=n(!1),A=l(()=>"POST_PURCHASE"===v,[v]),{checkDisableDelete:O,getTooltipText:$,checkDisableDuplicate:z}=m(i.uid,i.tag||""),D=(t,e)=>{let o=E.length,i=t.getBoundingClientRect(),n=e.getBoundingClientRect();return i.top-n.top<36*o},_=(t,e)=>{let o=e||t;if(t&&!isSection(t))return notVisible(t)&&D(e,t)?t:t.parentElement?_(t.parentElement,o):void 0},G=a(()=>{if("Section"==i.tag)return"bottom";let t=document.querySelector('[data-toolbar-active="true"]');if(t){let e=t.getBoundingClientRect();e.top<60?R("bottom"):R("top")}},[i.tag]),N=a(t=>{let e=t.detail;if(e?.componentUid==i.uid){G(),A&&(j(O()),k($()),U(z()));let t=f(i.uid).filter(t=>!("ROOT"===t.uid||"Section"===t.tag&&S||t.editorConfigs?.toolbar?.hide||t.editorConfigs?.component?.noSetting)).slice(0,3);P(t)}else P([]),x(!1)},[i.uid,A,f,O,$,z,S,G]);if(r(()=>(window.addEventListener("editor:active-component",N),()=>{window.removeEventListener("editor:active-component",N)}),[N]),"section"===i.type||i.editorConfigs?.toolbar?.hide)return null;let q=()=>w?.childrens?.length||0,F=()=>"Section"!==i.tag?-1:w?.childrens?.length?w.childrens.findIndex(t=>t==i.uid):-1,J=t=>{if(!E.length)return;let e=t?.target||null,o=e.closest("[data-toolbar-active]");if(!e||!o)return;if(T)Z(!1),x(!1);else{let t=_(o,o);if(t)Z(!0);else{let t=o.getBoundingClientRect();t.top<36*E.length?Z(!0):Z(!1)}x(!0)}let i=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!T}});window.dispatchEvent(i)},K=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:i.uid,isThemeSection:g}});return window.dispatchEvent(e),!1},Q=t=>{if(t.preventDefault(),t.stopPropagation(),q()>=25&&"Section"==i.tag)return!1;let e=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:i.uid,isThemeSection:g}});return window.dispatchEvent(e),!1},W=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:i.uid}});return window.dispatchEvent(e),!1},X=()=>{V(null),window.removeEventListener("editor:close-add-section-popup",X)},Y=(t,e)=>{if(t.preventDefault(),t.stopPropagation(),q()>=25)return!1;let o=t.target;if(o){V(e);let t=o.getBoundingClientRect(),n=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:i.uid,position:e,top:t.top+t.height/2}});window.dispatchEvent(n),window.addEventListener("editor:close-add-section-popup",X)}return!1},tt=()=>{let t=i.name&&i.name===`Section ${i.uid}`;return q()>=20?`${t?"Section":i?.name} ${F()+1}/25`:t?`Section ${F()+1}`:i?.name};return t(e,{children:[!("Section"==i.tag&&S)&&t("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==i.tag,"data-toolbar-theme-section":"Section"==i.tag&&!!g||S,"data-toolbar-limit":F()>=25,children:[t("div",{"data-toolbar-show-parent":!0,onClick:t=>J(t),"aria-hidden":"true",children:[o("div",{"data-toolbar-icon-drag":!0,children:t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[o("path",{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",fill:"currentColor"}),o("path",{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",fill:"currentColor"}),o("path",{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",fill:"currentColor"}),o("path",{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",fill:"currentColor"}),o("path",{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",fill:"currentColor"}),o("path",{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",fill:"currentColor"})]})}),"Section"==i.tag?o("div",{"data-toolbar-name":!0,children:tt()}):o("div",{"data-toolbar-name":!0,children:i.customLabel||i.label}),"Section"!==i.tag&&E.length>0&&o("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":T,children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{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",fill:"currentColor"})})})]}),T&&E.map((e,i)=>{let n=e?.childrens?.length??0,l=e.label;return"Row"===e.label&&(l=n<=1?e.label+" "+n+" col":e.label+" "+n+" cols"),t("div",{"data-toolbar-parent":!0,"data-parent-uid":e.uid,"data-toolbar-theme-section":S,"data-toolbar-parent-revert":M,style:{top:M?`${36*(i+1)}px`:`${-36*(i+1)}px`},children:[o("div",{"data-toolbar-icon-drag":!0,children:t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[o("path",{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",fill:"currentColor"}),o("path",{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",fill:"currentColor"}),o("path",{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",fill:"currentColor"}),o("path",{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",fill:"currentColor"}),o("path",{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",fill:"currentColor"}),o("path",{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",fill:"currentColor"})]})}),o("div",{"data-toolbar-name":!0,children:l})]},e.uid)}),"Section"===i.tag&&!i.isThemeSection&&"STATIC"!==v&&"POST_PURCHASE"!==v&&25>F()&&o(c,{...i}),"Section"===i.tag&&o(p,{...i}),"Sticky"==i.tag&&o("div",{"data-toolbar-zoom-out":!0,onClick:t=>W(t),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",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",fill:"currentColor"})})}),o(h,{enable:"Section"==i.tag&&q()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==i.tag&&q()>=25||I,onClick:I?void 0:t=>Q(t),"aria-hidden":"true",className:I?"!gp-cursor-not-allowed":"",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",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",fill:"currentColor"})})}),o(h,{"data-toolbar-delete":!0,onClick:t=>B?null:K(t),enable:B,"data-toolbar-disable":B,width:y.width,text:y.text,position:L,"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",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",fill:"currentColor"})})})]},i.uid),"STATIC"!==v&&"POST_PURCHASE"!==v&&25>F()&&o(u,{...i}),o("div",{"data-outline":!0,"data-outline-section":"Section"==i.tag,"data-outline-theme-section":"Section"==i.tag&&!!g||S,"data-outline-limit":F()>=25},"outline-"+i.uid),"Section"==i.tag&&!S&&t(e,{children:[o(h,{enable:q()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":q()>=25,"data-toolbar-add-open":"above"==H,onClick:t=>Y(t,"above"),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{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",fill:"#212121"})})}),o(h,{enable:q()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":q()>=25,"data-toolbar-add-open":"below"==H,onClick:t=>Y(t,"below"),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{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",fill:"#212121"})})})]}),"Section"===i.tag&&o(s,{...i}),o(b,{...i})]})};var ComponentToolbarPreview$1=i(ComponentToolbarPreview);export{ComponentToolbarPreview$1 as default};
@@ -1,42 +1 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { isValidElement } from 'react';
3
- import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
4
- import { disableWrap } from './constant.js';
5
- import RenderCustomCode from './RenderCustomCode.js';
6
-
7
- const ComponentWrapper = ({ children, ...props })=>{
8
- if (props.type === 'section') return null;
9
- const style = composeAdvanceStyle(props.advanced, props.tag);
10
- const advanced = props.advanced;
11
- if (disableWrap.includes(props.tag) && /*#__PURE__*/ isValidElement(children)) {
12
- return /*#__PURE__*/ jsxs(Fragment, {
13
- children: [
14
- /*#__PURE__*/ jsx(RenderCustomCode, {
15
- uid: props.uid,
16
- advanced: advanced
17
- }),
18
- /*#__PURE__*/ jsx(children.type, {
19
- className: advanced?.cssClass,
20
- ...children.props,
21
- style,
22
- advanced
23
- })
24
- ]
25
- });
26
- }
27
- return /*#__PURE__*/ jsxs(Fragment, {
28
- children: [
29
- /*#__PURE__*/ jsx(RenderCustomCode, {
30
- uid: props.uid,
31
- advanced: advanced
32
- }),
33
- /*#__PURE__*/ jsx("div", {
34
- style: style,
35
- className: `${props.uid} ${advanced?.cssClass}`,
36
- children: children
37
- })
38
- ]
39
- });
40
- };
41
-
42
- export { ComponentWrapper as default };
1
+ import{jsxs as e,Fragment as t,jsx as a}from"react/jsx-runtime";import{isValidElement as r}from"react";import{composeAdvanceStyle as s}from"../helpers/compose-advance-style.js";import{disableWrap as n}from"./constant.js";import o from"./RenderCustomCode.js";import i from"./animation/AnimationWrapper.js";let ComponentWrapper=({children:d,pageType:m,...p})=>{if("section"===p.type)return null;let l=s(p.advanced,p.tag,m),c=p.advanced,{animation:u}=c??{},f=u?.desktop?.enabled||u?.tablet?.enabled||u?.mobile?.enabled,C=a("div",{style:l,className:`${p.uid} ${c?.cssClass}`,children:d});return n.includes(p.tag)&&r(d)&&(C=a(d.type,{className:c?.cssClass,...d.props,style:l,advanced:c})),f&&(C=a(i,{children:C,settings:u,tag:p.tag})),e(t,{children:[a(o,{uid:p.uid,advanced:c}),C]})};export{ComponentWrapper as default};