@gem-sdk/components 2.0.0-dev.627 → 2.0.0-dev.628
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/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/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
|
@@ -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,
|
|
@@ -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