react 16.9.0-rc.0 → 16.10.2
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/build-info.json +5 -5
- package/cjs/react.development.js +382 -285
- package/cjs/react.production.min.js +13 -13
- package/package.json +1 -1
- package/umd/react.development.js +903 -694
- package/umd/react.production.min.js +26 -27
- package/umd/react.profiling.min.js +33 -31
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"branch": "
|
|
3
|
-
"buildNumber": "
|
|
4
|
-
"checksum": "
|
|
5
|
-
"commit": "
|
|
2
|
+
"branch": "pull/17007",
|
|
3
|
+
"buildNumber": "50178",
|
|
4
|
+
"checksum": "39106c3",
|
|
5
|
+
"commit": "4ab6305f6",
|
|
6
6
|
"environment": "ci",
|
|
7
|
-
"reactVersion": "16.
|
|
7
|
+
"reactVersion": "16.10.1-canary-4ab6305f6"
|
|
8
8
|
}
|
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.10.2
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -20,22 +20,21 @@ var checkPropTypes = require('prop-types/checkPropTypes');
|
|
|
20
20
|
|
|
21
21
|
// TODO: this is special because it gets imported during build.
|
|
22
22
|
|
|
23
|
-
var ReactVersion = '16.
|
|
23
|
+
var ReactVersion = '16.10.2';
|
|
24
24
|
|
|
25
25
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
26
26
|
// nor polyfill, then a plain number is used for performance.
|
|
27
27
|
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
28
|
-
|
|
29
28
|
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
30
29
|
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
31
30
|
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
32
31
|
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
33
32
|
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
34
33
|
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
35
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
36
|
-
// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
34
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
37
35
|
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
38
36
|
|
|
37
|
+
|
|
39
38
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
40
39
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
41
40
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
@@ -44,18 +43,20 @@ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
|
44
43
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
45
44
|
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
46
45
|
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
47
|
-
|
|
46
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
48
47
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
49
48
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
50
|
-
|
|
51
49
|
function getIteratorFn(maybeIterable) {
|
|
52
50
|
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
53
51
|
return null;
|
|
54
52
|
}
|
|
53
|
+
|
|
55
54
|
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
55
|
+
|
|
56
56
|
if (typeof maybeIterator === 'function') {
|
|
57
57
|
return maybeIterator;
|
|
58
58
|
}
|
|
59
|
+
|
|
59
60
|
return null;
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -66,7 +67,6 @@ function getIteratorFn(maybeIterable) {
|
|
|
66
67
|
// Do not require this module directly! Use normal `invariant` calls with
|
|
67
68
|
// template literal strings. The messages will be converted to ReactError during
|
|
68
69
|
// build, and in production they will be minified.
|
|
69
|
-
|
|
70
70
|
function ReactError(error) {
|
|
71
71
|
error.name = 'Invariant Violation';
|
|
72
72
|
return error;
|
|
@@ -96,12 +96,11 @@ function ReactError(error) {
|
|
|
96
96
|
* paths. Removing the logging code for production environments will keep the
|
|
97
97
|
* same logic and follow the same code paths.
|
|
98
98
|
*/
|
|
99
|
-
|
|
100
|
-
var lowPriorityWarning = function () {};
|
|
99
|
+
var lowPriorityWarningWithoutStack = function () {};
|
|
101
100
|
|
|
102
101
|
{
|
|
103
102
|
var printWarning = function (format) {
|
|
104
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
103
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
105
104
|
args[_key - 1] = arguments[_key];
|
|
106
105
|
}
|
|
107
106
|
|
|
@@ -109,9 +108,11 @@ var lowPriorityWarning = function () {};
|
|
|
109
108
|
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
110
109
|
return args[argIndex++];
|
|
111
110
|
});
|
|
111
|
+
|
|
112
112
|
if (typeof console !== 'undefined') {
|
|
113
113
|
console.warn(message);
|
|
114
114
|
}
|
|
115
|
+
|
|
115
116
|
try {
|
|
116
117
|
// --- Welcome to debugging React ---
|
|
117
118
|
// This error was thrown as a convenience so that you can use this stack
|
|
@@ -120,21 +121,22 @@ var lowPriorityWarning = function () {};
|
|
|
120
121
|
} catch (x) {}
|
|
121
122
|
};
|
|
122
123
|
|
|
123
|
-
|
|
124
|
+
lowPriorityWarningWithoutStack = function (condition, format) {
|
|
124
125
|
if (format === undefined) {
|
|
125
|
-
throw new Error('`
|
|
126
|
+
throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
126
127
|
}
|
|
128
|
+
|
|
127
129
|
if (!condition) {
|
|
128
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
130
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
129
131
|
args[_key2 - 2] = arguments[_key2];
|
|
130
132
|
}
|
|
131
133
|
|
|
132
|
-
printWarning.apply(
|
|
134
|
+
printWarning.apply(void 0, [format].concat(args));
|
|
133
135
|
}
|
|
134
136
|
};
|
|
135
137
|
}
|
|
136
138
|
|
|
137
|
-
var
|
|
139
|
+
var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
|
138
140
|
|
|
139
141
|
/**
|
|
140
142
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
@@ -142,35 +144,37 @@ var lowPriorityWarning$1 = lowPriorityWarning;
|
|
|
142
144
|
* paths. Removing the logging code for production environments will keep the
|
|
143
145
|
* same logic and follow the same code paths.
|
|
144
146
|
*/
|
|
145
|
-
|
|
146
147
|
var warningWithoutStack = function () {};
|
|
147
148
|
|
|
148
149
|
{
|
|
149
150
|
warningWithoutStack = function (condition, format) {
|
|
150
|
-
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
151
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
151
152
|
args[_key - 2] = arguments[_key];
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
if (format === undefined) {
|
|
155
156
|
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
156
157
|
}
|
|
158
|
+
|
|
157
159
|
if (args.length > 8) {
|
|
158
160
|
// Check before the condition to catch violations early.
|
|
159
161
|
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
|
160
162
|
}
|
|
163
|
+
|
|
161
164
|
if (condition) {
|
|
162
165
|
return;
|
|
163
166
|
}
|
|
167
|
+
|
|
164
168
|
if (typeof console !== 'undefined') {
|
|
165
169
|
var argsWithFormat = args.map(function (item) {
|
|
166
170
|
return '' + item;
|
|
167
171
|
});
|
|
168
|
-
argsWithFormat.unshift('Warning: ' + format);
|
|
169
|
-
|
|
170
|
-
// We intentionally don't use spread (or .apply) directly because it
|
|
172
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
171
173
|
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
174
|
+
|
|
172
175
|
Function.prototype.apply.call(console.error, console, argsWithFormat);
|
|
173
176
|
}
|
|
177
|
+
|
|
174
178
|
try {
|
|
175
179
|
// --- Welcome to debugging React ---
|
|
176
180
|
// This error was thrown as a convenience so that you can use this stack
|
|
@@ -192,18 +196,21 @@ function warnNoop(publicInstance, callerName) {
|
|
|
192
196
|
{
|
|
193
197
|
var _constructor = publicInstance.constructor;
|
|
194
198
|
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
195
|
-
var warningKey = componentName +
|
|
199
|
+
var warningKey = componentName + "." + callerName;
|
|
200
|
+
|
|
196
201
|
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
197
202
|
return;
|
|
198
203
|
}
|
|
204
|
+
|
|
199
205
|
warningWithoutStack$1(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
|
200
206
|
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
201
207
|
}
|
|
202
208
|
}
|
|
203
|
-
|
|
204
209
|
/**
|
|
205
210
|
* This is the abstract API for an update queue.
|
|
206
211
|
*/
|
|
212
|
+
|
|
213
|
+
|
|
207
214
|
var ReactNoopUpdateQueue = {
|
|
208
215
|
/**
|
|
209
216
|
* Checks whether or not this composite component is mounted.
|
|
@@ -270,25 +277,26 @@ var ReactNoopUpdateQueue = {
|
|
|
270
277
|
};
|
|
271
278
|
|
|
272
279
|
var emptyObject = {};
|
|
280
|
+
|
|
273
281
|
{
|
|
274
282
|
Object.freeze(emptyObject);
|
|
275
283
|
}
|
|
276
|
-
|
|
277
284
|
/**
|
|
278
285
|
* Base class helpers for the updating state of a component.
|
|
279
286
|
*/
|
|
287
|
+
|
|
288
|
+
|
|
280
289
|
function Component(props, context, updater) {
|
|
281
290
|
this.props = props;
|
|
282
|
-
this.context = context;
|
|
283
|
-
|
|
284
|
-
this.refs = emptyObject;
|
|
285
|
-
// We initialize the default updater but the real one gets injected by the
|
|
291
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
292
|
+
|
|
293
|
+
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
286
294
|
// renderer.
|
|
295
|
+
|
|
287
296
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
288
297
|
}
|
|
289
298
|
|
|
290
299
|
Component.prototype.isReactComponent = {};
|
|
291
|
-
|
|
292
300
|
/**
|
|
293
301
|
* Sets a subset of the state. Always use this to mutate
|
|
294
302
|
* state. You should treat `this.state` as immutable.
|
|
@@ -314,17 +322,18 @@ Component.prototype.isReactComponent = {};
|
|
|
314
322
|
* @final
|
|
315
323
|
* @protected
|
|
316
324
|
*/
|
|
325
|
+
|
|
317
326
|
Component.prototype.setState = function (partialState, callback) {
|
|
318
327
|
(function () {
|
|
319
328
|
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
320
329
|
{
|
|
321
|
-
throw ReactError(Error(
|
|
330
|
+
throw ReactError(Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."));
|
|
322
331
|
}
|
|
323
332
|
}
|
|
324
333
|
})();
|
|
334
|
+
|
|
325
335
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
326
336
|
};
|
|
327
|
-
|
|
328
337
|
/**
|
|
329
338
|
* Forces an update. This should only be invoked when it is known with
|
|
330
339
|
* certainty that we are **not** in a DOM transaction.
|
|
@@ -339,28 +348,33 @@ Component.prototype.setState = function (partialState, callback) {
|
|
|
339
348
|
* @final
|
|
340
349
|
* @protected
|
|
341
350
|
*/
|
|
351
|
+
|
|
352
|
+
|
|
342
353
|
Component.prototype.forceUpdate = function (callback) {
|
|
343
354
|
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
344
355
|
};
|
|
345
|
-
|
|
346
356
|
/**
|
|
347
357
|
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
348
358
|
* we would like to deprecate them, we're not going to move them over to this
|
|
349
359
|
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
350
360
|
*/
|
|
361
|
+
|
|
362
|
+
|
|
351
363
|
{
|
|
352
364
|
var deprecatedAPIs = {
|
|
353
365
|
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
354
366
|
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
355
367
|
};
|
|
368
|
+
|
|
356
369
|
var defineDeprecationWarning = function (methodName, info) {
|
|
357
370
|
Object.defineProperty(Component.prototype, methodName, {
|
|
358
371
|
get: function () {
|
|
359
|
-
|
|
372
|
+
lowPriorityWarningWithoutStack$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
360
373
|
return undefined;
|
|
361
374
|
}
|
|
362
375
|
});
|
|
363
376
|
};
|
|
377
|
+
|
|
364
378
|
for (var fnName in deprecatedAPIs) {
|
|
365
379
|
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
366
380
|
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
@@ -369,23 +383,25 @@ Component.prototype.forceUpdate = function (callback) {
|
|
|
369
383
|
}
|
|
370
384
|
|
|
371
385
|
function ComponentDummy() {}
|
|
372
|
-
ComponentDummy.prototype = Component.prototype;
|
|
373
386
|
|
|
387
|
+
ComponentDummy.prototype = Component.prototype;
|
|
374
388
|
/**
|
|
375
389
|
* Convenience component with default shallow equality check for sCU.
|
|
376
390
|
*/
|
|
391
|
+
|
|
377
392
|
function PureComponent(props, context, updater) {
|
|
378
393
|
this.props = props;
|
|
379
|
-
this.context = context;
|
|
380
|
-
|
|
394
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
395
|
+
|
|
381
396
|
this.refs = emptyObject;
|
|
382
397
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
383
398
|
}
|
|
384
399
|
|
|
385
400
|
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
386
|
-
pureComponentPrototype.constructor = PureComponent;
|
|
387
|
-
|
|
401
|
+
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
402
|
+
|
|
388
403
|
_assign(pureComponentPrototype, Component.prototype);
|
|
404
|
+
|
|
389
405
|
pureComponentPrototype.isPureReactComponent = true;
|
|
390
406
|
|
|
391
407
|
// an immutable object with a single mutable value
|
|
@@ -393,9 +409,11 @@ function createRef() {
|
|
|
393
409
|
var refObject = {
|
|
394
410
|
current: null
|
|
395
411
|
};
|
|
412
|
+
|
|
396
413
|
{
|
|
397
414
|
Object.seal(refObject);
|
|
398
415
|
}
|
|
416
|
+
|
|
399
417
|
return refObject;
|
|
400
418
|
}
|
|
401
419
|
|
|
@@ -433,19 +451,22 @@ var ReactCurrentOwner = {
|
|
|
433
451
|
};
|
|
434
452
|
|
|
435
453
|
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
436
|
-
|
|
437
454
|
var describeComponentFrame = function (name, source, ownerName) {
|
|
438
455
|
var sourceInfo = '';
|
|
456
|
+
|
|
439
457
|
if (source) {
|
|
440
458
|
var path = source.fileName;
|
|
441
459
|
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
460
|
+
|
|
442
461
|
{
|
|
443
462
|
// In DEV, include code for a common special case:
|
|
444
463
|
// prefer "folder/index.js" instead of just "index.js".
|
|
445
464
|
if (/^index\./.test(fileName)) {
|
|
446
465
|
var match = path.match(BEFORE_SLASH_RE);
|
|
466
|
+
|
|
447
467
|
if (match) {
|
|
448
468
|
var pathBeforeSlash = match[1];
|
|
469
|
+
|
|
449
470
|
if (pathBeforeSlash) {
|
|
450
471
|
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
451
472
|
fileName = folderName + '/' + fileName;
|
|
@@ -453,23 +474,24 @@ var describeComponentFrame = function (name, source, ownerName) {
|
|
|
453
474
|
}
|
|
454
475
|
}
|
|
455
476
|
}
|
|
477
|
+
|
|
456
478
|
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
457
479
|
} else if (ownerName) {
|
|
458
480
|
sourceInfo = ' (created by ' + ownerName + ')';
|
|
459
481
|
}
|
|
482
|
+
|
|
460
483
|
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
461
484
|
};
|
|
462
485
|
|
|
463
486
|
var Resolved = 1;
|
|
464
487
|
|
|
465
|
-
|
|
466
488
|
function refineResolvedLazyComponent(lazyComponent) {
|
|
467
489
|
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
468
490
|
}
|
|
469
491
|
|
|
470
492
|
function getWrappedName(outerType, innerType, wrapperName) {
|
|
471
493
|
var functionName = innerType.displayName || innerType.name || '';
|
|
472
|
-
return outerType.displayName || (functionName !== '' ? wrapperName +
|
|
494
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
473
495
|
}
|
|
474
496
|
|
|
475
497
|
function getComponentName(type) {
|
|
@@ -477,59 +499,74 @@ function getComponentName(type) {
|
|
|
477
499
|
// Host root, text node or just invalid type.
|
|
478
500
|
return null;
|
|
479
501
|
}
|
|
502
|
+
|
|
480
503
|
{
|
|
481
504
|
if (typeof type.tag === 'number') {
|
|
482
505
|
warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
483
506
|
}
|
|
484
507
|
}
|
|
508
|
+
|
|
485
509
|
if (typeof type === 'function') {
|
|
486
510
|
return type.displayName || type.name || null;
|
|
487
511
|
}
|
|
512
|
+
|
|
488
513
|
if (typeof type === 'string') {
|
|
489
514
|
return type;
|
|
490
515
|
}
|
|
516
|
+
|
|
491
517
|
switch (type) {
|
|
492
518
|
case REACT_FRAGMENT_TYPE:
|
|
493
519
|
return 'Fragment';
|
|
520
|
+
|
|
494
521
|
case REACT_PORTAL_TYPE:
|
|
495
522
|
return 'Portal';
|
|
523
|
+
|
|
496
524
|
case REACT_PROFILER_TYPE:
|
|
497
|
-
return
|
|
525
|
+
return "Profiler";
|
|
526
|
+
|
|
498
527
|
case REACT_STRICT_MODE_TYPE:
|
|
499
528
|
return 'StrictMode';
|
|
529
|
+
|
|
500
530
|
case REACT_SUSPENSE_TYPE:
|
|
501
531
|
return 'Suspense';
|
|
532
|
+
|
|
502
533
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
503
534
|
return 'SuspenseList';
|
|
504
535
|
}
|
|
536
|
+
|
|
505
537
|
if (typeof type === 'object') {
|
|
506
538
|
switch (type.$$typeof) {
|
|
507
539
|
case REACT_CONTEXT_TYPE:
|
|
508
540
|
return 'Context.Consumer';
|
|
541
|
+
|
|
509
542
|
case REACT_PROVIDER_TYPE:
|
|
510
543
|
return 'Context.Provider';
|
|
544
|
+
|
|
511
545
|
case REACT_FORWARD_REF_TYPE:
|
|
512
546
|
return getWrappedName(type, type.render, 'ForwardRef');
|
|
547
|
+
|
|
513
548
|
case REACT_MEMO_TYPE:
|
|
514
549
|
return getComponentName(type.type);
|
|
550
|
+
|
|
515
551
|
case REACT_LAZY_TYPE:
|
|
516
552
|
{
|
|
517
553
|
var thenable = type;
|
|
518
554
|
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
555
|
+
|
|
519
556
|
if (resolvedThenable) {
|
|
520
557
|
return getComponentName(resolvedThenable);
|
|
521
558
|
}
|
|
559
|
+
|
|
522
560
|
break;
|
|
523
561
|
}
|
|
524
562
|
}
|
|
525
563
|
}
|
|
564
|
+
|
|
526
565
|
return null;
|
|
527
566
|
}
|
|
528
567
|
|
|
529
568
|
var ReactDebugCurrentFrame = {};
|
|
530
|
-
|
|
531
569
|
var currentlyValidatingElement = null;
|
|
532
|
-
|
|
533
570
|
function setCurrentlyValidatingElement(element) {
|
|
534
571
|
{
|
|
535
572
|
currentlyValidatingElement = element;
|
|
@@ -541,17 +578,17 @@ function setCurrentlyValidatingElement(element) {
|
|
|
541
578
|
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
542
579
|
|
|
543
580
|
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
544
|
-
var stack = '';
|
|
581
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
|
545
582
|
|
|
546
|
-
// Add an extra top frame while an element is being validated
|
|
547
583
|
if (currentlyValidatingElement) {
|
|
548
584
|
var name = getComponentName(currentlyValidatingElement.type);
|
|
549
585
|
var owner = currentlyValidatingElement._owner;
|
|
550
586
|
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
551
|
-
}
|
|
587
|
+
} // Delegate to the injected renderer-specific implementation
|
|
588
|
+
|
|
552
589
|
|
|
553
|
-
// Delegate to the injected renderer-specific implementation
|
|
554
590
|
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
591
|
+
|
|
555
592
|
if (impl) {
|
|
556
593
|
stack += impl() || '';
|
|
557
594
|
}
|
|
@@ -563,7 +600,6 @@ function setCurrentlyValidatingElement(element) {
|
|
|
563
600
|
/**
|
|
564
601
|
* Used by act() to track whether you're inside an act() scope.
|
|
565
602
|
*/
|
|
566
|
-
|
|
567
603
|
var IsSomeRendererActing = {
|
|
568
604
|
current: false
|
|
569
605
|
};
|
|
@@ -601,41 +637,41 @@ var warning = warningWithoutStack$1;
|
|
|
601
637
|
if (condition) {
|
|
602
638
|
return;
|
|
603
639
|
}
|
|
640
|
+
|
|
604
641
|
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
605
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
606
|
-
// eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
642
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
607
643
|
|
|
608
|
-
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
644
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
609
645
|
args[_key - 2] = arguments[_key];
|
|
610
646
|
}
|
|
611
647
|
|
|
612
|
-
warningWithoutStack$1.apply(
|
|
648
|
+
warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
|
|
613
649
|
};
|
|
614
650
|
}
|
|
615
651
|
|
|
616
652
|
var warning$1 = warning;
|
|
617
653
|
|
|
618
654
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
619
|
-
|
|
620
655
|
var RESERVED_PROPS = {
|
|
621
656
|
key: true,
|
|
622
657
|
ref: true,
|
|
623
658
|
__self: true,
|
|
624
659
|
__source: true
|
|
625
660
|
};
|
|
626
|
-
|
|
627
|
-
var
|
|
628
|
-
var specialPropRefWarningShown = void 0;
|
|
661
|
+
var specialPropKeyWarningShown;
|
|
662
|
+
var specialPropRefWarningShown;
|
|
629
663
|
|
|
630
664
|
function hasValidRef(config) {
|
|
631
665
|
{
|
|
632
666
|
if (hasOwnProperty.call(config, 'ref')) {
|
|
633
667
|
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
668
|
+
|
|
634
669
|
if (getter && getter.isReactWarning) {
|
|
635
670
|
return false;
|
|
636
671
|
}
|
|
637
672
|
}
|
|
638
673
|
}
|
|
674
|
+
|
|
639
675
|
return config.ref !== undefined;
|
|
640
676
|
}
|
|
641
677
|
|
|
@@ -643,11 +679,13 @@ function hasValidKey(config) {
|
|
|
643
679
|
{
|
|
644
680
|
if (hasOwnProperty.call(config, 'key')) {
|
|
645
681
|
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
682
|
+
|
|
646
683
|
if (getter && getter.isReactWarning) {
|
|
647
684
|
return false;
|
|
648
685
|
}
|
|
649
686
|
}
|
|
650
687
|
}
|
|
688
|
+
|
|
651
689
|
return config.key !== undefined;
|
|
652
690
|
}
|
|
653
691
|
|
|
@@ -658,6 +696,7 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
658
696
|
warningWithoutStack$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
659
697
|
}
|
|
660
698
|
};
|
|
699
|
+
|
|
661
700
|
warnAboutAccessingKey.isReactWarning = true;
|
|
662
701
|
Object.defineProperty(props, 'key', {
|
|
663
702
|
get: warnAboutAccessingKey,
|
|
@@ -672,13 +711,13 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
672
711
|
warningWithoutStack$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
673
712
|
}
|
|
674
713
|
};
|
|
714
|
+
|
|
675
715
|
warnAboutAccessingRef.isReactWarning = true;
|
|
676
716
|
Object.defineProperty(props, 'ref', {
|
|
677
717
|
get: warnAboutAccessingRef,
|
|
678
718
|
configurable: true
|
|
679
719
|
});
|
|
680
720
|
}
|
|
681
|
-
|
|
682
721
|
/**
|
|
683
722
|
* Factory method to create a new React element. This no longer adheres to
|
|
684
723
|
* the class pattern, so do not use new to call it. Also, no instanceof check
|
|
@@ -699,17 +738,17 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
699
738
|
* indicating filename, line number, and/or other information.
|
|
700
739
|
* @internal
|
|
701
740
|
*/
|
|
741
|
+
|
|
742
|
+
|
|
702
743
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
703
744
|
var element = {
|
|
704
745
|
// This tag allows us to uniquely identify this as a React Element
|
|
705
746
|
$$typeof: REACT_ELEMENT_TYPE,
|
|
706
|
-
|
|
707
747
|
// Built-in properties that belong on the element
|
|
708
748
|
type: type,
|
|
709
749
|
key: key,
|
|
710
750
|
ref: ref,
|
|
711
751
|
props: props,
|
|
712
|
-
|
|
713
752
|
// Record the component responsible for creating this element.
|
|
714
753
|
_owner: owner
|
|
715
754
|
};
|
|
@@ -719,33 +758,33 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
719
758
|
// an external backing store so that we can freeze the whole object.
|
|
720
759
|
// This can be replaced with a WeakMap once they are implemented in
|
|
721
760
|
// commonly used development environments.
|
|
722
|
-
element._store = {};
|
|
723
|
-
|
|
724
|
-
// To make comparing ReactElements easier for testing purposes, we make
|
|
761
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
725
762
|
// the validation flag non-enumerable (where possible, which should
|
|
726
763
|
// include every environment we run tests in), so the test framework
|
|
727
764
|
// ignores it.
|
|
765
|
+
|
|
728
766
|
Object.defineProperty(element._store, 'validated', {
|
|
729
767
|
configurable: false,
|
|
730
768
|
enumerable: false,
|
|
731
769
|
writable: true,
|
|
732
770
|
value: false
|
|
733
|
-
});
|
|
734
|
-
|
|
771
|
+
}); // self and source are DEV only properties.
|
|
772
|
+
|
|
735
773
|
Object.defineProperty(element, '_self', {
|
|
736
774
|
configurable: false,
|
|
737
775
|
enumerable: false,
|
|
738
776
|
writable: false,
|
|
739
777
|
value: self
|
|
740
|
-
});
|
|
741
|
-
// Two elements created in two different places should be considered
|
|
778
|
+
}); // Two elements created in two different places should be considered
|
|
742
779
|
// equal for testing purposes and therefore we hide it from enumeration.
|
|
780
|
+
|
|
743
781
|
Object.defineProperty(element, '_source', {
|
|
744
782
|
configurable: false,
|
|
745
783
|
enumerable: false,
|
|
746
784
|
writable: false,
|
|
747
785
|
value: source
|
|
748
786
|
});
|
|
787
|
+
|
|
749
788
|
if (Object.freeze) {
|
|
750
789
|
Object.freeze(element.props);
|
|
751
790
|
Object.freeze(element);
|
|
@@ -754,7 +793,6 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
754
793
|
|
|
755
794
|
return element;
|
|
756
795
|
};
|
|
757
|
-
|
|
758
796
|
/**
|
|
759
797
|
* https://github.com/reactjs/rfcs/pull/107
|
|
760
798
|
* @param {*} type
|
|
@@ -763,45 +801,49 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
763
801
|
*/
|
|
764
802
|
|
|
765
803
|
|
|
804
|
+
|
|
766
805
|
/**
|
|
767
806
|
* https://github.com/reactjs/rfcs/pull/107
|
|
768
807
|
* @param {*} type
|
|
769
808
|
* @param {object} props
|
|
770
809
|
* @param {string} key
|
|
771
810
|
*/
|
|
811
|
+
|
|
772
812
|
function jsxDEV(type, config, maybeKey, source, self) {
|
|
773
|
-
var propName
|
|
813
|
+
var propName; // Reserved names are extracted
|
|
774
814
|
|
|
775
|
-
// Reserved names are extracted
|
|
776
815
|
var props = {};
|
|
777
|
-
|
|
778
816
|
var key = null;
|
|
779
|
-
var ref = null;
|
|
817
|
+
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
818
|
+
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
819
|
+
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
820
|
+
// but as an intermediary step, we will use jsxDEV for everything except
|
|
821
|
+
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
822
|
+
// key is explicitly declared to be undefined or not.
|
|
780
823
|
|
|
781
|
-
if (
|
|
782
|
-
|
|
824
|
+
if (maybeKey !== undefined) {
|
|
825
|
+
key = '' + maybeKey;
|
|
783
826
|
}
|
|
784
827
|
|
|
785
828
|
if (hasValidKey(config)) {
|
|
786
829
|
key = '' + config.key;
|
|
787
830
|
}
|
|
788
831
|
|
|
789
|
-
|
|
832
|
+
if (hasValidRef(config)) {
|
|
833
|
+
ref = config.ref;
|
|
834
|
+
} // Remaining properties are added to a new props object
|
|
835
|
+
|
|
836
|
+
|
|
790
837
|
for (propName in config) {
|
|
791
838
|
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
792
839
|
props[propName] = config[propName];
|
|
793
840
|
}
|
|
794
|
-
}
|
|
841
|
+
} // Resolve default props
|
|
795
842
|
|
|
796
|
-
// intentionally not checking if key was set above
|
|
797
|
-
// this key is higher priority as it's static
|
|
798
|
-
if (maybeKey !== undefined) {
|
|
799
|
-
key = '' + maybeKey;
|
|
800
|
-
}
|
|
801
843
|
|
|
802
|
-
// Resolve default props
|
|
803
844
|
if (type && type.defaultProps) {
|
|
804
845
|
var defaultProps = type.defaultProps;
|
|
846
|
+
|
|
805
847
|
for (propName in defaultProps) {
|
|
806
848
|
if (props[propName] === undefined) {
|
|
807
849
|
props[propName] = defaultProps[propName];
|
|
@@ -811,9 +853,11 @@ function jsxDEV(type, config, maybeKey, source, self) {
|
|
|
811
853
|
|
|
812
854
|
if (key || ref) {
|
|
813
855
|
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
856
|
+
|
|
814
857
|
if (key) {
|
|
815
858
|
defineKeyPropWarningGetter(props, displayName);
|
|
816
859
|
}
|
|
860
|
+
|
|
817
861
|
if (ref) {
|
|
818
862
|
defineRefPropWarningGetter(props, displayName);
|
|
819
863
|
}
|
|
@@ -821,17 +865,15 @@ function jsxDEV(type, config, maybeKey, source, self) {
|
|
|
821
865
|
|
|
822
866
|
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
823
867
|
}
|
|
824
|
-
|
|
825
868
|
/**
|
|
826
869
|
* Create and return a new ReactElement of the given type.
|
|
827
870
|
* See https://reactjs.org/docs/react-api.html#createelement
|
|
828
871
|
*/
|
|
872
|
+
|
|
829
873
|
function createElement(type, config, children) {
|
|
830
|
-
var propName
|
|
874
|
+
var propName; // Reserved names are extracted
|
|
831
875
|
|
|
832
|
-
// Reserved names are extracted
|
|
833
876
|
var props = {};
|
|
834
|
-
|
|
835
877
|
var key = null;
|
|
836
878
|
var ref = null;
|
|
837
879
|
var self = null;
|
|
@@ -841,61 +883,70 @@ function createElement(type, config, children) {
|
|
|
841
883
|
if (hasValidRef(config)) {
|
|
842
884
|
ref = config.ref;
|
|
843
885
|
}
|
|
886
|
+
|
|
844
887
|
if (hasValidKey(config)) {
|
|
845
888
|
key = '' + config.key;
|
|
846
889
|
}
|
|
847
890
|
|
|
848
891
|
self = config.__self === undefined ? null : config.__self;
|
|
849
|
-
source = config.__source === undefined ? null : config.__source;
|
|
850
|
-
|
|
892
|
+
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
|
893
|
+
|
|
851
894
|
for (propName in config) {
|
|
852
895
|
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
853
896
|
props[propName] = config[propName];
|
|
854
897
|
}
|
|
855
898
|
}
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
// Children can be more than one argument, and those are transferred onto
|
|
899
|
+
} // Children can be more than one argument, and those are transferred onto
|
|
859
900
|
// the newly allocated props object.
|
|
901
|
+
|
|
902
|
+
|
|
860
903
|
var childrenLength = arguments.length - 2;
|
|
904
|
+
|
|
861
905
|
if (childrenLength === 1) {
|
|
862
906
|
props.children = children;
|
|
863
907
|
} else if (childrenLength > 1) {
|
|
864
908
|
var childArray = Array(childrenLength);
|
|
909
|
+
|
|
865
910
|
for (var i = 0; i < childrenLength; i++) {
|
|
866
911
|
childArray[i] = arguments[i + 2];
|
|
867
912
|
}
|
|
913
|
+
|
|
868
914
|
{
|
|
869
915
|
if (Object.freeze) {
|
|
870
916
|
Object.freeze(childArray);
|
|
871
917
|
}
|
|
872
918
|
}
|
|
919
|
+
|
|
873
920
|
props.children = childArray;
|
|
874
|
-
}
|
|
921
|
+
} // Resolve default props
|
|
922
|
+
|
|
875
923
|
|
|
876
|
-
// Resolve default props
|
|
877
924
|
if (type && type.defaultProps) {
|
|
878
925
|
var defaultProps = type.defaultProps;
|
|
926
|
+
|
|
879
927
|
for (propName in defaultProps) {
|
|
880
928
|
if (props[propName] === undefined) {
|
|
881
929
|
props[propName] = defaultProps[propName];
|
|
882
930
|
}
|
|
883
931
|
}
|
|
884
932
|
}
|
|
933
|
+
|
|
885
934
|
{
|
|
886
935
|
if (key || ref) {
|
|
887
936
|
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
937
|
+
|
|
888
938
|
if (key) {
|
|
889
939
|
defineKeyPropWarningGetter(props, displayName);
|
|
890
940
|
}
|
|
941
|
+
|
|
891
942
|
if (ref) {
|
|
892
943
|
defineRefPropWarningGetter(props, displayName);
|
|
893
944
|
}
|
|
894
945
|
}
|
|
895
946
|
}
|
|
947
|
+
|
|
896
948
|
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
897
949
|
}
|
|
898
|
-
|
|
899
950
|
/**
|
|
900
951
|
* Return a function that produces ReactElements of a given type.
|
|
901
952
|
* See https://reactjs.org/docs/react-api.html#createfactory
|
|
@@ -904,39 +955,36 @@ function createElement(type, config, children) {
|
|
|
904
955
|
|
|
905
956
|
function cloneAndReplaceKey(oldElement, newKey) {
|
|
906
957
|
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
907
|
-
|
|
908
958
|
return newElement;
|
|
909
959
|
}
|
|
910
|
-
|
|
911
960
|
/**
|
|
912
961
|
* Clone and return a new ReactElement using element as the starting point.
|
|
913
962
|
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
914
963
|
*/
|
|
964
|
+
|
|
915
965
|
function cloneElement(element, config, children) {
|
|
916
966
|
(function () {
|
|
917
967
|
if (!!(element === null || element === undefined)) {
|
|
918
968
|
{
|
|
919
|
-
throw ReactError(Error(
|
|
969
|
+
throw ReactError(Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."));
|
|
920
970
|
}
|
|
921
971
|
}
|
|
922
972
|
})();
|
|
923
973
|
|
|
924
|
-
var propName
|
|
974
|
+
var propName; // Original props are copied
|
|
975
|
+
|
|
976
|
+
var props = _assign({}, element.props); // Reserved names are extracted
|
|
925
977
|
|
|
926
|
-
// Original props are copied
|
|
927
|
-
var props = _assign({}, element.props);
|
|
928
978
|
|
|
929
|
-
// Reserved names are extracted
|
|
930
979
|
var key = element.key;
|
|
931
|
-
var ref = element.ref;
|
|
932
|
-
|
|
933
|
-
var self = element._self;
|
|
934
|
-
// Source is preserved since cloneElement is unlikely to be targeted by a
|
|
980
|
+
var ref = element.ref; // Self is preserved since the owner is preserved.
|
|
981
|
+
|
|
982
|
+
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
|
935
983
|
// transpiler, and the original source is probably a better indicator of the
|
|
936
984
|
// true owner.
|
|
937
|
-
var source = element._source;
|
|
938
985
|
|
|
939
|
-
// Owner will be preserved, unless ref is overridden
|
|
986
|
+
var source = element._source; // Owner will be preserved, unless ref is overridden
|
|
987
|
+
|
|
940
988
|
var owner = element._owner;
|
|
941
989
|
|
|
942
990
|
if (config != null) {
|
|
@@ -945,15 +993,18 @@ function cloneElement(element, config, children) {
|
|
|
945
993
|
ref = config.ref;
|
|
946
994
|
owner = ReactCurrentOwner.current;
|
|
947
995
|
}
|
|
996
|
+
|
|
948
997
|
if (hasValidKey(config)) {
|
|
949
998
|
key = '' + config.key;
|
|
950
|
-
}
|
|
999
|
+
} // Remaining properties override existing props
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
var defaultProps;
|
|
951
1003
|
|
|
952
|
-
// Remaining properties override existing props
|
|
953
|
-
var defaultProps = void 0;
|
|
954
1004
|
if (element.type && element.type.defaultProps) {
|
|
955
1005
|
defaultProps = element.type.defaultProps;
|
|
956
1006
|
}
|
|
1007
|
+
|
|
957
1008
|
for (propName in config) {
|
|
958
1009
|
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
959
1010
|
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
@@ -964,24 +1015,26 @@ function cloneElement(element, config, children) {
|
|
|
964
1015
|
}
|
|
965
1016
|
}
|
|
966
1017
|
}
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
// Children can be more than one argument, and those are transferred onto
|
|
1018
|
+
} // Children can be more than one argument, and those are transferred onto
|
|
970
1019
|
// the newly allocated props object.
|
|
1020
|
+
|
|
1021
|
+
|
|
971
1022
|
var childrenLength = arguments.length - 2;
|
|
1023
|
+
|
|
972
1024
|
if (childrenLength === 1) {
|
|
973
1025
|
props.children = children;
|
|
974
1026
|
} else if (childrenLength > 1) {
|
|
975
1027
|
var childArray = Array(childrenLength);
|
|
1028
|
+
|
|
976
1029
|
for (var i = 0; i < childrenLength; i++) {
|
|
977
1030
|
childArray[i] = arguments[i + 2];
|
|
978
1031
|
}
|
|
1032
|
+
|
|
979
1033
|
props.children = childArray;
|
|
980
1034
|
}
|
|
981
1035
|
|
|
982
1036
|
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
983
1037
|
}
|
|
984
|
-
|
|
985
1038
|
/**
|
|
986
1039
|
* Verifies the object is a ReactElement.
|
|
987
1040
|
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
@@ -989,19 +1042,20 @@ function cloneElement(element, config, children) {
|
|
|
989
1042
|
* @return {boolean} True if `object` is a ReactElement.
|
|
990
1043
|
* @final
|
|
991
1044
|
*/
|
|
1045
|
+
|
|
992
1046
|
function isValidElement(object) {
|
|
993
1047
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
994
1048
|
}
|
|
995
1049
|
|
|
996
1050
|
var SEPARATOR = '.';
|
|
997
1051
|
var SUBSEPARATOR = ':';
|
|
998
|
-
|
|
999
1052
|
/**
|
|
1000
1053
|
* Escape and wrap key so it is safe to use as a reactid
|
|
1001
1054
|
*
|
|
1002
1055
|
* @param {string} key to be escaped.
|
|
1003
1056
|
* @return {string} the escaped key.
|
|
1004
1057
|
*/
|
|
1058
|
+
|
|
1005
1059
|
function escape(key) {
|
|
1006
1060
|
var escapeRegex = /[=:]/g;
|
|
1007
1061
|
var escaperLookup = {
|
|
@@ -1011,24 +1065,24 @@ function escape(key) {
|
|
|
1011
1065
|
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
|
1012
1066
|
return escaperLookup[match];
|
|
1013
1067
|
});
|
|
1014
|
-
|
|
1015
1068
|
return '$' + escapedString;
|
|
1016
1069
|
}
|
|
1017
|
-
|
|
1018
1070
|
/**
|
|
1019
1071
|
* TODO: Test that a single child and an array with one item have the same key
|
|
1020
1072
|
* pattern.
|
|
1021
1073
|
*/
|
|
1022
1074
|
|
|
1023
|
-
var didWarnAboutMaps = false;
|
|
1024
1075
|
|
|
1076
|
+
var didWarnAboutMaps = false;
|
|
1025
1077
|
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1078
|
+
|
|
1026
1079
|
function escapeUserProvidedKey(text) {
|
|
1027
1080
|
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1028
1081
|
}
|
|
1029
1082
|
|
|
1030
1083
|
var POOL_SIZE = 10;
|
|
1031
1084
|
var traverseContextPool = [];
|
|
1085
|
+
|
|
1032
1086
|
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
1033
1087
|
if (traverseContextPool.length) {
|
|
1034
1088
|
var traverseContext = traverseContextPool.pop();
|
|
@@ -1055,11 +1109,11 @@ function releaseTraverseContext(traverseContext) {
|
|
|
1055
1109
|
traverseContext.func = null;
|
|
1056
1110
|
traverseContext.context = null;
|
|
1057
1111
|
traverseContext.count = 0;
|
|
1112
|
+
|
|
1058
1113
|
if (traverseContextPool.length < POOL_SIZE) {
|
|
1059
1114
|
traverseContextPool.push(traverseContext);
|
|
1060
1115
|
}
|
|
1061
1116
|
}
|
|
1062
|
-
|
|
1063
1117
|
/**
|
|
1064
1118
|
* @param {?*} children Children tree container.
|
|
1065
1119
|
* @param {!string} nameSoFar Name of the key path so far.
|
|
@@ -1068,6 +1122,8 @@ function releaseTraverseContext(traverseContext) {
|
|
|
1068
1122
|
* process.
|
|
1069
1123
|
* @return {!number} The number of children in this subtree.
|
|
1070
1124
|
*/
|
|
1125
|
+
|
|
1126
|
+
|
|
1071
1127
|
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
1072
1128
|
var type = typeof children;
|
|
1073
1129
|
|
|
@@ -1086,26 +1142,28 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1086
1142
|
case 'number':
|
|
1087
1143
|
invokeCallback = true;
|
|
1088
1144
|
break;
|
|
1145
|
+
|
|
1089
1146
|
case 'object':
|
|
1090
1147
|
switch (children.$$typeof) {
|
|
1091
1148
|
case REACT_ELEMENT_TYPE:
|
|
1092
1149
|
case REACT_PORTAL_TYPE:
|
|
1093
1150
|
invokeCallback = true;
|
|
1094
1151
|
}
|
|
1152
|
+
|
|
1095
1153
|
}
|
|
1096
1154
|
}
|
|
1097
1155
|
|
|
1098
1156
|
if (invokeCallback) {
|
|
1099
|
-
callback(traverseContext, children,
|
|
1100
|
-
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1157
|
+
callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array
|
|
1101
1158
|
// so that it's consistent if the number of children grows.
|
|
1102
1159
|
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
1103
1160
|
return 1;
|
|
1104
1161
|
}
|
|
1105
1162
|
|
|
1106
|
-
var child
|
|
1107
|
-
var nextName
|
|
1163
|
+
var child;
|
|
1164
|
+
var nextName;
|
|
1108
1165
|
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1166
|
+
|
|
1109
1167
|
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1110
1168
|
|
|
1111
1169
|
if (Array.isArray(children)) {
|
|
@@ -1116,6 +1174,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1116
1174
|
}
|
|
1117
1175
|
} else {
|
|
1118
1176
|
var iteratorFn = getIteratorFn(children);
|
|
1177
|
+
|
|
1119
1178
|
if (typeof iteratorFn === 'function') {
|
|
1120
1179
|
{
|
|
1121
1180
|
// Warn about using Maps as children
|
|
@@ -1126,8 +1185,9 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1126
1185
|
}
|
|
1127
1186
|
|
|
1128
1187
|
var iterator = iteratorFn.call(children);
|
|
1129
|
-
var step
|
|
1188
|
+
var step;
|
|
1130
1189
|
var ii = 0;
|
|
1190
|
+
|
|
1131
1191
|
while (!(step = iterator.next()).done) {
|
|
1132
1192
|
child = step.value;
|
|
1133
1193
|
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
@@ -1135,14 +1195,17 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1135
1195
|
}
|
|
1136
1196
|
} else if (type === 'object') {
|
|
1137
1197
|
var addendum = '';
|
|
1198
|
+
|
|
1138
1199
|
{
|
|
1139
1200
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1140
1201
|
}
|
|
1202
|
+
|
|
1141
1203
|
var childrenString = '' + children;
|
|
1204
|
+
|
|
1142
1205
|
(function () {
|
|
1143
1206
|
{
|
|
1144
1207
|
{
|
|
1145
|
-
throw ReactError(Error(
|
|
1208
|
+
throw ReactError(Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum));
|
|
1146
1209
|
}
|
|
1147
1210
|
}
|
|
1148
1211
|
})();
|
|
@@ -1151,7 +1214,6 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1151
1214
|
|
|
1152
1215
|
return subtreeCount;
|
|
1153
1216
|
}
|
|
1154
|
-
|
|
1155
1217
|
/**
|
|
1156
1218
|
* Traverses children that are typically specified as `props.children`, but
|
|
1157
1219
|
* might also be specified through attributes:
|
|
@@ -1168,6 +1230,8 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1168
1230
|
* @param {?*} traverseContext Context for traversal.
|
|
1169
1231
|
* @return {!number} The number of children in this subtree.
|
|
1170
1232
|
*/
|
|
1233
|
+
|
|
1234
|
+
|
|
1171
1235
|
function traverseAllChildren(children, callback, traverseContext) {
|
|
1172
1236
|
if (children == null) {
|
|
1173
1237
|
return 0;
|
|
@@ -1175,7 +1239,6 @@ function traverseAllChildren(children, callback, traverseContext) {
|
|
|
1175
1239
|
|
|
1176
1240
|
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1177
1241
|
}
|
|
1178
|
-
|
|
1179
1242
|
/**
|
|
1180
1243
|
* Generate a key string that identifies a component within a set.
|
|
1181
1244
|
*
|
|
@@ -1183,24 +1246,25 @@ function traverseAllChildren(children, callback, traverseContext) {
|
|
|
1183
1246
|
* @param {number} index Index that is used if a manual key is not provided.
|
|
1184
1247
|
* @return {string}
|
|
1185
1248
|
*/
|
|
1249
|
+
|
|
1250
|
+
|
|
1186
1251
|
function getComponentKey(component, index) {
|
|
1187
1252
|
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1188
1253
|
// that we don't block potential future ES APIs.
|
|
1189
1254
|
if (typeof component === 'object' && component !== null && component.key != null) {
|
|
1190
1255
|
// Explicit key
|
|
1191
1256
|
return escape(component.key);
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1257
|
+
} // Implicit key determined by the index in the set
|
|
1258
|
+
|
|
1259
|
+
|
|
1194
1260
|
return index.toString(36);
|
|
1195
1261
|
}
|
|
1196
1262
|
|
|
1197
1263
|
function forEachSingleChild(bookKeeping, child, name) {
|
|
1198
1264
|
var func = bookKeeping.func,
|
|
1199
1265
|
context = bookKeeping.context;
|
|
1200
|
-
|
|
1201
1266
|
func.call(context, child, bookKeeping.count++);
|
|
1202
1267
|
}
|
|
1203
|
-
|
|
1204
1268
|
/**
|
|
1205
1269
|
* Iterates through children that are typically specified as `props.children`.
|
|
1206
1270
|
*
|
|
@@ -1213,10 +1277,13 @@ function forEachSingleChild(bookKeeping, child, name) {
|
|
|
1213
1277
|
* @param {function(*, int)} forEachFunc
|
|
1214
1278
|
* @param {*} forEachContext Context for forEachContext.
|
|
1215
1279
|
*/
|
|
1280
|
+
|
|
1281
|
+
|
|
1216
1282
|
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1217
1283
|
if (children == null) {
|
|
1218
1284
|
return children;
|
|
1219
1285
|
}
|
|
1286
|
+
|
|
1220
1287
|
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
|
1221
1288
|
traverseAllChildren(children, forEachSingleChild, traverseContext);
|
|
1222
1289
|
releaseTraverseContext(traverseContext);
|
|
@@ -1227,34 +1294,34 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
|
1227
1294
|
keyPrefix = bookKeeping.keyPrefix,
|
|
1228
1295
|
func = bookKeeping.func,
|
|
1229
1296
|
context = bookKeeping.context;
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
1297
|
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1298
|
+
|
|
1233
1299
|
if (Array.isArray(mappedChild)) {
|
|
1234
1300
|
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
|
1235
1301
|
return c;
|
|
1236
1302
|
});
|
|
1237
1303
|
} else if (mappedChild != null) {
|
|
1238
1304
|
if (isValidElement(mappedChild)) {
|
|
1239
|
-
mappedChild = cloneAndReplaceKey(mappedChild,
|
|
1240
|
-
// Keep both the (mapped) and old keys if they differ, just as
|
|
1305
|
+
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
1241
1306
|
// traverseAllChildren used to do for objects as children
|
|
1242
1307
|
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1243
1308
|
}
|
|
1309
|
+
|
|
1244
1310
|
result.push(mappedChild);
|
|
1245
1311
|
}
|
|
1246
1312
|
}
|
|
1247
1313
|
|
|
1248
1314
|
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1249
1315
|
var escapedPrefix = '';
|
|
1316
|
+
|
|
1250
1317
|
if (prefix != null) {
|
|
1251
1318
|
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1252
1319
|
}
|
|
1320
|
+
|
|
1253
1321
|
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
|
1254
1322
|
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
|
1255
1323
|
releaseTraverseContext(traverseContext);
|
|
1256
1324
|
}
|
|
1257
|
-
|
|
1258
1325
|
/**
|
|
1259
1326
|
* Maps children that are typically specified as `props.children`.
|
|
1260
1327
|
*
|
|
@@ -1268,15 +1335,17 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
|
1268
1335
|
* @param {*} context Context for mapFunction.
|
|
1269
1336
|
* @return {object} Object containing the ordered map of results.
|
|
1270
1337
|
*/
|
|
1338
|
+
|
|
1339
|
+
|
|
1271
1340
|
function mapChildren(children, func, context) {
|
|
1272
1341
|
if (children == null) {
|
|
1273
1342
|
return children;
|
|
1274
1343
|
}
|
|
1344
|
+
|
|
1275
1345
|
var result = [];
|
|
1276
1346
|
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1277
1347
|
return result;
|
|
1278
1348
|
}
|
|
1279
|
-
|
|
1280
1349
|
/**
|
|
1281
1350
|
* Count the number of children that are typically specified as
|
|
1282
1351
|
* `props.children`.
|
|
@@ -1286,18 +1355,21 @@ function mapChildren(children, func, context) {
|
|
|
1286
1355
|
* @param {?*} children Children tree container.
|
|
1287
1356
|
* @return {number} The number of children.
|
|
1288
1357
|
*/
|
|
1358
|
+
|
|
1359
|
+
|
|
1289
1360
|
function countChildren(children) {
|
|
1290
1361
|
return traverseAllChildren(children, function () {
|
|
1291
1362
|
return null;
|
|
1292
1363
|
}, null);
|
|
1293
1364
|
}
|
|
1294
|
-
|
|
1295
1365
|
/**
|
|
1296
1366
|
* Flatten a children object (typically specified as `props.children`) and
|
|
1297
1367
|
* return an array with appropriately re-keyed children.
|
|
1298
1368
|
*
|
|
1299
1369
|
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1300
1370
|
*/
|
|
1371
|
+
|
|
1372
|
+
|
|
1301
1373
|
function toArray(children) {
|
|
1302
1374
|
var result = [];
|
|
1303
1375
|
mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
|
@@ -1305,7 +1377,6 @@ function toArray(children) {
|
|
|
1305
1377
|
});
|
|
1306
1378
|
return result;
|
|
1307
1379
|
}
|
|
1308
|
-
|
|
1309
1380
|
/**
|
|
1310
1381
|
* Returns the first child in a collection of children and verifies that there
|
|
1311
1382
|
* is only one child in the collection.
|
|
@@ -1320,14 +1391,17 @@ function toArray(children) {
|
|
|
1320
1391
|
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1321
1392
|
* structure.
|
|
1322
1393
|
*/
|
|
1394
|
+
|
|
1395
|
+
|
|
1323
1396
|
function onlyChild(children) {
|
|
1324
1397
|
(function () {
|
|
1325
1398
|
if (!isValidElement(children)) {
|
|
1326
1399
|
{
|
|
1327
|
-
throw ReactError(Error(
|
|
1400
|
+
throw ReactError(Error("React.Children.only expected to receive a single React element child."));
|
|
1328
1401
|
}
|
|
1329
1402
|
}
|
|
1330
1403
|
})();
|
|
1404
|
+
|
|
1331
1405
|
return children;
|
|
1332
1406
|
}
|
|
1333
1407
|
|
|
@@ -1357,12 +1431,10 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1357
1431
|
Provider: null,
|
|
1358
1432
|
Consumer: null
|
|
1359
1433
|
};
|
|
1360
|
-
|
|
1361
1434
|
context.Provider = {
|
|
1362
1435
|
$$typeof: REACT_PROVIDER_TYPE,
|
|
1363
1436
|
_context: context
|
|
1364
1437
|
};
|
|
1365
|
-
|
|
1366
1438
|
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
1367
1439
|
var hasWarnedAboutUsingConsumerProvider = false;
|
|
1368
1440
|
|
|
@@ -1374,8 +1446,8 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1374
1446
|
$$typeof: REACT_CONTEXT_TYPE,
|
|
1375
1447
|
_context: context,
|
|
1376
1448
|
_calculateChangedBits: context._calculateChangedBits
|
|
1377
|
-
};
|
|
1378
|
-
|
|
1449
|
+
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
1450
|
+
|
|
1379
1451
|
Object.defineProperties(Consumer, {
|
|
1380
1452
|
Provider: {
|
|
1381
1453
|
get: function () {
|
|
@@ -1383,6 +1455,7 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1383
1455
|
hasWarnedAboutUsingConsumerProvider = true;
|
|
1384
1456
|
warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
|
1385
1457
|
}
|
|
1458
|
+
|
|
1386
1459
|
return context.Provider;
|
|
1387
1460
|
},
|
|
1388
1461
|
set: function (_Provider) {
|
|
@@ -1419,11 +1492,12 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1419
1492
|
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1420
1493
|
warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
|
1421
1494
|
}
|
|
1495
|
+
|
|
1422
1496
|
return context.Consumer;
|
|
1423
1497
|
}
|
|
1424
1498
|
}
|
|
1425
|
-
});
|
|
1426
|
-
|
|
1499
|
+
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1500
|
+
|
|
1427
1501
|
context.Consumer = Consumer;
|
|
1428
1502
|
}
|
|
1429
1503
|
|
|
@@ -1446,8 +1520,8 @@ function lazy(ctor) {
|
|
|
1446
1520
|
|
|
1447
1521
|
{
|
|
1448
1522
|
// In production, this would just set it on the object.
|
|
1449
|
-
var defaultProps
|
|
1450
|
-
var propTypes
|
|
1523
|
+
var defaultProps;
|
|
1524
|
+
var propTypes;
|
|
1451
1525
|
Object.defineProperties(lazyType, {
|
|
1452
1526
|
defaultProps: {
|
|
1453
1527
|
configurable: true,
|
|
@@ -1456,8 +1530,8 @@ function lazy(ctor) {
|
|
|
1456
1530
|
},
|
|
1457
1531
|
set: function (newDefaultProps) {
|
|
1458
1532
|
warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1459
|
-
defaultProps = newDefaultProps;
|
|
1460
|
-
|
|
1533
|
+
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1534
|
+
|
|
1461
1535
|
Object.defineProperty(lazyType, 'defaultProps', {
|
|
1462
1536
|
enumerable: true
|
|
1463
1537
|
});
|
|
@@ -1470,8 +1544,8 @@ function lazy(ctor) {
|
|
|
1470
1544
|
},
|
|
1471
1545
|
set: function (newPropTypes) {
|
|
1472
1546
|
warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1473
|
-
propTypes = newPropTypes;
|
|
1474
|
-
|
|
1547
|
+
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1548
|
+
|
|
1475
1549
|
Object.defineProperty(lazyType, 'propTypes', {
|
|
1476
1550
|
enumerable: true
|
|
1477
1551
|
});
|
|
@@ -1490,8 +1564,7 @@ function forwardRef(render) {
|
|
|
1490
1564
|
} else if (typeof render !== 'function') {
|
|
1491
1565
|
warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1492
1566
|
} else {
|
|
1493
|
-
!(
|
|
1494
|
-
// Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
|
|
1567
|
+
!( // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
|
|
1495
1568
|
render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.') : void 0;
|
|
1496
1569
|
}
|
|
1497
1570
|
|
|
@@ -1507,9 +1580,8 @@ function forwardRef(render) {
|
|
|
1507
1580
|
}
|
|
1508
1581
|
|
|
1509
1582
|
function isValidElementType(type) {
|
|
1510
|
-
return typeof type === 'string' || typeof type === 'function' ||
|
|
1511
|
-
|
|
1512
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE);
|
|
1583
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1584
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE);
|
|
1513
1585
|
}
|
|
1514
1586
|
|
|
1515
1587
|
function memo(type, compare) {
|
|
@@ -1518,6 +1590,7 @@ function memo(type, compare) {
|
|
|
1518
1590
|
warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1519
1591
|
}
|
|
1520
1592
|
}
|
|
1593
|
+
|
|
1521
1594
|
return {
|
|
1522
1595
|
$$typeof: REACT_MEMO_TYPE,
|
|
1523
1596
|
type: type,
|
|
@@ -1527,26 +1600,28 @@ function memo(type, compare) {
|
|
|
1527
1600
|
|
|
1528
1601
|
function resolveDispatcher() {
|
|
1529
1602
|
var dispatcher = ReactCurrentDispatcher.current;
|
|
1603
|
+
|
|
1530
1604
|
(function () {
|
|
1531
1605
|
if (!(dispatcher !== null)) {
|
|
1532
1606
|
{
|
|
1533
|
-
throw ReactError(Error(
|
|
1607
|
+
throw ReactError(Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."));
|
|
1534
1608
|
}
|
|
1535
1609
|
}
|
|
1536
1610
|
})();
|
|
1611
|
+
|
|
1537
1612
|
return dispatcher;
|
|
1538
1613
|
}
|
|
1539
1614
|
|
|
1540
1615
|
function useContext(Context, unstable_observedBits) {
|
|
1541
1616
|
var dispatcher = resolveDispatcher();
|
|
1617
|
+
|
|
1542
1618
|
{
|
|
1543
|
-
!(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0;
|
|
1619
|
+
!(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0; // TODO: add a more generic warning for invalid values.
|
|
1544
1620
|
|
|
1545
|
-
// TODO: add a more generic warning for invalid values.
|
|
1546
1621
|
if (Context._context !== undefined) {
|
|
1547
|
-
var realContext = Context._context;
|
|
1548
|
-
// Don't deduplicate because this legitimately causes bugs
|
|
1622
|
+
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1549
1623
|
// and nobody should be using this in existing code.
|
|
1624
|
+
|
|
1550
1625
|
if (realContext.Consumer === Context) {
|
|
1551
1626
|
warning$1(false, 'Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
|
1552
1627
|
} else if (realContext.Provider === Context) {
|
|
@@ -1554,73 +1629,65 @@ function useContext(Context, unstable_observedBits) {
|
|
|
1554
1629
|
}
|
|
1555
1630
|
}
|
|
1556
1631
|
}
|
|
1632
|
+
|
|
1557
1633
|
return dispatcher.useContext(Context, unstable_observedBits);
|
|
1558
1634
|
}
|
|
1559
|
-
|
|
1560
1635
|
function useState(initialState) {
|
|
1561
1636
|
var dispatcher = resolveDispatcher();
|
|
1562
1637
|
return dispatcher.useState(initialState);
|
|
1563
1638
|
}
|
|
1564
|
-
|
|
1565
1639
|
function useReducer(reducer, initialArg, init) {
|
|
1566
1640
|
var dispatcher = resolveDispatcher();
|
|
1567
1641
|
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1568
1642
|
}
|
|
1569
|
-
|
|
1570
1643
|
function useRef(initialValue) {
|
|
1571
1644
|
var dispatcher = resolveDispatcher();
|
|
1572
1645
|
return dispatcher.useRef(initialValue);
|
|
1573
1646
|
}
|
|
1574
|
-
|
|
1575
1647
|
function useEffect(create, inputs) {
|
|
1576
1648
|
var dispatcher = resolveDispatcher();
|
|
1577
1649
|
return dispatcher.useEffect(create, inputs);
|
|
1578
1650
|
}
|
|
1579
|
-
|
|
1580
1651
|
function useLayoutEffect(create, inputs) {
|
|
1581
1652
|
var dispatcher = resolveDispatcher();
|
|
1582
1653
|
return dispatcher.useLayoutEffect(create, inputs);
|
|
1583
1654
|
}
|
|
1584
|
-
|
|
1585
1655
|
function useCallback(callback, inputs) {
|
|
1586
1656
|
var dispatcher = resolveDispatcher();
|
|
1587
1657
|
return dispatcher.useCallback(callback, inputs);
|
|
1588
1658
|
}
|
|
1589
|
-
|
|
1590
1659
|
function useMemo(create, inputs) {
|
|
1591
1660
|
var dispatcher = resolveDispatcher();
|
|
1592
1661
|
return dispatcher.useMemo(create, inputs);
|
|
1593
1662
|
}
|
|
1594
|
-
|
|
1595
1663
|
function useImperativeHandle(ref, create, inputs) {
|
|
1596
1664
|
var dispatcher = resolveDispatcher();
|
|
1597
1665
|
return dispatcher.useImperativeHandle(ref, create, inputs);
|
|
1598
1666
|
}
|
|
1599
|
-
|
|
1600
1667
|
function useDebugValue(value, formatterFn) {
|
|
1601
1668
|
{
|
|
1602
1669
|
var dispatcher = resolveDispatcher();
|
|
1603
1670
|
return dispatcher.useDebugValue(value, formatterFn);
|
|
1604
1671
|
}
|
|
1605
1672
|
}
|
|
1606
|
-
|
|
1607
1673
|
var emptyObject$1 = {};
|
|
1608
|
-
|
|
1609
1674
|
function useResponder(responder, listenerProps) {
|
|
1610
1675
|
var dispatcher = resolveDispatcher();
|
|
1676
|
+
|
|
1611
1677
|
{
|
|
1612
1678
|
if (responder == null || responder.$$typeof !== REACT_RESPONDER_TYPE) {
|
|
1613
1679
|
warning$1(false, 'useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
|
|
1614
1680
|
return;
|
|
1615
1681
|
}
|
|
1616
1682
|
}
|
|
1683
|
+
|
|
1617
1684
|
return dispatcher.useResponder(responder, listenerProps || emptyObject$1);
|
|
1618
1685
|
}
|
|
1619
1686
|
|
|
1620
|
-
// Within the scope of the callback, mark all updates as being allowed to suspend.
|
|
1621
1687
|
function withSuspenseConfig(scope, config) {
|
|
1622
1688
|
var previousConfig = ReactCurrentBatchConfig.suspense;
|
|
1623
1689
|
ReactCurrentBatchConfig.suspense = config === undefined ? null : config;
|
|
1690
|
+
|
|
1624
1691
|
try {
|
|
1625
1692
|
scope();
|
|
1626
1693
|
} finally {
|
|
@@ -1634,20 +1701,23 @@ function withSuspenseConfig(scope, config) {
|
|
|
1634
1701
|
* used only in DEV and could be replaced by a static type checker for languages
|
|
1635
1702
|
* that support it.
|
|
1636
1703
|
*/
|
|
1637
|
-
|
|
1638
|
-
var propTypesMisspellWarningShown = void 0;
|
|
1704
|
+
var propTypesMisspellWarningShown;
|
|
1639
1705
|
|
|
1640
1706
|
{
|
|
1641
1707
|
propTypesMisspellWarningShown = false;
|
|
1642
1708
|
}
|
|
1643
1709
|
|
|
1710
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
1711
|
+
|
|
1644
1712
|
function getDeclarationErrorAddendum() {
|
|
1645
1713
|
if (ReactCurrentOwner.current) {
|
|
1646
1714
|
var name = getComponentName(ReactCurrentOwner.current.type);
|
|
1715
|
+
|
|
1647
1716
|
if (name) {
|
|
1648
1717
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
1649
1718
|
}
|
|
1650
1719
|
}
|
|
1720
|
+
|
|
1651
1721
|
return '';
|
|
1652
1722
|
}
|
|
1653
1723
|
|
|
@@ -1657,6 +1727,7 @@ function getSourceInfoErrorAddendum(source) {
|
|
|
1657
1727
|
var lineNumber = source.lineNumber;
|
|
1658
1728
|
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
1659
1729
|
}
|
|
1730
|
+
|
|
1660
1731
|
return '';
|
|
1661
1732
|
}
|
|
1662
1733
|
|
|
@@ -1664,14 +1735,16 @@ function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
|
1664
1735
|
if (elementProps !== null && elementProps !== undefined) {
|
|
1665
1736
|
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
1666
1737
|
}
|
|
1738
|
+
|
|
1667
1739
|
return '';
|
|
1668
1740
|
}
|
|
1669
|
-
|
|
1670
1741
|
/**
|
|
1671
1742
|
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1672
1743
|
* object keys are not valid. This allows us to keep track of children between
|
|
1673
1744
|
* updates.
|
|
1674
1745
|
*/
|
|
1746
|
+
|
|
1747
|
+
|
|
1675
1748
|
var ownerHasKeyUseWarning = {};
|
|
1676
1749
|
|
|
1677
1750
|
function getCurrentComponentErrorInfo(parentType) {
|
|
@@ -1679,13 +1752,14 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
|
1679
1752
|
|
|
1680
1753
|
if (!info) {
|
|
1681
1754
|
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1755
|
+
|
|
1682
1756
|
if (parentName) {
|
|
1683
|
-
info =
|
|
1757
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1684
1758
|
}
|
|
1685
1759
|
}
|
|
1760
|
+
|
|
1686
1761
|
return info;
|
|
1687
1762
|
}
|
|
1688
|
-
|
|
1689
1763
|
/**
|
|
1690
1764
|
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1691
1765
|
* This element is in an array. The array could grow and shrink or be
|
|
@@ -1697,34 +1771,39 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
|
1697
1771
|
* @param {ReactElement} element Element that requires a key.
|
|
1698
1772
|
* @param {*} parentType element's parent's type.
|
|
1699
1773
|
*/
|
|
1774
|
+
|
|
1775
|
+
|
|
1700
1776
|
function validateExplicitKey(element, parentType) {
|
|
1701
1777
|
if (!element._store || element._store.validated || element.key != null) {
|
|
1702
1778
|
return;
|
|
1703
1779
|
}
|
|
1704
|
-
element._store.validated = true;
|
|
1705
1780
|
|
|
1781
|
+
element._store.validated = true;
|
|
1706
1782
|
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1783
|
+
|
|
1707
1784
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1708
1785
|
return;
|
|
1709
1786
|
}
|
|
1710
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
1711
1787
|
|
|
1712
|
-
// Usually the current owner is the offender, but if it accepts children as a
|
|
1788
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
1713
1789
|
// property, it may be the creator of the child that's responsible for
|
|
1714
1790
|
// assigning it a key.
|
|
1791
|
+
|
|
1715
1792
|
var childOwner = '';
|
|
1793
|
+
|
|
1716
1794
|
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
1717
1795
|
// Give the component that originally created this child.
|
|
1718
|
-
childOwner =
|
|
1796
|
+
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
|
|
1719
1797
|
}
|
|
1720
1798
|
|
|
1721
1799
|
setCurrentlyValidatingElement(element);
|
|
1800
|
+
|
|
1722
1801
|
{
|
|
1723
1802
|
warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1724
1803
|
}
|
|
1804
|
+
|
|
1725
1805
|
setCurrentlyValidatingElement(null);
|
|
1726
1806
|
}
|
|
1727
|
-
|
|
1728
1807
|
/**
|
|
1729
1808
|
* Ensure that every element either is passed in a static location, in an
|
|
1730
1809
|
* array with an explicit keys property defined, or in an object literal
|
|
@@ -1734,13 +1813,17 @@ function validateExplicitKey(element, parentType) {
|
|
|
1734
1813
|
* @param {ReactNode} node Statically passed child of any type.
|
|
1735
1814
|
* @param {*} parentType node's parent's type.
|
|
1736
1815
|
*/
|
|
1816
|
+
|
|
1817
|
+
|
|
1737
1818
|
function validateChildKeys(node, parentType) {
|
|
1738
1819
|
if (typeof node !== 'object') {
|
|
1739
1820
|
return;
|
|
1740
1821
|
}
|
|
1822
|
+
|
|
1741
1823
|
if (Array.isArray(node)) {
|
|
1742
1824
|
for (var i = 0; i < node.length; i++) {
|
|
1743
1825
|
var child = node[i];
|
|
1826
|
+
|
|
1744
1827
|
if (isValidElement(child)) {
|
|
1745
1828
|
validateExplicitKey(child, parentType);
|
|
1746
1829
|
}
|
|
@@ -1752,12 +1835,14 @@ function validateChildKeys(node, parentType) {
|
|
|
1752
1835
|
}
|
|
1753
1836
|
} else if (node) {
|
|
1754
1837
|
var iteratorFn = getIteratorFn(node);
|
|
1838
|
+
|
|
1755
1839
|
if (typeof iteratorFn === 'function') {
|
|
1756
1840
|
// Entry iterators used to provide implicit keys,
|
|
1757
1841
|
// but now we print a separate warning for them later.
|
|
1758
1842
|
if (iteratorFn !== node.entries) {
|
|
1759
1843
|
var iterator = iteratorFn.call(node);
|
|
1760
|
-
var step
|
|
1844
|
+
var step;
|
|
1845
|
+
|
|
1761
1846
|
while (!(step = iterator.next()).done) {
|
|
1762
1847
|
if (isValidElement(step.value)) {
|
|
1763
1848
|
validateExplicitKey(step.value, parentType);
|
|
@@ -1767,30 +1852,34 @@ function validateChildKeys(node, parentType) {
|
|
|
1767
1852
|
}
|
|
1768
1853
|
}
|
|
1769
1854
|
}
|
|
1770
|
-
|
|
1771
1855
|
/**
|
|
1772
1856
|
* Given an element, validate that its props follow the propTypes definition,
|
|
1773
1857
|
* provided by the type.
|
|
1774
1858
|
*
|
|
1775
1859
|
* @param {ReactElement} element
|
|
1776
1860
|
*/
|
|
1861
|
+
|
|
1862
|
+
|
|
1777
1863
|
function validatePropTypes(element) {
|
|
1778
1864
|
var type = element.type;
|
|
1865
|
+
|
|
1779
1866
|
if (type === null || type === undefined || typeof type === 'string') {
|
|
1780
1867
|
return;
|
|
1781
1868
|
}
|
|
1869
|
+
|
|
1782
1870
|
var name = getComponentName(type);
|
|
1783
|
-
var propTypes
|
|
1871
|
+
var propTypes;
|
|
1872
|
+
|
|
1784
1873
|
if (typeof type === 'function') {
|
|
1785
1874
|
propTypes = type.propTypes;
|
|
1786
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
1787
|
-
// Note: Memo only checks outer props here.
|
|
1875
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1788
1876
|
// Inner props are checked in the reconciler.
|
|
1789
1877
|
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1790
1878
|
propTypes = type.propTypes;
|
|
1791
1879
|
} else {
|
|
1792
1880
|
return;
|
|
1793
1881
|
}
|
|
1882
|
+
|
|
1794
1883
|
if (propTypes) {
|
|
1795
1884
|
setCurrentlyValidatingElement(element);
|
|
1796
1885
|
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
@@ -1799,21 +1888,24 @@ function validatePropTypes(element) {
|
|
|
1799
1888
|
propTypesMisspellWarningShown = true;
|
|
1800
1889
|
warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1801
1890
|
}
|
|
1891
|
+
|
|
1802
1892
|
if (typeof type.getDefaultProps === 'function') {
|
|
1803
1893
|
!type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
|
1804
1894
|
}
|
|
1805
1895
|
}
|
|
1806
|
-
|
|
1807
1896
|
/**
|
|
1808
1897
|
* Given a fragment, validate that it can only be provided with fragment props
|
|
1809
1898
|
* @param {ReactElement} fragment
|
|
1810
1899
|
*/
|
|
1900
|
+
|
|
1901
|
+
|
|
1811
1902
|
function validateFragmentProps(fragment) {
|
|
1812
1903
|
setCurrentlyValidatingElement(fragment);
|
|
1813
|
-
|
|
1814
1904
|
var keys = Object.keys(fragment.props);
|
|
1905
|
+
|
|
1815
1906
|
for (var i = 0; i < keys.length; i++) {
|
|
1816
1907
|
var key = keys[i];
|
|
1908
|
+
|
|
1817
1909
|
if (key !== 'children' && key !== 'key') {
|
|
1818
1910
|
warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1819
1911
|
break;
|
|
@@ -1828,30 +1920,32 @@ function validateFragmentProps(fragment) {
|
|
|
1828
1920
|
}
|
|
1829
1921
|
|
|
1830
1922
|
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1831
|
-
var validType = isValidElementType(type);
|
|
1832
|
-
|
|
1833
|
-
// We warn in this case but don't throw. We expect the element creation to
|
|
1923
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1834
1924
|
// succeed and there will likely be errors in render.
|
|
1925
|
+
|
|
1835
1926
|
if (!validType) {
|
|
1836
1927
|
var info = '';
|
|
1928
|
+
|
|
1837
1929
|
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1838
1930
|
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1839
1931
|
}
|
|
1840
1932
|
|
|
1841
1933
|
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
1934
|
+
|
|
1842
1935
|
if (sourceInfo) {
|
|
1843
1936
|
info += sourceInfo;
|
|
1844
1937
|
} else {
|
|
1845
1938
|
info += getDeclarationErrorAddendum();
|
|
1846
1939
|
}
|
|
1847
1940
|
|
|
1848
|
-
var typeString
|
|
1941
|
+
var typeString;
|
|
1942
|
+
|
|
1849
1943
|
if (type === null) {
|
|
1850
1944
|
typeString = 'null';
|
|
1851
1945
|
} else if (Array.isArray(type)) {
|
|
1852
1946
|
typeString = 'array';
|
|
1853
1947
|
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1854
|
-
typeString =
|
|
1948
|
+
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
1855
1949
|
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1856
1950
|
} else {
|
|
1857
1951
|
typeString = typeof type;
|
|
@@ -1860,25 +1954,33 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1860
1954
|
warning$1(false, 'React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1861
1955
|
}
|
|
1862
1956
|
|
|
1863
|
-
var element = jsxDEV(type, props, key, source, self);
|
|
1864
|
-
|
|
1865
|
-
// The result can be nullish if a mock or a custom function is used.
|
|
1957
|
+
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1866
1958
|
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1959
|
+
|
|
1867
1960
|
if (element == null) {
|
|
1868
1961
|
return element;
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
// Skip key warning if the type isn't valid since our key validation logic
|
|
1962
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1872
1963
|
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1873
1964
|
// We don't want exception behavior to differ between dev and prod.
|
|
1874
1965
|
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1875
1966
|
// fixed, the key warnings will appear.)
|
|
1967
|
+
|
|
1968
|
+
|
|
1876
1969
|
if (validType) {
|
|
1877
1970
|
var children = props.children;
|
|
1971
|
+
|
|
1878
1972
|
if (children !== undefined) {
|
|
1879
1973
|
if (isStaticChildren) {
|
|
1880
|
-
|
|
1881
|
-
|
|
1974
|
+
if (Array.isArray(children)) {
|
|
1975
|
+
for (var i = 0; i < children.length; i++) {
|
|
1976
|
+
validateChildKeys(children[i], type);
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
if (Object.freeze) {
|
|
1980
|
+
Object.freeze(children);
|
|
1981
|
+
}
|
|
1982
|
+
} else {
|
|
1983
|
+
warning$1(false, 'React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
1882
1984
|
}
|
|
1883
1985
|
} else {
|
|
1884
1986
|
validateChildKeys(children, type);
|
|
@@ -1886,7 +1988,7 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1886
1988
|
}
|
|
1887
1989
|
}
|
|
1888
1990
|
|
|
1889
|
-
if (props
|
|
1991
|
+
if (hasOwnProperty$1.call(props, 'key')) {
|
|
1890
1992
|
warning$1(false, 'React.jsx: Spreading a key to JSX is a deprecated pattern. ' + 'Explicitly pass a key after spreading props in your JSX call. ' + 'E.g. <ComponentName {...props} key={key} />');
|
|
1891
1993
|
}
|
|
1892
1994
|
|
|
@@ -1897,45 +1999,44 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1897
1999
|
}
|
|
1898
2000
|
|
|
1899
2001
|
return element;
|
|
1900
|
-
}
|
|
1901
|
-
|
|
1902
|
-
// These two functions exist to still get child warnings in dev
|
|
2002
|
+
} // These two functions exist to still get child warnings in dev
|
|
1903
2003
|
// even with the prod transform. This means that jsxDEV is purely
|
|
1904
2004
|
// opt-in behavior for better messages but that we won't stop
|
|
1905
2005
|
// giving you warnings if you use production apis.
|
|
2006
|
+
|
|
1906
2007
|
function jsxWithValidationStatic(type, props, key) {
|
|
1907
2008
|
return jsxWithValidation(type, props, key, true);
|
|
1908
2009
|
}
|
|
1909
|
-
|
|
1910
2010
|
function jsxWithValidationDynamic(type, props, key) {
|
|
1911
2011
|
return jsxWithValidation(type, props, key, false);
|
|
1912
2012
|
}
|
|
1913
|
-
|
|
1914
2013
|
function createElementWithValidation(type, props, children) {
|
|
1915
|
-
var validType = isValidElementType(type);
|
|
1916
|
-
|
|
1917
|
-
// We warn in this case but don't throw. We expect the element creation to
|
|
2014
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1918
2015
|
// succeed and there will likely be errors in render.
|
|
2016
|
+
|
|
1919
2017
|
if (!validType) {
|
|
1920
2018
|
var info = '';
|
|
2019
|
+
|
|
1921
2020
|
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1922
2021
|
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1923
2022
|
}
|
|
1924
2023
|
|
|
1925
2024
|
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
2025
|
+
|
|
1926
2026
|
if (sourceInfo) {
|
|
1927
2027
|
info += sourceInfo;
|
|
1928
2028
|
} else {
|
|
1929
2029
|
info += getDeclarationErrorAddendum();
|
|
1930
2030
|
}
|
|
1931
2031
|
|
|
1932
|
-
var typeString
|
|
2032
|
+
var typeString;
|
|
2033
|
+
|
|
1933
2034
|
if (type === null) {
|
|
1934
2035
|
typeString = 'null';
|
|
1935
2036
|
} else if (Array.isArray(type)) {
|
|
1936
2037
|
typeString = 'array';
|
|
1937
2038
|
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1938
|
-
typeString =
|
|
2039
|
+
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
1939
2040
|
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1940
2041
|
} else {
|
|
1941
2042
|
typeString = typeof type;
|
|
@@ -1944,19 +2045,18 @@ function createElementWithValidation(type, props, children) {
|
|
|
1944
2045
|
warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1945
2046
|
}
|
|
1946
2047
|
|
|
1947
|
-
var element = createElement.apply(this, arguments);
|
|
1948
|
-
|
|
1949
|
-
// The result can be nullish if a mock or a custom function is used.
|
|
2048
|
+
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
1950
2049
|
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2050
|
+
|
|
1951
2051
|
if (element == null) {
|
|
1952
2052
|
return element;
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
|
-
// Skip key warning if the type isn't valid since our key validation logic
|
|
2053
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1956
2054
|
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1957
2055
|
// We don't want exception behavior to differ between dev and prod.
|
|
1958
2056
|
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1959
2057
|
// fixed, the key warnings will appear.)
|
|
2058
|
+
|
|
2059
|
+
|
|
1960
2060
|
if (validType) {
|
|
1961
2061
|
for (var i = 2; i < arguments.length; i++) {
|
|
1962
2062
|
validateChildKeys(arguments[i], type);
|
|
@@ -1971,16 +2071,15 @@ function createElementWithValidation(type, props, children) {
|
|
|
1971
2071
|
|
|
1972
2072
|
return element;
|
|
1973
2073
|
}
|
|
1974
|
-
|
|
1975
2074
|
function createFactoryWithValidation(type) {
|
|
1976
2075
|
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
1977
|
-
validatedFactory.type = type;
|
|
1978
|
-
|
|
2076
|
+
validatedFactory.type = type; // Legacy hook: remove it
|
|
2077
|
+
|
|
1979
2078
|
{
|
|
1980
2079
|
Object.defineProperty(validatedFactory, 'type', {
|
|
1981
2080
|
enumerable: false,
|
|
1982
2081
|
get: function () {
|
|
1983
|
-
|
|
2082
|
+
lowPriorityWarningWithoutStack$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
1984
2083
|
Object.defineProperty(this, 'type', {
|
|
1985
2084
|
value: type
|
|
1986
2085
|
});
|
|
@@ -1991,27 +2090,29 @@ function createFactoryWithValidation(type) {
|
|
|
1991
2090
|
|
|
1992
2091
|
return validatedFactory;
|
|
1993
2092
|
}
|
|
1994
|
-
|
|
1995
2093
|
function cloneElementWithValidation(element, props, children) {
|
|
1996
2094
|
var newElement = cloneElement.apply(this, arguments);
|
|
2095
|
+
|
|
1997
2096
|
for (var i = 2; i < arguments.length; i++) {
|
|
1998
2097
|
validateChildKeys(arguments[i], newElement.type);
|
|
1999
2098
|
}
|
|
2099
|
+
|
|
2000
2100
|
validatePropTypes(newElement);
|
|
2001
2101
|
return newElement;
|
|
2002
2102
|
}
|
|
2003
2103
|
|
|
2004
|
-
var hasBadMapPolyfill
|
|
2104
|
+
var hasBadMapPolyfill;
|
|
2005
2105
|
|
|
2006
2106
|
{
|
|
2007
2107
|
hasBadMapPolyfill = false;
|
|
2108
|
+
|
|
2008
2109
|
try {
|
|
2009
2110
|
var frozenObject = Object.freeze({});
|
|
2010
2111
|
var testMap = new Map([[frozenObject, null]]);
|
|
2011
|
-
var testSet = new Set([frozenObject]);
|
|
2012
|
-
// This is necessary for Rollup to not consider these unused.
|
|
2112
|
+
var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused.
|
|
2013
2113
|
// https://github.com/rollup/rollup/issues/1771
|
|
2014
2114
|
// TODO: we can remove these if Rollup fixes the bug.
|
|
2115
|
+
|
|
2015
2116
|
testMap.set(0, 0);
|
|
2016
2117
|
testSet.add(0);
|
|
2017
2118
|
} catch (e) {
|
|
@@ -2027,13 +2128,16 @@ function createFundamentalComponent(impl) {
|
|
|
2027
2128
|
if (true && !hasBadMapPolyfill) {
|
|
2028
2129
|
Object.freeze(impl);
|
|
2029
2130
|
}
|
|
2131
|
+
|
|
2030
2132
|
var fundamantalComponent = {
|
|
2031
2133
|
$$typeof: REACT_FUNDAMENTAL_TYPE,
|
|
2032
2134
|
impl: impl
|
|
2033
2135
|
};
|
|
2136
|
+
|
|
2034
2137
|
{
|
|
2035
2138
|
Object.freeze(fundamantalComponent);
|
|
2036
2139
|
}
|
|
2140
|
+
|
|
2037
2141
|
return fundamantalComponent;
|
|
2038
2142
|
}
|
|
2039
2143
|
|
|
@@ -2042,110 +2146,106 @@ function createEventResponder(displayName, responderConfig) {
|
|
|
2042
2146
|
onEvent = responderConfig.onEvent,
|
|
2043
2147
|
onMount = responderConfig.onMount,
|
|
2044
2148
|
onUnmount = responderConfig.onUnmount,
|
|
2045
|
-
onOwnershipChange = responderConfig.onOwnershipChange,
|
|
2046
2149
|
onRootEvent = responderConfig.onRootEvent,
|
|
2047
2150
|
rootEventTypes = responderConfig.rootEventTypes,
|
|
2048
|
-
targetEventTypes = responderConfig.targetEventTypes
|
|
2049
|
-
|
|
2151
|
+
targetEventTypes = responderConfig.targetEventTypes,
|
|
2152
|
+
targetPortalPropagation = responderConfig.targetPortalPropagation;
|
|
2050
2153
|
var eventResponder = {
|
|
2051
2154
|
$$typeof: REACT_RESPONDER_TYPE,
|
|
2052
2155
|
displayName: displayName,
|
|
2053
2156
|
getInitialState: getInitialState || null,
|
|
2054
2157
|
onEvent: onEvent || null,
|
|
2055
2158
|
onMount: onMount || null,
|
|
2056
|
-
onOwnershipChange: onOwnershipChange || null,
|
|
2057
2159
|
onRootEvent: onRootEvent || null,
|
|
2058
2160
|
onUnmount: onUnmount || null,
|
|
2059
2161
|
rootEventTypes: rootEventTypes || null,
|
|
2060
|
-
targetEventTypes: targetEventTypes || null
|
|
2061
|
-
|
|
2062
|
-
// We use responder as a Map key later on. When we have a bad
|
|
2162
|
+
targetEventTypes: targetEventTypes || null,
|
|
2163
|
+
targetPortalPropagation: targetPortalPropagation || false
|
|
2164
|
+
}; // We use responder as a Map key later on. When we have a bad
|
|
2063
2165
|
// polyfill, then we can't use it as a key as the polyfill tries
|
|
2064
2166
|
// to add a property to the object.
|
|
2167
|
+
|
|
2065
2168
|
if (true && !hasBadMapPolyfill) {
|
|
2066
2169
|
Object.freeze(eventResponder);
|
|
2067
2170
|
}
|
|
2171
|
+
|
|
2068
2172
|
return eventResponder;
|
|
2069
2173
|
}
|
|
2070
2174
|
|
|
2071
|
-
|
|
2175
|
+
function createScope(fn) {
|
|
2176
|
+
var scopeComponent = {
|
|
2177
|
+
$$typeof: REACT_SCOPE_TYPE,
|
|
2178
|
+
fn: fn
|
|
2179
|
+
};
|
|
2180
|
+
|
|
2181
|
+
{
|
|
2182
|
+
Object.freeze(scopeComponent);
|
|
2183
|
+
}
|
|
2072
2184
|
|
|
2185
|
+
return scopeComponent;
|
|
2186
|
+
}
|
|
2073
2187
|
|
|
2074
|
-
//
|
|
2188
|
+
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
2189
|
+
|
|
2190
|
+
// In some cases, StrictMode should also double-render lifecycles.
|
|
2075
2191
|
// This can be confusing for tests though,
|
|
2076
2192
|
// And it can be bad for performance in production.
|
|
2077
2193
|
// This feature flag can be used to control the behavior:
|
|
2078
2194
|
|
|
2079
|
-
|
|
2080
|
-
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
2195
|
+
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
2081
2196
|
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
2082
2197
|
|
|
2198
|
+
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
2083
2199
|
|
|
2084
|
-
//
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
// Gather advanced timing metrics for Profiler subtrees.
|
|
2200
|
+
// Gather advanced timing metrics for Profiler subtrees.
|
|
2088
2201
|
|
|
2202
|
+
// Trace which interactions trigger each commit.
|
|
2089
2203
|
|
|
2090
|
-
//
|
|
2204
|
+
// Only used in www builds.
|
|
2091
2205
|
|
|
2092
|
-
|
|
2093
|
-
// Only used in www builds.
|
|
2094
2206
|
// TODO: true? Here it might just be false.
|
|
2095
2207
|
|
|
2096
|
-
// Only used in www builds.
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
// Only used in www builds.
|
|
2208
|
+
// Only used in www builds.
|
|
2100
2209
|
|
|
2210
|
+
// Only used in www builds.
|
|
2101
2211
|
|
|
2102
|
-
// Disable javascript: URL strings in href for XSS protection.
|
|
2212
|
+
// Disable javascript: URL strings in href for XSS protection.
|
|
2103
2213
|
|
|
2104
|
-
|
|
2105
|
-
// React Fire: prevent the value and checked attributes from syncing
|
|
2214
|
+
// React Fire: prevent the value and checked attributes from syncing
|
|
2106
2215
|
// with their related DOM properties
|
|
2107
2216
|
|
|
2108
|
-
|
|
2109
|
-
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
2217
|
+
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
2110
2218
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
2111
2219
|
|
|
2112
2220
|
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
2221
|
+
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
2116
2222
|
// This is a flag so we can fix warnings in RN core before turning it on
|
|
2117
2223
|
|
|
2224
|
+
// Experimental React Flare event system and event components support.
|
|
2118
2225
|
|
|
2119
|
-
|
|
2120
|
-
var enableFlareAPI = false;
|
|
2226
|
+
var enableFlareAPI = false; // Experimental Host Component support.
|
|
2121
2227
|
|
|
2122
|
-
// Experimental
|
|
2123
|
-
var enableFundamentalAPI = false;
|
|
2228
|
+
var enableFundamentalAPI = false; // Experimental Scope support.
|
|
2124
2229
|
|
|
2125
|
-
// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
2126
|
-
var enableJSXTransformAPI = false;
|
|
2230
|
+
var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
2127
2231
|
|
|
2128
|
-
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
2232
|
+
var enableJSXTransformAPI = false; // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
2129
2233
|
// Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
|
|
2130
2234
|
|
|
2131
|
-
//
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
// For tests, we flush suspense fallbacks in an act scope;
|
|
2235
|
+
// For tests, we flush suspense fallbacks in an act scope;
|
|
2135
2236
|
// *except* in some of our own tests, where we test incremental loading states.
|
|
2136
2237
|
|
|
2137
|
-
|
|
2138
|
-
// Changes priority of some events like mousemove to user-blocking priority,
|
|
2238
|
+
// Changes priority of some events like mousemove to user-blocking priority,
|
|
2139
2239
|
// but without making them discrete. The flag exists in case it causes
|
|
2140
2240
|
// starvation problems.
|
|
2141
2241
|
|
|
2142
|
-
|
|
2143
|
-
// Add a callback property to suspense to notify which promises are currently
|
|
2242
|
+
// Add a callback property to suspense to notify which promises are currently
|
|
2144
2243
|
// in the update queue. This allows reporting and tracing of what is causing
|
|
2145
2244
|
// the user to see a loading state.
|
|
2245
|
+
// Also allows hydration callbacks to fire when a dehydrated boundary gets
|
|
2246
|
+
// hydrated or deleted.
|
|
2146
2247
|
|
|
2147
|
-
|
|
2148
|
-
// Part of the simplification of React.createElement so we can eventually move
|
|
2248
|
+
// Part of the simplification of React.createElement so we can eventually move
|
|
2149
2249
|
// from React.createElement to React.jsx
|
|
2150
2250
|
// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
|
|
2151
2251
|
|
|
@@ -2157,16 +2257,13 @@ var React = {
|
|
|
2157
2257
|
toArray: toArray,
|
|
2158
2258
|
only: onlyChild
|
|
2159
2259
|
},
|
|
2160
|
-
|
|
2161
2260
|
createRef: createRef,
|
|
2162
2261
|
Component: Component,
|
|
2163
2262
|
PureComponent: PureComponent,
|
|
2164
|
-
|
|
2165
2263
|
createContext: createContext,
|
|
2166
2264
|
forwardRef: forwardRef,
|
|
2167
2265
|
lazy: lazy,
|
|
2168
2266
|
memo: memo,
|
|
2169
|
-
|
|
2170
2267
|
useCallback: useCallback,
|
|
2171
2268
|
useContext: useContext,
|
|
2172
2269
|
useEffect: useEffect,
|
|
@@ -2177,22 +2274,17 @@ var React = {
|
|
|
2177
2274
|
useReducer: useReducer,
|
|
2178
2275
|
useRef: useRef,
|
|
2179
2276
|
useState: useState,
|
|
2180
|
-
|
|
2181
2277
|
Fragment: REACT_FRAGMENT_TYPE,
|
|
2182
2278
|
Profiler: REACT_PROFILER_TYPE,
|
|
2183
2279
|
StrictMode: REACT_STRICT_MODE_TYPE,
|
|
2184
2280
|
Suspense: REACT_SUSPENSE_TYPE,
|
|
2185
2281
|
unstable_SuspenseList: REACT_SUSPENSE_LIST_TYPE,
|
|
2186
|
-
|
|
2187
2282
|
createElement: createElementWithValidation,
|
|
2188
2283
|
cloneElement: cloneElementWithValidation,
|
|
2189
2284
|
createFactory: createFactoryWithValidation,
|
|
2190
2285
|
isValidElement: isValidElement,
|
|
2191
|
-
|
|
2192
2286
|
version: ReactVersion,
|
|
2193
|
-
|
|
2194
2287
|
unstable_withSuspenseConfig: withSuspenseConfig,
|
|
2195
|
-
|
|
2196
2288
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
2197
2289
|
};
|
|
2198
2290
|
|
|
@@ -2205,11 +2297,14 @@ if (enableFundamentalAPI) {
|
|
|
2205
2297
|
React.unstable_createFundamental = createFundamentalComponent;
|
|
2206
2298
|
}
|
|
2207
2299
|
|
|
2208
|
-
|
|
2300
|
+
if (enableScopeAPI) {
|
|
2301
|
+
React.unstable_createScope = createScope;
|
|
2302
|
+
} // Note: some APIs are added with feature flags.
|
|
2209
2303
|
// Make sure that stable builds for open source
|
|
2210
2304
|
// don't modify the React object to avoid deopts.
|
|
2211
2305
|
// Also let's not expose their names in stable builds.
|
|
2212
2306
|
|
|
2307
|
+
|
|
2213
2308
|
if (enableJSXTransformAPI) {
|
|
2214
2309
|
{
|
|
2215
2310
|
React.jsxDEV = jsxWithValidation;
|
|
@@ -2228,6 +2323,8 @@ var React$3 = ( React$2 && React ) || React$2;
|
|
|
2228
2323
|
|
|
2229
2324
|
// TODO: decide on the top-level export form.
|
|
2230
2325
|
// This is hacky but makes it work with both Rollup and Jest.
|
|
2326
|
+
|
|
2327
|
+
|
|
2231
2328
|
var react = React$3.default || React$3;
|
|
2232
2329
|
|
|
2233
2330
|
module.exports = react;
|