react 16.4.0-alpha.0911da3 → 16.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -7
- package/cjs/react.development.js +446 -171
- package/cjs/react.production.min.js +16 -14
- package/cjs/react.profiling.min.js +24 -0
- package/package.json +3 -3
- package/umd/react.development.js +1306 -387
- package/umd/react.production.min.js +20 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.5.0
|
|
2
2
|
* react.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -7,16 +7,18 @@
|
|
|
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
|
-
(d
|
|
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.0",__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.0
|
|
2
|
+
* react.profiling.min.js
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
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.0",__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.0",
|
|
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.3.0"
|
|
28
28
|
},
|
|
29
29
|
"browserify": {
|
|
30
30
|
"transform": [
|
package/umd/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.5.0
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -15,6 +15,122 @@
|
|
|
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.0';
|
|
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
|
+
/**
|
|
52
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
53
|
+
*
|
|
54
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
55
|
+
* to provide information about what broke and what you were
|
|
56
|
+
* expecting.
|
|
57
|
+
*
|
|
58
|
+
* The invariant message will be stripped in production, but the invariant
|
|
59
|
+
* will remain to ensure logic does not differ in production.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
var validateFormat = function () {};
|
|
63
|
+
|
|
64
|
+
{
|
|
65
|
+
validateFormat = function (format) {
|
|
66
|
+
if (format === undefined) {
|
|
67
|
+
throw new Error('invariant requires an error message argument');
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function invariant(condition, format, a, b, c, d, e, f) {
|
|
73
|
+
validateFormat(format);
|
|
74
|
+
|
|
75
|
+
if (!condition) {
|
|
76
|
+
var error = void 0;
|
|
77
|
+
if (format === undefined) {
|
|
78
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
79
|
+
} else {
|
|
80
|
+
var args = [a, b, c, d, e, f];
|
|
81
|
+
var argIndex = 0;
|
|
82
|
+
error = new Error(format.replace(/%s/g, function () {
|
|
83
|
+
return args[argIndex++];
|
|
84
|
+
}));
|
|
85
|
+
error.name = 'Invariant Violation';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Relying on the `invariant()` implementation lets us
|
|
94
|
+
// preserve the format and params in the www builds.
|
|
95
|
+
|
|
96
|
+
// Exports ReactDOM.createRoot
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// Experimental error-boundary API that can recover from errors within a single
|
|
100
|
+
// render phase
|
|
101
|
+
|
|
102
|
+
// Suspense
|
|
103
|
+
var enableSuspense = false;
|
|
104
|
+
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
// In some cases, StrictMode should also double-render lifecycles.
|
|
108
|
+
// This can be confusing for tests though,
|
|
109
|
+
// And it can be bad for performance in production.
|
|
110
|
+
// This feature flag can be used to control the behavior:
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
114
|
+
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
// Warn about legacy context API
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
// Gather advanced timing metrics for Profiler subtrees.
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
// Track which interactions trigger each commit.
|
|
127
|
+
var enableSchedulerTracking = true;
|
|
128
|
+
|
|
129
|
+
// Only used in www builds.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
// Only used in www builds.
|
|
133
|
+
|
|
18
134
|
/*
|
|
19
135
|
object-assign
|
|
20
136
|
(c) Sindre Sorhus
|
|
@@ -106,119 +222,6 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
|
|
|
106
222
|
return to;
|
|
107
223
|
};
|
|
108
224
|
|
|
109
|
-
// TODO: this is special because it gets imported during build.
|
|
110
|
-
|
|
111
|
-
var ReactVersion = '16.4.0-alpha.0911da3';
|
|
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_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8;
|
|
119
|
-
var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
|
|
120
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
|
|
121
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
|
|
122
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc;
|
|
123
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd;
|
|
124
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace;
|
|
125
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf;
|
|
126
|
-
var REACT_LOADING_TYPE = hasSymbol ? Symbol['for']('react.loading') : 0xeada;
|
|
127
|
-
var REACT_TIMEOUT_TYPE = hasSymbol ? Symbol['for']('react.timeout') : 0xeadb;
|
|
128
|
-
|
|
129
|
-
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
130
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
131
|
-
|
|
132
|
-
function getIteratorFn(maybeIterable) {
|
|
133
|
-
if (maybeIterable === null || typeof maybeIterable === 'undefined') {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
137
|
-
if (typeof maybeIterator === 'function') {
|
|
138
|
-
return maybeIterator;
|
|
139
|
-
}
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* WARNING: DO NOT manually require this module.
|
|
145
|
-
* This is a replacement for `invariant(...)` used by the error code system
|
|
146
|
-
* and will _only_ be required by the corresponding babel pass.
|
|
147
|
-
* It always throws.
|
|
148
|
-
*/
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the MIT license found in the
|
|
154
|
-
* LICENSE file in the root directory of this source tree.
|
|
155
|
-
*
|
|
156
|
-
*/
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
var emptyObject = {};
|
|
161
|
-
|
|
162
|
-
{
|
|
163
|
-
Object.freeze(emptyObject);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
var emptyObject_1 = emptyObject;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
170
|
-
*
|
|
171
|
-
* This source code is licensed under the MIT license found in the
|
|
172
|
-
* LICENSE file in the root directory of this source tree.
|
|
173
|
-
*
|
|
174
|
-
*/
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Use invariant() to assert state which your program assumes to be true.
|
|
180
|
-
*
|
|
181
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
|
182
|
-
* to provide information about what broke and what you were
|
|
183
|
-
* expecting.
|
|
184
|
-
*
|
|
185
|
-
* The invariant message will be stripped in production, but the invariant
|
|
186
|
-
* will remain to ensure logic does not differ in production.
|
|
187
|
-
*/
|
|
188
|
-
|
|
189
|
-
var validateFormat = function validateFormat(format) {};
|
|
190
|
-
|
|
191
|
-
{
|
|
192
|
-
validateFormat = function validateFormat(format) {
|
|
193
|
-
if (format === undefined) {
|
|
194
|
-
throw new Error('invariant requires an error message argument');
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
|
200
|
-
validateFormat(format);
|
|
201
|
-
|
|
202
|
-
if (!condition) {
|
|
203
|
-
var error;
|
|
204
|
-
if (format === undefined) {
|
|
205
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
206
|
-
} else {
|
|
207
|
-
var args = [a, b, c, d, e, f];
|
|
208
|
-
var argIndex = 0;
|
|
209
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
210
|
-
return args[argIndex++];
|
|
211
|
-
}));
|
|
212
|
-
error.name = 'Invariant Violation';
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
216
|
-
throw error;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
var invariant_1 = invariant;
|
|
221
|
-
|
|
222
225
|
/**
|
|
223
226
|
* Forked from fbjs/warning:
|
|
224
227
|
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
@@ -258,7 +261,7 @@ var lowPriorityWarning = function () {};
|
|
|
258
261
|
|
|
259
262
|
lowPriorityWarning = function (condition, format) {
|
|
260
263
|
if (format === undefined) {
|
|
261
|
-
throw new Error('`
|
|
264
|
+
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
262
265
|
}
|
|
263
266
|
if (!condition) {
|
|
264
267
|
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
@@ -272,53 +275,6 @@ var lowPriorityWarning = function () {};
|
|
|
272
275
|
|
|
273
276
|
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
274
277
|
|
|
275
|
-
/**
|
|
276
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
277
|
-
*
|
|
278
|
-
* This source code is licensed under the MIT license found in the
|
|
279
|
-
* LICENSE file in the root directory of this source tree.
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*/
|
|
283
|
-
|
|
284
|
-
function makeEmptyFunction(arg) {
|
|
285
|
-
return function () {
|
|
286
|
-
return arg;
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* This function accepts and discards inputs; it has no side effects. This is
|
|
292
|
-
* primarily useful idiomatically for overridable function endpoints which
|
|
293
|
-
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
|
294
|
-
*/
|
|
295
|
-
var emptyFunction = function emptyFunction() {};
|
|
296
|
-
|
|
297
|
-
emptyFunction.thatReturns = makeEmptyFunction;
|
|
298
|
-
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
|
299
|
-
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
|
300
|
-
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
|
301
|
-
emptyFunction.thatReturnsThis = function () {
|
|
302
|
-
return this;
|
|
303
|
-
};
|
|
304
|
-
emptyFunction.thatReturnsArgument = function (arg) {
|
|
305
|
-
return arg;
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
var emptyFunction_1 = emptyFunction;
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
312
|
-
*
|
|
313
|
-
* This source code is licensed under the MIT license found in the
|
|
314
|
-
* LICENSE file in the root directory of this source tree.
|
|
315
|
-
*
|
|
316
|
-
*/
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
278
|
/**
|
|
323
279
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
324
280
|
* This can be used to log issues in development environments in critical
|
|
@@ -326,49 +282,42 @@ var emptyFunction_1 = emptyFunction;
|
|
|
326
282
|
* same logic and follow the same code paths.
|
|
327
283
|
*/
|
|
328
284
|
|
|
329
|
-
var
|
|
285
|
+
var warningWithoutStack = function () {};
|
|
330
286
|
|
|
331
287
|
{
|
|
332
|
-
|
|
333
|
-
for (var _len = arguments.length, args = Array(_len >
|
|
334
|
-
args[_key -
|
|
288
|
+
warningWithoutStack = function (condition, format) {
|
|
289
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
290
|
+
args[_key - 2] = arguments[_key];
|
|
335
291
|
}
|
|
336
292
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
293
|
+
if (format === undefined) {
|
|
294
|
+
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
295
|
+
}
|
|
296
|
+
if (condition) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
341
299
|
if (typeof console !== 'undefined') {
|
|
342
|
-
|
|
300
|
+
var _console;
|
|
301
|
+
|
|
302
|
+
var stringArgs = args.map(function (item) {
|
|
303
|
+
return '' + item;
|
|
304
|
+
});
|
|
305
|
+
(_console = console).error.apply(_console, ['Warning: ' + format].concat(stringArgs));
|
|
343
306
|
}
|
|
344
307
|
try {
|
|
345
308
|
// --- Welcome to debugging React ---
|
|
346
309
|
// This error was thrown as a convenience so that you can use this stack
|
|
347
310
|
// to find the callsite that caused this warning to fire.
|
|
311
|
+
var argIndex = 0;
|
|
312
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
313
|
+
return args[argIndex++];
|
|
314
|
+
});
|
|
348
315
|
throw new Error(message);
|
|
349
316
|
} catch (x) {}
|
|
350
317
|
};
|
|
351
|
-
|
|
352
|
-
warning = function warning(condition, format) {
|
|
353
|
-
if (format === undefined) {
|
|
354
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
|
358
|
-
return; // Ignore CompositeComponent proptype check.
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (!condition) {
|
|
362
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
363
|
-
args[_key2 - 2] = arguments[_key2];
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
printWarning$1.apply(undefined, [format].concat(args));
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
318
|
}
|
|
370
319
|
|
|
371
|
-
var
|
|
320
|
+
var warningWithoutStack$1 = warningWithoutStack;
|
|
372
321
|
|
|
373
322
|
var didWarnStateUpdateForUnmountedComponent = {};
|
|
374
323
|
|
|
@@ -380,7 +329,7 @@ function warnNoop(publicInstance, callerName) {
|
|
|
380
329
|
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
381
330
|
return;
|
|
382
331
|
}
|
|
383
|
-
|
|
332
|
+
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);
|
|
384
333
|
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
385
334
|
}
|
|
386
335
|
}
|
|
@@ -453,13 +402,19 @@ var ReactNoopUpdateQueue = {
|
|
|
453
402
|
}
|
|
454
403
|
};
|
|
455
404
|
|
|
405
|
+
var emptyObject = {};
|
|
406
|
+
{
|
|
407
|
+
Object.freeze(emptyObject);
|
|
408
|
+
}
|
|
409
|
+
|
|
456
410
|
/**
|
|
457
411
|
* Base class helpers for the updating state of a component.
|
|
458
412
|
*/
|
|
459
413
|
function Component(props, context, updater) {
|
|
460
414
|
this.props = props;
|
|
461
415
|
this.context = context;
|
|
462
|
-
|
|
416
|
+
// If a component has string refs, we will assign a different object later.
|
|
417
|
+
this.refs = emptyObject;
|
|
463
418
|
// We initialize the default updater but the real one gets injected by the
|
|
464
419
|
// renderer.
|
|
465
420
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
@@ -493,7 +448,7 @@ Component.prototype.isReactComponent = {};
|
|
|
493
448
|
* @protected
|
|
494
449
|
*/
|
|
495
450
|
Component.prototype.setState = function (partialState, callback) {
|
|
496
|
-
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ?
|
|
451
|
+
!(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;
|
|
497
452
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
498
453
|
};
|
|
499
454
|
|
|
@@ -515,59 +470,812 @@ Component.prototype.forceUpdate = function (callback) {
|
|
|
515
470
|
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
516
471
|
};
|
|
517
472
|
|
|
518
|
-
/**
|
|
519
|
-
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
520
|
-
* we would like to deprecate them, we're not going to move them over to this
|
|
521
|
-
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
522
|
-
*/
|
|
523
|
-
{
|
|
524
|
-
var deprecatedAPIs = {
|
|
525
|
-
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
526
|
-
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
527
|
-
};
|
|
528
|
-
var defineDeprecationWarning = function (methodName, info) {
|
|
529
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
530
|
-
get: function () {
|
|
531
|
-
lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
532
|
-
return undefined;
|
|
473
|
+
/**
|
|
474
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
475
|
+
* we would like to deprecate them, we're not going to move them over to this
|
|
476
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
477
|
+
*/
|
|
478
|
+
{
|
|
479
|
+
var deprecatedAPIs = {
|
|
480
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
481
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
482
|
+
};
|
|
483
|
+
var defineDeprecationWarning = function (methodName, info) {
|
|
484
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
485
|
+
get: function () {
|
|
486
|
+
lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
487
|
+
return undefined;
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
for (var fnName in deprecatedAPIs) {
|
|
492
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
493
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function ComponentDummy() {}
|
|
499
|
+
ComponentDummy.prototype = Component.prototype;
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Convenience component with default shallow equality check for sCU.
|
|
503
|
+
*/
|
|
504
|
+
function PureComponent(props, context, updater) {
|
|
505
|
+
this.props = props;
|
|
506
|
+
this.context = context;
|
|
507
|
+
// If a component has string refs, we will assign a different object later.
|
|
508
|
+
this.refs = emptyObject;
|
|
509
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
513
|
+
pureComponentPrototype.constructor = PureComponent;
|
|
514
|
+
// Avoid an extra prototype jump for these methods.
|
|
515
|
+
objectAssign(pureComponentPrototype, Component.prototype);
|
|
516
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
517
|
+
|
|
518
|
+
// an immutable object with a single mutable value
|
|
519
|
+
function createRef() {
|
|
520
|
+
var refObject = {
|
|
521
|
+
current: null
|
|
522
|
+
};
|
|
523
|
+
{
|
|
524
|
+
Object.seal(refObject);
|
|
525
|
+
}
|
|
526
|
+
return refObject;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* A scheduling library to allow scheduling work with more granular priority and
|
|
533
|
+
* control than requestAnimationFrame and requestIdleCallback.
|
|
534
|
+
* Current TODO items:
|
|
535
|
+
* X- Pull out the scheduleWork polyfill built into React
|
|
536
|
+
* X- Initial test coverage
|
|
537
|
+
* X- Support for multiple callbacks
|
|
538
|
+
* - Support for two priorities; serial and deferred
|
|
539
|
+
* - Better test coverage
|
|
540
|
+
* - Better docblock
|
|
541
|
+
* - Polish documentation, API
|
|
542
|
+
*/
|
|
543
|
+
|
|
544
|
+
// This is a built-in polyfill for requestIdleCallback. It works by scheduling
|
|
545
|
+
// a requestAnimationFrame, storing the time for the start of the frame, then
|
|
546
|
+
// scheduling a postMessage which gets scheduled after paint. Within the
|
|
547
|
+
// postMessage handler do as much work as possible until time + frame rate.
|
|
548
|
+
// By separating the idle call into a separate event tick we ensure that
|
|
549
|
+
// layout, paint and other browser work is counted against the available time.
|
|
550
|
+
// The frame rate is dynamically adjusted.
|
|
551
|
+
|
|
552
|
+
// We capture a local reference to any global, in case it gets polyfilled after
|
|
553
|
+
// this module is initially evaluated.
|
|
554
|
+
// We want to be using a consistent implementation.
|
|
555
|
+
var localDate = Date;
|
|
556
|
+
|
|
557
|
+
// This initialization code may run even on server environments
|
|
558
|
+
// if a component just imports ReactDOM (e.g. for findDOMNode).
|
|
559
|
+
// Some environments might not have setTimeout or clearTimeout.
|
|
560
|
+
// However, we always expect them to be defined on the client.
|
|
561
|
+
// https://github.com/facebook/react/pull/13088
|
|
562
|
+
var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
|
|
563
|
+
var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
|
|
564
|
+
|
|
565
|
+
// We don't expect either of these to necessarily be defined,
|
|
566
|
+
// but we will error later if they are missing on the client.
|
|
567
|
+
var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
|
|
568
|
+
var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
|
|
569
|
+
|
|
570
|
+
var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
|
|
571
|
+
|
|
572
|
+
var now = void 0;
|
|
573
|
+
if (hasNativePerformanceNow) {
|
|
574
|
+
var Performance = performance;
|
|
575
|
+
now = function () {
|
|
576
|
+
return Performance.now();
|
|
577
|
+
};
|
|
578
|
+
} else {
|
|
579
|
+
now = function () {
|
|
580
|
+
return localDate.now();
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
var scheduleWork = void 0;
|
|
585
|
+
var cancelScheduledWork = void 0;
|
|
586
|
+
|
|
587
|
+
if (!canUseDOM) {
|
|
588
|
+
var timeoutIds = new Map();
|
|
589
|
+
|
|
590
|
+
scheduleWork = function (callback, options) {
|
|
591
|
+
// keeping return type consistent
|
|
592
|
+
var callbackConfig = {
|
|
593
|
+
scheduledCallback: callback,
|
|
594
|
+
timeoutTime: 0,
|
|
595
|
+
next: null,
|
|
596
|
+
prev: null
|
|
597
|
+
};
|
|
598
|
+
var timeoutId = localSetTimeout(function () {
|
|
599
|
+
callback({
|
|
600
|
+
timeRemaining: function () {
|
|
601
|
+
return Infinity;
|
|
602
|
+
},
|
|
603
|
+
|
|
604
|
+
didTimeout: false
|
|
605
|
+
});
|
|
606
|
+
});
|
|
607
|
+
timeoutIds.set(callback, timeoutId);
|
|
608
|
+
return callbackConfig;
|
|
609
|
+
};
|
|
610
|
+
cancelScheduledWork = function (callbackId) {
|
|
611
|
+
var callback = callbackId.scheduledCallback;
|
|
612
|
+
var timeoutId = timeoutIds.get(callback);
|
|
613
|
+
timeoutIds.delete(callbackId);
|
|
614
|
+
localClearTimeout(timeoutId);
|
|
615
|
+
};
|
|
616
|
+
} else {
|
|
617
|
+
{
|
|
618
|
+
if (typeof console !== 'undefined') {
|
|
619
|
+
if (typeof localRequestAnimationFrame !== 'function') {
|
|
620
|
+
console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
|
621
|
+
}
|
|
622
|
+
if (typeof localCancelAnimationFrame !== 'function') {
|
|
623
|
+
console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
var headOfPendingCallbacksLinkedList = null;
|
|
629
|
+
var tailOfPendingCallbacksLinkedList = null;
|
|
630
|
+
|
|
631
|
+
// We track what the next soonest timeoutTime is, to be able to quickly tell
|
|
632
|
+
// if none of the scheduled callbacks have timed out.
|
|
633
|
+
var nextSoonestTimeoutTime = -1;
|
|
634
|
+
|
|
635
|
+
var isIdleScheduled = false;
|
|
636
|
+
var isAnimationFrameScheduled = false;
|
|
637
|
+
|
|
638
|
+
// requestAnimationFrame does not run when the tab is in the background.
|
|
639
|
+
// if we're backgrounded we prefer for that work to happen so that the page
|
|
640
|
+
// continues to load in the background.
|
|
641
|
+
// so we also schedule a 'setTimeout' as a fallback.
|
|
642
|
+
var animationFrameTimeout = 100;
|
|
643
|
+
var rafID = void 0;
|
|
644
|
+
var timeoutID = void 0;
|
|
645
|
+
var scheduleAnimationFrameWithFallbackSupport = function (callback) {
|
|
646
|
+
// schedule rAF and also a setTimeout
|
|
647
|
+
rafID = localRequestAnimationFrame(function (timestamp) {
|
|
648
|
+
// cancel the setTimeout
|
|
649
|
+
localClearTimeout(timeoutID);
|
|
650
|
+
callback(timestamp);
|
|
651
|
+
});
|
|
652
|
+
timeoutID = localSetTimeout(function () {
|
|
653
|
+
// cancel the requestAnimationFrame
|
|
654
|
+
localCancelAnimationFrame(rafID);
|
|
655
|
+
callback(now());
|
|
656
|
+
}, animationFrameTimeout);
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
var frameDeadline = 0;
|
|
660
|
+
// We start out assuming that we run at 30fps but then the heuristic tracking
|
|
661
|
+
// will adjust this value to a faster fps if we get more frequent animation
|
|
662
|
+
// frames.
|
|
663
|
+
var previousFrameTime = 33;
|
|
664
|
+
var activeFrameTime = 33;
|
|
665
|
+
|
|
666
|
+
var frameDeadlineObject = {
|
|
667
|
+
didTimeout: false,
|
|
668
|
+
timeRemaining: function () {
|
|
669
|
+
var remaining = frameDeadline - now();
|
|
670
|
+
return remaining > 0 ? remaining : 0;
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Handles the case where a callback errors:
|
|
676
|
+
* - don't catch the error, because this changes debugging behavior
|
|
677
|
+
* - do start a new postMessage callback, to call any remaining callbacks,
|
|
678
|
+
* - but only if there is an error, so there is not extra overhead.
|
|
679
|
+
*/
|
|
680
|
+
var callUnsafely = function (callbackConfig, arg) {
|
|
681
|
+
var callback = callbackConfig.scheduledCallback;
|
|
682
|
+
var finishedCalling = false;
|
|
683
|
+
try {
|
|
684
|
+
callback(arg);
|
|
685
|
+
finishedCalling = true;
|
|
686
|
+
} finally {
|
|
687
|
+
// always remove it from linked list
|
|
688
|
+
cancelScheduledWork(callbackConfig);
|
|
689
|
+
|
|
690
|
+
if (!finishedCalling) {
|
|
691
|
+
// an error must have been thrown
|
|
692
|
+
isIdleScheduled = true;
|
|
693
|
+
window.postMessage(messageKey, '*');
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Checks for timed out callbacks, runs them, and then checks again to see if
|
|
700
|
+
* any more have timed out.
|
|
701
|
+
* Keeps doing this until there are none which have currently timed out.
|
|
702
|
+
*/
|
|
703
|
+
var callTimedOutCallbacks = function () {
|
|
704
|
+
if (headOfPendingCallbacksLinkedList === null) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
var currentTime = now();
|
|
709
|
+
// TODO: this would be more efficient if deferred callbacks are stored in
|
|
710
|
+
// min heap.
|
|
711
|
+
// Or in a linked list with links for both timeoutTime order and insertion
|
|
712
|
+
// order.
|
|
713
|
+
// For now an easy compromise is the current approach:
|
|
714
|
+
// Keep a pointer to the soonest timeoutTime, and check that first.
|
|
715
|
+
// If it has not expired, we can skip traversing the whole list.
|
|
716
|
+
// If it has expired, then we step through all the callbacks.
|
|
717
|
+
if (nextSoonestTimeoutTime === -1 || nextSoonestTimeoutTime > currentTime) {
|
|
718
|
+
// We know that none of them have timed out yet.
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
// NOTE: we intentionally wait to update the nextSoonestTimeoutTime until
|
|
722
|
+
// after successfully calling any timed out callbacks.
|
|
723
|
+
// If a timed out callback throws an error, we could get stuck in a state
|
|
724
|
+
// where the nextSoonestTimeoutTime was set wrong.
|
|
725
|
+
var updatedNextSoonestTimeoutTime = -1; // we will update nextSoonestTimeoutTime below
|
|
726
|
+
var timedOutCallbacks = [];
|
|
727
|
+
|
|
728
|
+
// iterate once to find timed out callbacks and find nextSoonestTimeoutTime
|
|
729
|
+
var currentCallbackConfig = headOfPendingCallbacksLinkedList;
|
|
730
|
+
while (currentCallbackConfig !== null) {
|
|
731
|
+
var _timeoutTime = currentCallbackConfig.timeoutTime;
|
|
732
|
+
if (_timeoutTime !== -1 && _timeoutTime <= currentTime) {
|
|
733
|
+
// it has timed out!
|
|
734
|
+
timedOutCallbacks.push(currentCallbackConfig);
|
|
735
|
+
} else {
|
|
736
|
+
if (_timeoutTime !== -1 && (updatedNextSoonestTimeoutTime === -1 || _timeoutTime < updatedNextSoonestTimeoutTime)) {
|
|
737
|
+
updatedNextSoonestTimeoutTime = _timeoutTime;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
currentCallbackConfig = currentCallbackConfig.next;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
if (timedOutCallbacks.length > 0) {
|
|
744
|
+
frameDeadlineObject.didTimeout = true;
|
|
745
|
+
for (var i = 0, len = timedOutCallbacks.length; i < len; i++) {
|
|
746
|
+
callUnsafely(timedOutCallbacks[i], frameDeadlineObject);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// NOTE: we intentionally wait to update the nextSoonestTimeoutTime until
|
|
751
|
+
// after successfully calling any timed out callbacks.
|
|
752
|
+
nextSoonestTimeoutTime = updatedNextSoonestTimeoutTime;
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
// We use the postMessage trick to defer idle work until after the repaint.
|
|
756
|
+
var messageKey = '__reactIdleCallback$' + Math.random().toString(36).slice(2);
|
|
757
|
+
var idleTick = function (event) {
|
|
758
|
+
if (event.source !== window || event.data !== messageKey) {
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
isIdleScheduled = false;
|
|
762
|
+
|
|
763
|
+
if (headOfPendingCallbacksLinkedList === null) {
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// First call anything which has timed out, until we have caught up.
|
|
768
|
+
callTimedOutCallbacks();
|
|
769
|
+
|
|
770
|
+
var currentTime = now();
|
|
771
|
+
// Next, as long as we have idle time, try calling more callbacks.
|
|
772
|
+
while (frameDeadline - currentTime > 0 && headOfPendingCallbacksLinkedList !== null) {
|
|
773
|
+
var latestCallbackConfig = headOfPendingCallbacksLinkedList;
|
|
774
|
+
frameDeadlineObject.didTimeout = false;
|
|
775
|
+
// callUnsafely will remove it from the head of the linked list
|
|
776
|
+
callUnsafely(latestCallbackConfig, frameDeadlineObject);
|
|
777
|
+
currentTime = now();
|
|
778
|
+
}
|
|
779
|
+
if (headOfPendingCallbacksLinkedList !== null) {
|
|
780
|
+
if (!isAnimationFrameScheduled) {
|
|
781
|
+
// Schedule another animation callback so we retry later.
|
|
782
|
+
isAnimationFrameScheduled = true;
|
|
783
|
+
scheduleAnimationFrameWithFallbackSupport(animationTick);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
// Assumes that we have addEventListener in this environment. Might need
|
|
788
|
+
// something better for old IE.
|
|
789
|
+
window.addEventListener('message', idleTick, false);
|
|
790
|
+
|
|
791
|
+
var animationTick = function (rafTime) {
|
|
792
|
+
isAnimationFrameScheduled = false;
|
|
793
|
+
var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
|
|
794
|
+
if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
|
|
795
|
+
if (nextFrameTime < 8) {
|
|
796
|
+
// Defensive coding. We don't support higher frame rates than 120hz.
|
|
797
|
+
// If we get lower than that, it is probably a bug.
|
|
798
|
+
nextFrameTime = 8;
|
|
799
|
+
}
|
|
800
|
+
// If one frame goes long, then the next one can be short to catch up.
|
|
801
|
+
// If two frames are short in a row, then that's an indication that we
|
|
802
|
+
// actually have a higher frame rate than what we're currently optimizing.
|
|
803
|
+
// We adjust our heuristic dynamically accordingly. For example, if we're
|
|
804
|
+
// running on 120hz display or 90hz VR display.
|
|
805
|
+
// Take the max of the two in case one of them was an anomaly due to
|
|
806
|
+
// missed frame deadlines.
|
|
807
|
+
activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
|
|
808
|
+
} else {
|
|
809
|
+
previousFrameTime = nextFrameTime;
|
|
810
|
+
}
|
|
811
|
+
frameDeadline = rafTime + activeFrameTime;
|
|
812
|
+
if (!isIdleScheduled) {
|
|
813
|
+
isIdleScheduled = true;
|
|
814
|
+
window.postMessage(messageKey, '*');
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
scheduleWork = function (callback, options) /* CallbackConfigType */{
|
|
819
|
+
var timeoutTime = -1;
|
|
820
|
+
if (options != null && typeof options.timeout === 'number') {
|
|
821
|
+
timeoutTime = now() + options.timeout;
|
|
822
|
+
}
|
|
823
|
+
if (nextSoonestTimeoutTime === -1 || timeoutTime !== -1 && timeoutTime < nextSoonestTimeoutTime) {
|
|
824
|
+
nextSoonestTimeoutTime = timeoutTime;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
var scheduledCallbackConfig = {
|
|
828
|
+
scheduledCallback: callback,
|
|
829
|
+
timeoutTime: timeoutTime,
|
|
830
|
+
prev: null,
|
|
831
|
+
next: null
|
|
832
|
+
};
|
|
833
|
+
if (headOfPendingCallbacksLinkedList === null) {
|
|
834
|
+
// Make this callback the head and tail of our list
|
|
835
|
+
headOfPendingCallbacksLinkedList = scheduledCallbackConfig;
|
|
836
|
+
tailOfPendingCallbacksLinkedList = scheduledCallbackConfig;
|
|
837
|
+
} else {
|
|
838
|
+
// Add latest callback as the new tail of the list
|
|
839
|
+
scheduledCallbackConfig.prev = tailOfPendingCallbacksLinkedList;
|
|
840
|
+
// renaming for clarity
|
|
841
|
+
var oldTailOfPendingCallbacksLinkedList = tailOfPendingCallbacksLinkedList;
|
|
842
|
+
if (oldTailOfPendingCallbacksLinkedList !== null) {
|
|
843
|
+
oldTailOfPendingCallbacksLinkedList.next = scheduledCallbackConfig;
|
|
844
|
+
}
|
|
845
|
+
tailOfPendingCallbacksLinkedList = scheduledCallbackConfig;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
if (!isAnimationFrameScheduled) {
|
|
849
|
+
// If rAF didn't already schedule one, we need to schedule a frame.
|
|
850
|
+
// TODO: If this rAF doesn't materialize because the browser throttles, we
|
|
851
|
+
// might want to still have setTimeout trigger scheduleWork as a backup to ensure
|
|
852
|
+
// that we keep performing work.
|
|
853
|
+
isAnimationFrameScheduled = true;
|
|
854
|
+
scheduleAnimationFrameWithFallbackSupport(animationTick);
|
|
855
|
+
}
|
|
856
|
+
return scheduledCallbackConfig;
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
cancelScheduledWork = function (callbackConfig /* CallbackConfigType */
|
|
860
|
+
) {
|
|
861
|
+
if (callbackConfig.prev === null && headOfPendingCallbacksLinkedList !== callbackConfig) {
|
|
862
|
+
// this callbackConfig has already been cancelled.
|
|
863
|
+
// cancelScheduledWork should be idempotent, a no-op after first call.
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* There are four possible cases:
|
|
869
|
+
* - Head/nodeToRemove/Tail -> null
|
|
870
|
+
* In this case we set Head and Tail to null.
|
|
871
|
+
* - Head -> ... middle nodes... -> Tail/nodeToRemove
|
|
872
|
+
* In this case we point the middle.next to null and put middle as the new
|
|
873
|
+
* Tail.
|
|
874
|
+
* - Head/nodeToRemove -> ...middle nodes... -> Tail
|
|
875
|
+
* In this case we point the middle.prev at null and move the Head to
|
|
876
|
+
* middle.
|
|
877
|
+
* - Head -> ... ?some nodes ... -> nodeToRemove -> ... ?some nodes ... -> Tail
|
|
878
|
+
* In this case we point the Head.next to the Tail and the Tail.prev to
|
|
879
|
+
* the Head.
|
|
880
|
+
*/
|
|
881
|
+
var next = callbackConfig.next;
|
|
882
|
+
var prev = callbackConfig.prev;
|
|
883
|
+
callbackConfig.next = null;
|
|
884
|
+
callbackConfig.prev = null;
|
|
885
|
+
if (next !== null) {
|
|
886
|
+
// we have a next
|
|
887
|
+
|
|
888
|
+
if (prev !== null) {
|
|
889
|
+
// we have a prev
|
|
890
|
+
|
|
891
|
+
// callbackConfig is somewhere in the middle of a list of 3 or more nodes.
|
|
892
|
+
prev.next = next;
|
|
893
|
+
next.prev = prev;
|
|
894
|
+
return;
|
|
895
|
+
} else {
|
|
896
|
+
// there is a next but not a previous one;
|
|
897
|
+
// callbackConfig is the head of a list of 2 or more other nodes.
|
|
898
|
+
next.prev = null;
|
|
899
|
+
headOfPendingCallbacksLinkedList = next;
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
} else {
|
|
903
|
+
// there is no next callback config; this must the tail of the list
|
|
904
|
+
|
|
905
|
+
if (prev !== null) {
|
|
906
|
+
// we have a prev
|
|
907
|
+
|
|
908
|
+
// callbackConfig is the tail of a list of 2 or more other nodes.
|
|
909
|
+
prev.next = null;
|
|
910
|
+
tailOfPendingCallbacksLinkedList = prev;
|
|
911
|
+
return;
|
|
912
|
+
} else {
|
|
913
|
+
// there is no previous callback config;
|
|
914
|
+
// callbackConfig is the only thing in the linked list,
|
|
915
|
+
// so both head and tail point to it.
|
|
916
|
+
headOfPendingCallbacksLinkedList = null;
|
|
917
|
+
tailOfPendingCallbacksLinkedList = null;
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
var DEFAULT_THREAD_ID = 0;
|
|
925
|
+
|
|
926
|
+
// Counters used to generate unique IDs.
|
|
927
|
+
var interactionIDCounter = 0;
|
|
928
|
+
var threadIDCounter = 0;
|
|
929
|
+
|
|
930
|
+
// Set of currently tracked interactions.
|
|
931
|
+
// Interactions "stack"–
|
|
932
|
+
// Meaning that newly tracked interactions are appended to the previously active set.
|
|
933
|
+
// When an interaction goes out of scope, the previous set (if any) is restored.
|
|
934
|
+
var interactionsRef = null;
|
|
935
|
+
|
|
936
|
+
// Listener(s) to notify when interactions begin and end.
|
|
937
|
+
var subscriberRef = null;
|
|
938
|
+
|
|
939
|
+
if (enableSchedulerTracking) {
|
|
940
|
+
interactionsRef = {
|
|
941
|
+
current: new Set()
|
|
942
|
+
};
|
|
943
|
+
subscriberRef = {
|
|
944
|
+
current: null
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
function unstable_clear(callback) {
|
|
949
|
+
if (!enableSchedulerTracking) {
|
|
950
|
+
return callback();
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
var prevInteractions = interactionsRef.current;
|
|
954
|
+
interactionsRef.current = new Set();
|
|
955
|
+
|
|
956
|
+
try {
|
|
957
|
+
return callback();
|
|
958
|
+
} finally {
|
|
959
|
+
interactionsRef.current = prevInteractions;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
function unstable_getCurrent() {
|
|
964
|
+
if (!enableSchedulerTracking) {
|
|
965
|
+
return null;
|
|
966
|
+
} else {
|
|
967
|
+
return interactionsRef.current;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
function unstable_getThreadID() {
|
|
972
|
+
return ++threadIDCounter;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
function unstable_track(name, timestamp, callback) {
|
|
976
|
+
var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
|
|
977
|
+
|
|
978
|
+
if (!enableSchedulerTracking) {
|
|
979
|
+
return callback();
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
var interaction = {
|
|
983
|
+
__count: 1,
|
|
984
|
+
id: interactionIDCounter++,
|
|
985
|
+
name: name,
|
|
986
|
+
timestamp: timestamp
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
var prevInteractions = interactionsRef.current;
|
|
990
|
+
|
|
991
|
+
// Tracked interactions should stack/accumulate.
|
|
992
|
+
// To do that, clone the current interactions.
|
|
993
|
+
// The previous set will be restored upon completion.
|
|
994
|
+
var interactions = new Set(prevInteractions);
|
|
995
|
+
interactions.add(interaction);
|
|
996
|
+
interactionsRef.current = interactions;
|
|
997
|
+
|
|
998
|
+
var subscriber = subscriberRef.current;
|
|
999
|
+
var returnValue = void 0;
|
|
1000
|
+
|
|
1001
|
+
try {
|
|
1002
|
+
if (subscriber !== null) {
|
|
1003
|
+
subscriber.onInteractionTracked(interaction);
|
|
1004
|
+
}
|
|
1005
|
+
} finally {
|
|
1006
|
+
try {
|
|
1007
|
+
if (subscriber !== null) {
|
|
1008
|
+
subscriber.onWorkStarted(interactions, threadID);
|
|
1009
|
+
}
|
|
1010
|
+
} finally {
|
|
1011
|
+
try {
|
|
1012
|
+
returnValue = callback();
|
|
1013
|
+
} finally {
|
|
1014
|
+
interactionsRef.current = prevInteractions;
|
|
1015
|
+
|
|
1016
|
+
try {
|
|
1017
|
+
if (subscriber !== null) {
|
|
1018
|
+
subscriber.onWorkStopped(interactions, threadID);
|
|
1019
|
+
}
|
|
1020
|
+
} finally {
|
|
1021
|
+
interaction.__count--;
|
|
1022
|
+
|
|
1023
|
+
// If no async work was scheduled for this interaction,
|
|
1024
|
+
// Notify subscribers that it's completed.
|
|
1025
|
+
if (subscriber !== null && interaction.__count === 0) {
|
|
1026
|
+
subscriber.onInteractionScheduledWorkCompleted(interaction);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
return returnValue;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
function unstable_wrap(callback) {
|
|
1037
|
+
var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
|
|
1038
|
+
|
|
1039
|
+
if (!enableSchedulerTracking) {
|
|
1040
|
+
return callback;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
var wrappedInteractions = interactionsRef.current;
|
|
1044
|
+
|
|
1045
|
+
var subscriber = subscriberRef.current;
|
|
1046
|
+
if (subscriber !== null) {
|
|
1047
|
+
subscriber.onWorkScheduled(wrappedInteractions, threadID);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
// Update the pending async work count for the current interactions.
|
|
1051
|
+
// Update after calling subscribers in case of error.
|
|
1052
|
+
wrappedInteractions.forEach(function (interaction) {
|
|
1053
|
+
interaction.__count++;
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
var hasRun = false;
|
|
1057
|
+
|
|
1058
|
+
function wrapped() {
|
|
1059
|
+
var prevInteractions = interactionsRef.current;
|
|
1060
|
+
interactionsRef.current = wrappedInteractions;
|
|
1061
|
+
|
|
1062
|
+
subscriber = subscriberRef.current;
|
|
1063
|
+
|
|
1064
|
+
try {
|
|
1065
|
+
var returnValue = void 0;
|
|
1066
|
+
|
|
1067
|
+
try {
|
|
1068
|
+
if (subscriber !== null) {
|
|
1069
|
+
subscriber.onWorkStarted(wrappedInteractions, threadID);
|
|
1070
|
+
}
|
|
1071
|
+
} finally {
|
|
1072
|
+
try {
|
|
1073
|
+
returnValue = callback.apply(undefined, arguments);
|
|
1074
|
+
} finally {
|
|
1075
|
+
interactionsRef.current = prevInteractions;
|
|
1076
|
+
|
|
1077
|
+
if (subscriber !== null) {
|
|
1078
|
+
subscriber.onWorkStopped(wrappedInteractions, threadID);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
return returnValue;
|
|
1084
|
+
} finally {
|
|
1085
|
+
if (!hasRun) {
|
|
1086
|
+
// We only expect a wrapped function to be executed once,
|
|
1087
|
+
// But in the event that it's executed more than once–
|
|
1088
|
+
// Only decrement the outstanding interaction counts once.
|
|
1089
|
+
hasRun = true;
|
|
1090
|
+
|
|
1091
|
+
// Update pending async counts for all wrapped interactions.
|
|
1092
|
+
// If this was the last scheduled async work for any of them,
|
|
1093
|
+
// Mark them as completed.
|
|
1094
|
+
wrappedInteractions.forEach(function (interaction) {
|
|
1095
|
+
interaction.__count--;
|
|
1096
|
+
|
|
1097
|
+
if (subscriber !== null && interaction.__count === 0) {
|
|
1098
|
+
subscriber.onInteractionScheduledWorkCompleted(interaction);
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
wrapped.cancel = function cancel() {
|
|
1106
|
+
subscriber = subscriberRef.current;
|
|
1107
|
+
|
|
1108
|
+
try {
|
|
1109
|
+
if (subscriber !== null) {
|
|
1110
|
+
subscriber.onWorkCanceled(wrappedInteractions, threadID);
|
|
1111
|
+
}
|
|
1112
|
+
} finally {
|
|
1113
|
+
// Update pending async counts for all wrapped interactions.
|
|
1114
|
+
// If this was the last scheduled async work for any of them,
|
|
1115
|
+
// Mark them as completed.
|
|
1116
|
+
wrappedInteractions.forEach(function (interaction) {
|
|
1117
|
+
interaction.__count--;
|
|
1118
|
+
|
|
1119
|
+
if (subscriber && interaction.__count === 0) {
|
|
1120
|
+
subscriber.onInteractionScheduledWorkCompleted(interaction);
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
return wrapped;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
var subscribers = null;
|
|
1130
|
+
if (enableSchedulerTracking) {
|
|
1131
|
+
subscribers = new Set();
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
function unstable_subscribe(subscriber) {
|
|
1135
|
+
if (enableSchedulerTracking) {
|
|
1136
|
+
subscribers.add(subscriber);
|
|
1137
|
+
|
|
1138
|
+
if (subscribers.size === 1) {
|
|
1139
|
+
subscriberRef.current = {
|
|
1140
|
+
onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
|
|
1141
|
+
onInteractionTracked: onInteractionTracked,
|
|
1142
|
+
onWorkCanceled: onWorkCanceled,
|
|
1143
|
+
onWorkScheduled: onWorkScheduled,
|
|
1144
|
+
onWorkStarted: onWorkStarted,
|
|
1145
|
+
onWorkStopped: onWorkStopped
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
function unstable_unsubscribe(subscriber) {
|
|
1152
|
+
if (enableSchedulerTracking) {
|
|
1153
|
+
subscribers.delete(subscriber);
|
|
1154
|
+
|
|
1155
|
+
if (subscribers.size === 0) {
|
|
1156
|
+
subscriberRef.current = null;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
function onInteractionTracked(interaction) {
|
|
1162
|
+
var didCatchError = false;
|
|
1163
|
+
var caughtError = null;
|
|
1164
|
+
|
|
1165
|
+
subscribers.forEach(function (subscriber) {
|
|
1166
|
+
try {
|
|
1167
|
+
subscriber.onInteractionTracked(interaction);
|
|
1168
|
+
} catch (error) {
|
|
1169
|
+
if (!didCatchError) {
|
|
1170
|
+
didCatchError = true;
|
|
1171
|
+
caughtError = error;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
if (didCatchError) {
|
|
1177
|
+
throw caughtError;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
function onInteractionScheduledWorkCompleted(interaction) {
|
|
1182
|
+
var didCatchError = false;
|
|
1183
|
+
var caughtError = null;
|
|
1184
|
+
|
|
1185
|
+
subscribers.forEach(function (subscriber) {
|
|
1186
|
+
try {
|
|
1187
|
+
subscriber.onInteractionScheduledWorkCompleted(interaction);
|
|
1188
|
+
} catch (error) {
|
|
1189
|
+
if (!didCatchError) {
|
|
1190
|
+
didCatchError = true;
|
|
1191
|
+
caughtError = error;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1196
|
+
if (didCatchError) {
|
|
1197
|
+
throw caughtError;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
function onWorkScheduled(interactions, threadID) {
|
|
1202
|
+
var didCatchError = false;
|
|
1203
|
+
var caughtError = null;
|
|
1204
|
+
|
|
1205
|
+
subscribers.forEach(function (subscriber) {
|
|
1206
|
+
try {
|
|
1207
|
+
subscriber.onWorkScheduled(interactions, threadID);
|
|
1208
|
+
} catch (error) {
|
|
1209
|
+
if (!didCatchError) {
|
|
1210
|
+
didCatchError = true;
|
|
1211
|
+
caughtError = error;
|
|
533
1212
|
}
|
|
534
|
-
});
|
|
535
|
-
};
|
|
536
|
-
for (var fnName in deprecatedAPIs) {
|
|
537
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
538
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
539
1213
|
}
|
|
1214
|
+
});
|
|
1215
|
+
|
|
1216
|
+
if (didCatchError) {
|
|
1217
|
+
throw caughtError;
|
|
540
1218
|
}
|
|
541
1219
|
}
|
|
542
1220
|
|
|
543
|
-
function
|
|
544
|
-
|
|
1221
|
+
function onWorkStarted(interactions, threadID) {
|
|
1222
|
+
var didCatchError = false;
|
|
1223
|
+
var caughtError = null;
|
|
545
1224
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
1225
|
+
subscribers.forEach(function (subscriber) {
|
|
1226
|
+
try {
|
|
1227
|
+
subscriber.onWorkStarted(interactions, threadID);
|
|
1228
|
+
} catch (error) {
|
|
1229
|
+
if (!didCatchError) {
|
|
1230
|
+
didCatchError = true;
|
|
1231
|
+
caughtError = error;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
if (didCatchError) {
|
|
1237
|
+
throw caughtError;
|
|
1238
|
+
}
|
|
554
1239
|
}
|
|
555
1240
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
objectAssign(pureComponentPrototype, Component.prototype);
|
|
560
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
1241
|
+
function onWorkStopped(interactions, threadID) {
|
|
1242
|
+
var didCatchError = false;
|
|
1243
|
+
var caughtError = null;
|
|
561
1244
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
1245
|
+
subscribers.forEach(function (subscriber) {
|
|
1246
|
+
try {
|
|
1247
|
+
subscriber.onWorkStopped(interactions, threadID);
|
|
1248
|
+
} catch (error) {
|
|
1249
|
+
if (!didCatchError) {
|
|
1250
|
+
didCatchError = true;
|
|
1251
|
+
caughtError = error;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
if (didCatchError) {
|
|
1257
|
+
throw caughtError;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
function onWorkCanceled(interactions, threadID) {
|
|
1262
|
+
var didCatchError = false;
|
|
1263
|
+
var caughtError = null;
|
|
1264
|
+
|
|
1265
|
+
subscribers.forEach(function (subscriber) {
|
|
1266
|
+
try {
|
|
1267
|
+
subscriber.onWorkCanceled(interactions, threadID);
|
|
1268
|
+
} catch (error) {
|
|
1269
|
+
if (!didCatchError) {
|
|
1270
|
+
didCatchError = true;
|
|
1271
|
+
caughtError = error;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
if (didCatchError) {
|
|
1277
|
+
throw caughtError;
|
|
569
1278
|
}
|
|
570
|
-
return refObject;
|
|
571
1279
|
}
|
|
572
1280
|
|
|
573
1281
|
/**
|
|
@@ -581,9 +1289,203 @@ var ReactCurrentOwner = {
|
|
|
581
1289
|
* @internal
|
|
582
1290
|
* @type {ReactComponent}
|
|
583
1291
|
*/
|
|
584
|
-
current: null
|
|
1292
|
+
current: null,
|
|
1293
|
+
currentDispatcher: null
|
|
1294
|
+
};
|
|
1295
|
+
|
|
1296
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
1297
|
+
|
|
1298
|
+
var describeComponentFrame = function (name, source, ownerName) {
|
|
1299
|
+
var sourceInfo = '';
|
|
1300
|
+
if (source) {
|
|
1301
|
+
var path = source.fileName;
|
|
1302
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
1303
|
+
{
|
|
1304
|
+
// In DEV, include code for a common special case:
|
|
1305
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
1306
|
+
if (/^index\./.test(fileName)) {
|
|
1307
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
1308
|
+
if (match) {
|
|
1309
|
+
var pathBeforeSlash = match[1];
|
|
1310
|
+
if (pathBeforeSlash) {
|
|
1311
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
1312
|
+
fileName = folderName + '/' + fileName;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
1318
|
+
} else if (ownerName) {
|
|
1319
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
1320
|
+
}
|
|
1321
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
1322
|
+
};
|
|
1323
|
+
|
|
1324
|
+
var Resolved = 1;
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
function refineResolvedThenable(thenable) {
|
|
1330
|
+
return thenable._reactStatus === Resolved ? thenable._reactResult : null;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
function getComponentName(type) {
|
|
1334
|
+
if (type == null) {
|
|
1335
|
+
// Host root, text node or just invalid type.
|
|
1336
|
+
return null;
|
|
1337
|
+
}
|
|
1338
|
+
{
|
|
1339
|
+
if (typeof type.tag === 'number') {
|
|
1340
|
+
warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
if (typeof type === 'function') {
|
|
1344
|
+
return type.displayName || type.name || null;
|
|
1345
|
+
}
|
|
1346
|
+
if (typeof type === 'string') {
|
|
1347
|
+
return type;
|
|
1348
|
+
}
|
|
1349
|
+
switch (type) {
|
|
1350
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
1351
|
+
return 'AsyncMode';
|
|
1352
|
+
case REACT_FRAGMENT_TYPE:
|
|
1353
|
+
return 'Fragment';
|
|
1354
|
+
case REACT_PORTAL_TYPE:
|
|
1355
|
+
return 'Portal';
|
|
1356
|
+
case REACT_PROFILER_TYPE:
|
|
1357
|
+
return 'Profiler';
|
|
1358
|
+
case REACT_STRICT_MODE_TYPE:
|
|
1359
|
+
return 'StrictMode';
|
|
1360
|
+
case REACT_PLACEHOLDER_TYPE:
|
|
1361
|
+
return 'Placeholder';
|
|
1362
|
+
}
|
|
1363
|
+
if (typeof type === 'object') {
|
|
1364
|
+
switch (type.$$typeof) {
|
|
1365
|
+
case REACT_CONTEXT_TYPE:
|
|
1366
|
+
return 'Context.Consumer';
|
|
1367
|
+
case REACT_PROVIDER_TYPE:
|
|
1368
|
+
return 'Context.Provider';
|
|
1369
|
+
case REACT_FORWARD_REF_TYPE:
|
|
1370
|
+
var renderFn = type.render;
|
|
1371
|
+
var functionName = renderFn.displayName || renderFn.name || '';
|
|
1372
|
+
return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
|
|
1373
|
+
}
|
|
1374
|
+
if (typeof type.then === 'function') {
|
|
1375
|
+
var thenable = type;
|
|
1376
|
+
var resolvedThenable = refineResolvedThenable(thenable);
|
|
1377
|
+
if (resolvedThenable) {
|
|
1378
|
+
return getComponentName(resolvedThenable);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
return null;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
var ReactDebugCurrentFrame = {};
|
|
1386
|
+
|
|
1387
|
+
var currentlyValidatingElement = null;
|
|
1388
|
+
|
|
1389
|
+
function setCurrentlyValidatingElement(element) {
|
|
1390
|
+
{
|
|
1391
|
+
currentlyValidatingElement = element;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
{
|
|
1396
|
+
// Stack implementation injected by the current renderer.
|
|
1397
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
1398
|
+
|
|
1399
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
1400
|
+
var stack = '';
|
|
1401
|
+
|
|
1402
|
+
// Add an extra top frame while an element is being validated
|
|
1403
|
+
if (currentlyValidatingElement) {
|
|
1404
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
1405
|
+
var owner = currentlyValidatingElement._owner;
|
|
1406
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
// Delegate to the injected renderer-specific implementation
|
|
1410
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
1411
|
+
if (impl) {
|
|
1412
|
+
stack += impl() || '';
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
return stack;
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
var ReactSharedInternals = {
|
|
1420
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
1421
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
1422
|
+
assign: objectAssign
|
|
585
1423
|
};
|
|
586
1424
|
|
|
1425
|
+
{
|
|
1426
|
+
// Re-export the schedule API(s) for UMD bundles.
|
|
1427
|
+
// This avoids introducing a dependency on a new UMD global in a minor update,
|
|
1428
|
+
// Since that would be a breaking change (e.g. for all existing CodeSandboxes).
|
|
1429
|
+
// This re-export is only required for UMD bundles;
|
|
1430
|
+
// CJS bundles use the shared NPM package.
|
|
1431
|
+
objectAssign(ReactSharedInternals, {
|
|
1432
|
+
Schedule: {
|
|
1433
|
+
unstable_cancelScheduledWork: cancelScheduledWork,
|
|
1434
|
+
unstable_now: now,
|
|
1435
|
+
unstable_scheduleWork: scheduleWork
|
|
1436
|
+
},
|
|
1437
|
+
ScheduleTracking: {
|
|
1438
|
+
__interactionsRef: interactionsRef,
|
|
1439
|
+
__subscriberRef: subscriberRef,
|
|
1440
|
+
unstable_clear: unstable_clear,
|
|
1441
|
+
unstable_getCurrent: unstable_getCurrent,
|
|
1442
|
+
unstable_getThreadID: unstable_getThreadID,
|
|
1443
|
+
unstable_subscribe: unstable_subscribe,
|
|
1444
|
+
unstable_track: unstable_track,
|
|
1445
|
+
unstable_unsubscribe: unstable_unsubscribe,
|
|
1446
|
+
unstable_wrap: unstable_wrap
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
{
|
|
1452
|
+
objectAssign(ReactSharedInternals, {
|
|
1453
|
+
// These should not be included in production.
|
|
1454
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
1455
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
1456
|
+
// TODO: remove in React 17.0.
|
|
1457
|
+
ReactComponentTreeHook: {}
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
1463
|
+
* This can be used to log issues in development environments in critical
|
|
1464
|
+
* paths. Removing the logging code for production environments will keep the
|
|
1465
|
+
* same logic and follow the same code paths.
|
|
1466
|
+
*/
|
|
1467
|
+
|
|
1468
|
+
var warning = warningWithoutStack$1;
|
|
1469
|
+
|
|
1470
|
+
{
|
|
1471
|
+
warning = function (condition, format) {
|
|
1472
|
+
if (condition) {
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1476
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
1477
|
+
// eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
1478
|
+
|
|
1479
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1480
|
+
args[_key - 2] = arguments[_key];
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
var warning$1 = warning;
|
|
1488
|
+
|
|
587
1489
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
588
1490
|
|
|
589
1491
|
var RESERVED_PROPS = {
|
|
@@ -624,7 +1526,7 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
624
1526
|
var warnAboutAccessingKey = function () {
|
|
625
1527
|
if (!specialPropKeyWarningShown) {
|
|
626
1528
|
specialPropKeyWarningShown = true;
|
|
627
|
-
|
|
1529
|
+
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);
|
|
628
1530
|
}
|
|
629
1531
|
};
|
|
630
1532
|
warnAboutAccessingKey.isReactWarning = true;
|
|
@@ -638,7 +1540,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
638
1540
|
var warnAboutAccessingRef = function () {
|
|
639
1541
|
if (!specialPropRefWarningShown) {
|
|
640
1542
|
specialPropRefWarningShown = true;
|
|
641
|
-
|
|
1543
|
+
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);
|
|
642
1544
|
}
|
|
643
1545
|
};
|
|
644
1546
|
warnAboutAccessingRef.isReactWarning = true;
|
|
@@ -670,7 +1572,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
670
1572
|
*/
|
|
671
1573
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
672
1574
|
var element = {
|
|
673
|
-
// This tag
|
|
1575
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
674
1576
|
$$typeof: REACT_ELEMENT_TYPE,
|
|
675
1577
|
|
|
676
1578
|
// Built-in properties that belong on the element
|
|
@@ -786,14 +1688,12 @@ function createElement(type, config, children) {
|
|
|
786
1688
|
}
|
|
787
1689
|
{
|
|
788
1690
|
if (key || ref) {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
defineRefPropWarningGetter(props, displayName);
|
|
796
|
-
}
|
|
1691
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
1692
|
+
if (key) {
|
|
1693
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
1694
|
+
}
|
|
1695
|
+
if (ref) {
|
|
1696
|
+
defineRefPropWarningGetter(props, displayName);
|
|
797
1697
|
}
|
|
798
1698
|
}
|
|
799
1699
|
}
|
|
@@ -817,6 +1717,8 @@ function cloneAndReplaceKey(oldElement, newKey) {
|
|
|
817
1717
|
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
818
1718
|
*/
|
|
819
1719
|
function cloneElement(element, config, children) {
|
|
1720
|
+
!!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
|
|
1721
|
+
|
|
820
1722
|
var propName = void 0;
|
|
821
1723
|
|
|
822
1724
|
// Original props are copied
|
|
@@ -882,28 +1784,13 @@ function cloneElement(element, config, children) {
|
|
|
882
1784
|
* Verifies the object is a ReactElement.
|
|
883
1785
|
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
884
1786
|
* @param {?object} object
|
|
885
|
-
* @return {boolean} True if `object` is a
|
|
1787
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
886
1788
|
* @final
|
|
887
1789
|
*/
|
|
888
1790
|
function isValidElement(object) {
|
|
889
1791
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
890
1792
|
}
|
|
891
1793
|
|
|
892
|
-
var ReactDebugCurrentFrame = {};
|
|
893
|
-
|
|
894
|
-
{
|
|
895
|
-
// Component that is being worked on
|
|
896
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
897
|
-
|
|
898
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
899
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
900
|
-
if (impl) {
|
|
901
|
-
return impl();
|
|
902
|
-
}
|
|
903
|
-
return null;
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
|
|
907
1794
|
var SEPARATOR = '.';
|
|
908
1795
|
var SUBSEPARATOR = ':';
|
|
909
1796
|
|
|
@@ -1031,7 +1918,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1031
1918
|
{
|
|
1032
1919
|
// Warn about using Maps as children
|
|
1033
1920
|
if (iteratorFn === children.entries) {
|
|
1034
|
-
|
|
1921
|
+
!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;
|
|
1035
1922
|
didWarnAboutMaps = true;
|
|
1036
1923
|
}
|
|
1037
1924
|
}
|
|
@@ -1050,7 +1937,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1050
1937
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1051
1938
|
}
|
|
1052
1939
|
var childrenString = '' + children;
|
|
1053
|
-
|
|
1940
|
+
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);
|
|
1054
1941
|
}
|
|
1055
1942
|
}
|
|
1056
1943
|
|
|
@@ -1109,7 +1996,7 @@ function forEachSingleChild(bookKeeping, child, name) {
|
|
|
1109
1996
|
/**
|
|
1110
1997
|
* Iterates through children that are typically specified as `props.children`.
|
|
1111
1998
|
*
|
|
1112
|
-
* See https://reactjs.org/docs/react-api.html#
|
|
1999
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1113
2000
|
*
|
|
1114
2001
|
* The provided forEachFunc(child, index) will be called for each
|
|
1115
2002
|
* leaf child.
|
|
@@ -1136,7 +2023,9 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
|
1136
2023
|
|
|
1137
2024
|
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1138
2025
|
if (Array.isArray(mappedChild)) {
|
|
1139
|
-
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey,
|
|
2026
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
|
2027
|
+
return c;
|
|
2028
|
+
});
|
|
1140
2029
|
} else if (mappedChild != null) {
|
|
1141
2030
|
if (isValidElement(mappedChild)) {
|
|
1142
2031
|
mappedChild = cloneAndReplaceKey(mappedChild,
|
|
@@ -1161,7 +2050,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
|
1161
2050
|
/**
|
|
1162
2051
|
* Maps children that are typically specified as `props.children`.
|
|
1163
2052
|
*
|
|
1164
|
-
* See https://reactjs.org/docs/react-api.html#
|
|
2053
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1165
2054
|
*
|
|
1166
2055
|
* The provided mapFunction(child, key, index) will be called for each
|
|
1167
2056
|
* leaf child.
|
|
@@ -1184,24 +2073,28 @@ function mapChildren(children, func, context) {
|
|
|
1184
2073
|
* Count the number of children that are typically specified as
|
|
1185
2074
|
* `props.children`.
|
|
1186
2075
|
*
|
|
1187
|
-
* See https://reactjs.org/docs/react-api.html#
|
|
2076
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1188
2077
|
*
|
|
1189
2078
|
* @param {?*} children Children tree container.
|
|
1190
2079
|
* @return {number} The number of children.
|
|
1191
2080
|
*/
|
|
1192
|
-
function countChildren(children
|
|
1193
|
-
return traverseAllChildren(children,
|
|
2081
|
+
function countChildren(children) {
|
|
2082
|
+
return traverseAllChildren(children, function () {
|
|
2083
|
+
return null;
|
|
2084
|
+
}, null);
|
|
1194
2085
|
}
|
|
1195
2086
|
|
|
1196
2087
|
/**
|
|
1197
2088
|
* Flatten a children object (typically specified as `props.children`) and
|
|
1198
2089
|
* return an array with appropriately re-keyed children.
|
|
1199
2090
|
*
|
|
1200
|
-
* See https://reactjs.org/docs/react-api.html#
|
|
2091
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1201
2092
|
*/
|
|
1202
2093
|
function toArray(children) {
|
|
1203
2094
|
var result = [];
|
|
1204
|
-
mapIntoWithKeyPrefixInternal(children, result, null,
|
|
2095
|
+
mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
|
2096
|
+
return child;
|
|
2097
|
+
});
|
|
1205
2098
|
return result;
|
|
1206
2099
|
}
|
|
1207
2100
|
|
|
@@ -1209,7 +2102,7 @@ function toArray(children) {
|
|
|
1209
2102
|
* Returns the first child in a collection of children and verifies that there
|
|
1210
2103
|
* is only one child in the collection.
|
|
1211
2104
|
*
|
|
1212
|
-
* See https://reactjs.org/docs/react-api.html#
|
|
2105
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
1213
2106
|
*
|
|
1214
2107
|
* The current implementation of this function assumes that a single child gets
|
|
1215
2108
|
* passed without a wrapper, but the purpose of this helper function is to
|
|
@@ -1220,67 +2113,97 @@ function toArray(children) {
|
|
|
1220
2113
|
* structure.
|
|
1221
2114
|
*/
|
|
1222
2115
|
function onlyChild(children) {
|
|
1223
|
-
!isValidElement(children) ?
|
|
2116
|
+
!isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
|
1224
2117
|
return children;
|
|
1225
2118
|
}
|
|
1226
2119
|
|
|
2120
|
+
function readContext(context, observedBits) {
|
|
2121
|
+
var dispatcher = ReactCurrentOwner.currentDispatcher;
|
|
2122
|
+
!(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;
|
|
2123
|
+
return dispatcher.readContext(context, observedBits);
|
|
2124
|
+
}
|
|
2125
|
+
|
|
1227
2126
|
function createContext(defaultValue, calculateChangedBits) {
|
|
1228
2127
|
if (calculateChangedBits === undefined) {
|
|
1229
2128
|
calculateChangedBits = null;
|
|
1230
2129
|
} else {
|
|
1231
2130
|
{
|
|
1232
|
-
|
|
2131
|
+
!(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
|
|
1233
2132
|
}
|
|
1234
2133
|
}
|
|
1235
2134
|
|
|
1236
2135
|
var context = {
|
|
1237
2136
|
$$typeof: REACT_CONTEXT_TYPE,
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
2137
|
+
_calculateChangedBits: calculateChangedBits,
|
|
2138
|
+
// As a workaround to support multiple concurrent renderers, we categorize
|
|
2139
|
+
// some renderers as primary and others as secondary. We only expect
|
|
2140
|
+
// there to be two concurrent renderers at most: React Native (primary) and
|
|
2141
|
+
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
2142
|
+
// Secondary renderers store their context values on separate fields.
|
|
2143
|
+
_currentValue: defaultValue,
|
|
2144
|
+
_currentValue2: defaultValue,
|
|
1242
2145
|
// These are circular
|
|
1243
2146
|
Provider: null,
|
|
1244
|
-
Consumer: null
|
|
2147
|
+
Consumer: null,
|
|
2148
|
+
unstable_read: null
|
|
1245
2149
|
};
|
|
1246
2150
|
|
|
1247
2151
|
context.Provider = {
|
|
1248
2152
|
$$typeof: REACT_PROVIDER_TYPE,
|
|
1249
|
-
|
|
2153
|
+
_context: context
|
|
1250
2154
|
};
|
|
1251
2155
|
context.Consumer = context;
|
|
2156
|
+
context.unstable_read = readContext.bind(null, context);
|
|
1252
2157
|
|
|
1253
2158
|
{
|
|
1254
2159
|
context._currentRenderer = null;
|
|
2160
|
+
context._currentRenderer2 = null;
|
|
1255
2161
|
}
|
|
1256
2162
|
|
|
1257
2163
|
return context;
|
|
1258
2164
|
}
|
|
1259
2165
|
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
2166
|
+
function lazy(ctor) {
|
|
2167
|
+
var thenable = null;
|
|
2168
|
+
return {
|
|
2169
|
+
then: function (resolve, reject) {
|
|
2170
|
+
if (thenable === null) {
|
|
2171
|
+
// Lazily create thenable by wrapping in an extra thenable.
|
|
2172
|
+
thenable = ctor();
|
|
2173
|
+
ctor = null;
|
|
2174
|
+
}
|
|
2175
|
+
return thenable.then(resolve, reject);
|
|
2176
|
+
},
|
|
1263
2177
|
|
|
1264
|
-
|
|
1265
|
-
|
|
2178
|
+
// React uses these fields to store the result.
|
|
2179
|
+
_reactStatus: -1,
|
|
2180
|
+
_reactResult: null
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
1266
2183
|
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
case REACT_CALL_TYPE:
|
|
1279
|
-
return 'ReactCall';
|
|
1280
|
-
case REACT_RETURN_TYPE:
|
|
1281
|
-
return 'ReactReturn';
|
|
2184
|
+
function forwardRef(render) {
|
|
2185
|
+
{
|
|
2186
|
+
if (typeof render !== 'function') {
|
|
2187
|
+
warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
2188
|
+
} else {
|
|
2189
|
+
!(render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept two parameters: props and ref. ' + 'Did you forget to use the ref parameter?') : void 0;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
if (render != null) {
|
|
2193
|
+
!(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;
|
|
2194
|
+
}
|
|
1282
2195
|
}
|
|
1283
|
-
|
|
2196
|
+
|
|
2197
|
+
return {
|
|
2198
|
+
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
2199
|
+
render: render
|
|
2200
|
+
};
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
function isValidElementType(type) {
|
|
2204
|
+
return typeof type === 'string' || typeof type === 'function' ||
|
|
2205
|
+
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
2206
|
+
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);
|
|
1284
2207
|
}
|
|
1285
2208
|
|
|
1286
2209
|
/**
|
|
@@ -1305,11 +2228,24 @@ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
|
1305
2228
|
|
|
1306
2229
|
|
|
1307
2230
|
|
|
2231
|
+
var printWarning$1 = function() {};
|
|
2232
|
+
|
|
1308
2233
|
{
|
|
1309
|
-
var invariant$2 = invariant_1;
|
|
1310
|
-
var warning$2 = warning_1;
|
|
1311
2234
|
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1312
2235
|
var loggedTypeFailures = {};
|
|
2236
|
+
|
|
2237
|
+
printWarning$1 = function(text) {
|
|
2238
|
+
var message = 'Warning: ' + text;
|
|
2239
|
+
if (typeof console !== 'undefined') {
|
|
2240
|
+
console.error(message);
|
|
2241
|
+
}
|
|
2242
|
+
try {
|
|
2243
|
+
// --- Welcome to debugging React ---
|
|
2244
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
2245
|
+
// to find the callsite that caused this warning to fire.
|
|
2246
|
+
throw new Error(message);
|
|
2247
|
+
} catch (x) {}
|
|
2248
|
+
};
|
|
1313
2249
|
}
|
|
1314
2250
|
|
|
1315
2251
|
/**
|
|
@@ -1334,12 +2270,29 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
1334
2270
|
try {
|
|
1335
2271
|
// This is intentionally an invariant that gets caught. It's the same
|
|
1336
2272
|
// behavior as without this statement except with a better message.
|
|
1337
|
-
|
|
2273
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
2274
|
+
var err = Error(
|
|
2275
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
2276
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
2277
|
+
);
|
|
2278
|
+
err.name = 'Invariant Violation';
|
|
2279
|
+
throw err;
|
|
2280
|
+
}
|
|
1338
2281
|
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
1339
2282
|
} catch (ex) {
|
|
1340
2283
|
error = ex;
|
|
1341
2284
|
}
|
|
1342
|
-
|
|
2285
|
+
if (error && !(error instanceof Error)) {
|
|
2286
|
+
printWarning$1(
|
|
2287
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
2288
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
2289
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
2290
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
2291
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
2292
|
+
'shape all require an argument).'
|
|
2293
|
+
);
|
|
2294
|
+
|
|
2295
|
+
}
|
|
1343
2296
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1344
2297
|
// Only monitor this failure once because there tends to be a lot of the
|
|
1345
2298
|
// same error.
|
|
@@ -1347,7 +2300,9 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
1347
2300
|
|
|
1348
2301
|
var stack = getStack ? getStack() : '';
|
|
1349
2302
|
|
|
1350
|
-
|
|
2303
|
+
printWarning$1(
|
|
2304
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
2305
|
+
);
|
|
1351
2306
|
}
|
|
1352
2307
|
}
|
|
1353
2308
|
}
|
|
@@ -1363,50 +2318,15 @@ var checkPropTypes_1 = checkPropTypes;
|
|
|
1363
2318
|
* that support it.
|
|
1364
2319
|
*/
|
|
1365
2320
|
|
|
1366
|
-
var currentlyValidatingElement = void 0;
|
|
1367
2321
|
var propTypesMisspellWarningShown = void 0;
|
|
1368
2322
|
|
|
1369
|
-
var getDisplayName = function () {};
|
|
1370
|
-
var getStackAddendum = function () {};
|
|
1371
|
-
|
|
1372
|
-
var VALID_FRAGMENT_PROPS = void 0;
|
|
1373
|
-
|
|
1374
2323
|
{
|
|
1375
|
-
currentlyValidatingElement = null;
|
|
1376
|
-
|
|
1377
2324
|
propTypesMisspellWarningShown = false;
|
|
1378
|
-
|
|
1379
|
-
getDisplayName = function (element) {
|
|
1380
|
-
if (element == null) {
|
|
1381
|
-
return '#empty';
|
|
1382
|
-
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1383
|
-
return '#text';
|
|
1384
|
-
} else if (typeof element.type === 'string') {
|
|
1385
|
-
return element.type;
|
|
1386
|
-
} else if (element.type === REACT_FRAGMENT_TYPE) {
|
|
1387
|
-
return 'React.Fragment';
|
|
1388
|
-
} else {
|
|
1389
|
-
return element.type.displayName || element.type.name || 'Unknown';
|
|
1390
|
-
}
|
|
1391
|
-
};
|
|
1392
|
-
|
|
1393
|
-
getStackAddendum = function () {
|
|
1394
|
-
var stack = '';
|
|
1395
|
-
if (currentlyValidatingElement) {
|
|
1396
|
-
var name = getDisplayName(currentlyValidatingElement);
|
|
1397
|
-
var owner = currentlyValidatingElement._owner;
|
|
1398
|
-
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
|
|
1399
|
-
}
|
|
1400
|
-
stack += ReactDebugCurrentFrame.getStackAddendum() || '';
|
|
1401
|
-
return stack;
|
|
1402
|
-
};
|
|
1403
|
-
|
|
1404
|
-
VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
|
|
1405
2325
|
}
|
|
1406
2326
|
|
|
1407
2327
|
function getDeclarationErrorAddendum() {
|
|
1408
2328
|
if (ReactCurrentOwner.current) {
|
|
1409
|
-
var name = getComponentName(ReactCurrentOwner.current);
|
|
2329
|
+
var name = getComponentName(ReactCurrentOwner.current.type);
|
|
1410
2330
|
if (name) {
|
|
1411
2331
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
1412
2332
|
}
|
|
@@ -1472,14 +2392,14 @@ function validateExplicitKey(element, parentType) {
|
|
|
1472
2392
|
var childOwner = '';
|
|
1473
2393
|
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
1474
2394
|
// Give the component that originally created this child.
|
|
1475
|
-
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
|
2395
|
+
childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
|
|
1476
2396
|
}
|
|
1477
2397
|
|
|
1478
|
-
|
|
2398
|
+
setCurrentlyValidatingElement(element);
|
|
1479
2399
|
{
|
|
1480
|
-
|
|
2400
|
+
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);
|
|
1481
2401
|
}
|
|
1482
|
-
|
|
2402
|
+
setCurrentlyValidatingElement(null);
|
|
1483
2403
|
}
|
|
1484
2404
|
|
|
1485
2405
|
/**
|
|
@@ -1532,22 +2452,31 @@ function validateChildKeys(node, parentType) {
|
|
|
1532
2452
|
* @param {ReactElement} element
|
|
1533
2453
|
*/
|
|
1534
2454
|
function validatePropTypes(element) {
|
|
1535
|
-
var
|
|
1536
|
-
|
|
2455
|
+
var type = element.type;
|
|
2456
|
+
var name = void 0,
|
|
2457
|
+
propTypes = void 0;
|
|
2458
|
+
if (typeof type === 'function') {
|
|
2459
|
+
// Class or functional component
|
|
2460
|
+
name = type.displayName || type.name;
|
|
2461
|
+
propTypes = type.propTypes;
|
|
2462
|
+
} else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
|
|
2463
|
+
// ForwardRef
|
|
2464
|
+
var functionName = type.render.displayName || type.render.name || '';
|
|
2465
|
+
name = functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
|
|
2466
|
+
propTypes = type.propTypes;
|
|
2467
|
+
} else {
|
|
1537
2468
|
return;
|
|
1538
2469
|
}
|
|
1539
|
-
var name = componentClass.displayName || componentClass.name;
|
|
1540
|
-
var propTypes = componentClass.propTypes;
|
|
1541
2470
|
if (propTypes) {
|
|
1542
|
-
|
|
1543
|
-
checkPropTypes_1(propTypes, element.props, 'prop', name, getStackAddendum);
|
|
1544
|
-
|
|
1545
|
-
} else if (
|
|
2471
|
+
setCurrentlyValidatingElement(element);
|
|
2472
|
+
checkPropTypes_1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
2473
|
+
setCurrentlyValidatingElement(null);
|
|
2474
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1546
2475
|
propTypesMisspellWarningShown = true;
|
|
1547
|
-
|
|
2476
|
+
warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1548
2477
|
}
|
|
1549
|
-
if (typeof
|
|
1550
|
-
|
|
2478
|
+
if (typeof type.getDefaultProps === 'function') {
|
|
2479
|
+
!type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
|
1551
2480
|
}
|
|
1552
2481
|
}
|
|
1553
2482
|
|
|
@@ -1556,28 +2485,26 @@ function validatePropTypes(element) {
|
|
|
1556
2485
|
* @param {ReactElement} fragment
|
|
1557
2486
|
*/
|
|
1558
2487
|
function validateFragmentProps(fragment) {
|
|
1559
|
-
|
|
2488
|
+
setCurrentlyValidatingElement(fragment);
|
|
1560
2489
|
|
|
1561
2490
|
var keys = Object.keys(fragment.props);
|
|
1562
2491
|
for (var i = 0; i < keys.length; i++) {
|
|
1563
2492
|
var key = keys[i];
|
|
1564
|
-
if (
|
|
1565
|
-
|
|
2493
|
+
if (key !== 'children' && key !== 'key') {
|
|
2494
|
+
warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1566
2495
|
break;
|
|
1567
2496
|
}
|
|
1568
2497
|
}
|
|
1569
2498
|
|
|
1570
2499
|
if (fragment.ref !== null) {
|
|
1571
|
-
|
|
2500
|
+
warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1572
2501
|
}
|
|
1573
2502
|
|
|
1574
|
-
|
|
2503
|
+
setCurrentlyValidatingElement(null);
|
|
1575
2504
|
}
|
|
1576
2505
|
|
|
1577
2506
|
function createElementWithValidation(type, props, children) {
|
|
1578
|
-
var validType =
|
|
1579
|
-
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1580
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_LOADING_TYPE || type === REACT_TIMEOUT_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE);
|
|
2507
|
+
var validType = isValidElementType(type);
|
|
1581
2508
|
|
|
1582
2509
|
// We warn in this case but don't throw. We expect the element creation to
|
|
1583
2510
|
// succeed and there will likely be errors in render.
|
|
@@ -1594,18 +2521,19 @@ function createElementWithValidation(type, props, children) {
|
|
|
1594
2521
|
info += getDeclarationErrorAddendum();
|
|
1595
2522
|
}
|
|
1596
2523
|
|
|
1597
|
-
info += getStackAddendum() || '';
|
|
1598
|
-
|
|
1599
2524
|
var typeString = void 0;
|
|
1600
2525
|
if (type === null) {
|
|
1601
2526
|
typeString = 'null';
|
|
1602
2527
|
} else if (Array.isArray(type)) {
|
|
1603
2528
|
typeString = 'array';
|
|
2529
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2530
|
+
typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
|
2531
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1604
2532
|
} else {
|
|
1605
2533
|
typeString = typeof type;
|
|
1606
2534
|
}
|
|
1607
2535
|
|
|
1608
|
-
|
|
2536
|
+
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);
|
|
1609
2537
|
}
|
|
1610
2538
|
|
|
1611
2539
|
var element = createElement.apply(this, arguments);
|
|
@@ -1679,12 +2607,12 @@ var React = {
|
|
|
1679
2607
|
PureComponent: PureComponent,
|
|
1680
2608
|
|
|
1681
2609
|
createContext: createContext,
|
|
2610
|
+
forwardRef: forwardRef,
|
|
1682
2611
|
|
|
1683
2612
|
Fragment: REACT_FRAGMENT_TYPE,
|
|
1684
2613
|
StrictMode: REACT_STRICT_MODE_TYPE,
|
|
1685
2614
|
unstable_AsyncMode: REACT_ASYNC_MODE_TYPE,
|
|
1686
|
-
|
|
1687
|
-
Timeout: REACT_TIMEOUT_TYPE,
|
|
2615
|
+
unstable_Profiler: REACT_PROFILER_TYPE,
|
|
1688
2616
|
|
|
1689
2617
|
createElement: createElementWithValidation,
|
|
1690
2618
|
cloneElement: cloneElementWithValidation,
|
|
@@ -1693,21 +2621,12 @@ var React = {
|
|
|
1693
2621
|
|
|
1694
2622
|
version: ReactVersion,
|
|
1695
2623
|
|
|
1696
|
-
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:
|
|
1697
|
-
ReactCurrentOwner: ReactCurrentOwner,
|
|
1698
|
-
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
1699
|
-
assign: objectAssign
|
|
1700
|
-
}
|
|
2624
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
1701
2625
|
};
|
|
1702
2626
|
|
|
1703
|
-
{
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
1707
|
-
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
1708
|
-
// TODO: remove in React 17.0.
|
|
1709
|
-
ReactComponentTreeHook: {}
|
|
1710
|
-
});
|
|
2627
|
+
if (enableSuspense) {
|
|
2628
|
+
React.Placeholder = REACT_PLACEHOLDER_TYPE;
|
|
2629
|
+
React.lazy = lazy;
|
|
1711
2630
|
}
|
|
1712
2631
|
|
|
1713
2632
|
|
|
@@ -1720,7 +2639,7 @@ var React$3 = ( React$2 && React ) || React$2;
|
|
|
1720
2639
|
|
|
1721
2640
|
// TODO: decide on the top-level export form.
|
|
1722
2641
|
// This is hacky but makes it work with both Rollup and Jest.
|
|
1723
|
-
var react = React$3
|
|
2642
|
+
var react = React$3.default || React$3;
|
|
1724
2643
|
|
|
1725
2644
|
return react;
|
|
1726
2645
|
|