react 0.0.0-experimental-bfa50f827-20210712 → 0.0.0-fb28e9048
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 +8 -0
- package/cjs/react.development.js +1086 -1557
- package/cjs/react.production.min.js +17 -19
- package/package.json +6 -21
- package/umd/react.development.js +2900 -2780
- package/umd/react.production.min.js +25 -24
- package/umd/react.profiling.min.js +29 -24
- package/cjs/react-jsx-dev-runtime.development.js +0 -1228
- package/cjs/react-jsx-dev-runtime.production.min.js +0 -9
- package/cjs/react-jsx-dev-runtime.profiling.min.js +0 -9
- package/cjs/react-jsx-runtime.development.js +0 -1246
- package/cjs/react-jsx-runtime.production.min.js +0 -10
- package/cjs/react-jsx-runtime.profiling.min.js +0 -10
- package/cjs/react-unstable-shared-subset.development.js +0 -2249
- package/cjs/react-unstable-shared-subset.production.min.js +0 -23
- package/jsx-dev-runtime.js +0 -7
- package/jsx-runtime.js +0 -7
- package/unstable-shared-subset.js +0 -7
package/build-info.json
ADDED
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React
|
|
1
|
+
/** @license React v0.0.0-fb28e9048
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -9,238 +9,204 @@
|
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
|
|
12
14
|
if (process.env.NODE_ENV !== "production") {
|
|
13
15
|
(function() {
|
|
14
16
|
'use strict';
|
|
15
17
|
|
|
16
18
|
var _assign = require('object-assign');
|
|
19
|
+
var checkPropTypes = require('prop-types/checkPropTypes');
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
// TODO: this is special because it gets imported during build.
|
|
22
|
+
|
|
23
|
+
var ReactVersion = '16.8.6-canary-fb28e9048';
|
|
19
24
|
|
|
20
|
-
// ATTENTION
|
|
21
|
-
// When adding new symbols to this file,
|
|
22
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
23
25
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
24
26
|
// nor polyfill, then a plain number is used for performance.
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
|
48
|
-
exports.Fragment = symbolFor('react.fragment');
|
|
49
|
-
exports.StrictMode = symbolFor('react.strict_mode');
|
|
50
|
-
exports.Profiler = symbolFor('react.profiler');
|
|
51
|
-
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
|
52
|
-
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
|
53
|
-
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
|
54
|
-
exports.Suspense = symbolFor('react.suspense');
|
|
55
|
-
exports.SuspenseList = symbolFor('react.suspense_list');
|
|
56
|
-
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
57
|
-
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
58
|
-
REACT_SCOPE_TYPE = symbolFor('react.scope');
|
|
59
|
-
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
|
|
60
|
-
exports.unstable_DebugTracingMode = symbolFor('react.debug_trace_mode');
|
|
61
|
-
exports.unstable_Offscreen = symbolFor('react.offscreen');
|
|
62
|
-
exports.unstable_LegacyHidden = symbolFor('react.legacy_hidden');
|
|
63
|
-
exports.unstable_Cache = symbolFor('react.cache');
|
|
64
|
-
}
|
|
27
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
28
|
+
|
|
29
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
30
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
31
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
32
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
33
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
34
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
35
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
36
|
+
|
|
37
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
38
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
39
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
40
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
41
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
42
|
+
var REACT_EVENT_COMPONENT_TYPE = hasSymbol ? Symbol.for('react.event_component') : 0xead5;
|
|
43
|
+
var REACT_EVENT_TARGET_TYPE = hasSymbol ? Symbol.for('react.event_target') : 0xead6;
|
|
44
|
+
|
|
45
|
+
// React event targets
|
|
46
|
+
var REACT_EVENT_TARGET_TOUCH_HIT = hasSymbol ? Symbol.for('react.event_target.touch_hit') : 0xead7;
|
|
47
|
+
var REACT_EVENT_FOCUS_TARGET = hasSymbol ? Symbol.for('react.event_target.focus') : 0xead8;
|
|
48
|
+
var REACT_EVENT_PRESS_TARGET = hasSymbol ? Symbol.for('react.event_target.press') : 0xead9;
|
|
65
49
|
|
|
66
50
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
67
51
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
52
|
+
|
|
68
53
|
function getIteratorFn(maybeIterable) {
|
|
69
54
|
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
70
55
|
return null;
|
|
71
56
|
}
|
|
72
|
-
|
|
73
57
|
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
74
|
-
|
|
75
58
|
if (typeof maybeIterator === 'function') {
|
|
76
59
|
return maybeIterator;
|
|
77
60
|
}
|
|
78
|
-
|
|
79
61
|
return null;
|
|
80
62
|
}
|
|
81
63
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
64
|
+
// Do not require this module directly! Use a normal error constructor with
|
|
65
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
66
|
+
// build, and in production they will be minified.
|
|
67
|
+
|
|
68
|
+
// Do not require this module directly! Use a normal error constructor with
|
|
69
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
70
|
+
// build, and in production they will be minified.
|
|
71
|
+
|
|
72
|
+
function ReactError(message) {
|
|
73
|
+
var error = new Error(message);
|
|
74
|
+
error.name = 'Invariant Violation';
|
|
75
|
+
return error;
|
|
76
|
+
}
|
|
92
77
|
|
|
93
78
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
79
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
80
|
+
*
|
|
81
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
82
|
+
* to provide information about what broke and what you were
|
|
83
|
+
* expecting.
|
|
84
|
+
*
|
|
85
|
+
* The invariant message will be stripped in production, but the invariant
|
|
86
|
+
* will remain to ensure logic does not differ in production.
|
|
96
87
|
*/
|
|
97
|
-
var ReactCurrentBatchConfig = {
|
|
98
|
-
transition: 0
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
var ReactCurrentActQueue = {
|
|
102
|
-
current: null,
|
|
103
|
-
// Our internal tests use a custom implementation of `act` that works by
|
|
104
|
-
// mocking the Scheduler package. Use this field to disable the `act` warning.
|
|
105
|
-
// TODO: Maybe the warning should be disabled by default, and then turned
|
|
106
|
-
// on at the testing frameworks layer? Instead of what we do now, which
|
|
107
|
-
// is check if a `jest` global is defined.
|
|
108
|
-
disableActWarning: false
|
|
109
|
-
};
|
|
110
88
|
|
|
111
89
|
/**
|
|
112
|
-
*
|
|
90
|
+
* Forked from fbjs/warning:
|
|
91
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
113
92
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
93
|
+
* Only change is we use console.warn instead of console.error,
|
|
94
|
+
* and do nothing when 'console' is not supported.
|
|
95
|
+
* This really simplifies the code.
|
|
96
|
+
* ---
|
|
97
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
98
|
+
* This can be used to log issues in development environments in critical
|
|
99
|
+
* paths. Removing the logging code for production environments will keep the
|
|
100
|
+
* same logic and follow the same code paths.
|
|
116
101
|
*/
|
|
117
|
-
var ReactCurrentOwner = {
|
|
118
|
-
/**
|
|
119
|
-
* @internal
|
|
120
|
-
* @type {ReactComponent}
|
|
121
|
-
*/
|
|
122
|
-
current: null
|
|
123
|
-
};
|
|
124
102
|
|
|
125
|
-
var
|
|
126
|
-
var currentExtraStackFrame = null;
|
|
127
|
-
function setExtraStackFrame(stack) {
|
|
128
|
-
{
|
|
129
|
-
currentExtraStackFrame = stack;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
103
|
+
var lowPriorityWarning = function () {};
|
|
132
104
|
|
|
133
105
|
{
|
|
134
|
-
|
|
135
|
-
{
|
|
136
|
-
|
|
106
|
+
var printWarning = function (format) {
|
|
107
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
108
|
+
args[_key - 1] = arguments[_key];
|
|
137
109
|
}
|
|
138
|
-
}; // Stack implementation injected by the current renderer.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
142
|
-
|
|
143
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
144
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
|
145
|
-
|
|
146
|
-
if (currentExtraStackFrame) {
|
|
147
|
-
stack += currentExtraStackFrame;
|
|
148
|
-
} // Delegate to the injected renderer-specific implementation
|
|
149
110
|
|
|
111
|
+
var argIndex = 0;
|
|
112
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
113
|
+
return args[argIndex++];
|
|
114
|
+
});
|
|
115
|
+
if (typeof console !== 'undefined') {
|
|
116
|
+
console.warn(message);
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
// --- Welcome to debugging React ---
|
|
120
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
121
|
+
// to find the callsite that caused this warning to fire.
|
|
122
|
+
throw new Error(message);
|
|
123
|
+
} catch (x) {}
|
|
124
|
+
};
|
|
150
125
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
stack += impl() || '';
|
|
126
|
+
lowPriorityWarning = function (condition, format) {
|
|
127
|
+
if (format === undefined) {
|
|
128
|
+
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
155
129
|
}
|
|
130
|
+
if (!condition) {
|
|
131
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
132
|
+
args[_key2 - 2] = arguments[_key2];
|
|
133
|
+
}
|
|
156
134
|
|
|
157
|
-
|
|
135
|
+
printWarning.apply(undefined, [format].concat(args));
|
|
136
|
+
}
|
|
158
137
|
};
|
|
159
138
|
}
|
|
160
139
|
|
|
161
|
-
var
|
|
162
|
-
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
163
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
164
|
-
ReactCurrentOwner: ReactCurrentOwner,
|
|
165
|
-
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
166
|
-
assign: _assign
|
|
167
|
-
};
|
|
140
|
+
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
168
141
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
144
|
+
* This can be used to log issues in development environments in critical
|
|
145
|
+
* paths. Removing the logging code for production environments will keep the
|
|
146
|
+
* same logic and follow the same code paths.
|
|
147
|
+
*/
|
|
173
148
|
|
|
174
|
-
|
|
175
|
-
//
|
|
176
|
-
// In PROD (or in packages without access to React internals),
|
|
177
|
-
// they are left as they are instead.
|
|
149
|
+
var warningWithoutStack = function () {};
|
|
178
150
|
|
|
179
|
-
|
|
180
|
-
{
|
|
181
|
-
for (var _len = arguments.length, args =
|
|
182
|
-
args[_key -
|
|
151
|
+
{
|
|
152
|
+
warningWithoutStack = function (condition, format) {
|
|
153
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
154
|
+
args[_key - 2] = arguments[_key];
|
|
183
155
|
}
|
|
184
156
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
function error(format) {
|
|
189
|
-
{
|
|
190
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
191
|
-
args[_key2 - 1] = arguments[_key2];
|
|
157
|
+
if (format === undefined) {
|
|
158
|
+
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
192
159
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function printWarning(level, format, args) {
|
|
199
|
-
// When changing this logic, you might want to also
|
|
200
|
-
// update consoleWithStackDev.www.js as well.
|
|
201
|
-
{
|
|
202
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
203
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
204
|
-
|
|
205
|
-
if (stack !== '') {
|
|
206
|
-
format += '%s';
|
|
207
|
-
args = args.concat([stack]);
|
|
160
|
+
if (args.length > 8) {
|
|
161
|
+
// Check before the condition to catch violations early.
|
|
162
|
+
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
|
208
163
|
}
|
|
164
|
+
if (condition) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (typeof console !== 'undefined') {
|
|
168
|
+
var argsWithFormat = args.map(function (item) {
|
|
169
|
+
return '' + item;
|
|
170
|
+
});
|
|
171
|
+
argsWithFormat.unshift('Warning: ' + format);
|
|
209
172
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
173
|
+
// We intentionally don't use spread (or .apply) directly because it
|
|
174
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
175
|
+
Function.prototype.apply.call(console.error, console, argsWithFormat);
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
// --- Welcome to debugging React ---
|
|
179
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
180
|
+
// to find the callsite that caused this warning to fire.
|
|
181
|
+
var argIndex = 0;
|
|
182
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
183
|
+
return args[argIndex++];
|
|
184
|
+
});
|
|
185
|
+
throw new Error(message);
|
|
186
|
+
} catch (x) {}
|
|
187
|
+
};
|
|
220
188
|
}
|
|
221
189
|
|
|
190
|
+
var warningWithoutStack$1 = warningWithoutStack;
|
|
191
|
+
|
|
222
192
|
var didWarnStateUpdateForUnmountedComponent = {};
|
|
223
193
|
|
|
224
194
|
function warnNoop(publicInstance, callerName) {
|
|
225
195
|
{
|
|
226
196
|
var _constructor = publicInstance.constructor;
|
|
227
197
|
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
228
|
-
var warningKey = componentName +
|
|
229
|
-
|
|
198
|
+
var warningKey = componentName + '.' + callerName;
|
|
230
199
|
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
231
200
|
return;
|
|
232
201
|
}
|
|
233
|
-
|
|
234
|
-
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);
|
|
235
|
-
|
|
202
|
+
warningWithoutStack$1(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
|
236
203
|
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
237
204
|
}
|
|
238
205
|
}
|
|
206
|
+
|
|
239
207
|
/**
|
|
240
208
|
* This is the abstract API for an update queue.
|
|
241
209
|
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
210
|
var ReactNoopUpdateQueue = {
|
|
245
211
|
/**
|
|
246
212
|
* Checks whether or not this composite component is mounted.
|
|
@@ -307,26 +273,25 @@ var ReactNoopUpdateQueue = {
|
|
|
307
273
|
};
|
|
308
274
|
|
|
309
275
|
var emptyObject = {};
|
|
310
|
-
|
|
311
276
|
{
|
|
312
277
|
Object.freeze(emptyObject);
|
|
313
278
|
}
|
|
279
|
+
|
|
314
280
|
/**
|
|
315
281
|
* Base class helpers for the updating state of a component.
|
|
316
282
|
*/
|
|
317
|
-
|
|
318
|
-
|
|
319
283
|
function Component(props, context, updater) {
|
|
320
284
|
this.props = props;
|
|
321
|
-
this.context = context;
|
|
322
|
-
|
|
323
|
-
this.refs = emptyObject;
|
|
285
|
+
this.context = context;
|
|
286
|
+
// If a component has string refs, we will assign a different object later.
|
|
287
|
+
this.refs = emptyObject;
|
|
288
|
+
// We initialize the default updater but the real one gets injected by the
|
|
324
289
|
// renderer.
|
|
325
|
-
|
|
326
290
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
327
291
|
}
|
|
328
292
|
|
|
329
293
|
Component.prototype.isReactComponent = {};
|
|
294
|
+
|
|
330
295
|
/**
|
|
331
296
|
* Sets a subset of the state. Always use this to mutate
|
|
332
297
|
* state. You should treat `this.state` as immutable.
|
|
@@ -352,16 +317,17 @@ Component.prototype.isReactComponent = {};
|
|
|
352
317
|
* @final
|
|
353
318
|
* @protected
|
|
354
319
|
*/
|
|
355
|
-
|
|
356
320
|
Component.prototype.setState = function (partialState, callback) {
|
|
357
|
-
|
|
358
|
-
{
|
|
359
|
-
|
|
321
|
+
(function () {
|
|
322
|
+
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
323
|
+
{
|
|
324
|
+
throw ReactError('setState(...): takes an object of state variables to update or a function which returns an object of state variables.');
|
|
325
|
+
}
|
|
360
326
|
}
|
|
361
|
-
}
|
|
362
|
-
|
|
327
|
+
})();
|
|
363
328
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
364
329
|
};
|
|
330
|
+
|
|
365
331
|
/**
|
|
366
332
|
* Forces an update. This should only be invoked when it is known with
|
|
367
333
|
* certainty that we are **not** in a DOM transaction.
|
|
@@ -376,34 +342,28 @@ Component.prototype.setState = function (partialState, callback) {
|
|
|
376
342
|
* @final
|
|
377
343
|
* @protected
|
|
378
344
|
*/
|
|
379
|
-
|
|
380
|
-
|
|
381
345
|
Component.prototype.forceUpdate = function (callback) {
|
|
382
346
|
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
383
347
|
};
|
|
348
|
+
|
|
384
349
|
/**
|
|
385
350
|
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
386
351
|
* we would like to deprecate them, we're not going to move them over to this
|
|
387
352
|
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
388
353
|
*/
|
|
389
|
-
|
|
390
|
-
|
|
391
354
|
{
|
|
392
355
|
var deprecatedAPIs = {
|
|
393
356
|
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
394
357
|
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
395
358
|
};
|
|
396
|
-
|
|
397
359
|
var defineDeprecationWarning = function (methodName, info) {
|
|
398
360
|
Object.defineProperty(Component.prototype, methodName, {
|
|
399
361
|
get: function () {
|
|
400
|
-
|
|
401
|
-
|
|
362
|
+
lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
402
363
|
return undefined;
|
|
403
364
|
}
|
|
404
365
|
});
|
|
405
366
|
};
|
|
406
|
-
|
|
407
367
|
for (var fnName in deprecatedAPIs) {
|
|
408
368
|
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
409
369
|
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
@@ -412,25 +372,23 @@ Component.prototype.forceUpdate = function (callback) {
|
|
|
412
372
|
}
|
|
413
373
|
|
|
414
374
|
function ComponentDummy() {}
|
|
415
|
-
|
|
416
375
|
ComponentDummy.prototype = Component.prototype;
|
|
376
|
+
|
|
417
377
|
/**
|
|
418
378
|
* Convenience component with default shallow equality check for sCU.
|
|
419
379
|
*/
|
|
420
|
-
|
|
421
380
|
function PureComponent(props, context, updater) {
|
|
422
381
|
this.props = props;
|
|
423
|
-
this.context = context;
|
|
424
|
-
|
|
382
|
+
this.context = context;
|
|
383
|
+
// If a component has string refs, we will assign a different object later.
|
|
425
384
|
this.refs = emptyObject;
|
|
426
385
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
427
386
|
}
|
|
428
387
|
|
|
429
388
|
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
430
|
-
pureComponentPrototype.constructor = PureComponent;
|
|
431
|
-
|
|
389
|
+
pureComponentPrototype.constructor = PureComponent;
|
|
390
|
+
// Avoid an extra prototype jump for these methods.
|
|
432
391
|
_assign(pureComponentPrototype, Component.prototype);
|
|
433
|
-
|
|
434
392
|
pureComponentPrototype.isPureReactComponent = true;
|
|
435
393
|
|
|
436
394
|
// an immutable object with a single mutable value
|
|
@@ -438,173 +396,340 @@ function createRef() {
|
|
|
438
396
|
var refObject = {
|
|
439
397
|
current: null
|
|
440
398
|
};
|
|
441
|
-
|
|
442
399
|
{
|
|
443
400
|
Object.seal(refObject);
|
|
444
401
|
}
|
|
445
|
-
|
|
446
402
|
return refObject;
|
|
447
403
|
}
|
|
448
404
|
|
|
449
|
-
|
|
405
|
+
/**
|
|
406
|
+
* Keeps track of the current dispatcher.
|
|
407
|
+
*/
|
|
408
|
+
var ReactCurrentDispatcher = {
|
|
409
|
+
/**
|
|
410
|
+
* @internal
|
|
411
|
+
* @type {ReactComponent}
|
|
412
|
+
*/
|
|
413
|
+
current: null
|
|
414
|
+
};
|
|
450
415
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
416
|
+
/**
|
|
417
|
+
* Keeps track of the current owner.
|
|
418
|
+
*
|
|
419
|
+
* The current owner is the component who should own any components that are
|
|
420
|
+
* currently being constructed.
|
|
421
|
+
*/
|
|
422
|
+
var ReactCurrentOwner = {
|
|
423
|
+
/**
|
|
424
|
+
* @internal
|
|
425
|
+
* @type {ReactComponent}
|
|
426
|
+
*/
|
|
427
|
+
current: null
|
|
428
|
+
};
|
|
454
429
|
|
|
455
|
-
|
|
456
|
-
var displayName = outerType.displayName;
|
|
430
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
457
431
|
|
|
458
|
-
|
|
459
|
-
|
|
432
|
+
var describeComponentFrame = function (name, source, ownerName) {
|
|
433
|
+
var sourceInfo = '';
|
|
434
|
+
if (source) {
|
|
435
|
+
var path = source.fileName;
|
|
436
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
437
|
+
{
|
|
438
|
+
// In DEV, include code for a common special case:
|
|
439
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
440
|
+
if (/^index\./.test(fileName)) {
|
|
441
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
442
|
+
if (match) {
|
|
443
|
+
var pathBeforeSlash = match[1];
|
|
444
|
+
if (pathBeforeSlash) {
|
|
445
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
446
|
+
fileName = folderName + '/' + fileName;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
452
|
+
} else if (ownerName) {
|
|
453
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
460
454
|
}
|
|
455
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
var Resolved = 1;
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
462
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
// In some cases, StrictMode should also double-render lifecycles.
|
|
469
|
+
// This can be confusing for tests though,
|
|
470
|
+
// And it can be bad for performance in production.
|
|
471
|
+
// This feature flag can be used to control the behavior:
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
475
|
+
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
// Gather advanced timing metrics for Profiler subtrees.
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
// Trace which interactions trigger each commit.
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
// Only used in www builds.
|
|
488
|
+
// TODO: true? Here it might just be false.
|
|
489
|
+
|
|
490
|
+
// Only used in www builds.
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
// Only used in www builds.
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
// Disable javascript: URL strings in href for XSS protection.
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
// Disables yielding during render in Concurrent Mode. Used for debugging only.
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
// React Fire: prevent the value and checked attributes from syncing
|
|
503
|
+
// with their related DOM properties
|
|
461
504
|
|
|
462
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
463
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
464
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
465
505
|
|
|
506
|
+
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
507
|
+
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
508
|
+
var enableStableConcurrentModeAPIs = false;
|
|
466
509
|
|
|
467
|
-
function getContextName(type) {
|
|
468
|
-
return type.displayName || 'Context';
|
|
469
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
470
510
|
|
|
471
511
|
|
|
472
|
-
|
|
512
|
+
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
513
|
+
// This is a flag so we can fix warnings in RN core before turning it on
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
// Experimental React Events support. Only used in www builds for now.
|
|
517
|
+
var enableEventAPI = false;
|
|
518
|
+
|
|
519
|
+
// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
520
|
+
var enableJSXTransformAPI = false;
|
|
521
|
+
|
|
522
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
523
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
524
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function getComponentName(type) {
|
|
473
528
|
if (type == null) {
|
|
474
529
|
// Host root, text node or just invalid type.
|
|
475
530
|
return null;
|
|
476
531
|
}
|
|
477
|
-
|
|
478
532
|
{
|
|
479
533
|
if (typeof type.tag === 'number') {
|
|
480
|
-
|
|
534
|
+
warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
481
535
|
}
|
|
482
536
|
}
|
|
483
|
-
|
|
484
537
|
if (typeof type === 'function') {
|
|
485
538
|
return type.displayName || type.name || null;
|
|
486
539
|
}
|
|
487
|
-
|
|
488
540
|
if (typeof type === 'string') {
|
|
489
541
|
return type;
|
|
490
542
|
}
|
|
491
|
-
|
|
492
543
|
switch (type) {
|
|
493
|
-
case
|
|
544
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
545
|
+
return 'ConcurrentMode';
|
|
546
|
+
case REACT_FRAGMENT_TYPE:
|
|
494
547
|
return 'Fragment';
|
|
495
|
-
|
|
496
548
|
case REACT_PORTAL_TYPE:
|
|
497
549
|
return 'Portal';
|
|
498
|
-
|
|
499
|
-
case exports.Profiler:
|
|
550
|
+
case REACT_PROFILER_TYPE:
|
|
500
551
|
return 'Profiler';
|
|
501
|
-
|
|
502
|
-
case exports.StrictMode:
|
|
552
|
+
case REACT_STRICT_MODE_TYPE:
|
|
503
553
|
return 'StrictMode';
|
|
504
|
-
|
|
505
|
-
case exports.Suspense:
|
|
554
|
+
case REACT_SUSPENSE_TYPE:
|
|
506
555
|
return 'Suspense';
|
|
507
|
-
|
|
508
|
-
case exports.SuspenseList:
|
|
509
|
-
return 'SuspenseList';
|
|
510
|
-
|
|
511
|
-
case exports.unstable_Cache:
|
|
512
|
-
return 'Cache';
|
|
513
556
|
}
|
|
514
|
-
|
|
515
557
|
if (typeof type === 'object') {
|
|
516
558
|
switch (type.$$typeof) {
|
|
517
559
|
case REACT_CONTEXT_TYPE:
|
|
518
|
-
|
|
519
|
-
return getContextName(context) + '.Consumer';
|
|
520
|
-
|
|
560
|
+
return 'Context.Consumer';
|
|
521
561
|
case REACT_PROVIDER_TYPE:
|
|
522
|
-
|
|
523
|
-
return getContextName(provider._context) + '.Provider';
|
|
524
|
-
|
|
562
|
+
return 'Context.Provider';
|
|
525
563
|
case REACT_FORWARD_REF_TYPE:
|
|
526
564
|
return getWrappedName(type, type.render, 'ForwardRef');
|
|
527
|
-
|
|
528
565
|
case REACT_MEMO_TYPE:
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
if (outerName !== null) {
|
|
532
|
-
return outerName;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
536
|
-
|
|
566
|
+
return getComponentName(type.type);
|
|
537
567
|
case REACT_LAZY_TYPE:
|
|
538
568
|
{
|
|
539
|
-
var
|
|
540
|
-
var
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
569
|
+
var thenable = type;
|
|
570
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
571
|
+
if (resolvedThenable) {
|
|
572
|
+
return getComponentName(resolvedThenable);
|
|
573
|
+
}
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
case REACT_EVENT_COMPONENT_TYPE:
|
|
577
|
+
{
|
|
578
|
+
if (enableEventAPI) {
|
|
579
|
+
var eventComponent = type;
|
|
580
|
+
var displayName = eventComponent.displayName;
|
|
581
|
+
if (displayName !== undefined) {
|
|
582
|
+
return displayName;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
case REACT_EVENT_TARGET_TYPE:
|
|
588
|
+
{
|
|
589
|
+
if (enableEventAPI) {
|
|
590
|
+
var eventTarget = type;
|
|
591
|
+
if (eventTarget.type === REACT_EVENT_TARGET_TOUCH_HIT) {
|
|
592
|
+
return 'TouchHitTarget';
|
|
593
|
+
} else if (eventTarget.type === REACT_EVENT_FOCUS_TARGET) {
|
|
594
|
+
return 'FocusTarget';
|
|
595
|
+
} else if (eventTarget.type === REACT_EVENT_PRESS_TARGET) {
|
|
596
|
+
return 'PressTarget';
|
|
597
|
+
}
|
|
598
|
+
var _displayName = eventTarget.displayName;
|
|
599
|
+
if (_displayName !== undefined) {
|
|
600
|
+
return _displayName;
|
|
601
|
+
}
|
|
547
602
|
}
|
|
548
603
|
}
|
|
549
604
|
}
|
|
550
605
|
}
|
|
551
|
-
|
|
552
606
|
return null;
|
|
553
607
|
}
|
|
554
608
|
|
|
555
|
-
var
|
|
609
|
+
var ReactDebugCurrentFrame = {};
|
|
556
610
|
|
|
557
|
-
var
|
|
558
|
-
key: true,
|
|
559
|
-
ref: true,
|
|
560
|
-
__self: true,
|
|
561
|
-
__source: true
|
|
562
|
-
};
|
|
563
|
-
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
611
|
+
var currentlyValidatingElement = null;
|
|
564
612
|
|
|
565
|
-
{
|
|
566
|
-
|
|
613
|
+
function setCurrentlyValidatingElement(element) {
|
|
614
|
+
{
|
|
615
|
+
currentlyValidatingElement = element;
|
|
616
|
+
}
|
|
567
617
|
}
|
|
568
618
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
619
|
+
{
|
|
620
|
+
// Stack implementation injected by the current renderer.
|
|
621
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
573
622
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
623
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
624
|
+
var stack = '';
|
|
625
|
+
|
|
626
|
+
// Add an extra top frame while an element is being validated
|
|
627
|
+
if (currentlyValidatingElement) {
|
|
628
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
629
|
+
var owner = currentlyValidatingElement._owner;
|
|
630
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
577
631
|
}
|
|
578
|
-
}
|
|
579
632
|
|
|
580
|
-
|
|
581
|
-
|
|
633
|
+
// Delegate to the injected renderer-specific implementation
|
|
634
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
635
|
+
if (impl) {
|
|
636
|
+
stack += impl() || '';
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
return stack;
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
var ReactSharedInternals = {
|
|
644
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
645
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
646
|
+
// used by act()
|
|
647
|
+
ReactShouldWarnActingUpdates: { current: false },
|
|
648
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
649
|
+
assign: _assign
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
{
|
|
653
|
+
_assign(ReactSharedInternals, {
|
|
654
|
+
// These should not be included in production.
|
|
655
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
656
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
657
|
+
// TODO: remove in React 17.0.
|
|
658
|
+
ReactComponentTreeHook: {}
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
664
|
+
* This can be used to log issues in development environments in critical
|
|
665
|
+
* paths. Removing the logging code for production environments will keep the
|
|
666
|
+
* same logic and follow the same code paths.
|
|
667
|
+
*/
|
|
668
|
+
|
|
669
|
+
var warning = warningWithoutStack$1;
|
|
670
|
+
|
|
671
|
+
{
|
|
672
|
+
warning = function (condition, format) {
|
|
673
|
+
if (condition) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
677
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
678
|
+
// eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
679
|
+
|
|
680
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
681
|
+
args[_key - 2] = arguments[_key];
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
var warning$1 = warning;
|
|
689
|
+
|
|
690
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
691
|
+
|
|
692
|
+
var RESERVED_PROPS = {
|
|
693
|
+
key: true,
|
|
694
|
+
ref: true,
|
|
695
|
+
__self: true,
|
|
696
|
+
__source: true
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
var specialPropKeyWarningShown = void 0;
|
|
700
|
+
var specialPropRefWarningShown = void 0;
|
|
701
|
+
|
|
702
|
+
function hasValidRef(config) {
|
|
703
|
+
{
|
|
704
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
705
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
706
|
+
if (getter && getter.isReactWarning) {
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return config.ref !== undefined;
|
|
712
|
+
}
|
|
582
713
|
|
|
583
714
|
function hasValidKey(config) {
|
|
584
715
|
{
|
|
585
716
|
if (hasOwnProperty.call(config, 'key')) {
|
|
586
717
|
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
587
|
-
|
|
588
718
|
if (getter && getter.isReactWarning) {
|
|
589
719
|
return false;
|
|
590
720
|
}
|
|
591
721
|
}
|
|
592
722
|
}
|
|
593
|
-
|
|
594
723
|
return config.key !== undefined;
|
|
595
724
|
}
|
|
596
725
|
|
|
597
726
|
function defineKeyPropWarningGetter(props, displayName) {
|
|
598
727
|
var warnAboutAccessingKey = function () {
|
|
599
|
-
{
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
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://reactjs.org/link/special-props)', displayName);
|
|
604
|
-
}
|
|
728
|
+
if (!specialPropKeyWarningShown) {
|
|
729
|
+
specialPropKeyWarningShown = true;
|
|
730
|
+
warningWithoutStack$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
605
731
|
}
|
|
606
732
|
};
|
|
607
|
-
|
|
608
733
|
warnAboutAccessingKey.isReactWarning = true;
|
|
609
734
|
Object.defineProperty(props, 'key', {
|
|
610
735
|
get: warnAboutAccessingKey,
|
|
@@ -614,15 +739,11 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
614
739
|
|
|
615
740
|
function defineRefPropWarningGetter(props, displayName) {
|
|
616
741
|
var warnAboutAccessingRef = function () {
|
|
617
|
-
{
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
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://reactjs.org/link/special-props)', displayName);
|
|
622
|
-
}
|
|
742
|
+
if (!specialPropRefWarningShown) {
|
|
743
|
+
specialPropRefWarningShown = true;
|
|
744
|
+
warningWithoutStack$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
623
745
|
}
|
|
624
746
|
};
|
|
625
|
-
|
|
626
747
|
warnAboutAccessingRef.isReactWarning = true;
|
|
627
748
|
Object.defineProperty(props, 'ref', {
|
|
628
749
|
get: warnAboutAccessingRef,
|
|
@@ -630,23 +751,10 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
630
751
|
});
|
|
631
752
|
}
|
|
632
753
|
|
|
633
|
-
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
634
|
-
{
|
|
635
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
636
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
637
|
-
|
|
638
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
639
|
-
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://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
|
|
640
|
-
|
|
641
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
754
|
/**
|
|
647
755
|
* Factory method to create a new React element. This no longer adheres to
|
|
648
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
649
|
-
* will
|
|
756
|
+
* the class pattern, so do not use new to call it. Also, no instanceof check
|
|
757
|
+
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
650
758
|
* if something is a React Element.
|
|
651
759
|
*
|
|
652
760
|
* @param {*} type
|
|
@@ -663,17 +771,17 @@ function warnIfStringRefCannotBeAutoConverted(config) {
|
|
|
663
771
|
* indicating filename, line number, and/or other information.
|
|
664
772
|
* @internal
|
|
665
773
|
*/
|
|
666
|
-
|
|
667
|
-
|
|
668
774
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
669
775
|
var element = {
|
|
670
776
|
// This tag allows us to uniquely identify this as a React Element
|
|
671
777
|
$$typeof: REACT_ELEMENT_TYPE,
|
|
778
|
+
|
|
672
779
|
// Built-in properties that belong on the element
|
|
673
780
|
type: type,
|
|
674
781
|
key: key,
|
|
675
782
|
ref: ref,
|
|
676
783
|
props: props,
|
|
784
|
+
|
|
677
785
|
// Record the component responsible for creating this element.
|
|
678
786
|
_owner: owner
|
|
679
787
|
};
|
|
@@ -683,33 +791,33 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
683
791
|
// an external backing store so that we can freeze the whole object.
|
|
684
792
|
// This can be replaced with a WeakMap once they are implemented in
|
|
685
793
|
// commonly used development environments.
|
|
686
|
-
element._store = {};
|
|
794
|
+
element._store = {};
|
|
795
|
+
|
|
796
|
+
// To make comparing ReactElements easier for testing purposes, we make
|
|
687
797
|
// the validation flag non-enumerable (where possible, which should
|
|
688
798
|
// include every environment we run tests in), so the test framework
|
|
689
799
|
// ignores it.
|
|
690
|
-
|
|
691
800
|
Object.defineProperty(element._store, 'validated', {
|
|
692
801
|
configurable: false,
|
|
693
802
|
enumerable: false,
|
|
694
803
|
writable: true,
|
|
695
804
|
value: false
|
|
696
|
-
});
|
|
697
|
-
|
|
805
|
+
});
|
|
806
|
+
// self and source are DEV only properties.
|
|
698
807
|
Object.defineProperty(element, '_self', {
|
|
699
808
|
configurable: false,
|
|
700
809
|
enumerable: false,
|
|
701
810
|
writable: false,
|
|
702
811
|
value: self
|
|
703
|
-
});
|
|
812
|
+
});
|
|
813
|
+
// Two elements created in two different places should be considered
|
|
704
814
|
// equal for testing purposes and therefore we hide it from enumeration.
|
|
705
|
-
|
|
706
815
|
Object.defineProperty(element, '_source', {
|
|
707
816
|
configurable: false,
|
|
708
817
|
enumerable: false,
|
|
709
818
|
writable: false,
|
|
710
819
|
value: source
|
|
711
820
|
});
|
|
712
|
-
|
|
713
821
|
if (Object.freeze) {
|
|
714
822
|
Object.freeze(element.props);
|
|
715
823
|
Object.freeze(element);
|
|
@@ -718,15 +826,84 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
718
826
|
|
|
719
827
|
return element;
|
|
720
828
|
};
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
832
|
+
* @param {*} type
|
|
833
|
+
* @param {object} props
|
|
834
|
+
* @param {string} key
|
|
835
|
+
*/
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
840
|
+
* @param {*} type
|
|
841
|
+
* @param {object} props
|
|
842
|
+
* @param {string} key
|
|
843
|
+
*/
|
|
844
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
845
|
+
var propName = void 0;
|
|
846
|
+
|
|
847
|
+
// Reserved names are extracted
|
|
848
|
+
var props = {};
|
|
849
|
+
|
|
850
|
+
var key = null;
|
|
851
|
+
var ref = null;
|
|
852
|
+
|
|
853
|
+
if (hasValidRef(config)) {
|
|
854
|
+
ref = config.ref;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
if (hasValidKey(config)) {
|
|
858
|
+
key = '' + config.key;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
// Remaining properties are added to a new props object
|
|
862
|
+
for (propName in config) {
|
|
863
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
864
|
+
props[propName] = config[propName];
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// intentionally not checking if key was set above
|
|
869
|
+
// this key is higher priority as it's static
|
|
870
|
+
if (maybeKey !== undefined) {
|
|
871
|
+
key = '' + maybeKey;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
// Resolve default props
|
|
875
|
+
if (type && type.defaultProps) {
|
|
876
|
+
var defaultProps = type.defaultProps;
|
|
877
|
+
for (propName in defaultProps) {
|
|
878
|
+
if (props[propName] === undefined) {
|
|
879
|
+
props[propName] = defaultProps[propName];
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
if (key || ref) {
|
|
885
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
886
|
+
if (key) {
|
|
887
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
888
|
+
}
|
|
889
|
+
if (ref) {
|
|
890
|
+
defineRefPropWarningGetter(props, displayName);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
895
|
+
}
|
|
896
|
+
|
|
721
897
|
/**
|
|
722
898
|
* Create and return a new ReactElement of the given type.
|
|
723
899
|
* See https://reactjs.org/docs/react-api.html#createelement
|
|
724
900
|
*/
|
|
725
|
-
|
|
726
901
|
function createElement(type, config, children) {
|
|
727
|
-
var propName
|
|
902
|
+
var propName = void 0;
|
|
728
903
|
|
|
904
|
+
// Reserved names are extracted
|
|
729
905
|
var props = {};
|
|
906
|
+
|
|
730
907
|
var key = null;
|
|
731
908
|
var ref = null;
|
|
732
909
|
var self = null;
|
|
@@ -735,105 +912,103 @@ function createElement(type, config, children) {
|
|
|
735
912
|
if (config != null) {
|
|
736
913
|
if (hasValidRef(config)) {
|
|
737
914
|
ref = config.ref;
|
|
738
|
-
|
|
739
|
-
{
|
|
740
|
-
warnIfStringRefCannotBeAutoConverted(config);
|
|
741
|
-
}
|
|
742
915
|
}
|
|
743
|
-
|
|
744
916
|
if (hasValidKey(config)) {
|
|
745
917
|
key = '' + config.key;
|
|
746
918
|
}
|
|
747
919
|
|
|
748
920
|
self = config.__self === undefined ? null : config.__self;
|
|
749
|
-
source = config.__source === undefined ? null : config.__source;
|
|
750
|
-
|
|
921
|
+
source = config.__source === undefined ? null : config.__source;
|
|
922
|
+
// Remaining properties are added to a new props object
|
|
751
923
|
for (propName in config) {
|
|
752
924
|
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
753
925
|
props[propName] = config[propName];
|
|
754
926
|
}
|
|
755
927
|
}
|
|
756
|
-
}
|
|
757
|
-
// the newly allocated props object.
|
|
758
|
-
|
|
928
|
+
}
|
|
759
929
|
|
|
930
|
+
// Children can be more than one argument, and those are transferred onto
|
|
931
|
+
// the newly allocated props object.
|
|
760
932
|
var childrenLength = arguments.length - 2;
|
|
761
|
-
|
|
762
933
|
if (childrenLength === 1) {
|
|
763
934
|
props.children = children;
|
|
764
935
|
} else if (childrenLength > 1) {
|
|
765
936
|
var childArray = Array(childrenLength);
|
|
766
|
-
|
|
767
937
|
for (var i = 0; i < childrenLength; i++) {
|
|
768
938
|
childArray[i] = arguments[i + 2];
|
|
769
939
|
}
|
|
770
|
-
|
|
771
940
|
{
|
|
772
941
|
if (Object.freeze) {
|
|
773
942
|
Object.freeze(childArray);
|
|
774
943
|
}
|
|
775
944
|
}
|
|
776
|
-
|
|
777
945
|
props.children = childArray;
|
|
778
|
-
}
|
|
779
|
-
|
|
946
|
+
}
|
|
780
947
|
|
|
948
|
+
// Resolve default props
|
|
781
949
|
if (type && type.defaultProps) {
|
|
782
950
|
var defaultProps = type.defaultProps;
|
|
783
|
-
|
|
784
951
|
for (propName in defaultProps) {
|
|
785
952
|
if (props[propName] === undefined) {
|
|
786
953
|
props[propName] = defaultProps[propName];
|
|
787
954
|
}
|
|
788
955
|
}
|
|
789
956
|
}
|
|
790
|
-
|
|
791
957
|
{
|
|
792
958
|
if (key || ref) {
|
|
793
959
|
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
794
|
-
|
|
795
960
|
if (key) {
|
|
796
961
|
defineKeyPropWarningGetter(props, displayName);
|
|
797
962
|
}
|
|
798
|
-
|
|
799
963
|
if (ref) {
|
|
800
964
|
defineRefPropWarningGetter(props, displayName);
|
|
801
965
|
}
|
|
802
966
|
}
|
|
803
967
|
}
|
|
804
|
-
|
|
805
968
|
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
806
969
|
}
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* Return a function that produces ReactElements of a given type.
|
|
973
|
+
* See https://reactjs.org/docs/react-api.html#createfactory
|
|
974
|
+
*/
|
|
975
|
+
|
|
976
|
+
|
|
807
977
|
function cloneAndReplaceKey(oldElement, newKey) {
|
|
808
978
|
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
979
|
+
|
|
809
980
|
return newElement;
|
|
810
981
|
}
|
|
982
|
+
|
|
811
983
|
/**
|
|
812
984
|
* Clone and return a new ReactElement using element as the starting point.
|
|
813
985
|
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
814
986
|
*/
|
|
815
|
-
|
|
816
987
|
function cloneElement(element, config, children) {
|
|
817
|
-
|
|
818
|
-
{
|
|
819
|
-
|
|
988
|
+
(function () {
|
|
989
|
+
if (!!(element === null || element === undefined)) {
|
|
990
|
+
{
|
|
991
|
+
throw ReactError('React.cloneElement(...): The argument must be a React element, but you passed ' + element + '.');
|
|
992
|
+
}
|
|
820
993
|
}
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
var propName; // Original props are copied
|
|
994
|
+
})();
|
|
824
995
|
|
|
825
|
-
var
|
|
996
|
+
var propName = void 0;
|
|
826
997
|
|
|
998
|
+
// Original props are copied
|
|
999
|
+
var props = _assign({}, element.props);
|
|
827
1000
|
|
|
1001
|
+
// Reserved names are extracted
|
|
828
1002
|
var key = element.key;
|
|
829
|
-
var ref = element.ref;
|
|
830
|
-
|
|
831
|
-
var self = element._self;
|
|
1003
|
+
var ref = element.ref;
|
|
1004
|
+
// Self is preserved since the owner is preserved.
|
|
1005
|
+
var self = element._self;
|
|
1006
|
+
// Source is preserved since cloneElement is unlikely to be targeted by a
|
|
832
1007
|
// transpiler, and the original source is probably a better indicator of the
|
|
833
1008
|
// true owner.
|
|
1009
|
+
var source = element._source;
|
|
834
1010
|
|
|
835
|
-
|
|
836
|
-
|
|
1011
|
+
// Owner will be preserved, unless ref is overridden
|
|
837
1012
|
var owner = element._owner;
|
|
838
1013
|
|
|
839
1014
|
if (config != null) {
|
|
@@ -842,18 +1017,15 @@ function cloneElement(element, config, children) {
|
|
|
842
1017
|
ref = config.ref;
|
|
843
1018
|
owner = ReactCurrentOwner.current;
|
|
844
1019
|
}
|
|
845
|
-
|
|
846
1020
|
if (hasValidKey(config)) {
|
|
847
1021
|
key = '' + config.key;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
var defaultProps;
|
|
1022
|
+
}
|
|
852
1023
|
|
|
1024
|
+
// Remaining properties override existing props
|
|
1025
|
+
var defaultProps = void 0;
|
|
853
1026
|
if (element.type && element.type.defaultProps) {
|
|
854
1027
|
defaultProps = element.type.defaultProps;
|
|
855
1028
|
}
|
|
856
|
-
|
|
857
1029
|
for (propName in config) {
|
|
858
1030
|
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
859
1031
|
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
@@ -864,26 +1036,24 @@ function cloneElement(element, config, children) {
|
|
|
864
1036
|
}
|
|
865
1037
|
}
|
|
866
1038
|
}
|
|
867
|
-
}
|
|
868
|
-
// the newly allocated props object.
|
|
869
|
-
|
|
1039
|
+
}
|
|
870
1040
|
|
|
1041
|
+
// Children can be more than one argument, and those are transferred onto
|
|
1042
|
+
// the newly allocated props object.
|
|
871
1043
|
var childrenLength = arguments.length - 2;
|
|
872
|
-
|
|
873
1044
|
if (childrenLength === 1) {
|
|
874
1045
|
props.children = children;
|
|
875
1046
|
} else if (childrenLength > 1) {
|
|
876
1047
|
var childArray = Array(childrenLength);
|
|
877
|
-
|
|
878
1048
|
for (var i = 0; i < childrenLength; i++) {
|
|
879
1049
|
childArray[i] = arguments[i + 2];
|
|
880
1050
|
}
|
|
881
|
-
|
|
882
1051
|
props.children = childArray;
|
|
883
1052
|
}
|
|
884
1053
|
|
|
885
1054
|
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
886
1055
|
}
|
|
1056
|
+
|
|
887
1057
|
/**
|
|
888
1058
|
* Verifies the object is a ReactElement.
|
|
889
1059
|
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
@@ -891,65 +1061,86 @@ function cloneElement(element, config, children) {
|
|
|
891
1061
|
* @return {boolean} True if `object` is a ReactElement.
|
|
892
1062
|
* @final
|
|
893
1063
|
*/
|
|
894
|
-
|
|
895
1064
|
function isValidElement(object) {
|
|
896
1065
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
897
1066
|
}
|
|
898
1067
|
|
|
899
1068
|
var SEPARATOR = '.';
|
|
900
1069
|
var SUBSEPARATOR = ':';
|
|
1070
|
+
|
|
901
1071
|
/**
|
|
902
1072
|
* Escape and wrap key so it is safe to use as a reactid
|
|
903
1073
|
*
|
|
904
1074
|
* @param {string} key to be escaped.
|
|
905
1075
|
* @return {string} the escaped key.
|
|
906
1076
|
*/
|
|
907
|
-
|
|
908
1077
|
function escape(key) {
|
|
909
1078
|
var escapeRegex = /[=:]/g;
|
|
910
1079
|
var escaperLookup = {
|
|
911
1080
|
'=': '=0',
|
|
912
1081
|
':': '=2'
|
|
913
1082
|
};
|
|
914
|
-
var escapedString = key.replace(escapeRegex, function (match) {
|
|
1083
|
+
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
|
915
1084
|
return escaperLookup[match];
|
|
916
1085
|
});
|
|
1086
|
+
|
|
917
1087
|
return '$' + escapedString;
|
|
918
1088
|
}
|
|
1089
|
+
|
|
919
1090
|
/**
|
|
920
1091
|
* TODO: Test that a single child and an array with one item have the same key
|
|
921
1092
|
* pattern.
|
|
922
1093
|
*/
|
|
923
1094
|
|
|
924
|
-
|
|
925
1095
|
var didWarnAboutMaps = false;
|
|
926
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
927
1096
|
|
|
1097
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
928
1098
|
function escapeUserProvidedKey(text) {
|
|
929
|
-
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1099
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
var POOL_SIZE = 10;
|
|
1103
|
+
var traverseContextPool = [];
|
|
1104
|
+
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
1105
|
+
if (traverseContextPool.length) {
|
|
1106
|
+
var traverseContext = traverseContextPool.pop();
|
|
1107
|
+
traverseContext.result = mapResult;
|
|
1108
|
+
traverseContext.keyPrefix = keyPrefix;
|
|
1109
|
+
traverseContext.func = mapFunction;
|
|
1110
|
+
traverseContext.context = mapContext;
|
|
1111
|
+
traverseContext.count = 0;
|
|
1112
|
+
return traverseContext;
|
|
1113
|
+
} else {
|
|
1114
|
+
return {
|
|
1115
|
+
result: mapResult,
|
|
1116
|
+
keyPrefix: keyPrefix,
|
|
1117
|
+
func: mapFunction,
|
|
1118
|
+
context: mapContext,
|
|
1119
|
+
count: 0
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
930
1122
|
}
|
|
931
|
-
/**
|
|
932
|
-
* Generate a key string that identifies a element within a set.
|
|
933
|
-
*
|
|
934
|
-
* @param {*} element A element that could contain a manual key.
|
|
935
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
|
936
|
-
* @return {string}
|
|
937
|
-
*/
|
|
938
|
-
|
|
939
1123
|
|
|
940
|
-
function
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
return index.toString(36);
|
|
1124
|
+
function releaseTraverseContext(traverseContext) {
|
|
1125
|
+
traverseContext.result = null;
|
|
1126
|
+
traverseContext.keyPrefix = null;
|
|
1127
|
+
traverseContext.func = null;
|
|
1128
|
+
traverseContext.context = null;
|
|
1129
|
+
traverseContext.count = 0;
|
|
1130
|
+
if (traverseContextPool.length < POOL_SIZE) {
|
|
1131
|
+
traverseContextPool.push(traverseContext);
|
|
1132
|
+
}
|
|
950
1133
|
}
|
|
951
1134
|
|
|
952
|
-
|
|
1135
|
+
/**
|
|
1136
|
+
* @param {?*} children Children tree container.
|
|
1137
|
+
* @param {!string} nameSoFar Name of the key path so far.
|
|
1138
|
+
* @param {!function} callback Callback to invoke with each child found.
|
|
1139
|
+
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
1140
|
+
* process.
|
|
1141
|
+
* @return {!number} The number of children in this subtree.
|
|
1142
|
+
*/
|
|
1143
|
+
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
953
1144
|
var type = typeof children;
|
|
954
1145
|
|
|
955
1146
|
if (type === 'undefined' || type === 'boolean') {
|
|
@@ -967,95 +1158,66 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
|
967
1158
|
case 'number':
|
|
968
1159
|
invokeCallback = true;
|
|
969
1160
|
break;
|
|
970
|
-
|
|
971
1161
|
case 'object':
|
|
972
1162
|
switch (children.$$typeof) {
|
|
973
1163
|
case REACT_ELEMENT_TYPE:
|
|
974
1164
|
case REACT_PORTAL_TYPE:
|
|
975
1165
|
invokeCallback = true;
|
|
976
1166
|
}
|
|
977
|
-
|
|
978
1167
|
}
|
|
979
1168
|
}
|
|
980
1169
|
|
|
981
1170
|
if (invokeCallback) {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
// so that it's consistent if the number of children grows
|
|
985
|
-
|
|
986
|
-
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
987
|
-
|
|
988
|
-
if (isArray(mappedChild)) {
|
|
989
|
-
var escapedChildKey = '';
|
|
990
|
-
|
|
991
|
-
if (childKey != null) {
|
|
992
|
-
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
|
996
|
-
return c;
|
|
997
|
-
});
|
|
998
|
-
} else if (mappedChild != null) {
|
|
999
|
-
if (isValidElement(mappedChild)) {
|
|
1000
|
-
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
1001
|
-
// traverseAllChildren used to do for objects as children
|
|
1002
|
-
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1003
|
-
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
|
1004
|
-
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
array.push(mappedChild);
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1171
|
+
callback(traverseContext, children,
|
|
1172
|
+
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1173
|
+
// so that it's consistent if the number of children grows.
|
|
1174
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
1010
1175
|
return 1;
|
|
1011
1176
|
}
|
|
1012
1177
|
|
|
1013
|
-
var child;
|
|
1014
|
-
var nextName;
|
|
1178
|
+
var child = void 0;
|
|
1179
|
+
var nextName = void 0;
|
|
1015
1180
|
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1016
|
-
|
|
1017
1181
|
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1018
1182
|
|
|
1019
|
-
if (isArray(children)) {
|
|
1183
|
+
if (Array.isArray(children)) {
|
|
1020
1184
|
for (var i = 0; i < children.length; i++) {
|
|
1021
1185
|
child = children[i];
|
|
1022
|
-
nextName = nextNamePrefix +
|
|
1023
|
-
subtreeCount +=
|
|
1186
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
|
1187
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1024
1188
|
}
|
|
1025
1189
|
} else {
|
|
1026
1190
|
var iteratorFn = getIteratorFn(children);
|
|
1027
|
-
|
|
1028
1191
|
if (typeof iteratorFn === 'function') {
|
|
1029
|
-
var iterableChildren = children;
|
|
1030
|
-
|
|
1031
1192
|
{
|
|
1032
1193
|
// Warn about using Maps as children
|
|
1033
|
-
if (iteratorFn ===
|
|
1034
|
-
|
|
1035
|
-
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1194
|
+
if (iteratorFn === children.entries) {
|
|
1195
|
+
!didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
|
|
1038
1196
|
didWarnAboutMaps = true;
|
|
1039
1197
|
}
|
|
1040
1198
|
}
|
|
1041
1199
|
|
|
1042
|
-
var iterator = iteratorFn.call(
|
|
1043
|
-
var step;
|
|
1200
|
+
var iterator = iteratorFn.call(children);
|
|
1201
|
+
var step = void 0;
|
|
1044
1202
|
var ii = 0;
|
|
1045
|
-
|
|
1046
1203
|
while (!(step = iterator.next()).done) {
|
|
1047
1204
|
child = step.value;
|
|
1048
|
-
nextName = nextNamePrefix +
|
|
1049
|
-
subtreeCount +=
|
|
1205
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
1206
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1050
1207
|
}
|
|
1051
1208
|
} else if (type === 'object') {
|
|
1052
|
-
var
|
|
1053
|
-
|
|
1209
|
+
var addendum = '';
|
|
1054
1210
|
{
|
|
1211
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1212
|
+
}
|
|
1213
|
+
var childrenString = '' + children;
|
|
1214
|
+
(function () {
|
|
1055
1215
|
{
|
|
1056
|
-
|
|
1216
|
+
{
|
|
1217
|
+
throw ReactError('Objects are not valid as a React child (found: ' + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ').' + addendum);
|
|
1218
|
+
}
|
|
1057
1219
|
}
|
|
1058
|
-
}
|
|
1220
|
+
})();
|
|
1059
1221
|
}
|
|
1060
1222
|
}
|
|
1061
1223
|
|
|
@@ -1063,47 +1225,52 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
|
1063
1225
|
}
|
|
1064
1226
|
|
|
1065
1227
|
/**
|
|
1066
|
-
*
|
|
1228
|
+
* Traverses children that are typically specified as `props.children`, but
|
|
1229
|
+
* might also be specified through attributes:
|
|
1067
1230
|
*
|
|
1068
|
-
*
|
|
1231
|
+
* - `traverseAllChildren(this.props.children, ...)`
|
|
1232
|
+
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
1069
1233
|
*
|
|
1070
|
-
* The
|
|
1071
|
-
*
|
|
1234
|
+
* The `traverseContext` is an optional argument that is passed through the
|
|
1235
|
+
* entire traversal. It can be used to store accumulations or anything else that
|
|
1236
|
+
* the callback might find relevant.
|
|
1072
1237
|
*
|
|
1073
|
-
* @param {?*} children Children tree
|
|
1074
|
-
* @param {function
|
|
1075
|
-
* @param {
|
|
1076
|
-
* @return {
|
|
1238
|
+
* @param {?*} children Children tree object.
|
|
1239
|
+
* @param {!function} callback To invoke upon traversing each child.
|
|
1240
|
+
* @param {?*} traverseContext Context for traversal.
|
|
1241
|
+
* @return {!number} The number of children in this subtree.
|
|
1077
1242
|
*/
|
|
1078
|
-
function
|
|
1243
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
|
1079
1244
|
if (children == null) {
|
|
1080
|
-
return
|
|
1245
|
+
return 0;
|
|
1081
1246
|
}
|
|
1082
1247
|
|
|
1083
|
-
|
|
1084
|
-
var count = 0;
|
|
1085
|
-
mapIntoArray(children, result, '', '', function (child) {
|
|
1086
|
-
return func.call(context, child, count++);
|
|
1087
|
-
});
|
|
1088
|
-
return result;
|
|
1248
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1089
1249
|
}
|
|
1250
|
+
|
|
1090
1251
|
/**
|
|
1091
|
-
*
|
|
1092
|
-
* `props.children`.
|
|
1093
|
-
*
|
|
1094
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1252
|
+
* Generate a key string that identifies a component within a set.
|
|
1095
1253
|
*
|
|
1096
|
-
* @param {
|
|
1097
|
-
* @
|
|
1254
|
+
* @param {*} component A component that could contain a manual key.
|
|
1255
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
1256
|
+
* @return {string}
|
|
1098
1257
|
*/
|
|
1258
|
+
function getComponentKey(component, index) {
|
|
1259
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1260
|
+
// that we don't block potential future ES APIs.
|
|
1261
|
+
if (typeof component === 'object' && component !== null && component.key != null) {
|
|
1262
|
+
// Explicit key
|
|
1263
|
+
return escape(component.key);
|
|
1264
|
+
}
|
|
1265
|
+
// Implicit key determined by the index in the set
|
|
1266
|
+
return index.toString(36);
|
|
1267
|
+
}
|
|
1099
1268
|
|
|
1269
|
+
function forEachSingleChild(bookKeeping, child, name) {
|
|
1270
|
+
var func = bookKeeping.func,
|
|
1271
|
+
context = bookKeeping.context;
|
|
1100
1272
|
|
|
1101
|
-
|
|
1102
|
-
var n = 0;
|
|
1103
|
-
mapChildren(children, function () {
|
|
1104
|
-
n++; // Don't return anything
|
|
1105
|
-
});
|
|
1106
|
-
return n;
|
|
1273
|
+
func.call(context, child, bookKeeping.count++);
|
|
1107
1274
|
}
|
|
1108
1275
|
|
|
1109
1276
|
/**
|
|
@@ -1119,23 +1286,98 @@ function countChildren(children) {
|
|
|
1119
1286
|
* @param {*} forEachContext Context for forEachContext.
|
|
1120
1287
|
*/
|
|
1121
1288
|
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1289
|
+
if (children == null) {
|
|
1290
|
+
return children;
|
|
1291
|
+
}
|
|
1292
|
+
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
|
1293
|
+
traverseAllChildren(children, forEachSingleChild, traverseContext);
|
|
1294
|
+
releaseTraverseContext(traverseContext);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1298
|
+
var result = bookKeeping.result,
|
|
1299
|
+
keyPrefix = bookKeeping.keyPrefix,
|
|
1300
|
+
func = bookKeeping.func,
|
|
1301
|
+
context = bookKeeping.context;
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1305
|
+
if (Array.isArray(mappedChild)) {
|
|
1306
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
|
1307
|
+
return c;
|
|
1308
|
+
});
|
|
1309
|
+
} else if (mappedChild != null) {
|
|
1310
|
+
if (isValidElement(mappedChild)) {
|
|
1311
|
+
mappedChild = cloneAndReplaceKey(mappedChild,
|
|
1312
|
+
// Keep both the (mapped) and old keys if they differ, just as
|
|
1313
|
+
// traverseAllChildren used to do for objects as children
|
|
1314
|
+
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1315
|
+
}
|
|
1316
|
+
result.push(mappedChild);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1321
|
+
var escapedPrefix = '';
|
|
1322
|
+
if (prefix != null) {
|
|
1323
|
+
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1324
|
+
}
|
|
1325
|
+
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
|
1326
|
+
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
|
1327
|
+
releaseTraverseContext(traverseContext);
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Maps children that are typically specified as `props.children`.
|
|
1332
|
+
*
|
|
1333
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1334
|
+
*
|
|
1335
|
+
* The provided mapFunction(child, key, index) will be called for each
|
|
1336
|
+
* leaf child.
|
|
1337
|
+
*
|
|
1338
|
+
* @param {?*} children Children tree container.
|
|
1339
|
+
* @param {function(*, int)} func The map function.
|
|
1340
|
+
* @param {*} context Context for mapFunction.
|
|
1341
|
+
* @return {object} Object containing the ordered map of results.
|
|
1342
|
+
*/
|
|
1343
|
+
function mapChildren(children, func, context) {
|
|
1344
|
+
if (children == null) {
|
|
1345
|
+
return children;
|
|
1346
|
+
}
|
|
1347
|
+
var result = [];
|
|
1348
|
+
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1349
|
+
return result;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
/**
|
|
1353
|
+
* Count the number of children that are typically specified as
|
|
1354
|
+
* `props.children`.
|
|
1355
|
+
*
|
|
1356
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1357
|
+
*
|
|
1358
|
+
* @param {?*} children Children tree container.
|
|
1359
|
+
* @return {number} The number of children.
|
|
1360
|
+
*/
|
|
1361
|
+
function countChildren(children) {
|
|
1362
|
+
return traverseAllChildren(children, function () {
|
|
1363
|
+
return null;
|
|
1364
|
+
}, null);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1126
1367
|
/**
|
|
1127
1368
|
* Flatten a children object (typically specified as `props.children`) and
|
|
1128
1369
|
* return an array with appropriately re-keyed children.
|
|
1129
1370
|
*
|
|
1130
1371
|
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1131
1372
|
*/
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
1373
|
function toArray(children) {
|
|
1135
|
-
|
|
1374
|
+
var result = [];
|
|
1375
|
+
mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
|
1136
1376
|
return child;
|
|
1137
|
-
})
|
|
1377
|
+
});
|
|
1378
|
+
return result;
|
|
1138
1379
|
}
|
|
1380
|
+
|
|
1139
1381
|
/**
|
|
1140
1382
|
* Returns the first child in a collection of children and verifies that there
|
|
1141
1383
|
* is only one child in the collection.
|
|
@@ -1150,23 +1392,29 @@ function toArray(children) {
|
|
|
1150
1392
|
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1151
1393
|
* structure.
|
|
1152
1394
|
*/
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
1395
|
function onlyChild(children) {
|
|
1156
|
-
|
|
1157
|
-
{
|
|
1158
|
-
|
|
1396
|
+
(function () {
|
|
1397
|
+
if (!isValidElement(children)) {
|
|
1398
|
+
{
|
|
1399
|
+
throw ReactError('React.Children.only expected to receive a single React element child.');
|
|
1400
|
+
}
|
|
1159
1401
|
}
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1402
|
+
})();
|
|
1162
1403
|
return children;
|
|
1163
1404
|
}
|
|
1164
1405
|
|
|
1165
|
-
function createContext(defaultValue) {
|
|
1166
|
-
|
|
1167
|
-
|
|
1406
|
+
function createContext(defaultValue, calculateChangedBits) {
|
|
1407
|
+
if (calculateChangedBits === undefined) {
|
|
1408
|
+
calculateChangedBits = null;
|
|
1409
|
+
} else {
|
|
1410
|
+
{
|
|
1411
|
+
!(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1168
1415
|
var context = {
|
|
1169
1416
|
$$typeof: REACT_CONTEXT_TYPE,
|
|
1417
|
+
_calculateChangedBits: calculateChangedBits,
|
|
1170
1418
|
// As a workaround to support multiple concurrent renderers, we categorize
|
|
1171
1419
|
// some renderers as primary and others as secondary. We only expect
|
|
1172
1420
|
// there to be two concurrent renderers at most: React Native (primary) and
|
|
@@ -1181,13 +1429,14 @@ function createContext(defaultValue) {
|
|
|
1181
1429
|
Provider: null,
|
|
1182
1430
|
Consumer: null
|
|
1183
1431
|
};
|
|
1432
|
+
|
|
1184
1433
|
context.Provider = {
|
|
1185
1434
|
$$typeof: REACT_PROVIDER_TYPE,
|
|
1186
1435
|
_context: context
|
|
1187
1436
|
};
|
|
1437
|
+
|
|
1188
1438
|
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
1189
1439
|
var hasWarnedAboutUsingConsumerProvider = false;
|
|
1190
|
-
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
1191
1440
|
|
|
1192
1441
|
{
|
|
1193
1442
|
// A separate object, but proxies back to the original context object for
|
|
@@ -1195,18 +1444,17 @@ function createContext(defaultValue) {
|
|
|
1195
1444
|
// warn for the incorrect usage of Context as a Consumer.
|
|
1196
1445
|
var Consumer = {
|
|
1197
1446
|
$$typeof: REACT_CONTEXT_TYPE,
|
|
1198
|
-
_context: context
|
|
1199
|
-
|
|
1200
|
-
|
|
1447
|
+
_context: context,
|
|
1448
|
+
_calculateChangedBits: context._calculateChangedBits
|
|
1449
|
+
};
|
|
1450
|
+
// $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
1201
1451
|
Object.defineProperties(Consumer, {
|
|
1202
1452
|
Provider: {
|
|
1203
1453
|
get: function () {
|
|
1204
1454
|
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1205
1455
|
hasWarnedAboutUsingConsumerProvider = true;
|
|
1206
|
-
|
|
1207
|
-
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?');
|
|
1456
|
+
warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
|
1208
1457
|
}
|
|
1209
|
-
|
|
1210
1458
|
return context.Provider;
|
|
1211
1459
|
},
|
|
1212
1460
|
set: function (_Provider) {
|
|
@@ -1241,27 +1489,13 @@ function createContext(defaultValue) {
|
|
|
1241
1489
|
get: function () {
|
|
1242
1490
|
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1243
1491
|
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1244
|
-
|
|
1245
|
-
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?');
|
|
1492
|
+
warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
|
1246
1493
|
}
|
|
1247
|
-
|
|
1248
1494
|
return context.Consumer;
|
|
1249
1495
|
}
|
|
1250
|
-
},
|
|
1251
|
-
displayName: {
|
|
1252
|
-
get: function () {
|
|
1253
|
-
return context.displayName;
|
|
1254
|
-
},
|
|
1255
|
-
set: function (displayName) {
|
|
1256
|
-
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
1257
|
-
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
1258
|
-
|
|
1259
|
-
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
1496
|
}
|
|
1263
|
-
});
|
|
1264
|
-
|
|
1497
|
+
});
|
|
1498
|
+
// $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1265
1499
|
context.Consumer = Consumer;
|
|
1266
1500
|
}
|
|
1267
1501
|
|
|
@@ -1273,85 +1507,19 @@ function createContext(defaultValue) {
|
|
|
1273
1507
|
return context;
|
|
1274
1508
|
}
|
|
1275
1509
|
|
|
1276
|
-
var Uninitialized = -1;
|
|
1277
|
-
var Pending = 0;
|
|
1278
|
-
var Resolved = 1;
|
|
1279
|
-
var Rejected = 2;
|
|
1280
|
-
|
|
1281
|
-
function lazyInitializer(payload) {
|
|
1282
|
-
if (payload._status === Uninitialized) {
|
|
1283
|
-
var ctor = payload._result;
|
|
1284
|
-
var thenable = ctor(); // Transition to the next state.
|
|
1285
|
-
// This might throw either because it's missing or throws. If so, we treat it
|
|
1286
|
-
// as still uninitialized and try again next time. Which is the same as what
|
|
1287
|
-
// happens if the ctor or any wrappers processing the ctor throws. This might
|
|
1288
|
-
// end up fixing it if the resolution was a concurrency bug.
|
|
1289
|
-
|
|
1290
|
-
thenable.then(function (moduleObject) {
|
|
1291
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1292
|
-
// Transition to the next state.
|
|
1293
|
-
var resolved = payload;
|
|
1294
|
-
resolved._status = Resolved;
|
|
1295
|
-
resolved._result = moduleObject;
|
|
1296
|
-
}
|
|
1297
|
-
}, function (error) {
|
|
1298
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1299
|
-
// Transition to the next state.
|
|
1300
|
-
var rejected = payload;
|
|
1301
|
-
rejected._status = Rejected;
|
|
1302
|
-
rejected._result = error;
|
|
1303
|
-
}
|
|
1304
|
-
});
|
|
1305
|
-
|
|
1306
|
-
if (payload._status === Uninitialized) {
|
|
1307
|
-
// In case, we're still uninitialized, then we're waiting for the thenable
|
|
1308
|
-
// to resolve. Set it as pending in the meantime.
|
|
1309
|
-
var pending = payload;
|
|
1310
|
-
pending._status = Pending;
|
|
1311
|
-
pending._result = thenable;
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
if (payload._status === Resolved) {
|
|
1316
|
-
var moduleObject = payload._result;
|
|
1317
|
-
|
|
1318
|
-
{
|
|
1319
|
-
if (moduleObject === undefined) {
|
|
1320
|
-
error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
|
1321
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
{
|
|
1326
|
-
if (!('default' in moduleObject)) {
|
|
1327
|
-
error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
|
1328
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
return moduleObject.default;
|
|
1333
|
-
} else {
|
|
1334
|
-
throw payload._result;
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
1510
|
function lazy(ctor) {
|
|
1339
|
-
var payload = {
|
|
1340
|
-
// We use these fields to store the result.
|
|
1341
|
-
_status: -1,
|
|
1342
|
-
_result: ctor
|
|
1343
|
-
};
|
|
1344
1511
|
var lazyType = {
|
|
1345
1512
|
$$typeof: REACT_LAZY_TYPE,
|
|
1346
|
-
|
|
1347
|
-
|
|
1513
|
+
_ctor: ctor,
|
|
1514
|
+
// React uses these fields to store the result.
|
|
1515
|
+
_status: -1,
|
|
1516
|
+
_result: null
|
|
1348
1517
|
};
|
|
1349
1518
|
|
|
1350
1519
|
{
|
|
1351
1520
|
// In production, this would just set it on the object.
|
|
1352
|
-
var defaultProps;
|
|
1353
|
-
var propTypes
|
|
1354
|
-
|
|
1521
|
+
var defaultProps = void 0;
|
|
1522
|
+
var propTypes = void 0;
|
|
1355
1523
|
Object.defineProperties(lazyType, {
|
|
1356
1524
|
defaultProps: {
|
|
1357
1525
|
configurable: true,
|
|
@@ -1359,11 +1527,9 @@ function lazy(ctor) {
|
|
|
1359
1527
|
return defaultProps;
|
|
1360
1528
|
},
|
|
1361
1529
|
set: function (newDefaultProps) {
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
// $FlowFixMe
|
|
1366
|
-
|
|
1530
|
+
warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1531
|
+
defaultProps = newDefaultProps;
|
|
1532
|
+
// Match production behavior more closely:
|
|
1367
1533
|
Object.defineProperty(lazyType, 'defaultProps', {
|
|
1368
1534
|
enumerable: true
|
|
1369
1535
|
});
|
|
@@ -1375,11 +1541,9 @@ function lazy(ctor) {
|
|
|
1375
1541
|
return propTypes;
|
|
1376
1542
|
},
|
|
1377
1543
|
set: function (newPropTypes) {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
// $FlowFixMe
|
|
1382
|
-
|
|
1544
|
+
warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1545
|
+
propTypes = newPropTypes;
|
|
1546
|
+
// Match production behavior more closely:
|
|
1383
1547
|
Object.defineProperty(lazyType, 'propTypes', {
|
|
1384
1548
|
enumerable: true
|
|
1385
1549
|
});
|
|
@@ -1394,635 +1558,132 @@ function lazy(ctor) {
|
|
|
1394
1558
|
function forwardRef(render) {
|
|
1395
1559
|
{
|
|
1396
1560
|
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1397
|
-
|
|
1561
|
+
warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1398
1562
|
} else if (typeof render !== 'function') {
|
|
1399
|
-
|
|
1563
|
+
warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1400
1564
|
} else {
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1565
|
+
!(
|
|
1566
|
+
// Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
|
|
1567
|
+
render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.') : void 0;
|
|
1404
1568
|
}
|
|
1405
1569
|
|
|
1406
1570
|
if (render != null) {
|
|
1407
|
-
|
|
1408
|
-
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1409
|
-
}
|
|
1571
|
+
!(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
|
|
1410
1572
|
}
|
|
1411
1573
|
}
|
|
1412
1574
|
|
|
1413
|
-
|
|
1575
|
+
return {
|
|
1414
1576
|
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1415
1577
|
render: render
|
|
1416
1578
|
};
|
|
1417
|
-
|
|
1418
|
-
{
|
|
1419
|
-
var ownName;
|
|
1420
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
1421
|
-
enumerable: false,
|
|
1422
|
-
configurable: true,
|
|
1423
|
-
get: function () {
|
|
1424
|
-
return ownName;
|
|
1425
|
-
},
|
|
1426
|
-
set: function (name) {
|
|
1427
|
-
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
1428
|
-
// because the component may be used elsewhere.
|
|
1429
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
1430
|
-
// so that our component-stack generation logic will display their frames.
|
|
1431
|
-
// An anonymous function generally suggests a pattern like:
|
|
1432
|
-
// React.forwardRef((props, ref) => {...});
|
|
1433
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1434
|
-
|
|
1435
|
-
if (!render.name && !render.displayName) {
|
|
1436
|
-
render.displayName = name;
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
});
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
return elementType;
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
1446
|
-
|
|
1447
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
1448
|
-
|
|
1449
|
-
var REACT_MODULE_REFERENCE = 0;
|
|
1450
|
-
|
|
1451
|
-
if (typeof Symbol === 'function') {
|
|
1452
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
1453
1579
|
}
|
|
1454
1580
|
|
|
1455
1581
|
function isValidElementType(type) {
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
if (type === exports.Fragment || type === exports.Profiler || type === exports.unstable_DebugTracingMode || type === exports.StrictMode || type === exports.Suspense || type === exports.SuspenseList || type === exports.unstable_LegacyHidden || type === exports.unstable_Offscreen || enableScopeAPI || type === exports.unstable_Cache) {
|
|
1462
|
-
return true;
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
if (typeof type === 'object' && type !== null) {
|
|
1466
|
-
if (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 || // This needs to include all possible module reference object
|
|
1467
|
-
// types supported by any Flight configuration anywhere since
|
|
1468
|
-
// we don't know which Flight build this will end up being used
|
|
1469
|
-
// with.
|
|
1470
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
1471
|
-
return true;
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
return false;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
function memo(type, compare) {
|
|
1479
|
-
{
|
|
1480
|
-
if (!isValidElementType(type)) {
|
|
1481
|
-
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
var elementType = {
|
|
1486
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
1487
|
-
type: type,
|
|
1488
|
-
compare: compare === undefined ? null : compare
|
|
1489
|
-
};
|
|
1490
|
-
|
|
1491
|
-
{
|
|
1492
|
-
var ownName;
|
|
1493
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
1494
|
-
enumerable: false,
|
|
1495
|
-
configurable: true,
|
|
1496
|
-
get: function () {
|
|
1497
|
-
return ownName;
|
|
1498
|
-
},
|
|
1499
|
-
set: function (name) {
|
|
1500
|
-
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
1501
|
-
// because the component may be used elsewhere.
|
|
1502
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
1503
|
-
// so that our component-stack generation logic will display their frames.
|
|
1504
|
-
// An anonymous function generally suggests a pattern like:
|
|
1505
|
-
// React.memo((props) => {...});
|
|
1506
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1507
|
-
|
|
1508
|
-
if (!type.name && !type.displayName) {
|
|
1509
|
-
type.displayName = name;
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
return elementType;
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
function resolveDispatcher() {
|
|
1519
|
-
var dispatcher = ReactCurrentDispatcher.current;
|
|
1520
|
-
|
|
1521
|
-
{
|
|
1522
|
-
if (dispatcher === null) {
|
|
1523
|
-
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:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');
|
|
1524
|
-
}
|
|
1525
|
-
} // Will result in a null access error if accessed outside render phase. We
|
|
1526
|
-
// intentionally don't throw our own error because this is in a hot path.
|
|
1527
|
-
// Also helps ensure this is inlined.
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
return dispatcher;
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
function getCacheForType(resourceType) {
|
|
1534
|
-
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
|
|
1535
|
-
|
|
1536
|
-
return dispatcher.getCacheForType(resourceType);
|
|
1537
|
-
}
|
|
1538
|
-
function useContext(Context) {
|
|
1539
|
-
var dispatcher = resolveDispatcher();
|
|
1540
|
-
|
|
1541
|
-
{
|
|
1542
|
-
// TODO: add a more generic warning for invalid values.
|
|
1543
|
-
if (Context._context !== undefined) {
|
|
1544
|
-
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1545
|
-
// and nobody should be using this in existing code.
|
|
1546
|
-
|
|
1547
|
-
if (realContext.Consumer === Context) {
|
|
1548
|
-
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?');
|
|
1549
|
-
} else if (realContext.Provider === Context) {
|
|
1550
|
-
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
return dispatcher.useContext(Context);
|
|
1556
|
-
}
|
|
1557
|
-
function useState(initialState) {
|
|
1558
|
-
var dispatcher = resolveDispatcher();
|
|
1559
|
-
return dispatcher.useState(initialState);
|
|
1560
|
-
}
|
|
1561
|
-
function useReducer(reducer, initialArg, init) {
|
|
1562
|
-
var dispatcher = resolveDispatcher();
|
|
1563
|
-
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1564
|
-
}
|
|
1565
|
-
function useRef(initialValue) {
|
|
1566
|
-
var dispatcher = resolveDispatcher();
|
|
1567
|
-
return dispatcher.useRef(initialValue);
|
|
1568
|
-
}
|
|
1569
|
-
function useEffect(create, deps) {
|
|
1570
|
-
var dispatcher = resolveDispatcher();
|
|
1571
|
-
return dispatcher.useEffect(create, deps);
|
|
1572
|
-
}
|
|
1573
|
-
function useLayoutEffect(create, deps) {
|
|
1574
|
-
var dispatcher = resolveDispatcher();
|
|
1575
|
-
return dispatcher.useLayoutEffect(create, deps);
|
|
1576
|
-
}
|
|
1577
|
-
function useCallback(callback, deps) {
|
|
1578
|
-
var dispatcher = resolveDispatcher();
|
|
1579
|
-
return dispatcher.useCallback(callback, deps);
|
|
1580
|
-
}
|
|
1581
|
-
function useMemo(create, deps) {
|
|
1582
|
-
var dispatcher = resolveDispatcher();
|
|
1583
|
-
return dispatcher.useMemo(create, deps);
|
|
1584
|
-
}
|
|
1585
|
-
function useImperativeHandle(ref, create, deps) {
|
|
1586
|
-
var dispatcher = resolveDispatcher();
|
|
1587
|
-
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1588
|
-
}
|
|
1589
|
-
function useDebugValue(value, formatterFn) {
|
|
1590
|
-
{
|
|
1591
|
-
var dispatcher = resolveDispatcher();
|
|
1592
|
-
return dispatcher.useDebugValue(value, formatterFn);
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
function useTransition() {
|
|
1596
|
-
var dispatcher = resolveDispatcher();
|
|
1597
|
-
return dispatcher.useTransition();
|
|
1598
|
-
}
|
|
1599
|
-
function useDeferredValue(value) {
|
|
1600
|
-
var dispatcher = resolveDispatcher();
|
|
1601
|
-
return dispatcher.useDeferredValue(value);
|
|
1602
|
-
}
|
|
1603
|
-
function useOpaqueIdentifier() {
|
|
1604
|
-
var dispatcher = resolveDispatcher();
|
|
1605
|
-
return dispatcher.useOpaqueIdentifier();
|
|
1606
|
-
}
|
|
1607
|
-
function useMutableSource(source, getSnapshot, subscribe) {
|
|
1608
|
-
var dispatcher = resolveDispatcher();
|
|
1609
|
-
return dispatcher.useMutableSource(source, getSnapshot, subscribe);
|
|
1610
|
-
}
|
|
1611
|
-
function useCacheRefresh() {
|
|
1612
|
-
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
|
|
1613
|
-
|
|
1614
|
-
return dispatcher.useCacheRefresh();
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
1618
|
-
// replaying on render function. This currently only patches the object
|
|
1619
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
1620
|
-
// We could also eagerly patch the method.
|
|
1621
|
-
var disabledDepth = 0;
|
|
1622
|
-
var prevLog;
|
|
1623
|
-
var prevInfo;
|
|
1624
|
-
var prevWarn;
|
|
1625
|
-
var prevError;
|
|
1626
|
-
var prevGroup;
|
|
1627
|
-
var prevGroupCollapsed;
|
|
1628
|
-
var prevGroupEnd;
|
|
1629
|
-
|
|
1630
|
-
function disabledLog() {}
|
|
1631
|
-
|
|
1632
|
-
disabledLog.__reactDisabledLog = true;
|
|
1633
|
-
function disableLogs() {
|
|
1634
|
-
{
|
|
1635
|
-
if (disabledDepth === 0) {
|
|
1636
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
1637
|
-
prevLog = console.log;
|
|
1638
|
-
prevInfo = console.info;
|
|
1639
|
-
prevWarn = console.warn;
|
|
1640
|
-
prevError = console.error;
|
|
1641
|
-
prevGroup = console.group;
|
|
1642
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
1643
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
1644
|
-
|
|
1645
|
-
var props = {
|
|
1646
|
-
configurable: true,
|
|
1647
|
-
enumerable: true,
|
|
1648
|
-
value: disabledLog,
|
|
1649
|
-
writable: true
|
|
1650
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1651
|
-
|
|
1652
|
-
Object.defineProperties(console, {
|
|
1653
|
-
info: props,
|
|
1654
|
-
log: props,
|
|
1655
|
-
warn: props,
|
|
1656
|
-
error: props,
|
|
1657
|
-
group: props,
|
|
1658
|
-
groupCollapsed: props,
|
|
1659
|
-
groupEnd: props
|
|
1660
|
-
});
|
|
1661
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
disabledDepth++;
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
function reenableLogs() {
|
|
1668
|
-
{
|
|
1669
|
-
disabledDepth--;
|
|
1670
|
-
|
|
1671
|
-
if (disabledDepth === 0) {
|
|
1672
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
1673
|
-
var props = {
|
|
1674
|
-
configurable: true,
|
|
1675
|
-
enumerable: true,
|
|
1676
|
-
writable: true
|
|
1677
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1678
|
-
|
|
1679
|
-
Object.defineProperties(console, {
|
|
1680
|
-
log: _assign({}, props, {
|
|
1681
|
-
value: prevLog
|
|
1682
|
-
}),
|
|
1683
|
-
info: _assign({}, props, {
|
|
1684
|
-
value: prevInfo
|
|
1685
|
-
}),
|
|
1686
|
-
warn: _assign({}, props, {
|
|
1687
|
-
value: prevWarn
|
|
1688
|
-
}),
|
|
1689
|
-
error: _assign({}, props, {
|
|
1690
|
-
value: prevError
|
|
1691
|
-
}),
|
|
1692
|
-
group: _assign({}, props, {
|
|
1693
|
-
value: prevGroup
|
|
1694
|
-
}),
|
|
1695
|
-
groupCollapsed: _assign({}, props, {
|
|
1696
|
-
value: prevGroupCollapsed
|
|
1697
|
-
}),
|
|
1698
|
-
groupEnd: _assign({}, props, {
|
|
1699
|
-
value: prevGroupEnd
|
|
1700
|
-
})
|
|
1701
|
-
});
|
|
1702
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
if (disabledDepth < 0) {
|
|
1706
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1712
|
-
var prefix;
|
|
1713
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1714
|
-
{
|
|
1715
|
-
if (prefix === undefined) {
|
|
1716
|
-
// Extract the VM specific prefix used by each line.
|
|
1717
|
-
try {
|
|
1718
|
-
throw Error();
|
|
1719
|
-
} catch (x) {
|
|
1720
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
1721
|
-
prefix = match && match[1] || '';
|
|
1722
|
-
}
|
|
1723
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
return '\n' + prefix + name;
|
|
1727
|
-
}
|
|
1582
|
+
return typeof type === 'string' || typeof type === 'function' ||
|
|
1583
|
+
// 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 || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_EVENT_COMPONENT_TYPE || type.$$typeof === REACT_EVENT_TARGET_TYPE);
|
|
1728
1585
|
}
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
{
|
|
1733
|
-
|
|
1734
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
1738
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
1739
|
-
if ( !fn || reentry) {
|
|
1740
|
-
return '';
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
|
-
{
|
|
1744
|
-
var frame = componentFrameCache.get(fn);
|
|
1745
|
-
|
|
1746
|
-
if (frame !== undefined) {
|
|
1747
|
-
return frame;
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
var control;
|
|
1752
|
-
reentry = true;
|
|
1753
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
1754
|
-
|
|
1755
|
-
Error.prepareStackTrace = undefined;
|
|
1756
|
-
var previousDispatcher;
|
|
1757
|
-
|
|
1758
|
-
{
|
|
1759
|
-
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
1760
|
-
// for warnings.
|
|
1761
|
-
|
|
1762
|
-
ReactCurrentDispatcher$1.current = null;
|
|
1763
|
-
disableLogs();
|
|
1764
|
-
}
|
|
1765
|
-
|
|
1766
|
-
try {
|
|
1767
|
-
// This should throw.
|
|
1768
|
-
if (construct) {
|
|
1769
|
-
// Something should be setting the props in the constructor.
|
|
1770
|
-
var Fake = function () {
|
|
1771
|
-
throw Error();
|
|
1772
|
-
}; // $FlowFixMe
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
1776
|
-
set: function () {
|
|
1777
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
1778
|
-
// because that won't throw in a non-strict mode function.
|
|
1779
|
-
throw Error();
|
|
1780
|
-
}
|
|
1781
|
-
});
|
|
1782
|
-
|
|
1783
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
1784
|
-
// We construct a different control for this case to include any extra
|
|
1785
|
-
// frames added by the construct call.
|
|
1786
|
-
try {
|
|
1787
|
-
Reflect.construct(Fake, []);
|
|
1788
|
-
} catch (x) {
|
|
1789
|
-
control = x;
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
Reflect.construct(fn, [], Fake);
|
|
1793
|
-
} else {
|
|
1794
|
-
try {
|
|
1795
|
-
Fake.call();
|
|
1796
|
-
} catch (x) {
|
|
1797
|
-
control = x;
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
fn.call(Fake.prototype);
|
|
1801
|
-
}
|
|
1802
|
-
} else {
|
|
1803
|
-
try {
|
|
1804
|
-
throw Error();
|
|
1805
|
-
} catch (x) {
|
|
1806
|
-
control = x;
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
fn();
|
|
1810
|
-
}
|
|
1811
|
-
} catch (sample) {
|
|
1812
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
1813
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
1814
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
1815
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
1816
|
-
var sampleLines = sample.stack.split('\n');
|
|
1817
|
-
var controlLines = control.stack.split('\n');
|
|
1818
|
-
var s = sampleLines.length - 1;
|
|
1819
|
-
var c = controlLines.length - 1;
|
|
1820
|
-
|
|
1821
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
1822
|
-
// We expect at least one stack frame to be shared.
|
|
1823
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
1824
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
1825
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
1826
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
1827
|
-
// the sample somewhere in the control.
|
|
1828
|
-
c--;
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
1832
|
-
// Next we find the first one that isn't the same which should be the
|
|
1833
|
-
// frame that called our sample function and the control.
|
|
1834
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
1835
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
1836
|
-
// If we're about to return the first line, and the control is also on the same
|
|
1837
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
1838
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
1839
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
1840
|
-
if (s !== 1 || c !== 1) {
|
|
1841
|
-
do {
|
|
1842
|
-
s--;
|
|
1843
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
1844
|
-
// The next one that isn't the same should be our match though.
|
|
1845
|
-
|
|
1846
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
1847
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
1848
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
|
1849
|
-
|
|
1850
|
-
{
|
|
1851
|
-
if (typeof fn === 'function') {
|
|
1852
|
-
componentFrameCache.set(fn, _frame);
|
|
1853
|
-
}
|
|
1854
|
-
} // Return the line we found.
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
return _frame;
|
|
1858
|
-
}
|
|
1859
|
-
} while (s >= 1 && c >= 0);
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
break;
|
|
1863
|
-
}
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
} finally {
|
|
1867
|
-
reentry = false;
|
|
1868
|
-
|
|
1869
|
-
{
|
|
1870
|
-
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
1871
|
-
reenableLogs();
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
1875
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
1879
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
1880
|
-
|
|
1881
|
-
{
|
|
1882
|
-
if (typeof fn === 'function') {
|
|
1883
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
return syntheticFrame;
|
|
1888
|
-
}
|
|
1889
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
1890
|
-
{
|
|
1891
|
-
return describeNativeComponentFrame(fn, false);
|
|
1892
|
-
}
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1895
|
-
function shouldConstruct(Component) {
|
|
1896
|
-
var prototype = Component.prototype;
|
|
1897
|
-
return !!(prototype && prototype.isReactComponent);
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
1901
|
-
|
|
1902
|
-
if (type == null) {
|
|
1903
|
-
return '';
|
|
1904
|
-
}
|
|
1905
|
-
|
|
1906
|
-
if (typeof type === 'function') {
|
|
1907
|
-
{
|
|
1908
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
if (typeof type === 'string') {
|
|
1913
|
-
return describeBuiltInComponentFrame(type);
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
|
-
switch (type) {
|
|
1917
|
-
case exports.Suspense:
|
|
1918
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
1919
|
-
|
|
1920
|
-
case exports.SuspenseList:
|
|
1921
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
1922
|
-
}
|
|
1923
|
-
|
|
1924
|
-
if (typeof type === 'object') {
|
|
1925
|
-
switch (type.$$typeof) {
|
|
1926
|
-
case REACT_FORWARD_REF_TYPE:
|
|
1927
|
-
return describeFunctionComponentFrame(type.render);
|
|
1928
|
-
|
|
1929
|
-
case REACT_MEMO_TYPE:
|
|
1930
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
1931
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
1932
|
-
|
|
1933
|
-
case REACT_LAZY_TYPE:
|
|
1934
|
-
{
|
|
1935
|
-
var lazyComponent = type;
|
|
1936
|
-
var payload = lazyComponent._payload;
|
|
1937
|
-
var init = lazyComponent._init;
|
|
1938
|
-
|
|
1939
|
-
try {
|
|
1940
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
1941
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
1942
|
-
} catch (x) {}
|
|
1943
|
-
}
|
|
1586
|
+
|
|
1587
|
+
function memo(type, compare) {
|
|
1588
|
+
{
|
|
1589
|
+
if (!isValidElementType(type)) {
|
|
1590
|
+
warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1944
1591
|
}
|
|
1945
1592
|
}
|
|
1946
|
-
|
|
1947
|
-
|
|
1593
|
+
return {
|
|
1594
|
+
$$typeof: REACT_MEMO_TYPE,
|
|
1595
|
+
type: type,
|
|
1596
|
+
compare: compare === undefined ? null : compare
|
|
1597
|
+
};
|
|
1948
1598
|
}
|
|
1949
1599
|
|
|
1950
|
-
|
|
1951
|
-
var
|
|
1600
|
+
function resolveDispatcher() {
|
|
1601
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
|
1602
|
+
(function () {
|
|
1603
|
+
if (!(dispatcher !== null)) {
|
|
1604
|
+
{
|
|
1605
|
+
throw ReactError('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.');
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
})();
|
|
1609
|
+
return dispatcher;
|
|
1610
|
+
}
|
|
1952
1611
|
|
|
1953
|
-
function
|
|
1612
|
+
function useContext(Context, unstable_observedBits) {
|
|
1613
|
+
var dispatcher = resolveDispatcher();
|
|
1954
1614
|
{
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1615
|
+
!(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0;
|
|
1616
|
+
|
|
1617
|
+
// TODO: add a more generic warning for invalid values.
|
|
1618
|
+
if (Context._context !== undefined) {
|
|
1619
|
+
var realContext = Context._context;
|
|
1620
|
+
// Don't deduplicate because this legitimately causes bugs
|
|
1621
|
+
// and nobody should be using this in existing code.
|
|
1622
|
+
if (realContext.Consumer === Context) {
|
|
1623
|
+
warning$1(false, 'Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
|
1624
|
+
} else if (realContext.Provider === Context) {
|
|
1625
|
+
warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1626
|
+
}
|
|
1961
1627
|
}
|
|
1962
1628
|
}
|
|
1629
|
+
return dispatcher.useContext(Context, unstable_observedBits);
|
|
1963
1630
|
}
|
|
1964
1631
|
|
|
1965
|
-
function
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
for (var typeSpecName in typeSpecs) {
|
|
1971
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
1972
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
1973
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
1974
|
-
// After these have been cleaned up, we'll let them throw.
|
|
1975
|
-
|
|
1976
|
-
try {
|
|
1977
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
1978
|
-
// behavior as without this statement except with a better message.
|
|
1979
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
1980
|
-
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
1981
|
-
err.name = 'Invariant Violation';
|
|
1982
|
-
throw err;
|
|
1983
|
-
}
|
|
1632
|
+
function useState(initialState) {
|
|
1633
|
+
var dispatcher = resolveDispatcher();
|
|
1634
|
+
return dispatcher.useState(initialState);
|
|
1635
|
+
}
|
|
1984
1636
|
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1637
|
+
function useReducer(reducer, initialArg, init) {
|
|
1638
|
+
var dispatcher = resolveDispatcher();
|
|
1639
|
+
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1640
|
+
}
|
|
1989
1641
|
|
|
1990
|
-
|
|
1991
|
-
|
|
1642
|
+
function useRef(initialValue) {
|
|
1643
|
+
var dispatcher = resolveDispatcher();
|
|
1644
|
+
return dispatcher.useRef(initialValue);
|
|
1645
|
+
}
|
|
1992
1646
|
|
|
1993
|
-
|
|
1647
|
+
function useEffect(create, inputs) {
|
|
1648
|
+
var dispatcher = resolveDispatcher();
|
|
1649
|
+
return dispatcher.useEffect(create, inputs);
|
|
1650
|
+
}
|
|
1994
1651
|
|
|
1995
|
-
|
|
1996
|
-
|
|
1652
|
+
function useLayoutEffect(create, inputs) {
|
|
1653
|
+
var dispatcher = resolveDispatcher();
|
|
1654
|
+
return dispatcher.useLayoutEffect(create, inputs);
|
|
1655
|
+
}
|
|
1997
1656
|
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
setCurrentlyValidatingElement(element);
|
|
1657
|
+
function useCallback(callback, inputs) {
|
|
1658
|
+
var dispatcher = resolveDispatcher();
|
|
1659
|
+
return dispatcher.useCallback(callback, inputs);
|
|
1660
|
+
}
|
|
2003
1661
|
|
|
2004
|
-
|
|
1662
|
+
function useMemo(create, inputs) {
|
|
1663
|
+
var dispatcher = resolveDispatcher();
|
|
1664
|
+
return dispatcher.useMemo(create, inputs);
|
|
1665
|
+
}
|
|
2005
1666
|
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
1667
|
+
function useImperativeHandle(ref, create, inputs) {
|
|
1668
|
+
var dispatcher = resolveDispatcher();
|
|
1669
|
+
return dispatcher.useImperativeHandle(ref, create, inputs);
|
|
2011
1670
|
}
|
|
2012
1671
|
|
|
2013
|
-
function
|
|
1672
|
+
function useDebugValue(value, formatterFn) {
|
|
2014
1673
|
{
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2018
|
-
setExtraStackFrame(stack);
|
|
2019
|
-
} else {
|
|
2020
|
-
setExtraStackFrame(null);
|
|
2021
|
-
}
|
|
1674
|
+
var dispatcher = resolveDispatcher();
|
|
1675
|
+
return dispatcher.useDebugValue(value, formatterFn);
|
|
2022
1676
|
}
|
|
2023
1677
|
}
|
|
2024
1678
|
|
|
2025
|
-
|
|
1679
|
+
/**
|
|
1680
|
+
* ReactElementValidator provides a wrapper around a element factory
|
|
1681
|
+
* which validates the props passed to the element. This is intended to be
|
|
1682
|
+
* used only in DEV and could be replaced by a static type checker for languages
|
|
1683
|
+
* that support it.
|
|
1684
|
+
*/
|
|
1685
|
+
|
|
1686
|
+
var propTypesMisspellWarningShown = void 0;
|
|
2026
1687
|
|
|
2027
1688
|
{
|
|
2028
1689
|
propTypesMisspellWarningShown = false;
|
|
@@ -2030,13 +1691,11 @@ var propTypesMisspellWarningShown;
|
|
|
2030
1691
|
|
|
2031
1692
|
function getDeclarationErrorAddendum() {
|
|
2032
1693
|
if (ReactCurrentOwner.current) {
|
|
2033
|
-
var name =
|
|
2034
|
-
|
|
1694
|
+
var name = getComponentName(ReactCurrentOwner.current.type);
|
|
2035
1695
|
if (name) {
|
|
2036
1696
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
2037
1697
|
}
|
|
2038
1698
|
}
|
|
2039
|
-
|
|
2040
1699
|
return '';
|
|
2041
1700
|
}
|
|
2042
1701
|
|
|
@@ -2046,7 +1705,6 @@ function getSourceInfoErrorAddendum(source) {
|
|
|
2046
1705
|
var lineNumber = source.lineNumber;
|
|
2047
1706
|
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
2048
1707
|
}
|
|
2049
|
-
|
|
2050
1708
|
return '';
|
|
2051
1709
|
}
|
|
2052
1710
|
|
|
@@ -2054,16 +1712,14 @@ function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
|
2054
1712
|
if (elementProps !== null && elementProps !== undefined) {
|
|
2055
1713
|
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
2056
1714
|
}
|
|
2057
|
-
|
|
2058
1715
|
return '';
|
|
2059
1716
|
}
|
|
1717
|
+
|
|
2060
1718
|
/**
|
|
2061
1719
|
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
2062
1720
|
* object keys are not valid. This allows us to keep track of children between
|
|
2063
1721
|
* updates.
|
|
2064
1722
|
*/
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
1723
|
var ownerHasKeyUseWarning = {};
|
|
2068
1724
|
|
|
2069
1725
|
function getCurrentComponentErrorInfo(parentType) {
|
|
@@ -2071,14 +1727,13 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
|
2071
1727
|
|
|
2072
1728
|
if (!info) {
|
|
2073
1729
|
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
2074
|
-
|
|
2075
1730
|
if (parentName) {
|
|
2076
|
-
info =
|
|
1731
|
+
info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
|
2077
1732
|
}
|
|
2078
1733
|
}
|
|
2079
|
-
|
|
2080
1734
|
return info;
|
|
2081
1735
|
}
|
|
1736
|
+
|
|
2082
1737
|
/**
|
|
2083
1738
|
* Warn if the element doesn't have an explicit key assigned to it.
|
|
2084
1739
|
* This element is in an array. The array could grow and shrink or be
|
|
@@ -2090,39 +1745,34 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
|
2090
1745
|
* @param {ReactElement} element Element that requires a key.
|
|
2091
1746
|
* @param {*} parentType element's parent's type.
|
|
2092
1747
|
*/
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
1748
|
function validateExplicitKey(element, parentType) {
|
|
2096
1749
|
if (!element._store || element._store.validated || element.key != null) {
|
|
2097
1750
|
return;
|
|
2098
1751
|
}
|
|
2099
|
-
|
|
2100
1752
|
element._store.validated = true;
|
|
2101
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2102
1753
|
|
|
1754
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2103
1755
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2104
1756
|
return;
|
|
2105
1757
|
}
|
|
1758
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
2106
1759
|
|
|
2107
|
-
|
|
1760
|
+
// Usually the current owner is the offender, but if it accepts children as a
|
|
2108
1761
|
// property, it may be the creator of the child that's responsible for
|
|
2109
1762
|
// assigning it a key.
|
|
2110
|
-
|
|
2111
1763
|
var childOwner = '';
|
|
2112
|
-
|
|
2113
1764
|
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
2114
1765
|
// Give the component that originally created this child.
|
|
2115
|
-
childOwner =
|
|
1766
|
+
childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
|
|
2116
1767
|
}
|
|
2117
1768
|
|
|
1769
|
+
setCurrentlyValidatingElement(element);
|
|
2118
1770
|
{
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
2122
|
-
|
|
2123
|
-
setCurrentlyValidatingElement$1(null);
|
|
1771
|
+
warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
2124
1772
|
}
|
|
1773
|
+
setCurrentlyValidatingElement(null);
|
|
2125
1774
|
}
|
|
1775
|
+
|
|
2126
1776
|
/**
|
|
2127
1777
|
* Ensure that every element either is passed in a static location, in an
|
|
2128
1778
|
* array with an explicit keys property defined, or in an object literal
|
|
@@ -2132,17 +1782,13 @@ function validateExplicitKey(element, parentType) {
|
|
|
2132
1782
|
* @param {ReactNode} node Statically passed child of any type.
|
|
2133
1783
|
* @param {*} parentType node's parent's type.
|
|
2134
1784
|
*/
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
1785
|
function validateChildKeys(node, parentType) {
|
|
2138
1786
|
if (typeof node !== 'object') {
|
|
2139
1787
|
return;
|
|
2140
1788
|
}
|
|
2141
|
-
|
|
2142
|
-
if (isArray(node)) {
|
|
1789
|
+
if (Array.isArray(node)) {
|
|
2143
1790
|
for (var i = 0; i < node.length; i++) {
|
|
2144
1791
|
var child = node[i];
|
|
2145
|
-
|
|
2146
1792
|
if (isValidElement(child)) {
|
|
2147
1793
|
validateExplicitKey(child, parentType);
|
|
2148
1794
|
}
|
|
@@ -2154,14 +1800,12 @@ function validateChildKeys(node, parentType) {
|
|
|
2154
1800
|
}
|
|
2155
1801
|
} else if (node) {
|
|
2156
1802
|
var iteratorFn = getIteratorFn(node);
|
|
2157
|
-
|
|
2158
1803
|
if (typeof iteratorFn === 'function') {
|
|
2159
1804
|
// Entry iterators used to provide implicit keys,
|
|
2160
1805
|
// but now we print a separate warning for them later.
|
|
2161
1806
|
if (iteratorFn !== node.entries) {
|
|
2162
1807
|
var iterator = iteratorFn.call(node);
|
|
2163
|
-
var step;
|
|
2164
|
-
|
|
1808
|
+
var step = void 0;
|
|
2165
1809
|
while (!(step = iterator.next()).done) {
|
|
2166
1810
|
if (isValidElement(step.value)) {
|
|
2167
1811
|
validateExplicitKey(step.value, parentType);
|
|
@@ -2171,139 +1815,203 @@ function validateChildKeys(node, parentType) {
|
|
|
2171
1815
|
}
|
|
2172
1816
|
}
|
|
2173
1817
|
}
|
|
1818
|
+
|
|
2174
1819
|
/**
|
|
2175
1820
|
* Given an element, validate that its props follow the propTypes definition,
|
|
2176
1821
|
* provided by the type.
|
|
2177
1822
|
*
|
|
2178
1823
|
* @param {ReactElement} element
|
|
2179
1824
|
*/
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
1825
|
function validatePropTypes(element) {
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
1826
|
+
var type = element.type;
|
|
1827
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
1828
|
+
return;
|
|
1829
|
+
}
|
|
1830
|
+
var name = getComponentName(type);
|
|
1831
|
+
var propTypes = void 0;
|
|
1832
|
+
if (typeof type === 'function') {
|
|
1833
|
+
propTypes = type.propTypes;
|
|
1834
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
1835
|
+
// Note: Memo only checks outer props here.
|
|
1836
|
+
// Inner props are checked in the reconciler.
|
|
1837
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1838
|
+
propTypes = type.propTypes;
|
|
1839
|
+
} else {
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
if (propTypes) {
|
|
1843
|
+
setCurrentlyValidatingElement(element);
|
|
1844
|
+
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
1845
|
+
setCurrentlyValidatingElement(null);
|
|
1846
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1847
|
+
propTypesMisspellWarningShown = true;
|
|
1848
|
+
warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1849
|
+
}
|
|
1850
|
+
if (typeof type.getDefaultProps === 'function') {
|
|
1851
|
+
!type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
2189
1854
|
|
|
2190
|
-
|
|
1855
|
+
/**
|
|
1856
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
1857
|
+
* @param {ReactElement} fragment
|
|
1858
|
+
*/
|
|
1859
|
+
function validateFragmentProps(fragment) {
|
|
1860
|
+
setCurrentlyValidatingElement(fragment);
|
|
2191
1861
|
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
} else {
|
|
2199
|
-
return;
|
|
1862
|
+
var keys = Object.keys(fragment.props);
|
|
1863
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1864
|
+
var key = keys[i];
|
|
1865
|
+
if (key !== 'children' && key !== 'key') {
|
|
1866
|
+
warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1867
|
+
break;
|
|
2200
1868
|
}
|
|
1869
|
+
}
|
|
2201
1870
|
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
2206
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2207
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1871
|
+
if (fragment.ref !== null) {
|
|
1872
|
+
warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1873
|
+
}
|
|
2208
1874
|
|
|
2209
|
-
|
|
1875
|
+
setCurrentlyValidatingElement(null);
|
|
1876
|
+
}
|
|
2210
1877
|
|
|
2211
|
-
|
|
2212
|
-
|
|
1878
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1879
|
+
var validType = isValidElementType(type);
|
|
2213
1880
|
|
|
2214
|
-
|
|
2215
|
-
|
|
1881
|
+
// We warn in this case but don't throw. We expect the element creation to
|
|
1882
|
+
// succeed and there will likely be errors in render.
|
|
1883
|
+
if (!validType) {
|
|
1884
|
+
var info = '';
|
|
1885
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1886
|
+
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.";
|
|
2216
1887
|
}
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
/**
|
|
2220
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
2221
|
-
* @param {ReactElement} fragment
|
|
2222
|
-
*/
|
|
2223
1888
|
|
|
1889
|
+
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
1890
|
+
if (sourceInfo) {
|
|
1891
|
+
info += sourceInfo;
|
|
1892
|
+
} else {
|
|
1893
|
+
info += getDeclarationErrorAddendum();
|
|
1894
|
+
}
|
|
2224
1895
|
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
1896
|
+
var typeString = void 0;
|
|
1897
|
+
if (type === null) {
|
|
1898
|
+
typeString = 'null';
|
|
1899
|
+
} else if (Array.isArray(type)) {
|
|
1900
|
+
typeString = 'array';
|
|
1901
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1902
|
+
typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
|
1903
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1904
|
+
} else {
|
|
1905
|
+
typeString = typeof type;
|
|
1906
|
+
}
|
|
2228
1907
|
|
|
2229
|
-
for (
|
|
2230
|
-
|
|
1908
|
+
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);
|
|
1909
|
+
}
|
|
2231
1910
|
|
|
2232
|
-
|
|
2233
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1911
|
+
var element = jsxDEV(type, props, key, source, self);
|
|
2234
1912
|
|
|
2235
|
-
|
|
1913
|
+
// The result can be nullish if a mock or a custom function is used.
|
|
1914
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1915
|
+
if (element == null) {
|
|
1916
|
+
return element;
|
|
1917
|
+
}
|
|
2236
1918
|
|
|
2237
|
-
|
|
2238
|
-
|
|
1919
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
|
1920
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1921
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
1922
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1923
|
+
// fixed, the key warnings will appear.)
|
|
1924
|
+
if (validType) {
|
|
1925
|
+
var children = props.children;
|
|
1926
|
+
if (children !== undefined) {
|
|
1927
|
+
if (isStaticChildren) {
|
|
1928
|
+
for (var i = 0; i < children.length; i++) {
|
|
1929
|
+
validateChildKeys(children[i], type);
|
|
1930
|
+
}
|
|
1931
|
+
} else {
|
|
1932
|
+
validateChildKeys(children, type);
|
|
2239
1933
|
}
|
|
2240
1934
|
}
|
|
1935
|
+
}
|
|
2241
1936
|
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1937
|
+
if (props.key !== undefined) {
|
|
1938
|
+
warning$1(false, 'React.jsx: Spreading a key to JSX is a deprecated pattern. ' + 'Explicitly pass a key after spreading props in your JSX call. ' + 'E.g. <ComponentName {...props} key={key} />');
|
|
1939
|
+
}
|
|
2246
1940
|
|
|
2247
|
-
|
|
2248
|
-
|
|
1941
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
1942
|
+
validateFragmentProps(element);
|
|
1943
|
+
} else {
|
|
1944
|
+
validatePropTypes(element);
|
|
2249
1945
|
}
|
|
1946
|
+
|
|
1947
|
+
return element;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
// These two functions exist to still get child warnings in dev
|
|
1951
|
+
// even with the prod transform. This means that jsxDEV is purely
|
|
1952
|
+
// opt-in behavior for better messages but that we won't stop
|
|
1953
|
+
// giving you warnings if you use production apis.
|
|
1954
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
1955
|
+
return jsxWithValidation(type, props, key, true);
|
|
2250
1956
|
}
|
|
1957
|
+
|
|
1958
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
1959
|
+
return jsxWithValidation(type, props, key, false);
|
|
1960
|
+
}
|
|
1961
|
+
|
|
2251
1962
|
function createElementWithValidation(type, props, children) {
|
|
2252
|
-
var validType = isValidElementType(type);
|
|
2253
|
-
// succeed and there will likely be errors in render.
|
|
1963
|
+
var validType = isValidElementType(type);
|
|
2254
1964
|
|
|
1965
|
+
// We warn in this case but don't throw. We expect the element creation to
|
|
1966
|
+
// succeed and there will likely be errors in render.
|
|
2255
1967
|
if (!validType) {
|
|
2256
1968
|
var info = '';
|
|
2257
|
-
|
|
2258
1969
|
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2259
1970
|
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.";
|
|
2260
1971
|
}
|
|
2261
1972
|
|
|
2262
1973
|
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
2263
|
-
|
|
2264
1974
|
if (sourceInfo) {
|
|
2265
1975
|
info += sourceInfo;
|
|
2266
1976
|
} else {
|
|
2267
1977
|
info += getDeclarationErrorAddendum();
|
|
2268
1978
|
}
|
|
2269
1979
|
|
|
2270
|
-
var typeString;
|
|
2271
|
-
|
|
1980
|
+
var typeString = void 0;
|
|
2272
1981
|
if (type === null) {
|
|
2273
1982
|
typeString = 'null';
|
|
2274
|
-
} else if (isArray(type)) {
|
|
1983
|
+
} else if (Array.isArray(type)) {
|
|
2275
1984
|
typeString = 'array';
|
|
2276
1985
|
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2277
|
-
typeString =
|
|
1986
|
+
typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
|
2278
1987
|
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2279
1988
|
} else {
|
|
2280
1989
|
typeString = typeof type;
|
|
2281
1990
|
}
|
|
2282
1991
|
|
|
2283
|
-
|
|
2284
|
-
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);
|
|
2285
|
-
}
|
|
1992
|
+
warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
2286
1993
|
}
|
|
2287
1994
|
|
|
2288
|
-
var element = createElement.apply(this, arguments);
|
|
2289
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1995
|
+
var element = createElement.apply(this, arguments);
|
|
2290
1996
|
|
|
1997
|
+
// The result can be nullish if a mock or a custom function is used.
|
|
1998
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2291
1999
|
if (element == null) {
|
|
2292
2000
|
return element;
|
|
2293
|
-
}
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
|
2294
2004
|
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2295
2005
|
// We don't want exception behavior to differ between dev and prod.
|
|
2296
2006
|
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2297
2007
|
// fixed, the key warnings will appear.)
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
2008
|
if (validType) {
|
|
2301
2009
|
for (var i = 2; i < arguments.length; i++) {
|
|
2302
2010
|
validateChildKeys(arguments[i], type);
|
|
2303
2011
|
}
|
|
2304
2012
|
}
|
|
2305
2013
|
|
|
2306
|
-
if (type ===
|
|
2014
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
2307
2015
|
validateFragmentProps(element);
|
|
2308
2016
|
} else {
|
|
2309
2017
|
validatePropTypes(element);
|
|
@@ -2311,24 +2019,16 @@ function createElementWithValidation(type, props, children) {
|
|
|
2311
2019
|
|
|
2312
2020
|
return element;
|
|
2313
2021
|
}
|
|
2314
|
-
|
|
2022
|
+
|
|
2315
2023
|
function createFactoryWithValidation(type) {
|
|
2316
2024
|
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2317
2025
|
validatedFactory.type = type;
|
|
2318
|
-
|
|
2026
|
+
// Legacy hook: remove it
|
|
2319
2027
|
{
|
|
2320
|
-
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
2321
|
-
didWarnAboutDeprecatedCreateFactory = true;
|
|
2322
|
-
|
|
2323
|
-
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
2324
|
-
} // Legacy hook: remove it
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
2028
|
Object.defineProperty(validatedFactory, 'type', {
|
|
2328
2029
|
enumerable: false,
|
|
2329
2030
|
get: function () {
|
|
2330
|
-
|
|
2331
|
-
|
|
2031
|
+
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2332
2032
|
Object.defineProperty(this, 'type', {
|
|
2333
2033
|
value: type
|
|
2334
2034
|
});
|
|
@@ -2339,304 +2039,133 @@ function createFactoryWithValidation(type) {
|
|
|
2339
2039
|
|
|
2340
2040
|
return validatedFactory;
|
|
2341
2041
|
}
|
|
2042
|
+
|
|
2342
2043
|
function cloneElementWithValidation(element, props, children) {
|
|
2343
2044
|
var newElement = cloneElement.apply(this, arguments);
|
|
2344
|
-
|
|
2345
2045
|
for (var i = 2; i < arguments.length; i++) {
|
|
2346
2046
|
validateChildKeys(arguments[i], newElement.type);
|
|
2347
2047
|
}
|
|
2348
|
-
|
|
2349
2048
|
validatePropTypes(newElement);
|
|
2350
2049
|
return newElement;
|
|
2351
2050
|
}
|
|
2352
2051
|
|
|
2353
|
-
function
|
|
2354
|
-
var mutableSource = {
|
|
2355
|
-
_getVersion: getVersion,
|
|
2356
|
-
_source: source,
|
|
2357
|
-
_workInProgressVersionPrimary: null,
|
|
2358
|
-
_workInProgressVersionSecondary: null
|
|
2359
|
-
};
|
|
2052
|
+
function noop() {}
|
|
2360
2053
|
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2054
|
+
var error = noop;
|
|
2055
|
+
var warn = noop;
|
|
2056
|
+
{
|
|
2057
|
+
var ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
2365
2058
|
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2059
|
+
error = function () {
|
|
2060
|
+
var stack = ReactDebugCurrentFrame$2.getStackAddendum();
|
|
2061
|
+
if (stack !== '') {
|
|
2062
|
+
var length = arguments.length;
|
|
2063
|
+
var args = new Array(length + 1);
|
|
2064
|
+
for (var i = 0; i < length; i++) {
|
|
2065
|
+
args[i] = arguments[i];
|
|
2066
|
+
}
|
|
2067
|
+
args[length] = stack;
|
|
2068
|
+
console.error.apply(console, args);
|
|
2069
|
+
} else {
|
|
2070
|
+
console.error.apply(console, arguments);
|
|
2071
|
+
}
|
|
2072
|
+
};
|
|
2369
2073
|
|
|
2370
|
-
|
|
2074
|
+
warn = function () {
|
|
2075
|
+
var stack = ReactDebugCurrentFrame$2.getStackAddendum();
|
|
2076
|
+
if (stack !== '') {
|
|
2077
|
+
var length = arguments.length;
|
|
2078
|
+
var args = new Array(length + 1);
|
|
2079
|
+
for (var i = 0; i < length; i++) {
|
|
2080
|
+
args[i] = arguments[i];
|
|
2081
|
+
}
|
|
2082
|
+
args[length] = stack;
|
|
2083
|
+
console.warn.apply(console, args);
|
|
2084
|
+
} else {
|
|
2085
|
+
console.warn.apply(console, arguments);
|
|
2086
|
+
}
|
|
2087
|
+
};
|
|
2371
2088
|
}
|
|
2372
2089
|
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2090
|
+
var React = {
|
|
2091
|
+
Children: {
|
|
2092
|
+
map: mapChildren,
|
|
2093
|
+
forEach: forEachChildren,
|
|
2094
|
+
count: countChildren,
|
|
2095
|
+
toArray: toArray,
|
|
2096
|
+
only: onlyChild
|
|
2097
|
+
},
|
|
2383
2098
|
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
if (enqueueTaskImpl === null) {
|
|
2388
|
-
try {
|
|
2389
|
-
// read require off the module object to get around the bundlers.
|
|
2390
|
-
// we don't want them to detect a require and bundle a Node polyfill.
|
|
2391
|
-
var requireString = ('require' + Math.random()).slice(0, 7);
|
|
2392
|
-
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
|
|
2393
|
-
// version of setImmediate, bypassing fake timers if any.
|
|
2394
|
-
|
|
2395
|
-
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
|
2396
|
-
} catch (_err) {
|
|
2397
|
-
// we're in a browser
|
|
2398
|
-
// we can't use regular timers because they may still be faked
|
|
2399
|
-
// so we try MessageChannel+postMessage instead
|
|
2400
|
-
enqueueTaskImpl = function (callback) {
|
|
2401
|
-
{
|
|
2402
|
-
if (didWarnAboutMessageChannel === false) {
|
|
2403
|
-
didWarnAboutMessageChannel = true;
|
|
2099
|
+
createRef: createRef,
|
|
2100
|
+
Component: Component,
|
|
2101
|
+
PureComponent: PureComponent,
|
|
2404
2102
|
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
}
|
|
2103
|
+
createContext: createContext,
|
|
2104
|
+
forwardRef: forwardRef,
|
|
2105
|
+
lazy: lazy,
|
|
2106
|
+
memo: memo,
|
|
2410
2107
|
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
channel.port2.postMessage(undefined);
|
|
2414
|
-
};
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2108
|
+
error: error,
|
|
2109
|
+
warn: warn,
|
|
2417
2110
|
|
|
2418
|
-
|
|
2419
|
-
|
|
2111
|
+
useCallback: useCallback,
|
|
2112
|
+
useContext: useContext,
|
|
2113
|
+
useEffect: useEffect,
|
|
2114
|
+
useImperativeHandle: useImperativeHandle,
|
|
2115
|
+
useDebugValue: useDebugValue,
|
|
2116
|
+
useLayoutEffect: useLayoutEffect,
|
|
2117
|
+
useMemo: useMemo,
|
|
2118
|
+
useReducer: useReducer,
|
|
2119
|
+
useRef: useRef,
|
|
2120
|
+
useState: useState,
|
|
2420
2121
|
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
// `act` calls can be nested, so we track the depth. This represents the
|
|
2426
|
-
// number of `act` scopes on the stack.
|
|
2427
|
-
var prevActScopeDepth = actScopeDepth;
|
|
2428
|
-
actScopeDepth++;
|
|
2122
|
+
Fragment: REACT_FRAGMENT_TYPE,
|
|
2123
|
+
Profiler: REACT_PROFILER_TYPE,
|
|
2124
|
+
StrictMode: REACT_STRICT_MODE_TYPE,
|
|
2125
|
+
Suspense: REACT_SUSPENSE_TYPE,
|
|
2429
2126
|
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
}
|
|
2127
|
+
createElement: createElementWithValidation,
|
|
2128
|
+
cloneElement: cloneElementWithValidation,
|
|
2129
|
+
createFactory: createFactoryWithValidation,
|
|
2130
|
+
isValidElement: isValidElement,
|
|
2435
2131
|
|
|
2436
|
-
|
|
2132
|
+
version: ReactVersion,
|
|
2437
2133
|
|
|
2438
|
-
|
|
2439
|
-
result = callback();
|
|
2440
|
-
} catch (error) {
|
|
2441
|
-
popActScope(prevActScopeDepth);
|
|
2442
|
-
throw error;
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
|
2446
|
-
var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
|
|
2447
|
-
// for it to resolve before exiting the current scope.
|
|
2448
|
-
|
|
2449
|
-
var wasAwaited = false;
|
|
2450
|
-
var thenable = {
|
|
2451
|
-
then: function (resolve, reject) {
|
|
2452
|
-
wasAwaited = true;
|
|
2453
|
-
thenableResult.then(function (returnValue) {
|
|
2454
|
-
popActScope(prevActScopeDepth);
|
|
2455
|
-
|
|
2456
|
-
if (actScopeDepth === 0) {
|
|
2457
|
-
// We've exited the outermost act scope. Recursively flush the
|
|
2458
|
-
// queue until there's no remaining work.
|
|
2459
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2460
|
-
} else {
|
|
2461
|
-
resolve(returnValue);
|
|
2462
|
-
}
|
|
2463
|
-
}, function (error) {
|
|
2464
|
-
// The callback threw an error.
|
|
2465
|
-
popActScope(prevActScopeDepth);
|
|
2466
|
-
reject(error);
|
|
2467
|
-
});
|
|
2468
|
-
}
|
|
2469
|
-
};
|
|
2134
|
+
unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
|
|
2470
2135
|
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
// eslint-disable-next-line no-undef
|
|
2474
|
-
Promise.resolve().then(function () {}).then(function () {
|
|
2475
|
-
if (!wasAwaited) {
|
|
2476
|
-
didWarnNoAwaitAct = true;
|
|
2136
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
2137
|
+
};
|
|
2477
2138
|
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
}
|
|
2139
|
+
// Note: some APIs are added with feature flags.
|
|
2140
|
+
// Make sure that stable builds for open source
|
|
2141
|
+
// don't modify the React object to avoid deopts.
|
|
2142
|
+
// Also let's not expose their names in stable builds.
|
|
2483
2143
|
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
// immediately, without awaiting.
|
|
2488
|
-
|
|
2489
|
-
popActScope(prevActScopeDepth);
|
|
2490
|
-
|
|
2491
|
-
if (actScopeDepth === 0) {
|
|
2492
|
-
// Exiting the outermost act scope. Flush the queue.
|
|
2493
|
-
var queue = ReactCurrentActQueue.current;
|
|
2494
|
-
|
|
2495
|
-
if (queue !== null) {
|
|
2496
|
-
flushActQueue(queue);
|
|
2497
|
-
ReactCurrentActQueue.current = null;
|
|
2498
|
-
} // Return a thenable. If the user awaits it, we'll flush again in
|
|
2499
|
-
// case additional work was scheduled by a microtask.
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
var _thenable = {
|
|
2503
|
-
then: function (resolve, reject) {
|
|
2504
|
-
// Confirm we haven't re-entered another `act` scope, in case
|
|
2505
|
-
// the user does something weird like await the thenable
|
|
2506
|
-
// multiple times.
|
|
2507
|
-
if (ReactCurrentActQueue.current === null) {
|
|
2508
|
-
// Recursively flush the queue until there's no remaining work.
|
|
2509
|
-
ReactCurrentActQueue.current = [];
|
|
2510
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2511
|
-
} else {
|
|
2512
|
-
resolve(returnValue);
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
};
|
|
2516
|
-
return _thenable;
|
|
2517
|
-
} else {
|
|
2518
|
-
// Since we're inside a nested `act` scope, the returned thenable
|
|
2519
|
-
// immediately resolves. The outer scope will flush the queue.
|
|
2520
|
-
var _thenable2 = {
|
|
2521
|
-
then: function (resolve, reject) {
|
|
2522
|
-
resolve(returnValue);
|
|
2523
|
-
}
|
|
2524
|
-
};
|
|
2525
|
-
return _thenable2;
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2144
|
+
if (enableStableConcurrentModeAPIs) {
|
|
2145
|
+
React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
2146
|
+
React.unstable_ConcurrentMode = undefined;
|
|
2529
2147
|
}
|
|
2530
2148
|
|
|
2531
|
-
|
|
2149
|
+
if (enableJSXTransformAPI) {
|
|
2532
2150
|
{
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
actScopeDepth = prevActScopeDepth;
|
|
2151
|
+
React.jsxDEV = jsxWithValidation;
|
|
2152
|
+
React.jsx = jsxWithValidationDynamic;
|
|
2153
|
+
React.jsxs = jsxWithValidationStatic;
|
|
2538
2154
|
}
|
|
2539
2155
|
}
|
|
2540
2156
|
|
|
2541
|
-
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
2542
|
-
{
|
|
2543
|
-
var queue = ReactCurrentActQueue.current;
|
|
2544
|
-
|
|
2545
|
-
if (queue !== null) {
|
|
2546
|
-
try {
|
|
2547
|
-
flushActQueue(queue);
|
|
2548
|
-
enqueueTask(function () {
|
|
2549
|
-
if (queue.length === 0) {
|
|
2550
|
-
// No additional work was scheduled. Finish.
|
|
2551
|
-
ReactCurrentActQueue.current = null;
|
|
2552
|
-
resolve(returnValue);
|
|
2553
|
-
} else {
|
|
2554
|
-
// Keep flushing work until there's none left.
|
|
2555
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2556
|
-
}
|
|
2557
|
-
});
|
|
2558
|
-
} catch (error) {
|
|
2559
|
-
reject(error);
|
|
2560
|
-
}
|
|
2561
|
-
} else {
|
|
2562
|
-
resolve(returnValue);
|
|
2563
|
-
}
|
|
2564
|
-
}
|
|
2565
|
-
}
|
|
2566
2157
|
|
|
2567
|
-
var isFlushing = false;
|
|
2568
2158
|
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
// Prevent re-entrancy.
|
|
2573
|
-
isFlushing = true;
|
|
2574
|
-
var i = 0;
|
|
2575
|
-
|
|
2576
|
-
try {
|
|
2577
|
-
for (; i < queue.length; i++) {
|
|
2578
|
-
var callback = queue[i];
|
|
2579
|
-
|
|
2580
|
-
do {
|
|
2581
|
-
callback = callback(true);
|
|
2582
|
-
} while (callback !== null);
|
|
2583
|
-
}
|
|
2159
|
+
var React$2 = Object.freeze({
|
|
2160
|
+
default: React
|
|
2161
|
+
});
|
|
2584
2162
|
|
|
2585
|
-
|
|
2586
|
-
} catch (error) {
|
|
2587
|
-
// If something throws, leave the remaining callbacks on the queue.
|
|
2588
|
-
queue = queue.slice(i + 1);
|
|
2589
|
-
throw error;
|
|
2590
|
-
} finally {
|
|
2591
|
-
isFlushing = false;
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2163
|
+
var React$3 = ( React$2 && React ) || React$2;
|
|
2596
2164
|
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
var
|
|
2600
|
-
var Children = {
|
|
2601
|
-
map: mapChildren,
|
|
2602
|
-
forEach: forEachChildren,
|
|
2603
|
-
count: countChildren,
|
|
2604
|
-
toArray: toArray,
|
|
2605
|
-
only: onlyChild
|
|
2606
|
-
};
|
|
2165
|
+
// TODO: decide on the top-level export form.
|
|
2166
|
+
// This is hacky but makes it work with both Rollup and Jest.
|
|
2167
|
+
var react = React$3.default || React$3;
|
|
2607
2168
|
|
|
2608
|
-
exports
|
|
2609
|
-
exports.Component = Component;
|
|
2610
|
-
exports.PureComponent = PureComponent;
|
|
2611
|
-
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
2612
|
-
exports.cloneElement = cloneElement$1;
|
|
2613
|
-
exports.createContext = createContext;
|
|
2614
|
-
exports.createElement = createElement$1;
|
|
2615
|
-
exports.createFactory = createFactory;
|
|
2616
|
-
exports.createRef = createRef;
|
|
2617
|
-
exports.forwardRef = forwardRef;
|
|
2618
|
-
exports.isValidElement = isValidElement;
|
|
2619
|
-
exports.lazy = lazy;
|
|
2620
|
-
exports.memo = memo;
|
|
2621
|
-
exports.startTransition = startTransition;
|
|
2622
|
-
exports.unstable_act = act;
|
|
2623
|
-
exports.unstable_createMutableSource = createMutableSource;
|
|
2624
|
-
exports.unstable_getCacheForType = getCacheForType;
|
|
2625
|
-
exports.unstable_useCacheRefresh = useCacheRefresh;
|
|
2626
|
-
exports.unstable_useMutableSource = useMutableSource;
|
|
2627
|
-
exports.unstable_useOpaqueIdentifier = useOpaqueIdentifier;
|
|
2628
|
-
exports.useCallback = useCallback;
|
|
2629
|
-
exports.useContext = useContext;
|
|
2630
|
-
exports.useDebugValue = useDebugValue;
|
|
2631
|
-
exports.useDeferredValue = useDeferredValue;
|
|
2632
|
-
exports.useEffect = useEffect;
|
|
2633
|
-
exports.useImperativeHandle = useImperativeHandle;
|
|
2634
|
-
exports.useLayoutEffect = useLayoutEffect;
|
|
2635
|
-
exports.useMemo = useMemo;
|
|
2636
|
-
exports.useReducer = useReducer;
|
|
2637
|
-
exports.useRef = useRef;
|
|
2638
|
-
exports.useState = useState;
|
|
2639
|
-
exports.useTransition = useTransition;
|
|
2640
|
-
exports.version = ReactVersion;
|
|
2169
|
+
module.exports = react;
|
|
2641
2170
|
})();
|
|
2642
2171
|
}
|