react 16.0.0-rc.1 → 16.1.0-beta
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 +406 -644
- package/cjs/react.production.min.js +21 -12
- package/index.js +0 -44
- package/package.json +6 -7
- package/umd/react.development.js +544 -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
|
|
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",
|
|
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
|
-
const source = testMinificationUsedDCE.toString();
|
|
12
|
-
const 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.1",
|
|
5
4
|
"keywords": [
|
|
6
5
|
"react"
|
|
7
6
|
],
|
|
8
|
-
"
|
|
7
|
+
"version": "16.1.0-beta",
|
|
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
|
|
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,198 @@ 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';
|
|
119
|
+
|
|
120
|
+
var ReactFeatureFlags = {
|
|
121
|
+
enableAsyncSubtreeAPI: true,
|
|
122
|
+
enableAsyncSchedulingByDefaultInReactDOM: false,
|
|
123
|
+
// Mutating mode (React DOM, React ART, React Native):
|
|
124
|
+
enableMutatingReconciler: true,
|
|
125
|
+
// Experimental noop mode (currently unused):
|
|
126
|
+
enableNoopReconciler: false,
|
|
127
|
+
// Experimental persistent mode (CS):
|
|
128
|
+
enablePersistentReconciler: false,
|
|
129
|
+
// Exports React.Fragment
|
|
130
|
+
enableReactFragment: false,
|
|
131
|
+
// Exports ReactDOM.createRoot
|
|
132
|
+
enableCreateRoot: false
|
|
133
|
+
}; /**
|
|
134
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
135
|
+
*
|
|
136
|
+
* This source code is licensed under the MIT license found in the
|
|
137
|
+
* LICENSE file in the root directory of this source tree.
|
|
138
|
+
*
|
|
139
|
+
*
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
{
|
|
143
|
+
if (Object.freeze) {
|
|
144
|
+
Object.freeze(ReactFeatureFlags);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
150
|
+
*
|
|
151
|
+
* This source code is licensed under the MIT license found in the
|
|
152
|
+
* LICENSE file in the root directory of this source tree.
|
|
108
153
|
*
|
|
109
|
-
* @providesModule reactProdInvariant
|
|
110
154
|
*
|
|
111
155
|
*/
|
|
112
156
|
|
|
157
|
+
/**
|
|
158
|
+
* WARNING: DO NOT manually require this module.
|
|
159
|
+
* This is a replacement for `invariant(...)` used by the error code system
|
|
160
|
+
* and will _only_ be required by the corresponding babel pass.
|
|
161
|
+
* It always throws.
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
166
|
+
*
|
|
167
|
+
* This source code is licensed under the MIT license found in the
|
|
168
|
+
* LICENSE file in the root directory of this source tree.
|
|
169
|
+
*
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
var emptyObject = {};
|
|
175
|
+
|
|
176
|
+
{
|
|
177
|
+
Object.freeze(emptyObject);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
var emptyObject_1 = emptyObject;
|
|
181
|
+
|
|
113
182
|
/**
|
|
114
183
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
115
|
-
* All rights reserved.
|
|
116
184
|
*
|
|
117
|
-
* This source code is licensed under the
|
|
118
|
-
* LICENSE file in the root directory of this source tree.
|
|
119
|
-
*
|
|
185
|
+
* This source code is licensed under the MIT license found in the
|
|
186
|
+
* LICENSE file in the root directory of this source tree.
|
|
187
|
+
*
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
194
|
+
*
|
|
195
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
196
|
+
* to provide information about what broke and what you were
|
|
197
|
+
* expecting.
|
|
198
|
+
*
|
|
199
|
+
* The invariant message will be stripped in production, but the invariant
|
|
200
|
+
* will remain to ensure logic does not differ in production.
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
var validateFormat = function validateFormat(format) {};
|
|
204
|
+
|
|
205
|
+
{
|
|
206
|
+
validateFormat = function validateFormat(format) {
|
|
207
|
+
if (format === undefined) {
|
|
208
|
+
throw new Error('invariant requires an error message argument');
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function invariant(condition, format, a, b, c, d, e, f) {
|
|
214
|
+
validateFormat(format);
|
|
215
|
+
|
|
216
|
+
if (!condition) {
|
|
217
|
+
var error;
|
|
218
|
+
if (format === undefined) {
|
|
219
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
220
|
+
} else {
|
|
221
|
+
var args = [a, b, c, d, e, f];
|
|
222
|
+
var argIndex = 0;
|
|
223
|
+
error = new Error(format.replace(/%s/g, function () {
|
|
224
|
+
return args[argIndex++];
|
|
225
|
+
}));
|
|
226
|
+
error.name = 'Invariant Violation';
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
var invariant_1$1 = invariant;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
238
|
+
*
|
|
239
|
+
* This source code is licensed under the MIT license found in the
|
|
240
|
+
* LICENSE file in the root directory of this source tree.
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Forked from fbjs/warning:
|
|
245
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
246
|
+
*
|
|
247
|
+
* Only change is we use console.warn instead of console.error,
|
|
248
|
+
* and do nothing when 'console' is not supported.
|
|
249
|
+
* This really simplifies the code.
|
|
250
|
+
* ---
|
|
251
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
252
|
+
* This can be used to log issues in development environments in critical
|
|
253
|
+
* paths. Removing the logging code for production environments will keep the
|
|
254
|
+
* same logic and follow the same code paths.
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
var lowPriorityWarning = function () {};
|
|
258
|
+
|
|
259
|
+
{
|
|
260
|
+
var printWarning = function (format) {
|
|
261
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
262
|
+
args[_key - 1] = arguments[_key];
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
var argIndex = 0;
|
|
266
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
267
|
+
return args[argIndex++];
|
|
268
|
+
});
|
|
269
|
+
if (typeof console !== 'undefined') {
|
|
270
|
+
console.warn(message);
|
|
271
|
+
}
|
|
272
|
+
try {
|
|
273
|
+
// --- Welcome to debugging React ---
|
|
274
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
275
|
+
// to find the callsite that caused this warning to fire.
|
|
276
|
+
throw new Error(message);
|
|
277
|
+
} catch (x) {}
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
lowPriorityWarning = function (condition, format) {
|
|
281
|
+
if (format === undefined) {
|
|
282
|
+
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
283
|
+
}
|
|
284
|
+
if (!condition) {
|
|
285
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
286
|
+
args[_key2 - 2] = arguments[_key2];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
printWarning.apply(undefined, [format].concat(args));
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
298
|
+
*
|
|
299
|
+
* This source code is licensed under the MIT license found in the
|
|
300
|
+
* LICENSE file in the root directory of this source tree.
|
|
120
301
|
*
|
|
121
302
|
*
|
|
122
303
|
*/
|
|
@@ -147,6 +328,18 @@ emptyFunction.thatReturnsArgument = function (arg) {
|
|
|
147
328
|
|
|
148
329
|
var emptyFunction_1 = emptyFunction;
|
|
149
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
333
|
+
*
|
|
334
|
+
* This source code is licensed under the MIT license found in the
|
|
335
|
+
* LICENSE file in the root directory of this source tree.
|
|
336
|
+
*
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
150
343
|
/**
|
|
151
344
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
152
345
|
* This can be used to log issues in development environments in critical
|
|
@@ -154,10 +347,10 @@ var emptyFunction_1 = emptyFunction;
|
|
|
154
347
|
* same logic and follow the same code paths.
|
|
155
348
|
*/
|
|
156
349
|
|
|
157
|
-
var warning
|
|
350
|
+
var warning = emptyFunction_1;
|
|
158
351
|
|
|
159
352
|
{
|
|
160
|
-
var printWarning = function printWarning(format) {
|
|
353
|
+
var printWarning$1 = function printWarning(format) {
|
|
161
354
|
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
162
355
|
args[_key - 1] = arguments[_key];
|
|
163
356
|
}
|
|
@@ -177,7 +370,7 @@ var warning$1 = emptyFunction_1;
|
|
|
177
370
|
} catch (x) {}
|
|
178
371
|
};
|
|
179
372
|
|
|
180
|
-
warning
|
|
373
|
+
warning = function warning(condition, format) {
|
|
181
374
|
if (format === undefined) {
|
|
182
375
|
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
183
376
|
}
|
|
@@ -191,21 +384,32 @@ var warning$1 = emptyFunction_1;
|
|
|
191
384
|
args[_key2 - 2] = arguments[_key2];
|
|
192
385
|
}
|
|
193
386
|
|
|
194
|
-
printWarning.apply(undefined, [format].concat(args));
|
|
387
|
+
printWarning$1.apply(undefined, [format].concat(args));
|
|
195
388
|
}
|
|
196
389
|
};
|
|
197
390
|
}
|
|
198
391
|
|
|
199
|
-
var warning_1 = warning
|
|
392
|
+
var warning_1$1 = warning;
|
|
200
393
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
394
|
+
/**
|
|
395
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
396
|
+
*
|
|
397
|
+
* This source code is licensed under the MIT license found in the
|
|
398
|
+
* LICENSE file in the root directory of this source tree.
|
|
399
|
+
*/
|
|
400
|
+
|
|
401
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
|
204
402
|
|
|
205
403
|
function warnNoop(publicInstance, callerName) {
|
|
206
404
|
{
|
|
207
405
|
var constructor = publicInstance.constructor;
|
|
208
|
-
|
|
406
|
+
var componentName = constructor && (constructor.displayName || constructor.name) || 'ReactClass';
|
|
407
|
+
var warningKey = componentName + '.' + callerName;
|
|
408
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
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);
|
|
412
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
209
413
|
}
|
|
210
414
|
}
|
|
211
415
|
|
|
@@ -263,171 +467,40 @@ var ReactNoopUpdateQueue = {
|
|
|
263
467
|
/**
|
|
264
468
|
* Sets a subset of the state. This only exists because _pendingState is
|
|
265
469
|
* 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
|
-
}
|
|
470
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
471
|
+
* during the merge.
|
|
472
|
+
*
|
|
473
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
474
|
+
* @param {object} partialState Next partial state to be merged with state.
|
|
475
|
+
* @param {?function} callback Called after component is updated.
|
|
476
|
+
* @param {?string} Name of the calling function in the public API.
|
|
477
|
+
* @internal
|
|
478
|
+
*/
|
|
479
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
480
|
+
warnNoop(publicInstance, 'setState');
|
|
481
|
+
}
|
|
482
|
+
};
|
|
415
483
|
|
|
416
|
-
|
|
484
|
+
/**
|
|
485
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
486
|
+
*
|
|
487
|
+
* This source code is licensed under the MIT license found in the
|
|
488
|
+
* LICENSE file in the root directory of this source tree.
|
|
489
|
+
*/
|
|
417
490
|
|
|
418
491
|
/**
|
|
419
492
|
* Base class helpers for the updating state of a component.
|
|
420
493
|
*/
|
|
421
|
-
function
|
|
494
|
+
function Component(props, context, updater) {
|
|
422
495
|
this.props = props;
|
|
423
496
|
this.context = context;
|
|
424
497
|
this.refs = emptyObject_1;
|
|
425
498
|
// We initialize the default updater but the real one gets injected by the
|
|
426
499
|
// renderer.
|
|
427
|
-
this.updater = updater ||
|
|
500
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
428
501
|
}
|
|
429
502
|
|
|
430
|
-
|
|
503
|
+
Component.prototype.isReactComponent = {};
|
|
431
504
|
|
|
432
505
|
/**
|
|
433
506
|
* Sets a subset of the state. Always use this to mutate
|
|
@@ -454,8 +527,8 @@ ReactComponent.prototype.isReactComponent = {};
|
|
|
454
527
|
* @final
|
|
455
528
|
* @protected
|
|
456
529
|
*/
|
|
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;
|
|
530
|
+
Component.prototype.setState = function (partialState, callback) {
|
|
531
|
+
!(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
532
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
460
533
|
};
|
|
461
534
|
|
|
@@ -473,7 +546,7 @@ ReactComponent.prototype.setState = function (partialState, callback) {
|
|
|
473
546
|
* @final
|
|
474
547
|
* @protected
|
|
475
548
|
*/
|
|
476
|
-
|
|
549
|
+
Component.prototype.forceUpdate = function (callback) {
|
|
477
550
|
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
478
551
|
};
|
|
479
552
|
|
|
@@ -488,9 +561,9 @@ ReactComponent.prototype.forceUpdate = function (callback) {
|
|
|
488
561
|
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
489
562
|
};
|
|
490
563
|
var defineDeprecationWarning = function (methodName, info) {
|
|
491
|
-
Object.defineProperty(
|
|
564
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
492
565
|
get: function () {
|
|
493
|
-
|
|
566
|
+
lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
494
567
|
return undefined;
|
|
495
568
|
}
|
|
496
569
|
});
|
|
@@ -505,61 +578,43 @@ ReactComponent.prototype.forceUpdate = function (callback) {
|
|
|
505
578
|
/**
|
|
506
579
|
* Base class helpers for the updating state of a component.
|
|
507
580
|
*/
|
|
508
|
-
function
|
|
509
|
-
// Duplicated from
|
|
581
|
+
function PureComponent(props, context, updater) {
|
|
582
|
+
// Duplicated from Component.
|
|
510
583
|
this.props = props;
|
|
511
584
|
this.context = context;
|
|
512
585
|
this.refs = emptyObject_1;
|
|
513
586
|
// We initialize the default updater but the real one gets injected by the
|
|
514
587
|
// renderer.
|
|
515
|
-
this.updater = updater ||
|
|
588
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
516
589
|
}
|
|
517
590
|
|
|
518
591
|
function ComponentDummy() {}
|
|
519
|
-
ComponentDummy.prototype =
|
|
520
|
-
var pureComponentPrototype =
|
|
521
|
-
pureComponentPrototype.constructor =
|
|
592
|
+
ComponentDummy.prototype = Component.prototype;
|
|
593
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
594
|
+
pureComponentPrototype.constructor = PureComponent;
|
|
522
595
|
// Avoid an extra prototype jump for these methods.
|
|
523
|
-
|
|
596
|
+
objectAssign$1(pureComponentPrototype, Component.prototype);
|
|
524
597
|
pureComponentPrototype.isPureReactComponent = true;
|
|
525
598
|
|
|
526
|
-
function
|
|
527
|
-
// Duplicated from
|
|
599
|
+
function AsyncComponent(props, context, updater) {
|
|
600
|
+
// Duplicated from Component.
|
|
528
601
|
this.props = props;
|
|
529
602
|
this.context = context;
|
|
530
603
|
this.refs = emptyObject_1;
|
|
531
604
|
// We initialize the default updater but the real one gets injected by the
|
|
532
605
|
// renderer.
|
|
533
|
-
this.updater = updater ||
|
|
606
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
534
607
|
}
|
|
535
608
|
|
|
536
|
-
var asyncComponentPrototype =
|
|
537
|
-
asyncComponentPrototype.constructor =
|
|
609
|
+
var asyncComponentPrototype = AsyncComponent.prototype = new ComponentDummy();
|
|
610
|
+
asyncComponentPrototype.constructor = AsyncComponent;
|
|
538
611
|
// Avoid an extra prototype jump for these methods.
|
|
539
|
-
|
|
612
|
+
objectAssign$1(asyncComponentPrototype, Component.prototype);
|
|
540
613
|
asyncComponentPrototype.unstable_isAsyncReactComponent = true;
|
|
541
614
|
asyncComponentPrototype.render = function () {
|
|
542
615
|
return this.props.children;
|
|
543
616
|
};
|
|
544
617
|
|
|
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
618
|
/**
|
|
564
619
|
* Keeps track of the current owner.
|
|
565
620
|
*
|
|
@@ -572,16 +627,24 @@ var ReactCurrentOwner = {
|
|
|
572
627
|
* @type {ReactComponent}
|
|
573
628
|
*/
|
|
574
629
|
current: null
|
|
575
|
-
};
|
|
630
|
+
}; /**
|
|
631
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
632
|
+
*
|
|
633
|
+
* This source code is licensed under the MIT license found in the
|
|
634
|
+
* LICENSE file in the root directory of this source tree.
|
|
635
|
+
*
|
|
636
|
+
*
|
|
637
|
+
*/
|
|
576
638
|
|
|
577
|
-
|
|
639
|
+
/**
|
|
640
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
641
|
+
*
|
|
642
|
+
* This source code is licensed under the MIT license found in the
|
|
643
|
+
* LICENSE file in the root directory of this source tree.
|
|
644
|
+
*/
|
|
578
645
|
|
|
579
646
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
580
647
|
|
|
581
|
-
{
|
|
582
|
-
var warning$3 = warning_1;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
648
|
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
586
649
|
// nor polyfill, then a plain number is used for performance.
|
|
587
650
|
var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
@@ -624,7 +687,7 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
624
687
|
var warnAboutAccessingKey = function () {
|
|
625
688
|
if (!specialPropKeyWarningShown) {
|
|
626
689
|
specialPropKeyWarningShown = true;
|
|
627
|
-
|
|
690
|
+
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
691
|
}
|
|
629
692
|
};
|
|
630
693
|
warnAboutAccessingKey.isReactWarning = true;
|
|
@@ -638,7 +701,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
638
701
|
var warnAboutAccessingRef = function () {
|
|
639
702
|
if (!specialPropRefWarningShown) {
|
|
640
703
|
specialPropRefWarningShown = true;
|
|
641
|
-
|
|
704
|
+
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
705
|
}
|
|
643
706
|
};
|
|
644
707
|
warnAboutAccessingRef.isReactWarning = true;
|
|
@@ -726,9 +789,9 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
726
789
|
|
|
727
790
|
/**
|
|
728
791
|
* Create and return a new ReactElement of the given type.
|
|
729
|
-
* See https://
|
|
792
|
+
* See https://reactjs.org/docs/react-api.html#createelement
|
|
730
793
|
*/
|
|
731
|
-
|
|
794
|
+
function createElement(type, config, children) {
|
|
732
795
|
var propName;
|
|
733
796
|
|
|
734
797
|
// Reserved names are extracted
|
|
@@ -797,39 +860,30 @@ ReactElement.createElement = function (type, config, children) {
|
|
|
797
860
|
}
|
|
798
861
|
}
|
|
799
862
|
}
|
|
800
|
-
return ReactElement(type, key, ref, self, source,
|
|
801
|
-
}
|
|
863
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
864
|
+
}
|
|
802
865
|
|
|
803
866
|
/**
|
|
804
867
|
* Return a function that produces ReactElements of a given type.
|
|
805
|
-
* See https://
|
|
868
|
+
* See https://reactjs.org/docs/react-api.html#createfactory
|
|
806
869
|
*/
|
|
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
870
|
|
|
818
|
-
|
|
871
|
+
|
|
872
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
|
819
873
|
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
820
874
|
|
|
821
875
|
return newElement;
|
|
822
|
-
}
|
|
876
|
+
}
|
|
823
877
|
|
|
824
878
|
/**
|
|
825
879
|
* Clone and return a new ReactElement using element as the starting point.
|
|
826
|
-
* See https://
|
|
880
|
+
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
827
881
|
*/
|
|
828
|
-
|
|
882
|
+
function cloneElement(element, config, children) {
|
|
829
883
|
var propName;
|
|
830
884
|
|
|
831
885
|
// Original props are copied
|
|
832
|
-
var props =
|
|
886
|
+
var props = objectAssign$1({}, element.props);
|
|
833
887
|
|
|
834
888
|
// Reserved names are extracted
|
|
835
889
|
var key = element.key;
|
|
@@ -848,7 +902,7 @@ ReactElement.cloneElement = function (element, config, children) {
|
|
|
848
902
|
if (hasValidRef(config)) {
|
|
849
903
|
// Silently steal the ref from the parent.
|
|
850
904
|
ref = config.ref;
|
|
851
|
-
owner =
|
|
905
|
+
owner = ReactCurrentOwner.current;
|
|
852
906
|
}
|
|
853
907
|
if (hasValidKey(config)) {
|
|
854
908
|
key = '' + config.key;
|
|
@@ -885,30 +939,25 @@ ReactElement.cloneElement = function (element, config, children) {
|
|
|
885
939
|
}
|
|
886
940
|
|
|
887
941
|
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
888
|
-
}
|
|
942
|
+
}
|
|
889
943
|
|
|
890
944
|
/**
|
|
891
945
|
* Verifies the object is a ReactElement.
|
|
892
|
-
* See https://
|
|
946
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
893
947
|
* @param {?object} object
|
|
894
948
|
* @return {boolean} True if `object` is a valid component.
|
|
895
949
|
* @final
|
|
896
950
|
*/
|
|
897
|
-
|
|
951
|
+
function isValidElement(object) {
|
|
898
952
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE$1;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
var ReactElement_1 = ReactElement;
|
|
953
|
+
}
|
|
902
954
|
|
|
903
955
|
/**
|
|
904
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
905
|
-
* All rights reserved.
|
|
956
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
906
957
|
*
|
|
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.
|
|
958
|
+
* This source code is licensed under the MIT license found in the
|
|
959
|
+
* LICENSE file in the root directory of this source tree.
|
|
910
960
|
*
|
|
911
|
-
* @providesModule ReactDebugCurrentFrame
|
|
912
961
|
*
|
|
913
962
|
*/
|
|
914
963
|
|
|
@@ -927,21 +976,19 @@ var ReactDebugCurrentFrame = {};
|
|
|
927
976
|
};
|
|
928
977
|
}
|
|
929
978
|
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
getStackAddendum = _require.getStackAddendum;
|
|
937
|
-
}
|
|
979
|
+
/**
|
|
980
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
981
|
+
*
|
|
982
|
+
* This source code is licensed under the MIT license found in the
|
|
983
|
+
* LICENSE file in the root directory of this source tree.
|
|
984
|
+
*/
|
|
938
985
|
|
|
939
986
|
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
940
987
|
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
941
988
|
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
942
989
|
// nor polyfill, then a plain number is used for performance.
|
|
943
990
|
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
944
|
-
|
|
991
|
+
var REACT_PORTAL_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.portal') || 0xeaca;
|
|
945
992
|
var SEPARATOR = '.';
|
|
946
993
|
var SUBSEPARATOR = ':';
|
|
947
994
|
|
|
@@ -1028,7 +1075,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1028
1075
|
if (children === null || type === 'string' || type === 'number' ||
|
|
1029
1076
|
// The following is inlined from ReactElement. This means we can optimize
|
|
1030
1077
|
// some checks. React Fiber also inlines this logic for similar purposes.
|
|
1031
|
-
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1078
|
+
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE || type === 'object' && children.$$typeof === REACT_PORTAL_TYPE) {
|
|
1032
1079
|
callback(traverseContext, children,
|
|
1033
1080
|
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1034
1081
|
// so that it's consistent if the number of children grows.
|
|
@@ -1053,7 +1100,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1053
1100
|
{
|
|
1054
1101
|
// Warn about using Maps as children
|
|
1055
1102
|
if (iteratorFn === children.entries) {
|
|
1056
|
-
|
|
1103
|
+
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
1104
|
didWarnAboutMaps = true;
|
|
1058
1105
|
}
|
|
1059
1106
|
}
|
|
@@ -1069,10 +1116,10 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1069
1116
|
} else if (type === 'object') {
|
|
1070
1117
|
var addendum = '';
|
|
1071
1118
|
{
|
|
1072
|
-
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getStackAddendum();
|
|
1119
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1073
1120
|
}
|
|
1074
1121
|
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);
|
|
1122
|
+
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
1123
|
}
|
|
1077
1124
|
}
|
|
1078
1125
|
|
|
@@ -1131,7 +1178,7 @@ function forEachSingleChild(bookKeeping, child, name) {
|
|
|
1131
1178
|
/**
|
|
1132
1179
|
* Iterates through children that are typically specified as `props.children`.
|
|
1133
1180
|
*
|
|
1134
|
-
* See https://
|
|
1181
|
+
* See https://reactjs.org/docs/react-api.html#react.children.foreach
|
|
1135
1182
|
*
|
|
1136
1183
|
* The provided forEachFunc(child, index) will be called for each
|
|
1137
1184
|
* leaf child.
|
|
@@ -1160,8 +1207,8 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
|
1160
1207
|
if (Array.isArray(mappedChild)) {
|
|
1161
1208
|
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction_1.thatReturnsArgument);
|
|
1162
1209
|
} else if (mappedChild != null) {
|
|
1163
|
-
if (
|
|
1164
|
-
mappedChild =
|
|
1210
|
+
if (isValidElement(mappedChild)) {
|
|
1211
|
+
mappedChild = cloneAndReplaceKey(mappedChild,
|
|
1165
1212
|
// Keep both the (mapped) and old keys if they differ, just as
|
|
1166
1213
|
// traverseAllChildren used to do for objects as children
|
|
1167
1214
|
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
@@ -1183,7 +1230,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
|
1183
1230
|
/**
|
|
1184
1231
|
* Maps children that are typically specified as `props.children`.
|
|
1185
1232
|
*
|
|
1186
|
-
* See https://
|
|
1233
|
+
* See https://reactjs.org/docs/react-api.html#react.children.map
|
|
1187
1234
|
*
|
|
1188
1235
|
* The provided mapFunction(child, key, index) will be called for each
|
|
1189
1236
|
* leaf child.
|
|
@@ -1206,7 +1253,7 @@ function mapChildren(children, func, context) {
|
|
|
1206
1253
|
* Count the number of children that are typically specified as
|
|
1207
1254
|
* `props.children`.
|
|
1208
1255
|
*
|
|
1209
|
-
* See https://
|
|
1256
|
+
* See https://reactjs.org/docs/react-api.html#react.children.count
|
|
1210
1257
|
*
|
|
1211
1258
|
* @param {?*} children Children tree container.
|
|
1212
1259
|
* @return {number} The number of children.
|
|
@@ -1219,7 +1266,7 @@ function countChildren(children, context) {
|
|
|
1219
1266
|
* Flatten a children object (typically specified as `props.children`) and
|
|
1220
1267
|
* return an array with appropriately re-keyed children.
|
|
1221
1268
|
*
|
|
1222
|
-
* See https://
|
|
1269
|
+
* See https://reactjs.org/docs/react-api.html#react.children.toarray
|
|
1223
1270
|
*/
|
|
1224
1271
|
function toArray(children) {
|
|
1225
1272
|
var result = [];
|
|
@@ -1227,33 +1274,11 @@ function toArray(children) {
|
|
|
1227
1274
|
return result;
|
|
1228
1275
|
}
|
|
1229
1276
|
|
|
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.1';
|
|
1251
|
-
|
|
1252
1277
|
/**
|
|
1253
1278
|
* Returns the first child in a collection of children and verifies that there
|
|
1254
1279
|
* is only one child in the collection.
|
|
1255
1280
|
*
|
|
1256
|
-
* See https://
|
|
1281
|
+
* See https://reactjs.org/docs/react-api.html#react.children.only
|
|
1257
1282
|
*
|
|
1258
1283
|
* The current implementation of this function assumes that a single child gets
|
|
1259
1284
|
* passed without a wrapper, but the purpose of this helper function is to
|
|
@@ -1264,28 +1289,67 @@ var ReactVersion = '16.0.0-rc.1';
|
|
|
1264
1289
|
* structure.
|
|
1265
1290
|
*/
|
|
1266
1291
|
function onlyChild(children) {
|
|
1267
|
-
!
|
|
1292
|
+
!isValidElement(children) ? invariant_1$1(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
|
1268
1293
|
return children;
|
|
1269
1294
|
}
|
|
1270
1295
|
|
|
1271
|
-
|
|
1296
|
+
/**
|
|
1297
|
+
* Copyright (c) 2016-present, Facebook, Inc.
|
|
1298
|
+
*
|
|
1299
|
+
* This source code is licensed under the MIT license found in the
|
|
1300
|
+
* LICENSE file in the root directory of this source tree.
|
|
1301
|
+
*
|
|
1302
|
+
*
|
|
1303
|
+
*/
|
|
1304
|
+
|
|
1305
|
+
var describeComponentFrame = function (name, source, ownerName) {
|
|
1306
|
+
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
function getComponentName(fiber) {
|
|
1310
|
+
var type = fiber.type;
|
|
1311
|
+
|
|
1312
|
+
if (typeof type === 'string') {
|
|
1313
|
+
return type;
|
|
1314
|
+
}
|
|
1315
|
+
if (typeof type === 'function') {
|
|
1316
|
+
return type.displayName || type.name;
|
|
1317
|
+
}
|
|
1318
|
+
return null;
|
|
1319
|
+
} /**
|
|
1320
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1321
|
+
*
|
|
1322
|
+
* This source code is licensed under the MIT license found in the
|
|
1323
|
+
* LICENSE file in the root directory of this source tree.
|
|
1324
|
+
*
|
|
1325
|
+
*
|
|
1326
|
+
*/
|
|
1272
1327
|
|
|
1273
1328
|
/**
|
|
1274
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1275
|
-
* All rights reserved.
|
|
1329
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1276
1330
|
*
|
|
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.
|
|
1331
|
+
* This source code is licensed under the MIT license found in the
|
|
1332
|
+
* LICENSE file in the root directory of this source tree.
|
|
1280
1333
|
*/
|
|
1281
1334
|
|
|
1335
|
+
|
|
1336
|
+
|
|
1282
1337
|
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1283
1338
|
|
|
1284
1339
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
1285
1340
|
|
|
1341
|
+
/**
|
|
1342
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1343
|
+
*
|
|
1344
|
+
* This source code is licensed under the MIT license found in the
|
|
1345
|
+
* LICENSE file in the root directory of this source tree.
|
|
1346
|
+
*/
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
|
|
1286
1350
|
{
|
|
1287
|
-
var invariant$2 = invariant_1;
|
|
1288
|
-
var warning$
|
|
1351
|
+
var invariant$2 = invariant_1$1;
|
|
1352
|
+
var warning$2 = warning_1$1;
|
|
1289
1353
|
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1290
1354
|
var loggedTypeFailures = {};
|
|
1291
1355
|
}
|
|
@@ -1301,7 +1365,7 @@ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
|
1301
1365
|
* @param {?Function} getStack Returns the component stack.
|
|
1302
1366
|
* @private
|
|
1303
1367
|
*/
|
|
1304
|
-
function checkPropTypes
|
|
1368
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
1305
1369
|
{
|
|
1306
1370
|
for (var typeSpecName in typeSpecs) {
|
|
1307
1371
|
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
|
@@ -1312,12 +1376,12 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
|
|
|
1312
1376
|
try {
|
|
1313
1377
|
// This is intentionally an invariant that gets caught. It's the same
|
|
1314
1378
|
// 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 ' + '
|
|
1379
|
+
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
1380
|
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
1317
1381
|
} catch (ex) {
|
|
1318
1382
|
error = ex;
|
|
1319
1383
|
}
|
|
1320
|
-
warning$
|
|
1384
|
+
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
1385
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1322
1386
|
// Only monitor this failure once because there tends to be a lot of the
|
|
1323
1387
|
// same error.
|
|
@@ -1325,74 +1389,30 @@ function checkPropTypes$1(typeSpecs, values, location, componentName, getStack)
|
|
|
1325
1389
|
|
|
1326
1390
|
var stack = getStack ? getStack() : '';
|
|
1327
1391
|
|
|
1328
|
-
warning$
|
|
1392
|
+
warning$2(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
|
1329
1393
|
}
|
|
1330
1394
|
}
|
|
1331
1395
|
}
|
|
1332
1396
|
}
|
|
1333
1397
|
}
|
|
1334
1398
|
|
|
1335
|
-
var checkPropTypes_1 = checkPropTypes
|
|
1399
|
+
var checkPropTypes_1$1 = checkPropTypes;
|
|
1336
1400
|
|
|
1337
1401
|
/**
|
|
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.
|
|
1402
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
1344
1403
|
*
|
|
1345
|
-
*
|
|
1346
|
-
*
|
|
1404
|
+
* This source code is licensed under the MIT license found in the
|
|
1405
|
+
* LICENSE file in the root directory of this source tree.
|
|
1347
1406
|
*/
|
|
1348
1407
|
|
|
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
1408
|
/**
|
|
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
|
-
*
|
|
1409
|
+
* ReactElementValidator provides a wrapper around a element factory
|
|
1410
|
+
* which validates the props passed to the element. This is intended to be
|
|
1411
|
+
* used only in DEV and could be replaced by a static type checker for languages
|
|
1412
|
+
* that support it.
|
|
1363
1413
|
*/
|
|
1364
1414
|
|
|
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
1415
|
{
|
|
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
1416
|
var currentlyValidatingElement = null;
|
|
1397
1417
|
|
|
1398
1418
|
var getDisplayName = function (element) {
|
|
@@ -1402,29 +1422,35 @@ var getComponentName_1 = getComponentName$1;
|
|
|
1402
1422
|
return '#text';
|
|
1403
1423
|
} else if (typeof element.type === 'string') {
|
|
1404
1424
|
return element.type;
|
|
1425
|
+
} else if (element.type === REACT_FRAGMENT_TYPE$1) {
|
|
1426
|
+
return 'React.Fragment';
|
|
1405
1427
|
} else {
|
|
1406
1428
|
return element.type.displayName || element.type.name || 'Unknown';
|
|
1407
1429
|
}
|
|
1408
1430
|
};
|
|
1409
1431
|
|
|
1410
|
-
var getStackAddendum
|
|
1432
|
+
var getStackAddendum = function () {
|
|
1411
1433
|
var stack = '';
|
|
1412
1434
|
if (currentlyValidatingElement) {
|
|
1413
1435
|
var name = getDisplayName(currentlyValidatingElement);
|
|
1414
1436
|
var owner = currentlyValidatingElement._owner;
|
|
1415
1437
|
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
|
|
1416
1438
|
}
|
|
1417
|
-
stack += ReactDebugCurrentFrame
|
|
1439
|
+
stack += ReactDebugCurrentFrame.getStackAddendum() || '';
|
|
1418
1440
|
return stack;
|
|
1419
1441
|
};
|
|
1442
|
+
|
|
1443
|
+
var REACT_FRAGMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.fragment') || 0xeacb;
|
|
1444
|
+
|
|
1445
|
+
var VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
|
|
1420
1446
|
}
|
|
1421
1447
|
|
|
1422
1448
|
var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
|
|
1423
1449
|
var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
|
|
1424
1450
|
|
|
1425
1451
|
function getDeclarationErrorAddendum() {
|
|
1426
|
-
if (
|
|
1427
|
-
var name = getComponentName(
|
|
1452
|
+
if (ReactCurrentOwner.current) {
|
|
1453
|
+
var name = getComponentName(ReactCurrentOwner.current);
|
|
1428
1454
|
if (name) {
|
|
1429
1455
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
1430
1456
|
}
|
|
@@ -1488,14 +1514,14 @@ function validateExplicitKey(element, parentType) {
|
|
|
1488
1514
|
// property, it may be the creator of the child that's responsible for
|
|
1489
1515
|
// assigning it a key.
|
|
1490
1516
|
var childOwner = '';
|
|
1491
|
-
if (element && element._owner && element._owner !==
|
|
1517
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
1492
1518
|
// Give the component that originally created this child.
|
|
1493
1519
|
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
|
1494
1520
|
}
|
|
1495
1521
|
|
|
1496
1522
|
currentlyValidatingElement = element;
|
|
1497
1523
|
{
|
|
1498
|
-
|
|
1524
|
+
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
1525
|
}
|
|
1500
1526
|
currentlyValidatingElement = null;
|
|
1501
1527
|
}
|
|
@@ -1516,11 +1542,11 @@ function validateChildKeys(node, parentType) {
|
|
|
1516
1542
|
if (Array.isArray(node)) {
|
|
1517
1543
|
for (var i = 0; i < node.length; i++) {
|
|
1518
1544
|
var child = node[i];
|
|
1519
|
-
if (
|
|
1545
|
+
if (isValidElement(child)) {
|
|
1520
1546
|
validateExplicitKey(child, parentType);
|
|
1521
1547
|
}
|
|
1522
1548
|
}
|
|
1523
|
-
} else if (
|
|
1549
|
+
} else if (isValidElement(node)) {
|
|
1524
1550
|
// This element was passed in a valid location.
|
|
1525
1551
|
if (node._store) {
|
|
1526
1552
|
node._store.validated = true;
|
|
@@ -1534,7 +1560,7 @@ function validateChildKeys(node, parentType) {
|
|
|
1534
1560
|
var iterator = iteratorFn.call(node);
|
|
1535
1561
|
var step;
|
|
1536
1562
|
while (!(step = iterator.next()).done) {
|
|
1537
|
-
if (
|
|
1563
|
+
if (isValidElement(step.value)) {
|
|
1538
1564
|
validateExplicitKey(step.value, parentType);
|
|
1539
1565
|
}
|
|
1540
1566
|
}
|
|
@@ -1555,462 +1581,215 @@ function validatePropTypes(element) {
|
|
|
1555
1581
|
return;
|
|
1556
1582
|
}
|
|
1557
1583
|
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;
|
|
1584
|
+
var propTypes = componentClass.propTypes;
|
|
1565
1585
|
|
|
1566
1586
|
if (propTypes) {
|
|
1567
1587
|
currentlyValidatingElement = element;
|
|
1568
|
-
|
|
1588
|
+
checkPropTypes_1$1(propTypes, element.props, 'prop', name, getStackAddendum);
|
|
1569
1589
|
currentlyValidatingElement = null;
|
|
1570
1590
|
}
|
|
1571
1591
|
if (typeof componentClass.getDefaultProps === 'function') {
|
|
1572
|
-
|
|
1592
|
+
warning_1$1(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1573
1593
|
}
|
|
1574
1594
|
}
|
|
1575
1595
|
|
|
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() || '';
|
|
1596
|
+
/**
|
|
1597
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
1598
|
+
* @param {ReactElement} fragment
|
|
1599
|
+
*/
|
|
1600
|
+
function validateFragmentProps(fragment) {
|
|
1601
|
+
currentlyValidatingElement = fragment;
|
|
1595
1602
|
|
|
1596
|
-
|
|
1597
|
-
|
|
1603
|
+
var _iteratorNormalCompletion = true;
|
|
1604
|
+
var _didIteratorError = false;
|
|
1605
|
+
var _iteratorError = undefined;
|
|
1598
1606
|
|
|
1599
|
-
|
|
1607
|
+
try {
|
|
1608
|
+
for (var _iterator = Object.keys(fragment.props)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
1609
|
+
var key = _step.value;
|
|
1600
1610
|
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1611
|
+
if (!VALID_FRAGMENT_PROPS.has(key)) {
|
|
1612
|
+
warning_1$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum());
|
|
1613
|
+
break;
|
|
1614
|
+
}
|
|
1605
1615
|
}
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1616
|
+
} catch (err) {
|
|
1617
|
+
_didIteratorError = true;
|
|
1618
|
+
_iteratorError = err;
|
|
1619
|
+
} finally {
|
|
1620
|
+
try {
|
|
1621
|
+
if (!_iteratorNormalCompletion && _iterator['return']) {
|
|
1622
|
+
_iterator['return']();
|
|
1623
|
+
}
|
|
1624
|
+
} finally {
|
|
1625
|
+
if (_didIteratorError) {
|
|
1626
|
+
throw _iteratorError;
|
|
1615
1627
|
}
|
|
1616
1628
|
}
|
|
1629
|
+
}
|
|
1617
1630
|
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
},
|
|
1631
|
+
if (fragment.ref !== null) {
|
|
1632
|
+
warning_1$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
|
|
1633
|
+
}
|
|
1622
1634
|
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
// Legacy hook TODO: Warn if this is accessed
|
|
1626
|
-
validatedFactory.type = type;
|
|
1635
|
+
currentlyValidatingElement = null;
|
|
1636
|
+
}
|
|
1627
1637
|
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
return type;
|
|
1637
|
-
}
|
|
1638
|
-
});
|
|
1638
|
+
function createElementWithValidation(type, props, children) {
|
|
1639
|
+
var validType = typeof type === 'string' || typeof type === 'function' || typeof type === 'symbol' || typeof type === 'number';
|
|
1640
|
+
// We warn in this case but don't throw. We expect the element creation to
|
|
1641
|
+
// succeed and there will likely be errors in render.
|
|
1642
|
+
if (!validType) {
|
|
1643
|
+
var info = '';
|
|
1644
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1645
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
|
|
1639
1646
|
}
|
|
1640
1647
|
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
1647
|
-
validateChildKeys(arguments[i], newElement.type);
|
|
1648
|
+
var sourceInfo = getSourceInfoErrorAddendum(props);
|
|
1649
|
+
if (sourceInfo) {
|
|
1650
|
+
info += sourceInfo;
|
|
1651
|
+
} else {
|
|
1652
|
+
info += getDeclarationErrorAddendum();
|
|
1648
1653
|
}
|
|
1649
|
-
validatePropTypes(newElement);
|
|
1650
|
-
return newElement;
|
|
1651
|
-
}
|
|
1652
|
-
};
|
|
1653
|
-
|
|
1654
|
-
var ReactElementValidator_1 = ReactElementValidator$1;
|
|
1655
1654
|
|
|
1656
|
-
|
|
1657
|
-
var warning$6 = warning_1;
|
|
1658
|
-
}
|
|
1655
|
+
info += getStackAddendum() || '';
|
|
1659
1656
|
|
|
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;
|
|
1657
|
+
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
1658
|
}
|
|
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
1659
|
|
|
1766
|
-
var
|
|
1660
|
+
var element = createElement.apply(this, arguments);
|
|
1767
1661
|
|
|
1768
|
-
function
|
|
1769
|
-
|
|
1770
|
-
if (
|
|
1771
|
-
|
|
1662
|
+
// The result can be nullish if a mock or a custom function is used.
|
|
1663
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1664
|
+
if (element == null) {
|
|
1665
|
+
return element;
|
|
1666
|
+
}
|
|
1772
1667
|
|
|
1773
|
-
|
|
1774
|
-
|
|
1668
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
|
1669
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1670
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
1671
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1672
|
+
// fixed, the key warnings will appear.)
|
|
1673
|
+
if (validType) {
|
|
1674
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
1675
|
+
validateChildKeys(arguments[i], type);
|
|
1676
|
+
}
|
|
1775
1677
|
}
|
|
1776
|
-
}
|
|
1777
1678
|
|
|
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;
|
|
1679
|
+
if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE$1) {
|
|
1680
|
+
validateFragmentProps(element);
|
|
1785
1681
|
} else {
|
|
1786
|
-
|
|
1682
|
+
validatePropTypes(element);
|
|
1787
1683
|
}
|
|
1788
|
-
}
|
|
1789
1684
|
|
|
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 || '');
|
|
1685
|
+
return element;
|
|
1801
1686
|
}
|
|
1802
1687
|
|
|
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
|
-
}
|
|
1688
|
+
function createFactoryWithValidation(type) {
|
|
1689
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
1690
|
+
// Legacy hook TODO: Warn if this is accessed
|
|
1691
|
+
validatedFactory.type = type;
|
|
1883
1692
|
|
|
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);
|
|
1693
|
+
{
|
|
1694
|
+
Object.defineProperty(validatedFactory, 'type', {
|
|
1695
|
+
enumerable: false,
|
|
1696
|
+
get: function () {
|
|
1697
|
+
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
1698
|
+
Object.defineProperty(this, 'type', {
|
|
1699
|
+
value: type
|
|
1700
|
+
});
|
|
1701
|
+
return type;
|
|
1901
1702
|
}
|
|
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
|
-
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1960
1705
|
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
};
|
|
1706
|
+
return validatedFactory;
|
|
1707
|
+
}
|
|
1964
1708
|
|
|
1965
|
-
|
|
1709
|
+
function cloneElementWithValidation(element, props, children) {
|
|
1710
|
+
var newElement = cloneElement.apply(this, arguments);
|
|
1711
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
1712
|
+
validateChildKeys(arguments[i], newElement.type);
|
|
1713
|
+
}
|
|
1714
|
+
validatePropTypes(newElement);
|
|
1715
|
+
return newElement;
|
|
1716
|
+
}
|
|
1966
1717
|
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1718
|
+
/**
|
|
1719
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1720
|
+
*
|
|
1721
|
+
* This source code is licensed under the MIT license found in the
|
|
1722
|
+
* LICENSE file in the root directory of this source tree.
|
|
1723
|
+
*/
|
|
1970
1724
|
|
|
1971
|
-
|
|
1972
|
-
var ReactElementValidator = ReactElementValidator_1;
|
|
1973
|
-
createElement = ReactElementValidator.createElement;
|
|
1974
|
-
createFactory = ReactElementValidator.createFactory;
|
|
1975
|
-
cloneElement = ReactElementValidator.cloneElement;
|
|
1976
|
-
}
|
|
1725
|
+
var REACT_FRAGMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.fragment') || 0xeacb;
|
|
1977
1726
|
|
|
1978
1727
|
var React = {
|
|
1979
1728
|
Children: {
|
|
1980
|
-
map:
|
|
1981
|
-
forEach:
|
|
1982
|
-
count:
|
|
1983
|
-
toArray:
|
|
1984
|
-
only:
|
|
1729
|
+
map: mapChildren,
|
|
1730
|
+
forEach: forEachChildren,
|
|
1731
|
+
count: countChildren,
|
|
1732
|
+
toArray: toArray,
|
|
1733
|
+
only: onlyChild
|
|
1985
1734
|
},
|
|
1986
1735
|
|
|
1987
|
-
Component:
|
|
1988
|
-
PureComponent:
|
|
1989
|
-
unstable_AsyncComponent:
|
|
1736
|
+
Component: Component,
|
|
1737
|
+
PureComponent: PureComponent,
|
|
1738
|
+
unstable_AsyncComponent: AsyncComponent,
|
|
1990
1739
|
|
|
1991
|
-
createElement:
|
|
1992
|
-
cloneElement:
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
createFactory: createFactory,
|
|
1740
|
+
createElement: createElementWithValidation,
|
|
1741
|
+
cloneElement: cloneElementWithValidation,
|
|
1742
|
+
createFactory: createFactoryWithValidation,
|
|
1743
|
+
isValidElement: isValidElement,
|
|
1996
1744
|
|
|
1997
1745
|
version: ReactVersion,
|
|
1998
1746
|
|
|
1999
1747
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
2000
|
-
ReactCurrentOwner:
|
|
1748
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
1749
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
1750
|
+
assign: objectAssign$1
|
|
2001
1751
|
}
|
|
2002
1752
|
};
|
|
2003
1753
|
|
|
1754
|
+
if (ReactFeatureFlags.enableReactFragment) {
|
|
1755
|
+
React.Fragment = REACT_FRAGMENT_TYPE;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
2004
1758
|
{
|
|
2005
|
-
|
|
1759
|
+
objectAssign$1(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
2006
1760
|
// These should not be included in production.
|
|
2007
|
-
|
|
2008
|
-
|
|
1761
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
1762
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
1763
|
+
// TODO: remove in React 17.0.
|
|
1764
|
+
ReactComponentTreeHook: {}
|
|
2009
1765
|
});
|
|
2010
1766
|
}
|
|
2011
1767
|
|
|
2012
|
-
var ReactEntry = React;
|
|
2013
1768
|
|
|
2014
|
-
|
|
1769
|
+
|
|
1770
|
+
var React$2 = Object.freeze({
|
|
1771
|
+
default: React
|
|
1772
|
+
});
|
|
1773
|
+
|
|
1774
|
+
var React$3 = ( React$2 && React ) || React$2;
|
|
1775
|
+
|
|
1776
|
+
/**
|
|
1777
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1778
|
+
*
|
|
1779
|
+
* This source code is licensed under the MIT license found in the
|
|
1780
|
+
* LICENSE file in the root directory of this source tree.
|
|
1781
|
+
*
|
|
1782
|
+
*
|
|
1783
|
+
*/
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
|
|
1787
|
+
|
|
1788
|
+
|
|
1789
|
+
// TODO: decide on the top-level export form.
|
|
1790
|
+
// This is hacky but makes it work with both Rollup and Jest.
|
|
1791
|
+
var react = React$3['default'] ? React$3['default'] : React$3;
|
|
1792
|
+
|
|
1793
|
+
return react;
|
|
2015
1794
|
|
|
2016
1795
|
})));
|