@gem-sdk/components 4.1.7 → 4.1.8
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),NextImage=require("../../image/components/NextImage.js"),useLiteHtml5Embed=require("../hooks/useLiteHtml5Embed.js"),helpers=require("../common/helpers.js"),system=require("@gem-sdk/system"),classes=require("../common/classes.js"),styles=require("../common/styles.js"),attrs=require("../common/attrs.js");const HTML5Embed=e=>{let s=core.useEditorMode(),t="edit"!==s,{thumbnail:l,muted:r,autoplay:a,loop:i,controls:m,src:o,style:u,title:c,className:n,lazy:d,poster:x}=e,{playVideoAndTurnOffThumbnail:j,videoRef:y,showThumbnail:p}=useLiteHtml5Embed.useLiteHtml5Embed(a,r,o),g=!t&&a&&r&&!!l,b=!d&&e.isVideoComponent&&t,h=helpers.listSourceVideoSupport.some(e=>o?.endsWith(e)),C=!l||!p,R=b&&!t?o:void 0,
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),NextImage=require("../../image/components/NextImage.js"),useLiteHtml5Embed=require("../hooks/useLiteHtml5Embed.js"),helpers=require("../common/helpers.js"),system=require("@gem-sdk/system"),classes=require("../common/classes.js"),styles=require("../common/styles.js"),attrs=require("../common/attrs.js");const HTML5Embed=e=>{let s=core.useEditorMode(),t="edit"!==s,{thumbnail:l,muted:r,autoplay:a,loop:i,controls:m,src:o,style:u,title:c,className:n,lazy:d,poster:x}=e,{playVideoAndTurnOffThumbnail:j,videoRef:y,showThumbnail:p}=useLiteHtml5Embed.useLiteHtml5Embed(a,r,o),g=!t&&a&&r&&!!l,b=!d&&e.isVideoComponent&&t,h=helpers.listSourceVideoSupport.some(e=>o?.endsWith(e)),C=!l||!p,R=b&&!t?o:void 0,v=system.createAttr({...attrs.getHtml5Attr({title:c,autoplay:a,preloadThumbnail:g,offLazyLoad:b,src:o,thumbnail:l})}),q=system.createClass({...classes.getWrapThumbnailClasses(C)}),L=system.createStyle({...styles.getPreloadImageStyle()}),N=system.createClass({...classes.getButtonThumbnailClasses()}),I=system.createClass({...classes.getImageThumbnailClasses()}),E=system.createClass({...classes.getVideoYoutubeClasses(n,b)}),H=()=>g?jsxRuntime.jsx(NextImage.default,{src:l,alt:c,priority:!0,style:L}):"",T=()=>jsxRuntime.jsxs("div",{role:"presentation",style:u,className:q,onClick:j,children:[jsxRuntime.jsx(NextImage.default,{id:"video-thumbnail",src:l??"",alt:x?.altText,title:x?.imageTitle,priority:x?.preload&&t,className:I,isDisableAspectStyle:!0,enableLazyLoadImage:!0}),jsxRuntime.jsx("button",{type:"button",className:N,"aria-label":"Play",children:jsxRuntime.jsx("svg",{className:"gp-w-5 gp-text-white",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{fill:"currentColor",d:"M5 5.274c0-1.707 1.826-2.792 3.325-1.977l12.362 6.726c1.566.853 1.566 3.101 0 3.953L8.325 20.702C6.826 21.518 5 20.432 5 18.726V5.274Z"})})})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[H(),jsxRuntime.jsx("video",{ref:y,...v,style:u,className:E,controls:m,loop:i,muted:r,autoPlay:a,playsInline:!0,src:h?void 0:R,children:h&&jsxRuntime.jsx("source",{"data-src":o,src:o,type:"video/mp4"})}),!C&&T()]})};exports.default=HTML5Embed;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsxs as e,Fragment as
|
|
2
|
+
import{jsxs as e,Fragment as o,jsx as t}from"react/jsx-runtime";import{useEditorMode as s}from"@gem-sdk/core";import r from"../../image/components/NextImage.js";import{useLiteHtml5Embed as m}from"../hooks/useLiteHtml5Embed.js";import{listSourceVideoSupport as i}from"../common/helpers.js";import{createAttr as l,createClass as a,createStyle as c}from"@gem-sdk/system";import{getWrapThumbnailClasses as n,getButtonThumbnailClasses as d,getImageThumbnailClasses as p,getVideoYoutubeClasses as y}from"../common/classes.js";import{getPreloadImageStyle as f}from"../common/styles.js";import{getHtml5Attr as h}from"../common/attrs.js";let HTML5Embed=u=>{let b=s(),g="edit"!==b,{thumbnail:v,muted:j,autoplay:x,loop:L,controls:N,src:k,style:C,title:T,className:w,lazy:E,poster:H}=u,{playVideoAndTurnOffThumbnail:I,videoRef:M,showThumbnail:P}=m(x,j,k),V=!g&&x&&j&&!!v,z=!E&&u.isVideoComponent&&g,A=i.some(e=>k?.endsWith(e)),B=!v||!P,D=z&&!g?k:void 0,S=l({...h({title:T,autoplay:x,preloadThumbnail:V,offLazyLoad:z,src:k,thumbnail:v})}),W=a({...n(B)}),Z=c({...f()}),q=a({...d()}),F=a({...p()}),G=a({...y(w,z)}),J=()=>V?t(r,{src:v,alt:T,priority:!0,style:Z}):"",K=()=>e("div",{role:"presentation",style:C,className:W,onClick:I,children:[t(r,{id:"video-thumbnail",src:v??"",alt:H?.altText,title:H?.imageTitle,priority:H?.preload&&g,className:F,isDisableAspectStyle:!0,enableLazyLoadImage:!0}),t("button",{type:"button",className:q,"aria-label":"Play",children:t("svg",{className:"gp-w-5 gp-text-white",viewBox:"0 0 24 24",children:t("path",{fill:"currentColor",d:"M5 5.274c0-1.707 1.826-2.792 3.325-1.977l12.362 6.726c1.566.853 1.566 3.101 0 3.953L8.325 20.702C6.826 21.518 5 20.432 5 18.726V5.274Z"})})})]});return e(o,{children:[J(),t("video",{ref:M,...S,style:C,className:G,controls:N,loop:L,muted:j,autoPlay:x,playsInline:!0,src:A?void 0:D,children:A&&t("source",{"data-src":k,src:k,type:"video/mp4"})}),!B&&K()]})};export{HTML5Embed as default};
|
|
@@ -48,7 +48,7 @@ import{template as e,RenderIf as t,isLocalEnv as o,baseAssetURL as s}from"@gem-s
|
|
|
48
48
|
${h?"muted":void 0}
|
|
49
49
|
${L?"autoplay":void 0}
|
|
50
50
|
playsinline
|
|
51
|
-
src="${C}"
|
|
51
|
+
${V?void 0:`src="${C}"`}
|
|
52
52
|
>
|
|
53
53
|
${n(V,`<source data-src="${A}" src="${C}" type="video/mp4"></source>`)}
|
|
54
54
|
</video>
|