@comet/site-react 9.0.0-canary-20251209132220 → 9.0.0-canary-20251209140438

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,5 +1,6 @@
1
- import { ReactElement, ReactNode } from 'react';
1
+ import { ComponentType, ReactElement, ReactNode } from 'react';
2
2
  import { DamVideoBlockData } from '../blocks.generated';
3
+ import { PlayPauseButtonProps } from './helpers/PlayPauseButton';
3
4
  import { VideoPreviewImageProps } from './helpers/VideoPreviewImage';
4
5
  import { PropsWithData } from './PropsWithData';
5
6
  interface DamVideoBlockProps extends PropsWithData<DamVideoBlockData> {
@@ -9,6 +10,8 @@ interface DamVideoBlockProps extends PropsWithData<DamVideoBlockData> {
9
10
  fill?: boolean;
10
11
  previewImageIcon?: ReactNode;
11
12
  playButtonAriaLabel?: string;
13
+ pauseButtonAriaLabel?: string;
14
+ playPauseButton?: ComponentType<PlayPauseButtonProps>;
12
15
  }
13
16
  export declare const DamVideoBlock: ({ ...componentProps }: import('../iframebridge/withPreview').WithPreviewProps & DamVideoBlockProps) => import("react/jsx-runtime").JSX.Element;
14
17
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"DamVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/DamVideoBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,kBAAmB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC;IACpE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,eAAO,MAAM,aAAa,iJA8DzB,CAAC"}
1
+ {"version":3,"file":"DamVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/DamVideoBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAyB,MAAM,OAAO,CAAC;AAErG,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,kBAAmB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC;IACpE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,aAAa,iJAkGzB,CAAC"}
@@ -1,10 +1,11 @@
1
1
  "use client";
2
2
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
- import { useState, useRef } from "react";
4
+ import { useState, useCallback } from "react";
5
5
  import { withPreview } from "../iframebridge/withPreview.js";
6
6
  import { PreviewSkeleton } from "../previewskeleton/PreviewSkeleton.js";
7
7
  import styles from "./DamVideoBlock.module.scss.js";
8
+ import { PlayPauseButton } from "./helpers/PlayPauseButton.js";
8
9
  import { useIsElementInViewport } from "./helpers/useIsElementInViewport.js";
9
10
  const DamVideoBlock = withPreview(
10
11
  ({
@@ -14,24 +15,45 @@ const DamVideoBlock = withPreview(
14
15
  renderPreviewImage,
15
16
  fill,
16
17
  previewImageIcon,
17
- playButtonAriaLabel
18
+ playButtonAriaLabel,
19
+ pauseButtonAriaLabel,
20
+ playPauseButton: PlayPauseButtonComponent
18
21
  }) => {
19
22
  var _a;
20
23
  if (damFile === void 0) {
21
24
  return /* @__PURE__ */ jsx(PreviewSkeleton, { type: "media", hasContent: false, aspectRatio });
22
25
  }
23
26
  const [showPreviewImage, setShowPreviewImage] = useState(true);
27
+ const [isPlaying, setIsPlaying] = useState(autoplay ?? false);
28
+ const [isHandledManually, setIsHandledManually] = useState(false);
24
29
  const hasPreviewImage = Boolean(previewImage && previewImage.damFile);
25
- const videoRef = useRef(null);
26
- useIsElementInViewport(videoRef, (inView) => {
27
- if (autoplay && videoRef.current) {
28
- if (inView) {
29
- videoRef.current.play();
30
- } else {
31
- videoRef.current.pause();
30
+ const [videoElement, setVideoElement] = useState(null);
31
+ const videoRef = setVideoElement;
32
+ const handleInView = useCallback(
33
+ (inView) => {
34
+ if (!isHandledManually && videoElement) {
35
+ if (inView && autoplay) {
36
+ videoElement.play();
37
+ setIsPlaying(true);
38
+ } else {
39
+ videoElement.pause();
40
+ setIsPlaying(false);
41
+ }
32
42
  }
43
+ },
44
+ [autoplay, isHandledManually, videoElement]
45
+ );
46
+ useIsElementInViewport({ current: videoElement }, handleInView);
47
+ const handlePlayPauseClick = () => {
48
+ if (isPlaying) {
49
+ setIsPlaying(false);
50
+ setIsHandledManually(true);
51
+ videoElement == null ? void 0 : videoElement.pause();
52
+ } else {
53
+ setIsPlaying(true);
54
+ videoElement == null ? void 0 : videoElement.play();
33
55
  }
34
- });
56
+ };
35
57
  return /* @__PURE__ */ jsx(Fragment, { children: hasPreviewImage && showPreviewImage ? renderPreviewImage({
36
58
  onPlay: () => setShowPreviewImage(false),
37
59
  image: previewImage,
@@ -40,25 +62,36 @@ const DamVideoBlock = withPreview(
40
62
  fill,
41
63
  icon: previewImageIcon,
42
64
  playButtonAriaLabel
43
- }) : /* @__PURE__ */ jsxs(
44
- "video",
45
- {
46
- autoPlay: autoplay || hasPreviewImage && !showPreviewImage,
47
- controls: showControls,
48
- loop,
49
- playsInline: true,
50
- muted: autoplay,
51
- ref: videoRef,
52
- className: clsx(styles.video, fill && styles.fill),
53
- style: !fill ? { "--aspect-ratio": aspectRatio.replace("x", " / ") } : void 0,
54
- children: [
55
- (_a = damFile.captions) == null ? void 0 : _a.map((caption) => {
56
- return /* @__PURE__ */ jsx("track", { src: caption.fileUrl, kind: "captions", srcLang: caption.language }, caption.id);
57
- }),
58
- /* @__PURE__ */ jsx("source", { src: damFile.fileUrl, type: damFile.mimetype })
59
- ]
60
- }
61
- ) });
65
+ }) : /* @__PURE__ */ jsxs("div", { className: styles.root, children: [
66
+ /* @__PURE__ */ jsxs(
67
+ "video",
68
+ {
69
+ autoPlay: autoplay || hasPreviewImage && !showPreviewImage,
70
+ controls: showControls,
71
+ loop,
72
+ playsInline: true,
73
+ muted: autoplay,
74
+ ref: videoRef,
75
+ className: clsx(styles.video, fill && styles.fill),
76
+ style: !fill ? { "--aspect-ratio": aspectRatio.replace("x", " / ") } : void 0,
77
+ children: [
78
+ (_a = damFile.captions) == null ? void 0 : _a.map((caption) => {
79
+ return /* @__PURE__ */ jsx("track", { src: caption.fileUrl, kind: "captions", srcLang: caption.language }, caption.id);
80
+ }),
81
+ /* @__PURE__ */ jsx("source", { src: damFile.fileUrl, type: damFile.mimetype })
82
+ ]
83
+ }
84
+ ),
85
+ !showControls && (PlayPauseButtonComponent ? /* @__PURE__ */ jsx(PlayPauseButtonComponent, { isPlaying, onClick: handlePlayPauseClick }) : /* @__PURE__ */ jsx(
86
+ PlayPauseButton,
87
+ {
88
+ isPlaying,
89
+ onClick: handlePlayPauseClick,
90
+ ariaLabelPlay: playButtonAriaLabel,
91
+ ariaLabelPause: pauseButtonAriaLabel
92
+ }
93
+ ))
94
+ ] }) });
62
95
  },
63
96
  { label: "Video" }
64
97
  );
@@ -1,11 +1,14 @@
1
- const video = "_video_17b8y_1";
2
- const fill = "_fill_17b8y_7";
1
+ const root = "_root_8r6od_1";
2
+ const video = "_video_8r6od_5";
3
+ const fill = "_fill_8r6od_11";
3
4
  const styles = {
5
+ root,
4
6
  video,
5
7
  fill
6
8
  };
7
9
  export {
8
10
  styles as default,
9
11
  fill,
12
+ root,
10
13
  video
11
14
  };
@@ -1,5 +1,6 @@
1
- import { ReactElement, ReactNode } from 'react';
1
+ import { ComponentType, ReactElement, ReactNode } from 'react';
2
2
  import { VimeoVideoBlockData } from '../blocks.generated';
3
+ import { PlayPauseButtonProps } from './helpers/PlayPauseButton';
3
4
  import { VideoPreviewImageProps } from './helpers/VideoPreviewImage';
4
5
  import { PropsWithData } from './PropsWithData';
5
6
  interface VimeoVideoBlockProps extends PropsWithData<VimeoVideoBlockData> {
@@ -9,6 +10,8 @@ interface VimeoVideoBlockProps extends PropsWithData<VimeoVideoBlockData> {
9
10
  fill?: boolean;
10
11
  previewImageIcon?: ReactNode;
11
12
  playButtonAriaLabel?: string;
13
+ pauseButtonAriaLabel?: string;
14
+ playPauseButton?: ComponentType<PlayPauseButtonProps>;
12
15
  }
13
16
  export declare const VimeoVideoBlock: ({ ...componentProps }: import('../iframebridge/withPreview').WithPreviewProps & VimeoVideoBlockProps) => import("react/jsx-runtime").JSX.Element;
14
17
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"VimeoVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/VimeoVideoBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAoB,MAAM,OAAO,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AAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,eAAe,mJAgH3B,CAAC"}
@@ -1,9 +1,10 @@
1
1
  "use client";
2
- import { jsx, Fragment } from "react/jsx-runtime";
2
+ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
- import { useState, useRef } from "react";
4
+ import { useState, useRef, useCallback } from "react";
5
5
  import { withPreview } from "../iframebridge/withPreview.js";
6
6
  import { PreviewSkeleton } from "../previewskeleton/PreviewSkeleton.js";
7
+ import { PlayPauseButton } from "./helpers/PlayPauseButton.js";
7
8
  import { useIsElementInViewport } from "./helpers/useIsElementInViewport.js";
8
9
  import styles from "./VimeoVideoBlock.module.scss.js";
9
10
  function parseVimeoIdentifier(vimeoIdentifier) {
@@ -26,20 +27,40 @@ const VimeoVideoBlock = withPreview(
26
27
  renderPreviewImage,
27
28
  fill,
28
29
  previewImageIcon,
29
- playButtonAriaLabel
30
+ playButtonAriaLabel,
31
+ pauseButtonAriaLabel,
32
+ playPauseButton: PlayPauseButtonComponent
30
33
  }) => {
31
34
  const [showPreviewImage, setShowPreviewImage] = useState(true);
32
35
  const hasPreviewImage = !!(previewImage && previewImage.damFile);
33
36
  const inViewRef = useRef(null);
34
- const iframeRef = useRef(null);
35
- const handleVisibilityChange = (isVisible) => {
36
- var _a, _b;
37
- (_b = (_a = iframeRef.current) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage(
38
- JSON.stringify({ method: isVisible && autoplay ? "play" : "pause" }),
39
- "https://player.vimeo.com"
40
- );
41
- };
42
- useIsElementInViewport(inViewRef, handleVisibilityChange);
37
+ const [iframeElement, setIframeElement] = useState(null);
38
+ const iframeRef = setIframeElement;
39
+ const [isPlaying, setIsPlaying] = useState(autoplay ?? false);
40
+ const [isHandledManually, setIsHandledManually] = useState(false);
41
+ const pauseVimeoVideo = useCallback(() => {
42
+ var _a;
43
+ (_a = iframeElement == null ? void 0 : iframeElement.contentWindow) == null ? void 0 : _a.postMessage(JSON.stringify({ method: "pause" }), "https://player.vimeo.com");
44
+ }, [iframeElement]);
45
+ const playVimeoVideo = useCallback(() => {
46
+ var _a;
47
+ (_a = iframeElement == null ? void 0 : iframeElement.contentWindow) == null ? void 0 : _a.postMessage(JSON.stringify({ method: "play" }), "https://player.vimeo.com");
48
+ }, [iframeElement]);
49
+ const handleInView = useCallback(
50
+ (isVisible) => {
51
+ if (!isHandledManually) {
52
+ if (isVisible && autoplay) {
53
+ playVimeoVideo();
54
+ setIsPlaying(true);
55
+ } else {
56
+ pauseVimeoVideo();
57
+ setIsPlaying(false);
58
+ }
59
+ }
60
+ },
61
+ [autoplay, isHandledManually, playVimeoVideo, pauseVimeoVideo]
62
+ );
63
+ useIsElementInViewport(inViewRef, handleInView);
43
64
  if (!vimeoIdentifier) {
44
65
  return /* @__PURE__ */ jsx(PreviewSkeleton, { type: "media", hasContent: false, aspectRatio });
45
66
  }
@@ -53,6 +74,16 @@ const VimeoVideoBlock = withPreview(
53
74
  const vimeoBaseUrl = "https://player.vimeo.com/video/";
54
75
  const vimeoUrl = new URL(`${vimeoBaseUrl}${identifier ?? ""}`);
55
76
  vimeoUrl.search = searchParams.toString();
77
+ const handlePlayPauseClick = () => {
78
+ if (isPlaying) {
79
+ setIsPlaying(false);
80
+ setIsHandledManually(true);
81
+ pauseVimeoVideo();
82
+ } else {
83
+ setIsPlaying(true);
84
+ playVimeoVideo();
85
+ }
86
+ };
56
87
  return /* @__PURE__ */ jsx(Fragment, { children: hasPreviewImage && showPreviewImage ? renderPreviewImage({
57
88
  onPlay: () => setShowPreviewImage(false),
58
89
  image: previewImage,
@@ -61,13 +92,24 @@ const VimeoVideoBlock = withPreview(
61
92
  fill,
62
93
  icon: previewImageIcon,
63
94
  playButtonAriaLabel
64
- }) : /* @__PURE__ */ jsx(
95
+ }) : /* @__PURE__ */ jsxs(
65
96
  "div",
66
97
  {
67
98
  ref: inViewRef,
68
99
  className: clsx(styles.videoContainer, fill && styles.fill),
69
100
  style: !fill ? { "--aspect-ratio": aspectRatio.replace("x", "/") } : void 0,
70
- children: /* @__PURE__ */ jsx("iframe", { ref: iframeRef, className: styles.vimeoContainer, src: vimeoUrl.toString(), allow: "autoplay", allowFullScreen: true })
101
+ children: [
102
+ /* @__PURE__ */ jsx("iframe", { ref: iframeRef, className: styles.vimeoContainer, src: vimeoUrl.toString(), allow: "autoplay", allowFullScreen: true }),
103
+ !showControls && (PlayPauseButtonComponent ? /* @__PURE__ */ jsx(PlayPauseButtonComponent, { isPlaying, onClick: handlePlayPauseClick }) : /* @__PURE__ */ jsx(
104
+ PlayPauseButton,
105
+ {
106
+ isPlaying,
107
+ onClick: handlePlayPauseClick,
108
+ ariaLabelPlay: playButtonAriaLabel,
109
+ ariaLabelPause: pauseButtonAriaLabel
110
+ }
111
+ ))
112
+ ]
71
113
  }
72
114
  ) });
73
115
  },
@@ -1,5 +1,6 @@
1
- import { ReactElement, ReactNode } from 'react';
1
+ import { ComponentType, ReactElement, ReactNode } from 'react';
2
2
  import { YouTubeVideoBlockData } from '../blocks.generated';
3
+ import { PlayPauseButtonProps } from './helpers/PlayPauseButton';
3
4
  import { VideoPreviewImageProps } from './helpers/VideoPreviewImage';
4
5
  import { PropsWithData } from './PropsWithData';
5
6
  interface YouTubeVideoBlockProps extends PropsWithData<YouTubeVideoBlockData> {
@@ -9,6 +10,8 @@ interface YouTubeVideoBlockProps extends PropsWithData<YouTubeVideoBlockData> {
9
10
  fill?: boolean;
10
11
  previewImageIcon?: ReactNode;
11
12
  playButtonAriaLabel?: string;
13
+ pauseButtonAriaLabel?: string;
14
+ playPauseButton?: ComponentType<PlayPauseButtonProps>;
12
15
  }
13
16
  export declare const YouTubeVideoBlock: ({ ...componentProps }: import('../iframebridge/withPreview').WithPreviewProps & YouTubeVideoBlockProps) => import("react/jsx-runtime").JSX.Element;
14
17
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"YouTubeVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/YouTubeVideoBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIjE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAcrD,UAAU,sBAAuB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC;IACpE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,eAAO,MAAM,iBAAiB,qJAwF7B,CAAC"}
1
+ {"version":3,"file":"YouTubeVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/YouTubeVideoBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAC;AAE7G,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAerD,UAAU,sBAAuB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC;IACpE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,iBAAiB,qJA2H7B,CAAC"}
@@ -1,9 +1,10 @@
1
1
  "use client";
2
- import { jsx, Fragment } from "react/jsx-runtime";
2
+ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
- import { useState, useRef } from "react";
4
+ import { useState, useRef, useCallback } from "react";
5
5
  import { withPreview } from "../iframebridge/withPreview.js";
6
6
  import { PreviewSkeleton } from "../previewskeleton/PreviewSkeleton.js";
7
+ import { PlayPauseButton } from "./helpers/PlayPauseButton.js";
7
8
  import { useIsElementInViewport } from "./helpers/useIsElementInViewport.js";
8
9
  import styles from "./YouTubeVideoBlock.module.scss.js";
9
10
  const EXPECTED_YT_ID_LENGTH = 11;
@@ -21,29 +22,40 @@ const YouTubeVideoBlock = withPreview(
21
22
  renderPreviewImage,
22
23
  fill,
23
24
  previewImageIcon,
24
- playButtonAriaLabel
25
+ playButtonAriaLabel,
26
+ pauseButtonAriaLabel,
27
+ playPauseButton: PlayPauseButtonComponent
25
28
  }) => {
26
29
  const [showPreviewImage, setShowPreviewImage] = useState(true);
30
+ const [isPlaying, setIsPlaying] = useState(autoplay ?? false);
31
+ const [isHandledManually, setIsHandledManually] = useState(false);
27
32
  const hasPreviewImage = !!(previewImage && previewImage.damFile);
28
- const iframeRef = useRef(null);
33
+ const [iframeElement, setIframeElement] = useState(null);
34
+ const iframeRef = setIframeElement;
29
35
  const inViewRef = useRef(null);
30
- const pauseYouTubeVideo = () => {
31
- var _a, _b;
32
- (_b = (_a = iframeRef.current) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage(`{"event":"command","func":"pauseVideo","args":""}`, "https://www.youtube-nocookie.com");
33
- };
34
- const playYouTubeVideo = () => {
35
- var _a, _b;
36
- (_b = (_a = iframeRef.current) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage(`{"event":"command","func":"playVideo","args":""}`, "https://www.youtube-nocookie.com");
37
- };
38
- useIsElementInViewport(inViewRef, (inView) => {
39
- if (autoplay) {
40
- if (inView) {
41
- playYouTubeVideo();
42
- } else {
43
- pauseYouTubeVideo();
36
+ const pauseYouTubeVideo = useCallback(() => {
37
+ var _a;
38
+ (_a = iframeElement == null ? void 0 : iframeElement.contentWindow) == null ? void 0 : _a.postMessage(`{"event":"command","func":"pauseVideo","args":""}`, "https://www.youtube-nocookie.com");
39
+ }, [iframeElement]);
40
+ const playYouTubeVideo = useCallback(() => {
41
+ var _a;
42
+ (_a = iframeElement == null ? void 0 : iframeElement.contentWindow) == null ? void 0 : _a.postMessage(`{"event":"command","func":"playVideo","args":""}`, "https://www.youtube-nocookie.com");
43
+ }, [iframeElement]);
44
+ const handleInView = useCallback(
45
+ (inView) => {
46
+ if (!isHandledManually) {
47
+ if (inView && autoplay) {
48
+ playYouTubeVideo();
49
+ setIsPlaying(true);
50
+ } else {
51
+ pauseYouTubeVideo();
52
+ setIsPlaying(false);
53
+ }
44
54
  }
45
- }
46
- });
55
+ },
56
+ [autoplay, isHandledManually, playYouTubeVideo, pauseYouTubeVideo]
57
+ );
58
+ useIsElementInViewport(inViewRef, handleInView);
47
59
  if (!youtubeIdentifier) {
48
60
  return /* @__PURE__ */ jsx(PreviewSkeleton, { type: "media", hasContent: false, aspectRatio });
49
61
  }
@@ -52,7 +64,7 @@ const YouTubeVideoBlock = withPreview(
52
64
  searchParams.append("modestbranding", "1");
53
65
  searchParams.append("rel", "0");
54
66
  searchParams.append("enablejsapi", "1");
55
- if (hasPreviewImage && !showPreviewImage) searchParams.append("autoplay", "1");
67
+ if (hasPreviewImage && !showPreviewImage || !hasPreviewImage) searchParams.append("autoplay", "1");
56
68
  if (autoplay) searchParams.append("mute", "1");
57
69
  if (showControls !== void 0) searchParams.append("controls", Number(showControls).toString());
58
70
  if (loop !== void 0) searchParams.append("loop", Number(loop).toString());
@@ -60,6 +72,16 @@ const YouTubeVideoBlock = withPreview(
60
72
  const youtubeBaseUrl = "https://www.youtube-nocookie.com/embed/";
61
73
  const youtubeUrl = new URL(`${youtubeBaseUrl}${identifier ?? ""}`);
62
74
  youtubeUrl.search = searchParams.toString();
75
+ const handlePlayPauseClick = () => {
76
+ if (isPlaying) {
77
+ setIsPlaying(false);
78
+ setIsHandledManually(true);
79
+ pauseYouTubeVideo();
80
+ } else {
81
+ setIsPlaying(true);
82
+ playYouTubeVideo();
83
+ }
84
+ };
63
85
  return /* @__PURE__ */ jsx(Fragment, { children: hasPreviewImage && showPreviewImage ? renderPreviewImage({
64
86
  onPlay: () => setShowPreviewImage(false),
65
87
  image: previewImage,
@@ -68,22 +90,33 @@ const YouTubeVideoBlock = withPreview(
68
90
  fill,
69
91
  icon: previewImageIcon,
70
92
  playButtonAriaLabel
71
- }) : /* @__PURE__ */ jsx(
93
+ }) : /* @__PURE__ */ jsxs(
72
94
  "div",
73
95
  {
74
96
  ref: inViewRef,
75
97
  className: clsx(styles.videoContainer, fill && styles.fill),
76
98
  style: !fill ? { "--aspect-ratio": aspectRatio.replace("x", "/") } : void 0,
77
- children: /* @__PURE__ */ jsx(
78
- "iframe",
79
- {
80
- ref: iframeRef,
81
- className: styles.youtubeContainer,
82
- allow: "autoplay",
83
- referrerPolicy: "strict-origin-when-cross-origin",
84
- src: youtubeUrl.toString()
85
- }
86
- )
99
+ children: [
100
+ !showControls && (PlayPauseButtonComponent ? /* @__PURE__ */ jsx(PlayPauseButtonComponent, { isPlaying, onClick: handlePlayPauseClick }) : /* @__PURE__ */ jsx(
101
+ PlayPauseButton,
102
+ {
103
+ isPlaying,
104
+ onClick: handlePlayPauseClick,
105
+ ariaLabelPlay: playButtonAriaLabel,
106
+ ariaLabelPause: pauseButtonAriaLabel
107
+ }
108
+ )),
109
+ /* @__PURE__ */ jsx(
110
+ "iframe",
111
+ {
112
+ ref: iframeRef,
113
+ className: styles.youtubeContainer,
114
+ allow: "autoplay",
115
+ referrerPolicy: "strict-origin-when-cross-origin",
116
+ src: youtubeUrl.toString()
117
+ }
118
+ )
119
+ ]
87
120
  }
88
121
  ) });
89
122
  },
@@ -0,0 +1,8 @@
1
+ export interface PlayPauseButtonProps {
2
+ isPlaying: boolean;
3
+ onClick: () => void;
4
+ ariaLabelPlay?: string;
5
+ ariaLabelPause?: string;
6
+ }
7
+ export declare const PlayPauseButton: ({ isPlaying, onClick, ariaLabelPlay, ariaLabelPause }: PlayPauseButtonProps) => import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=PlayPauseButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlayPauseButton.d.ts","sourceRoot":"","sources":["../../../src/blocks/helpers/PlayPauseButton.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,eAAe,GAAI,uDAAuD,oBAAoB,4CAM1G,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import styles from "./PlayPauseButton.module.scss.js";
4
+ const PlayPauseButton = ({ isPlaying, onClick, ariaLabelPlay, ariaLabelPause }) => {
5
+ return /* @__PURE__ */ jsx("button", { className: clsx(styles.button), onClick, "aria-label": isPlaying ? ariaLabelPause ?? "Pause" : ariaLabelPlay ?? "Play", children: /* @__PURE__ */ jsx("div", { className: clsx(styles.animatedPlayPause, isPlaying && styles.animatedPlayPausePaused) }) });
6
+ };
7
+ export {
8
+ PlayPauseButton
9
+ };
@@ -0,0 +1,14 @@
1
+ const button = "_button_4r8gs_1";
2
+ const animatedPlayPause = "_animatedPlayPause_4r8gs_23";
3
+ const animatedPlayPausePaused = "_animatedPlayPausePaused_4r8gs_32";
4
+ const styles = {
5
+ button,
6
+ animatedPlayPause,
7
+ animatedPlayPausePaused
8
+ };
9
+ export {
10
+ animatedPlayPause,
11
+ animatedPlayPausePaused,
12
+ button,
13
+ styles as default
14
+ };
package/lib/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { ListBlock } from './blocks/factories/ListBlock';
8
8
  export { OneOfBlock } from './blocks/factories/OneOfBlock';
9
9
  export { OptionalBlock } from './blocks/factories/OptionalBlock';
10
10
  export type { SupportedBlocks } from './blocks/factories/types';
11
+ export { type PlayPauseButtonProps } from './blocks/helpers/PlayPauseButton';
11
12
  export { hasRichTextBlockContent } from './blocks/helpers/RichTextBlockHelper';
12
13
  export { useIsElementInViewport } from './blocks/helpers/useIsElementInViewport';
13
14
  export type { VideoPreviewImageProps } from './blocks/helpers/VideoPreviewImage';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,uBAAuB,EAAE,KAAK,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC9I,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,SAA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AAE,wBAAwB,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtJ,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AACvG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,KAAK,gCAAgC,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC"}
package/lib/style.css CHANGED
@@ -1 +1 @@
1
- ._previewElementContainer_nwhl6_1{display:contents}._childrenWrapper_qguhx_1{position:relative;z-index:1}._root_v4248_1{position:absolute;z-index:2;top:0;left:0;right:0;min-height:100vh;height:var(--height)}._root_1ya0k_1{position:absolute;cursor:pointer;outline:1px solid transparent;outline-offset:-1px}._root_1ya0k_1:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;opacity:.25}._root_1ya0k_1:hover{outline-color:#29b6f6;outline-style:solid}._root_1ya0k_1:hover:after{background-color:#29b6f6}._isHoveredInBlockList_1ya0k_24{outline-color:#29b6f6;outline-style:solid}._isHoveredInBlockList_1ya0k_24:after{background-color:#29b6f6}._showBlockOutlines_1ya0k_32:not(:hover){outline-color:#d9d9d9;outline-style:dashed}._blockIsSelected_1ya0k_37{outline-color:#29b6f6}._blockIsSelected_1ya0k_37 ._label_1ya0k_40{display:inline-block}._label_1ya0k_40{position:absolute;padding:2px;background-color:#57b0eb;line-height:16px;color:#fff;top:1px;right:1px;font-size:12px;display:none}._barSkeleton_zomv4_1{min-height:20px;margin-bottom:5px;margin-right:5px;background-color:var(--background-color);color:var(--color)}._rowsContainer_zomv4_9{width:100%;min-width:300px}._rowSkeleton_zomv4_14{margin-bottom:10px;min-height:20px;width:var(--width);background-color:var(--background-color);color:var(--color)}._imageContainer_zomv4_22{width:100%;aspect-ratio:var(--aspect-ratio);height:var(--height);background-color:var(--background-color);color:var(--color)}._video_17b8y_1{width:100%;object-fit:cover;aspect-ratio:var(--aspect-ratio)}._fill_17b8y_7{height:100%}._root_1k5a5_1{position:relative;width:100%}._fill_1k5a5_6{height:100%}._iconWrapper_1k5a5_10{position:absolute;top:0;right:0;left:0;bottom:0;display:flex;align-items:center;justify-content:center;background-color:#000;opacity:.5;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;padding:0;cursor:pointer}._iconWrapper_1k5a5_10:focus ._playIcon_1k5a5_26{outline:4px solid white;outline-offset:10px;border-radius:2px}._playIcon_1k5a5_26{width:64px;height:64px;box-sizing:border-box;border-style:solid;border-width:32px 0 32px 64px;border-color:transparent transparent transparent white}._videoContainer_1flq1_1{overflow:hidden;position:relative;aspect-ratio:var(--aspect-ratio)}._fill_1flq1_7{width:100%;height:100%}._vimeoContainer_1flq1_12{position:absolute;border:0;top:0;left:0;width:100%;height:100%}._videoContainer_bhmhr_1{overflow:hidden;position:relative;aspect-ratio:var(--aspect-ratio)}._fill_bhmhr_7{width:100%;height:100%}._youtubeContainer_bhmhr_12{position:absolute;border:0;top:0;left:0;width:100%;height:100%}
1
+ ._previewElementContainer_nwhl6_1{display:contents}._childrenWrapper_qguhx_1{position:relative;z-index:1}._root_v4248_1{position:absolute;z-index:2;top:0;left:0;right:0;min-height:100vh;height:var(--height)}._root_1ya0k_1{position:absolute;cursor:pointer;outline:1px solid transparent;outline-offset:-1px}._root_1ya0k_1:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;opacity:.25}._root_1ya0k_1:hover{outline-color:#29b6f6;outline-style:solid}._root_1ya0k_1:hover:after{background-color:#29b6f6}._isHoveredInBlockList_1ya0k_24{outline-color:#29b6f6;outline-style:solid}._isHoveredInBlockList_1ya0k_24:after{background-color:#29b6f6}._showBlockOutlines_1ya0k_32:not(:hover){outline-color:#d9d9d9;outline-style:dashed}._blockIsSelected_1ya0k_37{outline-color:#29b6f6}._blockIsSelected_1ya0k_37 ._label_1ya0k_40{display:inline-block}._label_1ya0k_40{position:absolute;padding:2px;background-color:#57b0eb;line-height:16px;color:#fff;top:1px;right:1px;font-size:12px;display:none}._barSkeleton_zomv4_1{min-height:20px;margin-bottom:5px;margin-right:5px;background-color:var(--background-color);color:var(--color)}._rowsContainer_zomv4_9{width:100%;min-width:300px}._rowSkeleton_zomv4_14{margin-bottom:10px;min-height:20px;width:var(--width);background-color:var(--background-color);color:var(--color)}._imageContainer_zomv4_22{width:100%;aspect-ratio:var(--aspect-ratio);height:var(--height);background-color:var(--background-color);color:var(--color)}._root_8r6od_1{position:relative}._video_8r6od_5{width:100%;object-fit:cover;aspect-ratio:var(--aspect-ratio)}._fill_8r6od_11{height:100%}._button_4r8gs_1{position:absolute;left:8px;bottom:8px;width:24px;height:24px;display:flex;align-items:center;justify-content:center;background-color:#000000b3;z-index:10}._button_4r8gs_1:hover,._button_4r8gs_1:active{background-color:#9e9e9e}._button_4r8gs_1:focus{border-radius:6px}._animatedPlayPause_4r8gs_23{box-sizing:border-box;height:12px;border-color:transparent transparent transparent #fff;cursor:pointer;border-style:solid;border-width:6px 0 6px 9px;transition:border-width .1s ease,border-style .1s ease}._animatedPlayPausePaused_4r8gs_32{border-style:double;border-width:0 0 0 9px}._root_1k5a5_1{position:relative;width:100%}._fill_1k5a5_6{height:100%}._iconWrapper_1k5a5_10{position:absolute;top:0;right:0;left:0;bottom:0;display:flex;align-items:center;justify-content:center;background-color:#000;opacity:.5;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;padding:0;cursor:pointer}._iconWrapper_1k5a5_10:focus ._playIcon_1k5a5_26{outline:4px solid white;outline-offset:10px;border-radius:2px}._playIcon_1k5a5_26{width:64px;height:64px;box-sizing:border-box;border-style:solid;border-width:32px 0 32px 64px;border-color:transparent transparent transparent white}._videoContainer_1flq1_1{overflow:hidden;position:relative;aspect-ratio:var(--aspect-ratio)}._fill_1flq1_7{width:100%;height:100%}._vimeoContainer_1flq1_12{position:absolute;border:0;top:0;left:0;width:100%;height:100%}._videoContainer_bhmhr_1{overflow:hidden;position:relative;aspect-ratio:var(--aspect-ratio)}._fill_bhmhr_7{width:100%;height:100%}._youtubeContainer_bhmhr_12{position:absolute;border:0;top:0;left:0;width:100%;height:100%}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comet/site-react",
3
- "version": "9.0.0-canary-20251209132220",
3
+ "version": "9.0.0-canary-20251209140438",
4
4
  "description": "Comet Site React package",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,11 +33,11 @@
33
33
  "usehooks-ts": "^3.1.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/draft-js": "^0.11.18",
36
+ "@types/draft-js": "^0.11.20",
37
37
  "@types/jest": "^29.5.14",
38
38
  "@types/lodash.isequal": "^4.5.8",
39
39
  "@types/react": "^19.2.0",
40
- "@vitejs/plugin-react": "^4.6.0",
40
+ "@vitejs/plugin-react": "^4.7.0",
41
41
  "chokidar-cli": "^3.0.0",
42
42
  "eslint": "^9.30.1",
43
43
  "jest": "^29.7.0",
@@ -46,7 +46,7 @@
46
46
  "npm-run-all2": "^8.0.0",
47
47
  "prettier": "^3.6.2",
48
48
  "react": "^19.2.0",
49
- "rimraf": "^6.0.1",
49
+ "rimraf": "^6.1.2",
50
50
  "rollup": "^4.44.2",
51
51
  "rollup-plugin-preserve-directives": "^0.4.0",
52
52
  "sass": "^1.89.2",
@@ -55,8 +55,8 @@
55
55
  "vite": "^5.4.19",
56
56
  "vite-plugin-dts": "^4.5.4",
57
57
  "webpack": "^5.102.1",
58
- "@comet/cli": "9.0.0-canary-20251209132220",
59
- "@comet/eslint-config": "9.0.0-canary-20251209132220"
58
+ "@comet/cli": "9.0.0-canary-20251209140438",
59
+ "@comet/eslint-config": "9.0.0-canary-20251209140438"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "react": "^18.0.0 || ^19.0.0"
@@ -75,6 +75,7 @@
75
75
  "generate-block-types": "comet generate-block-types",
76
76
  "generate-block-types:watch": "chokidar -s \"block-meta.json\" -c \"pnpm generate-block-types\"",
77
77
  "lint": "pnpm generate-block-types && run-p lint:prettier lint:eslint lint:tsc",
78
+ "lint:ci": "pnpm run lint",
78
79
  "lint:eslint": "eslint --max-warnings 0 src/ **/*.json --no-warn-ignored",
79
80
  "lint:prettier": "pnpm exec prettier --check './**/*.{js,json,md,yml,yaml,css,scss}'",
80
81
  "lint:tsc": "tsc --noEmit",