@gem-sdk/core 2.0.0-dev.896 → 2.0.0
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.
- package/dist/cjs/components/AddOn.js +18 -1
- package/dist/cjs/components/ComponentAnimation.js +17 -0
- package/dist/cjs/components/ComponentToolbarPreview.js +752 -1
- package/dist/cjs/components/ComponentWrapper.js +61 -1
- package/dist/cjs/components/ComponentWrapperPreview.js +213 -1
- package/dist/cjs/components/Empty.js +7 -1
- package/dist/cjs/components/InteractionSuffix.js +42 -0
- package/dist/cjs/components/Render.js +75 -1
- package/dist/cjs/components/Render.liquid.js +313 -17
- package/dist/cjs/components/RenderBlock.js +54 -1
- package/dist/cjs/components/RenderCustomCode.js +59 -3
- package/dist/cjs/components/RenderPreview.js +67 -1
- package/dist/cjs/components/RenderSection.js +23 -1
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +252 -1
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +85 -1
- package/dist/cjs/components/ai-generator/components/PickProduct.js +220 -1
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +77 -1
- package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +47 -0
- package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +110 -0
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +37 -1
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +70 -1
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +67 -1
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +19 -1
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +37 -1
- package/dist/cjs/components/ai-generator/icons/SearchIcon.js +21 -1
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +21 -1
- package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +27 -0
- package/dist/cjs/components/ai-generator/icons/WarningIcon.js +31 -0
- package/dist/cjs/components/constant.js +83 -1
- package/dist/cjs/components/resize/Resize.js +16 -1
- package/dist/cjs/components/resize/Spacing.js +260 -1
- package/dist/cjs/components/src/product/helpers/variant-presets.js +56 -1
- package/dist/cjs/components/theme-section/CreateThemeSection.js +123 -1
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +45 -1
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +126 -1
- package/dist/cjs/components/toolbar/Tooltip.js +28 -1
- package/dist/cjs/contexts/AddonContext.js +36 -1
- package/dist/cjs/contexts/ArticleContext.js +39 -1
- package/dist/cjs/contexts/ArticleListContext.js +31 -1
- package/dist/cjs/contexts/BuilderComponent.js +34 -1
- package/dist/cjs/contexts/BuilderContext.js +39 -1
- package/dist/cjs/contexts/BuilderPreviewContext.js +486 -1
- package/dist/cjs/contexts/CartLineContext.js +29 -1
- package/dist/cjs/contexts/CollectionContext.js +38 -1
- package/dist/cjs/contexts/ModalContext.js +47 -1
- package/dist/cjs/contexts/PageContext.js +104 -1
- package/dist/cjs/contexts/ProductContext.js +177 -1
- package/dist/cjs/contexts/ProductListContext.js +32 -1
- package/dist/cjs/contexts/SectionContext.js +53 -1
- package/dist/cjs/contexts/ShopContext.js +107 -1
- package/dist/cjs/graphql/fragments/analytic.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection-product.generated.js +6 -2
- package/dist/cjs/graphql/fragments/collection.generated.js +6 -2
- package/dist/cjs/graphql/fragments/custom-code.generated.js +6 -2
- package/dist/cjs/graphql/fragments/custom-font.generated.js +6 -2
- package/dist/cjs/graphql/fragments/data-seo.generated.js +6 -2
- package/dist/cjs/graphql/fragments/media.generated.js +6 -2
- package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +39 -0
- package/dist/cjs/graphql/fragments/product-little.generated.js +7 -2
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +6 -2
- package/dist/cjs/graphql/fragments/product-option.generated.js +6 -2
- package/dist/cjs/graphql/fragments/product.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +6 -2
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +10 -28
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +6 -2
- package/dist/cjs/graphql/fragments/selected-option.generated.js +6 -2
- package/dist/cjs/graphql/fragments/variant.generated.js +6 -2
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +8 -4
- package/dist/cjs/graphql/queries/articles.generated.js +61 -0
- package/dist/cjs/graphql/queries/blogs.generated.js +69 -0
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +16 -2
- package/dist/cjs/graphql/queries/collection.generated.js +14 -2
- package/dist/cjs/graphql/queries/collections.generated.js +9 -2
- package/dist/cjs/graphql/queries/preview-page.generated.js +16 -8
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +11 -2
- package/dist/cjs/graphql/queries/product-medias.generated.js +8 -2
- package/dist/cjs/graphql/queries/product-value-label.generated.js +6 -2
- package/dist/cjs/graphql/queries/product-variants.generated.js +10 -2
- package/dist/cjs/graphql/queries/products.generated.js +17 -3
- package/dist/cjs/graphql/queries/published-shop-metas.js +15 -0
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +15 -2
- package/dist/cjs/graphql/queries/store-property.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +6 -2
- package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +17 -0
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +6 -2
- package/dist/cjs/helpers/GlobalEvent.js +19 -1
- package/dist/cjs/helpers/align.js +19 -0
- package/dist/cjs/helpers/animations.js +222 -1
- package/dist/cjs/helpers/background.js +235 -1
- package/dist/cjs/helpers/borders.js +198 -4
- package/dist/cjs/helpers/carousel.js +55 -1
- package/dist/cjs/helpers/clone-deep.js +5 -1
- package/dist/cjs/helpers/cls.js +16 -1
- package/dist/cjs/helpers/colors.js +184 -1
- package/dist/cjs/helpers/compose-advance-style.js +327 -1
- package/dist/cjs/helpers/constant.js +23 -1
- package/dist/cjs/helpers/convert.js +7 -1
- package/dist/cjs/helpers/covert-entities-html.js +19 -1
- package/dist/cjs/helpers/css-variable.js +7 -1
- package/dist/cjs/helpers/email.js +11 -1
- package/dist/cjs/helpers/filter-toolbar-preview.js +14 -1
- package/dist/cjs/helpers/flatten-connection.js +9 -1
- package/dist/cjs/helpers/get-resonsive-value.js +36 -1
- package/dist/cjs/helpers/get-shortname.js +92 -1
- package/dist/cjs/helpers/icon-list.js +61 -1
- package/dist/cjs/helpers/interaction/index.js +134 -0
- package/dist/cjs/helpers/is-browser.js +9 -1
- package/dist/cjs/helpers/is-defined.js +7 -1
- package/dist/cjs/helpers/is-empty-children.js +15 -1
- package/dist/cjs/helpers/is-safari.js +9 -1
- package/dist/cjs/helpers/layout.js +59 -1
- package/dist/cjs/helpers/load-script.js +31 -1
- package/dist/cjs/helpers/loop-component.js +16 -0
- package/dist/cjs/helpers/make-style.js +163 -1
- package/dist/cjs/helpers/normalize-builder-data.js +23 -1
- package/dist/cjs/helpers/pascal-to-kebab-case.js +7 -0
- package/dist/cjs/helpers/prefetch-queries.js +78 -1
- package/dist/cjs/helpers/product.js +48 -1
- package/dist/cjs/helpers/queries/get-collection.js +226 -1
- package/dist/cjs/helpers/queries/get-collections.js +21 -1
- package/dist/cjs/helpers/queries/get-product-by-slug.js +125 -1
- package/dist/cjs/helpers/queries/get-product.js +154 -1
- package/dist/cjs/helpers/queries/get-products.js +214 -1
- package/dist/cjs/helpers/query.js +29 -1
- package/dist/cjs/helpers/radius.js +140 -6
- package/dist/cjs/helpers/render.js +78 -1
- package/dist/cjs/helpers/shadow.js +69 -1
- package/dist/cjs/helpers/size.js +206 -4
- package/dist/cjs/helpers/spacing.js +43 -1
- package/dist/cjs/helpers/third-party/addAppBlockId.js +20 -0
- package/dist/cjs/helpers/third-party/appConfig.js +234 -0
- package/dist/cjs/helpers/third-party/appSetting.js +661 -0
- package/dist/cjs/helpers/third-party/composeAppBlockId.js +11 -0
- package/dist/cjs/helpers/third-party/constant.js +43 -0
- package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +34 -0
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +47 -0
- package/dist/cjs/helpers/third-party/getAppBlockType.js +12 -0
- package/dist/cjs/helpers/third-party/getAppBlocks.js +30 -0
- package/dist/cjs/helpers/third-party/mergeBlock.js +19 -0
- package/dist/cjs/helpers/third-party/mergeBlockOrder.js +47 -0
- package/dist/cjs/helpers/third-party/removeGPAppItems.js +18 -0
- package/dist/cjs/helpers/tracking/fpixel.js +28 -1
- package/dist/cjs/helpers/tracking/gtag.js +93 -1
- package/dist/cjs/helpers/tracking/tiktokpixel.js +17 -1
- package/dist/cjs/helpers/typography.js +160 -17
- package/dist/cjs/helpers/variant.js +11 -1
- package/dist/cjs/hooks/animation/useAnimationActions.js +39 -1
- package/dist/cjs/hooks/animation/useAnimationConfig.js +30 -1
- package/dist/cjs/hooks/animation/useAnimationPreview.js +31 -1
- package/dist/cjs/hooks/animation/useAnimationTarget.js +122 -1
- package/dist/cjs/hooks/animation/useApplyAnimation.js +89 -1
- package/dist/cjs/hooks/articles/useArticlesQuery.js +33 -1
- package/dist/cjs/hooks/cart/use-add-to-cart.js +20 -1
- package/dist/cjs/hooks/cart/use-cart-data.js +28 -1
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +20 -1
- package/dist/cjs/hooks/cart/use-cart-note-update.js +20 -1
- package/dist/cjs/hooks/cart/use-create-cart.js +22 -1
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +20 -1
- package/dist/cjs/hooks/cart/use-update-cart-item.js +20 -1
- package/dist/cjs/hooks/shop/use-collection-query.js +22 -1
- package/dist/cjs/hooks/shop/use-collections-query.js +17 -1
- package/dist/cjs/hooks/shop/use-product-query.js +22 -1
- package/dist/cjs/hooks/shop/use-products-query.js +63 -1
- package/dist/cjs/hooks/shop.js +126 -1
- package/dist/cjs/hooks/use-current-device.js +30 -1
- package/dist/cjs/hooks/use-lazy-video.js +15 -1
- package/dist/cjs/hooks/useAnimations.js +29 -1
- package/dist/cjs/hooks/useCartId.js +44 -1
- package/dist/cjs/hooks/useCartLine.js +11 -1
- package/dist/cjs/hooks/useCartUI.js +48 -1
- package/dist/cjs/hooks/useCollection.js +9 -1
- package/dist/cjs/hooks/useFetchHandle.js +13 -1
- package/dist/cjs/hooks/useFormatMoney.js +75 -1
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +128 -1
- package/dist/cjs/hooks/useInteraction.js +19 -0
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +10 -1
- package/dist/cjs/hooks/useLoadScript.js +32 -1
- package/dist/cjs/hooks/useMoney.js +84 -1
- package/dist/cjs/hooks/usePrevious.js +19 -1
- package/dist/cjs/hooks/useProduct.js +245 -1
- package/dist/cjs/hooks/useProductList.js +21 -1
- package/dist/cjs/hooks/useSuspenseFetch.js +27 -1
- package/dist/cjs/hooks/useSwatchesOptions.js +41 -1
- package/dist/cjs/hooks/useToolbarPostPurchase.js +89 -1
- package/dist/cjs/index.js +416 -1
- package/dist/cjs/types/animations.js +49 -1
- package/dist/cjs/types/appAPI.js +2 -1
- package/dist/cjs/types/custom.js +52 -0
- package/dist/cjs/types/global-style.js +15 -1
- package/dist/cjs/types/shop.js +2 -1
- package/dist/cjs/web-components/src/helpers/styles/constant.js +9 -1
- package/dist/esm/components/AddOn.js +14 -1
- package/dist/esm/components/ComponentAnimation.js +13 -0
- package/dist/esm/components/ComponentToolbarPreview.js +748 -1
- package/dist/esm/components/ComponentWrapper.js +57 -1
- package/dist/esm/components/ComponentWrapperPreview.js +209 -1
- package/dist/esm/components/Empty.js +3 -1
- package/dist/esm/components/InteractionSuffix.js +40 -0
- package/dist/esm/components/Render.js +71 -1
- package/dist/esm/components/Render.liquid.js +307 -17
- package/dist/esm/components/RenderBlock.js +50 -1
- package/dist/esm/components/RenderCustomCode.js +55 -3
- package/dist/esm/components/RenderPreview.js +63 -1
- package/dist/esm/components/RenderSection.js +19 -1
- package/dist/esm/components/ai-generator/AIContentGenerator.js +250 -1
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +83 -1
- package/dist/esm/components/ai-generator/components/PickProduct.js +218 -1
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +75 -1
- package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +45 -0
- package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +108 -0
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +35 -1
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +68 -1
- package/dist/esm/components/ai-generator/icons/AIIcon.js +65 -1
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +17 -1
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +34 -1
- package/dist/esm/components/ai-generator/icons/SearchIcon.js +19 -1
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +19 -1
- package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +25 -0
- package/dist/esm/components/ai-generator/icons/WarningIcon.js +29 -0
- package/dist/esm/components/constant.js +76 -1
- package/dist/esm/components/resize/Resize.js +12 -1
- package/dist/esm/components/resize/Spacing.js +256 -1
- package/dist/esm/components/src/product/helpers/variant-presets.js +54 -1
- package/dist/esm/components/theme-section/CreateThemeSection.js +121 -1
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +43 -1
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +124 -1
- package/dist/esm/components/toolbar/Tooltip.js +24 -1
- package/dist/esm/contexts/AddonContext.js +32 -1
- package/dist/esm/contexts/ArticleContext.js +36 -1
- package/dist/esm/contexts/ArticleListContext.js +27 -1
- package/dist/esm/contexts/BuilderComponent.js +31 -1
- package/dist/esm/contexts/BuilderContext.js +36 -1
- package/dist/esm/contexts/BuilderPreviewContext.js +483 -1
- package/dist/esm/contexts/CartLineContext.js +26 -1
- package/dist/esm/contexts/CollectionContext.js +35 -1
- package/dist/esm/contexts/ModalContext.js +44 -1
- package/dist/esm/contexts/PageContext.js +101 -1
- package/dist/esm/contexts/ProductContext.js +174 -1
- package/dist/esm/contexts/ProductListContext.js +28 -1
- package/dist/esm/contexts/SectionContext.js +49 -1
- package/dist/esm/contexts/ShopContext.js +104 -1
- package/dist/esm/graphql/fragments/analytic.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection-detail.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection-product.generated.js +4 -2
- package/dist/esm/graphql/fragments/collection.generated.js +4 -2
- package/dist/esm/graphql/fragments/custom-code.generated.js +4 -2
- package/dist/esm/graphql/fragments/custom-font.generated.js +4 -2
- package/dist/esm/graphql/fragments/data-seo.generated.js +4 -2
- package/dist/esm/graphql/fragments/media.generated.js +4 -2
- package/dist/esm/graphql/fragments/preview-theme-page.generated.js +37 -0
- package/dist/esm/graphql/fragments/product-little.generated.js +5 -2
- package/dist/esm/graphql/fragments/product-option-value.generated.js +4 -2
- package/dist/esm/graphql/fragments/product-option.generated.js +4 -2
- package/dist/esm/graphql/fragments/product.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-page-section.generated.js +4 -2
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +8 -28
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +4 -2
- package/dist/esm/graphql/fragments/selected-option.generated.js +4 -2
- package/dist/esm/graphql/fragments/variant.generated.js +4 -2
- package/dist/esm/graphql/mutations/page-view-up.generated.js +6 -4
- package/dist/esm/graphql/queries/articles.generated.js +59 -0
- package/dist/esm/graphql/queries/blogs.generated.js +67 -0
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +22 -10
- package/dist/esm/graphql/queries/collection.generated.js +18 -8
- package/dist/esm/graphql/queries/collections.generated.js +8 -3
- package/dist/esm/graphql/queries/preview-page.generated.js +16 -10
- package/dist/esm/graphql/queries/product-little-detail.generated.js +12 -5
- package/dist/esm/graphql/queries/product-medias.generated.js +6 -2
- package/dist/esm/graphql/queries/product-value-label.generated.js +4 -2
- package/dist/esm/graphql/queries/product-variants.generated.js +10 -4
- package/dist/esm/graphql/queries/products.generated.js +20 -9
- package/dist/esm/graphql/queries/published-shop-metas.js +13 -0
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +20 -9
- package/dist/esm/graphql/queries/store-property.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +4 -2
- package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +15 -0
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +4 -2
- package/dist/esm/helpers/GlobalEvent.js +15 -1
- package/dist/esm/helpers/align.js +17 -0
- package/dist/esm/helpers/animations.js +220 -1
- package/dist/esm/helpers/background.js +226 -1
- package/dist/esm/helpers/borders.js +189 -4
- package/dist/esm/helpers/carousel.js +51 -1
- package/dist/esm/helpers/clone-deep.js +3 -1
- package/dist/esm/helpers/cls.js +14 -1
- package/dist/esm/helpers/colors.js +169 -1
- package/dist/esm/helpers/compose-advance-style.js +319 -1
- package/dist/esm/helpers/constant.js +19 -1
- package/dist/esm/helpers/convert.js +4 -1
- package/dist/esm/helpers/covert-entities-html.js +17 -1
- package/dist/esm/helpers/css-variable.js +5 -1
- package/dist/esm/helpers/email.js +6 -1
- package/dist/esm/helpers/filter-toolbar-preview.js +9 -1
- package/dist/esm/helpers/flatten-connection.js +7 -1
- package/dist/esm/helpers/get-resonsive-value.js +31 -1
- package/dist/esm/helpers/get-shortname.js +90 -1
- package/dist/esm/helpers/icon-list.js +58 -1
- package/dist/esm/helpers/interaction/index.js +132 -0
- package/dist/esm/helpers/is-browser.js +5 -1
- package/dist/esm/helpers/is-defined.js +5 -1
- package/dist/esm/helpers/is-empty-children.js +10 -1
- package/dist/esm/helpers/is-safari.js +5 -1
- package/dist/esm/helpers/layout.js +54 -1
- package/dist/esm/helpers/load-script.js +29 -1
- package/dist/esm/helpers/loop-component.js +14 -0
- package/dist/esm/helpers/make-style.js +149 -1
- package/dist/esm/helpers/normalize-builder-data.js +21 -1
- package/dist/esm/helpers/pascal-to-kebab-case.js +5 -0
- package/dist/esm/helpers/prefetch-queries.js +76 -1
- package/dist/esm/helpers/product.js +44 -1
- package/dist/esm/helpers/queries/get-collection.js +223 -1
- package/dist/esm/helpers/queries/get-collections.js +19 -1
- package/dist/esm/helpers/queries/get-product-by-slug.js +123 -1
- package/dist/esm/helpers/queries/get-product.js +150 -1
- package/dist/esm/helpers/queries/get-products.js +210 -1
- package/dist/esm/helpers/query.js +25 -1
- package/dist/esm/helpers/radius.js +132 -6
- package/dist/esm/helpers/render.js +70 -1
- package/dist/esm/helpers/shadow.js +63 -1
- package/dist/esm/helpers/size.js +192 -4
- package/dist/esm/helpers/spacing.js +40 -1
- package/dist/esm/helpers/third-party/addAppBlockId.js +18 -0
- package/dist/esm/helpers/third-party/appConfig.js +200 -0
- package/dist/esm/helpers/third-party/appSetting.js +658 -0
- package/dist/esm/helpers/third-party/composeAppBlockId.js +9 -0
- package/dist/esm/helpers/third-party/constant.js +40 -0
- package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +32 -0
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +45 -0
- package/dist/esm/helpers/third-party/getAppBlockType.js +10 -0
- package/dist/esm/helpers/third-party/getAppBlocks.js +28 -0
- package/dist/esm/helpers/third-party/mergeBlock.js +17 -0
- package/dist/esm/helpers/third-party/mergeBlockOrder.js +45 -0
- package/dist/esm/helpers/third-party/removeGPAppItems.js +15 -0
- package/dist/esm/helpers/tracking/fpixel.js +24 -1
- package/dist/esm/helpers/tracking/gtag.js +87 -1
- package/dist/esm/helpers/tracking/tiktokpixel.js +15 -1
- package/dist/esm/helpers/typography.js +149 -17
- package/dist/esm/helpers/variant.js +9 -1
- package/dist/esm/hooks/animation/useAnimationActions.js +37 -1
- package/dist/esm/hooks/animation/useAnimationConfig.js +28 -1
- package/dist/esm/hooks/animation/useAnimationPreview.js +29 -1
- package/dist/esm/hooks/animation/useAnimationTarget.js +120 -1
- package/dist/esm/hooks/animation/useApplyAnimation.js +85 -1
- package/dist/esm/hooks/articles/useArticlesQuery.js +30 -1
- package/dist/esm/hooks/cart/use-add-to-cart.js +18 -1
- package/dist/esm/hooks/cart/use-cart-data.js +26 -1
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +18 -1
- package/dist/esm/hooks/cart/use-cart-note-update.js +18 -1
- package/dist/esm/hooks/cart/use-create-cart.js +20 -1
- package/dist/esm/hooks/cart/use-remove-cart-item.js +18 -1
- package/dist/esm/hooks/cart/use-update-cart-item.js +18 -1
- package/dist/esm/hooks/shop/use-collection-query.js +20 -1
- package/dist/esm/hooks/shop/use-collections-query.js +15 -1
- package/dist/esm/hooks/shop/use-product-query.js +20 -1
- package/dist/esm/hooks/shop/use-products-query.js +59 -1
- package/dist/esm/hooks/shop.js +111 -1
- package/dist/esm/hooks/use-current-device.js +28 -1
- package/dist/esm/hooks/use-lazy-video.js +13 -1
- package/dist/esm/hooks/useAnimations.js +27 -1
- package/dist/esm/hooks/useCartId.js +40 -1
- package/dist/esm/hooks/useCartLine.js +7 -1
- package/dist/esm/hooks/useCartUI.js +44 -1
- package/dist/esm/hooks/useCollection.js +7 -1
- package/dist/esm/hooks/useFetchHandle.js +11 -1
- package/dist/esm/hooks/useFormatMoney.js +71 -1
- package/dist/esm/hooks/useInitialSwatchesOptions.js +124 -1
- package/dist/esm/hooks/useInteraction.js +17 -0
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +6 -1
- package/dist/esm/hooks/useLoadScript.js +28 -1
- package/dist/esm/hooks/useMoney.js +80 -1
- package/dist/esm/hooks/usePrevious.js +17 -1
- package/dist/esm/hooks/useProduct.js +228 -1
- package/dist/esm/hooks/useProductList.js +16 -1
- package/dist/esm/hooks/useSuspenseFetch.js +23 -1
- package/dist/esm/hooks/useSwatchesOptions.js +37 -1
- package/dist/esm/hooks/useToolbarPostPurchase.js +87 -1
- package/dist/esm/index.js +117 -1
- package/dist/esm/types/animations.js +49 -1
- package/dist/esm/types/custom.js +52 -0
- package/dist/esm/types/global-style.js +12 -1
- package/dist/esm/web-components/src/helpers/styles/constant.js +7 -1
- package/dist/types/index.d.ts +23183 -17335
- package/package.json +5 -3
- package/dist/cjs/components/animation/AnimationWrapper.js +0 -1
- package/dist/cjs/hooks/animation/animations.js +0 -1
- package/dist/cjs/hooks/animation/useLivePageAnimation.js +0 -1
- package/dist/esm/components/animation/AnimationWrapper.js +0 -1
- package/dist/esm/hooks/animation/animations.js +0 -1
- package/dist/esm/hooks/animation/useLivePageAnimation.js +0 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable */ const ThemePageDocument = `
|
|
2
4
|
query ThemePage($themePageId: ID!, $first: Int, $where: ThemeStyleWhereInput) {
|
|
3
5
|
themePage(id: $themePageId) {
|
|
4
6
|
id
|
|
@@ -26,4 +28,6 @@
|
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
|
-
`;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports.ThemePageDocument = ThemePageDocument;
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const globalEvent = {
|
|
6
|
+
subscribe (eventName, callback) {
|
|
7
|
+
document.addEventListener(eventName, (e)=>callback(e.detail));
|
|
8
|
+
},
|
|
9
|
+
dispatch (eventName, detail) {
|
|
10
|
+
document.dispatchEvent(new CustomEvent(eventName, {
|
|
11
|
+
detail
|
|
12
|
+
}));
|
|
13
|
+
},
|
|
14
|
+
remove (eventName, callback) {
|
|
15
|
+
document.removeEventListener(eventName, callback);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.default = globalEvent;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const convertTextAlignToJustify = (align)=>{
|
|
4
|
+
const devices = [
|
|
5
|
+
'desktop',
|
|
6
|
+
'tablet',
|
|
7
|
+
'mobile'
|
|
8
|
+
];
|
|
9
|
+
const result = {};
|
|
10
|
+
devices.forEach((device)=>{
|
|
11
|
+
const deviceType = device === 'desktop' ? '' : `${device}:`;
|
|
12
|
+
result[`${deviceType}gp-justify-start`] = align?.[device] === 'left';
|
|
13
|
+
result[`${deviceType}gp-justify-center`] = align?.[device] === 'center';
|
|
14
|
+
result[`${deviceType}gp-justify-end`] = align?.[device] === 'right';
|
|
15
|
+
});
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.convertTextAlignToJustify = convertTextAlignToJustify;
|
|
@@ -1 +1,222 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const EASING = {
|
|
4
|
+
ease: 'cubic-bezier(0.46,0.03,0.52,0.96)',
|
|
5
|
+
'ease-in': 'cubic-bezier(0.55,0.08,0.68,0.53)',
|
|
6
|
+
'ease-out': 'cubic-bezier(0.46,0.03,0.52,0.96)',
|
|
7
|
+
linear: 'linear'
|
|
8
|
+
};
|
|
9
|
+
const animations = ()=>{
|
|
10
|
+
const normalizeOptions = (options)=>{
|
|
11
|
+
const cloneOptions = JSON.parse(JSON.stringify(options));
|
|
12
|
+
const numberMember = [
|
|
13
|
+
'delay',
|
|
14
|
+
'speed',
|
|
15
|
+
'scale',
|
|
16
|
+
'intensity'
|
|
17
|
+
];
|
|
18
|
+
numberMember.forEach((keyName)=>{
|
|
19
|
+
if (!cloneOptions?.[keyName]) return;
|
|
20
|
+
if (keyName === 'scale') {
|
|
21
|
+
if (!cloneOptions?.zoomDirection) throw new TypeError(`zoomDirection not found on zoom preset`);
|
|
22
|
+
const [i1, i2] = cloneOptions?.scale?.in ?? [
|
|
23
|
+
1,
|
|
24
|
+
1
|
|
25
|
+
];
|
|
26
|
+
const [o1, o2] = cloneOptions?.scale?.out ?? [
|
|
27
|
+
1,
|
|
28
|
+
1
|
|
29
|
+
];
|
|
30
|
+
cloneOptions[keyName] = {
|
|
31
|
+
in: [
|
|
32
|
+
Number(i1) / 100,
|
|
33
|
+
Number(i2) / 100
|
|
34
|
+
],
|
|
35
|
+
out: [
|
|
36
|
+
Number(o1) / 100,
|
|
37
|
+
Number(o2) / 100
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const num = Number(cloneOptions?.[keyName]);
|
|
43
|
+
if (keyName === 'delay') cloneOptions[keyName] = num * 1000;
|
|
44
|
+
else cloneOptions[keyName] = num;
|
|
45
|
+
if (!isFinite(num)) throw new TypeError(`${keyName} must be a number`);
|
|
46
|
+
});
|
|
47
|
+
return cloneOptions;
|
|
48
|
+
};
|
|
49
|
+
const slide = (target, options, reverse)=>{
|
|
50
|
+
const normalizedOptions = normalizeOptions(options);
|
|
51
|
+
const { direction, distance } = normalizedOptions;
|
|
52
|
+
const coordinate = [
|
|
53
|
+
'left',
|
|
54
|
+
'right'
|
|
55
|
+
].includes(direction ?? '') ? 'X' : 'Y';
|
|
56
|
+
let isNeg = [
|
|
57
|
+
'left',
|
|
58
|
+
'down'
|
|
59
|
+
].includes(direction ?? '') ? '-' : '';
|
|
60
|
+
if (reverse) {
|
|
61
|
+
isNeg = [
|
|
62
|
+
'left',
|
|
63
|
+
'down'
|
|
64
|
+
].includes(direction ?? '') ? '' : '-';
|
|
65
|
+
}
|
|
66
|
+
const preset = [
|
|
67
|
+
{
|
|
68
|
+
opacity: 0,
|
|
69
|
+
transform: `translate${coordinate}(${isNeg}${distance ?? 50}%)`
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
opacity: 1,
|
|
73
|
+
transform: `translate${coordinate}(0)`
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
return generateAnimationInstance(target, reverse ? preset.reverse() : preset, {
|
|
77
|
+
...generateOptions(normalizedOptions, 500)
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
const fade = (target, options, reverse)=>{
|
|
81
|
+
const normalizedOptions = normalizeOptions(options);
|
|
82
|
+
const preset = [
|
|
83
|
+
{
|
|
84
|
+
opacity: 0
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
opacity: 1
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
return generateAnimationInstance(target, reverse ? preset.reverse() : preset, {
|
|
91
|
+
...generateOptions(normalizedOptions, 500)
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
const generateOptions = (options, defaultDuration)=>{
|
|
95
|
+
const convertSpeedToDuration = (speed)=>{
|
|
96
|
+
if (!speed) return defaultDuration;
|
|
97
|
+
return 1.5 / speed * 1000;
|
|
98
|
+
};
|
|
99
|
+
const { loop, delay, speed, easing } = options ?? {};
|
|
100
|
+
const duration = convertSpeedToDuration(speed);
|
|
101
|
+
const actualDelay = delay ?? 0;
|
|
102
|
+
const actualDuration = loop ? duration + actualDelay : duration;
|
|
103
|
+
return {
|
|
104
|
+
iterations: loop ? Infinity : 1,
|
|
105
|
+
duration: actualDuration,
|
|
106
|
+
delay: actualDelay,
|
|
107
|
+
easing: EASING[easing ?? 'linear']
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
const zoom = (target, options, reverse)=>{
|
|
111
|
+
const normalizedOptions = normalizeOptions(options);
|
|
112
|
+
const { scale, zoomDirection, isFade } = normalizedOptions;
|
|
113
|
+
const [i1, i2] = scale.in;
|
|
114
|
+
const [o1, o2] = scale.out;
|
|
115
|
+
const zoomInPreset = [
|
|
116
|
+
{
|
|
117
|
+
transform: `scale(${i1}, ${i1})`,
|
|
118
|
+
opacity: isFade ? 0 : 1
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
transform: `scale(${i2 ?? 1.2}, ${i2 ?? 1.2})`,
|
|
122
|
+
opacity: 1
|
|
123
|
+
}
|
|
124
|
+
];
|
|
125
|
+
const zoomOutPreset = [
|
|
126
|
+
{
|
|
127
|
+
transform: `scale(${o1}, ${o1})`,
|
|
128
|
+
opacity: isFade ? 0 : 1
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
transform: `scale(${o2 ?? 0.8}, ${o2 ?? 0.8})`,
|
|
132
|
+
opacity: 1
|
|
133
|
+
}
|
|
134
|
+
];
|
|
135
|
+
let zoomPreset = zoomDirection === 'in' ? zoomInPreset : zoomOutPreset;
|
|
136
|
+
if (reverse) {
|
|
137
|
+
zoomPreset = zoomDirection === 'in' ? zoomOutPreset : zoomInPreset;
|
|
138
|
+
}
|
|
139
|
+
return generateAnimationInstance(target, reverse ? zoomPreset.reverse() : zoomPreset, {
|
|
140
|
+
...generateOptions(normalizedOptions, 700)
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
const generateLoopDelayEffect = (keyframes, delay, duration)=>{
|
|
144
|
+
if (!delay) return keyframes;
|
|
145
|
+
const offset = delay / duration;
|
|
146
|
+
const keyframe = [
|
|
147
|
+
...keyframes
|
|
148
|
+
].pop();
|
|
149
|
+
return [
|
|
150
|
+
...keyframes,
|
|
151
|
+
{
|
|
152
|
+
...keyframe,
|
|
153
|
+
offset: 1 - offset
|
|
154
|
+
}
|
|
155
|
+
];
|
|
156
|
+
};
|
|
157
|
+
const shake = (target, options)=>{
|
|
158
|
+
const normalizedOptions = normalizeOptions(options);
|
|
159
|
+
const { intensity } = normalizedOptions ?? {};
|
|
160
|
+
const zeroIntensity = [
|
|
161
|
+
{
|
|
162
|
+
transform: 'translate3d(0, 0, 0)'
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
const unitIntensity = [
|
|
166
|
+
{
|
|
167
|
+
transform: 'translate3d(4px, 0, 0)'
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
transform: 'translate3d(-4px, 0, 0)'
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
transform: 'translate3d(4px, 0, 0)'
|
|
174
|
+
}
|
|
175
|
+
];
|
|
176
|
+
let keyframes = [];
|
|
177
|
+
Array.from(Array(intensity ?? 1).keys()).forEach(()=>{
|
|
178
|
+
keyframes = [
|
|
179
|
+
...keyframes,
|
|
180
|
+
...unitIntensity
|
|
181
|
+
];
|
|
182
|
+
});
|
|
183
|
+
const shakePreset = [
|
|
184
|
+
{
|
|
185
|
+
transform: 'translate3d(-1px, 0, 0)'
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
transform: 'translate3d(2px, 0, 0)'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
transform: 'translate3d(-4px, 0, 0)'
|
|
192
|
+
},
|
|
193
|
+
...keyframes,
|
|
194
|
+
{
|
|
195
|
+
transform: 'translate3d(-4px, 0, 0)'
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
transform: 'translate3d(2px, 0, 0)'
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
transform: 'translate3d(-1px, 0, 0)'
|
|
202
|
+
}
|
|
203
|
+
];
|
|
204
|
+
return generateAnimationInstance(target, intensity ? shakePreset : zeroIntensity, {
|
|
205
|
+
...generateOptions(normalizedOptions ?? {}, 820)
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
const generateAnimationInstance = (target, effectPreset, options)=>{
|
|
209
|
+
const effect = new KeyframeEffect(target, options.iterations && options.iterations === 1 ? effectPreset : generateLoopDelayEffect(effectPreset, options?.delay ?? 0, (options?.duration) ?? 0), {
|
|
210
|
+
...options
|
|
211
|
+
});
|
|
212
|
+
return new Animation(effect, document.timeline);
|
|
213
|
+
};
|
|
214
|
+
return {
|
|
215
|
+
zoom,
|
|
216
|
+
shake,
|
|
217
|
+
fade,
|
|
218
|
+
slide
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
exports.animations = animations;
|
|
@@ -1 +1,235 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constant = require('./constant.js');
|
|
4
|
+
var colors = require('./colors.js');
|
|
5
|
+
var makeStyle = require('./make-style.js');
|
|
6
|
+
|
|
7
|
+
const getStyleBackgroundByDevice = (background, options)=>{
|
|
8
|
+
if (!background) {
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
...!options?.ignoreBackgroundColor ? {
|
|
13
|
+
...getStyleBgColor(background)
|
|
14
|
+
} : {},
|
|
15
|
+
...!options?.ignoreBackgroundImage ? {
|
|
16
|
+
...getStyleBgImage(background, options)
|
|
17
|
+
} : {},
|
|
18
|
+
...!options?.ignoreBackgroundImageProperties ? {
|
|
19
|
+
...getStyleBgPosition(background),
|
|
20
|
+
...getStyleBgSize(background),
|
|
21
|
+
...getStyleBgRepeat(background)
|
|
22
|
+
} : {},
|
|
23
|
+
...!options?.ignoreBgAttachment ? getStyleBgAttachment(background) : {}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const getStyleBgColor = (background)=>{
|
|
27
|
+
const bgColor = {
|
|
28
|
+
desktop: getBgColorByDevice(background, 'desktop'),
|
|
29
|
+
tablet: getBgColorByDevice(background, 'tablet'),
|
|
30
|
+
mobile: getBgColorByDevice(background, 'mobile')
|
|
31
|
+
};
|
|
32
|
+
return makeStyle.makeStyleResponsive('bgc', bgColor);
|
|
33
|
+
};
|
|
34
|
+
const getBgColorByDevice = (background, device)=>{
|
|
35
|
+
return getColor(background?.[device]?.color);
|
|
36
|
+
};
|
|
37
|
+
const getColor = (color)=>{
|
|
38
|
+
if (!color) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (colors.isColor(color?.toString())) {
|
|
42
|
+
return color;
|
|
43
|
+
}
|
|
44
|
+
return `var(--g-c-${color})`;
|
|
45
|
+
};
|
|
46
|
+
const getStyleBgImage = (background, options)=>{
|
|
47
|
+
const bgImage = {
|
|
48
|
+
desktop: getBgImageByDevice(background, 'desktop', options),
|
|
49
|
+
tablet: getBgImageByDevice(background, 'tablet', options),
|
|
50
|
+
mobile: getBgImageByDevice(background, 'mobile', options)
|
|
51
|
+
};
|
|
52
|
+
return makeStyle.makeStyleResponsive('bgi', bgImage);
|
|
53
|
+
};
|
|
54
|
+
const getBgImageByDevice = (background, device, options)=>{
|
|
55
|
+
const isBgVideo = background?.[device]?.type === 'video';
|
|
56
|
+
if (isBgVideo) return;
|
|
57
|
+
const backupFileKey = background?.[device]?.image?.backupFileKey;
|
|
58
|
+
const storage = background?.[device]?.image?.storage;
|
|
59
|
+
let imageByDevice = background?.[device]?.image?.src;
|
|
60
|
+
let newBackupFilekey = backupFileKey;
|
|
61
|
+
const shopifyHandleName = imageByDevice?.match(// eslint-disable-next-line
|
|
62
|
+
/\/files\/([^\/]+\.(jpg|jpeg|gif|png|webp|svg))/)?.[1];
|
|
63
|
+
if (backupFileKey && shopifyHandleName && shopifyHandleName != backupFileKey) {
|
|
64
|
+
newBackupFilekey = shopifyHandleName;
|
|
65
|
+
}
|
|
66
|
+
if (storage === 'FILE_CONTENT') {
|
|
67
|
+
if (options?.liquid && newBackupFilekey) {
|
|
68
|
+
imageByDevice = `{{ "${newBackupFilekey.replace('.jpeg', '.jpg')}" | file_url }}`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (storage === 'THEME' || !storage) {
|
|
72
|
+
if (options?.liquid && newBackupFilekey) {
|
|
73
|
+
imageByDevice = `{{ "${newBackupFilekey}" | asset_url }}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (typeof imageByDevice === 'string') {
|
|
77
|
+
return `url(${imageByDevice})`;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const getStyleBgPosition = (background)=>{
|
|
81
|
+
const bgPosition = {
|
|
82
|
+
desktop: getBgPositionByDevice(background, 'desktop'),
|
|
83
|
+
tablet: getBgPositionByDevice(background, 'tablet'),
|
|
84
|
+
mobile: getBgPositionByDevice(background, 'mobile')
|
|
85
|
+
};
|
|
86
|
+
return makeStyle.makeStyleResponsive('bgp', bgPosition);
|
|
87
|
+
};
|
|
88
|
+
const getBgPositionByDevice = (background, device)=>{
|
|
89
|
+
const positionByDevice = background?.[device]?.position;
|
|
90
|
+
return positionByDevice && `${positionByDevice.x}% ${positionByDevice.y}%`;
|
|
91
|
+
};
|
|
92
|
+
const getStyleBgSize = (background)=>{
|
|
93
|
+
const bgSize = {
|
|
94
|
+
desktop: getBgSizeByDevice(background, 'desktop'),
|
|
95
|
+
tablet: getBgSizeByDevice(background, 'tablet'),
|
|
96
|
+
mobile: getBgSizeByDevice(background, 'mobile')
|
|
97
|
+
};
|
|
98
|
+
return makeStyle.makeStyleResponsive('bgs', bgSize);
|
|
99
|
+
};
|
|
100
|
+
const getBgSizeByDevice = (background, device)=>{
|
|
101
|
+
return background?.[device]?.size;
|
|
102
|
+
};
|
|
103
|
+
const getStyleBgRepeat = (background)=>{
|
|
104
|
+
const bgRepeat = {
|
|
105
|
+
desktop: getBgRepeatByDevice(background, 'desktop'),
|
|
106
|
+
tablet: getBgRepeatByDevice(background, 'tablet'),
|
|
107
|
+
mobile: getBgRepeatByDevice(background, 'mobile')
|
|
108
|
+
};
|
|
109
|
+
return makeStyle.makeStyleResponsive('bgr', bgRepeat);
|
|
110
|
+
};
|
|
111
|
+
const getBgRepeatByDevice = (background, device)=>{
|
|
112
|
+
return background?.[device]?.repeat;
|
|
113
|
+
};
|
|
114
|
+
const getStyleBgAttachment = (background)=>{
|
|
115
|
+
const bgAttachment = {
|
|
116
|
+
desktop: getBgAttachmentByDevice(background, 'desktop'),
|
|
117
|
+
tablet: getBgAttachmentByDevice(background, 'tablet'),
|
|
118
|
+
mobile: getBgAttachmentByDevice(background, 'mobile')
|
|
119
|
+
};
|
|
120
|
+
return makeStyle.makeStyleResponsive('bga', bgAttachment);
|
|
121
|
+
};
|
|
122
|
+
const getBgAttachmentByDevice = (background, device)=>{
|
|
123
|
+
return background?.[device]?.attachment;
|
|
124
|
+
};
|
|
125
|
+
const composeBackgroundCss = (backgroundColor)=>{
|
|
126
|
+
return `${backgroundColor ? `background-color: ${colors.getSingleColorVariable(backgroundColor)};` : undefined}`;
|
|
127
|
+
};
|
|
128
|
+
const makeFixedBgAttachment = (background)=>{
|
|
129
|
+
if (!background) return;
|
|
130
|
+
background.tablet = background.tablet ? background.tablet : background.desktop;
|
|
131
|
+
background.mobile = background.mobile ? background.mobile : background.tablet;
|
|
132
|
+
const bgAttachment = {
|
|
133
|
+
desktop: getBgAttachmentByDevice(background, 'desktop'),
|
|
134
|
+
tablet: getBgAttachmentByDevice(background, 'tablet'),
|
|
135
|
+
mobile: getBgAttachmentByDevice(background, 'mobile')
|
|
136
|
+
};
|
|
137
|
+
const composeFixed = {
|
|
138
|
+
desktop: {
|
|
139
|
+
...makeFixedBgAttachmentByDevice('desktop', bgAttachment.desktop)
|
|
140
|
+
},
|
|
141
|
+
tablet: {
|
|
142
|
+
...makeFixedBgAttachmentByDevice('tablet', bgAttachment.tablet)
|
|
143
|
+
},
|
|
144
|
+
mobile: {
|
|
145
|
+
...makeFixedBgAttachmentByDevice('mobile', bgAttachment.mobile)
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
return {
|
|
149
|
+
wrapper: {
|
|
150
|
+
...composeFixed.desktop?.wrapper,
|
|
151
|
+
...composeFixed.tablet?.wrapper,
|
|
152
|
+
...composeFixed.mobile?.wrapper
|
|
153
|
+
},
|
|
154
|
+
content: {
|
|
155
|
+
...composeFixed.desktop?.content,
|
|
156
|
+
...composeFixed.tablet?.content,
|
|
157
|
+
...composeFixed.mobile?.content
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
const makeFixedBgAttachmentByDevice = (device, bgAttachment)=>{
|
|
162
|
+
const suffix = constant.devicesMapping[device] ?? '';
|
|
163
|
+
if (bgAttachment === 'fixed') {
|
|
164
|
+
return {
|
|
165
|
+
wrapper: {
|
|
166
|
+
[`--pos${suffix}`]: 'absolute',
|
|
167
|
+
[`--top${suffix}`]: '0',
|
|
168
|
+
[`--left${suffix}`]: '0',
|
|
169
|
+
[`--w${suffix}`]: '100%',
|
|
170
|
+
[`--h${suffix}`]: '100%'
|
|
171
|
+
},
|
|
172
|
+
content: {
|
|
173
|
+
[`--pos${suffix}`]: 'fixed',
|
|
174
|
+
[`--w${suffix}`]: '100vw',
|
|
175
|
+
[`--h${suffix}`]: '100vh',
|
|
176
|
+
[`--bga${suffix}`]: 'unset'
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
wrapper: {
|
|
182
|
+
[`--pos${suffix}`]: 'absolute'
|
|
183
|
+
},
|
|
184
|
+
content: {
|
|
185
|
+
[`--w${suffix}`]: '100%',
|
|
186
|
+
[`--h${suffix}`]: '100%',
|
|
187
|
+
[`--pos${suffix}`]: 'absolute',
|
|
188
|
+
[`--bga${suffix}`]: bgAttachment
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
const GRADIENT_BGR_KEY = 'linear-gradient';
|
|
193
|
+
const getGradientBgrStyleForButton = (backgroundStyle)=>{
|
|
194
|
+
if (!backgroundStyle) return;
|
|
195
|
+
const bgrStyle = {};
|
|
196
|
+
Object.keys(backgroundStyle).forEach((state)=>{
|
|
197
|
+
if (!backgroundStyle[state]?.startsWith(GRADIENT_BGR_KEY)) return;
|
|
198
|
+
if (state === 'normal') {
|
|
199
|
+
Object.assign(bgrStyle, {
|
|
200
|
+
'--bg': backgroundStyle[state]
|
|
201
|
+
});
|
|
202
|
+
} else {
|
|
203
|
+
Object.assign(bgrStyle, {
|
|
204
|
+
'--hvr-bg': backgroundStyle[state]
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
return bgrStyle;
|
|
209
|
+
};
|
|
210
|
+
const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage)=>{
|
|
211
|
+
if (!backgroundStyle) return;
|
|
212
|
+
const bgrStyle = {};
|
|
213
|
+
[
|
|
214
|
+
'desktop',
|
|
215
|
+
'tablet',
|
|
216
|
+
'mobile'
|
|
217
|
+
].forEach((device)=>{
|
|
218
|
+
if (backgroundStyle[device]?.color?.includes(GRADIENT_BGR_KEY)) {
|
|
219
|
+
Object.assign(bgrStyle, {
|
|
220
|
+
[`--bgc${device !== 'desktop' ? '-' + device : ''}`]: backgroundStyle[device]?.color,
|
|
221
|
+
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]: !ignoreBackgroundImage?.[device] ? `${backgroundStyle[device]?.color}` : `${getBgImageByDevice(backgroundStyle, device) || 'url()'}, ${backgroundStyle[device]?.color}`
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
return bgrStyle;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
exports.GRADIENT_BGR_KEY = GRADIENT_BGR_KEY;
|
|
229
|
+
exports.composeBackgroundCss = composeBackgroundCss;
|
|
230
|
+
exports.getBgImageByDevice = getBgImageByDevice;
|
|
231
|
+
exports.getGradientBgrStyleByDevice = getGradientBgrStyleByDevice;
|
|
232
|
+
exports.getGradientBgrStyleForButton = getGradientBgrStyleForButton;
|
|
233
|
+
exports.getStyleBackgroundByDevice = getStyleBackgroundByDevice;
|
|
234
|
+
exports.getStyleBgColor = getStyleBgColor;
|
|
235
|
+
exports.makeFixedBgAttachment = makeFixedBgAttachment;
|