@tanem/react-nprogress 6.0.3 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -116
- package/dist/react-nprogress.cjs +119 -0
- package/dist/react-nprogress.cjs.map +1 -0
- package/dist/react-nprogress.d.cts +25 -0
- package/dist/react-nprogress.d.cts.map +1 -0
- package/dist/react-nprogress.d.mts +25 -0
- package/dist/react-nprogress.d.mts.map +1 -0
- package/dist/react-nprogress.mjs +117 -0
- package/dist/react-nprogress.mjs.map +1 -0
- package/package.json +58 -40
- package/src/NProgress.tsx +13 -0
- package/src/clamp.ts +5 -0
- package/src/createTimeout.ts +35 -0
- package/src/env.d.ts +0 -0
- package/src/increment.ts +17 -0
- package/src/index.tsx +3 -0
- package/src/types.ts +12 -0
- package/src/useNProgress.tsx +121 -0
- package/dist/NProgress.d.ts +0 -8
- package/dist/clamp.d.ts +0 -1
- package/dist/createQueue.d.ts +0 -7
- package/dist/createTimeout.d.ts +0 -4
- package/dist/increment.d.ts +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -7
- package/dist/react-nprogress.cjs.development.js +0 -297
- package/dist/react-nprogress.cjs.development.js.map +0 -1
- package/dist/react-nprogress.cjs.production.js +0 -2
- package/dist/react-nprogress.cjs.production.js.map +0 -1
- package/dist/react-nprogress.esm.js +0 -293
- package/dist/react-nprogress.esm.js.map +0 -1
- package/dist/react-nprogress.umd.development.js +0 -725
- package/dist/react-nprogress.umd.development.js.map +0 -1
- package/dist/react-nprogress.umd.production.js +0 -2
- package/dist/react-nprogress.umd.production.js.map +0 -1
- package/dist/types.d.ts +0 -6
- package/dist/useEffectOnce.d.ts +0 -2
- package/dist/useGetSetState.d.ts +0 -1
- package/dist/useNProgress.d.ts +0 -6
- package/dist/useUpdateEffect.d.ts +0 -2
- package/dist/withNProgress.d.ts +0 -7
|
@@ -1,725 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react/jsx-runtime')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', 'react/jsx-runtime'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.NProgress = {}, global.React, global.React));
|
|
5
|
-
})(this, (function (exports, react, jsxRuntime) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
8
|
-
if (null == r) return {};
|
|
9
|
-
var t = {};
|
|
10
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
11
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
12
|
-
t[n] = r[n];
|
|
13
|
-
}
|
|
14
|
-
return t;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function _objectWithoutProperties(e, t) {
|
|
18
|
-
if (null == e) return {};
|
|
19
|
-
var o,
|
|
20
|
-
r,
|
|
21
|
-
i = _objectWithoutPropertiesLoose(e, t);
|
|
22
|
-
if (Object.getOwnPropertySymbols) {
|
|
23
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
24
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
25
|
-
}
|
|
26
|
-
return i;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function _typeof(o) {
|
|
30
|
-
"@babel/helpers - typeof";
|
|
31
|
-
|
|
32
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
33
|
-
return typeof o;
|
|
34
|
-
} : function (o) {
|
|
35
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
36
|
-
}, _typeof(o);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function toPrimitive(t, r) {
|
|
40
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
41
|
-
var e = t[Symbol.toPrimitive];
|
|
42
|
-
if (void 0 !== e) {
|
|
43
|
-
var i = e.call(t, r);
|
|
44
|
-
if ("object" != _typeof(i)) return i;
|
|
45
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
46
|
-
}
|
|
47
|
-
return ("string" === r ? String : Number)(t);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function toPropertyKey(t) {
|
|
51
|
-
var i = toPrimitive(t, "string");
|
|
52
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function _defineProperty(e, r, t) {
|
|
56
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
57
|
-
value: t,
|
|
58
|
-
enumerable: true,
|
|
59
|
-
configurable: true,
|
|
60
|
-
writable: true
|
|
61
|
-
}) : e[r] = t, e;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function _arrayWithHoles(r) {
|
|
65
|
-
if (Array.isArray(r)) return r;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _iterableToArrayLimit(r, l) {
|
|
69
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
70
|
-
if (null != t) {
|
|
71
|
-
var e,
|
|
72
|
-
n,
|
|
73
|
-
i,
|
|
74
|
-
u,
|
|
75
|
-
a = [],
|
|
76
|
-
f = true,
|
|
77
|
-
o = false;
|
|
78
|
-
try {
|
|
79
|
-
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
80
|
-
} catch (r) {
|
|
81
|
-
o = true, n = r;
|
|
82
|
-
} finally {
|
|
83
|
-
try {
|
|
84
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
85
|
-
} finally {
|
|
86
|
-
if (o) throw n;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return a;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function _arrayLikeToArray(r, a) {
|
|
94
|
-
(null == a || a > r.length) && (a = r.length);
|
|
95
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
96
|
-
return n;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function _unsupportedIterableToArray(r, a) {
|
|
100
|
-
if (r) {
|
|
101
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
102
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
103
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function _nonIterableRest() {
|
|
108
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function _slicedToArray(r, e) {
|
|
112
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
var clamp = function clamp(num, lower, upper) {
|
|
116
|
-
num = num <= upper ? num : upper;
|
|
117
|
-
num = num >= lower ? num : lower;
|
|
118
|
-
return num;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
var createQueue = function createQueue() {
|
|
122
|
-
var isRunning = false;
|
|
123
|
-
var pending = [];
|
|
124
|
-
var _next = function next() {
|
|
125
|
-
isRunning = true;
|
|
126
|
-
var cb = pending.shift();
|
|
127
|
-
if (cb) {
|
|
128
|
-
return cb(_next);
|
|
129
|
-
}
|
|
130
|
-
isRunning = false;
|
|
131
|
-
};
|
|
132
|
-
var clear = function clear() {
|
|
133
|
-
isRunning = false;
|
|
134
|
-
pending = [];
|
|
135
|
-
};
|
|
136
|
-
var enqueue = function enqueue(cb) {
|
|
137
|
-
pending.push(cb);
|
|
138
|
-
if (!isRunning && pending.length === 1) {
|
|
139
|
-
_next();
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
return {
|
|
143
|
-
clear: clear,
|
|
144
|
-
enqueue: enqueue
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
// Uses requestAnimationFrame rather than setTimeout for smoother animation
|
|
149
|
-
// timing. Note that rAF is throttled or paused in background tabs, so progress
|
|
150
|
-
// will stall when the tab is hidden and resume when it regains focus.
|
|
151
|
-
var createTimeout = function createTimeout() {
|
|
152
|
-
var handle;
|
|
153
|
-
var cancel = function cancel() {
|
|
154
|
-
if (handle !== undefined) {
|
|
155
|
-
window.cancelAnimationFrame(handle);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
var schedule = function schedule(callback, delay) {
|
|
159
|
-
cancel();
|
|
160
|
-
var deltaTime;
|
|
161
|
-
var start;
|
|
162
|
-
var _frame = function frame(time) {
|
|
163
|
-
start = start || time;
|
|
164
|
-
deltaTime = time - start;
|
|
165
|
-
if (deltaTime > delay) {
|
|
166
|
-
callback();
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
handle = window.requestAnimationFrame(_frame);
|
|
170
|
-
};
|
|
171
|
-
handle = window.requestAnimationFrame(_frame);
|
|
172
|
-
};
|
|
173
|
-
return {
|
|
174
|
-
cancel: cancel,
|
|
175
|
-
schedule: schedule
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
var increment = function increment(progress) {
|
|
180
|
-
var amount = 0;
|
|
181
|
-
if (progress >= 0 && progress < 0.2) {
|
|
182
|
-
amount = 0.1;
|
|
183
|
-
} else if (progress >= 0.2 && progress < 0.5) {
|
|
184
|
-
amount = 0.04;
|
|
185
|
-
} else if (progress >= 0.5 && progress < 0.8) {
|
|
186
|
-
amount = 0.02;
|
|
187
|
-
} else if (progress >= 0.8 && progress < 0.99) {
|
|
188
|
-
amount = 0.005;
|
|
189
|
-
}
|
|
190
|
-
return clamp(progress + amount, 0, 0.994);
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
// Hat-tip:
|
|
194
|
-
// https://github.com/streamich/react-use/blob/master/src/useEffectOnce.ts.
|
|
195
|
-
//
|
|
196
|
-
// `react-use` appears to be unmaintained, so moving the required code into
|
|
197
|
-
// this project for now.
|
|
198
|
-
var useEffectOnce = function useEffectOnce(effect) {
|
|
199
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
200
|
-
react.useEffect(effect, []);
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
204
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
205
|
-
var incrementParameter = function incrementParameter(num) {
|
|
206
|
-
return ++num % 1000000;
|
|
207
|
-
};
|
|
208
|
-
var useUpdate = function useUpdate() {
|
|
209
|
-
var _useState = react.useState(0),
|
|
210
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
211
|
-
setState = _useState2[1];
|
|
212
|
-
return react.useCallback(function () {
|
|
213
|
-
return setState(incrementParameter);
|
|
214
|
-
}, []);
|
|
215
|
-
};
|
|
216
|
-
var useGetSetState = function useGetSetState() {
|
|
217
|
-
var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
218
|
-
var update = useUpdate();
|
|
219
|
-
var state = react.useRef(_objectSpread$2({}, initialState));
|
|
220
|
-
var get = react.useCallback(function () {
|
|
221
|
-
return state.current;
|
|
222
|
-
}, []);
|
|
223
|
-
var set = react.useCallback(function (patch) {
|
|
224
|
-
if (!patch) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
Object.assign(state.current, patch);
|
|
228
|
-
update();
|
|
229
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
230
|
-
}, []);
|
|
231
|
-
return [get, set];
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
// Hat-tip:
|
|
235
|
-
// https://github.com/streamich/react-use/blob/master/src/useUpdateEffect.ts.
|
|
236
|
-
//
|
|
237
|
-
// `react-use` appears to be unmaintained, so moving the required code into
|
|
238
|
-
// this project for now.
|
|
239
|
-
var useFirstMountState = function useFirstMountState() {
|
|
240
|
-
var isFirst = react.useRef(true);
|
|
241
|
-
if (isFirst.current) {
|
|
242
|
-
isFirst.current = false;
|
|
243
|
-
return true;
|
|
244
|
-
}
|
|
245
|
-
return isFirst.current;
|
|
246
|
-
};
|
|
247
|
-
var useUpdateEffect = function useUpdateEffect(effect, deps) {
|
|
248
|
-
var isFirstMount = useFirstMountState();
|
|
249
|
-
react.useEffect(function () {
|
|
250
|
-
if (!isFirstMount) {
|
|
251
|
-
return effect();
|
|
252
|
-
}
|
|
253
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
254
|
-
}, deps);
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
258
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
259
|
-
/* istanbul ignore next */
|
|
260
|
-
var noop = function noop() {
|
|
261
|
-
return undefined;
|
|
262
|
-
};
|
|
263
|
-
// State includes a `sideEffect` callback that bridges imperative queue
|
|
264
|
-
// operations into React's declarative model. Each `setState` stores a callback;
|
|
265
|
-
// `useUpdateEffect` fires it after React commits the update. This lets the
|
|
266
|
-
// queue drive animations and schedule follow-up work without breaking React's
|
|
267
|
-
// rendering lifecycle.
|
|
268
|
-
var initialState = {
|
|
269
|
-
isFinished: true,
|
|
270
|
-
progress: 0,
|
|
271
|
-
sideEffect: noop
|
|
272
|
-
};
|
|
273
|
-
var useNProgress = function useNProgress() {
|
|
274
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
275
|
-
_ref$animationDuratio = _ref.animationDuration,
|
|
276
|
-
animationDuration = _ref$animationDuratio === void 0 ? 200 : _ref$animationDuratio,
|
|
277
|
-
_ref$incrementDuratio = _ref.incrementDuration,
|
|
278
|
-
incrementDuration = _ref$incrementDuratio === void 0 ? 200 : _ref$incrementDuratio,
|
|
279
|
-
_ref$isAnimating = _ref.isAnimating,
|
|
280
|
-
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
|
|
281
|
-
_ref$minimum = _ref.minimum,
|
|
282
|
-
minimum = _ref$minimum === void 0 ? 0.08 : _ref$minimum;
|
|
283
|
-
var _useGetSetState = useGetSetState(initialState),
|
|
284
|
-
_useGetSetState2 = _slicedToArray(_useGetSetState, 2),
|
|
285
|
-
get = _useGetSetState2[0],
|
|
286
|
-
setState = _useGetSetState2[1];
|
|
287
|
-
var queue = react.useRef(null);
|
|
288
|
-
var timeout = react.useRef(null);
|
|
289
|
-
useEffectOnce(function () {
|
|
290
|
-
queue.current = createQueue();
|
|
291
|
-
timeout.current = createTimeout();
|
|
292
|
-
});
|
|
293
|
-
var cleanup = react.useCallback(function () {
|
|
294
|
-
var _timeout$current, _queue$current;
|
|
295
|
-
(_timeout$current = timeout.current) === null || _timeout$current === void 0 || _timeout$current.cancel();
|
|
296
|
-
(_queue$current = queue.current) === null || _queue$current === void 0 || _queue$current.clear();
|
|
297
|
-
}, []);
|
|
298
|
-
var set = react.useCallback(function (n) {
|
|
299
|
-
var _queue$current4;
|
|
300
|
-
n = clamp(n, minimum, 1);
|
|
301
|
-
// Unlike the original nprogress `done()`, completion does not include a
|
|
302
|
-
// random progress jump before animating to 1. This keeps the primitive
|
|
303
|
-
// predictable; consumers can set a higher progress value before stopping
|
|
304
|
-
// the animation if they want that effect.
|
|
305
|
-
if (n === 1) {
|
|
306
|
-
var _queue$current2, _queue$current3;
|
|
307
|
-
cleanup();
|
|
308
|
-
(_queue$current2 = queue.current) === null || _queue$current2 === void 0 || _queue$current2.enqueue(function (next) {
|
|
309
|
-
setState({
|
|
310
|
-
progress: n,
|
|
311
|
-
sideEffect: function sideEffect() {
|
|
312
|
-
var _timeout$current2;
|
|
313
|
-
return (_timeout$current2 = timeout.current) === null || _timeout$current2 === void 0 ? void 0 : _timeout$current2.schedule(next, animationDuration);
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
(_queue$current3 = queue.current) === null || _queue$current3 === void 0 || _queue$current3.enqueue(function () {
|
|
318
|
-
setState({
|
|
319
|
-
isFinished: true,
|
|
320
|
-
sideEffect: cleanup
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
(_queue$current4 = queue.current) === null || _queue$current4 === void 0 || _queue$current4.enqueue(function (next) {
|
|
326
|
-
setState({
|
|
327
|
-
isFinished: false,
|
|
328
|
-
progress: n,
|
|
329
|
-
sideEffect: next
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
}, [animationDuration, cleanup, minimum, queue, setState, timeout]);
|
|
333
|
-
var trickle = react.useCallback(function () {
|
|
334
|
-
set(increment(get().progress));
|
|
335
|
-
}, [get, set]);
|
|
336
|
-
var start = react.useCallback(function () {
|
|
337
|
-
// The original nprogress calls set(0) - which clamps to `minimum` - before
|
|
338
|
-
// the first trickle. Here, the first trickle starts from increment(0) =
|
|
339
|
-
// 0.1, so the bar appears at max(0.1, minimum) rather than exactly
|
|
340
|
-
// `minimum`. The difference is negligible at the default minimum of 0.08.
|
|
341
|
-
var _work = function work() {
|
|
342
|
-
var _queue$current5;
|
|
343
|
-
trickle();
|
|
344
|
-
(_queue$current5 = queue.current) === null || _queue$current5 === void 0 || _queue$current5.enqueue(function (next) {
|
|
345
|
-
var _timeout$current3;
|
|
346
|
-
(_timeout$current3 = timeout.current) === null || _timeout$current3 === void 0 || _timeout$current3.schedule(function () {
|
|
347
|
-
_work();
|
|
348
|
-
next();
|
|
349
|
-
}, incrementDuration);
|
|
350
|
-
});
|
|
351
|
-
};
|
|
352
|
-
_work();
|
|
353
|
-
}, [incrementDuration, queue, timeout, trickle]);
|
|
354
|
-
var sideEffect = get().sideEffect;
|
|
355
|
-
useEffectOnce(function () {
|
|
356
|
-
if (isAnimating) {
|
|
357
|
-
start();
|
|
358
|
-
}
|
|
359
|
-
return cleanup;
|
|
360
|
-
});
|
|
361
|
-
useUpdateEffect(function () {
|
|
362
|
-
get().sideEffect();
|
|
363
|
-
}, [get, sideEffect]);
|
|
364
|
-
useUpdateEffect(function () {
|
|
365
|
-
if (!isAnimating) {
|
|
366
|
-
set(1);
|
|
367
|
-
} else {
|
|
368
|
-
setState(_objectSpread$1(_objectSpread$1({}, initialState), {}, {
|
|
369
|
-
sideEffect: start
|
|
370
|
-
}));
|
|
371
|
-
}
|
|
372
|
-
}, [isAnimating, set, setState, start]);
|
|
373
|
-
return {
|
|
374
|
-
animationDuration: animationDuration,
|
|
375
|
-
isFinished: get().isFinished,
|
|
376
|
-
progress: get().progress
|
|
377
|
-
};
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
var _excluded = ["children"];
|
|
381
|
-
var NProgress = function NProgress(_ref) {
|
|
382
|
-
var children = _ref.children,
|
|
383
|
-
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
384
|
-
var renderProps = useNProgress(restProps);
|
|
385
|
-
return children(renderProps);
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
function getDefaultExportFromCjs (x) {
|
|
389
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
var reactIs = {exports: {}};
|
|
393
|
-
|
|
394
|
-
var reactIs_development = {};
|
|
395
|
-
|
|
396
|
-
/** @license React v16.13.1
|
|
397
|
-
* react-is.development.js
|
|
398
|
-
*
|
|
399
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
400
|
-
*
|
|
401
|
-
* This source code is licensed under the MIT license found in the
|
|
402
|
-
* LICENSE file in the root directory of this source tree.
|
|
403
|
-
*/
|
|
404
|
-
|
|
405
|
-
var hasRequiredReactIs_development;
|
|
406
|
-
|
|
407
|
-
function requireReactIs_development () {
|
|
408
|
-
if (hasRequiredReactIs_development) return reactIs_development;
|
|
409
|
-
hasRequiredReactIs_development = 1;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
{
|
|
414
|
-
(function() {
|
|
415
|
-
|
|
416
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
417
|
-
// nor polyfill, then a plain number is used for performance.
|
|
418
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
419
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
420
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
421
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
422
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
423
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
424
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
425
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
426
|
-
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
427
|
-
|
|
428
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
429
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
430
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
431
|
-
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
432
|
-
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
433
|
-
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
434
|
-
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
435
|
-
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
436
|
-
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
437
|
-
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
438
|
-
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
439
|
-
|
|
440
|
-
function isValidElementType(type) {
|
|
441
|
-
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
442
|
-
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);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
function typeOf(object) {
|
|
446
|
-
if (typeof object === 'object' && object !== null) {
|
|
447
|
-
var $$typeof = object.$$typeof;
|
|
448
|
-
|
|
449
|
-
switch ($$typeof) {
|
|
450
|
-
case REACT_ELEMENT_TYPE:
|
|
451
|
-
var type = object.type;
|
|
452
|
-
|
|
453
|
-
switch (type) {
|
|
454
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
455
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
456
|
-
case REACT_FRAGMENT_TYPE:
|
|
457
|
-
case REACT_PROFILER_TYPE:
|
|
458
|
-
case REACT_STRICT_MODE_TYPE:
|
|
459
|
-
case REACT_SUSPENSE_TYPE:
|
|
460
|
-
return type;
|
|
461
|
-
|
|
462
|
-
default:
|
|
463
|
-
var $$typeofType = type && type.$$typeof;
|
|
464
|
-
|
|
465
|
-
switch ($$typeofType) {
|
|
466
|
-
case REACT_CONTEXT_TYPE:
|
|
467
|
-
case REACT_FORWARD_REF_TYPE:
|
|
468
|
-
case REACT_LAZY_TYPE:
|
|
469
|
-
case REACT_MEMO_TYPE:
|
|
470
|
-
case REACT_PROVIDER_TYPE:
|
|
471
|
-
return $$typeofType;
|
|
472
|
-
|
|
473
|
-
default:
|
|
474
|
-
return $$typeof;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
case REACT_PORTAL_TYPE:
|
|
480
|
-
return $$typeof;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
return undefined;
|
|
485
|
-
} // AsyncMode is deprecated along with isAsyncMode
|
|
486
|
-
|
|
487
|
-
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
488
|
-
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
489
|
-
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
490
|
-
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
491
|
-
var Element = REACT_ELEMENT_TYPE;
|
|
492
|
-
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
493
|
-
var Fragment = REACT_FRAGMENT_TYPE;
|
|
494
|
-
var Lazy = REACT_LAZY_TYPE;
|
|
495
|
-
var Memo = REACT_MEMO_TYPE;
|
|
496
|
-
var Portal = REACT_PORTAL_TYPE;
|
|
497
|
-
var Profiler = REACT_PROFILER_TYPE;
|
|
498
|
-
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
499
|
-
var Suspense = REACT_SUSPENSE_TYPE;
|
|
500
|
-
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
501
|
-
|
|
502
|
-
function isAsyncMode(object) {
|
|
503
|
-
{
|
|
504
|
-
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
505
|
-
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
506
|
-
|
|
507
|
-
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.');
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
512
|
-
}
|
|
513
|
-
function isConcurrentMode(object) {
|
|
514
|
-
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
515
|
-
}
|
|
516
|
-
function isContextConsumer(object) {
|
|
517
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
518
|
-
}
|
|
519
|
-
function isContextProvider(object) {
|
|
520
|
-
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
521
|
-
}
|
|
522
|
-
function isElement(object) {
|
|
523
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
524
|
-
}
|
|
525
|
-
function isForwardRef(object) {
|
|
526
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
527
|
-
}
|
|
528
|
-
function isFragment(object) {
|
|
529
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
530
|
-
}
|
|
531
|
-
function isLazy(object) {
|
|
532
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
533
|
-
}
|
|
534
|
-
function isMemo(object) {
|
|
535
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
536
|
-
}
|
|
537
|
-
function isPortal(object) {
|
|
538
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
539
|
-
}
|
|
540
|
-
function isProfiler(object) {
|
|
541
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
542
|
-
}
|
|
543
|
-
function isStrictMode(object) {
|
|
544
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
545
|
-
}
|
|
546
|
-
function isSuspense(object) {
|
|
547
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
reactIs_development.AsyncMode = AsyncMode;
|
|
551
|
-
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
552
|
-
reactIs_development.ContextConsumer = ContextConsumer;
|
|
553
|
-
reactIs_development.ContextProvider = ContextProvider;
|
|
554
|
-
reactIs_development.Element = Element;
|
|
555
|
-
reactIs_development.ForwardRef = ForwardRef;
|
|
556
|
-
reactIs_development.Fragment = Fragment;
|
|
557
|
-
reactIs_development.Lazy = Lazy;
|
|
558
|
-
reactIs_development.Memo = Memo;
|
|
559
|
-
reactIs_development.Portal = Portal;
|
|
560
|
-
reactIs_development.Profiler = Profiler;
|
|
561
|
-
reactIs_development.StrictMode = StrictMode;
|
|
562
|
-
reactIs_development.Suspense = Suspense;
|
|
563
|
-
reactIs_development.isAsyncMode = isAsyncMode;
|
|
564
|
-
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
565
|
-
reactIs_development.isContextConsumer = isContextConsumer;
|
|
566
|
-
reactIs_development.isContextProvider = isContextProvider;
|
|
567
|
-
reactIs_development.isElement = isElement;
|
|
568
|
-
reactIs_development.isForwardRef = isForwardRef;
|
|
569
|
-
reactIs_development.isFragment = isFragment;
|
|
570
|
-
reactIs_development.isLazy = isLazy;
|
|
571
|
-
reactIs_development.isMemo = isMemo;
|
|
572
|
-
reactIs_development.isPortal = isPortal;
|
|
573
|
-
reactIs_development.isProfiler = isProfiler;
|
|
574
|
-
reactIs_development.isStrictMode = isStrictMode;
|
|
575
|
-
reactIs_development.isSuspense = isSuspense;
|
|
576
|
-
reactIs_development.isValidElementType = isValidElementType;
|
|
577
|
-
reactIs_development.typeOf = typeOf;
|
|
578
|
-
})();
|
|
579
|
-
}
|
|
580
|
-
return reactIs_development;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
var hasRequiredReactIs;
|
|
584
|
-
|
|
585
|
-
function requireReactIs () {
|
|
586
|
-
if (hasRequiredReactIs) return reactIs.exports;
|
|
587
|
-
hasRequiredReactIs = 1;
|
|
588
|
-
|
|
589
|
-
{
|
|
590
|
-
reactIs.exports = requireReactIs_development();
|
|
591
|
-
}
|
|
592
|
-
return reactIs.exports;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
var hoistNonReactStatics_cjs;
|
|
596
|
-
var hasRequiredHoistNonReactStatics_cjs;
|
|
597
|
-
|
|
598
|
-
function requireHoistNonReactStatics_cjs () {
|
|
599
|
-
if (hasRequiredHoistNonReactStatics_cjs) return hoistNonReactStatics_cjs;
|
|
600
|
-
hasRequiredHoistNonReactStatics_cjs = 1;
|
|
601
|
-
|
|
602
|
-
var reactIs = requireReactIs();
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* Copyright 2015, Yahoo! Inc.
|
|
606
|
-
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
607
|
-
*/
|
|
608
|
-
var REACT_STATICS = {
|
|
609
|
-
childContextTypes: true,
|
|
610
|
-
contextType: true,
|
|
611
|
-
contextTypes: true,
|
|
612
|
-
defaultProps: true,
|
|
613
|
-
displayName: true,
|
|
614
|
-
getDefaultProps: true,
|
|
615
|
-
getDerivedStateFromError: true,
|
|
616
|
-
getDerivedStateFromProps: true,
|
|
617
|
-
mixins: true,
|
|
618
|
-
propTypes: true,
|
|
619
|
-
type: true
|
|
620
|
-
};
|
|
621
|
-
var KNOWN_STATICS = {
|
|
622
|
-
name: true,
|
|
623
|
-
length: true,
|
|
624
|
-
prototype: true,
|
|
625
|
-
caller: true,
|
|
626
|
-
callee: true,
|
|
627
|
-
arguments: true,
|
|
628
|
-
arity: true
|
|
629
|
-
};
|
|
630
|
-
var FORWARD_REF_STATICS = {
|
|
631
|
-
'$$typeof': true,
|
|
632
|
-
render: true,
|
|
633
|
-
defaultProps: true,
|
|
634
|
-
displayName: true,
|
|
635
|
-
propTypes: true
|
|
636
|
-
};
|
|
637
|
-
var MEMO_STATICS = {
|
|
638
|
-
'$$typeof': true,
|
|
639
|
-
compare: true,
|
|
640
|
-
defaultProps: true,
|
|
641
|
-
displayName: true,
|
|
642
|
-
propTypes: true,
|
|
643
|
-
type: true
|
|
644
|
-
};
|
|
645
|
-
var TYPE_STATICS = {};
|
|
646
|
-
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
647
|
-
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
648
|
-
|
|
649
|
-
function getStatics(component) {
|
|
650
|
-
// React v16.11 and below
|
|
651
|
-
if (reactIs.isMemo(component)) {
|
|
652
|
-
return MEMO_STATICS;
|
|
653
|
-
} // React v16.12 and above
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
var defineProperty = Object.defineProperty;
|
|
660
|
-
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
661
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
662
|
-
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
663
|
-
var getPrototypeOf = Object.getPrototypeOf;
|
|
664
|
-
var objectPrototype = Object.prototype;
|
|
665
|
-
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
666
|
-
if (typeof sourceComponent !== 'string') {
|
|
667
|
-
// don't hoist over string (html) components
|
|
668
|
-
if (objectPrototype) {
|
|
669
|
-
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
670
|
-
|
|
671
|
-
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
672
|
-
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
var keys = getOwnPropertyNames(sourceComponent);
|
|
677
|
-
|
|
678
|
-
if (getOwnPropertySymbols) {
|
|
679
|
-
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
var targetStatics = getStatics(targetComponent);
|
|
683
|
-
var sourceStatics = getStatics(sourceComponent);
|
|
684
|
-
|
|
685
|
-
for (var i = 0; i < keys.length; ++i) {
|
|
686
|
-
var key = keys[i];
|
|
687
|
-
|
|
688
|
-
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
689
|
-
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
690
|
-
|
|
691
|
-
try {
|
|
692
|
-
// Avoid failures from read-only properties
|
|
693
|
-
defineProperty(targetComponent, key, descriptor);
|
|
694
|
-
} catch (e) {}
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
return targetComponent;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
hoistNonReactStatics_cjs = hoistNonReactStatics;
|
|
703
|
-
return hoistNonReactStatics_cjs;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
var hoistNonReactStatics_cjsExports = requireHoistNonReactStatics_cjs();
|
|
707
|
-
var hoistNonReactStatics = /*@__PURE__*/getDefaultExportFromCjs(hoistNonReactStatics_cjsExports);
|
|
708
|
-
|
|
709
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
710
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
711
|
-
function withNProgress(BaseComponent) {
|
|
712
|
-
var WithNProgress = function WithNProgress(props) {
|
|
713
|
-
var hookProps = useNProgress(props);
|
|
714
|
-
return jsxRuntime.jsx(BaseComponent, _objectSpread(_objectSpread({}, props), hookProps));
|
|
715
|
-
};
|
|
716
|
-
hoistNonReactStatics(WithNProgress, BaseComponent);
|
|
717
|
-
return WithNProgress;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
exports.NProgress = NProgress;
|
|
721
|
-
exports.useNProgress = useNProgress;
|
|
722
|
-
exports.withNProgress = withNProgress;
|
|
723
|
-
|
|
724
|
-
}));
|
|
725
|
-
//# sourceMappingURL=react-nprogress.umd.development.js.map
|