@tanem/react-nprogress
Advanced tools
Comparing version 4.0.13 to 5.0.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.NProgress = {}, global.React)); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.NProgress = {}, global.React)); | ||
})(this, (function (exports, React) { 'use strict'; | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
var React__namespace = /*#__PURE__*/_interopNamespace(React); | ||
var React__namespace = /*#__PURE__*/_interopNamespace(React); | ||
function unwrapExports (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
var objectWithoutPropertiesLoose = createCommonjsModule(function (module) { | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
return target; | ||
} | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
return target; | ||
} | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; | ||
}); | ||
return target; | ||
}; | ||
var _objectWithoutPropertiesLoose = unwrapExports(objectWithoutPropertiesLoose); | ||
return _extends.apply(this, arguments); | ||
} | ||
var _extends_1 = createCommonjsModule(function (module) { | ||
function _extends() { | ||
module.exports = _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
var clamp = function clamp(num, lower, upper) { | ||
num = num <= upper ? num : upper; | ||
num = num >= lower ? num : lower; | ||
return num; | ||
}; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
var createQueue = function createQueue() { | ||
var isRunning = false; | ||
var pending = []; | ||
return target; | ||
}, module.exports.__esModule = true, module.exports["default"] = module.exports; | ||
return _extends.apply(this, arguments); | ||
} | ||
var next = function next() { | ||
isRunning = true; | ||
var cb = pending.shift(); | ||
module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports; | ||
}); | ||
if (cb) { | ||
return cb(next); | ||
} | ||
var _extends = unwrapExports(_extends_1); | ||
isRunning = false; | ||
}; | ||
var clamp = function clamp(num, lower, upper) { | ||
num = num <= upper ? num : upper; | ||
num = num >= lower ? num : lower; | ||
return num; | ||
}; | ||
var clear = function clear() { | ||
isRunning = false; | ||
pending = []; | ||
}; | ||
var createQueue = function createQueue() { | ||
var isRunning = false; | ||
var pending = []; | ||
var enqueue = function enqueue(cb) { | ||
pending.push(cb); | ||
var next = function next() { | ||
isRunning = true; | ||
var cb = pending.shift(); | ||
if (!isRunning && pending.length === 1) { | ||
next(); | ||
} | ||
}; | ||
if (cb) { | ||
return cb(next); | ||
} | ||
return { | ||
clear: clear, | ||
enqueue: enqueue | ||
}; | ||
}; | ||
isRunning = false; | ||
}; | ||
var createTimeout = function createTimeout() { | ||
var handle; | ||
var clear = function clear() { | ||
isRunning = false; | ||
pending = []; | ||
}; | ||
var cancel = function cancel() { | ||
if (handle) { | ||
window.cancelAnimationFrame(handle); | ||
} | ||
}; | ||
var enqueue = function enqueue(cb) { | ||
pending.push(cb); | ||
var schedule = function schedule(callback, delay) { | ||
var deltaTime; | ||
var start; | ||
if (!isRunning && pending.length === 1) { | ||
next(); | ||
} | ||
}; | ||
var frame = function frame(time) { | ||
start = start || time; | ||
deltaTime = time - start; | ||
return { | ||
clear: clear, | ||
enqueue: enqueue | ||
}; | ||
}; | ||
if (deltaTime > delay) { | ||
callback(); | ||
return; | ||
} | ||
var createTimeout = function createTimeout() { | ||
var handle; | ||
handle = window.requestAnimationFrame(frame); | ||
}; | ||
var cancel = function cancel() { | ||
if (handle) { | ||
window.cancelAnimationFrame(handle); | ||
} | ||
}; | ||
handle = window.requestAnimationFrame(frame); | ||
}; | ||
var schedule = function schedule(callback, delay) { | ||
var deltaTime; | ||
var start; | ||
return { | ||
cancel: cancel, | ||
schedule: schedule | ||
}; | ||
}; | ||
var frame = function frame(time) { | ||
start = start || time; | ||
deltaTime = time - start; | ||
var increment = function increment(progress) { | ||
var amount = 0; | ||
if (deltaTime > delay) { | ||
callback(); | ||
return; | ||
} | ||
if (progress >= 0 && progress < 0.2) { | ||
amount = 0.1; | ||
} else if (progress >= 0.2 && progress < 0.5) { | ||
amount = 0.04; | ||
} else if (progress >= 0.5 && progress < 0.8) { | ||
amount = 0.02; | ||
} else if (progress >= 0.8 && progress < 0.99) { | ||
amount = 0.005; | ||
} | ||
handle = window.requestAnimationFrame(frame); | ||
}; | ||
return clamp(progress + amount, 0, 0.994); | ||
}; | ||
handle = window.requestAnimationFrame(frame); | ||
}; | ||
// Hat-tip: | ||
var useEffectOnce = function useEffectOnce(effect) { | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
React.useEffect(effect, []); | ||
}; | ||
return { | ||
cancel: cancel, | ||
schedule: schedule | ||
}; | ||
}; | ||
var incrementParameter = function incrementParameter(num) { | ||
return ++num % 1000000; | ||
}; | ||
var increment = function increment(progress) { | ||
var amount = 0; | ||
var useUpdate = function useUpdate() { | ||
var _useState = React.useState(0), | ||
setState = _useState[1]; | ||
if (progress >= 0 && progress < 0.2) { | ||
amount = 0.1; | ||
} else if (progress >= 0.2 && progress < 0.5) { | ||
amount = 0.04; | ||
} else if (progress >= 0.5 && progress < 0.8) { | ||
amount = 0.02; | ||
} else if (progress >= 0.8 && progress < 0.99) { | ||
amount = 0.005; | ||
} | ||
return React.useCallback(function () { | ||
return setState(incrementParameter); | ||
}, []); | ||
}; | ||
return clamp(progress + amount, 0, 0.994); | ||
}; | ||
var useGetSetState = function useGetSetState( | ||
/* istanbul ignore next */ | ||
initialState) { | ||
if (initialState === void 0) { | ||
initialState = {}; | ||
} | ||
// Hat-tip: | ||
var useEffectOnce = function useEffectOnce(effect) { | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
React.useEffect(effect, []); | ||
}; | ||
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; | ||
} | ||
var incrementParameter = function incrementParameter(num) { | ||
return ++num % 1000000; | ||
}; | ||
Object.assign(state.current, patch); | ||
update(); // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
return [get, set]; | ||
}; | ||
var useUpdate = function useUpdate() { | ||
var _useState = React.useState(0), | ||
setState = _useState[1]; | ||
// Hat-tip: | ||
return React.useCallback(function () { | ||
return setState(incrementParameter); | ||
}, []); | ||
}; | ||
var useFirstMountState = function useFirstMountState() { | ||
var isFirst = React.useRef(true); | ||
var useGetSetState = function useGetSetState( | ||
/* istanbul ignore next */ | ||
initialState) { | ||
if (initialState === void 0) { | ||
initialState = {}; | ||
} | ||
if (isFirst.current) { | ||
isFirst.current = false; | ||
return true; | ||
} | ||
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; | ||
} | ||
return isFirst.current; | ||
}; | ||
Object.assign(state.current, patch); | ||
update(); // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
return [get, set]; | ||
}; | ||
var useUpdateEffect = function useUpdateEffect(effect, deps) { | ||
var isFirstMount = useFirstMountState(); | ||
React.useEffect(function () { | ||
if (!isFirstMount) { | ||
return effect(); | ||
} // eslint-disable-next-line react-hooks/exhaustive-deps | ||
// Hat-tip: | ||
}, deps); | ||
}; | ||
var useFirstMountState = function useFirstMountState() { | ||
var isFirst = React.useRef(true); | ||
/* istanbul ignore next */ | ||
if (isFirst.current) { | ||
isFirst.current = false; | ||
return true; | ||
} | ||
var noop = function noop() { | ||
return undefined; | ||
}; | ||
return isFirst.current; | ||
}; | ||
var initialState = { | ||
isFinished: true, | ||
progress: 0, | ||
sideEffect: noop | ||
}; | ||
var useNProgress = function useNProgress(_temp) { | ||
var _ref = _temp === void 0 ? {} : _temp, | ||
_ref$animationDuratio = _ref.animationDuration, | ||
animationDuration = _ref$animationDuratio === void 0 ? 200 : _ref$animationDuratio, | ||
_ref$incrementDuratio = _ref.incrementDuration, | ||
incrementDuration = _ref$incrementDuratio === void 0 ? 800 : _ref$incrementDuratio, | ||
_ref$isAnimating = _ref.isAnimating, | ||
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating, | ||
_ref$minimum = _ref.minimum, | ||
minimum = _ref$minimum === void 0 ? 0.08 : _ref$minimum; | ||
var useUpdateEffect = function useUpdateEffect(effect, deps) { | ||
var isFirstMount = useFirstMountState(); | ||
React.useEffect(function () { | ||
if (!isFirstMount) { | ||
return effect(); | ||
} // eslint-disable-next-line react-hooks/exhaustive-deps | ||
var _useGetSetState = useGetSetState(initialState), | ||
get = _useGetSetState[0], | ||
setState = _useGetSetState[1]; | ||
}, deps); | ||
}; | ||
var queue = React.useRef(null); | ||
var timeout = React.useRef(null); | ||
useEffectOnce(function () { | ||
queue.current = createQueue(); | ||
timeout.current = createTimeout(); | ||
}); | ||
var cleanup = React.useCallback(function () { | ||
var _timeout$current, _queue$current; | ||
/* istanbul ignore next */ | ||
(_timeout$current = timeout.current) == null ? void 0 : _timeout$current.cancel(); | ||
(_queue$current = queue.current) == null ? void 0 : _queue$current.clear(); | ||
}, []); | ||
var set = React.useCallback(function (n) { | ||
var _queue$current4; | ||
var noop = function noop() { | ||
return undefined; | ||
}; | ||
n = clamp(n, minimum, 1); | ||
var initialState = { | ||
isFinished: true, | ||
progress: 0, | ||
sideEffect: noop | ||
}; | ||
var useNProgress = function useNProgress(_temp) { | ||
var _ref = _temp === void 0 ? {} : _temp, | ||
_ref$animationDuratio = _ref.animationDuration, | ||
animationDuration = _ref$animationDuratio === void 0 ? 200 : _ref$animationDuratio, | ||
_ref$incrementDuratio = _ref.incrementDuration, | ||
incrementDuration = _ref$incrementDuratio === void 0 ? 800 : _ref$incrementDuratio, | ||
_ref$isAnimating = _ref.isAnimating, | ||
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating, | ||
_ref$minimum = _ref.minimum, | ||
minimum = _ref$minimum === void 0 ? 0.08 : _ref$minimum; | ||
if (n === 1) { | ||
var _queue$current2, _queue$current3; | ||
var _useGetSetState = useGetSetState(initialState), | ||
get = _useGetSetState[0], | ||
setState = _useGetSetState[1]; | ||
cleanup(); | ||
(_queue$current2 = queue.current) == null ? void 0 : _queue$current2.enqueue(function (next) { | ||
setState({ | ||
progress: n, | ||
sideEffect: function sideEffect() { | ||
var _timeout$current2; | ||
var queue = React.useRef(null); | ||
var timeout = React.useRef(null); | ||
useEffectOnce(function () { | ||
queue.current = createQueue(); | ||
timeout.current = createTimeout(); | ||
}); | ||
var cleanup = React.useCallback(function () { | ||
var _timeout$current, _queue$current; | ||
return (_timeout$current2 = timeout.current) == null ? void 0 : _timeout$current2.schedule(next, animationDuration); | ||
} | ||
}); | ||
}); | ||
(_queue$current3 = queue.current) == null ? void 0 : _queue$current3.enqueue(function () { | ||
setState({ | ||
isFinished: true, | ||
sideEffect: cleanup | ||
}); | ||
}); | ||
return; | ||
} | ||
(_timeout$current = timeout.current) == null ? void 0 : _timeout$current.cancel(); | ||
(_queue$current = queue.current) == null ? void 0 : _queue$current.clear(); | ||
}, []); | ||
var set = React.useCallback(function (n) { | ||
var _queue$current4; | ||
(_queue$current4 = queue.current) == null ? void 0 : _queue$current4.enqueue(function (next) { | ||
setState({ | ||
isFinished: false, | ||
progress: n, | ||
sideEffect: function sideEffect() { | ||
var _timeout$current3; | ||
n = clamp(n, minimum, 1); | ||
return (_timeout$current3 = timeout.current) == null ? void 0 : _timeout$current3.schedule(next, animationDuration); | ||
} | ||
}); | ||
}); | ||
}, [animationDuration, cleanup, minimum, queue, setState, timeout]); | ||
var trickle = React.useCallback(function () { | ||
set(increment(get().progress)); | ||
}, [get, set]); | ||
var start = React.useCallback(function () { | ||
var work = function work() { | ||
var _queue$current5; | ||
if (n === 1) { | ||
var _queue$current2, _queue$current3; | ||
trickle(); | ||
(_queue$current5 = queue.current) == null ? void 0 : _queue$current5.enqueue(function (next) { | ||
var _timeout$current4; | ||
cleanup(); | ||
(_queue$current2 = queue.current) == null ? void 0 : _queue$current2.enqueue(function (next) { | ||
setState({ | ||
progress: n, | ||
sideEffect: function sideEffect() { | ||
var _timeout$current2; | ||
(_timeout$current4 = timeout.current) == null ? void 0 : _timeout$current4.schedule(function () { | ||
work(); | ||
next(); | ||
}, incrementDuration); | ||
}); | ||
}; | ||
return (_timeout$current2 = timeout.current) == null ? void 0 : _timeout$current2.schedule(next, animationDuration); | ||
} | ||
}); | ||
}); | ||
(_queue$current3 = queue.current) == null ? void 0 : _queue$current3.enqueue(function () { | ||
setState({ | ||
isFinished: true, | ||
sideEffect: cleanup | ||
}); | ||
}); | ||
return; | ||
} | ||
work(); | ||
}, [incrementDuration, queue, timeout, trickle]); | ||
var savedTrickle = React.useRef(noop); | ||
var sideEffect = get().sideEffect; | ||
React.useEffect(function () { | ||
savedTrickle.current = trickle; | ||
}); | ||
useEffectOnce(function () { | ||
if (isAnimating) { | ||
start(); | ||
} | ||
(_queue$current4 = queue.current) == null ? void 0 : _queue$current4.enqueue(function (next) { | ||
setState({ | ||
isFinished: false, | ||
progress: n, | ||
sideEffect: function sideEffect() { | ||
var _timeout$current3; | ||
return cleanup; | ||
}); | ||
useUpdateEffect(function () { | ||
get().sideEffect(); | ||
}, [get, sideEffect]); | ||
useUpdateEffect(function () { | ||
if (!isAnimating) { | ||
set(1); | ||
} else { | ||
setState(_extends({}, initialState, { | ||
sideEffect: start | ||
})); | ||
} | ||
}, [isAnimating, set, setState, start]); | ||
return { | ||
animationDuration: animationDuration, | ||
isFinished: get().isFinished, | ||
progress: get().progress | ||
}; | ||
}; | ||
return (_timeout$current3 = timeout.current) == null ? void 0 : _timeout$current3.schedule(next, animationDuration); | ||
} | ||
}); | ||
}); | ||
}, [animationDuration, cleanup, minimum, queue, setState, timeout]); | ||
var trickle = React.useCallback(function () { | ||
set(increment(get().progress)); | ||
}, [get, set]); | ||
var start = React.useCallback(function () { | ||
var work = function work() { | ||
var _queue$current5; | ||
var _excluded = ["children"]; | ||
var NProgress = function NProgress(_ref) { | ||
var children = _ref.children, | ||
restProps = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
trickle(); | ||
(_queue$current5 = queue.current) == null ? void 0 : _queue$current5.enqueue(function (next) { | ||
var _timeout$current4; | ||
var renderProps = useNProgress(restProps); | ||
return children(renderProps); | ||
}; | ||
(_timeout$current4 = timeout.current) == null ? void 0 : _timeout$current4.schedule(function () { | ||
work(); | ||
next(); | ||
}, incrementDuration); | ||
}); | ||
}; | ||
var reactIs$1 = {exports: {}}; | ||
work(); | ||
}, [incrementDuration, queue, timeout, trickle]); | ||
var savedTrickle = React.useRef(noop); | ||
var sideEffect = get().sideEffect; | ||
React.useEffect(function () { | ||
savedTrickle.current = trickle; | ||
}); | ||
useEffectOnce(function () { | ||
if (isAnimating) { | ||
start(); | ||
} | ||
var reactIs_development = {}; | ||
return cleanup; | ||
}); | ||
useUpdateEffect(function () { | ||
get().sideEffect(); | ||
}, [get, sideEffect]); | ||
useUpdateEffect(function () { | ||
if (!isAnimating) { | ||
set(1); | ||
} else { | ||
setState(_extends({}, initialState, { | ||
sideEffect: start | ||
})); | ||
} | ||
}, [isAnimating, set, setState, start]); | ||
return { | ||
animationDuration: animationDuration, | ||
isFinished: get().isFinished, | ||
progress: get().progress | ||
}; | ||
}; | ||
/** @license React v16.13.1 | ||
* react-is.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var _excluded = ["children"]; | ||
var NProgress = function NProgress(_ref) { | ||
var children = _ref.children, | ||
restProps = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
var renderProps = useNProgress(restProps); | ||
return children(renderProps); | ||
}; | ||
var reactIs_development = createCommonjsModule(function (module, exports) { | ||
{ | ||
(function() { | ||
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol | ||
// nor polyfill, then a plain number is used for performance. | ||
var hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; | ||
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; | ||
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; | ||
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; | ||
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; | ||
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary | ||
// (unstable) APIs that have been removed. Can we remove the symbols? | ||
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; | ||
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; | ||
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; | ||
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; | ||
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; | ||
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; | ||
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; | ||
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; | ||
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; | ||
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; | ||
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; | ||
{ | ||
(function() { | ||
function isValidElementType(type) { | ||
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. | ||
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); | ||
} | ||
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol | ||
// nor polyfill, then a plain number is used for performance. | ||
var hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; | ||
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; | ||
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; | ||
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; | ||
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; | ||
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary | ||
// (unstable) APIs that have been removed. Can we remove the symbols? | ||
function typeOf(object) { | ||
if (typeof object === 'object' && object !== null) { | ||
var $$typeof = object.$$typeof; | ||
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; | ||
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; | ||
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; | ||
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; | ||
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; | ||
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; | ||
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; | ||
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; | ||
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; | ||
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; | ||
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; | ||
switch ($$typeof) { | ||
case REACT_ELEMENT_TYPE: | ||
var type = object.type; | ||
function isValidElementType(type) { | ||
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. | ||
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); | ||
} | ||
switch (type) { | ||
case REACT_ASYNC_MODE_TYPE: | ||
case REACT_CONCURRENT_MODE_TYPE: | ||
case REACT_FRAGMENT_TYPE: | ||
case REACT_PROFILER_TYPE: | ||
case REACT_STRICT_MODE_TYPE: | ||
case REACT_SUSPENSE_TYPE: | ||
return type; | ||
function typeOf(object) { | ||
if (typeof object === 'object' && object !== null) { | ||
var $$typeof = object.$$typeof; | ||
default: | ||
var $$typeofType = type && type.$$typeof; | ||
switch ($$typeof) { | ||
case REACT_ELEMENT_TYPE: | ||
var type = object.type; | ||
switch ($$typeofType) { | ||
case REACT_CONTEXT_TYPE: | ||
case REACT_FORWARD_REF_TYPE: | ||
case REACT_LAZY_TYPE: | ||
case REACT_MEMO_TYPE: | ||
case REACT_PROVIDER_TYPE: | ||
return $$typeofType; | ||
switch (type) { | ||
case REACT_ASYNC_MODE_TYPE: | ||
case REACT_CONCURRENT_MODE_TYPE: | ||
case REACT_FRAGMENT_TYPE: | ||
case REACT_PROFILER_TYPE: | ||
case REACT_STRICT_MODE_TYPE: | ||
case REACT_SUSPENSE_TYPE: | ||
return type; | ||
default: | ||
return $$typeof; | ||
} | ||
default: | ||
var $$typeofType = type && type.$$typeof; | ||
} | ||
switch ($$typeofType) { | ||
case REACT_CONTEXT_TYPE: | ||
case REACT_FORWARD_REF_TYPE: | ||
case REACT_LAZY_TYPE: | ||
case REACT_MEMO_TYPE: | ||
case REACT_PROVIDER_TYPE: | ||
return $$typeofType; | ||
case REACT_PORTAL_TYPE: | ||
return $$typeof; | ||
} | ||
} | ||
default: | ||
return $$typeof; | ||
} | ||
return undefined; | ||
} // AsyncMode is deprecated along with isAsyncMode | ||
} | ||
var AsyncMode = REACT_ASYNC_MODE_TYPE; | ||
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; | ||
var ContextConsumer = REACT_CONTEXT_TYPE; | ||
var ContextProvider = REACT_PROVIDER_TYPE; | ||
var Element = REACT_ELEMENT_TYPE; | ||
var ForwardRef = REACT_FORWARD_REF_TYPE; | ||
var Fragment = REACT_FRAGMENT_TYPE; | ||
var Lazy = REACT_LAZY_TYPE; | ||
var Memo = REACT_MEMO_TYPE; | ||
var Portal = REACT_PORTAL_TYPE; | ||
var Profiler = REACT_PROFILER_TYPE; | ||
var StrictMode = REACT_STRICT_MODE_TYPE; | ||
var Suspense = REACT_SUSPENSE_TYPE; | ||
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated | ||
case REACT_PORTAL_TYPE: | ||
return $$typeof; | ||
} | ||
} | ||
function isAsyncMode(object) { | ||
{ | ||
if (!hasWarnedAboutDeprecatedIsAsyncMode) { | ||
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint | ||
return undefined; | ||
} // AsyncMode is deprecated along with isAsyncMode | ||
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); | ||
} | ||
} | ||
var AsyncMode = REACT_ASYNC_MODE_TYPE; | ||
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; | ||
var ContextConsumer = REACT_CONTEXT_TYPE; | ||
var ContextProvider = REACT_PROVIDER_TYPE; | ||
var Element = REACT_ELEMENT_TYPE; | ||
var ForwardRef = REACT_FORWARD_REF_TYPE; | ||
var Fragment = REACT_FRAGMENT_TYPE; | ||
var Lazy = REACT_LAZY_TYPE; | ||
var Memo = REACT_MEMO_TYPE; | ||
var Portal = REACT_PORTAL_TYPE; | ||
var Profiler = REACT_PROFILER_TYPE; | ||
var StrictMode = REACT_STRICT_MODE_TYPE; | ||
var Suspense = REACT_SUSPENSE_TYPE; | ||
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated | ||
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; | ||
} | ||
function isConcurrentMode(object) { | ||
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; | ||
} | ||
function isContextConsumer(object) { | ||
return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} | ||
function isContextProvider(object) { | ||
return typeOf(object) === REACT_PROVIDER_TYPE; | ||
} | ||
function isElement(object) { | ||
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
} | ||
function isForwardRef(object) { | ||
return typeOf(object) === REACT_FORWARD_REF_TYPE; | ||
} | ||
function isFragment(object) { | ||
return typeOf(object) === REACT_FRAGMENT_TYPE; | ||
} | ||
function isLazy(object) { | ||
return typeOf(object) === REACT_LAZY_TYPE; | ||
} | ||
function isMemo(object) { | ||
return typeOf(object) === REACT_MEMO_TYPE; | ||
} | ||
function isPortal(object) { | ||
return typeOf(object) === REACT_PORTAL_TYPE; | ||
} | ||
function isProfiler(object) { | ||
return typeOf(object) === REACT_PROFILER_TYPE; | ||
} | ||
function isStrictMode(object) { | ||
return typeOf(object) === REACT_STRICT_MODE_TYPE; | ||
} | ||
function isSuspense(object) { | ||
return typeOf(object) === REACT_SUSPENSE_TYPE; | ||
} | ||
function isAsyncMode(object) { | ||
{ | ||
if (!hasWarnedAboutDeprecatedIsAsyncMode) { | ||
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint | ||
reactIs_development.AsyncMode = AsyncMode; | ||
reactIs_development.ConcurrentMode = ConcurrentMode; | ||
reactIs_development.ContextConsumer = ContextConsumer; | ||
reactIs_development.ContextProvider = ContextProvider; | ||
reactIs_development.Element = Element; | ||
reactIs_development.ForwardRef = ForwardRef; | ||
reactIs_development.Fragment = Fragment; | ||
reactIs_development.Lazy = Lazy; | ||
reactIs_development.Memo = Memo; | ||
reactIs_development.Portal = Portal; | ||
reactIs_development.Profiler = Profiler; | ||
reactIs_development.StrictMode = StrictMode; | ||
reactIs_development.Suspense = Suspense; | ||
reactIs_development.isAsyncMode = isAsyncMode; | ||
reactIs_development.isConcurrentMode = isConcurrentMode; | ||
reactIs_development.isContextConsumer = isContextConsumer; | ||
reactIs_development.isContextProvider = isContextProvider; | ||
reactIs_development.isElement = isElement; | ||
reactIs_development.isForwardRef = isForwardRef; | ||
reactIs_development.isFragment = isFragment; | ||
reactIs_development.isLazy = isLazy; | ||
reactIs_development.isMemo = isMemo; | ||
reactIs_development.isPortal = isPortal; | ||
reactIs_development.isProfiler = isProfiler; | ||
reactIs_development.isStrictMode = isStrictMode; | ||
reactIs_development.isSuspense = isSuspense; | ||
reactIs_development.isValidElementType = isValidElementType; | ||
reactIs_development.typeOf = typeOf; | ||
})(); | ||
} | ||
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); | ||
} | ||
} | ||
{ | ||
reactIs$1.exports = reactIs_development; | ||
} | ||
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; | ||
} | ||
function isConcurrentMode(object) { | ||
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; | ||
} | ||
function isContextConsumer(object) { | ||
return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} | ||
function isContextProvider(object) { | ||
return typeOf(object) === REACT_PROVIDER_TYPE; | ||
} | ||
function isElement(object) { | ||
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
} | ||
function isForwardRef(object) { | ||
return typeOf(object) === REACT_FORWARD_REF_TYPE; | ||
} | ||
function isFragment(object) { | ||
return typeOf(object) === REACT_FRAGMENT_TYPE; | ||
} | ||
function isLazy(object) { | ||
return typeOf(object) === REACT_LAZY_TYPE; | ||
} | ||
function isMemo(object) { | ||
return typeOf(object) === REACT_MEMO_TYPE; | ||
} | ||
function isPortal(object) { | ||
return typeOf(object) === REACT_PORTAL_TYPE; | ||
} | ||
function isProfiler(object) { | ||
return typeOf(object) === REACT_PROFILER_TYPE; | ||
} | ||
function isStrictMode(object) { | ||
return typeOf(object) === REACT_STRICT_MODE_TYPE; | ||
} | ||
function isSuspense(object) { | ||
return typeOf(object) === REACT_SUSPENSE_TYPE; | ||
} | ||
var reactIs = reactIs$1.exports; | ||
exports.AsyncMode = AsyncMode; | ||
exports.ConcurrentMode = ConcurrentMode; | ||
exports.ContextConsumer = ContextConsumer; | ||
exports.ContextProvider = ContextProvider; | ||
exports.Element = Element; | ||
exports.ForwardRef = ForwardRef; | ||
exports.Fragment = Fragment; | ||
exports.Lazy = Lazy; | ||
exports.Memo = Memo; | ||
exports.Portal = Portal; | ||
exports.Profiler = Profiler; | ||
exports.StrictMode = StrictMode; | ||
exports.Suspense = Suspense; | ||
exports.isAsyncMode = isAsyncMode; | ||
exports.isConcurrentMode = isConcurrentMode; | ||
exports.isContextConsumer = isContextConsumer; | ||
exports.isContextProvider = isContextProvider; | ||
exports.isElement = isElement; | ||
exports.isForwardRef = isForwardRef; | ||
exports.isFragment = isFragment; | ||
exports.isLazy = isLazy; | ||
exports.isMemo = isMemo; | ||
exports.isPortal = isPortal; | ||
exports.isProfiler = isProfiler; | ||
exports.isStrictMode = isStrictMode; | ||
exports.isSuspense = isSuspense; | ||
exports.isValidElementType = isValidElementType; | ||
exports.typeOf = typeOf; | ||
})(); | ||
} | ||
}); | ||
reactIs_development.AsyncMode; | ||
reactIs_development.ConcurrentMode; | ||
reactIs_development.ContextConsumer; | ||
reactIs_development.ContextProvider; | ||
reactIs_development.Element; | ||
reactIs_development.ForwardRef; | ||
reactIs_development.Fragment; | ||
reactIs_development.Lazy; | ||
reactIs_development.Memo; | ||
reactIs_development.Portal; | ||
reactIs_development.Profiler; | ||
reactIs_development.StrictMode; | ||
reactIs_development.Suspense; | ||
reactIs_development.isAsyncMode; | ||
reactIs_development.isConcurrentMode; | ||
reactIs_development.isContextConsumer; | ||
reactIs_development.isContextProvider; | ||
reactIs_development.isElement; | ||
reactIs_development.isForwardRef; | ||
reactIs_development.isFragment; | ||
reactIs_development.isLazy; | ||
reactIs_development.isMemo; | ||
reactIs_development.isPortal; | ||
reactIs_development.isProfiler; | ||
reactIs_development.isStrictMode; | ||
reactIs_development.isSuspense; | ||
reactIs_development.isValidElementType; | ||
reactIs_development.typeOf; | ||
/** | ||
* Copyright 2015, Yahoo! Inc. | ||
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. | ||
*/ | ||
var REACT_STATICS = { | ||
childContextTypes: true, | ||
contextType: true, | ||
contextTypes: true, | ||
defaultProps: true, | ||
displayName: true, | ||
getDefaultProps: true, | ||
getDerivedStateFromError: true, | ||
getDerivedStateFromProps: true, | ||
mixins: true, | ||
propTypes: true, | ||
type: true | ||
}; | ||
var KNOWN_STATICS = { | ||
name: true, | ||
length: true, | ||
prototype: true, | ||
caller: true, | ||
callee: true, | ||
arguments: true, | ||
arity: true | ||
}; | ||
var FORWARD_REF_STATICS = { | ||
'$$typeof': true, | ||
render: true, | ||
defaultProps: true, | ||
displayName: true, | ||
propTypes: true | ||
}; | ||
var MEMO_STATICS = { | ||
'$$typeof': true, | ||
compare: true, | ||
defaultProps: true, | ||
displayName: true, | ||
propTypes: true, | ||
type: true | ||
}; | ||
var TYPE_STATICS = {}; | ||
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; | ||
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; | ||
var reactIs = createCommonjsModule(function (module) { | ||
function getStatics(component) { | ||
// React v16.11 and below | ||
if (reactIs.isMemo(component)) { | ||
return MEMO_STATICS; | ||
} // React v16.12 and above | ||
{ | ||
module.exports = reactIs_development; | ||
} | ||
}); | ||
/** | ||
* Copyright 2015, Yahoo! Inc. | ||
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. | ||
*/ | ||
var REACT_STATICS = { | ||
childContextTypes: true, | ||
contextType: true, | ||
contextTypes: true, | ||
defaultProps: true, | ||
displayName: true, | ||
getDefaultProps: true, | ||
getDerivedStateFromError: true, | ||
getDerivedStateFromProps: true, | ||
mixins: true, | ||
propTypes: true, | ||
type: true | ||
}; | ||
var KNOWN_STATICS = { | ||
name: true, | ||
length: true, | ||
prototype: true, | ||
caller: true, | ||
callee: true, | ||
arguments: true, | ||
arity: true | ||
}; | ||
var FORWARD_REF_STATICS = { | ||
'$$typeof': true, | ||
render: true, | ||
defaultProps: true, | ||
displayName: true, | ||
propTypes: true | ||
}; | ||
var MEMO_STATICS = { | ||
'$$typeof': true, | ||
compare: true, | ||
defaultProps: true, | ||
displayName: true, | ||
propTypes: true, | ||
type: true | ||
}; | ||
var TYPE_STATICS = {}; | ||
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; | ||
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; | ||
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; | ||
} | ||
function getStatics(component) { | ||
// React v16.11 and below | ||
if (reactIs.isMemo(component)) { | ||
return MEMO_STATICS; | ||
} // React v16.12 and above | ||
var defineProperty = Object.defineProperty; | ||
var getOwnPropertyNames = Object.getOwnPropertyNames; | ||
var getOwnPropertySymbols = Object.getOwnPropertySymbols; | ||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | ||
var getPrototypeOf = Object.getPrototypeOf; | ||
var objectPrototype = Object.prototype; | ||
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { | ||
if (typeof sourceComponent !== 'string') { | ||
// don't hoist over string (html) components | ||
if (objectPrototype) { | ||
var inheritedComponent = getPrototypeOf(sourceComponent); | ||
if (inheritedComponent && inheritedComponent !== objectPrototype) { | ||
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); | ||
} | ||
} | ||
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; | ||
} | ||
var keys = getOwnPropertyNames(sourceComponent); | ||
var defineProperty = Object.defineProperty; | ||
var getOwnPropertyNames = Object.getOwnPropertyNames; | ||
var getOwnPropertySymbols = Object.getOwnPropertySymbols; | ||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | ||
var getPrototypeOf = Object.getPrototypeOf; | ||
var objectPrototype = Object.prototype; | ||
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { | ||
if (typeof sourceComponent !== 'string') { | ||
// don't hoist over string (html) components | ||
if (objectPrototype) { | ||
var inheritedComponent = getPrototypeOf(sourceComponent); | ||
if (getOwnPropertySymbols) { | ||
keys = keys.concat(getOwnPropertySymbols(sourceComponent)); | ||
} | ||
if (inheritedComponent && inheritedComponent !== objectPrototype) { | ||
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); | ||
} | ||
} | ||
var targetStatics = getStatics(targetComponent); | ||
var sourceStatics = getStatics(sourceComponent); | ||
var keys = getOwnPropertyNames(sourceComponent); | ||
for (var i = 0; i < keys.length; ++i) { | ||
var key = keys[i]; | ||
if (getOwnPropertySymbols) { | ||
keys = keys.concat(getOwnPropertySymbols(sourceComponent)); | ||
} | ||
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { | ||
var descriptor = getOwnPropertyDescriptor(sourceComponent, key); | ||
var targetStatics = getStatics(targetComponent); | ||
var sourceStatics = getStatics(sourceComponent); | ||
try { | ||
// Avoid failures from read-only properties | ||
defineProperty(targetComponent, key, descriptor); | ||
} catch (e) {} | ||
} | ||
} | ||
} | ||
for (var i = 0; i < keys.length; ++i) { | ||
var key = keys[i]; | ||
return targetComponent; | ||
} | ||
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { | ||
var descriptor = getOwnPropertyDescriptor(sourceComponent, key); | ||
var hoistNonReactStatics_cjs = hoistNonReactStatics; | ||
try { | ||
// Avoid failures from read-only properties | ||
defineProperty(targetComponent, key, descriptor); | ||
} catch (e) {} | ||
} | ||
} | ||
} | ||
function withNProgress(BaseComponent) { | ||
var WithNProgress = function WithNProgress(props) { | ||
var hookProps = useNProgress(props); | ||
return /*#__PURE__*/React__namespace.createElement(BaseComponent, _extends({}, props, hookProps)); | ||
}; | ||
return targetComponent; | ||
} | ||
hoistNonReactStatics_cjs(WithNProgress, BaseComponent); | ||
return WithNProgress; | ||
} | ||
var hoistNonReactStatics_cjs = hoistNonReactStatics; | ||
exports.NProgress = NProgress; | ||
exports.useNProgress = useNProgress; | ||
exports.withNProgress = withNProgress; | ||
function withNProgress(BaseComponent) { | ||
var WithNProgress = function WithNProgress(props) { | ||
var hookProps = useNProgress(props); | ||
return /*#__PURE__*/React__namespace.createElement(BaseComponent, _extends({}, props, hookProps)); | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
hoistNonReactStatics_cjs(WithNProgress, BaseComponent); | ||
return WithNProgress; | ||
} | ||
exports.NProgress = NProgress; | ||
exports.useNProgress = useNProgress; | ||
exports.withNProgress = withNProgress; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); | ||
//# sourceMappingURL=react-nprogress.umd.development.js.map |
@@ -1,2 +0,2 @@ | ||
!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})})); | ||
!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(){return o=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},o.apply(this,arguments)}var u=function(e,r,t){return e=(e=e<=t?e:t)>=r?e:r},c=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()}}},i=function(e){r.useEffect(e,[])},f=function(e){return++e%1e6},a=function(e){void 0===e&&(e={});var t,n=(t=r.useState(0)[1],r.useCallback((function(){return t(f)}),[])),u=r.useRef(o({},e));return[r.useCallback((function(){return u.current}),[]),r.useCallback((function(e){e&&(Object.assign(u.current,e),n())}),[])]},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)},l=function(){},p={isFinished:!0,progress:0,sideEffect:l},y=function(e){var t=void 0===e?{}:e,n=t.animationDuration,f=void 0===n?200:n,y=t.incrementDuration,d=void 0===y?800:y,m=t.isAnimating,b=void 0!==m&&m,v=t.minimum,g=void 0===v?.08:v,h=a(p),$=h[0],S=h[1],O=r.useRef(null),P=r.useRef(null);i((function(){var e;O.current=c(),P.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 j=r.useCallback((function(){var e,r;null==(e=P.current)||e.cancel(),null==(r=O.current)||r.clear()}),[]),w=r.useCallback((function(e){var r,t,n;if(1===(e=u(e,g,1)))return j(),null==(t=O.current)||t.enqueue((function(r){S({progress:e,sideEffect:function(){var e;return null==(e=P.current)?void 0:e.schedule(r,f)}})})),void(null==(n=O.current)||n.enqueue((function(){S({isFinished:!0,sideEffect:j})})));null==(r=O.current)||r.enqueue((function(r){S({isFinished:!1,progress:e,sideEffect:function(){var e;return null==(e=P.current)?void 0:e.schedule(r,f)}})}))}),[f,j,g,O,S,P]),x=r.useCallback((function(){var e,r;w((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),u(e+r,0,.994)))}),[$,w]),C=r.useCallback((function(){!function e(){var r;x(),null==(r=O.current)||r.enqueue((function(r){var t;null==(t=P.current)||t.schedule((function(){e(),r()}),d)}))}()}),[d,O,P,x]),E=r.useRef(l),F=$().sideEffect;return r.useEffect((function(){E.current=x})),i((function(){return b&&C(),j})),s((function(){$().sideEffect()}),[$,F]),s((function(){b?S(o({},p,{sideEffect:C})):w(1)}),[b,w,S,C]),{animationDuration:f,isFinished:$().isFinished,progress:$().progress}},d=["children"],m={exports:{}},b={},v="function"==typeof Symbol&&Symbol.for,g=v?Symbol.for("react.element"):60103,h=v?Symbol.for("react.portal"):60106,$=v?Symbol.for("react.fragment"):60107,S=v?Symbol.for("react.strict_mode"):60108,O=v?Symbol.for("react.profiler"):60114,P=v?Symbol.for("react.provider"):60109,j=v?Symbol.for("react.context"):60110,w=v?Symbol.for("react.async_mode"):60111,x=v?Symbol.for("react.concurrent_mode"):60111,C=v?Symbol.for("react.forward_ref"):60112,E=v?Symbol.for("react.suspense"):60113,F=v?Symbol.for("react.suspense_list"):60120,M=v?Symbol.for("react.memo"):60115,k=v?Symbol.for("react.lazy"):60116,R=v?Symbol.for("react.block"):60121,T=v?Symbol.for("react.fundamental"):60117,_=v?Symbol.for("react.responder"):60118,q=v?Symbol.for("react.scope"):60119;function D(e){if("object"==typeof e&&null!==e){var r=e.$$typeof;switch(r){case g:switch(e=e.type){case w:case x:case $:case O:case S:case E:return e;default:switch(e=e&&e.$$typeof){case j:case C:case k:case M:case P:return e;default:return r}}case h:return r}}}function N(e){return D(e)===x}b.AsyncMode=w,b.ConcurrentMode=x,b.ContextConsumer=j,b.ContextProvider=P,b.Element=g,b.ForwardRef=C,b.Fragment=$,b.Lazy=k,b.Memo=M,b.Portal=h,b.Profiler=O,b.StrictMode=S,b.Suspense=E,b.isAsyncMode=function(e){return N(e)||D(e)===w},b.isConcurrentMode=N,b.isContextConsumer=function(e){return D(e)===j},b.isContextProvider=function(e){return D(e)===P},b.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===g},b.isForwardRef=function(e){return D(e)===C},b.isFragment=function(e){return D(e)===$},b.isLazy=function(e){return D(e)===k},b.isMemo=function(e){return D(e)===M},b.isPortal=function(e){return D(e)===h},b.isProfiler=function(e){return D(e)===O},b.isStrictMode=function(e){return D(e)===S},b.isSuspense=function(e){return D(e)===E},b.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===$||e===x||e===O||e===S||e===E||e===F||"object"==typeof e&&null!==e&&(e.$$typeof===k||e.$$typeof===M||e.$$typeof===P||e.$$typeof===j||e.$$typeof===C||e.$$typeof===T||e.$$typeof===_||e.$$typeof===q||e.$$typeof===R)},b.typeOf=D,m.exports=b;var A=m.exports,z={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},L={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},V={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},B={};function G(e){return A.isMemo(e)?V:B[e.$$typeof]||z}B[A.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},B[A.Memo]=V;var H=Object.defineProperty,I=Object.getOwnPropertyNames,J=Object.getOwnPropertySymbols,K=Object.getOwnPropertyDescriptor,Q=Object.getPrototypeOf,U=Object.prototype;var W=function e(r,t,n){if("string"!=typeof t){if(U){var o=Q(t);o&&o!==U&&e(r,o,n)}var u=I(t);J&&(u=u.concat(J(t)));for(var c=G(r),i=G(t),f=0;f<u.length;++f){var a=u[f];if(!(L[a]||n&&n[a]||i&&i[a]||c&&c[a])){var s=K(t,a);try{H(r,a,s)}catch(e){}}}}return r};e.NProgress=function(e){var r=e.children,t=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,d);return r(y(t))},e.useNProgress=y,e.withNProgress=function(e){var r=function(r){var t=y(r);return n.createElement(e,o({},r,t))};return W(r,e),r},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=react-nprogress.umd.production.js.map |
{ | ||
"name": "@tanem/react-nprogress", | ||
"version": "4.0.13", | ||
"version": "5.0.0", | ||
"description": "A React primitive for building slim progress bars.", | ||
@@ -31,3 +31,3 @@ "main": "dist/index.js", | ||
"test:cjs": "jest --config ./scripts/jest/config.cjs.js", | ||
"test:cjsprod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.cjs.js", | ||
"test:cjsprod": "jest --config ./scripts/jest/config.cjsprod.js", | ||
"test:es": "jest --config ./scripts/jest/config.es.js", | ||
@@ -66,13 +66,11 @@ "test:src": "jest --config ./scripts/jest/config.src.js", | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0", | ||
"react-dom": "^16.8.0 || ^17.0.0" | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0", | ||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.17.8", | ||
"hoist-non-react-statics": "^3.3.2", | ||
"prop-types": "^15.8.1" | ||
"@babel/runtime": "^7.17.9", | ||
"hoist-non-react-statics": "^3.3.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.17.8", | ||
"@babel/plugin-proposal-class-properties": "7.16.7", | ||
"@babel/core": "7.17.9", | ||
"@babel/plugin-transform-runtime": "7.17.0", | ||
@@ -82,3 +80,7 @@ "@babel/preset-env": "7.16.11", | ||
"@babel/preset-typescript": "7.16.7", | ||
"@testing-library/react": "12.1.4", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"@rollup/plugin-commonjs": "^21.0.3", | ||
"@rollup/plugin-node-resolve": "^13.1.3", | ||
"@rollup/plugin-replace": "^4.0.0", | ||
"@testing-library/react": "13.0.0", | ||
"@testing-library/react-hooks": "7.0.2", | ||
@@ -88,14 +90,11 @@ "@types/hoist-non-react-statics": "3.3.1", | ||
"@types/mock-raf": "1.0.3", | ||
"@types/prop-types": "15.7.4", | ||
"@types/react": "17.0.43", | ||
"@types/react-dom": "17.0.14", | ||
"@typescript-eslint/eslint-plugin": "5.17.0", | ||
"@typescript-eslint/parser": "5.17.0", | ||
"@types/react": "18.0.1", | ||
"@types/react-dom": "18.0.0", | ||
"@typescript-eslint/eslint-plugin": "5.18.0", | ||
"@typescript-eslint/parser": "5.18.0", | ||
"babel-core": "6.26.3", | ||
"babel-plugin-transform-react-remove-prop-types": "0.4.24", | ||
"cross-env": "7.0.3", | ||
"eslint": "8.12.0", | ||
"eslint": "8.13.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-react": "7.29.4", | ||
"eslint-plugin-react-hooks": "4.3.0", | ||
"eslint-plugin-react-hooks": "4.4.0", | ||
"eslint-plugin-simple-import-sort": "7.0.0", | ||
@@ -105,18 +104,12 @@ "jest": "27.5.1", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "2.6.1", | ||
"react": "17.0.2", | ||
"react-dom": "17.0.2", | ||
"react-test-renderer": "17.0.2", | ||
"prettier": "2.6.2", | ||
"react": "18.0.0", | ||
"react-dom": "18.0.0", | ||
"react-test-renderer": "18.0.0", | ||
"regenerator-runtime": "0.13.9", | ||
"rollup": "2.70.1", | ||
"rollup-plugin-babel": "4.4.0", | ||
"rollup-plugin-commonjs": "10.1.0", | ||
"rollup-plugin-filesize": "9.1.2", | ||
"rollup-plugin-node-resolve": "5.2.0", | ||
"rollup-plugin-replace": "2.2.0", | ||
"rollup-plugin-size-snapshot": "0.12.0", | ||
"rollup-plugin-sourcemaps": "0.6.3", | ||
"rollup-plugin-terser": "7.0.2", | ||
"shx": "0.3.4", | ||
"tanem-scripts": "6.0.45", | ||
"tanem-scripts": "6.0.46", | ||
"ts-jest": "27.1.4", | ||
@@ -123,0 +116,0 @@ "typescript": "4.6.3" |
@@ -204,3 +204,2 @@ # react-nprogress | ||
- [`ReactDOM`](https://unpkg.com/react-dom/umd/react-dom.development.js) | ||
- [`PropTypes`](https://unpkg.com/prop-types/prop-types.js) | ||
@@ -207,0 +206,0 @@ For the minified production version, make sure you have already included: |
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
4
39
177825
1195
213
+ Addedreact@18.3.1(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedscheduler@0.23.2(transitive)
- Removedprop-types@^15.8.1
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact@17.0.2(transitive)
- Removedreact-dom@17.0.2(transitive)
- Removedscheduler@0.20.2(transitive)
Updated@babel/runtime@^7.17.9