@gem-sdk/core 1.38.0 → 2.0.0-dev.834
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 +1 -18
- package/dist/cjs/components/ComponentToolbarPreview.js +1 -465
- package/dist/cjs/components/ComponentWrapper.js +1 -46
- package/dist/cjs/components/ComponentWrapperPreview.js +1 -136
- package/dist/cjs/components/Empty.js +1 -7
- package/dist/cjs/components/Render.js +1 -65
- package/dist/cjs/components/Render.liquid.js +14 -288
- package/dist/cjs/components/RenderBlock.js +1 -54
- package/dist/cjs/components/RenderCustomCode.js +3 -56
- package/dist/cjs/components/RenderPreview.js +1 -66
- package/dist/cjs/components/RenderSection.js +1 -23
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +1 -0
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +1 -0
- package/dist/cjs/components/ai-generator/components/PickProduct.js +1 -0
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +1 -0
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -0
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +1 -0
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +1 -0
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +1 -0
- package/dist/cjs/components/animation/AnimationWrapper.js +1 -0
- package/dist/cjs/components/constant.js +1 -54
- package/dist/cjs/components/resize/Resize.js +1 -16
- package/dist/cjs/components/resize/Spacing.js +1 -248
- package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -56
- package/dist/cjs/components/theme-section/CreateThemeSection.js +1 -117
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +1 -36
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +1 -102
- package/dist/cjs/components/toolbar/Tooltip.js +1 -22
- package/dist/cjs/contexts/AddonContext.js +1 -36
- package/dist/cjs/contexts/BuilderComponent.js +1 -34
- package/dist/cjs/contexts/BuilderContext.js +1 -35
- package/dist/cjs/contexts/BuilderPreviewContext.js +1 -479
- package/dist/cjs/contexts/CartLineContext.js +1 -29
- package/dist/cjs/contexts/CollectionContext.js +1 -38
- package/dist/cjs/contexts/ModalContext.js +1 -47
- package/dist/cjs/contexts/PageContext.js +1 -44
- package/dist/cjs/contexts/ProductContext.js +1 -156
- package/dist/cjs/contexts/ProductListContext.js +1 -32
- package/dist/cjs/contexts/SectionContext.js +1 -53
- package/dist/cjs/contexts/ShopContext.js +1 -80
- package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-font.generated.js +2 -6
- package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
- package/dist/cjs/graphql/fragments/media.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-little.generated.js +11 -6
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product.generated.js +11 -6
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +3 -9
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
- package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +3 -7
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
- package/dist/cjs/graphql/queries/collection.generated.js +2 -14
- package/dist/cjs/graphql/queries/collections.generated.js +2 -9
- package/dist/cjs/graphql/queries/preview-page.generated.js +2 -14
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
- package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
- package/dist/cjs/graphql/queries/product-value-label.generated.js +2 -6
- package/dist/cjs/graphql/queries/product-variants.generated.js +2 -10
- package/dist/cjs/graphql/queries/products.generated.js +12 -17
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +2 -15
- package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +21 -0
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +13 -0
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +34 -0
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +22 -0
- package/dist/cjs/helpers/GlobalEvent.js +1 -19
- package/dist/cjs/helpers/animations.js +1 -213
- package/dist/cjs/helpers/background.js +1 -230
- package/dist/cjs/helpers/borders.js +4 -183
- package/dist/cjs/helpers/carousel.js +1 -58
- package/dist/cjs/helpers/clone-deep.js +1 -5
- package/dist/cjs/helpers/cls.js +1 -16
- package/dist/cjs/helpers/colors.js +1 -184
- package/dist/cjs/helpers/compose-advance-style.js +1 -268
- package/dist/cjs/helpers/constant.js +1 -23
- package/dist/cjs/helpers/convert.js +1 -7
- package/dist/cjs/helpers/covert-entities-html.js +1 -19
- package/dist/cjs/helpers/css-variable.js +1 -7
- package/dist/cjs/helpers/email.js +1 -11
- package/dist/cjs/helpers/filter-toolbar-preview.js +1 -14
- package/dist/cjs/helpers/flatten-connection.js +1 -9
- package/dist/cjs/helpers/get-resonsive-value.js +1 -36
- package/dist/cjs/helpers/get-shortname.js +1 -92
- package/dist/cjs/helpers/icon-list.js +1 -61
- package/dist/cjs/helpers/is-browser.js +1 -9
- package/dist/cjs/helpers/is-defined.js +1 -7
- package/dist/cjs/helpers/is-empty-children.js +1 -15
- package/dist/cjs/helpers/is-safari.js +1 -9
- package/dist/cjs/helpers/layout.js +1 -59
- package/dist/cjs/helpers/load-script.js +1 -31
- package/dist/cjs/helpers/make-style.js +1 -163
- package/dist/cjs/helpers/normalize-builder-data.js +1 -23
- package/dist/cjs/helpers/prefetch-queries.js +1 -78
- package/dist/cjs/helpers/product.js +1 -48
- package/dist/cjs/helpers/queries/get-collection.js +1 -226
- package/dist/cjs/helpers/queries/get-collections.js +1 -21
- package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
- package/dist/cjs/helpers/queries/get-product.js +1 -154
- package/dist/cjs/helpers/queries/get-products.js +1 -163
- package/dist/cjs/helpers/query.js +1 -29
- package/dist/cjs/helpers/radius.js +6 -140
- package/dist/cjs/helpers/render.js +1 -76
- package/dist/cjs/helpers/shadow.js +1 -57
- package/dist/cjs/helpers/size.js +4 -183
- package/dist/cjs/helpers/spacing.js +1 -43
- package/dist/cjs/helpers/tracking/fpixel.js +1 -28
- package/dist/cjs/helpers/tracking/gtag.js +1 -93
- package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
- package/dist/cjs/helpers/typography.js +17 -126
- package/dist/cjs/helpers/variant.js +1 -11
- package/dist/cjs/hooks/animation/animations.js +1 -0
- package/dist/cjs/hooks/animation/useAnimationActions.js +1 -39
- package/dist/cjs/hooks/animation/useAnimationConfig.js +1 -29
- package/dist/cjs/hooks/animation/useAnimationPreview.js +1 -31
- package/dist/cjs/hooks/animation/useAnimationTarget.js +1 -120
- package/dist/cjs/hooks/animation/useApplyAnimation.js +1 -87
- package/dist/cjs/hooks/animation/useLivePageAnimation.js +1 -0
- package/dist/cjs/hooks/cart/use-add-to-cart.js +1 -20
- package/dist/cjs/hooks/cart/use-cart-data.js +1 -28
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +1 -20
- package/dist/cjs/hooks/cart/use-cart-note-update.js +1 -20
- package/dist/cjs/hooks/cart/use-create-cart.js +1 -22
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +1 -20
- package/dist/cjs/hooks/cart/use-update-cart-item.js +1 -20
- package/dist/cjs/hooks/shop/use-collection-query.js +1 -22
- package/dist/cjs/hooks/shop/use-collections-query.js +1 -17
- package/dist/cjs/hooks/shop/use-product-query.js +1 -22
- package/dist/cjs/hooks/shop/use-products-query.js +1 -23
- package/dist/cjs/hooks/shop.js +1 -126
- package/dist/cjs/hooks/use-current-device.js +1 -21
- package/dist/cjs/hooks/use-lazy-video.js +1 -15
- package/dist/cjs/hooks/useAnimations.js +1 -26
- package/dist/cjs/hooks/useCartId.js +1 -44
- package/dist/cjs/hooks/useCartLine.js +1 -11
- package/dist/cjs/hooks/useCartUI.js +1 -48
- package/dist/cjs/hooks/useCollection.js +1 -9
- package/dist/cjs/hooks/useFetchHandle.js +1 -13
- package/dist/cjs/hooks/useFormatMoney.js +1 -58
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +1 -113
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +1 -10
- package/dist/cjs/hooks/useLoadScript.js +1 -32
- package/dist/cjs/hooks/useMoney.js +1 -84
- package/dist/cjs/hooks/usePrevious.js +1 -19
- package/dist/cjs/hooks/useProduct.js +1 -206
- package/dist/cjs/hooks/useProductList.js +1 -21
- package/dist/cjs/hooks/useSuspenseFetch.js +1 -27
- package/dist/cjs/hooks/useSwatchesOptions.js +1 -41
- package/dist/cjs/hooks/useToolbarPostPurchase.js +1 -0
- package/dist/cjs/index.js +1 -361
- package/dist/cjs/types/animations.js +1 -47
- package/dist/cjs/types/appAPI.js +1 -0
- package/dist/cjs/types/global-style.js +1 -15
- package/dist/cjs/types/shop.js +1 -2
- package/dist/cjs/web-components/src/helpers/styles/constant.js +1 -9
- package/dist/esm/components/AddOn.js +1 -14
- package/dist/esm/components/ComponentToolbarPreview.js +1 -463
- package/dist/esm/components/ComponentWrapper.js +1 -42
- package/dist/esm/components/ComponentWrapperPreview.js +1 -132
- package/dist/esm/components/Empty.js +1 -3
- package/dist/esm/components/Render.js +1 -61
- package/dist/esm/components/Render.liquid.js +14 -282
- package/dist/esm/components/RenderBlock.js +1 -50
- package/dist/esm/components/RenderCustomCode.js +3 -52
- package/dist/esm/components/RenderPreview.js +1 -62
- package/dist/esm/components/RenderSection.js +1 -19
- package/dist/esm/components/ai-generator/AIContentGenerator.js +1 -0
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +1 -0
- package/dist/esm/components/ai-generator/components/PickProduct.js +1 -0
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +1 -0
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -0
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +1 -0
- package/dist/esm/components/ai-generator/icons/AIIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +1 -0
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +1 -0
- package/dist/esm/components/animation/AnimationWrapper.js +1 -0
- package/dist/esm/components/constant.js +1 -50
- package/dist/esm/components/resize/Resize.js +1 -12
- package/dist/esm/components/resize/Spacing.js +1 -244
- package/dist/esm/components/src/product/helpers/variant-presets.js +1 -54
- package/dist/esm/components/theme-section/CreateThemeSection.js +1 -115
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +1 -34
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +1 -100
- package/dist/esm/components/toolbar/Tooltip.js +1 -18
- package/dist/esm/contexts/AddonContext.js +1 -32
- package/dist/esm/contexts/BuilderComponent.js +1 -31
- package/dist/esm/contexts/BuilderContext.js +1 -32
- package/dist/esm/contexts/BuilderPreviewContext.js +1 -476
- package/dist/esm/contexts/CartLineContext.js +1 -26
- package/dist/esm/contexts/CollectionContext.js +1 -35
- package/dist/esm/contexts/ModalContext.js +1 -44
- package/dist/esm/contexts/PageContext.js +1 -41
- package/dist/esm/contexts/ProductContext.js +1 -153
- package/dist/esm/contexts/ProductListContext.js +1 -28
- package/dist/esm/contexts/SectionContext.js +1 -49
- package/dist/esm/contexts/ShopContext.js +1 -77
- package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-font.generated.js +2 -4
- package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
- package/dist/esm/graphql/fragments/media.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-little.generated.js +11 -4
- package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/product.generated.js +11 -4
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +3 -6
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
- package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/variant.generated.js +2 -4
- package/dist/esm/graphql/mutations/page-view-up.generated.js +3 -5
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
- package/dist/esm/graphql/queries/collection.generated.js +8 -18
- package/dist/esm/graphql/queries/collections.generated.js +3 -8
- package/dist/esm/graphql/queries/preview-page.generated.js +8 -18
- package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
- package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
- package/dist/esm/graphql/queries/product-value-label.generated.js +2 -4
- package/dist/esm/graphql/queries/product-variants.generated.js +4 -10
- package/dist/esm/graphql/queries/products.generated.js +18 -20
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +9 -20
- package/dist/esm/graphql/queries/store-property.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +21 -0
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +13 -0
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +34 -0
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +22 -0
- package/dist/esm/helpers/GlobalEvent.js +1 -15
- package/dist/esm/helpers/animations.js +1 -211
- package/dist/esm/helpers/background.js +1 -222
- package/dist/esm/helpers/borders.js +4 -175
- package/dist/esm/helpers/carousel.js +1 -54
- package/dist/esm/helpers/clone-deep.js +1 -3
- package/dist/esm/helpers/cls.js +1 -14
- package/dist/esm/helpers/colors.js +1 -169
- package/dist/esm/helpers/compose-advance-style.js +1 -261
- package/dist/esm/helpers/constant.js +1 -19
- package/dist/esm/helpers/convert.js +1 -4
- package/dist/esm/helpers/covert-entities-html.js +1 -17
- package/dist/esm/helpers/css-variable.js +1 -5
- package/dist/esm/helpers/email.js +1 -6
- package/dist/esm/helpers/filter-toolbar-preview.js +1 -9
- package/dist/esm/helpers/flatten-connection.js +1 -7
- package/dist/esm/helpers/get-resonsive-value.js +1 -31
- package/dist/esm/helpers/get-shortname.js +1 -90
- package/dist/esm/helpers/icon-list.js +1 -58
- package/dist/esm/helpers/is-browser.js +1 -5
- package/dist/esm/helpers/is-defined.js +1 -5
- package/dist/esm/helpers/is-empty-children.js +1 -10
- package/dist/esm/helpers/is-safari.js +1 -5
- package/dist/esm/helpers/layout.js +1 -54
- package/dist/esm/helpers/load-script.js +1 -29
- package/dist/esm/helpers/make-style.js +1 -149
- package/dist/esm/helpers/normalize-builder-data.js +1 -21
- package/dist/esm/helpers/prefetch-queries.js +1 -76
- package/dist/esm/helpers/product.js +1 -44
- package/dist/esm/helpers/queries/get-collection.js +1 -223
- package/dist/esm/helpers/queries/get-collections.js +1 -19
- package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
- package/dist/esm/helpers/queries/get-product.js +1 -150
- package/dist/esm/helpers/queries/get-products.js +1 -161
- package/dist/esm/helpers/query.js +1 -25
- package/dist/esm/helpers/radius.js +6 -132
- package/dist/esm/helpers/render.js +1 -68
- package/dist/esm/helpers/shadow.js +1 -52
- package/dist/esm/helpers/size.js +4 -171
- package/dist/esm/helpers/spacing.js +1 -40
- package/dist/esm/helpers/tracking/fpixel.js +1 -24
- package/dist/esm/helpers/tracking/gtag.js +1 -87
- package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
- package/dist/esm/helpers/typography.js +17 -116
- package/dist/esm/helpers/variant.js +1 -9
- package/dist/esm/hooks/animation/animations.js +1 -0
- package/dist/esm/hooks/animation/useAnimationActions.js +1 -37
- package/dist/esm/hooks/animation/useAnimationConfig.js +1 -27
- package/dist/esm/hooks/animation/useAnimationPreview.js +1 -29
- package/dist/esm/hooks/animation/useAnimationTarget.js +1 -118
- package/dist/esm/hooks/animation/useApplyAnimation.js +1 -83
- package/dist/esm/hooks/animation/useLivePageAnimation.js +1 -0
- package/dist/esm/hooks/cart/use-add-to-cart.js +1 -18
- package/dist/esm/hooks/cart/use-cart-data.js +1 -26
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +1 -18
- package/dist/esm/hooks/cart/use-cart-note-update.js +1 -18
- package/dist/esm/hooks/cart/use-create-cart.js +1 -20
- package/dist/esm/hooks/cart/use-remove-cart-item.js +1 -18
- package/dist/esm/hooks/cart/use-update-cart-item.js +1 -18
- package/dist/esm/hooks/shop/use-collection-query.js +1 -20
- package/dist/esm/hooks/shop/use-collections-query.js +1 -15
- package/dist/esm/hooks/shop/use-product-query.js +1 -20
- package/dist/esm/hooks/shop/use-products-query.js +1 -21
- package/dist/esm/hooks/shop.js +1 -111
- package/dist/esm/hooks/use-current-device.js +1 -19
- package/dist/esm/hooks/use-lazy-video.js +1 -13
- package/dist/esm/hooks/useAnimations.js +1 -24
- package/dist/esm/hooks/useCartId.js +1 -40
- package/dist/esm/hooks/useCartLine.js +1 -7
- package/dist/esm/hooks/useCartUI.js +1 -44
- package/dist/esm/hooks/useCollection.js +1 -7
- package/dist/esm/hooks/useFetchHandle.js +1 -11
- package/dist/esm/hooks/useFormatMoney.js +1 -56
- package/dist/esm/hooks/useInitialSwatchesOptions.js +1 -109
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +1 -6
- package/dist/esm/hooks/useLoadScript.js +1 -28
- package/dist/esm/hooks/useMoney.js +1 -80
- package/dist/esm/hooks/usePrevious.js +1 -17
- package/dist/esm/hooks/useProduct.js +1 -192
- package/dist/esm/hooks/useProductList.js +1 -16
- package/dist/esm/hooks/useSuspenseFetch.js +1 -23
- package/dist/esm/hooks/useSwatchesOptions.js +1 -37
- package/dist/esm/hooks/useToolbarPostPurchase.js +1 -0
- package/dist/esm/index.js +1 -100
- package/dist/esm/types/animations.js +1 -47
- package/dist/esm/types/appAPI.js +1 -0
- package/dist/esm/types/global-style.js +1 -12
- package/dist/esm/web-components/src/helpers/styles/constant.js +1 -7
- package/dist/types/index.d.ts +25970 -6309
- package/package.json +8 -3
package/dist/cjs/helpers/size.js
CHANGED
|
@@ -1,183 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var getResonsiveValue = require('./get-resonsive-value.js');
|
|
6
|
-
|
|
7
|
-
function getCustomSizeCSSByDevice(size, device) {
|
|
8
|
-
if (!size || !device) return {};
|
|
9
|
-
const suffix = constant.devicesMapping[device] ?? '';
|
|
10
|
-
return {
|
|
11
|
-
[`--pl${suffix}`]: size?.[device]?.horizontal,
|
|
12
|
-
[`--pr${suffix}`]: size?.[device]?.horizontal,
|
|
13
|
-
[`--pt${suffix}`]: size?.[device]?.vertical,
|
|
14
|
-
[`--pb${suffix}`]: size?.[device]?.vertical
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
const composeSize = (size)=>{
|
|
18
|
-
return Object.assign({}, getCustomSizeCSSByDevice(size, 'desktop'), getCustomSizeCSSByDevice(size, 'tablet'), getCustomSizeCSSByDevice(size, 'mobile'));
|
|
19
|
-
};
|
|
20
|
-
function genSizeClass(name) {
|
|
21
|
-
return `gp-g-s-${name}`;
|
|
22
|
-
}
|
|
23
|
-
const composeSizeCss = (spacing)=>{
|
|
24
|
-
if (spacing === undefined) return '';
|
|
25
|
-
const size = spacing;
|
|
26
|
-
const sizeHozi = spacing?.custom?.desktop?.horizontal;
|
|
27
|
-
const sizeVerti = spacing?.custom?.desktop?.vertical;
|
|
28
|
-
if (!size?.custom) return undefined;
|
|
29
|
-
return `
|
|
30
|
-
${sizeHozi ? `padding-left: ${sizeHozi}; padding-right: ${sizeHozi};` : undefined}
|
|
31
|
-
${sizeVerti ? `padding-top: ${sizeVerti}; padding-bottom: ${sizeVerti};` : undefined}
|
|
32
|
-
`;
|
|
33
|
-
};
|
|
34
|
-
const makeGlobalSize = (globalSize)=>{
|
|
35
|
-
return {
|
|
36
|
-
width: makeStyleWithDefault('w', getWidthHeightGlobalSize('width', globalSize), {
|
|
37
|
-
desktop: '--g-ct-w',
|
|
38
|
-
tablet: '--g-ct-w',
|
|
39
|
-
mobile: '--g-ct-w'
|
|
40
|
-
}),
|
|
41
|
-
height: makeStyle.makeStyleResponsive('h', getWidthHeightGlobalSize('height', globalSize)),
|
|
42
|
-
padding: getPaddingGlobalSize(globalSize),
|
|
43
|
-
gap: getGlobalSizeGap(globalSize)
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
const getGlobalSizeGap = (globalSize)=>{
|
|
47
|
-
return {
|
|
48
|
-
'--gg': globalSize?.desktop?.gap,
|
|
49
|
-
'--gg-tablet': globalSize?.tablet?.gap,
|
|
50
|
-
'--gg-mobile': globalSize?.mobile?.gap
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
const makeStyleWithDefault = (name, value, defaultVal)=>{
|
|
54
|
-
return {
|
|
55
|
-
[`--${name}`]: value?.desktop === 'default' ? `var(${defaultVal?.desktop})` : value?.desktop,
|
|
56
|
-
[`--${name}-tablet`]: value?.tablet === 'default' ? `var(${defaultVal?.tablet})` : value?.tablet,
|
|
57
|
-
[`--${name}-mobile`]: value?.mobile === 'default' ? `var(${defaultVal?.mobile})` : value?.mobile
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
const getWidthHeightGlobalSize = (type, globalSize)=>{
|
|
61
|
-
if (!globalSize) return {};
|
|
62
|
-
let result = {};
|
|
63
|
-
const DEVICES = [
|
|
64
|
-
'desktop',
|
|
65
|
-
'mobile',
|
|
66
|
-
'tablet'
|
|
67
|
-
];
|
|
68
|
-
DEVICES.forEach((device)=>{
|
|
69
|
-
result = {
|
|
70
|
-
...result,
|
|
71
|
-
[device]: getResonsiveValue.getResponsiveValueByScreen(globalSize, device)?.[type]
|
|
72
|
-
};
|
|
73
|
-
});
|
|
74
|
-
return result;
|
|
75
|
-
};
|
|
76
|
-
const getHeightByShapeGlobalSize = (shapeByLayout)=>{
|
|
77
|
-
let result = {};
|
|
78
|
-
const DEVICES = [
|
|
79
|
-
'desktop',
|
|
80
|
-
'mobile',
|
|
81
|
-
'tablet'
|
|
82
|
-
];
|
|
83
|
-
DEVICES.forEach((device)=>{
|
|
84
|
-
const shapeByDevice = getResonsiveValue.getResponsiveValueByScreen(shapeByLayout, device);
|
|
85
|
-
const shapeValue = shapeByDevice?.shapeValue;
|
|
86
|
-
const height = shapeByDevice?.height;
|
|
87
|
-
result = {
|
|
88
|
-
...result,
|
|
89
|
-
[device]: shapeValue ? 'auto' : height || 'auto'
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
return result;
|
|
93
|
-
};
|
|
94
|
-
const getWidthByShapeGlobalSize = (shapeByLayout, defaultAuto)=>{
|
|
95
|
-
let result = {};
|
|
96
|
-
const DEVICES = [
|
|
97
|
-
'desktop',
|
|
98
|
-
'mobile',
|
|
99
|
-
'tablet'
|
|
100
|
-
];
|
|
101
|
-
DEVICES.forEach((device)=>{
|
|
102
|
-
const shapeByDevice = getResonsiveValue.getResponsiveValueByScreen(shapeByLayout, device);
|
|
103
|
-
const width = defaultAuto ? shapeByDevice?.width || 'auto' : shapeByDevice?.width;
|
|
104
|
-
if (width) {
|
|
105
|
-
result = {
|
|
106
|
-
...result,
|
|
107
|
-
[device]: width
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
return result;
|
|
112
|
-
};
|
|
113
|
-
const getAspectRatioGlobalSize = (shape)=>{
|
|
114
|
-
let result = {};
|
|
115
|
-
const DEVICES = [
|
|
116
|
-
'desktop',
|
|
117
|
-
'mobile',
|
|
118
|
-
'tablet'
|
|
119
|
-
];
|
|
120
|
-
DEVICES.forEach((device)=>{
|
|
121
|
-
const shapeValue = getResonsiveValue.getResponsiveValueByScreen(shape, device)?.shapeValue;
|
|
122
|
-
if (shapeValue) {
|
|
123
|
-
result = {
|
|
124
|
-
...result,
|
|
125
|
-
[device]: shapeValue
|
|
126
|
-
};
|
|
127
|
-
} else {
|
|
128
|
-
const shapeConfig = getResonsiveValue.getResponsiveValueByScreen(shape, device)?.shape;
|
|
129
|
-
switch(shapeConfig){
|
|
130
|
-
case 'square':
|
|
131
|
-
result = {
|
|
132
|
-
...result,
|
|
133
|
-
[device]: '1/1'
|
|
134
|
-
};
|
|
135
|
-
break;
|
|
136
|
-
case 'vertical':
|
|
137
|
-
result = {
|
|
138
|
-
...result,
|
|
139
|
-
[device]: '3/4'
|
|
140
|
-
};
|
|
141
|
-
break;
|
|
142
|
-
case 'horizontal':
|
|
143
|
-
result = {
|
|
144
|
-
...result,
|
|
145
|
-
[device]: '4/3'
|
|
146
|
-
};
|
|
147
|
-
break;
|
|
148
|
-
case 'original':
|
|
149
|
-
result = {
|
|
150
|
-
...result,
|
|
151
|
-
[device]: 'auto'
|
|
152
|
-
};
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
return result;
|
|
158
|
-
};
|
|
159
|
-
function getCustomPaddingSizeCSSByDevice(globalSize, device) {
|
|
160
|
-
if (!globalSize || !device) return {};
|
|
161
|
-
const suffix = constant.devicesMapping[device] ?? '';
|
|
162
|
-
return {
|
|
163
|
-
[`--pl${suffix}`]: globalSize?.[device]?.padding?.left,
|
|
164
|
-
[`--pr${suffix}`]: globalSize?.[device]?.padding?.right,
|
|
165
|
-
[`--pt${suffix}`]: globalSize?.[device]?.padding?.top,
|
|
166
|
-
[`--pb${suffix}`]: globalSize?.[device]?.padding?.bottom
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
const getPaddingGlobalSize = (globalSize)=>{
|
|
170
|
-
return Object.assign({}, getCustomPaddingSizeCSSByDevice(globalSize, 'desktop'), getCustomPaddingSizeCSSByDevice(globalSize, 'tablet'), getCustomPaddingSizeCSSByDevice(globalSize, 'mobile'));
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
exports.composeSize = composeSize;
|
|
174
|
-
exports.composeSizeCss = composeSizeCss;
|
|
175
|
-
exports.genSizeClass = genSizeClass;
|
|
176
|
-
exports.getAspectRatioGlobalSize = getAspectRatioGlobalSize;
|
|
177
|
-
exports.getGlobalSizeGap = getGlobalSizeGap;
|
|
178
|
-
exports.getHeightByShapeGlobalSize = getHeightByShapeGlobalSize;
|
|
179
|
-
exports.getPaddingGlobalSize = getPaddingGlobalSize;
|
|
180
|
-
exports.getWidthByShapeGlobalSize = getWidthByShapeGlobalSize;
|
|
181
|
-
exports.getWidthHeightGlobalSize = getWidthHeightGlobalSize;
|
|
182
|
-
exports.makeGlobalSize = makeGlobalSize;
|
|
183
|
-
exports.makeStyleWithDefault = makeStyleWithDefault;
|
|
1
|
+
"use strict";var makeStyle=require("./make-style.js"),constant=require("./constant.js"),getResonsiveValue=require("./get-resonsive-value.js");function getCustomSizeCSSByDevice(e,t){if(!e||!t)return{};let i=constant.devicesMapping[t]??"";return{[`--pl${i}`]:e?.[t]?.horizontal,[`--pr${i}`]:e?.[t]?.horizontal,[`--pt${i}`]:e?.[t]?.vertical,[`--pb${i}`]:e?.[t]?.vertical}}const composeSize=e=>Object.assign({},getCustomSizeCSSByDevice(e,"desktop"),getCustomSizeCSSByDevice(e,"tablet"),getCustomSizeCSSByDevice(e,"mobile"));function genSizeClass(e){return`gp-g-s-${e}`}const composeSizeCss=e=>{if(void 0===e)return"";let t=e?.custom?.desktop?.horizontal,i=e?.custom?.desktop?.vertical;if(e?.custom)return`
|
|
2
|
+
${t?`padding-left: ${t}; padding-right: ${t};`:void 0}
|
|
3
|
+
${i?`padding-top: ${i}; padding-bottom: ${i};`:void 0}
|
|
4
|
+
`},makeGlobalSize=e=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",e),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:makeStyle.makeStyleResponsive("h",getWidthHeightGlobalSize("height",e)),padding:getPaddingGlobalSize(e),gap:getGlobalSizeGap(e)}),getGlobalSizeGap=e=>({"--gg":e?.desktop?.gap,"--gg-tablet":e?.tablet?.gap,"--gg-mobile":e?.mobile?.gap}),makeStyleWithDefault=(e,t,i)=>({[`--${e}`]:t?.desktop==="default"?`var(${i?.desktop})`:t?.desktop,[`--${e}-tablet`]:t?.tablet==="default"?`var(${i?.tablet})`:t?.tablet,[`--${e}-mobile`]:t?.mobile==="default"?`var(${i?.mobile})`:t?.mobile}),getWidthHeightGlobalSize=(e,t)=>{if(!t)return{};let i={},a=["desktop","mobile","tablet"];return a.forEach(a=>{i={...i,[a]:getResonsiveValue.getResponsiveValueByScreen(t,a)?.[e]}}),i},getHeightByShapeGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,i),o=a?.shapeValue,l=a?.height;t={...t,[i]:o?"auto":l||"auto"}}),t},getWidthByShapeGlobalSize=(e,t)=>{let i={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let o=getResonsiveValue.getResponsiveValueByScreen(e,a),l=t?o?.width||"auto":o?.width;l&&(i={...i,[a]:l})}),i},getAspectRatioGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shapeValue;if(a)t={...t,[i]:a};else{let a=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shape;switch(a){case"square":t={...t,[i]:"1/1"};break;case"vertical":t={...t,[i]:"3/4"};break;case"horizontal":t={...t,[i]:"4/3"};break;case"original":t={...t,[i]:"auto"}}}}),t};function getCustomPaddingSizeCSSByDevice(e,t){if(!e||!t)return{};let i=constant.devicesMapping[t]??"";return{[`--pl${i}`]:e?.[t]?.padding?.left,[`--pr${i}`]:e?.[t]?.padding?.right,[`--pt${i}`]:e?.[t]?.padding?.top,[`--pb${i}`]:e?.[t]?.padding?.bottom}}const getPaddingGlobalSize=e=>Object.assign({},getCustomPaddingSizeCSSByDevice(e,"desktop"),getCustomPaddingSizeCSSByDevice(e,"tablet"),getCustomPaddingSizeCSSByDevice(e,"mobile"));exports.composeSize=composeSize,exports.composeSizeCss=composeSizeCss,exports.genSizeClass=genSizeClass,exports.getAspectRatioGlobalSize=getAspectRatioGlobalSize,exports.getGlobalSizeGap=getGlobalSizeGap,exports.getHeightByShapeGlobalSize=getHeightByShapeGlobalSize,exports.getPaddingGlobalSize=getPaddingGlobalSize,exports.getWidthByShapeGlobalSize=getWidthByShapeGlobalSize,exports.getWidthHeightGlobalSize=getWidthHeightGlobalSize,exports.makeGlobalSize=makeGlobalSize,exports.makeStyleWithDefault=makeStyleWithDefault;
|
|
@@ -1,43 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var constant = require('./constant.js');
|
|
4
|
-
|
|
5
|
-
function getSpacingCSSByType(key, device) {
|
|
6
|
-
if (!key) return {};
|
|
7
|
-
const suffix = device ? constant.devicesMapping?.[device] ?? '' : '';
|
|
8
|
-
return {
|
|
9
|
-
[`--p${suffix}`]: `var(--g-s-${key})`
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function getSpacingVariable(key) {
|
|
13
|
-
if (!key) return '';
|
|
14
|
-
return `var(--g-s-${key})`;
|
|
15
|
-
}
|
|
16
|
-
const composeSpacing = (spacingValue)=>{
|
|
17
|
-
const style = {};
|
|
18
|
-
switch(spacingValue?.desktop){
|
|
19
|
-
case 'm':
|
|
20
|
-
case 'l':
|
|
21
|
-
case 's':
|
|
22
|
-
Object.assign(style, getSpacingCSSByType(spacingValue.desktop));
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
switch(spacingValue?.tablet){
|
|
26
|
-
case 'm':
|
|
27
|
-
case 'l':
|
|
28
|
-
case 's':
|
|
29
|
-
Object.assign(style, getSpacingCSSByType(spacingValue.tablet, 'tablet'));
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
switch(spacingValue?.mobile){
|
|
33
|
-
case 'm':
|
|
34
|
-
case 'l':
|
|
35
|
-
case 's':
|
|
36
|
-
Object.assign(style, getSpacingCSSByType(spacingValue.mobile, 'mobile'));
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
return style;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
exports.composeSpacing = composeSpacing;
|
|
43
|
-
exports.getSpacingVariable = getSpacingVariable;
|
|
1
|
+
"use strict";var constant=require("./constant.js");function getSpacingCSSByType(e,t){if(!e)return{};let a=t?constant.devicesMapping?.[t]??"":"";return{[`--p${a}`]:`var(--g-s-${e})`}}function getSpacingVariable(e){return e?`var(--g-s-${e})`:""}const composeSpacing=e=>{let t={};switch(e?.desktop){case"m":case"l":case"s":Object.assign(t,getSpacingCSSByType(e.desktop))}switch(e?.tablet){case"m":case"l":case"s":Object.assign(t,getSpacingCSSByType(e.tablet,"tablet"))}switch(e?.mobile){case"m":case"l":case"s":Object.assign(t,getSpacingCSSByType(e.mobile,"mobile"))}return t};exports.composeSpacing=composeSpacing,exports.getSpacingVariable=getSpacingVariable;
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const pageview = ()=>{
|
|
4
|
-
if (!window.fbq) return;
|
|
5
|
-
window.fbq('track', 'PageView');
|
|
6
|
-
};
|
|
7
|
-
// https://developers.facebook.com/docs/facebook-pixel/advanced/
|
|
8
|
-
const event = (name, options = {})=>{
|
|
9
|
-
if (!window.fbq) return;
|
|
10
|
-
window.fbq('track', name, options);
|
|
11
|
-
};
|
|
12
|
-
const addToCart = (product)=>{
|
|
13
|
-
if (!window.fbq) return;
|
|
14
|
-
window.fbq('track', 'AddToCart', {
|
|
15
|
-
content_ids: [
|
|
16
|
-
product.id
|
|
17
|
-
],
|
|
18
|
-
content_name: product.name,
|
|
19
|
-
content_category: product.category,
|
|
20
|
-
content_type: 'product',
|
|
21
|
-
value: product.price,
|
|
22
|
-
currency: product.currency
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.addToCart = addToCart;
|
|
27
|
-
exports.event = event;
|
|
28
|
-
exports.pageview = pageview;
|
|
1
|
+
"use strict";const pageview=()=>{window.fbq&&window.fbq("track","PageView")},event=(e,t={})=>{window.fbq&&window.fbq("track",e,t)},addToCart=e=>{window.fbq&&window.fbq("track","AddToCart",{content_ids:[e.id],content_name:e.name,content_category:e.category,content_type:"product",value:e.price,currency:e.currency})};exports.addToCart=addToCart,exports.event=event,exports.pageview=pageview;
|
|
@@ -1,93 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages
|
|
4
|
-
const pageview = (url, trackingId)=>{
|
|
5
|
-
// GA 4
|
|
6
|
-
if (window.gtag && trackingId) {
|
|
7
|
-
window.gtag('config', trackingId, {
|
|
8
|
-
page_path: url
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
// GA 3
|
|
12
|
-
if (window.ga) {
|
|
13
|
-
window.ga('send', 'pageview', url);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
/** Addition to cart events
|
|
17
|
-
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart
|
|
18
|
-
*/ const addToCart = (product)=>{
|
|
19
|
-
// GA 3
|
|
20
|
-
if (!window.ga || !product) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
window.ga('ec:addProduct', {
|
|
24
|
-
...product,
|
|
25
|
-
id: product.sku,
|
|
26
|
-
name: product.variant === 'Default Title' ? product.name : `${product.name} - ${product.variant}`,
|
|
27
|
-
variant: product.variant === 'Default Title' ? product.name : product.variant
|
|
28
|
-
});
|
|
29
|
-
window.ga('ec:setAction', 'add');
|
|
30
|
-
window.ga('send', 'event', {
|
|
31
|
-
eventCategory: 'EnhancedEcommerce',
|
|
32
|
-
eventAction: 'Added Product',
|
|
33
|
-
nonInteraction: true
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
/** Product clicked event
|
|
37
|
-
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#product-click
|
|
38
|
-
*/ const productClick = (product)=>{
|
|
39
|
-
if (!window.ga) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
ga('ec:addProduct', {
|
|
43
|
-
id: product.id,
|
|
44
|
-
name: product.name,
|
|
45
|
-
category: product.category,
|
|
46
|
-
brand: product.brand,
|
|
47
|
-
variant: product.variant
|
|
48
|
-
});
|
|
49
|
-
ga('ec:setAction', 'click');
|
|
50
|
-
ga('send', 'event', {
|
|
51
|
-
eventAction: 'Click',
|
|
52
|
-
eventCategory: 'Product'
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
/** Product viewed event
|
|
56
|
-
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-actvities
|
|
57
|
-
*/ const productDetail = (product)=>{
|
|
58
|
-
if (!product || !window.ga) return;
|
|
59
|
-
ga('ec:addProduct', {
|
|
60
|
-
brand: product.brand,
|
|
61
|
-
category: product.category,
|
|
62
|
-
id: product.id,
|
|
63
|
-
name: product.name,
|
|
64
|
-
variant: product.variant
|
|
65
|
-
});
|
|
66
|
-
ga('ec:setAction', 'detail');
|
|
67
|
-
ga('send', 'event', {
|
|
68
|
-
eventAction: 'Detail',
|
|
69
|
-
eventCategory: 'Ecommerce',
|
|
70
|
-
nonInteraction: 1
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
/** Removal from cart events
|
|
74
|
-
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart
|
|
75
|
-
*/ const removeFromCart = (product, price)=>{
|
|
76
|
-
if (!product || !window.ga) return;
|
|
77
|
-
ga('ec:addProduct', {
|
|
78
|
-
id: product.id,
|
|
79
|
-
name: product.name,
|
|
80
|
-
price
|
|
81
|
-
});
|
|
82
|
-
ga('ec:setAction', 'remove');
|
|
83
|
-
ga('send', 'event', {
|
|
84
|
-
eventAction: 'Click',
|
|
85
|
-
eventCategory: 'Remove from cart'
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
exports.addToCart = addToCart;
|
|
90
|
-
exports.pageview = pageview;
|
|
91
|
-
exports.productClick = productClick;
|
|
92
|
-
exports.productDetail = productDetail;
|
|
93
|
-
exports.removeFromCart = removeFromCart;
|
|
1
|
+
"use strict";const pageview=(e,a)=>{window.gtag&&a&&window.gtag("config",a,{page_path:e}),window.ga&&window.ga("send","pageview",e)},addToCart=e=>{window.ga&&e&&(window.ga("ec:addProduct",{...e,id:e.sku,name:"Default Title"===e.variant?e.name:`${e.name} - ${e.variant}`,variant:"Default Title"===e.variant?e.name:e.variant}),window.ga("ec:setAction","add"),window.ga("send","event",{eventCategory:"EnhancedEcommerce",eventAction:"Added Product",nonInteraction:!0}))},productClick=e=>{window.ga&&(ga("ec:addProduct",{id:e.id,name:e.name,category:e.category,brand:e.brand,variant:e.variant}),ga("ec:setAction","click"),ga("send","event",{eventAction:"Click",eventCategory:"Product"}))},productDetail=e=>{e&&window.ga&&(ga("ec:addProduct",{brand:e.brand,category:e.category,id:e.id,name:e.name,variant:e.variant}),ga("ec:setAction","detail"),ga("send","event",{eventAction:"Detail",eventCategory:"Ecommerce",nonInteraction:1}))},removeFromCart=(e,a)=>{e&&window.ga&&(ga("ec:addProduct",{id:e.id,name:e.name,price:a}),ga("ec:setAction","remove"),ga("send","event",{eventAction:"Click",eventCategory:"Remove from cart"}))};exports.addToCart=addToCart,exports.pageview=pageview,exports.productClick=productClick,exports.productDetail=productDetail,exports.removeFromCart=removeFromCart;
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
const addToCart = (product)=>{
|
|
5
|
-
if (!window?.ttq?.track) return;
|
|
6
|
-
window.ttq.track('AddToCart', {
|
|
7
|
-
content_id: product.id,
|
|
8
|
-
content_type: 'product',
|
|
9
|
-
content_name: product.name,
|
|
10
|
-
quantity: product.quantity,
|
|
11
|
-
price: product.price,
|
|
12
|
-
value: (product.price ?? 0) * (product.quantity ?? 0),
|
|
13
|
-
currency: product.currency
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
exports.addToCart = addToCart;
|
|
1
|
+
"use strict";const addToCart=t=>{window?.ttq?.track&&window.ttq.track("AddToCart",{content_id:t.id,content_type:"product",content_name:t.name,quantity:t.quantity,price:t.price,value:(t.price??0)*(t.quantity??0),currency:t.currency})};exports.addToCart=addToCart;
|
|
@@ -1,126 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
${
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
17
|
-
${
|
|
18
|
-
${lineHeight ? `line-height: ${lineHeight};` : ''}
|
|
19
|
-
`;
|
|
20
|
-
};
|
|
21
|
-
const composeTypographyV2Css = (typography, isImportant)=>{
|
|
22
|
-
const typographyCustom = typography?.custom;
|
|
23
|
-
const { fontFamily, fontSize, fontWeight, lineHeight, letterSpacing } = typographyCustom ?? {};
|
|
24
|
-
const typographyAttrs = typography?.attrs;
|
|
25
|
-
const { bold, italic, underline, transform } = typographyAttrs ?? {};
|
|
26
|
-
const composeImportant = isImportant ? '!important' : '';
|
|
27
|
-
return `
|
|
28
|
-
${fontFamily ? `font-family: var(--g-font-${fontFamily}, ${fontFamily}) ${composeImportant};` : ''}
|
|
29
|
-
${fontSize?.desktop ? `font-size: ${fontSize?.desktop} ${composeImportant};` : ''}
|
|
30
|
-
${bold ? `font-weight: bold ${composeImportant};` : fontWeight ? `font-weight: ${fontWeight} ${composeImportant};` : ''}
|
|
31
|
-
${letterSpacing ? `letter-spacing: ${letterSpacing} ${composeImportant};` : ''}
|
|
32
|
-
${lineHeight ? `line-height: ${lineHeight} ${composeImportant};` : ''}
|
|
33
|
-
${italic ? `font-style: italic ${composeImportant};` : ''}
|
|
34
|
-
${underline ? `text-decoration-line: underline ${composeImportant};` : ''}
|
|
35
|
-
${transform ? `text-transform: ${transform} ${composeImportant};` : ''}
|
|
36
|
-
`;
|
|
37
|
-
};
|
|
38
|
-
function getCustomCSSByDevice(typography, device) {
|
|
39
|
-
if (!typography || !device) return {};
|
|
40
|
-
const suffix = device === 'desktop' || !device ? '' : `-${device}`;
|
|
41
|
-
const { fontFamily } = typography?.[device] ?? {};
|
|
42
|
-
return {
|
|
43
|
-
[`--size${suffix}`]: typography?.[device]?.fontSize,
|
|
44
|
-
[`--lh${suffix}`]: typography?.[device]?.lineHeight,
|
|
45
|
-
[`--fs${suffix}`]: typography?.[device]?.fontStyle,
|
|
46
|
-
[`--ff${suffix}`]: fontFamily ? `var(--g-font-${fontFamily}, ${fontFamily})` : undefined,
|
|
47
|
-
[`--weight${suffix}`]: typography?.[device]?.fontWeight,
|
|
48
|
-
[`--ls${suffix}`]: typography?.[device]?.letterSpacing
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
const composeTypography = (typography)=>{
|
|
52
|
-
if (!typography) return {};
|
|
53
|
-
return makeStyle.removeNullUndefined({
|
|
54
|
-
...getCustomCSSByDevice(typography, 'desktop'),
|
|
55
|
-
...getCustomCSSByDevice(typography, 'tablet'),
|
|
56
|
-
...getCustomCSSByDevice(typography, 'mobile')
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
const composeTypographyV2 = (value, attrs)=>{
|
|
60
|
-
if (!value) return {};
|
|
61
|
-
return makeStyle.removeNullUndefined({
|
|
62
|
-
...makeStyle.makeStyle({
|
|
63
|
-
fs: !attrs?.italic ? value?.fontStyle : undefined,
|
|
64
|
-
ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, '${value.fontFamily}'), ${value.fallbackFontFamily}` : undefined,
|
|
65
|
-
weight: !attrs?.bold ? value?.fontWeight : undefined,
|
|
66
|
-
ls: value?.letterSpacing,
|
|
67
|
-
lh: value?.lineHeight
|
|
68
|
-
}),
|
|
69
|
-
...makeStyle.makeStyleResponsive('size', value?.fontSize)
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
const composeTypographyAttr = (attrs)=>{
|
|
73
|
-
if (!attrs) return {};
|
|
74
|
-
return makeStyle.removeNullUndefined({
|
|
75
|
-
...makeStyle.makeStyle({
|
|
76
|
-
fs: attrs?.italic ? 'italic' : undefined,
|
|
77
|
-
weight: attrs?.bold ? 'bold' : undefined,
|
|
78
|
-
c: colors.getSingleColorVariable(attrs?.color),
|
|
79
|
-
tt: attrs?.transform,
|
|
80
|
-
tdl: attrs?.underline ? 'underline' : undefined
|
|
81
|
-
})
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
const composeTypographyClassName = (typo, typography)=>{
|
|
85
|
-
return typo ? typo?.type && !typo.custom ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
|
|
86
|
-
};
|
|
87
|
-
const composeFallbackTypographyStyle = (tag)=>{
|
|
88
|
-
if ([
|
|
89
|
-
'heading',
|
|
90
|
-
'heading-1',
|
|
91
|
-
'heading-2',
|
|
92
|
-
'heading-3',
|
|
93
|
-
'heading-4',
|
|
94
|
-
'heading-5',
|
|
95
|
-
'heading-6'
|
|
96
|
-
].includes(tag)) {
|
|
97
|
-
return 'var(--g-font-heading, heading)';
|
|
98
|
-
}
|
|
99
|
-
return 'var(--g-font-body, body)';
|
|
100
|
-
};
|
|
101
|
-
const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
102
|
-
if (typo) {
|
|
103
|
-
const fallbackFontFamily = composeFallbackTypographyStyle(typo.type ?? 'heading');
|
|
104
|
-
const customTypo = {
|
|
105
|
-
...typo.custom,
|
|
106
|
-
fallbackFontFamily: fallbackFontFamily
|
|
107
|
-
};
|
|
108
|
-
return {
|
|
109
|
-
...composeTypographyV2(customTypo, typo.attrs),
|
|
110
|
-
...!disableAttr && composeTypographyAttr(typo.attrs)
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
...!typography?.type ? composeTypography(typography?.custom) : {}
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
exports.composeFallbackTypographyStyle = composeFallbackTypographyStyle;
|
|
119
|
-
exports.composeTypography = composeTypography;
|
|
120
|
-
exports.composeTypographyAttr = composeTypographyAttr;
|
|
121
|
-
exports.composeTypographyClassName = composeTypographyClassName;
|
|
122
|
-
exports.composeTypographyCss = composeTypographyCss;
|
|
123
|
-
exports.composeTypographyStyle = composeTypographyStyle;
|
|
124
|
-
exports.composeTypographyV2 = composeTypographyV2;
|
|
125
|
-
exports.composeTypographyV2Css = composeTypographyV2Css;
|
|
126
|
-
exports.genTypoClass = genTypoClass;
|
|
1
|
+
"use strict";var colors=require("./colors.js"),makeStyle=require("./make-style.js");const genTypoClass=e=>`gp-g-${e}`,composeTypographyCss=e=>{let o=e?.custom,{fontFamily:t,fontSize:p,fontStyle:s,fontWeight:a,lineHeight:y,letterSpacing:l}=o?.desktop??{};return`
|
|
2
|
+
${t?`font-family: var(--g-font-${t}, ${t});`:""}
|
|
3
|
+
${p?`font-size: ${p};`:""}
|
|
4
|
+
${s?`font-style: ${s};`:""}
|
|
5
|
+
${a?`font-weight: ${a};`:""}
|
|
6
|
+
${l?`letter-spacing: ${l};`:""}
|
|
7
|
+
${y?`line-height: ${y};`:""}
|
|
8
|
+
`},composeTypographyV2Css=(e,o)=>{let t=e?.custom,{fontFamily:p,fontSize:s,fontWeight:a,lineHeight:y,letterSpacing:l}=t??{},r=e?.attrs,{bold:i,italic:n,underline:g,transform:m}=r??{},c=o?"!important":"";return`
|
|
9
|
+
${p?`font-family: var(--g-font-${p}, ${p}) ${c};`:""}
|
|
10
|
+
${s?.desktop?`font-size: ${s?.desktop} ${c};`:""}
|
|
11
|
+
${i?`font-weight: bold ${c};`:a?`font-weight: ${a} ${c};`:""}
|
|
12
|
+
${l?`letter-spacing: ${l} ${c};`:""}
|
|
13
|
+
${y?.desktop?`line-height: ${y?.desktop} ${c};`:""}
|
|
14
|
+
${n?`font-style: italic ${c};`:""}
|
|
15
|
+
${g?`text-decoration-line: underline ${c};`:""}
|
|
16
|
+
${m?`text-transform: ${m} ${c};`:""}
|
|
17
|
+
`};function getCustomCSSByDevice(e,o){if(!e||!o)return{};let t="desktop"!==o&&o?`-${o}`:"",{fontFamily:p}=e?.[o]??{};return{[`--size${t}`]:e?.[o]?.fontSize,[`--lh${t}`]:e?.[o]?.lineHeight,[`--fs${t}`]:e?.[o]?.fontStyle,[`--ff${t}`]:p?`var(--g-font-${p}, ${p})`:void 0,[`--weight${t}`]:e?.[o]?.fontWeight,[`--ls${t}`]:e?.[o]?.letterSpacing}}const composeTypography=e=>e?makeStyle.removeNullUndefined({...getCustomCSSByDevice(e,"desktop"),...getCustomCSSByDevice(e,"tablet"),...getCustomCSSByDevice(e,"mobile")}):{},composeTypographyV2=(e,o)=>e?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:o?.italic?void 0:e?.fontStyle,ff:e?.fontFamily?`var(--g-font-${e.fontFamily.replace(/ /g,"-")}, '${e.fontFamily}'), ${e.fallbackFontFamily}`:void 0,weight:o?.bold?void 0:e?.fontWeight,ls:e?.letterSpacing}),...makeStyle.makeStyleResponsive("size",e?.fontSize),...makeStyle.makeStyleResponsive("lh",e?.lineHeight)}):{},composeTypographyAttr=e=>e?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:e?.italic?"italic":void 0,weight:e?.bold?"bold":void 0,c:colors.getSingleColorVariable(e?.color),tt:e?.transform,tdl:e?.underline?"underline":void 0})}):{},composeTypographyClassName=(e,o)=>e?e?.type&&!e.custom?genTypoClass(e.type):"":o?.type&&genTypoClass(o?.type),composeFallbackTypographyStyle=e=>["heading","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6"].includes(e)?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(e,o,t)=>{if(e){let o=composeFallbackTypographyStyle(e.type??"heading"),p={...e.custom,fallbackFontFamily:o};return{...composeTypographyV2(p,e.attrs),...!t&&composeTypographyAttr(e.attrs)}}return{...o?.type?{}:composeTypography(o?.custom)}};exports.composeFallbackTypographyStyle=composeFallbackTypographyStyle,exports.composeTypography=composeTypography,exports.composeTypographyAttr=composeTypographyAttr,exports.composeTypographyClassName=composeTypographyClassName,exports.composeTypographyCss=composeTypographyCss,exports.composeTypographyStyle=composeTypographyStyle,exports.composeTypographyV2=composeTypographyV2,exports.composeTypographyV2Css=composeTypographyV2Css,exports.genTypoClass=genTypoClass;
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function checkInStock(variant, product) {
|
|
4
|
-
if (!variant) return false;
|
|
5
|
-
return variant?.inventoryQuantity && variant.inventoryQuantity > 0 && !isDefaultVariant(variant, product) || !variant?.manageInventory || variant.inventoryPolicy === 'CONTINUE';
|
|
6
|
-
}
|
|
7
|
-
function isDefaultVariant(variant, product) {
|
|
8
|
-
return Boolean(variant?.title === 'Default Title' && product?.options?.some((option)=>option.values.length > 1));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
exports.checkInStock = checkInStock;
|
|
1
|
+
"use strict";function checkInStock(t,n){return!!t&&(t?.inventoryQuantity&&t.inventoryQuantity>0&&!isDefaultVariant(t,n)||!t?.manageInventory||"CONTINUE"===t.inventoryPolicy)}function isDefaultVariant(t,n){return(n?.[0]?.selectedOptions.length??0)>1&&t?.title==="Default Title"}exports.checkInStock=checkInStock;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const EASING={ease:"cubic-bezier(0.46,0.03,0.52,0.96)","ease-in":"cubic-bezier(0.55,0.08,0.68,0.53)","ease-out":"cubic-bezier(0.46,0.03,0.52,0.96)",linear:"linear"},animations=()=>{let t=t=>{let r=JSON.parse(JSON.stringify(t)),e=["delay","speed","scale","intensity"];return e.forEach(t=>{if(!r?.[t])return;if("scale"===t){if(!r?.zoomDirection)throw TypeError("zoomDirection not found on zoom preset");let[e,a]=r?.scale?.in??[1,1],[n,o]=r?.scale?.out??[1,1];r[t]={in:[Number(e)/100,Number(a)/100],out:[Number(n)/100,Number(o)/100]};return}let e=Number(r?.[t]);if("delay"===t?r[t]=1e3*e:r[t]=e,!isFinite(e))throw TypeError(`${t} must be a number`)}),r},r=(r,e)=>{let n=t(e),{direction:s,distance:l}=n,p=["left","right"].includes(s??"")?"X":"Y",u=["left","down"].includes(s??"")?"-":"",f=o(r),m=[{display:f,opacity:0,transform:`translate${p}(${u}${l??50}%)`},{display:f,opacity:i(r),transform:`translate${p}(0)`}];return c(r,m,{...a(n,500),fill:"forwards"})},e=(r,e)=>{let n=t(e),o=[{opacity:0},{opacity:i(r)}];return c(r,o,{...a(n,500)})},a=(t,r)=>{let e=t=>t?1.5/t*1e3:r,{loop:a,delay:n,speed:o,easing:i}=t??{},s=e(o),l=n??0,c=a?s+l:s;return{iterations:a?1/0:1,duration:c,delay:l,easing:EASING[i??"linear"]}},n=(r,e)=>{let n=t(e),{scale:s,zoomDirection:l,isFade:p}=n,[u,f]=s.in,[m,y]=s.out,d=o(r),b=i(r),$=[{display:d,transform:`scale(${u}, ${u})`,opacity:p?0:1},{display:d,transform:`scale(${f??1.2}, ${f??1.2})`,opacity:b}],w=[{display:d,transform:`scale(${m}, ${m})`,opacity:p?0:1},{display:d,transform:`scale(${y??.8}, ${y??.8})`,opacity:b}],x="in"===l?$:w;return c(r,x,{...a(n,700),fill:"forwards"})},o=t=>{let r="inline"===window.getComputedStyle(t,null).getPropertyValue("display");return r?"block":void 0},i=t=>window.getComputedStyle(t,null).getPropertyValue("opacity"),s=(t,r,e)=>{if(!r)return t;let a=r/e,n=[...t].pop();return[...t,{...n,offset:1-a}]},l=(r,e)=>{let n=t(e),{intensity:s}=n??{},l=o(r),p=i(r),u=[{transform:"translate3d(0, 0, 0)",opacity:p,display:l}],f=[{transform:"translate3d(4px, 0, 0)",opacity:p,display:l},{transform:"translate3d(-4px, 0, 0)",opacity:p,display:l},{transform:"translate3d(4px, 0, 0)",opacity:p,display:l}],m=[];Array.from(Array(s??1).keys()).forEach(()=>{m=[...m,...f]});let y=[{transform:"translate3d(-1px, 0, 0)",opacity:p,display:l},{transform:"translate3d(2px, 0, 0)",opacity:p,display:l},{transform:"translate3d(-4px, 0, 0)",opacity:p,display:l},...m,{transform:"translate3d(-4px, 0, 0)",opacity:p,display:l},{transform:"translate3d(2px, 0, 0)",opacity:p,display:l},{transform:"translate3d(-1px, 0, 0)",opacity:p,display:l}];return c(r,s?y:u,{...a(n??{},820)})},c=(t,r,e)=>{let a=new KeyframeEffect(t,e.iterations&&1===e.iterations?r:s(r,e?.delay??0,e?.duration??0),{...e});return new Animation(a,document.timeline)};return{zoom:n,shake:l,fade:e,slide:r}};exports.animations=animations;
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var react = require('react');
|
|
4
|
-
|
|
5
|
-
const useAnimationActions = ()=>{
|
|
6
|
-
const listAnimations = react.useRef();
|
|
7
|
-
const setAnimation = react.useCallback((newListAnimations)=>{
|
|
8
|
-
listAnimations.current = newListAnimations;
|
|
9
|
-
}, [
|
|
10
|
-
listAnimations
|
|
11
|
-
]);
|
|
12
|
-
const playAnimation = react.useCallback(()=>{
|
|
13
|
-
if (!listAnimations.current) return;
|
|
14
|
-
for (const animation of listAnimations.current){
|
|
15
|
-
animation.play();
|
|
16
|
-
}
|
|
17
|
-
}, []);
|
|
18
|
-
const cancelAnimation = react.useCallback(()=>{
|
|
19
|
-
if (!listAnimations.current) return;
|
|
20
|
-
for (const animation of listAnimations.current){
|
|
21
|
-
animation.cancel();
|
|
22
|
-
}
|
|
23
|
-
}, []);
|
|
24
|
-
const setAnimationOnFinish = react.useCallback((onFinish)=>{
|
|
25
|
-
if (!listAnimations.current) return;
|
|
26
|
-
for (const animation of listAnimations.current){
|
|
27
|
-
animation.onfinish = onFinish;
|
|
28
|
-
}
|
|
29
|
-
}, []);
|
|
30
|
-
return {
|
|
31
|
-
currentAnimation: listAnimations.current,
|
|
32
|
-
setAnimation,
|
|
33
|
-
playAnimation,
|
|
34
|
-
cancelAnimation,
|
|
35
|
-
setAnimationOnFinish
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
exports.useAnimationActions = useAnimationActions;
|
|
1
|
+
"use strict";var react=require("react");const useAnimationActions=()=>{let e=react.useRef(),r=react.useCallback(r=>{e.current=r},[e]),t=react.useCallback(()=>{if(e.current)for(let r of e.current)r.play()},[]),c=react.useCallback(()=>{if(e.current)for(let r of e.current)r.cancel()},[]),n=react.useCallback(r=>{if(e.current)for(let t of e.current)t.onfinish=r},[]);return{currentAnimation:e.current,setAnimation:r,playAnimation:t,cancelAnimation:c,setAnimationOnFinish:n}};exports.useAnimationActions=useAnimationActions;
|
|
@@ -1,29 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var react = require('react');
|
|
4
|
-
var useCurrentDevice = require('../use-current-device.js');
|
|
5
|
-
|
|
6
|
-
const useAnimationConfig = (props)=>{
|
|
7
|
-
const currentDevice = useCurrentDevice.useCurrentDevice();
|
|
8
|
-
const configByDevices = react.useMemo(()=>props?.advanced?.animation?.[currentDevice], [
|
|
9
|
-
currentDevice,
|
|
10
|
-
props?.advanced?.animation
|
|
11
|
-
]);
|
|
12
|
-
const getAnimationConfig = react.useCallback(()=>{
|
|
13
|
-
const { trigger, triggerConfig } = configByDevices;
|
|
14
|
-
const { animation, setting } = triggerConfig[trigger];
|
|
15
|
-
return {
|
|
16
|
-
type: animation,
|
|
17
|
-
setting: setting[animation]
|
|
18
|
-
};
|
|
19
|
-
}, [
|
|
20
|
-
configByDevices
|
|
21
|
-
]);
|
|
22
|
-
const isEnabledAnimation = configByDevices?.enabled;
|
|
23
|
-
return {
|
|
24
|
-
isEnabledAnimation,
|
|
25
|
-
getAnimationConfig
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
exports.useAnimationConfig = useAnimationConfig;
|
|
1
|
+
"use strict";var react=require("react"),useCurrentDevice=require("../use-current-device.js");const useAnimationConfig=e=>{let n=useCurrentDevice.useCurrentDevice(),t=react.useMemo(()=>e?.advanced?.animation?.[n],[n,e?.advanced?.animation]),r=react.useCallback(()=>{let{trigger:e,triggerConfig:n}=t,{animation:r,setting:i}=n[e];return{type:r,setting:i[r]}},[t]),i=t?.enabled;return{isEnabledAnimation:i,getAnimationConfig:r}};exports.useAnimationConfig=useAnimationConfig;
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var react = require('react');
|
|
4
|
-
|
|
5
|
-
const useAnimationPreview = ({ props, playAnimation, cancelAnimation, setAnimationOnFinish, setToolbarActive })=>{
|
|
6
|
-
const previewAnimation = react.useCallback((e)=>{
|
|
7
|
-
const { uid, isCancel } = e.detail;
|
|
8
|
-
if (props.uid !== uid) return;
|
|
9
|
-
cancelAnimation();
|
|
10
|
-
if (isCancel) {
|
|
11
|
-
setToolbarActive(true);
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
playAnimation();
|
|
15
|
-
setToolbarActive(false);
|
|
16
|
-
setAnimationOnFinish(()=>{
|
|
17
|
-
setToolbarActive(true);
|
|
18
|
-
});
|
|
19
|
-
}, [
|
|
20
|
-
props.uid,
|
|
21
|
-
cancelAnimation,
|
|
22
|
-
playAnimation,
|
|
23
|
-
setToolbarActive,
|
|
24
|
-
setAnimationOnFinish
|
|
25
|
-
]);
|
|
26
|
-
return {
|
|
27
|
-
previewAnimation
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
exports.useAnimationPreview = useAnimationPreview;
|
|
1
|
+
"use strict";var react=require("react");const useAnimationPreview=({props:e,playAnimation:i,cancelAnimation:r,setAnimationOnFinish:t,setToolbarActive:a})=>{let u=react.useCallback(u=>{let{uid:n,isCancel:s}=u.detail;if(e.uid===n){if(r(),s){a(!0);return}i(),a(!1),t(()=>{a(!0)})}},[e.uid,r,i,a,t]);return{previewAnimation:u}};exports.useAnimationPreview=useAnimationPreview;
|