yet-another-react-lightbox 1.9.3 → 1.9.4

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
@@ -22,11 +22,11 @@ Modern React lightbox component. Performant, easy to use, customizable and exten
22
22
 
23
23
  ## Documentation
24
24
 
25
- [https://yet-another-react-lightbox.vercel.app/documentation](https://yet-another-react-lightbox.vercel.app/documentation)
25
+ [https://yet-another-react-lightbox.com/documentation](https://yet-another-react-lightbox.com/documentation)
26
26
 
27
27
  ## Examples
28
28
 
29
- [https://yet-another-react-lightbox.vercel.app/examples](https://yet-another-react-lightbox.vercel.app/examples)
29
+ [https://yet-another-react-lightbox.com/examples](https://yet-another-react-lightbox.com/examples)
30
30
 
31
31
  ## Installation
32
32
 
@@ -121,7 +121,7 @@ export default App;
121
121
  ```
122
122
 
123
123
  You can also integrate 3rd-party image components (e.g., Next.js Image or Gatsby Image) via a custom render function.
124
- See [examples](https://yet-another-react-lightbox.vercel.app/examples) on the documentation website.
124
+ See [examples](https://yet-another-react-lightbox.com/examples) on the documentation website.
125
125
 
126
126
  ## Plugins
127
127
 
@@ -129,14 +129,14 @@ Yet Another React Lightbox allows you to add optional features based on your req
129
129
 
130
130
  The following plugins come bundled in the package:
131
131
 
132
- - [Captions](https://yet-another-react-lightbox.vercel.app/plugins/captions) - adds support for slide title and
132
+ - [Captions](https://yet-another-react-lightbox.com/plugins/captions) - adds support for slide title and
133
133
  description
134
- - [Fullscreen](https://yet-another-react-lightbox.vercel.app/plugins/fullscreen) - adds support for fullscreen mode
135
- - [Inline](https://yet-another-react-lightbox.vercel.app/plugins/inline) - adds support for inline rendering mode
136
- - [Slideshow](https://yet-another-react-lightbox.vercel.app/plugins/slideshow) - adds slideshow autoplay feature
137
- - [Thumbnails](https://yet-another-react-lightbox.vercel.app/plugins/thumbnails) - adds thumbnails track
138
- - [Video](https://yet-another-react-lightbox.vercel.app/plugins/video) - adds support for video slides
139
- - [Zoom](https://yet-another-react-lightbox.vercel.app/plugins/zoom) - adds image zoom feature
134
+ - [Fullscreen](https://yet-another-react-lightbox.com/plugins/fullscreen) - adds support for fullscreen mode
135
+ - [Inline](https://yet-another-react-lightbox.com/plugins/inline) - adds support for inline rendering mode
136
+ - [Slideshow](https://yet-another-react-lightbox.com/plugins/slideshow) - adds slideshow autoplay feature
137
+ - [Thumbnails](https://yet-another-react-lightbox.com/plugins/thumbnails) - adds thumbnails track
138
+ - [Video](https://yet-another-react-lightbox.com/plugins/video) - adds support for video slides
139
+ - [Zoom](https://yet-another-react-lightbox.com/plugins/zoom) - adds image zoom feature
140
140
 
141
141
  ## License
142
142
 
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { adjustDevicePixelRatio, clsx, cssClass, hasWindow } from "../utils.js";
2
+ import { clsx, cssClass, hasWindow } from "../utils.js";
3
3
  import { useLatest } from "../hooks/index.js";
4
4
  import { useEvents } from "../contexts/index.js";
5
5
  import { ErrorIcon, LoadingIcon } from "./Icons.js";
@@ -42,8 +42,8 @@ export const ImageSlide = ({ slide: image, offset, render, rect, imageFit }) =>
42
42
  }, []);
43
43
  const cover = image.imageFit === "cover" || (image.imageFit !== "contain" && imageFit === "cover");
44
44
  const nonInfinite = (value, fallback) => (Number.isFinite(value) ? value : fallback);
45
- const maxWidth = adjustDevicePixelRatio(nonInfinite(Math.max(...((_b = (_a = image.srcSet) === null || _a === void 0 ? void 0 : _a.map((x) => x.width)) !== null && _b !== void 0 ? _b : []).concat(image.width ? [image.width] : [])), ((_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalWidth) || 0));
46
- const maxHeight = adjustDevicePixelRatio(nonInfinite(Math.max(...((_e = (_d = image.srcSet) === null || _d === void 0 ? void 0 : _d.map((x) => x.height).filter((x) => Boolean(x))) !== null && _e !== void 0 ? _e : []).concat(image.height ? [image.height] : [])), (image.aspectRatio && maxWidth ? maxWidth / image.aspectRatio : (_f = imageRef.current) === null || _f === void 0 ? void 0 : _f.naturalHeight) || 0));
45
+ const maxWidth = nonInfinite(Math.max(...((_b = (_a = image.srcSet) === null || _a === void 0 ? void 0 : _a.map((x) => x.width)) !== null && _b !== void 0 ? _b : []).concat(image.width ? [image.width] : [])), ((_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalWidth) || 0);
46
+ const maxHeight = nonInfinite(Math.max(...((_e = (_d = image.srcSet) === null || _d === void 0 ? void 0 : _d.map((x) => x.height).filter((x) => Boolean(x))) !== null && _e !== void 0 ? _e : []).concat(image.height ? [image.height] : [])), (image.aspectRatio && maxWidth ? maxWidth / image.aspectRatio : (_f = imageRef.current) === null || _f === void 0 ? void 0 : _f.naturalHeight) || 0);
47
47
  const style = maxWidth && maxHeight ? { maxWidth, maxHeight } : undefined;
48
48
  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(", ");
49
49
  const estimateActualWidth = () => {
@@ -8,5 +8,4 @@ export declare const cleanup: (...cleaners: (() => void)[]) => () => void;
8
8
  export declare const makeUseContext: <T>(name: string, contextName: string, context: React.Context<T | null>) => () => T;
9
9
  export declare const hasWindow: () => boolean;
10
10
  export declare const isDefined: <T = any>(x: T | undefined) => x is T;
11
- export declare const adjustDevicePixelRatio: (value: number) => number;
12
11
  export declare const round: (value: number, decimals?: number) => number;
@@ -18,7 +18,6 @@ export const makeUseContext = (name, contextName, context) => () => {
18
18
  };
19
19
  export const hasWindow = () => typeof window !== "undefined";
20
20
  export const isDefined = (x) => typeof x !== "undefined";
21
- export const adjustDevicePixelRatio = (value) => hasWindow() ? Math.round(value / (window.devicePixelRatio || 1)) : value;
22
21
  export const round = (value, decimals = 0) => {
23
22
  const factor = 10 ** decimals;
24
23
  return Math.round((value + Number.EPSILON) * factor) / factor;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { adjustDevicePixelRatio, cleanup, clsx, createIcon, createModule, cssClass, IconButton, ImageSlide, label, makeUseContext, round, useContainerRect, useController, useEnhancedEffect, useEvents, useMotionPreference, } from "../core/index.js";
2
+ import { cleanup, clsx, createIcon, createModule, cssClass, IconButton, ImageSlide, label, makeUseContext, round, useContainerRect, useController, useEnhancedEffect, useEvents, useMotionPreference, } from "../core/index.js";
3
3
  const defaultZoomProps = {
4
4
  maxZoomPixelRatio: 1,
5
5
  zoomInMultiplier: 2,
@@ -106,8 +106,8 @@ const getSlideRects = (slide, cover, maxZoomPixelRatio, rect) => {
106
106
  }
107
107
  : { width, height };
108
108
  maxSlideRect = {
109
- width: adjustDevicePixelRatio(maxSlideRect.width) * maxZoomPixelRatio,
110
- height: adjustDevicePixelRatio(maxSlideRect.height) * maxZoomPixelRatio,
109
+ width: maxSlideRect.width * maxZoomPixelRatio,
110
+ height: maxSlideRect.height * maxZoomPixelRatio,
111
111
  };
112
112
  slideRect = cover
113
113
  ? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "1.9.3",
3
+ "version": "1.9.4",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",
@@ -60,7 +60,7 @@
60
60
  "dist"
61
61
  ],
62
62
  "sideEffects": false,
63
- "homepage": "https://yet-another-react-lightbox.vercel.app/",
63
+ "homepage": "https://yet-another-react-lightbox.com",
64
64
  "repository": {
65
65
  "type": "git",
66
66
  "url": "https://github.com/igordanchenko/yet-another-react-lightbox.git"
@@ -107,7 +107,7 @@
107
107
  "eslint-config-prettier": "^8.5.0",
108
108
  "eslint-plugin-import": "^2.26.0",
109
109
  "eslint-plugin-jsx-a11y": "^6.6.0",
110
- "eslint-plugin-prettier": "^4.1.0",
110
+ "eslint-plugin-prettier": "^4.2.1",
111
111
  "eslint-plugin-react": "^7.30.1",
112
112
  "eslint-plugin-react-hooks": "^4.6.0",
113
113
  "husky": "^8.0.1",
@@ -116,7 +116,7 @@
116
116
  "lint-staged": "^13.0.3",
117
117
  "npm-run-all": "^4.1.5",
118
118
  "postcss": "^8.4.14",
119
- "postcss-cli": "^9.1.0",
119
+ "postcss-cli": "^10.0.0",
120
120
  "prettier": "^2.7.1",
121
121
  "react": "^18.2.0",
122
122
  "react-dom": "^18.2.0",