pb-sxp-ui 1.0.27 → 1.0.28

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/index.js CHANGED
@@ -12070,13 +12070,24 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12070
12070
  });
12071
12071
  }
12072
12072
  }, [data, index, bffEventReport]);
12073
+ const blur = useMemo(() => {
12074
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12075
+ }, [videoPostConfig]);
12076
+ const translateY = useMemo(() => {
12077
+ var _a;
12078
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12079
+ ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12080
+ : 'translateY(-50%)';
12081
+ }, [videoPostConfig]);
12082
+ const blurBgSrc = useMemo(() => {
12083
+ var _a;
12084
+ return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12085
+ }, [firstFrameSrc, rec]);
12073
12086
  const handLoadeddata = useCallback(() => {
12074
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12075
- if (!video)
12087
+ if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
12076
12088
  return;
12089
+ const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12077
12090
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12078
- if (!canvas)
12079
- return;
12080
12091
  const ctx = canvas.getContext('2d');
12081
12092
  const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12082
12093
  const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
@@ -12084,10 +12095,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12084
12095
  canvas.width = targetWidth;
12085
12096
  ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12086
12097
  setFirstFrameSrc(canvas.toDataURL());
12087
- canvas.remove();
12088
12098
  }, []);
12089
12099
  useEffect(() => {
12090
- var _a, _b, _c;
12100
+ var _a, _b, _c, _d;
12091
12101
  if (!videoRef.current)
12092
12102
  return;
12093
12103
  setIsPauseVideo(false);
@@ -12110,14 +12120,16 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12110
12120
  videoRef.current.setAttribute('x5-playsinline', 'true');
12111
12121
  videoRef.current.setAttribute('webkit-playsinline', 'true');
12112
12122
  }
12113
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('canplay', handleLoadedMetadata);
12114
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('playing', handlePlaying);
12115
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('loadeddata', handLoadeddata);
12123
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
12124
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12125
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12126
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
12116
12127
  return () => {
12117
- var _a, _b, _c;
12118
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
12119
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('playing', handlePlaying);
12120
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('loadeddata', handLoadeddata);
12128
+ var _a, _b, _c, _d;
12129
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
12130
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
12131
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
12132
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
12121
12133
  };
12122
12134
  }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
12123
12135
  useEffect(() => {
@@ -12176,19 +12188,6 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12176
12188
  window.removeEventListener('beforeunload', handleBeforeUnload);
12177
12189
  };
12178
12190
  }, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
12179
- const blur = useMemo(() => {
12180
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12181
- }, [videoPostConfig]);
12182
- const translateY = useMemo(() => {
12183
- var _a;
12184
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12185
- ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12186
- : 'translateY(-50%)';
12187
- }, [videoPostConfig]);
12188
- const blurBgSrc = useMemo(() => {
12189
- var _a;
12190
- return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12191
- }, [firstFrameSrc, rec]);
12192
12191
  if (!rec.video) {
12193
12192
  return null;
12194
12193
  }
@@ -12216,7 +12215,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12216
12215
  right: 0
12217
12216
  } },
12218
12217
  React.createElement("div", { style: { position: 'relative' } },
12219
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', poster: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
12218
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous',
12219
+ // poster={sxpParameter?.placeholder_image}
12220
+ muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
12220
12221
  width: '100%',
12221
12222
  height: 'auto',
12222
12223
  objectFit: 'contain'
@@ -12228,7 +12229,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12228
12229
  height,
12229
12230
  overflow: 'hidden'
12230
12231
  } },
12231
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', poster: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
12232
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous',
12233
+ // poster={sxpParameter?.placeholder_image}
12234
+ muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
12232
12235
  renderPoster,
12233
12236
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
12234
12237
  };
@@ -13081,3 +13084,4 @@ function useEditorDataProvider() {
13081
13084
  */
13082
13085
 
13083
13086
  export { EditorDataProvider, Modal$1 as Modal, SxpDataSourceProvider$1 as SxpDataSourceProvider, index as SxpPageCore, SxpPageRender, index$1 as core, Pagebuilder as default, defaultSetting, _materials_ as materials, useEditorDataProvider };
13087
+ //# sourceMappingURL=index.js.map