@comet/site-nextjs 9.0.0-beta.4 → 9.0.0-beta.5
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,4 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,Fragment as a,jsxs as i}from"react/jsx-runtime";import o from"clsx";import{useState as r,useCallback as
|
|
3
|
-
/* @__PURE__ */i("video",{autoPlay:c
|
|
4
|
-
/* @__PURE__ */e("source",{src:
|
|
2
|
+
import{jsx as e,Fragment as a,jsxs as i}from"react/jsx-runtime";import o from"clsx";import{useState as r,useCallback as l}from"react";import{withPreview as t}from"../iframebridge/withPreview.js";import{PreviewSkeleton as s}from"../previewskeleton/PreviewSkeleton.js";import n from"./DamVideoBlock.module.scss.js";import{PlayPauseButton as p}from"./helpers/PlayPauseButton.js";import{useIsElementInViewport as m}from"./helpers/useIsElementInViewport.js";const c=t(({data:{damFile:t,autoplay:c,loop:u,showControls:d,previewImage:y},aspectRatio:f="16x9",previewImageSizes:P,renderPreviewImage:v,fill:w,previewImageIcon:g,playButtonAriaLabel:I,pauseButtonAriaLabel:h,playPauseButton:k})=>{if(void 0===t)return e(s,{type:"media",hasContent:!1,aspectRatio:f});const[B,b]=r(!0),[j,L]=r(c??!1),[x,V]=r(!1),C=Boolean(y&&y.damFile),[A,R]=r(null),S=l(e=>{R(e),e&&C&&!B&&e.paused&&e.play()},[C,B]),z=l(e=>{!x&&A&&(e&&c?(A.play(),L(!0)):(A.pause(),L(!1)))},[c,x,A]);m({current:A},z);const D=()=>{j?(L(!1),V(!0),A?.pause()):(L(!0),A?.play())};return e(a,{children:C&&B?v({onPlay:()=>{b(!1),L(!0),V(!0)},image:y,aspectRatio:f,sizes:P,fill:w,icon:g,playButtonAriaLabel:I}):/* @__PURE__ */i("div",{className:n.root,children:[
|
|
3
|
+
/* @__PURE__ */i("video",{autoPlay:c,controls:d,loop:u,playsInline:!0,muted:c,ref:S,className:o(n.video,w&&n.fill),style:w?void 0:{"--aspect-ratio":f.replace("x"," / ")},children:[t.captions?.map(a=>/* @__PURE__ */e("track",{src:a.fileUrl,kind:"captions",srcLang:a.language},a.id)),
|
|
4
|
+
/* @__PURE__ */e("source",{src:t.fileUrl,type:t.mimetype})]}),!d&&(k?/* @__PURE__ */e(k,{isPlaying:j,onClick:D}):/* @__PURE__ */e(p,{isPlaying:j,onClick:D,ariaLabelPlay:I,ariaLabelPause:h}))]})})},{label:"Video"});export{c as DamVideoBlock};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import a from"clsx";import{useState as i,useRef as r,useCallback as s}from"react";import{withPreview as n}from"../iframebridge/withPreview.js";import{PreviewSkeleton as l}from"../previewskeleton/PreviewSkeleton.js";import{PlayPauseButton as p}from"./helpers/PlayPauseButton.js";import{useIsElementInViewport as m}from"./helpers/useIsElementInViewport.js";import c from"./VimeoVideoBlock.module.scss.js";const d=n(({data:{vimeoIdentifier:n,autoplay:d,loop:u,showControls:w,previewImage:v},aspectRatio:
|
|
3
|
-
/* @__PURE__ */e("iframe",{ref:N,className:c.vimeoContainer,src:O.toString(),allow:"autoplay",allowFullScreen:!0}),!w&&(b?/* @__PURE__ */e(b,{isPlaying:x,onClick:U}):/* @__PURE__ */e(p,{isPlaying:x,onClick:U,ariaLabelPlay:S,ariaLabelPause:I}))]})})},{label:"Video"});export{d as VimeoVideoBlock};
|
|
2
|
+
import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import a from"clsx";import{useState as i,useRef as r,useCallback as s}from"react";import{withPreview as n}from"../iframebridge/withPreview.js";import{PreviewSkeleton as l}from"../previewskeleton/PreviewSkeleton.js";import{PlayPauseButton as p}from"./helpers/PlayPauseButton.js";import{useIsElementInViewport as m}from"./helpers/useIsElementInViewport.js";import c from"./VimeoVideoBlock.module.scss.js";const d=n(({data:{vimeoIdentifier:n,autoplay:d,loop:u,showControls:w,previewImage:v},aspectRatio:y="16x9",previewImageSizes:f,renderPreviewImage:h,fill:g,previewImageIcon:P,playButtonAriaLabel:S,pauseButtonAriaLabel:I,playPauseButton:b})=>{const[B,k]=i(!0),L=!(!v||!v.damFile),V=r(null),[j,C]=i(null),N=C,[x,R]=i(d??!1),[z,A]=i(!1),$=s(()=>{j?.contentWindow?.postMessage(JSON.stringify({method:"pause"}),"https://player.vimeo.com")},[j]),E=s(()=>{j?.contentWindow?.postMessage(JSON.stringify({method:"play"}),"https://player.vimeo.com")},[j]),F=s(e=>{z||(e&&d?(E(),R(!0)):($(),R(!1)))},[d,z,E,$]);if(m(V,F),!n)return e(l,{type:"media",hasContent:!1,aspectRatio:y});const J=function(e){const o=e.match(/^(https?:\/\/)?((www\.|player\.)?vimeo\.com\/?(showcase\/)*([0-9a-z]*\/)*([0-9]{6,11})[?]?.*)$/),t=e.match(/^([0-9]{6,11})$/);if(o||t)return o?o[6]:t?t[1]:void 0}(n),M=new URLSearchParams;(d||L&&!B)&&M.append("autoplay","1"),d&&M.append("muted","1"),void 0!==u&&M.append("loop",Number(u).toString()),void 0!==w&&M.append("controls",Number(w).toString()),M.append("dnt","1");const O=new URL(`https://player.vimeo.com/video/${J??""}`);O.search=M.toString();const U=()=>{x?(R(!1),A(!0),$()):(R(!0),E())};return e(o,{children:L&&B?h({onPlay:()=>{k(!1),R(!0),A(!0)},image:v,aspectRatio:y,sizes:f,fill:g,icon:P,playButtonAriaLabel:S}):/* @__PURE__ */t("div",{ref:V,className:a(c.videoContainer,g&&c.fill),style:g?void 0:{"--aspect-ratio":y.replace("x","/")},children:[
|
|
3
|
+
/* @__PURE__ */e("iframe",{ref:N,className:c.vimeoContainer,src:O.toString(),allow:"autoplay",allowFullScreen:!0,loading:"lazy"}),!w&&(b?/* @__PURE__ */e(b,{isPlaying:x,onClick:U}):/* @__PURE__ */e(p,{isPlaying:x,onClick:U,ariaLabelPlay:S,ariaLabelPause:I}))]})})},{label:"Video"});export{d as VimeoVideoBlock};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import a from"clsx";import{useState as i,useRef as n,useCallback as r}from"react";import{withPreview as s}from"../iframebridge/withPreview.js";import{PreviewSkeleton as l}from"../previewskeleton/PreviewSkeleton.js";import{PlayPauseButton as p}from"./helpers/PlayPauseButton.js";import{useIsElementInViewport as u}from"./helpers/useIsElementInViewport.js";import m from"./YouTubeVideoBlock.module.scss.js";const c=s(({data:{youtubeIdentifier:s,autoplay:c,loop:d,showControls:w,previewImage:y},aspectRatio:b="16x9",previewImageSizes:g,renderPreviewImage:v,fill:f,previewImageIcon:h,playButtonAriaLabel:P,pauseButtonAriaLabel:k,playPauseButton:I})=>{const[B,S]=i(!0),[j,L]=i(c??!1),[V,C]=i(!1),x=!(!y||!y.damFile),[R,A]=i(null),N=A,z=n(null),E=r(()=>{R?.contentWindow?.postMessage('{"event":"command","func":"pauseVideo","args":""}',"https://www.youtube-nocookie.com")},[R]),M=r(()=>{R?.contentWindow?.postMessage('{"event":"command","func":"playVideo","args":""}',"https://www.youtube-nocookie.com")},[R]),T=r(e=>{V||(e&&c?(M(),L(!0)):(E(),L(!1)))},[c,V,M,E]);if(u(z,T),!s)return e(l,{type:"media",hasContent:!1,aspectRatio:b});const U=(e=>{const o=e.match(/(https?:\/\/)?(((m|www)\.)?(youtube(-nocookie)?|youtube.googleapis)\.com.*(v\/|v=|vi=|vi\/|e\/|embed\/|user\/.*\/u\/\d+\/)|youtu\.be\/)([_0-9a-zA-Z-]+)/);return(11===e.length?e:o&&11===o[8].length?o[8]:null)??void 0})(s),W=new URLSearchParams;W.append("modestbranding","1"),W.append("rel","0"),W.append("enablejsapi","1"),x&&!B&&W.append("autoplay","1"),c&&W.append("mute","1"),void 0!==w&&W.append("controls",Number(w).toString()),void 0!==d&&W.append("loop",Number(d).toString()),d&&U&&W.append("playlist",U);const Y=new URL(`https://www.youtube-nocookie.com/embed/${U??""}`);Y.search=W.toString();const F=()=>{j?(L(!1),C(!0),E()):(L(!0),M())};return e(o,{children:x&&B?v({onPlay:()=>S(!1),image:y,aspectRatio:b,sizes:g,fill:f,icon:h,playButtonAriaLabel:P}):/* @__PURE__ */t("div",{ref:z,className:a(m.videoContainer,f&&m.fill),style:f?void 0:{"--aspect-ratio":b.replace("x","/")},children:[!w&&(I?/* @__PURE__ */e(I,{isPlaying:j,onClick:F}):/* @__PURE__ */e(p,{isPlaying:j,onClick:F,ariaLabelPlay:P,ariaLabelPause:k})),
|
|
2
|
+
import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import a from"clsx";import{useState as i,useRef as n,useCallback as r}from"react";import{withPreview as s}from"../iframebridge/withPreview.js";import{PreviewSkeleton as l}from"../previewskeleton/PreviewSkeleton.js";import{PlayPauseButton as p}from"./helpers/PlayPauseButton.js";import{useIsElementInViewport as u}from"./helpers/useIsElementInViewport.js";import m from"./YouTubeVideoBlock.module.scss.js";const c=s(({data:{youtubeIdentifier:s,autoplay:c,loop:d,showControls:w,previewImage:y},aspectRatio:b="16x9",previewImageSizes:g,renderPreviewImage:v,fill:f,previewImageIcon:h,playButtonAriaLabel:P,pauseButtonAriaLabel:k,playPauseButton:I})=>{const[B,S]=i(!0),[j,L]=i(c??!1),[V,C]=i(!1),x=!(!y||!y.damFile),[R,A]=i(null),N=A,z=n(null),E=r(()=>{R?.contentWindow?.postMessage('{"event":"command","func":"pauseVideo","args":""}',"https://www.youtube-nocookie.com")},[R]),M=r(()=>{R?.contentWindow?.postMessage('{"event":"command","func":"playVideo","args":""}',"https://www.youtube-nocookie.com")},[R]),T=r(e=>{V||(e&&c?(M(),L(!0)):(E(),L(!1)))},[c,V,M,E]);if(u(z,T),!s)return e(l,{type:"media",hasContent:!1,aspectRatio:b});const U=(e=>{const o=e.match(/(https?:\/\/)?(((m|www)\.)?(youtube(-nocookie)?|youtube.googleapis)\.com.*(v\/|v=|vi=|vi\/|e\/|embed\/|user\/.*\/u\/\d+\/)|youtu\.be\/)([_0-9a-zA-Z-]+)/);return(11===e.length?e:o&&11===o[8].length?o[8]:null)??void 0})(s),W=new URLSearchParams;W.append("modestbranding","1"),W.append("rel","0"),W.append("enablejsapi","1"),x&&!B&&W.append("autoplay","1"),c&&W.append("mute","1"),void 0!==w&&W.append("controls",Number(w).toString()),void 0!==d&&W.append("loop",Number(d).toString()),d&&U&&W.append("playlist",U);const Y=new URL(`https://www.youtube-nocookie.com/embed/${U??""}`);Y.search=W.toString();const F=()=>{j?(L(!1),C(!0),E()):(L(!0),M())};return e(o,{children:x&&B?v({onPlay:()=>{S(!1),L(!0),C(!0)},image:y,aspectRatio:b,sizes:g,fill:f,icon:h,playButtonAriaLabel:P}):/* @__PURE__ */t("div",{ref:z,className:a(m.videoContainer,f&&m.fill),style:f?void 0:{"--aspect-ratio":b.replace("x","/")},children:[!w&&(I?/* @__PURE__ */e(I,{isPlaying:j,onClick:F}):/* @__PURE__ */e(p,{isPlaying:j,onClick:F,ariaLabelPlay:P,ariaLabelPause:k})),
|
|
3
3
|
/* @__PURE__ */e("iframe",{ref:N,className:m.youtubeContainer,allow:"autoplay",referrerPolicy:"strict-origin-when-cross-origin",src:Y.toString()})]})})},{label:"Video"});export{c as YouTubeVideoBlock};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/site-nextjs",
|
|
3
|
-
"version": "9.0.0-beta.
|
|
3
|
+
"version": "9.0.0-beta.5",
|
|
4
4
|
"description": "Comet Site Next.js package",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"jose": "^5.10.0",
|
|
32
32
|
"server-only": "^0.0.1",
|
|
33
|
-
"@comet/site-react": "9.0.0-beta.
|
|
33
|
+
"@comet/site-react": "9.0.0-beta.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/react": "^19.2.
|
|
36
|
+
"@types/react": "^19.2.15",
|
|
37
37
|
"@types/react-dom": "^19.2.3",
|
|
38
38
|
"@vitejs/plugin-react": "^4.7.0",
|
|
39
39
|
"chokidar-cli": "^3.0.0",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"vite": "^7.2.4",
|
|
53
53
|
"vite-plugin-dts": "^4.5.4",
|
|
54
54
|
"vitest": "^4.0.16",
|
|
55
|
-
"@comet/cli": "9.0.0-beta.
|
|
56
|
-
"@comet/eslint-config": "9.0.0-beta.
|
|
55
|
+
"@comet/cli": "9.0.0-beta.5",
|
|
56
|
+
"@comet/eslint-config": "9.0.0-beta.5"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"next": "^16.0.0",
|