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