yet-another-react-lightbox 2.3.0 → 2.4.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.
- package/README.md +1 -1
- package/dist/core/components/IconButton.d.ts +1 -1
- package/dist/core/components/ImageSlide.d.ts +1 -2
- package/dist/core/components/ImageSlide.js +5 -2
- package/dist/core/consts.d.ts +7 -5
- package/dist/core/consts.js +2 -0
- package/dist/core/contexts/Events.d.ts +8 -4
- package/dist/core/contexts/Events.js +2 -3
- package/dist/core/contexts/LightboxState.d.ts +6 -4
- package/dist/core/contexts/LightboxState.js +13 -10
- package/dist/core/hooks/index.d.ts +4 -0
- package/dist/core/hooks/index.js +4 -0
- package/dist/core/hooks/useAnimation.d.ts +10 -0
- package/dist/core/hooks/useAnimation.js +48 -0
- package/dist/core/hooks/useContainerRect.d.ts +1 -4
- package/dist/core/hooks/useDelay.d.ts +1 -0
- package/dist/core/hooks/useDelay.js +10 -0
- package/dist/core/hooks/useLoseFocus.d.ts +4 -0
- package/dist/core/hooks/useLoseFocus.js +19 -0
- package/dist/core/hooks/useThrottle.d.ts +1 -0
- package/dist/core/hooks/useThrottle.js +16 -0
- package/dist/core/modules/Carousel.js +3 -4
- package/dist/core/modules/Controller.d.ts +13 -2
- package/dist/core/modules/Controller.js +46 -59
- package/dist/core/modules/Navigation.js +13 -12
- package/dist/core/modules/Toolbar.d.ts +6 -0
- package/dist/core/modules/Toolbar.js +2 -2
- package/dist/core/utils.d.ts +2 -0
- package/dist/core/utils.js +2 -0
- package/dist/plugins/captions/CaptionsContext.js +2 -6
- package/dist/plugins/fullscreen/Fullscreen.js +1 -7
- package/dist/plugins/fullscreen/FullscreenButton.d.ts +1 -6
- package/dist/plugins/fullscreen/FullscreenButton.js +6 -99
- package/dist/plugins/fullscreen/FullscreenContext.d.ts +7 -3
- package/dist/plugins/fullscreen/FullscreenContext.js +97 -3
- package/dist/plugins/fullscreen/index.d.ts +2 -1
- package/dist/plugins/slideshow/Slideshow.js +7 -11
- package/dist/plugins/slideshow/SlideshowButton.js +6 -55
- package/dist/plugins/slideshow/SlideshowContext.d.ts +9 -0
- package/dist/plugins/slideshow/SlideshowContext.js +58 -0
- package/dist/plugins/thumbnails/Thumbnail.d.ts +1 -2
- package/dist/plugins/thumbnails/ThumbnailsContainer.js +2 -2
- package/dist/plugins/thumbnails/ThumbnailsTrack.d.ts +1 -3
- package/dist/plugins/thumbnails/ThumbnailsTrack.js +28 -46
- package/dist/plugins/thumbnails/index.d.ts +0 -1
- package/dist/plugins/video/Video.js +2 -5
- package/dist/plugins/video/index.d.ts +9 -0
- package/dist/plugins/video/index.js +1 -0
- package/dist/plugins/zoom/ZoomContainer.d.ts +1 -2
- package/dist/plugins/zoom/ZoomContainer.js +1 -1
- package/dist/plugins/zoom/ZoomContext.js +1 -1
- package/dist/plugins/zoom/index.d.ts +6 -0
- package/dist/types.d.ts +5 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ export const defaultVideoProps = {
|
|
|
5
5
|
playsInline: true,
|
|
6
6
|
};
|
|
7
7
|
export const Video = ({ augment }) => {
|
|
8
|
-
augment(({ render: { slide: renderSlide, ...restRender }, video:
|
|
8
|
+
augment(({ render: { slide: renderSlide, ...restRender }, video: videoProps, ...restProps }) => ({
|
|
9
9
|
render: {
|
|
10
10
|
slide: (slide, offset, rect) => {
|
|
11
11
|
if (slide.type === "video") {
|
|
@@ -15,10 +15,7 @@ export const Video = ({ augment }) => {
|
|
|
15
15
|
},
|
|
16
16
|
...restRender,
|
|
17
17
|
},
|
|
18
|
-
video: {
|
|
19
|
-
...defaultVideoProps,
|
|
20
|
-
...originalVideo,
|
|
21
|
-
},
|
|
18
|
+
video: { ...defaultVideoProps, ...videoProps },
|
|
22
19
|
...restProps,
|
|
23
20
|
}));
|
|
24
21
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GenericSlide } from "../../types.js";
|
|
2
2
|
import { Video } from "./Video.js";
|
|
3
|
+
import { ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING } from "../../core/consts.js";
|
|
3
4
|
/** Video slide attributes */
|
|
4
5
|
export interface SlideVideo extends GenericSlide {
|
|
5
6
|
/** video slide type marker */
|
|
@@ -48,4 +49,12 @@ declare module "../../types" {
|
|
|
48
49
|
video?: Pick<SlideVideo, "autoPlay" | "controls" | "controlsList" | "crossOrigin" | "preload" | "loop" | "muted" | "playsInline" | "disablePictureInPicture" | "disableRemotePlayback">;
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
declare module "../../core" {
|
|
53
|
+
interface EventTypes {
|
|
54
|
+
[ACTIVE_SLIDE_LOADING]: void;
|
|
55
|
+
[ACTIVE_SLIDE_PLAYING]: void;
|
|
56
|
+
[ACTIVE_SLIDE_COMPLETE]: void;
|
|
57
|
+
[ACTIVE_SLIDE_ERROR]: void;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
51
60
|
export default Video;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { ContainerRect } from "../../
|
|
3
|
-
import { LightboxProps, Slide } from "../../types.js";
|
|
2
|
+
import { ContainerRect, LightboxProps, Slide } from "../../types.js";
|
|
4
3
|
/** Zoom container */
|
|
5
4
|
export declare const ZoomContainer: React.FC<Pick<LightboxProps, "render" | "carousel" | "zoom" | "animation" | "on"> & {
|
|
6
5
|
slide: Slide;
|
|
@@ -39,7 +39,7 @@ const distance = (pointerA, pointerB) => ((pointerA.clientX - pointerB.clientX)
|
|
|
39
39
|
export const ZoomContainer = ({ slide, offset, rect, render, carousel, animation, zoom: originalZoomProps, on }) => {
|
|
40
40
|
var _a;
|
|
41
41
|
const zoomProps = { ...defaultZoomProps, ...originalZoomProps };
|
|
42
|
-
const {
|
|
42
|
+
const { currentIndex } = useLightboxState().state;
|
|
43
43
|
const [zoom, setZoom] = React.useState(1);
|
|
44
44
|
const [offsetX, setOffsetX] = React.useState(0);
|
|
45
45
|
const [offsetY, setOffsetY] = React.useState(0);
|
|
@@ -6,7 +6,7 @@ export const ZoomContextProvider = ({ slides, children }) => {
|
|
|
6
6
|
const [isMinZoom, setIsMinZoom] = React.useState(false);
|
|
7
7
|
const [isMaxZoom, setIsMaxZoom] = React.useState(false);
|
|
8
8
|
const [isZoomSupported, setIsZoomSupported] = React.useState(false);
|
|
9
|
-
const {
|
|
9
|
+
const { currentIndex } = useLightboxState().state;
|
|
10
10
|
const updateZoomSupported = useEventCallback(() => setIsZoomSupported(slides.length > currentIndex && isImageSlide(slides[currentIndex])));
|
|
11
11
|
useLayoutEffect(updateZoomSupported, [currentIndex, updateZoomSupported]);
|
|
12
12
|
const context = React.useMemo(() => ({
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { ContainerRect } from "./core/hooks/useContainerRect.js";
|
|
3
2
|
/** Image fit setting */
|
|
4
3
|
export type ImageFit = "contain" | "cover";
|
|
5
4
|
/** Image source */
|
|
@@ -38,6 +37,11 @@ export interface SlideTypes {
|
|
|
38
37
|
}
|
|
39
38
|
/** Slide */
|
|
40
39
|
export type Slide = SlideTypes[keyof SlideTypes];
|
|
40
|
+
/** Container rect */
|
|
41
|
+
export type ContainerRect = {
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
};
|
|
41
45
|
/** Supported customization slots */
|
|
42
46
|
export interface SlotType {
|
|
43
47
|
/** lightbox root customization slot */
|