@gem-sdk/core 3.0.0-pre-production.15 → 3.0.6

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 (413) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/components/AddOn.js +2 -18
  3. package/dist/cjs/components/ComponentAnimation.js +2 -17
  4. package/dist/cjs/components/ComponentToolbarPreview.js +2 -752
  5. package/dist/cjs/components/ComponentWrapper.js +2 -61
  6. package/dist/cjs/components/ComponentWrapperPreview.js +2 -213
  7. package/dist/cjs/components/Empty.js +2 -7
  8. package/dist/cjs/components/InteractionSuffix.js +2 -42
  9. package/dist/cjs/components/Render.js +2 -75
  10. package/dist/cjs/components/Render.liquid.js +16 -307
  11. package/dist/cjs/components/RenderBlock.js +2 -54
  12. package/dist/cjs/components/RenderCustomCode.js +4 -59
  13. package/dist/cjs/components/RenderPreview.js +2 -67
  14. package/dist/cjs/components/RenderSection.js +2 -23
  15. package/dist/cjs/components/ai-generator/AIContentGenerator.js +2 -252
  16. package/dist/cjs/components/ai-generator/AIGenContentLoading.js +2 -85
  17. package/dist/cjs/components/ai-generator/components/PickProduct.js +2 -220
  18. package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +2 -77
  19. package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +1 -47
  20. package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +1 -110
  21. package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -37
  22. package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +1 -70
  23. package/dist/cjs/components/ai-generator/icons/AIIcon.js +2 -67
  24. package/dist/cjs/components/ai-generator/icons/CloseIcon.js +2 -19
  25. package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +2 -37
  26. package/dist/cjs/components/ai-generator/icons/SearchIcon.js +2 -21
  27. package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +2 -21
  28. package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +2 -27
  29. package/dist/cjs/components/ai-generator/icons/WarningIcon.js +2 -31
  30. package/dist/cjs/components/constant.js +1 -82
  31. package/dist/cjs/components/resize/Resize.js +2 -16
  32. package/dist/cjs/components/resize/Spacing.js +2 -260
  33. package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -56
  34. package/dist/cjs/components/theme-section/CreateThemeSection.js +2 -123
  35. package/dist/cjs/components/theme-section/ThemeSectionStatus.js +2 -45
  36. package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +2 -126
  37. package/dist/cjs/components/toolbar/Tooltip.js +2 -28
  38. package/dist/cjs/constants/device.js +1 -0
  39. package/dist/cjs/contexts/AddonContext.js +2 -36
  40. package/dist/cjs/contexts/ArticleContext.js +2 -39
  41. package/dist/cjs/contexts/ArticleListContext.js +2 -31
  42. package/dist/cjs/contexts/BuilderComponent.js +2 -34
  43. package/dist/cjs/contexts/BuilderContext.js +2 -39
  44. package/dist/cjs/contexts/BuilderPreviewContext.js +2 -482
  45. package/dist/cjs/contexts/CartLineContext.js +2 -29
  46. package/dist/cjs/contexts/CollectionContext.js +2 -38
  47. package/dist/cjs/contexts/I18nContext.js +2 -0
  48. package/dist/cjs/contexts/ModalContext.js +2 -47
  49. package/dist/cjs/contexts/PageContext.js +2 -111
  50. package/dist/cjs/contexts/ProductContext.js +2 -182
  51. package/dist/cjs/contexts/ProductListContext.js +2 -32
  52. package/dist/cjs/contexts/SectionContext.js +2 -53
  53. package/dist/cjs/contexts/ShopContext.js +2 -107
  54. package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
  55. package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
  56. package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
  57. package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
  58. package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
  59. package/dist/cjs/graphql/fragments/custom-font.generated.js +7 -7
  60. package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
  61. package/dist/cjs/graphql/fragments/media.generated.js +2 -6
  62. package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +6 -6
  63. package/dist/cjs/graphql/fragments/product-little.generated.js +2 -6
  64. package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
  65. package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
  66. package/dist/cjs/graphql/fragments/product.generated.js +2 -6
  67. package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
  68. package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
  69. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +4 -18
  70. package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
  71. package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
  72. package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
  73. package/dist/cjs/graphql/mutations/page-view-up.generated.js +2 -6
  74. package/dist/cjs/graphql/queries/articles.generated.js +2 -6
  75. package/dist/cjs/graphql/queries/blogs.generated.js +2 -6
  76. package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
  77. package/dist/cjs/graphql/queries/collection.generated.js +2 -14
  78. package/dist/cjs/graphql/queries/collections.generated.js +2 -9
  79. package/dist/cjs/graphql/queries/preview-page.generated.js +2 -12
  80. package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
  81. package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
  82. package/dist/cjs/graphql/queries/product-value-label.generated.js +2 -6
  83. package/dist/cjs/graphql/queries/product-variants.generated.js +3 -11
  84. package/dist/cjs/graphql/queries/products.generated.js +3 -17
  85. package/dist/cjs/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -6
  86. package/dist/cjs/graphql/queries/published-theme-pages.generated.js +3 -19
  87. package/dist/cjs/graphql/queries/shop-shopify.generated.js +2 -6
  88. package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
  89. package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -6
  90. package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +2 -6
  91. package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -6
  92. package/dist/cjs/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -6
  93. package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -6
  94. package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +2 -6
  95. package/dist/cjs/helpers/GlobalEvent.js +1 -19
  96. package/dist/cjs/helpers/align.js +1 -37
  97. package/dist/cjs/helpers/animations.js +1 -222
  98. package/dist/cjs/helpers/background.js +1 -236
  99. package/dist/cjs/helpers/backgroundImage.js +1 -0
  100. package/dist/cjs/helpers/borders.js +4 -198
  101. package/dist/cjs/helpers/carousel.js +1 -55
  102. package/dist/cjs/helpers/clone-deep.js +1 -5
  103. package/dist/cjs/helpers/cls.js +1 -16
  104. package/dist/cjs/helpers/colors.js +1 -184
  105. package/dist/cjs/helpers/compose-advance-style.js +1 -323
  106. package/dist/cjs/helpers/composeClasses.js +1 -0
  107. package/dist/cjs/helpers/const.js +1 -0
  108. package/dist/cjs/helpers/constant.js +1 -23
  109. package/dist/cjs/helpers/convert.js +1 -7
  110. package/dist/cjs/helpers/covert-entities-html.js +1 -19
  111. package/dist/cjs/helpers/css-variable.js +1 -7
  112. package/dist/cjs/helpers/email.js +1 -11
  113. package/dist/cjs/helpers/filter-styles.js +1 -0
  114. package/dist/cjs/helpers/filter-toolbar-preview.js +2 -14
  115. package/dist/cjs/helpers/flatten-connection.js +1 -9
  116. package/dist/cjs/helpers/get-resonsive-value.js +1 -36
  117. package/dist/cjs/helpers/get-shortname.js +1 -92
  118. package/dist/cjs/helpers/icon-list.js +1 -61
  119. package/dist/cjs/helpers/interaction/index.js +2 -134
  120. package/dist/cjs/helpers/is-browser.js +1 -9
  121. package/dist/cjs/helpers/is-defined.js +1 -7
  122. package/dist/cjs/helpers/is-empty-children.js +2 -15
  123. package/dist/cjs/helpers/is-safari.js +1 -9
  124. package/dist/cjs/helpers/layout.js +1 -76
  125. package/dist/cjs/helpers/load-script.js +1 -31
  126. package/dist/cjs/helpers/loop-component.js +1 -16
  127. package/dist/cjs/helpers/make-style.js +1 -163
  128. package/dist/cjs/helpers/normalize-builder-data.js +1 -23
  129. package/dist/cjs/helpers/pascal-to-kebab-case.js +1 -7
  130. package/dist/cjs/helpers/prefetch-queries.js +1 -78
  131. package/dist/cjs/helpers/product.js +1 -48
  132. package/dist/cjs/helpers/queries/get-collection.js +1 -226
  133. package/dist/cjs/helpers/queries/get-collections.js +1 -21
  134. package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
  135. package/dist/cjs/helpers/queries/get-product.js +1 -154
  136. package/dist/cjs/helpers/queries/get-products.js +1 -214
  137. package/dist/cjs/helpers/query.js +1 -29
  138. package/dist/cjs/helpers/radius.js +6 -140
  139. package/dist/cjs/helpers/render.js +1 -91
  140. package/dist/cjs/helpers/shadow.js +1 -69
  141. package/dist/cjs/helpers/size.js +4 -228
  142. package/dist/cjs/helpers/spacing.js +1 -43
  143. package/dist/cjs/helpers/third-party/addAppBlockId.js +1 -20
  144. package/dist/cjs/helpers/third-party/appConfig.js +1 -416
  145. package/dist/cjs/helpers/third-party/appSetting.js +1 -1324
  146. package/dist/cjs/helpers/third-party/composeAppBlockId.js +1 -11
  147. package/dist/cjs/helpers/third-party/constant.js +1 -69
  148. package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +1 -34
  149. package/dist/cjs/helpers/third-party/getAppBlockConfig.js +1 -55
  150. package/dist/cjs/helpers/third-party/getAppBlockType.js +1 -12
  151. package/dist/cjs/helpers/third-party/getAppBlocks.js +1 -30
  152. package/dist/cjs/helpers/third-party/mergeBlock.js +1 -19
  153. package/dist/cjs/helpers/third-party/mergeBlockOrder.js +1 -47
  154. package/dist/cjs/helpers/third-party/removeGPAppItems.js +1 -18
  155. package/dist/cjs/helpers/tracking/fpixel.js +1 -28
  156. package/dist/cjs/helpers/tracking/gtag.js +1 -93
  157. package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
  158. package/dist/cjs/helpers/typography.js +19 -160
  159. package/dist/cjs/helpers/variant.js +1 -11
  160. package/dist/cjs/hooks/animation/useAnimationActions.js +2 -39
  161. package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -30
  162. package/dist/cjs/hooks/animation/useAnimationPreview.js +2 -31
  163. package/dist/cjs/hooks/animation/useAnimationTarget.js +2 -122
  164. package/dist/cjs/hooks/animation/useApplyAnimation.js +2 -89
  165. package/dist/cjs/hooks/articles/useArticlesQuery.js +2 -33
  166. package/dist/cjs/hooks/cart/use-add-to-cart.js +2 -20
  167. package/dist/cjs/hooks/cart/use-cart-data.js +2 -28
  168. package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +2 -20
  169. package/dist/cjs/hooks/cart/use-cart-note-update.js +2 -20
  170. package/dist/cjs/hooks/cart/use-create-cart.js +2 -22
  171. package/dist/cjs/hooks/cart/use-remove-cart-item.js +2 -20
  172. package/dist/cjs/hooks/cart/use-update-cart-item.js +2 -20
  173. package/dist/cjs/hooks/shop/use-collection-query.js +2 -22
  174. package/dist/cjs/hooks/shop/use-collections-query.js +2 -17
  175. package/dist/cjs/hooks/shop/use-product-query.js +2 -22
  176. package/dist/cjs/hooks/shop/use-products-query.js +2 -63
  177. package/dist/cjs/hooks/shop/useShopifyLink.js +2 -0
  178. package/dist/cjs/hooks/shop.js +2 -135
  179. package/dist/cjs/hooks/use-current-device.js +2 -30
  180. package/dist/cjs/hooks/use-lazy-video.js +2 -15
  181. package/dist/cjs/hooks/useAnimations.js +2 -29
  182. package/dist/cjs/hooks/useCartId.js +2 -44
  183. package/dist/cjs/hooks/useCartLine.js +2 -11
  184. package/dist/cjs/hooks/useCartUI.js +2 -48
  185. package/dist/cjs/hooks/useCollection.js +2 -9
  186. package/dist/cjs/hooks/useFetchHandle.js +2 -13
  187. package/dist/cjs/hooks/useFormatMoney.js +2 -75
  188. package/dist/cjs/hooks/useI18n.js +2 -0
  189. package/dist/cjs/hooks/useInitialSwatchesOptions.js +2 -127
  190. package/dist/cjs/hooks/useInteraction.js +2 -19
  191. package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +2 -10
  192. package/dist/cjs/hooks/useLoadScript.js +2 -32
  193. package/dist/cjs/hooks/useMoney.js +2 -84
  194. package/dist/cjs/hooks/usePrevious.js +2 -19
  195. package/dist/cjs/hooks/useProduct.js +2 -250
  196. package/dist/cjs/hooks/useProductList.js +2 -21
  197. package/dist/cjs/hooks/useStickyStore.js +1 -0
  198. package/dist/cjs/hooks/useSuspenseFetch.js +2 -27
  199. package/dist/cjs/hooks/useSwatchesOptions.js +2 -41
  200. package/dist/cjs/hooks/useToolbarPostPurchase.js +2 -89
  201. package/dist/cjs/index.js +1 -425
  202. package/dist/cjs/types/animations.js +1 -49
  203. package/dist/cjs/types/appAPI.js +1 -2
  204. package/dist/cjs/types/custom.js +1 -52
  205. package/dist/cjs/types/global-style.js +1 -15
  206. package/dist/cjs/types/shop.js +1 -2
  207. package/dist/esm/components/AddOn.js +2 -14
  208. package/dist/esm/components/ComponentAnimation.js +2 -13
  209. package/dist/esm/components/ComponentToolbarPreview.js +2 -748
  210. package/dist/esm/components/ComponentWrapper.js +2 -57
  211. package/dist/esm/components/ComponentWrapperPreview.js +2 -209
  212. package/dist/esm/components/Empty.js +2 -3
  213. package/dist/esm/components/InteractionSuffix.js +2 -40
  214. package/dist/esm/components/Render.js +2 -71
  215. package/dist/esm/components/Render.liquid.js +16 -301
  216. package/dist/esm/components/RenderBlock.js +2 -50
  217. package/dist/esm/components/RenderCustomCode.js +4 -55
  218. package/dist/esm/components/RenderPreview.js +2 -63
  219. package/dist/esm/components/RenderSection.js +2 -19
  220. package/dist/esm/components/ai-generator/AIContentGenerator.js +2 -250
  221. package/dist/esm/components/ai-generator/AIGenContentLoading.js +2 -83
  222. package/dist/esm/components/ai-generator/components/PickProduct.js +2 -218
  223. package/dist/esm/components/ai-generator/components/ToneAndVoice.js +2 -75
  224. package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +1 -45
  225. package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +1 -108
  226. package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -35
  227. package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +1 -68
  228. package/dist/esm/components/ai-generator/icons/AIIcon.js +2 -65
  229. package/dist/esm/components/ai-generator/icons/CloseIcon.js +2 -17
  230. package/dist/esm/components/ai-generator/icons/DropdownIcon.js +2 -34
  231. package/dist/esm/components/ai-generator/icons/SearchIcon.js +2 -19
  232. package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +2 -19
  233. package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +2 -25
  234. package/dist/esm/components/ai-generator/icons/WarningIcon.js +2 -29
  235. package/dist/esm/components/constant.js +1 -75
  236. package/dist/esm/components/resize/Resize.js +2 -12
  237. package/dist/esm/components/resize/Spacing.js +2 -256
  238. package/dist/esm/components/src/product/helpers/variant-presets.js +1 -54
  239. package/dist/esm/components/theme-section/CreateThemeSection.js +2 -121
  240. package/dist/esm/components/theme-section/ThemeSectionStatus.js +2 -43
  241. package/dist/esm/components/theme-section/ThemeSectionTooltip.js +2 -124
  242. package/dist/esm/components/toolbar/Tooltip.js +2 -24
  243. package/dist/esm/constants/device.js +1 -0
  244. package/dist/esm/contexts/AddonContext.js +2 -32
  245. package/dist/esm/contexts/ArticleContext.js +2 -36
  246. package/dist/esm/contexts/ArticleListContext.js +2 -27
  247. package/dist/esm/contexts/BuilderComponent.js +2 -31
  248. package/dist/esm/contexts/BuilderContext.js +2 -36
  249. package/dist/esm/contexts/BuilderPreviewContext.js +2 -479
  250. package/dist/esm/contexts/CartLineContext.js +2 -26
  251. package/dist/esm/contexts/CollectionContext.js +2 -35
  252. package/dist/esm/contexts/I18nContext.js +2 -0
  253. package/dist/esm/contexts/ModalContext.js +2 -44
  254. package/dist/esm/contexts/PageContext.js +2 -108
  255. package/dist/esm/contexts/ProductContext.js +2 -179
  256. package/dist/esm/contexts/ProductListContext.js +2 -28
  257. package/dist/esm/contexts/SectionContext.js +2 -49
  258. package/dist/esm/contexts/ShopContext.js +2 -104
  259. package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
  260. package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
  261. package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
  262. package/dist/esm/graphql/fragments/collection.generated.js +2 -4
  263. package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
  264. package/dist/esm/graphql/fragments/custom-font.generated.js +7 -5
  265. package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
  266. package/dist/esm/graphql/fragments/media.generated.js +2 -4
  267. package/dist/esm/graphql/fragments/preview-theme-page.generated.js +6 -4
  268. package/dist/esm/graphql/fragments/product-little.generated.js +2 -4
  269. package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
  270. package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
  271. package/dist/esm/graphql/fragments/product.generated.js +2 -4
  272. package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
  273. package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
  274. package/dist/esm/graphql/fragments/published-theme-page.generated.js +4 -16
  275. package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
  276. package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
  277. package/dist/esm/graphql/fragments/variant.generated.js +2 -4
  278. package/dist/esm/graphql/mutations/page-view-up.generated.js +2 -4
  279. package/dist/esm/graphql/queries/articles.generated.js +2 -4
  280. package/dist/esm/graphql/queries/blogs.generated.js +2 -4
  281. package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
  282. package/dist/esm/graphql/queries/collection.generated.js +8 -18
  283. package/dist/esm/graphql/queries/collections.generated.js +3 -8
  284. package/dist/esm/graphql/queries/preview-page.generated.js +6 -14
  285. package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
  286. package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
  287. package/dist/esm/graphql/queries/product-value-label.generated.js +2 -4
  288. package/dist/esm/graphql/queries/product-variants.generated.js +5 -11
  289. package/dist/esm/graphql/queries/products.generated.js +9 -20
  290. package/dist/esm/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -4
  291. package/dist/esm/graphql/queries/published-theme-pages.generated.js +6 -20
  292. package/dist/esm/graphql/queries/shop-shopify.generated.js +2 -4
  293. package/dist/esm/graphql/queries/store-property.generated.js +2 -4
  294. package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -4
  295. package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +2 -4
  296. package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -4
  297. package/dist/esm/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -4
  298. package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -4
  299. package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +2 -4
  300. package/dist/esm/helpers/GlobalEvent.js +1 -15
  301. package/dist/esm/helpers/align.js +1 -34
  302. package/dist/esm/helpers/animations.js +1 -220
  303. package/dist/esm/helpers/background.js +1 -227
  304. package/dist/esm/helpers/backgroundImage.js +1 -0
  305. package/dist/esm/helpers/borders.js +4 -189
  306. package/dist/esm/helpers/carousel.js +1 -51
  307. package/dist/esm/helpers/clone-deep.js +1 -3
  308. package/dist/esm/helpers/cls.js +1 -14
  309. package/dist/esm/helpers/colors.js +1 -169
  310. package/dist/esm/helpers/compose-advance-style.js +1 -315
  311. package/dist/esm/helpers/composeClasses.js +1 -0
  312. package/dist/esm/helpers/const.js +1 -0
  313. package/dist/esm/helpers/constant.js +1 -19
  314. package/dist/esm/helpers/convert.js +1 -4
  315. package/dist/esm/helpers/covert-entities-html.js +1 -17
  316. package/dist/esm/helpers/css-variable.js +1 -5
  317. package/dist/esm/helpers/email.js +1 -6
  318. package/dist/esm/helpers/filter-styles.js +1 -0
  319. package/dist/esm/helpers/filter-toolbar-preview.js +2 -9
  320. package/dist/esm/helpers/flatten-connection.js +1 -7
  321. package/dist/esm/helpers/get-resonsive-value.js +1 -31
  322. package/dist/esm/helpers/get-shortname.js +1 -90
  323. package/dist/esm/helpers/icon-list.js +1 -58
  324. package/dist/esm/helpers/interaction/index.js +2 -132
  325. package/dist/esm/helpers/is-browser.js +1 -5
  326. package/dist/esm/helpers/is-defined.js +1 -5
  327. package/dist/esm/helpers/is-empty-children.js +2 -10
  328. package/dist/esm/helpers/is-safari.js +1 -5
  329. package/dist/esm/helpers/layout.js +1 -70
  330. package/dist/esm/helpers/load-script.js +1 -29
  331. package/dist/esm/helpers/loop-component.js +1 -14
  332. package/dist/esm/helpers/make-style.js +1 -149
  333. package/dist/esm/helpers/normalize-builder-data.js +1 -21
  334. package/dist/esm/helpers/pascal-to-kebab-case.js +1 -5
  335. package/dist/esm/helpers/prefetch-queries.js +1 -76
  336. package/dist/esm/helpers/product.js +1 -44
  337. package/dist/esm/helpers/queries/get-collection.js +1 -223
  338. package/dist/esm/helpers/queries/get-collections.js +1 -19
  339. package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
  340. package/dist/esm/helpers/queries/get-product.js +1 -150
  341. package/dist/esm/helpers/queries/get-products.js +1 -210
  342. package/dist/esm/helpers/query.js +1 -25
  343. package/dist/esm/helpers/radius.js +6 -132
  344. package/dist/esm/helpers/render.js +1 -82
  345. package/dist/esm/helpers/shadow.js +1 -63
  346. package/dist/esm/helpers/size.js +4 -213
  347. package/dist/esm/helpers/spacing.js +1 -40
  348. package/dist/esm/helpers/third-party/addAppBlockId.js +1 -18
  349. package/dist/esm/helpers/third-party/appConfig.js +1 -356
  350. package/dist/esm/helpers/third-party/appSetting.js +1 -1321
  351. package/dist/esm/helpers/third-party/composeAppBlockId.js +1 -9
  352. package/dist/esm/helpers/third-party/constant.js +1 -66
  353. package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +1 -32
  354. package/dist/esm/helpers/third-party/getAppBlockConfig.js +1 -53
  355. package/dist/esm/helpers/third-party/getAppBlockType.js +1 -10
  356. package/dist/esm/helpers/third-party/getAppBlocks.js +1 -28
  357. package/dist/esm/helpers/third-party/mergeBlock.js +1 -17
  358. package/dist/esm/helpers/third-party/mergeBlockOrder.js +1 -45
  359. package/dist/esm/helpers/third-party/removeGPAppItems.js +1 -15
  360. package/dist/esm/helpers/tracking/fpixel.js +1 -24
  361. package/dist/esm/helpers/tracking/gtag.js +1 -87
  362. package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
  363. package/dist/esm/helpers/typography.js +19 -149
  364. package/dist/esm/helpers/variant.js +1 -9
  365. package/dist/esm/hooks/animation/useAnimationActions.js +2 -37
  366. package/dist/esm/hooks/animation/useAnimationConfig.js +2 -28
  367. package/dist/esm/hooks/animation/useAnimationPreview.js +2 -29
  368. package/dist/esm/hooks/animation/useAnimationTarget.js +2 -120
  369. package/dist/esm/hooks/animation/useApplyAnimation.js +2 -85
  370. package/dist/esm/hooks/articles/useArticlesQuery.js +2 -30
  371. package/dist/esm/hooks/cart/use-add-to-cart.js +2 -18
  372. package/dist/esm/hooks/cart/use-cart-data.js +2 -26
  373. package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +2 -18
  374. package/dist/esm/hooks/cart/use-cart-note-update.js +2 -18
  375. package/dist/esm/hooks/cart/use-create-cart.js +2 -20
  376. package/dist/esm/hooks/cart/use-remove-cart-item.js +2 -18
  377. package/dist/esm/hooks/cart/use-update-cart-item.js +2 -18
  378. package/dist/esm/hooks/shop/use-collection-query.js +2 -20
  379. package/dist/esm/hooks/shop/use-collections-query.js +2 -15
  380. package/dist/esm/hooks/shop/use-product-query.js +2 -20
  381. package/dist/esm/hooks/shop/use-products-query.js +2 -59
  382. package/dist/esm/hooks/shop/useShopifyLink.js +2 -0
  383. package/dist/esm/hooks/shop.js +2 -119
  384. package/dist/esm/hooks/use-current-device.js +2 -28
  385. package/dist/esm/hooks/use-lazy-video.js +2 -13
  386. package/dist/esm/hooks/useAnimations.js +2 -27
  387. package/dist/esm/hooks/useCartId.js +2 -40
  388. package/dist/esm/hooks/useCartLine.js +2 -7
  389. package/dist/esm/hooks/useCartUI.js +2 -44
  390. package/dist/esm/hooks/useCollection.js +2 -7
  391. package/dist/esm/hooks/useFetchHandle.js +2 -11
  392. package/dist/esm/hooks/useFormatMoney.js +2 -71
  393. package/dist/esm/hooks/useI18n.js +2 -0
  394. package/dist/esm/hooks/useInitialSwatchesOptions.js +2 -123
  395. package/dist/esm/hooks/useInteraction.js +2 -17
  396. package/dist/esm/hooks/useIsomorphicLayoutEffect.js +2 -6
  397. package/dist/esm/hooks/useLoadScript.js +2 -28
  398. package/dist/esm/hooks/useMoney.js +2 -80
  399. package/dist/esm/hooks/usePrevious.js +2 -17
  400. package/dist/esm/hooks/useProduct.js +2 -233
  401. package/dist/esm/hooks/useProductList.js +2 -16
  402. package/dist/esm/hooks/useStickyStore.js +1 -0
  403. package/dist/esm/hooks/useSuspenseFetch.js +2 -23
  404. package/dist/esm/hooks/useSwatchesOptions.js +2 -37
  405. package/dist/esm/hooks/useToolbarPostPurchase.js +2 -87
  406. package/dist/esm/index.js +1 -119
  407. package/dist/esm/types/animations.js +1 -49
  408. package/dist/esm/types/custom.js +1 -52
  409. package/dist/esm/types/global-style.js +1 -12
  410. package/dist/types/index.d.ts +12025 -8969
  411. package/package.json +6 -6
  412. package/dist/cjs/web-components/src/helpers/styles/constant.js +0 -9
  413. package/dist/esm/web-components/src/helpers/styles/constant.js +0 -7
@@ -1,210 +1 @@
1
- import { ProductsDocument } from '../../graphql/queries/products.generated.js';
2
- import { calculateFirstProduct } from './get-collection.js';
3
- import { fetchVariants, fetchMedias } from './get-product.js';
4
-
5
- const getProducts = async (fetcher, { ids, isSample, isStorefront, defaultSelectedProductCount, allStatus })=>{
6
- const products = await loopFetchProducts(fetcher, {
7
- ids,
8
- isSample,
9
- isStorefront,
10
- defaultSelectedProductCount,
11
- allStatus
12
- });
13
- if (!products) {
14
- throw new Error('Product not found');
15
- }
16
- const [mergedVariant, mergedMedias] = await Promise.all([
17
- mergeVariantsToProducts({
18
- fetcher,
19
- products,
20
- isSample,
21
- isStorefront
22
- }),
23
- mergeMediasToProducts({
24
- fetcher,
25
- products,
26
- isSample,
27
- isStorefront
28
- })
29
- ]);
30
- return {
31
- ...products,
32
- products: {
33
- ...products.products,
34
- edges: products.products?.edges.map((edge)=>{
35
- const medias = mergedMedias.find((item)=>item.productId === edge.node?.baseID);
36
- const variants = mergedVariant.find((item)=>item.productId === edge.node?.baseID);
37
- if (edge.node) {
38
- return {
39
- ...edge,
40
- node: {
41
- ...edge.node,
42
- variants: {
43
- ...edge.node?.variants,
44
- edges: variants?.items ?? []
45
- },
46
- medias: {
47
- ...edge.node?.medias,
48
- edges: medias?.items ?? []
49
- }
50
- }
51
- };
52
- }
53
- return edge;
54
- }) ?? []
55
- }
56
- };
57
- };
58
- const getProductQueryAll = async (fetcher, arg)=>{
59
- const limit = arg?.limit || 4;
60
- delete arg.limit;
61
- const variables = {
62
- first: limit,
63
- firstMedia: 1,
64
- firstVariant: 1,
65
- orderBy: {
66
- field: 'PLATFORM_CREATED_AT',
67
- direction: 'DESC'
68
- },
69
- orderByMedia: {
70
- field: 'POSITION',
71
- direction: 'ASC'
72
- },
73
- where: {
74
- status: 'ACTIVE',
75
- ...arg
76
- }
77
- };
78
- const pageData = await fetchProducts(fetcher, variables);
79
- return pageData;
80
- };
81
- const getListProductByVariables = async (fetcher, arg)=>{
82
- const variables = {
83
- first: arg.first || 8,
84
- firstMedia: 1,
85
- firstVariant: 1,
86
- orderBy: {
87
- field: 'PLATFORM_CREATED_AT',
88
- direction: 'DESC'
89
- },
90
- orderByMedia: {
91
- field: 'POSITION',
92
- direction: 'ASC'
93
- },
94
- where: {
95
- status: 'ACTIVE',
96
- ...arg.where
97
- },
98
- after: arg.after
99
- };
100
- const pageData = await fetchProducts(fetcher, variables);
101
- return pageData;
102
- };
103
- const fetchProducts = async (fetcher, variables)=>{
104
- return fetcher([
105
- ProductsDocument,
106
- variables
107
- ]);
108
- };
109
- const loopFetchProducts = async (fetcher, { ids, isSample, isStorefront, defaultSelectedProductCount, allStatus })=>{
110
- const defaultNumberOfProducts = defaultSelectedProductCount || 4;
111
- const numberOfProducts = (ids?.length == 0 ? defaultNumberOfProducts : ids?.length) ?? defaultNumberOfProducts;
112
- const productsPerPage = 8; // number of products per page
113
- let variables; // variables of collection query
114
- let productAfterFetcher; // product after of collection query
115
- let dataProducts; // data of collection query
116
- let hasNextPage; //
117
- let firstProducts;
118
- let currentPage = 1;
119
- // counter number of queries
120
- const pages = Math.ceil(numberOfProducts / productsPerPage);
121
- while(currentPage <= pages && hasNextPage !== false){
122
- const status = allStatus ? {} : {
123
- status: 'ACTIVE'
124
- };
125
- variables = {
126
- first: calculateFirstProduct(numberOfProducts, currentPage, productsPerPage),
127
- firstMedia: 1,
128
- firstVariant: 1,
129
- orderBy: {
130
- field: 'PLATFORM_CREATED_AT',
131
- direction: 'DESC'
132
- },
133
- orderByMedia: {
134
- field: 'POSITION',
135
- direction: 'ASC'
136
- },
137
- where: {
138
- ...status,
139
- isSample,
140
- ...isStorefront && {
141
- isStorefront
142
- },
143
- ...ids?.length ? {
144
- baseIDIn: ids
145
- } : {}
146
- },
147
- after: productAfterFetcher
148
- };
149
- const pageData = await fetchProducts(fetcher, variables);
150
- productAfterFetcher = pageData?.products?.pageInfo?.endCursor;
151
- if (currentPage === 1) {
152
- dataProducts = pageData; // set data of first page
153
- firstProducts = pageData;
154
- } else if (firstProducts?.products && pageData?.products?.edges.length) {
155
- // concat new values to the old ones
156
- firstProducts.products = {
157
- edges: firstProducts.products.edges.concat(pageData?.products?.edges),
158
- pageInfo: pageData?.products?.pageInfo
159
- };
160
- }
161
- currentPage++;
162
- // hasNextPage = false if there is no more pages then break the loop
163
- if (!firstProducts) {
164
- hasNextPage = false;
165
- break;
166
- }
167
- }
168
- return dataProducts;
169
- };
170
- const mergeVariantsToProducts = async ({ fetcher, products, isSample, isStorefront })=>{
171
- const productsWithVariants = await Promise.all(products?.products?.edges?.map(async (product)=>{
172
- const variants = await fetchVariants(fetcher, {
173
- id: product?.node?.baseID,
174
- isSample,
175
- isStorefront
176
- });
177
- return {
178
- productId: product?.node?.baseID,
179
- items: variants
180
- };
181
- }) ?? []);
182
- return productsWithVariants;
183
- };
184
- const mergeMediasToProducts = async ({ fetcher, products, isSample, isStorefront })=>{
185
- const productsWithMedias = await Promise.all(products?.products?.edges?.map(async (product)=>{
186
- const medias = await fetchMedias(fetcher, {
187
- id: product?.node?.baseID,
188
- isSample,
189
- isStorefront
190
- });
191
- return {
192
- productId: product?.node?.baseID,
193
- items: medias
194
- };
195
- }) ?? []);
196
- return productsWithMedias;
197
- }; // future can be used for fetching products with paging ids
198
- // const pagingQuery = (
199
- // data: string[],
200
- // currentPage: number,
201
- // productsPerPage: number,
202
- // first: number,
203
- // ): string[] => {
204
- // return data.slice(
205
- // (currentPage - 1) * productsPerPage,
206
- // (currentPage - 1) * productsPerPage + first,
207
- // );
208
- // };
209
-
210
- export { getListProductByVariables, getProductQueryAll, getProducts };
1
+ import{ProductsDocument as e}from"../../graphql/queries/products.generated.js";import{calculateFirstProduct as t}from"./get-collection.js";import{fetchVariants as r,fetchMedias as d}from"./get-product.js";let getProducts=async(e,{ids:t,isSample:r,isStorefront:d,defaultSelectedProductCount:s,allStatus:o})=>{let a=await loopFetchProducts(e,{ids:t,isSample:r,isStorefront:d,defaultSelectedProductCount:s,allStatus:o});if(!a)throw Error("Product not found");let[i,c]=await Promise.all([mergeVariantsToProducts({fetcher:e,products:a,isSample:r,isStorefront:d}),mergeMediasToProducts({fetcher:e,products:a,isSample:r,isStorefront:d})]);return{...a,products:{...a.products,edges:a.products?.edges.map(e=>{let t=c.find(t=>t.productId===e.node?.baseID),r=i.find(t=>t.productId===e.node?.baseID);return e.node?{...e,node:{...e.node,variants:{...e.node?.variants,edges:r?.items??[]},medias:{...e.node?.medias,edges:t?.items??[]}}}:e})??[]}}},getProductQueryAll=async(e,t)=>{let r=t?.limit||4;delete t.limit;let d={first:r,firstMedia:1,firstVariant:1,orderBy:{field:"PLATFORM_CREATED_AT",direction:"DESC"},orderByMedia:{field:"POSITION",direction:"ASC"},where:{status:"ACTIVE",...t}},s=await fetchProducts(e,d);return s},getListProductByVariables=async(e,t)=>{let r={first:t.first||8,firstMedia:1,firstVariant:1,orderBy:{field:"PLATFORM_CREATED_AT",direction:"DESC"},orderByMedia:{field:"POSITION",direction:"ASC"},where:{status:"ACTIVE",...t.where},after:t.after},d=await fetchProducts(e,r);return d},fetchProducts=async(t,r)=>t([e,r]),loopFetchProducts=async(e,{ids:r,isSample:d,isStorefront:s,defaultSelectedProductCount:o,allStatus:a})=>{let i,c,n,u,l;let f=o||4,g=(r?.length==0?f:r?.length)??f,p=1,P=Math.ceil(g/8);for(;p<=P&&!1!==u;){let o=a?{}:{status:"ACTIVE"};i={first:t(g,p,8),firstMedia:1,firstVariant:1,orderBy:{field:"PLATFORM_CREATED_AT",direction:"DESC"},orderByMedia:{field:"POSITION",direction:"ASC"},where:{...o,isSample:d,...s&&{isStorefront:s},...r?.length?{baseIDIn:r}:{}},after:c};let f=await fetchProducts(e,i);if(c=f?.products?.pageInfo?.endCursor,1===p?(n=f,l=f):l?.products&&f?.products?.edges.length&&(l.products={edges:l.products.edges.concat(f?.products?.edges),pageInfo:f?.products?.pageInfo}),p++,!l){u=!1;break}}return n},mergeVariantsToProducts=async({fetcher:e,products:t,isSample:d,isStorefront:s})=>{let o=await Promise.all(t?.products?.edges?.map(async t=>{let o=await r(e,{id:t?.node?.baseID,isSample:d,isStorefront:s});return{productId:t?.node?.baseID,items:o}})??[]);return o},mergeMediasToProducts=async({fetcher:e,products:t,isSample:r,isStorefront:s})=>{let o=await Promise.all(t?.products?.edges?.map(async t=>{let o=await d(e,{id:t?.node?.baseID,isSample:r,isStorefront:s});return{productId:t?.node?.baseID,items:o}})??[]);return o};export{getListProductByVariables,getProductQueryAll,getProducts};
@@ -1,25 +1 @@
1
- const generateProductQueryKey = (args)=>{
2
- return [
3
- 'query/product',
4
- args
5
- ];
6
- };
7
- const generateCollectionQueryKey = (args)=>{
8
- return [
9
- 'query/collection',
10
- args
11
- ];
12
- };
13
- const generateProductsQueryKey = (args)=>{
14
- return [
15
- 'query/products',
16
- {
17
- ...args,
18
- ids: [
19
- ...args.ids
20
- ].sort()
21
- }
22
- ];
23
- };
24
-
25
- export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey };
1
+ let generateProductQueryKey=e=>["query/product",e],generateCollectionQueryKey=e=>["query/collection",e],generateProductsQueryKey=e=>["query/products",{...e,ids:[...e.ids].sort()}];export{generateCollectionQueryKey,generateProductQueryKey,generateProductsQueryKey};
@@ -1,132 +1,6 @@
1
- import { devicesMapping, stateMapping } from './constant.js';
2
- import { makeStyle } from './make-style.js';
3
-
4
- const getCornerCSSFromGlobal = (corner)=>{
5
- if (!corner?.radiusType) return {};
6
- if ([
7
- 'custom',
8
- 'circle'
9
- ].includes(corner?.radiusType)) return makeStyle({
10
- bblr: corner.bblr,
11
- bbrr: corner.bbrr,
12
- btlr: corner.btlr,
13
- btrr: corner.btrr
14
- });
15
- return makeStyle({
16
- radius: `var(--g-radius-${corner?.radiusType})`
17
- });
18
- };
19
- const getRadiusCSSFromGlobal = (state, key, device)=>{
20
- if (!key || !state) return {};
21
- const suffix = device && device !== 'desktop' ? devicesMapping?.[device] : '';
22
- const mState = stateMapping?.[state];
23
- return {
24
- [`-${mState}-radius${suffix}`]: `var(--g-radius-${key})`
25
- };
26
- };
27
- const getCustomRadius = (state, radius, device)=>{
28
- if (!radius || !state || radius?.radiusType !== 'custom') return {};
29
- const suffix = device && device !== 'desktop' ? devicesMapping?.[device] : '';
30
- const mState = stateMapping?.[state];
31
- return {
32
- [`-${mState}-bblr${suffix}`]: radius.bblr,
33
- [`-${mState}-bbrr${suffix}`]: radius.bbrr,
34
- [`-${mState}-btlr${suffix}`]: radius.btlr,
35
- [`-${mState}-btrr${suffix}`]: radius.btrr
36
- };
37
- };
38
- const composeRadius = (value)=>{
39
- if (!value) return {};
40
- if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
41
- return composeRadiusResponsiveState(value);
42
- }
43
- return composeRadiusState(value);
44
- };
45
- const composeRadiusResponsive = (radiusValue)=>{
46
- const style = {};
47
- Object.assign(style, getCustomRadius('normal', radiusValue?.desktop, 'desktop'));
48
- Object.assign(style, getCustomRadius('normal', radiusValue?.tablet, 'tablet'));
49
- Object.assign(style, getCustomRadius('normal', radiusValue?.mobile, 'mobile'));
50
- return style;
51
- };
52
- const composeRadiusState = (radiusValue, device)=>{
53
- const style = {};
54
- switch(radiusValue?.normal?.radiusType){
55
- case 'medium':
56
- case 'large':
57
- case 'small':
58
- Object.assign(style, getRadiusCSSFromGlobal('normal', radiusValue?.normal?.radiusType, device));
59
- break;
60
- case 'circle':
61
- case 'none':
62
- case 'custom':
63
- Object.assign(style, getCustomRadius('normal', radiusValue.normal, device));
64
- break;
65
- }
66
- switch(radiusValue?.hover?.radiusType){
67
- case 'medium':
68
- case 'large':
69
- case 'small':
70
- Object.assign(style, getRadiusCSSFromGlobal('hover', radiusValue?.hover?.radiusType, device));
71
- break;
72
- case 'circle':
73
- case 'none':
74
- case 'custom':
75
- Object.assign(style, getCustomRadius('hover', radiusValue.hover, device));
76
- break;
77
- }
78
- switch(radiusValue?.focus?.radiusType){
79
- case 'medium':
80
- case 'large':
81
- case 'small':
82
- Object.assign(style, getRadiusCSSFromGlobal('focus', radiusValue?.focus?.radiusType, device));
83
- break;
84
- case 'circle':
85
- case 'none':
86
- case 'custom':
87
- Object.assign(style, getCustomRadius('focus', radiusValue.focus, device));
88
- break;
89
- }
90
- return style;
91
- };
92
- const composeRadiusResponsiveState = (radiusValue)=>{
93
- const style = {};
94
- Object.assign(style, composeRadiusState(radiusValue?.desktop, 'desktop'));
95
- Object.assign(style, composeRadiusState(radiusValue?.tablet, 'tablet'));
96
- Object.assign(style, composeRadiusState(radiusValue?.mobile, 'mobile'));
97
- return style;
98
- };
99
- const getRadiusStyleActiveState = (radiusValue)=>{
100
- if (radiusValue?.active?.radiusType === 'custom') {
101
- return getCustomRadius('normal', radiusValue?.active);
102
- }
103
- return getRadiusCSSFromGlobal('normal', radiusValue?.active?.radiusType);
104
- };
105
- const composeCornerCss = (value, important = false)=>{
106
- if (!value) {
107
- return '';
108
- }
109
- const { radiusType, bblr, bbrr, btlr, btrr } = value;
110
- const sub = important ? ' !important' : '';
111
- let radiusValue = undefined;
112
- switch(radiusType){
113
- case 'medium':
114
- case 'large':
115
- case 'small':
116
- radiusValue = `border-radius: var(--g-radius-${radiusType});`;
117
- break;
118
- case 'circle':
119
- case 'none':
120
- case 'custom':
121
- radiusValue = `
122
- ${bblr ? `border-bottom-left-radius: ${bblr}${sub};` : ''}
123
- ${bbrr ? `border-bottom-right-radius: ${bbrr}${sub};` : ''}
124
- ${btlr ? `border-top-left-radius: ${btlr}${sub};` : ''}
125
- ${btrr ? `border-top-right-radius: ${btrr}${sub};` : ''}
126
- `;
127
- break;
128
- }
129
- return radiusValue;
130
- };
131
-
132
- export { composeCornerCss, composeRadius, composeRadiusResponsive, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState };
1
+ import{devicesMapping as e,stateMapping as s}from"./constant.js";import{makeStyle as t}from"./make-style.js";let getCornerCSSFromGlobal=e=>e?.radiusType?["custom","circle"].includes(e?.radiusType)?t({bblr:e.bblr,bbrr:e.bbrr,btlr:e.btlr,btrr:e.btrr}):t({radius:`var(--g-radius-${e?.radiusType})`}):{},getRadiusCSSFromGlobal=(t,r,a)=>{if(!r||!t)return{};let o=a&&"desktop"!==a?e?.[a]:"",i=s?.[t];return{[`-${i}-radius${o}`]:`var(--g-radius-${r})`}},getCustomRadius=(t,r,a)=>{let o=["custom","pill","rounded","single","none","circle","square"];if(!r||!t||!o.includes(r?.radiusType??""))return{};let i=a&&"desktop"!==a?e?.[a]:"",u=s?.[t];return{[`-${u}-bblr${i}`]:r.bblr,[`-${u}-bbrr${i}`]:r.bbrr,[`-${u}-btlr${i}`]:r.btlr,[`-${u}-btrr${i}`]:r.btrr}},composeRadius=e=>e?"desktop"in e||"tablet"in e||"mobile"in e?composeRadiusResponsiveState(e):composeRadiusState(e):{},composeRadiusResponsive=e=>{let s={};return Object.assign(s,getCustomRadius("normal",e?.desktop,"desktop")),Object.assign(s,getCustomRadius("normal",e?.tablet,"tablet")),Object.assign(s,getCustomRadius("normal",e?.mobile,"mobile")),s},composeRadiusState=(e,s)=>{let t={},r=["normal","hover","focus","active"];for(let a of r){let r=e?.[a]||e?.normal;if(r)switch(r.radiusType){case"medium":case"large":case"small":Object.assign(t,getRadiusCSSFromGlobal(a,r.radiusType,s));break;default:Object.assign(t,getCustomRadius(a,r,s))}}return t},composeRadiusResponsiveState=e=>{let s={};return Object.assign(s,composeRadiusState(e?.desktop,"desktop")),Object.assign(s,composeRadiusState(e?.tablet,"tablet")),Object.assign(s,composeRadiusState(e?.mobile,"mobile")),s},getRadiusStyleActiveState=e=>{let s=["circle","square","rounded","none","custom"],t=e?.active||e?.normal;return s.includes(t?.radiusType||"")?getCustomRadius("normal",t):getRadiusCSSFromGlobal("normal",t?.radiusType)},composeCornerCss=(e,s=!1)=>{let t;if(!e)return"";let{radiusType:r,bblr:a,bbrr:o,btlr:i,btrr:u}=e,l=s?" !important":"";switch(r){case"medium":case"large":case"small":t=`border-radius: var(--g-radius-${r});`;break;case"circle":case"square":case"none":case"rounded":case"custom":t=`
2
+ ${a?`border-bottom-left-radius: ${a}${l};`:""}
3
+ ${o?`border-bottom-right-radius: ${o}${l};`:""}
4
+ ${i?`border-top-left-radius: ${i}${l};`:""}
5
+ ${u?`border-top-right-radius: ${u}${l};`:""}
6
+ `}return t};export{composeCornerCss,composeRadius,composeRadiusResponsive,getCornerCSSFromGlobal,getCustomRadius,getRadiusCSSFromGlobal,getRadiusStyleActiveState};
@@ -1,82 +1 @@
1
- const RenderIf = (c, t, f)=>c ? typeof t === 'string' ? t : t() : (typeof f === 'string' ? f : f?.()) ?? '';
2
- const isObject = (obj)=>{
3
- if (typeof obj === 'object' && !Array.isArray(obj) && obj !== null) {
4
- return true;
5
- }
6
- return false;
7
- };
8
- const props = (strings, ...keys)=>{
9
- const props = keys[0];
10
- const propsArr = [];
11
- for(const attr in props){
12
- if (Object.hasOwnProperty.call(props, attr)) {
13
- const val = props[attr];
14
- if (![
15
- 'symbol',
16
- 'object',
17
- 'function'
18
- ].includes(typeof val)) {
19
- if (val) {
20
- propsArr.push(`${attr}="${val}"`);
21
- } else {
22
- propsArr.push(`${attr}`);
23
- }
24
- }
25
- }
26
- }
27
- return propsArr.join(' ');
28
- };
29
- const styles = (strings, ...keys)=>{
30
- const styles = keys[0];
31
- const styleArr = [];
32
- for(const attr in styles){
33
- if (Object.hasOwnProperty.call(styles, attr)) {
34
- const val = styles[attr];
35
- if (val !== undefined && val !== false) styleArr.push(`${attr}:${val}`);
36
- }
37
- }
38
- return styleArr.join(';');
39
- };
40
- const dataStringify = (obj)=>{
41
- return JSON.stringify(obj).replace(/\\"/g, '"');
42
- };
43
- const template = (strings, ...keys)=>{
44
- let str = '';
45
- strings.forEach((item, index)=>{
46
- str += item;
47
- if (keys[index] !== undefined) {
48
- if (isObject(keys[index])) {
49
- if (/style=["|']/.test(item)) {
50
- str += styles`${keys[index]}`;
51
- } else {
52
- str += props`${keys[index]}`;
53
- }
54
- } else {
55
- str += keys[index];
56
- }
57
- }
58
- });
59
- str = str.replaceAll(`style=""`, '');
60
- str = str.replaceAll(`class=""`, '');
61
- return str;
62
- };
63
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
64
- const composeMemo = (fn, _)=>fn();
65
- const removeUndefinedValuesFromObject = (obj)=>{
66
- Object.keys(obj).forEach((key)=>obj?.[key] === undefined && delete obj[key]);
67
- return obj;
68
- };
69
- function sanitizeLiquid(input) {
70
- // eslint-disable-next-line regexp/no-super-linear-backtracking
71
- return input.replace(/\{\{\s*(.*?)\s*\}\}/g, (_, inner)=>{
72
- const trimmed = inner.trim();
73
- // eslint-disable-next-line regexp/no-unused-capturing-group, regexp/no-dupe-characters-character-class, regexp/prefer-w, regexp/prefer-d
74
- const isValidLiquid = /^([a-zA-Z_][a-zA-Z0-9_-]*)(\.[a-zA-Z0-9_-]+)*$/i.test(trimmed);
75
- if (isValidLiquid) {
76
- return `{{ ${trimmed} }}`;
77
- }
78
- return trimmed;
79
- });
80
- }
81
-
82
- export { RenderIf, composeMemo, dataStringify, props, removeUndefinedValuesFromObject, sanitizeLiquid, styles, template };
1
+ let RenderIf=(e,t,r)=>e?"string"==typeof t?t:t():("string"==typeof r?r:r?.())??"",isObject=e=>!("object"!=typeof e||Array.isArray(e))&&null!==e,props=(e,...t)=>{let r=t[0],s=[];for(let e in r)if(Object.hasOwnProperty.call(r,e)){let t=r[e];["symbol","object","function"].includes(typeof t)||(t?s.push(`${e}="${t}"`):s.push(`${e}`))}return s.join(" ")},styles=(e,...t)=>{let r=t[0],s=[];for(let e in r)if(Object.hasOwnProperty.call(r,e)){let t=r[e];void 0!==t&&!1!==t&&s.push(`${e}:${t}`)}return s.join(";")},dataStringify=e=>JSON.stringify(e).replace(/\\"/g,'"'),template=(e,...t)=>{let r="";return e.forEach((e,s)=>{r+=e,void 0!==t[s]&&(isObject(t[s])?/style=["|']/.test(e)?r+=styles`${t[s]}`:r+=props`${t[s]}`:r+=t[s])}),r=(r=r.replaceAll('style=""',"")).replaceAll('class=""',"")},composeMemo=(e,t)=>e(),removeUndefinedValuesFromObject=e=>(Object.keys(e).forEach(t=>e?.[t]===void 0&&delete e[t]),e);function sanitizeLiquid(e){return e.replace(/\{\{\s*(.*?)\s*\}\}/g,(e,t)=>{let r=t.trim(),s=/^([a-zA-Z_][a-zA-Z0-9_-]*)(\.[a-zA-Z0-9_-]+)*$/i.test(r);return s?`{{ ${r} }}`:r})}export{RenderIf,composeMemo,dataStringify,props,removeUndefinedValuesFromObject,sanitizeLiquid,styles,template};
@@ -1,63 +1 @@
1
- import { getSingleColorVariable } from './colors.js';
2
- import { stateMapping } from './constant.js';
3
- import { getShortName } from './get-shortname.js';
4
-
5
- const parseValueWithUnit = (valueWithUnit)=>{
6
- const matches = valueWithUnit.match(/(\d+)(.+)/);
7
- if (matches && matches.length === 3) {
8
- const value = Number(matches[1] ?? 0);
9
- const unit = matches[2];
10
- return {
11
- value,
12
- unit: unit ?? 'px'
13
- };
14
- }
15
- return {
16
- value: 0,
17
- unit: 'px'
18
- };
19
- };
20
- const getStyleShadow = (shadowStyle, isActiveState = false)=>{
21
- const { styleAppliedFor, value, isEnableShadow } = shadowStyle || {};
22
- let { state } = shadowStyle || {};
23
- if (!state) state = 'normal';
24
- if (!styleAppliedFor || !value) return {};
25
- if (typeof value.distance == 'undefined') return {};
26
- const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
27
- return {
28
- [`-${!isActiveState ? stateMapping?.[state] || '' : ''}-${getShortName(styleAppliedFor)}${shadowStyle.screen ? `-${shadowStyle.screen}` : ''}`]: isEnableShadow ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${getSingleColorVariable(value?.color)}` : 'none'
29
- };
30
- };
31
- const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow, screen)=>{
32
- if (!shadow || !styleAppliedFor) return {};
33
- const style = {};
34
- for (const [key, value] of Object.entries(shadow)){
35
- Object.assign(style, getStyleShadow({
36
- value: value,
37
- state: key,
38
- styleAppliedFor,
39
- isEnableShadow: isEnableShadow?.[key],
40
- screen: screen ?? ''
41
- }));
42
- }
43
- return style;
44
- };
45
- const getResponsiveStyleShadow = (value, styleAppliedFor, isEnableShadow)=>{
46
- if (!value) return undefined;
47
- if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
48
- return {
49
- ...getStyleShadowState(value.desktop, styleAppliedFor, isEnableShadow.desktop),
50
- ...value.tablet && (isEnableShadow.tablet ?? isEnableShadow.desktop) ? getStyleShadowState(value.tablet, styleAppliedFor, isEnableShadow.tablet ?? isEnableShadow.desktop, 'tablet') : undefined,
51
- ...value.mobile && (isEnableShadow.mobile ?? isEnableShadow.tablet ?? isEnableShadow.desktop) ? getStyleShadowState(value.mobile, styleAppliedFor, isEnableShadow.mobile ?? isEnableShadow.tablet ?? isEnableShadow.desktop, 'mobile') : undefined
52
- };
53
- }
54
- };
55
- const composeShadowCss = ({ hasBoxShadow, boxShadowValue, important })=>{
56
- if (!hasBoxShadow) return undefined;
57
- if (!boxShadowValue) return undefined;
58
- const { value: distance, unit: unitDistance } = parseValueWithUnit(`${boxShadowValue?.distance}`);
59
- const sub = important ? ' !important' : '';
60
- return `box-shadow: ${Math.cos(parseFloat(`${boxShadowValue?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${boxShadowValue?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${boxShadowValue?.blur} ${boxShadowValue?.spread + ' '}${getSingleColorVariable(boxShadowValue?.color)}${sub};`;
61
- };
62
-
63
- export { composeShadowCss, getResponsiveStyleShadow, getStyleShadow, getStyleShadowState, parseValueWithUnit };
1
+ import{getSingleColorVariable as e}from"./colors.js";import{stateMapping as t}from"./constant.js";import{getShortName as o}from"./get-shortname.js";let parseValueWithUnit=e=>{let t=e.match(/(\d+)(.+)/);if(t&&3===t.length){let e=Number(t[1]??0),o=t[2];return{value:e,unit:o??"px"}}return{value:0,unit:"px"}},getStyleShadow=(a,l=!1)=>{let{styleAppliedFor:s,value:n,isEnableShadow:r}=a||{},{state:i}=a||{};if(i||(i="normal"),!s||!n)return{};let d="none"===n.type||!1===n.enable;if(void 0===n.distance&&!d)return{};let{value:p,unit:h}=parseValueWithUnit(`${n?.distance}`);return{[`-${l?"":t?.[i]||""}-${o(s)}${a.screen?`-${a.screen}`:""}`]:r&&!d?`${Math.cos(parseFloat(`${n?.angle}`)*Math.PI/180)*parseFloat(`${p}`)}${h} ${Math.sin(parseFloat(`${n?.angle}`)*Math.PI/180)*parseFloat(`${p}`)}${h} ${n?.blur} ${"box-shadow"===s?n?.spread+" ":""}${e(n?.color)}`:"none"}},getStyleShadowState=(e,t,o,a)=>{if(!e||!t)return{};let l={};for(let[s,n]of Object.entries(e))Object.assign(l,getStyleShadow({value:n,state:s,styleAppliedFor:t,isEnableShadow:o?.[s],screen:a??""}));return l},getResponsiveStyleShadow=(e,t,o)=>{if(e&&("desktop"in e||"tablet"in e||"mobile"in e))return{...getStyleShadowState(e.desktop,t,o.desktop),...e.tablet&&(o.tablet??o.desktop)?getStyleShadowState(e.tablet,t,o.tablet??o.desktop,"tablet"):void 0,...e.mobile&&(o.mobile??o.tablet??o.desktop)?getStyleShadowState(e.mobile,t,o.mobile??o.tablet??o.desktop,"mobile"):void 0}},getResponsiveStyleShadowWithoutState=(e,t,o)=>{if(e&&("desktop"in e||"tablet"in e||"mobile"in e))return{...getStyleShadow({value:e.desktop,styleAppliedFor:t,isEnableShadow:o.desktop}),...e.tablet&&(o.tablet??o.desktop)?getStyleShadow({value:e.tablet,styleAppliedFor:t,isEnableShadow:o.tablet??o.desktop,screen:"tablet"}):void 0,...e.mobile&&(o.mobile??o.tablet??o.desktop)?getStyleShadow({value:e.mobile,styleAppliedFor:t,isEnableShadow:o.mobile??o.tablet??o.desktop,screen:"mobile"}):void 0}},composeShadow=e=>({...getStyleShadowState(e?.desktop,"box-shadow",{normal:e?.desktop?.normal?.type!=="none",focus:e?.desktop?.focus?.type!=="none",hover:e?.desktop?.hover?.type!=="none"}),...getStyleShadowState(e?.tablet,"box-shadow",{normal:e?.tablet?.normal?.type!=="none",focus:e?.tablet?.focus?.type!=="none",hover:e?.tablet?.hover?.type!=="none"},"tablet"),...getStyleShadowState(e?.mobile,"box-shadow",{normal:e?.mobile?.normal?.type!=="none",focus:e?.mobile?.focus?.type!=="none",hover:e?.mobile?.hover?.type!=="none"},"mobile")}),composeShadowCss=({hasBoxShadow:t,boxShadowValue:o,important:a})=>{if(!t||!o)return;let{value:l,unit:s}=parseValueWithUnit(`${o?.distance}`),n=a?" !important":"";return`box-shadow: ${Math.cos(parseFloat(`${o?.angle}`)*Math.PI/180)*parseFloat(`${l}`)}${s} ${Math.sin(parseFloat(`${o?.angle}`)*Math.PI/180)*parseFloat(`${l}`)}${s} ${o?.blur} ${o?.spread+" "}${e(o?.color)}${n};`};export{composeShadow,composeShadowCss,getResponsiveStyleShadow,getResponsiveStyleShadowWithoutState,getStyleShadow,getStyleShadowState,parseValueWithUnit};