@gem-sdk/components 2.0.0-dev.627 → 2.0.0-dev.629
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/button/components/Button.liquid.js +2 -2
- package/dist/cjs/countdown-timer/setting/configs/settings.js +3 -3
- package/dist/cjs/countdown-timer/setting/configs/uiV2.js +3 -1
- package/dist/cjs/product/setting/product-button/configs/uiV2.js +1 -0
- package/dist/cjs/video/components/HTML5Embed.liquid.js +1 -0
- package/dist/cjs/video/components/LiteVimeoEmbed.liquid.js +8 -6
- package/dist/cjs/video/components/Video.js +5 -4
- package/dist/cjs/video/components/Video.liquid.js +5 -4
- package/dist/cjs/video/components/common/getClasses.js +1 -1
- package/dist/cjs/video/components/common/index.js +2 -2
- package/dist/esm/button/components/Button.liquid.js +2 -2
- package/dist/esm/countdown-timer/setting/configs/settings.js +3 -3
- package/dist/esm/countdown-timer/setting/configs/uiV2.js +3 -1
- package/dist/esm/product/setting/product-button/configs/uiV2.js +1 -0
- package/dist/esm/video/components/HTML5Embed.liquid.js +1 -0
- package/dist/esm/video/components/LiteVimeoEmbed.liquid.js +8 -6
- package/dist/esm/video/components/Video.js +5 -4
- package/dist/esm/video/components/Video.liquid.js +5 -4
- package/dist/esm/video/components/common/getClasses.js +1 -1
- package/dist/esm/video/components/common/index.js +2 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ var helpers = require('./common/helpers.js');
|
|
|
16
16
|
|
|
17
17
|
const Button = (props)=>{
|
|
18
18
|
const { advanced, className, nodePrice, customAttrs, styles: styles$1 = {}, setting = {}, builderProps, wrapClassName = '' } = props;
|
|
19
|
-
const { iconSvg,
|
|
19
|
+
const { iconSvg, btnLink, htmlType, disabled, enableBtnLink, shouldClearSpace, disabledLoading = true } = setting;
|
|
20
20
|
const { enableTextStyle = true } = styles$1;
|
|
21
21
|
const { customCss, wrapStyle, restStyle, dataState, dataIdAttr, isShowIcon, isScrollToElement, getArialLabel, getLabelToDisplay, checkIsShowLabel, checkIsEditableLabel } = data.getData(props);
|
|
22
22
|
const { HTMLTag: ButtonWrapper, urlData, shouldRenderLink } = helpers.getInsertLinkData({
|
|
@@ -103,7 +103,7 @@ const Button = (props)=>{
|
|
|
103
103
|
style="${buttonStyles}"
|
|
104
104
|
class="${buttonClasses}"
|
|
105
105
|
>
|
|
106
|
-
${system.If(
|
|
106
|
+
${system.If(!disabledLoading, ButtonLoadingIndicator_liquid.default(), '')}
|
|
107
107
|
<div class="${buttonContentWrapperClasses}">
|
|
108
108
|
${system.If(isShowIcon, ButtonIcon_liquid.default({
|
|
109
109
|
iconSvg: iconSvg ?? '',
|
|
@@ -22,15 +22,15 @@ const CountdownSettings = [
|
|
|
22
22
|
default: 'evergreen',
|
|
23
23
|
options: [
|
|
24
24
|
{
|
|
25
|
-
label: '
|
|
25
|
+
label: 'End at',
|
|
26
26
|
value: 'standard'
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
label: '
|
|
29
|
+
label: 'Auto-renew',
|
|
30
30
|
value: 'daily'
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
label: '
|
|
33
|
+
label: 'Manual',
|
|
34
34
|
value: 'evergreen'
|
|
35
35
|
}
|
|
36
36
|
]
|
|
@@ -8,7 +8,7 @@ const SettingUIV2 = [
|
|
|
8
8
|
controls: [
|
|
9
9
|
{
|
|
10
10
|
label: {
|
|
11
|
-
en: '
|
|
11
|
+
en: 'Type'
|
|
12
12
|
},
|
|
13
13
|
setting: {
|
|
14
14
|
id: 'behaviour'
|
|
@@ -254,6 +254,7 @@ const SettingUIV2 = [
|
|
|
254
254
|
iconName: 'polaris-text-title',
|
|
255
255
|
getValueFromSettingID: 'numTypo.type',
|
|
256
256
|
isHideClear: true,
|
|
257
|
+
isTypoValue: true,
|
|
257
258
|
controls: [
|
|
258
259
|
{
|
|
259
260
|
setting: {
|
|
@@ -291,6 +292,7 @@ const SettingUIV2 = [
|
|
|
291
292
|
iconName: 'polaris-text-title',
|
|
292
293
|
isHideClear: true,
|
|
293
294
|
getValueFromSettingID: 'labelTypo.type',
|
|
295
|
+
isTypoValue: true,
|
|
294
296
|
controls: [
|
|
295
297
|
{
|
|
296
298
|
setting: {
|
|
@@ -11,13 +11,13 @@ var index = require('./common/index.js');
|
|
|
11
11
|
var NextImage_liquid = require('../../image/components/NextImage.liquid.js');
|
|
12
12
|
|
|
13
13
|
const LiteVimeoEmbed = (props)=>{
|
|
14
|
-
const { title, id, lazy, aspectRatio, autoplay, muted } = props;
|
|
14
|
+
const { title, id, lazy, aspectRatio, autoplay, muted, preload, thumbnailLink } = props;
|
|
15
15
|
const { iframeSrc } = index.getVimeoParams(props);
|
|
16
16
|
const iframe = !lazy;
|
|
17
17
|
const posterUrl = props.thumbnail;
|
|
18
18
|
const stateVimeo = system.createStateOrContext({
|
|
19
19
|
id,
|
|
20
|
-
thumbnail:
|
|
20
|
+
thumbnail: thumbnailLink,
|
|
21
21
|
lazy,
|
|
22
22
|
iframeSrc,
|
|
23
23
|
title,
|
|
@@ -51,12 +51,14 @@ const LiteVimeoEmbed = (props)=>{
|
|
|
51
51
|
data-title="${title}"
|
|
52
52
|
style="${articleVimeoStyle}"
|
|
53
53
|
>
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
${system.If(!iframe, core.template`
|
|
55
|
+
${NextImage_liquid.default({
|
|
56
56
|
src: posterUrl,
|
|
57
57
|
alt: title,
|
|
58
|
-
className: imageVimeoClasses
|
|
59
|
-
|
|
58
|
+
className: imageVimeoClasses,
|
|
59
|
+
enableLazyLoadImage: true,
|
|
60
|
+
priority: preload
|
|
61
|
+
})}`)}
|
|
60
62
|
${system.If(!iframe, core.template`
|
|
61
63
|
<button type="button" class="${buttonVimeoClasses}" aria-label="Play">
|
|
62
64
|
<svg class="gp-w-5 gp-text-white" viewBox="0 0 24 24">
|
|
@@ -19,7 +19,7 @@ const LiteVimeoEmbed = dynamic(()=>Promise.resolve().then(function () { return r
|
|
|
19
19
|
const LiteYouTubeEmbed = dynamic(()=>Promise.resolve().then(function () { return require('./LiteYouTubeEmbed.js'); }));
|
|
20
20
|
const Video = ({ className, setting, style, builderAttrs, builderProps, advanced, children })=>{
|
|
21
21
|
const mode = core.useEditorMode();
|
|
22
|
-
const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster,
|
|
22
|
+
const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, startTime, endTime } = setting ?? {};
|
|
23
23
|
const { cssClass: advancedCssClass } = advanced ?? {};
|
|
24
24
|
const posterSrc = poster?.src;
|
|
25
25
|
const isInstantLP = mode !== 'edit';
|
|
@@ -76,7 +76,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
76
76
|
muted: !mute,
|
|
77
77
|
thumbnail: posterSrc,
|
|
78
78
|
lazy: setting.lazy ?? true,
|
|
79
|
-
preload: preload,
|
|
79
|
+
preload: poster?.preload,
|
|
80
80
|
style: youtubeStyle
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -94,6 +94,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
94
94
|
id: videoId,
|
|
95
95
|
title: "Video",
|
|
96
96
|
aspectRatio: aspectRatio,
|
|
97
|
+
preload: poster?.preload,
|
|
97
98
|
vimeoStyleIframe: vimeoStyle
|
|
98
99
|
});
|
|
99
100
|
}
|
|
@@ -108,7 +109,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
108
109
|
src: html5Url,
|
|
109
110
|
thumbnail: posterSrc,
|
|
110
111
|
title: "Video",
|
|
111
|
-
preload: preload,
|
|
112
|
+
preload: poster?.preload,
|
|
112
113
|
lazy: setting.lazy ?? true,
|
|
113
114
|
isVideoComponent: true,
|
|
114
115
|
style: html5Style
|
|
@@ -129,7 +130,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
129
130
|
setting?.type,
|
|
130
131
|
setting?.lazy,
|
|
131
132
|
posterSrc,
|
|
132
|
-
preload,
|
|
133
|
+
poster?.preload,
|
|
133
134
|
vimeoStyle,
|
|
134
135
|
youtubeStyle,
|
|
135
136
|
html5Style
|
|
@@ -15,7 +15,7 @@ var LiteYouTubeEmbed_liquid = require('./LiteYouTubeEmbed.liquid.js');
|
|
|
15
15
|
var getSrcSet = require('../../image/helpers/getSrcSet.js');
|
|
16
16
|
|
|
17
17
|
const Video = ({ className, setting, style, builderAttrs, builderProps, advanced })=>{
|
|
18
|
-
const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster,
|
|
18
|
+
const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, startTime, endTime } = setting ?? {};
|
|
19
19
|
const posterSrc = getSrcSet.getImageSrc(poster);
|
|
20
20
|
const { cssClass: advancedCssClass } = advanced ?? {};
|
|
21
21
|
const isInstantLP = false;
|
|
@@ -61,7 +61,6 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
61
61
|
if (endTime) {
|
|
62
62
|
params += `&end=${common.parseTimeVideo(endTime)}`;
|
|
63
63
|
}
|
|
64
|
-
console.log('autoplay', autoplay);
|
|
65
64
|
return LiteYouTubeEmbed_liquid.default({
|
|
66
65
|
uid: builderProps?.uid,
|
|
67
66
|
id: videoId,
|
|
@@ -74,7 +73,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
74
73
|
muted: !mute,
|
|
75
74
|
thumbnail: posterSrc,
|
|
76
75
|
lazy: setting.lazy ?? true,
|
|
77
|
-
preload:
|
|
76
|
+
preload: poster?.preload,
|
|
78
77
|
style: youtubeStyle
|
|
79
78
|
});
|
|
80
79
|
}
|
|
@@ -87,11 +86,13 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
87
86
|
loop: loopVideo,
|
|
88
87
|
controls,
|
|
89
88
|
thumbnail: posterSrc,
|
|
89
|
+
thumbnailLink: poster?.src,
|
|
90
90
|
autoplay: autoplay,
|
|
91
91
|
lazy: setting.lazy ?? true,
|
|
92
92
|
id: videoId,
|
|
93
93
|
title: 'Video',
|
|
94
94
|
aspectRatio: aspectRatio,
|
|
95
|
+
preload: poster?.preload,
|
|
95
96
|
vimeoStyleIframe: vimeoStyle
|
|
96
97
|
});
|
|
97
98
|
}
|
|
@@ -107,7 +108,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
107
108
|
src: html5Url,
|
|
108
109
|
thumbnail: posterSrc,
|
|
109
110
|
title: 'Video',
|
|
110
|
-
preload,
|
|
111
|
+
preload: poster?.preload,
|
|
111
112
|
lazy: setting.lazy ?? true,
|
|
112
113
|
isVideoComponent: true,
|
|
113
114
|
style: html5Style
|
|
@@ -78,7 +78,7 @@ const getImageVimeoClasses = ()=>{
|
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
80
|
const getButtonVimeoClasses = ()=>{
|
|
81
|
-
const classList = `gp-absolute gp-left-1/2 gp-top-1/2 gp-flex gp-aspect-[56/32] gp-w-14 -gp-translate-x-1/2 -gp-translate-y-1/2 gp-items-center gp-justify-center gp-rounded gp-bg-black/80 gp-transition-colors hover:gp-bg-[#ef0800] gp-z-10 gp-lite-vimeo-embed-button
|
|
81
|
+
const classList = `gp-absolute gp-left-1/2 gp-top-1/2 gp-flex gp-aspect-[56/32] gp-w-14 -gp-translate-x-1/2 -gp-translate-y-1/2 gp-items-center gp-justify-center gp-rounded gp-bg-black/80 gp-transition-colors hover:gp-bg-[#ef0800] gp-z-10 gp-lite-vimeo-embed-button`;
|
|
82
82
|
return {
|
|
83
83
|
...composeClasses(classList)
|
|
84
84
|
};
|
|
@@ -25,7 +25,7 @@ const listSourceVideoSupport = [
|
|
|
25
25
|
'.mov'
|
|
26
26
|
];
|
|
27
27
|
const getYoutubeParams = (props)=>{
|
|
28
|
-
const { id, poster, params, muted, webp, controls, adNetwork, autoplay } = props;
|
|
28
|
+
const { id, poster, params, muted, webp, controls, adNetwork, autoplay, lazy } = props;
|
|
29
29
|
const videoId = encodeURIComponent(id);
|
|
30
30
|
const posterImp = poster || 'hqdefault';
|
|
31
31
|
const paramsImp = `${params}` || '';
|
|
@@ -34,7 +34,7 @@ const getYoutubeParams = (props)=>{
|
|
|
34
34
|
const vi = webp ? 'vi_webp' : 'vi';
|
|
35
35
|
const posterUrl = props.thumbnail || `https://i.ytimg.com/${vi}/${videoId}/${posterImp}.${format}`;
|
|
36
36
|
const ytUrl = props.noCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com';
|
|
37
|
-
const iframeSrc = `${ytUrl}/embed/${videoId}?autoplay=${autoplay}&state=1${mutedImp}${paramsImp}&controls=${controls ? 1 : 0}`;
|
|
37
|
+
const iframeSrc = `${ytUrl}/embed/${videoId}?autoplay=${lazy ? true : autoplay}&state=1${mutedImp}${paramsImp}&controls=${controls ? 1 : 0}`;
|
|
38
38
|
const adNetworkImp = adNetwork || false;
|
|
39
39
|
return {
|
|
40
40
|
videoId,
|
|
@@ -12,7 +12,7 @@ import { getInsertLinkData } from './common/helpers.js';
|
|
|
12
12
|
|
|
13
13
|
const Button = (props)=>{
|
|
14
14
|
const { advanced, className, nodePrice, customAttrs, styles = {}, setting = {}, builderProps, wrapClassName = '' } = props;
|
|
15
|
-
const { iconSvg,
|
|
15
|
+
const { iconSvg, btnLink, htmlType, disabled, enableBtnLink, shouldClearSpace, disabledLoading = true } = setting;
|
|
16
16
|
const { enableTextStyle = true } = styles;
|
|
17
17
|
const { customCss, wrapStyle, restStyle, dataState, dataIdAttr, isShowIcon, isScrollToElement, getArialLabel, getLabelToDisplay, checkIsShowLabel, checkIsEditableLabel } = getData(props);
|
|
18
18
|
const { HTMLTag: ButtonWrapper, urlData, shouldRenderLink } = getInsertLinkData({
|
|
@@ -99,7 +99,7 @@ const Button = (props)=>{
|
|
|
99
99
|
style="${buttonStyles}"
|
|
100
100
|
class="${buttonClasses}"
|
|
101
101
|
>
|
|
102
|
-
${If(
|
|
102
|
+
${If(!disabledLoading, ButtonLoadingIndicator(), '')}
|
|
103
103
|
<div class="${buttonContentWrapperClasses}">
|
|
104
104
|
${If(isShowIcon, ButtonIcon({
|
|
105
105
|
iconSvg: iconSvg ?? '',
|
|
@@ -20,15 +20,15 @@ const CountdownSettings = [
|
|
|
20
20
|
default: 'evergreen',
|
|
21
21
|
options: [
|
|
22
22
|
{
|
|
23
|
-
label: '
|
|
23
|
+
label: 'End at',
|
|
24
24
|
value: 'standard'
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
label: '
|
|
27
|
+
label: 'Auto-renew',
|
|
28
28
|
value: 'daily'
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
label: '
|
|
31
|
+
label: 'Manual',
|
|
32
32
|
value: 'evergreen'
|
|
33
33
|
}
|
|
34
34
|
]
|
|
@@ -6,7 +6,7 @@ const SettingUIV2 = [
|
|
|
6
6
|
controls: [
|
|
7
7
|
{
|
|
8
8
|
label: {
|
|
9
|
-
en: '
|
|
9
|
+
en: 'Type'
|
|
10
10
|
},
|
|
11
11
|
setting: {
|
|
12
12
|
id: 'behaviour'
|
|
@@ -252,6 +252,7 @@ const SettingUIV2 = [
|
|
|
252
252
|
iconName: 'polaris-text-title',
|
|
253
253
|
getValueFromSettingID: 'numTypo.type',
|
|
254
254
|
isHideClear: true,
|
|
255
|
+
isTypoValue: true,
|
|
255
256
|
controls: [
|
|
256
257
|
{
|
|
257
258
|
setting: {
|
|
@@ -289,6 +290,7 @@ const SettingUIV2 = [
|
|
|
289
290
|
iconName: 'polaris-text-title',
|
|
290
291
|
isHideClear: true,
|
|
291
292
|
getValueFromSettingID: 'labelTypo.type',
|
|
293
|
+
isTypoValue: true,
|
|
292
294
|
controls: [
|
|
293
295
|
{
|
|
294
296
|
setting: {
|
|
@@ -7,13 +7,13 @@ import { getVimeoParams } from './common/index.js';
|
|
|
7
7
|
import NextImage from '../../image/components/NextImage.liquid.js';
|
|
8
8
|
|
|
9
9
|
const LiteVimeoEmbed = (props)=>{
|
|
10
|
-
const { title, id, lazy, aspectRatio, autoplay, muted } = props;
|
|
10
|
+
const { title, id, lazy, aspectRatio, autoplay, muted, preload, thumbnailLink } = props;
|
|
11
11
|
const { iframeSrc } = getVimeoParams(props);
|
|
12
12
|
const iframe = !lazy;
|
|
13
13
|
const posterUrl = props.thumbnail;
|
|
14
14
|
const stateVimeo = createStateOrContext({
|
|
15
15
|
id,
|
|
16
|
-
thumbnail:
|
|
16
|
+
thumbnail: thumbnailLink,
|
|
17
17
|
lazy,
|
|
18
18
|
iframeSrc,
|
|
19
19
|
title,
|
|
@@ -47,12 +47,14 @@ const LiteVimeoEmbed = (props)=>{
|
|
|
47
47
|
data-title="${title}"
|
|
48
48
|
style="${articleVimeoStyle}"
|
|
49
49
|
>
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
${If(!iframe, template`
|
|
51
|
+
${NextImage({
|
|
52
52
|
src: posterUrl,
|
|
53
53
|
alt: title,
|
|
54
|
-
className: imageVimeoClasses
|
|
55
|
-
|
|
54
|
+
className: imageVimeoClasses,
|
|
55
|
+
enableLazyLoadImage: true,
|
|
56
|
+
priority: preload
|
|
57
|
+
})}`)}
|
|
56
58
|
${If(!iframe, template`
|
|
57
59
|
<button type="button" class="${buttonVimeoClasses}" aria-label="Play">
|
|
58
60
|
<svg class="gp-w-5 gp-text-white" viewBox="0 0 24 24">
|
|
@@ -15,7 +15,7 @@ const LiteVimeoEmbed = dynamic(()=>import('./LiteVimeoEmbed.js'));
|
|
|
15
15
|
const LiteYouTubeEmbed = dynamic(()=>import('./LiteYouTubeEmbed.js'));
|
|
16
16
|
const Video = ({ className, setting, style, builderAttrs, builderProps, advanced, children })=>{
|
|
17
17
|
const mode = useEditorMode();
|
|
18
|
-
const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster,
|
|
18
|
+
const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, startTime, endTime } = setting ?? {};
|
|
19
19
|
const { cssClass: advancedCssClass } = advanced ?? {};
|
|
20
20
|
const posterSrc = poster?.src;
|
|
21
21
|
const isInstantLP = mode !== 'edit';
|
|
@@ -72,7 +72,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
72
72
|
muted: !mute,
|
|
73
73
|
thumbnail: posterSrc,
|
|
74
74
|
lazy: setting.lazy ?? true,
|
|
75
|
-
preload: preload,
|
|
75
|
+
preload: poster?.preload,
|
|
76
76
|
style: youtubeStyle
|
|
77
77
|
});
|
|
78
78
|
}
|
|
@@ -90,6 +90,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
90
90
|
id: videoId,
|
|
91
91
|
title: "Video",
|
|
92
92
|
aspectRatio: aspectRatio,
|
|
93
|
+
preload: poster?.preload,
|
|
93
94
|
vimeoStyleIframe: vimeoStyle
|
|
94
95
|
});
|
|
95
96
|
}
|
|
@@ -104,7 +105,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
104
105
|
src: html5Url,
|
|
105
106
|
thumbnail: posterSrc,
|
|
106
107
|
title: "Video",
|
|
107
|
-
preload: preload,
|
|
108
|
+
preload: poster?.preload,
|
|
108
109
|
lazy: setting.lazy ?? true,
|
|
109
110
|
isVideoComponent: true,
|
|
110
111
|
style: html5Style
|
|
@@ -125,7 +126,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
125
126
|
setting?.type,
|
|
126
127
|
setting?.lazy,
|
|
127
128
|
posterSrc,
|
|
128
|
-
preload,
|
|
129
|
+
poster?.preload,
|
|
129
130
|
vimeoStyle,
|
|
130
131
|
youtubeStyle,
|
|
131
132
|
html5Style
|
|
@@ -11,7 +11,7 @@ import LiteYouTubeEmbed from './LiteYouTubeEmbed.liquid.js';
|
|
|
11
11
|
import { getImageSrc } from '../../image/helpers/getSrcSet.js';
|
|
12
12
|
|
|
13
13
|
const Video = ({ className, setting, style, builderAttrs, builderProps, advanced })=>{
|
|
14
|
-
const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster,
|
|
14
|
+
const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, startTime, endTime } = setting ?? {};
|
|
15
15
|
const posterSrc = getImageSrc(poster);
|
|
16
16
|
const { cssClass: advancedCssClass } = advanced ?? {};
|
|
17
17
|
const isInstantLP = false;
|
|
@@ -57,7 +57,6 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
57
57
|
if (endTime) {
|
|
58
58
|
params += `&end=${parseTimeVideo(endTime)}`;
|
|
59
59
|
}
|
|
60
|
-
console.log('autoplay', autoplay);
|
|
61
60
|
return LiteYouTubeEmbed({
|
|
62
61
|
uid: builderProps?.uid,
|
|
63
62
|
id: videoId,
|
|
@@ -70,7 +69,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
70
69
|
muted: !mute,
|
|
71
70
|
thumbnail: posterSrc,
|
|
72
71
|
lazy: setting.lazy ?? true,
|
|
73
|
-
preload:
|
|
72
|
+
preload: poster?.preload,
|
|
74
73
|
style: youtubeStyle
|
|
75
74
|
});
|
|
76
75
|
}
|
|
@@ -83,11 +82,13 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
83
82
|
loop: loopVideo,
|
|
84
83
|
controls,
|
|
85
84
|
thumbnail: posterSrc,
|
|
85
|
+
thumbnailLink: poster?.src,
|
|
86
86
|
autoplay: autoplay,
|
|
87
87
|
lazy: setting.lazy ?? true,
|
|
88
88
|
id: videoId,
|
|
89
89
|
title: 'Video',
|
|
90
90
|
aspectRatio: aspectRatio,
|
|
91
|
+
preload: poster?.preload,
|
|
91
92
|
vimeoStyleIframe: vimeoStyle
|
|
92
93
|
});
|
|
93
94
|
}
|
|
@@ -103,7 +104,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
|
|
|
103
104
|
src: html5Url,
|
|
104
105
|
thumbnail: posterSrc,
|
|
105
106
|
title: 'Video',
|
|
106
|
-
preload,
|
|
107
|
+
preload: poster?.preload,
|
|
107
108
|
lazy: setting.lazy ?? true,
|
|
108
109
|
isVideoComponent: true,
|
|
109
110
|
style: html5Style
|
|
@@ -76,7 +76,7 @@ const getImageVimeoClasses = ()=>{
|
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
78
|
const getButtonVimeoClasses = ()=>{
|
|
79
|
-
const classList = `gp-absolute gp-left-1/2 gp-top-1/2 gp-flex gp-aspect-[56/32] gp-w-14 -gp-translate-x-1/2 -gp-translate-y-1/2 gp-items-center gp-justify-center gp-rounded gp-bg-black/80 gp-transition-colors hover:gp-bg-[#ef0800] gp-z-10 gp-lite-vimeo-embed-button
|
|
79
|
+
const classList = `gp-absolute gp-left-1/2 gp-top-1/2 gp-flex gp-aspect-[56/32] gp-w-14 -gp-translate-x-1/2 -gp-translate-y-1/2 gp-items-center gp-justify-center gp-rounded gp-bg-black/80 gp-transition-colors hover:gp-bg-[#ef0800] gp-z-10 gp-lite-vimeo-embed-button`;
|
|
80
80
|
return {
|
|
81
81
|
...composeClasses(classList)
|
|
82
82
|
};
|
|
@@ -23,7 +23,7 @@ const listSourceVideoSupport = [
|
|
|
23
23
|
'.mov'
|
|
24
24
|
];
|
|
25
25
|
const getYoutubeParams = (props)=>{
|
|
26
|
-
const { id, poster, params, muted, webp, controls, adNetwork, autoplay } = props;
|
|
26
|
+
const { id, poster, params, muted, webp, controls, adNetwork, autoplay, lazy } = props;
|
|
27
27
|
const videoId = encodeURIComponent(id);
|
|
28
28
|
const posterImp = poster || 'hqdefault';
|
|
29
29
|
const paramsImp = `${params}` || '';
|
|
@@ -32,7 +32,7 @@ const getYoutubeParams = (props)=>{
|
|
|
32
32
|
const vi = webp ? 'vi_webp' : 'vi';
|
|
33
33
|
const posterUrl = props.thumbnail || `https://i.ytimg.com/${vi}/${videoId}/${posterImp}.${format}`;
|
|
34
34
|
const ytUrl = props.noCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com';
|
|
35
|
-
const iframeSrc = `${ytUrl}/embed/${videoId}?autoplay=${autoplay}&state=1${mutedImp}${paramsImp}&controls=${controls ? 1 : 0}`;
|
|
35
|
+
const iframeSrc = `${ytUrl}/embed/${videoId}?autoplay=${lazy ? true : autoplay}&state=1${mutedImp}${paramsImp}&controls=${controls ? 1 : 0}`;
|
|
36
36
|
const adNetworkImp = adNetwork || false;
|
|
37
37
|
return {
|
|
38
38
|
videoId,
|
package/dist/types/index.d.ts
CHANGED