react 16.8.3 → 16.9.0-alpha.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/build-info.json +5 -5
- package/cjs/react.development.js +140 -45
- package/cjs/react.production.min.js +16 -17
- package/package.json +2 -2
- package/umd/react.development.js +563 -490
- package/umd/react.production.min.js +25 -26
- package/umd/react.profiling.min.js +29 -30
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"branch": "pull/
|
|
3
|
-
"buildNumber": "
|
|
4
|
-
"checksum": "
|
|
5
|
-
"commit": "
|
|
2
|
+
"branch": "pull/15307",
|
|
3
|
+
"buildNumber": "14231",
|
|
4
|
+
"checksum": "0f531f7",
|
|
5
|
+
"commit": "c35e37aab",
|
|
6
6
|
"environment": "ci",
|
|
7
|
-
"reactVersion": "16.8.
|
|
7
|
+
"reactVersion": "16.8.6-canary-c35e37aab"
|
|
8
8
|
}
|
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.9.0-alpha.0
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -20,7 +20,7 @@ var checkPropTypes = require('prop-types/checkPropTypes');
|
|
|
20
20
|
|
|
21
21
|
// TODO: this is special because it gets imported during build.
|
|
22
22
|
|
|
23
|
-
var ReactVersion = '16.
|
|
23
|
+
var ReactVersion = '16.9.0-alpha.0';
|
|
24
24
|
|
|
25
25
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
26
26
|
// nor polyfill, then a plain number is used for performance.
|
|
@@ -39,6 +39,11 @@ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead
|
|
|
39
39
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
40
40
|
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
41
41
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
42
|
+
var REACT_EVENT_COMPONENT_TYPE = hasSymbol ? Symbol.for('react.event_component') : 0xead5;
|
|
43
|
+
var REACT_EVENT_TARGET_TYPE = hasSymbol ? Symbol.for('react.event_target') : 0xead6;
|
|
44
|
+
|
|
45
|
+
// React event targets
|
|
46
|
+
var REACT_EVENT_TARGET_TOUCH_HIT = hasSymbol ? Symbol.for('react.event_target.touch_hit') : 0xead7;
|
|
42
47
|
|
|
43
48
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
44
49
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
@@ -54,6 +59,20 @@ function getIteratorFn(maybeIterable) {
|
|
|
54
59
|
return null;
|
|
55
60
|
}
|
|
56
61
|
|
|
62
|
+
// Do not require this module directly! Use a normal error constructor with
|
|
63
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
64
|
+
// build, and in production they will be minified.
|
|
65
|
+
|
|
66
|
+
// Do not require this module directly! Use a normal error constructor with
|
|
67
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
68
|
+
// build, and in production they will be minified.
|
|
69
|
+
|
|
70
|
+
function ReactError(message) {
|
|
71
|
+
var error = new Error(message);
|
|
72
|
+
error.name = 'Invariant Violation';
|
|
73
|
+
return error;
|
|
74
|
+
}
|
|
75
|
+
|
|
57
76
|
/**
|
|
58
77
|
* Use invariant() to assert state which your program assumes to be true.
|
|
59
78
|
*
|
|
@@ -65,40 +84,6 @@ function getIteratorFn(maybeIterable) {
|
|
|
65
84
|
* will remain to ensure logic does not differ in production.
|
|
66
85
|
*/
|
|
67
86
|
|
|
68
|
-
var validateFormat = function () {};
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
validateFormat = function (format) {
|
|
72
|
-
if (format === undefined) {
|
|
73
|
-
throw new Error('invariant requires an error message argument');
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
|
79
|
-
validateFormat(format);
|
|
80
|
-
|
|
81
|
-
if (!condition) {
|
|
82
|
-
var error = void 0;
|
|
83
|
-
if (format === undefined) {
|
|
84
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
85
|
-
} else {
|
|
86
|
-
var args = [a, b, c, d, e, f];
|
|
87
|
-
var argIndex = 0;
|
|
88
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
89
|
-
return args[argIndex++];
|
|
90
|
-
}));
|
|
91
|
-
error.name = 'Invariant Violation';
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Relying on the `invariant()` implementation lets us
|
|
100
|
-
// preserve the format and params in the www builds.
|
|
101
|
-
|
|
102
87
|
/**
|
|
103
88
|
* Forked from fbjs/warning:
|
|
104
89
|
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
@@ -331,7 +316,13 @@ Component.prototype.isReactComponent = {};
|
|
|
331
316
|
* @protected
|
|
332
317
|
*/
|
|
333
318
|
Component.prototype.setState = function (partialState, callback) {
|
|
334
|
-
|
|
319
|
+
(function () {
|
|
320
|
+
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
321
|
+
{
|
|
322
|
+
throw ReactError('setState(...): takes an object of state variables to update or a function which returns an object of state variables.');
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
})();
|
|
335
326
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
336
327
|
};
|
|
337
328
|
|
|
@@ -521,6 +512,27 @@ function getComponentName(type) {
|
|
|
521
512
|
if (resolvedThenable) {
|
|
522
513
|
return getComponentName(resolvedThenable);
|
|
523
514
|
}
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
case REACT_EVENT_COMPONENT_TYPE:
|
|
518
|
+
{
|
|
519
|
+
var eventComponent = type;
|
|
520
|
+
var displayName = eventComponent.displayName;
|
|
521
|
+
if (displayName !== undefined) {
|
|
522
|
+
return displayName;
|
|
523
|
+
}
|
|
524
|
+
break;
|
|
525
|
+
}
|
|
526
|
+
case REACT_EVENT_TARGET_TYPE:
|
|
527
|
+
{
|
|
528
|
+
var eventTarget = type;
|
|
529
|
+
if (eventTarget.type === REACT_EVENT_TARGET_TOUCH_HIT) {
|
|
530
|
+
return 'TouchHitTarget';
|
|
531
|
+
}
|
|
532
|
+
var _displayName = eventTarget.displayName;
|
|
533
|
+
if (_displayName !== undefined) {
|
|
534
|
+
return _displayName;
|
|
535
|
+
}
|
|
524
536
|
}
|
|
525
537
|
}
|
|
526
538
|
}
|
|
@@ -564,6 +576,8 @@ function setCurrentlyValidatingElement(element) {
|
|
|
564
576
|
var ReactSharedInternals = {
|
|
565
577
|
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
566
578
|
ReactCurrentOwner: ReactCurrentOwner,
|
|
579
|
+
// used by act()
|
|
580
|
+
ReactShouldWarnActingUpdates: { current: false },
|
|
567
581
|
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
568
582
|
assign: _assign
|
|
569
583
|
};
|
|
@@ -837,7 +851,13 @@ function cloneAndReplaceKey(oldElement, newKey) {
|
|
|
837
851
|
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
838
852
|
*/
|
|
839
853
|
function cloneElement(element, config, children) {
|
|
840
|
-
|
|
854
|
+
(function () {
|
|
855
|
+
if (!!(element === null || element === undefined)) {
|
|
856
|
+
{
|
|
857
|
+
throw ReactError('React.cloneElement(...): The argument must be a React element, but you passed ' + element + '.');
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
})();
|
|
841
861
|
|
|
842
862
|
var propName = void 0;
|
|
843
863
|
|
|
@@ -1057,7 +1077,13 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1057
1077
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1058
1078
|
}
|
|
1059
1079
|
var childrenString = '' + children;
|
|
1060
|
-
|
|
1080
|
+
(function () {
|
|
1081
|
+
{
|
|
1082
|
+
{
|
|
1083
|
+
throw ReactError('Objects are not valid as a React child (found: ' + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ').' + addendum);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
})();
|
|
1061
1087
|
}
|
|
1062
1088
|
}
|
|
1063
1089
|
|
|
@@ -1233,7 +1259,13 @@ function toArray(children) {
|
|
|
1233
1259
|
* structure.
|
|
1234
1260
|
*/
|
|
1235
1261
|
function onlyChild(children) {
|
|
1236
|
-
|
|
1262
|
+
(function () {
|
|
1263
|
+
if (!isValidElement(children)) {
|
|
1264
|
+
{
|
|
1265
|
+
throw ReactError('React.Children.only expected to receive a single React element child.');
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
})();
|
|
1237
1269
|
return children;
|
|
1238
1270
|
}
|
|
1239
1271
|
|
|
@@ -1415,7 +1447,7 @@ function forwardRef(render) {
|
|
|
1415
1447
|
function isValidElementType(type) {
|
|
1416
1448
|
return typeof type === 'string' || typeof type === 'function' ||
|
|
1417
1449
|
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1418
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_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);
|
|
1450
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_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_EVENT_COMPONENT_TYPE || type.$$typeof === REACT_EVENT_TARGET_TYPE);
|
|
1419
1451
|
}
|
|
1420
1452
|
|
|
1421
1453
|
function memo(type, compare) {
|
|
@@ -1433,7 +1465,13 @@ function memo(type, compare) {
|
|
|
1433
1465
|
|
|
1434
1466
|
function resolveDispatcher() {
|
|
1435
1467
|
var dispatcher = ReactCurrentDispatcher.current;
|
|
1436
|
-
|
|
1468
|
+
(function () {
|
|
1469
|
+
if (!(dispatcher !== null)) {
|
|
1470
|
+
{
|
|
1471
|
+
throw ReactError('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.');
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
})();
|
|
1437
1475
|
return dispatcher;
|
|
1438
1476
|
}
|
|
1439
1477
|
|
|
@@ -1787,6 +1825,44 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
1787
1825
|
return newElement;
|
|
1788
1826
|
}
|
|
1789
1827
|
|
|
1828
|
+
function noop() {}
|
|
1829
|
+
|
|
1830
|
+
var error = noop;
|
|
1831
|
+
var warn = noop;
|
|
1832
|
+
{
|
|
1833
|
+
var ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1834
|
+
|
|
1835
|
+
error = function () {
|
|
1836
|
+
var stack = ReactDebugCurrentFrame$2.getStackAddendum();
|
|
1837
|
+
if (stack !== '') {
|
|
1838
|
+
var length = arguments.length;
|
|
1839
|
+
var args = new Array(length + 1);
|
|
1840
|
+
for (var i = 0; i < length; i++) {
|
|
1841
|
+
args[i] = arguments[i];
|
|
1842
|
+
}
|
|
1843
|
+
args[length] = stack;
|
|
1844
|
+
console.error.apply(console, args);
|
|
1845
|
+
} else {
|
|
1846
|
+
console.error.apply(console, arguments);
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
|
|
1850
|
+
warn = function () {
|
|
1851
|
+
var stack = ReactDebugCurrentFrame$2.getStackAddendum();
|
|
1852
|
+
if (stack !== '') {
|
|
1853
|
+
var length = arguments.length;
|
|
1854
|
+
var args = new Array(length + 1);
|
|
1855
|
+
for (var i = 0; i < length; i++) {
|
|
1856
|
+
args[i] = arguments[i];
|
|
1857
|
+
}
|
|
1858
|
+
args[length] = stack;
|
|
1859
|
+
console.warn.apply(console, args);
|
|
1860
|
+
} else {
|
|
1861
|
+
console.warn.apply(console, arguments);
|
|
1862
|
+
}
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1790
1866
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
1791
1867
|
|
|
1792
1868
|
|
|
@@ -1818,6 +1894,12 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
1818
1894
|
// Only used in www builds.
|
|
1819
1895
|
|
|
1820
1896
|
|
|
1897
|
+
// Disable javascript: URL strings in href for XSS protection.
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
// Disables yielding during render in Concurrent Mode. Used for debugging only.
|
|
1901
|
+
|
|
1902
|
+
|
|
1821
1903
|
// React Fire: prevent the value and checked attributes from syncing
|
|
1822
1904
|
// with their related DOM properties
|
|
1823
1905
|
|
|
@@ -1826,6 +1908,18 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
1826
1908
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
1827
1909
|
var enableStableConcurrentModeAPIs = false;
|
|
1828
1910
|
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
1914
|
+
// This is a flag so we can fix warnings in RN core before turning it on
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
// Experimental React Events support. Only used in www builds for now.
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
// Enables rewritten version of ReactFiberScheduler. Added in case we need to
|
|
1921
|
+
// quickly revert it.
|
|
1922
|
+
|
|
1829
1923
|
var React = {
|
|
1830
1924
|
Children: {
|
|
1831
1925
|
map: mapChildren,
|
|
@@ -1844,6 +1938,9 @@ var React = {
|
|
|
1844
1938
|
lazy: lazy,
|
|
1845
1939
|
memo: memo,
|
|
1846
1940
|
|
|
1941
|
+
error: error,
|
|
1942
|
+
warn: warn,
|
|
1943
|
+
|
|
1847
1944
|
useCallback: useCallback,
|
|
1848
1945
|
useContext: useContext,
|
|
1849
1946
|
useEffect: useEffect,
|
|
@@ -1856,6 +1953,7 @@ var React = {
|
|
|
1856
1953
|
useState: useState,
|
|
1857
1954
|
|
|
1858
1955
|
Fragment: REACT_FRAGMENT_TYPE,
|
|
1956
|
+
Profiler: REACT_PROFILER_TYPE,
|
|
1859
1957
|
StrictMode: REACT_STRICT_MODE_TYPE,
|
|
1860
1958
|
Suspense: REACT_SUSPENSE_TYPE,
|
|
1861
1959
|
|
|
@@ -1867,7 +1965,6 @@ var React = {
|
|
|
1867
1965
|
version: ReactVersion,
|
|
1868
1966
|
|
|
1869
1967
|
unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
|
|
1870
|
-
unstable_Profiler: REACT_PROFILER_TYPE,
|
|
1871
1968
|
|
|
1872
1969
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
1873
1970
|
};
|
|
@@ -1879,9 +1976,7 @@ var React = {
|
|
|
1879
1976
|
|
|
1880
1977
|
if (enableStableConcurrentModeAPIs) {
|
|
1881
1978
|
React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
1882
|
-
React.Profiler = REACT_PROFILER_TYPE;
|
|
1883
1979
|
React.unstable_ConcurrentMode = undefined;
|
|
1884
|
-
React.unstable_Profiler = undefined;
|
|
1885
1980
|
}
|
|
1886
1981
|
|
|
1887
1982
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.9.0-alpha.0
|
|
2
2
|
* react.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -7,19 +7,18 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
'use strict';var
|
|
11
|
-
60115,
|
|
12
|
-
|
|
13
|
-
function E(a,b,
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function R(a){a
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
b
|
|
25
|
-
unstable_ConcurrentMode:x,unstable_Profiler:u,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:I,ReactCurrentOwner:J,assign:k}},Y={default:X},Z=Y&&X||Y;module.exports=Z.default||Z;
|
|
10
|
+
'use strict';var h=require("object-assign"),n="function"===typeof Symbol&&Symbol.for,p=n?Symbol.for("react.element"):60103,q=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,t=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,v=n?Symbol.for("react.provider"):60109,w=n?Symbol.for("react.context"):60110,x=n?Symbol.for("react.concurrent_mode"):60111,y=n?Symbol.for("react.forward_ref"):60112,aa=n?Symbol.for("react.suspense"):60113,ba=n?Symbol.for("react.memo"):
|
|
11
|
+
60115,ca=n?Symbol.for("react.lazy"):60116,z="function"===typeof Symbol&&Symbol.iterator;function A(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return Error("Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ")}
|
|
12
|
+
var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C={};function D(a,b,c){this.props=a;this.context=b;this.refs=C;this.updater=c||B}D.prototype.isReactComponent={};D.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw A(85);this.updater.enqueueSetState(this,a,b,"setState")};D.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};
|
|
13
|
+
function E(){}E.prototype=D.prototype;function F(a,b,c){this.props=a;this.context=b;this.refs=C;this.updater=c||B}var G=F.prototype=new E;G.constructor=F;h(G,D.prototype);G.isPureReactComponent=!0;var H={current:null},I={current:null},J=Object.prototype.hasOwnProperty,K={key:!0,ref:!0,__self:!0,__source:!0};
|
|
14
|
+
function L(a,b,c){var d=void 0,e={},g=null,k=null;if(null!=b)for(d in void 0!==b.ref&&(k=b.ref),void 0!==b.key&&(g=""+b.key),b)J.call(b,d)&&!K.hasOwnProperty(d)&&(e[d]=b[d]);var f=arguments.length-2;if(1===f)e.children=c;else if(1<f){for(var l=Array(f),m=0;m<f;m++)l[m]=arguments[m+2];e.children=l}if(a&&a.defaultProps)for(d in f=a.defaultProps,f)void 0===e[d]&&(e[d]=f[d]);return{$$typeof:p,type:a,key:g,ref:k,props:e,_owner:I.current}}
|
|
15
|
+
function da(a,b){return{$$typeof:p,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function M(a){return"object"===typeof a&&null!==a&&a.$$typeof===p}function escape(a){var b={"=":"=0",":":"=2"};return"$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}var N=/\/+/g,O=[];function P(a,b,c,d){if(O.length){var e=O.pop();e.result=a;e.keyPrefix=b;e.func=c;e.context=d;e.count=0;return e}return{result:a,keyPrefix:b,func:c,context:d,count:0}}
|
|
16
|
+
function Q(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>O.length&&O.push(a)}
|
|
17
|
+
function R(a,b,c,d){var e=typeof a;if("undefined"===e||"boolean"===e)a=null;var g=!1;if(null===a)g=!0;else switch(e){case "string":case "number":g=!0;break;case "object":switch(a.$$typeof){case p:case q:g=!0}}if(g)return c(d,a,""===b?"."+S(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var k=0;k<a.length;k++){e=a[k];var f=b+S(e,k);g+=R(e,f,c,d)}else if(null===a||"object"!==typeof a?f=null:(f=z&&a[z]||a["@@iterator"],f="function"===typeof f?f:null),"function"===typeof f)for(a=f.call(a),k=
|
|
18
|
+
0;!(e=a.next()).done;)e=e.value,f=b+S(e,k++),g+=R(e,f,c,d);else if("object"===e)throw c=""+a,A(31,"[object Object]"===c?"object with keys {"+Object.keys(a).join(", ")+"}":c,"");return g}function T(a,b,c){return null==a?0:R(a,"",b,c)}function S(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function ea(a,b){a.func.call(a.context,b,a.count++)}
|
|
19
|
+
function fa(a,b,c){var d=a.result,e=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?U(a,d,c,function(a){return a}):null!=a&&(M(a)&&(a=da(a,e+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(N,"$&/")+"/")+c)),d.push(a))}function U(a,b,c,d,e){var g="";null!=c&&(g=(""+c).replace(N,"$&/")+"/");b=P(b,g,d,e);T(a,fa,b);Q(b)}function V(){var a=H.current;if(null===a)throw A(321);return a}function W(){}
|
|
20
|
+
var X={Children:{map:function(a,b,c){if(null==a)return a;var d=[];U(a,d,null,b,c);return d},forEach:function(a,b,c){if(null==a)return a;b=P(null,null,b,c);T(a,ea,b);Q(b)},count:function(a){return T(a,function(){return null},null)},toArray:function(a){var b=[];U(a,b,null,function(a){return a});return b},only:function(a){if(!M(a))throw A(143);return a}},createRef:function(){return{current:null}},Component:D,PureComponent:F,createContext:function(a,b){void 0===b&&(b=null);a={$$typeof:w,_calculateChangedBits:b,
|
|
21
|
+
_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:v,_context:a};return a.Consumer=a},forwardRef:function(a){return{$$typeof:y,render:a}},lazy:function(a){return{$$typeof:ca,_ctor:a,_status:-1,_result:null}},memo:function(a,b){return{$$typeof:ba,type:a,compare:void 0===b?null:b}},error:W,warn:W,useCallback:function(a,b){return V().useCallback(a,b)},useContext:function(a,b){return V().useContext(a,b)},useEffect:function(a,b){return V().useEffect(a,b)},
|
|
22
|
+
useImperativeHandle:function(a,b,c){return V().useImperativeHandle(a,b,c)},useDebugValue:function(){},useLayoutEffect:function(a,b){return V().useLayoutEffect(a,b)},useMemo:function(a,b){return V().useMemo(a,b)},useReducer:function(a,b,c){return V().useReducer(a,b,c)},useRef:function(a){return V().useRef(a)},useState:function(a){return V().useState(a)},Fragment:r,Profiler:u,StrictMode:t,Suspense:aa,createElement:L,cloneElement:function(a,b,c){if(null===a||void 0===a)throw A(267,a);var d=void 0,e=
|
|
23
|
+
h({},a.props),g=a.key,k=a.ref,f=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,f=I.current);void 0!==b.key&&(g=""+b.key);var l=void 0;a.type&&a.type.defaultProps&&(l=a.type.defaultProps);for(d in b)J.call(b,d)&&!K.hasOwnProperty(d)&&(e[d]=void 0===b[d]&&void 0!==l?l[d]:b[d])}d=arguments.length-2;if(1===d)e.children=c;else if(1<d){l=Array(d);for(var m=0;m<d;m++)l[m]=arguments[m+2];e.children=l}return{$$typeof:p,type:a.type,key:g,ref:k,props:e,_owner:f}},createFactory:function(a){var b=L.bind(null,a);
|
|
24
|
+
b.type=a;return b},isValidElement:M,version:"16.9.0-alpha.0",unstable_ConcurrentMode:x,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:H,ReactCurrentOwner:I,ReactShouldWarnActingUpdates:{current:!1},assign:h}},Y={default:X},Z=Y&&X||Y;module.exports=Z.default||Z;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react"
|
|
6
6
|
],
|
|
7
|
-
"version": "16.
|
|
7
|
+
"version": "16.9.0-alpha.0",
|
|
8
8
|
"homepage": "https://reactjs.org/",
|
|
9
9
|
"bugs": "https://github.com/facebook/react/issues",
|
|
10
10
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"loose-envify": "^1.1.0",
|
|
30
30
|
"object-assign": "^4.1.1",
|
|
31
31
|
"prop-types": "^15.6.2",
|
|
32
|
-
"scheduler": "^0.
|
|
32
|
+
"scheduler": "^0.14.0-alpha.0"
|
|
33
33
|
},
|
|
34
34
|
"browserify": {
|
|
35
35
|
"transform": [
|
package/umd/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.9.0-alpha.0
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
// TODO: this is special because it gets imported during build.
|
|
19
19
|
|
|
20
|
-
var ReactVersion = '16.
|
|
20
|
+
var ReactVersion = '16.9.0-alpha.0';
|
|
21
21
|
|
|
22
22
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
23
23
|
// nor polyfill, then a plain number is used for performance.
|
|
@@ -36,6 +36,11 @@ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead
|
|
|
36
36
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
37
37
|
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
38
38
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
39
|
+
var REACT_EVENT_COMPONENT_TYPE = hasSymbol ? Symbol.for('react.event_component') : 0xead5;
|
|
40
|
+
var REACT_EVENT_TARGET_TYPE = hasSymbol ? Symbol.for('react.event_target') : 0xead6;
|
|
41
|
+
|
|
42
|
+
// React event targets
|
|
43
|
+
var REACT_EVENT_TARGET_TOUCH_HIT = hasSymbol ? Symbol.for('react.event_target.touch_hit') : 0xead7;
|
|
39
44
|
|
|
40
45
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
41
46
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
@@ -142,6 +147,20 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
|
|
|
142
147
|
return to;
|
|
143
148
|
};
|
|
144
149
|
|
|
150
|
+
// Do not require this module directly! Use a normal error constructor with
|
|
151
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
152
|
+
// build, and in production they will be minified.
|
|
153
|
+
|
|
154
|
+
// Do not require this module directly! Use a normal error constructor with
|
|
155
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
156
|
+
// build, and in production they will be minified.
|
|
157
|
+
|
|
158
|
+
function ReactError(message) {
|
|
159
|
+
var error = new Error(message);
|
|
160
|
+
error.name = 'Invariant Violation';
|
|
161
|
+
return error;
|
|
162
|
+
}
|
|
163
|
+
|
|
145
164
|
/**
|
|
146
165
|
* Use invariant() to assert state which your program assumes to be true.
|
|
147
166
|
*
|
|
@@ -153,40 +172,6 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
|
|
|
153
172
|
* will remain to ensure logic does not differ in production.
|
|
154
173
|
*/
|
|
155
174
|
|
|
156
|
-
var validateFormat = function () {};
|
|
157
|
-
|
|
158
|
-
{
|
|
159
|
-
validateFormat = function (format) {
|
|
160
|
-
if (format === undefined) {
|
|
161
|
-
throw new Error('invariant requires an error message argument');
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
|
167
|
-
validateFormat(format);
|
|
168
|
-
|
|
169
|
-
if (!condition) {
|
|
170
|
-
var error = void 0;
|
|
171
|
-
if (format === undefined) {
|
|
172
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
173
|
-
} else {
|
|
174
|
-
var args = [a, b, c, d, e, f];
|
|
175
|
-
var argIndex = 0;
|
|
176
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
177
|
-
return args[argIndex++];
|
|
178
|
-
}));
|
|
179
|
-
error.name = 'Invariant Violation';
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
183
|
-
throw error;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// Relying on the `invariant()` implementation lets us
|
|
188
|
-
// preserve the format and params in the www builds.
|
|
189
|
-
|
|
190
175
|
/**
|
|
191
176
|
* Forked from fbjs/warning:
|
|
192
177
|
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
@@ -419,7 +404,13 @@ Component.prototype.isReactComponent = {};
|
|
|
419
404
|
* @protected
|
|
420
405
|
*/
|
|
421
406
|
Component.prototype.setState = function (partialState, callback) {
|
|
422
|
-
|
|
407
|
+
(function () {
|
|
408
|
+
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
409
|
+
{
|
|
410
|
+
throw ReactError('setState(...): takes an object of state variables to update or a function which returns an object of state variables.');
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
})();
|
|
423
414
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
424
415
|
};
|
|
425
416
|
|
|
@@ -499,6 +490,244 @@ function createRef() {
|
|
|
499
490
|
|
|
500
491
|
var enableSchedulerDebugging = false;
|
|
501
492
|
|
|
493
|
+
// The DOM Scheduler implementation is similar to requestIdleCallback. It
|
|
494
|
+
// works by scheduling a requestAnimationFrame, storing the time for the start
|
|
495
|
+
// of the frame, then scheduling a postMessage which gets scheduled after paint.
|
|
496
|
+
// Within the postMessage handler do as much work as possible until time + frame
|
|
497
|
+
// rate. By separating the idle call into a separate event tick we ensure that
|
|
498
|
+
// layout, paint and other browser work is counted against the available time.
|
|
499
|
+
// The frame rate is dynamically adjusted.
|
|
500
|
+
|
|
501
|
+
var requestHostCallback = void 0;
|
|
502
|
+
var cancelHostCallback = void 0;
|
|
503
|
+
var shouldYieldToHost = void 0;
|
|
504
|
+
var getCurrentTime = void 0;
|
|
505
|
+
|
|
506
|
+
var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
|
|
507
|
+
|
|
508
|
+
// We capture a local reference to any global, in case it gets polyfilled after
|
|
509
|
+
// this module is initially evaluated. We want to be using a
|
|
510
|
+
// consistent implementation.
|
|
511
|
+
var localDate = Date;
|
|
512
|
+
|
|
513
|
+
// This initialization code may run even on server environments if a component
|
|
514
|
+
// just imports ReactDOM (e.g. for findDOMNode). Some environments might not
|
|
515
|
+
// have setTimeout or clearTimeout. However, we always expect them to be defined
|
|
516
|
+
// on the client. https://github.com/facebook/react/pull/13088
|
|
517
|
+
var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
|
|
518
|
+
var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
|
|
519
|
+
|
|
520
|
+
// We don't expect either of these to necessarily be defined, but we will error
|
|
521
|
+
// later if they are missing on the client.
|
|
522
|
+
var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
|
|
523
|
+
var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
|
|
524
|
+
|
|
525
|
+
// requestAnimationFrame does not run when the tab is in the background. If
|
|
526
|
+
// we're backgrounded we prefer for that work to happen so that the page
|
|
527
|
+
// continues to load in the background. So we also schedule a 'setTimeout' as
|
|
528
|
+
// a fallback.
|
|
529
|
+
// TODO: Need a better heuristic for backgrounded work.
|
|
530
|
+
var ANIMATION_FRAME_TIMEOUT = 100;
|
|
531
|
+
var rAFID = void 0;
|
|
532
|
+
var rAFTimeoutID = void 0;
|
|
533
|
+
var requestAnimationFrameWithTimeout = function (callback) {
|
|
534
|
+
// schedule rAF and also a setTimeout
|
|
535
|
+
rAFID = localRequestAnimationFrame(function (timestamp) {
|
|
536
|
+
// cancel the setTimeout
|
|
537
|
+
localClearTimeout(rAFTimeoutID);
|
|
538
|
+
callback(timestamp);
|
|
539
|
+
});
|
|
540
|
+
rAFTimeoutID = localSetTimeout(function () {
|
|
541
|
+
// cancel the requestAnimationFrame
|
|
542
|
+
localCancelAnimationFrame(rAFID);
|
|
543
|
+
callback(getCurrentTime());
|
|
544
|
+
}, ANIMATION_FRAME_TIMEOUT);
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
if (hasNativePerformanceNow) {
|
|
548
|
+
var Performance = performance;
|
|
549
|
+
getCurrentTime = function () {
|
|
550
|
+
return Performance.now();
|
|
551
|
+
};
|
|
552
|
+
} else {
|
|
553
|
+
getCurrentTime = function () {
|
|
554
|
+
return localDate.now();
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
if (
|
|
559
|
+
// If Scheduler runs in a non-DOM environment, it falls back to a naive
|
|
560
|
+
// implementation using setTimeout.
|
|
561
|
+
typeof window === 'undefined' ||
|
|
562
|
+
// Check if MessageChannel is supported, too.
|
|
563
|
+
typeof MessageChannel !== 'function') {
|
|
564
|
+
// If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
|
|
565
|
+
// fallback to a naive implementation.
|
|
566
|
+
var _callback = null;
|
|
567
|
+
var _flushCallback = function (didTimeout) {
|
|
568
|
+
if (_callback !== null) {
|
|
569
|
+
try {
|
|
570
|
+
_callback(didTimeout);
|
|
571
|
+
} finally {
|
|
572
|
+
_callback = null;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
requestHostCallback = function (cb, ms) {
|
|
577
|
+
if (_callback !== null) {
|
|
578
|
+
// Protect against re-entrancy.
|
|
579
|
+
setTimeout(requestHostCallback, 0, cb);
|
|
580
|
+
} else {
|
|
581
|
+
_callback = cb;
|
|
582
|
+
setTimeout(_flushCallback, 0, false);
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
cancelHostCallback = function () {
|
|
586
|
+
_callback = null;
|
|
587
|
+
};
|
|
588
|
+
shouldYieldToHost = function () {
|
|
589
|
+
return false;
|
|
590
|
+
};
|
|
591
|
+
} else {
|
|
592
|
+
if (typeof console !== 'undefined') {
|
|
593
|
+
// TODO: Remove fb.me link
|
|
594
|
+
if (typeof localRequestAnimationFrame !== 'function') {
|
|
595
|
+
console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
|
596
|
+
}
|
|
597
|
+
if (typeof localCancelAnimationFrame !== 'function') {
|
|
598
|
+
console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
var scheduledHostCallback = null;
|
|
603
|
+
var isMessageEventScheduled = false;
|
|
604
|
+
var timeoutTime = -1;
|
|
605
|
+
|
|
606
|
+
var isAnimationFrameScheduled = false;
|
|
607
|
+
|
|
608
|
+
var isFlushingHostCallback = false;
|
|
609
|
+
|
|
610
|
+
var frameDeadline = 0;
|
|
611
|
+
// We start out assuming that we run at 30fps but then the heuristic tracking
|
|
612
|
+
// will adjust this value to a faster fps if we get more frequent animation
|
|
613
|
+
// frames.
|
|
614
|
+
var previousFrameTime = 33;
|
|
615
|
+
var activeFrameTime = 33;
|
|
616
|
+
|
|
617
|
+
shouldYieldToHost = function () {
|
|
618
|
+
return frameDeadline <= getCurrentTime();
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
// We use the postMessage trick to defer idle work until after the repaint.
|
|
622
|
+
var channel = new MessageChannel();
|
|
623
|
+
var port = channel.port2;
|
|
624
|
+
channel.port1.onmessage = function (event) {
|
|
625
|
+
isMessageEventScheduled = false;
|
|
626
|
+
|
|
627
|
+
var prevScheduledCallback = scheduledHostCallback;
|
|
628
|
+
var prevTimeoutTime = timeoutTime;
|
|
629
|
+
scheduledHostCallback = null;
|
|
630
|
+
timeoutTime = -1;
|
|
631
|
+
|
|
632
|
+
var currentTime = getCurrentTime();
|
|
633
|
+
|
|
634
|
+
var didTimeout = false;
|
|
635
|
+
if (frameDeadline - currentTime <= 0) {
|
|
636
|
+
// There's no time left in this idle period. Check if the callback has
|
|
637
|
+
// a timeout and whether it's been exceeded.
|
|
638
|
+
if (prevTimeoutTime !== -1 && prevTimeoutTime <= currentTime) {
|
|
639
|
+
// Exceeded the timeout. Invoke the callback even though there's no
|
|
640
|
+
// time left.
|
|
641
|
+
didTimeout = true;
|
|
642
|
+
} else {
|
|
643
|
+
// No timeout.
|
|
644
|
+
if (!isAnimationFrameScheduled) {
|
|
645
|
+
// Schedule another animation callback so we retry later.
|
|
646
|
+
isAnimationFrameScheduled = true;
|
|
647
|
+
requestAnimationFrameWithTimeout(animationTick);
|
|
648
|
+
}
|
|
649
|
+
// Exit without invoking the callback.
|
|
650
|
+
scheduledHostCallback = prevScheduledCallback;
|
|
651
|
+
timeoutTime = prevTimeoutTime;
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (prevScheduledCallback !== null) {
|
|
657
|
+
isFlushingHostCallback = true;
|
|
658
|
+
try {
|
|
659
|
+
prevScheduledCallback(didTimeout);
|
|
660
|
+
} finally {
|
|
661
|
+
isFlushingHostCallback = false;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
var animationTick = function (rafTime) {
|
|
667
|
+
if (scheduledHostCallback !== null) {
|
|
668
|
+
// Eagerly schedule the next animation callback at the beginning of the
|
|
669
|
+
// frame. If the scheduler queue is not empty at the end of the frame, it
|
|
670
|
+
// will continue flushing inside that callback. If the queue *is* empty,
|
|
671
|
+
// then it will exit immediately. Posting the callback at the start of the
|
|
672
|
+
// frame ensures it's fired within the earliest possible frame. If we
|
|
673
|
+
// waited until the end of the frame to post the callback, we risk the
|
|
674
|
+
// browser skipping a frame and not firing the callback until the frame
|
|
675
|
+
// after that.
|
|
676
|
+
requestAnimationFrameWithTimeout(animationTick);
|
|
677
|
+
} else {
|
|
678
|
+
// No pending work. Exit.
|
|
679
|
+
isAnimationFrameScheduled = false;
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
|
|
684
|
+
if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
|
|
685
|
+
if (nextFrameTime < 8) {
|
|
686
|
+
// Defensive coding. We don't support higher frame rates than 120hz.
|
|
687
|
+
// If the calculated frame time gets lower than 8, it is probably a bug.
|
|
688
|
+
nextFrameTime = 8;
|
|
689
|
+
}
|
|
690
|
+
// If one frame goes long, then the next one can be short to catch up.
|
|
691
|
+
// If two frames are short in a row, then that's an indication that we
|
|
692
|
+
// actually have a higher frame rate than what we're currently optimizing.
|
|
693
|
+
// We adjust our heuristic dynamically accordingly. For example, if we're
|
|
694
|
+
// running on 120hz display or 90hz VR display.
|
|
695
|
+
// Take the max of the two in case one of them was an anomaly due to
|
|
696
|
+
// missed frame deadlines.
|
|
697
|
+
activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
|
|
698
|
+
} else {
|
|
699
|
+
previousFrameTime = nextFrameTime;
|
|
700
|
+
}
|
|
701
|
+
frameDeadline = rafTime + activeFrameTime;
|
|
702
|
+
if (!isMessageEventScheduled) {
|
|
703
|
+
isMessageEventScheduled = true;
|
|
704
|
+
port.postMessage(undefined);
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
requestHostCallback = function (callback, absoluteTimeout) {
|
|
709
|
+
scheduledHostCallback = callback;
|
|
710
|
+
timeoutTime = absoluteTimeout;
|
|
711
|
+
if (isFlushingHostCallback || absoluteTimeout < 0) {
|
|
712
|
+
// Don't wait for the next frame. Continue working ASAP, in a new event.
|
|
713
|
+
port.postMessage(undefined);
|
|
714
|
+
} else if (!isAnimationFrameScheduled) {
|
|
715
|
+
// If rAF didn't already schedule one, we need to schedule a frame.
|
|
716
|
+
// TODO: If this rAF doesn't materialize because the browser throttles, we
|
|
717
|
+
// might want to still have setTimeout trigger rIC as a backup to ensure
|
|
718
|
+
// that we keep performing work.
|
|
719
|
+
isAnimationFrameScheduled = true;
|
|
720
|
+
requestAnimationFrameWithTimeout(animationTick);
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
cancelHostCallback = function () {
|
|
725
|
+
scheduledHostCallback = null;
|
|
726
|
+
isMessageEventScheduled = false;
|
|
727
|
+
timeoutTime = -1;
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
|
|
502
731
|
/* eslint-disable no-var */
|
|
503
732
|
|
|
504
733
|
// TODO: Use symbols?
|
|
@@ -525,7 +754,7 @@ var IDLE_PRIORITY = maxSigned31BitInt;
|
|
|
525
754
|
// Callbacks are stored as a circular, doubly linked list.
|
|
526
755
|
var firstCallbackNode = null;
|
|
527
756
|
|
|
528
|
-
var
|
|
757
|
+
var currentHostCallbackDidTimeout = false;
|
|
529
758
|
// Pausing the scheduler is useful for debugging.
|
|
530
759
|
var isSchedulerPaused = false;
|
|
531
760
|
|
|
@@ -533,31 +762,31 @@ var currentPriorityLevel = NormalPriority;
|
|
|
533
762
|
var currentEventStartTime = -1;
|
|
534
763
|
var currentExpirationTime = -1;
|
|
535
764
|
|
|
536
|
-
// This is set
|
|
537
|
-
var
|
|
765
|
+
// This is set while performing work, to prevent re-entrancy.
|
|
766
|
+
var isPerformingWork = false;
|
|
538
767
|
|
|
539
768
|
var isHostCallbackScheduled = false;
|
|
540
769
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
function ensureHostCallbackIsScheduled() {
|
|
544
|
-
if (isExecutingCallback) {
|
|
770
|
+
function scheduleHostCallbackIfNeeded() {
|
|
771
|
+
if (isPerformingWork) {
|
|
545
772
|
// Don't schedule work yet; wait until the next time we yield.
|
|
546
773
|
return;
|
|
547
774
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
isHostCallbackScheduled
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
775
|
+
if (firstCallbackNode !== null) {
|
|
776
|
+
// Schedule the host callback using the earliest expiration in the list.
|
|
777
|
+
var expirationTime = firstCallbackNode.expirationTime;
|
|
778
|
+
if (isHostCallbackScheduled) {
|
|
779
|
+
// Cancel the existing host callback.
|
|
780
|
+
cancelHostCallback();
|
|
781
|
+
} else {
|
|
782
|
+
isHostCallbackScheduled = true;
|
|
783
|
+
}
|
|
784
|
+
requestHostCallback(flushWork, expirationTime);
|
|
555
785
|
}
|
|
556
|
-
requestHostCallback(flushWork, expirationTime);
|
|
557
786
|
}
|
|
558
787
|
|
|
559
788
|
function flushFirstCallback() {
|
|
560
|
-
var
|
|
789
|
+
var currentlyFlushingCallback = firstCallbackNode;
|
|
561
790
|
|
|
562
791
|
// Remove the node from the list before calling the callback. That way the
|
|
563
792
|
// list is in a consistent state even if the callback throws.
|
|
@@ -572,19 +801,24 @@ function flushFirstCallback() {
|
|
|
572
801
|
next.previous = lastCallbackNode;
|
|
573
802
|
}
|
|
574
803
|
|
|
575
|
-
|
|
804
|
+
currentlyFlushingCallback.next = currentlyFlushingCallback.previous = null;
|
|
576
805
|
|
|
577
806
|
// Now it's safe to call the callback.
|
|
578
|
-
var callback =
|
|
579
|
-
var expirationTime =
|
|
580
|
-
var priorityLevel =
|
|
807
|
+
var callback = currentlyFlushingCallback.callback;
|
|
808
|
+
var expirationTime = currentlyFlushingCallback.expirationTime;
|
|
809
|
+
var priorityLevel = currentlyFlushingCallback.priorityLevel;
|
|
581
810
|
var previousPriorityLevel = currentPriorityLevel;
|
|
582
811
|
var previousExpirationTime = currentExpirationTime;
|
|
583
812
|
currentPriorityLevel = priorityLevel;
|
|
584
813
|
currentExpirationTime = expirationTime;
|
|
585
814
|
var continuationCallback;
|
|
586
815
|
try {
|
|
587
|
-
|
|
816
|
+
var didUserCallbackTimeout = currentHostCallbackDidTimeout ||
|
|
817
|
+
// Immediate priority callbacks are always called as if they timed out
|
|
818
|
+
priorityLevel === ImmediatePriority;
|
|
819
|
+
continuationCallback = callback(didUserCallbackTimeout);
|
|
820
|
+
} catch (error) {
|
|
821
|
+
throw error;
|
|
588
822
|
} finally {
|
|
589
823
|
currentPriorityLevel = previousPriorityLevel;
|
|
590
824
|
currentExpirationTime = previousExpirationTime;
|
|
@@ -628,7 +862,7 @@ function flushFirstCallback() {
|
|
|
628
862
|
} else if (nextAfterContinuation === firstCallbackNode) {
|
|
629
863
|
// The new callback is the highest priority callback in the list.
|
|
630
864
|
firstCallbackNode = continuationNode;
|
|
631
|
-
|
|
865
|
+
scheduleHostCallbackIfNeeded();
|
|
632
866
|
}
|
|
633
867
|
|
|
634
868
|
var previous = nextAfterContinuation.previous;
|
|
@@ -639,41 +873,20 @@ function flushFirstCallback() {
|
|
|
639
873
|
}
|
|
640
874
|
}
|
|
641
875
|
|
|
642
|
-
function
|
|
643
|
-
if (
|
|
644
|
-
// Confirm we've exited the outer most event handler
|
|
645
|
-
currentEventStartTime === -1 && firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority) {
|
|
646
|
-
isExecutingCallback = true;
|
|
647
|
-
try {
|
|
648
|
-
do {
|
|
649
|
-
flushFirstCallback();
|
|
650
|
-
} while (
|
|
651
|
-
// Keep flushing until there are no more immediate callbacks
|
|
652
|
-
firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority);
|
|
653
|
-
} finally {
|
|
654
|
-
isExecutingCallback = false;
|
|
655
|
-
if (firstCallbackNode !== null) {
|
|
656
|
-
// There's still work remaining. Request another callback.
|
|
657
|
-
ensureHostCallbackIsScheduled();
|
|
658
|
-
} else {
|
|
659
|
-
isHostCallbackScheduled = false;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
function flushWork(didTimeout) {
|
|
876
|
+
function flushWork(didUserCallbackTimeout) {
|
|
666
877
|
// Exit right away if we're currently paused
|
|
667
|
-
|
|
668
878
|
if (enableSchedulerDebugging && isSchedulerPaused) {
|
|
669
879
|
return;
|
|
670
880
|
}
|
|
671
881
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
882
|
+
// We'll need a new host callback the next time work is scheduled.
|
|
883
|
+
isHostCallbackScheduled = false;
|
|
884
|
+
|
|
885
|
+
isPerformingWork = true;
|
|
886
|
+
var previousDidTimeout = currentHostCallbackDidTimeout;
|
|
887
|
+
currentHostCallbackDidTimeout = didUserCallbackTimeout;
|
|
675
888
|
try {
|
|
676
|
-
if (
|
|
889
|
+
if (didUserCallbackTimeout) {
|
|
677
890
|
// Flush all the expired callbacks without yielding.
|
|
678
891
|
while (firstCallbackNode !== null && !(enableSchedulerDebugging && isSchedulerPaused)) {
|
|
679
892
|
// TODO Wrap in feature flag
|
|
@@ -701,16 +914,10 @@ function flushWork(didTimeout) {
|
|
|
701
914
|
}
|
|
702
915
|
}
|
|
703
916
|
} finally {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
ensureHostCallbackIsScheduled();
|
|
709
|
-
} else {
|
|
710
|
-
isHostCallbackScheduled = false;
|
|
711
|
-
}
|
|
712
|
-
// Before exiting, flush all the immediate work that was scheduled.
|
|
713
|
-
flushImmediateWork();
|
|
917
|
+
isPerformingWork = false;
|
|
918
|
+
currentHostCallbackDidTimeout = previousDidTimeout;
|
|
919
|
+
// There's still work remaining. Request another callback.
|
|
920
|
+
scheduleHostCallbackIfNeeded();
|
|
714
921
|
}
|
|
715
922
|
}
|
|
716
923
|
|
|
@@ -733,12 +940,13 @@ function unstable_runWithPriority(priorityLevel, eventHandler) {
|
|
|
733
940
|
|
|
734
941
|
try {
|
|
735
942
|
return eventHandler();
|
|
943
|
+
} catch (error) {
|
|
944
|
+
// There's still work remaining. Request another callback.
|
|
945
|
+
scheduleHostCallbackIfNeeded();
|
|
946
|
+
throw error;
|
|
736
947
|
} finally {
|
|
737
948
|
currentPriorityLevel = previousPriorityLevel;
|
|
738
949
|
currentEventStartTime = previousEventStartTime;
|
|
739
|
-
|
|
740
|
-
// Before exiting, flush all the immediate work that was scheduled.
|
|
741
|
-
flushImmediateWork();
|
|
742
950
|
}
|
|
743
951
|
}
|
|
744
952
|
|
|
@@ -764,12 +972,13 @@ function unstable_next(eventHandler) {
|
|
|
764
972
|
|
|
765
973
|
try {
|
|
766
974
|
return eventHandler();
|
|
975
|
+
} catch (error) {
|
|
976
|
+
// There's still work remaining. Request another callback.
|
|
977
|
+
scheduleHostCallbackIfNeeded();
|
|
978
|
+
throw error;
|
|
767
979
|
} finally {
|
|
768
980
|
currentPriorityLevel = previousPriorityLevel;
|
|
769
981
|
currentEventStartTime = previousEventStartTime;
|
|
770
|
-
|
|
771
|
-
// Before exiting, flush all the immediate work that was scheduled.
|
|
772
|
-
flushImmediateWork();
|
|
773
982
|
}
|
|
774
983
|
}
|
|
775
984
|
|
|
@@ -784,384 +993,157 @@ function unstable_wrapCallback(callback) {
|
|
|
784
993
|
|
|
785
994
|
try {
|
|
786
995
|
return callback.apply(this, arguments);
|
|
996
|
+
} catch (error) {
|
|
997
|
+
// There's still work remaining. Request another callback.
|
|
998
|
+
scheduleHostCallbackIfNeeded();
|
|
999
|
+
throw error;
|
|
787
1000
|
} finally {
|
|
788
1001
|
currentPriorityLevel = previousPriorityLevel;
|
|
789
1002
|
currentEventStartTime = previousEventStartTime;
|
|
790
|
-
flushImmediateWork();
|
|
791
1003
|
}
|
|
792
1004
|
};
|
|
793
1005
|
}
|
|
794
1006
|
|
|
795
|
-
function unstable_scheduleCallback(callback, deprecated_options) {
|
|
1007
|
+
function unstable_scheduleCallback(priorityLevel, callback, deprecated_options) {
|
|
796
1008
|
var startTime = currentEventStartTime !== -1 ? currentEventStartTime : getCurrentTime();
|
|
797
1009
|
|
|
798
1010
|
var expirationTime;
|
|
799
1011
|
if (typeof deprecated_options === 'object' && deprecated_options !== null && typeof deprecated_options.timeout === 'number') {
|
|
800
1012
|
// FIXME: Remove this branch once we lift expiration times out of React.
|
|
801
|
-
expirationTime = startTime + deprecated_options.timeout;
|
|
802
|
-
} else {
|
|
803
|
-
switch (
|
|
804
|
-
case ImmediatePriority:
|
|
805
|
-
expirationTime = startTime + IMMEDIATE_PRIORITY_TIMEOUT;
|
|
806
|
-
break;
|
|
807
|
-
case UserBlockingPriority:
|
|
808
|
-
expirationTime = startTime + USER_BLOCKING_PRIORITY;
|
|
809
|
-
break;
|
|
810
|
-
case IdlePriority:
|
|
811
|
-
expirationTime = startTime + IDLE_PRIORITY;
|
|
812
|
-
break;
|
|
813
|
-
case LowPriority:
|
|
814
|
-
expirationTime = startTime + LOW_PRIORITY_TIMEOUT;
|
|
815
|
-
break;
|
|
816
|
-
case NormalPriority:
|
|
817
|
-
default:
|
|
818
|
-
expirationTime = startTime + NORMAL_PRIORITY_TIMEOUT;
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
var newNode = {
|
|
823
|
-
callback: callback,
|
|
824
|
-
priorityLevel: currentPriorityLevel,
|
|
825
|
-
expirationTime: expirationTime,
|
|
826
|
-
next: null,
|
|
827
|
-
previous: null
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
// Insert the new callback into the list, ordered first by expiration, then
|
|
831
|
-
// by insertion. So the new callback is inserted any other callback with
|
|
832
|
-
// equal expiration.
|
|
833
|
-
if (firstCallbackNode === null) {
|
|
834
|
-
// This is the first callback in the list.
|
|
835
|
-
firstCallbackNode = newNode.next = newNode.previous = newNode;
|
|
836
|
-
ensureHostCallbackIsScheduled();
|
|
837
|
-
} else {
|
|
838
|
-
var next = null;
|
|
839
|
-
var node = firstCallbackNode;
|
|
840
|
-
do {
|
|
841
|
-
if (node.expirationTime > expirationTime) {
|
|
842
|
-
// The new callback expires before this one.
|
|
843
|
-
next = node;
|
|
844
|
-
break;
|
|
845
|
-
}
|
|
846
|
-
node = node.next;
|
|
847
|
-
} while (node !== firstCallbackNode);
|
|
848
|
-
|
|
849
|
-
if (next === null) {
|
|
850
|
-
// No callback with a later expiration was found, which means the new
|
|
851
|
-
// callback has the latest expiration in the list.
|
|
852
|
-
next = firstCallbackNode;
|
|
853
|
-
} else if (next === firstCallbackNode) {
|
|
854
|
-
// The new callback has the earliest expiration in the entire list.
|
|
855
|
-
firstCallbackNode = newNode;
|
|
856
|
-
ensureHostCallbackIsScheduled();
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
var previous = next.previous;
|
|
860
|
-
previous.next = next.previous = newNode;
|
|
861
|
-
newNode.next = next;
|
|
862
|
-
newNode.previous = previous;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
return newNode;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
function unstable_pauseExecution() {
|
|
869
|
-
isSchedulerPaused = true;
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
function unstable_continueExecution() {
|
|
873
|
-
isSchedulerPaused = false;
|
|
874
|
-
if (firstCallbackNode !== null) {
|
|
875
|
-
ensureHostCallbackIsScheduled();
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
function unstable_getFirstCallbackNode() {
|
|
880
|
-
return firstCallbackNode;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
function unstable_cancelCallback(callbackNode) {
|
|
884
|
-
var next = callbackNode.next;
|
|
885
|
-
if (next === null) {
|
|
886
|
-
// Already cancelled.
|
|
887
|
-
return;
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
if (next === callbackNode) {
|
|
891
|
-
// This is the only scheduled callback. Clear the list.
|
|
892
|
-
firstCallbackNode = null;
|
|
893
|
-
} else {
|
|
894
|
-
// Remove the callback from its position in the list.
|
|
895
|
-
if (callbackNode === firstCallbackNode) {
|
|
896
|
-
firstCallbackNode = next;
|
|
897
|
-
}
|
|
898
|
-
var previous = callbackNode.previous;
|
|
899
|
-
previous.next = next;
|
|
900
|
-
next.previous = previous;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
callbackNode.next = callbackNode.previous = null;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
function unstable_getCurrentPriorityLevel() {
|
|
907
|
-
return currentPriorityLevel;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
function unstable_shouldYield() {
|
|
911
|
-
return !currentDidTimeout && (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime || shouldYieldToHost());
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
// The remaining code is essentially a polyfill for requestIdleCallback. It
|
|
915
|
-
// works by scheduling a requestAnimationFrame, storing the time for the start
|
|
916
|
-
// of the frame, then scheduling a postMessage which gets scheduled after paint.
|
|
917
|
-
// Within the postMessage handler do as much work as possible until time + frame
|
|
918
|
-
// rate. By separating the idle call into a separate event tick we ensure that
|
|
919
|
-
// layout, paint and other browser work is counted against the available time.
|
|
920
|
-
// The frame rate is dynamically adjusted.
|
|
921
|
-
|
|
922
|
-
// We capture a local reference to any global, in case it gets polyfilled after
|
|
923
|
-
// this module is initially evaluated. We want to be using a
|
|
924
|
-
// consistent implementation.
|
|
925
|
-
var localDate = Date;
|
|
926
|
-
|
|
927
|
-
// This initialization code may run even on server environments if a component
|
|
928
|
-
// just imports ReactDOM (e.g. for findDOMNode). Some environments might not
|
|
929
|
-
// have setTimeout or clearTimeout. However, we always expect them to be defined
|
|
930
|
-
// on the client. https://github.com/facebook/react/pull/13088
|
|
931
|
-
var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
|
|
932
|
-
var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
|
|
933
|
-
|
|
934
|
-
// We don't expect either of these to necessarily be defined, but we will error
|
|
935
|
-
// later if they are missing on the client.
|
|
936
|
-
var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
|
|
937
|
-
var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
|
|
938
|
-
|
|
939
|
-
var getCurrentTime;
|
|
940
|
-
|
|
941
|
-
// requestAnimationFrame does not run when the tab is in the background. If
|
|
942
|
-
// we're backgrounded we prefer for that work to happen so that the page
|
|
943
|
-
// continues to load in the background. So we also schedule a 'setTimeout' as
|
|
944
|
-
// a fallback.
|
|
945
|
-
// TODO: Need a better heuristic for backgrounded work.
|
|
946
|
-
var ANIMATION_FRAME_TIMEOUT = 100;
|
|
947
|
-
var rAFID;
|
|
948
|
-
var rAFTimeoutID;
|
|
949
|
-
var requestAnimationFrameWithTimeout = function (callback) {
|
|
950
|
-
// schedule rAF and also a setTimeout
|
|
951
|
-
rAFID = localRequestAnimationFrame(function (timestamp) {
|
|
952
|
-
// cancel the setTimeout
|
|
953
|
-
localClearTimeout(rAFTimeoutID);
|
|
954
|
-
callback(timestamp);
|
|
955
|
-
});
|
|
956
|
-
rAFTimeoutID = localSetTimeout(function () {
|
|
957
|
-
// cancel the requestAnimationFrame
|
|
958
|
-
localCancelAnimationFrame(rAFID);
|
|
959
|
-
callback(getCurrentTime());
|
|
960
|
-
}, ANIMATION_FRAME_TIMEOUT);
|
|
961
|
-
};
|
|
962
|
-
|
|
963
|
-
if (hasNativePerformanceNow) {
|
|
964
|
-
var Performance = performance;
|
|
965
|
-
getCurrentTime = function () {
|
|
966
|
-
return Performance.now();
|
|
967
|
-
};
|
|
968
|
-
} else {
|
|
969
|
-
getCurrentTime = function () {
|
|
970
|
-
return localDate.now();
|
|
971
|
-
};
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
var requestHostCallback;
|
|
975
|
-
var cancelHostCallback;
|
|
976
|
-
var shouldYieldToHost;
|
|
977
|
-
|
|
978
|
-
var globalValue = null;
|
|
979
|
-
if (typeof window !== 'undefined') {
|
|
980
|
-
globalValue = window;
|
|
981
|
-
} else if (typeof global !== 'undefined') {
|
|
982
|
-
globalValue = global;
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
if (globalValue && globalValue._schedMock) {
|
|
986
|
-
// Dynamic injection, only for testing purposes.
|
|
987
|
-
var globalImpl = globalValue._schedMock;
|
|
988
|
-
requestHostCallback = globalImpl[0];
|
|
989
|
-
cancelHostCallback = globalImpl[1];
|
|
990
|
-
shouldYieldToHost = globalImpl[2];
|
|
991
|
-
getCurrentTime = globalImpl[3];
|
|
992
|
-
} else if (
|
|
993
|
-
// If Scheduler runs in a non-DOM environment, it falls back to a naive
|
|
994
|
-
// implementation using setTimeout.
|
|
995
|
-
typeof window === 'undefined' ||
|
|
996
|
-
// Check if MessageChannel is supported, too.
|
|
997
|
-
typeof MessageChannel !== 'function') {
|
|
998
|
-
// If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
|
|
999
|
-
// fallback to a naive implementation.
|
|
1000
|
-
var _callback = null;
|
|
1001
|
-
var _flushCallback = function (didTimeout) {
|
|
1002
|
-
if (_callback !== null) {
|
|
1003
|
-
try {
|
|
1004
|
-
_callback(didTimeout);
|
|
1005
|
-
} finally {
|
|
1006
|
-
_callback = null;
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
};
|
|
1010
|
-
requestHostCallback = function (cb, ms) {
|
|
1011
|
-
if (_callback !== null) {
|
|
1012
|
-
// Protect against re-entrancy.
|
|
1013
|
-
setTimeout(requestHostCallback, 0, cb);
|
|
1014
|
-
} else {
|
|
1015
|
-
_callback = cb;
|
|
1016
|
-
setTimeout(_flushCallback, 0, false);
|
|
1017
|
-
}
|
|
1018
|
-
};
|
|
1019
|
-
cancelHostCallback = function () {
|
|
1020
|
-
_callback = null;
|
|
1021
|
-
};
|
|
1022
|
-
shouldYieldToHost = function () {
|
|
1023
|
-
return false;
|
|
1024
|
-
};
|
|
1025
|
-
} else {
|
|
1026
|
-
if (typeof console !== 'undefined') {
|
|
1027
|
-
// TODO: Remove fb.me link
|
|
1028
|
-
if (typeof localRequestAnimationFrame !== 'function') {
|
|
1029
|
-
console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
|
1030
|
-
}
|
|
1031
|
-
if (typeof localCancelAnimationFrame !== 'function') {
|
|
1032
|
-
console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
|
1013
|
+
expirationTime = startTime + deprecated_options.timeout;
|
|
1014
|
+
} else {
|
|
1015
|
+
switch (priorityLevel) {
|
|
1016
|
+
case ImmediatePriority:
|
|
1017
|
+
expirationTime = startTime + IMMEDIATE_PRIORITY_TIMEOUT;
|
|
1018
|
+
break;
|
|
1019
|
+
case UserBlockingPriority:
|
|
1020
|
+
expirationTime = startTime + USER_BLOCKING_PRIORITY;
|
|
1021
|
+
break;
|
|
1022
|
+
case IdlePriority:
|
|
1023
|
+
expirationTime = startTime + IDLE_PRIORITY;
|
|
1024
|
+
break;
|
|
1025
|
+
case LowPriority:
|
|
1026
|
+
expirationTime = startTime + LOW_PRIORITY_TIMEOUT;
|
|
1027
|
+
break;
|
|
1028
|
+
case NormalPriority:
|
|
1029
|
+
default:
|
|
1030
|
+
expirationTime = startTime + NORMAL_PRIORITY_TIMEOUT;
|
|
1033
1031
|
}
|
|
1034
1032
|
}
|
|
1035
1033
|
|
|
1036
|
-
var
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1034
|
+
var newNode = {
|
|
1035
|
+
callback: callback,
|
|
1036
|
+
priorityLevel: priorityLevel,
|
|
1037
|
+
expirationTime: expirationTime,
|
|
1038
|
+
next: null,
|
|
1039
|
+
previous: null
|
|
1040
|
+
};
|
|
1043
1041
|
|
|
1044
|
-
|
|
1045
|
-
//
|
|
1046
|
-
//
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1042
|
+
// Insert the new callback into the list, ordered first by expiration, then
|
|
1043
|
+
// by insertion. So the new callback is inserted any other callback with
|
|
1044
|
+
// equal expiration.
|
|
1045
|
+
if (firstCallbackNode === null) {
|
|
1046
|
+
// This is the first callback in the list.
|
|
1047
|
+
firstCallbackNode = newNode.next = newNode.previous = newNode;
|
|
1048
|
+
scheduleHostCallbackIfNeeded();
|
|
1049
|
+
} else {
|
|
1050
|
+
var next = null;
|
|
1051
|
+
var node = firstCallbackNode;
|
|
1052
|
+
do {
|
|
1053
|
+
if (node.expirationTime > expirationTime) {
|
|
1054
|
+
// The new callback expires before this one.
|
|
1055
|
+
next = node;
|
|
1056
|
+
break;
|
|
1057
|
+
}
|
|
1058
|
+
node = node.next;
|
|
1059
|
+
} while (node !== firstCallbackNode);
|
|
1050
1060
|
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1061
|
+
if (next === null) {
|
|
1062
|
+
// No callback with a later expiration was found, which means the new
|
|
1063
|
+
// callback has the latest expiration in the list.
|
|
1064
|
+
next = firstCallbackNode;
|
|
1065
|
+
} else if (next === firstCallbackNode) {
|
|
1066
|
+
// The new callback has the earliest expiration in the entire list.
|
|
1067
|
+
firstCallbackNode = newNode;
|
|
1068
|
+
scheduleHostCallbackIfNeeded();
|
|
1069
|
+
}
|
|
1054
1070
|
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1071
|
+
var previous = next.previous;
|
|
1072
|
+
previous.next = next.previous = newNode;
|
|
1073
|
+
newNode.next = next;
|
|
1074
|
+
newNode.previous = previous;
|
|
1075
|
+
}
|
|
1060
1076
|
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
scheduledHostCallback = null;
|
|
1064
|
-
timeoutTime = -1;
|
|
1077
|
+
return newNode;
|
|
1078
|
+
}
|
|
1065
1079
|
|
|
1066
|
-
|
|
1080
|
+
function unstable_pauseExecution() {
|
|
1081
|
+
isSchedulerPaused = true;
|
|
1082
|
+
}
|
|
1067
1083
|
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
// time left.
|
|
1075
|
-
didTimeout = true;
|
|
1076
|
-
} else {
|
|
1077
|
-
// No timeout.
|
|
1078
|
-
if (!isAnimationFrameScheduled) {
|
|
1079
|
-
// Schedule another animation callback so we retry later.
|
|
1080
|
-
isAnimationFrameScheduled = true;
|
|
1081
|
-
requestAnimationFrameWithTimeout(animationTick);
|
|
1082
|
-
}
|
|
1083
|
-
// Exit without invoking the callback.
|
|
1084
|
-
scheduledHostCallback = prevScheduledCallback;
|
|
1085
|
-
timeoutTime = prevTimeoutTime;
|
|
1086
|
-
return;
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1084
|
+
function unstable_continueExecution() {
|
|
1085
|
+
isSchedulerPaused = false;
|
|
1086
|
+
if (firstCallbackNode !== null) {
|
|
1087
|
+
scheduleHostCallbackIfNeeded();
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1089
1090
|
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
prevScheduledCallback(didTimeout);
|
|
1094
|
-
} finally {
|
|
1095
|
-
isFlushingHostCallback = false;
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
};
|
|
1091
|
+
function unstable_getFirstCallbackNode() {
|
|
1092
|
+
return firstCallbackNode;
|
|
1093
|
+
}
|
|
1099
1094
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
// frame ensures it's fired within the earliest possible frame. If we
|
|
1107
|
-
// waited until the end of the frame to post the callback, we risk the
|
|
1108
|
-
// browser skipping a frame and not firing the callback until the frame
|
|
1109
|
-
// after that.
|
|
1110
|
-
requestAnimationFrameWithTimeout(animationTick);
|
|
1111
|
-
} else {
|
|
1112
|
-
// No pending work. Exit.
|
|
1113
|
-
isAnimationFrameScheduled = false;
|
|
1114
|
-
return;
|
|
1115
|
-
}
|
|
1095
|
+
function unstable_cancelCallback(callbackNode) {
|
|
1096
|
+
var next = callbackNode.next;
|
|
1097
|
+
if (next === null) {
|
|
1098
|
+
// Already cancelled.
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1116
1101
|
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
// If one frame goes long, then the next one can be short to catch up.
|
|
1125
|
-
// If two frames are short in a row, then that's an indication that we
|
|
1126
|
-
// actually have a higher frame rate than what we're currently optimizing.
|
|
1127
|
-
// We adjust our heuristic dynamically accordingly. For example, if we're
|
|
1128
|
-
// running on 120hz display or 90hz VR display.
|
|
1129
|
-
// Take the max of the two in case one of them was an anomaly due to
|
|
1130
|
-
// missed frame deadlines.
|
|
1131
|
-
activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
|
|
1132
|
-
} else {
|
|
1133
|
-
previousFrameTime = nextFrameTime;
|
|
1134
|
-
}
|
|
1135
|
-
frameDeadline = rafTime + activeFrameTime;
|
|
1136
|
-
if (!isMessageEventScheduled) {
|
|
1137
|
-
isMessageEventScheduled = true;
|
|
1138
|
-
port.postMessage(undefined);
|
|
1102
|
+
if (next === callbackNode) {
|
|
1103
|
+
// This is the only scheduled callback. Clear the list.
|
|
1104
|
+
firstCallbackNode = null;
|
|
1105
|
+
} else {
|
|
1106
|
+
// Remove the callback from its position in the list.
|
|
1107
|
+
if (callbackNode === firstCallbackNode) {
|
|
1108
|
+
firstCallbackNode = next;
|
|
1139
1109
|
}
|
|
1140
|
-
|
|
1110
|
+
var previous = callbackNode.previous;
|
|
1111
|
+
previous.next = next;
|
|
1112
|
+
next.previous = previous;
|
|
1113
|
+
}
|
|
1141
1114
|
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
timeoutTime = absoluteTimeout;
|
|
1145
|
-
if (isFlushingHostCallback || absoluteTimeout < 0) {
|
|
1146
|
-
// Don't wait for the next frame. Continue working ASAP, in a new event.
|
|
1147
|
-
port.postMessage(undefined);
|
|
1148
|
-
} else if (!isAnimationFrameScheduled) {
|
|
1149
|
-
// If rAF didn't already schedule one, we need to schedule a frame.
|
|
1150
|
-
// TODO: If this rAF doesn't materialize because the browser throttles, we
|
|
1151
|
-
// might want to still have setTimeout trigger rIC as a backup to ensure
|
|
1152
|
-
// that we keep performing work.
|
|
1153
|
-
isAnimationFrameScheduled = true;
|
|
1154
|
-
requestAnimationFrameWithTimeout(animationTick);
|
|
1155
|
-
}
|
|
1156
|
-
};
|
|
1115
|
+
callbackNode.next = callbackNode.previous = null;
|
|
1116
|
+
}
|
|
1157
1117
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
isMessageEventScheduled = false;
|
|
1161
|
-
timeoutTime = -1;
|
|
1162
|
-
};
|
|
1118
|
+
function unstable_getCurrentPriorityLevel() {
|
|
1119
|
+
return currentPriorityLevel;
|
|
1163
1120
|
}
|
|
1164
1121
|
|
|
1122
|
+
function unstable_shouldYield() {
|
|
1123
|
+
return !currentHostCallbackDidTimeout && (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime || shouldYieldToHost());
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
var Scheduler = Object.freeze({
|
|
1129
|
+
unstable_ImmediatePriority: ImmediatePriority,
|
|
1130
|
+
unstable_UserBlockingPriority: UserBlockingPriority,
|
|
1131
|
+
unstable_NormalPriority: NormalPriority,
|
|
1132
|
+
unstable_IdlePriority: IdlePriority,
|
|
1133
|
+
unstable_LowPriority: LowPriority,
|
|
1134
|
+
unstable_runWithPriority: unstable_runWithPriority,
|
|
1135
|
+
unstable_next: unstable_next,
|
|
1136
|
+
unstable_scheduleCallback: unstable_scheduleCallback,
|
|
1137
|
+
unstable_cancelCallback: unstable_cancelCallback,
|
|
1138
|
+
unstable_wrapCallback: unstable_wrapCallback,
|
|
1139
|
+
unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
|
|
1140
|
+
unstable_shouldYield: unstable_shouldYield,
|
|
1141
|
+
unstable_continueExecution: unstable_continueExecution,
|
|
1142
|
+
unstable_pauseExecution: unstable_pauseExecution,
|
|
1143
|
+
unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
|
|
1144
|
+
get unstable_now () { return getCurrentTime; }
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1165
1147
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
1166
1148
|
|
|
1167
1149
|
|
|
@@ -1193,6 +1175,12 @@ var enableSchedulerTracing = true;
|
|
|
1193
1175
|
// Only used in www builds.
|
|
1194
1176
|
|
|
1195
1177
|
|
|
1178
|
+
// Disable javascript: URL strings in href for XSS protection.
|
|
1179
|
+
|
|
1180
|
+
|
|
1181
|
+
// Disables yielding during render in Concurrent Mode. Used for debugging only.
|
|
1182
|
+
|
|
1183
|
+
|
|
1196
1184
|
// React Fire: prevent the value and checked attributes from syncing
|
|
1197
1185
|
// with their related DOM properties
|
|
1198
1186
|
|
|
@@ -1201,6 +1189,18 @@ var enableSchedulerTracing = true;
|
|
|
1201
1189
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
1202
1190
|
var enableStableConcurrentModeAPIs = false;
|
|
1203
1191
|
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
1195
|
+
// This is a flag so we can fix warnings in RN core before turning it on
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
// Experimental React Events support. Only used in www builds for now.
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
// Enables rewritten version of ReactFiberScheduler. Added in case we need to
|
|
1202
|
+
// quickly revert it.
|
|
1203
|
+
|
|
1204
1204
|
var DEFAULT_THREAD_ID = 0;
|
|
1205
1205
|
|
|
1206
1206
|
// Counters used to generate unique IDs.
|
|
@@ -1558,6 +1558,20 @@ function onWorkCanceled(interactions, threadID) {
|
|
|
1558
1558
|
}
|
|
1559
1559
|
}
|
|
1560
1560
|
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
var SchedulerTracing = Object.freeze({
|
|
1564
|
+
get __interactionsRef () { return interactionsRef; },
|
|
1565
|
+
get __subscriberRef () { return subscriberRef; },
|
|
1566
|
+
unstable_clear: unstable_clear,
|
|
1567
|
+
unstable_getCurrent: unstable_getCurrent,
|
|
1568
|
+
unstable_getThreadID: unstable_getThreadID,
|
|
1569
|
+
unstable_trace: unstable_trace,
|
|
1570
|
+
unstable_wrap: unstable_wrap,
|
|
1571
|
+
unstable_subscribe: unstable_subscribe,
|
|
1572
|
+
unstable_unsubscribe: unstable_unsubscribe
|
|
1573
|
+
});
|
|
1574
|
+
|
|
1561
1575
|
/**
|
|
1562
1576
|
* Keeps track of the current dispatcher.
|
|
1563
1577
|
*/
|
|
@@ -1670,6 +1684,27 @@ function getComponentName(type) {
|
|
|
1670
1684
|
if (resolvedThenable) {
|
|
1671
1685
|
return getComponentName(resolvedThenable);
|
|
1672
1686
|
}
|
|
1687
|
+
break;
|
|
1688
|
+
}
|
|
1689
|
+
case REACT_EVENT_COMPONENT_TYPE:
|
|
1690
|
+
{
|
|
1691
|
+
var eventComponent = type;
|
|
1692
|
+
var displayName = eventComponent.displayName;
|
|
1693
|
+
if (displayName !== undefined) {
|
|
1694
|
+
return displayName;
|
|
1695
|
+
}
|
|
1696
|
+
break;
|
|
1697
|
+
}
|
|
1698
|
+
case REACT_EVENT_TARGET_TYPE:
|
|
1699
|
+
{
|
|
1700
|
+
var eventTarget = type;
|
|
1701
|
+
if (eventTarget.type === REACT_EVENT_TARGET_TOUCH_HIT) {
|
|
1702
|
+
return 'TouchHitTarget';
|
|
1703
|
+
}
|
|
1704
|
+
var _displayName = eventTarget.displayName;
|
|
1705
|
+
if (_displayName !== undefined) {
|
|
1706
|
+
return _displayName;
|
|
1707
|
+
}
|
|
1673
1708
|
}
|
|
1674
1709
|
}
|
|
1675
1710
|
}
|
|
@@ -1713,6 +1748,8 @@ function setCurrentlyValidatingElement(element) {
|
|
|
1713
1748
|
var ReactSharedInternals = {
|
|
1714
1749
|
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
1715
1750
|
ReactCurrentOwner: ReactCurrentOwner,
|
|
1751
|
+
// used by act()
|
|
1752
|
+
ReactShouldWarnActingUpdates: { current: false },
|
|
1716
1753
|
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
1717
1754
|
assign: objectAssign
|
|
1718
1755
|
};
|
|
@@ -1724,35 +1761,8 @@ var ReactSharedInternals = {
|
|
|
1724
1761
|
// This re-export is only required for UMD bundles;
|
|
1725
1762
|
// CJS bundles use the shared NPM package.
|
|
1726
1763
|
objectAssign(ReactSharedInternals, {
|
|
1727
|
-
Scheduler:
|
|
1728
|
-
|
|
1729
|
-
unstable_shouldYield: unstable_shouldYield,
|
|
1730
|
-
unstable_now: getCurrentTime,
|
|
1731
|
-
unstable_scheduleCallback: unstable_scheduleCallback,
|
|
1732
|
-
unstable_runWithPriority: unstable_runWithPriority,
|
|
1733
|
-
unstable_next: unstable_next,
|
|
1734
|
-
unstable_wrapCallback: unstable_wrapCallback,
|
|
1735
|
-
unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
|
|
1736
|
-
unstable_pauseExecution: unstable_pauseExecution,
|
|
1737
|
-
unstable_continueExecution: unstable_continueExecution,
|
|
1738
|
-
unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
|
|
1739
|
-
unstable_IdlePriority: IdlePriority,
|
|
1740
|
-
unstable_ImmediatePriority: ImmediatePriority,
|
|
1741
|
-
unstable_LowPriority: LowPriority,
|
|
1742
|
-
unstable_NormalPriority: NormalPriority,
|
|
1743
|
-
unstable_UserBlockingPriority: UserBlockingPriority
|
|
1744
|
-
},
|
|
1745
|
-
SchedulerTracing: {
|
|
1746
|
-
__interactionsRef: interactionsRef,
|
|
1747
|
-
__subscriberRef: subscriberRef,
|
|
1748
|
-
unstable_clear: unstable_clear,
|
|
1749
|
-
unstable_getCurrent: unstable_getCurrent,
|
|
1750
|
-
unstable_getThreadID: unstable_getThreadID,
|
|
1751
|
-
unstable_subscribe: unstable_subscribe,
|
|
1752
|
-
unstable_trace: unstable_trace,
|
|
1753
|
-
unstable_unsubscribe: unstable_unsubscribe,
|
|
1754
|
-
unstable_wrap: unstable_wrap
|
|
1755
|
-
}
|
|
1764
|
+
Scheduler: Scheduler,
|
|
1765
|
+
SchedulerTracing: SchedulerTracing
|
|
1756
1766
|
});
|
|
1757
1767
|
}
|
|
1758
1768
|
|
|
@@ -2025,7 +2035,13 @@ function cloneAndReplaceKey(oldElement, newKey) {
|
|
|
2025
2035
|
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
2026
2036
|
*/
|
|
2027
2037
|
function cloneElement(element, config, children) {
|
|
2028
|
-
|
|
2038
|
+
(function () {
|
|
2039
|
+
if (!!(element === null || element === undefined)) {
|
|
2040
|
+
{
|
|
2041
|
+
throw ReactError('React.cloneElement(...): The argument must be a React element, but you passed ' + element + '.');
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
})();
|
|
2029
2045
|
|
|
2030
2046
|
var propName = void 0;
|
|
2031
2047
|
|
|
@@ -2245,7 +2261,13 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
2245
2261
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
2246
2262
|
}
|
|
2247
2263
|
var childrenString = '' + children;
|
|
2248
|
-
|
|
2264
|
+
(function () {
|
|
2265
|
+
{
|
|
2266
|
+
{
|
|
2267
|
+
throw ReactError('Objects are not valid as a React child (found: ' + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ').' + addendum);
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
})();
|
|
2249
2271
|
}
|
|
2250
2272
|
}
|
|
2251
2273
|
|
|
@@ -2421,7 +2443,13 @@ function toArray(children) {
|
|
|
2421
2443
|
* structure.
|
|
2422
2444
|
*/
|
|
2423
2445
|
function onlyChild(children) {
|
|
2424
|
-
|
|
2446
|
+
(function () {
|
|
2447
|
+
if (!isValidElement(children)) {
|
|
2448
|
+
{
|
|
2449
|
+
throw ReactError('React.Children.only expected to receive a single React element child.');
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
})();
|
|
2425
2453
|
return children;
|
|
2426
2454
|
}
|
|
2427
2455
|
|
|
@@ -2603,7 +2631,7 @@ function forwardRef(render) {
|
|
|
2603
2631
|
function isValidElementType(type) {
|
|
2604
2632
|
return typeof type === 'string' || typeof type === 'function' ||
|
|
2605
2633
|
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
2606
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_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);
|
|
2634
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_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_EVENT_COMPONENT_TYPE || type.$$typeof === REACT_EVENT_TARGET_TYPE);
|
|
2607
2635
|
}
|
|
2608
2636
|
|
|
2609
2637
|
function memo(type, compare) {
|
|
@@ -2621,7 +2649,13 @@ function memo(type, compare) {
|
|
|
2621
2649
|
|
|
2622
2650
|
function resolveDispatcher() {
|
|
2623
2651
|
var dispatcher = ReactCurrentDispatcher.current;
|
|
2624
|
-
|
|
2652
|
+
(function () {
|
|
2653
|
+
if (!(dispatcher !== null)) {
|
|
2654
|
+
{
|
|
2655
|
+
throw ReactError('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.');
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
})();
|
|
2625
2659
|
return dispatcher;
|
|
2626
2660
|
}
|
|
2627
2661
|
|
|
@@ -3080,6 +3114,44 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
3080
3114
|
return newElement;
|
|
3081
3115
|
}
|
|
3082
3116
|
|
|
3117
|
+
function noop() {}
|
|
3118
|
+
|
|
3119
|
+
var error = noop;
|
|
3120
|
+
var warn = noop;
|
|
3121
|
+
{
|
|
3122
|
+
var ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
3123
|
+
|
|
3124
|
+
error = function () {
|
|
3125
|
+
var stack = ReactDebugCurrentFrame$2.getStackAddendum();
|
|
3126
|
+
if (stack !== '') {
|
|
3127
|
+
var length = arguments.length;
|
|
3128
|
+
var args = new Array(length + 1);
|
|
3129
|
+
for (var i = 0; i < length; i++) {
|
|
3130
|
+
args[i] = arguments[i];
|
|
3131
|
+
}
|
|
3132
|
+
args[length] = stack;
|
|
3133
|
+
console.error.apply(console, args);
|
|
3134
|
+
} else {
|
|
3135
|
+
console.error.apply(console, arguments);
|
|
3136
|
+
}
|
|
3137
|
+
};
|
|
3138
|
+
|
|
3139
|
+
warn = function () {
|
|
3140
|
+
var stack = ReactDebugCurrentFrame$2.getStackAddendum();
|
|
3141
|
+
if (stack !== '') {
|
|
3142
|
+
var length = arguments.length;
|
|
3143
|
+
var args = new Array(length + 1);
|
|
3144
|
+
for (var i = 0; i < length; i++) {
|
|
3145
|
+
args[i] = arguments[i];
|
|
3146
|
+
}
|
|
3147
|
+
args[length] = stack;
|
|
3148
|
+
console.warn.apply(console, args);
|
|
3149
|
+
} else {
|
|
3150
|
+
console.warn.apply(console, arguments);
|
|
3151
|
+
}
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3083
3155
|
var React = {
|
|
3084
3156
|
Children: {
|
|
3085
3157
|
map: mapChildren,
|
|
@@ -3098,6 +3170,9 @@ var React = {
|
|
|
3098
3170
|
lazy: lazy,
|
|
3099
3171
|
memo: memo,
|
|
3100
3172
|
|
|
3173
|
+
error: error,
|
|
3174
|
+
warn: warn,
|
|
3175
|
+
|
|
3101
3176
|
useCallback: useCallback,
|
|
3102
3177
|
useContext: useContext,
|
|
3103
3178
|
useEffect: useEffect,
|
|
@@ -3110,6 +3185,7 @@ var React = {
|
|
|
3110
3185
|
useState: useState,
|
|
3111
3186
|
|
|
3112
3187
|
Fragment: REACT_FRAGMENT_TYPE,
|
|
3188
|
+
Profiler: REACT_PROFILER_TYPE,
|
|
3113
3189
|
StrictMode: REACT_STRICT_MODE_TYPE,
|
|
3114
3190
|
Suspense: REACT_SUSPENSE_TYPE,
|
|
3115
3191
|
|
|
@@ -3121,7 +3197,6 @@ var React = {
|
|
|
3121
3197
|
version: ReactVersion,
|
|
3122
3198
|
|
|
3123
3199
|
unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
|
|
3124
|
-
unstable_Profiler: REACT_PROFILER_TYPE,
|
|
3125
3200
|
|
|
3126
3201
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
3127
3202
|
};
|
|
@@ -3133,9 +3208,7 @@ var React = {
|
|
|
3133
3208
|
|
|
3134
3209
|
if (enableStableConcurrentModeAPIs) {
|
|
3135
3210
|
React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
3136
|
-
React.Profiler = REACT_PROFILER_TYPE;
|
|
3137
3211
|
React.unstable_ConcurrentMode = undefined;
|
|
3138
|
-
React.unstable_Profiler = undefined;
|
|
3139
3212
|
}
|
|
3140
3213
|
|
|
3141
3214
|
|