@tanem/react-nprogress
Advanced tools
Comparing version 1.0.10 to 1.0.11
# Changelog | ||
## [v1.0.10](https://github.com/tanem/react-nprogress/tree/v1.0.10) (2018-10-25) | ||
## [v1.0.11](https://github.com/tanem/react-nprogress/tree/v1.0.11) (2018-10-27) | ||
[Full Changelog](https://github.com/tanem/react-nprogress/compare/v1.0.10...v1.0.11) | ||
**Merged pull requests:** | ||
- Ensure end animations run immediately [\#23](https://github.com/tanem/react-nprogress/pull/23) ([tanem](https://github.com/tanem)) | ||
## [v1.0.10](https://github.com/tanem/react-nprogress/tree/v1.0.10) (2018-10-24) | ||
[Full Changelog](https://github.com/tanem/react-nprogress/compare/v1.0.9...v1.0.10) | ||
@@ -5,0 +12,0 @@ |
@@ -131,2 +131,24 @@ 'use strict'; | ||
n = clamp(n, this.props.minimum, 1); | ||
if (n === 1) { | ||
this.cleanup(); | ||
queue(function (next) { | ||
_this3.setState(function () { | ||
return { | ||
progress: n | ||
}; | ||
}, function () { | ||
return timeout(next, _this3.props.animationDuration); | ||
}); | ||
}); | ||
queue(function () { | ||
_this3.setState(function () { | ||
return { | ||
isFinished: true | ||
}; | ||
}, _this3.cleanup); | ||
}); | ||
return; | ||
} | ||
queue(function (next) { | ||
@@ -141,14 +163,2 @@ _this3.setState(function () { | ||
}); | ||
if (n === 1) { | ||
queue(function () { | ||
_this3.setState(function () { | ||
return { | ||
isFinished: true | ||
}; | ||
}, function () { | ||
return _this3.cleanup(); | ||
}); | ||
}); | ||
} | ||
}; | ||
@@ -155,0 +165,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";function _interopDefault(n){return n&&"object"==typeof n&&"default"in n?n.default:n}var handle,_extends=_interopDefault(require("@babel/runtime/helpers/extends")),_inheritsLoose=_interopDefault(require("@babel/runtime/helpers/inheritsLoose")),React=require("react"),clamp=function(n,t,i){return n=t<=(n=n<=i?n:i)?n:t},increment=function(n){var t=0;return 0<=n&&n<.2?t=.1:.2<=n&&n<.5?t=.04:.5<=n&&n<.8?t=.02:.8<=n&&n<.99&&(t=.005),clamp(n+t,0,.994)},isRunning=!1,pending=[],next=function n(){isRunning=!0;var t=pending.shift();if(t)return t(n);isRunning=!1},clear=function(){isRunning=!1,pending=[]},queue=function(n){pending.push(n),isRunning||1!==pending.length||next()},cancel=function(){handle&&window.cancelAnimationFrame(handle)},timeout=function(i,e){var r;handle=window.requestAnimationFrame(function n(t){e<t-(r=r||t)?i():handle=window.requestAnimationFrame(n)})},ReactNProgress=function(r){function n(){for(var n,t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];return(n=r.call.apply(r,[this].concat(i))||this).initialState={isFinished:!1,progress:0},n.state=n.initialState,n}_inheritsLoose(n,r);var t=n.prototype;return t.start=function(){var i=this;!function t(){i.trickle(),queue(function(n){timeout(function(){t(),n()},i.props.incrementDuration)})}()},t.trickle=function(){this.set(increment(this.state.progress))},t.set=function(t){var i=this;t=clamp(t,this.props.minimum,1),queue(function(n){i.setState(function(){return{progress:t}},function(){return timeout(n,i.props.animationDuration)})}),1===t&&queue(function(){i.setState(function(){return{isFinished:!0}},function(){return i.cleanup()})})},t.cleanup=function(){cancel(),clear()},t.done=function(){this.set(1)},t.componentDidMount=function(){this.props.isAnimating&&this.start()},t.componentDidUpdate=function(n){var t=this;n.isAnimating&&!this.props.isAnimating&&this.done(),!n.isAnimating&&this.props.isAnimating&&this.setState(function(){return t.initialState},function(){return t.start()})},t.componentWillUnmount=function(){this.cleanup()},t.render=function(){return this.props.children(_extends({},this.state,{animationDuration:this.props.animationDuration}))},n}(React.Component);ReactNProgress.defaultProps={animationDuration:200,incrementDuration:800,isAnimating:!1,minimum:.08},module.exports=ReactNProgress; | ||
"use strict";function _interopDefault(n){return n&&"object"==typeof n&&"default"in n?n.default:n}var handle,_extends=_interopDefault(require("@babel/runtime/helpers/extends")),_inheritsLoose=_interopDefault(require("@babel/runtime/helpers/inheritsLoose")),React=require("react"),clamp=function(n,t,i){return n=t<=(n=n<=i?n:i)?n:t},increment=function(n){var t=0;return 0<=n&&n<.2?t=.1:.2<=n&&n<.5?t=.04:.5<=n&&n<.8?t=.02:.8<=n&&n<.99&&(t=.005),clamp(n+t,0,.994)},isRunning=!1,pending=[],next=function n(){isRunning=!0;var t=pending.shift();if(t)return t(n);isRunning=!1},clear=function(){isRunning=!1,pending=[]},queue=function(n){pending.push(n),isRunning||1!==pending.length||next()},cancel=function(){handle&&window.cancelAnimationFrame(handle)},timeout=function(i,e){var r;handle=window.requestAnimationFrame(function n(t){e<t-(r=r||t)?i():handle=window.requestAnimationFrame(n)})},ReactNProgress=function(r){function n(){for(var n,t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];return(n=r.call.apply(r,[this].concat(i))||this).initialState={isFinished:!1,progress:0},n.state=n.initialState,n}_inheritsLoose(n,r);var t=n.prototype;return t.start=function(){var i=this;!function t(){i.trickle(),queue(function(n){timeout(function(){t(),n()},i.props.incrementDuration)})}()},t.trickle=function(){this.set(increment(this.state.progress))},t.set=function(t){var i=this;if(1===(t=clamp(t,this.props.minimum,1)))return this.cleanup(),queue(function(n){i.setState(function(){return{progress:t}},function(){return timeout(n,i.props.animationDuration)})}),void queue(function(){i.setState(function(){return{isFinished:!0}},i.cleanup)});queue(function(n){i.setState(function(){return{progress:t}},function(){return timeout(n,i.props.animationDuration)})})},t.cleanup=function(){cancel(),clear()},t.done=function(){this.set(1)},t.componentDidMount=function(){this.props.isAnimating&&this.start()},t.componentDidUpdate=function(n){var t=this;n.isAnimating&&!this.props.isAnimating&&this.done(),!n.isAnimating&&this.props.isAnimating&&this.setState(function(){return t.initialState},function(){return t.start()})},t.componentWillUnmount=function(){this.cleanup()},t.render=function(){return this.props.children(_extends({},this.state,{animationDuration:this.props.animationDuration}))},n}(React.Component);ReactNProgress.defaultProps={animationDuration:200,incrementDuration:800,isAnimating:!1,minimum:.08},module.exports=ReactNProgress; | ||
//# sourceMappingURL=react-nprogress.production.min.js.map |
@@ -127,2 +127,24 @@ import _extends from '@babel/runtime/helpers/extends'; | ||
n = clamp(n, this.props.minimum, 1); | ||
if (n === 1) { | ||
this.cleanup(); | ||
queue(function (next) { | ||
_this3.setState(function () { | ||
return { | ||
progress: n | ||
}; | ||
}, function () { | ||
return timeout(next, _this3.props.animationDuration); | ||
}); | ||
}); | ||
queue(function () { | ||
_this3.setState(function () { | ||
return { | ||
isFinished: true | ||
}; | ||
}, _this3.cleanup); | ||
}); | ||
return; | ||
} | ||
queue(function (next) { | ||
@@ -137,14 +159,2 @@ _this3.setState(function () { | ||
}); | ||
if (n === 1) { | ||
queue(function () { | ||
_this3.setState(function () { | ||
return { | ||
isFinished: true | ||
}; | ||
}, function () { | ||
return _this3.cleanup(); | ||
}); | ||
}); | ||
} | ||
}; | ||
@@ -151,0 +161,0 @@ |
{ | ||
"name": "@tanem/react-nprogress", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "A React primitive for building slim progress bars inspired by Google, YouTube, and Medium.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -162,2 +162,24 @@ (function (global, factory) { | ||
n = clamp(n, this.props.minimum, 1); | ||
if (n === 1) { | ||
this.cleanup(); | ||
queue(function (next) { | ||
_this3.setState(function () { | ||
return { | ||
progress: n | ||
}; | ||
}, function () { | ||
return timeout(next, _this3.props.animationDuration); | ||
}); | ||
}); | ||
queue(function () { | ||
_this3.setState(function () { | ||
return { | ||
isFinished: true | ||
}; | ||
}, _this3.cleanup); | ||
}); | ||
return; | ||
} | ||
queue(function (next) { | ||
@@ -172,14 +194,2 @@ _this3.setState(function () { | ||
}); | ||
if (n === 1) { | ||
queue(function () { | ||
_this3.setState(function () { | ||
return { | ||
isFinished: true | ||
}; | ||
}, function () { | ||
return _this3.cleanup(); | ||
}); | ||
}); | ||
} | ||
}; | ||
@@ -186,0 +196,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):t.NProgress=n(t.React)}(this,function(t){"use strict";var n,i=(function(t){function n(){return t.exports=n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},n.apply(this,arguments)}t.exports=n}(n={exports:{}},n.exports),n.exports);var e,o=function(t,n){t.prototype=Object.create(n.prototype),(t.prototype.constructor=t).__proto__=n},s=function(t,n,i){return t=n<=(t=t<=i?t:i)?t:n},a=!1,u=[],c=function(t){u.push(t),a||1!==u.length||function t(){a=!0;var n=u.shift();if(n)return n(t);a=!1}()},p=function(i,o){var r;e=window.requestAnimationFrame(function t(n){o<n-(r=r||n)?i():e=window.requestAnimationFrame(t)})},r=function(r){function t(){for(var t,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return(t=r.call.apply(r,[this].concat(i))||this).initialState={isFinished:!1,progress:0},t.state=t.initialState,t}o(t,r);var n=t.prototype;return n.start=function(){var i=this;!function n(){i.trickle(),c(function(t){p(function(){n(),t()},i.props.incrementDuration)})}()},n.trickle=function(){var t,n;this.set((t=this.state.progress,(n=0)<=t&&t<.2?n=.1:.2<=t&&t<.5?n=.04:.5<=t&&t<.8?n=.02:.8<=t&&t<.99&&(n=.005),s(t+n,0,.994)))},n.set=function(n){var i=this;n=s(n,this.props.minimum,1),c(function(t){i.setState(function(){return{progress:n}},function(){return p(t,i.props.animationDuration)})}),1===n&&c(function(){i.setState(function(){return{isFinished:!0}},function(){return i.cleanup()})})},n.cleanup=function(){e&&window.cancelAnimationFrame(e),a=!1,u=[]},n.done=function(){this.set(1)},n.componentDidMount=function(){this.props.isAnimating&&this.start()},n.componentDidUpdate=function(t){var n=this;t.isAnimating&&!this.props.isAnimating&&this.done(),!t.isAnimating&&this.props.isAnimating&&this.setState(function(){return n.initialState},function(){return n.start()})},n.componentWillUnmount=function(){this.cleanup()},n.render=function(){return this.props.children(i({},this.state,{animationDuration:this.props.animationDuration}))},t}(t.Component);return r.defaultProps={animationDuration:200,incrementDuration:800,isAnimating:!1,minimum:.08},r}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):t.NProgress=n(t.React)}(this,function(t){"use strict";var n,i=(function(t){function n(){return t.exports=n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},n.apply(this,arguments)}t.exports=n}(n={exports:{}},n.exports),n.exports);var e,r=function(t,n){t.prototype=Object.create(n.prototype),(t.prototype.constructor=t).__proto__=n},s=function(t,n,i){return t=n<=(t=t<=i?t:i)?t:n},a=!1,u=[],c=function(t){u.push(t),a||1!==u.length||function t(){a=!0;var n=u.shift();if(n)return n(t);a=!1}()},p=function(i,r){var o;e=window.requestAnimationFrame(function t(n){r<n-(o=o||n)?i():e=window.requestAnimationFrame(t)})},o=function(o){function t(){for(var t,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return(t=o.call.apply(o,[this].concat(i))||this).initialState={isFinished:!1,progress:0},t.state=t.initialState,t}r(t,o);var n=t.prototype;return n.start=function(){var i=this;!function n(){i.trickle(),c(function(t){p(function(){n(),t()},i.props.incrementDuration)})}()},n.trickle=function(){var t,n;this.set((t=this.state.progress,(n=0)<=t&&t<.2?n=.1:.2<=t&&t<.5?n=.04:.5<=t&&t<.8?n=.02:.8<=t&&t<.99&&(n=.005),s(t+n,0,.994)))},n.set=function(n){var i=this;if(1===(n=s(n,this.props.minimum,1)))return this.cleanup(),c(function(t){i.setState(function(){return{progress:n}},function(){return p(t,i.props.animationDuration)})}),void c(function(){i.setState(function(){return{isFinished:!0}},i.cleanup)});c(function(t){i.setState(function(){return{progress:n}},function(){return p(t,i.props.animationDuration)})})},n.cleanup=function(){e&&window.cancelAnimationFrame(e),a=!1,u=[]},n.done=function(){this.set(1)},n.componentDidMount=function(){this.props.isAnimating&&this.start()},n.componentDidUpdate=function(t){var n=this;t.isAnimating&&!this.props.isAnimating&&this.done(),!t.isAnimating&&this.props.isAnimating&&this.setState(function(){return n.initialState},function(){return n.start()})},n.componentWillUnmount=function(){this.cleanup()},n.render=function(){return this.props.children(i({},this.state,{animationDuration:this.props.animationDuration}))},t}(t.Component);return o.defaultProps={animationDuration:200,incrementDuration:800,isAnimating:!1,minimum:.08},o}); | ||
//# sourceMappingURL=react-nprogress.production.min.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79074
642