@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,90 +1 @@
1
- const globalSortNameMapping = {
2
- 'typography-heading-1-fontFamily': 'h1-ff',
3
- 'typography-heading-1-fontSize': 'h1-size',
4
- 'typography-heading-1-fontWeight': 'h1-weight',
5
- 'typography-heading-1-lineHeight': 'h1-lh',
6
- 'typography-heading-1-letterSpacing': 'h1-ls',
7
- 'typography-heading-1-fontStyle': 'h1-fs',
8
- 'typography-heading-2-fontFamily': 'h2-ff',
9
- 'typography-heading-2-fontSize': 'h2-size',
10
- 'typography-heading-2-fontWeight': 'h2-weight',
11
- 'typography-heading-2-lineHeight': 'h2-lh',
12
- 'typography-heading-2-letterSpacing': 'h2-ls',
13
- 'typography-heading-2-fontStyle': 'h2-fs',
14
- 'typography-heading-3-fontFamily': 'h3-ff',
15
- 'typography-heading-3-fontSize': 'h3-size',
16
- 'typography-heading-3-fontWeight': 'h3-weight',
17
- 'typography-heading-3-lineHeight': 'h3-lh',
18
- 'typography-heading-3-letterSpacing': 'h3-ls',
19
- 'typography-heading-3-fontStyle': 'h3-fs',
20
- 'typography-subheading-1-fontFamily': 'sh1-ff',
21
- 'typography-subheading-1-fontSize': 'sh1-size',
22
- 'typography-subheading-1-fontWeight': 'sh1-weight',
23
- 'typography-subheading-1-lineHeight': 'sh1-lh',
24
- 'typography-subheading-1-letterSpacing': 'sh1-ls',
25
- 'typography-subheading-1-fontStyle': 'sh1-fs',
26
- 'typography-subheading-2-fontFamily': 'sh2-ff',
27
- 'typography-subheading-2-fontSize': 'sh2-size',
28
- 'typography-subheading-2-fontWeight': 'sh2-weight',
29
- 'typography-subheading-2-lineHeight': 'sh2-lh',
30
- 'typography-subheading-2-letterSpacing': 'sh2-ls',
31
- 'typography-subheading-2-fontStyle': 'sh2-fs',
32
- 'typography-subheading-3-fontFamily': 'sh3-ff',
33
- 'typography-subheading-3-fontSize': 'sh3-size',
34
- 'typography-subheading-3-fontWeight': 'sh3-weight',
35
- 'typography-subheading-3-lineHeight': 'sh3-lh',
36
- 'typography-subheading-3-letterSpacing': 'sh3-ls',
37
- 'typography-subheading-3-fontStyle': 'sh3-fs',
38
- 'typography-paragraph-1-fontFamily': 'p1-ff',
39
- 'typography-paragraph-1-fontSize': 'p1-size',
40
- 'typography-paragraph-1-fontWeight': 'p1-weight',
41
- 'typography-paragraph-1-lineHeight': 'p1-lh',
42
- 'typography-paragraph-1-letterSpacing': 'p1-ls',
43
- 'typography-paragraph-1-fontStyle': 'p1-fs',
44
- 'typography-paragraph-2-fontFamily': 'p2-ff',
45
- 'typography-paragraph-2-fontSize': 'p2-size',
46
- 'typography-paragraph-2-fontWeight': 'p2-weight',
47
- 'typography-paragraph-2-lineHeight': 'p2-lh',
48
- 'typography-paragraph-2-letterSpacing': 'p2-ls',
49
- 'typography-paragraph-2-fontStyle': 'p2-fs',
50
- 'typography-paragraph-3-fontFamily': 'p3-ff',
51
- 'typography-paragraph-3-fontSize': 'p3-size',
52
- 'typography-paragraph-3-fontWeight': 'p3-weight',
53
- 'typography-paragraph-3-lineHeight': 'p3-lh',
54
- 'typography-paragraph-3-letterSpacing': 'p3-ls',
55
- 'typography-paragraph-3-fontStyle': 'p3-fs',
56
- 'color-brand': 'c-brand',
57
- 'color-highlight': 'c-highlight',
58
- 'color-text-1': 'c-text-1',
59
- 'color-text-2': 'c-text-2',
60
- 'color-text-3': 'c-text-3',
61
- 'color-bg-1': 'c-bg-1',
62
- 'color-bg-2': 'c-bg-2',
63
- 'color-bg-3': 'c-bg-3',
64
- 'color-line-1': 'c-line-1',
65
- 'color-line-2': 'c-line-2',
66
- 'color-line-3': 'c-line-3',
67
- 'color-success': 'c-success',
68
- 'color-info': 'c-info',
69
- 'color-warning': 'c-warning',
70
- 'color-error': 'c-error',
71
- 'spacing-xxs': 's-xxs',
72
- 'spacing-xs': 's-xs',
73
- 'spacing-s': 's-s',
74
- 'spacing-m': 's-m',
75
- 'spacing-l': 's-l',
76
- 'spacing-xl': 's-xl',
77
- 'spacing-2xl': 's-2xl',
78
- 'spacing-3xl': 's-3xl',
79
- 'spacing-4xl': 's-4xl',
80
- 'spacing-5xl': 's-5xl',
81
- 'container-width': 'ct-w',
82
- 'container-padding': 'ct-p',
83
- 'text-shadow': 'ts',
84
- 'box-shadow': 'shadow'
85
- };
86
- function getShortName(name) {
87
- return globalSortNameMapping[name] || name;
88
- }
89
-
90
- export { getShortName };
1
+ let globalSortNameMapping={"typography-heading-1-fontFamily":"h1-ff","typography-heading-1-fontSize":"h1-size","typography-heading-1-fontWeight":"h1-weight","typography-heading-1-lineHeight":"h1-lh","typography-heading-1-letterSpacing":"h1-ls","typography-heading-1-fontStyle":"h1-fs","typography-heading-2-fontFamily":"h2-ff","typography-heading-2-fontSize":"h2-size","typography-heading-2-fontWeight":"h2-weight","typography-heading-2-lineHeight":"h2-lh","typography-heading-2-letterSpacing":"h2-ls","typography-heading-2-fontStyle":"h2-fs","typography-heading-3-fontFamily":"h3-ff","typography-heading-3-fontSize":"h3-size","typography-heading-3-fontWeight":"h3-weight","typography-heading-3-lineHeight":"h3-lh","typography-heading-3-letterSpacing":"h3-ls","typography-heading-3-fontStyle":"h3-fs","typography-subheading-1-fontFamily":"sh1-ff","typography-subheading-1-fontSize":"sh1-size","typography-subheading-1-fontWeight":"sh1-weight","typography-subheading-1-lineHeight":"sh1-lh","typography-subheading-1-letterSpacing":"sh1-ls","typography-subheading-1-fontStyle":"sh1-fs","typography-subheading-2-fontFamily":"sh2-ff","typography-subheading-2-fontSize":"sh2-size","typography-subheading-2-fontWeight":"sh2-weight","typography-subheading-2-lineHeight":"sh2-lh","typography-subheading-2-letterSpacing":"sh2-ls","typography-subheading-2-fontStyle":"sh2-fs","typography-subheading-3-fontFamily":"sh3-ff","typography-subheading-3-fontSize":"sh3-size","typography-subheading-3-fontWeight":"sh3-weight","typography-subheading-3-lineHeight":"sh3-lh","typography-subheading-3-letterSpacing":"sh3-ls","typography-subheading-3-fontStyle":"sh3-fs","typography-paragraph-1-fontFamily":"p1-ff","typography-paragraph-1-fontSize":"p1-size","typography-paragraph-1-fontWeight":"p1-weight","typography-paragraph-1-lineHeight":"p1-lh","typography-paragraph-1-letterSpacing":"p1-ls","typography-paragraph-1-fontStyle":"p1-fs","typography-paragraph-2-fontFamily":"p2-ff","typography-paragraph-2-fontSize":"p2-size","typography-paragraph-2-fontWeight":"p2-weight","typography-paragraph-2-lineHeight":"p2-lh","typography-paragraph-2-letterSpacing":"p2-ls","typography-paragraph-2-fontStyle":"p2-fs","typography-paragraph-3-fontFamily":"p3-ff","typography-paragraph-3-fontSize":"p3-size","typography-paragraph-3-fontWeight":"p3-weight","typography-paragraph-3-lineHeight":"p3-lh","typography-paragraph-3-letterSpacing":"p3-ls","typography-paragraph-3-fontStyle":"p3-fs","color-brand":"c-brand","color-highlight":"c-highlight","color-text-1":"c-text-1","color-text-2":"c-text-2","color-text-3":"c-text-3","color-bg-1":"c-bg-1","color-bg-2":"c-bg-2","color-bg-3":"c-bg-3","color-line-1":"c-line-1","color-line-2":"c-line-2","color-line-3":"c-line-3","color-success":"c-success","color-info":"c-info","color-warning":"c-warning","color-error":"c-error","spacing-xxs":"s-xxs","spacing-xs":"s-xs","spacing-s":"s-s","spacing-m":"s-m","spacing-l":"s-l","spacing-xl":"s-xl","spacing-2xl":"s-2xl","spacing-3xl":"s-3xl","spacing-4xl":"s-4xl","spacing-5xl":"s-5xl","container-width":"ct-w","container-padding":"ct-p","text-shadow":"ts","box-shadow":"shadow"};function getShortName(h){return globalSortNameMapping[h]||h}export{getShortName};
@@ -1,58 +1 @@
1
- import { devicesMapping } from '../web-components/src/helpers/styles/constant.js';
2
-
3
- const TEXT_TOTAL_SPACING = 3; //Padding 2, margin 1
4
- const composePostionIconList = (lineHeight, position, iconWidth)=>{
5
- const compose = {};
6
- composePositionLineHeight({
7
- compose,
8
- lineHeight,
9
- device: 'desktop',
10
- position,
11
- iconWidth
12
- });
13
- composePositionLineHeight({
14
- compose,
15
- lineHeight,
16
- device: 'tablet',
17
- position,
18
- iconWidth
19
- });
20
- composePositionLineHeight({
21
- compose,
22
- lineHeight,
23
- device: 'mobile',
24
- position,
25
- iconWidth
26
- });
27
- return compose;
28
- };
29
- const composePositionLineHeight = ({ compose, lineHeight, device, position, iconWidth })=>{
30
- const positionDevice = position?.[device];
31
- const iconWidthDevice = iconWidth?.[device];
32
- if (positionDevice) {
33
- const suffix = devicesMapping[device] ?? '';
34
- if (positionDevice === 'center') {
35
- compose.wrapper = {
36
- ...compose.wrapper,
37
- [`--ai${suffix}`]: 'center'
38
- };
39
- compose.content = {
40
- ...compose.content,
41
- [`--pos${suffix}`]: 'static'
42
- };
43
- } else if (iconWidthDevice) {
44
- const computedTop = parseFloat(lineHeight.replaceAll(/[a-zA-Z]/g, '')) / 2 + TEXT_TOTAL_SPACING - iconWidthDevice / 2;
45
- compose.wrapper = {
46
- ...compose.wrapper,
47
- [`--ai${suffix}`]: 'flex-start'
48
- };
49
- compose.content = {
50
- ...compose.content,
51
- [`--top${suffix}`]: `${Math.max(0, Math.ceil(computedTop))}px`,
52
- [`--pos${suffix}`]: 'relative'
53
- };
54
- }
55
- }
56
- };
57
-
58
- export { composePositionLineHeight, composePostionIconList };
1
+ import{devicesMapping as e}from"../web-components/src/helpers/styles/constant.js";let TEXT_TOTAL_SPACING=3,composePostionIconList=(e,t,o)=>{let i={};return composePositionLineHeight({compose:i,lineHeight:e,device:"desktop",position:t,iconWidth:o}),composePositionLineHeight({compose:i,lineHeight:e,device:"tablet",position:t,iconWidth:o}),composePositionLineHeight({compose:i,lineHeight:e,device:"mobile",position:t,iconWidth:o}),i},composePositionLineHeight=({compose:t,lineHeight:o,device:i,position:s,iconWidth:n})=>{let p=s?.[i],c=n?.[i];if(p){let s=e[i]??"";if("center"===p)t.wrapper={...t.wrapper,[`--ai${s}`]:"center"},t.content={...t.content,[`--pos${s}`]:"static"};else if(c){let e=parseFloat(o.replaceAll(/[a-zA-Z]/g,""))/2+3-c/2;t.wrapper={...t.wrapper,[`--ai${s}`]:"flex-start"},t.content={...t.content,[`--top${s}`]:`${Math.max(0,Math.ceil(e))}px`,[`--pos${s}`]:"relative"}}}};export{composePositionLineHeight,composePostionIconList};
@@ -1,5 +1 @@
1
- function isBrowser() {
2
- return typeof window !== 'undefined';
3
- }
4
-
5
- export { isBrowser as default };
1
+ function isBrowser(){return"undefined"!=typeof window}export{isBrowser as default};
@@ -1,5 +1 @@
1
- function isDefined(argument) {
2
- return argument !== undefined;
3
- }
4
-
5
- export { isDefined };
1
+ function isDefined(e){return void 0!==e}export{isDefined};
@@ -1,10 +1 @@
1
- import { Children } from 'react';
2
- import { ComponentToolbarPreview } from '../components/ComponentToolbarPreview.js';
3
-
4
- const isEmptyChildren = (children)=>{
5
- let arrChild = Children.toArray(children);
6
- arrChild = arrChild.filter((child)=>child?.type != ComponentToolbarPreview);
7
- return Children.count(arrChild) < 1 || !children;
8
- };
9
-
10
- export { isEmptyChildren as default, isEmptyChildren };
1
+ import{Children as t}from"react";import r from"../components/ComponentToolbarPreview.js";let isEmptyChildren=e=>{let o=t.toArray(e);return o=o.filter(t=>t?.type!=r),1>t.count(o)||!e};export{isEmptyChildren as default,isEmptyChildren};
@@ -1,5 +1 @@
1
- function isSafari() {
2
- return navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1;
3
- }
4
-
5
- export { isSafari as default };
1
+ function isSafari(){return -1!=navigator.userAgent.indexOf("Safari")&&-1==navigator.userAgent.indexOf("Chrome")}export{isSafari as default};
@@ -1,54 +1 @@
1
- import { devicesMapping } from './constant.js';
2
- import { getResponsiveValueByScreen, getResponsiveValue } from './get-resonsive-value.js';
3
-
4
- const gridToArrayRegex = // eslint-disable-next-line regexp/no-super-linear-backtracking
5
- /[^\s()]+(?:\([^\s()]+(?:\([^()]+\))?(?:, *[^\s()]+(?:\([^()]+\))?)*\))?/g; // Regex convert css grid to array
6
- const optionLayoutStyle = (column)=>{
7
- if (!column) return {};
8
- const style = {};
9
- for (const [key, value] of Object.entries(column)){
10
- Object.assign(style, {
11
- [`--gtc${devicesMapping?.[key]}`]: `repeat(${parseFloat(value + '') || 1}, minmax(0, 1fr))`
12
- });
13
- }
14
- return style;
15
- };
16
- const composeGridLayout = (layout)=>{
17
- const display = getResponsiveValue(layout, 'display');
18
- const desktop = (getResponsiveValueByScreen(display, 'desktop') === 'fit' ? layout?.desktop?.cols?.map(()=>`minmax(0, auto)`) : layout?.desktop?.cols?.map((col)=>`minmax(0, ${col}fr)`))?.join(' ');
19
- const tablet = (getResponsiveValueByScreen(display, 'tablet') === 'fit' ? layout?.tablet?.cols?.map(()=>`minmax(0, auto)`) : layout?.tablet?.cols?.map((col)=>`minmax(0, ${col}fr)`))?.join(' ');
20
- const mobile = (getResponsiveValueByScreen(display, 'mobile') === 'fit' ? layout?.mobile?.cols?.map(()=>`minmax(0, auto)`) : layout?.mobile?.cols?.map((col)=>`minmax(0, ${col}fr)`))?.join(' ');
21
- return {
22
- [`--gtc`]: desktop,
23
- [`--gtc-tablet`]: tablet,
24
- [`--gtc-mobile`]: mobile
25
- };
26
- };
27
- const gridToArray = (layout)=>{
28
- return layout ? layout.match(gridToArrayRegex) ?? [] : [];
29
- };
30
- const convertOldLayout = (layout)=>{
31
- const desktopCol = gridToArray(layout?.desktop).length;
32
- const tabletCol = gridToArray(layout?.tablet).length;
33
- const mobileCol = gridToArray(layout?.mobile).length;
34
- return {
35
- desktop: {
36
- cols: desktopCol ? Array.from({
37
- length: desktopCol
38
- }, ()=>12 / desktopCol) : undefined,
39
- display: 'fill'
40
- },
41
- tablet: {
42
- cols: tabletCol ? Array.from({
43
- length: tabletCol
44
- }, ()=>12 / tabletCol) : undefined
45
- },
46
- mobile: {
47
- cols: mobileCol ? Array.from({
48
- length: mobileCol
49
- }, ()=>12 / mobileCol) : undefined
50
- }
51
- };
52
- };
53
-
54
- export { composeGridLayout, convertOldLayout, gridToArrayRegex, optionLayoutStyle };
1
+ import{devicesMapping as t}from"./constant.js";import{getResponsiveValueByScreen as o,getResponsiveValue as e}from"./get-resonsive-value.js";let gridToArrayRegex=/[^\s()]+(?:\([^\s()]+(?:\([^()]+\))?(?:, *[^\s()]+(?:\([^()]+\))?)*\))?/g,optionLayoutStyle=o=>{if(!o)return{};let e={};for(let[r,a]of Object.entries(o))Object.assign(e,{[`--gtc${t?.[r]}`]:`repeat(${parseFloat(a+"")||1}, minmax(0, 1fr))`});return e},composeGridLayout=t=>{let r=e(t,"display"),a=("fit"===o(r,"desktop")?t?.desktop?.cols?.map(()=>"minmax(0, auto)"):t?.desktop?.cols?.map(t=>`minmax(0, ${t}fr)`))?.join(" "),i=("fit"===o(r,"tablet")?t?.tablet?.cols?.map(()=>"minmax(0, auto)"):t?.tablet?.cols?.map(t=>`minmax(0, ${t}fr)`))?.join(" "),l=("fit"===o(r,"mobile")?t?.mobile?.cols?.map(()=>"minmax(0, auto)"):t?.mobile?.cols?.map(t=>`minmax(0, ${t}fr)`))?.join(" ");return{"--gtc":a,"--gtc-tablet":i,"--gtc-mobile":l}},gridToArray=t=>t?t.match(gridToArrayRegex)??[]:[],convertOldLayout=t=>{let o=gridToArray(t?.desktop).length,e=gridToArray(t?.tablet).length,r=gridToArray(t?.mobile).length;return{desktop:{cols:o?Array.from({length:o},()=>12/o):void 0,display:"fill"},tablet:{cols:e?Array.from({length:e},()=>12/e):void 0},mobile:{cols:r?Array.from({length:r},()=>12/r):void 0}}};export{composeGridLayout,convertOldLayout,gridToArrayRegex,optionLayoutStyle};
@@ -1,29 +1 @@
1
- const SCRIPTS_LOADED = {};
2
- function loadScript(src, options) {
3
- const isScriptLoaded = SCRIPTS_LOADED[src];
4
- if (isScriptLoaded) {
5
- return isScriptLoaded;
6
- }
7
- const promise = new Promise((resolve, reject)=>{
8
- const script = document.createElement('script');
9
- if (options?.module) {
10
- script.type = 'module';
11
- }
12
- script.src = src;
13
- script.onload = ()=>{
14
- resolve(true);
15
- };
16
- script.onerror = ()=>{
17
- reject(false);
18
- };
19
- if (options?.in === 'head') {
20
- document.head.appendChild(script);
21
- } else {
22
- document.body.appendChild(script);
23
- }
24
- });
25
- SCRIPTS_LOADED[src] = promise;
26
- return promise;
27
- }
28
-
29
- export { loadScript };
1
+ let SCRIPTS_LOADED={};function loadScript(e,t){let d=SCRIPTS_LOADED[e];if(d)return d;let o=new Promise((d,o)=>{let n=document.createElement("script");t?.module&&(n.type="module"),n.src=e,n.onload=()=>{d(!0)},n.onerror=()=>{o(!1)},t?.in==="head"?document.head.appendChild(n):document.body.appendChild(n)});return SCRIPTS_LOADED[e]=o,o}export{loadScript};
@@ -1,149 +1 @@
1
- import { getResponsiveValueByScreen } from './get-resonsive-value.js';
2
-
3
- const removeNullUndefined = (obj)=>Object.entries(obj).reduce((a, [k, v])=>{
4
- if (v === null || v === undefined) return a;
5
- return {
6
- ...a,
7
- [k]: v
8
- };
9
- }, {});
10
- const makeStyleKey = (name)=>{
11
- return [
12
- name,
13
- `hvr-${name}`,
14
- `focus-${name}`,
15
- `${name}-tablet`,
16
- `hvr-${name}-tablet`,
17
- `focus-${name}-tablet`,
18
- `${name}-mobile`,
19
- `hvr-${name}-mobile`,
20
- `focus-${name}-mobile`
21
- ].map((key)=>`--${key}`);
22
- };
23
- const makeStyle = (style)=>{
24
- return removeNullUndefined(Object.fromEntries(Object.entries(style).map(([key, value])=>[
25
- `--${key}`,
26
- value
27
- ])));
28
- };
29
- const makeStyleState = (name, value)=>{
30
- if (!value) return {};
31
- return {
32
- [`--${name}`]: value?.normal,
33
- [`--hvr-${name}`]: value?.hover,
34
- [`--focus-${name}`]: value?.focus
35
- };
36
- };
37
- const makeStyleResponsiveState = (name, value)=>{
38
- if (!value) return {};
39
- return {
40
- [`--${name}`]: value?.desktop?.normal,
41
- [`--hvr-${name}`]: value?.desktop?.hover,
42
- [`--focus-${name}`]: value?.desktop?.focus,
43
- [`--${name}-tablet`]: value?.tablet?.normal,
44
- [`--hvr-${name}-tablet`]: value?.tablet?.hover,
45
- [`--focus-${name}-tablet`]: value?.tablet?.focus,
46
- [`--${name}-mobile`]: value?.mobile?.normal,
47
- [`--hvr-${name}-mobile`]: value?.mobile?.hover,
48
- [`--focus-${name}-mobile`]: value?.mobile?.focus
49
- };
50
- };
51
- const makeStyleResponsive = (name, value, unit)=>{
52
- return {
53
- [`--${name}`]: unit ? `${value?.desktop}${unit}` : value?.desktop,
54
- [`--${name}-tablet`]: unit ? `${value?.tablet}${unit}` : value?.tablet,
55
- [`--${name}-mobile`]: unit ? `${value?.mobile}${unit}` : value?.mobile
56
- };
57
- };
58
- const makeStyleResponsiveByScreen = (name, value, unit)=>{
59
- return {
60
- [`--${name}`]: unit ? `${getResponsiveValueByScreen(value, 'desktop')}${unit}` : getResponsiveValueByScreen(value, 'desktop'),
61
- [`--${name}-tablet`]: unit ? `${getResponsiveValueByScreen(value, 'tablet')}${unit}` : getResponsiveValueByScreen(value, 'tablet'),
62
- [`--${name}-mobile`]: unit ? `${getResponsiveValueByScreen(value, 'mobile')}${unit}` : getResponsiveValueByScreen(value, 'mobile')
63
- };
64
- };
65
- const makeWidth = (widthValue, fullWidthValue)=>{
66
- const getVal = (deviceValue, widthValue, fullWidthValue)=>{
67
- const widthVal = getResponsiveValueByScreen(widthValue, deviceValue);
68
- const fullWidthVal = fullWidthValue?.[deviceValue] === undefined ? fullWidthValue?.['desktop'] : fullWidthValue?.[deviceValue];
69
- if (fullWidthVal) {
70
- return '100%';
71
- } else if (fullWidthVal === false) {
72
- return widthVal ?? widthVal;
73
- } else {
74
- return widthVal || 'auto';
75
- }
76
- };
77
- return {
78
- desktop: getVal('desktop', widthValue, fullWidthValue),
79
- tablet: getVal('tablet', widthValue, fullWidthValue),
80
- mobile: getVal('mobile', widthValue, fullWidthValue)
81
- };
82
- };
83
- const makeGlobalSizeWidthResponsive = (globalSize)=>{
84
- return {
85
- '--w': globalSize?.desktop?.width,
86
- '--w-tablet': globalSize?.tablet?.width,
87
- '--w-mobile': globalSize?.mobile?.width
88
- };
89
- };
90
- const makeGlobalSizeHeightResponsive = (globalSize)=>{
91
- return {
92
- '--h': globalSize?.desktop?.height,
93
- '--h-tablet': globalSize?.tablet?.height,
94
- '--h-mobile': globalSize?.mobile?.height
95
- };
96
- };
97
- const makeHeight = (heighValue, autoHeight)=>{
98
- const getVal = (deviceValue, heighValue, autoHeight)=>{
99
- const heightVal = heighValue?.[deviceValue];
100
- const isAuto = autoHeight?.[deviceValue];
101
- if (isAuto) {
102
- return 'auto';
103
- } else if (isAuto === false) {
104
- return heightVal ?? heightVal;
105
- } else {
106
- return heightVal;
107
- }
108
- };
109
- return {
110
- desktop: getVal('desktop', heighValue, autoHeight),
111
- tablet: getVal('tablet', heighValue, autoHeight),
112
- mobile: getVal('mobile', heighValue, autoHeight)
113
- };
114
- };
115
- const makeAspectRatio = (aspectRatio, aspectWidth, aspectHeight)=>{
116
- let result = {};
117
- const DEVICES = [
118
- 'desktop',
119
- 'mobile',
120
- 'tablet'
121
- ];
122
- DEVICES.forEach((device)=>{
123
- const aspectRatioDevice = getResponsiveValueByScreen(aspectRatio, device);
124
- if (aspectRatioDevice !== 'none') {
125
- result = {
126
- ...result,
127
- [device]: aspectRatioDevice !== 'custom' ? aspectRatioDevice : `${getResponsiveValueByScreen(aspectWidth, 'desktop')}/${getResponsiveValueByScreen(aspectHeight, 'desktop')}`
128
- };
129
- }
130
- });
131
- return result;
132
- };
133
- const makeLineClamp = (lineClampValue, hasLineClampValue)=>{
134
- const getVal = (deviceValue, lineClampValue, hasLineClampValue)=>{
135
- const lineClamp = lineClampValue?.[deviceValue];
136
- const hasLineClamp = hasLineClampValue?.[deviceValue] || hasLineClampValue?.['desktop'];
137
- if (hasLineClamp || hasLineClamp === undefined) {
138
- return lineClamp;
139
- }
140
- return 'unset';
141
- };
142
- return {
143
- desktop: getVal('desktop', lineClampValue, hasLineClampValue),
144
- tablet: getVal('tablet', lineClampValue, hasLineClampValue),
145
- mobile: getVal('mobile', lineClampValue, hasLineClampValue)
146
- };
147
- };
148
-
149
- export { makeAspectRatio, makeGlobalSizeHeightResponsive, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleState, makeWidth, removeNullUndefined };
1
+ import{getResponsiveValueByScreen as e}from"./get-resonsive-value.js";let removeNullUndefined=e=>Object.entries(e).reduce((e,[t,l])=>null==l?e:{...e,[t]:l},{}),makeStyleKey=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),makeStyle=e=>removeNullUndefined(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),makeStyleState=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},makeStyleResponsiveState=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},makeStyleResponsive=(e,t,l)=>({[`--${e}`]:l?`${t?.desktop}${l}`:t?.desktop,[`--${e}-tablet`]:l?`${t?.tablet}${l}`:t?.tablet,[`--${e}-mobile`]:l?`${t?.mobile}${l}`:t?.mobile}),makeStyleResponsiveByScreen=(t,l,o)=>({[`--${t}`]:o?`${e(l,"desktop")}${o}`:e(l,"desktop"),[`--${t}-tablet`]:o?`${e(l,"tablet")}${o}`:e(l,"tablet"),[`--${t}-mobile`]:o?`${e(l,"mobile")}${o}`:e(l,"mobile")}),makeWidth=(t,l)=>{let o=(t,l,o)=>{let a=e(l,t),i=o?.[t]===void 0?o?.desktop:o?.[t];return i?"100%":!1===i?a??a:a||"auto"};return{desktop:o("desktop",t,l),tablet:o("tablet",t,l),mobile:o("mobile",t,l)}},makeGlobalSizeWidthResponsive=e=>({"--w":e?.desktop?.width,"--w-tablet":e?.tablet?.width,"--w-mobile":e?.mobile?.width}),makeGlobalSizeHeightResponsive=e=>({"--h":e?.desktop?.height,"--h-tablet":e?.tablet?.height,"--h-mobile":e?.mobile?.height}),makeHeight=(e,t)=>{let l=(e,t,l)=>{let o=t?.[e],a=l?.[e];return a?"auto":!1===a?o??o:o};return{desktop:l("desktop",e,t),tablet:l("tablet",e,t),mobile:l("mobile",e,t)}},makeAspectRatio=(t,l,o)=>{let a={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let m=e(t,i);"none"!==m&&(a={...a,[i]:"custom"!==m?m:`${e(l,"desktop")}/${e(o,"desktop")}`})}),a},makeLineClamp=(e,t)=>{let l=(e,t,l)=>{let o=t?.[e],a=l?.[e]||l?.desktop;return a||void 0===a?o:"unset"};return{desktop:l("desktop",e,t),tablet:l("tablet",e,t),mobile:l("mobile",e,t)}};export{makeAspectRatio,makeGlobalSizeHeightResponsive,makeGlobalSizeWidthResponsive,makeHeight,makeLineClamp,makeStyle,makeStyleKey,makeStyleResponsive,makeStyleResponsiveByScreen,makeStyleResponsiveState,makeStyleState,makeWidth,removeNullUndefined};
@@ -1,21 +1 @@
1
- function normalizeBuilderData(data) {
2
- const result = {};
3
- function compose(data, res = {}) {
4
- const childrens = data.childrens;
5
- const items = childrens?.map((child)=>child.uid) ?? [];
6
- res[data.uid] = {
7
- ...data,
8
- childrens: items,
9
- type: 'component'
10
- };
11
- if (childrens) {
12
- childrens.map((child)=>compose(child, res));
13
- }
14
- }
15
- compose(data, result);
16
- return {
17
- ...result
18
- };
19
- }
20
-
21
- export { normalizeBuilderData };
1
+ function normalizeBuilderData(e){let n={};return!function e(n,i={}){let t=n.childrens,r=t?.map(e=>e.uid)??[];i[n.uid]={...n,childrens:r,type:"component"},t&&t.map(n=>e(n,i))}(e,n),{...n}}export{normalizeBuilderData};
@@ -1,76 +1 @@
1
- import { unstable_serialize } from 'swr';
2
- import { getCollection } from './queries/get-collection.js';
3
- import { getProduct } from './queries/get-product.js';
4
- import { getProducts } from './queries/get-products.js';
5
- import { generateCollectionQueryKey, generateProductsQueryKey, generateProductQueryKey } from './query.js';
6
-
7
- const prefetchQueries = (input, options)=>{
8
- const queries = [];
9
- Object.keys(input).forEach((key)=>{
10
- const item = input[key];
11
- let data = undefined;
12
- switch(item.tag){
13
- case 'Product':
14
- {
15
- if (item.settings?.isAuto) break;
16
- const variables = {
17
- id: item.settings?.productSetting?.productId ?? 'latest',
18
- isSample: options?.isSample,
19
- isStorefront: options?.isStorefront
20
- };
21
- data = {
22
- key: unstable_serialize(generateProductQueryKey(variables)),
23
- func: getProduct,
24
- variables
25
- };
26
- break;
27
- }
28
- case 'ProductList':
29
- {
30
- const productSetting = item.settings?.productSetting;
31
- if (productSetting?.productSrc === 'Collection') {
32
- const variables = {
33
- id: productSetting?.collectionId ?? 'latest',
34
- numberOfProducts: item.settings?.numberOfProducts ?? 4,
35
- orderBy: item.settings?.orderBy,
36
- isSample: options?.isSample,
37
- isStorefront: options?.isStorefront
38
- };
39
- data = {
40
- key: unstable_serialize(generateCollectionQueryKey(variables)),
41
- func: getCollection,
42
- variables
43
- };
44
- } else {
45
- const variables = {
46
- ids: [
47
- ...productSetting?.productIds ?? []
48
- ].sort(),
49
- isSample: options?.isSample,
50
- isStorefront: options?.isStorefront
51
- };
52
- data = {
53
- key: unstable_serialize(generateProductsQueryKey(variables)),
54
- func: getProducts,
55
- variables
56
- };
57
- }
58
- break;
59
- }
60
- }
61
- if (data) {
62
- queries.push(data);
63
- }
64
- });
65
- return queries.reduce((accumulator, current)=>{
66
- if (!accumulator.some((x)=>x.key === current.key)) {
67
- return [
68
- ...accumulator,
69
- current
70
- ];
71
- }
72
- return accumulator;
73
- }, []);
74
- };
75
-
76
- export { prefetchQueries };
1
+ import{unstable_serialize as e}from"swr";import{getCollection as t}from"./queries/get-collection.js";import{getProduct as r}from"./queries/get-product.js";import{getProducts as s}from"./queries/get-products.js";import{generateCollectionQueryKey as o,generateProductsQueryKey as i,generateProductQueryKey as c}from"./query.js";let prefetchQueries=(u,l)=>{let n=[];return Object.keys(u).forEach(p=>{let f;let d=u[p];switch(d.tag){case"Product":{if(d.settings?.isAuto)break;let t={id:d.settings?.productSetting?.productId??"latest",isSample:l?.isSample,isStorefront:l?.isStorefront};f={key:e(c(t)),func:r,variables:t};break}case"ProductList":{let r=d.settings?.productSetting;if(r?.productSrc==="Collection"){let s={id:r?.collectionId??"latest",numberOfProducts:d.settings?.numberOfProducts??4,orderBy:d.settings?.orderBy,isSample:l?.isSample,isStorefront:l?.isStorefront};f={key:e(o(s)),func:t,variables:s}}else{let t={ids:[...r?.productIds??[]].sort(),isSample:l?.isSample,isStorefront:l?.isStorefront};f={key:e(i(t)),func:s,variables:t}}}}f&&n.push(f)}),n.reduce((e,t)=>e.some(e=>e.key===t.key)?e:[...e,t],[])};export{prefetchQueries};
@@ -1,44 +1 @@
1
- import { checkInStock } from './variant.js';
2
-
3
- function getSelectedVariant(variants, choices, variantId) {
4
- /**
5
- * Ensure the user has selected all the required options, not just some.
6
- */ if (!variants || !variants.length || !choices || variants[0]?.selectedOptions.length !== Object.keys(choices).length) {
7
- return;
8
- }
9
- if (variantId) {
10
- return variants.find((variant)=>variant?.id === variantId);
11
- }
12
- return variants.find((variant)=>{
13
- return Object.entries(choices).every(([name, value])=>{
14
- return variant?.selectedOptions.some((option)=>option.name === name && option.value === value);
15
- });
16
- });
17
- }
18
- function parseSelectedOption(options) {
19
- if (!options || options && options.length === 0) {
20
- return;
21
- }
22
- return options.reduce((acc, { name, value })=>{
23
- if (name && value) {
24
- return {
25
- ...acc,
26
- [name]: value
27
- };
28
- }
29
- return acc;
30
- }, {});
31
- }
32
- function checkAvailableVariantInStock(variants, optionId, optionValue) {
33
- return variants ? variants.some((item)=>{
34
- if (item) {
35
- const { selectedOptions } = item;
36
- const opt = selectedOptions?.some((option)=>option?.name === optionId && option.value === optionValue);
37
- const isInStock = checkInStock(item);
38
- return opt && isInStock;
39
- }
40
- return false;
41
- }) : false;
42
- }
43
-
44
- export { checkAvailableVariantInStock, getSelectedVariant, parseSelectedOption };
1
+ import{checkInStock as e}from"./variant.js";function getSelectedVariant(e,t,n){return e&&e.length&&t&&e[0]?.selectedOptions.length===Object.keys(t).length?n?e.find(e=>e?.id===n):e.find(e=>Object.entries(t).every(([t,n])=>e?.selectedOptions.some(e=>e.name===t&&e.value===n))):void 0}function parseSelectedOption(e){if(e&&(!e||0!==e.length))return e.reduce((e,{name:t,value:n})=>t&&n?{...e,[t]:n}:e,{})}function checkAvailableVariantInStock(t,n,r){return!!t&&t.some(t=>{if(t){let{selectedOptions:i}=t,a=i?.some(e=>e?.name===n&&e.value===r),c=e(t);return a&&c}return!1})}export{checkAvailableVariantInStock,getSelectedVariant,parseSelectedOption};