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