react 0.0.0-experimental-3f3fe0874 → 0.0.0-experimental-241c4467e
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 +557 -498
- package/cjs/react.production.min.js +15 -14
- package/package.json +1 -1
- package/umd/react.development.js +560 -497
- package/umd/react.production.min.js +15 -15
- package/umd/react.profiling.min.js +24 -24
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"branch": "
|
|
3
|
-
"buildNumber": "
|
|
4
|
-
"checksum": "
|
|
5
|
-
"commit": "
|
|
2
|
+
"branch": "master",
|
|
3
|
+
"buildNumber": "80590",
|
|
4
|
+
"checksum": "fcf66d8",
|
|
5
|
+
"commit": "241c4467e",
|
|
6
6
|
"environment": "ci",
|
|
7
|
-
"reactVersion": "16.12.0-experimental-
|
|
7
|
+
"reactVersion": "16.12.0-experimental-241c4467e"
|
|
8
8
|
}
|
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.0.0-experimental-
|
|
1
|
+
/** @license React v0.0.0-experimental-241c4467e
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -20,7 +20,7 @@ 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.12.0-experimental-
|
|
23
|
+
var ReactVersion = '16.12.0-experimental-241c4467e';
|
|
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.
|
|
@@ -41,6 +41,7 @@ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
|
41
41
|
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
42
42
|
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
43
43
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
44
|
+
var REACT_CHUNK_TYPE = hasSymbol ? Symbol.for('react.chunk') : 0xead9;
|
|
44
45
|
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
45
46
|
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
46
47
|
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
@@ -60,113 +61,265 @@ function getIteratorFn(maybeIterable) {
|
|
|
60
61
|
return null;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Keeps track of the current dispatcher.
|
|
66
|
+
*/
|
|
67
|
+
var ReactCurrentDispatcher = {
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
* @type {ReactComponent}
|
|
71
|
+
*/
|
|
72
|
+
current: null
|
|
73
|
+
};
|
|
66
74
|
|
|
67
75
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
|
71
|
-
* to provide information about what broke and what you were
|
|
72
|
-
* expecting.
|
|
73
|
-
*
|
|
74
|
-
* The invariant message will be stripped in production, but the invariant
|
|
75
|
-
* will remain to ensure logic does not differ in production.
|
|
76
|
+
* Keeps track of the current batch's configuration such as how long an update
|
|
77
|
+
* should suspend for if it needs to.
|
|
76
78
|
*/
|
|
79
|
+
var ReactCurrentBatchConfig = {
|
|
80
|
+
suspense: null
|
|
81
|
+
};
|
|
77
82
|
|
|
78
83
|
/**
|
|
79
|
-
*
|
|
80
|
-
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
84
|
+
* Keeps track of the current owner.
|
|
81
85
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* This really simplifies the code.
|
|
85
|
-
* ---
|
|
86
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
87
|
-
* This can be used to log issues in development environments in critical
|
|
88
|
-
* paths. Removing the logging code for production environments will keep the
|
|
89
|
-
* same logic and follow the same code paths.
|
|
86
|
+
* The current owner is the component who should own any components that are
|
|
87
|
+
* currently being constructed.
|
|
90
88
|
*/
|
|
91
|
-
var
|
|
89
|
+
var ReactCurrentOwner = {
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
* @type {ReactComponent}
|
|
93
|
+
*/
|
|
94
|
+
current: null
|
|
95
|
+
};
|
|
92
96
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
98
|
+
var describeComponentFrame = function (name, source, ownerName) {
|
|
99
|
+
var sourceInfo = '';
|
|
100
|
+
|
|
101
|
+
if (source) {
|
|
102
|
+
var path = source.fileName;
|
|
103
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
104
|
+
|
|
105
|
+
{
|
|
106
|
+
// In DEV, include code for a common special case:
|
|
107
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
108
|
+
if (/^index\./.test(fileName)) {
|
|
109
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
110
|
+
|
|
111
|
+
if (match) {
|
|
112
|
+
var pathBeforeSlash = match[1];
|
|
113
|
+
|
|
114
|
+
if (pathBeforeSlash) {
|
|
115
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
116
|
+
fileName = folderName + '/' + fileName;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
97
120
|
}
|
|
98
121
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
122
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
123
|
+
} else if (ownerName) {
|
|
124
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
var Resolved = 1;
|
|
131
|
+
|
|
132
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
133
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
137
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
138
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function getComponentName(type) {
|
|
142
|
+
if (type == null) {
|
|
143
|
+
// Host root, text node or just invalid type.
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
103
146
|
|
|
104
|
-
|
|
105
|
-
|
|
147
|
+
{
|
|
148
|
+
if (typeof type.tag === 'number') {
|
|
149
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
106
150
|
}
|
|
151
|
+
}
|
|
107
152
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
153
|
+
if (typeof type === 'function') {
|
|
154
|
+
return type.displayName || type.name || null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (typeof type === 'string') {
|
|
158
|
+
return type;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
switch (type) {
|
|
162
|
+
case REACT_FRAGMENT_TYPE:
|
|
163
|
+
return 'Fragment';
|
|
164
|
+
|
|
165
|
+
case REACT_PORTAL_TYPE:
|
|
166
|
+
return 'Portal';
|
|
167
|
+
|
|
168
|
+
case REACT_PROFILER_TYPE:
|
|
169
|
+
return "Profiler";
|
|
170
|
+
|
|
171
|
+
case REACT_STRICT_MODE_TYPE:
|
|
172
|
+
return 'StrictMode';
|
|
173
|
+
|
|
174
|
+
case REACT_SUSPENSE_TYPE:
|
|
175
|
+
return 'Suspense';
|
|
176
|
+
|
|
177
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
178
|
+
return 'SuspenseList';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (typeof type === 'object') {
|
|
182
|
+
switch (type.$$typeof) {
|
|
183
|
+
case REACT_CONTEXT_TYPE:
|
|
184
|
+
return 'Context.Consumer';
|
|
185
|
+
|
|
186
|
+
case REACT_PROVIDER_TYPE:
|
|
187
|
+
return 'Context.Provider';
|
|
188
|
+
|
|
189
|
+
case REACT_FORWARD_REF_TYPE:
|
|
190
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
191
|
+
|
|
192
|
+
case REACT_MEMO_TYPE:
|
|
193
|
+
return getComponentName(type.type);
|
|
194
|
+
|
|
195
|
+
case REACT_CHUNK_TYPE:
|
|
196
|
+
return getComponentName(type.render);
|
|
197
|
+
|
|
198
|
+
case REACT_LAZY_TYPE:
|
|
199
|
+
{
|
|
200
|
+
var thenable = type;
|
|
201
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
202
|
+
|
|
203
|
+
if (resolvedThenable) {
|
|
204
|
+
return getComponentName(resolvedThenable);
|
|
205
|
+
}
|
|
115
206
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
119
209
|
}
|
|
210
|
+
}
|
|
120
211
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
args[_key2 - 2] = arguments[_key2];
|
|
124
|
-
}
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
125
214
|
|
|
126
|
-
|
|
215
|
+
var ReactDebugCurrentFrame = {};
|
|
216
|
+
var currentlyValidatingElement = null;
|
|
217
|
+
function setCurrentlyValidatingElement(element) {
|
|
218
|
+
{
|
|
219
|
+
currentlyValidatingElement = element;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
{
|
|
224
|
+
// Stack implementation injected by the current renderer.
|
|
225
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
226
|
+
|
|
227
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
228
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
|
229
|
+
|
|
230
|
+
if (currentlyValidatingElement) {
|
|
231
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
232
|
+
var owner = currentlyValidatingElement._owner;
|
|
233
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
234
|
+
} // Delegate to the injected renderer-specific implementation
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
238
|
+
|
|
239
|
+
if (impl) {
|
|
240
|
+
stack += impl() || '';
|
|
127
241
|
}
|
|
242
|
+
|
|
243
|
+
return stack;
|
|
128
244
|
};
|
|
129
245
|
}
|
|
130
246
|
|
|
131
|
-
var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
|
132
|
-
|
|
133
247
|
/**
|
|
134
|
-
*
|
|
135
|
-
* This can be used to log issues in development environments in critical
|
|
136
|
-
* paths. Removing the logging code for production environments will keep the
|
|
137
|
-
* same logic and follow the same code paths.
|
|
248
|
+
* Used by act() to track whether you're inside an act() scope.
|
|
138
249
|
*/
|
|
139
|
-
var
|
|
250
|
+
var IsSomeRendererActing = {
|
|
251
|
+
current: false
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
var ReactSharedInternals = {
|
|
255
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
256
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
257
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
258
|
+
IsSomeRendererActing: IsSomeRendererActing,
|
|
259
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
260
|
+
assign: _assign
|
|
261
|
+
};
|
|
140
262
|
|
|
141
263
|
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
264
|
+
_assign(ReactSharedInternals, {
|
|
265
|
+
// These should not be included in production.
|
|
266
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
267
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
268
|
+
// TODO: remove in React 17.0.
|
|
269
|
+
ReactComponentTreeHook: {}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
146
272
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
273
|
+
// by calls to these methods by a Babel plugin.
|
|
274
|
+
//
|
|
275
|
+
// In PROD (or in packages without access to React internals),
|
|
276
|
+
// they are left as they are instead.
|
|
150
277
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
278
|
+
function warn(format) {
|
|
279
|
+
{
|
|
280
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
281
|
+
args[_key - 1] = arguments[_key];
|
|
154
282
|
}
|
|
155
283
|
|
|
156
|
-
|
|
157
|
-
|
|
284
|
+
printWarning('warn', format, args);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function error(format) {
|
|
288
|
+
{
|
|
289
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
290
|
+
args[_key2 - 1] = arguments[_key2];
|
|
158
291
|
}
|
|
159
292
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
293
|
+
printWarning('error', format, args);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function printWarning(level, format, args) {
|
|
298
|
+
// When changing this logic, you might want to also
|
|
299
|
+
// update consoleWithStackDev.www.js as well.
|
|
300
|
+
{
|
|
301
|
+
var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
|
|
302
|
+
|
|
303
|
+
if (!hasExistingStack) {
|
|
304
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
305
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
166
306
|
|
|
167
|
-
|
|
307
|
+
if (stack !== '') {
|
|
308
|
+
format += '%s';
|
|
309
|
+
args = args.concat([stack]);
|
|
310
|
+
}
|
|
168
311
|
}
|
|
169
312
|
|
|
313
|
+
var argsWithFormat = args.map(function (item) {
|
|
314
|
+
return '' + item;
|
|
315
|
+
}); // Careful: RN currently depends on this prefix
|
|
316
|
+
|
|
317
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
318
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
319
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
320
|
+
|
|
321
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
322
|
+
|
|
170
323
|
try {
|
|
171
324
|
// --- Welcome to debugging React ---
|
|
172
325
|
// This error was thrown as a convenience so that you can use this stack
|
|
@@ -177,10 +330,23 @@ var warningWithoutStack = function () {};
|
|
|
177
330
|
});
|
|
178
331
|
throw new Error(message);
|
|
179
332
|
} catch (x) {}
|
|
180
|
-
}
|
|
333
|
+
}
|
|
181
334
|
}
|
|
182
335
|
|
|
183
|
-
|
|
336
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
337
|
+
// template literal strings. The messages will be replaced with error codes
|
|
338
|
+
// during build.
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
342
|
+
*
|
|
343
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
344
|
+
* to provide information about what broke and what you were
|
|
345
|
+
* expecting.
|
|
346
|
+
*
|
|
347
|
+
* The invariant message will be stripped in production, but the invariant
|
|
348
|
+
* will remain to ensure logic does not differ in production.
|
|
349
|
+
*/
|
|
184
350
|
|
|
185
351
|
var didWarnStateUpdateForUnmountedComponent = {};
|
|
186
352
|
|
|
@@ -194,7 +360,8 @@ function warnNoop(publicInstance, callerName) {
|
|
|
194
360
|
return;
|
|
195
361
|
}
|
|
196
362
|
|
|
197
|
-
|
|
363
|
+
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);
|
|
364
|
+
|
|
198
365
|
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
199
366
|
}
|
|
200
367
|
}
|
|
@@ -280,367 +447,134 @@ var emptyObject = {};
|
|
|
280
447
|
|
|
281
448
|
function Component(props, context, updater) {
|
|
282
449
|
this.props = props;
|
|
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
|
|
286
|
-
// renderer.
|
|
287
|
-
|
|
288
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
Component.prototype.isReactComponent = {};
|
|
292
|
-
/**
|
|
293
|
-
* Sets a subset of the state. Always use this to mutate
|
|
294
|
-
* state. You should treat `this.state` as immutable.
|
|
295
|
-
*
|
|
296
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
297
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
298
|
-
*
|
|
299
|
-
* There is no guarantee that calls to `setState` will run synchronously,
|
|
300
|
-
* as they may eventually be batched together. You can provide an optional
|
|
301
|
-
* callback that will be executed when the call to setState is actually
|
|
302
|
-
* completed.
|
|
303
|
-
*
|
|
304
|
-
* When a function is provided to setState, it will be called at some point in
|
|
305
|
-
* the future (not synchronously). It will be called with the up to date
|
|
306
|
-
* component arguments (state, props, context). These values can be different
|
|
307
|
-
* from this.* because your function may be called after receiveProps but before
|
|
308
|
-
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
309
|
-
* assigned to this.
|
|
310
|
-
*
|
|
311
|
-
* @param {object|function} partialState Next partial state or function to
|
|
312
|
-
* produce next partial state to be merged with current state.
|
|
313
|
-
* @param {?function} callback Called after state is updated.
|
|
314
|
-
* @final
|
|
315
|
-
* @protected
|
|
316
|
-
*/
|
|
317
|
-
|
|
318
|
-
Component.prototype.setState = function (partialState, callback) {
|
|
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
|
-
|
|
325
|
-
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
326
|
-
};
|
|
327
|
-
/**
|
|
328
|
-
* Forces an update. This should only be invoked when it is known with
|
|
329
|
-
* certainty that we are **not** in a DOM transaction.
|
|
330
|
-
*
|
|
331
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
332
|
-
* component's state has changed but `setState` was not called.
|
|
333
|
-
*
|
|
334
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
335
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
336
|
-
*
|
|
337
|
-
* @param {?function} callback Called after update is complete.
|
|
338
|
-
* @final
|
|
339
|
-
* @protected
|
|
340
|
-
*/
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
Component.prototype.forceUpdate = function (callback) {
|
|
344
|
-
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
345
|
-
};
|
|
346
|
-
/**
|
|
347
|
-
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
348
|
-
* we would like to deprecate them, we're not going to move them over to this
|
|
349
|
-
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
350
|
-
*/
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
{
|
|
354
|
-
var deprecatedAPIs = {
|
|
355
|
-
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
356
|
-
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
var defineDeprecationWarning = function (methodName, info) {
|
|
360
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
361
|
-
get: function () {
|
|
362
|
-
lowPriorityWarningWithoutStack$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
363
|
-
return undefined;
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
for (var fnName in deprecatedAPIs) {
|
|
369
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
370
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
function ComponentDummy() {}
|
|
376
|
-
|
|
377
|
-
ComponentDummy.prototype = Component.prototype;
|
|
378
|
-
/**
|
|
379
|
-
* Convenience component with default shallow equality check for sCU.
|
|
380
|
-
*/
|
|
381
|
-
|
|
382
|
-
function PureComponent(props, context, updater) {
|
|
383
|
-
this.props = props;
|
|
384
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
385
|
-
|
|
386
|
-
this.refs = emptyObject;
|
|
387
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
391
|
-
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
392
|
-
|
|
393
|
-
_assign(pureComponentPrototype, Component.prototype);
|
|
394
|
-
|
|
395
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
396
|
-
|
|
397
|
-
// an immutable object with a single mutable value
|
|
398
|
-
function createRef() {
|
|
399
|
-
var refObject = {
|
|
400
|
-
current: null
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
{
|
|
404
|
-
Object.seal(refObject);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
return refObject;
|
|
408
|
-
}
|
|
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
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Keeps track of the current owner.
|
|
431
|
-
*
|
|
432
|
-
* The current owner is the component who should own any components that are
|
|
433
|
-
* currently being constructed.
|
|
434
|
-
*/
|
|
435
|
-
var ReactCurrentOwner = {
|
|
436
|
-
/**
|
|
437
|
-
* @internal
|
|
438
|
-
* @type {ReactComponent}
|
|
439
|
-
*/
|
|
440
|
-
current: null
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
444
|
-
var describeComponentFrame = function (name, source, ownerName) {
|
|
445
|
-
var sourceInfo = '';
|
|
446
|
-
|
|
447
|
-
if (source) {
|
|
448
|
-
var path = source.fileName;
|
|
449
|
-
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
450
|
-
|
|
451
|
-
{
|
|
452
|
-
// In DEV, include code for a common special case:
|
|
453
|
-
// prefer "folder/index.js" instead of just "index.js".
|
|
454
|
-
if (/^index\./.test(fileName)) {
|
|
455
|
-
var match = path.match(BEFORE_SLASH_RE);
|
|
456
|
-
|
|
457
|
-
if (match) {
|
|
458
|
-
var pathBeforeSlash = match[1];
|
|
459
|
-
|
|
460
|
-
if (pathBeforeSlash) {
|
|
461
|
-
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
462
|
-
fileName = folderName + '/' + fileName;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
469
|
-
} else if (ownerName) {
|
|
470
|
-
sourceInfo = ' (created by ' + ownerName + ')';
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
474
|
-
};
|
|
475
|
-
|
|
476
|
-
var Resolved = 1;
|
|
477
|
-
|
|
478
|
-
function refineResolvedLazyComponent(lazyComponent) {
|
|
479
|
-
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
483
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
484
|
-
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
function getComponentName(type) {
|
|
488
|
-
if (type == null) {
|
|
489
|
-
// Host root, text node or just invalid type.
|
|
490
|
-
return null;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
{
|
|
494
|
-
if (typeof type.tag === 'number') {
|
|
495
|
-
warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
if (typeof type === 'function') {
|
|
500
|
-
return type.displayName || type.name || null;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
if (typeof type === 'string') {
|
|
504
|
-
return type;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
switch (type) {
|
|
508
|
-
case REACT_FRAGMENT_TYPE:
|
|
509
|
-
return 'Fragment';
|
|
510
|
-
|
|
511
|
-
case REACT_PORTAL_TYPE:
|
|
512
|
-
return 'Portal';
|
|
513
|
-
|
|
514
|
-
case REACT_PROFILER_TYPE:
|
|
515
|
-
return "Profiler";
|
|
516
|
-
|
|
517
|
-
case REACT_STRICT_MODE_TYPE:
|
|
518
|
-
return 'StrictMode';
|
|
519
|
-
|
|
520
|
-
case REACT_SUSPENSE_TYPE:
|
|
521
|
-
return 'Suspense';
|
|
522
|
-
|
|
523
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
524
|
-
return 'SuspenseList';
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
if (typeof type === 'object') {
|
|
528
|
-
switch (type.$$typeof) {
|
|
529
|
-
case REACT_CONTEXT_TYPE:
|
|
530
|
-
return 'Context.Consumer';
|
|
531
|
-
|
|
532
|
-
case REACT_PROVIDER_TYPE:
|
|
533
|
-
return 'Context.Provider';
|
|
534
|
-
|
|
535
|
-
case REACT_FORWARD_REF_TYPE:
|
|
536
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
537
|
-
|
|
538
|
-
case REACT_MEMO_TYPE:
|
|
539
|
-
return getComponentName(type.type);
|
|
540
|
-
|
|
541
|
-
case REACT_LAZY_TYPE:
|
|
542
|
-
{
|
|
543
|
-
var thenable = type;
|
|
544
|
-
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
545
|
-
|
|
546
|
-
if (resolvedThenable) {
|
|
547
|
-
return getComponentName(resolvedThenable);
|
|
548
|
-
}
|
|
450
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
549
451
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
}
|
|
452
|
+
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
453
|
+
// renderer.
|
|
554
454
|
|
|
555
|
-
|
|
455
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
556
456
|
}
|
|
557
457
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
458
|
+
Component.prototype.isReactComponent = {};
|
|
459
|
+
/**
|
|
460
|
+
* Sets a subset of the state. Always use this to mutate
|
|
461
|
+
* state. You should treat `this.state` as immutable.
|
|
462
|
+
*
|
|
463
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
464
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
465
|
+
*
|
|
466
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
|
467
|
+
* as they may eventually be batched together. You can provide an optional
|
|
468
|
+
* callback that will be executed when the call to setState is actually
|
|
469
|
+
* completed.
|
|
470
|
+
*
|
|
471
|
+
* When a function is provided to setState, it will be called at some point in
|
|
472
|
+
* the future (not synchronously). It will be called with the up to date
|
|
473
|
+
* component arguments (state, props, context). These values can be different
|
|
474
|
+
* from this.* because your function may be called after receiveProps but before
|
|
475
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
476
|
+
* assigned to this.
|
|
477
|
+
*
|
|
478
|
+
* @param {object|function} partialState Next partial state or function to
|
|
479
|
+
* produce next partial state to be merged with current state.
|
|
480
|
+
* @param {?function} callback Called after state is updated.
|
|
481
|
+
* @final
|
|
482
|
+
* @protected
|
|
483
|
+
*/
|
|
484
|
+
|
|
485
|
+
Component.prototype.setState = function (partialState, callback) {
|
|
486
|
+
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
487
|
+
{
|
|
488
|
+
throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
|
489
|
+
}
|
|
563
490
|
}
|
|
564
|
-
}
|
|
565
491
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
492
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* Forces an update. This should only be invoked when it is known with
|
|
496
|
+
* certainty that we are **not** in a DOM transaction.
|
|
497
|
+
*
|
|
498
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
499
|
+
* component's state has changed but `setState` was not called.
|
|
500
|
+
*
|
|
501
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
502
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
503
|
+
*
|
|
504
|
+
* @param {?function} callback Called after update is complete.
|
|
505
|
+
* @final
|
|
506
|
+
* @protected
|
|
507
|
+
*/
|
|
569
508
|
|
|
570
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
571
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
|
572
509
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
510
|
+
Component.prototype.forceUpdate = function (callback) {
|
|
511
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
515
|
+
* we would like to deprecate them, we're not going to move them over to this
|
|
516
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
517
|
+
*/
|
|
578
518
|
|
|
579
519
|
|
|
580
|
-
|
|
520
|
+
{
|
|
521
|
+
var deprecatedAPIs = {
|
|
522
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
523
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
524
|
+
};
|
|
581
525
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
526
|
+
var defineDeprecationWarning = function (methodName, info) {
|
|
527
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
528
|
+
get: function () {
|
|
529
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
585
530
|
|
|
586
|
-
|
|
531
|
+
return undefined;
|
|
532
|
+
}
|
|
533
|
+
});
|
|
587
534
|
};
|
|
535
|
+
|
|
536
|
+
for (var fnName in deprecatedAPIs) {
|
|
537
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
538
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
588
541
|
}
|
|
589
542
|
|
|
543
|
+
function ComponentDummy() {}
|
|
544
|
+
|
|
545
|
+
ComponentDummy.prototype = Component.prototype;
|
|
590
546
|
/**
|
|
591
|
-
*
|
|
547
|
+
* Convenience component with default shallow equality check for sCU.
|
|
592
548
|
*/
|
|
593
|
-
var IsSomeRendererActing = {
|
|
594
|
-
current: false
|
|
595
|
-
};
|
|
596
549
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
ReactCurrentOwner: ReactCurrentOwner,
|
|
601
|
-
IsSomeRendererActing: IsSomeRendererActing,
|
|
602
|
-
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
603
|
-
assign: _assign
|
|
604
|
-
};
|
|
550
|
+
function PureComponent(props, context, updater) {
|
|
551
|
+
this.props = props;
|
|
552
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
605
553
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
// These should not be included in production.
|
|
609
|
-
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
610
|
-
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
611
|
-
// TODO: remove in React 17.0.
|
|
612
|
-
ReactComponentTreeHook: {}
|
|
613
|
-
});
|
|
554
|
+
this.refs = emptyObject;
|
|
555
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
614
556
|
}
|
|
615
557
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
* This can be used to log issues in development environments in critical
|
|
619
|
-
* paths. Removing the logging code for production environments will keep the
|
|
620
|
-
* same logic and follow the same code paths.
|
|
621
|
-
*/
|
|
558
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
559
|
+
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
622
560
|
|
|
623
|
-
|
|
561
|
+
_assign(pureComponentPrototype, Component.prototype);
|
|
624
562
|
|
|
625
|
-
|
|
626
|
-
warning = function (condition, format) {
|
|
627
|
-
if (condition) {
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
563
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
630
564
|
|
|
631
|
-
|
|
632
|
-
|
|
565
|
+
// an immutable object with a single mutable value
|
|
566
|
+
function createRef() {
|
|
567
|
+
var refObject = {
|
|
568
|
+
current: null
|
|
569
|
+
};
|
|
633
570
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
571
|
+
{
|
|
572
|
+
Object.seal(refObject);
|
|
573
|
+
}
|
|
637
574
|
|
|
638
|
-
|
|
639
|
-
};
|
|
575
|
+
return refObject;
|
|
640
576
|
}
|
|
641
577
|
|
|
642
|
-
var warning$1 = warning;
|
|
643
|
-
|
|
644
578
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
645
579
|
var RESERVED_PROPS = {
|
|
646
580
|
key: true,
|
|
@@ -650,6 +584,11 @@ var RESERVED_PROPS = {
|
|
|
650
584
|
};
|
|
651
585
|
var specialPropKeyWarningShown;
|
|
652
586
|
var specialPropRefWarningShown;
|
|
587
|
+
var didWarnAboutStringRefs;
|
|
588
|
+
|
|
589
|
+
{
|
|
590
|
+
didWarnAboutStringRefs = {};
|
|
591
|
+
}
|
|
653
592
|
|
|
654
593
|
function hasValidRef(config) {
|
|
655
594
|
{
|
|
@@ -681,9 +620,12 @@ function hasValidKey(config) {
|
|
|
681
620
|
|
|
682
621
|
function defineKeyPropWarningGetter(props, displayName) {
|
|
683
622
|
var warnAboutAccessingKey = function () {
|
|
684
|
-
|
|
685
|
-
specialPropKeyWarningShown
|
|
686
|
-
|
|
623
|
+
{
|
|
624
|
+
if (!specialPropKeyWarningShown) {
|
|
625
|
+
specialPropKeyWarningShown = true;
|
|
626
|
+
|
|
627
|
+
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);
|
|
628
|
+
}
|
|
687
629
|
}
|
|
688
630
|
};
|
|
689
631
|
|
|
@@ -696,9 +638,12 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
696
638
|
|
|
697
639
|
function defineRefPropWarningGetter(props, displayName) {
|
|
698
640
|
var warnAboutAccessingRef = function () {
|
|
699
|
-
|
|
700
|
-
specialPropRefWarningShown
|
|
701
|
-
|
|
641
|
+
{
|
|
642
|
+
if (!specialPropRefWarningShown) {
|
|
643
|
+
specialPropRefWarningShown = true;
|
|
644
|
+
|
|
645
|
+
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);
|
|
646
|
+
}
|
|
702
647
|
}
|
|
703
648
|
};
|
|
704
649
|
|
|
@@ -708,6 +653,20 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
708
653
|
configurable: true
|
|
709
654
|
});
|
|
710
655
|
}
|
|
656
|
+
|
|
657
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
658
|
+
{
|
|
659
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
660
|
+
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
661
|
+
|
|
662
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
663
|
+
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);
|
|
664
|
+
|
|
665
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
711
670
|
/**
|
|
712
671
|
* Factory method to create a new React element. This no longer adheres to
|
|
713
672
|
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
@@ -821,6 +780,7 @@ function jsxDEV(type, config, maybeKey, source, self) {
|
|
|
821
780
|
|
|
822
781
|
if (hasValidRef(config)) {
|
|
823
782
|
ref = config.ref;
|
|
783
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
|
824
784
|
} // Remaining properties are added to a new props object
|
|
825
785
|
|
|
826
786
|
|
|
@@ -872,6 +832,10 @@ function createElement(type, config, children) {
|
|
|
872
832
|
if (config != null) {
|
|
873
833
|
if (hasValidRef(config)) {
|
|
874
834
|
ref = config.ref;
|
|
835
|
+
|
|
836
|
+
{
|
|
837
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
|
838
|
+
}
|
|
875
839
|
}
|
|
876
840
|
|
|
877
841
|
if (hasValidKey(config)) {
|
|
@@ -1167,7 +1131,10 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1167
1131
|
{
|
|
1168
1132
|
// Warn about using Maps as children
|
|
1169
1133
|
if (iteratorFn === children.entries) {
|
|
1170
|
-
!didWarnAboutMaps
|
|
1134
|
+
if (!didWarnAboutMaps) {
|
|
1135
|
+
error('Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.');
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1171
1138
|
didWarnAboutMaps = true;
|
|
1172
1139
|
}
|
|
1173
1140
|
}
|
|
@@ -1394,7 +1361,9 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1394
1361
|
calculateChangedBits = null;
|
|
1395
1362
|
} else {
|
|
1396
1363
|
{
|
|
1397
|
-
|
|
1364
|
+
if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
|
|
1365
|
+
error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
|
|
1366
|
+
}
|
|
1398
1367
|
}
|
|
1399
1368
|
}
|
|
1400
1369
|
|
|
@@ -1437,7 +1406,8 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1437
1406
|
get: function () {
|
|
1438
1407
|
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1439
1408
|
hasWarnedAboutUsingConsumerProvider = true;
|
|
1440
|
-
|
|
1409
|
+
|
|
1410
|
+
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?');
|
|
1441
1411
|
}
|
|
1442
1412
|
|
|
1443
1413
|
return context.Provider;
|
|
@@ -1474,7 +1444,8 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1474
1444
|
get: function () {
|
|
1475
1445
|
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1476
1446
|
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1477
|
-
|
|
1447
|
+
|
|
1448
|
+
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?');
|
|
1478
1449
|
}
|
|
1479
1450
|
|
|
1480
1451
|
return context.Consumer;
|
|
@@ -1513,7 +1484,8 @@ function lazy(ctor) {
|
|
|
1513
1484
|
return defaultProps;
|
|
1514
1485
|
},
|
|
1515
1486
|
set: function (newDefaultProps) {
|
|
1516
|
-
|
|
1487
|
+
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.');
|
|
1488
|
+
|
|
1517
1489
|
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1518
1490
|
|
|
1519
1491
|
Object.defineProperty(lazyType, 'defaultProps', {
|
|
@@ -1527,7 +1499,8 @@ function lazy(ctor) {
|
|
|
1527
1499
|
return propTypes;
|
|
1528
1500
|
},
|
|
1529
1501
|
set: function (newPropTypes) {
|
|
1530
|
-
|
|
1502
|
+
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.');
|
|
1503
|
+
|
|
1531
1504
|
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1532
1505
|
|
|
1533
1506
|
Object.defineProperty(lazyType, 'propTypes', {
|
|
@@ -1544,16 +1517,19 @@ function lazy(ctor) {
|
|
|
1544
1517
|
function forwardRef(render) {
|
|
1545
1518
|
{
|
|
1546
1519
|
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1547
|
-
|
|
1520
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1548
1521
|
} else if (typeof render !== 'function') {
|
|
1549
|
-
|
|
1522
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1550
1523
|
} else {
|
|
1551
|
-
|
|
1552
|
-
|
|
1524
|
+
if (render.length !== 0 && render.length !== 2) {
|
|
1525
|
+
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.');
|
|
1526
|
+
}
|
|
1553
1527
|
}
|
|
1554
1528
|
|
|
1555
1529
|
if (render != null) {
|
|
1556
|
-
|
|
1530
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
|
1531
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1532
|
+
}
|
|
1557
1533
|
}
|
|
1558
1534
|
}
|
|
1559
1535
|
|
|
@@ -1565,13 +1541,13 @@ function forwardRef(render) {
|
|
|
1565
1541
|
|
|
1566
1542
|
function isValidElementType(type) {
|
|
1567
1543
|
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);
|
|
1544
|
+
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_CHUNK_TYPE);
|
|
1569
1545
|
}
|
|
1570
1546
|
|
|
1571
1547
|
function memo(type, compare) {
|
|
1572
1548
|
{
|
|
1573
1549
|
if (!isValidElementType(type)) {
|
|
1574
|
-
|
|
1550
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1575
1551
|
}
|
|
1576
1552
|
}
|
|
1577
1553
|
|
|
@@ -1582,6 +1558,41 @@ function memo(type, compare) {
|
|
|
1582
1558
|
};
|
|
1583
1559
|
}
|
|
1584
1560
|
|
|
1561
|
+
function chunk(query, render) {
|
|
1562
|
+
{
|
|
1563
|
+
if (typeof query !== 'function') {
|
|
1564
|
+
error('Chunks require a query function but was given %s.', query === null ? 'null' : typeof query);
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1568
|
+
error('Chunks require a render function but received a `memo` ' + 'component. Use `memo` on an inner component instead.');
|
|
1569
|
+
} else if (render != null && render.$$typeof === REACT_FORWARD_REF_TYPE) {
|
|
1570
|
+
error('Chunks require a render function but received a `forwardRef` ' + 'component. Use `forwardRef` on an inner component instead.');
|
|
1571
|
+
} else if (typeof render !== 'function') {
|
|
1572
|
+
error('Chunks require a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1573
|
+
} else if (render.length !== 0 && render.length !== 2) {
|
|
1574
|
+
// Warn if it's not accepting two args.
|
|
1575
|
+
// Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
|
|
1576
|
+
error('Chunk render functions accept exactly two parameters: props and data. %s', render.length === 1 ? 'Did you forget to use the data parameter?' : 'Any additional parameter will be undefined.');
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
if (render != null && (render.defaultProps != null || render.propTypes != null)) {
|
|
1580
|
+
error('Chunk render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
return function () {
|
|
1585
|
+
var args = arguments;
|
|
1586
|
+
return {
|
|
1587
|
+
$$typeof: REACT_CHUNK_TYPE,
|
|
1588
|
+
query: function () {
|
|
1589
|
+
return query.apply(null, args);
|
|
1590
|
+
},
|
|
1591
|
+
render: render
|
|
1592
|
+
};
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1585
1596
|
function resolveDispatcher() {
|
|
1586
1597
|
var dispatcher = ReactCurrentDispatcher.current;
|
|
1587
1598
|
|
|
@@ -1598,16 +1609,19 @@ function useContext(Context, unstable_observedBits) {
|
|
|
1598
1609
|
var dispatcher = resolveDispatcher();
|
|
1599
1610
|
|
|
1600
1611
|
{
|
|
1601
|
-
|
|
1612
|
+
if (unstable_observedBits !== undefined) {
|
|
1613
|
+
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' : '');
|
|
1614
|
+
} // TODO: add a more generic warning for invalid values.
|
|
1615
|
+
|
|
1602
1616
|
|
|
1603
1617
|
if (Context._context !== undefined) {
|
|
1604
1618
|
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1605
1619
|
// and nobody should be using this in existing code.
|
|
1606
1620
|
|
|
1607
1621
|
if (realContext.Consumer === Context) {
|
|
1608
|
-
|
|
1622
|
+
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?');
|
|
1609
1623
|
} else if (realContext.Provider === Context) {
|
|
1610
|
-
|
|
1624
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1611
1625
|
}
|
|
1612
1626
|
}
|
|
1613
1627
|
}
|
|
@@ -1626,25 +1640,25 @@ function useRef(initialValue) {
|
|
|
1626
1640
|
var dispatcher = resolveDispatcher();
|
|
1627
1641
|
return dispatcher.useRef(initialValue);
|
|
1628
1642
|
}
|
|
1629
|
-
function useEffect(create,
|
|
1643
|
+
function useEffect(create, deps) {
|
|
1630
1644
|
var dispatcher = resolveDispatcher();
|
|
1631
|
-
return dispatcher.useEffect(create,
|
|
1645
|
+
return dispatcher.useEffect(create, deps);
|
|
1632
1646
|
}
|
|
1633
|
-
function useLayoutEffect(create,
|
|
1647
|
+
function useLayoutEffect(create, deps) {
|
|
1634
1648
|
var dispatcher = resolveDispatcher();
|
|
1635
|
-
return dispatcher.useLayoutEffect(create,
|
|
1649
|
+
return dispatcher.useLayoutEffect(create, deps);
|
|
1636
1650
|
}
|
|
1637
|
-
function useCallback(callback,
|
|
1651
|
+
function useCallback(callback, deps) {
|
|
1638
1652
|
var dispatcher = resolveDispatcher();
|
|
1639
|
-
return dispatcher.useCallback(callback,
|
|
1653
|
+
return dispatcher.useCallback(callback, deps);
|
|
1640
1654
|
}
|
|
1641
|
-
function useMemo(create,
|
|
1655
|
+
function useMemo(create, deps) {
|
|
1642
1656
|
var dispatcher = resolveDispatcher();
|
|
1643
|
-
return dispatcher.useMemo(create,
|
|
1657
|
+
return dispatcher.useMemo(create, deps);
|
|
1644
1658
|
}
|
|
1645
|
-
function useImperativeHandle(ref, create,
|
|
1659
|
+
function useImperativeHandle(ref, create, deps) {
|
|
1646
1660
|
var dispatcher = resolveDispatcher();
|
|
1647
|
-
return dispatcher.useImperativeHandle(ref, create,
|
|
1661
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1648
1662
|
}
|
|
1649
1663
|
function useDebugValue(value, formatterFn) {
|
|
1650
1664
|
{
|
|
@@ -1658,7 +1672,8 @@ function useResponder(responder, listenerProps) {
|
|
|
1658
1672
|
|
|
1659
1673
|
{
|
|
1660
1674
|
if (responder == null || responder.$$typeof !== REACT_RESPONDER_TYPE) {
|
|
1661
|
-
|
|
1675
|
+
error('useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
|
|
1676
|
+
|
|
1662
1677
|
return;
|
|
1663
1678
|
}
|
|
1664
1679
|
}
|
|
@@ -1789,7 +1804,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
1789
1804
|
setCurrentlyValidatingElement(element);
|
|
1790
1805
|
|
|
1791
1806
|
{
|
|
1792
|
-
|
|
1807
|
+
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);
|
|
1793
1808
|
}
|
|
1794
1809
|
|
|
1795
1810
|
setCurrentlyValidatingElement(null);
|
|
@@ -1851,36 +1866,39 @@ function validateChildKeys(node, parentType) {
|
|
|
1851
1866
|
|
|
1852
1867
|
|
|
1853
1868
|
function validatePropTypes(element) {
|
|
1854
|
-
|
|
1869
|
+
{
|
|
1870
|
+
var type = element.type;
|
|
1855
1871
|
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1872
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1859
1875
|
|
|
1860
|
-
|
|
1861
|
-
|
|
1876
|
+
var name = getComponentName(type);
|
|
1877
|
+
var propTypes;
|
|
1862
1878
|
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1879
|
+
if (typeof type === 'function') {
|
|
1880
|
+
propTypes = type.propTypes;
|
|
1881
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1882
|
+
// Inner props are checked in the reconciler.
|
|
1883
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1884
|
+
propTypes = type.propTypes;
|
|
1885
|
+
} else {
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1872
1888
|
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1889
|
+
if (propTypes) {
|
|
1890
|
+
setCurrentlyValidatingElement(element);
|
|
1891
|
+
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
1892
|
+
setCurrentlyValidatingElement(null);
|
|
1893
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1894
|
+
propTypesMisspellWarningShown = true;
|
|
1895
|
+
|
|
1896
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1897
|
+
}
|
|
1881
1898
|
|
|
1882
|
-
|
|
1883
|
-
|
|
1899
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1900
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1901
|
+
}
|
|
1884
1902
|
}
|
|
1885
1903
|
}
|
|
1886
1904
|
/**
|
|
@@ -1890,23 +1908,26 @@ function validatePropTypes(element) {
|
|
|
1890
1908
|
|
|
1891
1909
|
|
|
1892
1910
|
function validateFragmentProps(fragment) {
|
|
1893
|
-
|
|
1894
|
-
|
|
1911
|
+
{
|
|
1912
|
+
setCurrentlyValidatingElement(fragment);
|
|
1913
|
+
var keys = Object.keys(fragment.props);
|
|
1914
|
+
|
|
1915
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1916
|
+
var key = keys[i];
|
|
1895
1917
|
|
|
1896
|
-
|
|
1897
|
-
|
|
1918
|
+
if (key !== 'children' && key !== 'key') {
|
|
1919
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1898
1920
|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
break;
|
|
1921
|
+
break;
|
|
1922
|
+
}
|
|
1902
1923
|
}
|
|
1903
|
-
}
|
|
1904
1924
|
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1925
|
+
if (fragment.ref !== null) {
|
|
1926
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1927
|
+
}
|
|
1908
1928
|
|
|
1909
|
-
|
|
1929
|
+
setCurrentlyValidatingElement(null);
|
|
1930
|
+
}
|
|
1910
1931
|
}
|
|
1911
1932
|
|
|
1912
1933
|
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
@@ -1941,7 +1962,9 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1941
1962
|
typeString = typeof type;
|
|
1942
1963
|
}
|
|
1943
1964
|
|
|
1944
|
-
|
|
1965
|
+
{
|
|
1966
|
+
error('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);
|
|
1967
|
+
}
|
|
1945
1968
|
}
|
|
1946
1969
|
|
|
1947
1970
|
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
@@ -1970,7 +1993,9 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1970
1993
|
Object.freeze(children);
|
|
1971
1994
|
}
|
|
1972
1995
|
} else {
|
|
1973
|
-
|
|
1996
|
+
{
|
|
1997
|
+
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
1998
|
+
}
|
|
1974
1999
|
}
|
|
1975
2000
|
} else {
|
|
1976
2001
|
validateChildKeys(children, type);
|
|
@@ -1979,7 +2004,9 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1979
2004
|
}
|
|
1980
2005
|
|
|
1981
2006
|
if (hasOwnProperty$1.call(props, 'key')) {
|
|
1982
|
-
|
|
2007
|
+
{
|
|
2008
|
+
error('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} />');
|
|
2009
|
+
}
|
|
1983
2010
|
}
|
|
1984
2011
|
|
|
1985
2012
|
if (type === REACT_FRAGMENT_TYPE) {
|
|
@@ -2032,7 +2059,9 @@ function createElementWithValidation(type, props, children) {
|
|
|
2032
2059
|
typeString = typeof type;
|
|
2033
2060
|
}
|
|
2034
2061
|
|
|
2035
|
-
|
|
2062
|
+
{
|
|
2063
|
+
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);
|
|
2064
|
+
}
|
|
2036
2065
|
}
|
|
2037
2066
|
|
|
2038
2067
|
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
@@ -2061,15 +2090,24 @@ function createElementWithValidation(type, props, children) {
|
|
|
2061
2090
|
|
|
2062
2091
|
return element;
|
|
2063
2092
|
}
|
|
2093
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
|
2064
2094
|
function createFactoryWithValidation(type) {
|
|
2065
2095
|
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2066
|
-
validatedFactory.type = type;
|
|
2096
|
+
validatedFactory.type = type;
|
|
2067
2097
|
|
|
2068
2098
|
{
|
|
2099
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
2100
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
|
2101
|
+
|
|
2102
|
+
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
2103
|
+
} // Legacy hook: remove it
|
|
2104
|
+
|
|
2105
|
+
|
|
2069
2106
|
Object.defineProperty(validatedFactory, 'type', {
|
|
2070
2107
|
enumerable: false,
|
|
2071
2108
|
get: function () {
|
|
2072
|
-
|
|
2109
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2110
|
+
|
|
2073
2111
|
Object.defineProperty(this, 'type', {
|
|
2074
2112
|
value: type
|
|
2075
2113
|
});
|
|
@@ -2189,22 +2227,21 @@ function createScope() {
|
|
|
2189
2227
|
// SSR experiments
|
|
2190
2228
|
|
|
2191
2229
|
|
|
2192
|
-
//
|
|
2230
|
+
// Flight experiments
|
|
2231
|
+
|
|
2232
|
+
var enableChunksAPI = true; // Only used in www builds.
|
|
2193
2233
|
|
|
2194
2234
|
// Only used in www builds.
|
|
2195
2235
|
|
|
2196
2236
|
// Disable javascript: URL strings in href for XSS protection.
|
|
2197
2237
|
|
|
2198
|
-
// React Fire: prevent the value and checked attributes from syncing
|
|
2199
|
-
// with their related DOM properties
|
|
2200
|
-
|
|
2201
2238
|
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
2202
2239
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
2203
2240
|
|
|
2204
2241
|
var exposeConcurrentModeAPIs = true;
|
|
2205
2242
|
// Experimental React Flare event system and event components support.
|
|
2206
2243
|
|
|
2207
|
-
var
|
|
2244
|
+
var enableDeprecatedFlareAPI = false; // Experimental Host Component support.
|
|
2208
2245
|
|
|
2209
2246
|
var enableFundamentalAPI = false; // Experimental Scope support.
|
|
2210
2247
|
|
|
@@ -2229,9 +2266,24 @@ var enableJSXTransformAPI = false; // We will enforce mocking scheduler with sch
|
|
|
2229
2266
|
|
|
2230
2267
|
|
|
2231
2268
|
|
|
2232
|
-
|
|
2233
2269
|
// Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
|
|
2234
2270
|
|
|
2271
|
+
// --------------------------
|
|
2272
|
+
// Future APIs to be deprecated
|
|
2273
|
+
// --------------------------
|
|
2274
|
+
// Prevent the value and checked attributes from syncing
|
|
2275
|
+
// with their related DOM properties
|
|
2276
|
+
|
|
2277
|
+
|
|
2278
|
+
|
|
2279
|
+
// Disables React.createFactory
|
|
2280
|
+
|
|
2281
|
+
var disableCreateFactory = false; // Disables children for <textarea> elements
|
|
2282
|
+
|
|
2283
|
+
// Disables ReactDOM.unstable_renderSubtreeIntoContainer
|
|
2284
|
+
|
|
2285
|
+
// Disables ReactDOM.unstable_createPortal
|
|
2286
|
+
|
|
2235
2287
|
var React = {
|
|
2236
2288
|
Children: {
|
|
2237
2289
|
map: mapChildren,
|
|
@@ -2263,12 +2315,15 @@ var React = {
|
|
|
2263
2315
|
Suspense: REACT_SUSPENSE_TYPE,
|
|
2264
2316
|
createElement: createElementWithValidation,
|
|
2265
2317
|
cloneElement: cloneElementWithValidation,
|
|
2266
|
-
createFactory: createFactoryWithValidation,
|
|
2267
2318
|
isValidElement: isValidElement,
|
|
2268
2319
|
version: ReactVersion,
|
|
2269
2320
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
2270
2321
|
};
|
|
2271
2322
|
|
|
2323
|
+
if (!disableCreateFactory) {
|
|
2324
|
+
React.createFactory = createFactoryWithValidation;
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2272
2327
|
if (exposeConcurrentModeAPIs) {
|
|
2273
2328
|
React.useTransition = useTransition;
|
|
2274
2329
|
React.useDeferredValue = useDeferredValue;
|
|
@@ -2276,9 +2331,13 @@ if (exposeConcurrentModeAPIs) {
|
|
|
2276
2331
|
React.unstable_withSuspenseConfig = withSuspenseConfig;
|
|
2277
2332
|
}
|
|
2278
2333
|
|
|
2279
|
-
if (
|
|
2280
|
-
React.
|
|
2281
|
-
|
|
2334
|
+
if (enableChunksAPI) {
|
|
2335
|
+
React.chunk = chunk;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
if (enableDeprecatedFlareAPI) {
|
|
2339
|
+
React.DEPRECATED_useResponder = useResponder;
|
|
2340
|
+
React.DEPRECATED_createResponder = createEventResponder;
|
|
2282
2341
|
}
|
|
2283
2342
|
|
|
2284
2343
|
if (enableFundamentalAPI) {
|