react 16.4.2 → 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 +352 -163
- 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 +1222 -389
- package/umd/react.production.min.js +20 -15
|
@@ -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
|
-
|
|
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,100 +15,9 @@
|
|
|
15
15
|
(global.React = factory());
|
|
16
16
|
}(this, (function () { 'use strict';
|
|
17
17
|
|
|
18
|
-
/*
|
|
19
|
-
object-assign
|
|
20
|
-
(c) Sindre Sorhus
|
|
21
|
-
@license MIT
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/* eslint-disable no-unused-vars */
|
|
26
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
27
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
28
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
29
|
-
|
|
30
|
-
function toObject(val) {
|
|
31
|
-
if (val === null || val === undefined) {
|
|
32
|
-
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return Object(val);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function shouldUseNative() {
|
|
39
|
-
try {
|
|
40
|
-
if (!Object.assign) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Detect buggy property enumeration order in older V8 versions.
|
|
45
|
-
|
|
46
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
47
|
-
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
48
|
-
test1[5] = 'de';
|
|
49
|
-
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
54
|
-
var test2 = {};
|
|
55
|
-
for (var i = 0; i < 10; i++) {
|
|
56
|
-
test2['_' + String.fromCharCode(i)] = i;
|
|
57
|
-
}
|
|
58
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
59
|
-
return test2[n];
|
|
60
|
-
});
|
|
61
|
-
if (order2.join('') !== '0123456789') {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
66
|
-
var test3 = {};
|
|
67
|
-
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
68
|
-
test3[letter] = letter;
|
|
69
|
-
});
|
|
70
|
-
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
71
|
-
'abcdefghijklmnopqrst') {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return true;
|
|
76
|
-
} catch (err) {
|
|
77
|
-
// We don't expect any of the above to throw, but better to be safe.
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
83
|
-
var from;
|
|
84
|
-
var to = toObject(target);
|
|
85
|
-
var symbols;
|
|
86
|
-
|
|
87
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
88
|
-
from = Object(arguments[s]);
|
|
89
|
-
|
|
90
|
-
for (var key in from) {
|
|
91
|
-
if (hasOwnProperty.call(from, key)) {
|
|
92
|
-
to[key] = from[key];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (getOwnPropertySymbols) {
|
|
97
|
-
symbols = getOwnPropertySymbols(from);
|
|
98
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
99
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
100
|
-
to[symbols[i]] = from[symbols[i]];
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return to;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
18
|
// TODO: this is special because it gets imported during build.
|
|
110
19
|
|
|
111
|
-
var ReactVersion = '16.
|
|
20
|
+
var ReactVersion = '16.5.0';
|
|
112
21
|
|
|
113
22
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
114
23
|
// nor polyfill, then a plain number is used for performance.
|
|
@@ -123,13 +32,13 @@ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
|
123
32
|
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
124
33
|
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
125
34
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
126
|
-
var
|
|
35
|
+
var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
|
|
127
36
|
|
|
128
37
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
129
38
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
130
39
|
|
|
131
40
|
function getIteratorFn(maybeIterable) {
|
|
132
|
-
if (maybeIterable === null || typeof maybeIterable
|
|
41
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
133
42
|
return null;
|
|
134
43
|
}
|
|
135
44
|
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
@@ -139,16 +48,6 @@ function getIteratorFn(maybeIterable) {
|
|
|
139
48
|
return null;
|
|
140
49
|
}
|
|
141
50
|
|
|
142
|
-
/**
|
|
143
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
144
|
-
*
|
|
145
|
-
* This source code is licensed under the MIT license found in the
|
|
146
|
-
* LICENSE file in the root directory of this source tree.
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
51
|
/**
|
|
153
52
|
* Use invariant() to assert state which your program assumes to be true.
|
|
154
53
|
*
|
|
@@ -160,10 +59,10 @@ function getIteratorFn(maybeIterable) {
|
|
|
160
59
|
* will remain to ensure logic does not differ in production.
|
|
161
60
|
*/
|
|
162
61
|
|
|
163
|
-
var validateFormat = function
|
|
62
|
+
var validateFormat = function () {};
|
|
164
63
|
|
|
165
64
|
{
|
|
166
|
-
validateFormat = function
|
|
65
|
+
validateFormat = function (format) {
|
|
167
66
|
if (format === undefined) {
|
|
168
67
|
throw new Error('invariant requires an error message argument');
|
|
169
68
|
}
|
|
@@ -174,7 +73,7 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
174
73
|
validateFormat(format);
|
|
175
74
|
|
|
176
75
|
if (!condition) {
|
|
177
|
-
var error;
|
|
76
|
+
var error = void 0;
|
|
178
77
|
if (format === undefined) {
|
|
179
78
|
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
180
79
|
} else {
|
|
@@ -191,10 +90,8 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
191
90
|
}
|
|
192
91
|
}
|
|
193
92
|
|
|
194
|
-
var invariant_1 = invariant;
|
|
195
|
-
|
|
196
93
|
// Relying on the `invariant()` implementation lets us
|
|
197
|
-
//
|
|
94
|
+
// preserve the format and params in the www builds.
|
|
198
95
|
|
|
199
96
|
// Exports ReactDOM.createRoot
|
|
200
97
|
|
|
@@ -226,25 +123,104 @@ var enableSuspense = false;
|
|
|
226
123
|
// Gather advanced timing metrics for Profiler subtrees.
|
|
227
124
|
|
|
228
125
|
|
|
126
|
+
// Track which interactions trigger each commit.
|
|
127
|
+
var enableSchedulerTracking = true;
|
|
128
|
+
|
|
229
129
|
// Only used in www builds.
|
|
230
130
|
|
|
231
|
-
/**
|
|
232
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
233
|
-
*
|
|
234
|
-
* This source code is licensed under the MIT license found in the
|
|
235
|
-
* LICENSE file in the root directory of this source tree.
|
|
236
|
-
*
|
|
237
|
-
*/
|
|
238
131
|
|
|
132
|
+
// Only used in www builds.
|
|
239
133
|
|
|
134
|
+
/*
|
|
135
|
+
object-assign
|
|
136
|
+
(c) Sindre Sorhus
|
|
137
|
+
@license MIT
|
|
138
|
+
*/
|
|
240
139
|
|
|
241
|
-
var emptyObject = {};
|
|
242
140
|
|
|
243
|
-
|
|
244
|
-
|
|
141
|
+
/* eslint-disable no-unused-vars */
|
|
142
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
143
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
144
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
145
|
+
|
|
146
|
+
function toObject(val) {
|
|
147
|
+
if (val === null || val === undefined) {
|
|
148
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return Object(val);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function shouldUseNative() {
|
|
155
|
+
try {
|
|
156
|
+
if (!Object.assign) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
161
|
+
|
|
162
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
163
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
164
|
+
test1[5] = 'de';
|
|
165
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
170
|
+
var test2 = {};
|
|
171
|
+
for (var i = 0; i < 10; i++) {
|
|
172
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
173
|
+
}
|
|
174
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
175
|
+
return test2[n];
|
|
176
|
+
});
|
|
177
|
+
if (order2.join('') !== '0123456789') {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
182
|
+
var test3 = {};
|
|
183
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
184
|
+
test3[letter] = letter;
|
|
185
|
+
});
|
|
186
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
187
|
+
'abcdefghijklmnopqrst') {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return true;
|
|
192
|
+
} catch (err) {
|
|
193
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
245
196
|
}
|
|
246
197
|
|
|
247
|
-
var
|
|
198
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
199
|
+
var from;
|
|
200
|
+
var to = toObject(target);
|
|
201
|
+
var symbols;
|
|
202
|
+
|
|
203
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
204
|
+
from = Object(arguments[s]);
|
|
205
|
+
|
|
206
|
+
for (var key in from) {
|
|
207
|
+
if (hasOwnProperty.call(from, key)) {
|
|
208
|
+
to[key] = from[key];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (getOwnPropertySymbols) {
|
|
213
|
+
symbols = getOwnPropertySymbols(from);
|
|
214
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
215
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
216
|
+
to[symbols[i]] = from[symbols[i]];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return to;
|
|
223
|
+
};
|
|
248
224
|
|
|
249
225
|
/**
|
|
250
226
|
* Forked from fbjs/warning:
|
|
@@ -285,7 +261,7 @@ var lowPriorityWarning = function () {};
|
|
|
285
261
|
|
|
286
262
|
lowPriorityWarning = function (condition, format) {
|
|
287
263
|
if (format === undefined) {
|
|
288
|
-
throw new Error('`
|
|
264
|
+
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
289
265
|
}
|
|
290
266
|
if (!condition) {
|
|
291
267
|
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
@@ -299,53 +275,6 @@ var lowPriorityWarning = function () {};
|
|
|
299
275
|
|
|
300
276
|
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
301
277
|
|
|
302
|
-
/**
|
|
303
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
304
|
-
*
|
|
305
|
-
* This source code is licensed under the MIT license found in the
|
|
306
|
-
* LICENSE file in the root directory of this source tree.
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*/
|
|
310
|
-
|
|
311
|
-
function makeEmptyFunction(arg) {
|
|
312
|
-
return function () {
|
|
313
|
-
return arg;
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* This function accepts and discards inputs; it has no side effects. This is
|
|
319
|
-
* primarily useful idiomatically for overridable function endpoints which
|
|
320
|
-
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
|
321
|
-
*/
|
|
322
|
-
var emptyFunction = function emptyFunction() {};
|
|
323
|
-
|
|
324
|
-
emptyFunction.thatReturns = makeEmptyFunction;
|
|
325
|
-
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
|
326
|
-
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
|
327
|
-
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
|
328
|
-
emptyFunction.thatReturnsThis = function () {
|
|
329
|
-
return this;
|
|
330
|
-
};
|
|
331
|
-
emptyFunction.thatReturnsArgument = function (arg) {
|
|
332
|
-
return arg;
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
var emptyFunction_1 = emptyFunction;
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
339
|
-
*
|
|
340
|
-
* This source code is licensed under the MIT license found in the
|
|
341
|
-
* LICENSE file in the root directory of this source tree.
|
|
342
|
-
*
|
|
343
|
-
*/
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
278
|
/**
|
|
350
279
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
351
280
|
* This can be used to log issues in development environments in critical
|
|
@@ -353,49 +282,42 @@ var emptyFunction_1 = emptyFunction;
|
|
|
353
282
|
* same logic and follow the same code paths.
|
|
354
283
|
*/
|
|
355
284
|
|
|
356
|
-
var
|
|
285
|
+
var warningWithoutStack = function () {};
|
|
357
286
|
|
|
358
287
|
{
|
|
359
|
-
|
|
360
|
-
for (var _len = arguments.length, args = Array(_len >
|
|
361
|
-
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];
|
|
362
291
|
}
|
|
363
292
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
293
|
+
if (format === undefined) {
|
|
294
|
+
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
295
|
+
}
|
|
296
|
+
if (condition) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
368
299
|
if (typeof console !== 'undefined') {
|
|
369
|
-
|
|
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));
|
|
370
306
|
}
|
|
371
307
|
try {
|
|
372
308
|
// --- Welcome to debugging React ---
|
|
373
309
|
// This error was thrown as a convenience so that you can use this stack
|
|
374
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
|
+
});
|
|
375
315
|
throw new Error(message);
|
|
376
316
|
} catch (x) {}
|
|
377
317
|
};
|
|
378
|
-
|
|
379
|
-
warning = function warning(condition, format) {
|
|
380
|
-
if (format === undefined) {
|
|
381
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
|
385
|
-
return; // Ignore CompositeComponent proptype check.
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (!condition) {
|
|
389
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
390
|
-
args[_key2 - 2] = arguments[_key2];
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
printWarning$1.apply(undefined, [format].concat(args));
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
318
|
}
|
|
397
319
|
|
|
398
|
-
var
|
|
320
|
+
var warningWithoutStack$1 = warningWithoutStack;
|
|
399
321
|
|
|
400
322
|
var didWarnStateUpdateForUnmountedComponent = {};
|
|
401
323
|
|
|
@@ -407,7 +329,7 @@ function warnNoop(publicInstance, callerName) {
|
|
|
407
329
|
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
408
330
|
return;
|
|
409
331
|
}
|
|
410
|
-
|
|
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);
|
|
411
333
|
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
412
334
|
}
|
|
413
335
|
}
|
|
@@ -480,13 +402,19 @@ var ReactNoopUpdateQueue = {
|
|
|
480
402
|
}
|
|
481
403
|
};
|
|
482
404
|
|
|
405
|
+
var emptyObject = {};
|
|
406
|
+
{
|
|
407
|
+
Object.freeze(emptyObject);
|
|
408
|
+
}
|
|
409
|
+
|
|
483
410
|
/**
|
|
484
411
|
* Base class helpers for the updating state of a component.
|
|
485
412
|
*/
|
|
486
413
|
function Component(props, context, updater) {
|
|
487
414
|
this.props = props;
|
|
488
415
|
this.context = context;
|
|
489
|
-
|
|
416
|
+
// If a component has string refs, we will assign a different object later.
|
|
417
|
+
this.refs = emptyObject;
|
|
490
418
|
// We initialize the default updater but the real one gets injected by the
|
|
491
419
|
// renderer.
|
|
492
420
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
@@ -520,7 +448,7 @@ Component.prototype.isReactComponent = {};
|
|
|
520
448
|
* @protected
|
|
521
449
|
*/
|
|
522
450
|
Component.prototype.setState = function (partialState, callback) {
|
|
523
|
-
!(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;
|
|
524
452
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
525
453
|
};
|
|
526
454
|
|
|
@@ -558,43 +486,796 @@ Component.prototype.forceUpdate = function (callback) {
|
|
|
558
486
|
lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
559
487
|
return undefined;
|
|
560
488
|
}
|
|
561
|
-
});
|
|
562
|
-
};
|
|
563
|
-
for (var fnName in deprecatedAPIs) {
|
|
564
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
565
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
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;
|
|
1212
|
+
}
|
|
566
1213
|
}
|
|
1214
|
+
});
|
|
1215
|
+
|
|
1216
|
+
if (didCatchError) {
|
|
1217
|
+
throw caughtError;
|
|
567
1218
|
}
|
|
568
1219
|
}
|
|
569
1220
|
|
|
570
|
-
function
|
|
571
|
-
|
|
1221
|
+
function onWorkStarted(interactions, threadID) {
|
|
1222
|
+
var didCatchError = false;
|
|
1223
|
+
var caughtError = null;
|
|
572
1224
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
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
|
+
}
|
|
581
1239
|
}
|
|
582
1240
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
objectAssign(pureComponentPrototype, Component.prototype);
|
|
587
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
1241
|
+
function onWorkStopped(interactions, threadID) {
|
|
1242
|
+
var didCatchError = false;
|
|
1243
|
+
var caughtError = null;
|
|
588
1244
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
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;
|
|
596
1278
|
}
|
|
597
|
-
return refObject;
|
|
598
1279
|
}
|
|
599
1280
|
|
|
600
1281
|
/**
|
|
@@ -608,9 +1289,203 @@ var ReactCurrentOwner = {
|
|
|
608
1289
|
* @internal
|
|
609
1290
|
* @type {ReactComponent}
|
|
610
1291
|
*/
|
|
611
|
-
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;
|
|
612
1322
|
};
|
|
613
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
|
|
1423
|
+
};
|
|
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
|
+
|
|
614
1489
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
615
1490
|
|
|
616
1491
|
var RESERVED_PROPS = {
|
|
@@ -651,7 +1526,7 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
651
1526
|
var warnAboutAccessingKey = function () {
|
|
652
1527
|
if (!specialPropKeyWarningShown) {
|
|
653
1528
|
specialPropKeyWarningShown = true;
|
|
654
|
-
|
|
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);
|
|
655
1530
|
}
|
|
656
1531
|
};
|
|
657
1532
|
warnAboutAccessingKey.isReactWarning = true;
|
|
@@ -665,7 +1540,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
665
1540
|
var warnAboutAccessingRef = function () {
|
|
666
1541
|
if (!specialPropRefWarningShown) {
|
|
667
1542
|
specialPropRefWarningShown = true;
|
|
668
|
-
|
|
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);
|
|
669
1544
|
}
|
|
670
1545
|
};
|
|
671
1546
|
warnAboutAccessingRef.isReactWarning = true;
|
|
@@ -813,14 +1688,12 @@ function createElement(type, config, children) {
|
|
|
813
1688
|
}
|
|
814
1689
|
{
|
|
815
1690
|
if (key || ref) {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
defineRefPropWarningGetter(props, displayName);
|
|
823
|
-
}
|
|
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);
|
|
824
1697
|
}
|
|
825
1698
|
}
|
|
826
1699
|
}
|
|
@@ -844,7 +1717,7 @@ function cloneAndReplaceKey(oldElement, newKey) {
|
|
|
844
1717
|
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
845
1718
|
*/
|
|
846
1719
|
function cloneElement(element, config, children) {
|
|
847
|
-
!!(element === null || element === undefined) ?
|
|
1720
|
+
!!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
|
|
848
1721
|
|
|
849
1722
|
var propName = void 0;
|
|
850
1723
|
|
|
@@ -911,28 +1784,13 @@ function cloneElement(element, config, children) {
|
|
|
911
1784
|
* Verifies the object is a ReactElement.
|
|
912
1785
|
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
913
1786
|
* @param {?object} object
|
|
914
|
-
* @return {boolean} True if `object` is a
|
|
1787
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
915
1788
|
* @final
|
|
916
1789
|
*/
|
|
917
1790
|
function isValidElement(object) {
|
|
918
1791
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
919
1792
|
}
|
|
920
1793
|
|
|
921
|
-
var ReactDebugCurrentFrame = {};
|
|
922
|
-
|
|
923
|
-
{
|
|
924
|
-
// Component that is being worked on
|
|
925
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
926
|
-
|
|
927
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
928
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
929
|
-
if (impl) {
|
|
930
|
-
return impl();
|
|
931
|
-
}
|
|
932
|
-
return null;
|
|
933
|
-
};
|
|
934
|
-
}
|
|
935
|
-
|
|
936
1794
|
var SEPARATOR = '.';
|
|
937
1795
|
var SUBSEPARATOR = ':';
|
|
938
1796
|
|
|
@@ -1060,7 +1918,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1060
1918
|
{
|
|
1061
1919
|
// Warn about using Maps as children
|
|
1062
1920
|
if (iteratorFn === children.entries) {
|
|
1063
|
-
!didWarnAboutMaps ?
|
|
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;
|
|
1064
1922
|
didWarnAboutMaps = true;
|
|
1065
1923
|
}
|
|
1066
1924
|
}
|
|
@@ -1079,7 +1937,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1079
1937
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1080
1938
|
}
|
|
1081
1939
|
var childrenString = '' + children;
|
|
1082
|
-
|
|
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);
|
|
1083
1941
|
}
|
|
1084
1942
|
}
|
|
1085
1943
|
|
|
@@ -1165,7 +2023,9 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
|
1165
2023
|
|
|
1166
2024
|
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1167
2025
|
if (Array.isArray(mappedChild)) {
|
|
1168
|
-
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey,
|
|
2026
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
|
2027
|
+
return c;
|
|
2028
|
+
});
|
|
1169
2029
|
} else if (mappedChild != null) {
|
|
1170
2030
|
if (isValidElement(mappedChild)) {
|
|
1171
2031
|
mappedChild = cloneAndReplaceKey(mappedChild,
|
|
@@ -1219,7 +2079,9 @@ function mapChildren(children, func, context) {
|
|
|
1219
2079
|
* @return {number} The number of children.
|
|
1220
2080
|
*/
|
|
1221
2081
|
function countChildren(children) {
|
|
1222
|
-
return traverseAllChildren(children,
|
|
2082
|
+
return traverseAllChildren(children, function () {
|
|
2083
|
+
return null;
|
|
2084
|
+
}, null);
|
|
1223
2085
|
}
|
|
1224
2086
|
|
|
1225
2087
|
/**
|
|
@@ -1230,7 +2092,9 @@ function countChildren(children) {
|
|
|
1230
2092
|
*/
|
|
1231
2093
|
function toArray(children) {
|
|
1232
2094
|
var result = [];
|
|
1233
|
-
mapIntoWithKeyPrefixInternal(children, result, null,
|
|
2095
|
+
mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
|
2096
|
+
return child;
|
|
2097
|
+
});
|
|
1234
2098
|
return result;
|
|
1235
2099
|
}
|
|
1236
2100
|
|
|
@@ -1249,35 +2113,39 @@ function toArray(children) {
|
|
|
1249
2113
|
* structure.
|
|
1250
2114
|
*/
|
|
1251
2115
|
function onlyChild(children) {
|
|
1252
|
-
!isValidElement(children) ?
|
|
2116
|
+
!isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
|
1253
2117
|
return children;
|
|
1254
2118
|
}
|
|
1255
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
|
+
|
|
1256
2126
|
function createContext(defaultValue, calculateChangedBits) {
|
|
1257
2127
|
if (calculateChangedBits === undefined) {
|
|
1258
2128
|
calculateChangedBits = null;
|
|
1259
2129
|
} else {
|
|
1260
2130
|
{
|
|
1261
|
-
!(calculateChangedBits === null || typeof calculateChangedBits === 'function') ?
|
|
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;
|
|
1262
2132
|
}
|
|
1263
2133
|
}
|
|
1264
2134
|
|
|
1265
2135
|
var context = {
|
|
1266
2136
|
$$typeof: REACT_CONTEXT_TYPE,
|
|
1267
2137
|
_calculateChangedBits: calculateChangedBits,
|
|
1268
|
-
_defaultValue: defaultValue,
|
|
1269
|
-
_currentValue: defaultValue,
|
|
1270
2138
|
// As a workaround to support multiple concurrent renderers, we categorize
|
|
1271
2139
|
// some renderers as primary and others as secondary. We only expect
|
|
1272
2140
|
// there to be two concurrent renderers at most: React Native (primary) and
|
|
1273
2141
|
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
1274
2142
|
// Secondary renderers store their context values on separate fields.
|
|
2143
|
+
_currentValue: defaultValue,
|
|
1275
2144
|
_currentValue2: defaultValue,
|
|
1276
|
-
_changedBits: 0,
|
|
1277
|
-
_changedBits2: 0,
|
|
1278
2145
|
// These are circular
|
|
1279
2146
|
Provider: null,
|
|
1280
|
-
Consumer: null
|
|
2147
|
+
Consumer: null,
|
|
2148
|
+
unstable_read: null
|
|
1281
2149
|
};
|
|
1282
2150
|
|
|
1283
2151
|
context.Provider = {
|
|
@@ -1285,6 +2153,7 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1285
2153
|
_context: context
|
|
1286
2154
|
};
|
|
1287
2155
|
context.Consumer = context;
|
|
2156
|
+
context.unstable_read = readContext.bind(null, context);
|
|
1288
2157
|
|
|
1289
2158
|
{
|
|
1290
2159
|
context._currentRenderer = null;
|
|
@@ -1294,12 +2163,34 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1294
2163
|
return context;
|
|
1295
2164
|
}
|
|
1296
2165
|
|
|
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
|
+
},
|
|
2177
|
+
|
|
2178
|
+
// React uses these fields to store the result.
|
|
2179
|
+
_reactStatus: -1,
|
|
2180
|
+
_reactResult: null
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
2183
|
+
|
|
1297
2184
|
function forwardRef(render) {
|
|
1298
2185
|
{
|
|
1299
|
-
|
|
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
|
+
}
|
|
1300
2191
|
|
|
1301
2192
|
if (render != null) {
|
|
1302
|
-
!(render.defaultProps == null && render.propTypes == 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;
|
|
1303
2194
|
}
|
|
1304
2195
|
}
|
|
1305
2196
|
|
|
@@ -1309,51 +2200,10 @@ function forwardRef(render) {
|
|
|
1309
2200
|
};
|
|
1310
2201
|
}
|
|
1311
2202
|
|
|
1312
|
-
var describeComponentFrame = function (name, source, ownerName) {
|
|
1313
|
-
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
1314
|
-
};
|
|
1315
|
-
|
|
1316
2203
|
function isValidElementType(type) {
|
|
1317
2204
|
return typeof type === 'string' || typeof type === 'function' ||
|
|
1318
2205
|
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1319
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type ===
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
function getComponentName(fiber) {
|
|
1323
|
-
var type = fiber.type;
|
|
1324
|
-
|
|
1325
|
-
if (typeof type === 'function') {
|
|
1326
|
-
return type.displayName || type.name;
|
|
1327
|
-
}
|
|
1328
|
-
if (typeof type === 'string') {
|
|
1329
|
-
return type;
|
|
1330
|
-
}
|
|
1331
|
-
switch (type) {
|
|
1332
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
1333
|
-
return 'AsyncMode';
|
|
1334
|
-
case REACT_CONTEXT_TYPE:
|
|
1335
|
-
return 'Context.Consumer';
|
|
1336
|
-
case REACT_FRAGMENT_TYPE:
|
|
1337
|
-
return 'ReactFragment';
|
|
1338
|
-
case REACT_PORTAL_TYPE:
|
|
1339
|
-
return 'ReactPortal';
|
|
1340
|
-
case REACT_PROFILER_TYPE:
|
|
1341
|
-
return 'Profiler(' + fiber.pendingProps.id + ')';
|
|
1342
|
-
case REACT_PROVIDER_TYPE:
|
|
1343
|
-
return 'Context.Provider';
|
|
1344
|
-
case REACT_STRICT_MODE_TYPE:
|
|
1345
|
-
return 'StrictMode';
|
|
1346
|
-
case REACT_TIMEOUT_TYPE:
|
|
1347
|
-
return 'Timeout';
|
|
1348
|
-
}
|
|
1349
|
-
if (typeof type === 'object' && type !== null) {
|
|
1350
|
-
switch (type.$$typeof) {
|
|
1351
|
-
case REACT_FORWARD_REF_TYPE:
|
|
1352
|
-
var functionName = type.render.displayName || type.render.name || '';
|
|
1353
|
-
return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
return null;
|
|
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);
|
|
1357
2207
|
}
|
|
1358
2208
|
|
|
1359
2209
|
/**
|
|
@@ -1378,11 +2228,24 @@ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
|
1378
2228
|
|
|
1379
2229
|
|
|
1380
2230
|
|
|
2231
|
+
var printWarning$1 = function() {};
|
|
2232
|
+
|
|
1381
2233
|
{
|
|
1382
|
-
var invariant$2 = invariant_1;
|
|
1383
|
-
var warning$2 = warning_1;
|
|
1384
2234
|
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1385
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
|
+
};
|
|
1386
2249
|
}
|
|
1387
2250
|
|
|
1388
2251
|
/**
|
|
@@ -1407,12 +2270,29 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
1407
2270
|
try {
|
|
1408
2271
|
// This is intentionally an invariant that gets caught. It's the same
|
|
1409
2272
|
// behavior as without this statement except with a better message.
|
|
1410
|
-
|
|
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
|
+
}
|
|
1411
2281
|
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
1412
2282
|
} catch (ex) {
|
|
1413
2283
|
error = ex;
|
|
1414
2284
|
}
|
|
1415
|
-
|
|
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
|
+
}
|
|
1416
2296
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1417
2297
|
// Only monitor this failure once because there tends to be a lot of the
|
|
1418
2298
|
// same error.
|
|
@@ -1420,7 +2300,9 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
1420
2300
|
|
|
1421
2301
|
var stack = getStack ? getStack() : '';
|
|
1422
2302
|
|
|
1423
|
-
|
|
2303
|
+
printWarning$1(
|
|
2304
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
2305
|
+
);
|
|
1424
2306
|
}
|
|
1425
2307
|
}
|
|
1426
2308
|
}
|
|
@@ -1436,52 +2318,15 @@ var checkPropTypes_1 = checkPropTypes;
|
|
|
1436
2318
|
* that support it.
|
|
1437
2319
|
*/
|
|
1438
2320
|
|
|
1439
|
-
var currentlyValidatingElement = void 0;
|
|
1440
2321
|
var propTypesMisspellWarningShown = void 0;
|
|
1441
2322
|
|
|
1442
|
-
var getDisplayName = function () {};
|
|
1443
|
-
var getStackAddendum = function () {};
|
|
1444
|
-
|
|
1445
2323
|
{
|
|
1446
|
-
currentlyValidatingElement = null;
|
|
1447
|
-
|
|
1448
2324
|
propTypesMisspellWarningShown = false;
|
|
1449
|
-
|
|
1450
|
-
getDisplayName = function (element) {
|
|
1451
|
-
if (element == null) {
|
|
1452
|
-
return '#empty';
|
|
1453
|
-
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1454
|
-
return '#text';
|
|
1455
|
-
} else if (typeof element.type === 'string') {
|
|
1456
|
-
return element.type;
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
var type = element.type;
|
|
1460
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
1461
|
-
return 'React.Fragment';
|
|
1462
|
-
} else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
|
|
1463
|
-
var functionName = type.render.displayName || type.render.name || '';
|
|
1464
|
-
return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
|
|
1465
|
-
} else {
|
|
1466
|
-
return type.displayName || type.name || 'Unknown';
|
|
1467
|
-
}
|
|
1468
|
-
};
|
|
1469
|
-
|
|
1470
|
-
getStackAddendum = function () {
|
|
1471
|
-
var stack = '';
|
|
1472
|
-
if (currentlyValidatingElement) {
|
|
1473
|
-
var name = getDisplayName(currentlyValidatingElement);
|
|
1474
|
-
var owner = currentlyValidatingElement._owner;
|
|
1475
|
-
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
|
|
1476
|
-
}
|
|
1477
|
-
stack += ReactDebugCurrentFrame.getStackAddendum() || '';
|
|
1478
|
-
return stack;
|
|
1479
|
-
};
|
|
1480
2325
|
}
|
|
1481
2326
|
|
|
1482
2327
|
function getDeclarationErrorAddendum() {
|
|
1483
2328
|
if (ReactCurrentOwner.current) {
|
|
1484
|
-
var name = getComponentName(ReactCurrentOwner.current);
|
|
2329
|
+
var name = getComponentName(ReactCurrentOwner.current.type);
|
|
1485
2330
|
if (name) {
|
|
1486
2331
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
1487
2332
|
}
|
|
@@ -1547,14 +2392,14 @@ function validateExplicitKey(element, parentType) {
|
|
|
1547
2392
|
var childOwner = '';
|
|
1548
2393
|
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
1549
2394
|
// Give the component that originally created this child.
|
|
1550
|
-
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
|
2395
|
+
childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
|
|
1551
2396
|
}
|
|
1552
2397
|
|
|
1553
|
-
|
|
2398
|
+
setCurrentlyValidatingElement(element);
|
|
1554
2399
|
{
|
|
1555
|
-
|
|
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);
|
|
1556
2401
|
}
|
|
1557
|
-
|
|
2402
|
+
setCurrentlyValidatingElement(null);
|
|
1558
2403
|
}
|
|
1559
2404
|
|
|
1560
2405
|
/**
|
|
@@ -1623,15 +2468,15 @@ function validatePropTypes(element) {
|
|
|
1623
2468
|
return;
|
|
1624
2469
|
}
|
|
1625
2470
|
if (propTypes) {
|
|
1626
|
-
|
|
1627
|
-
checkPropTypes_1(propTypes, element.props, 'prop', name, getStackAddendum);
|
|
1628
|
-
|
|
2471
|
+
setCurrentlyValidatingElement(element);
|
|
2472
|
+
checkPropTypes_1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
2473
|
+
setCurrentlyValidatingElement(null);
|
|
1629
2474
|
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1630
2475
|
propTypesMisspellWarningShown = true;
|
|
1631
|
-
|
|
2476
|
+
warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1632
2477
|
}
|
|
1633
2478
|
if (typeof type.getDefaultProps === 'function') {
|
|
1634
|
-
!type.getDefaultProps.isReactClassApproved ?
|
|
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;
|
|
1635
2480
|
}
|
|
1636
2481
|
}
|
|
1637
2482
|
|
|
@@ -1640,22 +2485,22 @@ function validatePropTypes(element) {
|
|
|
1640
2485
|
* @param {ReactElement} fragment
|
|
1641
2486
|
*/
|
|
1642
2487
|
function validateFragmentProps(fragment) {
|
|
1643
|
-
|
|
2488
|
+
setCurrentlyValidatingElement(fragment);
|
|
1644
2489
|
|
|
1645
2490
|
var keys = Object.keys(fragment.props);
|
|
1646
2491
|
for (var i = 0; i < keys.length; i++) {
|
|
1647
2492
|
var key = keys[i];
|
|
1648
2493
|
if (key !== 'children' && key !== 'key') {
|
|
1649
|
-
|
|
2494
|
+
warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1650
2495
|
break;
|
|
1651
2496
|
}
|
|
1652
2497
|
}
|
|
1653
2498
|
|
|
1654
2499
|
if (fragment.ref !== null) {
|
|
1655
|
-
|
|
2500
|
+
warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1656
2501
|
}
|
|
1657
2502
|
|
|
1658
|
-
|
|
2503
|
+
setCurrentlyValidatingElement(null);
|
|
1659
2504
|
}
|
|
1660
2505
|
|
|
1661
2506
|
function createElementWithValidation(type, props, children) {
|
|
@@ -1676,18 +2521,19 @@ function createElementWithValidation(type, props, children) {
|
|
|
1676
2521
|
info += getDeclarationErrorAddendum();
|
|
1677
2522
|
}
|
|
1678
2523
|
|
|
1679
|
-
info += getStackAddendum() || '';
|
|
1680
|
-
|
|
1681
2524
|
var typeString = void 0;
|
|
1682
2525
|
if (type === null) {
|
|
1683
2526
|
typeString = 'null';
|
|
1684
2527
|
} else if (Array.isArray(type)) {
|
|
1685
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?';
|
|
1686
2532
|
} else {
|
|
1687
2533
|
typeString = typeof type;
|
|
1688
2534
|
}
|
|
1689
2535
|
|
|
1690
|
-
|
|
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);
|
|
1691
2537
|
}
|
|
1692
2538
|
|
|
1693
2539
|
var element = createElement.apply(this, arguments);
|
|
@@ -1775,25 +2621,12 @@ var React = {
|
|
|
1775
2621
|
|
|
1776
2622
|
version: ReactVersion,
|
|
1777
2623
|
|
|
1778
|
-
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:
|
|
1779
|
-
ReactCurrentOwner: ReactCurrentOwner,
|
|
1780
|
-
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
1781
|
-
assign: objectAssign
|
|
1782
|
-
}
|
|
2624
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
1783
2625
|
};
|
|
1784
2626
|
|
|
1785
2627
|
if (enableSuspense) {
|
|
1786
|
-
React.
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
{
|
|
1790
|
-
objectAssign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
1791
|
-
// These should not be included in production.
|
|
1792
|
-
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
1793
|
-
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
1794
|
-
// TODO: remove in React 17.0.
|
|
1795
|
-
ReactComponentTreeHook: {}
|
|
1796
|
-
});
|
|
2628
|
+
React.Placeholder = REACT_PLACEHOLDER_TYPE;
|
|
2629
|
+
React.lazy = lazy;
|
|
1797
2630
|
}
|
|
1798
2631
|
|
|
1799
2632
|
|
|
@@ -1806,7 +2639,7 @@ var React$3 = ( React$2 && React ) || React$2;
|
|
|
1806
2639
|
|
|
1807
2640
|
// TODO: decide on the top-level export form.
|
|
1808
2641
|
// This is hacky but makes it work with both Rollup and Jest.
|
|
1809
|
-
var react = React$3.default
|
|
2642
|
+
var react = React$3.default || React$3;
|
|
1810
2643
|
|
|
1811
2644
|
return react;
|
|
1812
2645
|
|