react 16.0.0-rc.2 → 16.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +16 -26
- package/README.md +1 -1
- package/cjs/react.development.js +405 -645
- package/cjs/react.production.min.js +21 -12
- package/index.js +0 -44
- package/package.json +6 -7
- package/umd/react.development.js +542 -765
- package/umd/react.production.min.js +22 -13
- package/PATENTS +0 -33
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
React v16.1.0-beta.1
|
|
3
|
+
react.production.min.js
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2013-present, Facebook, Inc.
|
|
6
|
+
|
|
7
|
+
This source code is licensed under the MIT license found in the
|
|
8
|
+
LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
'use strict';var n=require("object-assign"),p=require("fbjs/lib/emptyObject"),r=require("fbjs/lib/emptyFunction");
|
|
2
11
|
function t(a){for(var b=arguments.length-1,d="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,e=0;e<b;e++)d+="\x26args[]\x3d"+encodeURIComponent(arguments[e+1]);b=Error(d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");b.name="Invariant Violation";b.framesToPop=1;throw b;}
|
|
3
12
|
var u={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};function v(a,b,d){this.props=a;this.context=b;this.refs=p;this.updater=d||u}v.prototype.isReactComponent={};v.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?t("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};v.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};
|
|
4
|
-
function w(a,b,d){this.props=a;this.context=b;this.refs=p;this.updater=d||u}function x(){}x.prototype=v.prototype;var y=w.prototype=new x;y.constructor=w;
|
|
5
|
-
var B={
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
function w(a,b,d){this.props=a;this.context=b;this.refs=p;this.updater=d||u}function x(){}x.prototype=v.prototype;var y=w.prototype=new x;y.constructor=w;n(y,v.prototype);y.isPureReactComponent=!0;function z(a,b,d){this.props=a;this.context=b;this.refs=p;this.updater=d||u}var A=z.prototype=new x;A.constructor=z;n(A,v.prototype);A.unstable_isAsyncReactComponent=!0;A.render=function(){return this.props.children};
|
|
14
|
+
var B={current:null},C=Object.prototype.hasOwnProperty,D="function"===typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103,E={key:!0,ref:!0,__self:!0,__source:!0};function F(a,b,d,e,c,f,h){return{$$typeof:D,type:a,key:b,ref:d,props:h,_owner:f}}function G(a){return"object"===typeof a&&null!==a&&a.$$typeof===D}
|
|
15
|
+
var H="function"===typeof Symbol&&Symbol.iterator,I="function"===typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103,J="function"===typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.portal")||60106;function escape(a){var b={"\x3d":"\x3d0",":":"\x3d2"};return"$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}var K=/\/+/g,L=[];
|
|
16
|
+
function M(a,b,d,e){if(L.length){var c=L.pop();c.result=a;c.keyPrefix=b;c.func=d;c.context=e;c.count=0;return c}return{result:a,keyPrefix:b,func:d,context:e,count:0}}function N(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>L.length&&L.push(a)}
|
|
17
|
+
function O(a,b,d,e){var c=typeof a;if("undefined"===c||"boolean"===c)a=null;if(null===a||"string"===c||"number"===c||"object"===c&&a.$$typeof===I||"object"===c&&a.$$typeof===J)return d(e,a,""===b?"."+P(a,0):b),1;var f=0;b=""===b?".":b+":";if(Array.isArray(a))for(var h=0;h<a.length;h++){c=a[h];var l=b+P(c,h);f+=O(c,l,d,e)}else if(l=H&&a[H]||a["@@iterator"],"function"===typeof l)for(a=l.call(a),h=0;!(c=a.next()).done;)c=c.value,l=b+P(c,h++),f+=O(c,l,d,e);else"object"===c&&(d=""+a,t("31","[object Object]"===
|
|
18
|
+
d?"object with keys {"+Object.keys(a).join(", ")+"}":d,""));return f}function P(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function Q(a,b){a.func.call(a.context,b,a.count++)}
|
|
19
|
+
function R(a,b,d){var e=a.result,c=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?S(a,e,d,r.thatReturnsArgument):null!=a&&(G(a)&&(b=c+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(K,"$\x26/")+"/")+d,a=F(a.type,b,a.ref,a._self,a._source,a._owner,a.props)),e.push(a))}function S(a,b,d,e,c){var f="";null!=d&&(f=(""+d).replace(K,"$\x26/")+"/");b=M(b,f,e,c);null==a||O(a,"",R,b);N(b)}"function"===typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.fragment");
|
|
20
|
+
var T={Children:{map:function(a,b,d){if(null==a)return a;var e=[];S(a,e,null,b,d);return e},forEach:function(a,b,d){if(null==a)return a;b=M(null,null,b,d);null==a||O(a,"",Q,b);N(b)},count:function(a){return null==a?0:O(a,"",r.thatReturnsNull,null)},toArray:function(a){var b=[];S(a,b,null,r.thatReturnsArgument);return b},only:function(a){G(a)?void 0:t("143");return a}},Component:v,PureComponent:w,unstable_AsyncComponent:z,createElement:function(a,b,d){var e,c={},f=null,h=null,l=null,q=null;if(null!=
|
|
21
|
+
b)for(e in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(f=""+b.key),l=void 0===b.__self?null:b.__self,q=void 0===b.__source?null:b.__source,b)C.call(b,e)&&!E.hasOwnProperty(e)&&(c[e]=b[e]);var k=arguments.length-2;if(1===k)c.children=d;else if(1<k){for(var g=Array(k),m=0;m<k;m++)g[m]=arguments[m+2];c.children=g}if(a&&a.defaultProps)for(e in k=a.defaultProps,k)void 0===c[e]&&(c[e]=k[e]);return F(a,f,h,l,q,B.current,c)},cloneElement:function(a,b,d){var e=n({},a.props),c=a.key,f=a.ref,h=a._self,l=a._source,
|
|
22
|
+
q=a._owner;if(null!=b){void 0!==b.ref&&(f=b.ref,q=B.current);void 0!==b.key&&(c=""+b.key);if(a.type&&a.type.defaultProps)var k=a.type.defaultProps;for(g in b)C.call(b,g)&&!E.hasOwnProperty(g)&&(e[g]=void 0===b[g]&&void 0!==k?k[g]:b[g])}var g=arguments.length-2;if(1===g)e.children=d;else if(1<g){k=Array(g);for(var m=0;m<g;m++)k[m]=arguments[m+2];e.children=k}return F(a.type,c,f,h,l,q,e)},createFactory:function(a){var b=F.createElement.bind(null,a);b.type=a;return b},isValidElement:G,version:"16.1.0-beta.1",
|
|
23
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:B,assign:n}},U=Object.freeze({default:T}),V=U&&T||U;module.exports=V["default"]?V["default"]:V;
|
package/index.js
CHANGED
|
@@ -1,50 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function testMinificationUsedDCE() {
|
|
4
|
-
if (process.env.NODE_ENV === 'development') {
|
|
5
|
-
// We expect this method only to be called in production.
|
|
6
|
-
throw new Error('This is unreachable');
|
|
7
|
-
}
|
|
8
|
-
try {
|
|
9
|
-
// use scoped variable for our initial test, in case
|
|
10
|
-
// 'top-level' mangling is not enabled.
|
|
11
|
-
var source = testMinificationUsedDCE.toString();
|
|
12
|
-
var longVariableName = true;
|
|
13
|
-
if (longVariableName && source.match(/longVariableName/g).length === 3) {
|
|
14
|
-
// We are not minified.
|
|
15
|
-
// This might be a Node environment where DCE is not expected anyway.
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
if (source.match(/toString/g).length !== 2) {
|
|
19
|
-
// We always look for two matches:
|
|
20
|
-
// The actual occurence and then the call to 'match'
|
|
21
|
-
//
|
|
22
|
-
// We know for a fact the above line exists so there should be 2
|
|
23
|
-
// matches.
|
|
24
|
-
// Therefore the browser gave us invalid source.
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (source.match(/unreachable/g).length === 2) {
|
|
28
|
-
// We always look for two matches:
|
|
29
|
-
// The actual occurence and then the call to 'match'
|
|
30
|
-
|
|
31
|
-
// Dead code elimination would have stripped that branch
|
|
32
|
-
// because it is impossible to reach in production.
|
|
33
|
-
setTimeout(function() {
|
|
34
|
-
// Ensure it gets reported to production logging
|
|
35
|
-
throw new Error(
|
|
36
|
-
'React is running in production mode, but dead code ' +
|
|
37
|
-
'elimination has not been applied. Read how to correctly ' +
|
|
38
|
-
'configure React for production: ' +
|
|
39
|
-
'https://fburl.com/react-perf-use-the-production-build'
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
} catch (e) {}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
3
|
if (process.env.NODE_ENV === 'production') {
|
|
47
|
-
testMinificationUsedDCE();
|
|
48
4
|
module.exports = require('./cjs/react.production.min.js');
|
|
49
5
|
} else {
|
|
50
6
|
module.exports = require('./cjs/react.development.js');
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react",
|
|
3
3
|
"description": "React is a JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "16.0.0-rc.2",
|
|
5
4
|
"keywords": [
|
|
6
5
|
"react"
|
|
7
6
|
],
|
|
8
|
-
"
|
|
7
|
+
"version": "16.1.0-beta.1",
|
|
8
|
+
"homepage": "https://reactjs.org/",
|
|
9
9
|
"bugs": "https://github.com/facebook/react/issues",
|
|
10
|
-
"license": "
|
|
10
|
+
"license": "MIT",
|
|
11
11
|
"files": [
|
|
12
12
|
"LICENSE",
|
|
13
|
-
"PATENTS",
|
|
14
13
|
"README.md",
|
|
15
14
|
"index.js",
|
|
16
15
|
"cjs/",
|
|
@@ -22,10 +21,10 @@
|
|
|
22
21
|
"node": ">=0.10.0"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
25
|
-
"fbjs": "^0.8.
|
|
24
|
+
"fbjs": "^0.8.16",
|
|
26
25
|
"loose-envify": "^1.1.0",
|
|
27
|
-
"object-assign": "^4.1.
|
|
28
|
-
"prop-types": "^15.
|
|
26
|
+
"object-assign": "^4.1.1",
|
|
27
|
+
"prop-types": "^15.6.0"
|
|
29
28
|
},
|
|
30
29
|
"browserify": {
|
|
31
30
|
"transform": [
|
package/umd/react.development.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* react.development.js
|
|
1
|
+
/** @license React v16.1.0-beta.1
|
|
2
|
+
* react.development.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.
|
|
3
8
|
*/
|
|
4
9
|
|
|
5
10
|
(function (global, factory) {
|
|
@@ -14,6 +19,7 @@ object-assign
|
|
|
14
19
|
@license MIT
|
|
15
20
|
*/
|
|
16
21
|
|
|
22
|
+
|
|
17
23
|
/* eslint-disable no-unused-vars */
|
|
18
24
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
19
25
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -71,7 +77,7 @@ function shouldUseNative() {
|
|
|
71
77
|
}
|
|
72
78
|
}
|
|
73
79
|
|
|
74
|
-
var
|
|
80
|
+
var objectAssign$1 = shouldUseNative() ? Object.assign : function (target, source) {
|
|
75
81
|
var from;
|
|
76
82
|
var to = toObject(target);
|
|
77
83
|
var symbols;
|
|
@@ -100,23 +106,196 @@ var index = shouldUseNative() ? Object.assign : function (target, source) {
|
|
|
100
106
|
|
|
101
107
|
/**
|
|
102
108
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
103
|
-
* All rights reserved.
|
|
104
109
|
*
|
|
105
|
-
* This source code is licensed under the
|
|
106
|
-
* LICENSE file in the root directory of this source tree.
|
|
107
|
-
|
|
110
|
+
* This source code is licensed under the MIT license found in the
|
|
111
|
+
* LICENSE file in the root directory of this source tree.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
// TODO: this is special because it gets imported during build.
|
|
117
|
+
|
|
118
|
+
var ReactVersion = '16.1.0-beta.1';
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
122
|
+
*
|
|
123
|
+
* This source code is licensed under the MIT license found in the
|
|
124
|
+
* LICENSE file in the root directory of this source tree.
|
|
108
125
|
*
|
|
109
|
-
* @providesModule reactProdInvariant
|
|
110
126
|
*
|
|
111
127
|
*/
|
|
112
128
|
|
|
129
|
+
/**
|
|
130
|
+
* WARNING: DO NOT manually require this module.
|
|
131
|
+
* This is a replacement for `invariant(...)` used by the error code system
|
|
132
|
+
* and will _only_ be required by the corresponding babel pass.
|
|
133
|
+
* It always throws.
|
|
134
|
+
*/
|
|
135
|
+
|
|
113
136
|
/**
|
|
114
137
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
115
|
-
* All rights reserved.
|
|
116
138
|
*
|
|
117
|
-
* This source code is licensed under the
|
|
118
|
-
* LICENSE file in the root directory of this source tree.
|
|
119
|
-
*
|
|
139
|
+
* This source code is licensed under the MIT license found in the
|
|
140
|
+
* LICENSE file in the root directory of this source tree.
|
|
141
|
+
*
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
148
|
+
*
|
|
149
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
150
|
+
* to provide information about what broke and what you were
|
|
151
|
+
* expecting.
|
|
152
|
+
*
|
|
153
|
+
* The invariant message will be stripped in production, but the invariant
|
|
154
|
+
* will remain to ensure logic does not differ in production.
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
var validateFormat = function validateFormat(format) {};
|
|
158
|
+
|
|
159
|
+
{
|
|
160
|
+
validateFormat = function validateFormat(format) {
|
|
161
|
+
if (format === undefined) {
|
|
162
|
+
throw new Error('invariant requires an error message argument');
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function invariant(condition, format, a, b, c, d, e, f) {
|
|
168
|
+
validateFormat(format);
|
|
169
|
+
|
|
170
|
+
if (!condition) {
|
|
171
|
+
var error;
|
|
172
|
+
if (format === undefined) {
|
|
173
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
174
|
+
} else {
|
|
175
|
+
var args = [a, b, c, d, e, f];
|
|
176
|
+
var argIndex = 0;
|
|
177
|
+
error = new Error(format.replace(/%s/g, function () {
|
|
178
|
+
return args[argIndex++];
|
|
179
|
+
}));
|
|
180
|
+
error.name = 'Invariant Violation';
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
184
|
+
throw error;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
var invariant_1$1 = invariant;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
192
|
+
*
|
|
193
|
+
* This source code is licensed under the MIT license found in the
|
|
194
|
+
* LICENSE file in the root directory of this source tree.
|
|
195
|
+
*
|
|
196
|
+
*
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
// Exports React.Fragment
|
|
202
|
+
var enableReactFragment = false;
|
|
203
|
+
// Exports ReactDOM.createRoot
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
// Mutating mode (React DOM, React ART, React Native):
|
|
208
|
+
|
|
209
|
+
// Experimental noop mode (currently unused):
|
|
210
|
+
|
|
211
|
+
// Experimental persistent mode (CS):
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
// Only used in www builds.
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
218
|
+
*
|
|
219
|
+
* This source code is licensed under the MIT license found in the
|
|
220
|
+
* LICENSE file in the root directory of this source tree.
|
|
221
|
+
*
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
var emptyObject = {};
|
|
227
|
+
|
|
228
|
+
{
|
|
229
|
+
Object.freeze(emptyObject);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
var emptyObject_1 = emptyObject;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
236
|
+
*
|
|
237
|
+
* This source code is licensed under the MIT license found in the
|
|
238
|
+
* LICENSE file in the root directory of this source tree.
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Forked from fbjs/warning:
|
|
243
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
244
|
+
*
|
|
245
|
+
* Only change is we use console.warn instead of console.error,
|
|
246
|
+
* and do nothing when 'console' is not supported.
|
|
247
|
+
* This really simplifies the code.
|
|
248
|
+
* ---
|
|
249
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
250
|
+
* This can be used to log issues in development environments in critical
|
|
251
|
+
* paths. Removing the logging code for production environments will keep the
|
|
252
|
+
* same logic and follow the same code paths.
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
var lowPriorityWarning = function () {};
|
|
256
|
+
|
|
257
|
+
{
|
|
258
|
+
var printWarning = function (format) {
|
|
259
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
260
|
+
args[_key - 1] = arguments[_key];
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
var argIndex = 0;
|
|
264
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
265
|
+
return args[argIndex++];
|
|
266
|
+
});
|
|
267
|
+
if (typeof console !== 'undefined') {
|
|
268
|
+
console.warn(message);
|
|
269
|
+
}
|
|
270
|
+
try {
|
|
271
|
+
// --- Welcome to debugging React ---
|
|
272
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
273
|
+
// to find the callsite that caused this warning to fire.
|
|
274
|
+
throw new Error(message);
|
|
275
|
+
} catch (x) {}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
lowPriorityWarning = function (condition, format) {
|
|
279
|
+
if (format === undefined) {
|
|
280
|
+
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
281
|
+
}
|
|
282
|
+
if (!condition) {
|
|
283
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
284
|
+
args[_key2 - 2] = arguments[_key2];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
printWarning.apply(undefined, [format].concat(args));
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
296
|
+
*
|
|
297
|
+
* This source code is licensed under the MIT license found in the
|
|
298
|
+
* LICENSE file in the root directory of this source tree.
|
|
120
299
|
*
|
|
121
300
|
*
|
|
122
301
|
*/
|
|
@@ -147,6 +326,18 @@ emptyFunction.thatReturnsArgument = function (arg) {
|
|
|
147
326
|
|
|
148
327
|
var emptyFunction_1 = emptyFunction;
|
|
149
328
|
|
|
329
|
+
/**
|
|
330
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
331
|
+
*
|
|
332
|
+
* This source code is licensed under the MIT license found in the
|
|
333
|
+
* LICENSE file in the root directory of this source tree.
|
|
334
|
+
*
|
|
335
|
+
*/
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
150
341
|
/**
|
|
151
342
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
152
343
|
* This can be used to log issues in development environments in critical
|
|
@@ -154,10 +345,10 @@ var emptyFunction_1 = emptyFunction;
|
|
|
154
345
|
* same logic and follow the same code paths.
|
|
155
346
|
*/
|
|
156
347
|
|
|
157
|
-
var warning
|
|
348
|
+
var warning = emptyFunction_1;
|
|
158
349
|
|
|
159
350
|
{
|
|
160
|
-
var printWarning = function printWarning(format) {
|
|
351
|
+
var printWarning$1 = function printWarning(format) {
|
|
161
352
|
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
162
353
|
args[_key - 1] = arguments[_key];
|
|
163
354
|
}
|
|
@@ -177,7 +368,7 @@ var warning$1 = emptyFunction_1;
|
|
|
177
368
|
} catch (x) {}
|
|
178
369
|
};
|
|
179
370
|
|
|
180
|
-
warning
|
|
371
|
+
warning = function warning(condition, format) {
|
|
181
372
|
if (format === undefined) {
|
|
182
373
|
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
183
374
|
}
|
|
@@ -191,21 +382,32 @@ var warning$1 = emptyFunction_1;
|
|
|
191
382
|
args[_key2 - 2] = arguments[_key2];
|
|
192
383
|
}
|
|
193
384
|
|
|
194
|
-
printWarning.apply(undefined, [format].concat(args));
|
|
385
|
+
printWarning$1.apply(undefined, [format].concat(args));
|
|
195
386
|
}
|
|
196
387
|
};
|
|
197
388
|
}
|
|
198
389
|
|
|
199
|
-
var warning_1 = warning
|
|
390
|
+
var warning_1$1 = warning;
|
|
200
391
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
392
|
+
/**
|
|
393
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
394
|
+
*
|
|
395
|
+
* This source code is licensed under the MIT license found in the
|
|
396
|
+
* LICENSE file in the root directory of this source tree.
|
|
397
|
+
*/
|
|
398
|
+
|
|
399
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
|
204
400
|
|
|
205
401
|
function warnNoop(publicInstance, callerName) {
|
|
206
402
|
{
|
|
207
403
|
var constructor = publicInstance.constructor;
|
|
208
|
-
|
|
404
|
+
var componentName = constructor && (constructor.displayName || constructor.name) || 'ReactClass';
|
|
405
|
+
var warningKey = componentName + '.' + callerName;
|
|
406
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
warning_1$1(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
|
|
410
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
209
411
|
}
|
|
210
412
|
}
|
|
211
413
|
|
|
@@ -263,171 +465,40 @@ var ReactNoopUpdateQueue = {
|
|
|
263
465
|
/**
|
|
264
466
|
* Sets a subset of the state. This only exists because _pendingState is
|
|
265
467
|
* internal. This provides a merging strategy that is not available to deep
|
|
266
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
267
|
-
* during the merge.
|
|
268
|
-
*
|
|
269
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
270
|
-
* @param {object} partialState Next partial state to be merged with state.
|
|
271
|
-
* @param {?function} callback Called after component is updated.
|
|
272
|
-
* @param {?string} Name of the calling function in the public API.
|
|
273
|
-
* @internal
|
|
274
|
-
*/
|
|
275
|
-
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
276
|
-
warnNoop(publicInstance, 'setState');
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue;
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
284
|
-
* All rights reserved.
|
|
285
|
-
*
|
|
286
|
-
* This source code is licensed under the BSD-style license found in the
|
|
287
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
288
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
289
|
-
*
|
|
290
|
-
*/
|
|
291
|
-
|
|
292
|
-
var emptyObject = {};
|
|
293
|
-
|
|
294
|
-
{
|
|
295
|
-
Object.freeze(emptyObject);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
var emptyObject_1 = emptyObject;
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
302
|
-
* All rights reserved.
|
|
303
|
-
*
|
|
304
|
-
* This source code is licensed under the BSD-style license found in the
|
|
305
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
306
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
307
|
-
*
|
|
308
|
-
*/
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Use invariant() to assert state which your program assumes to be true.
|
|
312
|
-
*
|
|
313
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
|
314
|
-
* to provide information about what broke and what you were
|
|
315
|
-
* expecting.
|
|
316
|
-
*
|
|
317
|
-
* The invariant message will be stripped in production, but the invariant
|
|
318
|
-
* will remain to ensure logic does not differ in production.
|
|
319
|
-
*/
|
|
320
|
-
|
|
321
|
-
var validateFormat = function validateFormat(format) {};
|
|
322
|
-
|
|
323
|
-
{
|
|
324
|
-
validateFormat = function validateFormat(format) {
|
|
325
|
-
if (format === undefined) {
|
|
326
|
-
throw new Error('invariant requires an error message argument');
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
|
332
|
-
validateFormat(format);
|
|
333
|
-
|
|
334
|
-
if (!condition) {
|
|
335
|
-
var error;
|
|
336
|
-
if (format === undefined) {
|
|
337
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
338
|
-
} else {
|
|
339
|
-
var args = [a, b, c, d, e, f];
|
|
340
|
-
var argIndex = 0;
|
|
341
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
342
|
-
return args[argIndex++];
|
|
343
|
-
}));
|
|
344
|
-
error.name = 'Invariant Violation';
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
348
|
-
throw error;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
var invariant_1 = invariant;
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Copyright 2014-2015, Facebook, Inc.
|
|
356
|
-
* All rights reserved.
|
|
357
|
-
*
|
|
358
|
-
* This source code is licensed under the BSD-style license found in the
|
|
359
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
360
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
361
|
-
*
|
|
362
|
-
* @providesModule lowPriorityWarning
|
|
363
|
-
*/
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Forked from fbjs/warning:
|
|
367
|
-
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
368
|
-
*
|
|
369
|
-
* Only change is we use console.warn instead of console.error,
|
|
370
|
-
* and do nothing when 'console' is not supported.
|
|
371
|
-
* This really simplifies the code.
|
|
372
|
-
* ---
|
|
373
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
374
|
-
* This can be used to log issues in development environments in critical
|
|
375
|
-
* paths. Removing the logging code for production environments will keep the
|
|
376
|
-
* same logic and follow the same code paths.
|
|
377
|
-
*/
|
|
378
|
-
|
|
379
|
-
var lowPriorityWarning = function () {};
|
|
380
|
-
|
|
381
|
-
{
|
|
382
|
-
var printWarning$1 = function (format) {
|
|
383
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
384
|
-
args[_key - 1] = arguments[_key];
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
var argIndex = 0;
|
|
388
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
389
|
-
return args[argIndex++];
|
|
390
|
-
});
|
|
391
|
-
if (typeof console !== 'undefined') {
|
|
392
|
-
console.warn(message);
|
|
393
|
-
}
|
|
394
|
-
try {
|
|
395
|
-
// --- Welcome to debugging React ---
|
|
396
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
397
|
-
// to find the callsite that caused this warning to fire.
|
|
398
|
-
throw new Error(message);
|
|
399
|
-
} catch (x) {}
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
lowPriorityWarning = function (condition, format) {
|
|
403
|
-
if (format === undefined) {
|
|
404
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
405
|
-
}
|
|
406
|
-
if (!condition) {
|
|
407
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
408
|
-
args[_key2 - 2] = arguments[_key2];
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
printWarning$1.apply(undefined, [format].concat(args));
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
}
|
|
468
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
469
|
+
* during the merge.
|
|
470
|
+
*
|
|
471
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
472
|
+
* @param {object} partialState Next partial state to be merged with state.
|
|
473
|
+
* @param {?function} callback Called after component is updated.
|
|
474
|
+
* @param {?string} Name of the calling function in the public API.
|
|
475
|
+
* @internal
|
|
476
|
+
*/
|
|
477
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
478
|
+
warnNoop(publicInstance, 'setState');
|
|
479
|
+
}
|
|
480
|
+
};
|
|
415
481
|
|
|
416
|
-
|
|
482
|
+
/**
|
|
483
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
484
|
+
*
|
|
485
|
+
* This source code is licensed under the MIT license found in the
|
|
486
|
+
* LICENSE file in the root directory of this source tree.
|
|
487
|
+
*/
|
|
417
488
|
|
|
418
489
|
/**
|
|
419
490
|
* Base class helpers for the updating state of a component.
|
|
420
491
|
*/
|
|
421
|
-
function
|
|
492
|
+
function Component(props, context, updater) {
|
|
422
493
|
this.props = props;
|
|
423
494
|
this.context = context;
|
|
424
495
|
this.refs = emptyObject_1;
|
|
425
496
|
// We initialize the default updater but the real one gets injected by the
|
|
426
497
|
// renderer.
|
|
427
|
-
this.updater = updater ||
|
|
498
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
428
499
|
}
|
|
429
500
|
|
|
430
|
-
|
|
501
|
+
Component.prototype.isReactComponent = {};
|
|
431
502
|
|
|
432
503
|
/**
|
|
433
504
|
* Sets a subset of the state. Always use this to mutate
|
|
@@ -454,8 +525,8 @@ ReactComponent.prototype.isReactComponent = {};
|
|
|
454
525
|
* @final
|
|
455
526
|
* @protected
|
|
456
527
|
*/
|
|
457
|
-
|
|
458
|
-
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant_1(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
|
|
528
|
+
Component.prototype.setState = function (partialState, callback) {
|
|
529
|
+
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant_1$1(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
|
|
459
530
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
460
531
|
};
|
|
461
532
|
|
|
@@ -473,7 +544,7 @@ ReactComponent.prototype.setState = function (partialState, callback) {
|
|
|
473
544
|
* @final
|
|
474
545
|
* @protected
|
|
475
546
|
*/
|
|
476
|
-
|
|
547
|
+
Component.prototype.forceUpdate = function (callback) {
|
|
477
548
|
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
478
549
|
};
|
|
479
550
|
|
|
@@ -488,9 +559,9 @@ ReactComponent.prototype.forceUpdate = function (callback) {
|
|
|
488
559
|
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
489
560
|
};
|
|
490
561
|
var defineDeprecationWarning = function (methodName, info) {
|
|
491
|
-
Object.defineProperty(
|
|
562
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
492
563
|
get: function () {
|
|
493
|
-
|
|
564
|
+
lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
494
565
|
return undefined;
|
|
495
566
|
}
|
|
496
567
|
});
|
|
@@ -505,61 +576,43 @@ ReactComponent.prototype.forceUpdate = function (callback) {
|
|
|
505
576
|
/**
|
|
506
577
|
* Base class helpers for the updating state of a component.
|
|
507
578
|
*/
|
|
508
|
-
function
|
|
509
|
-
// Duplicated from
|
|
579
|
+
function PureComponent(props, context, updater) {
|
|
580
|
+
// Duplicated from Component.
|
|
510
581
|
this.props = props;
|
|
511
582
|
this.context = context;
|
|
512
583
|
this.refs = emptyObject_1;
|
|
513
584
|
// We initialize the default updater but the real one gets injected by the
|
|
514
585
|
// renderer.
|
|
515
|
-
this.updater = updater ||
|
|
586
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
516
587
|
}
|
|
517
588
|
|
|
518
589
|
function ComponentDummy() {}
|
|
519
|
-
ComponentDummy.prototype =
|
|
520
|
-
var pureComponentPrototype =
|
|
521
|
-
pureComponentPrototype.constructor =
|
|
590
|
+
ComponentDummy.prototype = Component.prototype;
|
|
591
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
592
|
+
pureComponentPrototype.constructor = PureComponent;
|
|
522
593
|
// Avoid an extra prototype jump for these methods.
|
|
523
|
-
|
|
594
|
+
objectAssign$1(pureComponentPrototype, Component.prototype);
|
|
524
595
|
pureComponentPrototype.isPureReactComponent = true;
|
|
525
596
|
|
|
526
|
-
function
|
|
527
|
-
// Duplicated from
|
|
597
|
+
function AsyncComponent(props, context, updater) {
|
|
598
|
+
// Duplicated from Component.
|
|
528
599
|
this.props = props;
|
|
529
600
|
this.context = context;
|
|
530
601
|
this.refs = emptyObject_1;
|
|
531
602
|
// We initialize the default updater but the real one gets injected by the
|
|
532
603
|
// renderer.
|
|
533
|
-
this.updater = updater ||
|
|
604
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
534
605
|
}
|
|
535
606
|
|
|
536
|
-
var asyncComponentPrototype =
|
|
537
|
-
asyncComponentPrototype.constructor =
|
|
607
|
+
var asyncComponentPrototype = AsyncComponent.prototype = new ComponentDummy();
|
|
608
|
+
asyncComponentPrototype.constructor = AsyncComponent;
|
|
538
609
|
// Avoid an extra prototype jump for these methods.
|
|
539
|
-
|
|
610
|
+
objectAssign$1(asyncComponentPrototype, Component.prototype);
|
|
540
611
|
asyncComponentPrototype.unstable_isAsyncReactComponent = true;
|
|
541
612
|
asyncComponentPrototype.render = function () {
|
|
542
613
|
return this.props.children;
|
|
543
614
|
};
|
|
544
615
|
|
|
545
|
-
var ReactBaseClasses = {
|
|
546
|
-
Component: ReactComponent,
|
|
547
|
-
PureComponent: ReactPureComponent,
|
|
548
|
-
AsyncComponent: ReactAsyncComponent
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
553
|
-
* All rights reserved.
|
|
554
|
-
*
|
|
555
|
-
* This source code is licensed under the BSD-style license found in the
|
|
556
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
557
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
558
|
-
*
|
|
559
|
-
* @providesModule ReactCurrentOwner
|
|
560
|
-
*
|
|
561
|
-
*/
|
|
562
|
-
|
|
563
616
|
/**
|
|
564
617
|
* Keeps track of the current owner.
|
|
565
618
|
*
|
|
@@ -572,16 +625,24 @@ var ReactCurrentOwner = {
|
|
|
572
625
|
* @type {ReactComponent}
|
|
573
626
|
*/
|
|
574
627
|
current: null
|
|
575
|
-
};
|
|
628
|
+
}; /**
|
|
629
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
630
|
+
*
|
|
631
|
+
* This source code is licensed under the MIT license found in the
|
|
632
|
+
* LICENSE file in the root directory of this source tree.
|
|
633
|
+
*
|
|
634
|
+
*
|
|
635
|
+
*/
|
|
576
636
|
|
|
577
|
-
|
|
637
|
+
/**
|
|
638
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
639
|
+
*
|
|
640
|
+
* This source code is licensed under the MIT license found in the
|
|
641
|
+
* LICENSE file in the root directory of this source tree.
|
|
642
|
+
*/
|
|
578
643
|
|
|
579
644
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
580
645
|
|
|
581
|
-
{
|
|
582
|
-
var warning$3 = warning_1;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
646
|
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
586
647
|
// nor polyfill, then a plain number is used for performance.
|
|
587
648
|
var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
@@ -624,7 +685,7 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
624
685
|
var warnAboutAccessingKey = function () {
|
|
625
686
|
if (!specialPropKeyWarningShown) {
|
|
626
687
|
specialPropKeyWarningShown = true;
|
|
627
|
-
|
|
688
|
+
warning_1$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
628
689
|
}
|
|
629
690
|
};
|
|
630
691
|
warnAboutAccessingKey.isReactWarning = true;
|
|
@@ -638,7 +699,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
638
699
|
var warnAboutAccessingRef = function () {
|
|
639
700
|
if (!specialPropRefWarningShown) {
|
|
640
701
|
specialPropRefWarningShown = true;
|
|
641
|
-
|
|
702
|
+
warning_1$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
642
703
|
}
|
|
643
704
|
};
|
|
644
705
|
warnAboutAccessingRef.isReactWarning = true;
|
|
@@ -726,9 +787,9 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
726
787
|
|
|
727
788
|
/**
|
|
728
789
|
* Create and return a new ReactElement of the given type.
|
|
729
|
-
* See https://
|
|
790
|
+
* See https://reactjs.org/docs/react-api.html#createelement
|
|
730
791
|
*/
|
|
731
|
-
|
|
792
|
+
function createElement(type, config, children) {
|
|
732
793
|
var propName;
|
|
733
794
|
|
|
734
795
|
// Reserved names are extracted
|
|
@@ -797,39 +858,30 @@ ReactElement.createElement = function (type, config, children) {
|
|
|
797
858
|
}
|
|
798
859
|
}
|
|
799
860
|
}
|
|
800
|
-
return ReactElement(type, key, ref, self, source,
|
|
801
|
-
}
|
|
861
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
862
|
+
}
|
|
802
863
|
|
|
803
864
|
/**
|
|
804
865
|
* Return a function that produces ReactElements of a given type.
|
|
805
|
-
* See https://
|
|
866
|
+
* See https://reactjs.org/docs/react-api.html#createfactory
|
|
806
867
|
*/
|
|
807
|
-
ReactElement.createFactory = function (type) {
|
|
808
|
-
var factory = ReactElement.createElement.bind(null, type);
|
|
809
|
-
// Expose the type on the factory and the prototype so that it can be
|
|
810
|
-
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
|
|
811
|
-
// This should not be named `constructor` since this may not be the function
|
|
812
|
-
// that created the element, and it may not even be a constructor.
|
|
813
|
-
// Legacy hook TODO: Warn if this is accessed
|
|
814
|
-
factory.type = type;
|
|
815
|
-
return factory;
|
|
816
|
-
};
|
|
817
868
|
|
|
818
|
-
|
|
869
|
+
|
|
870
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
|
819
871
|
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
820
872
|
|
|
821
873
|
return newElement;
|
|
822
|
-
}
|
|
874
|
+
}
|
|
823
875
|
|
|
824
876
|
/**
|
|
825
877
|
* Clone and return a new ReactElement using element as the starting point.
|
|
826
|
-
* See https://
|
|
878
|
+
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
827
879
|
*/
|
|
828
|
-
|
|
880
|
+
function cloneElement(element, config, children) {
|
|
829
881
|
var propName;
|
|
830
882
|
|
|
831
883
|
// Original props are copied
|
|
832
|
-
var props =
|
|
884
|
+
var props = objectAssign$1({}, element.props);
|
|
833
885
|
|
|
834
886
|
// Reserved names are extracted
|
|
835
887
|
var key = element.key;
|
|
@@ -848,7 +900,7 @@ ReactElement.cloneElement = function (element, config, children) {
|
|
|
848
900
|
if (hasValidRef(config)) {
|
|
849
901
|
// Silently steal the ref from the parent.
|
|
850
902
|
ref = config.ref;
|
|
851
|
-
owner =
|
|
903
|
+
owner = ReactCurrentOwner.current;
|
|
852
904
|
}
|
|
853
905
|
if (hasValidKey(config)) {
|
|
854
906
|
key = '' + config.key;
|
|
@@ -885,30 +937,25 @@ ReactElement.cloneElement = function (element, config, children) {
|
|
|
885
937
|
}
|
|
886
938
|
|
|
887
939
|
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
888
|
-
}
|
|
940
|
+
}
|
|
889
941
|
|
|
890
942
|
/**
|
|
891
943
|
* Verifies the object is a ReactElement.
|
|
892
|
-
* See https://
|
|
944
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
893
945
|
* @param {?object} object
|
|
894
946
|
* @return {boolean} True if `object` is a valid component.
|
|
895
947
|
* @final
|
|
896
948
|
*/
|
|
897
|
-
|
|
949
|
+
function isValidElement(object) {
|
|
898
950
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE$1;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
var ReactElement_1 = ReactElement;
|
|
951
|
+
}
|
|
902
952
|
|
|
903
953
|
/**
|
|
904
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
905
|
-
* All rights reserved.
|
|
954
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
906
955
|
*
|
|
907
|
-
* This source code is licensed under the
|
|
908
|
-
* LICENSE file in the root directory of this source tree.
|
|
909
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
956
|
+
* This source code is licensed under the MIT license found in the
|
|
957
|
+
* LICENSE file in the root directory of this source tree.
|
|
910
958
|
*
|
|
911
|
-
* @providesModule ReactDebugCurrentFrame
|
|
912
959
|
*
|
|
913
960
|
*/
|
|
914
961
|
|
|
@@ -927,21 +974,19 @@ var ReactDebugCurrentFrame = {};
|
|
|
927
974
|
};
|
|
928
975
|
}
|
|
929
976
|
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
getStackAddendum = _require.getStackAddendum;
|
|
937
|
-
}
|
|
977
|
+
/**
|
|
978
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
979
|
+
*
|
|
980
|
+
* This source code is licensed under the MIT license found in the
|
|
981
|
+
* LICENSE file in the root directory of this source tree.
|
|
982
|
+
*/
|
|
938
983
|
|
|
939
984
|
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
940
985
|
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
941
986
|
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
942
987
|
// nor polyfill, then a plain number is used for performance.
|
|
943
988
|
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
944
|
-
|
|
989
|
+
var REACT_PORTAL_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.portal') || 0xeaca;
|
|
945
990
|
var SEPARATOR = '.';
|
|
946
991
|
var SUBSEPARATOR = ':';
|
|
947
992
|
|
|
@@ -1028,7 +1073,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1028
1073
|
if (children === null || type === 'string' || type === 'number' ||
|
|
1029
1074
|
// The following is inlined from ReactElement. This means we can optimize
|
|
1030
1075
|
// some checks. React Fiber also inlines this logic for similar purposes.
|
|
1031
|
-
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1076
|
+
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE || type === 'object' && children.$$typeof === REACT_PORTAL_TYPE) {
|
|
1032
1077
|
callback(traverseContext, children,
|
|
1033
1078
|
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1034
1079
|
// so that it's consistent if the number of children grows.
|
|
@@ -1053,7 +1098,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1053
1098
|
{
|
|
1054
1099
|
// Warn about using Maps as children
|
|
1055
1100
|
if (iteratorFn === children.entries) {
|
|
1056
|
-
|
|
1101
|
+
warning_1$1(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', ReactDebugCurrentFrame.getStackAddendum());
|
|
1057
1102
|
didWarnAboutMaps = true;
|
|
1058
1103
|
}
|
|
1059
1104
|
}
|
|
@@ -1069,10 +1114,10 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1069
1114
|
} else if (type === 'object') {
|
|
1070
1115
|
var addendum = '';
|
|
1071
1116
|
{
|
|
1072
|
-
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getStackAddendum();
|
|
1117
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1073
1118
|
}
|
|
1074
1119
|
var childrenString = '' + children;
|
|
1075
|
-
invariant_1(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
|
1120
|
+
invariant_1$1(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
|
1076
1121
|
}
|
|
1077
1122
|
}
|
|
1078
1123
|
|
|
@@ -1131,7 +1176,7 @@ function forEachSingleChild(bookKeeping, child, name) {
|
|
|
1131
1176
|
/**
|
|
1132
1177
|
* Iterates through children that are typically specified as `props.children`.
|
|
1133
1178
|
*
|
|
1134
|
-
* See https://
|
|
1179
|
+
* See https://reactjs.org/docs/react-api.html#react.children.foreach
|
|
1135
1180
|
*
|
|
1136
1181
|
* The provided forEachFunc(child, index) will be called for each
|
|
1137
1182
|
* leaf child.
|
|
@@ -1160,8 +1205,8 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
|
1160
1205
|
if (Array.isArray(mappedChild)) {
|
|
1161
1206
|
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction_1.thatReturnsArgument);
|
|
1162
1207
|
} else if (mappedChild != null) {
|
|
1163
|
-
if (
|
|
1164
|
-
mappedChild =
|
|
1208
|
+
if (isValidElement(mappedChild)) {
|
|
1209
|
+
mappedChild = cloneAndReplaceKey(mappedChild,
|
|
1165
1210
|
// Keep both the (mapped) and old keys if they differ, just as
|
|
1166
1211
|
// traverseAllChildren used to do for objects as children
|
|
1167
1212
|
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
@@ -1183,7 +1228,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
|
1183
1228
|
/**
|
|
1184
1229
|
* Maps children that are typically specified as `props.children`.
|
|
1185
1230
|
*
|
|
1186
|
-
* See https://
|
|
1231
|
+
* See https://reactjs.org/docs/react-api.html#react.children.map
|
|
1187
1232
|
*
|
|
1188
1233
|
* The provided mapFunction(child, key, index) will be called for each
|
|
1189
1234
|
* leaf child.
|
|
@@ -1206,7 +1251,7 @@ function mapChildren(children, func, context) {
|
|
|
1206
1251
|
* Count the number of children that are typically specified as
|
|
1207
1252
|
* `props.children`.
|
|
1208
1253
|
*
|
|
1209
|
-
* See https://
|
|
1254
|
+
* See https://reactjs.org/docs/react-api.html#react.children.count
|
|
1210
1255
|
*
|
|
1211
1256
|
* @param {?*} children Children tree container.
|
|
1212
1257
|
* @return {number} The number of children.
|
|
@@ -1219,7 +1264,7 @@ function countChildren(children, context) {
|
|
|
1219
1264
|
* Flatten a children object (typically specified as `props.children`) and
|
|
1220
1265
|
* return an array with appropriately re-keyed children.
|
|
1221
1266
|
*
|
|
1222
|
-
* See https://
|
|
1267
|
+
* See https://reactjs.org/docs/react-api.html#react.children.toarray
|
|
1223
1268
|
*/
|
|
1224
1269
|
function toArray(children) {
|
|
1225
1270
|
var result = [];
|
|
@@ -1227,33 +1272,11 @@ function toArray(children) {
|
|
|
1227
1272
|
return result;
|
|
1228
1273
|
}
|
|
1229
1274
|
|
|
1230
|
-
var ReactChildren = {
|
|
1231
|
-
forEach: forEachChildren,
|
|
1232
|
-
map: mapChildren,
|
|
1233
|
-
count: countChildren,
|
|
1234
|
-
toArray: toArray
|
|
1235
|
-
};
|
|
1236
|
-
|
|
1237
|
-
var ReactChildren_1 = ReactChildren;
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1241
|
-
* All rights reserved.
|
|
1242
|
-
*
|
|
1243
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1244
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1245
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1246
|
-
*
|
|
1247
|
-
* @providesModule ReactVersion
|
|
1248
|
-
*/
|
|
1249
|
-
|
|
1250
|
-
var ReactVersion = '16.0.0-rc.2';
|
|
1251
|
-
|
|
1252
1275
|
/**
|
|
1253
1276
|
* Returns the first child in a collection of children and verifies that there
|
|
1254
1277
|
* is only one child in the collection.
|
|
1255
1278
|
*
|
|
1256
|
-
* See https://
|
|
1279
|
+
* See https://reactjs.org/docs/react-api.html#react.children.only
|
|
1257
1280
|
*
|
|
1258
1281
|
* The current implementation of this function assumes that a single child gets
|
|
1259
1282
|
* passed without a wrapper, but the purpose of this helper function is to
|
|
@@ -1264,28 +1287,67 @@ var ReactVersion = '16.0.0-rc.2';
|
|
|
1264
1287
|
* structure.
|
|
1265
1288
|
*/
|
|
1266
1289
|
function onlyChild(children) {
|
|
1267
|
-
!
|
|
1290
|
+
!isValidElement(children) ? invariant_1$1(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
|
1268
1291
|
return children;
|
|
1269
1292
|
}
|
|
1270
1293
|
|
|
1271
|
-
|
|
1294
|
+
/**
|
|
1295
|
+
* Copyright (c) 2016-present, Facebook, Inc.
|
|
1296
|
+
*
|
|
1297
|
+
* This source code is licensed under the MIT license found in the
|
|
1298
|
+
* LICENSE file in the root directory of this source tree.
|
|
1299
|
+
*
|
|
1300
|
+
*
|
|
1301
|
+
*/
|
|
1302
|
+
|
|
1303
|
+
var describeComponentFrame = function (name, source, ownerName) {
|
|
1304
|
+
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1307
|
+
function getComponentName(fiber) {
|
|
1308
|
+
var type = fiber.type;
|
|
1309
|
+
|
|
1310
|
+
if (typeof type === 'string') {
|
|
1311
|
+
return type;
|
|
1312
|
+
}
|
|
1313
|
+
if (typeof type === 'function') {
|
|
1314
|
+
return type.displayName || type.name;
|
|
1315
|
+
}
|
|
1316
|
+
return null;
|
|
1317
|
+
} /**
|
|
1318
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1319
|
+
*
|
|
1320
|
+
* This source code is licensed under the MIT license found in the
|
|
1321
|
+
* LICENSE file in the root directory of this source tree.
|
|
1322
|
+
*
|
|
1323
|
+
*
|
|
1324
|
+
*/
|
|
1272
1325
|
|
|
1273
1326
|
/**
|
|
1274
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1275
|
-
* All rights reserved.
|
|
1327
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1276
1328
|
*
|
|
1277
|
-
* This source code is licensed under the
|
|
1278
|
-
* LICENSE file in the root directory of this source tree.
|
|
1279
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1329
|
+
* This source code is licensed under the MIT license found in the
|
|
1330
|
+
* LICENSE file in the root directory of this source tree.
|
|
1280
1331
|
*/
|
|
1281
1332
|
|
|
1333
|
+
|
|
1334
|
+
|
|
1282
1335
|
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1283
1336
|
|
|
1284
1337
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
1285
1338
|
|
|
1339
|
+
/**
|
|
1340
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1341
|
+
*
|
|
1342
|
+
* This source code is licensed under the MIT license found in the
|
|
1343
|
+
* LICENSE file in the root directory of this source tree.
|
|
1344
|
+
*/
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
|
|
1286
1348
|
{
|
|
1287
|
-
var invariant$2 = invariant_1;
|
|
1288
|
-
var warning$
|
|
1349
|
+
var invariant$2 = invariant_1$1;
|
|
1350
|
+
var warning$2 = warning_1$1;
|
|
1289
1351
|
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1290
1352
|
var loggedTypeFailures = {};
|
|
1291
1353
|
}
|
|
@@ -1301,7 +1363,7 @@ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
|
1301
1363
|
* @param {?Function} getStack Returns the component stack.
|
|
1302
1364
|
* @private
|
|
1303
1365
|
*/
|
|
1304
|
-
function checkPropTypes
|
|
1366
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
1305
1367
|
{
|
|
1306
1368
|
for (var typeSpecName in typeSpecs) {
|
|
1307
1369
|
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
|
@@ -1312,12 +1374,12 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
|
|
|
1312
1374
|
try {
|
|
1313
1375
|
// This is intentionally an invariant that gets caught. It's the same
|
|
1314
1376
|
// behavior as without this statement except with a better message.
|
|
1315
|
-
invariant$2(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + '
|
|
1377
|
+
invariant$2(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
|
|
1316
1378
|
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
1317
1379
|
} catch (ex) {
|
|
1318
1380
|
error = ex;
|
|
1319
1381
|
}
|
|
1320
|
-
warning$
|
|
1382
|
+
warning$2(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
|
|
1321
1383
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1322
1384
|
// Only monitor this failure once because there tends to be a lot of the
|
|
1323
1385
|
// same error.
|
|
@@ -1325,74 +1387,30 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
|
|
|
1325
1387
|
|
|
1326
1388
|
var stack = getStack ? getStack() : '';
|
|
1327
1389
|
|
|
1328
|
-
warning$
|
|
1390
|
+
warning$2(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
|
1329
1391
|
}
|
|
1330
1392
|
}
|
|
1331
1393
|
}
|
|
1332
1394
|
}
|
|
1333
1395
|
}
|
|
1334
1396
|
|
|
1335
|
-
var checkPropTypes_1 = checkPropTypes
|
|
1397
|
+
var checkPropTypes_1$1 = checkPropTypes;
|
|
1336
1398
|
|
|
1337
1399
|
/**
|
|
1338
|
-
* Copyright
|
|
1339
|
-
* All rights reserved.
|
|
1340
|
-
*
|
|
1341
|
-
* This source code is licensed under the BSD-style license found in the
|
|
1342
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1343
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1400
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
1344
1401
|
*
|
|
1345
|
-
*
|
|
1346
|
-
*
|
|
1402
|
+
* This source code is licensed under the MIT license found in the
|
|
1403
|
+
* LICENSE file in the root directory of this source tree.
|
|
1347
1404
|
*/
|
|
1348
1405
|
|
|
1349
|
-
var describeComponentFrame$1 = function (name, source, ownerName) {
|
|
1350
|
-
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
1351
|
-
};
|
|
1352
|
-
|
|
1353
1406
|
/**
|
|
1354
|
-
*
|
|
1355
|
-
*
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1358
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
1359
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1360
|
-
*
|
|
1361
|
-
* @providesModule getComponentName
|
|
1362
|
-
*
|
|
1407
|
+
* ReactElementValidator provides a wrapper around a element factory
|
|
1408
|
+
* which validates the props passed to the element. This is intended to be
|
|
1409
|
+
* used only in DEV and could be replaced by a static type checker for languages
|
|
1410
|
+
* that support it.
|
|
1363
1411
|
*/
|
|
1364
1412
|
|
|
1365
|
-
function getComponentName$1(instanceOrFiber) {
|
|
1366
|
-
if (typeof instanceOrFiber.getName === 'function') {
|
|
1367
|
-
// Stack reconciler
|
|
1368
|
-
var instance = instanceOrFiber;
|
|
1369
|
-
return instance.getName();
|
|
1370
|
-
}
|
|
1371
|
-
if (typeof instanceOrFiber.tag === 'number') {
|
|
1372
|
-
// Fiber reconciler
|
|
1373
|
-
var fiber = instanceOrFiber;
|
|
1374
|
-
var type = fiber.type;
|
|
1375
|
-
|
|
1376
|
-
if (typeof type === 'string') {
|
|
1377
|
-
return type;
|
|
1378
|
-
}
|
|
1379
|
-
if (typeof type === 'function') {
|
|
1380
|
-
return type.displayName || type.name;
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
return null;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
var getComponentName_1 = getComponentName$1;
|
|
1387
|
-
|
|
1388
1413
|
{
|
|
1389
|
-
var checkPropTypes = checkPropTypes_1;
|
|
1390
|
-
var lowPriorityWarning$1 = lowPriorityWarning_1;
|
|
1391
|
-
var ReactDebugCurrentFrame$1 = ReactDebugCurrentFrame_1;
|
|
1392
|
-
var warning$4 = warning_1;
|
|
1393
|
-
var describeComponentFrame = describeComponentFrame$1;
|
|
1394
|
-
var getComponentName = getComponentName_1;
|
|
1395
|
-
|
|
1396
1414
|
var currentlyValidatingElement = null;
|
|
1397
1415
|
|
|
1398
1416
|
var getDisplayName = function (element) {
|
|
@@ -1402,29 +1420,35 @@ var getComponentName_1 = getComponentName$1;
|
|
|
1402
1420
|
return '#text';
|
|
1403
1421
|
} else if (typeof element.type === 'string') {
|
|
1404
1422
|
return element.type;
|
|
1423
|
+
} else if (element.type === REACT_FRAGMENT_TYPE$1) {
|
|
1424
|
+
return 'React.Fragment';
|
|
1405
1425
|
} else {
|
|
1406
1426
|
return element.type.displayName || element.type.name || 'Unknown';
|
|
1407
1427
|
}
|
|
1408
1428
|
};
|
|
1409
1429
|
|
|
1410
|
-
var getStackAddendum
|
|
1430
|
+
var getStackAddendum = function () {
|
|
1411
1431
|
var stack = '';
|
|
1412
1432
|
if (currentlyValidatingElement) {
|
|
1413
1433
|
var name = getDisplayName(currentlyValidatingElement);
|
|
1414
1434
|
var owner = currentlyValidatingElement._owner;
|
|
1415
1435
|
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
|
|
1416
1436
|
}
|
|
1417
|
-
stack += ReactDebugCurrentFrame
|
|
1437
|
+
stack += ReactDebugCurrentFrame.getStackAddendum() || '';
|
|
1418
1438
|
return stack;
|
|
1419
1439
|
};
|
|
1440
|
+
|
|
1441
|
+
var REACT_FRAGMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.fragment') || 0xeacb;
|
|
1442
|
+
|
|
1443
|
+
var VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
|
|
1420
1444
|
}
|
|
1421
1445
|
|
|
1422
1446
|
var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
|
|
1423
1447
|
var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
|
|
1424
1448
|
|
|
1425
1449
|
function getDeclarationErrorAddendum() {
|
|
1426
|
-
if (
|
|
1427
|
-
var name = getComponentName(
|
|
1450
|
+
if (ReactCurrentOwner.current) {
|
|
1451
|
+
var name = getComponentName(ReactCurrentOwner.current);
|
|
1428
1452
|
if (name) {
|
|
1429
1453
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
1430
1454
|
}
|
|
@@ -1488,14 +1512,14 @@ function validateExplicitKey(element, parentType) {
|
|
|
1488
1512
|
// property, it may be the creator of the child that's responsible for
|
|
1489
1513
|
// assigning it a key.
|
|
1490
1514
|
var childOwner = '';
|
|
1491
|
-
if (element && element._owner && element._owner !==
|
|
1515
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
1492
1516
|
// Give the component that originally created this child.
|
|
1493
1517
|
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
|
1494
1518
|
}
|
|
1495
1519
|
|
|
1496
1520
|
currentlyValidatingElement = element;
|
|
1497
1521
|
{
|
|
1498
|
-
|
|
1522
|
+
warning_1$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.%s', currentComponentErrorInfo, childOwner, getStackAddendum());
|
|
1499
1523
|
}
|
|
1500
1524
|
currentlyValidatingElement = null;
|
|
1501
1525
|
}
|
|
@@ -1516,11 +1540,11 @@ function validateChildKeys(node, parentType) {
|
|
|
1516
1540
|
if (Array.isArray(node)) {
|
|
1517
1541
|
for (var i = 0; i < node.length; i++) {
|
|
1518
1542
|
var child = node[i];
|
|
1519
|
-
if (
|
|
1543
|
+
if (isValidElement(child)) {
|
|
1520
1544
|
validateExplicitKey(child, parentType);
|
|
1521
1545
|
}
|
|
1522
1546
|
}
|
|
1523
|
-
} else if (
|
|
1547
|
+
} else if (isValidElement(node)) {
|
|
1524
1548
|
// This element was passed in a valid location.
|
|
1525
1549
|
if (node._store) {
|
|
1526
1550
|
node._store.validated = true;
|
|
@@ -1534,7 +1558,7 @@ function validateChildKeys(node, parentType) {
|
|
|
1534
1558
|
var iterator = iteratorFn.call(node);
|
|
1535
1559
|
var step;
|
|
1536
1560
|
while (!(step = iterator.next()).done) {
|
|
1537
|
-
if (
|
|
1561
|
+
if (isValidElement(step.value)) {
|
|
1538
1562
|
validateExplicitKey(step.value, parentType);
|
|
1539
1563
|
}
|
|
1540
1564
|
}
|
|
@@ -1555,462 +1579,215 @@ function validatePropTypes(element) {
|
|
|
1555
1579
|
return;
|
|
1556
1580
|
}
|
|
1557
1581
|
var name = componentClass.displayName || componentClass.name;
|
|
1558
|
-
|
|
1559
|
-
// ReactNative `View.propTypes` have been deprecated in favor of `ViewPropTypes`.
|
|
1560
|
-
// In their place a temporary getter has been added with a deprecated warning message.
|
|
1561
|
-
// Avoid triggering that warning during validation using the temporary workaround,
|
|
1562
|
-
// __propTypesSecretDontUseThesePlease.
|
|
1563
|
-
// TODO (bvaughn) Revert this particular change any time after April 1 ReactNative tag.
|
|
1564
|
-
var propTypes = typeof componentClass.__propTypesSecretDontUseThesePlease === 'object' ? componentClass.__propTypesSecretDontUseThesePlease : componentClass.propTypes;
|
|
1582
|
+
var propTypes = componentClass.propTypes;
|
|
1565
1583
|
|
|
1566
1584
|
if (propTypes) {
|
|
1567
1585
|
currentlyValidatingElement = element;
|
|
1568
|
-
|
|
1586
|
+
checkPropTypes_1$1(propTypes, element.props, 'prop', name, getStackAddendum);
|
|
1569
1587
|
currentlyValidatingElement = null;
|
|
1570
1588
|
}
|
|
1571
1589
|
if (typeof componentClass.getDefaultProps === 'function') {
|
|
1572
|
-
|
|
1590
|
+
warning_1$1(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1573
1591
|
}
|
|
1574
1592
|
}
|
|
1575
1593
|
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
var info = '';
|
|
1583
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1584
|
-
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
var sourceInfo = getSourceInfoErrorAddendum(props);
|
|
1588
|
-
if (sourceInfo) {
|
|
1589
|
-
info += sourceInfo;
|
|
1590
|
-
} else {
|
|
1591
|
-
info += getDeclarationErrorAddendum();
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
info += ReactDebugCurrentFrame$1.getStackAddendum() || '';
|
|
1594
|
+
/**
|
|
1595
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
1596
|
+
* @param {ReactElement} fragment
|
|
1597
|
+
*/
|
|
1598
|
+
function validateFragmentProps(fragment) {
|
|
1599
|
+
currentlyValidatingElement = fragment;
|
|
1595
1600
|
|
|
1596
|
-
|
|
1597
|
-
|
|
1601
|
+
var _iteratorNormalCompletion = true;
|
|
1602
|
+
var _didIteratorError = false;
|
|
1603
|
+
var _iteratorError = undefined;
|
|
1598
1604
|
|
|
1599
|
-
|
|
1605
|
+
try {
|
|
1606
|
+
for (var _iterator = Object.keys(fragment.props)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
1607
|
+
var key = _step.value;
|
|
1600
1608
|
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1609
|
+
if (!VALID_FRAGMENT_PROPS.has(key)) {
|
|
1610
|
+
warning_1$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum());
|
|
1611
|
+
break;
|
|
1612
|
+
}
|
|
1605
1613
|
}
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1614
|
+
} catch (err) {
|
|
1615
|
+
_didIteratorError = true;
|
|
1616
|
+
_iteratorError = err;
|
|
1617
|
+
} finally {
|
|
1618
|
+
try {
|
|
1619
|
+
if (!_iteratorNormalCompletion && _iterator['return']) {
|
|
1620
|
+
_iterator['return']();
|
|
1621
|
+
}
|
|
1622
|
+
} finally {
|
|
1623
|
+
if (_didIteratorError) {
|
|
1624
|
+
throw _iteratorError;
|
|
1615
1625
|
}
|
|
1616
1626
|
}
|
|
1627
|
+
}
|
|
1617
1628
|
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
},
|
|
1629
|
+
if (fragment.ref !== null) {
|
|
1630
|
+
warning_1$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
|
|
1631
|
+
}
|
|
1622
1632
|
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
// Legacy hook TODO: Warn if this is accessed
|
|
1626
|
-
validatedFactory.type = type;
|
|
1633
|
+
currentlyValidatingElement = null;
|
|
1634
|
+
}
|
|
1627
1635
|
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
return type;
|
|
1637
|
-
}
|
|
1638
|
-
});
|
|
1636
|
+
function createElementWithValidation(type, props, children) {
|
|
1637
|
+
var validType = typeof type === 'string' || typeof type === 'function' || typeof type === 'symbol' || typeof type === 'number';
|
|
1638
|
+
// We warn in this case but don't throw. We expect the element creation to
|
|
1639
|
+
// succeed and there will likely be errors in render.
|
|
1640
|
+
if (!validType) {
|
|
1641
|
+
var info = '';
|
|
1642
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1643
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
|
|
1639
1644
|
}
|
|
1640
1645
|
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
1647
|
-
validateChildKeys(arguments[i], newElement.type);
|
|
1646
|
+
var sourceInfo = getSourceInfoErrorAddendum(props);
|
|
1647
|
+
if (sourceInfo) {
|
|
1648
|
+
info += sourceInfo;
|
|
1649
|
+
} else {
|
|
1650
|
+
info += getDeclarationErrorAddendum();
|
|
1648
1651
|
}
|
|
1649
|
-
validatePropTypes(newElement);
|
|
1650
|
-
return newElement;
|
|
1651
|
-
}
|
|
1652
|
-
};
|
|
1653
|
-
|
|
1654
|
-
var ReactElementValidator_1 = ReactElementValidator$1;
|
|
1655
1652
|
|
|
1656
|
-
|
|
1657
|
-
var warning$6 = warning_1;
|
|
1658
|
-
}
|
|
1653
|
+
info += getStackAddendum() || '';
|
|
1659
1654
|
|
|
1660
|
-
function
|
|
1661
|
-
// Based on isNative() from Lodash
|
|
1662
|
-
var funcToString = Function.prototype.toString;
|
|
1663
|
-
var reIsNative = RegExp('^' + funcToString
|
|
1664
|
-
// Take an example native function source for comparison
|
|
1665
|
-
.call(Object.prototype.hasOwnProperty)
|
|
1666
|
-
// Strip regex characters so we can use it for regex
|
|
1667
|
-
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
|
1668
|
-
// Remove hasOwnProperty from the template to make it generic
|
|
1669
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
1670
|
-
try {
|
|
1671
|
-
var source = funcToString.call(fn);
|
|
1672
|
-
return reIsNative.test(source);
|
|
1673
|
-
} catch (err) {
|
|
1674
|
-
return false;
|
|
1655
|
+
warning_1$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', type == null ? type : typeof type, info);
|
|
1675
1656
|
}
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
var canUseCollections =
|
|
1679
|
-
// Array.from
|
|
1680
|
-
typeof Array.from === 'function' &&
|
|
1681
|
-
// Map
|
|
1682
|
-
typeof Map === 'function' && isNative(Map) &&
|
|
1683
|
-
// Map.prototype.keys
|
|
1684
|
-
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
|
|
1685
|
-
// Set
|
|
1686
|
-
typeof Set === 'function' && isNative(Set) &&
|
|
1687
|
-
// Set.prototype.keys
|
|
1688
|
-
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
|
|
1689
|
-
|
|
1690
|
-
var setItem;
|
|
1691
|
-
var getItem;
|
|
1692
|
-
var removeItem;
|
|
1693
|
-
var getItemIDs;
|
|
1694
|
-
var addRoot;
|
|
1695
|
-
var removeRoot;
|
|
1696
|
-
var getRootIDs;
|
|
1697
|
-
|
|
1698
|
-
if (canUseCollections) {
|
|
1699
|
-
var itemMap = new Map();
|
|
1700
|
-
var rootIDSet = new Set();
|
|
1701
|
-
|
|
1702
|
-
setItem = function (id, item) {
|
|
1703
|
-
itemMap.set(id, item);
|
|
1704
|
-
};
|
|
1705
|
-
getItem = function (id) {
|
|
1706
|
-
return itemMap.get(id);
|
|
1707
|
-
};
|
|
1708
|
-
removeItem = function (id) {
|
|
1709
|
-
itemMap['delete'](id);
|
|
1710
|
-
};
|
|
1711
|
-
getItemIDs = function () {
|
|
1712
|
-
return Array.from(itemMap.keys());
|
|
1713
|
-
};
|
|
1714
|
-
|
|
1715
|
-
addRoot = function (id) {
|
|
1716
|
-
rootIDSet.add(id);
|
|
1717
|
-
};
|
|
1718
|
-
removeRoot = function (id) {
|
|
1719
|
-
rootIDSet['delete'](id);
|
|
1720
|
-
};
|
|
1721
|
-
getRootIDs = function () {
|
|
1722
|
-
return Array.from(rootIDSet.keys());
|
|
1723
|
-
};
|
|
1724
|
-
} else {
|
|
1725
|
-
var itemByKey = {};
|
|
1726
|
-
var rootByKey = {};
|
|
1727
|
-
|
|
1728
|
-
// Use non-numeric keys to prevent V8 performance issues:
|
|
1729
|
-
// https://github.com/facebook/react/pull/7232
|
|
1730
|
-
var getKeyFromID = function (id) {
|
|
1731
|
-
return '.' + id;
|
|
1732
|
-
};
|
|
1733
|
-
var getIDFromKey = function (key) {
|
|
1734
|
-
return parseInt(key.substr(1), 10);
|
|
1735
|
-
};
|
|
1736
|
-
|
|
1737
|
-
setItem = function (id, item) {
|
|
1738
|
-
var key = getKeyFromID(id);
|
|
1739
|
-
itemByKey[key] = item;
|
|
1740
|
-
};
|
|
1741
|
-
getItem = function (id) {
|
|
1742
|
-
var key = getKeyFromID(id);
|
|
1743
|
-
return itemByKey[key];
|
|
1744
|
-
};
|
|
1745
|
-
removeItem = function (id) {
|
|
1746
|
-
var key = getKeyFromID(id);
|
|
1747
|
-
delete itemByKey[key];
|
|
1748
|
-
};
|
|
1749
|
-
getItemIDs = function () {
|
|
1750
|
-
return Object.keys(itemByKey).map(getIDFromKey);
|
|
1751
|
-
};
|
|
1752
|
-
|
|
1753
|
-
addRoot = function (id) {
|
|
1754
|
-
var key = getKeyFromID(id);
|
|
1755
|
-
rootByKey[key] = true;
|
|
1756
|
-
};
|
|
1757
|
-
removeRoot = function (id) {
|
|
1758
|
-
var key = getKeyFromID(id);
|
|
1759
|
-
delete rootByKey[key];
|
|
1760
|
-
};
|
|
1761
|
-
getRootIDs = function () {
|
|
1762
|
-
return Object.keys(rootByKey).map(getIDFromKey);
|
|
1763
|
-
};
|
|
1764
|
-
}
|
|
1765
1657
|
|
|
1766
|
-
var
|
|
1658
|
+
var element = createElement.apply(this, arguments);
|
|
1767
1659
|
|
|
1768
|
-
function
|
|
1769
|
-
|
|
1770
|
-
if (
|
|
1771
|
-
|
|
1660
|
+
// The result can be nullish if a mock or a custom function is used.
|
|
1661
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1662
|
+
if (element == null) {
|
|
1663
|
+
return element;
|
|
1664
|
+
}
|
|
1772
1665
|
|
|
1773
|
-
|
|
1774
|
-
|
|
1666
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
|
1667
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1668
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
1669
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1670
|
+
// fixed, the key warnings will appear.)
|
|
1671
|
+
if (validType) {
|
|
1672
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
1673
|
+
validateChildKeys(arguments[i], type);
|
|
1674
|
+
}
|
|
1775
1675
|
}
|
|
1776
|
-
}
|
|
1777
1676
|
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
return '#empty';
|
|
1781
|
-
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1782
|
-
return '#text';
|
|
1783
|
-
} else if (typeof element.type === 'string') {
|
|
1784
|
-
return element.type;
|
|
1677
|
+
if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE$1) {
|
|
1678
|
+
validateFragmentProps(element);
|
|
1785
1679
|
} else {
|
|
1786
|
-
|
|
1680
|
+
validatePropTypes(element);
|
|
1787
1681
|
}
|
|
1788
|
-
}
|
|
1789
1682
|
|
|
1790
|
-
|
|
1791
|
-
var name = ReactComponentTreeHook.getDisplayName(id);
|
|
1792
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1793
|
-
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
|
1794
|
-
var ownerName = void 0;
|
|
1795
|
-
|
|
1796
|
-
if (ownerID) {
|
|
1797
|
-
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
|
|
1798
|
-
}
|
|
1799
|
-
warning$6(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
|
|
1800
|
-
return describeComponentFrame$1(name || '', element && element._source, ownerName || '');
|
|
1683
|
+
return element;
|
|
1801
1684
|
}
|
|
1802
1685
|
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
item.childIDs = nextChildIDs;
|
|
1808
|
-
|
|
1809
|
-
for (var i = 0; i < nextChildIDs.length; i++) {
|
|
1810
|
-
var nextChildID = nextChildIDs[i];
|
|
1811
|
-
var nextChild = getItem(nextChildID);
|
|
1812
|
-
!nextChild ? invariant_1(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1813
|
-
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? invariant_1(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : void 0;
|
|
1814
|
-
!nextChild.isMounted ? invariant_1(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1815
|
-
if (nextChild.parentID == null) {
|
|
1816
|
-
nextChild.parentID = id;
|
|
1817
|
-
// TODO: This shouldn't be necessary but mounting a new root during in
|
|
1818
|
-
// componentWillMount currently causes not-yet-mounted components to
|
|
1819
|
-
// be purged from our tree data so their parent id is missing.
|
|
1820
|
-
}
|
|
1821
|
-
!(nextChild.parentID === id) ? invariant_1(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : void 0;
|
|
1822
|
-
}
|
|
1823
|
-
},
|
|
1824
|
-
onBeforeMountComponent: function (id, element, parentID) {
|
|
1825
|
-
var item = {
|
|
1826
|
-
element: element,
|
|
1827
|
-
parentID: parentID,
|
|
1828
|
-
text: null,
|
|
1829
|
-
childIDs: [],
|
|
1830
|
-
isMounted: false,
|
|
1831
|
-
updateCount: 0
|
|
1832
|
-
};
|
|
1833
|
-
setItem(id, item);
|
|
1834
|
-
},
|
|
1835
|
-
onBeforeUpdateComponent: function (id, element) {
|
|
1836
|
-
var item = getItem(id);
|
|
1837
|
-
if (!item || !item.isMounted) {
|
|
1838
|
-
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1839
|
-
// In this case, ignore the element.
|
|
1840
|
-
return;
|
|
1841
|
-
}
|
|
1842
|
-
item.element = element;
|
|
1843
|
-
},
|
|
1844
|
-
onMountComponent: function (id) {
|
|
1845
|
-
var item = getItem(id);
|
|
1846
|
-
!item ? invariant_1(false, 'Item must have been set') : void 0;
|
|
1847
|
-
item.isMounted = true;
|
|
1848
|
-
var isRoot = item.parentID === 0;
|
|
1849
|
-
if (isRoot) {
|
|
1850
|
-
addRoot(id);
|
|
1851
|
-
}
|
|
1852
|
-
},
|
|
1853
|
-
onUpdateComponent: function (id) {
|
|
1854
|
-
var item = getItem(id);
|
|
1855
|
-
if (!item || !item.isMounted) {
|
|
1856
|
-
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1857
|
-
// In this case, ignore the element.
|
|
1858
|
-
return;
|
|
1859
|
-
}
|
|
1860
|
-
item.updateCount++;
|
|
1861
|
-
},
|
|
1862
|
-
onUnmountComponent: function (id) {
|
|
1863
|
-
var item = getItem(id);
|
|
1864
|
-
if (item) {
|
|
1865
|
-
// We need to check if it exists.
|
|
1866
|
-
// `item` might not exist if it is inside an error boundary, and a sibling
|
|
1867
|
-
// error boundary child threw while mounting. Then this instance never
|
|
1868
|
-
// got a chance to mount, but it still gets an unmounting event during
|
|
1869
|
-
// the error boundary cleanup.
|
|
1870
|
-
item.isMounted = false;
|
|
1871
|
-
var isRoot = item.parentID === 0;
|
|
1872
|
-
if (isRoot) {
|
|
1873
|
-
removeRoot(id);
|
|
1874
|
-
}
|
|
1875
|
-
}
|
|
1876
|
-
unmountedIDs.push(id);
|
|
1877
|
-
},
|
|
1878
|
-
purgeUnmountedComponents: function () {
|
|
1879
|
-
if (ReactComponentTreeHook._preventPurging) {
|
|
1880
|
-
// Should only be used for testing.
|
|
1881
|
-
return;
|
|
1882
|
-
}
|
|
1686
|
+
function createFactoryWithValidation(type) {
|
|
1687
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
1688
|
+
// Legacy hook TODO: Warn if this is accessed
|
|
1689
|
+
validatedFactory.type = type;
|
|
1883
1690
|
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
},
|
|
1894
|
-
getCurrentStackAddendum: function () {
|
|
1895
|
-
var info = '';
|
|
1896
|
-
var currentOwner = ReactCurrentOwner_1.current;
|
|
1897
|
-
if (currentOwner) {
|
|
1898
|
-
!(typeof currentOwner.tag !== 'number') ? invariant_1(false, 'Fiber owners should not show up in Stack stack traces.') : void 0;
|
|
1899
|
-
if (typeof currentOwner._debugID === 'number') {
|
|
1900
|
-
info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
|
|
1691
|
+
{
|
|
1692
|
+
Object.defineProperty(validatedFactory, 'type', {
|
|
1693
|
+
enumerable: false,
|
|
1694
|
+
get: function () {
|
|
1695
|
+
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
1696
|
+
Object.defineProperty(this, 'type', {
|
|
1697
|
+
value: type
|
|
1698
|
+
});
|
|
1699
|
+
return type;
|
|
1901
1700
|
}
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
},
|
|
1905
|
-
getStackAddendumByID: function (id) {
|
|
1906
|
-
var info = '';
|
|
1907
|
-
while (id) {
|
|
1908
|
-
info += describeID(id);
|
|
1909
|
-
id = ReactComponentTreeHook.getParentID(id);
|
|
1910
|
-
}
|
|
1911
|
-
return info;
|
|
1912
|
-
},
|
|
1913
|
-
getChildIDs: function (id) {
|
|
1914
|
-
var item = getItem(id);
|
|
1915
|
-
return item ? item.childIDs : [];
|
|
1916
|
-
},
|
|
1917
|
-
getDisplayName: function (id) {
|
|
1918
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1919
|
-
if (!element) {
|
|
1920
|
-
return null;
|
|
1921
|
-
}
|
|
1922
|
-
return getDisplayName$1(element);
|
|
1923
|
-
},
|
|
1924
|
-
getElement: function (id) {
|
|
1925
|
-
var item = getItem(id);
|
|
1926
|
-
return item ? item.element : null;
|
|
1927
|
-
},
|
|
1928
|
-
getOwnerID: function (id) {
|
|
1929
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1930
|
-
if (!element || !element._owner) {
|
|
1931
|
-
return null;
|
|
1932
|
-
}
|
|
1933
|
-
return element._owner._debugID;
|
|
1934
|
-
},
|
|
1935
|
-
getParentID: function (id) {
|
|
1936
|
-
var item = getItem(id);
|
|
1937
|
-
return item ? item.parentID : null;
|
|
1938
|
-
},
|
|
1939
|
-
getSource: function (id) {
|
|
1940
|
-
var item = getItem(id);
|
|
1941
|
-
var element = item ? item.element : null;
|
|
1942
|
-
var source = element != null ? element._source : null;
|
|
1943
|
-
return source;
|
|
1944
|
-
},
|
|
1945
|
-
getText: function (id) {
|
|
1946
|
-
var element = ReactComponentTreeHook.getElement(id);
|
|
1947
|
-
if (typeof element === 'string') {
|
|
1948
|
-
return element;
|
|
1949
|
-
} else if (typeof element === 'number') {
|
|
1950
|
-
return '' + element;
|
|
1951
|
-
} else {
|
|
1952
|
-
return null;
|
|
1953
|
-
}
|
|
1954
|
-
},
|
|
1955
|
-
getUpdateCount: function (id) {
|
|
1956
|
-
var item = getItem(id);
|
|
1957
|
-
return item ? item.updateCount : 0;
|
|
1958
|
-
},
|
|
1959
|
-
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1960
1703
|
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
};
|
|
1704
|
+
return validatedFactory;
|
|
1705
|
+
}
|
|
1964
1706
|
|
|
1965
|
-
|
|
1707
|
+
function cloneElementWithValidation(element, props, children) {
|
|
1708
|
+
var newElement = cloneElement.apply(this, arguments);
|
|
1709
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
1710
|
+
validateChildKeys(arguments[i], newElement.type);
|
|
1711
|
+
}
|
|
1712
|
+
validatePropTypes(newElement);
|
|
1713
|
+
return newElement;
|
|
1714
|
+
}
|
|
1966
1715
|
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1716
|
+
/**
|
|
1717
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1718
|
+
*
|
|
1719
|
+
* This source code is licensed under the MIT license found in the
|
|
1720
|
+
* LICENSE file in the root directory of this source tree.
|
|
1721
|
+
*/
|
|
1970
1722
|
|
|
1971
|
-
|
|
1972
|
-
var ReactElementValidator = ReactElementValidator_1;
|
|
1973
|
-
createElement = ReactElementValidator.createElement;
|
|
1974
|
-
createFactory = ReactElementValidator.createFactory;
|
|
1975
|
-
cloneElement = ReactElementValidator.cloneElement;
|
|
1976
|
-
}
|
|
1723
|
+
var REACT_FRAGMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.fragment') || 0xeacb;
|
|
1977
1724
|
|
|
1978
1725
|
var React = {
|
|
1979
1726
|
Children: {
|
|
1980
|
-
map:
|
|
1981
|
-
forEach:
|
|
1982
|
-
count:
|
|
1983
|
-
toArray:
|
|
1984
|
-
only:
|
|
1727
|
+
map: mapChildren,
|
|
1728
|
+
forEach: forEachChildren,
|
|
1729
|
+
count: countChildren,
|
|
1730
|
+
toArray: toArray,
|
|
1731
|
+
only: onlyChild
|
|
1985
1732
|
},
|
|
1986
1733
|
|
|
1987
|
-
Component:
|
|
1988
|
-
PureComponent:
|
|
1989
|
-
unstable_AsyncComponent:
|
|
1734
|
+
Component: Component,
|
|
1735
|
+
PureComponent: PureComponent,
|
|
1736
|
+
unstable_AsyncComponent: AsyncComponent,
|
|
1990
1737
|
|
|
1991
|
-
createElement:
|
|
1992
|
-
cloneElement:
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
createFactory: createFactory,
|
|
1738
|
+
createElement: createElementWithValidation,
|
|
1739
|
+
cloneElement: cloneElementWithValidation,
|
|
1740
|
+
createFactory: createFactoryWithValidation,
|
|
1741
|
+
isValidElement: isValidElement,
|
|
1996
1742
|
|
|
1997
1743
|
version: ReactVersion,
|
|
1998
1744
|
|
|
1999
1745
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
2000
|
-
ReactCurrentOwner:
|
|
1746
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
1747
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
1748
|
+
assign: objectAssign$1
|
|
2001
1749
|
}
|
|
2002
1750
|
};
|
|
2003
1751
|
|
|
1752
|
+
if (enableReactFragment) {
|
|
1753
|
+
React.Fragment = REACT_FRAGMENT_TYPE;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
2004
1756
|
{
|
|
2005
|
-
|
|
1757
|
+
objectAssign$1(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
2006
1758
|
// These should not be included in production.
|
|
2007
|
-
|
|
2008
|
-
|
|
1759
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
1760
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
1761
|
+
// TODO: remove in React 17.0.
|
|
1762
|
+
ReactComponentTreeHook: {}
|
|
2009
1763
|
});
|
|
2010
1764
|
}
|
|
2011
1765
|
|
|
2012
|
-
var ReactEntry = React;
|
|
2013
1766
|
|
|
2014
|
-
|
|
1767
|
+
|
|
1768
|
+
var React$2 = Object.freeze({
|
|
1769
|
+
default: React
|
|
1770
|
+
});
|
|
1771
|
+
|
|
1772
|
+
var React$3 = ( React$2 && React ) || React$2;
|
|
1773
|
+
|
|
1774
|
+
/**
|
|
1775
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1776
|
+
*
|
|
1777
|
+
* This source code is licensed under the MIT license found in the
|
|
1778
|
+
* LICENSE file in the root directory of this source tree.
|
|
1779
|
+
*
|
|
1780
|
+
*
|
|
1781
|
+
*/
|
|
1782
|
+
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
|
|
1787
|
+
// TODO: decide on the top-level export form.
|
|
1788
|
+
// This is hacky but makes it work with both Rollup and Jest.
|
|
1789
|
+
var react = React$3['default'] ? React$3['default'] : React$3;
|
|
1790
|
+
|
|
1791
|
+
return react;
|
|
2015
1792
|
|
|
2016
1793
|
})));
|