react 16.4.0 → 16.5.1
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/LICENSE +1 -1
- package/README.md +4 -7
- package/cjs/react.development.js +424 -172
- package/cjs/react.production.min.js +17 -15
- package/cjs/react.profiling.min.js +24 -0
- package/package.json +3 -3
- package/umd/react.development.js +1273 -377
- package/umd/react.production.min.js +21 -16
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.5.1
|
|
2
2
|
* react.production.min.js
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
'use strict';var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
'use strict';var m=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.async_mode"):60111,y=n?Symbol.for("react.forward_ref"):60112;n&&Symbol.for("react.placeholder");
|
|
11
|
+
var z="function"===typeof Symbol&&Symbol.iterator;function A(a,b,d,c,e,g,h,f){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var k=[d,c,e,g,h,f],l=0;a=Error(b.replace(/%s/g,function(){return k[l++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
|
|
12
|
+
function B(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);A(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D={};
|
|
13
|
+
function E(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C}E.prototype.isReactComponent={};E.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?B("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C}var H=G.prototype=new F;
|
|
14
|
+
H.constructor=G;m(H,E.prototype);H.isPureReactComponent=!0;var I={current:null,currentDispatcher:null},J=Object.prototype.hasOwnProperty,K={key:!0,ref:!0,__self:!0,__source:!0};
|
|
15
|
+
function L(a,b,d){var c=void 0,e={},g=null,h=null;if(null!=b)for(c in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(g=""+b.key),b)J.call(b,c)&&!K.hasOwnProperty(c)&&(e[c]=b[c]);var f=arguments.length-2;if(1===f)e.children=d;else if(1<f){for(var k=Array(f),l=0;l<f;l++)k[l]=arguments[l+2];e.children=k}if(a&&a.defaultProps)for(c in f=a.defaultProps,f)void 0===e[c]&&(e[c]=f[c]);return{$$typeof:p,type:a,key:g,ref:h,props:e,_owner:I.current}}
|
|
16
|
+
function M(a,b){return{$$typeof:p,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function N(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 O=/\/+/g,P=[];function Q(a,b,d,c){if(P.length){var e=P.pop();e.result=a;e.keyPrefix=b;e.func=d;e.context=c;e.count=0;return e}return{result:a,keyPrefix:b,func:d,context:c,count:0}}
|
|
17
|
+
function R(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>P.length&&P.push(a)}
|
|
18
|
+
function S(a,b,d,c){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 d(c,a,""===b?"."+T(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var h=0;h<a.length;h++){e=a[h];var f=b+T(e,h);g+=S(e,f,d,c)}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),h=
|
|
19
|
+
0;!(e=a.next()).done;)e=e.value,f=b+T(e,h++),g+=S(e,f,d,c);else"object"===e&&(d=""+a,B("31","[object Object]"===d?"object with keys {"+Object.keys(a).join(", ")+"}":d,""));return g}function U(a,b,d){return null==a?0:S(a,"",b,d)}function T(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function V(a,b){a.func.call(a.context,b,a.count++)}
|
|
20
|
+
function aa(a,b,d){var c=a.result,e=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?W(a,c,d,function(a){return a}):null!=a&&(N(a)&&(a=M(a,e+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(O,"$&/")+"/")+d)),c.push(a))}function W(a,b,d,c,e){var g="";null!=d&&(g=(""+d).replace(O,"$&/")+"/");b=Q(b,g,c,e);U(a,aa,b);R(b)}function ba(a,b){var d=I.currentDispatcher;null===d?B("277"):void 0;return d.readContext(a,b)}
|
|
21
|
+
var X={Children:{map:function(a,b,d){if(null==a)return a;var c=[];W(a,c,null,b,d);return c},forEach:function(a,b,d){if(null==a)return a;b=Q(null,null,b,d);U(a,V,b);R(b)},count:function(a){return U(a,function(){return null},null)},toArray:function(a){var b=[];W(a,b,null,function(a){return a});return b},only:function(a){N(a)?void 0:B("143");return a}},createRef:function(){return{current:null}},Component:E,PureComponent:G,createContext:function(a,b){void 0===b&&(b=null);a={$$typeof:w,_calculateChangedBits:b,
|
|
22
|
+
_currentValue:a,_currentValue2:a,Provider:null,Consumer:null,unstable_read:null};a.Provider={$$typeof:v,_context:a};a.Consumer=a;a.unstable_read=ba.bind(null,a);return a},forwardRef:function(a){return{$$typeof:y,render:a}},Fragment:r,StrictMode:t,unstable_AsyncMode:x,unstable_Profiler:u,createElement:L,cloneElement:function(a,b,d){null===a||void 0===a?B("267",a):void 0;var c=void 0,e=m({},a.props),g=a.key,h=a.ref,f=a._owner;if(null!=b){void 0!==b.ref&&(h=b.ref,f=I.current);void 0!==b.key&&(g=""+b.key);
|
|
23
|
+
var k=void 0;a.type&&a.type.defaultProps&&(k=a.type.defaultProps);for(c in b)J.call(b,c)&&!K.hasOwnProperty(c)&&(e[c]=void 0===b[c]&&void 0!==k?k[c]:b[c])}c=arguments.length-2;if(1===c)e.children=d;else if(1<c){k=Array(c);for(var l=0;l<c;l++)k[l]=arguments[l+2];e.children=k}return{$$typeof:p,type:a.type,key:g,ref:h,props:e,_owner:f}},createFactory:function(a){var b=L.bind(null,a);b.type=a;return b},isValidElement:N,version:"16.5.1",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:I,
|
|
24
|
+
assign:m}},Y={default:X},Z=Y&&X||Y;module.exports=Z.default||Z;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @license React v16.5.1
|
|
2
|
+
* react.profiling.min.js
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';var m=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.async_mode"):60111,y=n?Symbol.for("react.forward_ref"):60112;n&&Symbol.for("react.placeholder");
|
|
11
|
+
var z="function"===typeof Symbol&&Symbol.iterator;function A(a,b,d,c,e,g,h,f){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var k=[d,c,e,g,h,f],l=0;a=Error(b.replace(/%s/g,function(){return k[l++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
|
|
12
|
+
function B(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);A(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D={};
|
|
13
|
+
function E(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C}E.prototype.isReactComponent={};E.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?B("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C}var H=G.prototype=new F;
|
|
14
|
+
H.constructor=G;m(H,E.prototype);H.isPureReactComponent=!0;var I={current:null,currentDispatcher:null},J=Object.prototype.hasOwnProperty,K={key:!0,ref:!0,__self:!0,__source:!0};
|
|
15
|
+
function L(a,b,d){var c=void 0,e={},g=null,h=null;if(null!=b)for(c in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(g=""+b.key),b)J.call(b,c)&&!K.hasOwnProperty(c)&&(e[c]=b[c]);var f=arguments.length-2;if(1===f)e.children=d;else if(1<f){for(var k=Array(f),l=0;l<f;l++)k[l]=arguments[l+2];e.children=k}if(a&&a.defaultProps)for(c in f=a.defaultProps,f)void 0===e[c]&&(e[c]=f[c]);return{$$typeof:p,type:a,key:g,ref:h,props:e,_owner:I.current}}
|
|
16
|
+
function M(a,b){return{$$typeof:p,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function N(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 O=/\/+/g,P=[];function Q(a,b,d,c){if(P.length){var e=P.pop();e.result=a;e.keyPrefix=b;e.func=d;e.context=c;e.count=0;return e}return{result:a,keyPrefix:b,func:d,context:c,count:0}}
|
|
17
|
+
function R(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>P.length&&P.push(a)}
|
|
18
|
+
function S(a,b,d,c){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 d(c,a,""===b?"."+T(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var h=0;h<a.length;h++){e=a[h];var f=b+T(e,h);g+=S(e,f,d,c)}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),h=
|
|
19
|
+
0;!(e=a.next()).done;)e=e.value,f=b+T(e,h++),g+=S(e,f,d,c);else"object"===e&&(d=""+a,B("31","[object Object]"===d?"object with keys {"+Object.keys(a).join(", ")+"}":d,""));return g}function U(a,b,d){return null==a?0:S(a,"",b,d)}function T(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function V(a,b){a.func.call(a.context,b,a.count++)}
|
|
20
|
+
function aa(a,b,d){var c=a.result,e=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?W(a,c,d,function(a){return a}):null!=a&&(N(a)&&(a=M(a,e+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(O,"$&/")+"/")+d)),c.push(a))}function W(a,b,d,c,e){var g="";null!=d&&(g=(""+d).replace(O,"$&/")+"/");b=Q(b,g,c,e);U(a,aa,b);R(b)}function ba(a,b){var d=I.currentDispatcher;null===d?B("277"):void 0;return d.readContext(a,b)}
|
|
21
|
+
var X={Children:{map:function(a,b,d){if(null==a)return a;var c=[];W(a,c,null,b,d);return c},forEach:function(a,b,d){if(null==a)return a;b=Q(null,null,b,d);U(a,V,b);R(b)},count:function(a){return U(a,function(){return null},null)},toArray:function(a){var b=[];W(a,b,null,function(a){return a});return b},only:function(a){N(a)?void 0:B("143");return a}},createRef:function(){return{current:null}},Component:E,PureComponent:G,createContext:function(a,b){void 0===b&&(b=null);a={$$typeof:w,_calculateChangedBits:b,
|
|
22
|
+
_currentValue:a,_currentValue2:a,Provider:null,Consumer:null,unstable_read:null};a.Provider={$$typeof:v,_context:a};a.Consumer=a;a.unstable_read=ba.bind(null,a);return a},forwardRef:function(a){return{$$typeof:y,render:a}},Fragment:r,StrictMode:t,unstable_AsyncMode:x,unstable_Profiler:u,createElement:L,cloneElement:function(a,b,d){null===a||void 0===a?B("267",a):void 0;var c=void 0,e=m({},a.props),g=a.key,h=a.ref,f=a._owner;if(null!=b){void 0!==b.ref&&(h=b.ref,f=I.current);void 0!==b.key&&(g=""+b.key);
|
|
23
|
+
var k=void 0;a.type&&a.type.defaultProps&&(k=a.type.defaultProps);for(c in b)J.call(b,c)&&!K.hasOwnProperty(c)&&(e[c]=void 0===b[c]&&void 0!==k?k[c]:b[c])}c=arguments.length-2;if(1===c)e.children=d;else if(1<c){k=Array(c);for(var l=0;l<c;l++)k[l]=arguments[l+2];e.children=k}return{$$typeof:p,type:a.type,key:g,ref:h,props:e,_owner:f}},createFactory:function(a){var b=L.bind(null,a);b.type=a;return b},isValidElement:N,version:"16.5.1",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:I,
|
|
24
|
+
assign:m}},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.5.1",
|
|
8
8
|
"homepage": "https://reactjs.org/",
|
|
9
9
|
"bugs": "https://github.com/facebook/react/issues",
|
|
10
10
|
"license": "MIT",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"node": ">=0.10.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"fbjs": "^0.8.16",
|
|
25
24
|
"loose-envify": "^1.1.0",
|
|
26
25
|
"object-assign": "^4.1.1",
|
|
27
|
-
"prop-types": "^15.6.
|
|
26
|
+
"prop-types": "^15.6.2",
|
|
27
|
+
"schedule": "^0.4.0"
|
|
28
28
|
},
|
|
29
29
|
"browserify": {
|
|
30
30
|
"transform": [
|
package/umd/react.development.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.5.1
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -15,6 +15,81 @@
|
|
|
15
15
|
(global.React = factory());
|
|
16
16
|
}(this, (function () { 'use strict';
|
|
17
17
|
|
|
18
|
+
// TODO: this is special because it gets imported during build.
|
|
19
|
+
|
|
20
|
+
var ReactVersion = '16.5.1';
|
|
21
|
+
|
|
22
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
23
|
+
// nor polyfill, then a plain number is used for performance.
|
|
24
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
25
|
+
|
|
26
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
27
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
28
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
29
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
30
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
31
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
32
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
33
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
34
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
35
|
+
var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
|
|
36
|
+
|
|
37
|
+
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
38
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
39
|
+
|
|
40
|
+
function getIteratorFn(maybeIterable) {
|
|
41
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
45
|
+
if (typeof maybeIterator === 'function') {
|
|
46
|
+
return maybeIterator;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Exports ReactDOM.createRoot
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// Experimental error-boundary API that can recover from errors within a single
|
|
55
|
+
// render phase
|
|
56
|
+
|
|
57
|
+
// Suspense
|
|
58
|
+
var enableSuspense = false;
|
|
59
|
+
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
// In some cases, StrictMode should also double-render lifecycles.
|
|
63
|
+
// This can be confusing for tests though,
|
|
64
|
+
// And it can be bad for performance in production.
|
|
65
|
+
// This feature flag can be used to control the behavior:
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
69
|
+
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
// Warn about legacy context API
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
// Gather advanced timing metrics for Profiler subtrees.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
// Track which interactions trigger each commit.
|
|
82
|
+
var enableSchedulerTracking = true;
|
|
83
|
+
|
|
84
|
+
// Only used in www builds.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
// Only used in www builds.
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// React Fire: prevent the value and checked attributes from syncing
|
|
91
|
+
// with their related DOM properties
|
|
92
|
+
|
|
18
93
|
/*
|
|
19
94
|
object-assign
|
|
20
95
|
(c) Sindre Sorhus
|
|
@@ -106,49 +181,6 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
|
|
|
106
181
|
return to;
|
|
107
182
|
};
|
|
108
183
|
|
|
109
|
-
// TODO: this is special because it gets imported during build.
|
|
110
|
-
|
|
111
|
-
var ReactVersion = '16.4.0';
|
|
112
|
-
|
|
113
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
114
|
-
// nor polyfill, then a plain number is used for performance.
|
|
115
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
116
|
-
|
|
117
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
118
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
119
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
120
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
121
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
122
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
123
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
124
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
125
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
126
|
-
var REACT_TIMEOUT_TYPE = hasSymbol ? Symbol.for('react.timeout') : 0xead1;
|
|
127
|
-
|
|
128
|
-
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
129
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
130
|
-
|
|
131
|
-
function getIteratorFn(maybeIterable) {
|
|
132
|
-
if (maybeIterable === null || typeof maybeIterable === 'undefined') {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
136
|
-
if (typeof maybeIterator === 'function') {
|
|
137
|
-
return maybeIterator;
|
|
138
|
-
}
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
144
|
-
*
|
|
145
|
-
* This source code is licensed under the MIT license found in the
|
|
146
|
-
* LICENSE file in the root directory of this source tree.
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
184
|
/**
|
|
153
185
|
* Use invariant() to assert state which your program assumes to be true.
|
|
154
186
|
*
|
|
@@ -160,10 +192,10 @@ function getIteratorFn(maybeIterable) {
|
|
|
160
192
|
* will remain to ensure logic does not differ in production.
|
|
161
193
|
*/
|
|
162
194
|
|
|
163
|
-
var validateFormat = function
|
|
195
|
+
var validateFormat = function () {};
|
|
164
196
|
|
|
165
197
|
{
|
|
166
|
-
validateFormat = function
|
|
198
|
+
validateFormat = function (format) {
|
|
167
199
|
if (format === undefined) {
|
|
168
200
|
throw new Error('invariant requires an error message argument');
|
|
169
201
|
}
|
|
@@ -174,7 +206,7 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
174
206
|
validateFormat(format);
|
|
175
207
|
|
|
176
208
|
if (!condition) {
|
|
177
|
-
var error;
|
|
209
|
+
var error = void 0;
|
|
178
210
|
if (format === undefined) {
|
|
179
211
|
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
180
212
|
} else {
|
|
@@ -191,63 +223,8 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
191
223
|
}
|
|
192
224
|
}
|
|
193
225
|
|
|
194
|
-
var invariant_1 = invariant;
|
|
195
|
-
|
|
196
226
|
// Relying on the `invariant()` implementation lets us
|
|
197
|
-
//
|
|
198
|
-
|
|
199
|
-
// Exports ReactDOM.createRoot
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
// Experimental error-boundary API that can recover from errors within a single
|
|
203
|
-
// render phase
|
|
204
|
-
|
|
205
|
-
// Suspense
|
|
206
|
-
var enableSuspense = false;
|
|
207
|
-
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
// In some cases, StrictMode should also double-render lifecycles.
|
|
211
|
-
// This can be confusing for tests though,
|
|
212
|
-
// And it can be bad for performance in production.
|
|
213
|
-
// This feature flag can be used to control the behavior:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
217
|
-
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
// Warn about legacy context API
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
// Gather advanced timing metrics for Profiler subtrees.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
// Fires getDerivedStateFromProps for state *or* props changes
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
// Only used in www builds.
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
236
|
-
*
|
|
237
|
-
* This source code is licensed under the MIT license found in the
|
|
238
|
-
* LICENSE file in the root directory of this source tree.
|
|
239
|
-
*
|
|
240
|
-
*/
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
var emptyObject = {};
|
|
245
|
-
|
|
246
|
-
{
|
|
247
|
-
Object.freeze(emptyObject);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
var emptyObject_1 = emptyObject;
|
|
227
|
+
// preserve the format and params in the www builds.
|
|
251
228
|
|
|
252
229
|
/**
|
|
253
230
|
* Forked from fbjs/warning:
|
|
@@ -288,7 +265,7 @@ var lowPriorityWarning = function () {};
|
|
|
288
265
|
|
|
289
266
|
lowPriorityWarning = function (condition, format) {
|
|
290
267
|
if (format === undefined) {
|
|
291
|
-
throw new Error('`
|
|
268
|
+
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
292
269
|
}
|
|
293
270
|
if (!condition) {
|
|
294
271
|
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
@@ -302,53 +279,6 @@ var lowPriorityWarning = function () {};
|
|
|
302
279
|
|
|
303
280
|
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
304
281
|
|
|
305
|
-
/**
|
|
306
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
307
|
-
*
|
|
308
|
-
* This source code is licensed under the MIT license found in the
|
|
309
|
-
* LICENSE file in the root directory of this source tree.
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*/
|
|
313
|
-
|
|
314
|
-
function makeEmptyFunction(arg) {
|
|
315
|
-
return function () {
|
|
316
|
-
return arg;
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* This function accepts and discards inputs; it has no side effects. This is
|
|
322
|
-
* primarily useful idiomatically for overridable function endpoints which
|
|
323
|
-
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
|
324
|
-
*/
|
|
325
|
-
var emptyFunction = function emptyFunction() {};
|
|
326
|
-
|
|
327
|
-
emptyFunction.thatReturns = makeEmptyFunction;
|
|
328
|
-
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
|
329
|
-
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
|
330
|
-
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
|
331
|
-
emptyFunction.thatReturnsThis = function () {
|
|
332
|
-
return this;
|
|
333
|
-
};
|
|
334
|
-
emptyFunction.thatReturnsArgument = function (arg) {
|
|
335
|
-
return arg;
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
var emptyFunction_1 = emptyFunction;
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
342
|
-
*
|
|
343
|
-
* This source code is licensed under the MIT license found in the
|
|
344
|
-
* LICENSE file in the root directory of this source tree.
|
|
345
|
-
*
|
|
346
|
-
*/
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
282
|
/**
|
|
353
283
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
354
284
|
* This can be used to log issues in development environments in critical
|
|
@@ -356,49 +286,87 @@ var emptyFunction_1 = emptyFunction;
|
|
|
356
286
|
* same logic and follow the same code paths.
|
|
357
287
|
*/
|
|
358
288
|
|
|
359
|
-
var
|
|
289
|
+
var warningWithoutStack = function () {};
|
|
360
290
|
|
|
361
291
|
{
|
|
362
|
-
|
|
363
|
-
for (var _len = arguments.length, args = Array(_len >
|
|
364
|
-
args[_key -
|
|
292
|
+
warningWithoutStack = function (condition, format) {
|
|
293
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
294
|
+
args[_key - 2] = arguments[_key];
|
|
365
295
|
}
|
|
366
296
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
297
|
+
if (format === undefined) {
|
|
298
|
+
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
299
|
+
}
|
|
300
|
+
if (args.length > 8) {
|
|
301
|
+
// Check before the condition to catch violations early.
|
|
302
|
+
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
|
303
|
+
}
|
|
304
|
+
if (condition) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
371
307
|
if (typeof console !== 'undefined') {
|
|
372
|
-
|
|
308
|
+
var _args$map = args.map(function (item) {
|
|
309
|
+
return '' + item;
|
|
310
|
+
}),
|
|
311
|
+
a = _args$map[0],
|
|
312
|
+
b = _args$map[1],
|
|
313
|
+
c = _args$map[2],
|
|
314
|
+
d = _args$map[3],
|
|
315
|
+
e = _args$map[4],
|
|
316
|
+
f = _args$map[5],
|
|
317
|
+
g = _args$map[6],
|
|
318
|
+
h = _args$map[7];
|
|
319
|
+
|
|
320
|
+
var message = 'Warning: ' + format;
|
|
321
|
+
|
|
322
|
+
// We intentionally don't use spread (or .apply) because it breaks IE9:
|
|
323
|
+
// https://github.com/facebook/react/issues/13610
|
|
324
|
+
switch (args.length) {
|
|
325
|
+
case 0:
|
|
326
|
+
console.error(message);
|
|
327
|
+
break;
|
|
328
|
+
case 1:
|
|
329
|
+
console.error(message, a);
|
|
330
|
+
break;
|
|
331
|
+
case 2:
|
|
332
|
+
console.error(message, a, b);
|
|
333
|
+
break;
|
|
334
|
+
case 3:
|
|
335
|
+
console.error(message, a, b, c);
|
|
336
|
+
break;
|
|
337
|
+
case 4:
|
|
338
|
+
console.error(message, a, b, c, d);
|
|
339
|
+
break;
|
|
340
|
+
case 5:
|
|
341
|
+
console.error(message, a, b, c, d, e);
|
|
342
|
+
break;
|
|
343
|
+
case 6:
|
|
344
|
+
console.error(message, a, b, c, d, e, f);
|
|
345
|
+
break;
|
|
346
|
+
case 7:
|
|
347
|
+
console.error(message, a, b, c, d, e, f, g);
|
|
348
|
+
break;
|
|
349
|
+
case 8:
|
|
350
|
+
console.error(message, a, b, c, d, e, f, g, h);
|
|
351
|
+
break;
|
|
352
|
+
default:
|
|
353
|
+
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
|
354
|
+
}
|
|
373
355
|
}
|
|
374
356
|
try {
|
|
375
357
|
// --- Welcome to debugging React ---
|
|
376
358
|
// This error was thrown as a convenience so that you can use this stack
|
|
377
359
|
// to find the callsite that caused this warning to fire.
|
|
378
|
-
|
|
360
|
+
var argIndex = 0;
|
|
361
|
+
var _message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
362
|
+
return args[argIndex++];
|
|
363
|
+
});
|
|
364
|
+
throw new Error(_message);
|
|
379
365
|
} catch (x) {}
|
|
380
366
|
};
|
|
381
|
-
|
|
382
|
-
warning = function warning(condition, format) {
|
|
383
|
-
if (format === undefined) {
|
|
384
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
|
388
|
-
return; // Ignore CompositeComponent proptype check.
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
if (!condition) {
|
|
392
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
393
|
-
args[_key2 - 2] = arguments[_key2];
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
printWarning$1.apply(undefined, [format].concat(args));
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
367
|
}
|
|
400
368
|
|
|
401
|
-
var
|
|
369
|
+
var warningWithoutStack$1 = warningWithoutStack;
|
|
402
370
|
|
|
403
371
|
var didWarnStateUpdateForUnmountedComponent = {};
|
|
404
372
|
|
|
@@ -410,7 +378,7 @@ function warnNoop(publicInstance, callerName) {
|
|
|
410
378
|
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
411
379
|
return;
|
|
412
380
|
}
|
|
413
|
-
|
|
381
|
+
warningWithoutStack$1(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
|
414
382
|
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
415
383
|
}
|
|
416
384
|
}
|
|
@@ -483,13 +451,19 @@ var ReactNoopUpdateQueue = {
|
|
|
483
451
|
}
|
|
484
452
|
};
|
|
485
453
|
|
|
454
|
+
var emptyObject = {};
|
|
455
|
+
{
|
|
456
|
+
Object.freeze(emptyObject);
|
|
457
|
+
}
|
|
458
|
+
|
|
486
459
|
/**
|
|
487
460
|
* Base class helpers for the updating state of a component.
|
|
488
461
|
*/
|
|
489
462
|
function Component(props, context, updater) {
|
|
490
463
|
this.props = props;
|
|
491
464
|
this.context = context;
|
|
492
|
-
|
|
465
|
+
// If a component has string refs, we will assign a different object later.
|
|
466
|
+
this.refs = emptyObject;
|
|
493
467
|
// We initialize the default updater but the real one gets injected by the
|
|
494
468
|
// renderer.
|
|
495
469
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
@@ -523,7 +497,7 @@ Component.prototype.isReactComponent = {};
|
|
|
523
497
|
* @protected
|
|
524
498
|
*/
|
|
525
499
|
Component.prototype.setState = function (partialState, callback) {
|
|
526
|
-
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ?
|
|
500
|
+
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
|
|
527
501
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
528
502
|
};
|
|
529
503
|
|
|
@@ -561,43 +535,796 @@ Component.prototype.forceUpdate = function (callback) {
|
|
|
561
535
|
lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
562
536
|
return undefined;
|
|
563
537
|
}
|
|
564
|
-
});
|
|
565
|
-
};
|
|
566
|
-
for (var fnName in deprecatedAPIs) {
|
|
567
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
568
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
538
|
+
});
|
|
539
|
+
};
|
|
540
|
+
for (var fnName in deprecatedAPIs) {
|
|
541
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
542
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
function ComponentDummy() {}
|
|
548
|
+
ComponentDummy.prototype = Component.prototype;
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Convenience component with default shallow equality check for sCU.
|
|
552
|
+
*/
|
|
553
|
+
function PureComponent(props, context, updater) {
|
|
554
|
+
this.props = props;
|
|
555
|
+
this.context = context;
|
|
556
|
+
// If a component has string refs, we will assign a different object later.
|
|
557
|
+
this.refs = emptyObject;
|
|
558
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
562
|
+
pureComponentPrototype.constructor = PureComponent;
|
|
563
|
+
// Avoid an extra prototype jump for these methods.
|
|
564
|
+
objectAssign(pureComponentPrototype, Component.prototype);
|
|
565
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
566
|
+
|
|
567
|
+
// an immutable object with a single mutable value
|
|
568
|
+
function createRef() {
|
|
569
|
+
var refObject = {
|
|
570
|
+
current: null
|
|
571
|
+
};
|
|
572
|
+
{
|
|
573
|
+
Object.seal(refObject);
|
|
574
|
+
}
|
|
575
|
+
return refObject;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* A scheduling library to allow scheduling work with more granular priority and
|
|
582
|
+
* control than requestAnimationFrame and requestIdleCallback.
|
|
583
|
+
* Current TODO items:
|
|
584
|
+
* X- Pull out the scheduleWork polyfill built into React
|
|
585
|
+
* X- Initial test coverage
|
|
586
|
+
* X- Support for multiple callbacks
|
|
587
|
+
* - Support for two priorities; serial and deferred
|
|
588
|
+
* - Better test coverage
|
|
589
|
+
* - Better docblock
|
|
590
|
+
* - Polish documentation, API
|
|
591
|
+
*/
|
|
592
|
+
|
|
593
|
+
// This is a built-in polyfill for requestIdleCallback. It works by scheduling
|
|
594
|
+
// a requestAnimationFrame, storing the time for the start of the frame, then
|
|
595
|
+
// scheduling a postMessage which gets scheduled after paint. Within the
|
|
596
|
+
// postMessage handler do as much work as possible until time + frame rate.
|
|
597
|
+
// By separating the idle call into a separate event tick we ensure that
|
|
598
|
+
// layout, paint and other browser work is counted against the available time.
|
|
599
|
+
// The frame rate is dynamically adjusted.
|
|
600
|
+
|
|
601
|
+
// We capture a local reference to any global, in case it gets polyfilled after
|
|
602
|
+
// this module is initially evaluated.
|
|
603
|
+
// We want to be using a consistent implementation.
|
|
604
|
+
var localDate = Date;
|
|
605
|
+
|
|
606
|
+
// This initialization code may run even on server environments
|
|
607
|
+
// if a component just imports ReactDOM (e.g. for findDOMNode).
|
|
608
|
+
// Some environments might not have setTimeout or clearTimeout.
|
|
609
|
+
// However, we always expect them to be defined on the client.
|
|
610
|
+
// https://github.com/facebook/react/pull/13088
|
|
611
|
+
var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
|
|
612
|
+
var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
|
|
613
|
+
|
|
614
|
+
// We don't expect either of these to necessarily be defined,
|
|
615
|
+
// but we will error later if they are missing on the client.
|
|
616
|
+
var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
|
|
617
|
+
var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
|
|
618
|
+
|
|
619
|
+
var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
|
|
620
|
+
|
|
621
|
+
var now = void 0;
|
|
622
|
+
if (hasNativePerformanceNow) {
|
|
623
|
+
var Performance = performance;
|
|
624
|
+
now = function () {
|
|
625
|
+
return Performance.now();
|
|
626
|
+
};
|
|
627
|
+
} else {
|
|
628
|
+
now = function () {
|
|
629
|
+
return localDate.now();
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
var scheduleWork = void 0;
|
|
634
|
+
var cancelScheduledWork = void 0;
|
|
635
|
+
|
|
636
|
+
if (!canUseDOM) {
|
|
637
|
+
var timeoutIds = new Map();
|
|
638
|
+
|
|
639
|
+
scheduleWork = function (callback, options) {
|
|
640
|
+
// keeping return type consistent
|
|
641
|
+
var callbackConfig = {
|
|
642
|
+
scheduledCallback: callback,
|
|
643
|
+
timeoutTime: 0,
|
|
644
|
+
next: null,
|
|
645
|
+
prev: null
|
|
646
|
+
};
|
|
647
|
+
var timeoutId = localSetTimeout(function () {
|
|
648
|
+
callback({
|
|
649
|
+
timeRemaining: function () {
|
|
650
|
+
return Infinity;
|
|
651
|
+
},
|
|
652
|
+
|
|
653
|
+
didTimeout: false
|
|
654
|
+
});
|
|
655
|
+
});
|
|
656
|
+
timeoutIds.set(callback, timeoutId);
|
|
657
|
+
return callbackConfig;
|
|
658
|
+
};
|
|
659
|
+
cancelScheduledWork = function (callbackId) {
|
|
660
|
+
var callback = callbackId.scheduledCallback;
|
|
661
|
+
var timeoutId = timeoutIds.get(callback);
|
|
662
|
+
timeoutIds.delete(callbackId);
|
|
663
|
+
localClearTimeout(timeoutId);
|
|
664
|
+
};
|
|
665
|
+
} else {
|
|
666
|
+
{
|
|
667
|
+
if (typeof console !== 'undefined') {
|
|
668
|
+
if (typeof localRequestAnimationFrame !== 'function') {
|
|
669
|
+
console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
|
670
|
+
}
|
|
671
|
+
if (typeof localCancelAnimationFrame !== 'function') {
|
|
672
|
+
console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
var headOfPendingCallbacksLinkedList = null;
|
|
678
|
+
var tailOfPendingCallbacksLinkedList = null;
|
|
679
|
+
|
|
680
|
+
// We track what the next soonest timeoutTime is, to be able to quickly tell
|
|
681
|
+
// if none of the scheduled callbacks have timed out.
|
|
682
|
+
var nextSoonestTimeoutTime = -1;
|
|
683
|
+
|
|
684
|
+
var isIdleScheduled = false;
|
|
685
|
+
var isAnimationFrameScheduled = false;
|
|
686
|
+
|
|
687
|
+
// requestAnimationFrame does not run when the tab is in the background.
|
|
688
|
+
// if we're backgrounded we prefer for that work to happen so that the page
|
|
689
|
+
// continues to load in the background.
|
|
690
|
+
// so we also schedule a 'setTimeout' as a fallback.
|
|
691
|
+
var animationFrameTimeout = 100;
|
|
692
|
+
var rafID = void 0;
|
|
693
|
+
var timeoutID = void 0;
|
|
694
|
+
var scheduleAnimationFrameWithFallbackSupport = function (callback) {
|
|
695
|
+
// schedule rAF and also a setTimeout
|
|
696
|
+
rafID = localRequestAnimationFrame(function (timestamp) {
|
|
697
|
+
// cancel the setTimeout
|
|
698
|
+
localClearTimeout(timeoutID);
|
|
699
|
+
callback(timestamp);
|
|
700
|
+
});
|
|
701
|
+
timeoutID = localSetTimeout(function () {
|
|
702
|
+
// cancel the requestAnimationFrame
|
|
703
|
+
localCancelAnimationFrame(rafID);
|
|
704
|
+
callback(now());
|
|
705
|
+
}, animationFrameTimeout);
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
var frameDeadline = 0;
|
|
709
|
+
// We start out assuming that we run at 30fps but then the heuristic tracking
|
|
710
|
+
// will adjust this value to a faster fps if we get more frequent animation
|
|
711
|
+
// frames.
|
|
712
|
+
var previousFrameTime = 33;
|
|
713
|
+
var activeFrameTime = 33;
|
|
714
|
+
|
|
715
|
+
var frameDeadlineObject = {
|
|
716
|
+
didTimeout: false,
|
|
717
|
+
timeRemaining: function () {
|
|
718
|
+
var remaining = frameDeadline - now();
|
|
719
|
+
return remaining > 0 ? remaining : 0;
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Handles the case where a callback errors:
|
|
725
|
+
* - don't catch the error, because this changes debugging behavior
|
|
726
|
+
* - do start a new postMessage callback, to call any remaining callbacks,
|
|
727
|
+
* - but only if there is an error, so there is not extra overhead.
|
|
728
|
+
*/
|
|
729
|
+
var callUnsafely = function (callbackConfig, arg) {
|
|
730
|
+
var callback = callbackConfig.scheduledCallback;
|
|
731
|
+
var finishedCalling = false;
|
|
732
|
+
try {
|
|
733
|
+
callback(arg);
|
|
734
|
+
finishedCalling = true;
|
|
735
|
+
} finally {
|
|
736
|
+
// always remove it from linked list
|
|
737
|
+
cancelScheduledWork(callbackConfig);
|
|
738
|
+
|
|
739
|
+
if (!finishedCalling) {
|
|
740
|
+
// an error must have been thrown
|
|
741
|
+
isIdleScheduled = true;
|
|
742
|
+
window.postMessage(messageKey, '*');
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Checks for timed out callbacks, runs them, and then checks again to see if
|
|
749
|
+
* any more have timed out.
|
|
750
|
+
* Keeps doing this until there are none which have currently timed out.
|
|
751
|
+
*/
|
|
752
|
+
var callTimedOutCallbacks = function () {
|
|
753
|
+
if (headOfPendingCallbacksLinkedList === null) {
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
var currentTime = now();
|
|
758
|
+
// TODO: this would be more efficient if deferred callbacks are stored in
|
|
759
|
+
// min heap.
|
|
760
|
+
// Or in a linked list with links for both timeoutTime order and insertion
|
|
761
|
+
// order.
|
|
762
|
+
// For now an easy compromise is the current approach:
|
|
763
|
+
// Keep a pointer to the soonest timeoutTime, and check that first.
|
|
764
|
+
// If it has not expired, we can skip traversing the whole list.
|
|
765
|
+
// If it has expired, then we step through all the callbacks.
|
|
766
|
+
if (nextSoonestTimeoutTime === -1 || nextSoonestTimeoutTime > currentTime) {
|
|
767
|
+
// We know that none of them have timed out yet.
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
// NOTE: we intentionally wait to update the nextSoonestTimeoutTime until
|
|
771
|
+
// after successfully calling any timed out callbacks.
|
|
772
|
+
// If a timed out callback throws an error, we could get stuck in a state
|
|
773
|
+
// where the nextSoonestTimeoutTime was set wrong.
|
|
774
|
+
var updatedNextSoonestTimeoutTime = -1; // we will update nextSoonestTimeoutTime below
|
|
775
|
+
var timedOutCallbacks = [];
|
|
776
|
+
|
|
777
|
+
// iterate once to find timed out callbacks and find nextSoonestTimeoutTime
|
|
778
|
+
var currentCallbackConfig = headOfPendingCallbacksLinkedList;
|
|
779
|
+
while (currentCallbackConfig !== null) {
|
|
780
|
+
var _timeoutTime = currentCallbackConfig.timeoutTime;
|
|
781
|
+
if (_timeoutTime !== -1 && _timeoutTime <= currentTime) {
|
|
782
|
+
// it has timed out!
|
|
783
|
+
timedOutCallbacks.push(currentCallbackConfig);
|
|
784
|
+
} else {
|
|
785
|
+
if (_timeoutTime !== -1 && (updatedNextSoonestTimeoutTime === -1 || _timeoutTime < updatedNextSoonestTimeoutTime)) {
|
|
786
|
+
updatedNextSoonestTimeoutTime = _timeoutTime;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
currentCallbackConfig = currentCallbackConfig.next;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
if (timedOutCallbacks.length > 0) {
|
|
793
|
+
frameDeadlineObject.didTimeout = true;
|
|
794
|
+
for (var i = 0, len = timedOutCallbacks.length; i < len; i++) {
|
|
795
|
+
callUnsafely(timedOutCallbacks[i], frameDeadlineObject);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// NOTE: we intentionally wait to update the nextSoonestTimeoutTime until
|
|
800
|
+
// after successfully calling any timed out callbacks.
|
|
801
|
+
nextSoonestTimeoutTime = updatedNextSoonestTimeoutTime;
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
// We use the postMessage trick to defer idle work until after the repaint.
|
|
805
|
+
var messageKey = '__reactIdleCallback$' + Math.random().toString(36).slice(2);
|
|
806
|
+
var idleTick = function (event) {
|
|
807
|
+
if (event.source !== window || event.data !== messageKey) {
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
isIdleScheduled = false;
|
|
811
|
+
|
|
812
|
+
if (headOfPendingCallbacksLinkedList === null) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// First call anything which has timed out, until we have caught up.
|
|
817
|
+
callTimedOutCallbacks();
|
|
818
|
+
|
|
819
|
+
var currentTime = now();
|
|
820
|
+
// Next, as long as we have idle time, try calling more callbacks.
|
|
821
|
+
while (frameDeadline - currentTime > 0 && headOfPendingCallbacksLinkedList !== null) {
|
|
822
|
+
var latestCallbackConfig = headOfPendingCallbacksLinkedList;
|
|
823
|
+
frameDeadlineObject.didTimeout = false;
|
|
824
|
+
// callUnsafely will remove it from the head of the linked list
|
|
825
|
+
callUnsafely(latestCallbackConfig, frameDeadlineObject);
|
|
826
|
+
currentTime = now();
|
|
827
|
+
}
|
|
828
|
+
if (headOfPendingCallbacksLinkedList !== null) {
|
|
829
|
+
if (!isAnimationFrameScheduled) {
|
|
830
|
+
// Schedule another animation callback so we retry later.
|
|
831
|
+
isAnimationFrameScheduled = true;
|
|
832
|
+
scheduleAnimationFrameWithFallbackSupport(animationTick);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
// Assumes that we have addEventListener in this environment. Might need
|
|
837
|
+
// something better for old IE.
|
|
838
|
+
window.addEventListener('message', idleTick, false);
|
|
839
|
+
|
|
840
|
+
var animationTick = function (rafTime) {
|
|
841
|
+
isAnimationFrameScheduled = false;
|
|
842
|
+
var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
|
|
843
|
+
if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
|
|
844
|
+
if (nextFrameTime < 8) {
|
|
845
|
+
// Defensive coding. We don't support higher frame rates than 120hz.
|
|
846
|
+
// If we get lower than that, it is probably a bug.
|
|
847
|
+
nextFrameTime = 8;
|
|
848
|
+
}
|
|
849
|
+
// If one frame goes long, then the next one can be short to catch up.
|
|
850
|
+
// If two frames are short in a row, then that's an indication that we
|
|
851
|
+
// actually have a higher frame rate than what we're currently optimizing.
|
|
852
|
+
// We adjust our heuristic dynamically accordingly. For example, if we're
|
|
853
|
+
// running on 120hz display or 90hz VR display.
|
|
854
|
+
// Take the max of the two in case one of them was an anomaly due to
|
|
855
|
+
// missed frame deadlines.
|
|
856
|
+
activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
|
|
857
|
+
} else {
|
|
858
|
+
previousFrameTime = nextFrameTime;
|
|
859
|
+
}
|
|
860
|
+
frameDeadline = rafTime + activeFrameTime;
|
|
861
|
+
if (!isIdleScheduled) {
|
|
862
|
+
isIdleScheduled = true;
|
|
863
|
+
window.postMessage(messageKey, '*');
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
scheduleWork = function (callback, options) /* CallbackConfigType */{
|
|
868
|
+
var timeoutTime = -1;
|
|
869
|
+
if (options != null && typeof options.timeout === 'number') {
|
|
870
|
+
timeoutTime = now() + options.timeout;
|
|
871
|
+
}
|
|
872
|
+
if (nextSoonestTimeoutTime === -1 || timeoutTime !== -1 && timeoutTime < nextSoonestTimeoutTime) {
|
|
873
|
+
nextSoonestTimeoutTime = timeoutTime;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
var scheduledCallbackConfig = {
|
|
877
|
+
scheduledCallback: callback,
|
|
878
|
+
timeoutTime: timeoutTime,
|
|
879
|
+
prev: null,
|
|
880
|
+
next: null
|
|
881
|
+
};
|
|
882
|
+
if (headOfPendingCallbacksLinkedList === null) {
|
|
883
|
+
// Make this callback the head and tail of our list
|
|
884
|
+
headOfPendingCallbacksLinkedList = scheduledCallbackConfig;
|
|
885
|
+
tailOfPendingCallbacksLinkedList = scheduledCallbackConfig;
|
|
886
|
+
} else {
|
|
887
|
+
// Add latest callback as the new tail of the list
|
|
888
|
+
scheduledCallbackConfig.prev = tailOfPendingCallbacksLinkedList;
|
|
889
|
+
// renaming for clarity
|
|
890
|
+
var oldTailOfPendingCallbacksLinkedList = tailOfPendingCallbacksLinkedList;
|
|
891
|
+
if (oldTailOfPendingCallbacksLinkedList !== null) {
|
|
892
|
+
oldTailOfPendingCallbacksLinkedList.next = scheduledCallbackConfig;
|
|
893
|
+
}
|
|
894
|
+
tailOfPendingCallbacksLinkedList = scheduledCallbackConfig;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
if (!isAnimationFrameScheduled) {
|
|
898
|
+
// If rAF didn't already schedule one, we need to schedule a frame.
|
|
899
|
+
// TODO: If this rAF doesn't materialize because the browser throttles, we
|
|
900
|
+
// might want to still have setTimeout trigger scheduleWork as a backup to ensure
|
|
901
|
+
// that we keep performing work.
|
|
902
|
+
isAnimationFrameScheduled = true;
|
|
903
|
+
scheduleAnimationFrameWithFallbackSupport(animationTick);
|
|
904
|
+
}
|
|
905
|
+
return scheduledCallbackConfig;
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
cancelScheduledWork = function (callbackConfig /* CallbackConfigType */
|
|
909
|
+
) {
|
|
910
|
+
if (callbackConfig.prev === null && headOfPendingCallbacksLinkedList !== callbackConfig) {
|
|
911
|
+
// this callbackConfig has already been cancelled.
|
|
912
|
+
// cancelScheduledWork should be idempotent, a no-op after first call.
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* There are four possible cases:
|
|
918
|
+
* - Head/nodeToRemove/Tail -> null
|
|
919
|
+
* In this case we set Head and Tail to null.
|
|
920
|
+
* - Head -> ... middle nodes... -> Tail/nodeToRemove
|
|
921
|
+
* In this case we point the middle.next to null and put middle as the new
|
|
922
|
+
* Tail.
|
|
923
|
+
* - Head/nodeToRemove -> ...middle nodes... -> Tail
|
|
924
|
+
* In this case we point the middle.prev at null and move the Head to
|
|
925
|
+
* middle.
|
|
926
|
+
* - Head -> ... ?some nodes ... -> nodeToRemove -> ... ?some nodes ... -> Tail
|
|
927
|
+
* In this case we point the Head.next to the Tail and the Tail.prev to
|
|
928
|
+
* the Head.
|
|
929
|
+
*/
|
|
930
|
+
var next = callbackConfig.next;
|
|
931
|
+
var prev = callbackConfig.prev;
|
|
932
|
+
callbackConfig.next = null;
|
|
933
|
+
callbackConfig.prev = null;
|
|
934
|
+
if (next !== null) {
|
|
935
|
+
// we have a next
|
|
936
|
+
|
|
937
|
+
if (prev !== null) {
|
|
938
|
+
// we have a prev
|
|
939
|
+
|
|
940
|
+
// callbackConfig is somewhere in the middle of a list of 3 or more nodes.
|
|
941
|
+
prev.next = next;
|
|
942
|
+
next.prev = prev;
|
|
943
|
+
return;
|
|
944
|
+
} else {
|
|
945
|
+
// there is a next but not a previous one;
|
|
946
|
+
// callbackConfig is the head of a list of 2 or more other nodes.
|
|
947
|
+
next.prev = null;
|
|
948
|
+
headOfPendingCallbacksLinkedList = next;
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
} else {
|
|
952
|
+
// there is no next callback config; this must the tail of the list
|
|
953
|
+
|
|
954
|
+
if (prev !== null) {
|
|
955
|
+
// we have a prev
|
|
956
|
+
|
|
957
|
+
// callbackConfig is the tail of a list of 2 or more other nodes.
|
|
958
|
+
prev.next = null;
|
|
959
|
+
tailOfPendingCallbacksLinkedList = prev;
|
|
960
|
+
return;
|
|
961
|
+
} else {
|
|
962
|
+
// there is no previous callback config;
|
|
963
|
+
// callbackConfig is the only thing in the linked list,
|
|
964
|
+
// so both head and tail point to it.
|
|
965
|
+
headOfPendingCallbacksLinkedList = null;
|
|
966
|
+
tailOfPendingCallbacksLinkedList = null;
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
var DEFAULT_THREAD_ID = 0;
|
|
974
|
+
|
|
975
|
+
// Counters used to generate unique IDs.
|
|
976
|
+
var interactionIDCounter = 0;
|
|
977
|
+
var threadIDCounter = 0;
|
|
978
|
+
|
|
979
|
+
// Set of currently tracked interactions.
|
|
980
|
+
// Interactions "stack"–
|
|
981
|
+
// Meaning that newly tracked interactions are appended to the previously active set.
|
|
982
|
+
// When an interaction goes out of scope, the previous set (if any) is restored.
|
|
983
|
+
var interactionsRef = null;
|
|
984
|
+
|
|
985
|
+
// Listener(s) to notify when interactions begin and end.
|
|
986
|
+
var subscriberRef = null;
|
|
987
|
+
|
|
988
|
+
if (enableSchedulerTracking) {
|
|
989
|
+
interactionsRef = {
|
|
990
|
+
current: new Set()
|
|
991
|
+
};
|
|
992
|
+
subscriberRef = {
|
|
993
|
+
current: null
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
function unstable_clear(callback) {
|
|
998
|
+
if (!enableSchedulerTracking) {
|
|
999
|
+
return callback();
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
var prevInteractions = interactionsRef.current;
|
|
1003
|
+
interactionsRef.current = new Set();
|
|
1004
|
+
|
|
1005
|
+
try {
|
|
1006
|
+
return callback();
|
|
1007
|
+
} finally {
|
|
1008
|
+
interactionsRef.current = prevInteractions;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
function unstable_getCurrent() {
|
|
1013
|
+
if (!enableSchedulerTracking) {
|
|
1014
|
+
return null;
|
|
1015
|
+
} else {
|
|
1016
|
+
return interactionsRef.current;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
function unstable_getThreadID() {
|
|
1021
|
+
return ++threadIDCounter;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
function unstable_track(name, timestamp, callback) {
|
|
1025
|
+
var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
|
|
1026
|
+
|
|
1027
|
+
if (!enableSchedulerTracking) {
|
|
1028
|
+
return callback();
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
var interaction = {
|
|
1032
|
+
__count: 1,
|
|
1033
|
+
id: interactionIDCounter++,
|
|
1034
|
+
name: name,
|
|
1035
|
+
timestamp: timestamp
|
|
1036
|
+
};
|
|
1037
|
+
|
|
1038
|
+
var prevInteractions = interactionsRef.current;
|
|
1039
|
+
|
|
1040
|
+
// Tracked interactions should stack/accumulate.
|
|
1041
|
+
// To do that, clone the current interactions.
|
|
1042
|
+
// The previous set will be restored upon completion.
|
|
1043
|
+
var interactions = new Set(prevInteractions);
|
|
1044
|
+
interactions.add(interaction);
|
|
1045
|
+
interactionsRef.current = interactions;
|
|
1046
|
+
|
|
1047
|
+
var subscriber = subscriberRef.current;
|
|
1048
|
+
var returnValue = void 0;
|
|
1049
|
+
|
|
1050
|
+
try {
|
|
1051
|
+
if (subscriber !== null) {
|
|
1052
|
+
subscriber.onInteractionTracked(interaction);
|
|
1053
|
+
}
|
|
1054
|
+
} finally {
|
|
1055
|
+
try {
|
|
1056
|
+
if (subscriber !== null) {
|
|
1057
|
+
subscriber.onWorkStarted(interactions, threadID);
|
|
1058
|
+
}
|
|
1059
|
+
} finally {
|
|
1060
|
+
try {
|
|
1061
|
+
returnValue = callback();
|
|
1062
|
+
} finally {
|
|
1063
|
+
interactionsRef.current = prevInteractions;
|
|
1064
|
+
|
|
1065
|
+
try {
|
|
1066
|
+
if (subscriber !== null) {
|
|
1067
|
+
subscriber.onWorkStopped(interactions, threadID);
|
|
1068
|
+
}
|
|
1069
|
+
} finally {
|
|
1070
|
+
interaction.__count--;
|
|
1071
|
+
|
|
1072
|
+
// If no async work was scheduled for this interaction,
|
|
1073
|
+
// Notify subscribers that it's completed.
|
|
1074
|
+
if (subscriber !== null && interaction.__count === 0) {
|
|
1075
|
+
subscriber.onInteractionScheduledWorkCompleted(interaction);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
return returnValue;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
function unstable_wrap(callback) {
|
|
1086
|
+
var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
|
|
1087
|
+
|
|
1088
|
+
if (!enableSchedulerTracking) {
|
|
1089
|
+
return callback;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
var wrappedInteractions = interactionsRef.current;
|
|
1093
|
+
|
|
1094
|
+
var subscriber = subscriberRef.current;
|
|
1095
|
+
if (subscriber !== null) {
|
|
1096
|
+
subscriber.onWorkScheduled(wrappedInteractions, threadID);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
// Update the pending async work count for the current interactions.
|
|
1100
|
+
// Update after calling subscribers in case of error.
|
|
1101
|
+
wrappedInteractions.forEach(function (interaction) {
|
|
1102
|
+
interaction.__count++;
|
|
1103
|
+
});
|
|
1104
|
+
|
|
1105
|
+
var hasRun = false;
|
|
1106
|
+
|
|
1107
|
+
function wrapped() {
|
|
1108
|
+
var prevInteractions = interactionsRef.current;
|
|
1109
|
+
interactionsRef.current = wrappedInteractions;
|
|
1110
|
+
|
|
1111
|
+
subscriber = subscriberRef.current;
|
|
1112
|
+
|
|
1113
|
+
try {
|
|
1114
|
+
var returnValue = void 0;
|
|
1115
|
+
|
|
1116
|
+
try {
|
|
1117
|
+
if (subscriber !== null) {
|
|
1118
|
+
subscriber.onWorkStarted(wrappedInteractions, threadID);
|
|
1119
|
+
}
|
|
1120
|
+
} finally {
|
|
1121
|
+
try {
|
|
1122
|
+
returnValue = callback.apply(undefined, arguments);
|
|
1123
|
+
} finally {
|
|
1124
|
+
interactionsRef.current = prevInteractions;
|
|
1125
|
+
|
|
1126
|
+
if (subscriber !== null) {
|
|
1127
|
+
subscriber.onWorkStopped(wrappedInteractions, threadID);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
return returnValue;
|
|
1133
|
+
} finally {
|
|
1134
|
+
if (!hasRun) {
|
|
1135
|
+
// We only expect a wrapped function to be executed once,
|
|
1136
|
+
// But in the event that it's executed more than once–
|
|
1137
|
+
// Only decrement the outstanding interaction counts once.
|
|
1138
|
+
hasRun = true;
|
|
1139
|
+
|
|
1140
|
+
// Update pending async counts for all wrapped interactions.
|
|
1141
|
+
// If this was the last scheduled async work for any of them,
|
|
1142
|
+
// Mark them as completed.
|
|
1143
|
+
wrappedInteractions.forEach(function (interaction) {
|
|
1144
|
+
interaction.__count--;
|
|
1145
|
+
|
|
1146
|
+
if (subscriber !== null && interaction.__count === 0) {
|
|
1147
|
+
subscriber.onInteractionScheduledWorkCompleted(interaction);
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
wrapped.cancel = function cancel() {
|
|
1155
|
+
subscriber = subscriberRef.current;
|
|
1156
|
+
|
|
1157
|
+
try {
|
|
1158
|
+
if (subscriber !== null) {
|
|
1159
|
+
subscriber.onWorkCanceled(wrappedInteractions, threadID);
|
|
1160
|
+
}
|
|
1161
|
+
} finally {
|
|
1162
|
+
// Update pending async counts for all wrapped interactions.
|
|
1163
|
+
// If this was the last scheduled async work for any of them,
|
|
1164
|
+
// Mark them as completed.
|
|
1165
|
+
wrappedInteractions.forEach(function (interaction) {
|
|
1166
|
+
interaction.__count--;
|
|
1167
|
+
|
|
1168
|
+
if (subscriber && interaction.__count === 0) {
|
|
1169
|
+
subscriber.onInteractionScheduledWorkCompleted(interaction);
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
|
|
1175
|
+
return wrapped;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
var subscribers = null;
|
|
1179
|
+
if (enableSchedulerTracking) {
|
|
1180
|
+
subscribers = new Set();
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
function unstable_subscribe(subscriber) {
|
|
1184
|
+
if (enableSchedulerTracking) {
|
|
1185
|
+
subscribers.add(subscriber);
|
|
1186
|
+
|
|
1187
|
+
if (subscribers.size === 1) {
|
|
1188
|
+
subscriberRef.current = {
|
|
1189
|
+
onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
|
|
1190
|
+
onInteractionTracked: onInteractionTracked,
|
|
1191
|
+
onWorkCanceled: onWorkCanceled,
|
|
1192
|
+
onWorkScheduled: onWorkScheduled,
|
|
1193
|
+
onWorkStarted: onWorkStarted,
|
|
1194
|
+
onWorkStopped: onWorkStopped
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
function unstable_unsubscribe(subscriber) {
|
|
1201
|
+
if (enableSchedulerTracking) {
|
|
1202
|
+
subscribers.delete(subscriber);
|
|
1203
|
+
|
|
1204
|
+
if (subscribers.size === 0) {
|
|
1205
|
+
subscriberRef.current = null;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
function onInteractionTracked(interaction) {
|
|
1211
|
+
var didCatchError = false;
|
|
1212
|
+
var caughtError = null;
|
|
1213
|
+
|
|
1214
|
+
subscribers.forEach(function (subscriber) {
|
|
1215
|
+
try {
|
|
1216
|
+
subscriber.onInteractionTracked(interaction);
|
|
1217
|
+
} catch (error) {
|
|
1218
|
+
if (!didCatchError) {
|
|
1219
|
+
didCatchError = true;
|
|
1220
|
+
caughtError = error;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
});
|
|
1224
|
+
|
|
1225
|
+
if (didCatchError) {
|
|
1226
|
+
throw caughtError;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
function onInteractionScheduledWorkCompleted(interaction) {
|
|
1231
|
+
var didCatchError = false;
|
|
1232
|
+
var caughtError = null;
|
|
1233
|
+
|
|
1234
|
+
subscribers.forEach(function (subscriber) {
|
|
1235
|
+
try {
|
|
1236
|
+
subscriber.onInteractionScheduledWorkCompleted(interaction);
|
|
1237
|
+
} catch (error) {
|
|
1238
|
+
if (!didCatchError) {
|
|
1239
|
+
didCatchError = true;
|
|
1240
|
+
caughtError = error;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1245
|
+
if (didCatchError) {
|
|
1246
|
+
throw caughtError;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
function onWorkScheduled(interactions, threadID) {
|
|
1251
|
+
var didCatchError = false;
|
|
1252
|
+
var caughtError = null;
|
|
1253
|
+
|
|
1254
|
+
subscribers.forEach(function (subscriber) {
|
|
1255
|
+
try {
|
|
1256
|
+
subscriber.onWorkScheduled(interactions, threadID);
|
|
1257
|
+
} catch (error) {
|
|
1258
|
+
if (!didCatchError) {
|
|
1259
|
+
didCatchError = true;
|
|
1260
|
+
caughtError = error;
|
|
1261
|
+
}
|
|
569
1262
|
}
|
|
1263
|
+
});
|
|
1264
|
+
|
|
1265
|
+
if (didCatchError) {
|
|
1266
|
+
throw caughtError;
|
|
570
1267
|
}
|
|
571
1268
|
}
|
|
572
1269
|
|
|
573
|
-
function
|
|
574
|
-
|
|
1270
|
+
function onWorkStarted(interactions, threadID) {
|
|
1271
|
+
var didCatchError = false;
|
|
1272
|
+
var caughtError = null;
|
|
575
1273
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
1274
|
+
subscribers.forEach(function (subscriber) {
|
|
1275
|
+
try {
|
|
1276
|
+
subscriber.onWorkStarted(interactions, threadID);
|
|
1277
|
+
} catch (error) {
|
|
1278
|
+
if (!didCatchError) {
|
|
1279
|
+
didCatchError = true;
|
|
1280
|
+
caughtError = error;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
|
|
1285
|
+
if (didCatchError) {
|
|
1286
|
+
throw caughtError;
|
|
1287
|
+
}
|
|
584
1288
|
}
|
|
585
1289
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
objectAssign(pureComponentPrototype, Component.prototype);
|
|
590
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
1290
|
+
function onWorkStopped(interactions, threadID) {
|
|
1291
|
+
var didCatchError = false;
|
|
1292
|
+
var caughtError = null;
|
|
591
1293
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
1294
|
+
subscribers.forEach(function (subscriber) {
|
|
1295
|
+
try {
|
|
1296
|
+
subscriber.onWorkStopped(interactions, threadID);
|
|
1297
|
+
} catch (error) {
|
|
1298
|
+
if (!didCatchError) {
|
|
1299
|
+
didCatchError = true;
|
|
1300
|
+
caughtError = error;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1304
|
+
|
|
1305
|
+
if (didCatchError) {
|
|
1306
|
+
throw caughtError;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
function onWorkCanceled(interactions, threadID) {
|
|
1311
|
+
var didCatchError = false;
|
|
1312
|
+
var caughtError = null;
|
|
1313
|
+
|
|
1314
|
+
subscribers.forEach(function (subscriber) {
|
|
1315
|
+
try {
|
|
1316
|
+
subscriber.onWorkCanceled(interactions, threadID);
|
|
1317
|
+
} catch (error) {
|
|
1318
|
+
if (!didCatchError) {
|
|
1319
|
+
didCatchError = true;
|
|
1320
|
+
caughtError = error;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
});
|
|
1324
|
+
|
|
1325
|
+
if (didCatchError) {
|
|
1326
|
+
throw caughtError;
|
|
599
1327
|
}
|
|
600
|
-
return refObject;
|
|
601
1328
|
}
|
|
602
1329
|
|
|
603
1330
|
/**
|
|
@@ -611,9 +1338,203 @@ var ReactCurrentOwner = {
|
|
|
611
1338
|
* @internal
|
|
612
1339
|
* @type {ReactComponent}
|
|
613
1340
|
*/
|
|
614
|
-
current: null
|
|
1341
|
+
current: null,
|
|
1342
|
+
currentDispatcher: null
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
1346
|
+
|
|
1347
|
+
var describeComponentFrame = function (name, source, ownerName) {
|
|
1348
|
+
var sourceInfo = '';
|
|
1349
|
+
if (source) {
|
|
1350
|
+
var path = source.fileName;
|
|
1351
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
1352
|
+
{
|
|
1353
|
+
// In DEV, include code for a common special case:
|
|
1354
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
1355
|
+
if (/^index\./.test(fileName)) {
|
|
1356
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
1357
|
+
if (match) {
|
|
1358
|
+
var pathBeforeSlash = match[1];
|
|
1359
|
+
if (pathBeforeSlash) {
|
|
1360
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
1361
|
+
fileName = folderName + '/' + fileName;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
1367
|
+
} else if (ownerName) {
|
|
1368
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
1369
|
+
}
|
|
1370
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
615
1371
|
};
|
|
616
1372
|
|
|
1373
|
+
var Resolved = 1;
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
function refineResolvedThenable(thenable) {
|
|
1379
|
+
return thenable._reactStatus === Resolved ? thenable._reactResult : null;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
function getComponentName(type) {
|
|
1383
|
+
if (type == null) {
|
|
1384
|
+
// Host root, text node or just invalid type.
|
|
1385
|
+
return null;
|
|
1386
|
+
}
|
|
1387
|
+
{
|
|
1388
|
+
if (typeof type.tag === 'number') {
|
|
1389
|
+
warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
if (typeof type === 'function') {
|
|
1393
|
+
return type.displayName || type.name || null;
|
|
1394
|
+
}
|
|
1395
|
+
if (typeof type === 'string') {
|
|
1396
|
+
return type;
|
|
1397
|
+
}
|
|
1398
|
+
switch (type) {
|
|
1399
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
1400
|
+
return 'AsyncMode';
|
|
1401
|
+
case REACT_FRAGMENT_TYPE:
|
|
1402
|
+
return 'Fragment';
|
|
1403
|
+
case REACT_PORTAL_TYPE:
|
|
1404
|
+
return 'Portal';
|
|
1405
|
+
case REACT_PROFILER_TYPE:
|
|
1406
|
+
return 'Profiler';
|
|
1407
|
+
case REACT_STRICT_MODE_TYPE:
|
|
1408
|
+
return 'StrictMode';
|
|
1409
|
+
case REACT_PLACEHOLDER_TYPE:
|
|
1410
|
+
return 'Placeholder';
|
|
1411
|
+
}
|
|
1412
|
+
if (typeof type === 'object') {
|
|
1413
|
+
switch (type.$$typeof) {
|
|
1414
|
+
case REACT_CONTEXT_TYPE:
|
|
1415
|
+
return 'Context.Consumer';
|
|
1416
|
+
case REACT_PROVIDER_TYPE:
|
|
1417
|
+
return 'Context.Provider';
|
|
1418
|
+
case REACT_FORWARD_REF_TYPE:
|
|
1419
|
+
var renderFn = type.render;
|
|
1420
|
+
var functionName = renderFn.displayName || renderFn.name || '';
|
|
1421
|
+
return type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
|
|
1422
|
+
}
|
|
1423
|
+
if (typeof type.then === 'function') {
|
|
1424
|
+
var thenable = type;
|
|
1425
|
+
var resolvedThenable = refineResolvedThenable(thenable);
|
|
1426
|
+
if (resolvedThenable) {
|
|
1427
|
+
return getComponentName(resolvedThenable);
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
return null;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
var ReactDebugCurrentFrame = {};
|
|
1435
|
+
|
|
1436
|
+
var currentlyValidatingElement = null;
|
|
1437
|
+
|
|
1438
|
+
function setCurrentlyValidatingElement(element) {
|
|
1439
|
+
{
|
|
1440
|
+
currentlyValidatingElement = element;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
{
|
|
1445
|
+
// Stack implementation injected by the current renderer.
|
|
1446
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
1447
|
+
|
|
1448
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
1449
|
+
var stack = '';
|
|
1450
|
+
|
|
1451
|
+
// Add an extra top frame while an element is being validated
|
|
1452
|
+
if (currentlyValidatingElement) {
|
|
1453
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
1454
|
+
var owner = currentlyValidatingElement._owner;
|
|
1455
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
// Delegate to the injected renderer-specific implementation
|
|
1459
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
1460
|
+
if (impl) {
|
|
1461
|
+
stack += impl() || '';
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
return stack;
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
var ReactSharedInternals = {
|
|
1469
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
1470
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
1471
|
+
assign: objectAssign
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
{
|
|
1475
|
+
// Re-export the schedule API(s) for UMD bundles.
|
|
1476
|
+
// This avoids introducing a dependency on a new UMD global in a minor update,
|
|
1477
|
+
// Since that would be a breaking change (e.g. for all existing CodeSandboxes).
|
|
1478
|
+
// This re-export is only required for UMD bundles;
|
|
1479
|
+
// CJS bundles use the shared NPM package.
|
|
1480
|
+
objectAssign(ReactSharedInternals, {
|
|
1481
|
+
Schedule: {
|
|
1482
|
+
unstable_cancelScheduledWork: cancelScheduledWork,
|
|
1483
|
+
unstable_now: now,
|
|
1484
|
+
unstable_scheduleWork: scheduleWork
|
|
1485
|
+
},
|
|
1486
|
+
ScheduleTracking: {
|
|
1487
|
+
__interactionsRef: interactionsRef,
|
|
1488
|
+
__subscriberRef: subscriberRef,
|
|
1489
|
+
unstable_clear: unstable_clear,
|
|
1490
|
+
unstable_getCurrent: unstable_getCurrent,
|
|
1491
|
+
unstable_getThreadID: unstable_getThreadID,
|
|
1492
|
+
unstable_subscribe: unstable_subscribe,
|
|
1493
|
+
unstable_track: unstable_track,
|
|
1494
|
+
unstable_unsubscribe: unstable_unsubscribe,
|
|
1495
|
+
unstable_wrap: unstable_wrap
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
{
|
|
1501
|
+
objectAssign(ReactSharedInternals, {
|
|
1502
|
+
// These should not be included in production.
|
|
1503
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
1504
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
1505
|
+
// TODO: remove in React 17.0.
|
|
1506
|
+
ReactComponentTreeHook: {}
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
1512
|
+
* This can be used to log issues in development environments in critical
|
|
1513
|
+
* paths. Removing the logging code for production environments will keep the
|
|
1514
|
+
* same logic and follow the same code paths.
|
|
1515
|
+
*/
|
|
1516
|
+
|
|
1517
|
+
var warning = warningWithoutStack$1;
|
|
1518
|
+
|
|
1519
|
+
{
|
|
1520
|
+
warning = function (condition, format) {
|
|
1521
|
+
if (condition) {
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1525
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
1526
|
+
// eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
1527
|
+
|
|
1528
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1529
|
+
args[_key - 2] = arguments[_key];
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
var warning$1 = warning;
|
|
1537
|
+
|
|
617
1538
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
618
1539
|
|
|
619
1540
|
var RESERVED_PROPS = {
|
|
@@ -654,7 +1575,7 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
654
1575
|
var warnAboutAccessingKey = function () {
|
|
655
1576
|
if (!specialPropKeyWarningShown) {
|
|
656
1577
|
specialPropKeyWarningShown = true;
|
|
657
|
-
|
|
1578
|
+
warningWithoutStack$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
658
1579
|
}
|
|
659
1580
|
};
|
|
660
1581
|
warnAboutAccessingKey.isReactWarning = true;
|
|
@@ -668,7 +1589,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
668
1589
|
var warnAboutAccessingRef = function () {
|
|
669
1590
|
if (!specialPropRefWarningShown) {
|
|
670
1591
|
specialPropRefWarningShown = true;
|
|
671
|
-
|
|
1592
|
+
warningWithoutStack$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
672
1593
|
}
|
|
673
1594
|
};
|
|
674
1595
|
warnAboutAccessingRef.isReactWarning = true;
|
|
@@ -816,14 +1737,12 @@ function createElement(type, config, children) {
|
|
|
816
1737
|
}
|
|
817
1738
|
{
|
|
818
1739
|
if (key || ref) {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
defineRefPropWarningGetter(props, displayName);
|
|
826
|
-
}
|
|
1740
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
1741
|
+
if (key) {
|
|
1742
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
1743
|
+
}
|
|
1744
|
+
if (ref) {
|
|
1745
|
+
defineRefPropWarningGetter(props, displayName);
|
|
827
1746
|
}
|
|
828
1747
|
}
|
|
829
1748
|
}
|
|
@@ -847,7 +1766,7 @@ function cloneAndReplaceKey(oldElement, newKey) {
|
|
|
847
1766
|
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
848
1767
|
*/
|
|
849
1768
|
function cloneElement(element, config, children) {
|
|
850
|
-
!!(element === null || element === undefined) ?
|
|
1769
|
+
!!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
|
|
851
1770
|
|
|
852
1771
|
var propName = void 0;
|
|
853
1772
|
|
|
@@ -914,28 +1833,13 @@ function cloneElement(element, config, children) {
|
|
|
914
1833
|
* Verifies the object is a ReactElement.
|
|
915
1834
|
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
916
1835
|
* @param {?object} object
|
|
917
|
-
* @return {boolean} True if `object` is a
|
|
1836
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
918
1837
|
* @final
|
|
919
1838
|
*/
|
|
920
1839
|
function isValidElement(object) {
|
|
921
1840
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
922
1841
|
}
|
|
923
1842
|
|
|
924
|
-
var ReactDebugCurrentFrame = {};
|
|
925
|
-
|
|
926
|
-
{
|
|
927
|
-
// Component that is being worked on
|
|
928
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
929
|
-
|
|
930
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
931
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
932
|
-
if (impl) {
|
|
933
|
-
return impl();
|
|
934
|
-
}
|
|
935
|
-
return null;
|
|
936
|
-
};
|
|
937
|
-
}
|
|
938
|
-
|
|
939
1843
|
var SEPARATOR = '.';
|
|
940
1844
|
var SUBSEPARATOR = ':';
|
|
941
1845
|
|
|
@@ -1063,7 +1967,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1063
1967
|
{
|
|
1064
1968
|
// Warn about using Maps as children
|
|
1065
1969
|
if (iteratorFn === children.entries) {
|
|
1066
|
-
!didWarnAboutMaps ?
|
|
1970
|
+
!didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
|
|
1067
1971
|
didWarnAboutMaps = true;
|
|
1068
1972
|
}
|
|
1069
1973
|
}
|
|
@@ -1082,7 +1986,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1082
1986
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1083
1987
|
}
|
|
1084
1988
|
var childrenString = '' + children;
|
|
1085
|
-
|
|
1989
|
+
invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
|
1086
1990
|
}
|
|
1087
1991
|
}
|
|
1088
1992
|
|
|
@@ -1141,7 +2045,7 @@ function forEachSingleChild(bookKeeping, child, name) {
|
|
|
1141
2045
|
/**
|
|
1142
2046
|
* Iterates through children that are typically specified as `props.children`.
|
|
1143
2047
|
*
|
|
1144
|
-
* See https://reactjs.org/docs/react-api.html#
|
|
2048
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1145
2049
|
*
|
|
1146
2050
|
* The provided forEachFunc(child, index) will be called for each
|
|
1147
2051
|
* leaf child.
|
|
@@ -1168,7 +2072,9 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
|
1168
2072
|
|
|
1169
2073
|
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1170
2074
|
if (Array.isArray(mappedChild)) {
|
|
1171
|
-
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey,
|
|
2075
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
|
2076
|
+
return c;
|
|
2077
|
+
});
|
|
1172
2078
|
} else if (mappedChild != null) {
|
|
1173
2079
|
if (isValidElement(mappedChild)) {
|
|
1174
2080
|
mappedChild = cloneAndReplaceKey(mappedChild,
|
|
@@ -1193,7 +2099,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
|
1193
2099
|
/**
|
|
1194
2100
|
* Maps children that are typically specified as `props.children`.
|
|
1195
2101
|
*
|
|
1196
|
-
* See https://reactjs.org/docs/react-api.html#
|
|
2102
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1197
2103
|
*
|
|
1198
2104
|
* The provided mapFunction(child, key, index) will be called for each
|
|
1199
2105
|
* leaf child.
|
|
@@ -1216,24 +2122,28 @@ function mapChildren(children, func, context) {
|
|
|
1216
2122
|
* Count the number of children that are typically specified as
|
|
1217
2123
|
* `props.children`.
|
|
1218
2124
|
*
|
|
1219
|
-
* See https://reactjs.org/docs/react-api.html#
|
|
2125
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1220
2126
|
*
|
|
1221
2127
|
* @param {?*} children Children tree container.
|
|
1222
2128
|
* @return {number} The number of children.
|
|
1223
2129
|
*/
|
|
1224
2130
|
function countChildren(children) {
|
|
1225
|
-
return traverseAllChildren(children,
|
|
2131
|
+
return traverseAllChildren(children, function () {
|
|
2132
|
+
return null;
|
|
2133
|
+
}, null);
|
|
1226
2134
|
}
|
|
1227
2135
|
|
|
1228
2136
|
/**
|
|
1229
2137
|
* Flatten a children object (typically specified as `props.children`) and
|
|
1230
2138
|
* return an array with appropriately re-keyed children.
|
|
1231
2139
|
*
|
|
1232
|
-
* See https://reactjs.org/docs/react-api.html#
|
|
2140
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1233
2141
|
*/
|
|
1234
2142
|
function toArray(children) {
|
|
1235
2143
|
var result = [];
|
|
1236
|
-
mapIntoWithKeyPrefixInternal(children, result, null,
|
|
2144
|
+
mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
|
2145
|
+
return child;
|
|
2146
|
+
});
|
|
1237
2147
|
return result;
|
|
1238
2148
|
}
|
|
1239
2149
|
|
|
@@ -1241,7 +2151,7 @@ function toArray(children) {
|
|
|
1241
2151
|
* Returns the first child in a collection of children and verifies that there
|
|
1242
2152
|
* is only one child in the collection.
|
|
1243
2153
|
*
|
|
1244
|
-
* See https://reactjs.org/docs/react-api.html#
|
|
2154
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
1245
2155
|
*
|
|
1246
2156
|
* The current implementation of this function assumes that a single child gets
|
|
1247
2157
|
* passed without a wrapper, but the purpose of this helper function is to
|
|
@@ -1252,35 +2162,39 @@ function toArray(children) {
|
|
|
1252
2162
|
* structure.
|
|
1253
2163
|
*/
|
|
1254
2164
|
function onlyChild(children) {
|
|
1255
|
-
!isValidElement(children) ?
|
|
2165
|
+
!isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
|
1256
2166
|
return children;
|
|
1257
2167
|
}
|
|
1258
2168
|
|
|
2169
|
+
function readContext(context, observedBits) {
|
|
2170
|
+
var dispatcher = ReactCurrentOwner.currentDispatcher;
|
|
2171
|
+
!(dispatcher !== null) ? invariant(false, 'Context.unstable_read(): Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
|
|
2172
|
+
return dispatcher.readContext(context, observedBits);
|
|
2173
|
+
}
|
|
2174
|
+
|
|
1259
2175
|
function createContext(defaultValue, calculateChangedBits) {
|
|
1260
2176
|
if (calculateChangedBits === undefined) {
|
|
1261
2177
|
calculateChangedBits = null;
|
|
1262
2178
|
} else {
|
|
1263
2179
|
{
|
|
1264
|
-
!(calculateChangedBits === null || typeof calculateChangedBits === 'function') ?
|
|
2180
|
+
!(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
|
|
1265
2181
|
}
|
|
1266
2182
|
}
|
|
1267
2183
|
|
|
1268
2184
|
var context = {
|
|
1269
2185
|
$$typeof: REACT_CONTEXT_TYPE,
|
|
1270
2186
|
_calculateChangedBits: calculateChangedBits,
|
|
1271
|
-
_defaultValue: defaultValue,
|
|
1272
|
-
_currentValue: defaultValue,
|
|
1273
2187
|
// As a workaround to support multiple concurrent renderers, we categorize
|
|
1274
2188
|
// some renderers as primary and others as secondary. We only expect
|
|
1275
2189
|
// there to be two concurrent renderers at most: React Native (primary) and
|
|
1276
2190
|
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
1277
2191
|
// Secondary renderers store their context values on separate fields.
|
|
2192
|
+
_currentValue: defaultValue,
|
|
1278
2193
|
_currentValue2: defaultValue,
|
|
1279
|
-
_changedBits: 0,
|
|
1280
|
-
_changedBits2: 0,
|
|
1281
2194
|
// These are circular
|
|
1282
2195
|
Provider: null,
|
|
1283
|
-
Consumer: null
|
|
2196
|
+
Consumer: null,
|
|
2197
|
+
unstable_read: null
|
|
1284
2198
|
};
|
|
1285
2199
|
|
|
1286
2200
|
context.Provider = {
|
|
@@ -1288,6 +2202,7 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1288
2202
|
_context: context
|
|
1289
2203
|
};
|
|
1290
2204
|
context.Consumer = context;
|
|
2205
|
+
context.unstable_read = readContext.bind(null, context);
|
|
1291
2206
|
|
|
1292
2207
|
{
|
|
1293
2208
|
context._currentRenderer = null;
|
|
@@ -1297,12 +2212,36 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1297
2212
|
return context;
|
|
1298
2213
|
}
|
|
1299
2214
|
|
|
2215
|
+
function lazy(ctor) {
|
|
2216
|
+
var thenable = null;
|
|
2217
|
+
return {
|
|
2218
|
+
then: function (resolve, reject) {
|
|
2219
|
+
if (thenable === null) {
|
|
2220
|
+
// Lazily create thenable by wrapping in an extra thenable.
|
|
2221
|
+
thenable = ctor();
|
|
2222
|
+
ctor = null;
|
|
2223
|
+
}
|
|
2224
|
+
return thenable.then(resolve, reject);
|
|
2225
|
+
},
|
|
2226
|
+
|
|
2227
|
+
// React uses these fields to store the result.
|
|
2228
|
+
_reactStatus: -1,
|
|
2229
|
+
_reactResult: null
|
|
2230
|
+
};
|
|
2231
|
+
}
|
|
2232
|
+
|
|
1300
2233
|
function forwardRef(render) {
|
|
1301
2234
|
{
|
|
1302
|
-
|
|
2235
|
+
if (typeof render !== 'function') {
|
|
2236
|
+
warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
2237
|
+
} else {
|
|
2238
|
+
!(
|
|
2239
|
+
// Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
|
|
2240
|
+
render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.') : void 0;
|
|
2241
|
+
}
|
|
1303
2242
|
|
|
1304
2243
|
if (render != null) {
|
|
1305
|
-
!(render.defaultProps == null && render.propTypes == null) ?
|
|
2244
|
+
!(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
|
|
1306
2245
|
}
|
|
1307
2246
|
}
|
|
1308
2247
|
|
|
@@ -1312,51 +2251,10 @@ function forwardRef(render) {
|
|
|
1312
2251
|
};
|
|
1313
2252
|
}
|
|
1314
2253
|
|
|
1315
|
-
var describeComponentFrame = function (name, source, ownerName) {
|
|
1316
|
-
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
1317
|
-
};
|
|
1318
|
-
|
|
1319
2254
|
function isValidElementType(type) {
|
|
1320
2255
|
return typeof type === 'string' || typeof type === 'function' ||
|
|
1321
2256
|
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1322
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type ===
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
function getComponentName(fiber) {
|
|
1326
|
-
var type = fiber.type;
|
|
1327
|
-
|
|
1328
|
-
if (typeof type === 'function') {
|
|
1329
|
-
return type.displayName || type.name;
|
|
1330
|
-
}
|
|
1331
|
-
if (typeof type === 'string') {
|
|
1332
|
-
return type;
|
|
1333
|
-
}
|
|
1334
|
-
switch (type) {
|
|
1335
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
1336
|
-
return 'AsyncMode';
|
|
1337
|
-
case REACT_CONTEXT_TYPE:
|
|
1338
|
-
return 'Context.Consumer';
|
|
1339
|
-
case REACT_FRAGMENT_TYPE:
|
|
1340
|
-
return 'ReactFragment';
|
|
1341
|
-
case REACT_PORTAL_TYPE:
|
|
1342
|
-
return 'ReactPortal';
|
|
1343
|
-
case REACT_PROFILER_TYPE:
|
|
1344
|
-
return 'Profiler(' + fiber.pendingProps.id + ')';
|
|
1345
|
-
case REACT_PROVIDER_TYPE:
|
|
1346
|
-
return 'Context.Provider';
|
|
1347
|
-
case REACT_STRICT_MODE_TYPE:
|
|
1348
|
-
return 'StrictMode';
|
|
1349
|
-
case REACT_TIMEOUT_TYPE:
|
|
1350
|
-
return 'Timeout';
|
|
1351
|
-
}
|
|
1352
|
-
if (typeof type === 'object' && type !== null) {
|
|
1353
|
-
switch (type.$$typeof) {
|
|
1354
|
-
case REACT_FORWARD_REF_TYPE:
|
|
1355
|
-
var functionName = type.render.displayName || type.render.name || '';
|
|
1356
|
-
return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
return null;
|
|
2257
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_PLACEHOLDER_TYPE || typeof type === 'object' && type !== null && (typeof type.then === 'function' || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
|
|
1360
2258
|
}
|
|
1361
2259
|
|
|
1362
2260
|
/**
|
|
@@ -1381,11 +2279,24 @@ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
|
1381
2279
|
|
|
1382
2280
|
|
|
1383
2281
|
|
|
2282
|
+
var printWarning$1 = function() {};
|
|
2283
|
+
|
|
1384
2284
|
{
|
|
1385
|
-
var invariant$2 = invariant_1;
|
|
1386
|
-
var warning$2 = warning_1;
|
|
1387
2285
|
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1388
2286
|
var loggedTypeFailures = {};
|
|
2287
|
+
|
|
2288
|
+
printWarning$1 = function(text) {
|
|
2289
|
+
var message = 'Warning: ' + text;
|
|
2290
|
+
if (typeof console !== 'undefined') {
|
|
2291
|
+
console.error(message);
|
|
2292
|
+
}
|
|
2293
|
+
try {
|
|
2294
|
+
// --- Welcome to debugging React ---
|
|
2295
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
2296
|
+
// to find the callsite that caused this warning to fire.
|
|
2297
|
+
throw new Error(message);
|
|
2298
|
+
} catch (x) {}
|
|
2299
|
+
};
|
|
1389
2300
|
}
|
|
1390
2301
|
|
|
1391
2302
|
/**
|
|
@@ -1410,12 +2321,29 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
1410
2321
|
try {
|
|
1411
2322
|
// This is intentionally an invariant that gets caught. It's the same
|
|
1412
2323
|
// behavior as without this statement except with a better message.
|
|
1413
|
-
|
|
2324
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
2325
|
+
var err = Error(
|
|
2326
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
2327
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
2328
|
+
);
|
|
2329
|
+
err.name = 'Invariant Violation';
|
|
2330
|
+
throw err;
|
|
2331
|
+
}
|
|
1414
2332
|
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
1415
2333
|
} catch (ex) {
|
|
1416
2334
|
error = ex;
|
|
1417
2335
|
}
|
|
1418
|
-
|
|
2336
|
+
if (error && !(error instanceof Error)) {
|
|
2337
|
+
printWarning$1(
|
|
2338
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
2339
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
2340
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
2341
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
2342
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
2343
|
+
'shape all require an argument).'
|
|
2344
|
+
);
|
|
2345
|
+
|
|
2346
|
+
}
|
|
1419
2347
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1420
2348
|
// Only monitor this failure once because there tends to be a lot of the
|
|
1421
2349
|
// same error.
|
|
@@ -1423,7 +2351,9 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
1423
2351
|
|
|
1424
2352
|
var stack = getStack ? getStack() : '';
|
|
1425
2353
|
|
|
1426
|
-
|
|
2354
|
+
printWarning$1(
|
|
2355
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
2356
|
+
);
|
|
1427
2357
|
}
|
|
1428
2358
|
}
|
|
1429
2359
|
}
|
|
@@ -1439,46 +2369,15 @@ var checkPropTypes_1 = checkPropTypes;
|
|
|
1439
2369
|
* that support it.
|
|
1440
2370
|
*/
|
|
1441
2371
|
|
|
1442
|
-
var currentlyValidatingElement = void 0;
|
|
1443
2372
|
var propTypesMisspellWarningShown = void 0;
|
|
1444
2373
|
|
|
1445
|
-
var getDisplayName = function () {};
|
|
1446
|
-
var getStackAddendum = function () {};
|
|
1447
|
-
|
|
1448
2374
|
{
|
|
1449
|
-
currentlyValidatingElement = null;
|
|
1450
|
-
|
|
1451
2375
|
propTypesMisspellWarningShown = false;
|
|
1452
|
-
|
|
1453
|
-
getDisplayName = function (element) {
|
|
1454
|
-
if (element == null) {
|
|
1455
|
-
return '#empty';
|
|
1456
|
-
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1457
|
-
return '#text';
|
|
1458
|
-
} else if (typeof element.type === 'string') {
|
|
1459
|
-
return element.type;
|
|
1460
|
-
} else if (element.type === REACT_FRAGMENT_TYPE) {
|
|
1461
|
-
return 'React.Fragment';
|
|
1462
|
-
} else {
|
|
1463
|
-
return element.type.displayName || element.type.name || 'Unknown';
|
|
1464
|
-
}
|
|
1465
|
-
};
|
|
1466
|
-
|
|
1467
|
-
getStackAddendum = function () {
|
|
1468
|
-
var stack = '';
|
|
1469
|
-
if (currentlyValidatingElement) {
|
|
1470
|
-
var name = getDisplayName(currentlyValidatingElement);
|
|
1471
|
-
var owner = currentlyValidatingElement._owner;
|
|
1472
|
-
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
|
|
1473
|
-
}
|
|
1474
|
-
stack += ReactDebugCurrentFrame.getStackAddendum() || '';
|
|
1475
|
-
return stack;
|
|
1476
|
-
};
|
|
1477
2376
|
}
|
|
1478
2377
|
|
|
1479
2378
|
function getDeclarationErrorAddendum() {
|
|
1480
2379
|
if (ReactCurrentOwner.current) {
|
|
1481
|
-
var name = getComponentName(ReactCurrentOwner.current);
|
|
2380
|
+
var name = getComponentName(ReactCurrentOwner.current.type);
|
|
1482
2381
|
if (name) {
|
|
1483
2382
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
1484
2383
|
}
|
|
@@ -1544,14 +2443,14 @@ function validateExplicitKey(element, parentType) {
|
|
|
1544
2443
|
var childOwner = '';
|
|
1545
2444
|
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
1546
2445
|
// Give the component that originally created this child.
|
|
1547
|
-
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
|
2446
|
+
childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
|
|
1548
2447
|
}
|
|
1549
2448
|
|
|
1550
|
-
|
|
2449
|
+
setCurrentlyValidatingElement(element);
|
|
1551
2450
|
{
|
|
1552
|
-
|
|
2451
|
+
warning$1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1553
2452
|
}
|
|
1554
|
-
|
|
2453
|
+
setCurrentlyValidatingElement(null);
|
|
1555
2454
|
}
|
|
1556
2455
|
|
|
1557
2456
|
/**
|
|
@@ -1604,22 +2503,31 @@ function validateChildKeys(node, parentType) {
|
|
|
1604
2503
|
* @param {ReactElement} element
|
|
1605
2504
|
*/
|
|
1606
2505
|
function validatePropTypes(element) {
|
|
1607
|
-
var
|
|
1608
|
-
|
|
2506
|
+
var type = element.type;
|
|
2507
|
+
var name = void 0,
|
|
2508
|
+
propTypes = void 0;
|
|
2509
|
+
if (typeof type === 'function') {
|
|
2510
|
+
// Class or functional component
|
|
2511
|
+
name = type.displayName || type.name;
|
|
2512
|
+
propTypes = type.propTypes;
|
|
2513
|
+
} else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
|
|
2514
|
+
// ForwardRef
|
|
2515
|
+
var functionName = type.render.displayName || type.render.name || '';
|
|
2516
|
+
name = type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
|
|
2517
|
+
propTypes = type.propTypes;
|
|
2518
|
+
} else {
|
|
1609
2519
|
return;
|
|
1610
2520
|
}
|
|
1611
|
-
var name = componentClass.displayName || componentClass.name;
|
|
1612
|
-
var propTypes = componentClass.propTypes;
|
|
1613
2521
|
if (propTypes) {
|
|
1614
|
-
|
|
1615
|
-
checkPropTypes_1(propTypes, element.props, 'prop', name, getStackAddendum);
|
|
1616
|
-
|
|
1617
|
-
} else if (
|
|
2522
|
+
setCurrentlyValidatingElement(element);
|
|
2523
|
+
checkPropTypes_1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
2524
|
+
setCurrentlyValidatingElement(null);
|
|
2525
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1618
2526
|
propTypesMisspellWarningShown = true;
|
|
1619
|
-
|
|
2527
|
+
warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1620
2528
|
}
|
|
1621
|
-
if (typeof
|
|
1622
|
-
!
|
|
2529
|
+
if (typeof type.getDefaultProps === 'function') {
|
|
2530
|
+
!type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
|
1623
2531
|
}
|
|
1624
2532
|
}
|
|
1625
2533
|
|
|
@@ -1628,22 +2536,22 @@ function validatePropTypes(element) {
|
|
|
1628
2536
|
* @param {ReactElement} fragment
|
|
1629
2537
|
*/
|
|
1630
2538
|
function validateFragmentProps(fragment) {
|
|
1631
|
-
|
|
2539
|
+
setCurrentlyValidatingElement(fragment);
|
|
1632
2540
|
|
|
1633
2541
|
var keys = Object.keys(fragment.props);
|
|
1634
2542
|
for (var i = 0; i < keys.length; i++) {
|
|
1635
2543
|
var key = keys[i];
|
|
1636
2544
|
if (key !== 'children' && key !== 'key') {
|
|
1637
|
-
|
|
2545
|
+
warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1638
2546
|
break;
|
|
1639
2547
|
}
|
|
1640
2548
|
}
|
|
1641
2549
|
|
|
1642
2550
|
if (fragment.ref !== null) {
|
|
1643
|
-
|
|
2551
|
+
warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1644
2552
|
}
|
|
1645
2553
|
|
|
1646
|
-
|
|
2554
|
+
setCurrentlyValidatingElement(null);
|
|
1647
2555
|
}
|
|
1648
2556
|
|
|
1649
2557
|
function createElementWithValidation(type, props, children) {
|
|
@@ -1664,18 +2572,19 @@ function createElementWithValidation(type, props, children) {
|
|
|
1664
2572
|
info += getDeclarationErrorAddendum();
|
|
1665
2573
|
}
|
|
1666
2574
|
|
|
1667
|
-
info += getStackAddendum() || '';
|
|
1668
|
-
|
|
1669
2575
|
var typeString = void 0;
|
|
1670
2576
|
if (type === null) {
|
|
1671
2577
|
typeString = 'null';
|
|
1672
2578
|
} else if (Array.isArray(type)) {
|
|
1673
2579
|
typeString = 'array';
|
|
2580
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2581
|
+
typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
|
2582
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1674
2583
|
} else {
|
|
1675
2584
|
typeString = typeof type;
|
|
1676
2585
|
}
|
|
1677
2586
|
|
|
1678
|
-
|
|
2587
|
+
warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1679
2588
|
}
|
|
1680
2589
|
|
|
1681
2590
|
var element = createElement.apply(this, arguments);
|
|
@@ -1763,25 +2672,12 @@ var React = {
|
|
|
1763
2672
|
|
|
1764
2673
|
version: ReactVersion,
|
|
1765
2674
|
|
|
1766
|
-
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:
|
|
1767
|
-
ReactCurrentOwner: ReactCurrentOwner,
|
|
1768
|
-
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
1769
|
-
assign: objectAssign
|
|
1770
|
-
}
|
|
2675
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
1771
2676
|
};
|
|
1772
2677
|
|
|
1773
2678
|
if (enableSuspense) {
|
|
1774
|
-
React.
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
{
|
|
1778
|
-
objectAssign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
1779
|
-
// These should not be included in production.
|
|
1780
|
-
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
1781
|
-
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
1782
|
-
// TODO: remove in React 17.0.
|
|
1783
|
-
ReactComponentTreeHook: {}
|
|
1784
|
-
});
|
|
2679
|
+
React.Placeholder = REACT_PLACEHOLDER_TYPE;
|
|
2680
|
+
React.lazy = lazy;
|
|
1785
2681
|
}
|
|
1786
2682
|
|
|
1787
2683
|
|
|
@@ -1794,7 +2690,7 @@ var React$3 = ( React$2 && React ) || React$2;
|
|
|
1794
2690
|
|
|
1795
2691
|
// TODO: decide on the top-level export form.
|
|
1796
2692
|
// This is hacky but makes it work with both Rollup and Jest.
|
|
1797
|
-
var react = React$3.default
|
|
2693
|
+
var react = React$3.default || React$3;
|
|
1798
2694
|
|
|
1799
2695
|
return react;
|
|
1800
2696
|
|