@tanem/react-nprogress
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -8,3 +8,2 @@ 'use strict'; | ||
var React = require('react'); | ||
var reactUse = require('react-use'); | ||
var hoistNonReactStatics = require('hoist-non-react-statics'); | ||
@@ -127,4 +126,69 @@ | ||
// Hat-tip: | ||
var useEffectOnce = function useEffectOnce(effect) { | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
React.useEffect(effect, []); | ||
}; | ||
var incrementParameter = function incrementParameter(num) { | ||
return ++num % 1000000; | ||
}; | ||
var useUpdate = function useUpdate() { | ||
var _useState = React.useState(0), | ||
setState = _useState[1]; | ||
return React.useCallback(function () { | ||
return setState(incrementParameter); | ||
}, []); | ||
}; | ||
var useGetSetState = function useGetSetState( | ||
/* istanbul ignore next */ | ||
initialState) { | ||
if (initialState === void 0) { | ||
initialState = {}; | ||
} | ||
var update = useUpdate(); | ||
var state = React.useRef(_extends__default["default"]({}, initialState)); | ||
var get = React.useCallback(function () { | ||
return state.current; | ||
}, []); | ||
var set = React.useCallback(function (patch) { | ||
if (!patch) { | ||
return; | ||
} | ||
Object.assign(state.current, patch); | ||
update(); // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
return [get, set]; | ||
}; | ||
// Hat-tip: | ||
var useFirstMountState = function useFirstMountState() { | ||
var isFirst = React.useRef(true); | ||
if (isFirst.current) { | ||
isFirst.current = false; | ||
return true; | ||
} | ||
return isFirst.current; | ||
}; | ||
var useUpdateEffect = function useUpdateEffect(effect, deps) { | ||
var isFirstMount = useFirstMountState(); | ||
React.useEffect(function () { | ||
if (!isFirstMount) { | ||
return effect(); | ||
} // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, deps); | ||
}; | ||
/* istanbul ignore next */ | ||
var noop = function noop() { | ||
@@ -150,3 +214,3 @@ return undefined; | ||
var _useGetSetState = reactUse.useGetSetState(initialState), | ||
var _useGetSetState = useGetSetState(initialState), | ||
get = _useGetSetState[0], | ||
@@ -157,3 +221,3 @@ setState = _useGetSetState[1]; | ||
var timeout = React.useRef(null); | ||
reactUse.useEffectOnce(function () { | ||
useEffectOnce(function () { | ||
queue.current = createQueue(); | ||
@@ -233,3 +297,3 @@ timeout.current = createTimeout(); | ||
}); | ||
reactUse.useEffectOnce(function () { | ||
useEffectOnce(function () { | ||
if (isAnimating) { | ||
@@ -241,6 +305,6 @@ start(); | ||
}); | ||
reactUse.useUpdateEffect(function () { | ||
useUpdateEffect(function () { | ||
get().sideEffect(); | ||
}, [get, sideEffect]); | ||
reactUse.useUpdateEffect(function () { | ||
useUpdateEffect(function () { | ||
if (!isAnimating) { | ||
@@ -247,0 +311,0 @@ set(1); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),_extends=require("@babel/runtime/helpers/extends"),React=require("react"),reactUse=require("react-use"),hoistNonReactStatics=require("hoist-non-react-statics");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var _objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_extends__default=_interopDefaultLegacy(_extends),React__namespace=_interopNamespace(React),hoistNonReactStatics__default=_interopDefaultLegacy(hoistNonReactStatics),clamp=function(e,t,n){return e=(e=e<=n?e:n)>=t?e:t},createQueue=function(){var e=!1,t=[],n=function n(){e=!0;var r=t.shift();if(r)return r(n);e=!1};return{clear:function(){e=!1,t=[]},enqueue:function(r){t.push(r),e||1!==t.length||n()}}},createTimeout=function(){var e;return{cancel:function(){e&&window.cancelAnimationFrame(e)},schedule:function(t,n){var r;e=window.requestAnimationFrame((function u(i){i-(r=r||i)>n?t():e=window.requestAnimationFrame(u)}))}}},increment=function(e){var t=0;return e>=0&&e<.2?t=.1:e>=.2&&e<.5?t=.04:e>=.5&&e<.8?t=.02:e>=.8&&e<.99&&(t=.005),clamp(e+t,0,.994)},noop=function(){},initialState={isFinished:!0,progress:0,sideEffect:noop},useNProgress=function(e){var t=void 0===e?{}:e,n=t.animationDuration,r=void 0===n?200:n,u=t.incrementDuration,i=void 0===u?800:u,c=t.isAnimating,o=void 0!==c&&c,a=t.minimum,s=void 0===a?.08:a,f=reactUse.useGetSetState(initialState),l=f[0],d=f[1],p=React.useRef(null),_=React.useRef(null);reactUse.useEffectOnce((function(){p.current=createQueue(),_.current=createTimeout()}));var h=React.useCallback((function(){var e,t;null==(e=_.current)||e.cancel(),null==(t=p.current)||t.clear()}),[]),v=React.useCallback((function(e){var t,n,u;if(1===(e=clamp(e,s,1)))return h(),null==(n=p.current)||n.enqueue((function(t){d({progress:e,sideEffect:function(){var e;return null==(e=_.current)?void 0:e.schedule(t,r)}})})),void(null==(u=p.current)||u.enqueue((function(){d({isFinished:!0,sideEffect:h})})));null==(t=p.current)||t.enqueue((function(t){d({isFinished:!1,progress:e,sideEffect:function(){var e;return null==(e=_.current)?void 0:e.schedule(t,r)}})}))}),[r,h,s,p,d,_]),m=React.useCallback((function(){v(increment(l().progress))}),[l,v]),g=React.useCallback((function(){!function e(){var t;m(),null==(t=p.current)||t.enqueue((function(t){var n;null==(n=_.current)||n.schedule((function(){e(),t()}),i)}))}()}),[i,p,_,m]),b=React.useRef(noop),P=l().sideEffect;return React.useEffect((function(){b.current=m})),reactUse.useEffectOnce((function(){return o&&g(),h})),reactUse.useUpdateEffect((function(){l().sideEffect()}),[l,P]),reactUse.useUpdateEffect((function(){o?d(_extends__default.default({},initialState,{sideEffect:g})):v(1)}),[o,v,d,g]),{animationDuration:r,isFinished:l().isFinished,progress:l().progress}},_excluded=["children"],NProgress=function(e){var t=e.children,n=_objectWithoutPropertiesLoose__default.default(e,_excluded);return t(useNProgress(n))};function withNProgress(e){var t=function(t){var n=useNProgress(t);return React__namespace.createElement(e,_extends__default.default({},t,n))};return hoistNonReactStatics__default.default(t,e),t}exports.NProgress=NProgress,exports.useNProgress=useNProgress,exports.withNProgress=withNProgress; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),_extends=require("@babel/runtime/helpers/extends"),React=require("react"),hoistNonReactStatics=require("hoist-non-react-statics");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var _objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_extends__default=_interopDefaultLegacy(_extends),React__namespace=_interopNamespace(React),hoistNonReactStatics__default=_interopDefaultLegacy(hoistNonReactStatics),clamp=function(e,t,n){return e=(e=e<=n?e:n)>=t?e:t},createQueue=function(){var e=!1,t=[],n=function n(){e=!0;var r=t.shift();if(r)return r(n);e=!1};return{clear:function(){e=!1,t=[]},enqueue:function(r){t.push(r),e||1!==t.length||n()}}},createTimeout=function(){var e;return{cancel:function(){e&&window.cancelAnimationFrame(e)},schedule:function(t,n){var r;e=window.requestAnimationFrame((function u(c){c-(r=r||c)>n?t():e=window.requestAnimationFrame(u)}))}}},increment=function(e){var t=0;return e>=0&&e<.2?t=.1:e>=.2&&e<.5?t=.04:e>=.5&&e<.8?t=.02:e>=.8&&e<.99&&(t=.005),clamp(e+t,0,.994)},useEffectOnce=function(e){React.useEffect(e,[])},incrementParameter=function(e){return++e%1e6},useUpdate=function(){var e=React.useState(0)[1];return React.useCallback((function(){return e(incrementParameter)}),[])},useGetSetState=function(e){void 0===e&&(e={});var t=useUpdate(),n=React.useRef(_extends__default.default({},e));return[React.useCallback((function(){return n.current}),[]),React.useCallback((function(e){e&&(Object.assign(n.current,e),t())}),[])]},useFirstMountState=function(){var e=React.useRef(!0);return e.current?(e.current=!1,!0):e.current},useUpdateEffect=function(e,t){var n=useFirstMountState();React.useEffect((function(){if(!n)return e()}),t)},noop=function(){},initialState={isFinished:!0,progress:0,sideEffect:noop},useNProgress=function(e){var t=void 0===e?{}:e,n=t.animationDuration,r=void 0===n?200:n,u=t.incrementDuration,c=void 0===u?800:u,i=t.isAnimating,a=void 0!==i&&i,o=t.minimum,s=void 0===o?.08:o,f=useGetSetState(initialState),l=f[0],d=f[1],p=React.useRef(null),_=React.useRef(null);useEffectOnce((function(){p.current=createQueue(),_.current=createTimeout()}));var v=React.useCallback((function(){var e,t;null==(e=_.current)||e.cancel(),null==(t=p.current)||t.clear()}),[]),m=React.useCallback((function(e){var t,n,u;if(1===(e=clamp(e,s,1)))return v(),null==(n=p.current)||n.enqueue((function(t){d({progress:e,sideEffect:function(){var e;return null==(e=_.current)?void 0:e.schedule(t,r)}})})),void(null==(u=p.current)||u.enqueue((function(){d({isFinished:!0,sideEffect:v})})));null==(t=p.current)||t.enqueue((function(t){d({isFinished:!1,progress:e,sideEffect:function(){var e;return null==(e=_.current)?void 0:e.schedule(t,r)}})}))}),[r,v,s,p,d,_]),h=React.useCallback((function(){m(increment(l().progress))}),[l,m]),R=React.useCallback((function(){!function e(){var t;h(),null==(t=p.current)||t.enqueue((function(t){var n;null==(n=_.current)||n.schedule((function(){e(),t()}),c)}))}()}),[c,p,_,h]),g=React.useRef(noop),b=l().sideEffect;return React.useEffect((function(){g.current=h})),useEffectOnce((function(){return a&&R(),v})),useUpdateEffect((function(){l().sideEffect()}),[l,b]),useUpdateEffect((function(){a?d(_extends__default.default({},initialState,{sideEffect:R})):m(1)}),[a,m,d,R]),{animationDuration:r,isFinished:l().isFinished,progress:l().progress}},_excluded=["children"],NProgress=function(e){var t=e.children,n=_objectWithoutPropertiesLoose__default.default(e,_excluded);return t(useNProgress(n))};function withNProgress(e){var t=function(t){var n=useNProgress(t);return React__namespace.createElement(e,_extends__default.default({},t,n))};return hoistNonReactStatics__default.default(t,e),t}exports.NProgress=NProgress,exports.useNProgress=useNProgress,exports.withNProgress=withNProgress; | ||
//# sourceMappingURL=react-nprogress.cjs.production.js.map |
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose'; | ||
import _extends from '@babel/runtime/helpers/extends'; | ||
import * as React from 'react'; | ||
import { useRef, useCallback, useEffect } from 'react'; | ||
import { useGetSetState, useEffectOnce, useUpdateEffect } from 'react-use'; | ||
import { useEffect, useCallback, useRef, useState } from 'react'; | ||
import hoistNonReactStatics from 'hoist-non-react-statics'; | ||
@@ -98,4 +97,69 @@ | ||
// Hat-tip: | ||
var useEffectOnce = function useEffectOnce(effect) { | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
useEffect(effect, []); | ||
}; | ||
var incrementParameter = function incrementParameter(num) { | ||
return ++num % 1000000; | ||
}; | ||
var useUpdate = function useUpdate() { | ||
var _useState = useState(0), | ||
setState = _useState[1]; | ||
return useCallback(function () { | ||
return setState(incrementParameter); | ||
}, []); | ||
}; | ||
var useGetSetState = function useGetSetState( | ||
/* istanbul ignore next */ | ||
initialState) { | ||
if (initialState === void 0) { | ||
initialState = {}; | ||
} | ||
var update = useUpdate(); | ||
var state = useRef(_extends({}, initialState)); | ||
var get = useCallback(function () { | ||
return state.current; | ||
}, []); | ||
var set = useCallback(function (patch) { | ||
if (!patch) { | ||
return; | ||
} | ||
Object.assign(state.current, patch); | ||
update(); // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
return [get, set]; | ||
}; | ||
// Hat-tip: | ||
var useFirstMountState = function useFirstMountState() { | ||
var isFirst = useRef(true); | ||
if (isFirst.current) { | ||
isFirst.current = false; | ||
return true; | ||
} | ||
return isFirst.current; | ||
}; | ||
var useUpdateEffect = function useUpdateEffect(effect, deps) { | ||
var isFirstMount = useFirstMountState(); | ||
useEffect(function () { | ||
if (!isFirstMount) { | ||
return effect(); | ||
} // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, deps); | ||
}; | ||
/* istanbul ignore next */ | ||
var noop = function noop() { | ||
@@ -102,0 +166,0 @@ return undefined; |
@@ -79,84 +79,2 @@ (function (global, factory) { | ||
function useFirstMountState() { | ||
var isFirst = React.useRef(true); | ||
if (isFirst.current) { | ||
isFirst.current = false; | ||
return true; | ||
} | ||
return isFirst.current; | ||
} | ||
var useUpdateEffect = function (effect, deps) { | ||
var isFirstMount = useFirstMountState(); | ||
React.useEffect(function () { | ||
if (!isFirstMount) { | ||
return effect(); | ||
} | ||
}, deps); | ||
}; | ||
var useUpdateEffect$1 = useUpdateEffect; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
var __assign = function() { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var updateReducer = function (num) { return (num + 1) % 1000000; }; | ||
function useUpdate() { | ||
var _a = React.useReducer(updateReducer, 0), update = _a[1]; | ||
return update; | ||
} | ||
var useEffectOnce = function (effect) { | ||
React.useEffect(effect, []); | ||
}; | ||
var useEffectOnce$1 = useEffectOnce; | ||
var useGetSetState = function (initialState) { | ||
if (initialState === void 0) { initialState = {}; } | ||
{ | ||
if (typeof initialState !== 'object') { | ||
console.error('useGetSetState initial state must be an object.'); | ||
} | ||
} | ||
var update = useUpdate(); | ||
var state = React.useRef(__assign({}, initialState)); | ||
var get = React.useCallback(function () { return state.current; }, []); | ||
var set = React.useCallback(function (patch) { | ||
if (!patch) { | ||
return; | ||
} | ||
{ | ||
if (typeof patch !== 'object') { | ||
console.error('useGetSetState setter patch must be an object.'); | ||
} | ||
} | ||
Object.assign(state.current, patch); | ||
update(); | ||
}, []); | ||
return [get, set]; | ||
}; | ||
var useGetSetState$1 = useGetSetState; | ||
var clamp = function clamp(num, lower, upper) { | ||
@@ -252,4 +170,69 @@ num = num <= upper ? num : upper; | ||
// Hat-tip: | ||
var useEffectOnce = function useEffectOnce(effect) { | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
React.useEffect(effect, []); | ||
}; | ||
var incrementParameter = function incrementParameter(num) { | ||
return ++num % 1000000; | ||
}; | ||
var useUpdate = function useUpdate() { | ||
var _useState = React.useState(0), | ||
setState = _useState[1]; | ||
return React.useCallback(function () { | ||
return setState(incrementParameter); | ||
}, []); | ||
}; | ||
var useGetSetState = function useGetSetState( | ||
/* istanbul ignore next */ | ||
initialState) { | ||
if (initialState === void 0) { | ||
initialState = {}; | ||
} | ||
var update = useUpdate(); | ||
var state = React.useRef(_extends({}, initialState)); | ||
var get = React.useCallback(function () { | ||
return state.current; | ||
}, []); | ||
var set = React.useCallback(function (patch) { | ||
if (!patch) { | ||
return; | ||
} | ||
Object.assign(state.current, patch); | ||
update(); // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
return [get, set]; | ||
}; | ||
// Hat-tip: | ||
var useFirstMountState = function useFirstMountState() { | ||
var isFirst = React.useRef(true); | ||
if (isFirst.current) { | ||
isFirst.current = false; | ||
return true; | ||
} | ||
return isFirst.current; | ||
}; | ||
var useUpdateEffect = function useUpdateEffect(effect, deps) { | ||
var isFirstMount = useFirstMountState(); | ||
React.useEffect(function () { | ||
if (!isFirstMount) { | ||
return effect(); | ||
} // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, deps); | ||
}; | ||
/* istanbul ignore next */ | ||
var noop = function noop() { | ||
@@ -275,3 +258,3 @@ return undefined; | ||
var _useGetSetState = useGetSetState$1(initialState), | ||
var _useGetSetState = useGetSetState(initialState), | ||
get = _useGetSetState[0], | ||
@@ -282,3 +265,3 @@ setState = _useGetSetState[1]; | ||
var timeout = React.useRef(null); | ||
useEffectOnce$1(function () { | ||
useEffectOnce(function () { | ||
queue.current = createQueue(); | ||
@@ -358,3 +341,3 @@ timeout.current = createTimeout(); | ||
}); | ||
useEffectOnce$1(function () { | ||
useEffectOnce(function () { | ||
if (isAnimating) { | ||
@@ -366,6 +349,6 @@ start(); | ||
}); | ||
useUpdateEffect$1(function () { | ||
useUpdateEffect(function () { | ||
get().sideEffect(); | ||
}, [get, sideEffect]); | ||
useUpdateEffect$1(function () { | ||
useUpdateEffect(function () { | ||
if (!isAnimating) { | ||
@@ -372,0 +355,0 @@ set(1); |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).NProgress={},e.React)}(this,(function(e,r){"use strict";function t(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var n=t(r);function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function u(e,r){return e(r={exports:{}},r.exports),r.exports}var c=o(u((function(e){e.exports=function(e,r){if(null==e)return{};var t,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r.indexOf(t=u[n])>=0||(o[t]=e[t]);return o},e.exports.__esModule=!0,e.exports.default=e.exports}))),i=u((function(e){function r(){return e.exports=r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})),f=o(i);var s=function(e,t){var n,o=(n=r.useRef(!0)).current?(n.current=!1,!0):n.current;r.useEffect((function(){if(!o)return e()}),t)},a=function(){return a=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},a.apply(this,arguments)},l=function(e){return(e+1)%1e6};var p=function(e){r.useEffect(e,[])},y=function(e){void 0===e&&(e={});var t=r.useReducer(l,0)[1],n=r.useRef(a({},e));return[r.useCallback((function(){return n.current}),[]),r.useCallback((function(e){e&&(Object.assign(n.current,e),t())}),[])]},d=function(e,r,t){return e=(e=e<=t?e:t)>=r?e:r},m=function(){var e=!1,r=[],t=function t(){e=!0;var n=r.shift();if(n)return n(t);e=!1};return{clear:function(){e=!1,r=[]},enqueue:function(n){r.push(n),e||1!==r.length||t()}}},b=function(){},v={isFinished:!0,progress:0,sideEffect:b},g=function(e){var t=void 0===e?{}:e,n=t.animationDuration,o=void 0===n?200:n,u=t.incrementDuration,c=void 0===u?800:u,i=t.isAnimating,a=void 0!==i&&i,l=t.minimum,g=void 0===l?.08:l,h=y(v),$=h[0],x=h[1],O=r.useRef(null),S=r.useRef(null);p((function(){var e;O.current=m(),S.current={cancel:function(){e&&window.cancelAnimationFrame(e)},schedule:function(r,t){var n;e=window.requestAnimationFrame((function o(u){u-(n=n||u)>t?r():e=window.requestAnimationFrame(o)}))}}}));var P=r.useCallback((function(){var e,r;null==(e=S.current)||e.cancel(),null==(r=O.current)||r.clear()}),[]),j=r.useCallback((function(e){var r,t,n;if(1===(e=d(e,g,1)))return P(),null==(t=O.current)||t.enqueue((function(r){x({progress:e,sideEffect:function(){var e;return null==(e=S.current)?void 0:e.schedule(r,o)}})})),void(null==(n=O.current)||n.enqueue((function(){x({isFinished:!0,sideEffect:P})})));null==(r=O.current)||r.enqueue((function(r){x({isFinished:!1,progress:e,sideEffect:function(){var e;return null==(e=S.current)?void 0:e.schedule(r,o)}})}))}),[o,P,g,O,x,S]),w=r.useCallback((function(){var e,r;j((e=$().progress,r=0,e>=0&&e<.2?r=.1:e>=.2&&e<.5?r=.04:e>=.5&&e<.8?r=.02:e>=.8&&e<.99&&(r=.005),d(e+r,0,.994)))}),[$,j]),_=r.useCallback((function(){!function e(){var r;w(),null==(r=O.current)||r.enqueue((function(r){var t;null==(t=S.current)||t.schedule((function(){e(),r()}),c)}))}()}),[c,O,S,w]),E=r.useRef(b),M=$().sideEffect;return r.useEffect((function(){E.current=w})),p((function(){return a&&_(),P})),s((function(){$().sideEffect()}),[$,M]),s((function(){a?x(f({},v,{sideEffect:_})):j(1)}),[a,j,x,_]),{animationDuration:o,isFinished:$().isFinished,progress:$().progress}},h=["children"],$="function"==typeof Symbol&&Symbol.for,x=$?Symbol.for("react.element"):60103,O=$?Symbol.for("react.portal"):60106,S=$?Symbol.for("react.fragment"):60107,P=$?Symbol.for("react.strict_mode"):60108,j=$?Symbol.for("react.profiler"):60114,w=$?Symbol.for("react.provider"):60109,_=$?Symbol.for("react.context"):60110,E=$?Symbol.for("react.async_mode"):60111,M=$?Symbol.for("react.concurrent_mode"):60111,C=$?Symbol.for("react.forward_ref"):60112,F=$?Symbol.for("react.suspense"):60113,R=$?Symbol.for("react.suspense_list"):60120,k=$?Symbol.for("react.memo"):60115,T=$?Symbol.for("react.lazy"):60116,q=$?Symbol.for("react.block"):60121,D=$?Symbol.for("react.fundamental"):60117,N=$?Symbol.for("react.responder"):60118,A=$?Symbol.for("react.scope"):60119;function z(e){if("object"==typeof e&&null!==e){var r=e.$$typeof;switch(r){case x:switch(e=e.type){case E:case M:case S:case j:case P:case F:return e;default:switch(e=e&&e.$$typeof){case _:case C:case T:case k:case w:return e;default:return r}}case O:return r}}}function L(e){return z(e)===M}var V={AsyncMode:E,ConcurrentMode:M,ContextConsumer:_,ContextProvider:w,Element:x,ForwardRef:C,Fragment:S,Lazy:T,Memo:k,Portal:O,Profiler:j,StrictMode:P,Suspense:F,isAsyncMode:function(e){return L(e)||z(e)===E},isConcurrentMode:L,isContextConsumer:function(e){return z(e)===_},isContextProvider:function(e){return z(e)===w},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===x},isForwardRef:function(e){return z(e)===C},isFragment:function(e){return z(e)===S},isLazy:function(e){return z(e)===T},isMemo:function(e){return z(e)===k},isPortal:function(e){return z(e)===O},isProfiler:function(e){return z(e)===j},isStrictMode:function(e){return z(e)===P},isSuspense:function(e){return z(e)===F},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===S||e===M||e===j||e===P||e===F||e===R||"object"==typeof e&&null!==e&&(e.$$typeof===T||e.$$typeof===k||e.$$typeof===w||e.$$typeof===_||e.$$typeof===C||e.$$typeof===D||e.$$typeof===N||e.$$typeof===A||e.$$typeof===q)},typeOf:z},B=(u((function(e,r){})),u((function(e){e.exports=V}))),G={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},H={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},I={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},J={};function K(e){return B.isMemo(e)?I:J[e.$$typeof]||G}J[B.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},J[B.Memo]=I;var Q=Object.defineProperty,U=Object.getOwnPropertyNames,W=Object.getOwnPropertySymbols,X=Object.getOwnPropertyDescriptor,Y=Object.getPrototypeOf,Z=Object.prototype;var ee=function e(r,t,n){if("string"!=typeof t){if(Z){var o=Y(t);o&&o!==Z&&e(r,o,n)}var u=U(t);W&&(u=u.concat(W(t)));for(var c=K(r),i=K(t),f=0;f<u.length;++f){var s=u[f];if(!(H[s]||n&&n[s]||i&&i[s]||c&&c[s])){var a=X(t,s);try{Q(r,s,a)}catch(e){}}}}return r};e.NProgress=function(e){var r=e.children,t=c(e,h);return r(g(t))},e.useNProgress=g,e.withNProgress=function(e){var r=function(r){var t=g(r);return n.createElement(e,f({},r,t))};return ee(r,e),r},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).NProgress={},e.React)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(t);function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function u(e,t){return e(t={exports:{}},t.exports),t.exports}var c=o(u((function(e){e.exports=function(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t.indexOf(r=u[n])>=0||(o[r]=e[r]);return o},e.exports.__esModule=!0,e.exports.default=e.exports}))),i=u((function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,t.apply(this,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})),f=o(i),s=function(e,t,r){return e=(e=e<=r?e:r)>=t?e:t},a=function(){var e=!1,t=[],r=function r(){e=!0;var n=t.shift();if(n)return n(r);e=!1};return{clear:function(){e=!1,t=[]},enqueue:function(n){t.push(n),e||1!==t.length||r()}}},l=function(e){t.useEffect(e,[])},p=function(e){return++e%1e6},d=function(e){void 0===e&&(e={});var r,n=(r=t.useState(0)[1],t.useCallback((function(){return r(p)}),[])),o=t.useRef(f({},e));return[t.useCallback((function(){return o.current}),[]),t.useCallback((function(e){e&&(Object.assign(o.current,e),n())}),[])]},y=function(e,r){var n,o=(n=t.useRef(!0)).current?(n.current=!1,!0):n.current;t.useEffect((function(){if(!o)return e()}),r)},m=function(){},b={isFinished:!0,progress:0,sideEffect:m},v=function(e){var r=void 0===e?{}:e,n=r.animationDuration,o=void 0===n?200:n,u=r.incrementDuration,c=void 0===u?800:u,i=r.isAnimating,p=void 0!==i&&i,v=r.minimum,g=void 0===v?.08:v,h=d(b),$=h[0],x=h[1],S=t.useRef(null),O=t.useRef(null);l((function(){var e;S.current=a(),O.current={cancel:function(){e&&window.cancelAnimationFrame(e)},schedule:function(t,r){var n;e=window.requestAnimationFrame((function o(u){u-(n=n||u)>r?t():e=window.requestAnimationFrame(o)}))}}}));var P=t.useCallback((function(){var e,t;null==(e=O.current)||e.cancel(),null==(t=S.current)||t.clear()}),[]),j=t.useCallback((function(e){var t,r,n;if(1===(e=s(e,g,1)))return P(),null==(r=S.current)||r.enqueue((function(t){x({progress:e,sideEffect:function(){var e;return null==(e=O.current)?void 0:e.schedule(t,o)}})})),void(null==(n=S.current)||n.enqueue((function(){x({isFinished:!0,sideEffect:P})})));null==(t=S.current)||t.enqueue((function(t){x({isFinished:!1,progress:e,sideEffect:function(){var e;return null==(e=O.current)?void 0:e.schedule(t,o)}})}))}),[o,P,g,S,x,O]),w=t.useCallback((function(){var e,t;j((e=$().progress,t=0,e>=0&&e<.2?t=.1:e>=.2&&e<.5?t=.04:e>=.5&&e<.8?t=.02:e>=.8&&e<.99&&(t=.005),s(e+t,0,.994)))}),[$,j]),_=t.useCallback((function(){!function e(){var t;w(),null==(t=S.current)||t.enqueue((function(t){var r;null==(r=O.current)||r.schedule((function(){e(),t()}),c)}))}()}),[c,S,O,w]),C=t.useRef(m),E=$().sideEffect;return t.useEffect((function(){C.current=w})),l((function(){return p&&_(),P})),y((function(){$().sideEffect()}),[$,E]),y((function(){p?x(f({},b,{sideEffect:_})):j(1)}),[p,j,x,_]),{animationDuration:o,isFinished:$().isFinished,progress:$().progress}},g=["children"],h="function"==typeof Symbol&&Symbol.for,$=h?Symbol.for("react.element"):60103,x=h?Symbol.for("react.portal"):60106,S=h?Symbol.for("react.fragment"):60107,O=h?Symbol.for("react.strict_mode"):60108,P=h?Symbol.for("react.profiler"):60114,j=h?Symbol.for("react.provider"):60109,w=h?Symbol.for("react.context"):60110,_=h?Symbol.for("react.async_mode"):60111,C=h?Symbol.for("react.concurrent_mode"):60111,E=h?Symbol.for("react.forward_ref"):60112,M=h?Symbol.for("react.suspense"):60113,F=h?Symbol.for("react.suspense_list"):60120,k=h?Symbol.for("react.memo"):60115,R=h?Symbol.for("react.lazy"):60116,T=h?Symbol.for("react.block"):60121,q=h?Symbol.for("react.fundamental"):60117,D=h?Symbol.for("react.responder"):60118,N=h?Symbol.for("react.scope"):60119;function A(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case $:switch(e=e.type){case _:case C:case S:case P:case O:case M:return e;default:switch(e=e&&e.$$typeof){case w:case E:case R:case k:case j:return e;default:return t}}case x:return t}}}function z(e){return A(e)===C}var L={AsyncMode:_,ConcurrentMode:C,ContextConsumer:w,ContextProvider:j,Element:$,ForwardRef:E,Fragment:S,Lazy:R,Memo:k,Portal:x,Profiler:P,StrictMode:O,Suspense:M,isAsyncMode:function(e){return z(e)||A(e)===_},isConcurrentMode:z,isContextConsumer:function(e){return A(e)===w},isContextProvider:function(e){return A(e)===j},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===$},isForwardRef:function(e){return A(e)===E},isFragment:function(e){return A(e)===S},isLazy:function(e){return A(e)===R},isMemo:function(e){return A(e)===k},isPortal:function(e){return A(e)===x},isProfiler:function(e){return A(e)===P},isStrictMode:function(e){return A(e)===O},isSuspense:function(e){return A(e)===M},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===S||e===C||e===P||e===O||e===M||e===F||"object"==typeof e&&null!==e&&(e.$$typeof===R||e.$$typeof===k||e.$$typeof===j||e.$$typeof===w||e.$$typeof===E||e.$$typeof===q||e.$$typeof===D||e.$$typeof===N||e.$$typeof===T)},typeOf:A},V=(u((function(e,t){})),u((function(e){e.exports=L}))),B={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},G={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},H={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},I={};function J(e){return V.isMemo(e)?H:I[e.$$typeof]||B}I[V.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},I[V.Memo]=H;var K=Object.defineProperty,Q=Object.getOwnPropertyNames,U=Object.getOwnPropertySymbols,W=Object.getOwnPropertyDescriptor,X=Object.getPrototypeOf,Y=Object.prototype;var Z=function e(t,r,n){if("string"!=typeof r){if(Y){var o=X(r);o&&o!==Y&&e(t,o,n)}var u=Q(r);U&&(u=u.concat(U(r)));for(var c=J(t),i=J(r),f=0;f<u.length;++f){var s=u[f];if(!(G[s]||n&&n[s]||i&&i[s]||c&&c[s])){var a=W(r,s);try{K(t,s,a)}catch(e){}}}}return t};e.NProgress=function(e){var t=e.children,r=c(e,g);return t(v(r))},e.useNProgress=v,e.withNProgress=function(e){var t=function(t){var r=v(t);return n.createElement(e,f({},t,r))};return Z(t,e),t},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=react-nprogress.umd.production.js.map |
{ | ||
"name": "@tanem/react-nprogress", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "A React primitive for building slim progress bars.", | ||
@@ -71,4 +71,3 @@ "main": "dist/index.js", | ||
"hoist-non-react-statics": "^3.3.2", | ||
"prop-types": "^15.7.2", | ||
"react-use": "^17.3.1" | ||
"prop-types": "^15.7.2" | ||
}, | ||
@@ -90,4 +89,4 @@ "devDependencies": { | ||
"@types/react-dom": "17.0.11", | ||
"@typescript-eslint/eslint-plugin": "5.7.0", | ||
"@typescript-eslint/parser": "5.7.0", | ||
"@typescript-eslint/eslint-plugin": "5.8.0", | ||
"@typescript-eslint/parser": "5.8.0", | ||
"babel-core": "6.26.3", | ||
@@ -121,4 +120,4 @@ "babel-plugin-transform-react-remove-prop-types": "0.4.24", | ||
"ts-jest": "27.1.2", | ||
"typescript": "4.3.5" | ||
"typescript": "4.5.4" | ||
} | ||
} |
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
5
26
1231
170133
- Removedreact-use@^17.3.1
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@types/js-cookie@2.2.7(transitive)
- Removed@xobotyi/scrollbar-width@1.9.5(transitive)
- Removedcopy-to-clipboard@3.3.3(transitive)
- Removedcss-in-js-utils@3.1.0(transitive)
- Removedcss-tree@1.1.3(transitive)
- Removedcsstype@3.1.3(transitive)
- Removederror-stack-parser@2.1.4(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-shallow-equal@1.0.0(transitive)
- Removedfastest-stable-stringify@2.0.2(transitive)
- Removedhyphenate-style-name@1.1.0(transitive)
- Removedinline-style-prefixer@7.0.1(transitive)
- Removedjs-cookie@2.2.1(transitive)
- Removedmdn-data@2.0.14(transitive)
- Removednano-css@5.6.2(transitive)
- Removedreact-universal-interface@0.6.2(transitive)
- Removedreact-use@17.5.1(transitive)
- Removedresize-observer-polyfill@1.5.1(transitive)
- Removedrtl-css-js@1.16.1(transitive)
- Removedscreenfull@5.2.0(transitive)
- Removedset-harmonic-interval@1.0.1(transitive)
- Removedsource-map@0.5.60.6.1(transitive)
- Removedstack-generator@2.0.10(transitive)
- Removedstackframe@1.3.4(transitive)
- Removedstacktrace-gps@3.1.2(transitive)
- Removedstacktrace-js@2.0.2(transitive)
- Removedstylis@4.3.4(transitive)
- Removedthrottle-debounce@3.0.1(transitive)
- Removedtoggle-selection@1.0.6(transitive)
- Removedts-easing@0.2.0(transitive)
- Removedtslib@2.8.1(transitive)