@tanem/react-nprogress 6.0.4 → 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.
Files changed (41) hide show
  1. package/README.md +78 -116
  2. package/dist/react-nprogress.cjs +119 -0
  3. package/dist/react-nprogress.cjs.map +1 -0
  4. package/dist/react-nprogress.d.cts +25 -0
  5. package/dist/react-nprogress.d.cts.map +1 -0
  6. package/dist/react-nprogress.d.mts +25 -0
  7. package/dist/react-nprogress.d.mts.map +1 -0
  8. package/dist/react-nprogress.mjs +117 -0
  9. package/dist/react-nprogress.mjs.map +1 -0
  10. package/package.json +50 -36
  11. package/src/NProgress.tsx +13 -0
  12. package/src/clamp.ts +5 -0
  13. package/src/createTimeout.ts +35 -0
  14. package/src/env.d.ts +0 -0
  15. package/src/increment.ts +17 -0
  16. package/src/index.tsx +3 -0
  17. package/src/types.ts +12 -0
  18. package/src/useNProgress.tsx +121 -0
  19. package/dist/NProgress.d.ts +0 -8
  20. package/dist/clamp.d.ts +0 -1
  21. package/dist/createQueue.d.ts +0 -7
  22. package/dist/createTimeout.d.ts +0 -4
  23. package/dist/increment.d.ts +0 -1
  24. package/dist/index.d.ts +0 -3
  25. package/dist/index.js +0 -7
  26. package/dist/react-nprogress.cjs.development.js +0 -299
  27. package/dist/react-nprogress.cjs.development.js.map +0 -1
  28. package/dist/react-nprogress.cjs.production.js +0 -2
  29. package/dist/react-nprogress.cjs.production.js.map +0 -1
  30. package/dist/react-nprogress.esm.js +0 -295
  31. package/dist/react-nprogress.esm.js.map +0 -1
  32. package/dist/react-nprogress.umd.development.js +0 -727
  33. package/dist/react-nprogress.umd.development.js.map +0 -1
  34. package/dist/react-nprogress.umd.production.js +0 -2
  35. package/dist/react-nprogress.umd.production.js.map +0 -1
  36. package/dist/types.d.ts +0 -6
  37. package/dist/useEffectOnce.d.ts +0 -2
  38. package/dist/useGetSetState.d.ts +0 -1
  39. package/dist/useNProgress.d.ts +0 -6
  40. package/dist/useUpdateEffect.d.ts +0 -2
  41. package/dist/withNProgress.d.ts +0 -7
@@ -1,727 +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 useUpdate = function useUpdate() {
206
- var _useReducer = react.useReducer(function (num) {
207
- return (num + 1) % 1000000;
208
- }, 0),
209
- _useReducer2 = _slicedToArray(_useReducer, 2),
210
- update = _useReducer2[1];
211
- return update;
212
- };
213
- var useGetSetState = function useGetSetState() {
214
- var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
215
- var update = useUpdate();
216
- var stateRef = react.useRef(_objectSpread$2({}, initialState));
217
- var get = react.useCallback(function () {
218
- return stateRef.current;
219
- }, []);
220
- var set = react.useCallback(function (patch) {
221
- if (!patch) {
222
- return;
223
- }
224
- Object.assign(stateRef.current, patch);
225
- update();
226
- // eslint-disable-next-line react-hooks/exhaustive-deps
227
- }, []);
228
- return [get, set];
229
- };
230
-
231
- // Hat-tip:
232
- // https://github.com/streamich/react-use/blob/master/src/useUpdateEffect.ts.
233
- //
234
- // `react-use` appears to be unmaintained, so moving the required code into
235
- // this project for now.
236
- var useFirstMountState = function useFirstMountState() {
237
- var isFirstRef = react.useRef(true);
238
- // Read and mutated directly during render (rather than in an effect) so
239
- // the first-mount result is available synchronously on the very first
240
- // render, before any effect has run.
241
- /* eslint-disable react-hooks/refs -- intentional, see comment above */
242
- if (isFirstRef.current) {
243
- isFirstRef.current = false;
244
- return true;
245
- }
246
- return isFirstRef.current;
247
- /* eslint-enable react-hooks/refs */
248
- };
249
- var useUpdateEffect = function useUpdateEffect(effect, deps) {
250
- var isFirstMount = useFirstMountState();
251
- react.useEffect(function () {
252
- if (!isFirstMount) {
253
- return effect();
254
- }
255
- // eslint-disable-next-line react-hooks/exhaustive-deps
256
- }, deps);
257
- };
258
-
259
- 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; }
260
- 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; }
261
- /* istanbul ignore next */
262
- var noop = function noop() {
263
- return undefined;
264
- };
265
- // State includes a `sideEffect` callback that bridges imperative queue
266
- // operations into React's declarative model. Each `setState` stores a callback;
267
- // `useUpdateEffect` fires it after React commits the update. This lets the
268
- // queue drive animations and schedule follow-up work without breaking React's
269
- // rendering lifecycle.
270
- var initialState = {
271
- isFinished: true,
272
- progress: 0,
273
- sideEffect: noop
274
- };
275
- var useNProgress = function useNProgress() {
276
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
277
- _ref$animationDuratio = _ref.animationDuration,
278
- animationDuration = _ref$animationDuratio === void 0 ? 200 : _ref$animationDuratio,
279
- _ref$incrementDuratio = _ref.incrementDuration,
280
- incrementDuration = _ref$incrementDuratio === void 0 ? 200 : _ref$incrementDuratio,
281
- _ref$isAnimating = _ref.isAnimating,
282
- isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
283
- _ref$minimum = _ref.minimum,
284
- minimum = _ref$minimum === void 0 ? 0.08 : _ref$minimum;
285
- var _useGetSetState = useGetSetState(initialState),
286
- _useGetSetState2 = _slicedToArray(_useGetSetState, 2),
287
- get = _useGetSetState2[0],
288
- setState = _useGetSetState2[1];
289
- var queueRef = react.useRef(null);
290
- var timeoutRef = react.useRef(null);
291
- useEffectOnce(function () {
292
- queueRef.current = createQueue();
293
- timeoutRef.current = createTimeout();
294
- });
295
- var cleanup = react.useCallback(function () {
296
- var _timeoutRef$current, _queueRef$current;
297
- (_timeoutRef$current = timeoutRef.current) === null || _timeoutRef$current === void 0 || _timeoutRef$current.cancel();
298
- (_queueRef$current = queueRef.current) === null || _queueRef$current === void 0 || _queueRef$current.clear();
299
- }, []);
300
- var set = react.useCallback(function (n) {
301
- var _queueRef$current4;
302
- n = clamp(n, minimum, 1);
303
- // Unlike the original nprogress `done()`, completion does not include a
304
- // random progress jump before animating to 1. This keeps the primitive
305
- // predictable; consumers can set a higher progress value before stopping
306
- // the animation if they want that effect.
307
- if (n === 1) {
308
- var _queueRef$current2, _queueRef$current3;
309
- cleanup();
310
- (_queueRef$current2 = queueRef.current) === null || _queueRef$current2 === void 0 || _queueRef$current2.enqueue(function (next) {
311
- setState({
312
- progress: n,
313
- sideEffect: function sideEffect() {
314
- var _timeoutRef$current2;
315
- return (_timeoutRef$current2 = timeoutRef.current) === null || _timeoutRef$current2 === void 0 ? void 0 : _timeoutRef$current2.schedule(next, animationDuration);
316
- }
317
- });
318
- });
319
- (_queueRef$current3 = queueRef.current) === null || _queueRef$current3 === void 0 || _queueRef$current3.enqueue(function () {
320
- setState({
321
- isFinished: true,
322
- sideEffect: cleanup
323
- });
324
- });
325
- return;
326
- }
327
- (_queueRef$current4 = queueRef.current) === null || _queueRef$current4 === void 0 || _queueRef$current4.enqueue(function (next) {
328
- setState({
329
- isFinished: false,
330
- progress: n,
331
- sideEffect: next
332
- });
333
- });
334
- }, [animationDuration, cleanup, minimum, queueRef, setState, timeoutRef]);
335
- var trickle = react.useCallback(function () {
336
- set(increment(get().progress));
337
- }, [get, set]);
338
- var start = react.useCallback(function () {
339
- // The original nprogress calls set(0) - which clamps to `minimum` - before
340
- // the first trickle. Here, the first trickle starts from increment(0) =
341
- // 0.1, so the bar appears at max(0.1, minimum) rather than exactly
342
- // `minimum`. The difference is negligible at the default minimum of 0.08.
343
- var _work = function work() {
344
- var _queueRef$current5;
345
- trickle();
346
- (_queueRef$current5 = queueRef.current) === null || _queueRef$current5 === void 0 || _queueRef$current5.enqueue(function (next) {
347
- var _timeoutRef$current3;
348
- (_timeoutRef$current3 = timeoutRef.current) === null || _timeoutRef$current3 === void 0 || _timeoutRef$current3.schedule(function () {
349
- _work();
350
- next();
351
- }, incrementDuration);
352
- });
353
- };
354
- _work();
355
- }, [incrementDuration, queueRef, timeoutRef, trickle]);
356
- var sideEffect = get().sideEffect;
357
- useEffectOnce(function () {
358
- if (isAnimating) {
359
- start();
360
- }
361
- return cleanup;
362
- });
363
- useUpdateEffect(function () {
364
- get().sideEffect();
365
- }, [get, sideEffect]);
366
- useUpdateEffect(function () {
367
- if (!isAnimating) {
368
- set(1);
369
- } else {
370
- setState(_objectSpread$1(_objectSpread$1({}, initialState), {}, {
371
- sideEffect: start
372
- }));
373
- }
374
- }, [isAnimating, set, setState, start]);
375
- return {
376
- animationDuration: animationDuration,
377
- isFinished: get().isFinished,
378
- progress: get().progress
379
- };
380
- };
381
-
382
- var _excluded = ["children"];
383
- var NProgress = function NProgress(_ref) {
384
- var children = _ref.children,
385
- restProps = _objectWithoutProperties(_ref, _excluded);
386
- var renderProps = useNProgress(restProps);
387
- return children(renderProps);
388
- };
389
-
390
- function getDefaultExportFromCjs (x) {
391
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
392
- }
393
-
394
- var reactIs = {exports: {}};
395
-
396
- var reactIs_development = {};
397
-
398
- /** @license React v16.13.1
399
- * react-is.development.js
400
- *
401
- * Copyright (c) Facebook, Inc. and its affiliates.
402
- *
403
- * This source code is licensed under the MIT license found in the
404
- * LICENSE file in the root directory of this source tree.
405
- */
406
-
407
- var hasRequiredReactIs_development;
408
-
409
- function requireReactIs_development () {
410
- if (hasRequiredReactIs_development) return reactIs_development;
411
- hasRequiredReactIs_development = 1;
412
-
413
-
414
-
415
- {
416
- (function() {
417
-
418
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
419
- // nor polyfill, then a plain number is used for performance.
420
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
421
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
422
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
423
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
424
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
425
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
426
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
427
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
428
- // (unstable) APIs that have been removed. Can we remove the symbols?
429
-
430
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
431
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
432
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
433
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
434
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
435
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
436
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
437
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
438
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
439
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
440
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
441
-
442
- function isValidElementType(type) {
443
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
444
- 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);
445
- }
446
-
447
- function typeOf(object) {
448
- if (typeof object === 'object' && object !== null) {
449
- var $$typeof = object.$$typeof;
450
-
451
- switch ($$typeof) {
452
- case REACT_ELEMENT_TYPE:
453
- var type = object.type;
454
-
455
- switch (type) {
456
- case REACT_ASYNC_MODE_TYPE:
457
- case REACT_CONCURRENT_MODE_TYPE:
458
- case REACT_FRAGMENT_TYPE:
459
- case REACT_PROFILER_TYPE:
460
- case REACT_STRICT_MODE_TYPE:
461
- case REACT_SUSPENSE_TYPE:
462
- return type;
463
-
464
- default:
465
- var $$typeofType = type && type.$$typeof;
466
-
467
- switch ($$typeofType) {
468
- case REACT_CONTEXT_TYPE:
469
- case REACT_FORWARD_REF_TYPE:
470
- case REACT_LAZY_TYPE:
471
- case REACT_MEMO_TYPE:
472
- case REACT_PROVIDER_TYPE:
473
- return $$typeofType;
474
-
475
- default:
476
- return $$typeof;
477
- }
478
-
479
- }
480
-
481
- case REACT_PORTAL_TYPE:
482
- return $$typeof;
483
- }
484
- }
485
-
486
- return undefined;
487
- } // AsyncMode is deprecated along with isAsyncMode
488
-
489
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
490
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
491
- var ContextConsumer = REACT_CONTEXT_TYPE;
492
- var ContextProvider = REACT_PROVIDER_TYPE;
493
- var Element = REACT_ELEMENT_TYPE;
494
- var ForwardRef = REACT_FORWARD_REF_TYPE;
495
- var Fragment = REACT_FRAGMENT_TYPE;
496
- var Lazy = REACT_LAZY_TYPE;
497
- var Memo = REACT_MEMO_TYPE;
498
- var Portal = REACT_PORTAL_TYPE;
499
- var Profiler = REACT_PROFILER_TYPE;
500
- var StrictMode = REACT_STRICT_MODE_TYPE;
501
- var Suspense = REACT_SUSPENSE_TYPE;
502
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
503
-
504
- function isAsyncMode(object) {
505
- {
506
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
507
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
508
-
509
- 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.');
510
- }
511
- }
512
-
513
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
514
- }
515
- function isConcurrentMode(object) {
516
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
517
- }
518
- function isContextConsumer(object) {
519
- return typeOf(object) === REACT_CONTEXT_TYPE;
520
- }
521
- function isContextProvider(object) {
522
- return typeOf(object) === REACT_PROVIDER_TYPE;
523
- }
524
- function isElement(object) {
525
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
526
- }
527
- function isForwardRef(object) {
528
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
529
- }
530
- function isFragment(object) {
531
- return typeOf(object) === REACT_FRAGMENT_TYPE;
532
- }
533
- function isLazy(object) {
534
- return typeOf(object) === REACT_LAZY_TYPE;
535
- }
536
- function isMemo(object) {
537
- return typeOf(object) === REACT_MEMO_TYPE;
538
- }
539
- function isPortal(object) {
540
- return typeOf(object) === REACT_PORTAL_TYPE;
541
- }
542
- function isProfiler(object) {
543
- return typeOf(object) === REACT_PROFILER_TYPE;
544
- }
545
- function isStrictMode(object) {
546
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
547
- }
548
- function isSuspense(object) {
549
- return typeOf(object) === REACT_SUSPENSE_TYPE;
550
- }
551
-
552
- reactIs_development.AsyncMode = AsyncMode;
553
- reactIs_development.ConcurrentMode = ConcurrentMode;
554
- reactIs_development.ContextConsumer = ContextConsumer;
555
- reactIs_development.ContextProvider = ContextProvider;
556
- reactIs_development.Element = Element;
557
- reactIs_development.ForwardRef = ForwardRef;
558
- reactIs_development.Fragment = Fragment;
559
- reactIs_development.Lazy = Lazy;
560
- reactIs_development.Memo = Memo;
561
- reactIs_development.Portal = Portal;
562
- reactIs_development.Profiler = Profiler;
563
- reactIs_development.StrictMode = StrictMode;
564
- reactIs_development.Suspense = Suspense;
565
- reactIs_development.isAsyncMode = isAsyncMode;
566
- reactIs_development.isConcurrentMode = isConcurrentMode;
567
- reactIs_development.isContextConsumer = isContextConsumer;
568
- reactIs_development.isContextProvider = isContextProvider;
569
- reactIs_development.isElement = isElement;
570
- reactIs_development.isForwardRef = isForwardRef;
571
- reactIs_development.isFragment = isFragment;
572
- reactIs_development.isLazy = isLazy;
573
- reactIs_development.isMemo = isMemo;
574
- reactIs_development.isPortal = isPortal;
575
- reactIs_development.isProfiler = isProfiler;
576
- reactIs_development.isStrictMode = isStrictMode;
577
- reactIs_development.isSuspense = isSuspense;
578
- reactIs_development.isValidElementType = isValidElementType;
579
- reactIs_development.typeOf = typeOf;
580
- })();
581
- }
582
- return reactIs_development;
583
- }
584
-
585
- var hasRequiredReactIs;
586
-
587
- function requireReactIs () {
588
- if (hasRequiredReactIs) return reactIs.exports;
589
- hasRequiredReactIs = 1;
590
-
591
- {
592
- reactIs.exports = requireReactIs_development();
593
- }
594
- return reactIs.exports;
595
- }
596
-
597
- var hoistNonReactStatics_cjs;
598
- var hasRequiredHoistNonReactStatics_cjs;
599
-
600
- function requireHoistNonReactStatics_cjs () {
601
- if (hasRequiredHoistNonReactStatics_cjs) return hoistNonReactStatics_cjs;
602
- hasRequiredHoistNonReactStatics_cjs = 1;
603
-
604
- var reactIs = requireReactIs();
605
-
606
- /**
607
- * Copyright 2015, Yahoo! Inc.
608
- * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
609
- */
610
- var REACT_STATICS = {
611
- childContextTypes: true,
612
- contextType: true,
613
- contextTypes: true,
614
- defaultProps: true,
615
- displayName: true,
616
- getDefaultProps: true,
617
- getDerivedStateFromError: true,
618
- getDerivedStateFromProps: true,
619
- mixins: true,
620
- propTypes: true,
621
- type: true
622
- };
623
- var KNOWN_STATICS = {
624
- name: true,
625
- length: true,
626
- prototype: true,
627
- caller: true,
628
- callee: true,
629
- arguments: true,
630
- arity: true
631
- };
632
- var FORWARD_REF_STATICS = {
633
- '$$typeof': true,
634
- render: true,
635
- defaultProps: true,
636
- displayName: true,
637
- propTypes: true
638
- };
639
- var MEMO_STATICS = {
640
- '$$typeof': true,
641
- compare: true,
642
- defaultProps: true,
643
- displayName: true,
644
- propTypes: true,
645
- type: true
646
- };
647
- var TYPE_STATICS = {};
648
- TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
649
- TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
650
-
651
- function getStatics(component) {
652
- // React v16.11 and below
653
- if (reactIs.isMemo(component)) {
654
- return MEMO_STATICS;
655
- } // React v16.12 and above
656
-
657
-
658
- return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
659
- }
660
-
661
- var defineProperty = Object.defineProperty;
662
- var getOwnPropertyNames = Object.getOwnPropertyNames;
663
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
664
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
665
- var getPrototypeOf = Object.getPrototypeOf;
666
- var objectPrototype = Object.prototype;
667
- function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
668
- if (typeof sourceComponent !== 'string') {
669
- // don't hoist over string (html) components
670
- if (objectPrototype) {
671
- var inheritedComponent = getPrototypeOf(sourceComponent);
672
-
673
- if (inheritedComponent && inheritedComponent !== objectPrototype) {
674
- hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
675
- }
676
- }
677
-
678
- var keys = getOwnPropertyNames(sourceComponent);
679
-
680
- if (getOwnPropertySymbols) {
681
- keys = keys.concat(getOwnPropertySymbols(sourceComponent));
682
- }
683
-
684
- var targetStatics = getStatics(targetComponent);
685
- var sourceStatics = getStatics(sourceComponent);
686
-
687
- for (var i = 0; i < keys.length; ++i) {
688
- var key = keys[i];
689
-
690
- if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
691
- var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
692
-
693
- try {
694
- // Avoid failures from read-only properties
695
- defineProperty(targetComponent, key, descriptor);
696
- } catch (e) {}
697
- }
698
- }
699
- }
700
-
701
- return targetComponent;
702
- }
703
-
704
- hoistNonReactStatics_cjs = hoistNonReactStatics;
705
- return hoistNonReactStatics_cjs;
706
- }
707
-
708
- var hoistNonReactStatics_cjsExports = requireHoistNonReactStatics_cjs();
709
- var hoistNonReactStatics = /*@__PURE__*/getDefaultExportFromCjs(hoistNonReactStatics_cjsExports);
710
-
711
- 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; }
712
- 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; }
713
- function withNProgress(BaseComponent) {
714
- var WithNProgress = function WithNProgress(props) {
715
- var hookProps = useNProgress(props);
716
- return jsxRuntime.jsx(BaseComponent, _objectSpread(_objectSpread({}, props), hookProps));
717
- };
718
- hoistNonReactStatics(WithNProgress, BaseComponent);
719
- return WithNProgress;
720
- }
721
-
722
- exports.NProgress = NProgress;
723
- exports.useNProgress = useNProgress;
724
- exports.withNProgress = withNProgress;
725
-
726
- }));
727
- //# sourceMappingURL=react-nprogress.umd.development.js.map