@gravity-ui/page-constructor 4.27.0 → 4.27.2-alpha.0

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.
@@ -20,6 +20,9 @@ unpredictable css rules order in build */
20
20
  position: relative;
21
21
  height: 100%;
22
22
  }
23
+ .pc-header-block__content_theme_dark {
24
+ --g-color-line-focus: var(--pc-color-line-focus-dark);
25
+ }
23
26
  .pc-header-block__content_theme_dark .pc-header-block__title,
24
27
  .pc-header-block__content_theme_dark .pc-header-block__overtitle {
25
28
  color: var(--g-color-text-light-primary);
@@ -32,7 +32,7 @@ const Video = (props) => {
32
32
  }, [playVideo, video, setHasVideoFallback]);
33
33
  const reactPlayerBlock = (0, react_1.useMemo)(() => {
34
34
  const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton, ariaLabel, customControlsOptions, } = video;
35
- return (react_1.default.createElement(ReactPlayer_1.default, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, analyticsEvents: analyticsEvents, height: height, ariaLabel: ariaLabel, customControlsOptions: customControlsOptions, ratio: ratio }));
35
+ return (react_1.default.createElement(ReactPlayer_1.default, { ref: ref, className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, analyticsEvents: analyticsEvents, height: height, ariaLabel: ariaLabel, customControlsOptions: customControlsOptions, ratio: ratio }));
36
36
  }, [
37
37
  video,
38
38
  height,
@@ -11,5 +11,6 @@ export interface ReactPlayerBlockProps extends Omit<MediaVideoProps, 'loop' | 's
11
11
  ratio?: number;
12
12
  children?: React.ReactNode;
13
13
  }
14
- export declare const ReactPlayerBlock: React.ForwardRefExoticComponent<ReactPlayerBlockProps & React.RefAttributes<ReactPlayerBlockHandler>>;
14
+ type ReactPlayerBlockRefType = ReactPlayerBlockHandler | undefined;
15
+ export declare const ReactPlayerBlock: React.ForwardRefExoticComponent<ReactPlayerBlockProps & React.RefAttributes<ReactPlayerBlockRefType>>;
15
16
  export default ReactPlayerBlock;
@@ -48,9 +48,18 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
48
48
  return [];
49
49
  }, [analyticsEvents]);
50
50
  const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.ReactPlayerControls);
51
- (0, react_1.useImperativeHandle)(originRef, () => ({
52
- pause: () => setIsPlaying(false),
53
- }));
51
+ (0, react_1.useImperativeHandle)(originRef, () => {
52
+ if (!playerRef) {
53
+ return;
54
+ }
55
+ const { play, pause, addEventListener } = playerRef.getInternalPlayer();
56
+ // eslint-disable-next-line consistent-return
57
+ return {
58
+ play,
59
+ pause,
60
+ addEventListener,
61
+ };
62
+ }, [playerRef]);
54
63
  (0, react_1.useEffect)(() => {
55
64
  if (ref.current && !(playingVideoRef === null || playingVideoRef === void 0 ? void 0 : playingVideoRef.contains(ref.current))) {
56
65
  setMuted(true);
@@ -1,4 +1,3 @@
1
1
  export type ArrowDirection = 'left' | 'right';
2
- export interface ReactPlayerBlockHandler {
3
- pause: () => void;
2
+ export interface ReactPlayerBlockHandler extends Pick<HTMLVideoElement, 'play' | 'pause' | 'addEventListener'> {
4
3
  }
@@ -20,6 +20,9 @@ unpredictable css rules order in build */
20
20
  position: relative;
21
21
  height: 100%;
22
22
  }
23
+ .pc-header-block__content_theme_dark {
24
+ --g-color-line-focus: var(--pc-color-line-focus-dark);
25
+ }
23
26
  .pc-header-block__content_theme_dark .pc-header-block__title,
24
27
  .pc-header-block__content_theme_dark .pc-header-block__overtitle {
25
28
  color: var(--g-color-text-light-primary);
@@ -30,7 +30,7 @@ const Video = (props) => {
30
30
  }, [playVideo, video, setHasVideoFallback]);
31
31
  const reactPlayerBlock = useMemo(() => {
32
32
  const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton, ariaLabel, customControlsOptions, } = video;
33
- return (React.createElement(ReactPlayerBlock, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, analyticsEvents: analyticsEvents, height: height, ariaLabel: ariaLabel, customControlsOptions: customControlsOptions, ratio: ratio }));
33
+ return (React.createElement(ReactPlayerBlock, { ref: ref, className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, analyticsEvents: analyticsEvents, height: height, ariaLabel: ariaLabel, customControlsOptions: customControlsOptions, ratio: ratio }));
34
34
  }, [
35
35
  video,
36
36
  height,
@@ -12,5 +12,6 @@ export interface ReactPlayerBlockProps extends Omit<MediaVideoProps, 'loop' | 's
12
12
  ratio?: number;
13
13
  children?: React.ReactNode;
14
14
  }
15
- export declare const ReactPlayerBlock: React.ForwardRefExoticComponent<ReactPlayerBlockProps & React.RefAttributes<ReactPlayerBlockHandler>>;
15
+ type ReactPlayerBlockRefType = ReactPlayerBlockHandler | undefined;
16
+ export declare const ReactPlayerBlock: React.ForwardRefExoticComponent<ReactPlayerBlockProps & React.RefAttributes<ReactPlayerBlockRefType>>;
16
17
  export default ReactPlayerBlock;
@@ -45,9 +45,18 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
45
45
  return [];
46
46
  }, [analyticsEvents]);
47
47
  const handleAnalytics = useAnalytics(DefaultEventNames.ReactPlayerControls);
48
- useImperativeHandle(originRef, () => ({
49
- pause: () => setIsPlaying(false),
50
- }));
48
+ useImperativeHandle(originRef, () => {
49
+ if (!playerRef) {
50
+ return;
51
+ }
52
+ const { play, pause, addEventListener } = playerRef.getInternalPlayer();
53
+ // eslint-disable-next-line consistent-return
54
+ return {
55
+ play,
56
+ pause,
57
+ addEventListener,
58
+ };
59
+ }, [playerRef]);
51
60
  useEffect(() => {
52
61
  if (ref.current && !(playingVideoRef === null || playingVideoRef === void 0 ? void 0 : playingVideoRef.contains(ref.current))) {
53
62
  setMuted(true);
@@ -1,4 +1,3 @@
1
1
  export type ArrowDirection = 'left' | 'right';
2
- export interface ReactPlayerBlockHandler {
3
- pause: () => void;
2
+ export interface ReactPlayerBlockHandler extends Pick<HTMLVideoElement, 'play' | 'pause' | 'addEventListener'> {
4
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.27.0",
3
+ "version": "4.27.2-alpha.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,4 +1,3 @@
1
1
  export type ArrowDirection = 'left' | 'right';
2
- export interface ReactPlayerBlockHandler {
3
- pause: () => void;
2
+ export interface ReactPlayerBlockHandler extends Pick<HTMLVideoElement, 'play' | 'pause' | 'addEventListener'> {
4
3
  }