@alfalab/core-components-gallery 7.0.6 → 7.1.0-alfasans
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/Component.d.ts +1 -1
- package/Component.js.map +1 -1
- package/components/bottom-button/Component.d.ts +1 -1
- package/components/bottom-button/Component.js.map +1 -1
- package/components/bottom-button/index.css +5 -5
- package/components/bottom-button/index.module.css.js +1 -1
- package/components/buttons/index.css +5 -5
- package/components/buttons/index.d.ts +1 -1
- package/components/buttons/index.js +1 -1
- package/components/buttons/index.js.map +1 -1
- package/components/buttons/index.module.css.js +1 -1
- package/components/header/Component.js.map +1 -1
- package/components/header/index.css +1 -1
- package/components/header/index.module.css.js +1 -1
- package/components/header-info-block/Component.d.ts +1 -1
- package/components/header-info-block/index.css +4 -4
- package/components/header-info-block/index.module.css.js +1 -1
- package/components/header-mobile/Component.js +5 -3
- package/components/header-mobile/Component.js.map +1 -1
- package/components/header-mobile/index.css +6 -6
- package/components/header-mobile/index.module.css.js +1 -1
- package/components/image-preview/Component.d.ts +1 -1
- package/components/image-preview/Component.js.map +1 -1
- package/components/image-preview/index.css +17 -17
- package/components/image-preview/index.module.css.js +1 -1
- package/components/image-viewer/component.js.map +1 -1
- package/components/image-viewer/hooks.d.ts +1 -1
- package/components/image-viewer/hooks.js.map +1 -1
- package/components/image-viewer/index.css +25 -25
- package/components/image-viewer/index.module.css.js +1 -1
- package/components/image-viewer/slide.d.ts +1 -1
- package/components/image-viewer/slide.js.map +1 -1
- package/components/image-viewer/video/index.css +7 -7
- package/components/image-viewer/video/index.d.ts +1 -1
- package/components/image-viewer/video/index.js +109 -25
- package/components/image-viewer/video/index.js.map +1 -1
- package/components/image-viewer/video/index.module.css.js +1 -1
- package/components/info-bar/Component.js.map +1 -1
- package/components/info-bar/index.css +3 -3
- package/components/info-bar/index.module.css.js +1 -1
- package/components/navigation-bar/Component.js.map +1 -1
- package/components/navigation-bar/index.css +8 -8
- package/components/navigation-bar/index.module.css.js +1 -1
- package/components/subtitles/index.css +3 -3
- package/components/subtitles/index.js.map +1 -1
- package/components/subtitles/index.module.css.js +1 -1
- package/context.d.ts +1 -2
- package/cssm/Component.d.ts +1 -1
- package/cssm/Component.js.map +1 -1
- package/cssm/components/bottom-button/Component.d.ts +1 -1
- package/cssm/components/bottom-button/Component.js.map +1 -1
- package/cssm/components/buttons/index.d.ts +1 -1
- package/cssm/components/buttons/index.js +1 -1
- package/cssm/components/buttons/index.js.map +1 -1
- package/cssm/components/header/Component.js.map +1 -1
- package/cssm/components/header-info-block/Component.d.ts +1 -1
- package/cssm/components/header-mobile/Component.js +5 -3
- package/cssm/components/header-mobile/Component.js.map +1 -1
- package/cssm/components/image-preview/Component.d.ts +1 -1
- package/cssm/components/image-preview/Component.js.map +1 -1
- package/cssm/components/image-viewer/component.js.map +1 -1
- package/cssm/components/image-viewer/hooks.d.ts +1 -1
- package/cssm/components/image-viewer/hooks.js.map +1 -1
- package/cssm/components/image-viewer/slide.d.ts +1 -1
- package/cssm/components/image-viewer/slide.js.map +1 -1
- package/cssm/components/image-viewer/video/index.d.ts +1 -1
- package/cssm/components/image-viewer/video/index.js +109 -25
- package/cssm/components/image-viewer/video/index.js.map +1 -1
- package/cssm/components/info-bar/Component.js.map +1 -1
- package/cssm/components/navigation-bar/Component.js.map +1 -1
- package/cssm/components/subtitles/index.js.map +1 -1
- package/cssm/context.d.ts +1 -2
- package/cssm/hooks/use-custom-subtitles.js.map +1 -1
- package/cssm/types.d.ts +4 -3
- package/cssm/utils/split-filename.js.map +1 -1
- package/cssm/utils/utils.js.map +1 -1
- package/esm/Component.d.ts +1 -1
- package/esm/Component.js.map +1 -1
- package/esm/components/bottom-button/Component.d.ts +1 -1
- package/esm/components/bottom-button/Component.js.map +1 -1
- package/esm/components/bottom-button/index.css +5 -5
- package/esm/components/bottom-button/index.module.css.js +1 -1
- package/esm/components/buttons/index.css +5 -5
- package/esm/components/buttons/index.d.ts +1 -1
- package/esm/components/buttons/index.js +1 -1
- package/esm/components/buttons/index.js.map +1 -1
- package/esm/components/buttons/index.module.css.js +1 -1
- package/esm/components/header/Component.js.map +1 -1
- package/esm/components/header/index.css +1 -1
- package/esm/components/header/index.module.css.js +1 -1
- package/esm/components/header-info-block/Component.d.ts +1 -1
- package/esm/components/header-info-block/index.css +4 -4
- package/esm/components/header-info-block/index.module.css.js +1 -1
- package/esm/components/header-mobile/Component.js +5 -3
- package/esm/components/header-mobile/Component.js.map +1 -1
- package/esm/components/header-mobile/index.css +6 -6
- package/esm/components/header-mobile/index.module.css.js +1 -1
- package/esm/components/image-preview/Component.d.ts +1 -1
- package/esm/components/image-preview/Component.js.map +1 -1
- package/esm/components/image-preview/index.css +17 -17
- package/esm/components/image-preview/index.module.css.js +1 -1
- package/esm/components/image-viewer/component.js.map +1 -1
- package/esm/components/image-viewer/hooks.d.ts +1 -1
- package/esm/components/image-viewer/hooks.js.map +1 -1
- package/esm/components/image-viewer/index.css +25 -25
- package/esm/components/image-viewer/index.module.css.js +1 -1
- package/esm/components/image-viewer/slide.d.ts +1 -1
- package/esm/components/image-viewer/slide.js.map +1 -1
- package/esm/components/image-viewer/video/index.css +7 -7
- package/esm/components/image-viewer/video/index.d.ts +1 -1
- package/esm/components/image-viewer/video/index.js +92 -25
- package/esm/components/image-viewer/video/index.js.map +1 -1
- package/esm/components/image-viewer/video/index.module.css.js +1 -1
- package/esm/components/info-bar/Component.js.map +1 -1
- package/esm/components/info-bar/index.css +3 -3
- package/esm/components/info-bar/index.module.css.js +1 -1
- package/esm/components/navigation-bar/Component.js.map +1 -1
- package/esm/components/navigation-bar/index.css +8 -8
- package/esm/components/navigation-bar/index.module.css.js +1 -1
- package/esm/components/subtitles/index.css +3 -3
- package/esm/components/subtitles/index.js.map +1 -1
- package/esm/components/subtitles/index.module.css.js +1 -1
- package/esm/context.d.ts +1 -2
- package/esm/hooks/use-custom-subtitles.js.map +1 -1
- package/esm/index.css +9 -9
- package/esm/index.module.css.js +1 -1
- package/esm/types.d.ts +4 -3
- package/esm/utils/split-filename.js.map +1 -1
- package/esm/utils/utils.js.map +1 -1
- package/hooks/use-custom-subtitles.js.map +1 -1
- package/index.css +9 -9
- package/index.module.css.js +1 -1
- package/modern/Component.d.ts +1 -1
- package/modern/Component.js.map +1 -1
- package/modern/components/bottom-button/Component.d.ts +1 -1
- package/modern/components/bottom-button/Component.js.map +1 -1
- package/modern/components/bottom-button/index.css +5 -5
- package/modern/components/bottom-button/index.module.css.js +1 -1
- package/modern/components/buttons/index.css +5 -5
- package/modern/components/buttons/index.d.ts +1 -1
- package/modern/components/buttons/index.js +1 -1
- package/modern/components/buttons/index.js.map +1 -1
- package/modern/components/buttons/index.module.css.js +1 -1
- package/modern/components/header/Component.js.map +1 -1
- package/modern/components/header/index.css +1 -1
- package/modern/components/header/index.module.css.js +1 -1
- package/modern/components/header-info-block/Component.d.ts +1 -1
- package/modern/components/header-info-block/index.css +4 -4
- package/modern/components/header-info-block/index.module.css.js +1 -1
- package/modern/components/header-mobile/Component.js +3 -1
- package/modern/components/header-mobile/Component.js.map +1 -1
- package/modern/components/header-mobile/index.css +6 -6
- package/modern/components/header-mobile/index.module.css.js +1 -1
- package/modern/components/image-preview/Component.d.ts +1 -1
- package/modern/components/image-preview/Component.js.map +1 -1
- package/modern/components/image-preview/index.css +17 -17
- package/modern/components/image-preview/index.module.css.js +1 -1
- package/modern/components/image-viewer/component.js.map +1 -1
- package/modern/components/image-viewer/hooks.d.ts +1 -1
- package/modern/components/image-viewer/hooks.js.map +1 -1
- package/modern/components/image-viewer/index.css +25 -25
- package/modern/components/image-viewer/index.module.css.js +1 -1
- package/modern/components/image-viewer/slide.d.ts +1 -1
- package/modern/components/image-viewer/slide.js.map +1 -1
- package/modern/components/image-viewer/video/index.css +7 -7
- package/modern/components/image-viewer/video/index.d.ts +1 -1
- package/modern/components/image-viewer/video/index.js +60 -23
- package/modern/components/image-viewer/video/index.js.map +1 -1
- package/modern/components/image-viewer/video/index.module.css.js +1 -1
- package/modern/components/info-bar/Component.js.map +1 -1
- package/modern/components/info-bar/index.css +3 -3
- package/modern/components/info-bar/index.module.css.js +1 -1
- package/modern/components/navigation-bar/Component.js.map +1 -1
- package/modern/components/navigation-bar/index.css +8 -8
- package/modern/components/navigation-bar/index.module.css.js +1 -1
- package/modern/components/subtitles/index.css +3 -3
- package/modern/components/subtitles/index.js.map +1 -1
- package/modern/components/subtitles/index.module.css.js +1 -1
- package/modern/context.d.ts +1 -2
- package/modern/hooks/use-custom-subtitles.js.map +1 -1
- package/modern/index.css +9 -9
- package/modern/index.module.css.js +1 -1
- package/modern/types.d.ts +4 -3
- package/modern/utils/split-filename.js.map +1 -1
- package/modern/utils/utils.js.map +1 -1
- package/moderncssm/Component.d.ts +1 -1
- package/moderncssm/Component.js.map +1 -1
- package/moderncssm/components/bottom-button/Component.d.ts +1 -1
- package/moderncssm/components/bottom-button/Component.js.map +1 -1
- package/moderncssm/components/buttons/index.d.ts +1 -1
- package/moderncssm/components/buttons/index.js +1 -1
- package/moderncssm/components/buttons/index.js.map +1 -1
- package/moderncssm/components/header/Component.js.map +1 -1
- package/moderncssm/components/header-info-block/Component.d.ts +1 -1
- package/moderncssm/components/header-mobile/Component.js +3 -1
- package/moderncssm/components/header-mobile/Component.js.map +1 -1
- package/moderncssm/components/image-preview/Component.d.ts +1 -1
- package/moderncssm/components/image-preview/Component.js.map +1 -1
- package/moderncssm/components/image-viewer/component.js.map +1 -1
- package/moderncssm/components/image-viewer/hooks.d.ts +1 -1
- package/moderncssm/components/image-viewer/hooks.js.map +1 -1
- package/moderncssm/components/image-viewer/slide.d.ts +1 -1
- package/moderncssm/components/image-viewer/slide.js.map +1 -1
- package/moderncssm/components/image-viewer/video/index.d.ts +1 -1
- package/moderncssm/components/image-viewer/video/index.js +60 -23
- package/moderncssm/components/image-viewer/video/index.js.map +1 -1
- package/moderncssm/components/info-bar/Component.js.map +1 -1
- package/moderncssm/components/navigation-bar/Component.js.map +1 -1
- package/moderncssm/components/subtitles/index.js.map +1 -1
- package/moderncssm/context.d.ts +1 -2
- package/moderncssm/hooks/use-custom-subtitles.js.map +1 -1
- package/moderncssm/types.d.ts +4 -3
- package/moderncssm/utils/split-filename.js.map +1 -1
- package/moderncssm/utils/utils.js.map +1 -1
- package/package.json +11 -11
- package/src/components/buttons/index.tsx +1 -1
- package/src/components/header-mobile/Component.tsx +3 -1
- package/src/components/image-viewer/video/index.tsx +80 -24
- package/src/types.ts +1 -0
- package/types.d.ts +4 -3
- package/utils/split-filename.js.map +1 -1
- package/utils/utils.js.map +1 -1
|
@@ -12,23 +12,23 @@
|
|
|
12
12
|
:root {
|
|
13
13
|
--focus-color: var(--color-light-status-info);
|
|
14
14
|
}
|
|
15
|
-
.
|
|
15
|
+
.gallery__component_1c7ku {
|
|
16
16
|
display: flex;
|
|
17
17
|
z-index: 3;
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
transition: border 0.15s ease-in-out;
|
|
20
20
|
outline: none;
|
|
21
21
|
}
|
|
22
|
-
.
|
|
22
|
+
.gallery__component_1c7ku .gallery__image_1c7ku {
|
|
23
23
|
opacity: 0.3;
|
|
24
24
|
}
|
|
25
|
-
.
|
|
25
|
+
.gallery__component_1c7ku.gallery__mobile_1c7ku {
|
|
26
26
|
padding: 0;
|
|
27
27
|
}
|
|
28
|
-
.
|
|
28
|
+
.gallery__active_1c7ku > .gallery__image_1c7ku {
|
|
29
29
|
opacity: 1;
|
|
30
30
|
}
|
|
31
|
-
.
|
|
31
|
+
.gallery__preview_1c7ku {
|
|
32
32
|
width: 56px;
|
|
33
33
|
height: 56px;
|
|
34
34
|
flex-shrink: 0;
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
-moz-user-select: none;
|
|
39
39
|
user-select: none;
|
|
40
40
|
}
|
|
41
|
-
.
|
|
41
|
+
.gallery__preview_1c7ku.gallery__mobile_1c7ku {
|
|
42
42
|
width: 46px;
|
|
43
43
|
height: 46px;
|
|
44
44
|
border-radius: var(--border-radius-8);
|
|
45
45
|
}
|
|
46
|
-
.
|
|
46
|
+
.gallery__image_1c7ku {
|
|
47
47
|
transition: opacity 0.15s ease-in-out;
|
|
48
48
|
}
|
|
49
|
-
.
|
|
49
|
+
.gallery__image_1c7ku > img {
|
|
50
50
|
display: block;
|
|
51
51
|
width: 100%;
|
|
52
52
|
height: 100%;
|
|
@@ -56,36 +56,36 @@
|
|
|
56
56
|
overflow: clip;
|
|
57
57
|
overflow-clip-margin: border-box;
|
|
58
58
|
}
|
|
59
|
-
.
|
|
59
|
+
.gallery__image_1c7ku:hover {
|
|
60
60
|
opacity: 0.7;
|
|
61
61
|
}
|
|
62
|
-
.
|
|
62
|
+
.gallery__loading_1c7ku {
|
|
63
63
|
background-color: var(--color-static-neutral-100-inverted);
|
|
64
64
|
}
|
|
65
|
-
.
|
|
65
|
+
.gallery__loading_1c7ku .gallery__active_1c7ku {
|
|
66
66
|
background-color: var(--color-static-neutral-300-inverted);
|
|
67
67
|
}
|
|
68
|
-
.
|
|
68
|
+
.gallery__brokenImageWrapper_1c7ku {
|
|
69
69
|
display: flex;
|
|
70
70
|
justify-content: center;
|
|
71
71
|
align-items: center;
|
|
72
72
|
background-color: var(--color-static-neutral-300-inverted);
|
|
73
73
|
opacity: 0.3;
|
|
74
74
|
}
|
|
75
|
-
.
|
|
75
|
+
.gallery__brokenImageWrapper_1c7ku.gallery__active_1c7ku {
|
|
76
76
|
opacity: 1;
|
|
77
77
|
}
|
|
78
|
-
.
|
|
78
|
+
.gallery__brokenIcon_1c7ku {
|
|
79
79
|
width: 40px;
|
|
80
80
|
height: 40px;
|
|
81
81
|
}
|
|
82
|
-
.
|
|
82
|
+
.gallery__focused_1c7ku {
|
|
83
83
|
outline: 2px solid var(--focus-color);
|
|
84
84
|
outline-offset: 2px;
|
|
85
85
|
}
|
|
86
|
-
.
|
|
86
|
+
.gallery__canvasPreview_1c7ku {
|
|
87
87
|
border-radius: var(--border-radius-12);
|
|
88
88
|
}
|
|
89
|
-
.
|
|
89
|
+
.gallery__canvasPreview_1c7ku.gallery__mobile_1c7ku {
|
|
90
90
|
border-radius: var(--border-radius-8);
|
|
91
91
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"component":"
|
|
3
|
+
const styles = {"component":"gallery__component_1c7ku","image":"gallery__image_1c7ku","mobile":"gallery__mobile_1c7ku","active":"gallery__active_1c7ku","preview":"gallery__preview_1c7ku","loading":"gallery__loading_1c7ku","brokenImageWrapper":"gallery__brokenImageWrapper_1c7ku","brokenIcon":"gallery__brokenIcon_1c7ku","focused":"gallery__focused_1c7ku","canvasPreview":"gallery__canvasPreview_1c7ku"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/image-viewer/component.tsx"],"sourcesContent":["import React, { type FC, type KeyboardEventHandler, useCallback, useContext, useMemo } from 'react';\nimport cn from 'classnames';\nimport SwiperCore, { A11y, Controller, EffectFade } from 'swiper';\nimport { Swiper, SwiperSlide } from 'swiper/react';\n\nimport { useFocus } from '@alfalab/hooks';\nimport { ChevronBackHeavyMIcon } from '@alfalab/icons-glyph/ChevronBackHeavyMIcon';\nimport { ChevronForwardHeavyMIcon } from '@alfalab/icons-glyph/ChevronForwardHeavyMIcon';\n\nimport { GalleryContext } from '../../context';\nimport { getImageAlt, getImageKey, isVideo, TestIds } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { Slide } from './slide';\n\nimport 'swiper/swiper.min.css';\nimport styles from './index.module.css';\n\nSwiperCore.use([EffectFade, A11y, Controller]);\n\nexport const ImageViewer: FC = () => {\n const {\n images,\n imagesMeta,\n fullScreen,\n currentSlideIndex,\n initialSlide,\n setCurrentSlideIndex,\n getSwiper,\n setSwiper,\n slidePrev,\n slideNext,\n getCurrentImage,\n } = useContext(GalleryContext);\n\n const { handleWrapperClick, isMobile, rightArrowRef, leftArrowRef } = useHandleImageViewer();\n\n const [leftArrowFocused] = useFocus(leftArrowRef, 'keyboard');\n const [rightArrowFocused] = useFocus(rightArrowRef, 'keyboard');\n\n const swiper = getSwiper();\n const currentImage = getCurrentImage();\n\n const handleSlideChange = useCallback(() => {\n setCurrentSlideIndex?.(swiper?.activeIndex ?? initialSlide);\n }, [setCurrentSlideIndex, swiper, initialSlide]);\n\n const handlePrevClick = () => {\n slidePrev();\n };\n\n const handleNextClick = () => {\n slideNext();\n };\n\n const handleArrowLeftKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === 'Enter') {\n slidePrev();\n }\n };\n\n const handleArrowRightKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === 'Enter') {\n slideNext();\n }\n };\n\n const swiperProps = useMemo<Swiper>(\n () => ({\n slidesPerView: 1,\n effect: 'slide',\n className: cn(styles.swiper, {\n [styles.hidden]: fullScreen && !isVideo(currentImage?.src),\n [styles.fullScreenVideo]: fullScreen && isVideo(currentImage?.src),\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n }),\n controller: { control: swiper },\n a11y: {\n slideRole: 'img',\n },\n initialSlide,\n simulateTouch: false,\n zoom: { maxRatio: 4, minRatio: 1, toggle: true },\n onSwiper: setSwiper,\n onSlideChange: handleSlideChange,\n lazy: { loadPrevNext: true },\n }),\n [\n fullScreen,\n currentImage?.src,\n isMobile,\n swiper,\n initialSlide,\n setSwiper,\n handleSlideChange,\n ],\n );\n\n const showControls = !fullScreen && !isMobile && !!images.length;\n\n const swiperWidth = swiper?.width || 1;\n const swiperHeight = swiper?.height || swiper?.width || 1;\n\n const swiperAspectRatio = swiperWidth / swiperHeight;\n\n return (\n <div\n className={cn(styles.component, {\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n })}\n aria-hidden={true}\n onClick={handleWrapperClick}\n >\n {showControls && (\n <div\n className={cn(styles.arrow, {\n [styles.focused]: leftArrowFocused,\n })}\n onClick={handlePrevClick}\n role='button'\n onKeyDown={handleArrowLeftKeyDown}\n tabIndex={0}\n ref={leftArrowRef}\n aria-label='Предыдущее изображение'\n data-test-id={TestIds.PREV_SLIDE_BUTTON}\n >\n <ChevronBackHeavyMIcon />\n </div>\n )}\n\n {fullScreen && !isVideo(currentImage?.src) && (\n <img\n src={currentImage?.src}\n alt={currentImage ? getImageAlt(currentImage, currentSlideIndex) : ''}\n className={styles.fullScreenImage}\n />\n )}\n\n <Swiper {...swiperProps}>\n {images.map((image, index) => {\n const meta = imagesMeta[index];\n\n const imageWidth = meta?.width || 1;\n const imageHeight = meta?.height || 1;\n\n const imageAspectRatio = imageWidth / imageHeight;\n\n const slideVisible = index === currentSlideIndex;\n\n return (\n <SwiperSlide\n key={getImageKey(image, index)}\n style={{\n pointerEvents: slideVisible ? 'auto' : 'none',\n transitionProperty: 'opacity',\n }}\n >\n {({ isActive }) => (\n <Slide\n isActive={isActive}\n containerAspectRatio={swiperAspectRatio}\n image={image}\n containerHeight={swiperHeight}\n meta={meta}\n index={index}\n imageAspectRatio={imageAspectRatio}\n slideVisible={slideVisible}\n />\n )}\n </SwiperSlide>\n );\n })}\n </Swiper>\n\n {showControls && (\n <div\n className={cn(styles.arrow, {\n [styles.focused]: rightArrowFocused,\n })}\n onClick={handleNextClick}\n role='button'\n onKeyDown={handleArrowRightKeyDown}\n tabIndex={0}\n ref={rightArrowRef}\n aria-label='Следующее изображение'\n data-test-id={TestIds.NEXT_SLIDE_BUTTON}\n >\n <ChevronForwardHeavyMIcon />\n </div>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAkBA,UAAU,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAEvC,MAAM,WAAW,GAAO,MAAK;AAChC,IAAA,MAAM,EACF,MAAM,EACN,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,oBAAoB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,MAAM,YAAY,GAAG,KAAK,KAAK,iBAAiB;AAEhD,YAAA,QACI,KAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EACR,GAAG,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9B,KAAK,EAAE;oBACH,aAAa,EAAE,YAAY,GAAG,MAAM,GAAG,MAAM;AAC7C,oBAAA,kBAAkB,EAAE,SAAS;iBAChC,EAEA,EAAA,CAAC,EAAE,QAAQ,EAAE,MACV,KAAC,CAAA,aAAA,CAAA,KAAK,IACF,QAAQ,EAAE,QAAQ,EAClB,oBAAoB,EAAE,iBAAiB,EACvC,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,YAAY,EAC5B,CAAA,CACL,CACS;AAEtB,SAAC,CAAC,CACG;QAER,YAAY,KACT,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;AACxB,gBAAA,CAAC,MAAM,CAAC,OAAO,GAAG,iBAAiB;aACtC,CAAC,EACF,OAAO,EAAE,eAAe,EACxB,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,uBAAuB,EAClC,QAAQ,EAAE,CAAC,EACX,GAAG,EAAE,aAAa,EAAA,YAAA,EACP,2HAAuB,EAAA,cAAA,EACpB,OAAO,CAAC,iBAAiB,EAAA;AAEvC,YAAA,KAAA,CAAA,aAAA,CAAC,wBAAwB,EAAG,IAAA,CAAA,CAC1B,CACT,CACC;AAEd;;;;"}
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/image-viewer/component.tsx"],"sourcesContent":["import React, { type FC, type KeyboardEventHandler, useCallback, useContext, useMemo } from 'react';\nimport cn from 'classnames';\nimport SwiperCore, { A11y, Controller, EffectFade } from 'swiper';\nimport { Swiper, SwiperSlide } from 'swiper/react';\n\nimport { useFocus } from '@alfalab/hooks';\nimport { ChevronBackHeavyMIcon } from '@alfalab/icons-glyph/ChevronBackHeavyMIcon';\nimport { ChevronForwardHeavyMIcon } from '@alfalab/icons-glyph/ChevronForwardHeavyMIcon';\n\nimport { GalleryContext } from '../../context';\nimport { getImageAlt, getImageKey, isVideo, TestIds } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { Slide } from './slide';\n\nimport 'swiper/swiper.min.css';\nimport styles from './index.module.css';\n\nSwiperCore.use([EffectFade, A11y, Controller]);\n\nexport const ImageViewer: FC = () => {\n const {\n images,\n imagesMeta,\n fullScreen,\n currentSlideIndex,\n initialSlide,\n setCurrentSlideIndex,\n getSwiper,\n setSwiper,\n slidePrev,\n slideNext,\n getCurrentImage,\n } = useContext(GalleryContext);\n\n const { handleWrapperClick, isMobile, rightArrowRef, leftArrowRef } = useHandleImageViewer();\n\n const [leftArrowFocused] = useFocus(leftArrowRef, 'keyboard');\n const [rightArrowFocused] = useFocus(rightArrowRef, 'keyboard');\n\n const swiper = getSwiper();\n const currentImage = getCurrentImage();\n\n const handleSlideChange = useCallback(() => {\n setCurrentSlideIndex?.(swiper?.activeIndex ?? initialSlide);\n }, [setCurrentSlideIndex, swiper, initialSlide]);\n\n const handlePrevClick = () => {\n slidePrev();\n };\n\n const handleNextClick = () => {\n slideNext();\n };\n\n const handleArrowLeftKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === 'Enter') {\n slidePrev();\n }\n };\n\n const handleArrowRightKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === 'Enter') {\n slideNext();\n }\n };\n\n const swiperProps = useMemo<Swiper>(\n () => ({\n slidesPerView: 1,\n effect: 'slide',\n className: cn(styles.swiper, {\n [styles.hidden]: fullScreen && !isVideo(currentImage?.src),\n [styles.fullScreenVideo]: fullScreen && isVideo(currentImage?.src),\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n }),\n controller: { control: swiper },\n a11y: {\n slideRole: 'img',\n },\n initialSlide,\n simulateTouch: false,\n zoom: { maxRatio: 4, minRatio: 1, toggle: true },\n onSwiper: setSwiper,\n onSlideChange: handleSlideChange,\n lazy: { loadPrevNext: true },\n }),\n [\n fullScreen,\n currentImage?.src,\n isMobile,\n swiper,\n initialSlide,\n setSwiper,\n handleSlideChange,\n ],\n );\n\n const showControls = !fullScreen && !isMobile && !!images.length;\n\n const swiperWidth = swiper?.width || 1;\n const swiperHeight = swiper?.height || swiper?.width || 1;\n\n const swiperAspectRatio = swiperWidth / swiperHeight;\n\n return (\n <div\n className={cn(styles.component, {\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n })}\n aria-hidden={true}\n onClick={handleWrapperClick}\n >\n {showControls && (\n <div\n className={cn(styles.arrow, {\n [styles.focused]: leftArrowFocused,\n })}\n onClick={handlePrevClick}\n role='button'\n onKeyDown={handleArrowLeftKeyDown}\n tabIndex={0}\n ref={leftArrowRef}\n aria-label='Предыдущее изображение'\n data-test-id={TestIds.PREV_SLIDE_BUTTON}\n >\n <ChevronBackHeavyMIcon />\n </div>\n )}\n\n {fullScreen && !isVideo(currentImage?.src) && (\n <img\n src={currentImage?.src}\n alt={currentImage ? getImageAlt(currentImage, currentSlideIndex) : ''}\n className={styles.fullScreenImage}\n />\n )}\n\n <Swiper {...swiperProps}>\n {images.map((image, index) => {\n const meta = imagesMeta[index];\n\n const imageWidth = meta?.width || 1;\n const imageHeight = meta?.height || 1;\n\n const imageAspectRatio = imageWidth / imageHeight;\n\n const slideVisible = index === currentSlideIndex;\n\n return (\n <SwiperSlide\n key={getImageKey(image, index)}\n style={{\n pointerEvents: slideVisible ? 'auto' : 'none',\n transitionProperty: 'opacity',\n }}\n >\n {({ isActive }) => (\n <Slide\n isActive={isActive}\n containerAspectRatio={swiperAspectRatio}\n image={image}\n containerHeight={swiperHeight}\n meta={meta}\n index={index}\n imageAspectRatio={imageAspectRatio}\n slideVisible={slideVisible}\n />\n )}\n </SwiperSlide>\n );\n })}\n </Swiper>\n\n {showControls && (\n <div\n className={cn(styles.arrow, {\n [styles.focused]: rightArrowFocused,\n })}\n onClick={handleNextClick}\n role='button'\n onKeyDown={handleArrowRightKeyDown}\n tabIndex={0}\n ref={rightArrowRef}\n aria-label='Следующее изображение'\n data-test-id={TestIds.NEXT_SLIDE_BUTTON}\n >\n <ChevronForwardHeavyMIcon />\n </div>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAkBA,UAAU,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAEvC,MAAM,WAAW,GAAO,MAAK;AAChC,IAAA,MAAM,EACF,MAAM,EACN,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,eAAe,GAClB,GAAG,UAAU,CAAC,cAAc,CAAC;AAE9B,IAAA,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,oBAAoB,EAAE;IAE5F,MAAM,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;IAC7D,MAAM,CAAC,iBAAiB,CAAC,GAAG,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;AAE/D,IAAA,MAAM,MAAM,GAAG,SAAS,EAAE;AAC1B,IAAA,MAAM,YAAY,GAAG,eAAe,EAAE;AAEtC,IAAA,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAK;QACvC,oBAAoB,GAAG,MAAM,EAAE,WAAW,IAAI,YAAY,CAAC;KAC9D,EAAE,CAAC,oBAAoB,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IAEhD,MAAM,eAAe,GAAG,MAAK;AACzB,QAAA,SAAS,EAAE;AACf,KAAC;IAED,MAAM,eAAe,GAAG,MAAK;AACzB,QAAA,SAA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AAO,GAAG,iBAAiB;aACtC,CAAC,EACF,OAAO,EAAE,eAAe,EACxB,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,uBAAuB,EAClC,QAAQ,EAAE,CAAC,EACX,GAAG,EAAE,aAAa,EAAA,YAAA,EACP,2HAAuB,EAAA,cAAA,EACpB,OAAO,CAAC,iBAAiB,EAAA;AAEvC,YAAA,KAAA,CAAA,aAAA,CAAC,wBAAwB,EAAG,IAAA,CAAA,CAC1B,CACT,CACC;AAEd;;;;"}
|
|
@@ -2,7 +2,7 @@ import { type MouseEventHandler, type SyntheticEvent } from 'react';
|
|
|
2
2
|
export declare const useHandleImageViewer: () => {
|
|
3
3
|
handleLoad: (event: SyntheticEvent<HTMLImageElement>, index: number) => void;
|
|
4
4
|
handleLoadError: (index: number) => void;
|
|
5
|
-
handleWrapperClick: MouseEventHandler
|
|
5
|
+
handleWrapperClick: MouseEventHandler;
|
|
6
6
|
isMobile: boolean;
|
|
7
7
|
leftArrowRef: import("react").RefObject<HTMLDivElement>;
|
|
8
8
|
rightArrowRef: import("react").RefObject<HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":["../../../src/components/image-viewer/hooks.ts"],"sourcesContent":["import {\n type MouseEventHandler,\n type SyntheticEvent,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport elementClosest from 'element-closest';\n\nimport { GalleryContext } from '../../context';\n\nimport styles from './index.module.css';\n\nexport const useHandleImageViewer = () => {\n const { view, onClose, setImageMeta } = useContext(GalleryContext);\n\n const leftArrowRef = useRef<HTMLDivElement>(null);\n const rightArrowRef = useRef<HTMLDivElement>(null);\n\n const isMobile = view === 'mobile';\n\n const handleLoad = (event: SyntheticEvent<HTMLImageElement>, index: number) => {\n const target = event.currentTarget;\n\n const { naturalWidth, naturalHeight } = target;\n\n setImageMeta({ width: naturalWidth, height: naturalHeight }, index);\n };\n\n const handleLoadError = (index: number) => {\n setImageMeta({ width: 0, height: 0, broken: true }, index);\n };\n\n const handleWrapperClick = useCallback<MouseEventHandler>(\n (event) => {\n const eventTarget = event.target as HTMLElement;\n\n const isArrow =\n leftArrowRef.current?.contains(eventTarget) ||\n rightArrowRef.current?.contains(eventTarget);\n\n const isPlaceholder = Boolean(eventTarget.closest(`.${styles.placeholder}`));\n\n const isImg = eventTarget.tagName === 'IMG';\n\n if (!isImg && !isPlaceholder && !isArrow && !isMobile) {\n onClose();\n }\n },\n [isMobile, onClose],\n );\n\n useEffect(() => {\n elementClosest(window);\n }, []);\n\n return {\n handleLoad,\n handleLoadError,\n handleWrapperClick,\n isMobile,\n leftArrowRef,\n rightArrowRef,\n };\n};\n"],"names":[],"mappings":";;;;;AAcO,MAAM,oBAAoB,GAAG,MAAK;AACrC,IAAA,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC;AAElE,IAAA,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC;AACjD,IAAA,MAAM,aAAa,GAAG,MAAM,CAAiB,IAAI,CAAC;AAElD,IAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,QAAQ;AAElC,IAAA,MAAM,UAAU,GAAG,CAAC,KAAuC,EAAE,KAAa,KAAI;AAC1E,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa;AAElC,QAAA,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,MAAM;AAE9C,QAAA,YAAY,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC;AACvE,KAAC;AAED,IAAA,MAAM,eAAe,GAAG,CAAC,KAAa,KAAI;AACtC,QAAA,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC;AAC9D,KAAC;AAED,IAAA,MAAM,kBAAkB,GAAG,WAAW,CAClC,CAAC,KAAK,KAAI;AACN,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAqB;QAE/C,MAAM,OAAO,GACT,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC;AAC3C,YAAA,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC;AAEhD,QAAA,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA,CAAA,EAAI,MAAM,CAAC,WAAW,CAAE,CAAA,CAAC,CAAC;AAE5E,QAAA,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,KAAK,KAAK;
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":["../../../src/components/image-viewer/hooks.ts"],"sourcesContent":["import {\n type MouseEventHandler,\n type SyntheticEvent,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport elementClosest from 'element-closest';\n\nimport { GalleryContext } from '../../context';\n\nimport styles from './index.module.css';\n\nexport const useHandleImageViewer = () => {\n const { view, onClose, setImageMeta } = useContext(GalleryContext);\n\n const leftArrowRef = useRef<HTMLDivElement>(null);\n const rightArrowRef = useRef<HTMLDivElement>(null);\n\n const isMobile = view === 'mobile';\n\n const handleLoad = (event: SyntheticEvent<HTMLImageElement>, index: number) => {\n const target = event.currentTarget;\n\n const { naturalWidth, naturalHeight } = target;\n\n setImageMeta({ width: naturalWidth, height: naturalHeight }, index);\n };\n\n const handleLoadError = (index: number) => {\n setImageMeta({ width: 0, height: 0, broken: true }, index);\n };\n\n const handleWrapperClick = useCallback<MouseEventHandler>(\n (event) => {\n const eventTarget = event.target as HTMLElement;\n\n const isArrow =\n leftArrowRef.current?.contains(eventTarget) ||\n rightArrowRef.current?.contains(eventTarget);\n\n const isPlaceholder = Boolean(eventTarget.closest(`.${styles.placeholder}`));\n\n const isImg = eventTarget.tagName === 'IMG';\n\n if (!isImg && !isPlaceholder && !isArrow && !isMobile) {\n onClose();\n }\n },\n [isMobile, onClose],\n );\n\n useEffect(() => {\n elementClosest(window);\n }, []);\n\n return {\n handleLoad,\n handleLoadError,\n handleWrapperClick,\n isMobile,\n leftArrowRef,\n rightArrowRef,\n };\n};\n"],"names":[],"mappings":";;;;;AAcO,MAAM,oBAAoB,GAAG,MAAK;AACrC,IAAA,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC;AAElE,IAAA,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC;AACjD,IAAA,MAAM,aAAa,GAAG,MAAM,CAAiB,IAAI,CAAC;AAElD,IAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,QAAQ;AAElC,IAAA,MAAM,UAAU,GAAG,CAAC,KAAuC,EAAE,KAAa,KAAI;AAC1E,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa;AAElC,QAAA,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,MAAM;AAE9C,QAAA,YAAY,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,KAAK,CAAC;AACvE,KAAC;AAED,IAAA,MAAM,eAAe,GAAG,CAAC,KAAa,KAAI;AACtC,QAAA,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC;AAC9D,KAAC;AAED,IAAA,MAAM,kBAAkB,GAAG,WAAW,CAClC,CAAC,KAAK,KAAI;AACN,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAqB;QAE/C,MAAM,OAAO,GACT,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC;AAC3C,YAAA,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC;AAEhD,QAAA,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA,CAAA,EAAI,MAAM,CAAC,WAAW,CAAE,CAAA,CAAC,CAAC;AAE5E,QAAA,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,KAAK,KAAK;AAE3C,QAAA,IAAI,CAAC,KAAK,IAAI,CAAC,aAAa,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE;AACnD,YAAA,OAAO,EAAE;;AAEjB,KAAC,EACD,CAAC,QAAQ,EAAE,OAAO,CAAC,CACtB;IAED,SAAS,CAAC,MAAK;QACX,cAAc,CAAC,MAAM,CAAC;KACzB,EAAE,EAAE,CAAC;IAEN,OAAO;QACH,UAAU;QACV,eAAe;QACf,kBAAkB;QAClB,QAAQ;QACR,YAAY;QACZ,aAAa;KAChB;AACL;;;;"}
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
:root {
|
|
25
25
|
--focus-color: var(--color-light-status-info);
|
|
26
26
|
}
|
|
27
|
-
.
|
|
27
|
+
.gallery__component_zqqzx {
|
|
28
28
|
display: flex;
|
|
29
29
|
flex-grow: 1;
|
|
30
30
|
justify-content: center;
|
|
31
31
|
background-color: var(--color-static-neutral-0-inverted);
|
|
32
32
|
}
|
|
33
|
-
.
|
|
33
|
+
.gallery__swiper_zqqzx {
|
|
34
34
|
display: flex;
|
|
35
35
|
width: 100%;
|
|
36
36
|
height: 100%;
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
padding: var(--gap-32) var(--gap-16);
|
|
39
39
|
box-sizing: border-box;
|
|
40
40
|
}
|
|
41
|
-
.
|
|
41
|
+
.gallery__swiper_zqqzx.gallery__mobile_zqqzx {
|
|
42
42
|
max-height: calc(100vh - 210px);
|
|
43
43
|
}
|
|
44
|
-
.
|
|
44
|
+
.gallery__swiper_zqqzx.gallery__mobileVideo_zqqzx {
|
|
45
45
|
max-height: 100vh;
|
|
46
46
|
}
|
|
47
|
-
.
|
|
47
|
+
.gallery__singleSlideContainer_zqqzx {
|
|
48
48
|
display: flex;
|
|
49
49
|
width: 100%;
|
|
50
50
|
height: 100%;
|
|
@@ -53,17 +53,17 @@
|
|
|
53
53
|
padding: var(--gap-32);
|
|
54
54
|
box-sizing: border-box;
|
|
55
55
|
}
|
|
56
|
-
.
|
|
56
|
+
.gallery__singleSlideContainer_zqqzx.gallery__mobile_zqqzx {
|
|
57
57
|
max-height: calc(100vh - 174px);
|
|
58
58
|
padding: 0;
|
|
59
59
|
}
|
|
60
|
-
.
|
|
60
|
+
.gallery__singleSlideContainer_zqqzx.gallery__mobileVideo_zqqzx {
|
|
61
61
|
max-height: 100vh;
|
|
62
62
|
}
|
|
63
|
-
.
|
|
63
|
+
.gallery__hidden_zqqzx {
|
|
64
64
|
display: none;
|
|
65
65
|
}
|
|
66
|
-
.
|
|
66
|
+
.gallery__slide_zqqzx {
|
|
67
67
|
position: relative;
|
|
68
68
|
display: flex;
|
|
69
69
|
justify-content: center;
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
width: 100%;
|
|
72
72
|
height: 100%;
|
|
73
73
|
}
|
|
74
|
-
.
|
|
74
|
+
.gallery__slideLoading_zqqzx {
|
|
75
75
|
background-color: var(--color-static-neutral-translucent-100-inverted);
|
|
76
76
|
border-radius: var(--border-radius-8);
|
|
77
77
|
}
|
|
78
|
-
.
|
|
78
|
+
.gallery__spinner_zqqzx {
|
|
79
79
|
position: absolute;
|
|
80
80
|
color: var(--color-static-neutral-translucent-1300-inverted);
|
|
81
81
|
}
|
|
82
|
-
.
|
|
82
|
+
.gallery__image_zqqzx {
|
|
83
83
|
width: 0;
|
|
84
84
|
height: 0;
|
|
85
85
|
-webkit-user-select: none;
|
|
@@ -87,10 +87,10 @@
|
|
|
87
87
|
user-select: none;
|
|
88
88
|
border-radius: var(--border-radius-8);
|
|
89
89
|
}
|
|
90
|
-
.
|
|
90
|
+
.gallery__image_zqqzx.gallery__mobile_zqqzx {
|
|
91
91
|
border-radius: var(--border-radius-0);
|
|
92
92
|
}
|
|
93
|
-
.
|
|
93
|
+
.gallery__smallImage_zqqzx {
|
|
94
94
|
position: relative;
|
|
95
95
|
width: auto;
|
|
96
96
|
height: auto;
|
|
@@ -98,15 +98,15 @@
|
|
|
98
98
|
-moz-user-select: none;
|
|
99
99
|
user-select: none;
|
|
100
100
|
}
|
|
101
|
-
.
|
|
101
|
+
.gallery__verticalImageFit_zqqzx {
|
|
102
102
|
width: auto;
|
|
103
103
|
height: 100%;
|
|
104
104
|
}
|
|
105
|
-
.
|
|
105
|
+
.gallery__horizontalImageFit_zqqzx {
|
|
106
106
|
width: 100%;
|
|
107
107
|
height: auto;
|
|
108
108
|
}
|
|
109
|
-
.
|
|
109
|
+
.gallery__arrow_zqqzx {
|
|
110
110
|
display: flex;
|
|
111
111
|
flex-direction: column;
|
|
112
112
|
justify-content: center;
|
|
@@ -119,17 +119,17 @@
|
|
|
119
119
|
transition: background-color 0.15s ease-in-out;
|
|
120
120
|
outline: none;
|
|
121
121
|
}
|
|
122
|
-
.
|
|
122
|
+
.gallery__arrow_zqqzx:hover {
|
|
123
123
|
background-color: var(--color-static-neutral-0-inverted-hover);
|
|
124
124
|
}
|
|
125
|
-
.
|
|
125
|
+
.gallery__arrow_zqqzx:active {
|
|
126
126
|
background-color: var(--color-static-neutral-0-inverted-press);
|
|
127
127
|
}
|
|
128
|
-
.
|
|
128
|
+
.gallery__focused_zqqzx {
|
|
129
129
|
outline: 2px solid var(--focus-color);
|
|
130
130
|
outline-offset: 2px;
|
|
131
131
|
}
|
|
132
|
-
.
|
|
132
|
+
.gallery__placeholder_zqqzx {
|
|
133
133
|
display: flex;
|
|
134
134
|
justify-content: center;
|
|
135
135
|
align-items: center;
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
border-radius: var(--border-radius-8);
|
|
139
139
|
background-color: var(--color-static-neutral-300-inverted);
|
|
140
140
|
}
|
|
141
|
-
.
|
|
141
|
+
.gallery__brokenImgWrapper_zqqzx {
|
|
142
142
|
position: relative;
|
|
143
143
|
display: flex;
|
|
144
144
|
flex-direction: column;
|
|
@@ -146,17 +146,17 @@
|
|
|
146
146
|
width: 150px;
|
|
147
147
|
text-align: center;
|
|
148
148
|
}
|
|
149
|
-
.
|
|
149
|
+
.gallery__brokenImgIcon_zqqzx {
|
|
150
150
|
width: 80px;
|
|
151
151
|
height: 80px;
|
|
152
152
|
margin-bottom: var(--gap-4);
|
|
153
153
|
}
|
|
154
|
-
.
|
|
154
|
+
.gallery__fullScreenImage_zqqzx {
|
|
155
155
|
width: 100%;
|
|
156
156
|
height: auto;
|
|
157
157
|
background-color: var(--color-light-base-bg-primary);
|
|
158
158
|
}
|
|
159
|
-
.
|
|
159
|
+
.gallery__fullScreenVideo_zqqzx {
|
|
160
160
|
width: calc(100% - 192px);
|
|
161
161
|
max-height: calc(100vh - 82px);
|
|
162
162
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"component":"
|
|
3
|
+
const styles = {"component":"gallery__component_zqqzx","swiper":"gallery__swiper_zqqzx","mobile":"gallery__mobile_zqqzx","mobileVideo":"gallery__mobileVideo_zqqzx","singleSlideContainer":"gallery__singleSlideContainer_zqqzx","hidden":"gallery__hidden_zqqzx","slide":"gallery__slide_zqqzx","slideLoading":"gallery__slideLoading_zqqzx","spinner":"gallery__spinner_zqqzx","image":"gallery__image_zqqzx","smallImage":"gallery__smallImage_zqqzx","verticalImageFit":"gallery__verticalImageFit_zqqzx","horizontalImageFit":"gallery__horizontalImageFit_zqqzx","arrow":"gallery__arrow_zqqzx","focused":"gallery__focused_zqqzx","placeholder":"gallery__placeholder_zqqzx","brokenImgWrapper":"gallery__brokenImgWrapper_zqqzx","brokenImgIcon":"gallery__brokenImgIcon_zqqzx","fullScreenImage":"gallery__fullScreenImage_zqqzx","fullScreenVideo":"gallery__fullScreenVideo_zqqzx"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide.js","sources":["../../../src/components/image-viewer/slide.tsx"],"sourcesContent":["import React, { type FC, type ReactNode, useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Spinner } from '@alfalab/core-components-spinner';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { GalleryContext } from '../../context';\nimport { type GalleryImage, type ImageMeta } from '../../types';\nimport { getImageAlt, isSmallImage, isVideo, TestIds } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { NoImagePaths } from './paths';\nimport { Video } from './video';\n\nimport styles from './index.module.css';\n\ntype SlideInnerProps = {\n active: boolean;\n broken: boolean;\n loading: boolean;\n children: ReactNode;\n isVideoView?: boolean;\n};\n\nconst SlideInner: FC<SlideInnerProps> = ({ children, broken, loading, isVideoView }) => {\n const content = broken ? (\n <div className={styles.brokenImgWrapper}>\n <div className={styles.brokenImgIcon}>\n <svg\n xmlns='http://www.w3.org/2000/svg'\n width='80'\n height='80'\n viewBox='0 0 80 80'\n fill='none'\n >\n <rect width='80' height='80' fill='none' />\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n d={NoImagePaths.baseImage}\n fill='#89898A'\n />\n <path d={NoImagePaths.triangleImage} fill='#89898A' />\n </svg>\n </div>\n\n <TypographyText view='primary-small' color='static-secondary-light'>\n Не удалось загрузить {isVideoView ? 'видео' : 'изображение'}\n </TypographyText>\n </div>\n ) : (\n children\n );\n\n return (\n <div className={cn(styles.slide, { [styles.slideLoading]: loading })}>\n {broken ? <div className={styles.placeholder}>{content}</div> : content}\n <Spinner className={styles.spinner} preset={48} visible={loading} />\n </div>\n );\n};\n\ntype SlideProps = {\n isActive: boolean;\n image: GalleryImage;\n meta?: ImageMeta;\n containerAspectRatio: number;\n imageAspectRatio: number;\n index: number;\n containerHeight: number;\n slideVisible: boolean;\n};\n\nexport const Slide: FC<SlideProps> = ({\n isActive,\n meta,\n containerAspectRatio,\n imageAspectRatio,\n image,\n index,\n containerHeight,\n slideVisible,\n}) => {\n const { view } = useContext(GalleryContext);\n const { handleLoad, handleLoadError } = useHandleImageViewer();\n\n const broken = Boolean(meta?.broken);\n const small = isSmallImage(meta);\n const verticalImageFit = !small && containerAspectRatio > imageAspectRatio;\n const horizontalImageFit = !small && containerAspectRatio <= imageAspectRatio;\n\n if (isVideo(image.src)) {\n return (\n <SlideInner isVideoView={true} active={isActive} broken={broken} loading={!meta}>\n <Video url={image.src} index={index} isActive={isActive} />\n </SlideInner>\n );\n }\n\n return (\n <SlideInner active={isActive} broken={broken} loading={!meta}>\n <img\n src={image.src}\n alt={getImageAlt(image, index)}\n className={cn({\n [styles.smallImage]: small,\n [styles.image]: !small && meta,\n [styles.mobile]: view === 'mobile',\n [styles.verticalImageFit]: verticalImageFit,\n [styles.horizontalImageFit]: horizontalImageFit,\n })}\n onLoad={(event) => handleLoad(event, index)}\n onError={() => handleLoadError(index)}\n style={{\n maxHeight: `${containerHeight}px`,\n }}\n data-test-id={slideVisible ? TestIds.ACTIVE_IMAGE : undefined}\n />\n </SlideInner>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBA,MAAM,UAAU,GAAwB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,KAAI;AACnF,IAAA,MAAM,OAAO,GAAG,MAAM,IAClB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAAA;AACnC,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA;AAChC,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EAAA;gBAEX,KAAM,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAG,CAAA;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CAAC;AACpC,IAAA,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC;IAChC,MAAM,gBAAgB,GAAG,CAAC,KAAK,IAAI,oBAAoB,GAAG,gBAAgB;IAC1E,MAAM,kBAAkB,GAAG,CAAC,KAAK,IAAI,oBAAoB,IAAI,gBAAgB;AAE7E,IAAA,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;AACpB,QAAA,QACI,KAAC,CAAA,aAAA,CAAA,UAAU,IAAC,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAA;AAC3E,YAAA,KAAA,CAAA,aAAA,CAAC,KAAK,EAAC,EAAA,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAI,CAAA,CAClD
|
|
1
|
+
{"version":3,"file":"slide.js","sources":["../../../src/components/image-viewer/slide.tsx"],"sourcesContent":["import React, { type FC, type ReactNode, useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Spinner } from '@alfalab/core-components-spinner';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { GalleryContext } from '../../context';\nimport { type GalleryImage, type ImageMeta } from '../../types';\nimport { getImageAlt, isSmallImage, isVideo, TestIds } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { NoImagePaths } from './paths';\nimport { Video } from './video';\n\nimport styles from './index.module.css';\n\ntype SlideInnerProps = {\n active: boolean;\n broken: boolean;\n loading: boolean;\n children: ReactNode;\n isVideoView?: boolean;\n};\n\nconst SlideInner: FC<SlideInnerProps> = ({ children, broken, loading, isVideoView }) => {\n const content = broken ? (\n <div className={styles.brokenImgWrapper}>\n <div className={styles.brokenImgIcon}>\n <svg\n xmlns='http://www.w3.org/2000/svg'\n width='80'\n height='80'\n viewBox='0 0 80 80'\n fill='none'\n >\n <rect width='80' height='80' fill='none' />\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n d={NoImagePaths.baseImage}\n fill='#89898A'\n />\n <path d={NoImagePaths.triangleImage} fill='#89898A' />\n </svg>\n </div>\n\n <TypographyText view='primary-small' color='static-secondary-light'>\n Не удалось загрузить {isVideoView ? 'видео' : 'изображение'}\n </TypographyText>\n </div>\n ) : (\n children\n );\n\n return (\n <div className={cn(styles.slide, { [styles.slideLoading]: loading })}>\n {broken ? <div className={styles.placeholder}>{content}</div> : content}\n <Spinner className={styles.spinner} preset={48} visible={loading} />\n </div>\n );\n};\n\ntype SlideProps = {\n isActive: boolean;\n image: GalleryImage;\n meta?: ImageMeta;\n containerAspectRatio: number;\n imageAspectRatio: number;\n index: number;\n containerHeight: number;\n slideVisible: boolean;\n};\n\nexport const Slide: FC<SlideProps> = ({\n isActive,\n meta,\n containerAspectRatio,\n imageAspectRatio,\n image,\n index,\n containerHeight,\n slideVisible,\n}) => {\n const { view } = useContext(GalleryContext);\n const { handleLoad, handleLoadError } = useHandleImageViewer();\n\n const broken = Boolean(meta?.broken);\n const small = isSmallImage(meta);\n const verticalImageFit = !small && containerAspectRatio > imageAspectRatio;\n const horizontalImageFit = !small && containerAspectRatio <= imageAspectRatio;\n\n if (isVideo(image.src)) {\n return (\n <SlideInner isVideoView={true} active={isActive} broken={broken} loading={!meta}>\n <Video url={image.src} index={index} isActive={isActive} />\n </SlideInner>\n );\n }\n\n return (\n <SlideInner active={isActive} broken={broken} loading={!meta}>\n <img\n src={image.src}\n alt={getImageAlt(image, index)}\n className={cn({\n [styles.smallImage]: small,\n [styles.image]: !small && meta,\n [styles.mobile]: view === 'mobile',\n [styles.verticalImageFit]: verticalImageFit,\n [styles.horizontalImageFit]: horizontalImageFit,\n })}\n onLoad={(event) => handleLoad(event, index)}\n onError={() => handleLoadError(index)}\n style={{\n maxHeight: `${containerHeight}px`,\n }}\n data-test-id={slideVisible ? TestIds.ACTIVE_IMAGE : undefined}\n />\n </SlideInner>\n );\n};\n"],"names":[],"mappings":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,UAAU,EAAA,EAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAA;AACxD,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,GAAG,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9B,SAAS,EAAE,EAAE,CAAC;AACV,gBAAA,CAAC,MAAM,CAAC,UAAU,GAAG,KAAK;gBAC1B,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,KAAK,IAAI,IAAI;AAC9B,gBAAA,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,KAAK,QAAQ;AAClC,gBAAA,CAAC,MAAM,CAAC,gBAAgB,GAAG,gBAAgB;AAC3C,gBAAA,CAAC,MAAM,CAAC,kBAAkB,GAAG,kBAAkB;aAClD,CAAC,EACF,MAAM,EAAE,CAAC,KAAK,KAAK,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,EAC3C,OAAO,EAAE,MAAM,eAAe,CAAC,KAAK,CAAC,EACrC,KAAK,EAAE;gBACH,SAAS,EAAE,CAAG,EAAA,eAAe,CAAI,EAAA,CAAA;AACpC,aAAA,EAAA,cAAA,EACa,YAAY,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,EAC/D,CAAA,CACO;AAErB;;;;"}
|
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
--border-radius-0: 0;
|
|
8
8
|
--border-radius-24: var(--border-radius-3xl);
|
|
9
9
|
}
|
|
10
|
-
.
|
|
10
|
+
.gallery__videoWrapper_la50x {
|
|
11
11
|
display: flex;
|
|
12
12
|
justify-content: center;
|
|
13
13
|
height: 100%;
|
|
14
14
|
width: auto;
|
|
15
15
|
position: relative;
|
|
16
16
|
}
|
|
17
|
-
.
|
|
17
|
+
.gallery__video_la50x {
|
|
18
18
|
max-width: 100%;
|
|
19
19
|
max-height: 100%;
|
|
20
20
|
border-radius: var(--border-radius-24);
|
|
21
21
|
}
|
|
22
|
-
.
|
|
22
|
+
.gallery__mobile_la50x {
|
|
23
23
|
border-radius: var(--border-radius-0);
|
|
24
24
|
}
|
|
25
|
-
.
|
|
25
|
+
.gallery__videoButton_la50x {
|
|
26
26
|
position: absolute;
|
|
27
27
|
top: 50%;
|
|
28
28
|
left: 50%;
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
z-index: 1;
|
|
31
31
|
color: green;
|
|
32
32
|
}
|
|
33
|
-
.
|
|
33
|
+
.gallery__icon_la50x {
|
|
34
34
|
color: var(--color-static-neutral-0);
|
|
35
35
|
}
|
|
36
|
-
.
|
|
36
|
+
.gallery__iconShape_la50x {
|
|
37
37
|
fill: var(--color-static-neutral-translucent-700);
|
|
38
38
|
}
|
|
39
|
-
.
|
|
39
|
+
.gallery__bottomButton_la50x {
|
|
40
40
|
position: absolute;
|
|
41
41
|
bottom: 48px;
|
|
42
42
|
left: 32px;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React, { useRef, useContext, useEffect, useCallback } from 'react';
|
|
1
|
+
import React, { useRef, useState, useContext, useEffect, useCallback } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
-
import Hls from 'hls.js';
|
|
4
3
|
import { Circle } from '@alfalab/core-components-icon-view/modern/circle';
|
|
5
4
|
import PlayCompactMIcon from '@alfalab/icons-glyph/PlayCompactMIcon';
|
|
6
5
|
import { GalleryContext } from '../../../context.js';
|
|
@@ -11,6 +10,7 @@ import styles from './index.module.css.js';
|
|
|
11
10
|
const Video = ({ url, index, className, isActive }) => {
|
|
12
11
|
const playerRef = useRef(null);
|
|
13
12
|
const timer = useRef();
|
|
13
|
+
const [hlsSupported, setHlsSupported] = useState(true);
|
|
14
14
|
const { setImageMeta, mutedVideo, view, playingVideo, setPlayingVideo, setHideNavigation, getCurrentImage, } = useContext(GalleryContext);
|
|
15
15
|
const isMobile = view === 'mobile';
|
|
16
16
|
const isDesktop = view === 'desktop';
|
|
@@ -19,30 +19,67 @@ const Video = ({ url, index, className, isActive }) => {
|
|
|
19
19
|
setImageMeta({ player: playerRef }, index);
|
|
20
20
|
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
21
21
|
}, [index]);
|
|
22
|
+
const loadHlsLibrary = useCallback(async (attempt = 1, maxAttempts = 3) => {
|
|
23
|
+
try {
|
|
24
|
+
const { default: HlsLib } = await import(
|
|
25
|
+
/* webpackChunkName: "hls-js-gallery" */ 'hls.js');
|
|
26
|
+
return HlsLib;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
if (attempt < maxAttempts) {
|
|
30
|
+
/* Экспоненциальная задержка ретрая: 300ms, 600ms, 1200ms */
|
|
31
|
+
await new Promise((resolve) => {
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
resolve();
|
|
34
|
+
}, 300 * 2 ** (attempt - 1));
|
|
35
|
+
});
|
|
36
|
+
return loadHlsLibrary(attempt + 1, maxAttempts);
|
|
37
|
+
}
|
|
38
|
+
setHlsSupported(false);
|
|
39
|
+
setImageMeta({ player: { current: null }, broken: true }, index);
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}, [setImageMeta, index]);
|
|
22
43
|
useEffect(() => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
let hls = null;
|
|
45
|
+
const initHls = async () => {
|
|
46
|
+
try {
|
|
47
|
+
const HlsLib = await loadHlsLibrary();
|
|
48
|
+
if (!HlsLib || !playerRef.current) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (!HlsLib.isSupported()) {
|
|
52
|
+
setHlsSupported(false);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
hls = new HlsLib();
|
|
56
|
+
hls.on(HlsLib.Events.ERROR, (_, data) => {
|
|
57
|
+
if (data.fatal && hls) {
|
|
58
|
+
switch (data.type) {
|
|
59
|
+
case HlsLib.ErrorTypes.MEDIA_ERROR:
|
|
60
|
+
hls.recoverMediaError();
|
|
61
|
+
break;
|
|
62
|
+
case HlsLib.ErrorTypes.NETWORK_ERROR:
|
|
63
|
+
setImageMeta({ player: { current: null }, broken: true }, index);
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
hls.destroy();
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
37
69
|
}
|
|
70
|
+
});
|
|
71
|
+
hls.loadSource(url);
|
|
72
|
+
if (playerRef.current) {
|
|
73
|
+
hls.attachMedia(playerRef.current);
|
|
74
|
+
hls.subtitleDisplay = false;
|
|
38
75
|
}
|
|
39
|
-
});
|
|
40
|
-
hls.loadSource(url);
|
|
41
|
-
if (playerRef.current) {
|
|
42
|
-
hls.attachMedia(playerRef.current);
|
|
43
|
-
hls.subtitleDisplay = false;
|
|
44
76
|
}
|
|
45
|
-
|
|
77
|
+
catch {
|
|
78
|
+
setHlsSupported(false);
|
|
79
|
+
setImageMeta({ player: { current: null }, broken: true }, index);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
initHls();
|
|
46
83
|
return () => {
|
|
47
84
|
if (hls) {
|
|
48
85
|
hls.destroy();
|
|
@@ -125,7 +162,7 @@ const Video = ({ url, index, className, isActive }) => {
|
|
|
125
162
|
return (
|
|
126
163
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
127
164
|
React.createElement("div", { onClick: handleWrapperClick, className: styles.videoWrapper },
|
|
128
|
-
React.createElement("video", { onPlay: onPlay, onPause: onPause, ref: playerRef, playsInline: true, muted: mutedVideo, loop: true, src:
|
|
165
|
+
React.createElement("video", { onPlay: onPlay, onPause: onPause, ref: playerRef, playsInline: true, muted: mutedVideo, loop: true, src: hlsSupported ? undefined : url, className: cn(styles.video, { [styles.mobile]: view === 'mobile' }, className) },
|
|
129
166
|
React.createElement("track", { kind: 'captions' })),
|
|
130
167
|
isDesktop && !playingVideo && (React.createElement("div", { className: styles.videoButton },
|
|
131
168
|
React.createElement(Circle, { size: 64, shapeClassName: styles.iconShape },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/image-viewer/video/index.tsx"],"sourcesContent":["import React, {\n type MouseEvent,\n type ReactEventHandler,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport cn from 'classnames';\nimport Hls from 'hls.js';\n\nimport { Circle } from '@alfalab/core-components-icon-view/circle';\nimport PlayCompactMIcon from '@alfalab/icons-glyph/PlayCompactMIcon';\n\nimport { GalleryContext } from '../../../context';\nimport { BottomButton } from '../../bottom-button';\nimport { Subtitles } from '../../subtitles';\n\nimport styles from './index.module.css';\n\ntype Props = {\n url: string;\n index: number;\n isActive: boolean;\n className?: string;\n};\n\nexport const Video = ({ url, index, className, isActive }: Props) => {\n const playerRef = useRef<HTMLVideoElement>(null);\n const timer = useRef<ReturnType<typeof setTimeout>>();\n\n const {\n setImageMeta,\n mutedVideo,\n view,\n playingVideo,\n setPlayingVideo,\n setHideNavigation,\n getCurrentImage,\n } = useContext(GalleryContext);\n\n const isMobile = view === 'mobile';\n const isDesktop = view === 'desktop';\n\n const image = getCurrentImage();\n\n useEffect(() => {\n setImageMeta({ player: playerRef }, index);\n /* eslint-disable-next-line react-hooks/exhaustive-deps */\n }, [index]);\n\n useEffect(() => {\n const hls = new Hls();\n\n if (Hls.isSupported()) {\n hls.on(Hls.Events.ERROR, (_, data) => {\n if (data.fatal) {\n switch (data.type) {\n case Hls.ErrorTypes.MEDIA_ERROR:\n hls.recoverMediaError();\n break;\n case Hls.ErrorTypes.NETWORK_ERROR:\n setImageMeta({ player: { current: null }, broken: true }, index);\n break;\n default:\n hls.destroy();\n break;\n }\n }\n });\n\n hls.loadSource(url);\n if (playerRef.current) {\n hls.attachMedia(playerRef.current);\n hls.subtitleDisplay = false;\n }\n }\n\n return () => {\n if (hls) {\n hls.destroy();\n }\n if (timer.current) {\n clearTimeout(timer.current);\n }\n };\n /* eslint-disable-next-line react-hooks/exhaustive-deps */\n }, [url, index]);\n\n useEffect(() => {\n if (playerRef.current && isActive) {\n if (playingVideo) {\n playerRef.current.play();\n } else {\n playerRef.current.pause();\n }\n }\n if (playerRef.current && !isActive) {\n playerRef.current.pause();\n playerRef.current.currentTime = 0;\n }\n }, [isActive, playingVideo]);\n\n useEffect(() => {\n const handleSpacePress = (e: KeyboardEvent) => {\n if ((e.key === ' ' || e.code === 'Space') && isActive) {\n if (playingVideo) {\n setPlayingVideo(false);\n } else {\n setPlayingVideo(true);\n }\n }\n };\n\n document.addEventListener('keyup', handleSpacePress);\n\n return () => {\n document.removeEventListener('keyup', handleSpacePress);\n };\n }, [isActive, playingVideo, setPlayingVideo]);\n\n const handleWrapperClick = (e: MouseEvent) => {\n e.stopPropagation();\n\n if (isMobile) {\n setHideNavigation(false);\n\n if (playingVideo) {\n if (timer.current) {\n clearTimeout(timer.current);\n }\n timer.current = setTimeout(() => {\n setHideNavigation(true);\n }, 3000);\n }\n\n return;\n }\n\n setPlayingVideo(!playingVideo);\n };\n\n const handleBottomButtonClick = useCallback(\n (e: MouseEvent) => {\n e.stopPropagation();\n if (image?.bottomButton) {\n image.bottomButton.onClick(e);\n }\n },\n [image?.bottomButton],\n );\n\n const onPlay: ReactEventHandler<HTMLVideoElement> = () => {\n image?.onPlay?.();\n\n if (timer.current) {\n clearTimeout(timer.current);\n }\n\n timer.current = setTimeout(() => {\n setHideNavigation(true);\n }, 3000);\n };\n\n const onPause: ReactEventHandler<HTMLVideoElement> = () => {\n image?.onPause?.();\n\n if (timer.current) {\n clearTimeout(timer.current);\n timer.current = undefined;\n }\n\n setHideNavigation(false);\n };\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div onClick={handleWrapperClick} className={styles.videoWrapper}>\n <video\n onPlay={onPlay}\n onPause={onPause}\n ref={playerRef}\n playsInline={true}\n muted={mutedVideo}\n loop={true}\n src={Hls.isSupported() ? undefined : url}\n className={cn(styles.video, { [styles.mobile]: view === 'mobile' }, className)}\n >\n <track kind='captions' />\n </video>\n {isDesktop && !playingVideo && (\n <div className={styles.videoButton}>\n <Circle size={64} shapeClassName={styles.iconShape}>\n <PlayCompactMIcon className={styles.icon} />\n </Circle>\n </div>\n )}\n {isDesktop && <Subtitles />}\n {isDesktop && image?.bottomButton && (\n <BottomButton\n bottomButton={image.bottomButton}\n onClick={handleBottomButtonClick}\n className={styles.bottomButton}\n />\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA2BO,MAAM,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAS,KAAI;AAChE,IAAA,MAAM,SAAS,GAAG,MAAM,CAAmB,IAAI,CAAC;AAChD,IAAA,MAAM,KAAK,GAAG,MAAM,EAAiC;IAErD,MAAM,EACF,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,GAClB,GAAG,UAAU,CAAC,cAAc,CAAC;AAE9B,IAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,QAAQ;AAClC,IAAA,MAAM,SAAS,GAAG,IAAI,KAAK,SAAS;AAEpC,IAAA,MAAM,KAAK,GAAG,eAAe,EAAE;IAE/B,SAAS,CAAC,MAAK;QACX,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC;;AAE9C,KAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAEX,SAAS,CAAC,MAAK;AACX,QAAA,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE;AAErB,QAAA,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE;AACnB,YAAA,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,C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,EAAC,UAAU,EAAA,CAAG,CACrB;QACP,SAAS,IAAI,CAAC,YAAY,KACvB,6BAAK,SAAS,EAAE,MAAM,CAAC,WAAW,EAAA;YAC9B,KAAC,CAAA,aAAA,CAAA,MAAM,EAAC,EAAA,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,CAAC,SAAS,EAAA;gBAC9C,KAAC,CAAA,aAAA,CAAA,gBAAgB,EAAC,EAAA,SAAS,EAAE,MAAM,CAAC,IAAI,EAAA,CAAI,CACvC,CACP,CACT;QACA,SAAS,IAAI,KAAC,CAAA,aAAA,CAAA,SAAS,EAAG,IAAA,CAAA;AAC1B,QAAA,SAAS,IAAI,KAAK,EAAE,YAAY,KAC7B,KAAC,CAAA,aAAA,CAAA,YAAY,EACT,EAAA,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,OAAO,EAAE,uBAAuB,EAChC,SAAS,EAAE,MAAM,CAAC,YAAY,EAChC,CAAA,CACL,CACC;AAEd;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/image-viewer/video/index.tsx"],"sourcesContent":["import React, {\n type MouseEvent,\n type ReactEventHandler,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport cn from 'classnames';\nimport type Hls from 'hls.js';\n\nimport { Circle } from '@alfalab/core-components-icon-view/circle';\nimport PlayCompactMIcon from '@alfalab/icons-glyph/PlayCompactMIcon';\n\nimport { GalleryContext } from '../../../context';\nimport { BottomButton } from '../../bottom-button';\nimport { Subtitles } from '../../subtitles';\n\nimport styles from './index.module.css';\n\ntype Props = {\n url: string;\n index: number;\n isActive: boolean;\n className?: string;\n};\n\nexport const Video = ({ url, index, className, isActive }: Props) => {\n const playerRef = useRef<HTMLVideoElement>(null);\n const timer = useRef<ReturnType<typeof setTimeout>>();\n const [hlsSupported, setHlsSupported] = useState<boolean>(true);\n\n const {\n setImageMeta,\n mutedVideo,\n view,\n playingVideo,\n setPlayingVideo,\n setHideNavigation,\n getCurrentImage,\n } = useContext(GalleryContext);\n\n const isMobile = view === 'mobile';\n const isDesktop = view === 'desktop';\n\n const image = getCurrentImage();\n\n useEffect(() => {\n setImageMeta({ player: playerRef }, index);\n /* eslint-disable-next-line react-hooks/exhaustive-deps */\n }, [index]);\n\n const loadHlsLibrary = useCallback(\n async (attempt = 1, maxAttempts = 3): Promise<typeof Hls | null> => {\n try {\n const { default: HlsLib } = await import(\n /* webpackChunkName: \"hls-js-gallery\" */ 'hls.js'\n );\n\n return HlsLib;\n } catch {\n if (attempt < maxAttempts) {\n /* Экспоненциальная задержка ретрая: 300ms, 600ms, 1200ms */\n await new Promise<void>((resolve) => {\n setTimeout(\n () => {\n resolve();\n },\n 300 * 2 ** (attempt - 1),\n );\n });\n\n return loadHlsLibrary(attempt + 1, maxAttempts);\n }\n\n setHlsSupported(false);\n setImageMeta({ player: { current: null }, broken: true }, index);\n\n return null;\n }\n },\n [setImageMeta, index],\n );\n\n useEffect(() => {\n let hls: Hls | null = null;\n\n const initHls = async () => {\n try {\n const HlsLib = await loadHlsLibrary();\n\n if (!HlsLib || !playerRef.current) {\n return;\n }\n\n if (!HlsLib.isSupported()) {\n setHlsSupported(false);\n\n return;\n }\n\n hls = new HlsLib();\n\n hls.on(HlsLib.Events.ERROR, (_, data) => {\n if (data.fatal && hls) {\n switch (data.type) {\n case HlsLib.ErrorTypes.MEDIA_ERROR:\n hls.recoverMediaError();\n break;\n case HlsLib.ErrorTypes.NETWORK_ERROR:\n setImageMeta({ player: { current: null }, broken: true }, index);\n break;\n default:\n hls.destroy();\n break;\n }\n }\n });\n\n hls.loadSource(url);\n\n if (playerRef.current) {\n hls.attachMedia(playerRef.current);\n hls.subtitleDisplay = false;\n }\n } catch {\n setHlsSupported(false);\n setImageMeta({ player: { current: null }, broken: true }, index);\n }\n };\n\n initHls();\n\n return () => {\n if (hls) {\n hls.destroy();\n }\n if (timer.current) {\n clearTimeout(timer.current);\n }\n };\n /* eslint-disable-next-line react-hooks/exhaustive-deps */\n }, [url, index]);\n\n useEffect(() => {\n if (playerRef.current && isActive) {\n if (playingVideo) {\n playerRef.current.play();\n } else {\n playerRef.current.pause();\n }\n }\n if (playerRef.current && !isActive) {\n playerRef.current.pause();\n playerRef.current.currentTime = 0;\n }\n }, [isActive, playingVideo]);\n\n useEffect(() => {\n const handleSpacePress = (e: KeyboardEvent) => {\n if ((e.key === ' ' || e.code === 'Space') && isActive) {\n if (playingVideo) {\n setPlayingVideo(false);\n } else {\n setPlayingVideo(true);\n }\n }\n };\n\n document.addEventListener('keyup', handleSpacePress);\n\n return () => {\n document.removeEventListener('keyup', handleSpacePress);\n };\n }, [isActive, playingVideo, setPlayingVideo]);\n\n const handleWrapperClick = (e: MouseEvent) => {\n e.stopPropagation();\n\n if (isMobile) {\n setHideNavigation(false);\n\n if (playingVideo) {\n if (timer.current) {\n clearTimeout(timer.current);\n }\n timer.current = setTimeout(() => {\n setHideNavigation(true);\n }, 3000);\n }\n\n return;\n }\n\n setPlayingVideo(!playingVideo);\n };\n\n const handleBottomButtonClick = useCallback(\n (e: MouseEvent) => {\n e.stopPropagation();\n if (image?.bottomButton) {\n image.bottomButton.onClick(e);\n }\n },\n [image?.bottomButton],\n );\n\n const onPlay: ReactEventHandler<HTMLVideoElement> = () => {\n image?.onPlay?.();\n\n if (timer.current) {\n clearTimeout(timer.current);\n }\n\n timer.current = setTimeout(() => {\n setHideNavigation(true);\n }, 3000);\n };\n\n const onPause: ReactEventHandler<HTMLVideoElement> = () => {\n image?.onPause?.();\n\n if (timer.current) {\n clearTimeout(timer.current);\n timer.current = undefined;\n }\n\n setHideNavigation(false);\n };\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div onClick={handleWrapperClick} className={styles.videoWrapper}>\n <video\n onPlay={onPlay}\n onPause={onPause}\n ref={playerRef}\n playsInline={true}\n muted={mutedVideo}\n loop={true}\n src={hlsSupported ? undefined : url}\n className={cn(styles.video, { [styles.mobile]: view === 'mobile' }, className)}\n >\n <track kind='captions' />\n </video>\n {isDesktop && !playingVideo && (\n <div className={styles.videoButton}>\n <Circle size={64} shapeClassName={styles.iconShape}>\n <PlayCompactMIcon className={styles.icon} />\n </Circle>\n </div>\n )}\n {isDesktop && <Subtitles />}\n {isDesktop && image?.bottomButton && (\n <BottomButton\n bottomButton={image.bottomButton}\n onClick={handleBottomButtonClick}\n className={styles.bottomButton}\n />\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA4BO,MAAM,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAS,KAAI;AAChE,IAAA,MAAM,SAAS,GAAG,MAAM,CAAmB,IAAI,CAAC;AAChD,IAAA,MAAM,KAAK,GAAG,MAAM,EAAiC;IACrD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAU,IAAI,CAAC;IAE/D,MAAM,EACF,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,GAClB,GAAG,UAAU,CAAC,cAAc,CAAC;AAE9B,IAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,QAAQ;AAClC,IAAA,MAAM,SAAS,GAAG,IAAI,KAAK,SAAS;AAEpC,IAAA,MAAM,KAAK,GAAG,eAAe,EAAE;IAE/B,SAAS,CAAC,MAAK;QACX,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC;;AAE9C,KAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAEX,IAAA,MAAM,cAAc,GAAG,WAAW,CAC9B,OAAO,OAAO,GAAG,CAAC,EAAE,WAAW,GAAG,CAAC,KAAgC;AAC/D,QAAA,IAAI;AACA,YAAA,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM;qDACW,QAAQ,CACpD;AAED,YAAA,OAAO,MAAM;;AACf,QAAA,MAAM;AACJ,YA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