react-lazy-load-image-component
Advanced tools
Comparing version 1.4.2 to 1.4.3
@@ -100,4 +100,4 @@ module.exports = (function(e) { | ||
i = r(1), | ||
a = u(r(4)), | ||
s = u(r(12)), | ||
s = u(r(4)), | ||
a = u(r(12)), | ||
l = u(r(2)); | ||
@@ -131,6 +131,6 @@ function u(e) { | ||
i = e.scrollPosition, | ||
a = e.visibleByDefault; | ||
s = e.visibleByDefault; | ||
return ( | ||
(r.state = { visible: a }), | ||
a && (o(), n()), | ||
(r.state = { visible: s }), | ||
s && (o(), n()), | ||
(r.onVisible = r.onVisible.bind(r)), | ||
@@ -199,3 +199,3 @@ (r.isScrollTracked = Boolean( | ||
(d && (0, l.default)()) | ||
? o.default.createElement(a.default, { | ||
? o.default.createElement(s.default, { | ||
className: t, | ||
@@ -211,3 +211,3 @@ height: i, | ||
}) | ||
: o.default.createElement(s.default, { | ||
: o.default.createElement(a.default, { | ||
className: t, | ||
@@ -276,4 +276,4 @@ delayMethod: r, | ||
i = u(r(0)), | ||
a = u(r(5)), | ||
s = r(1), | ||
s = u(r(5)), | ||
a = r(1), | ||
l = u(r(2)); | ||
@@ -365,2 +365,3 @@ function u(e) { | ||
this.LAZY_LOAD_OBSERVER && | ||
this.LAZY_LOAD_OBSERVER.observer && | ||
this.LAZY_LOAD_OBSERVER.observer.unobserve( | ||
@@ -388,3 +389,3 @@ this.placeholder | ||
t = this.placeholder.getBoundingClientRect(), | ||
r = a.default.findDOMNode(this.placeholder) | ||
r = s.default.findDOMNode(this.placeholder) | ||
.style, | ||
@@ -425,9 +426,9 @@ n = { | ||
i = t.x, | ||
a = t.x + window.innerWidth, | ||
s = t.y; | ||
s = t.x + window.innerWidth, | ||
a = t.y; | ||
return Boolean( | ||
s - r <= n.bottom && | ||
a - r <= n.bottom && | ||
o + r >= n.top && | ||
i - r <= n.right && | ||
a + r >= n.left | ||
s + r >= n.left | ||
); | ||
@@ -450,7 +451,7 @@ }, | ||
o = t.height, | ||
a = t.placeholder, | ||
s = t.style, | ||
s = t.placeholder, | ||
a = t.style, | ||
l = t.width; | ||
if (a && 'function' != typeof a.type) | ||
return i.default.cloneElement(a, { | ||
if (s && 'function' != typeof s.type) | ||
return i.default.cloneElement(s, { | ||
ref: function(t) { | ||
@@ -460,3 +461,3 @@ return (e.placeholder = t); | ||
}); | ||
var u = n({ display: 'inline-block' }, s); | ||
var u = n({ display: 'inline-block' }, a); | ||
return ( | ||
@@ -474,3 +475,3 @@ void 0 !== l && (u.width = l), | ||
}, | ||
a | ||
s | ||
) | ||
@@ -485,18 +486,18 @@ ); | ||
(c.propTypes = { | ||
onVisible: s.PropTypes.func.isRequired, | ||
className: s.PropTypes.string, | ||
height: s.PropTypes.oneOfType([ | ||
s.PropTypes.number, | ||
s.PropTypes.string, | ||
onVisible: a.PropTypes.func.isRequired, | ||
className: a.PropTypes.string, | ||
height: a.PropTypes.oneOfType([ | ||
a.PropTypes.number, | ||
a.PropTypes.string, | ||
]), | ||
placeholder: s.PropTypes.element, | ||
threshold: s.PropTypes.number, | ||
useIntersectionObserver: s.PropTypes.bool, | ||
scrollPosition: s.PropTypes.shape({ | ||
x: s.PropTypes.number.isRequired, | ||
y: s.PropTypes.number.isRequired, | ||
placeholder: a.PropTypes.element, | ||
threshold: a.PropTypes.number, | ||
useIntersectionObserver: a.PropTypes.bool, | ||
scrollPosition: a.PropTypes.shape({ | ||
x: a.PropTypes.number.isRequired, | ||
y: a.PropTypes.number.isRequired, | ||
}), | ||
width: s.PropTypes.oneOfType([ | ||
s.PropTypes.number, | ||
s.PropTypes.string, | ||
width: a.PropTypes.oneOfType([ | ||
a.PropTypes.number, | ||
a.PropTypes.string, | ||
]), | ||
@@ -544,4 +545,4 @@ }), | ||
i = p(r(0)), | ||
a = p(r(5)), | ||
s = r(1), | ||
s = p(r(5)), | ||
a = r(1), | ||
l = p(r(13)), | ||
@@ -645,3 +646,3 @@ u = p(r(14)), | ||
((0, f.default)( | ||
a.default.findDOMNode( | ||
s.default.findDOMNode( | ||
this.baseComponentRef.current | ||
@@ -660,3 +661,3 @@ ) | ||
((this.scrollElement = (0, f.default)( | ||
a.default.findDOMNode( | ||
s.default.findDOMNode( | ||
this.baseComponentRef.current | ||
@@ -751,5 +752,5 @@ ) | ||
(t.propTypes = { | ||
delayMethod: s.PropTypes.oneOf(['debounce', 'throttle']), | ||
delayTime: s.PropTypes.number, | ||
useIntersectionObserver: s.PropTypes.bool, | ||
delayMethod: a.PropTypes.oneOf(['debounce', 'throttle']), | ||
delayTime: a.PropTypes.number, | ||
useIntersectionObserver: a.PropTypes.bool, | ||
}), | ||
@@ -781,6 +782,6 @@ (t.defaultProps = { | ||
(t.trackWindowScroll = t.LazyLoadComponent = t.LazyLoadImage = void 0); | ||
var n = a(r(9)), | ||
o = a(r(3)), | ||
i = a(r(6)); | ||
function a(e) { | ||
var n = s(r(9)), | ||
o = s(r(3)), | ||
i = s(r(6)); | ||
function s(e) { | ||
return e && e.__esModule ? e : { default: e }; | ||
@@ -821,4 +822,4 @@ } | ||
i = l(r(0)), | ||
a = r(1), | ||
s = l(r(3)); | ||
s = r(1), | ||
a = l(r(3)); | ||
function l(e) { | ||
@@ -938,3 +939,3 @@ return e && e.__esModule ? e : { default: e }; | ||
o = e.delayTime, | ||
a = e.height, | ||
s = e.height, | ||
l = e.placeholder, | ||
@@ -948,3 +949,3 @@ u = e.scrollPosition, | ||
return i.default.createElement( | ||
s.default, | ||
a.default, | ||
{ | ||
@@ -955,3 +956,3 @@ beforeLoad: t, | ||
delayTime: o, | ||
height: a, | ||
height: s, | ||
placeholder: l, | ||
@@ -976,4 +977,4 @@ scrollPosition: u, | ||
o = t.placeholderSrc, | ||
a = t.width, | ||
s = t.wrapperClassName, | ||
s = t.width, | ||
a = t.wrapperClassName, | ||
l = this.state.loaded, | ||
@@ -985,3 +986,3 @@ u = l ? ' lazy-load-image-loaded' : ''; | ||
className: | ||
s + | ||
a + | ||
' lazy-load-image-background ' + | ||
@@ -998,3 +999,3 @@ r + | ||
height: n, | ||
width: a, | ||
width: s, | ||
}, | ||
@@ -1024,12 +1025,12 @@ }, | ||
(u.propTypes = { | ||
afterLoad: a.PropTypes.func, | ||
beforeLoad: a.PropTypes.func, | ||
delayMethod: a.PropTypes.string, | ||
delayTime: a.PropTypes.number, | ||
effect: a.PropTypes.string, | ||
placeholderSrc: a.PropTypes.string, | ||
threshold: a.PropTypes.number, | ||
useIntersectionObserver: a.PropTypes.bool, | ||
visibleByDefault: a.PropTypes.bool, | ||
wrapperClassName: a.PropTypes.string, | ||
afterLoad: s.PropTypes.func, | ||
beforeLoad: s.PropTypes.func, | ||
delayMethod: s.PropTypes.string, | ||
delayTime: s.PropTypes.number, | ||
effect: s.PropTypes.string, | ||
placeholderSrc: s.PropTypes.string, | ||
threshold: s.PropTypes.number, | ||
useIntersectionObserver: s.PropTypes.bool, | ||
visibleByDefault: s.PropTypes.bool, | ||
wrapperClassName: s.PropTypes.string, | ||
}), | ||
@@ -1061,8 +1062,8 @@ (u.defaultProps = { | ||
(e.exports = function() { | ||
function e(e, t, r, o, i, a) { | ||
if (a !== n) { | ||
var s = new Error( | ||
function e(e, t, r, o, i, s) { | ||
if (s !== n) { | ||
var a = new Error( | ||
'Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types' | ||
); | ||
throw ((s.name = 'Invariant Violation'), s); | ||
throw ((a.name = 'Invariant Violation'), a); | ||
} | ||
@@ -1120,6 +1121,6 @@ } | ||
})(), | ||
o = s(r(0)), | ||
i = s(r(4)), | ||
a = s(r(6)); | ||
function s(e) { | ||
o = a(r(0)), | ||
i = a(r(4)), | ||
s = a(r(6)); | ||
function a(e) { | ||
return e && e.__esModule ? e : { default: e }; | ||
@@ -1185,3 +1186,3 @@ } | ||
})(o.default.Component); | ||
t.default = (0, a.default)(l); | ||
t.default = (0, s.default)(l); | ||
}, | ||
@@ -1194,4 +1195,4 @@ function(e, t, r) { | ||
i = /^\s+|\s+$/g, | ||
a = /^[-+]0x[0-9a-f]+$/i, | ||
s = /^0b[01]+$/i, | ||
s = /^[-+]0x[0-9a-f]+$/i, | ||
a = /^0b[01]+$/i, | ||
l = /^0o[0-7]+$/i, | ||
@@ -1236,6 +1237,6 @@ u = parseInt, | ||
e = e.replace(i, ''); | ||
var r = s.test(e); | ||
var r = a.test(e); | ||
return r || l.test(e) | ||
? u(e.slice(2), r ? 2 : 8) | ||
: a.test(e) | ||
: s.test(e) | ||
? n | ||
@@ -1247,4 +1248,4 @@ : +e; | ||
i, | ||
s, | ||
a, | ||
s, | ||
l, | ||
@@ -1260,7 +1261,7 @@ u, | ||
n = i; | ||
return (o = i = void 0), (c = t), (s = e.apply(n, r)); | ||
return (o = i = void 0), (c = t), (a = e.apply(n, r)); | ||
} | ||
function w(e) { | ||
var r = e - u; | ||
return void 0 === u || r >= t || r < 0 || (p && e - c >= a); | ||
return void 0 === u || r >= t || r < 0 || (p && e - c >= s); | ||
} | ||
@@ -1274,3 +1275,3 @@ function g() { | ||
var r = t - (e - u); | ||
return p ? h(r, a - (e - c)) : r; | ||
return p ? h(r, s - (e - c)) : r; | ||
})(e) | ||
@@ -1280,3 +1281,3 @@ ); | ||
function _(e) { | ||
return (l = void 0), d && o ? O(e) : ((o = i = void 0), s); | ||
return (l = void 0), d && o ? O(e) : ((o = i = void 0), a); | ||
} | ||
@@ -1292,3 +1293,3 @@ function P() { | ||
(l = setTimeout(g, t)), | ||
f ? O(e) : s | ||
f ? O(e) : a | ||
); | ||
@@ -1298,3 +1299,3 @@ })(u); | ||
} | ||
return void 0 === l && (l = setTimeout(g, t)), s; | ||
return void 0 === l && (l = setTimeout(g, t)), a; | ||
} | ||
@@ -1305,5 +1306,5 @@ return ( | ||
((f = !!n.leading), | ||
(a = (p = 'maxWait' in n) | ||
(s = (p = 'maxWait' in n) | ||
? y(m(n.maxWait) || 0, t) | ||
: a), | ||
: s), | ||
(d = 'trailing' in n ? !!n.trailing : d)), | ||
@@ -1316,3 +1317,3 @@ (P.cancel = function() { | ||
(P.flush = function() { | ||
return void 0 === l ? s : _(b()); | ||
return void 0 === l ? a : _(b()); | ||
}), | ||
@@ -1330,4 +1331,4 @@ P | ||
i = /^\s+|\s+$/g, | ||
a = /^[-+]0x[0-9a-f]+$/i, | ||
s = /^0b[01]+$/i, | ||
s = /^[-+]0x[0-9a-f]+$/i, | ||
a = /^0b[01]+$/i, | ||
l = /^0o[0-7]+$/i, | ||
@@ -1351,4 +1352,4 @@ u = parseInt, | ||
i, | ||
s, | ||
a, | ||
s, | ||
l, | ||
@@ -1364,7 +1365,7 @@ u, | ||
n = i; | ||
return (o = i = void 0), (c = t), (s = e.apply(n, r)); | ||
return (o = i = void 0), (c = t), (a = e.apply(n, r)); | ||
} | ||
function w(e) { | ||
var r = e - u; | ||
return void 0 === u || r >= t || r < 0 || (p && e - c >= a); | ||
return void 0 === u || r >= t || r < 0 || (p && e - c >= s); | ||
} | ||
@@ -1378,3 +1379,3 @@ function g() { | ||
var r = t - (e - u); | ||
return p ? h(r, a - (e - c)) : r; | ||
return p ? h(r, s - (e - c)) : r; | ||
})(e) | ||
@@ -1384,3 +1385,3 @@ ); | ||
function _(e) { | ||
return (l = void 0), d && o ? v(e) : ((o = i = void 0), s); | ||
return (l = void 0), d && o ? v(e) : ((o = i = void 0), a); | ||
} | ||
@@ -1396,3 +1397,3 @@ function P() { | ||
(l = setTimeout(g, t)), | ||
f ? v(e) : s | ||
f ? v(e) : a | ||
); | ||
@@ -1402,3 +1403,3 @@ })(u); | ||
} | ||
return void 0 === l && (l = setTimeout(g, t)), s; | ||
return void 0 === l && (l = setTimeout(g, t)), a; | ||
} | ||
@@ -1409,5 +1410,5 @@ return ( | ||
((f = !!n.leading), | ||
(a = (p = 'maxWait' in n) | ||
(s = (p = 'maxWait' in n) | ||
? y(O(n.maxWait) || 0, t) | ||
: a), | ||
: s), | ||
(d = 'trailing' in n ? !!n.trailing : d)), | ||
@@ -1420,3 +1421,3 @@ (P.cancel = function() { | ||
(P.flush = function() { | ||
return void 0 === l ? s : _(b()); | ||
return void 0 === l ? a : _(b()); | ||
}), | ||
@@ -1450,6 +1451,6 @@ P | ||
e = e.replace(i, ''); | ||
var r = s.test(e); | ||
var r = a.test(e); | ||
return r || l.test(e) | ||
? u(e.slice(2), r ? 2 : 8) | ||
: a.test(e) | ||
: s.test(e) | ||
? n | ||
@@ -1456,0 +1457,0 @@ : +e; |
{ | ||
"name": "react-lazy-load-image-component", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"description": " React Component to lazy load images using a HOC to track window scroll position. ", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -54,3 +54,3 @@ import React from 'react'; | ||
componentWillUnmount() { | ||
if (this.LAZY_LOAD_OBSERVER) { | ||
if (this.LAZY_LOAD_OBSERVER && this.LAZY_LOAD_OBSERVER.observer) { | ||
this.LAZY_LOAD_OBSERVER.observer.unobserve(this.placeholder); | ||
@@ -57,0 +57,0 @@ } |
88124
2605