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