@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 +1,214 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var products_generated = require('../../graphql/queries/products.generated.js');
|
|
4
|
+
var getCollection = require('./get-collection.js');
|
|
5
|
+
var getProduct = require('./get-product.js');
|
|
6
|
+
|
|
7
|
+
const getProducts = async (fetcher, { ids, isSample, isStorefront, defaultSelectedProductCount, allStatus })=>{
|
|
8
|
+
const products = await loopFetchProducts(fetcher, {
|
|
9
|
+
ids,
|
|
10
|
+
isSample,
|
|
11
|
+
isStorefront,
|
|
12
|
+
defaultSelectedProductCount,
|
|
13
|
+
allStatus
|
|
14
|
+
});
|
|
15
|
+
if (!products) {
|
|
16
|
+
throw new Error('Product not found');
|
|
17
|
+
}
|
|
18
|
+
const [mergedVariant, mergedMedias] = await Promise.all([
|
|
19
|
+
mergeVariantsToProducts({
|
|
20
|
+
fetcher,
|
|
21
|
+
products,
|
|
22
|
+
isSample,
|
|
23
|
+
isStorefront
|
|
24
|
+
}),
|
|
25
|
+
mergeMediasToProducts({
|
|
26
|
+
fetcher,
|
|
27
|
+
products,
|
|
28
|
+
isSample,
|
|
29
|
+
isStorefront
|
|
30
|
+
})
|
|
31
|
+
]);
|
|
32
|
+
return {
|
|
33
|
+
...products,
|
|
34
|
+
products: {
|
|
35
|
+
...products.products,
|
|
36
|
+
edges: products.products?.edges.map((edge)=>{
|
|
37
|
+
const medias = mergedMedias.find((item)=>item.productId === edge.node?.baseID);
|
|
38
|
+
const variants = mergedVariant.find((item)=>item.productId === edge.node?.baseID);
|
|
39
|
+
if (edge.node) {
|
|
40
|
+
return {
|
|
41
|
+
...edge,
|
|
42
|
+
node: {
|
|
43
|
+
...edge.node,
|
|
44
|
+
variants: {
|
|
45
|
+
...edge.node?.variants,
|
|
46
|
+
edges: variants?.items ?? []
|
|
47
|
+
},
|
|
48
|
+
medias: {
|
|
49
|
+
...edge.node?.medias,
|
|
50
|
+
edges: medias?.items ?? []
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return edge;
|
|
56
|
+
}) ?? []
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const getProductQueryAll = async (fetcher, arg)=>{
|
|
61
|
+
const limit = arg?.limit || 4;
|
|
62
|
+
delete arg.limit;
|
|
63
|
+
const variables = {
|
|
64
|
+
first: limit,
|
|
65
|
+
firstMedia: 1,
|
|
66
|
+
firstVariant: 1,
|
|
67
|
+
orderBy: {
|
|
68
|
+
field: 'PLATFORM_CREATED_AT',
|
|
69
|
+
direction: 'DESC'
|
|
70
|
+
},
|
|
71
|
+
orderByMedia: {
|
|
72
|
+
field: 'POSITION',
|
|
73
|
+
direction: 'ASC'
|
|
74
|
+
},
|
|
75
|
+
where: {
|
|
76
|
+
status: 'ACTIVE',
|
|
77
|
+
...arg
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const pageData = await fetchProducts(fetcher, variables);
|
|
81
|
+
return pageData;
|
|
82
|
+
};
|
|
83
|
+
const getListProductByVariables = async (fetcher, arg)=>{
|
|
84
|
+
const variables = {
|
|
85
|
+
first: arg.first || 8,
|
|
86
|
+
firstMedia: 1,
|
|
87
|
+
firstVariant: 1,
|
|
88
|
+
orderBy: {
|
|
89
|
+
field: 'PLATFORM_CREATED_AT',
|
|
90
|
+
direction: 'DESC'
|
|
91
|
+
},
|
|
92
|
+
orderByMedia: {
|
|
93
|
+
field: 'POSITION',
|
|
94
|
+
direction: 'ASC'
|
|
95
|
+
},
|
|
96
|
+
where: {
|
|
97
|
+
status: 'ACTIVE',
|
|
98
|
+
...arg.where
|
|
99
|
+
},
|
|
100
|
+
after: arg.after
|
|
101
|
+
};
|
|
102
|
+
const pageData = await fetchProducts(fetcher, variables);
|
|
103
|
+
return pageData;
|
|
104
|
+
};
|
|
105
|
+
const fetchProducts = async (fetcher, variables)=>{
|
|
106
|
+
return fetcher([
|
|
107
|
+
products_generated.ProductsDocument,
|
|
108
|
+
variables
|
|
109
|
+
]);
|
|
110
|
+
};
|
|
111
|
+
const loopFetchProducts = async (fetcher, { ids, isSample, isStorefront, defaultSelectedProductCount, allStatus })=>{
|
|
112
|
+
const defaultNumberOfProducts = defaultSelectedProductCount || 4;
|
|
113
|
+
const numberOfProducts = (ids?.length == 0 ? defaultNumberOfProducts : ids?.length) ?? defaultNumberOfProducts;
|
|
114
|
+
const productsPerPage = 8; // number of products per page
|
|
115
|
+
let variables; // variables of collection query
|
|
116
|
+
let productAfterFetcher; // product after of collection query
|
|
117
|
+
let dataProducts; // data of collection query
|
|
118
|
+
let hasNextPage; //
|
|
119
|
+
let firstProducts;
|
|
120
|
+
let currentPage = 1;
|
|
121
|
+
// counter number of queries
|
|
122
|
+
const pages = Math.ceil(numberOfProducts / productsPerPage);
|
|
123
|
+
while(currentPage <= pages && hasNextPage !== false){
|
|
124
|
+
const status = allStatus ? {} : {
|
|
125
|
+
status: 'ACTIVE'
|
|
126
|
+
};
|
|
127
|
+
variables = {
|
|
128
|
+
first: getCollection.calculateFirstProduct(numberOfProducts, currentPage, productsPerPage),
|
|
129
|
+
firstMedia: 1,
|
|
130
|
+
firstVariant: 1,
|
|
131
|
+
orderBy: {
|
|
132
|
+
field: 'PLATFORM_CREATED_AT',
|
|
133
|
+
direction: 'DESC'
|
|
134
|
+
},
|
|
135
|
+
orderByMedia: {
|
|
136
|
+
field: 'POSITION',
|
|
137
|
+
direction: 'ASC'
|
|
138
|
+
},
|
|
139
|
+
where: {
|
|
140
|
+
...status,
|
|
141
|
+
isSample,
|
|
142
|
+
...isStorefront && {
|
|
143
|
+
isStorefront
|
|
144
|
+
},
|
|
145
|
+
...ids?.length ? {
|
|
146
|
+
baseIDIn: ids
|
|
147
|
+
} : {}
|
|
148
|
+
},
|
|
149
|
+
after: productAfterFetcher
|
|
150
|
+
};
|
|
151
|
+
const pageData = await fetchProducts(fetcher, variables);
|
|
152
|
+
productAfterFetcher = pageData?.products?.pageInfo?.endCursor;
|
|
153
|
+
if (currentPage === 1) {
|
|
154
|
+
dataProducts = pageData; // set data of first page
|
|
155
|
+
firstProducts = pageData;
|
|
156
|
+
} else if (firstProducts?.products && pageData?.products?.edges.length) {
|
|
157
|
+
// concat new values to the old ones
|
|
158
|
+
firstProducts.products = {
|
|
159
|
+
edges: firstProducts.products.edges.concat(pageData?.products?.edges),
|
|
160
|
+
pageInfo: pageData?.products?.pageInfo
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
currentPage++;
|
|
164
|
+
// hasNextPage = false if there is no more pages then break the loop
|
|
165
|
+
if (!firstProducts) {
|
|
166
|
+
hasNextPage = false;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return dataProducts;
|
|
171
|
+
};
|
|
172
|
+
const mergeVariantsToProducts = async ({ fetcher, products, isSample, isStorefront })=>{
|
|
173
|
+
const productsWithVariants = await Promise.all(products?.products?.edges?.map(async (product)=>{
|
|
174
|
+
const variants = await getProduct.fetchVariants(fetcher, {
|
|
175
|
+
id: product?.node?.baseID,
|
|
176
|
+
isSample,
|
|
177
|
+
isStorefront
|
|
178
|
+
});
|
|
179
|
+
return {
|
|
180
|
+
productId: product?.node?.baseID,
|
|
181
|
+
items: variants
|
|
182
|
+
};
|
|
183
|
+
}) ?? []);
|
|
184
|
+
return productsWithVariants;
|
|
185
|
+
};
|
|
186
|
+
const mergeMediasToProducts = async ({ fetcher, products, isSample, isStorefront })=>{
|
|
187
|
+
const productsWithMedias = await Promise.all(products?.products?.edges?.map(async (product)=>{
|
|
188
|
+
const medias = await getProduct.fetchMedias(fetcher, {
|
|
189
|
+
id: product?.node?.baseID,
|
|
190
|
+
isSample,
|
|
191
|
+
isStorefront
|
|
192
|
+
});
|
|
193
|
+
return {
|
|
194
|
+
productId: product?.node?.baseID,
|
|
195
|
+
items: medias
|
|
196
|
+
};
|
|
197
|
+
}) ?? []);
|
|
198
|
+
return productsWithMedias;
|
|
199
|
+
}; // future can be used for fetching products with paging ids
|
|
200
|
+
// const pagingQuery = (
|
|
201
|
+
// data: string[],
|
|
202
|
+
// currentPage: number,
|
|
203
|
+
// productsPerPage: number,
|
|
204
|
+
// first: number,
|
|
205
|
+
// ): string[] => {
|
|
206
|
+
// return data.slice(
|
|
207
|
+
// (currentPage - 1) * productsPerPage,
|
|
208
|
+
// (currentPage - 1) * productsPerPage + first,
|
|
209
|
+
// );
|
|
210
|
+
// };
|
|
211
|
+
|
|
212
|
+
exports.getListProductByVariables = getListProductByVariables;
|
|
213
|
+
exports.getProductQueryAll = getProductQueryAll;
|
|
214
|
+
exports.getProducts = getProducts;
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const generateProductQueryKey = (args)=>{
|
|
4
|
+
return [
|
|
5
|
+
'query/product',
|
|
6
|
+
args
|
|
7
|
+
];
|
|
8
|
+
};
|
|
9
|
+
const generateCollectionQueryKey = (args)=>{
|
|
10
|
+
return [
|
|
11
|
+
'query/collection',
|
|
12
|
+
args
|
|
13
|
+
];
|
|
14
|
+
};
|
|
15
|
+
const generateProductsQueryKey = (args)=>{
|
|
16
|
+
return [
|
|
17
|
+
'query/products',
|
|
18
|
+
{
|
|
19
|
+
...args,
|
|
20
|
+
ids: [
|
|
21
|
+
...args.ids
|
|
22
|
+
].sort()
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.generateCollectionQueryKey = generateCollectionQueryKey;
|
|
28
|
+
exports.generateProductQueryKey = generateProductQueryKey;
|
|
29
|
+
exports.generateProductsQueryKey = generateProductsQueryKey;
|
|
@@ -1,6 +1,140 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constant = require('./constant.js');
|
|
4
|
+
var makeStyle = require('./make-style.js');
|
|
5
|
+
|
|
6
|
+
const getCornerCSSFromGlobal = (corner)=>{
|
|
7
|
+
if (!corner?.radiusType) return {};
|
|
8
|
+
if ([
|
|
9
|
+
'custom',
|
|
10
|
+
'circle'
|
|
11
|
+
].includes(corner?.radiusType)) return makeStyle.makeStyle({
|
|
12
|
+
bblr: corner.bblr,
|
|
13
|
+
bbrr: corner.bbrr,
|
|
14
|
+
btlr: corner.btlr,
|
|
15
|
+
btrr: corner.btrr
|
|
16
|
+
});
|
|
17
|
+
return makeStyle.makeStyle({
|
|
18
|
+
radius: `var(--g-radius-${corner?.radiusType})`
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const getRadiusCSSFromGlobal = (state, key, device)=>{
|
|
22
|
+
if (!key || !state) return {};
|
|
23
|
+
const suffix = device && device !== 'desktop' ? constant.devicesMapping?.[device] : '';
|
|
24
|
+
const mState = constant.stateMapping?.[state];
|
|
25
|
+
return {
|
|
26
|
+
[`-${mState}-radius${suffix}`]: `var(--g-radius-${key})`
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const getCustomRadius = (state, radius, device)=>{
|
|
30
|
+
if (!radius || !state || radius?.radiusType !== 'custom') return {};
|
|
31
|
+
const suffix = device && device !== 'desktop' ? constant.devicesMapping?.[device] : '';
|
|
32
|
+
const mState = constant.stateMapping?.[state];
|
|
33
|
+
return {
|
|
34
|
+
[`-${mState}-bblr${suffix}`]: radius.bblr,
|
|
35
|
+
[`-${mState}-bbrr${suffix}`]: radius.bbrr,
|
|
36
|
+
[`-${mState}-btlr${suffix}`]: radius.btlr,
|
|
37
|
+
[`-${mState}-btrr${suffix}`]: radius.btrr
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const composeRadius = (value)=>{
|
|
41
|
+
if (!value) return {};
|
|
42
|
+
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
43
|
+
return composeRadiusResponsiveState(value);
|
|
44
|
+
}
|
|
45
|
+
return composeRadiusState(value);
|
|
46
|
+
};
|
|
47
|
+
const composeRadiusResponsive = (radiusValue)=>{
|
|
48
|
+
const style = {};
|
|
49
|
+
Object.assign(style, getCustomRadius('normal', radiusValue?.desktop, 'desktop'));
|
|
50
|
+
Object.assign(style, getCustomRadius('normal', radiusValue?.tablet, 'tablet'));
|
|
51
|
+
Object.assign(style, getCustomRadius('normal', radiusValue?.mobile, 'mobile'));
|
|
52
|
+
return style;
|
|
53
|
+
};
|
|
54
|
+
const composeRadiusState = (radiusValue, device)=>{
|
|
55
|
+
const style = {};
|
|
56
|
+
switch(radiusValue?.normal?.radiusType){
|
|
57
|
+
case 'medium':
|
|
58
|
+
case 'large':
|
|
59
|
+
case 'small':
|
|
60
|
+
Object.assign(style, getRadiusCSSFromGlobal('normal', radiusValue?.normal?.radiusType, device));
|
|
61
|
+
break;
|
|
62
|
+
case 'circle':
|
|
63
|
+
case 'none':
|
|
64
|
+
case 'custom':
|
|
65
|
+
Object.assign(style, getCustomRadius('normal', radiusValue.normal, device));
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
switch(radiusValue?.hover?.radiusType){
|
|
69
|
+
case 'medium':
|
|
70
|
+
case 'large':
|
|
71
|
+
case 'small':
|
|
72
|
+
Object.assign(style, getRadiusCSSFromGlobal('hover', radiusValue?.hover?.radiusType, device));
|
|
73
|
+
break;
|
|
74
|
+
case 'circle':
|
|
75
|
+
case 'none':
|
|
76
|
+
case 'custom':
|
|
77
|
+
Object.assign(style, getCustomRadius('hover', radiusValue.hover, device));
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
switch(radiusValue?.focus?.radiusType){
|
|
81
|
+
case 'medium':
|
|
82
|
+
case 'large':
|
|
83
|
+
case 'small':
|
|
84
|
+
Object.assign(style, getRadiusCSSFromGlobal('focus', radiusValue?.focus?.radiusType, device));
|
|
85
|
+
break;
|
|
86
|
+
case 'circle':
|
|
87
|
+
case 'none':
|
|
88
|
+
case 'custom':
|
|
89
|
+
Object.assign(style, getCustomRadius('focus', radiusValue.focus, device));
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
return style;
|
|
93
|
+
};
|
|
94
|
+
const composeRadiusResponsiveState = (radiusValue)=>{
|
|
95
|
+
const style = {};
|
|
96
|
+
Object.assign(style, composeRadiusState(radiusValue?.desktop, 'desktop'));
|
|
97
|
+
Object.assign(style, composeRadiusState(radiusValue?.tablet, 'tablet'));
|
|
98
|
+
Object.assign(style, composeRadiusState(radiusValue?.mobile, 'mobile'));
|
|
99
|
+
return style;
|
|
100
|
+
};
|
|
101
|
+
const getRadiusStyleActiveState = (radiusValue)=>{
|
|
102
|
+
if (radiusValue?.active?.radiusType === 'custom') {
|
|
103
|
+
return getCustomRadius('normal', radiusValue?.active);
|
|
104
|
+
}
|
|
105
|
+
return getRadiusCSSFromGlobal('normal', radiusValue?.active?.radiusType);
|
|
106
|
+
};
|
|
107
|
+
const composeCornerCss = (value, important = false)=>{
|
|
108
|
+
if (!value) {
|
|
109
|
+
return '';
|
|
110
|
+
}
|
|
111
|
+
const { radiusType, bblr, bbrr, btlr, btrr } = value;
|
|
112
|
+
const sub = important ? ' !important' : '';
|
|
113
|
+
let radiusValue = undefined;
|
|
114
|
+
switch(radiusType){
|
|
115
|
+
case 'medium':
|
|
116
|
+
case 'large':
|
|
117
|
+
case 'small':
|
|
118
|
+
radiusValue = `border-radius: var(--g-radius-${radiusType});`;
|
|
119
|
+
break;
|
|
120
|
+
case 'circle':
|
|
121
|
+
case 'none':
|
|
122
|
+
case 'custom':
|
|
123
|
+
radiusValue = `
|
|
124
|
+
${bblr ? `border-bottom-left-radius: ${bblr}${sub};` : ''}
|
|
125
|
+
${bbrr ? `border-bottom-right-radius: ${bbrr}${sub};` : ''}
|
|
126
|
+
${btlr ? `border-top-left-radius: ${btlr}${sub};` : ''}
|
|
127
|
+
${btrr ? `border-top-right-radius: ${btrr}${sub};` : ''}
|
|
128
|
+
`;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
return radiusValue;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
exports.composeCornerCss = composeCornerCss;
|
|
135
|
+
exports.composeRadius = composeRadius;
|
|
136
|
+
exports.composeRadiusResponsive = composeRadiusResponsive;
|
|
137
|
+
exports.getCornerCSSFromGlobal = getCornerCSSFromGlobal;
|
|
138
|
+
exports.getCustomRadius = getCustomRadius;
|
|
139
|
+
exports.getRadiusCSSFromGlobal = getRadiusCSSFromGlobal;
|
|
140
|
+
exports.getRadiusStyleActiveState = getRadiusStyleActiveState;
|
|
@@ -1 +1,78 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const RenderIf = (c, t, f)=>c ? typeof t === 'string' ? t : t() : (typeof f === 'string' ? f : f?.()) ?? '';
|
|
4
|
+
const isObject = (obj)=>{
|
|
5
|
+
if (typeof obj === 'object' && !Array.isArray(obj) && obj !== null) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
return false;
|
|
9
|
+
};
|
|
10
|
+
const props = (strings, ...keys)=>{
|
|
11
|
+
const props = keys[0];
|
|
12
|
+
const propsArr = [];
|
|
13
|
+
for(const attr in props){
|
|
14
|
+
if (Object.hasOwnProperty.call(props, attr)) {
|
|
15
|
+
const val = props[attr];
|
|
16
|
+
if (![
|
|
17
|
+
'symbol',
|
|
18
|
+
'object',
|
|
19
|
+
'function'
|
|
20
|
+
].includes(typeof val)) {
|
|
21
|
+
if (val) {
|
|
22
|
+
propsArr.push(`${attr}="${val}"`);
|
|
23
|
+
} else {
|
|
24
|
+
propsArr.push(`${attr}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return propsArr.join(' ');
|
|
30
|
+
};
|
|
31
|
+
const styles = (strings, ...keys)=>{
|
|
32
|
+
const styles = keys[0];
|
|
33
|
+
const styleArr = [];
|
|
34
|
+
for(const attr in styles){
|
|
35
|
+
if (Object.hasOwnProperty.call(styles, attr)) {
|
|
36
|
+
const val = styles[attr];
|
|
37
|
+
if (val !== undefined && val !== false) styleArr.push(`${attr}:${val}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return styleArr.join(';');
|
|
41
|
+
};
|
|
42
|
+
const dataStringify = (obj)=>{
|
|
43
|
+
return JSON.stringify(obj).replace(/\\"/g, '"');
|
|
44
|
+
};
|
|
45
|
+
const template = (strings, ...keys)=>{
|
|
46
|
+
let str = '';
|
|
47
|
+
strings.forEach((item, index)=>{
|
|
48
|
+
str += item;
|
|
49
|
+
if (keys[index] !== undefined) {
|
|
50
|
+
if (isObject(keys[index])) {
|
|
51
|
+
if (/style=["|']/.test(item)) {
|
|
52
|
+
str += styles`${keys[index]}`;
|
|
53
|
+
} else {
|
|
54
|
+
str += props`${keys[index]}`;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
str += keys[index];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
str = str.replaceAll(`style=""`, '');
|
|
62
|
+
str = str.replaceAll(`class=""`, '');
|
|
63
|
+
return str;
|
|
64
|
+
};
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
66
|
+
const composeMemo = (fn, _)=>fn();
|
|
67
|
+
const removeUndefinedValuesFromObject = (obj)=>{
|
|
68
|
+
Object.keys(obj).forEach((key)=>obj?.[key] === undefined && delete obj[key]);
|
|
69
|
+
return obj;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
exports.RenderIf = RenderIf;
|
|
73
|
+
exports.composeMemo = composeMemo;
|
|
74
|
+
exports.dataStringify = dataStringify;
|
|
75
|
+
exports.props = props;
|
|
76
|
+
exports.removeUndefinedValuesFromObject = removeUndefinedValuesFromObject;
|
|
77
|
+
exports.styles = styles;
|
|
78
|
+
exports.template = template;
|
|
@@ -1 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var colors = require('./colors.js');
|
|
4
|
+
var constant = require('./constant.js');
|
|
5
|
+
var getShortname = require('./get-shortname.js');
|
|
6
|
+
|
|
7
|
+
const parseValueWithUnit = (valueWithUnit)=>{
|
|
8
|
+
const matches = valueWithUnit.match(/(\d+)(.+)/);
|
|
9
|
+
if (matches && matches.length === 3) {
|
|
10
|
+
const value = Number(matches[1] ?? 0);
|
|
11
|
+
const unit = matches[2];
|
|
12
|
+
return {
|
|
13
|
+
value,
|
|
14
|
+
unit: unit ?? 'px'
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
value: 0,
|
|
19
|
+
unit: 'px'
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const getStyleShadow = (shadowStyle, isActiveState = false)=>{
|
|
23
|
+
const { styleAppliedFor, value, isEnableShadow } = shadowStyle || {};
|
|
24
|
+
let { state } = shadowStyle || {};
|
|
25
|
+
if (!state) state = 'normal';
|
|
26
|
+
if (!styleAppliedFor || !value) return {};
|
|
27
|
+
if (typeof value.distance == 'undefined') return {};
|
|
28
|
+
const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
|
|
29
|
+
return {
|
|
30
|
+
[`-${!isActiveState ? constant.stateMapping?.[state] || '' : ''}-${getShortname.getShortName(styleAppliedFor)}${shadowStyle.screen ? `-${shadowStyle.screen}` : ''}`]: isEnableShadow ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${colors.getSingleColorVariable(value?.color)}` : 'none'
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow, screen)=>{
|
|
34
|
+
if (!shadow || !styleAppliedFor) return {};
|
|
35
|
+
const style = {};
|
|
36
|
+
for (const [key, value] of Object.entries(shadow)){
|
|
37
|
+
Object.assign(style, getStyleShadow({
|
|
38
|
+
value: value,
|
|
39
|
+
state: key,
|
|
40
|
+
styleAppliedFor,
|
|
41
|
+
isEnableShadow: isEnableShadow?.[key],
|
|
42
|
+
screen: screen ?? ''
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
return style;
|
|
46
|
+
};
|
|
47
|
+
const getResponsiveStyleShadow = (value, styleAppliedFor, isEnableShadow)=>{
|
|
48
|
+
if (!value) return undefined;
|
|
49
|
+
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
50
|
+
return {
|
|
51
|
+
...getStyleShadowState(value.desktop, styleAppliedFor, isEnableShadow.desktop),
|
|
52
|
+
...value.tablet && (isEnableShadow.tablet ?? isEnableShadow.desktop) ? getStyleShadowState(value.tablet, styleAppliedFor, isEnableShadow.tablet ?? isEnableShadow.desktop, 'tablet') : undefined,
|
|
53
|
+
...value.mobile && (isEnableShadow.mobile ?? isEnableShadow.tablet ?? isEnableShadow.desktop) ? getStyleShadowState(value.mobile, styleAppliedFor, isEnableShadow.mobile ?? isEnableShadow.tablet ?? isEnableShadow.desktop, 'mobile') : undefined
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const composeShadowCss = ({ hasBoxShadow, boxShadowValue, important })=>{
|
|
58
|
+
if (!hasBoxShadow) return undefined;
|
|
59
|
+
if (!boxShadowValue) return undefined;
|
|
60
|
+
const { value: distance, unit: unitDistance } = parseValueWithUnit(`${boxShadowValue?.distance}`);
|
|
61
|
+
const sub = important ? ' !important' : '';
|
|
62
|
+
return `box-shadow: ${Math.cos(parseFloat(`${boxShadowValue?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${boxShadowValue?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${boxShadowValue?.blur} ${boxShadowValue?.spread + ' '}${colors.getSingleColorVariable(boxShadowValue?.color)}${sub};`;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
exports.composeShadowCss = composeShadowCss;
|
|
66
|
+
exports.getResponsiveStyleShadow = getResponsiveStyleShadow;
|
|
67
|
+
exports.getStyleShadow = getStyleShadow;
|
|
68
|
+
exports.getStyleShadowState = getStyleShadowState;
|
|
69
|
+
exports.parseValueWithUnit = parseValueWithUnit;
|