react 16.10.1 → 16.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +5 -5
- package/cjs/react.development.js +422 -842
- package/cjs/react.production.min.js +17 -17
- package/package.json +1 -1
- package/umd/react.development.js +2612 -3217
- package/umd/react.production.min.js +25 -26
- package/umd/react.profiling.min.js +32 -33
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"branch": "
|
|
3
|
-
"buildNumber": "
|
|
4
|
-
"checksum": "
|
|
5
|
-
"commit": "
|
|
2
|
+
"branch": "master",
|
|
3
|
+
"buildNumber": "91354",
|
|
4
|
+
"checksum": "b0ed8f5",
|
|
5
|
+
"commit": "d28bd2994",
|
|
6
6
|
"environment": "ci",
|
|
7
|
-
"reactVersion": "16.
|
|
7
|
+
"reactVersion": "16.12.0-d28bd2994"
|
|
8
8
|
}
|
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.13.0
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -18,9 +18,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
18
18
|
var _assign = require('object-assign');
|
|
19
19
|
var checkPropTypes = require('prop-types/checkPropTypes');
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var ReactVersion = '16.10.1';
|
|
21
|
+
var ReactVersion = '16.13.0';
|
|
24
22
|
|
|
25
23
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
26
24
|
// nor polyfill, then a plain number is used for performance.
|
|
@@ -32,15 +30,13 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac
|
|
|
32
30
|
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
33
31
|
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
34
32
|
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
|
-
|
|
37
|
-
|
|
38
33
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
39
34
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
40
35
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
41
36
|
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
42
37
|
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
43
38
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
39
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
44
40
|
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
45
41
|
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
46
42
|
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
@@ -60,121 +56,264 @@ function getIteratorFn(maybeIterable) {
|
|
|
60
56
|
return null;
|
|
61
57
|
}
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
59
|
+
/**
|
|
60
|
+
* Keeps track of the current dispatcher.
|
|
61
|
+
*/
|
|
62
|
+
var ReactCurrentDispatcher = {
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
* @type {ReactComponent}
|
|
66
|
+
*/
|
|
67
|
+
current: null
|
|
68
|
+
};
|
|
74
69
|
|
|
75
70
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
|
79
|
-
* to provide information about what broke and what you were
|
|
80
|
-
* expecting.
|
|
81
|
-
*
|
|
82
|
-
* The invariant message will be stripped in production, but the invariant
|
|
83
|
-
* will remain to ensure logic does not differ in production.
|
|
71
|
+
* Keeps track of the current batch's configuration such as how long an update
|
|
72
|
+
* should suspend for if it needs to.
|
|
84
73
|
*/
|
|
74
|
+
var ReactCurrentBatchConfig = {
|
|
75
|
+
suspense: null
|
|
76
|
+
};
|
|
85
77
|
|
|
86
78
|
/**
|
|
87
|
-
*
|
|
88
|
-
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
79
|
+
* Keeps track of the current owner.
|
|
89
80
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* This really simplifies the code.
|
|
93
|
-
* ---
|
|
94
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
95
|
-
* This can be used to log issues in development environments in critical
|
|
96
|
-
* paths. Removing the logging code for production environments will keep the
|
|
97
|
-
* same logic and follow the same code paths.
|
|
81
|
+
* The current owner is the component who should own any components that are
|
|
82
|
+
* currently being constructed.
|
|
98
83
|
*/
|
|
99
|
-
var
|
|
84
|
+
var ReactCurrentOwner = {
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
* @type {ReactComponent}
|
|
88
|
+
*/
|
|
89
|
+
current: null
|
|
90
|
+
};
|
|
100
91
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
92
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
93
|
+
function describeComponentFrame (name, source, ownerName) {
|
|
94
|
+
var sourceInfo = '';
|
|
95
|
+
|
|
96
|
+
if (source) {
|
|
97
|
+
var path = source.fileName;
|
|
98
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
99
|
+
|
|
100
|
+
{
|
|
101
|
+
// In DEV, include code for a common special case:
|
|
102
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
103
|
+
if (/^index\./.test(fileName)) {
|
|
104
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
105
|
+
|
|
106
|
+
if (match) {
|
|
107
|
+
var pathBeforeSlash = match[1];
|
|
108
|
+
|
|
109
|
+
if (pathBeforeSlash) {
|
|
110
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
111
|
+
fileName = folderName + '/' + fileName;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
105
115
|
}
|
|
106
116
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
118
|
+
} else if (ownerName) {
|
|
119
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
var Resolved = 1;
|
|
126
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
127
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
131
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
132
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function getComponentName(type) {
|
|
136
|
+
if (type == null) {
|
|
137
|
+
// Host root, text node or just invalid type.
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
111
140
|
|
|
112
|
-
|
|
113
|
-
|
|
141
|
+
{
|
|
142
|
+
if (typeof type.tag === 'number') {
|
|
143
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
114
144
|
}
|
|
145
|
+
}
|
|
115
146
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
147
|
+
if (typeof type === 'function') {
|
|
148
|
+
return type.displayName || type.name || null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (typeof type === 'string') {
|
|
152
|
+
return type;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
switch (type) {
|
|
156
|
+
case REACT_FRAGMENT_TYPE:
|
|
157
|
+
return 'Fragment';
|
|
158
|
+
|
|
159
|
+
case REACT_PORTAL_TYPE:
|
|
160
|
+
return 'Portal';
|
|
161
|
+
|
|
162
|
+
case REACT_PROFILER_TYPE:
|
|
163
|
+
return "Profiler";
|
|
164
|
+
|
|
165
|
+
case REACT_STRICT_MODE_TYPE:
|
|
166
|
+
return 'StrictMode';
|
|
167
|
+
|
|
168
|
+
case REACT_SUSPENSE_TYPE:
|
|
169
|
+
return 'Suspense';
|
|
170
|
+
|
|
171
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
172
|
+
return 'SuspenseList';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (typeof type === 'object') {
|
|
176
|
+
switch (type.$$typeof) {
|
|
177
|
+
case REACT_CONTEXT_TYPE:
|
|
178
|
+
return 'Context.Consumer';
|
|
179
|
+
|
|
180
|
+
case REACT_PROVIDER_TYPE:
|
|
181
|
+
return 'Context.Provider';
|
|
182
|
+
|
|
183
|
+
case REACT_FORWARD_REF_TYPE:
|
|
184
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
185
|
+
|
|
186
|
+
case REACT_MEMO_TYPE:
|
|
187
|
+
return getComponentName(type.type);
|
|
188
|
+
|
|
189
|
+
case REACT_BLOCK_TYPE:
|
|
190
|
+
return getComponentName(type.render);
|
|
191
|
+
|
|
192
|
+
case REACT_LAZY_TYPE:
|
|
193
|
+
{
|
|
194
|
+
var thenable = type;
|
|
195
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
196
|
+
|
|
197
|
+
if (resolvedThenable) {
|
|
198
|
+
return getComponentName(resolvedThenable);
|
|
199
|
+
}
|
|
123
200
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
127
203
|
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
var ReactDebugCurrentFrame = {};
|
|
210
|
+
var currentlyValidatingElement = null;
|
|
211
|
+
function setCurrentlyValidatingElement(element) {
|
|
212
|
+
{
|
|
213
|
+
currentlyValidatingElement = element;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
{
|
|
218
|
+
// Stack implementation injected by the current renderer.
|
|
219
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
220
|
+
|
|
221
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
222
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
|
223
|
+
|
|
224
|
+
if (currentlyValidatingElement) {
|
|
225
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
226
|
+
var owner = currentlyValidatingElement._owner;
|
|
227
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
228
|
+
} // Delegate to the injected renderer-specific implementation
|
|
128
229
|
|
|
129
|
-
if (!condition) {
|
|
130
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
131
|
-
args[_key2 - 2] = arguments[_key2];
|
|
132
|
-
}
|
|
133
230
|
|
|
134
|
-
|
|
231
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
232
|
+
|
|
233
|
+
if (impl) {
|
|
234
|
+
stack += impl() || '';
|
|
135
235
|
}
|
|
236
|
+
|
|
237
|
+
return stack;
|
|
136
238
|
};
|
|
137
239
|
}
|
|
138
240
|
|
|
139
|
-
var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
|
140
|
-
|
|
141
241
|
/**
|
|
142
|
-
*
|
|
143
|
-
* This can be used to log issues in development environments in critical
|
|
144
|
-
* paths. Removing the logging code for production environments will keep the
|
|
145
|
-
* same logic and follow the same code paths.
|
|
242
|
+
* Used by act() to track whether you're inside an act() scope.
|
|
146
243
|
*/
|
|
147
|
-
var
|
|
244
|
+
var IsSomeRendererActing = {
|
|
245
|
+
current: false
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
var ReactSharedInternals = {
|
|
249
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
250
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
251
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
252
|
+
IsSomeRendererActing: IsSomeRendererActing,
|
|
253
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
254
|
+
assign: _assign
|
|
255
|
+
};
|
|
148
256
|
|
|
149
257
|
{
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
258
|
+
_assign(ReactSharedInternals, {
|
|
259
|
+
// These should not be included in production.
|
|
260
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
261
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
262
|
+
// TODO: remove in React 17.0.
|
|
263
|
+
ReactComponentTreeHook: {}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
154
266
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
267
|
+
// by calls to these methods by a Babel plugin.
|
|
268
|
+
//
|
|
269
|
+
// In PROD (or in packages without access to React internals),
|
|
270
|
+
// they are left as they are instead.
|
|
158
271
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
272
|
+
function warn(format) {
|
|
273
|
+
{
|
|
274
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
275
|
+
args[_key - 1] = arguments[_key];
|
|
162
276
|
}
|
|
163
277
|
|
|
164
|
-
|
|
165
|
-
|
|
278
|
+
printWarning('warn', format, args);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function error(format) {
|
|
282
|
+
{
|
|
283
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
284
|
+
args[_key2 - 1] = arguments[_key2];
|
|
166
285
|
}
|
|
167
286
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
287
|
+
printWarning('error', format, args);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function printWarning(level, format, args) {
|
|
292
|
+
// When changing this logic, you might want to also
|
|
293
|
+
// update consoleWithStackDev.www.js as well.
|
|
294
|
+
{
|
|
295
|
+
var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
|
|
174
296
|
|
|
175
|
-
|
|
297
|
+
if (!hasExistingStack) {
|
|
298
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
299
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
300
|
+
|
|
301
|
+
if (stack !== '') {
|
|
302
|
+
format += '%s';
|
|
303
|
+
args = args.concat([stack]);
|
|
304
|
+
}
|
|
176
305
|
}
|
|
177
306
|
|
|
307
|
+
var argsWithFormat = args.map(function (item) {
|
|
308
|
+
return '' + item;
|
|
309
|
+
}); // Careful: RN currently depends on this prefix
|
|
310
|
+
|
|
311
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
312
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
313
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
314
|
+
|
|
315
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
316
|
+
|
|
178
317
|
try {
|
|
179
318
|
// --- Welcome to debugging React ---
|
|
180
319
|
// This error was thrown as a convenience so that you can use this stack
|
|
@@ -185,11 +324,9 @@ var warningWithoutStack = function () {};
|
|
|
185
324
|
});
|
|
186
325
|
throw new Error(message);
|
|
187
326
|
} catch (x) {}
|
|
188
|
-
}
|
|
327
|
+
}
|
|
189
328
|
}
|
|
190
329
|
|
|
191
|
-
var warningWithoutStack$1 = warningWithoutStack;
|
|
192
|
-
|
|
193
330
|
var didWarnStateUpdateForUnmountedComponent = {};
|
|
194
331
|
|
|
195
332
|
function warnNoop(publicInstance, callerName) {
|
|
@@ -202,7 +339,8 @@ function warnNoop(publicInstance, callerName) {
|
|
|
202
339
|
return;
|
|
203
340
|
}
|
|
204
341
|
|
|
205
|
-
|
|
342
|
+
error("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);
|
|
343
|
+
|
|
206
344
|
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
207
345
|
}
|
|
208
346
|
}
|
|
@@ -324,13 +462,11 @@ Component.prototype.isReactComponent = {};
|
|
|
324
462
|
*/
|
|
325
463
|
|
|
326
464
|
Component.prototype.setState = function (partialState, callback) {
|
|
327
|
-
(function
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
throw ReactError(Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."));
|
|
331
|
-
}
|
|
465
|
+
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
466
|
+
{
|
|
467
|
+
throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
|
|
332
468
|
}
|
|
333
|
-
}
|
|
469
|
+
}
|
|
334
470
|
|
|
335
471
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
336
472
|
};
|
|
@@ -369,7 +505,8 @@ Component.prototype.forceUpdate = function (callback) {
|
|
|
369
505
|
var defineDeprecationWarning = function (methodName, info) {
|
|
370
506
|
Object.defineProperty(Component.prototype, methodName, {
|
|
371
507
|
get: function () {
|
|
372
|
-
|
|
508
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
509
|
+
|
|
373
510
|
return undefined;
|
|
374
511
|
}
|
|
375
512
|
});
|
|
@@ -417,240 +554,6 @@ function createRef() {
|
|
|
417
554
|
return refObject;
|
|
418
555
|
}
|
|
419
556
|
|
|
420
|
-
/**
|
|
421
|
-
* Keeps track of the current dispatcher.
|
|
422
|
-
*/
|
|
423
|
-
var ReactCurrentDispatcher = {
|
|
424
|
-
/**
|
|
425
|
-
* @internal
|
|
426
|
-
* @type {ReactComponent}
|
|
427
|
-
*/
|
|
428
|
-
current: null
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Keeps track of the current batch's configuration such as how long an update
|
|
433
|
-
* should suspend for if it needs to.
|
|
434
|
-
*/
|
|
435
|
-
var ReactCurrentBatchConfig = {
|
|
436
|
-
suspense: null
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Keeps track of the current owner.
|
|
441
|
-
*
|
|
442
|
-
* The current owner is the component who should own any components that are
|
|
443
|
-
* currently being constructed.
|
|
444
|
-
*/
|
|
445
|
-
var ReactCurrentOwner = {
|
|
446
|
-
/**
|
|
447
|
-
* @internal
|
|
448
|
-
* @type {ReactComponent}
|
|
449
|
-
*/
|
|
450
|
-
current: null
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
454
|
-
var describeComponentFrame = function (name, source, ownerName) {
|
|
455
|
-
var sourceInfo = '';
|
|
456
|
-
|
|
457
|
-
if (source) {
|
|
458
|
-
var path = source.fileName;
|
|
459
|
-
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
460
|
-
|
|
461
|
-
{
|
|
462
|
-
// In DEV, include code for a common special case:
|
|
463
|
-
// prefer "folder/index.js" instead of just "index.js".
|
|
464
|
-
if (/^index\./.test(fileName)) {
|
|
465
|
-
var match = path.match(BEFORE_SLASH_RE);
|
|
466
|
-
|
|
467
|
-
if (match) {
|
|
468
|
-
var pathBeforeSlash = match[1];
|
|
469
|
-
|
|
470
|
-
if (pathBeforeSlash) {
|
|
471
|
-
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
472
|
-
fileName = folderName + '/' + fileName;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
479
|
-
} else if (ownerName) {
|
|
480
|
-
sourceInfo = ' (created by ' + ownerName + ')';
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
var Resolved = 1;
|
|
487
|
-
|
|
488
|
-
function refineResolvedLazyComponent(lazyComponent) {
|
|
489
|
-
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
493
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
494
|
-
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
function getComponentName(type) {
|
|
498
|
-
if (type == null) {
|
|
499
|
-
// Host root, text node or just invalid type.
|
|
500
|
-
return null;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
{
|
|
504
|
-
if (typeof type.tag === 'number') {
|
|
505
|
-
warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
if (typeof type === 'function') {
|
|
510
|
-
return type.displayName || type.name || null;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
if (typeof type === 'string') {
|
|
514
|
-
return type;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
switch (type) {
|
|
518
|
-
case REACT_FRAGMENT_TYPE:
|
|
519
|
-
return 'Fragment';
|
|
520
|
-
|
|
521
|
-
case REACT_PORTAL_TYPE:
|
|
522
|
-
return 'Portal';
|
|
523
|
-
|
|
524
|
-
case REACT_PROFILER_TYPE:
|
|
525
|
-
return "Profiler";
|
|
526
|
-
|
|
527
|
-
case REACT_STRICT_MODE_TYPE:
|
|
528
|
-
return 'StrictMode';
|
|
529
|
-
|
|
530
|
-
case REACT_SUSPENSE_TYPE:
|
|
531
|
-
return 'Suspense';
|
|
532
|
-
|
|
533
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
534
|
-
return 'SuspenseList';
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
if (typeof type === 'object') {
|
|
538
|
-
switch (type.$$typeof) {
|
|
539
|
-
case REACT_CONTEXT_TYPE:
|
|
540
|
-
return 'Context.Consumer';
|
|
541
|
-
|
|
542
|
-
case REACT_PROVIDER_TYPE:
|
|
543
|
-
return 'Context.Provider';
|
|
544
|
-
|
|
545
|
-
case REACT_FORWARD_REF_TYPE:
|
|
546
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
547
|
-
|
|
548
|
-
case REACT_MEMO_TYPE:
|
|
549
|
-
return getComponentName(type.type);
|
|
550
|
-
|
|
551
|
-
case REACT_LAZY_TYPE:
|
|
552
|
-
{
|
|
553
|
-
var thenable = type;
|
|
554
|
-
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
555
|
-
|
|
556
|
-
if (resolvedThenable) {
|
|
557
|
-
return getComponentName(resolvedThenable);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
break;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
return null;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
var ReactDebugCurrentFrame = {};
|
|
569
|
-
var currentlyValidatingElement = null;
|
|
570
|
-
function setCurrentlyValidatingElement(element) {
|
|
571
|
-
{
|
|
572
|
-
currentlyValidatingElement = element;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
{
|
|
577
|
-
// Stack implementation injected by the current renderer.
|
|
578
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
579
|
-
|
|
580
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
581
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
|
582
|
-
|
|
583
|
-
if (currentlyValidatingElement) {
|
|
584
|
-
var name = getComponentName(currentlyValidatingElement.type);
|
|
585
|
-
var owner = currentlyValidatingElement._owner;
|
|
586
|
-
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
587
|
-
} // Delegate to the injected renderer-specific implementation
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
591
|
-
|
|
592
|
-
if (impl) {
|
|
593
|
-
stack += impl() || '';
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
return stack;
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
/**
|
|
601
|
-
* Used by act() to track whether you're inside an act() scope.
|
|
602
|
-
*/
|
|
603
|
-
var IsSomeRendererActing = {
|
|
604
|
-
current: false
|
|
605
|
-
};
|
|
606
|
-
|
|
607
|
-
var ReactSharedInternals = {
|
|
608
|
-
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
609
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
610
|
-
ReactCurrentOwner: ReactCurrentOwner,
|
|
611
|
-
IsSomeRendererActing: IsSomeRendererActing,
|
|
612
|
-
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
613
|
-
assign: _assign
|
|
614
|
-
};
|
|
615
|
-
|
|
616
|
-
{
|
|
617
|
-
_assign(ReactSharedInternals, {
|
|
618
|
-
// These should not be included in production.
|
|
619
|
-
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
620
|
-
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
621
|
-
// TODO: remove in React 17.0.
|
|
622
|
-
ReactComponentTreeHook: {}
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
/**
|
|
627
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
628
|
-
* This can be used to log issues in development environments in critical
|
|
629
|
-
* paths. Removing the logging code for production environments will keep the
|
|
630
|
-
* same logic and follow the same code paths.
|
|
631
|
-
*/
|
|
632
|
-
|
|
633
|
-
var warning = warningWithoutStack$1;
|
|
634
|
-
|
|
635
|
-
{
|
|
636
|
-
warning = function (condition, format) {
|
|
637
|
-
if (condition) {
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
642
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
643
|
-
|
|
644
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
645
|
-
args[_key - 2] = arguments[_key];
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
|
|
649
|
-
};
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
var warning$1 = warning;
|
|
653
|
-
|
|
654
557
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
655
558
|
var RESERVED_PROPS = {
|
|
656
559
|
key: true,
|
|
@@ -658,8 +561,11 @@ var RESERVED_PROPS = {
|
|
|
658
561
|
__self: true,
|
|
659
562
|
__source: true
|
|
660
563
|
};
|
|
661
|
-
var specialPropKeyWarningShown;
|
|
662
|
-
|
|
564
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
565
|
+
|
|
566
|
+
{
|
|
567
|
+
didWarnAboutStringRefs = {};
|
|
568
|
+
}
|
|
663
569
|
|
|
664
570
|
function hasValidRef(config) {
|
|
665
571
|
{
|
|
@@ -691,9 +597,12 @@ function hasValidKey(config) {
|
|
|
691
597
|
|
|
692
598
|
function defineKeyPropWarningGetter(props, displayName) {
|
|
693
599
|
var warnAboutAccessingKey = function () {
|
|
694
|
-
|
|
695
|
-
specialPropKeyWarningShown
|
|
696
|
-
|
|
600
|
+
{
|
|
601
|
+
if (!specialPropKeyWarningShown) {
|
|
602
|
+
specialPropKeyWarningShown = true;
|
|
603
|
+
|
|
604
|
+
error('%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);
|
|
605
|
+
}
|
|
697
606
|
}
|
|
698
607
|
};
|
|
699
608
|
|
|
@@ -706,9 +615,12 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
706
615
|
|
|
707
616
|
function defineRefPropWarningGetter(props, displayName) {
|
|
708
617
|
var warnAboutAccessingRef = function () {
|
|
709
|
-
|
|
710
|
-
specialPropRefWarningShown
|
|
711
|
-
|
|
618
|
+
{
|
|
619
|
+
if (!specialPropRefWarningShown) {
|
|
620
|
+
specialPropRefWarningShown = true;
|
|
621
|
+
|
|
622
|
+
error('%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);
|
|
623
|
+
}
|
|
712
624
|
}
|
|
713
625
|
};
|
|
714
626
|
|
|
@@ -718,10 +630,24 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
718
630
|
configurable: true
|
|
719
631
|
});
|
|
720
632
|
}
|
|
633
|
+
|
|
634
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
635
|
+
{
|
|
636
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
637
|
+
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
638
|
+
|
|
639
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
640
|
+
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
|
|
641
|
+
|
|
642
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
721
647
|
/**
|
|
722
648
|
* Factory method to create a new React element. This no longer adheres to
|
|
723
|
-
* the class pattern, so do not use new to call it. Also,
|
|
724
|
-
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
649
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
650
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
725
651
|
* if something is a React Element.
|
|
726
652
|
*
|
|
727
653
|
* @param {*} type
|
|
@@ -793,78 +719,6 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
793
719
|
|
|
794
720
|
return element;
|
|
795
721
|
};
|
|
796
|
-
/**
|
|
797
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
798
|
-
* @param {*} type
|
|
799
|
-
* @param {object} props
|
|
800
|
-
* @param {string} key
|
|
801
|
-
*/
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
807
|
-
* @param {*} type
|
|
808
|
-
* @param {object} props
|
|
809
|
-
* @param {string} key
|
|
810
|
-
*/
|
|
811
|
-
|
|
812
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
813
|
-
var propName; // Reserved names are extracted
|
|
814
|
-
|
|
815
|
-
var props = {};
|
|
816
|
-
var key = null;
|
|
817
|
-
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
818
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
819
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
820
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
821
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
822
|
-
// key is explicitly declared to be undefined or not.
|
|
823
|
-
|
|
824
|
-
if (maybeKey !== undefined) {
|
|
825
|
-
key = '' + maybeKey;
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
if (hasValidKey(config)) {
|
|
829
|
-
key = '' + config.key;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
if (hasValidRef(config)) {
|
|
833
|
-
ref = config.ref;
|
|
834
|
-
} // Remaining properties are added to a new props object
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
for (propName in config) {
|
|
838
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
839
|
-
props[propName] = config[propName];
|
|
840
|
-
}
|
|
841
|
-
} // Resolve default props
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
if (type && type.defaultProps) {
|
|
845
|
-
var defaultProps = type.defaultProps;
|
|
846
|
-
|
|
847
|
-
for (propName in defaultProps) {
|
|
848
|
-
if (props[propName] === undefined) {
|
|
849
|
-
props[propName] = defaultProps[propName];
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
if (key || ref) {
|
|
855
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
856
|
-
|
|
857
|
-
if (key) {
|
|
858
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
if (ref) {
|
|
862
|
-
defineRefPropWarningGetter(props, displayName);
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
867
|
-
}
|
|
868
722
|
/**
|
|
869
723
|
* Create and return a new ReactElement of the given type.
|
|
870
724
|
* See https://reactjs.org/docs/react-api.html#createelement
|
|
@@ -882,6 +736,10 @@ function createElement(type, config, children) {
|
|
|
882
736
|
if (config != null) {
|
|
883
737
|
if (hasValidRef(config)) {
|
|
884
738
|
ref = config.ref;
|
|
739
|
+
|
|
740
|
+
{
|
|
741
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
|
742
|
+
}
|
|
885
743
|
}
|
|
886
744
|
|
|
887
745
|
if (hasValidKey(config)) {
|
|
@@ -947,12 +805,6 @@ function createElement(type, config, children) {
|
|
|
947
805
|
|
|
948
806
|
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
949
807
|
}
|
|
950
|
-
/**
|
|
951
|
-
* Return a function that produces ReactElements of a given type.
|
|
952
|
-
* See https://reactjs.org/docs/react-api.html#createfactory
|
|
953
|
-
*/
|
|
954
|
-
|
|
955
|
-
|
|
956
808
|
function cloneAndReplaceKey(oldElement, newKey) {
|
|
957
809
|
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
958
810
|
return newElement;
|
|
@@ -963,13 +815,11 @@ function cloneAndReplaceKey(oldElement, newKey) {
|
|
|
963
815
|
*/
|
|
964
816
|
|
|
965
817
|
function cloneElement(element, config, children) {
|
|
966
|
-
(
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
throw ReactError(Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."));
|
|
970
|
-
}
|
|
818
|
+
if (!!(element === null || element === undefined)) {
|
|
819
|
+
{
|
|
820
|
+
throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
|
|
971
821
|
}
|
|
972
|
-
}
|
|
822
|
+
}
|
|
973
823
|
|
|
974
824
|
var propName; // Original props are copied
|
|
975
825
|
|
|
@@ -1176,10 +1026,14 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1176
1026
|
var iteratorFn = getIteratorFn(children);
|
|
1177
1027
|
|
|
1178
1028
|
if (typeof iteratorFn === 'function') {
|
|
1029
|
+
|
|
1179
1030
|
{
|
|
1180
1031
|
// Warn about using Maps as children
|
|
1181
1032
|
if (iteratorFn === children.entries) {
|
|
1182
|
-
!didWarnAboutMaps
|
|
1033
|
+
if (!didWarnAboutMaps) {
|
|
1034
|
+
warn('Using Maps as children is deprecated and will be removed in ' + 'a future major release. Consider converting children to ' + 'an array of keyed ReactElements instead.');
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1183
1037
|
didWarnAboutMaps = true;
|
|
1184
1038
|
}
|
|
1185
1039
|
}
|
|
@@ -1202,13 +1056,11 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1202
1056
|
|
|
1203
1057
|
var childrenString = '' + children;
|
|
1204
1058
|
|
|
1205
|
-
|
|
1059
|
+
{
|
|
1206
1060
|
{
|
|
1207
|
-
{
|
|
1208
|
-
throw ReactError(Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum));
|
|
1209
|
-
}
|
|
1061
|
+
throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum );
|
|
1210
1062
|
}
|
|
1211
|
-
}
|
|
1063
|
+
}
|
|
1212
1064
|
}
|
|
1213
1065
|
}
|
|
1214
1066
|
|
|
@@ -1394,13 +1246,11 @@ function toArray(children) {
|
|
|
1394
1246
|
|
|
1395
1247
|
|
|
1396
1248
|
function onlyChild(children) {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
throw ReactError(Error("React.Children.only expected to receive a single React element child."));
|
|
1401
|
-
}
|
|
1249
|
+
if (!isValidElement(children)) {
|
|
1250
|
+
{
|
|
1251
|
+
throw Error( "React.Children.only expected to receive a single React element child." );
|
|
1402
1252
|
}
|
|
1403
|
-
}
|
|
1253
|
+
}
|
|
1404
1254
|
|
|
1405
1255
|
return children;
|
|
1406
1256
|
}
|
|
@@ -1410,7 +1260,9 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1410
1260
|
calculateChangedBits = null;
|
|
1411
1261
|
} else {
|
|
1412
1262
|
{
|
|
1413
|
-
|
|
1263
|
+
if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
|
|
1264
|
+
error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
|
|
1265
|
+
}
|
|
1414
1266
|
}
|
|
1415
1267
|
}
|
|
1416
1268
|
|
|
@@ -1453,7 +1305,8 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1453
1305
|
get: function () {
|
|
1454
1306
|
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1455
1307
|
hasWarnedAboutUsingConsumerProvider = true;
|
|
1456
|
-
|
|
1308
|
+
|
|
1309
|
+
error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
|
1457
1310
|
}
|
|
1458
1311
|
|
|
1459
1312
|
return context.Provider;
|
|
@@ -1490,7 +1343,8 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1490
1343
|
get: function () {
|
|
1491
1344
|
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1492
1345
|
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1493
|
-
|
|
1346
|
+
|
|
1347
|
+
error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
|
1494
1348
|
}
|
|
1495
1349
|
|
|
1496
1350
|
return context.Consumer;
|
|
@@ -1529,7 +1383,8 @@ function lazy(ctor) {
|
|
|
1529
1383
|
return defaultProps;
|
|
1530
1384
|
},
|
|
1531
1385
|
set: function (newDefaultProps) {
|
|
1532
|
-
|
|
1386
|
+
error('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.');
|
|
1387
|
+
|
|
1533
1388
|
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1534
1389
|
|
|
1535
1390
|
Object.defineProperty(lazyType, 'defaultProps', {
|
|
@@ -1543,7 +1398,8 @@ function lazy(ctor) {
|
|
|
1543
1398
|
return propTypes;
|
|
1544
1399
|
},
|
|
1545
1400
|
set: function (newPropTypes) {
|
|
1546
|
-
|
|
1401
|
+
error('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.');
|
|
1402
|
+
|
|
1547
1403
|
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1548
1404
|
|
|
1549
1405
|
Object.defineProperty(lazyType, 'propTypes', {
|
|
@@ -1560,16 +1416,19 @@ function lazy(ctor) {
|
|
|
1560
1416
|
function forwardRef(render) {
|
|
1561
1417
|
{
|
|
1562
1418
|
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1563
|
-
|
|
1419
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1564
1420
|
} else if (typeof render !== 'function') {
|
|
1565
|
-
|
|
1421
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1566
1422
|
} else {
|
|
1567
|
-
|
|
1568
|
-
|
|
1423
|
+
if (render.length !== 0 && render.length !== 2) {
|
|
1424
|
+
error('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.');
|
|
1425
|
+
}
|
|
1569
1426
|
}
|
|
1570
1427
|
|
|
1571
1428
|
if (render != null) {
|
|
1572
|
-
|
|
1429
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
|
1430
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1431
|
+
}
|
|
1573
1432
|
}
|
|
1574
1433
|
}
|
|
1575
1434
|
|
|
@@ -1581,13 +1440,13 @@ function forwardRef(render) {
|
|
|
1581
1440
|
|
|
1582
1441
|
function isValidElementType(type) {
|
|
1583
1442
|
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1584
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE);
|
|
1443
|
+
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 || type.$$typeof === REACT_BLOCK_TYPE);
|
|
1585
1444
|
}
|
|
1586
1445
|
|
|
1587
1446
|
function memo(type, compare) {
|
|
1588
1447
|
{
|
|
1589
1448
|
if (!isValidElementType(type)) {
|
|
1590
|
-
|
|
1449
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1591
1450
|
}
|
|
1592
1451
|
}
|
|
1593
1452
|
|
|
@@ -1601,13 +1460,11 @@ function memo(type, compare) {
|
|
|
1601
1460
|
function resolveDispatcher() {
|
|
1602
1461
|
var dispatcher = ReactCurrentDispatcher.current;
|
|
1603
1462
|
|
|
1604
|
-
(
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
throw ReactError(Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."));
|
|
1608
|
-
}
|
|
1463
|
+
if (!(dispatcher !== null)) {
|
|
1464
|
+
{
|
|
1465
|
+
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." );
|
|
1609
1466
|
}
|
|
1610
|
-
}
|
|
1467
|
+
}
|
|
1611
1468
|
|
|
1612
1469
|
return dispatcher;
|
|
1613
1470
|
}
|
|
@@ -1616,16 +1473,19 @@ function useContext(Context, unstable_observedBits) {
|
|
|
1616
1473
|
var dispatcher = resolveDispatcher();
|
|
1617
1474
|
|
|
1618
1475
|
{
|
|
1619
|
-
|
|
1476
|
+
if (unstable_observedBits !== undefined) {
|
|
1477
|
+
error('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' : '');
|
|
1478
|
+
} // TODO: add a more generic warning for invalid values.
|
|
1479
|
+
|
|
1620
1480
|
|
|
1621
1481
|
if (Context._context !== undefined) {
|
|
1622
1482
|
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1623
1483
|
// and nobody should be using this in existing code.
|
|
1624
1484
|
|
|
1625
1485
|
if (realContext.Consumer === Context) {
|
|
1626
|
-
|
|
1486
|
+
error('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?');
|
|
1627
1487
|
} else if (realContext.Provider === Context) {
|
|
1628
|
-
|
|
1488
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1629
1489
|
}
|
|
1630
1490
|
}
|
|
1631
1491
|
}
|
|
@@ -1644,25 +1504,25 @@ function useRef(initialValue) {
|
|
|
1644
1504
|
var dispatcher = resolveDispatcher();
|
|
1645
1505
|
return dispatcher.useRef(initialValue);
|
|
1646
1506
|
}
|
|
1647
|
-
function useEffect(create,
|
|
1507
|
+
function useEffect(create, deps) {
|
|
1648
1508
|
var dispatcher = resolveDispatcher();
|
|
1649
|
-
return dispatcher.useEffect(create,
|
|
1509
|
+
return dispatcher.useEffect(create, deps);
|
|
1650
1510
|
}
|
|
1651
|
-
function useLayoutEffect(create,
|
|
1511
|
+
function useLayoutEffect(create, deps) {
|
|
1652
1512
|
var dispatcher = resolveDispatcher();
|
|
1653
|
-
return dispatcher.useLayoutEffect(create,
|
|
1513
|
+
return dispatcher.useLayoutEffect(create, deps);
|
|
1654
1514
|
}
|
|
1655
|
-
function useCallback(callback,
|
|
1515
|
+
function useCallback(callback, deps) {
|
|
1656
1516
|
var dispatcher = resolveDispatcher();
|
|
1657
|
-
return dispatcher.useCallback(callback,
|
|
1517
|
+
return dispatcher.useCallback(callback, deps);
|
|
1658
1518
|
}
|
|
1659
|
-
function useMemo(create,
|
|
1519
|
+
function useMemo(create, deps) {
|
|
1660
1520
|
var dispatcher = resolveDispatcher();
|
|
1661
|
-
return dispatcher.useMemo(create,
|
|
1521
|
+
return dispatcher.useMemo(create, deps);
|
|
1662
1522
|
}
|
|
1663
|
-
function useImperativeHandle(ref, create,
|
|
1523
|
+
function useImperativeHandle(ref, create, deps) {
|
|
1664
1524
|
var dispatcher = resolveDispatcher();
|
|
1665
|
-
return dispatcher.useImperativeHandle(ref, create,
|
|
1525
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1666
1526
|
}
|
|
1667
1527
|
function useDebugValue(value, formatterFn) {
|
|
1668
1528
|
{
|
|
@@ -1670,45 +1530,13 @@ function useDebugValue(value, formatterFn) {
|
|
|
1670
1530
|
return dispatcher.useDebugValue(value, formatterFn);
|
|
1671
1531
|
}
|
|
1672
1532
|
}
|
|
1673
|
-
var emptyObject$1 = {};
|
|
1674
|
-
function useResponder(responder, listenerProps) {
|
|
1675
|
-
var dispatcher = resolveDispatcher();
|
|
1676
|
-
|
|
1677
|
-
{
|
|
1678
|
-
if (responder == null || responder.$$typeof !== REACT_RESPONDER_TYPE) {
|
|
1679
|
-
warning$1(false, 'useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
|
|
1680
|
-
return;
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
return dispatcher.useResponder(responder, listenerProps || emptyObject$1);
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
function withSuspenseConfig(scope, config) {
|
|
1688
|
-
var previousConfig = ReactCurrentBatchConfig.suspense;
|
|
1689
|
-
ReactCurrentBatchConfig.suspense = config === undefined ? null : config;
|
|
1690
|
-
|
|
1691
|
-
try {
|
|
1692
|
-
scope();
|
|
1693
|
-
} finally {
|
|
1694
|
-
ReactCurrentBatchConfig.suspense = previousConfig;
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
1533
|
|
|
1698
|
-
/**
|
|
1699
|
-
* ReactElementValidator provides a wrapper around a element factory
|
|
1700
|
-
* which validates the props passed to the element. This is intended to be
|
|
1701
|
-
* used only in DEV and could be replaced by a static type checker for languages
|
|
1702
|
-
* that support it.
|
|
1703
|
-
*/
|
|
1704
1534
|
var propTypesMisspellWarningShown;
|
|
1705
1535
|
|
|
1706
1536
|
{
|
|
1707
1537
|
propTypesMisspellWarningShown = false;
|
|
1708
1538
|
}
|
|
1709
1539
|
|
|
1710
|
-
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
1711
|
-
|
|
1712
1540
|
function getDeclarationErrorAddendum() {
|
|
1713
1541
|
if (ReactCurrentOwner.current) {
|
|
1714
1542
|
var name = getComponentName(ReactCurrentOwner.current.type);
|
|
@@ -1799,7 +1627,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
1799
1627
|
setCurrentlyValidatingElement(element);
|
|
1800
1628
|
|
|
1801
1629
|
{
|
|
1802
|
-
|
|
1630
|
+
error('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);
|
|
1803
1631
|
}
|
|
1804
1632
|
|
|
1805
1633
|
setCurrentlyValidatingElement(null);
|
|
@@ -1861,36 +1689,39 @@ function validateChildKeys(node, parentType) {
|
|
|
1861
1689
|
|
|
1862
1690
|
|
|
1863
1691
|
function validatePropTypes(element) {
|
|
1864
|
-
|
|
1692
|
+
{
|
|
1693
|
+
var type = element.type;
|
|
1865
1694
|
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1695
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
var name = getComponentName(type);
|
|
1700
|
+
var propTypes;
|
|
1869
1701
|
|
|
1870
|
-
|
|
1871
|
-
|
|
1702
|
+
if (typeof type === 'function') {
|
|
1703
|
+
propTypes = type.propTypes;
|
|
1704
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1705
|
+
// Inner props are checked in the reconciler.
|
|
1706
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1707
|
+
propTypes = type.propTypes;
|
|
1708
|
+
} else {
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1872
1711
|
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
} else {
|
|
1880
|
-
return;
|
|
1881
|
-
}
|
|
1712
|
+
if (propTypes) {
|
|
1713
|
+
setCurrentlyValidatingElement(element);
|
|
1714
|
+
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
1715
|
+
setCurrentlyValidatingElement(null);
|
|
1716
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1717
|
+
propTypesMisspellWarningShown = true;
|
|
1882
1718
|
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
1886
|
-
setCurrentlyValidatingElement(null);
|
|
1887
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1888
|
-
propTypesMisspellWarningShown = true;
|
|
1889
|
-
warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1890
|
-
}
|
|
1719
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1720
|
+
}
|
|
1891
1721
|
|
|
1892
|
-
|
|
1893
|
-
|
|
1722
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1723
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1724
|
+
}
|
|
1894
1725
|
}
|
|
1895
1726
|
}
|
|
1896
1727
|
/**
|
|
@@ -1900,115 +1731,26 @@ function validatePropTypes(element) {
|
|
|
1900
1731
|
|
|
1901
1732
|
|
|
1902
1733
|
function validateFragmentProps(fragment) {
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1907
|
-
var key = keys[i];
|
|
1908
|
-
|
|
1909
|
-
if (key !== 'children' && key !== 'key') {
|
|
1910
|
-
warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1911
|
-
break;
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
|
|
1915
|
-
if (fragment.ref !== null) {
|
|
1916
|
-
warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
setCurrentlyValidatingElement(null);
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1923
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1924
|
-
// succeed and there will likely be errors in render.
|
|
1925
|
-
|
|
1926
|
-
if (!validType) {
|
|
1927
|
-
var info = '';
|
|
1928
|
-
|
|
1929
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1930
|
-
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1931
|
-
}
|
|
1932
|
-
|
|
1933
|
-
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
1934
|
-
|
|
1935
|
-
if (sourceInfo) {
|
|
1936
|
-
info += sourceInfo;
|
|
1937
|
-
} else {
|
|
1938
|
-
info += getDeclarationErrorAddendum();
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
var typeString;
|
|
1942
|
-
|
|
1943
|
-
if (type === null) {
|
|
1944
|
-
typeString = 'null';
|
|
1945
|
-
} else if (Array.isArray(type)) {
|
|
1946
|
-
typeString = 'array';
|
|
1947
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1948
|
-
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
1949
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1950
|
-
} else {
|
|
1951
|
-
typeString = typeof type;
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
warning$1(false, 'React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1958
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1959
|
-
|
|
1960
|
-
if (element == null) {
|
|
1961
|
-
return element;
|
|
1962
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1963
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1964
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
1965
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1966
|
-
// fixed, the key warnings will appear.)
|
|
1967
|
-
|
|
1734
|
+
{
|
|
1735
|
+
setCurrentlyValidatingElement(fragment);
|
|
1736
|
+
var keys = Object.keys(fragment.props);
|
|
1968
1737
|
|
|
1969
|
-
|
|
1970
|
-
|
|
1738
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1739
|
+
var key = keys[i];
|
|
1971
1740
|
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
if (Array.isArray(children)) {
|
|
1975
|
-
for (var i = 0; i < children.length; i++) {
|
|
1976
|
-
validateChildKeys(children[i], type);
|
|
1977
|
-
}
|
|
1741
|
+
if (key !== 'children' && key !== 'key') {
|
|
1742
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1978
1743
|
|
|
1979
|
-
|
|
1980
|
-
Object.freeze(children);
|
|
1981
|
-
}
|
|
1982
|
-
} else {
|
|
1983
|
-
warning$1(false, 'React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
1984
|
-
}
|
|
1985
|
-
} else {
|
|
1986
|
-
validateChildKeys(children, type);
|
|
1744
|
+
break;
|
|
1987
1745
|
}
|
|
1988
1746
|
}
|
|
1989
|
-
}
|
|
1990
1747
|
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1748
|
+
if (fragment.ref !== null) {
|
|
1749
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1750
|
+
}
|
|
1994
1751
|
|
|
1995
|
-
|
|
1996
|
-
validateFragmentProps(element);
|
|
1997
|
-
} else {
|
|
1998
|
-
validatePropTypes(element);
|
|
1752
|
+
setCurrentlyValidatingElement(null);
|
|
1999
1753
|
}
|
|
2000
|
-
|
|
2001
|
-
return element;
|
|
2002
|
-
} // These two functions exist to still get child warnings in dev
|
|
2003
|
-
// even with the prod transform. This means that jsxDEV is purely
|
|
2004
|
-
// opt-in behavior for better messages but that we won't stop
|
|
2005
|
-
// giving you warnings if you use production apis.
|
|
2006
|
-
|
|
2007
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
2008
|
-
return jsxWithValidation(type, props, key, true);
|
|
2009
|
-
}
|
|
2010
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
2011
|
-
return jsxWithValidation(type, props, key, false);
|
|
2012
1754
|
}
|
|
2013
1755
|
function createElementWithValidation(type, props, children) {
|
|
2014
1756
|
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
@@ -2042,7 +1784,9 @@ function createElementWithValidation(type, props, children) {
|
|
|
2042
1784
|
typeString = typeof type;
|
|
2043
1785
|
}
|
|
2044
1786
|
|
|
2045
|
-
|
|
1787
|
+
{
|
|
1788
|
+
error('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);
|
|
1789
|
+
}
|
|
2046
1790
|
}
|
|
2047
1791
|
|
|
2048
1792
|
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
@@ -2071,15 +1815,24 @@ function createElementWithValidation(type, props, children) {
|
|
|
2071
1815
|
|
|
2072
1816
|
return element;
|
|
2073
1817
|
}
|
|
1818
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
|
2074
1819
|
function createFactoryWithValidation(type) {
|
|
2075
1820
|
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2076
|
-
validatedFactory.type = type;
|
|
1821
|
+
validatedFactory.type = type;
|
|
2077
1822
|
|
|
2078
1823
|
{
|
|
1824
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
1825
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
|
1826
|
+
|
|
1827
|
+
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
1828
|
+
} // Legacy hook: remove it
|
|
1829
|
+
|
|
1830
|
+
|
|
2079
1831
|
Object.defineProperty(validatedFactory, 'type', {
|
|
2080
1832
|
enumerable: false,
|
|
2081
1833
|
get: function () {
|
|
2082
|
-
|
|
1834
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
1835
|
+
|
|
2083
1836
|
Object.defineProperty(this, 'type', {
|
|
2084
1837
|
value: type
|
|
2085
1838
|
});
|
|
@@ -2101,10 +1854,7 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
2101
1854
|
return newElement;
|
|
2102
1855
|
}
|
|
2103
1856
|
|
|
2104
|
-
var hasBadMapPolyfill;
|
|
2105
|
-
|
|
2106
1857
|
{
|
|
2107
|
-
hasBadMapPolyfill = false;
|
|
2108
1858
|
|
|
2109
1859
|
try {
|
|
2110
1860
|
var frozenObject = Object.freeze({});
|
|
@@ -2116,217 +1866,47 @@ var hasBadMapPolyfill;
|
|
|
2116
1866
|
testMap.set(0, 0);
|
|
2117
1867
|
testSet.add(0);
|
|
2118
1868
|
} catch (e) {
|
|
2119
|
-
// TODO: Consider warning about bad polyfills
|
|
2120
|
-
hasBadMapPolyfill = true;
|
|
2121
|
-
}
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
function createFundamentalComponent(impl) {
|
|
2125
|
-
// We use responder as a Map key later on. When we have a bad
|
|
2126
|
-
// polyfill, then we can't use it as a key as the polyfill tries
|
|
2127
|
-
// to add a property to the object.
|
|
2128
|
-
if (true && !hasBadMapPolyfill) {
|
|
2129
|
-
Object.freeze(impl);
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
|
-
var fundamantalComponent = {
|
|
2133
|
-
$$typeof: REACT_FUNDAMENTAL_TYPE,
|
|
2134
|
-
impl: impl
|
|
2135
|
-
};
|
|
2136
|
-
|
|
2137
|
-
{
|
|
2138
|
-
Object.freeze(fundamantalComponent);
|
|
2139
|
-
}
|
|
2140
|
-
|
|
2141
|
-
return fundamantalComponent;
|
|
2142
|
-
}
|
|
2143
|
-
|
|
2144
|
-
function createEventResponder(displayName, responderConfig) {
|
|
2145
|
-
var getInitialState = responderConfig.getInitialState,
|
|
2146
|
-
onEvent = responderConfig.onEvent,
|
|
2147
|
-
onMount = responderConfig.onMount,
|
|
2148
|
-
onUnmount = responderConfig.onUnmount,
|
|
2149
|
-
onRootEvent = responderConfig.onRootEvent,
|
|
2150
|
-
rootEventTypes = responderConfig.rootEventTypes,
|
|
2151
|
-
targetEventTypes = responderConfig.targetEventTypes,
|
|
2152
|
-
targetPortalPropagation = responderConfig.targetPortalPropagation;
|
|
2153
|
-
var eventResponder = {
|
|
2154
|
-
$$typeof: REACT_RESPONDER_TYPE,
|
|
2155
|
-
displayName: displayName,
|
|
2156
|
-
getInitialState: getInitialState || null,
|
|
2157
|
-
onEvent: onEvent || null,
|
|
2158
|
-
onMount: onMount || null,
|
|
2159
|
-
onRootEvent: onRootEvent || null,
|
|
2160
|
-
onUnmount: onUnmount || null,
|
|
2161
|
-
rootEventTypes: rootEventTypes || null,
|
|
2162
|
-
targetEventTypes: targetEventTypes || null,
|
|
2163
|
-
targetPortalPropagation: targetPortalPropagation || false
|
|
2164
|
-
}; // We use responder as a Map key later on. When we have a bad
|
|
2165
|
-
// polyfill, then we can't use it as a key as the polyfill tries
|
|
2166
|
-
// to add a property to the object.
|
|
2167
|
-
|
|
2168
|
-
if (true && !hasBadMapPolyfill) {
|
|
2169
|
-
Object.freeze(eventResponder);
|
|
2170
|
-
}
|
|
2171
|
-
|
|
2172
|
-
return eventResponder;
|
|
2173
|
-
}
|
|
2174
|
-
|
|
2175
|
-
function createScope(fn) {
|
|
2176
|
-
var scopeComponent = {
|
|
2177
|
-
$$typeof: REACT_SCOPE_TYPE,
|
|
2178
|
-
fn: fn
|
|
2179
|
-
};
|
|
2180
|
-
|
|
2181
|
-
{
|
|
2182
|
-
Object.freeze(scopeComponent);
|
|
2183
1869
|
}
|
|
2184
|
-
|
|
2185
|
-
return scopeComponent;
|
|
2186
1870
|
}
|
|
2187
1871
|
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
2199
|
-
|
|
2200
|
-
// Gather advanced timing metrics for Profiler subtrees.
|
|
2201
|
-
|
|
2202
|
-
// Trace which interactions trigger each commit.
|
|
2203
|
-
|
|
2204
|
-
// Only used in www builds.
|
|
2205
|
-
|
|
2206
|
-
// TODO: true? Here it might just be false.
|
|
2207
|
-
|
|
2208
|
-
// Only used in www builds.
|
|
2209
|
-
|
|
2210
|
-
// Only used in www builds.
|
|
2211
|
-
|
|
2212
|
-
// Disable javascript: URL strings in href for XSS protection.
|
|
2213
|
-
|
|
2214
|
-
// React Fire: prevent the value and checked attributes from syncing
|
|
2215
|
-
// with their related DOM properties
|
|
2216
|
-
|
|
2217
|
-
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
2218
|
-
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
2222
|
-
// This is a flag so we can fix warnings in RN core before turning it on
|
|
2223
|
-
|
|
2224
|
-
// Experimental React Flare event system and event components support.
|
|
2225
|
-
|
|
2226
|
-
var enableFlareAPI = false; // Experimental Host Component support.
|
|
2227
|
-
|
|
2228
|
-
var enableFundamentalAPI = false; // Experimental Scope support.
|
|
2229
|
-
|
|
2230
|
-
var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
2231
|
-
|
|
2232
|
-
var enableJSXTransformAPI = false; // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
2233
|
-
// Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
|
|
2234
|
-
|
|
2235
|
-
// For tests, we flush suspense fallbacks in an act scope;
|
|
2236
|
-
// *except* in some of our own tests, where we test incremental loading states.
|
|
2237
|
-
|
|
2238
|
-
// Changes priority of some events like mousemove to user-blocking priority,
|
|
2239
|
-
// but without making them discrete. The flag exists in case it causes
|
|
2240
|
-
// starvation problems.
|
|
2241
|
-
|
|
2242
|
-
// Add a callback property to suspense to notify which promises are currently
|
|
2243
|
-
// in the update queue. This allows reporting and tracing of what is causing
|
|
2244
|
-
// the user to see a loading state.
|
|
2245
|
-
// Also allows hydration callbacks to fire when a dehydrated boundary gets
|
|
2246
|
-
// hydrated or deleted.
|
|
2247
|
-
|
|
2248
|
-
// Part of the simplification of React.createElement so we can eventually move
|
|
2249
|
-
// from React.createElement to React.jsx
|
|
2250
|
-
// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
|
|
2251
|
-
|
|
2252
|
-
var React = {
|
|
2253
|
-
Children: {
|
|
2254
|
-
map: mapChildren,
|
|
2255
|
-
forEach: forEachChildren,
|
|
2256
|
-
count: countChildren,
|
|
2257
|
-
toArray: toArray,
|
|
2258
|
-
only: onlyChild
|
|
2259
|
-
},
|
|
2260
|
-
createRef: createRef,
|
|
2261
|
-
Component: Component,
|
|
2262
|
-
PureComponent: PureComponent,
|
|
2263
|
-
createContext: createContext,
|
|
2264
|
-
forwardRef: forwardRef,
|
|
2265
|
-
lazy: lazy,
|
|
2266
|
-
memo: memo,
|
|
2267
|
-
useCallback: useCallback,
|
|
2268
|
-
useContext: useContext,
|
|
2269
|
-
useEffect: useEffect,
|
|
2270
|
-
useImperativeHandle: useImperativeHandle,
|
|
2271
|
-
useDebugValue: useDebugValue,
|
|
2272
|
-
useLayoutEffect: useLayoutEffect,
|
|
2273
|
-
useMemo: useMemo,
|
|
2274
|
-
useReducer: useReducer,
|
|
2275
|
-
useRef: useRef,
|
|
2276
|
-
useState: useState,
|
|
2277
|
-
Fragment: REACT_FRAGMENT_TYPE,
|
|
2278
|
-
Profiler: REACT_PROFILER_TYPE,
|
|
2279
|
-
StrictMode: REACT_STRICT_MODE_TYPE,
|
|
2280
|
-
Suspense: REACT_SUSPENSE_TYPE,
|
|
2281
|
-
unstable_SuspenseList: REACT_SUSPENSE_LIST_TYPE,
|
|
2282
|
-
createElement: createElementWithValidation,
|
|
2283
|
-
cloneElement: cloneElementWithValidation,
|
|
2284
|
-
createFactory: createFactoryWithValidation,
|
|
2285
|
-
isValidElement: isValidElement,
|
|
2286
|
-
version: ReactVersion,
|
|
2287
|
-
unstable_withSuspenseConfig: withSuspenseConfig,
|
|
2288
|
-
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
1872
|
+
var createElement$1 = createElementWithValidation ;
|
|
1873
|
+
var cloneElement$1 = cloneElementWithValidation ;
|
|
1874
|
+
var createFactory = createFactoryWithValidation ;
|
|
1875
|
+
var Children = {
|
|
1876
|
+
map: mapChildren,
|
|
1877
|
+
forEach: forEachChildren,
|
|
1878
|
+
count: countChildren,
|
|
1879
|
+
toArray: toArray,
|
|
1880
|
+
only: onlyChild
|
|
2289
1881
|
};
|
|
2290
1882
|
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
default: React
|
|
2320
|
-
});
|
|
2321
|
-
|
|
2322
|
-
var React$3 = ( React$2 && React ) || React$2;
|
|
2323
|
-
|
|
2324
|
-
// TODO: decide on the top-level export form.
|
|
2325
|
-
// This is hacky but makes it work with both Rollup and Jest.
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
var react = React$3.default || React$3;
|
|
2329
|
-
|
|
2330
|
-
module.exports = react;
|
|
1883
|
+
exports.Children = Children;
|
|
1884
|
+
exports.Component = Component;
|
|
1885
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
1886
|
+
exports.Profiler = REACT_PROFILER_TYPE;
|
|
1887
|
+
exports.PureComponent = PureComponent;
|
|
1888
|
+
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1889
|
+
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
1890
|
+
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
1891
|
+
exports.cloneElement = cloneElement$1;
|
|
1892
|
+
exports.createContext = createContext;
|
|
1893
|
+
exports.createElement = createElement$1;
|
|
1894
|
+
exports.createFactory = createFactory;
|
|
1895
|
+
exports.createRef = createRef;
|
|
1896
|
+
exports.forwardRef = forwardRef;
|
|
1897
|
+
exports.isValidElement = isValidElement;
|
|
1898
|
+
exports.lazy = lazy;
|
|
1899
|
+
exports.memo = memo;
|
|
1900
|
+
exports.useCallback = useCallback;
|
|
1901
|
+
exports.useContext = useContext;
|
|
1902
|
+
exports.useDebugValue = useDebugValue;
|
|
1903
|
+
exports.useEffect = useEffect;
|
|
1904
|
+
exports.useImperativeHandle = useImperativeHandle;
|
|
1905
|
+
exports.useLayoutEffect = useLayoutEffect;
|
|
1906
|
+
exports.useMemo = useMemo;
|
|
1907
|
+
exports.useReducer = useReducer;
|
|
1908
|
+
exports.useRef = useRef;
|
|
1909
|
+
exports.useState = useState;
|
|
1910
|
+
exports.version = ReactVersion;
|
|
2331
1911
|
})();
|
|
2332
1912
|
}
|