Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-spring-lightbox

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-spring-lightbox - npm Package Compare versions

Comparing version 1.4.6 to 1.4.7

9

CHANGELOG.md

@@ -5,2 +5,11 @@ # Changelog

## [1.4.7] - 2020-04-05
### Added
- Lower distance and velocity gesture threshold for a paging between images
- Allow click to zoom while a paging animation completes
- Upgrade to `rollup@2.3.3` and `react-use-gesture@7.0.10`
- Add `sideEffects: false` to `package.json`
## [1.4.6] - 2020-04-04

@@ -7,0 +16,0 @@

24

dist/index.cjs.js

@@ -239,3 +239,2 @@ 'use strict';

if (f.scale === 1) setDisableDrag(false);
setIsPanningImage(false);
}

@@ -533,17 +532,10 @@ });

var xDelta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var onRest = function onRest() {
return isDragging && setIsDragging(false);
};
var x = (i - currentIndex) * pageWidth + (down ? xDelta : 0);
if (i < currentIndex - 1 || i > currentIndex + 1) return {
x: x,
display: 'none',
onRest: onRest
display: 'none'
};
return {
x: x,
display: 'flex',
onRest: onRest
display: 'flex'
};

@@ -597,3 +589,3 @@ };

var draggedFarEnough = distance > pageWidth / 3;
var draggedFastEnough = velocity > 1 && distance <= pageWidth / 3; // Handle next/prev image from valid drag
var draggedFastEnough = velocity > 1.5 && distance <= pageWidth / 3; // Handle next/prev image from valid drag

@@ -613,2 +605,3 @@ if (draggedFarEnough || draggedFastEnough) {

});
setIsDragging(false);
},

@@ -630,4 +623,4 @@ onDrag: function onDrag(_ref3) {

var isHorizontalDrag = Math.abs(xDir) > 0.7;
var draggedFarEnough = down && isHorizontalDrag && distance > pageWidth / 3;
var draggedFastEnough = down && isHorizontalDrag && velocity > 2.5; // Handle next/prev image from valid drag
var draggedFarEnough = down && isHorizontalDrag && distance > pageWidth / 3.5;
var draggedFastEnough = down && isHorizontalDrag && velocity > 2; // Handle next/prev image from valid drag

@@ -648,2 +641,5 @@ if (draggedFarEnough || draggedFastEnough) {

});
},
onDragEnd: function onDragEnd() {
return setIsDragging(false);
}

@@ -682,3 +678,3 @@ },

onClick: function onClick() {
return Math.abs(x.value) < 1 && onClose();
return Math.abs(x.value) < 1 && !disableDrag && onClose();
}

@@ -685,0 +681,0 @@ }, /*#__PURE__*/React__default.createElement(PagerContentWrapper, null, /*#__PURE__*/React__default.createElement(PagerInnerContentWrapper, null, /*#__PURE__*/React__default.createElement(ImageContainer, {

@@ -6,3 +6,3 @@ import React, { useEffect, useState, useRef } from 'react';

import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import { animated, useSpring, config, to, useSprings, useTransition } from '@react-spring/web';
import { useSpring, config, to, animated, useSprings, useTransition } from '@react-spring/web';
import { useGesture } from 'react-use-gesture';

@@ -235,3 +235,2 @@ import clamp from 'lodash.clamp';

if (f.scale === 1) setDisableDrag(false);
setIsPanningImage(false);
}

@@ -529,17 +528,10 @@ });

var xDelta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var onRest = function onRest() {
return isDragging && setIsDragging(false);
};
var x = (i - currentIndex) * pageWidth + (down ? xDelta : 0);
if (i < currentIndex - 1 || i > currentIndex + 1) return {
x: x,
display: 'none',
onRest: onRest
display: 'none'
};
return {
x: x,
display: 'flex',
onRest: onRest
display: 'flex'
};

@@ -593,3 +585,3 @@ };

var draggedFarEnough = distance > pageWidth / 3;
var draggedFastEnough = velocity > 1 && distance <= pageWidth / 3; // Handle next/prev image from valid drag
var draggedFastEnough = velocity > 1.5 && distance <= pageWidth / 3; // Handle next/prev image from valid drag

@@ -609,2 +601,3 @@ if (draggedFarEnough || draggedFastEnough) {

});
setIsDragging(false);
},

@@ -626,4 +619,4 @@ onDrag: function onDrag(_ref3) {

var isHorizontalDrag = Math.abs(xDir) > 0.7;
var draggedFarEnough = down && isHorizontalDrag && distance > pageWidth / 3;
var draggedFastEnough = down && isHorizontalDrag && velocity > 2.5; // Handle next/prev image from valid drag
var draggedFarEnough = down && isHorizontalDrag && distance > pageWidth / 3.5;
var draggedFastEnough = down && isHorizontalDrag && velocity > 2; // Handle next/prev image from valid drag

@@ -644,2 +637,5 @@ if (draggedFarEnough || draggedFastEnough) {

});
},
onDragEnd: function onDragEnd() {
return setIsDragging(false);
}

@@ -678,3 +674,3 @@ },

onClick: function onClick() {
return Math.abs(x.value) < 1 && onClose();
return Math.abs(x.value) < 1 && !disableDrag && onClose();
}

@@ -681,0 +677,0 @@ }, /*#__PURE__*/React.createElement(PagerContentWrapper, null, /*#__PURE__*/React.createElement(PagerInnerContentWrapper, null, /*#__PURE__*/React.createElement(ImageContainer, {

{
"name": "react-spring-lightbox",
"version": "1.4.6",
"version": "1.4.7",
"description": "A flexible image gallery lightbox with native-feeling touch gestures and buttery smooth animations, built with react-spring.",

@@ -8,2 +8,3 @@ "author": "Tim Ellenberger <timellenberger@gmail.com>",

"repository": "tim-soft/react-spring-lightbox",
"sideEffects": false,
"bugs": {

@@ -90,3 +91,3 @@ "url": "https://github.com/tim-soft/react-spring-lightbox/issues"

"jest": "^25.2.3",
"lint-staged": "^10.1.1",
"lint-staged": "^10.1.2",
"prettier": "^1.19.1",

@@ -96,3 +97,3 @@ "react": "^16.13.1",

"react-is": "^16.13.1",
"rollup": "^2.3.2",
"rollup": "^2.3.3",
"rollup-plugin-babel": "^4.4.0",

@@ -108,4 +109,4 @@ "rollup-plugin-filesize": "^6.2.1",

"lodash.clamp": "^4.0.3",
"react-use-gesture": "^7.0.9"
"react-use-gesture": "^7.0.10"
}
}

@@ -0,0 +0,0 @@ # react-spring-lightbox

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc