@gem-sdk/components 2.0.0-dev.277 → 2.0.0-dev.288
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/accordion/components/Accordion.js +60 -179
- package/dist/cjs/accordion/components/Accordion.liquid.js +77 -101
- package/dist/cjs/accordion/components/AccordionItem.js +126 -280
- package/dist/cjs/accordion/components/AccordionItem.liquid.js +77 -215
- package/dist/cjs/accordion/components/common/classes.js +55 -0
- package/dist/cjs/accordion/components/common/index.js +146 -0
- package/dist/cjs/accordion/components/common/styles.js +131 -0
- package/dist/cjs/accordion/hooks/useAccordion.js +145 -0
- package/dist/cjs/accordion/hooks/useAccordionItem.js +119 -0
- package/dist/cjs/article/components/ArticleImage.js +0 -1
- package/dist/cjs/article/components/ArticlePagination.js +1 -1
- package/dist/cjs/article/components/ArticlePagination.liquid.js +3 -3
- package/dist/cjs/article/setting/configs/ArticleImage/settings.js +5 -5
- package/dist/cjs/banner/components/HeroBannerItem.js +0 -6
- package/dist/cjs/banner/components/HeroBannerItem.liquid.js +3 -0
- package/dist/cjs/banner/setting/setting.js +28 -3
- package/dist/cjs/banner/setting/uiV2.js +10 -97
- package/dist/cjs/builder.js +18 -20
- package/dist/cjs/cart/components/CartLineImage.js +0 -2
- package/dist/cjs/code/common/classes.js +11 -0
- package/dist/cjs/code/common/styles.js +15 -0
- package/dist/cjs/code/components/CSSCode.js +9 -99
- package/dist/cjs/code/components/CSSCode.liquid.js +11 -11
- package/dist/cjs/code/hooks/useCSSCode.js +102 -0
- package/dist/cjs/code/setting/CSSCode.js +7 -121
- package/dist/cjs/code/setting/config/setting.js +77 -0
- package/dist/cjs/code/setting/config/uiV1.js +52 -0
- package/dist/cjs/code/setting/config/uiV2.js +58 -0
- package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +4 -1
- package/dist/cjs/form/components/contact/Contact.js +6 -2
- package/dist/cjs/form/components/contact/common/composeStyles.js +21 -0
- package/dist/cjs/form/components/form-checkbox/FormCheckbox.js +6 -4
- package/dist/cjs/form/components/form-checkbox/FormCheckbox.liquid.js +2 -4
- package/dist/cjs/form/components/form-checkbox/common/composeClasses.js +2 -2
- package/dist/cjs/form/components/form-checkbox/common/composeStyles.js +23 -10
- package/dist/cjs/form/components/form-dropdown/common/composeClasses.js +1 -1
- package/dist/cjs/form/components/form-email/FormEmail.js +18 -10
- package/dist/cjs/form/components/form-email/common/composeClasses.js +2 -1
- package/dist/cjs/form/components/newsletter/Newsletter.js +7 -2
- package/dist/cjs/form/components/newsletter/Newsletter.liquid.js +1 -1
- package/dist/cjs/form/components/newsletter/common/composeStyles.js +4 -2
- package/dist/cjs/form/components/textarea/TextArea.js +16 -8
- package/dist/cjs/form/components/textarea/common/composeClasses.js +1 -1
- package/dist/cjs/form/components/textfield/TextField.js +17 -9
- package/dist/cjs/form/components/textfield/common/composeClasses.js +2 -2
- package/dist/cjs/form/setting/contact/Contact.js +5 -1
- package/dist/cjs/form/setting/form-checkbox/configs/settings.js +153 -6
- package/dist/cjs/form/setting/form-checkbox/configs/uiV2.js +137 -0
- package/dist/cjs/form/setting/form-dropdown/configs/settings.js +147 -0
- package/dist/cjs/form/setting/form-dropdown/configs/uiV2.js +156 -4
- package/dist/cjs/form/setting/newsletter/configs/settings.js +132 -3
- package/dist/cjs/form/setting/newsletter/configs/uiV2.js +93 -0
- package/dist/cjs/form/setting/submit-button/configs/settings.js +37 -0
- package/dist/cjs/form/setting/submit-button/configs/uiV2.js +13 -0
- package/dist/cjs/grid/row/commons/getInnerRadius.js +11 -10
- package/dist/cjs/grid/row/setting/configs/uiV2.js +1 -1
- package/dist/cjs/header/components/kind/basic/index.js +1 -0
- package/dist/cjs/header/components/kind/modern/index.js +1 -1
- package/dist/cjs/helpers.js +53 -0
- package/dist/cjs/icon-list/setting/configs/uiV2.js +1 -1
- package/dist/cjs/icon-list-v2/setting/configs/settings.js +5 -5
- package/dist/cjs/image/components/AdaptiveImage.js +63 -49
- package/dist/cjs/image/components/AdaptiveImage.liquid.js +56 -44
- package/dist/cjs/image/components/Image.js +65 -154
- package/dist/cjs/image/components/Image.liquid.js +68 -103
- package/dist/cjs/image/components/Modal3d.liquid.js +54 -21
- package/dist/cjs/image/components/NextImage.js +26 -59
- package/dist/cjs/image/components/NextImage.liquid.js +27 -115
- package/dist/cjs/image/components/Video.liquid.js +38 -13
- package/dist/cjs/image/components/common/attributes.js +115 -0
- package/dist/cjs/image/components/common/classes.js +57 -0
- package/dist/cjs/image/components/common/constants.js +15 -0
- package/dist/cjs/image/components/common/data.js +24 -0
- package/dist/cjs/image/components/common/helpers.js +75 -0
- package/dist/cjs/image/components/common/styles.js +88 -0
- package/dist/cjs/image/components/helpers/getNextImageLiquidAttrs.js +80 -0
- package/dist/cjs/image/components/helpers/getNextImageReactAttrs.js +40 -0
- package/dist/cjs/image/components/hooks/useCheckNoImage.js +25 -0
- package/dist/cjs/image/helpers/getSrcSet.js +0 -2
- package/dist/cjs/image/next.js +1 -5
- package/dist/cjs/image/setting/configs/settings.js +14 -8
- package/dist/cjs/image/setting/configs/uiV2.js +61 -15
- package/dist/cjs/image/setting/index.js +1 -3
- package/dist/cjs/image-comparison/components/CompareImage.js +1 -1
- package/dist/cjs/image-comparison/components/CompareImage.liquid.js +1 -1
- package/dist/cjs/index.js +91 -91
- package/dist/cjs/index.liquid.js +8 -8
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-box/setting.js +4 -10
- package/dist/cjs/post-purchase/countdown-timer/components/PostPurchaseCountdownTimer.js +9 -23
- package/dist/cjs/post-purchase/countdown-timer/components/TextCountdown.js +12 -26
- package/dist/cjs/post-purchase/countdown-timer/components/common/getClasses.js +24 -0
- package/dist/cjs/post-purchase/countdown-timer/components/common/getStyles.js +21 -0
- package/dist/cjs/post-purchase/countdown-timer/hooks/useCountdownTimer.js +18 -1
- package/dist/cjs/post-purchase/countdown-timer/hooks/useGetTimeExpired.js +18 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/CountdownTimer.js +9 -358
- package/dist/cjs/post-purchase/countdown-timer/settings/config/preset.js +26 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/config/setting.js +243 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/config/uiV1.js +125 -0
- package/dist/cjs/post-purchase/countdown-timer/settings/config/uiV2.js +185 -0
- package/dist/cjs/post-purchase/image/common/getClasses.js +1 -1
- package/dist/cjs/post-purchase/image/setting/setting-v2.js +5 -5
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +24 -26
- package/dist/cjs/post-purchase/product/hooks/product-image/useListCarousel.js +1 -1
- package/dist/cjs/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +4 -1
- package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +20 -7
- package/dist/cjs/post-purchase/product/settings/product-image/uiV2.js +3 -1
- package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/settings.js +2 -2
- package/dist/cjs/post-purchase/product/settings/product-quantity/configs/settings.js +1 -1
- package/dist/cjs/post-purchase/utils/constants.js +1 -1
- package/dist/cjs/product/components/FileUpload/components/common/index.js +3 -0
- package/dist/cjs/product/components/ProductBundle/common/classes.js +25 -0
- package/dist/cjs/product/components/ProductBundle/common/index.js +5 -0
- package/dist/cjs/product/components/ProductBundle/common/styles.js +89 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscount.js +82 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscount.liquid.js +74 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +69 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +46 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountItem.js +23 -0
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountItem.liquid.js +14 -0
- package/dist/cjs/product/components/{ProductBundleDiscount.js → ProductBundle/hooks/useProductBundleDataState.js} +20 -215
- package/dist/cjs/product/components/ProductBundle/hooks/useProductBundleDiscountState.js +56 -0
- package/dist/cjs/product/{setting → components/ProductBundle/setting}/ProductBundleDiscount.js +7 -7
- package/dist/cjs/product/{setting → components/ProductBundle/setting}/ProductBundleDiscountItem.js +3 -0
- package/dist/cjs/product/components/ProductButton.js +2 -2
- package/dist/cjs/product/components/ProductButton.liquid.js +2 -2
- package/dist/cjs/product/components/ProductPrice/common/getAttr.js +23 -0
- package/dist/cjs/product/components/ProductPrice/common/getClasses.js +19 -0
- package/dist/cjs/product/components/ProductPrice/common/getTextData.js +40 -0
- package/dist/cjs/product/components/ProductPrice/hooks/useGpPrice.js +126 -0
- package/dist/cjs/product/components/ProductPrice/index.js +54 -0
- package/dist/cjs/product/components/ProductPrice/index.liquid.js +43 -0
- package/dist/cjs/product/components/ProductQuickView/ProductQuickView.js +5 -5
- package/dist/cjs/product/next.js +3 -3
- package/dist/cjs/product/setting/index.js +2 -2
- package/dist/cjs/product/setting/product/configs/presets.js +1 -0
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductFeatureImage.js +6 -7
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +11 -12
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/index.js +6 -5
- package/dist/cjs/product/setting/product-list/configs/settingsV2.js +10 -8
- package/dist/cjs/setting.js +5 -2
- package/dist/esm/accordion/components/Accordion.js +61 -180
- package/dist/esm/accordion/components/Accordion.liquid.js +78 -102
- package/dist/esm/accordion/components/AccordionItem.js +129 -281
- package/dist/esm/accordion/components/AccordionItem.liquid.js +76 -214
- package/dist/esm/accordion/components/common/classes.js +44 -0
- package/dist/esm/accordion/components/common/index.js +136 -0
- package/dist/esm/accordion/components/common/styles.js +122 -0
- package/dist/esm/accordion/hooks/useAccordion.js +141 -0
- package/dist/esm/accordion/hooks/useAccordionItem.js +115 -0
- package/dist/esm/article/components/ArticleImage.js +0 -1
- package/dist/esm/article/components/ArticlePagination.js +1 -1
- package/dist/esm/article/components/ArticlePagination.liquid.js +3 -3
- package/dist/esm/article/setting/configs/ArticleImage/settings.js +5 -5
- package/dist/esm/banner/components/HeroBannerItem.js +0 -6
- package/dist/esm/banner/components/HeroBannerItem.liquid.js +3 -0
- package/dist/esm/banner/setting/setting.js +28 -3
- package/dist/esm/banner/setting/uiV2.js +10 -97
- package/dist/esm/builder.js +3 -5
- package/dist/esm/cart/components/CartLineImage.js +0 -2
- package/dist/esm/code/common/classes.js +9 -0
- package/dist/esm/code/common/styles.js +13 -0
- package/dist/esm/code/components/CSSCode.js +9 -99
- package/dist/esm/code/components/CSSCode.liquid.js +12 -12
- package/dist/esm/code/hooks/useCSSCode.js +98 -0
- package/dist/esm/code/setting/CSSCode.js +7 -121
- package/dist/esm/code/setting/config/setting.js +75 -0
- package/dist/esm/code/setting/config/uiV1.js +50 -0
- package/dist/esm/code/setting/config/uiV2.js +56 -0
- package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +4 -1
- package/dist/esm/form/components/contact/Contact.js +7 -3
- package/dist/esm/form/components/contact/common/composeStyles.js +19 -0
- package/dist/esm/form/components/form-checkbox/FormCheckbox.js +7 -5
- package/dist/esm/form/components/form-checkbox/FormCheckbox.liquid.js +3 -5
- package/dist/esm/form/components/form-checkbox/common/composeClasses.js +2 -2
- package/dist/esm/form/components/form-checkbox/common/composeStyles.js +25 -11
- package/dist/esm/form/components/form-dropdown/common/composeClasses.js +1 -1
- package/dist/esm/form/components/form-email/FormEmail.js +18 -10
- package/dist/esm/form/components/form-email/common/composeClasses.js +2 -1
- package/dist/esm/form/components/newsletter/Newsletter.js +8 -3
- package/dist/esm/form/components/newsletter/Newsletter.liquid.js +1 -1
- package/dist/esm/form/components/newsletter/common/composeStyles.js +4 -2
- package/dist/esm/form/components/textarea/TextArea.js +16 -8
- package/dist/esm/form/components/textarea/common/composeClasses.js +1 -1
- package/dist/esm/form/components/textfield/TextField.js +17 -9
- package/dist/esm/form/components/textfield/common/composeClasses.js +2 -2
- package/dist/esm/form/setting/contact/Contact.js +5 -1
- package/dist/esm/form/setting/form-checkbox/configs/settings.js +153 -6
- package/dist/esm/form/setting/form-checkbox/configs/uiV2.js +137 -0
- package/dist/esm/form/setting/form-dropdown/configs/settings.js +147 -0
- package/dist/esm/form/setting/form-dropdown/configs/uiV2.js +156 -4
- package/dist/esm/form/setting/newsletter/configs/settings.js +132 -3
- package/dist/esm/form/setting/newsletter/configs/uiV2.js +93 -0
- package/dist/esm/form/setting/submit-button/configs/settings.js +37 -0
- package/dist/esm/form/setting/submit-button/configs/uiV2.js +13 -0
- package/dist/esm/grid/row/commons/getInnerRadius.js +11 -10
- package/dist/esm/grid/row/setting/configs/uiV2.js +1 -1
- package/dist/esm/header/components/kind/basic/index.js +1 -0
- package/dist/esm/header/components/kind/modern/index.js +1 -1
- package/dist/esm/helpers.js +52 -1
- package/dist/esm/icon-list/setting/configs/uiV2.js +1 -1
- package/dist/esm/icon-list-v2/setting/configs/settings.js +5 -5
- package/dist/esm/image/components/AdaptiveImage.js +64 -50
- package/dist/esm/image/components/AdaptiveImage.liquid.js +57 -45
- package/dist/esm/image/components/Image.js +66 -155
- package/dist/esm/image/components/Image.liquid.js +69 -104
- package/dist/esm/image/components/Modal3d.liquid.js +55 -22
- package/dist/esm/image/components/NextImage.js +26 -59
- package/dist/esm/image/components/NextImage.liquid.js +28 -116
- package/dist/esm/image/components/Video.liquid.js +38 -13
- package/dist/esm/image/components/common/attributes.js +108 -0
- package/dist/esm/image/components/common/classes.js +51 -0
- package/dist/esm/image/components/common/constants.js +11 -0
- package/dist/esm/image/components/common/data.js +22 -0
- package/dist/esm/image/components/common/helpers.js +69 -0
- package/dist/esm/image/components/common/styles.js +80 -0
- package/dist/esm/image/components/helpers/getNextImageLiquidAttrs.js +78 -0
- package/dist/esm/image/components/helpers/getNextImageReactAttrs.js +38 -0
- package/dist/esm/image/components/hooks/useCheckNoImage.js +23 -0
- package/dist/esm/image/helpers/getSrcSet.js +1 -2
- package/dist/esm/image/next.js +1 -5
- package/dist/esm/image/setting/configs/settings.js +14 -8
- package/dist/esm/image/setting/configs/uiV2.js +61 -15
- package/dist/esm/image/setting/index.js +1 -3
- package/dist/esm/image-comparison/components/CompareImage.js +1 -1
- package/dist/esm/image-comparison/components/CompareImage.liquid.js +1 -1
- package/dist/esm/index.js +4 -5
- package/dist/esm/index.liquid.js +3 -3
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-box/setting.js +4 -10
- package/dist/esm/post-purchase/countdown-timer/components/PostPurchaseCountdownTimer.js +9 -23
- package/dist/esm/post-purchase/countdown-timer/components/TextCountdown.js +13 -27
- package/dist/esm/post-purchase/countdown-timer/components/common/getClasses.js +21 -0
- package/dist/esm/post-purchase/countdown-timer/components/common/getStyles.js +19 -0
- package/dist/esm/post-purchase/countdown-timer/hooks/useCountdownTimer.js +19 -3
- package/dist/esm/post-purchase/countdown-timer/hooks/useGetTimeExpired.js +16 -0
- package/dist/esm/post-purchase/countdown-timer/settings/CountdownTimer.js +9 -358
- package/dist/esm/post-purchase/countdown-timer/settings/config/preset.js +24 -0
- package/dist/esm/post-purchase/countdown-timer/settings/config/setting.js +241 -0
- package/dist/esm/post-purchase/countdown-timer/settings/config/uiV1.js +123 -0
- package/dist/esm/post-purchase/countdown-timer/settings/config/uiV2.js +183 -0
- package/dist/esm/post-purchase/image/common/getClasses.js +1 -1
- package/dist/esm/post-purchase/image/setting/setting-v2.js +5 -5
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +25 -27
- package/dist/esm/post-purchase/product/hooks/product-image/useListCarousel.js +1 -1
- package/dist/esm/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +4 -1
- package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +20 -7
- package/dist/esm/post-purchase/product/settings/product-image/uiV2.js +3 -1
- package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/settings.js +2 -2
- package/dist/esm/post-purchase/product/settings/product-quantity/configs/settings.js +1 -1
- package/dist/esm/post-purchase/utils/constants.js +1 -1
- package/dist/esm/product/components/FileUpload/components/common/index.js +3 -0
- package/dist/esm/product/components/ProductBundle/common/classes.js +19 -0
- package/dist/esm/product/components/ProductBundle/common/index.js +3 -0
- package/dist/esm/product/components/ProductBundle/common/styles.js +80 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscount.js +78 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscount.liquid.js +70 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +65 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +42 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountItem.js +19 -0
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountItem.liquid.js +10 -0
- package/dist/esm/product/components/{ProductBundleDiscount.js → ProductBundle/hooks/useProductBundleDataState.js} +21 -216
- package/dist/esm/product/components/ProductBundle/hooks/useProductBundleDiscountState.js +52 -0
- package/dist/esm/product/{setting → components/ProductBundle/setting}/ProductBundleDiscount.js +7 -7
- package/dist/esm/product/{setting → components/ProductBundle/setting}/ProductBundleDiscountItem.js +3 -0
- package/dist/esm/product/components/ProductButton.js +1 -1
- package/dist/esm/product/components/ProductButton.liquid.js +1 -1
- package/dist/esm/product/components/ProductPrice/common/getAttr.js +21 -0
- package/dist/esm/product/components/ProductPrice/common/getClasses.js +17 -0
- package/dist/esm/product/components/ProductPrice/common/getTextData.js +38 -0
- package/dist/esm/product/components/ProductPrice/hooks/useGpPrice.js +124 -0
- package/dist/esm/product/components/ProductPrice/index.js +50 -0
- package/dist/esm/product/components/ProductPrice/index.liquid.js +38 -0
- package/dist/esm/product/components/ProductQuickView/ProductQuickView.js +1 -1
- package/dist/esm/product/next.js +3 -3
- package/dist/esm/product/setting/index.js +2 -2
- package/dist/esm/product/setting/product/configs/presets.js +1 -0
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductFeatureImage.js +6 -7
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +11 -12
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/index.js +6 -5
- package/dist/esm/product/setting/product-list/configs/settingsV2.js +10 -8
- package/dist/esm/setting.js +5 -2
- package/dist/types/index.d.ts +173 -256
- package/package.json +2 -2
- package/dist/cjs/image/components/BackgroundImage.js +0 -102
- package/dist/cjs/image/components/Img.js +0 -28
- package/dist/cjs/image/components/helpers.js +0 -12
- package/dist/cjs/image/setting/BackgroundImage.js +0 -364
- package/dist/cjs/product/components/ProductBundleDiscount.liquid.js +0 -81
- package/dist/cjs/product/components/ProductBundleDiscountItem.js +0 -42
- package/dist/cjs/product/components/ProductBundleDiscountItem.liquid.js +0 -103
- package/dist/cjs/product/components/ProductPrice.js +0 -209
- package/dist/cjs/product/components/ProductPrice.liquid.js +0 -88
- package/dist/esm/image/components/BackgroundImage.js +0 -98
- package/dist/esm/image/components/Img.js +0 -24
- package/dist/esm/image/components/helpers.js +0 -9
- package/dist/esm/image/setting/BackgroundImage.js +0 -360
- package/dist/esm/product/components/ProductBundleDiscount.liquid.js +0 -77
- package/dist/esm/product/components/ProductBundleDiscountItem.js +0 -36
- package/dist/esm/product/components/ProductBundleDiscountItem.liquid.js +0 -99
- package/dist/esm/product/components/ProductPrice.js +0 -205
- package/dist/esm/product/components/ProductPrice.liquid.js +0 -83
|
@@ -3,126 +3,38 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var system = require('@gem-sdk/system');
|
|
7
|
+
var classes = require('./common/classes.js');
|
|
8
|
+
var styles = require('./common/styles.js');
|
|
9
|
+
var getNextImageLiquidAttrs = require('./helpers/getNextImageLiquidAttrs.js');
|
|
8
10
|
|
|
9
11
|
const NextImage = (props)=>{
|
|
10
|
-
const { setting,
|
|
11
|
-
const { aspectRatio, layout, qualityPercent, qualityType } = setting ?? {};
|
|
12
|
+
const { style, setting, priority, className, pageContext, width = 2237, height = 1678, isNotLazyload, isDisableObjectFit, isDisableAspectStyle, enableLazyLoadImage = true } = props;
|
|
12
13
|
const hasLazyLoad = !isNotLazyload && enableLazyLoadImage && !priority;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const nextImageStyles = system.createStyle({
|
|
15
|
+
...style,
|
|
16
|
+
...styles.getNextImageStyles({
|
|
17
|
+
width,
|
|
18
|
+
height,
|
|
19
|
+
setting,
|
|
20
|
+
isDisableObjectFit,
|
|
21
|
+
isDisableAspectStyle
|
|
22
|
+
})
|
|
19
23
|
});
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const objectFits = getObjectFit();
|
|
29
|
-
index.DEVICES.forEach((device)=>{
|
|
30
|
-
const objectFitKey = `--objf${device !== 'desktop' ? `-${device}` : ''}`;
|
|
31
|
-
const objectFitByDevice = objectFits?.[objectFitKey] || objectFits?.['--objf'];
|
|
32
|
-
if (aspectRatio?.[device] === 'auto' && objectFitByDevice === 'contain') {
|
|
33
|
-
result = {
|
|
34
|
-
...result,
|
|
35
|
-
[device]: 'auto'
|
|
36
|
-
};
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const value = aspectRatio?.[device] !== 'auto' && !!aspectRatio?.[device] ? aspectRatio?.[device] : `${width}/${height}`;
|
|
40
|
-
result = {
|
|
41
|
-
...result,
|
|
42
|
-
[device]: value
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
return result;
|
|
46
|
-
};
|
|
47
|
-
const getAttrPropImage = ()=>{
|
|
48
|
-
const ignoreAttrInProps = [
|
|
49
|
-
'src',
|
|
50
|
-
'srcset',
|
|
51
|
-
'width',
|
|
52
|
-
'height',
|
|
53
|
-
'alt',
|
|
54
|
-
'base-src'
|
|
55
|
-
];
|
|
56
|
-
const propsImage = {
|
|
57
|
-
...props
|
|
58
|
-
};
|
|
59
|
-
ignoreAttrInProps.forEach((attr)=>{
|
|
60
|
-
if (propsImage[attr]) {
|
|
61
|
-
delete propsImage[attr];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
return propsImage;
|
|
65
|
-
};
|
|
66
|
-
const attrProps = getAttrPropImage();
|
|
67
|
-
const imagePlaceholder = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
|
|
24
|
+
const nextImageClasses = system.createClass({
|
|
25
|
+
...classes.getNextImageClasses({
|
|
26
|
+
className,
|
|
27
|
+
hasLazyLoad,
|
|
28
|
+
isOptimizePlan: pageContext?.isOptimizePlan
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
const nextImageAttrs = getNextImageLiquidAttrs.getNextImageLiquidAttrs(props);
|
|
68
32
|
return core.template`
|
|
69
|
-
|
|
70
|
-
${
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
draggable="false"
|
|
75
|
-
isNotLazyload="true"
|
|
76
|
-
class="${core.cls(className)}"
|
|
77
|
-
${{
|
|
78
|
-
src: srcImage,
|
|
79
|
-
width,
|
|
80
|
-
height,
|
|
81
|
-
alt
|
|
82
|
-
}}
|
|
83
|
-
fetchpriority="high"
|
|
84
|
-
quality-type=${JSON.stringify(qualityType) || '{}'}
|
|
85
|
-
quality-percent=${JSON.stringify(qualityPercent) || '{}'}
|
|
86
|
-
data-sizes="auto"
|
|
87
|
-
srcset="${srcset}"
|
|
88
|
-
sizes="${sizes || '100vw'}"
|
|
89
|
-
style="${{
|
|
90
|
-
...core.makeStyleResponsive('aspect', aspectRatioGlobalSize()),
|
|
91
|
-
...getObjectFit(),
|
|
92
|
-
...style
|
|
93
|
-
}}"
|
|
94
|
-
/>`, core.template`<img
|
|
95
|
-
${{
|
|
96
|
-
...attrProps
|
|
97
|
-
}}
|
|
98
|
-
${customAttrs}
|
|
99
|
-
draggable="false"
|
|
100
|
-
class="${core.cls(className, {
|
|
101
|
-
gp_lazyload: hasLazyLoad,
|
|
102
|
-
gp_force_load: pageContext?.isOptimizePlan
|
|
103
|
-
})}"
|
|
104
|
-
${{
|
|
105
|
-
'data-src': srcImage,
|
|
106
|
-
'data-srcset': srcSetImg,
|
|
107
|
-
src: enableLazyLoadImage ? imagePlaceholder : srcImage,
|
|
108
|
-
width,
|
|
109
|
-
height,
|
|
110
|
-
alt,
|
|
111
|
-
...baseSrc ? {
|
|
112
|
-
'base-src': baseSrc
|
|
113
|
-
} : {}
|
|
114
|
-
}}
|
|
115
|
-
quality-type=${JSON.stringify(qualityType) || '{}'}
|
|
116
|
-
quality-percent=${JSON.stringify(qualityPercent) || '{}'}
|
|
117
|
-
data-sizes="auto"
|
|
118
|
-
sizes="100vw"
|
|
119
|
-
style="${{
|
|
120
|
-
...core.makeStyleResponsive('aspect', aspectRatioGlobalSize()),
|
|
121
|
-
...getObjectFit(),
|
|
122
|
-
...style
|
|
123
|
-
}}"
|
|
124
|
-
/>`)}
|
|
125
|
-
`;
|
|
33
|
+
<img
|
|
34
|
+
${nextImageAttrs}
|
|
35
|
+
style="${nextImageStyles}"
|
|
36
|
+
class="${nextImageClasses}"
|
|
37
|
+
/>`;
|
|
126
38
|
};
|
|
127
39
|
|
|
128
40
|
exports.default = NextImage;
|
|
@@ -3,24 +3,49 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
|
+
var system = require('@gem-sdk/system');
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
+
const DEFAULT_CLASS = 'feature-video gp-w-full gp-h-full gp-relative';
|
|
9
|
+
const DEFAULT_ALLOW = 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture';
|
|
10
|
+
const Video = ({ src, alt, style, autoplay, controls, aspectRatio, allowfullscreen, frameborder = '0', allow = DEFAULT_ALLOW, className = DEFAULT_CLASS })=>{
|
|
11
|
+
const getVideoClasses = ()=>{
|
|
12
|
+
return {
|
|
13
|
+
[className]: true
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const getVideoStyles = ()=>{
|
|
17
|
+
return {
|
|
18
|
+
...core.makeStyleResponsive('aspect', aspectRatio)
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const getVideoAttrs = ()=>{
|
|
22
|
+
return {
|
|
23
|
+
src,
|
|
24
|
+
alt,
|
|
25
|
+
allow,
|
|
26
|
+
frameborder,
|
|
27
|
+
...style,
|
|
28
|
+
...autoplay ? {
|
|
29
|
+
autoplay
|
|
30
|
+
} : {},
|
|
31
|
+
...controls ? {
|
|
32
|
+
controls
|
|
33
|
+
} : {},
|
|
34
|
+
...allowfullscreen ? {
|
|
35
|
+
allowfullscreen
|
|
36
|
+
} : {}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const videoAttrs = system.createAttr(getVideoAttrs());
|
|
40
|
+
const videoStyles = system.createStyle(getVideoStyles());
|
|
41
|
+
const videoClasses = system.createClass(getVideoClasses());
|
|
8
42
|
return core.template`
|
|
9
43
|
<iframe
|
|
10
44
|
${{
|
|
11
|
-
...
|
|
45
|
+
...videoAttrs
|
|
12
46
|
}}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
controls="${controls}"
|
|
16
|
-
allowfullscreen="${allowfullscreen}"
|
|
17
|
-
allow="${allow}"
|
|
18
|
-
frameborder="${frameborder}"
|
|
19
|
-
autoplay="${autoplay}"
|
|
20
|
-
alt="${alt}"
|
|
21
|
-
style="${{
|
|
22
|
-
...core.makeStyleResponsive('aspect', aspectRatio)
|
|
23
|
-
}}"
|
|
47
|
+
style="${videoStyles}"
|
|
48
|
+
class="${videoClasses}"
|
|
24
49
|
>
|
|
25
50
|
</iframe>
|
|
26
51
|
`;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('./constants.js');
|
|
4
|
+
var helpers = require('./helpers.js');
|
|
5
|
+
|
|
6
|
+
const getContainerAttrs = (builderAttrs, uid)=>{
|
|
7
|
+
return {
|
|
8
|
+
...builderAttrs,
|
|
9
|
+
...uid && {
|
|
10
|
+
'data-id': uid
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const getLinkWrapperAttrs = ({ urlData, imageLink, title, isLiquid = false })=>{
|
|
15
|
+
const attributes = isLiquid ? {
|
|
16
|
+
...urlData,
|
|
17
|
+
...imageLink?.noFollow && {
|
|
18
|
+
rel: 'nofollow'
|
|
19
|
+
},
|
|
20
|
+
title
|
|
21
|
+
} : {
|
|
22
|
+
setting: urlData,
|
|
23
|
+
title
|
|
24
|
+
};
|
|
25
|
+
return imageLink?.link ? attributes : {};
|
|
26
|
+
};
|
|
27
|
+
const getImageLiquidAttrs = ({ pageContext, enableLazyLoadImage = false })=>{
|
|
28
|
+
return {
|
|
29
|
+
...pageContext && {
|
|
30
|
+
pageContext
|
|
31
|
+
},
|
|
32
|
+
...enableLazyLoadImage && {
|
|
33
|
+
enableLazyLoadImage
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const getAdaptiveImageAttrs = ({ styles, setting })=>{
|
|
38
|
+
const { alt, srcSet, priority } = setting ?? {};
|
|
39
|
+
const aspectRatio = helpers.getAspectRatio({
|
|
40
|
+
styles,
|
|
41
|
+
setting
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
pictureClass: 'gp-contents',
|
|
45
|
+
...alt && {
|
|
46
|
+
alt
|
|
47
|
+
},
|
|
48
|
+
...srcSet && {
|
|
49
|
+
srcSet
|
|
50
|
+
},
|
|
51
|
+
...priority && {
|
|
52
|
+
priority
|
|
53
|
+
},
|
|
54
|
+
...styles?.objectFit && {
|
|
55
|
+
layout: styles.objectFit
|
|
56
|
+
},
|
|
57
|
+
aspectRatio
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const getNextImageAttrs = ({ styles, setting })=>{
|
|
61
|
+
const { objectFit } = styles ?? {};
|
|
62
|
+
const { vw, alt, title, quality, priority, isNotLazyload } = setting ?? {};
|
|
63
|
+
const aspectRatio = helpers.getAspectRatio({
|
|
64
|
+
styles,
|
|
65
|
+
setting
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
...setting?.image,
|
|
69
|
+
...vw && {
|
|
70
|
+
vw
|
|
71
|
+
},
|
|
72
|
+
...alt && {
|
|
73
|
+
alt
|
|
74
|
+
},
|
|
75
|
+
...title && {
|
|
76
|
+
title
|
|
77
|
+
},
|
|
78
|
+
...quality && {
|
|
79
|
+
quality
|
|
80
|
+
},
|
|
81
|
+
...priority && {
|
|
82
|
+
priority
|
|
83
|
+
},
|
|
84
|
+
isNotLazyload,
|
|
85
|
+
setting: {
|
|
86
|
+
aspectRatio,
|
|
87
|
+
layout: objectFit
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
const getLoadingAdaptiveImageAttrs = ({ srcDesktop, enableLazyLoadImage })=>{
|
|
92
|
+
const lazyLoadAttrs = {
|
|
93
|
+
width: '100%',
|
|
94
|
+
src: constants.IMAGE_PLACEHOLDER,
|
|
95
|
+
loading: 'lazy',
|
|
96
|
+
...srcDesktop ? {
|
|
97
|
+
'data-src': srcDesktop
|
|
98
|
+
} : {}
|
|
99
|
+
};
|
|
100
|
+
const priorityLoadAttrs = {
|
|
101
|
+
src: srcDesktop || '',
|
|
102
|
+
fetchpriority: 'high',
|
|
103
|
+
loading: 'lazy'
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
...enableLazyLoadImage ? lazyLoadAttrs : priorityLoadAttrs
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
exports.getAdaptiveImageAttrs = getAdaptiveImageAttrs;
|
|
111
|
+
exports.getContainerAttrs = getContainerAttrs;
|
|
112
|
+
exports.getImageLiquidAttrs = getImageLiquidAttrs;
|
|
113
|
+
exports.getLinkWrapperAttrs = getLinkWrapperAttrs;
|
|
114
|
+
exports.getLoadingAdaptiveImageAttrs = getLoadingAdaptiveImageAttrs;
|
|
115
|
+
exports.getNextImageAttrs = getNextImageAttrs;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
|
|
5
|
+
const getContainerClasses = (uid, cssClass)=>{
|
|
6
|
+
return {
|
|
7
|
+
'gp-group/image gp-relative': true,
|
|
8
|
+
[`force-publish-${new Date().getTime()}`]: true,
|
|
9
|
+
...uid && {
|
|
10
|
+
[uid]: true
|
|
11
|
+
},
|
|
12
|
+
...cssClass && {
|
|
13
|
+
[cssClass]: true
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const getWrapperClasses = ()=>{
|
|
18
|
+
return {
|
|
19
|
+
'gp-h-full gp-w-full gp-flex pointer-events-auto': true
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const getImageClasses = (className, styles)=>{
|
|
23
|
+
const borderClass = core.handleConvertClassColor(styles?.borderImg);
|
|
24
|
+
return {
|
|
25
|
+
...className && {
|
|
26
|
+
[className]: true
|
|
27
|
+
},
|
|
28
|
+
...borderClass && {
|
|
29
|
+
[borderClass]: true
|
|
30
|
+
},
|
|
31
|
+
'gp-inline-block gp-w-full gp-max-w-full': true
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const getNextImageClasses = ({ className, hasLazyLoad, isOptimizePlan = false })=>{
|
|
35
|
+
return {
|
|
36
|
+
...className && {
|
|
37
|
+
[className]: true
|
|
38
|
+
},
|
|
39
|
+
gp_lazyload: hasLazyLoad,
|
|
40
|
+
gp_force_load: isOptimizePlan
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const getAdaptiveImageClasses = ({ className, hasLazyLoad = false, hasForceLoad = false })=>{
|
|
44
|
+
return {
|
|
45
|
+
...className && {
|
|
46
|
+
[className]: true
|
|
47
|
+
},
|
|
48
|
+
gp_lazyload: hasLazyLoad,
|
|
49
|
+
gp_force_load: hasForceLoad
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.getAdaptiveImageClasses = getAdaptiveImageClasses;
|
|
54
|
+
exports.getContainerClasses = getContainerClasses;
|
|
55
|
+
exports.getImageClasses = getImageClasses;
|
|
56
|
+
exports.getNextImageClasses = getNextImageClasses;
|
|
57
|
+
exports.getWrapperClasses = getWrapperClasses;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const IMAGE_PLACEHOLDER = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
|
|
4
|
+
const FALLBACK_IMAGE = 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif';
|
|
5
|
+
const NEXT_IMAGE_CONFIG = {
|
|
6
|
+
DEFAULT_SIZES: '100vw',
|
|
7
|
+
DEFAULT_ALT: 'Alt image',
|
|
8
|
+
DEFAULT_SRC: 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f08-f6665179f02f/-/format/auto/-/quality/lighter/placeholder-1.png',
|
|
9
|
+
DEFAULT_WIDTH_PROPS: 800,
|
|
10
|
+
DEFAULT_HEIGHT_PROPS: 533
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.FALLBACK_IMAGE = FALLBACK_IMAGE;
|
|
14
|
+
exports.IMAGE_PLACEHOLDER = IMAGE_PLACEHOLDER;
|
|
15
|
+
exports.NEXT_IMAGE_CONFIG = NEXT_IMAGE_CONFIG;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var getSrcSet = require('../../helpers/getSrcSet.js');
|
|
4
|
+
var constants = require('./constants.js');
|
|
5
|
+
|
|
6
|
+
const getAdaptiveImageData = (props)=>{
|
|
7
|
+
const { srcSet } = props;
|
|
8
|
+
const getDeviceSource = (props)=>{
|
|
9
|
+
const { isLiquid } = props ?? {};
|
|
10
|
+
const srcDesktop = getSrcSet.getImageSrc(srcSet?.desktop, 'desktop', !isLiquid) || constants.FALLBACK_IMAGE;
|
|
11
|
+
const srcTablet = (getSrcSet.getImageSrc(srcSet?.tablet, 'tablet', !isLiquid) ?? getSrcSet.getImageSrc(srcSet?.desktop, 'tablet', !isLiquid)) || constants.FALLBACK_IMAGE;
|
|
12
|
+
const srcMobile = (getSrcSet.getImageSrc(srcSet?.mobile, 'mobile', !isLiquid) ?? getSrcSet.getImageSrc(srcSet?.tablet, 'mobile', !isLiquid) ?? getSrcSet.getImageSrc(srcSet?.desktop, 'mobile', !isLiquid)) || constants.FALLBACK_IMAGE;
|
|
13
|
+
return {
|
|
14
|
+
srcTablet,
|
|
15
|
+
srcMobile,
|
|
16
|
+
srcDesktop
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
getDeviceSource
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.getAdaptiveImageData = getAdaptiveImageData;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var getSrcSet = require('../../helpers/getSrcSet.js');
|
|
5
|
+
|
|
6
|
+
const overwriteDefaultRadius = (cornerRadius)=>{
|
|
7
|
+
const radius = {
|
|
8
|
+
...cornerRadius
|
|
9
|
+
};
|
|
10
|
+
let hasDefault = true;
|
|
11
|
+
if (radius) {
|
|
12
|
+
Object.keys(radius ?? {}).forEach((key)=>{
|
|
13
|
+
if (key === 'bblr' || key === 'bbrr' || key === 'btlr' || key === 'btrr') {
|
|
14
|
+
const currPos = radius[key] ?? {};
|
|
15
|
+
if (currPos !== '0px') hasDefault = false;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return hasDefault ? core.getCornerCSSFromGlobal(radius) : {};
|
|
20
|
+
};
|
|
21
|
+
const getAspectRatio = ({ styles, setting })=>{
|
|
22
|
+
const { srcSet, image } = setting ?? {};
|
|
23
|
+
const { customAspectRadio, shape } = styles ?? {};
|
|
24
|
+
const aspectRatio = {
|
|
25
|
+
desktop: composeAspectRatio({
|
|
26
|
+
device: 'desktop',
|
|
27
|
+
aspect: styles?.aspectRatio,
|
|
28
|
+
auto: setting?.isAdaptive ? srcSet?.desktop : image,
|
|
29
|
+
custom: customAspectRadio
|
|
30
|
+
}),
|
|
31
|
+
tablet: composeAspectRatio({
|
|
32
|
+
device: 'tablet',
|
|
33
|
+
aspect: styles?.aspectRatio,
|
|
34
|
+
auto: setting?.isAdaptive ? srcSet?.tablet : image,
|
|
35
|
+
custom: customAspectRadio
|
|
36
|
+
}),
|
|
37
|
+
mobile: composeAspectRatio({
|
|
38
|
+
device: 'mobile',
|
|
39
|
+
aspect: styles?.aspectRatio,
|
|
40
|
+
auto: setting?.isAdaptive ? srcSet?.mobile : image,
|
|
41
|
+
custom: customAspectRadio
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
return shape ? core.getAspectRatioGlobalSize(shape) : aspectRatio;
|
|
45
|
+
};
|
|
46
|
+
const composeAspectRatio = ({ device, aspect, custom, auto })=>{
|
|
47
|
+
const aspectValue = aspect?.[device];
|
|
48
|
+
if (aspectValue === 'auto') return auto?.height ? `${auto.width}/${auto.height}` : undefined;
|
|
49
|
+
if (aspectValue === 'custom') return custom?.[device]?.height ? `${custom?.[device]?.width}/${custom?.[device]?.height}` : undefined;
|
|
50
|
+
return aspectValue;
|
|
51
|
+
};
|
|
52
|
+
const getResponsiveObjectFit = ({ layout, isDisableObjectFit })=>{
|
|
53
|
+
if (isDisableObjectFit) return {};
|
|
54
|
+
return core.makeStyleResponsive('objf', layout);
|
|
55
|
+
};
|
|
56
|
+
const getAspectRatioNextImage = ({ isDisableAspectStyle, aspectRatio, objectFits, width, height })=>{
|
|
57
|
+
if (isDisableAspectStyle) return {};
|
|
58
|
+
const result = {};
|
|
59
|
+
getSrcSet.DEVICES.forEach((device)=>{
|
|
60
|
+
const objectFitKey = `--objf${device !== 'desktop' ? `-${device}` : ''}`;
|
|
61
|
+
const objectFitByDevice = objectFits?.[objectFitKey] || objectFits?.['--objf'];
|
|
62
|
+
if (aspectRatio?.[device] === 'auto' && objectFitByDevice === 'contain') {
|
|
63
|
+
result[device] = 'auto';
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
result[device] = aspectRatio?.[device] !== 'auto' && !!aspectRatio?.[device] ? aspectRatio[device] : `${width}/${height}`;
|
|
67
|
+
});
|
|
68
|
+
return result;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
exports.composeAspectRatio = composeAspectRatio;
|
|
72
|
+
exports.getAspectRatio = getAspectRatio;
|
|
73
|
+
exports.getAspectRatioNextImage = getAspectRatioNextImage;
|
|
74
|
+
exports.getResponsiveObjectFit = getResponsiveObjectFit;
|
|
75
|
+
exports.overwriteDefaultRadius = overwriteDefaultRadius;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var helpers = require('./helpers.js');
|
|
5
|
+
|
|
6
|
+
const getContainerStyles = (style, styles)=>{
|
|
7
|
+
return {
|
|
8
|
+
...style,
|
|
9
|
+
...core.makeStyleResponsive('ta', styles?.align)
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const getWrapperStyles = (styles)=>{
|
|
13
|
+
return {
|
|
14
|
+
borderRadius: 'inherit',
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
...core.makeStyleResponsive('jc', styles?.align)
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const getImageStyles = (styles, builderProps)=>{
|
|
20
|
+
const { wrapperBorder, borderRadius } = styles ?? {};
|
|
21
|
+
return {
|
|
22
|
+
...getImageWidth(styles),
|
|
23
|
+
...getImageHeight(styles),
|
|
24
|
+
...core.getBorderStyle(wrapperBorder),
|
|
25
|
+
...core.getBorderRadiusStyle(borderRadius),
|
|
26
|
+
...helpers.overwriteDefaultRadius(builderProps?.builderData?.advanced?.rounded),
|
|
27
|
+
...core.getStyleShadow({
|
|
28
|
+
value: styles?.shadow,
|
|
29
|
+
styleAppliedFor: 'box-shadow',
|
|
30
|
+
isEnableShadow: styles?.shadow?.type !== 'none'
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const getNextImageStyles = ({ width, height, setting, isDisableObjectFit, isDisableAspectStyle })=>{
|
|
35
|
+
const { layout, aspectRatio } = setting ?? {};
|
|
36
|
+
const objectFits = helpers.getResponsiveObjectFit({
|
|
37
|
+
layout,
|
|
38
|
+
isDisableObjectFit
|
|
39
|
+
});
|
|
40
|
+
const aspectRatioNextImage = helpers.getAspectRatioNextImage({
|
|
41
|
+
isDisableAspectStyle,
|
|
42
|
+
objectFits,
|
|
43
|
+
aspectRatio,
|
|
44
|
+
width,
|
|
45
|
+
height
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
...core.makeStyleResponsive('aspect', aspectRatioNextImage),
|
|
49
|
+
...objectFits
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const getAdaptiveImageStyles = ({ layout, aspectRatio, borderRadius })=>{
|
|
53
|
+
const objectFits = helpers.getResponsiveObjectFit({
|
|
54
|
+
layout,
|
|
55
|
+
isDisableObjectFit: false
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
...core.makeStyleResponsiveState('radius', borderRadius),
|
|
59
|
+
...core.makeStyleResponsive('aspect', aspectRatio),
|
|
60
|
+
...objectFits
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const getAdaptivePictureStyles = ()=>{
|
|
64
|
+
return {
|
|
65
|
+
borderRadius: 'inherit'
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const getNoDataImageStyles = (styles)=>{
|
|
69
|
+
return {
|
|
70
|
+
...getImageWidth(styles),
|
|
71
|
+
...getImageHeight(styles)
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
const getImageWidth = (styles)=>{
|
|
75
|
+
const imageWidth = styles?.shape ? core.makeStyleResponsive('w', core.getWidthByShapeGlobalSize(styles.shape)) : core.makeStyleResponsive('w', core.makeWidth(styles?.width, styles?.fullWidth));
|
|
76
|
+
return imageWidth;
|
|
77
|
+
};
|
|
78
|
+
const getImageHeight = (styles)=>{
|
|
79
|
+
return core.makeStyleResponsive('h', core.getHeightByShapeGlobalSize(styles?.shape));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
exports.getAdaptiveImageStyles = getAdaptiveImageStyles;
|
|
83
|
+
exports.getAdaptivePictureStyles = getAdaptivePictureStyles;
|
|
84
|
+
exports.getContainerStyles = getContainerStyles;
|
|
85
|
+
exports.getImageStyles = getImageStyles;
|
|
86
|
+
exports.getNextImageStyles = getNextImageStyles;
|
|
87
|
+
exports.getNoDataImageStyles = getNoDataImageStyles;
|
|
88
|
+
exports.getWrapperStyles = getWrapperStyles;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var system = require('@gem-sdk/system');
|
|
4
|
+
var getSrcSet = require('../../helpers/getSrcSet.js');
|
|
5
|
+
var constants = require('../common/constants.js');
|
|
6
|
+
|
|
7
|
+
const getNextImageLiquidAttrs = (props)=>{
|
|
8
|
+
const { srcset, setting, storage, baseSrc, priority, customAttrs, width = 2237, height = 1678, isNotLazyload, backupFileKey, backupFilePath, srcIsLiquidCode, enableLazyLoadImage, alt = constants.NEXT_IMAGE_CONFIG.DEFAULT_ALT, src = constants.NEXT_IMAGE_CONFIG.DEFAULT_SRC, sizes = constants.NEXT_IMAGE_CONFIG.DEFAULT_SIZES } = props;
|
|
9
|
+
const hasLazyLoad = !isNotLazyload && enableLazyLoadImage && !priority;
|
|
10
|
+
const getLoadingAttrs = ()=>{
|
|
11
|
+
const newBackupFileKey = backupFileKey ? getSrcSet.getNewBackupFileKey(backupFileKey ?? '', src) : '';
|
|
12
|
+
const srcImage = srcIsLiquidCode ? baseSrc : getSrcSet.getImageSrc({
|
|
13
|
+
src,
|
|
14
|
+
backupFileKey: newBackupFileKey,
|
|
15
|
+
backupFilePath,
|
|
16
|
+
storage
|
|
17
|
+
});
|
|
18
|
+
const srcSetImg = srcIsLiquidCode ? src : getSrcSet.getSrcSet(newBackupFileKey ?? '', storage ?? 'THEME', src);
|
|
19
|
+
const lazyLoadAttrs = {
|
|
20
|
+
sizes: '100vw',
|
|
21
|
+
src: constants.IMAGE_PLACEHOLDER,
|
|
22
|
+
...baseSrc ? {
|
|
23
|
+
'base-src': baseSrc
|
|
24
|
+
} : {},
|
|
25
|
+
...srcImage ? {
|
|
26
|
+
'data-src': srcImage
|
|
27
|
+
} : {},
|
|
28
|
+
...srcSetImg ? {
|
|
29
|
+
'data-srcset': srcSetImg
|
|
30
|
+
} : {}
|
|
31
|
+
};
|
|
32
|
+
const priorityLoadAttrs = {
|
|
33
|
+
sizes: sizes,
|
|
34
|
+
src: srcImage || '',
|
|
35
|
+
fetchpriority: 'high',
|
|
36
|
+
isNotLazyload: 'true',
|
|
37
|
+
srcset: srcset || ''
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
...hasLazyLoad ? lazyLoadAttrs : priorityLoadAttrs
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const getBaseAttrs = ()=>{
|
|
44
|
+
const { qualityPercent, qualityType } = setting ?? {};
|
|
45
|
+
return {
|
|
46
|
+
alt,
|
|
47
|
+
width,
|
|
48
|
+
height,
|
|
49
|
+
draggable: 'false',
|
|
50
|
+
'data-sizes': 'auto',
|
|
51
|
+
'quality-type': JSON.stringify(qualityType) || '{}',
|
|
52
|
+
'quality-percent': JSON.stringify(qualityPercent) || '{}'
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const getFilteredAttrs = ()=>{
|
|
56
|
+
const ignoreAttrs = [
|
|
57
|
+
'src',
|
|
58
|
+
'srcset',
|
|
59
|
+
'width',
|
|
60
|
+
'height',
|
|
61
|
+
'alt',
|
|
62
|
+
'base-src'
|
|
63
|
+
];
|
|
64
|
+
const filteredAttrs = {};
|
|
65
|
+
Object.entries(props).forEach(([key, value])=>{
|
|
66
|
+
if (!ignoreAttrs.includes(key) && (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')) {
|
|
67
|
+
filteredAttrs[key] = value;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return filteredAttrs;
|
|
71
|
+
};
|
|
72
|
+
return system.createAttr({
|
|
73
|
+
...customAttrs,
|
|
74
|
+
...getBaseAttrs(),
|
|
75
|
+
...getLoadingAttrs(),
|
|
76
|
+
...getFilteredAttrs()
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
exports.getNextImageLiquidAttrs = getNextImageLiquidAttrs;
|