@gem-sdk/components 2.0.0-dev.643 → 2.0.0-dev.645
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/icon-list-hoz/setting/IconListHoz.js +0 -5
- package/dist/cjs/icon-list-hoz/setting/configs/settings.js +1 -1
- package/dist/cjs/icon-list-hoz/setting/configs/uiV2.js +1 -1
- package/dist/cjs/product/components/ProductImagesV2/components/gallery-grid/GalleryGrid.liquid.js +1 -1
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +1 -1
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +1 -1
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductFeatureImage.js +1 -1
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +1 -1
- package/dist/cjs/video/components/HTML5Embed.js +1 -2
- package/dist/cjs/video/components/HTML5Embed.liquid.js +1 -2
- package/dist/cjs/video/components/LiteVimeoEmbed.js +5 -4
- package/dist/cjs/video/components/LiteVimeoEmbed.liquid.js +2 -1
- package/dist/cjs/video/components/common/common.js +11 -0
- package/dist/cjs/video/components/common/getAttr.js +2 -2
- package/dist/cjs/video/components/common/getClasses.js +2 -2
- package/dist/cjs/video/components/common/getStyle.js +3 -2
- package/dist/cjs/video/components/common/index.js +1 -1
- package/dist/cjs/video/hooks/useLiteVimeoEmbed.js +6 -1
- package/dist/esm/icon-list-hoz/setting/IconListHoz.js +0 -5
- package/dist/esm/icon-list-hoz/setting/configs/settings.js +1 -1
- package/dist/esm/icon-list-hoz/setting/configs/uiV2.js +1 -1
- package/dist/esm/product/components/ProductImagesV2/components/gallery-grid/GalleryGrid.liquid.js +1 -1
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +1 -1
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +1 -1
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductFeatureImage.js +1 -1
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +1 -1
- package/dist/esm/video/components/HTML5Embed.js +1 -2
- package/dist/esm/video/components/HTML5Embed.liquid.js +1 -2
- package/dist/esm/video/components/LiteVimeoEmbed.js +5 -4
- package/dist/esm/video/components/LiteVimeoEmbed.liquid.js +2 -1
- package/dist/esm/video/components/common/common.js +9 -0
- package/dist/esm/video/components/common/getAttr.js +2 -2
- package/dist/esm/video/components/common/getClasses.js +2 -2
- package/dist/esm/video/components/common/getStyle.js +3 -2
- package/dist/esm/video/components/common/index.js +1 -1
- package/dist/esm/video/hooks/useLiteVimeoEmbed.js +6 -1
- package/package.json +1 -1
package/dist/cjs/product/components/ProductImagesV2/components/gallery-grid/GalleryGrid.liquid.js
CHANGED
|
@@ -180,7 +180,7 @@ const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazy
|
|
|
180
180
|
external-id="{{media.external_id}}"
|
|
181
181
|
grid-index="{{forloop.index}}"
|
|
182
182
|
data-outline="${className ? 'active' : 'deactive'}"
|
|
183
|
-
class="${galleryItemClasses(`gem-slider-item-${builderPropUID}-{{product.id}} ${className}`)}"
|
|
183
|
+
class="${galleryItemClasses(`gem-slider-item-${builderPropUID}-{{product.id}} gp-gallery-image-item ${className}`)}"
|
|
184
184
|
style="${_function.getStyleOfObject(galleryGridItemStyles)}"
|
|
185
185
|
>
|
|
186
186
|
<div class="gp-h-full" style="${system.LiquidIf(`media == null or media.media_type == 'image'`, `display: block !important;`)}">
|
package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js
CHANGED
|
@@ -60,7 +60,7 @@ const ProductFeaturedImageCarousel = (props)=>{
|
|
|
60
60
|
filteredProductImages?.map((image)=>{
|
|
61
61
|
return /*#__PURE__*/ jsxRuntime.jsx(CarouselItem.default, {
|
|
62
62
|
contentType: "productImage",
|
|
63
|
-
className: galleryItemClasses('gp-ft-image-item'),
|
|
63
|
+
className: galleryItemClasses('gp-ft-image-item !gp-min-w-full'),
|
|
64
64
|
onClickItem: ()=>{
|
|
65
65
|
const clickEffect = core.getResponsiveValueByScreen(setting?.ftClickOpenLightBox, currentDevice);
|
|
66
66
|
if (clickEffect !== 'none') onHandleClick(image?.id ?? '', enableOpenLightBox);
|
package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js
CHANGED
|
@@ -177,7 +177,7 @@ const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazy
|
|
|
177
177
|
external-id="{{media.external_id}}"
|
|
178
178
|
grid-index="{{forloop.index}}"
|
|
179
179
|
data-outline="${className ? 'active' : 'deactive'}"
|
|
180
|
-
class="${galleryItemClasses(`gem-slider-item-${builderPropUID}-{{product.id}} ${className}`)}"
|
|
180
|
+
class="${galleryItemClasses(`gem-slider-item-${builderPropUID}-{{product.id}} gp-gallery-image-item ${className}`)}"
|
|
181
181
|
style="${_function.getStyleOfObject(galleryGridItemStyles)}"
|
|
182
182
|
>
|
|
183
183
|
<div class="gp-h-full" style="${system.LiquidIf(`media == null or media.media_type == 'image'`, `display: block !important;`)}">
|
|
@@ -204,7 +204,7 @@ const productFeatureImageSetting = [
|
|
|
204
204
|
hide: true,
|
|
205
205
|
label: 'Custom Arrow',
|
|
206
206
|
info: 'Choose from list or paste any SVG icon',
|
|
207
|
-
default: `<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
207
|
+
default: `<svg data-name="arrow" width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
208
208
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 0C18.6274 0 24 5.37258 24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0ZM10.6828 8.13017C10.5266 7.95661 10.2734 7.95661 10.1172 8.13017C9.96095 8.30374 9.96095 8.58515 10.1172 8.75871L13.0343 12L10.1172 15.2413C9.96095 15.4149 9.96095 15.6963 10.1172 15.8698C10.2734 16.0434 10.5266 16.0434 10.6828 15.8698L13.8828 12.3143C14.0391 12.1407 14.0391 11.8593 13.8828 11.6857L10.6828 8.13017Z" fill="currentColor"/>
|
|
209
209
|
</svg>`
|
|
210
210
|
},
|
|
@@ -163,7 +163,7 @@ const productGalleryImageSetting = [
|
|
|
163
163
|
hide: true,
|
|
164
164
|
label: 'Custom Arrow',
|
|
165
165
|
info: 'Choose from list or paste any SVG icon',
|
|
166
|
-
default: `<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
166
|
+
default: `<svg data-name="arrow" width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
167
167
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 0C18.6274 0 24 5.37258 24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0ZM10.6828 8.13017C10.5266 7.95661 10.2734 7.95661 10.1172 8.13017C9.96095 8.30374 9.96095 8.58515 10.1172 8.75871L13.0343 12L10.1172 15.2413C9.96095 15.4149 9.96095 15.6963 10.1172 15.8698C10.2734 16.0434 10.5266 16.0434 10.6828 15.8698L13.8828 12.3143C14.0391 12.1407 14.0391 11.8593 13.8828 11.6857L10.6828 8.13017Z" fill="currentColor"/>
|
|
168
168
|
</svg>`
|
|
169
169
|
},
|
|
@@ -19,7 +19,7 @@ const HTML5Embed = (props)=>{
|
|
|
19
19
|
const isInstantLP = mode !== 'edit';
|
|
20
20
|
const { thumbnail, muted, autoplay, loop, controls, src, style, title, className, lazy, preload } = props;
|
|
21
21
|
const { playVideoAndTurnOffThumbnail, videoRef, showThumbnail } = useLiteHtml5Embed.useLiteHtml5Embed(autoplay, src);
|
|
22
|
-
const preloadThumbnail = !isInstantLP && autoplay && thumbnail;
|
|
22
|
+
const preloadThumbnail = !isInstantLP && autoplay && muted && !!thumbnail;
|
|
23
23
|
const offLazyLoad = !lazy && props.isVideoComponent && isInstantLP;
|
|
24
24
|
const isMp4Video = index.listSourceVideoSupport.some((ext)=>src.endsWith(ext));
|
|
25
25
|
const hiddenRenderThumbnail = !thumbnail || !showThumbnail;
|
|
@@ -32,7 +32,6 @@ const HTML5Embed = (props)=>{
|
|
|
32
32
|
preloadThumbnail,
|
|
33
33
|
offLazyLoad,
|
|
34
34
|
src,
|
|
35
|
-
isInstantLP,
|
|
36
35
|
thumbnail
|
|
37
36
|
})
|
|
38
37
|
});
|
|
@@ -14,7 +14,7 @@ const HTML5Embed = (props)=>{
|
|
|
14
14
|
const videoId = `gp-video-${props.uid}`;
|
|
15
15
|
const isInstantLP = false;
|
|
16
16
|
const { thumbnail, muted, autoplay, loop, controls, src, style, title, className, lazy, preload } = props;
|
|
17
|
-
const preloadThumbnail = autoplay && thumbnail;
|
|
17
|
+
const preloadThumbnail = autoplay && muted && !!thumbnail;
|
|
18
18
|
const offLazyLoad = !lazy && props.isVideoComponent;
|
|
19
19
|
const isMp4Video = src.endsWith('.mp4');
|
|
20
20
|
const hiddenRenderThumbnail = !thumbnail || autoplay;
|
|
@@ -27,7 +27,6 @@ const HTML5Embed = (props)=>{
|
|
|
27
27
|
preloadThumbnail,
|
|
28
28
|
offLazyLoad,
|
|
29
29
|
src,
|
|
30
|
-
isInstantLP,
|
|
31
30
|
thumbnail
|
|
32
31
|
})
|
|
33
32
|
});
|
|
@@ -12,21 +12,22 @@ var index = require('./common/index.js');
|
|
|
12
12
|
var NextImage = require('../../image/components/NextImage.js');
|
|
13
13
|
|
|
14
14
|
const LiteVimeoEmbed = (props)=>{
|
|
15
|
-
const { title, lazy, aspectRatio } = props;
|
|
15
|
+
const { title, lazy, aspectRatio, autoplay, muted } = props;
|
|
16
16
|
const { iframeSrc, videoId } = index.getVimeoParams(props);
|
|
17
|
-
const
|
|
17
|
+
const preventAutoPlayByBrowser = autoplay && muted && !lazy;
|
|
18
|
+
const { addIframe, thumbnail, iframe, originRatio } = useLiteVimeoEmbed.useLiteVimeoEmbed(lazy, videoId);
|
|
18
19
|
const posterUrl = props.thumbnail || thumbnail;
|
|
19
20
|
const iframeVimeoStyle = system.createStyle({
|
|
20
21
|
...getStyle.getIframeVimeoStyle(aspectRatio)
|
|
21
22
|
});
|
|
22
23
|
const articleVimeoStyle = system.createStyle({
|
|
23
|
-
...getStyle.getArticleVimeoStyle(aspectRatio, posterUrl)
|
|
24
|
+
...getStyle.getArticleVimeoStyle(aspectRatio, posterUrl, originRatio)
|
|
24
25
|
});
|
|
25
26
|
const articleVimeoClasses = system.createClass({
|
|
26
27
|
...getClasses.getArticleVimeoClasses(posterUrl, aspectRatio)
|
|
27
28
|
});
|
|
28
29
|
const imageVimeoClasses = system.createClass({
|
|
29
|
-
...getClasses.getImageVimeoClasses(iframe)
|
|
30
|
+
...getClasses.getImageVimeoClasses(iframe, preventAutoPlayByBrowser)
|
|
30
31
|
});
|
|
31
32
|
const buttonVimeoClasses = system.createClass({
|
|
32
33
|
...getClasses.getButtonVimeoClasses(iframe)
|
|
@@ -13,6 +13,7 @@ var NextImage_liquid = require('../../image/components/NextImage.liquid.js');
|
|
|
13
13
|
const LiteVimeoEmbed = (props)=>{
|
|
14
14
|
const { title, id, lazy, aspectRatio, autoplay, muted, preload, thumbnailLink } = props;
|
|
15
15
|
const { iframeSrc } = index.getVimeoParams(props);
|
|
16
|
+
const preventAutoPlayByBrowser = autoplay && muted && !lazy;
|
|
16
17
|
const iframe = !lazy;
|
|
17
18
|
const posterUrl = props.thumbnail;
|
|
18
19
|
const stateVimeo = system.createStateOrContext({
|
|
@@ -35,7 +36,7 @@ const LiteVimeoEmbed = (props)=>{
|
|
|
35
36
|
...getClasses.getArticleVimeoClasses(posterUrl, aspectRatio)
|
|
36
37
|
});
|
|
37
38
|
const imageVimeoClasses = system.createClass({
|
|
38
|
-
...getClasses.getImageVimeoClasses(iframe)
|
|
39
|
+
...getClasses.getImageVimeoClasses(iframe, preventAutoPlayByBrowser)
|
|
39
40
|
});
|
|
40
41
|
const buttonVimeoClasses = system.createClass({
|
|
41
42
|
...getClasses.getButtonVimeoClasses(iframe)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const makeStyleResponsiveRatio = (name, value, originRatio)=>{
|
|
4
|
+
return {
|
|
5
|
+
[`--${name}`]: originRatio && value?.desktop === 'auto' ? originRatio : value?.desktop,
|
|
6
|
+
[`--${name}-tablet`]: originRatio && value?.tablet === 'auto' ? originRatio : value?.tablet,
|
|
7
|
+
[`--${name}-mobile`]: originRatio && value?.mobile === 'auto' ? originRatio : value?.mobile
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.makeStyleResponsiveRatio = makeStyleResponsiveRatio;
|
|
@@ -5,13 +5,13 @@ const getAttr = ({ uid })=>{
|
|
|
5
5
|
'data-id': uid
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
|
-
const getHtml5Attr = ({ videoId, title, autoplay, preloadThumbnail, offLazyLoad, src,
|
|
8
|
+
const getHtml5Attr = ({ videoId, title, autoplay, preloadThumbnail, offLazyLoad, src, thumbnail })=>{
|
|
9
9
|
return {
|
|
10
10
|
id: `${videoId}`,
|
|
11
11
|
title: `${title}`,
|
|
12
12
|
preload: `${autoplay && !preloadThumbnail || offLazyLoad ? 'metadata' : 'none'}`,
|
|
13
13
|
'data-src': `${src}`,
|
|
14
|
-
poster:
|
|
14
|
+
poster: preloadThumbnail && thumbnail ? thumbnail : '',
|
|
15
15
|
'data-poster': thumbnail || ''
|
|
16
16
|
};
|
|
17
17
|
};
|
|
@@ -71,9 +71,9 @@ const getVideoYoutubeClasses = (className, offLazyLoad)=>{
|
|
|
71
71
|
...composeClasses(classList)
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
const getImageVimeoClasses = (iframe)=>{
|
|
74
|
+
const getImageVimeoClasses = (iframe, preventAutoPlayByBrowser)=>{
|
|
75
75
|
let classList = `gp-h-full gp-w-full gp-relative gp-top-0 gp-left-0 gp-z-9`;
|
|
76
|
-
if (iframe) classList += ` gp-invisible gp-opacity-0`;
|
|
76
|
+
if (iframe && !preventAutoPlayByBrowser) classList += ` gp-invisible gp-opacity-0`;
|
|
77
77
|
return {
|
|
78
78
|
...composeClasses(classList)
|
|
79
79
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@gem-sdk/core');
|
|
4
|
+
var common = require('./common.js');
|
|
4
5
|
|
|
5
6
|
function filterTruthyStyles(styles) {
|
|
6
7
|
return Object.fromEntries(Object.entries(styles || {}).filter(([, value])=>!!value));
|
|
@@ -53,10 +54,10 @@ const getIframeVimeoStyle = (aspectRatio)=>{
|
|
|
53
54
|
};
|
|
54
55
|
return filterTruthyStyles(composeStyles);
|
|
55
56
|
};
|
|
56
|
-
const getArticleVimeoStyle = (aspectRatio, posterUrl)=>{
|
|
57
|
+
const getArticleVimeoStyle = (aspectRatio, posterUrl, originRatio)=>{
|
|
57
58
|
const composeStyles = {
|
|
58
59
|
backgroundImage: `url(${posterUrl})`,
|
|
59
|
-
...
|
|
60
|
+
...common.makeStyleResponsiveRatio('aspect', aspectRatio, originRatio)
|
|
60
61
|
};
|
|
61
62
|
return filterTruthyStyles(composeStyles);
|
|
62
63
|
};
|
|
@@ -52,7 +52,7 @@ const getYoutubeParams = (props)=>{
|
|
|
52
52
|
const getVimeoParams = (props)=>{
|
|
53
53
|
const { id, autoplay, muted, controls, loop, lazy } = props;
|
|
54
54
|
const videoId = encodeURIComponent(id);
|
|
55
|
-
const params = `?&autoplay=${lazy ? 1 : autoplay ? 1 : 0}` + `&muted=${muted ? 1 : 0}` + `&loop=${loop ? 1 : 0}` + `&controls=${controls}` +
|
|
55
|
+
const params = `?&autoplay=${lazy ? 1 : autoplay ? 1 : 0}` + `&muted=${muted ? 1 : 0}` + `&loop=${loop ? 1 : 0}` + `&controls=${controls}` + '&autopause=false';
|
|
56
56
|
const iframeSrc = `https://player.vimeo.com/video/${videoId}${params}`;
|
|
57
57
|
return {
|
|
58
58
|
videoId,
|
|
@@ -7,10 +7,14 @@ var React = require('react');
|
|
|
7
7
|
const useLiteVimeoEmbed = (lazy, videoId)=>{
|
|
8
8
|
const [thumbnail, setThumbnail] = React.useState();
|
|
9
9
|
const [iframe, setIframe] = React.useState(!lazy);
|
|
10
|
+
const [originRatio, setOriginRatio] = React.useState();
|
|
10
11
|
React.useEffect(()=>{
|
|
11
12
|
fetch(`https://vimeo.com/api/v2/video/${videoId}.json`).then((res)=>{
|
|
12
13
|
return res.json();
|
|
13
14
|
}).then(([video])=>{
|
|
15
|
+
if (video?.width && video?.height) {
|
|
16
|
+
setOriginRatio((video?.width / video?.height).toFixed(2));
|
|
17
|
+
}
|
|
14
18
|
setThumbnail(video?.thumbnail_large);
|
|
15
19
|
});
|
|
16
20
|
}, [
|
|
@@ -23,7 +27,8 @@ const useLiteVimeoEmbed = (lazy, videoId)=>{
|
|
|
23
27
|
return {
|
|
24
28
|
addIframe,
|
|
25
29
|
thumbnail,
|
|
26
|
-
iframe
|
|
30
|
+
iframe,
|
|
31
|
+
originRatio
|
|
27
32
|
};
|
|
28
33
|
};
|
|
29
34
|
|
package/dist/esm/product/components/ProductImagesV2/components/gallery-grid/GalleryGrid.liquid.js
CHANGED
|
@@ -176,7 +176,7 @@ const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazy
|
|
|
176
176
|
external-id="{{media.external_id}}"
|
|
177
177
|
grid-index="{{forloop.index}}"
|
|
178
178
|
data-outline="${className ? 'active' : 'deactive'}"
|
|
179
|
-
class="${galleryItemClasses(`gem-slider-item-${builderPropUID}-{{product.id}} ${className}`)}"
|
|
179
|
+
class="${galleryItemClasses(`gem-slider-item-${builderPropUID}-{{product.id}} gp-gallery-image-item ${className}`)}"
|
|
180
180
|
style="${getStyleOfObject(galleryGridItemStyles)}"
|
|
181
181
|
>
|
|
182
182
|
<div class="gp-h-full" style="${LiquidIf(`media == null or media.media_type == 'image'`, `display: block !important;`)}">
|
package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js
CHANGED
|
@@ -56,7 +56,7 @@ const ProductFeaturedImageCarousel = (props)=>{
|
|
|
56
56
|
filteredProductImages?.map((image)=>{
|
|
57
57
|
return /*#__PURE__*/ jsx(CarouselItem, {
|
|
58
58
|
contentType: "productImage",
|
|
59
|
-
className: galleryItemClasses('gp-ft-image-item'),
|
|
59
|
+
className: galleryItemClasses('gp-ft-image-item !gp-min-w-full'),
|
|
60
60
|
onClickItem: ()=>{
|
|
61
61
|
const clickEffect = getResponsiveValueByScreen(setting?.ftClickOpenLightBox, currentDevice);
|
|
62
62
|
if (clickEffect !== 'none') onHandleClick(image?.id ?? '', enableOpenLightBox);
|
package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js
CHANGED
|
@@ -173,7 +173,7 @@ const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazy
|
|
|
173
173
|
external-id="{{media.external_id}}"
|
|
174
174
|
grid-index="{{forloop.index}}"
|
|
175
175
|
data-outline="${className ? 'active' : 'deactive'}"
|
|
176
|
-
class="${galleryItemClasses(`gem-slider-item-${builderPropUID}-{{product.id}} ${className}`)}"
|
|
176
|
+
class="${galleryItemClasses(`gem-slider-item-${builderPropUID}-{{product.id}} gp-gallery-image-item ${className}`)}"
|
|
177
177
|
style="${getStyleOfObject(galleryGridItemStyles)}"
|
|
178
178
|
>
|
|
179
179
|
<div class="gp-h-full" style="${LiquidIf(`media == null or media.media_type == 'image'`, `display: block !important;`)}">
|
|
@@ -202,7 +202,7 @@ const productFeatureImageSetting = [
|
|
|
202
202
|
hide: true,
|
|
203
203
|
label: 'Custom Arrow',
|
|
204
204
|
info: 'Choose from list or paste any SVG icon',
|
|
205
|
-
default: `<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
205
|
+
default: `<svg data-name="arrow" width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
206
206
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 0C18.6274 0 24 5.37258 24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0ZM10.6828 8.13017C10.5266 7.95661 10.2734 7.95661 10.1172 8.13017C9.96095 8.30374 9.96095 8.58515 10.1172 8.75871L13.0343 12L10.1172 15.2413C9.96095 15.4149 9.96095 15.6963 10.1172 15.8698C10.2734 16.0434 10.5266 16.0434 10.6828 15.8698L13.8828 12.3143C14.0391 12.1407 14.0391 11.8593 13.8828 11.6857L10.6828 8.13017Z" fill="currentColor"/>
|
|
207
207
|
</svg>`
|
|
208
208
|
},
|
|
@@ -161,7 +161,7 @@ const productGalleryImageSetting = [
|
|
|
161
161
|
hide: true,
|
|
162
162
|
label: 'Custom Arrow',
|
|
163
163
|
info: 'Choose from list or paste any SVG icon',
|
|
164
|
-
default: `<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
164
|
+
default: `<svg data-name="arrow" width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
165
165
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 0C18.6274 0 24 5.37258 24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0ZM10.6828 8.13017C10.5266 7.95661 10.2734 7.95661 10.1172 8.13017C9.96095 8.30374 9.96095 8.58515 10.1172 8.75871L13.0343 12L10.1172 15.2413C9.96095 15.4149 9.96095 15.6963 10.1172 15.8698C10.2734 16.0434 10.5266 16.0434 10.6828 15.8698L13.8828 12.3143C14.0391 12.1407 14.0391 11.8593 13.8828 11.6857L10.6828 8.13017Z" fill="currentColor"/>
|
|
166
166
|
</svg>`
|
|
167
167
|
},
|
|
@@ -15,7 +15,7 @@ const HTML5Embed = (props)=>{
|
|
|
15
15
|
const isInstantLP = mode !== 'edit';
|
|
16
16
|
const { thumbnail, muted, autoplay, loop, controls, src, style, title, className, lazy, preload } = props;
|
|
17
17
|
const { playVideoAndTurnOffThumbnail, videoRef, showThumbnail } = useLiteHtml5Embed(autoplay, src);
|
|
18
|
-
const preloadThumbnail = !isInstantLP && autoplay && thumbnail;
|
|
18
|
+
const preloadThumbnail = !isInstantLP && autoplay && muted && !!thumbnail;
|
|
19
19
|
const offLazyLoad = !lazy && props.isVideoComponent && isInstantLP;
|
|
20
20
|
const isMp4Video = listSourceVideoSupport.some((ext)=>src.endsWith(ext));
|
|
21
21
|
const hiddenRenderThumbnail = !thumbnail || !showThumbnail;
|
|
@@ -28,7 +28,6 @@ const HTML5Embed = (props)=>{
|
|
|
28
28
|
preloadThumbnail,
|
|
29
29
|
offLazyLoad,
|
|
30
30
|
src,
|
|
31
|
-
isInstantLP,
|
|
32
31
|
thumbnail
|
|
33
32
|
})
|
|
34
33
|
});
|
|
@@ -10,7 +10,7 @@ const HTML5Embed = (props)=>{
|
|
|
10
10
|
const videoId = `gp-video-${props.uid}`;
|
|
11
11
|
const isInstantLP = false;
|
|
12
12
|
const { thumbnail, muted, autoplay, loop, controls, src, style, title, className, lazy, preload } = props;
|
|
13
|
-
const preloadThumbnail = autoplay && thumbnail;
|
|
13
|
+
const preloadThumbnail = autoplay && muted && !!thumbnail;
|
|
14
14
|
const offLazyLoad = !lazy && props.isVideoComponent;
|
|
15
15
|
const isMp4Video = src.endsWith('.mp4');
|
|
16
16
|
const hiddenRenderThumbnail = !thumbnail || autoplay;
|
|
@@ -23,7 +23,6 @@ const HTML5Embed = (props)=>{
|
|
|
23
23
|
preloadThumbnail,
|
|
24
24
|
offLazyLoad,
|
|
25
25
|
src,
|
|
26
|
-
isInstantLP,
|
|
27
26
|
thumbnail
|
|
28
27
|
})
|
|
29
28
|
});
|
|
@@ -8,21 +8,22 @@ import { getVimeoParams } from './common/index.js';
|
|
|
8
8
|
import NextImage from '../../image/components/NextImage.js';
|
|
9
9
|
|
|
10
10
|
const LiteVimeoEmbed = (props)=>{
|
|
11
|
-
const { title, lazy, aspectRatio } = props;
|
|
11
|
+
const { title, lazy, aspectRatio, autoplay, muted } = props;
|
|
12
12
|
const { iframeSrc, videoId } = getVimeoParams(props);
|
|
13
|
-
const
|
|
13
|
+
const preventAutoPlayByBrowser = autoplay && muted && !lazy;
|
|
14
|
+
const { addIframe, thumbnail, iframe, originRatio } = useLiteVimeoEmbed(lazy, videoId);
|
|
14
15
|
const posterUrl = props.thumbnail || thumbnail;
|
|
15
16
|
const iframeVimeoStyle = createStyle({
|
|
16
17
|
...getIframeVimeoStyle(aspectRatio)
|
|
17
18
|
});
|
|
18
19
|
const articleVimeoStyle = createStyle({
|
|
19
|
-
...getArticleVimeoStyle(aspectRatio, posterUrl)
|
|
20
|
+
...getArticleVimeoStyle(aspectRatio, posterUrl, originRatio)
|
|
20
21
|
});
|
|
21
22
|
const articleVimeoClasses = createClass({
|
|
22
23
|
...getArticleVimeoClasses(posterUrl, aspectRatio)
|
|
23
24
|
});
|
|
24
25
|
const imageVimeoClasses = createClass({
|
|
25
|
-
...getImageVimeoClasses(iframe)
|
|
26
|
+
...getImageVimeoClasses(iframe, preventAutoPlayByBrowser)
|
|
26
27
|
});
|
|
27
28
|
const buttonVimeoClasses = createClass({
|
|
28
29
|
...getButtonVimeoClasses(iframe)
|
|
@@ -9,6 +9,7 @@ import NextImage from '../../image/components/NextImage.liquid.js';
|
|
|
9
9
|
const LiteVimeoEmbed = (props)=>{
|
|
10
10
|
const { title, id, lazy, aspectRatio, autoplay, muted, preload, thumbnailLink } = props;
|
|
11
11
|
const { iframeSrc } = getVimeoParams(props);
|
|
12
|
+
const preventAutoPlayByBrowser = autoplay && muted && !lazy;
|
|
12
13
|
const iframe = !lazy;
|
|
13
14
|
const posterUrl = props.thumbnail;
|
|
14
15
|
const stateVimeo = createStateOrContext({
|
|
@@ -31,7 +32,7 @@ const LiteVimeoEmbed = (props)=>{
|
|
|
31
32
|
...getArticleVimeoClasses(posterUrl, aspectRatio)
|
|
32
33
|
});
|
|
33
34
|
const imageVimeoClasses = createClass({
|
|
34
|
-
...getImageVimeoClasses(iframe)
|
|
35
|
+
...getImageVimeoClasses(iframe, preventAutoPlayByBrowser)
|
|
35
36
|
});
|
|
36
37
|
const buttonVimeoClasses = createClass({
|
|
37
38
|
...getButtonVimeoClasses(iframe)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const makeStyleResponsiveRatio = (name, value, originRatio)=>{
|
|
2
|
+
return {
|
|
3
|
+
[`--${name}`]: originRatio && value?.desktop === 'auto' ? originRatio : value?.desktop,
|
|
4
|
+
[`--${name}-tablet`]: originRatio && value?.tablet === 'auto' ? originRatio : value?.tablet,
|
|
5
|
+
[`--${name}-mobile`]: originRatio && value?.mobile === 'auto' ? originRatio : value?.mobile
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { makeStyleResponsiveRatio };
|
|
@@ -3,13 +3,13 @@ const getAttr = ({ uid })=>{
|
|
|
3
3
|
'data-id': uid
|
|
4
4
|
};
|
|
5
5
|
};
|
|
6
|
-
const getHtml5Attr = ({ videoId, title, autoplay, preloadThumbnail, offLazyLoad, src,
|
|
6
|
+
const getHtml5Attr = ({ videoId, title, autoplay, preloadThumbnail, offLazyLoad, src, thumbnail })=>{
|
|
7
7
|
return {
|
|
8
8
|
id: `${videoId}`,
|
|
9
9
|
title: `${title}`,
|
|
10
10
|
preload: `${autoplay && !preloadThumbnail || offLazyLoad ? 'metadata' : 'none'}`,
|
|
11
11
|
'data-src': `${src}`,
|
|
12
|
-
poster:
|
|
12
|
+
poster: preloadThumbnail && thumbnail ? thumbnail : '',
|
|
13
13
|
'data-poster': thumbnail || ''
|
|
14
14
|
};
|
|
15
15
|
};
|
|
@@ -69,9 +69,9 @@ const getVideoYoutubeClasses = (className, offLazyLoad)=>{
|
|
|
69
69
|
...composeClasses(classList)
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
-
const getImageVimeoClasses = (iframe)=>{
|
|
72
|
+
const getImageVimeoClasses = (iframe, preventAutoPlayByBrowser)=>{
|
|
73
73
|
let classList = `gp-h-full gp-w-full gp-relative gp-top-0 gp-left-0 gp-z-9`;
|
|
74
|
-
if (iframe) classList += ` gp-invisible gp-opacity-0`;
|
|
74
|
+
if (iframe && !preventAutoPlayByBrowser) classList += ` gp-invisible gp-opacity-0`;
|
|
75
75
|
return {
|
|
76
76
|
...composeClasses(classList)
|
|
77
77
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { makeStyleResponsive } from '@gem-sdk/core';
|
|
2
|
+
import { makeStyleResponsiveRatio } from './common.js';
|
|
2
3
|
|
|
3
4
|
function filterTruthyStyles(styles) {
|
|
4
5
|
return Object.fromEntries(Object.entries(styles || {}).filter(([, value])=>!!value));
|
|
@@ -51,10 +52,10 @@ const getIframeVimeoStyle = (aspectRatio)=>{
|
|
|
51
52
|
};
|
|
52
53
|
return filterTruthyStyles(composeStyles);
|
|
53
54
|
};
|
|
54
|
-
const getArticleVimeoStyle = (aspectRatio, posterUrl)=>{
|
|
55
|
+
const getArticleVimeoStyle = (aspectRatio, posterUrl, originRatio)=>{
|
|
55
56
|
const composeStyles = {
|
|
56
57
|
backgroundImage: `url(${posterUrl})`,
|
|
57
|
-
...
|
|
58
|
+
...makeStyleResponsiveRatio('aspect', aspectRatio, originRatio)
|
|
58
59
|
};
|
|
59
60
|
return filterTruthyStyles(composeStyles);
|
|
60
61
|
};
|
|
@@ -50,7 +50,7 @@ const getYoutubeParams = (props)=>{
|
|
|
50
50
|
const getVimeoParams = (props)=>{
|
|
51
51
|
const { id, autoplay, muted, controls, loop, lazy } = props;
|
|
52
52
|
const videoId = encodeURIComponent(id);
|
|
53
|
-
const params = `?&autoplay=${lazy ? 1 : autoplay ? 1 : 0}` + `&muted=${muted ? 1 : 0}` + `&loop=${loop ? 1 : 0}` + `&controls=${controls}` +
|
|
53
|
+
const params = `?&autoplay=${lazy ? 1 : autoplay ? 1 : 0}` + `&muted=${muted ? 1 : 0}` + `&loop=${loop ? 1 : 0}` + `&controls=${controls}` + '&autopause=false';
|
|
54
54
|
const iframeSrc = `https://player.vimeo.com/video/${videoId}${params}`;
|
|
55
55
|
return {
|
|
56
56
|
videoId,
|
|
@@ -3,10 +3,14 @@ import { useState, useEffect } from 'react';
|
|
|
3
3
|
const useLiteVimeoEmbed = (lazy, videoId)=>{
|
|
4
4
|
const [thumbnail, setThumbnail] = useState();
|
|
5
5
|
const [iframe, setIframe] = useState(!lazy);
|
|
6
|
+
const [originRatio, setOriginRatio] = useState();
|
|
6
7
|
useEffect(()=>{
|
|
7
8
|
fetch(`https://vimeo.com/api/v2/video/${videoId}.json`).then((res)=>{
|
|
8
9
|
return res.json();
|
|
9
10
|
}).then(([video])=>{
|
|
11
|
+
if (video?.width && video?.height) {
|
|
12
|
+
setOriginRatio((video?.width / video?.height).toFixed(2));
|
|
13
|
+
}
|
|
10
14
|
setThumbnail(video?.thumbnail_large);
|
|
11
15
|
});
|
|
12
16
|
}, [
|
|
@@ -19,7 +23,8 @@ const useLiteVimeoEmbed = (lazy, videoId)=>{
|
|
|
19
23
|
return {
|
|
20
24
|
addIframe,
|
|
21
25
|
thumbnail,
|
|
22
|
-
iframe
|
|
26
|
+
iframe,
|
|
27
|
+
originRatio
|
|
23
28
|
};
|
|
24
29
|
};
|
|
25
30
|
|