yet-another-react-lightbox 3.5.4 → 3.7.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 +3 -3
- package/dist/index.d.ts +240 -4
- package/dist/index.js +1368 -4
- package/dist/plugins/captions/captions.css +1 -33
- package/dist/plugins/captions/captions.css.d.ts +2 -0
- package/dist/plugins/captions/index.d.ts +8 -4
- package/dist/plugins/captions/index.js +104 -3
- package/dist/plugins/counter/counter.css +1 -16
- package/dist/plugins/counter/counter.css.d.ts +2 -0
- package/dist/plugins/counter/index.d.ts +8 -3
- package/dist/plugins/counter/index.js +18 -2
- package/dist/plugins/download/index.d.ts +6 -3
- package/dist/plugins/download/index.js +90 -3
- package/dist/plugins/fullscreen/index.d.ts +8 -4
- package/dist/plugins/fullscreen/index.js +128 -3
- package/dist/plugins/index.d.ts +9 -9
- package/dist/plugins/index.js +9 -9
- package/dist/plugins/inline/index.d.ts +8 -3
- package/dist/plugins/inline/index.js +26 -2
- package/dist/plugins/slideshow/index.d.ts +8 -4
- package/dist/plugins/slideshow/index.js +113 -3
- package/dist/plugins/thumbnails/index.d.ts +7 -4
- package/dist/plugins/thumbnails/index.js +261 -3
- package/dist/plugins/thumbnails/thumbnails.css +1 -139
- package/dist/plugins/thumbnails/thumbnails.css.d.ts +2 -0
- package/dist/plugins/video/index.d.ts +7 -2
- package/dist/plugins/video/index.js +109 -2
- package/dist/plugins/zoom/index.d.ts +7 -4
- package/dist/plugins/zoom/index.js +500 -3
- package/dist/styles.css +1 -281
- package/dist/styles.css.d.ts +2 -0
- package/dist/types.d.ts +125 -47
- package/dist/types.js +51 -1
- package/package.json +34 -10
- package/dist/Lightbox.d.ts +0 -4
- package/dist/Lightbox.js +0 -46
- package/dist/core/components/IconButton.d.ts +0 -7
- package/dist/core/components/IconButton.js +0 -8
- package/dist/core/components/Icons.d.ts +0 -29
- package/dist/core/components/Icons.js +0 -27
- package/dist/core/components/ImageSlide.d.ts +0 -13
- package/dist/core/components/ImageSlide.js +0 -68
- package/dist/core/components/index.d.ts +0 -3
- package/dist/core/components/index.js +0 -3
- package/dist/core/config.d.ts +0 -7
- package/dist/core/config.js +0 -93
- package/dist/core/consts.d.ts +0 -50
- package/dist/core/consts.js +0 -49
- package/dist/core/contexts/Events.d.ts +0 -17
- package/dist/core/contexts/Events.js +0 -29
- package/dist/core/contexts/LightboxProps.d.ts +0 -6
- package/dist/core/contexts/LightboxProps.js +0 -7
- package/dist/core/contexts/LightboxState.d.ts +0 -27
- package/dist/core/contexts/LightboxState.js +0 -49
- package/dist/core/contexts/Timeouts.d.ts +0 -8
- package/dist/core/contexts/Timeouts.js +0 -32
- package/dist/core/contexts/index.d.ts +0 -4
- package/dist/core/contexts/index.js +0 -4
- package/dist/core/hooks/index.d.ts +0 -11
- package/dist/core/hooks/index.js +0 -11
- package/dist/core/hooks/useAnimation.d.ts +0 -15
- package/dist/core/hooks/useAnimation.js +0 -57
- package/dist/core/hooks/useContainerRect.d.ts +0 -7
- package/dist/core/hooks/useContainerRect.js +0 -36
- package/dist/core/hooks/useDelay.d.ts +0 -1
- package/dist/core/hooks/useDelay.js +0 -10
- package/dist/core/hooks/useEventCallback.d.ts +0 -1
- package/dist/core/hooks/useEventCallback.js +0 -9
- package/dist/core/hooks/useForkRef.d.ts +0 -3
- package/dist/core/hooks/useForkRef.js +0 -17
- package/dist/core/hooks/useLayoutEffect.d.ts +0 -2
- package/dist/core/hooks/useLayoutEffect.js +0 -3
- package/dist/core/hooks/useLoseFocus.d.ts +0 -4
- package/dist/core/hooks/useLoseFocus.js +0 -19
- package/dist/core/hooks/useMotionPreference.d.ts +0 -1
- package/dist/core/hooks/useMotionPreference.js +0 -13
- package/dist/core/hooks/useRTL.d.ts +0 -1
- package/dist/core/hooks/useRTL.js +0 -9
- package/dist/core/hooks/useSensors.d.ts +0 -14
- package/dist/core/hooks/useSensors.js +0 -38
- package/dist/core/hooks/useThrottle.d.ts +0 -1
- package/dist/core/hooks/useThrottle.js +0 -16
- package/dist/core/index.d.ts +0 -7
- package/dist/core/index.js +0 -7
- package/dist/core/modules/Carousel.d.ts +0 -4
- package/dist/core/modules/Carousel.js +0 -72
- package/dist/core/modules/Controller.d.ts +0 -31
- package/dist/core/modules/Controller.js +0 -215
- package/dist/core/modules/Navigation.d.ts +0 -13
- package/dist/core/modules/Navigation.js +0 -35
- package/dist/core/modules/NoScroll.d.ts +0 -4
- package/dist/core/modules/NoScroll.js +0 -52
- package/dist/core/modules/Portal.d.ts +0 -4
- package/dist/core/modules/Portal.js +0 -92
- package/dist/core/modules/Root.d.ts +0 -4
- package/dist/core/modules/Root.js +0 -7
- package/dist/core/modules/Toolbar.d.ts +0 -4
- package/dist/core/modules/Toolbar.js +0 -25
- package/dist/core/modules/controller/index.d.ts +0 -8
- package/dist/core/modules/controller/index.js +0 -9
- package/dist/core/modules/controller/usePointerSwipe.d.ts +0 -2
- package/dist/core/modules/controller/usePointerSwipe.js +0 -72
- package/dist/core/modules/controller/usePreventSwipeNavigation.d.ts +0 -3
- package/dist/core/modules/controller/usePreventSwipeNavigation.js +0 -20
- package/dist/core/modules/controller/useWheelSwipe.d.ts +0 -3
- package/dist/core/modules/controller/useWheelSwipe.js +0 -92
- package/dist/core/modules/index.d.ts +0 -7
- package/dist/core/modules/index.js +0 -7
- package/dist/core/utils.d.ts +0 -36
- package/dist/core/utils.js +0 -70
- package/dist/plugins/captions/Captions.d.ts +0 -3
- package/dist/plugins/captions/Captions.js +0 -25
- package/dist/plugins/captions/CaptionsButton.d.ts +0 -2
- package/dist/plugins/captions/CaptionsButton.js +0 -16
- package/dist/plugins/captions/CaptionsContext.d.ts +0 -5
- package/dist/plugins/captions/CaptionsContext.js +0 -16
- package/dist/plugins/captions/Description.d.ts +0 -4
- package/dist/plugins/captions/Description.js +0 -27
- package/dist/plugins/captions/Title.d.ts +0 -4
- package/dist/plugins/captions/Title.js +0 -16
- package/dist/plugins/captions/props.d.ts +0 -19
- package/dist/plugins/captions/props.js +0 -14
- package/dist/plugins/captions/utils.d.ts +0 -1
- package/dist/plugins/captions/utils.js +0 -2
- package/dist/plugins/counter/Counter.d.ts +0 -5
- package/dist/plugins/counter/Counter.js +0 -14
- package/dist/plugins/download/Download.d.ts +0 -2
- package/dist/plugins/download/Download.js +0 -9
- package/dist/plugins/download/DownloadButton.d.ts +0 -2
- package/dist/plugins/download/DownloadButton.js +0 -19
- package/dist/plugins/download/FileSaver.d.ts +0 -1
- package/dist/plugins/download/FileSaver.js +0 -60
- package/dist/plugins/fullscreen/Fullscreen.d.ts +0 -3
- package/dist/plugins/fullscreen/Fullscreen.js +0 -13
- package/dist/plugins/fullscreen/FullscreenButton.d.ts +0 -3
- package/dist/plugins/fullscreen/FullscreenButton.js +0 -16
- package/dist/plugins/fullscreen/FullscreenContext.d.ts +0 -5
- package/dist/plugins/fullscreen/FullscreenContext.js +0 -93
- package/dist/plugins/fullscreen/props.d.ts +0 -10
- package/dist/plugins/fullscreen/props.js +0 -8
- package/dist/plugins/inline/Inline.d.ts +0 -3
- package/dist/plugins/inline/Inline.js +0 -18
- package/dist/plugins/inline/InlineContainer.d.ts +0 -4
- package/dist/plugins/inline/InlineContainer.js +0 -5
- package/dist/plugins/slideshow/Slideshow.d.ts +0 -3
- package/dist/plugins/slideshow/Slideshow.js +0 -13
- package/dist/plugins/slideshow/SlideshowButton.d.ts +0 -2
- package/dist/plugins/slideshow/SlideshowButton.js +0 -14
- package/dist/plugins/slideshow/SlideshowContext.d.ts +0 -5
- package/dist/plugins/slideshow/SlideshowContext.js +0 -79
- package/dist/plugins/slideshow/props.d.ts +0 -12
- package/dist/plugins/slideshow/props.js +0 -9
- package/dist/plugins/thumbnails/Thumbnail.d.ts +0 -15
- package/dist/plugins/thumbnails/Thumbnail.js +0 -51
- package/dist/plugins/thumbnails/Thumbnails.d.ts +0 -3
- package/dist/plugins/thumbnails/Thumbnails.js +0 -22
- package/dist/plugins/thumbnails/ThumbnailsButton.d.ts +0 -2
- package/dist/plugins/thumbnails/ThumbnailsButton.js +0 -16
- package/dist/plugins/thumbnails/ThumbnailsContext.d.ts +0 -6
- package/dist/plugins/thumbnails/ThumbnailsContext.js +0 -24
- package/dist/plugins/thumbnails/ThumbnailsTrack.d.ts +0 -5
- package/dist/plugins/thumbnails/ThumbnailsTrack.js +0 -141
- package/dist/plugins/thumbnails/props.d.ts +0 -40
- package/dist/plugins/thumbnails/props.js +0 -21
- package/dist/plugins/thumbnails/utils.d.ts +0 -2
- package/dist/plugins/thumbnails/utils.js +0 -4
- package/dist/plugins/video/Video.d.ts +0 -3
- package/dist/plugins/video/Video.js +0 -21
- package/dist/plugins/video/VideoSlide.d.ts +0 -8
- package/dist/plugins/video/VideoSlide.js +0 -74
- package/dist/plugins/video/props.d.ts +0 -29
- package/dist/plugins/video/props.js +0 -13
- package/dist/plugins/zoom/ResponsiveImage.d.ts +0 -11
- package/dist/plugins/zoom/ResponsiveImage.js +0 -58
- package/dist/plugins/zoom/Zoom.d.ts +0 -3
- package/dist/plugins/zoom/Zoom.js +0 -18
- package/dist/plugins/zoom/ZoomButton.d.ts +0 -8
- package/dist/plugins/zoom/ZoomButton.js +0 -27
- package/dist/plugins/zoom/ZoomButtonsGroup.d.ts +0 -2
- package/dist/plugins/zoom/ZoomButtonsGroup.js +0 -22
- package/dist/plugins/zoom/ZoomController.d.ts +0 -12
- package/dist/plugins/zoom/ZoomController.js +0 -17
- package/dist/plugins/zoom/ZoomToolbarControl.d.ts +0 -2
- package/dist/plugins/zoom/ZoomToolbarControl.js +0 -12
- package/dist/plugins/zoom/ZoomWrapper.d.ts +0 -5
- package/dist/plugins/zoom/ZoomWrapper.js +0 -36
- package/dist/plugins/zoom/hooks/index.d.ts +0 -6
- package/dist/plugins/zoom/hooks/index.js +0 -6
- package/dist/plugins/zoom/hooks/useZoomAnimation.d.ts +0 -2
- package/dist/plugins/zoom/hooks/useZoomAnimation.js +0 -39
- package/dist/plugins/zoom/hooks/useZoomCallback.d.ts +0 -1
- package/dist/plugins/zoom/hooks/useZoomCallback.js +0 -12
- package/dist/plugins/zoom/hooks/useZoomImageRect.d.ts +0 -5
- package/dist/plugins/zoom/hooks/useZoomImageRect.js +0 -41
- package/dist/plugins/zoom/hooks/useZoomProps.d.ts +0 -13
- package/dist/plugins/zoom/hooks/useZoomProps.js +0 -6
- package/dist/plugins/zoom/hooks/useZoomSensors.d.ts +0 -3
- package/dist/plugins/zoom/hooks/useZoomSensors.js +0 -154
- package/dist/plugins/zoom/hooks/useZoomState.d.ts +0 -12
- package/dist/plugins/zoom/hooks/useZoomState.js +0 -63
- package/dist/plugins/zoom/props.d.ts +0 -25
- package/dist/plugins/zoom/props.js +0 -15
- package/dist/props.d.ts +0 -2
- package/dist/props.js +0 -38
package/dist/styles.css
CHANGED
|
@@ -1,281 +1 @@
|
|
|
1
|
-
.yarl__fullsize {
|
|
2
|
-
width: 100%;
|
|
3
|
-
height: 100%;
|
|
4
|
-
}
|
|
5
|
-
.yarl__relative {
|
|
6
|
-
position: relative;
|
|
7
|
-
}
|
|
8
|
-
.yarl__portal {
|
|
9
|
-
position: fixed;
|
|
10
|
-
top: 0;
|
|
11
|
-
right: 0;
|
|
12
|
-
bottom: 0;
|
|
13
|
-
left: 0;
|
|
14
|
-
opacity: 0;
|
|
15
|
-
overflow: hidden;
|
|
16
|
-
z-index: var(--yarl__portal_zindex, 9999);
|
|
17
|
-
transition: opacity var(--yarl__fade_animation_duration, 250ms) var(--yarl__fade_animation_timing_function, ease);
|
|
18
|
-
}
|
|
19
|
-
.yarl__portal_open {
|
|
20
|
-
opacity: 1;
|
|
21
|
-
}
|
|
22
|
-
.yarl__container {
|
|
23
|
-
position: absolute;
|
|
24
|
-
top: 0;
|
|
25
|
-
right: 0;
|
|
26
|
-
bottom: 0;
|
|
27
|
-
left: 0;
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
background-color: var(--yarl__container_background_color, var(--yarl__color_backdrop, #000));
|
|
30
|
-
outline: 0;
|
|
31
|
-
-webkit-user-select: none;
|
|
32
|
-
-moz-user-select: none;
|
|
33
|
-
user-select: none;
|
|
34
|
-
touch-action: var(--yarl__controller_touch_action, none);
|
|
35
|
-
overscroll-behavior: var(--yarl__controller_overscroll-behavior, contain);
|
|
36
|
-
}
|
|
37
|
-
.yarl__carousel {
|
|
38
|
-
display: flex;
|
|
39
|
-
flex: 0 0 auto;
|
|
40
|
-
height: 100%;
|
|
41
|
-
align-content: center;
|
|
42
|
-
justify-content: center;
|
|
43
|
-
align-items: stretch;
|
|
44
|
-
width: calc(100% + (var(--yarl__carousel_slides_count) - 1) * (100% + var(--yarl__carousel_spacing_px, 0) * 1px + var(--yarl__carousel_spacing_percent, 0) * 1%));
|
|
45
|
-
-webkit-transform: translateX(var(--yarl__swipe_offset, 0px));
|
|
46
|
-
transform: translateX(var(--yarl__swipe_offset, 0px));
|
|
47
|
-
}
|
|
48
|
-
.yarl__carousel_with_slides {
|
|
49
|
-
-webkit-column-gap: calc(var(--yarl__carousel_spacing_px, 0) * 1px + 100 / (100 * var(--yarl__carousel_slides_count) + (var(--yarl__carousel_slides_count) - 1) * var(--yarl__carousel_spacing_percent, 0)) * var(--yarl__carousel_spacing_percent, 0) * 1%);
|
|
50
|
-
-moz-column-gap: calc(var(--yarl__carousel_spacing_px, 0) * 1px + 100 / (100 * var(--yarl__carousel_slides_count) + (var(--yarl__carousel_slides_count) - 1) * var(--yarl__carousel_spacing_percent, 0)) * var(--yarl__carousel_spacing_percent, 0) * 1%);
|
|
51
|
-
column-gap: calc(var(--yarl__carousel_spacing_px, 0) * 1px + 100 / (100 * var(--yarl__carousel_slides_count) + (var(--yarl__carousel_slides_count) - 1) * var(--yarl__carousel_spacing_percent, 0)) * var(--yarl__carousel_spacing_percent, 0) * 1%);
|
|
52
|
-
}
|
|
53
|
-
.yarl__flex_center {
|
|
54
|
-
display: flex;
|
|
55
|
-
justify-content: center;
|
|
56
|
-
align-content: center;
|
|
57
|
-
align-items: center;
|
|
58
|
-
}
|
|
59
|
-
.yarl__slide {
|
|
60
|
-
flex: 1;
|
|
61
|
-
position: relative;
|
|
62
|
-
overflow: hidden;
|
|
63
|
-
padding: calc(var(--yarl__carousel_padding_px, 0) * 1px + 100 / (100 * var(--yarl__carousel_slides_count) + (var(--yarl__carousel_slides_count) - 1) * var(--yarl__carousel_spacing_percent, 0)) * var(--yarl__carousel_padding_percent, 0) * 1%);
|
|
64
|
-
}
|
|
65
|
-
[dir=rtl] .yarl__slide {
|
|
66
|
-
--yarl__direction: -1;
|
|
67
|
-
}
|
|
68
|
-
.yarl__slide_image {
|
|
69
|
-
max-width: 100%;
|
|
70
|
-
max-height: 100%;
|
|
71
|
-
-o-object-fit: contain;
|
|
72
|
-
object-fit: contain;
|
|
73
|
-
touch-action: var(--yarl__controller_touch_action, none);
|
|
74
|
-
-moz-user-select: none;
|
|
75
|
-
user-select: none;
|
|
76
|
-
-webkit-user-select: none;
|
|
77
|
-
-webkit-touch-callout: none;
|
|
78
|
-
}
|
|
79
|
-
@media screen and (min-width: 800px) {
|
|
80
|
-
.yarl__slide_image {
|
|
81
|
-
-webkit-transform: translateZ(0);
|
|
82
|
-
-webkit-backface-visibility: hidden;
|
|
83
|
-
-webkit-transform-style: preserve-3d;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
.yarl__slide_image_cover {
|
|
87
|
-
width: 100%;
|
|
88
|
-
height: 100%;
|
|
89
|
-
-o-object-fit: cover;
|
|
90
|
-
object-fit: cover;
|
|
91
|
-
}
|
|
92
|
-
.yarl__slide_image_loading {
|
|
93
|
-
opacity: 0;
|
|
94
|
-
}
|
|
95
|
-
.yarl__slide_placeholder {
|
|
96
|
-
position: absolute;
|
|
97
|
-
top: 50%;
|
|
98
|
-
left: 50%;
|
|
99
|
-
-webkit-transform: translateX(-50%) translateY(-50%);
|
|
100
|
-
transform: translateX(-50%) translateY(-50%);
|
|
101
|
-
line-height: 0;
|
|
102
|
-
}
|
|
103
|
-
.yarl__slide_loading {
|
|
104
|
-
color: var(--yarl__slide_icon_loading_color, var(--yarl__color_button, rgba(255, 255, 255, 0.8)));
|
|
105
|
-
-webkit-animation: yarl__delayed_fadein 1s linear;
|
|
106
|
-
animation: yarl__delayed_fadein 1s linear;
|
|
107
|
-
}
|
|
108
|
-
.yarl__slide_loading line {
|
|
109
|
-
-webkit-animation: yarl__stroke_opacity 1s linear infinite;
|
|
110
|
-
animation: yarl__stroke_opacity 1s linear infinite;
|
|
111
|
-
}
|
|
112
|
-
.yarl__slide_loading line:nth-of-type(1) {
|
|
113
|
-
-webkit-animation-delay: -1.875s;
|
|
114
|
-
animation-delay: -1.875s;
|
|
115
|
-
}
|
|
116
|
-
.yarl__slide_loading line:nth-of-type(2) {
|
|
117
|
-
-webkit-animation-delay: -1.75s;
|
|
118
|
-
animation-delay: -1.75s;
|
|
119
|
-
}
|
|
120
|
-
.yarl__slide_loading line:nth-of-type(3) {
|
|
121
|
-
-webkit-animation-delay: -1.625s;
|
|
122
|
-
animation-delay: -1.625s;
|
|
123
|
-
}
|
|
124
|
-
.yarl__slide_loading line:nth-of-type(4) {
|
|
125
|
-
-webkit-animation-delay: -1.5s;
|
|
126
|
-
animation-delay: -1.5s;
|
|
127
|
-
}
|
|
128
|
-
.yarl__slide_loading line:nth-of-type(5) {
|
|
129
|
-
-webkit-animation-delay: -1.375s;
|
|
130
|
-
animation-delay: -1.375s;
|
|
131
|
-
}
|
|
132
|
-
.yarl__slide_loading line:nth-of-type(6) {
|
|
133
|
-
-webkit-animation-delay: -1.25s;
|
|
134
|
-
animation-delay: -1.25s;
|
|
135
|
-
}
|
|
136
|
-
.yarl__slide_loading line:nth-of-type(7) {
|
|
137
|
-
-webkit-animation-delay: -1.125s;
|
|
138
|
-
animation-delay: -1.125s;
|
|
139
|
-
}
|
|
140
|
-
.yarl__slide_loading line:nth-of-type(8) {
|
|
141
|
-
-webkit-animation-delay: -1s;
|
|
142
|
-
animation-delay: -1s;
|
|
143
|
-
}
|
|
144
|
-
.yarl__slide_error {
|
|
145
|
-
width: var(--yarl__slide_icon_error_size, 48px);
|
|
146
|
-
height: var(--yarl__slide_icon_error_size, 48px);
|
|
147
|
-
color: var(--yarl__slide_icon_error_color, red);
|
|
148
|
-
}
|
|
149
|
-
@media (prefers-reduced-motion) {
|
|
150
|
-
.yarl__portal, .yarl__slide {
|
|
151
|
-
transition: unset;
|
|
152
|
-
}
|
|
153
|
-
.yarl__slide_loading, .yarl__slide_loading line {
|
|
154
|
-
-webkit-animation: unset;
|
|
155
|
-
animation: unset;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
.yarl__toolbar {
|
|
159
|
-
position: absolute;
|
|
160
|
-
top: 0;
|
|
161
|
-
right: 0;
|
|
162
|
-
bottom: auto;
|
|
163
|
-
left: auto;
|
|
164
|
-
display: flex;
|
|
165
|
-
justify-content: flex-end;
|
|
166
|
-
padding: var(--yarl__toolbar_padding, 8px);
|
|
167
|
-
}
|
|
168
|
-
[dir=rtl] .yarl__toolbar {
|
|
169
|
-
top: 0;
|
|
170
|
-
right: auto;
|
|
171
|
-
bottom: auto;
|
|
172
|
-
left: 0;
|
|
173
|
-
}
|
|
174
|
-
.yarl__icon {
|
|
175
|
-
width: var(--yarl__icon_size, 32px);
|
|
176
|
-
height: var(--yarl__icon_size, 32px);
|
|
177
|
-
}
|
|
178
|
-
.yarl__button {
|
|
179
|
-
cursor: pointer;
|
|
180
|
-
-webkit-appearance: none;
|
|
181
|
-
-moz-appearance: none;
|
|
182
|
-
appearance: none;
|
|
183
|
-
background-color: var(--yarl__button_background_color, transparent);
|
|
184
|
-
border: var(--yarl__button_border, 0);
|
|
185
|
-
margin: var(--yarl__button_margin, 0);
|
|
186
|
-
outline: none;
|
|
187
|
-
line-height: 0;
|
|
188
|
-
padding: var(--yarl__button_padding, 8px);
|
|
189
|
-
color: var(--yarl__color_button, rgba(255, 255, 255, 0.8));
|
|
190
|
-
-webkit-filter: var(--yarl__button_filter, drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.8)));
|
|
191
|
-
filter: var(--yarl__button_filter, drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.8)));
|
|
192
|
-
-webkit-tap-highlight-color: transparent;
|
|
193
|
-
}
|
|
194
|
-
.yarl__button:focus {
|
|
195
|
-
color: var(--yarl__color_button_active, #fff);
|
|
196
|
-
}
|
|
197
|
-
.yarl__button:focus:not(:focus-visible) {
|
|
198
|
-
color: var(--yarl__color_button, rgba(255, 255, 255, 0.8));
|
|
199
|
-
}
|
|
200
|
-
.yarl__button:focus-visible {
|
|
201
|
-
color: var(--yarl__color_button_active, #fff);
|
|
202
|
-
}
|
|
203
|
-
@media (hover: hover) {
|
|
204
|
-
.yarl__button:hover, .yarl__button:focus:hover, .yarl__button:focus-visible:hover {
|
|
205
|
-
color: var(--yarl__color_button_active, #fff);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
.yarl__button:disabled {
|
|
209
|
-
color: var(--yarl__color_button_disabled, rgba(255, 255, 255, 0.4));
|
|
210
|
-
cursor: default;
|
|
211
|
-
}
|
|
212
|
-
.yarl__navigation_prev, .yarl__navigation_next {
|
|
213
|
-
position: absolute;
|
|
214
|
-
top: 50%;
|
|
215
|
-
-webkit-transform: translateY(-50%);
|
|
216
|
-
transform: translateY(-50%);
|
|
217
|
-
padding: var(--yarl__navigation_button_padding, 24px 16px);
|
|
218
|
-
}
|
|
219
|
-
.yarl__navigation_prev {
|
|
220
|
-
left: 0;
|
|
221
|
-
}
|
|
222
|
-
[dir=rtl] .yarl__navigation_prev {
|
|
223
|
-
left: unset;
|
|
224
|
-
right: 0;
|
|
225
|
-
-webkit-transform: translateY(-50%) rotate(180deg);
|
|
226
|
-
transform: translateY(-50%) rotate(180deg);
|
|
227
|
-
}
|
|
228
|
-
.yarl__navigation_next {
|
|
229
|
-
right: 0;
|
|
230
|
-
}
|
|
231
|
-
[dir=rtl] .yarl__navigation_next {
|
|
232
|
-
left: 0;
|
|
233
|
-
right: unset;
|
|
234
|
-
-webkit-transform: translateY(-50%) rotate(180deg);
|
|
235
|
-
transform: translateY(-50%) rotate(180deg);
|
|
236
|
-
}
|
|
237
|
-
.yarl__no_scroll {
|
|
238
|
-
height: 100%;
|
|
239
|
-
overflow: hidden;
|
|
240
|
-
overscroll-behavior: none;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
@-webkit-keyframes yarl__delayed_fadein {
|
|
244
|
-
0% {
|
|
245
|
-
opacity: 0;
|
|
246
|
-
}
|
|
247
|
-
80% {
|
|
248
|
-
opacity: 0;
|
|
249
|
-
}
|
|
250
|
-
100% {
|
|
251
|
-
opacity: 1;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
@keyframes yarl__delayed_fadein {
|
|
256
|
-
0% {
|
|
257
|
-
opacity: 0;
|
|
258
|
-
}
|
|
259
|
-
80% {
|
|
260
|
-
opacity: 0;
|
|
261
|
-
}
|
|
262
|
-
100% {
|
|
263
|
-
opacity: 1;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
@-webkit-keyframes yarl__stroke_opacity {
|
|
267
|
-
from {
|
|
268
|
-
stroke-opacity: 1;
|
|
269
|
-
}
|
|
270
|
-
to {
|
|
271
|
-
stroke-opacity: 0.125;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
@keyframes yarl__stroke_opacity {
|
|
275
|
-
from {
|
|
276
|
-
stroke-opacity: 1;
|
|
277
|
-
}
|
|
278
|
-
to {
|
|
279
|
-
stroke-opacity: 0.125;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
1
|
+
.yarl__fullsize{height:100%;width:100%}.yarl__relative{position:relative}.yarl__portal{bottom:0;left:0;opacity:0;overflow:hidden;position:fixed;right:0;top:0;transition:opacity var(--yarl__fade_animation_duration,.25s) var(--yarl__fade_animation_timing_function,ease);z-index:var(--yarl__portal_zindex,9999)}.yarl__portal_open{opacity:1}.yarl__container{background-color:var(--yarl__container_background_color,var(--yarl__color_backdrop,#000));bottom:0;left:0;outline:0;overflow:hidden;overscroll-behavior:var(--yarl__controller_overscroll-behavior,contain);position:absolute;right:0;top:0;touch-action:var(--yarl__controller_touch_action,none);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yarl__carousel{align-content:center;align-items:stretch;display:flex;flex:0 0 auto;height:100%;justify-content:center;-webkit-transform:translateX(var(--yarl__swipe_offset,0));transform:translateX(var(--yarl__swipe_offset,0));width:calc(100% + (var(--yarl__carousel_slides_count) - 1)*(100% + var(--yarl__carousel_spacing_px, 0)*1px + var(--yarl__carousel_spacing_percent, 0)*1%))}.yarl__carousel_with_slides{-webkit-column-gap:calc(var(--yarl__carousel_spacing_px, 0)*1px + 100/(var(--yarl__carousel_slides_count)*100 + (var(--yarl__carousel_slides_count) - 1)*var(--yarl__carousel_spacing_percent, 0))*var(--yarl__carousel_spacing_percent, 0)*1%);-moz-column-gap:calc(var(--yarl__carousel_spacing_px, 0)*1px + 100/(var(--yarl__carousel_slides_count)*100 + (var(--yarl__carousel_slides_count) - 1)*var(--yarl__carousel_spacing_percent, 0))*var(--yarl__carousel_spacing_percent, 0)*1%);column-gap:calc(var(--yarl__carousel_spacing_px, 0)*1px + 100/(var(--yarl__carousel_slides_count)*100 + (var(--yarl__carousel_slides_count) - 1)*var(--yarl__carousel_spacing_percent, 0))*var(--yarl__carousel_spacing_percent, 0)*1%)}.yarl__flex_center{align-content:center;align-items:center;display:flex;justify-content:center}.yarl__slide{flex:1;overflow:hidden;padding:calc(var(--yarl__carousel_padding_px, 0)*1px + 100/(var(--yarl__carousel_slides_count)*100 + (var(--yarl__carousel_slides_count) - 1)*var(--yarl__carousel_spacing_percent, 0))*var(--yarl__carousel_padding_percent, 0)*1%);position:relative}[dir=rtl] .yarl__slide{--yarl__direction:-1}.yarl__slide_image{-webkit-touch-callout:none;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;touch-action:var(--yarl__controller_touch_action,none);-moz-user-select:none;user-select:none;-webkit-user-select:none}@media screen and (min-width:800px){.yarl__slide_image{-webkit-backface-visibility:hidden;-webkit-transform:translateZ(0);-webkit-transform-style:preserve-3d}}.yarl__slide_image_cover{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.yarl__slide_image_loading{opacity:0}.yarl__slide_placeholder{left:50%;line-height:0;position:absolute;top:50%;-webkit-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%)}.yarl__slide_loading{-webkit-animation:yarl__delayed_fadein 1s linear;animation:yarl__delayed_fadein 1s linear;color:var(--yarl__slide_icon_loading_color,var(--yarl__color_button,hsla(0,0%,100%,.8)))}.yarl__slide_loading line{-webkit-animation:yarl__stroke_opacity 1s linear infinite;animation:yarl__stroke_opacity 1s linear infinite}.yarl__slide_loading line:first-of-type{-webkit-animation-delay:-1.875s;animation-delay:-1.875s}.yarl__slide_loading line:nth-of-type(2){-webkit-animation-delay:-1.75s;animation-delay:-1.75s}.yarl__slide_loading line:nth-of-type(3){-webkit-animation-delay:-1.625s;animation-delay:-1.625s}.yarl__slide_loading line:nth-of-type(4){-webkit-animation-delay:-1.5s;animation-delay:-1.5s}.yarl__slide_loading line:nth-of-type(5){-webkit-animation-delay:-1.375s;animation-delay:-1.375s}.yarl__slide_loading line:nth-of-type(6){-webkit-animation-delay:-1.25s;animation-delay:-1.25s}.yarl__slide_loading line:nth-of-type(7){-webkit-animation-delay:-1.125s;animation-delay:-1.125s}.yarl__slide_loading line:nth-of-type(8){-webkit-animation-delay:-1s;animation-delay:-1s}.yarl__slide_error{color:var(--yarl__slide_icon_error_color,red);height:var(--yarl__slide_icon_error_size,48px);width:var(--yarl__slide_icon_error_size,48px)}@media (prefers-reduced-motion){.yarl__portal,.yarl__slide{transition:unset}.yarl__slide_loading,.yarl__slide_loading line{-webkit-animation:unset;animation:unset}}.yarl__toolbar{bottom:auto;display:flex;justify-content:flex-end;left:auto;padding:var(--yarl__toolbar_padding,8px);position:absolute;right:0;top:0}[dir=rtl] .yarl__toolbar{bottom:auto;left:0;right:auto;top:0}.yarl__icon{height:var(--yarl__icon_size,32px);width:var(--yarl__icon_size,32px)}.yarl__button{-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--yarl__button_background_color,transparent);border:var(--yarl__button_border,0);color:var(--yarl__color_button,hsla(0,0%,100%,.8));cursor:pointer;-webkit-filter:var(--yarl__button_filter,drop-shadow(2px 2px 2px rgba(0,0,0,.8)));filter:var(--yarl__button_filter,drop-shadow(2px 2px 2px rgba(0,0,0,.8)));line-height:0;margin:var(--yarl__button_margin,0);outline:none;padding:var(--yarl__button_padding,8px)}.yarl__button:focus{color:var(--yarl__color_button_active,#fff)}.yarl__button:focus:not(:focus-visible){color:var(--yarl__color_button,hsla(0,0%,100%,.8))}.yarl__button:focus-visible{color:var(--yarl__color_button_active,#fff)}@media (hover:hover){.yarl__button:focus-visible:hover,.yarl__button:focus:hover,.yarl__button:hover{color:var(--yarl__color_button_active,#fff)}}.yarl__button:disabled{color:var(--yarl__color_button_disabled,hsla(0,0%,100%,.4));cursor:default}.yarl__navigation_next,.yarl__navigation_prev{padding:var(--yarl__navigation_button_padding,24px 16px);position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.yarl__navigation_prev{left:0}[dir=rtl] .yarl__navigation_prev{left:unset;right:0;-webkit-transform:translateY(-50%) rotate(180deg);transform:translateY(-50%) rotate(180deg)}.yarl__navigation_next{right:0}[dir=rtl] .yarl__navigation_next{left:0;right:unset;-webkit-transform:translateY(-50%) rotate(180deg);transform:translateY(-50%) rotate(180deg)}.yarl__no_scroll{height:100%;overflow:hidden;overscroll-behavior:none}@-webkit-keyframes yarl__delayed_fadein{0%{opacity:0}80%{opacity:0}to{opacity:1}}@keyframes yarl__delayed_fadein{0%{opacity:0}80%{opacity:0}to{opacity:1}}@-webkit-keyframes yarl__stroke_opacity{0%{stroke-opacity:1}to{stroke-opacity:.125}}@keyframes yarl__stroke_opacity{0%{stroke-opacity:1}to{stroke-opacity:.125}}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,60 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const MODULE_CAROUSEL = "carousel";
|
|
4
|
+
declare const MODULE_CONTROLLER = "controller";
|
|
5
|
+
declare const MODULE_NAVIGATION = "navigation";
|
|
6
|
+
declare const MODULE_NO_SCROLL = "no-scroll";
|
|
7
|
+
declare const MODULE_PORTAL = "portal";
|
|
8
|
+
declare const MODULE_ROOT = "root";
|
|
9
|
+
declare const MODULE_TOOLBAR = "toolbar";
|
|
10
|
+
declare const PLUGIN_CAPTIONS = "captions";
|
|
11
|
+
declare const PLUGIN_COUNTER = "counter";
|
|
12
|
+
declare const PLUGIN_DOWNLOAD = "download";
|
|
13
|
+
declare const PLUGIN_FULLSCREEN = "fullscreen";
|
|
14
|
+
declare const PLUGIN_INLINE = "inline";
|
|
15
|
+
declare const PLUGIN_SLIDESHOW = "slideshow";
|
|
16
|
+
declare const PLUGIN_THUMBNAILS = "thumbnails";
|
|
17
|
+
declare const PLUGIN_ZOOM = "zoom";
|
|
18
|
+
declare const SLIDE_STATUS_LOADING = "loading";
|
|
19
|
+
declare const SLIDE_STATUS_PLAYING = "playing";
|
|
20
|
+
declare const SLIDE_STATUS_ERROR = "error";
|
|
21
|
+
declare const SLIDE_STATUS_COMPLETE = "complete";
|
|
22
|
+
declare const SLIDE_STATUS_PLACEHOLDER = "placeholder";
|
|
23
|
+
type SlideStatus = typeof SLIDE_STATUS_LOADING | typeof SLIDE_STATUS_PLAYING | typeof SLIDE_STATUS_ERROR | typeof SLIDE_STATUS_COMPLETE;
|
|
24
|
+
declare const activeSlideStatus: (status: SlideStatus) => `active-slide-${SlideStatus}`;
|
|
25
|
+
declare const ACTIVE_SLIDE_LOADING: "active-slide-loading";
|
|
26
|
+
declare const ACTIVE_SLIDE_PLAYING: "active-slide-playing";
|
|
27
|
+
declare const ACTIVE_SLIDE_ERROR: "active-slide-error";
|
|
28
|
+
declare const ACTIVE_SLIDE_COMPLETE: "active-slide-complete";
|
|
29
|
+
declare const CLASS_FULLSIZE = "fullsize";
|
|
30
|
+
declare const CLASS_FLEX_CENTER = "flex_center";
|
|
31
|
+
declare const CLASS_NO_SCROLL = "no_scroll";
|
|
32
|
+
declare const CLASS_NO_SCROLL_PADDING = "no_scroll_padding";
|
|
33
|
+
declare const ACTION_PREV = "prev";
|
|
34
|
+
declare const ACTION_NEXT = "next";
|
|
35
|
+
declare const ACTION_SWIPE = "swipe";
|
|
36
|
+
declare const ACTION_CLOSE = "close";
|
|
37
|
+
declare const EVENT_ON_POINTER_DOWN = "onPointerDown";
|
|
38
|
+
declare const EVENT_ON_POINTER_MOVE = "onPointerMove";
|
|
39
|
+
declare const EVENT_ON_POINTER_UP = "onPointerUp";
|
|
40
|
+
declare const EVENT_ON_POINTER_LEAVE = "onPointerLeave";
|
|
41
|
+
declare const EVENT_ON_POINTER_CANCEL = "onPointerCancel";
|
|
42
|
+
declare const EVENT_ON_KEY_DOWN = "onKeyDown";
|
|
43
|
+
declare const EVENT_ON_KEY_UP = "onKeyUp";
|
|
44
|
+
declare const EVENT_ON_WHEEL = "onWheel";
|
|
45
|
+
declare const VK_ESCAPE = "Escape";
|
|
46
|
+
declare const VK_ARROW_LEFT = "ArrowLeft";
|
|
47
|
+
declare const VK_ARROW_RIGHT = "ArrowRight";
|
|
48
|
+
declare const ELEMENT_BUTTON = "button";
|
|
49
|
+
declare const ELEMENT_ICON = "icon";
|
|
50
|
+
declare const IMAGE_FIT_CONTAIN = "contain";
|
|
51
|
+
declare const IMAGE_FIT_COVER = "cover";
|
|
52
|
+
declare const UNKNOWN_ACTION_TYPE = "Unknown action type";
|
|
53
|
+
|
|
2
54
|
/** Lightbox external props */
|
|
3
|
-
|
|
55
|
+
type LightboxExternalProps = DeepPartial<LightboxProps, "carousel" | "animation" | "controller" | "toolbar">;
|
|
4
56
|
/** Lightbox properties */
|
|
5
|
-
|
|
57
|
+
interface LightboxProps {
|
|
6
58
|
/** if `true`, the lightbox is open */
|
|
7
59
|
open: boolean;
|
|
8
60
|
/** a callback to close the lightbox */
|
|
@@ -35,20 +87,20 @@ export interface LightboxProps {
|
|
|
35
87
|
className: string;
|
|
36
88
|
}
|
|
37
89
|
/** Slide */
|
|
38
|
-
|
|
90
|
+
type Slide = SlideTypes[SlideTypeKey];
|
|
39
91
|
/** Supported slide types */
|
|
40
|
-
|
|
92
|
+
interface SlideTypes {
|
|
41
93
|
/** image slide type */
|
|
42
94
|
image: SlideImage;
|
|
43
95
|
}
|
|
44
96
|
/** Slide type key */
|
|
45
|
-
|
|
97
|
+
type SlideTypeKey = keyof SlideTypes;
|
|
46
98
|
/** Generic slide */
|
|
47
|
-
|
|
99
|
+
interface GenericSlide {
|
|
48
100
|
type?: SlideTypeKey;
|
|
49
101
|
}
|
|
50
102
|
/** Image slide properties */
|
|
51
|
-
|
|
103
|
+
interface SlideImage extends GenericSlide {
|
|
52
104
|
/** image URL */
|
|
53
105
|
src: string;
|
|
54
106
|
/** image 'alt' attribute */
|
|
@@ -63,7 +115,7 @@ export interface SlideImage extends GenericSlide {
|
|
|
63
115
|
srcSet?: ImageSource[];
|
|
64
116
|
}
|
|
65
117
|
/** Image source */
|
|
66
|
-
|
|
118
|
+
interface ImageSource {
|
|
67
119
|
/** image URL */
|
|
68
120
|
src: string;
|
|
69
121
|
/** image width in pixels */
|
|
@@ -72,36 +124,36 @@ export interface ImageSource {
|
|
|
72
124
|
height: number;
|
|
73
125
|
}
|
|
74
126
|
/** Image fit setting */
|
|
75
|
-
|
|
127
|
+
type ImageFit = "contain" | "cover";
|
|
76
128
|
/** Lightbox component */
|
|
77
|
-
|
|
129
|
+
type Component = React.ComponentType<ComponentProps>;
|
|
78
130
|
/** Lightbox component properties */
|
|
79
|
-
|
|
131
|
+
type ComponentProps = React.PropsWithChildren<Omit<LightboxProps, "slides" | "index" | "plugins">>;
|
|
80
132
|
/** Lightbox component tree node */
|
|
81
|
-
|
|
133
|
+
type Node = {
|
|
82
134
|
/** module */
|
|
83
135
|
module: Module;
|
|
84
136
|
/** module child nodes */
|
|
85
137
|
children?: Node[];
|
|
86
138
|
};
|
|
87
139
|
/** Lightbox module */
|
|
88
|
-
|
|
140
|
+
type Module = {
|
|
89
141
|
/** module name */
|
|
90
142
|
name: string;
|
|
91
143
|
/** module component */
|
|
92
144
|
component: Component;
|
|
93
145
|
};
|
|
94
146
|
/** Lightbox props augmentation */
|
|
95
|
-
|
|
147
|
+
type Augmentation = (props: ComponentProps) => ComponentProps;
|
|
96
148
|
/** Container rect */
|
|
97
|
-
|
|
149
|
+
type ContainerRect = {
|
|
98
150
|
width: number;
|
|
99
151
|
height: number;
|
|
100
152
|
};
|
|
101
153
|
/** Customization slots */
|
|
102
|
-
|
|
154
|
+
type Slot = SlotType[keyof SlotType];
|
|
103
155
|
/** Supported customization slots */
|
|
104
|
-
|
|
156
|
+
interface SlotType {
|
|
105
157
|
/** lightbox root customization slot */
|
|
106
158
|
root: "root";
|
|
107
159
|
/** lightbox container customization slot */
|
|
@@ -116,11 +168,11 @@ interface SlotCSSProperties extends React.CSSProperties {
|
|
|
116
168
|
[key: `--yarl__${string}`]: string | number;
|
|
117
169
|
}
|
|
118
170
|
/** Customization slots styles */
|
|
119
|
-
|
|
171
|
+
type SlotStyles = {
|
|
120
172
|
[key in Slot]?: SlotCSSProperties;
|
|
121
173
|
};
|
|
122
174
|
/** Carousel settings */
|
|
123
|
-
|
|
175
|
+
interface CarouselSettings {
|
|
124
176
|
/** if `true`, the lightbox carousel doesn't wrap around */
|
|
125
177
|
finite: boolean;
|
|
126
178
|
/** the lightbox preloads (2 * preload + 1) slides */
|
|
@@ -132,9 +184,9 @@ export interface CarouselSettings {
|
|
|
132
184
|
/** `object-fit` setting for image slides */
|
|
133
185
|
imageFit: ImageFit;
|
|
134
186
|
}
|
|
135
|
-
|
|
187
|
+
type LengthOrPercentage = `${number}px` | `${number}%` | number;
|
|
136
188
|
/** Animation settings */
|
|
137
|
-
|
|
189
|
+
interface AnimationSettings {
|
|
138
190
|
/** fade-in / fade-out animation settings */
|
|
139
191
|
fade: number;
|
|
140
192
|
/** swipe animation settings */
|
|
@@ -152,7 +204,7 @@ export interface AnimationSettings {
|
|
|
152
204
|
};
|
|
153
205
|
}
|
|
154
206
|
/** Controller settings */
|
|
155
|
-
|
|
207
|
+
interface ControllerSettings {
|
|
156
208
|
/** controller ref */
|
|
157
209
|
ref: React.ForwardedRef<ControllerRef>;
|
|
158
210
|
/** if true, the lightbox captures focus when it opens */
|
|
@@ -161,11 +213,13 @@ export interface ControllerSettings {
|
|
|
161
213
|
touchAction: "none" | "pan-y";
|
|
162
214
|
/** if `true`, set ARIA attributes on the controller div */
|
|
163
215
|
aria: boolean;
|
|
216
|
+
/** if `true`, close the lightbox on pull-down gesture */
|
|
217
|
+
closeOnPullDown: boolean;
|
|
164
218
|
/** if `true`, close the lightbox when the backdrop is clicked */
|
|
165
219
|
closeOnBackdropClick: boolean;
|
|
166
220
|
}
|
|
167
221
|
/** Lightbox controller ref */
|
|
168
|
-
|
|
222
|
+
interface ControllerRef {
|
|
169
223
|
/** navigate to the previous slide */
|
|
170
224
|
prev: Callback<NavigationAction | void>;
|
|
171
225
|
/** navigate to the next slide */
|
|
@@ -180,17 +234,30 @@ export interface ControllerRef {
|
|
|
180
234
|
getLightboxState: () => LightboxState;
|
|
181
235
|
}
|
|
182
236
|
/** Portal settings */
|
|
183
|
-
|
|
237
|
+
interface PortalSettings {
|
|
184
238
|
/** portal mount point */
|
|
185
239
|
root?: DocumentFragment | Element | null;
|
|
186
240
|
}
|
|
187
241
|
/** Lightbox navigation action */
|
|
188
|
-
|
|
242
|
+
interface NavigationAction {
|
|
189
243
|
/** navigate through the specified number of slides */
|
|
190
244
|
count?: number;
|
|
191
245
|
}
|
|
246
|
+
/** Lightbox state swipe action */
|
|
247
|
+
type LightboxStateSwipeAction = {
|
|
248
|
+
type: "swipe";
|
|
249
|
+
increment: number;
|
|
250
|
+
duration?: number;
|
|
251
|
+
easing?: string;
|
|
252
|
+
};
|
|
253
|
+
/** Lightbox state update action */
|
|
254
|
+
type LightboxStateUpdateAction = {
|
|
255
|
+
type: "update";
|
|
256
|
+
slides: Slide[];
|
|
257
|
+
index: number;
|
|
258
|
+
};
|
|
192
259
|
/** Lightbox state */
|
|
193
|
-
|
|
260
|
+
interface LightboxState {
|
|
194
261
|
/** lightbox slides */
|
|
195
262
|
slides: Slide[];
|
|
196
263
|
/** current slide index */
|
|
@@ -207,9 +274,9 @@ export interface LightboxState {
|
|
|
207
274
|
};
|
|
208
275
|
}
|
|
209
276
|
/** Render function */
|
|
210
|
-
|
|
277
|
+
type RenderFunction<T = void> = [T] extends [void] ? () => React.ReactNode : (props: T) => React.ReactNode;
|
|
211
278
|
/** `render.slide` render function props */
|
|
212
|
-
|
|
279
|
+
interface RenderSlideProps {
|
|
213
280
|
/** slide */
|
|
214
281
|
slide: Slide;
|
|
215
282
|
/** slide offset (`0` - current slide, `1` - next slide, `-1` - previous slide, etc.) */
|
|
@@ -218,19 +285,19 @@ export interface RenderSlideProps {
|
|
|
218
285
|
rect: ContainerRect;
|
|
219
286
|
}
|
|
220
287
|
/** `render.slideHeader` render function props */
|
|
221
|
-
|
|
288
|
+
interface RenderSlideHeaderProps {
|
|
222
289
|
slide: Slide;
|
|
223
290
|
}
|
|
224
291
|
/** `render.slideFooter` render function props */
|
|
225
|
-
|
|
292
|
+
interface RenderSlideFooterProps {
|
|
226
293
|
slide: Slide;
|
|
227
294
|
}
|
|
228
295
|
/** `render.slideContainer` render function props */
|
|
229
|
-
|
|
296
|
+
interface RenderSlideContainerProps extends React.PropsWithChildren {
|
|
230
297
|
slide: Slide;
|
|
231
298
|
}
|
|
232
299
|
/** Custom render functions. */
|
|
233
|
-
|
|
300
|
+
interface Render {
|
|
234
301
|
/** render custom slide type, or override the default image slide */
|
|
235
302
|
slide?: RenderFunction<RenderSlideProps>;
|
|
236
303
|
/** render custom slide header (use absolute positioning) */
|
|
@@ -258,15 +325,15 @@ export interface Render {
|
|
|
258
325
|
/** render custom Close button */
|
|
259
326
|
buttonClose?: RenderFunction;
|
|
260
327
|
}
|
|
261
|
-
|
|
262
|
-
|
|
328
|
+
type Callback<T = void> = [T] extends [void] ? () => void : (props: T) => void;
|
|
329
|
+
interface ViewCallbackProps {
|
|
263
330
|
index: number;
|
|
264
331
|
}
|
|
265
|
-
|
|
332
|
+
interface ClickCallbackProps {
|
|
266
333
|
index: number;
|
|
267
334
|
}
|
|
268
335
|
/** Lifecycle callbacks */
|
|
269
|
-
|
|
336
|
+
interface Callbacks {
|
|
270
337
|
/** a callback called when a slide becomes active */
|
|
271
338
|
view?: Callback<ViewCallbackProps>;
|
|
272
339
|
/** a callback called when a slide is clicked */
|
|
@@ -281,20 +348,30 @@ export interface Callbacks {
|
|
|
281
348
|
exited?: Callback;
|
|
282
349
|
}
|
|
283
350
|
/** Custom UI labels */
|
|
284
|
-
|
|
351
|
+
type Labels = {
|
|
285
352
|
[key: string]: string;
|
|
286
353
|
};
|
|
287
354
|
/** Toolbar settings */
|
|
288
|
-
|
|
355
|
+
interface ToolbarSettings {
|
|
289
356
|
/** buttons to render in the toolbar */
|
|
290
357
|
buttons: (ToolbarButtonKey | React.ReactNode)[];
|
|
291
358
|
}
|
|
292
|
-
|
|
293
|
-
|
|
359
|
+
type ToolbarButtonKey = keyof ToolbarButtonKeys;
|
|
360
|
+
interface ToolbarButtonKeys {
|
|
294
361
|
close: null;
|
|
295
362
|
}
|
|
363
|
+
interface EventTypes {
|
|
364
|
+
[ACTION_PREV]: NavigationAction | void;
|
|
365
|
+
[ACTION_NEXT]: NavigationAction | void;
|
|
366
|
+
[ACTION_SWIPE]: LightboxStateSwipeAction;
|
|
367
|
+
[ACTION_CLOSE]: void;
|
|
368
|
+
[ACTIVE_SLIDE_LOADING]: void;
|
|
369
|
+
[ACTIVE_SLIDE_PLAYING]: void;
|
|
370
|
+
[ACTIVE_SLIDE_COMPLETE]: void;
|
|
371
|
+
[ACTIVE_SLIDE_ERROR]: void;
|
|
372
|
+
}
|
|
296
373
|
/** Plugin methods */
|
|
297
|
-
|
|
374
|
+
interface PluginProps {
|
|
298
375
|
/** test if a target module is present */
|
|
299
376
|
contains: (target: string) => boolean;
|
|
300
377
|
/** add module as a parent */
|
|
@@ -315,16 +392,17 @@ export interface PluginProps {
|
|
|
315
392
|
augment: (augmentation: Augmentation) => void;
|
|
316
393
|
}
|
|
317
394
|
/** Lightbox plugin */
|
|
318
|
-
|
|
395
|
+
type Plugin = (props: PluginProps) => void;
|
|
319
396
|
/** Deep partial utility type */
|
|
320
|
-
|
|
397
|
+
type DeepPartial<T extends {}, K extends keyof T> = Omit<Partial<T>, K> & {
|
|
321
398
|
[P in K]?: DeepPartialValue<T[P]>;
|
|
322
399
|
};
|
|
323
|
-
|
|
400
|
+
type DeepPartialValue<T> = T extends any[] ? T : T extends (...props: any[]) => any ? T : T extends {} ? {
|
|
324
401
|
[P in keyof T]?: P extends "ref" ? T[P] : DeepPartialValue<T[P]>;
|
|
325
402
|
} : T;
|
|
326
403
|
/** Deep non-nullable utility type */
|
|
327
|
-
|
|
404
|
+
type DeepNonNullable<T> = T extends {} ? {
|
|
328
405
|
[K in keyof T]-?: NonNullable<T[K]>;
|
|
329
406
|
} : never;
|
|
330
|
-
|
|
407
|
+
|
|
408
|
+
export { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING, AnimationSettings, Augmentation, CLASS_FLEX_CENTER, CLASS_FULLSIZE, CLASS_NO_SCROLL, CLASS_NO_SCROLL_PADDING, Callback, Callbacks, CarouselSettings, ClickCallbackProps, Component, ComponentProps, ContainerRect, ControllerRef, ControllerSettings, DeepNonNullable, DeepPartial, DeepPartialValue, ELEMENT_BUTTON, ELEMENT_ICON, EVENT_ON_KEY_DOWN, EVENT_ON_KEY_UP, EVENT_ON_POINTER_CANCEL, EVENT_ON_POINTER_DOWN, EVENT_ON_POINTER_LEAVE, EVENT_ON_POINTER_MOVE, EVENT_ON_POINTER_UP, EVENT_ON_WHEEL, EventTypes, GenericSlide, IMAGE_FIT_CONTAIN, IMAGE_FIT_COVER, ImageFit, ImageSource, Labels, LengthOrPercentage, LightboxExternalProps, LightboxProps, LightboxState, LightboxStateSwipeAction, LightboxStateUpdateAction, MODULE_CAROUSEL, MODULE_CONTROLLER, MODULE_NAVIGATION, MODULE_NO_SCROLL, MODULE_PORTAL, MODULE_ROOT, MODULE_TOOLBAR, Module, NavigationAction, Node, PLUGIN_CAPTIONS, PLUGIN_COUNTER, PLUGIN_DOWNLOAD, PLUGIN_FULLSCREEN, PLUGIN_INLINE, PLUGIN_SLIDESHOW, PLUGIN_THUMBNAILS, PLUGIN_ZOOM, Plugin, PluginProps, PortalSettings, Render, RenderFunction, RenderSlideContainerProps, RenderSlideFooterProps, RenderSlideHeaderProps, RenderSlideProps, SLIDE_STATUS_COMPLETE, SLIDE_STATUS_ERROR, SLIDE_STATUS_LOADING, SLIDE_STATUS_PLACEHOLDER, SLIDE_STATUS_PLAYING, Slide, SlideImage, SlideStatus, SlideTypeKey, SlideTypes, Slot, SlotStyles, SlotType, ToolbarButtonKey, ToolbarButtonKeys, ToolbarSettings, UNKNOWN_ACTION_TYPE, VK_ARROW_LEFT, VK_ARROW_RIGHT, VK_ESCAPE, ViewCallbackProps, activeSlideStatus };
|
package/dist/types.js
CHANGED
|
@@ -1 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
const MODULE_CAROUSEL = "carousel";
|
|
2
|
+
const MODULE_CONTROLLER = "controller";
|
|
3
|
+
const MODULE_NAVIGATION = "navigation";
|
|
4
|
+
const MODULE_NO_SCROLL = "no-scroll";
|
|
5
|
+
const MODULE_PORTAL = "portal";
|
|
6
|
+
const MODULE_ROOT = "root";
|
|
7
|
+
const MODULE_TOOLBAR = "toolbar";
|
|
8
|
+
const PLUGIN_CAPTIONS = "captions";
|
|
9
|
+
const PLUGIN_COUNTER = "counter";
|
|
10
|
+
const PLUGIN_DOWNLOAD = "download";
|
|
11
|
+
const PLUGIN_FULLSCREEN = "fullscreen";
|
|
12
|
+
const PLUGIN_INLINE = "inline";
|
|
13
|
+
const PLUGIN_SLIDESHOW = "slideshow";
|
|
14
|
+
const PLUGIN_THUMBNAILS = "thumbnails";
|
|
15
|
+
const PLUGIN_ZOOM = "zoom";
|
|
16
|
+
const SLIDE_STATUS_LOADING = "loading";
|
|
17
|
+
const SLIDE_STATUS_PLAYING = "playing";
|
|
18
|
+
const SLIDE_STATUS_ERROR = "error";
|
|
19
|
+
const SLIDE_STATUS_COMPLETE = "complete";
|
|
20
|
+
const SLIDE_STATUS_PLACEHOLDER = "placeholder";
|
|
21
|
+
const activeSlideStatus = (status) => `active-slide-${status}`;
|
|
22
|
+
const ACTIVE_SLIDE_LOADING = activeSlideStatus(SLIDE_STATUS_LOADING);
|
|
23
|
+
const ACTIVE_SLIDE_PLAYING = activeSlideStatus(SLIDE_STATUS_PLAYING);
|
|
24
|
+
const ACTIVE_SLIDE_ERROR = activeSlideStatus(SLIDE_STATUS_ERROR);
|
|
25
|
+
const ACTIVE_SLIDE_COMPLETE = activeSlideStatus(SLIDE_STATUS_COMPLETE);
|
|
26
|
+
const CLASS_FULLSIZE = "fullsize";
|
|
27
|
+
const CLASS_FLEX_CENTER = "flex_center";
|
|
28
|
+
const CLASS_NO_SCROLL = "no_scroll";
|
|
29
|
+
const CLASS_NO_SCROLL_PADDING = "no_scroll_padding";
|
|
30
|
+
const ACTION_PREV = "prev";
|
|
31
|
+
const ACTION_NEXT = "next";
|
|
32
|
+
const ACTION_SWIPE = "swipe";
|
|
33
|
+
const ACTION_CLOSE = "close";
|
|
34
|
+
const EVENT_ON_POINTER_DOWN = "onPointerDown";
|
|
35
|
+
const EVENT_ON_POINTER_MOVE = "onPointerMove";
|
|
36
|
+
const EVENT_ON_POINTER_UP = "onPointerUp";
|
|
37
|
+
const EVENT_ON_POINTER_LEAVE = "onPointerLeave";
|
|
38
|
+
const EVENT_ON_POINTER_CANCEL = "onPointerCancel";
|
|
39
|
+
const EVENT_ON_KEY_DOWN = "onKeyDown";
|
|
40
|
+
const EVENT_ON_KEY_UP = "onKeyUp";
|
|
41
|
+
const EVENT_ON_WHEEL = "onWheel";
|
|
42
|
+
const VK_ESCAPE = "Escape";
|
|
43
|
+
const VK_ARROW_LEFT = "ArrowLeft";
|
|
44
|
+
const VK_ARROW_RIGHT = "ArrowRight";
|
|
45
|
+
const ELEMENT_BUTTON = "button";
|
|
46
|
+
const ELEMENT_ICON = "icon";
|
|
47
|
+
const IMAGE_FIT_CONTAIN = "contain";
|
|
48
|
+
const IMAGE_FIT_COVER = "cover";
|
|
49
|
+
const UNKNOWN_ACTION_TYPE = "Unknown action type";
|
|
50
|
+
|
|
51
|
+
export { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING, CLASS_FLEX_CENTER, CLASS_FULLSIZE, CLASS_NO_SCROLL, CLASS_NO_SCROLL_PADDING, ELEMENT_BUTTON, ELEMENT_ICON, EVENT_ON_KEY_DOWN, EVENT_ON_KEY_UP, EVENT_ON_POINTER_CANCEL, EVENT_ON_POINTER_DOWN, EVENT_ON_POINTER_LEAVE, EVENT_ON_POINTER_MOVE, EVENT_ON_POINTER_UP, EVENT_ON_WHEEL, IMAGE_FIT_CONTAIN, IMAGE_FIT_COVER, MODULE_CAROUSEL, MODULE_CONTROLLER, MODULE_NAVIGATION, MODULE_NO_SCROLL, MODULE_PORTAL, MODULE_ROOT, MODULE_TOOLBAR, PLUGIN_CAPTIONS, PLUGIN_COUNTER, PLUGIN_DOWNLOAD, PLUGIN_FULLSCREEN, PLUGIN_INLINE, PLUGIN_SLIDESHOW, PLUGIN_THUMBNAILS, PLUGIN_ZOOM, SLIDE_STATUS_COMPLETE, SLIDE_STATUS_ERROR, SLIDE_STATUS_LOADING, SLIDE_STATUS_PLACEHOLDER, SLIDE_STATUS_PLAYING, UNKNOWN_ACTION_TYPE, VK_ARROW_LEFT, VK_ARROW_RIGHT, VK_ESCAPE, activeSlideStatus };
|