yet-another-react-lightbox 3.28.0 → 3.29.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Yet Another React Lightbox
2
2
 
3
- Modern React lightbox component. Performant, easy to use, customizable and
3
+ Modern React lightbox component. Performant, easy to use, customizable, and
4
4
  extendable.
5
5
 
6
6
  ## Overview
@@ -9,8 +9,8 @@ extendable.
9
9
  [![Bundle Size](https://img.shields.io/bundlephobia/minzip/yet-another-react-lightbox.svg?color=blue)](https://bundlephobia.com/package/yet-another-react-lightbox)
10
10
  [![License MIT](https://img.shields.io/npm/l/yet-another-react-lightbox.svg?color=blue)](https://github.com/igordanchenko/yet-another-react-lightbox/blob/main/LICENSE)
11
11
 
12
- - **Built for React:** works with React 19, 18, 17 and 16.8.0+
13
- - **UX:** supports keyboard, mouse, touchpad and touchscreen navigation
12
+ - **Built for React:** works with React 19, 18, 17, and 16.8.0+
13
+ - **UX:** supports keyboard, mouse, touchpad, and touchscreen navigation
14
14
  - **Preloading:** never displays partially downloaded images
15
15
  - **Performance:** preloads limited number of images without compromising
16
16
  performance or UX
@@ -21,7 +21,7 @@ extendable.
21
21
  - **Customization:** customize any UI element or add your own custom slides
22
22
  - **No bloat:** never bundle rarely used features; add optional features via
23
23
  plugins
24
- - **TypeScript:** type definitions come built-in in the package
24
+ - **TypeScript:** type definitions come built-in with the package
25
25
  - **RTL:** compatible with RTL layout
26
26
 
27
27
  ![Yet Another React Lightbox | Example](https://images.yet-another-react-lightbox.com/example.jpg)
@@ -158,7 +158,7 @@ The following plugins are bundled in the package:
158
158
 
159
159
  ## Sponsors
160
160
 
161
- This project is supported by the following companies, organizations and
161
+ This project is supported by the following companies, organizations, and
162
162
  individuals who help make its continued development and maintenance possible.
163
163
 
164
164
  <p align="center">
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { LightboxExternalProps, LightboxProps, Labels, Label, Slide, SlideImage, LengthOrPercentage, ContainerRect, ToolbarSettings, CarouselSettings, Component, Module, Node as Node$1, Plugin, Augmentation, EventTypes, ComponentProps, LightboxStateSwipeAction, LightboxStateUpdateAction, LightboxState, Render, ControllerSettings, ControllerRef, Callback, RenderFunction } from './types.js';
3
- export { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING, AnimationSettings, CLASS_FLEX_CENTER, CLASS_FULLSIZE, CLASS_NO_SCROLL, CLASS_NO_SCROLL_PADDING, CLASS_SLIDE, CLASS_SLIDE_WRAPPER, CLASS_SLIDE_WRAPPER_INTERACTIVE, Callbacks, ClickCallbackProps, 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, GenericSlide, IMAGE_FIT_CONTAIN, IMAGE_FIT_COVER, ImageFit, ImageSource, MODULE_CAROUSEL, MODULE_CONTROLLER, MODULE_NAVIGATION, MODULE_NO_SCROLL, MODULE_PORTAL, MODULE_ROOT, MODULE_TOOLBAR, NavigationAction, NoScrollSettings, PLUGIN_CAPTIONS, PLUGIN_COUNTER, PLUGIN_DOWNLOAD, PLUGIN_FULLSCREEN, PLUGIN_INLINE, PLUGIN_SHARE, PLUGIN_SLIDESHOW, PLUGIN_THUMBNAILS, PLUGIN_ZOOM, PluginProps, PortalSettings, RenderSlideContainerProps, RenderSlideFooterProps, RenderSlideHeaderProps, RenderSlideProps, SLIDE_STATUS_COMPLETE, SLIDE_STATUS_ERROR, SLIDE_STATUS_LOADING, SLIDE_STATUS_PLACEHOLDER, SLIDE_STATUS_PLAYING, SlideStatus, SlideTypeKey, SlideTypes, Slot, SlotStyles, SlotType, ToolbarButtonKey, ToolbarButtonKeys, UNKNOWN_ACTION_TYPE, VK_ARROW_LEFT, VK_ARROW_RIGHT, VK_ESCAPE, ViewCallbackProps, activeSlideStatus } from './types.js';
2
+ import { LightboxExternalProps, LightboxProps, ToolbarSettings, CarouselSettings, Slide, ContainerRect, LengthOrPercentage, SlideImage, Labels, Label, Component, Module, Node as Node$1, Plugin, Augmentation, EventTypes, ComponentProps, LightboxStateSwipeAction, LightboxStateUpdateAction, LightboxState, Render, ControllerSettings, ControllerRef, Callback, RenderFunction } from './types.js';
3
+ export { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING, AnimationSettings, CLASS_FLEX_CENTER, CLASS_FULLSIZE, CLASS_NO_SCROLL, CLASS_NO_SCROLL_PADDING, CLASS_SLIDE, CLASS_SLIDE_WRAPPER, CLASS_SLIDE_WRAPPER_INTERACTIVE, Callbacks, ClickCallbackProps, 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, GenericSlide, IMAGE_FIT_CONTAIN, IMAGE_FIT_COVER, ImageFit, ImageProps, ImageSource, MODULE_CAROUSEL, MODULE_CONTROLLER, MODULE_NAVIGATION, MODULE_NO_SCROLL, MODULE_PORTAL, MODULE_ROOT, MODULE_TOOLBAR, NavigationAction, NoScrollSettings, PLUGIN_CAPTIONS, PLUGIN_COUNTER, PLUGIN_DOWNLOAD, PLUGIN_FULLSCREEN, PLUGIN_INLINE, PLUGIN_SHARE, PLUGIN_SLIDESHOW, PLUGIN_THUMBNAILS, PLUGIN_ZOOM, PluginProps, PortalSettings, RenderSlideContainerProps, RenderSlideFooterProps, RenderSlideHeaderProps, RenderSlideProps, SLIDE_STATUS_COMPLETE, SLIDE_STATUS_ERROR, SLIDE_STATUS_LOADING, SLIDE_STATUS_PLACEHOLDER, SLIDE_STATUS_PLAYING, SlideStatus, SlideTypeKey, SlideTypes, Slot, SlotStyles, SlotType, ToolbarButtonKey, ToolbarButtonKeys, UNKNOWN_ACTION_TYPE, VK_ARROW_LEFT, VK_ARROW_RIGHT, VK_ESCAPE, ViewCallbackProps, activeSlideStatus } from './types.js';
4
4
 
5
5
  /** Lightbox component */
6
6
  declare function Lightbox({ carousel, animation, render, toolbar, controller, noScroll, on, plugins, slides, index, ...restProps }: LightboxExternalProps): React.JSX.Element | null;
@@ -15,7 +15,7 @@ declare function makeComposePrefix(base: string): (prefix?: string) => string;
15
15
  declare function translateLabel(labels: Labels | undefined, defaultLabel: Label): string;
16
16
  /** @deprecated - use `translateLabel` instead */
17
17
  declare function label(labels: Labels | undefined, defaultLabel: Label): string;
18
- declare function translateSlideCounter(labels: Labels | undefined, slides: Slide[], index: number): string;
18
+ declare function translateSlideCounter(labels: Labels | undefined, slides: readonly Slide[], index: number): string;
19
19
  declare function cleanup(...cleaners: (() => void)[]): () => void;
20
20
  declare function makeUseContext<T>(name: string, contextName: string, context: React.Context<T | null>): () => NonNullable<T>;
21
21
  declare function hasWindow(): boolean;
@@ -36,9 +36,9 @@ declare function computeSlideRect(containerRect: ContainerRect, padding: LengthO
36
36
  };
37
37
  declare function devicePixelRatio(): number;
38
38
  declare function getSlideIndex(index: number, slidesCount: number): number;
39
- declare function hasSlides(slides: Slide[]): slides is [Slide, ...Slide[]];
39
+ declare function hasSlides(slides: readonly Slide[]): slides is [Slide, ...Slide[]];
40
40
  declare function getSlide(slides: [Slide, ...Slide[]], index: number): SlideImage;
41
- declare function getSlideIfPresent(slides: Slide[], index: number): SlideImage | undefined;
41
+ declare function getSlideIfPresent(slides: readonly Slide[], index: number): SlideImage | undefined;
42
42
  declare function getSlideKey(slide: Slide): string | undefined;
43
43
  declare function addToolbarButton(toolbar: ToolbarSettings, key: string, button: React.ReactNode): ToolbarSettings;
44
44
  declare function stopNavigationEventsPropagation(): {
@@ -46,7 +46,7 @@ declare function stopNavigationEventsPropagation(): {
46
46
  onKeyDown: (event: React.PointerEvent | React.KeyboardEvent | React.WheelEvent) => void;
47
47
  onWheel: (event: React.PointerEvent | React.KeyboardEvent | React.WheelEvent) => void;
48
48
  };
49
- declare function calculatePreload(carousel: CarouselSettings, slides: Slide[], minimum?: number): number;
49
+ declare function calculatePreload(carousel: CarouselSettings, slides: readonly Slide[], minimum?: number): number;
50
50
  declare function makeInertWhen(condition: boolean): {
51
51
  inert: boolean;
52
52
  };
@@ -54,7 +54,7 @@ declare function reflow(node: HTMLElement): void;
54
54
 
55
55
  declare function createModule(name: string, component: Component): Module;
56
56
  declare function createNode(module: Module, children?: Node$1[]): Node$1;
57
- declare function withPlugins(root: Node$1[], plugins?: Plugin[], augmentations?: Augmentation[]): {
57
+ declare function withPlugins(root: Node$1[], plugins?: readonly Plugin[], augmentations?: Augmentation[]): {
58
58
  config: Node$1[];
59
59
  augmentation: Augmentation;
60
60
  };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ export { ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE
6
6
 
7
7
  const cssPrefix$3 = "yarl__";
8
8
  function clsx(...classes) {
9
- return [...classes].filter(Boolean).join(" ");
9
+ return classes.filter(Boolean).join(" ");
10
10
  }
11
11
  function cssClass(name) {
12
12
  return `${cssPrefix$3}${name}`;
@@ -715,10 +715,10 @@ function ImageSlide({ slide: image, offset, render, rect, imageFit, imageProps,
715
715
  maxWidth: "100%",
716
716
  maxHeight: "100%",
717
717
  };
718
- const srcSet = (_g = image.srcSet) === null || _g === void 0 ? void 0 : _g.sort((a, b) => a.width - b.width).map((item) => `${item.src} ${item.width}w`).join(", ");
718
+ const srcSet = (_g = image.srcSet) === null || _g === void 0 ? void 0 : _g.slice().sort((a, b) => a.width - b.width).map((item) => `${item.src} ${item.width}w`).join(", ");
719
719
  const estimateActualWidth = () => rect && !cover && image.width && image.height ? (rect.height / image.height) * image.width : Number.MAX_VALUE;
720
720
  const sizes = srcSet && rect && hasWindow() ? `${Math.round(Math.min(estimateActualWidth(), rect.width))}px` : undefined;
721
- const { style: imagePropsStyle, className: imagePropsClassName, ...restImageProps } = imageProps || {};
721
+ const { style: imagePropsStyle, className: imagePropsClassName, ...restImageProps } = (typeof imageProps === "function" ? imageProps(image) : imageProps) || {};
722
722
  return (React.createElement(React.Fragment, null,
723
723
  React.createElement("img", { ref: setImageRef, onLoad: handleOnLoad, onError: handleOnError, onClick: onClick, draggable: false, className: clsx(cssClass(slideImagePrefix()), cover && cssClass(slideImagePrefix("cover")), status !== SLIDE_STATUS_COMPLETE && cssClass(slideImagePrefix("loading")), imagePropsClassName), style: { ...defaultStyle, ...style, ...imagePropsStyle }, ...restImageProps, alt: (_h = image.alt) !== null && _h !== void 0 ? _h : "", sizes: sizes, srcSet: srcSet, src: image.src }),
724
724
  status !== SLIDE_STATUS_COMPLETE && (React.createElement("div", { className: cssClass(slidePrefix(SLIDE_STATUS_PLACEHOLDER)) },
@@ -39,7 +39,7 @@ declare module "yet-another-react-lightbox" {
39
39
  /** disables the capability of remote playback */
40
40
  disableRemotePlayback?: boolean;
41
41
  /** an array of video files */
42
- sources: {
42
+ sources: readonly {
43
43
  /** video source URL */
44
44
  src: string;
45
45
  /** video source type (e.g., `video/mp4`) */
package/dist/styles.css CHANGED
@@ -1 +1 @@
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:none;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;opacity:var(--yarl__pull_opacity,1);transform:translate(var(--yarl__swipe_offset,0),var(--yarl__pull_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{-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{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;-webkit-touch-callout:none}.yarl__slide_image_cover{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.yarl__slide_image_loading{opacity:0}@media screen and (min-width:800px){.yarl__slide_wrapper:not(.yarl__slide_wrapper_interactive) .yarl__slide_image{-webkit-backface-visibility:hidden;-webkit-transform:translateZ(0);-webkit-transform-style:preserve-3d}}.yarl__slide_placeholder{left:50%;line-height:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%)}.yarl__slide_loading{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{animation:yarl__stroke_opacity 1s linear infinite}.yarl__slide_loading line:first-of-type{animation-delay:-1.875s}.yarl__slide_loading line:nth-of-type(2){animation-delay:-1.75s}.yarl__slide_loading line:nth-of-type(3){animation-delay:-1.625s}.yarl__slide_loading line:nth-of-type(4){animation-delay:-1.5s}.yarl__slide_loading line:nth-of-type(5){animation-delay:-1.375s}.yarl__slide_loading line:nth-of-type(6){animation-delay:-1.25s}.yarl__slide_loading line:nth-of-type(7){animation-delay:-1.125s}.yarl__slide_loading line:nth-of-type(8){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{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-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;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);-webkit-tap-highlight-color:transparent}.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%;transform:translateY(-50%)}.yarl__navigation_prev{left:0}[dir=rtl] .yarl__navigation_prev{left:unset;right:0;transform:translateY(-50%) rotate(180deg)}.yarl__navigation_next{right:0}[dir=rtl] .yarl__navigation_next{left:0;right:unset;transform:translateY(-50%) rotate(180deg)}.yarl__no_scroll{height:100%;overflow:hidden;overscroll-behavior:none}@keyframes yarl__delayed_fadein{0%{opacity:0}80%{opacity:0}to{opacity:1}}@keyframes yarl__stroke_opacity{0%{stroke-opacity:1}to{stroke-opacity:.125}}
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:none;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;opacity:var(--yarl__pull_opacity,1);transform:translate(var(--yarl__swipe_offset,0),var(--yarl__pull_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{-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{max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;touch-action:var(--yarl__controller_touch_action,none);-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-touch-callout:none}.yarl__slide_image_cover{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.yarl__slide_image_loading{opacity:0}@media screen and (min-width:800px){.yarl__slide_wrapper:not(.yarl__slide_wrapper_interactive) .yarl__slide_image{-webkit-backface-visibility:hidden;-webkit-transform:translateZ(0);-webkit-transform-style:preserve-3d}}.yarl__slide_placeholder{left:50%;line-height:0;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%)}.yarl__slide_loading{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{animation:yarl__stroke_opacity 1s linear infinite}.yarl__slide_loading line:first-of-type{animation-delay:-1.875s}.yarl__slide_loading line:nth-of-type(2){animation-delay:-1.75s}.yarl__slide_loading line:nth-of-type(3){animation-delay:-1.625s}.yarl__slide_loading line:nth-of-type(4){animation-delay:-1.5s}.yarl__slide_loading line:nth-of-type(5){animation-delay:-1.375s}.yarl__slide_loading line:nth-of-type(6){animation-delay:-1.25s}.yarl__slide_loading line:nth-of-type(7){animation-delay:-1.125s}.yarl__slide_loading line:nth-of-type(8){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{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-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;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);-webkit-tap-highlight-color:transparent}.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%;transform:translateY(-50%)}.yarl__navigation_prev{left:0}[dir=rtl] .yarl__navigation_prev{left:unset;right:0;transform:translateY(-50%) rotate(180deg)}.yarl__navigation_next{right:0}[dir=rtl] .yarl__navigation_next{left:0;right:unset;transform:translateY(-50%) rotate(180deg)}.yarl__no_scroll{height:100%;overflow:hidden;overscroll-behavior:none}@keyframes yarl__delayed_fadein{0%{opacity:0}80%{opacity:0}to{opacity:1}}@keyframes yarl__stroke_opacity{0%{stroke-opacity:1}to{stroke-opacity:.125}}
package/dist/types.d.ts CHANGED
@@ -66,13 +66,13 @@ interface LightboxProps {
66
66
  /** starting slide index */
67
67
  index: number;
68
68
  /** slides to display in the lightbox */
69
- slides: Slide[];
69
+ slides: readonly Slide[];
70
70
  /** custom render functions */
71
71
  render: Render;
72
72
  /** custom UI labels / translations */
73
73
  labels: Labels;
74
74
  /** enabled plugins */
75
- plugins: Plugin[];
75
+ plugins: readonly Plugin[];
76
76
  /** toolbar settings */
77
77
  toolbar: ToolbarSettings;
78
78
  /** carousel settings */
@@ -120,7 +120,7 @@ interface SlideImage extends GenericSlide {
120
120
  /** `object-fit` setting */
121
121
  imageFit?: ImageFit;
122
122
  /** alternative images to be passed to the 'srcSet' */
123
- srcSet?: ImageSource[];
123
+ srcSet?: readonly ImageSource[];
124
124
  }
125
125
  /** Image source */
126
126
  interface ImageSource {
@@ -200,9 +200,10 @@ interface CarouselSettings {
200
200
  /** `object-fit` setting for image slides */
201
201
  imageFit: ImageFit;
202
202
  /** custom image attributes */
203
- imageProps: Omit<React.ImgHTMLAttributes<HTMLImageElement>, "src" | "alt" | "sizes" | "srcSet" | "onLoad" | "onError" | "onClick">;
203
+ imageProps: ImageProps | ((slide: Slide) => ImageProps);
204
204
  }
205
205
  type LengthOrPercentage = `${number}px` | `${number}%` | number;
206
+ type ImageProps = Omit<React.ImgHTMLAttributes<HTMLImageElement>, "src" | "alt" | "sizes" | "srcSet" | "onLoad" | "onError" | "onClick">;
206
207
  /** Animation settings */
207
208
  interface AnimationSettings {
208
209
  /** fade-in / fade-out animation settings */
@@ -284,13 +285,13 @@ type LightboxStateSwipeAction = {
284
285
  /** Lightbox state update action */
285
286
  type LightboxStateUpdateAction = {
286
287
  type: "update";
287
- slides: Slide[];
288
+ slides: readonly Slide[];
288
289
  index: number;
289
290
  };
290
291
  /** Lightbox state */
291
292
  interface LightboxState {
292
293
  /** lightbox slides */
293
- slides: Slide[];
294
+ slides: readonly Slide[];
294
295
  /** current slide index */
295
296
  currentIndex: number;
296
297
  /** current slide index in the (-∞, +∞) range */
@@ -407,7 +408,7 @@ type Label = keyof Labels;
407
408
  /** Toolbar settings */
408
409
  interface ToolbarSettings {
409
410
  /** buttons to render in the toolbar */
410
- buttons: (ToolbarButtonKey | React.ReactNode)[];
411
+ buttons: readonly (ToolbarButtonKey | React.ReactNode)[];
411
412
  }
412
413
  type ToolbarButtonKey = keyof ToolbarButtonKeys;
413
414
  interface ToolbarButtonKeys {
@@ -450,9 +451,9 @@ type Plugin = (props: PluginProps) => void;
450
451
  type DeepPartial<T extends object, K extends keyof T = keyof T, E extends string = never> = Omit<Partial<T>, K> & {
451
452
  [P in K]?: DeepPartialValue<T[P], E>;
452
453
  };
453
- type DeepPartialValue<T, E extends string = never> = T extends any[] ? T : T extends (...props: any[]) => any ? T : T extends object ? {
454
+ type DeepPartialValue<T, E extends string = never> = T extends readonly any[] ? T : T extends (...props: any[]) => any ? T : T extends object ? {
454
455
  [P in keyof T]?: P extends E ? T[P] : DeepPartialValue<T[P], E>;
455
456
  } : T;
456
457
 
457
458
  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, CLASS_SLIDE, CLASS_SLIDE_WRAPPER, CLASS_SLIDE_WRAPPER_INTERACTIVE, 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_SHARE, 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 };
458
- export type { AnimationSettings, Augmentation, Callback, Callbacks, CarouselSettings, ClickCallbackProps, Component, ComponentProps, ContainerRect, ControllerRef, ControllerSettings, DeepPartial, DeepPartialValue, EventTypes, GenericSlide, ImageFit, ImageSource, Label, Labels, LengthOrPercentage, LightboxExternalProps, LightboxProps, LightboxState, LightboxStateSwipeAction, LightboxStateUpdateAction, Module, NavigationAction, NoScrollSettings, Node, Plugin, PluginProps, PortalSettings, Render, RenderFunction, RenderSlideContainerProps, RenderSlideFooterProps, RenderSlideHeaderProps, RenderSlideProps, Slide, SlideImage, SlideStatus, SlideTypeKey, SlideTypes, Slot, SlotStyles, SlotType, ToolbarButtonKey, ToolbarButtonKeys, ToolbarSettings, ViewCallbackProps };
459
+ export type { AnimationSettings, Augmentation, Callback, Callbacks, CarouselSettings, ClickCallbackProps, Component, ComponentProps, ContainerRect, ControllerRef, ControllerSettings, DeepPartial, DeepPartialValue, EventTypes, GenericSlide, ImageFit, ImageProps, ImageSource, Label, Labels, LengthOrPercentage, LightboxExternalProps, LightboxProps, LightboxState, LightboxStateSwipeAction, LightboxStateUpdateAction, Module, NavigationAction, NoScrollSettings, Node, Plugin, PluginProps, PortalSettings, Render, RenderFunction, RenderSlideContainerProps, RenderSlideFooterProps, RenderSlideHeaderProps, RenderSlideProps, Slide, SlideImage, SlideStatus, SlideTypeKey, SlideTypes, Slot, SlotStyles, SlotType, ToolbarButtonKey, ToolbarButtonKeys, ToolbarSettings, ViewCallbackProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "3.28.0",
3
+ "version": "3.29.1",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",
@@ -16,10 +16,6 @@
16
16
  "types": "./dist/index.d.ts",
17
17
  "default": "./dist/index.js"
18
18
  },
19
- "./styles.css": {
20
- "types": "./dist/styles.css.d.ts",
21
- "default": "./dist/styles.css"
22
- },
23
19
  "./plugins": {
24
20
  "types": "./dist/plugins/index.d.ts",
25
21
  "default": "./dist/plugins/index.js"
@@ -28,18 +24,10 @@
28
24
  "types": "./dist/plugins/captions/index.d.ts",
29
25
  "default": "./dist/plugins/captions/index.js"
30
26
  },
31
- "./plugins/captions.css": {
32
- "types": "./dist/plugins/captions/captions.css.d.ts",
33
- "default": "./dist/plugins/captions/captions.css"
34
- },
35
27
  "./plugins/counter": {
36
28
  "types": "./dist/plugins/counter/index.d.ts",
37
29
  "default": "./dist/plugins/counter/index.js"
38
30
  },
39
- "./plugins/counter.css": {
40
- "types": "./dist/plugins/counter/counter.css.d.ts",
41
- "default": "./dist/plugins/counter/counter.css"
42
- },
43
31
  "./plugins/download": {
44
32
  "types": "./dist/plugins/download/index.d.ts",
45
33
  "default": "./dist/plugins/download/index.js"
@@ -64,10 +52,6 @@
64
52
  "types": "./dist/plugins/thumbnails/index.d.ts",
65
53
  "default": "./dist/plugins/thumbnails/index.js"
66
54
  },
67
- "./plugins/thumbnails.css": {
68
- "types": "./dist/plugins/thumbnails/thumbnails.css.d.ts",
69
- "default": "./dist/plugins/thumbnails/thumbnails.css"
70
- },
71
55
  "./plugins/video": {
72
56
  "types": "./dist/plugins/video/index.d.ts",
73
57
  "default": "./dist/plugins/video/index.js"
@@ -75,7 +59,11 @@
75
59
  "./plugins/zoom": {
76
60
  "types": "./dist/plugins/zoom/index.d.ts",
77
61
  "default": "./dist/plugins/zoom/index.js"
78
- }
62
+ },
63
+ "./styles.css": "./dist/styles.css",
64
+ "./plugins/captions.css": "./dist/plugins/captions/captions.css",
65
+ "./plugins/counter.css": "./dist/plugins/counter/counter.css",
66
+ "./plugins/thumbnails.css": "./dist/plugins/thumbnails/thumbnails.css"
79
67
  },
80
68
  "typesVersions": {
81
69
  "*": {
@@ -85,24 +73,15 @@
85
73
  "core": [
86
74
  "dist/index.d.ts"
87
75
  ],
88
- "styles.css": [
89
- "dist/styles.css.d.ts"
90
- ],
91
76
  "plugins": [
92
77
  "dist/plugins/index.d.ts"
93
78
  ],
94
79
  "plugins/captions": [
95
80
  "dist/plugins/captions/index.d.ts"
96
81
  ],
97
- "plugins/captions.css": [
98
- "dist/plugins/captions/captions.css.d.ts"
99
- ],
100
82
  "plugins/counter": [
101
83
  "dist/plugins/counter/index.d.ts"
102
84
  ],
103
- "plugins/counter.css": [
104
- "dist/plugins/counter/counter.css.d.ts"
105
- ],
106
85
  "plugins/download": [
107
86
  "dist/plugins/download/index.d.ts"
108
87
  ],
@@ -121,9 +100,6 @@
121
100
  "plugins/thumbnails": [
122
101
  "dist/plugins/thumbnails/index.d.ts"
123
102
  ],
124
- "plugins/thumbnails.css": [
125
- "dist/plugins/thumbnails/thumbnails.css.d.ts"
126
- ],
127
103
  "plugins/video": [
128
104
  "dist/plugins/video/index.d.ts"
129
105
  ],
@@ -1,2 +0,0 @@
1
- declare const styles: unknown;
2
- export default styles;
@@ -1,2 +0,0 @@
1
- declare const styles: unknown;
2
- export default styles;
@@ -1,2 +0,0 @@
1
- declare const styles: unknown;
2
- export default styles;
@@ -1,2 +0,0 @@
1
- declare const styles: unknown;
2
- export default styles;