react 0.0.0-experimental-241485a2c-20210708 → 0.0.0-fec00a869
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 +789 -1530
- package/cjs/react.production.min.js +18 -19
- package/package.json +6 -21
- package/umd/react.development.js +2646 -2811
- package/umd/react.production.min.js +25 -24
- package/umd/react.profiling.min.js +30 -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-fec00a869
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -9,238 +9,217 @@
|
|
|
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.7.0-canary-fec00a869';
|
|
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
|
-
exports.unstable_Offscreen = 0xeae2;
|
|
41
|
-
exports.unstable_LegacyHidden = 0xeae3;
|
|
42
|
-
exports.unstable_Cache = 0xeae4;
|
|
43
|
-
|
|
44
|
-
if (typeof Symbol === 'function' && Symbol.for) {
|
|
45
|
-
var symbolFor = Symbol.for;
|
|
46
|
-
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
|
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;
|
|
65
42
|
|
|
66
43
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
67
44
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
45
|
+
|
|
68
46
|
function getIteratorFn(maybeIterable) {
|
|
69
47
|
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
70
48
|
return null;
|
|
71
49
|
}
|
|
72
|
-
|
|
73
50
|
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
74
|
-
|
|
75
51
|
if (typeof maybeIterator === 'function') {
|
|
76
52
|
return maybeIterator;
|
|
77
53
|
}
|
|
78
|
-
|
|
79
54
|
return null;
|
|
80
55
|
}
|
|
81
56
|
|
|
82
57
|
/**
|
|
83
|
-
*
|
|
84
|
-
*/
|
|
85
|
-
var ReactCurrentDispatcher = {
|
|
86
|
-
/**
|
|
87
|
-
* @internal
|
|
88
|
-
* @type {ReactComponent}
|
|
89
|
-
*/
|
|
90
|
-
current: null
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Keeps track of the current batch's configuration such as how long an update
|
|
95
|
-
* should suspend for if it needs to.
|
|
96
|
-
*/
|
|
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
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Keeps track of the current owner.
|
|
58
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
113
59
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
60
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
61
|
+
* to provide information about what broke and what you were
|
|
62
|
+
* expecting.
|
|
63
|
+
*
|
|
64
|
+
* The invariant message will be stripped in production, but the invariant
|
|
65
|
+
* will remain to ensure logic does not differ in production.
|
|
116
66
|
*/
|
|
117
|
-
var ReactCurrentOwner = {
|
|
118
|
-
/**
|
|
119
|
-
* @internal
|
|
120
|
-
* @type {ReactComponent}
|
|
121
|
-
*/
|
|
122
|
-
current: null
|
|
123
|
-
};
|
|
124
67
|
|
|
125
|
-
var
|
|
126
|
-
var currentExtraStackFrame = null;
|
|
127
|
-
function setExtraStackFrame(stack) {
|
|
128
|
-
{
|
|
129
|
-
currentExtraStackFrame = stack;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
68
|
+
var validateFormat = function () {};
|
|
132
69
|
|
|
133
70
|
{
|
|
134
|
-
|
|
135
|
-
{
|
|
136
|
-
|
|
71
|
+
validateFormat = function (format) {
|
|
72
|
+
if (format === undefined) {
|
|
73
|
+
throw new Error('invariant requires an error message argument');
|
|
137
74
|
}
|
|
138
|
-
};
|
|
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
|
-
|
|
75
|
+
};
|
|
76
|
+
}
|
|
150
77
|
|
|
151
|
-
|
|
78
|
+
function invariant(condition, format, a, b, c, d, e, f) {
|
|
79
|
+
validateFormat(format);
|
|
152
80
|
|
|
153
|
-
|
|
154
|
-
|
|
81
|
+
if (!condition) {
|
|
82
|
+
var error = void 0;
|
|
83
|
+
if (format === undefined) {
|
|
84
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
85
|
+
} else {
|
|
86
|
+
var args = [a, b, c, d, e, f];
|
|
87
|
+
var argIndex = 0;
|
|
88
|
+
error = new Error(format.replace(/%s/g, function () {
|
|
89
|
+
return args[argIndex++];
|
|
90
|
+
}));
|
|
91
|
+
error.name = 'Invariant Violation';
|
|
155
92
|
}
|
|
156
93
|
|
|
157
|
-
|
|
158
|
-
|
|
94
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
159
97
|
}
|
|
160
98
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
164
|
-
ReactCurrentOwner: ReactCurrentOwner,
|
|
165
|
-
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
166
|
-
assign: _assign
|
|
167
|
-
};
|
|
99
|
+
// Relying on the `invariant()` implementation lets us
|
|
100
|
+
// preserve the format and params in the www builds.
|
|
168
101
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Forked from fbjs/warning:
|
|
104
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
105
|
+
*
|
|
106
|
+
* Only change is we use console.warn instead of console.error,
|
|
107
|
+
* and do nothing when 'console' is not supported.
|
|
108
|
+
* This really simplifies the code.
|
|
109
|
+
* ---
|
|
110
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
111
|
+
* This can be used to log issues in development environments in critical
|
|
112
|
+
* paths. Removing the logging code for production environments will keep the
|
|
113
|
+
* same logic and follow the same code paths.
|
|
114
|
+
*/
|
|
173
115
|
|
|
174
|
-
|
|
175
|
-
//
|
|
176
|
-
// In PROD (or in packages without access to React internals),
|
|
177
|
-
// they are left as they are instead.
|
|
116
|
+
var lowPriorityWarning = function () {};
|
|
178
117
|
|
|
179
|
-
|
|
180
|
-
{
|
|
181
|
-
for (var _len = arguments.length, args =
|
|
118
|
+
{
|
|
119
|
+
var printWarning = function (format) {
|
|
120
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
182
121
|
args[_key - 1] = arguments[_key];
|
|
183
122
|
}
|
|
184
123
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
124
|
+
var argIndex = 0;
|
|
125
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
126
|
+
return args[argIndex++];
|
|
127
|
+
});
|
|
128
|
+
if (typeof console !== 'undefined') {
|
|
129
|
+
console.warn(message);
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
// --- Welcome to debugging React ---
|
|
133
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
134
|
+
// to find the callsite that caused this warning to fire.
|
|
135
|
+
throw new Error(message);
|
|
136
|
+
} catch (x) {}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
lowPriorityWarning = function (condition, format) {
|
|
140
|
+
if (format === undefined) {
|
|
141
|
+
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
192
142
|
}
|
|
143
|
+
if (!condition) {
|
|
144
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
145
|
+
args[_key2 - 2] = arguments[_key2];
|
|
146
|
+
}
|
|
193
147
|
|
|
194
|
-
|
|
195
|
-
|
|
148
|
+
printWarning.apply(undefined, [format].concat(args));
|
|
149
|
+
}
|
|
150
|
+
};
|
|
196
151
|
}
|
|
197
152
|
|
|
198
|
-
|
|
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();
|
|
153
|
+
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
204
154
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
157
|
+
* This can be used to log issues in development environments in critical
|
|
158
|
+
* paths. Removing the logging code for production environments will keep the
|
|
159
|
+
* same logic and follow the same code paths.
|
|
160
|
+
*/
|
|
209
161
|
|
|
210
|
-
|
|
211
|
-
return '' + item;
|
|
212
|
-
}); // Careful: RN currently depends on this prefix
|
|
162
|
+
var warningWithoutStack = function () {};
|
|
213
163
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
164
|
+
{
|
|
165
|
+
warningWithoutStack = function (condition, format) {
|
|
166
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
167
|
+
args[_key - 2] = arguments[_key];
|
|
168
|
+
}
|
|
217
169
|
|
|
218
|
-
|
|
219
|
-
|
|
170
|
+
if (format === undefined) {
|
|
171
|
+
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
172
|
+
}
|
|
173
|
+
if (args.length > 8) {
|
|
174
|
+
// Check before the condition to catch violations early.
|
|
175
|
+
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
|
176
|
+
}
|
|
177
|
+
if (condition) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (typeof console !== 'undefined') {
|
|
181
|
+
var argsWithFormat = args.map(function (item) {
|
|
182
|
+
return '' + item;
|
|
183
|
+
});
|
|
184
|
+
argsWithFormat.unshift('Warning: ' + format);
|
|
185
|
+
|
|
186
|
+
// We intentionally don't use spread (or .apply) directly because it
|
|
187
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
188
|
+
Function.prototype.apply.call(console.error, console, argsWithFormat);
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
// --- Welcome to debugging React ---
|
|
192
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
193
|
+
// to find the callsite that caused this warning to fire.
|
|
194
|
+
var argIndex = 0;
|
|
195
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
196
|
+
return args[argIndex++];
|
|
197
|
+
});
|
|
198
|
+
throw new Error(message);
|
|
199
|
+
} catch (x) {}
|
|
200
|
+
};
|
|
220
201
|
}
|
|
221
202
|
|
|
203
|
+
var warningWithoutStack$1 = warningWithoutStack;
|
|
204
|
+
|
|
222
205
|
var didWarnStateUpdateForUnmountedComponent = {};
|
|
223
206
|
|
|
224
207
|
function warnNoop(publicInstance, callerName) {
|
|
225
208
|
{
|
|
226
209
|
var _constructor = publicInstance.constructor;
|
|
227
210
|
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
228
|
-
var warningKey = componentName +
|
|
229
|
-
|
|
211
|
+
var warningKey = componentName + '.' + callerName;
|
|
230
212
|
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
231
213
|
return;
|
|
232
214
|
}
|
|
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
|
-
|
|
215
|
+
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
216
|
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
237
217
|
}
|
|
238
218
|
}
|
|
219
|
+
|
|
239
220
|
/**
|
|
240
221
|
* This is the abstract API for an update queue.
|
|
241
222
|
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
223
|
var ReactNoopUpdateQueue = {
|
|
245
224
|
/**
|
|
246
225
|
* Checks whether or not this composite component is mounted.
|
|
@@ -307,26 +286,25 @@ var ReactNoopUpdateQueue = {
|
|
|
307
286
|
};
|
|
308
287
|
|
|
309
288
|
var emptyObject = {};
|
|
310
|
-
|
|
311
289
|
{
|
|
312
290
|
Object.freeze(emptyObject);
|
|
313
291
|
}
|
|
292
|
+
|
|
314
293
|
/**
|
|
315
294
|
* Base class helpers for the updating state of a component.
|
|
316
295
|
*/
|
|
317
|
-
|
|
318
|
-
|
|
319
296
|
function Component(props, context, updater) {
|
|
320
297
|
this.props = props;
|
|
321
|
-
this.context = context;
|
|
322
|
-
|
|
323
|
-
this.refs = emptyObject;
|
|
298
|
+
this.context = context;
|
|
299
|
+
// If a component has string refs, we will assign a different object later.
|
|
300
|
+
this.refs = emptyObject;
|
|
301
|
+
// We initialize the default updater but the real one gets injected by the
|
|
324
302
|
// renderer.
|
|
325
|
-
|
|
326
303
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
327
304
|
}
|
|
328
305
|
|
|
329
306
|
Component.prototype.isReactComponent = {};
|
|
307
|
+
|
|
330
308
|
/**
|
|
331
309
|
* Sets a subset of the state. Always use this to mutate
|
|
332
310
|
* state. You should treat `this.state` as immutable.
|
|
@@ -352,16 +330,11 @@ Component.prototype.isReactComponent = {};
|
|
|
352
330
|
* @final
|
|
353
331
|
* @protected
|
|
354
332
|
*/
|
|
355
|
-
|
|
356
333
|
Component.prototype.setState = function (partialState, callback) {
|
|
357
|
-
|
|
358
|
-
{
|
|
359
|
-
throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
334
|
+
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
|
|
363
335
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
364
336
|
};
|
|
337
|
+
|
|
365
338
|
/**
|
|
366
339
|
* Forces an update. This should only be invoked when it is known with
|
|
367
340
|
* certainty that we are **not** in a DOM transaction.
|
|
@@ -376,34 +349,28 @@ Component.prototype.setState = function (partialState, callback) {
|
|
|
376
349
|
* @final
|
|
377
350
|
* @protected
|
|
378
351
|
*/
|
|
379
|
-
|
|
380
|
-
|
|
381
352
|
Component.prototype.forceUpdate = function (callback) {
|
|
382
353
|
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
383
354
|
};
|
|
355
|
+
|
|
384
356
|
/**
|
|
385
357
|
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
386
358
|
* we would like to deprecate them, we're not going to move them over to this
|
|
387
359
|
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
388
360
|
*/
|
|
389
|
-
|
|
390
|
-
|
|
391
361
|
{
|
|
392
362
|
var deprecatedAPIs = {
|
|
393
363
|
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
394
364
|
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
395
365
|
};
|
|
396
|
-
|
|
397
366
|
var defineDeprecationWarning = function (methodName, info) {
|
|
398
367
|
Object.defineProperty(Component.prototype, methodName, {
|
|
399
368
|
get: function () {
|
|
400
|
-
|
|
401
|
-
|
|
369
|
+
lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
402
370
|
return undefined;
|
|
403
371
|
}
|
|
404
372
|
});
|
|
405
373
|
};
|
|
406
|
-
|
|
407
374
|
for (var fnName in deprecatedAPIs) {
|
|
408
375
|
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
409
376
|
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
@@ -412,25 +379,23 @@ Component.prototype.forceUpdate = function (callback) {
|
|
|
412
379
|
}
|
|
413
380
|
|
|
414
381
|
function ComponentDummy() {}
|
|
415
|
-
|
|
416
382
|
ComponentDummy.prototype = Component.prototype;
|
|
383
|
+
|
|
417
384
|
/**
|
|
418
385
|
* Convenience component with default shallow equality check for sCU.
|
|
419
386
|
*/
|
|
420
|
-
|
|
421
387
|
function PureComponent(props, context, updater) {
|
|
422
388
|
this.props = props;
|
|
423
|
-
this.context = context;
|
|
424
|
-
|
|
389
|
+
this.context = context;
|
|
390
|
+
// If a component has string refs, we will assign a different object later.
|
|
425
391
|
this.refs = emptyObject;
|
|
426
392
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
427
393
|
}
|
|
428
394
|
|
|
429
395
|
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
430
|
-
pureComponentPrototype.constructor = PureComponent;
|
|
431
|
-
|
|
396
|
+
pureComponentPrototype.constructor = PureComponent;
|
|
397
|
+
// Avoid an extra prototype jump for these methods.
|
|
432
398
|
_assign(pureComponentPrototype, Component.prototype);
|
|
433
|
-
|
|
434
399
|
pureComponentPrototype.isPureReactComponent = true;
|
|
435
400
|
|
|
436
401
|
// an immutable object with a single mutable value
|
|
@@ -438,120 +403,209 @@ function createRef() {
|
|
|
438
403
|
var refObject = {
|
|
439
404
|
current: null
|
|
440
405
|
};
|
|
441
|
-
|
|
442
406
|
{
|
|
443
407
|
Object.seal(refObject);
|
|
444
408
|
}
|
|
445
|
-
|
|
446
409
|
return refObject;
|
|
447
410
|
}
|
|
448
411
|
|
|
449
|
-
|
|
412
|
+
/**
|
|
413
|
+
* Keeps track of the current dispatcher.
|
|
414
|
+
*/
|
|
415
|
+
var ReactCurrentDispatcher = {
|
|
416
|
+
/**
|
|
417
|
+
* @internal
|
|
418
|
+
* @type {ReactComponent}
|
|
419
|
+
*/
|
|
420
|
+
current: null
|
|
421
|
+
};
|
|
450
422
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
423
|
+
/**
|
|
424
|
+
* Keeps track of the current owner.
|
|
425
|
+
*
|
|
426
|
+
* The current owner is the component who should own any components that are
|
|
427
|
+
* currently being constructed.
|
|
428
|
+
*/
|
|
429
|
+
var ReactCurrentOwner = {
|
|
430
|
+
/**
|
|
431
|
+
* @internal
|
|
432
|
+
* @type {ReactComponent}
|
|
433
|
+
*/
|
|
434
|
+
current: null
|
|
435
|
+
};
|
|
454
436
|
|
|
455
|
-
|
|
456
|
-
var displayName = outerType.displayName;
|
|
437
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
457
438
|
|
|
458
|
-
|
|
459
|
-
|
|
439
|
+
var describeComponentFrame = function (name, source, ownerName) {
|
|
440
|
+
var sourceInfo = '';
|
|
441
|
+
if (source) {
|
|
442
|
+
var path = source.fileName;
|
|
443
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
444
|
+
{
|
|
445
|
+
// In DEV, include code for a common special case:
|
|
446
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
447
|
+
if (/^index\./.test(fileName)) {
|
|
448
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
449
|
+
if (match) {
|
|
450
|
+
var pathBeforeSlash = match[1];
|
|
451
|
+
if (pathBeforeSlash) {
|
|
452
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
453
|
+
fileName = folderName + '/' + fileName;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
459
|
+
} else if (ownerName) {
|
|
460
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
460
461
|
}
|
|
462
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
463
|
+
};
|
|
461
464
|
|
|
462
|
-
|
|
463
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
464
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
465
|
+
var Resolved = 1;
|
|
465
466
|
|
|
466
467
|
|
|
467
|
-
function
|
|
468
|
-
return
|
|
469
|
-
}
|
|
468
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
469
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
470
|
+
}
|
|
470
471
|
|
|
472
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
473
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
474
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
|
475
|
+
}
|
|
471
476
|
|
|
472
|
-
function
|
|
477
|
+
function getComponentName(type) {
|
|
473
478
|
if (type == null) {
|
|
474
479
|
// Host root, text node or just invalid type.
|
|
475
480
|
return null;
|
|
476
481
|
}
|
|
477
|
-
|
|
478
482
|
{
|
|
479
483
|
if (typeof type.tag === 'number') {
|
|
480
|
-
|
|
484
|
+
warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
481
485
|
}
|
|
482
486
|
}
|
|
483
|
-
|
|
484
487
|
if (typeof type === 'function') {
|
|
485
488
|
return type.displayName || type.name || null;
|
|
486
489
|
}
|
|
487
|
-
|
|
488
490
|
if (typeof type === 'string') {
|
|
489
491
|
return type;
|
|
490
492
|
}
|
|
491
|
-
|
|
492
493
|
switch (type) {
|
|
493
|
-
case
|
|
494
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
495
|
+
return 'ConcurrentMode';
|
|
496
|
+
case REACT_FRAGMENT_TYPE:
|
|
494
497
|
return 'Fragment';
|
|
495
|
-
|
|
496
498
|
case REACT_PORTAL_TYPE:
|
|
497
499
|
return 'Portal';
|
|
498
|
-
|
|
499
|
-
case exports.Profiler:
|
|
500
|
+
case REACT_PROFILER_TYPE:
|
|
500
501
|
return 'Profiler';
|
|
501
|
-
|
|
502
|
-
case exports.StrictMode:
|
|
502
|
+
case REACT_STRICT_MODE_TYPE:
|
|
503
503
|
return 'StrictMode';
|
|
504
|
-
|
|
505
|
-
case exports.Suspense:
|
|
504
|
+
case REACT_SUSPENSE_TYPE:
|
|
506
505
|
return 'Suspense';
|
|
507
|
-
|
|
508
|
-
case exports.SuspenseList:
|
|
509
|
-
return 'SuspenseList';
|
|
510
|
-
|
|
511
|
-
case exports.unstable_Cache:
|
|
512
|
-
return 'Cache';
|
|
513
506
|
}
|
|
514
|
-
|
|
515
507
|
if (typeof type === 'object') {
|
|
516
508
|
switch (type.$$typeof) {
|
|
517
509
|
case REACT_CONTEXT_TYPE:
|
|
518
|
-
|
|
519
|
-
return getContextName(context) + '.Consumer';
|
|
520
|
-
|
|
510
|
+
return 'Context.Consumer';
|
|
521
511
|
case REACT_PROVIDER_TYPE:
|
|
522
|
-
|
|
523
|
-
return getContextName(provider._context) + '.Provider';
|
|
524
|
-
|
|
512
|
+
return 'Context.Provider';
|
|
525
513
|
case REACT_FORWARD_REF_TYPE:
|
|
526
514
|
return getWrappedName(type, type.render, 'ForwardRef');
|
|
527
|
-
|
|
528
515
|
case REACT_MEMO_TYPE:
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
if (outerName !== null) {
|
|
532
|
-
return outerName;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
536
|
-
|
|
516
|
+
return getComponentName(type.type);
|
|
537
517
|
case REACT_LAZY_TYPE:
|
|
538
518
|
{
|
|
539
|
-
var
|
|
540
|
-
var
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
try {
|
|
544
|
-
return getComponentNameFromType(init(payload));
|
|
545
|
-
} catch (x) {
|
|
546
|
-
return null;
|
|
519
|
+
var thenable = type;
|
|
520
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
521
|
+
if (resolvedThenable) {
|
|
522
|
+
return getComponentName(resolvedThenable);
|
|
547
523
|
}
|
|
548
524
|
}
|
|
549
525
|
}
|
|
550
526
|
}
|
|
551
|
-
|
|
552
527
|
return null;
|
|
553
528
|
}
|
|
554
529
|
|
|
530
|
+
var ReactDebugCurrentFrame = {};
|
|
531
|
+
|
|
532
|
+
var currentlyValidatingElement = null;
|
|
533
|
+
|
|
534
|
+
function setCurrentlyValidatingElement(element) {
|
|
535
|
+
{
|
|
536
|
+
currentlyValidatingElement = element;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
{
|
|
541
|
+
// Stack implementation injected by the current renderer.
|
|
542
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
543
|
+
|
|
544
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
545
|
+
var stack = '';
|
|
546
|
+
|
|
547
|
+
// Add an extra top frame while an element is being validated
|
|
548
|
+
if (currentlyValidatingElement) {
|
|
549
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
550
|
+
var owner = currentlyValidatingElement._owner;
|
|
551
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// Delegate to the injected renderer-specific implementation
|
|
555
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
556
|
+
if (impl) {
|
|
557
|
+
stack += impl() || '';
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
return stack;
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
var ReactSharedInternals = {
|
|
565
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
566
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
567
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
568
|
+
assign: _assign
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
{
|
|
572
|
+
_assign(ReactSharedInternals, {
|
|
573
|
+
// These should not be included in production.
|
|
574
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
575
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
576
|
+
// TODO: remove in React 17.0.
|
|
577
|
+
ReactComponentTreeHook: {}
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
583
|
+
* This can be used to log issues in development environments in critical
|
|
584
|
+
* paths. Removing the logging code for production environments will keep the
|
|
585
|
+
* same logic and follow the same code paths.
|
|
586
|
+
*/
|
|
587
|
+
|
|
588
|
+
var warning = warningWithoutStack$1;
|
|
589
|
+
|
|
590
|
+
{
|
|
591
|
+
warning = function (condition, format) {
|
|
592
|
+
if (condition) {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
596
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
597
|
+
// eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
598
|
+
|
|
599
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
600
|
+
args[_key - 2] = arguments[_key];
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
var warning$1 = warning;
|
|
608
|
+
|
|
555
609
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
556
610
|
|
|
557
611
|
var RESERVED_PROPS = {
|
|
@@ -560,23 +614,19 @@ var RESERVED_PROPS = {
|
|
|
560
614
|
__self: true,
|
|
561
615
|
__source: true
|
|
562
616
|
};
|
|
563
|
-
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
564
617
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}
|
|
618
|
+
var specialPropKeyWarningShown = void 0;
|
|
619
|
+
var specialPropRefWarningShown = void 0;
|
|
568
620
|
|
|
569
621
|
function hasValidRef(config) {
|
|
570
622
|
{
|
|
571
623
|
if (hasOwnProperty.call(config, 'ref')) {
|
|
572
624
|
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
573
|
-
|
|
574
625
|
if (getter && getter.isReactWarning) {
|
|
575
626
|
return false;
|
|
576
627
|
}
|
|
577
628
|
}
|
|
578
629
|
}
|
|
579
|
-
|
|
580
630
|
return config.ref !== undefined;
|
|
581
631
|
}
|
|
582
632
|
|
|
@@ -584,27 +634,21 @@ function hasValidKey(config) {
|
|
|
584
634
|
{
|
|
585
635
|
if (hasOwnProperty.call(config, 'key')) {
|
|
586
636
|
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
587
|
-
|
|
588
637
|
if (getter && getter.isReactWarning) {
|
|
589
638
|
return false;
|
|
590
639
|
}
|
|
591
640
|
}
|
|
592
641
|
}
|
|
593
|
-
|
|
594
642
|
return config.key !== undefined;
|
|
595
643
|
}
|
|
596
644
|
|
|
597
645
|
function defineKeyPropWarningGetter(props, displayName) {
|
|
598
646
|
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
|
-
}
|
|
647
|
+
if (!specialPropKeyWarningShown) {
|
|
648
|
+
specialPropKeyWarningShown = true;
|
|
649
|
+
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
650
|
}
|
|
606
651
|
};
|
|
607
|
-
|
|
608
652
|
warnAboutAccessingKey.isReactWarning = true;
|
|
609
653
|
Object.defineProperty(props, 'key', {
|
|
610
654
|
get: warnAboutAccessingKey,
|
|
@@ -614,15 +658,11 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
614
658
|
|
|
615
659
|
function defineRefPropWarningGetter(props, displayName) {
|
|
616
660
|
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
|
-
}
|
|
661
|
+
if (!specialPropRefWarningShown) {
|
|
662
|
+
specialPropRefWarningShown = true;
|
|
663
|
+
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
664
|
}
|
|
624
665
|
};
|
|
625
|
-
|
|
626
666
|
warnAboutAccessingRef.isReactWarning = true;
|
|
627
667
|
Object.defineProperty(props, 'ref', {
|
|
628
668
|
get: warnAboutAccessingRef,
|
|
@@ -630,30 +670,15 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
630
670
|
});
|
|
631
671
|
}
|
|
632
672
|
|
|
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
673
|
/**
|
|
647
674
|
* 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
|
|
675
|
+
* the class pattern, so do not use new to call it. Also, no instanceof check
|
|
676
|
+
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
650
677
|
* if something is a React Element.
|
|
651
678
|
*
|
|
652
679
|
* @param {*} type
|
|
653
|
-
* @param {*} props
|
|
654
680
|
* @param {*} key
|
|
655
681
|
* @param {string|object} ref
|
|
656
|
-
* @param {*} owner
|
|
657
682
|
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
658
683
|
* different from the `owner` when React.createElement is called, so that we
|
|
659
684
|
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
@@ -661,19 +686,21 @@ function warnIfStringRefCannotBeAutoConverted(config) {
|
|
|
661
686
|
* change in behavior.
|
|
662
687
|
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
663
688
|
* indicating filename, line number, and/or other information.
|
|
689
|
+
* @param {*} owner
|
|
690
|
+
* @param {*} props
|
|
664
691
|
* @internal
|
|
665
692
|
*/
|
|
666
|
-
|
|
667
|
-
|
|
668
693
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
669
694
|
var element = {
|
|
670
695
|
// This tag allows us to uniquely identify this as a React Element
|
|
671
696
|
$$typeof: REACT_ELEMENT_TYPE,
|
|
697
|
+
|
|
672
698
|
// Built-in properties that belong on the element
|
|
673
699
|
type: type,
|
|
674
700
|
key: key,
|
|
675
701
|
ref: ref,
|
|
676
702
|
props: props,
|
|
703
|
+
|
|
677
704
|
// Record the component responsible for creating this element.
|
|
678
705
|
_owner: owner
|
|
679
706
|
};
|
|
@@ -683,33 +710,33 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
683
710
|
// an external backing store so that we can freeze the whole object.
|
|
684
711
|
// This can be replaced with a WeakMap once they are implemented in
|
|
685
712
|
// commonly used development environments.
|
|
686
|
-
element._store = {};
|
|
713
|
+
element._store = {};
|
|
714
|
+
|
|
715
|
+
// To make comparing ReactElements easier for testing purposes, we make
|
|
687
716
|
// the validation flag non-enumerable (where possible, which should
|
|
688
717
|
// include every environment we run tests in), so the test framework
|
|
689
718
|
// ignores it.
|
|
690
|
-
|
|
691
719
|
Object.defineProperty(element._store, 'validated', {
|
|
692
720
|
configurable: false,
|
|
693
721
|
enumerable: false,
|
|
694
722
|
writable: true,
|
|
695
723
|
value: false
|
|
696
|
-
});
|
|
697
|
-
|
|
724
|
+
});
|
|
725
|
+
// self and source are DEV only properties.
|
|
698
726
|
Object.defineProperty(element, '_self', {
|
|
699
727
|
configurable: false,
|
|
700
728
|
enumerable: false,
|
|
701
729
|
writable: false,
|
|
702
730
|
value: self
|
|
703
|
-
});
|
|
731
|
+
});
|
|
732
|
+
// Two elements created in two different places should be considered
|
|
704
733
|
// equal for testing purposes and therefore we hide it from enumeration.
|
|
705
|
-
|
|
706
734
|
Object.defineProperty(element, '_source', {
|
|
707
735
|
configurable: false,
|
|
708
736
|
enumerable: false,
|
|
709
737
|
writable: false,
|
|
710
738
|
value: source
|
|
711
739
|
});
|
|
712
|
-
|
|
713
740
|
if (Object.freeze) {
|
|
714
741
|
Object.freeze(element.props);
|
|
715
742
|
Object.freeze(element);
|
|
@@ -718,15 +745,17 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
718
745
|
|
|
719
746
|
return element;
|
|
720
747
|
};
|
|
748
|
+
|
|
721
749
|
/**
|
|
722
750
|
* Create and return a new ReactElement of the given type.
|
|
723
751
|
* See https://reactjs.org/docs/react-api.html#createelement
|
|
724
752
|
*/
|
|
725
|
-
|
|
726
753
|
function createElement(type, config, children) {
|
|
727
|
-
var propName
|
|
754
|
+
var propName = void 0;
|
|
728
755
|
|
|
756
|
+
// Reserved names are extracted
|
|
729
757
|
var props = {};
|
|
758
|
+
|
|
730
759
|
var key = null;
|
|
731
760
|
var ref = null;
|
|
732
761
|
var self = null;
|
|
@@ -735,105 +764,97 @@ function createElement(type, config, children) {
|
|
|
735
764
|
if (config != null) {
|
|
736
765
|
if (hasValidRef(config)) {
|
|
737
766
|
ref = config.ref;
|
|
738
|
-
|
|
739
|
-
{
|
|
740
|
-
warnIfStringRefCannotBeAutoConverted(config);
|
|
741
|
-
}
|
|
742
767
|
}
|
|
743
|
-
|
|
744
768
|
if (hasValidKey(config)) {
|
|
745
769
|
key = '' + config.key;
|
|
746
770
|
}
|
|
747
771
|
|
|
748
772
|
self = config.__self === undefined ? null : config.__self;
|
|
749
|
-
source = config.__source === undefined ? null : config.__source;
|
|
750
|
-
|
|
773
|
+
source = config.__source === undefined ? null : config.__source;
|
|
774
|
+
// Remaining properties are added to a new props object
|
|
751
775
|
for (propName in config) {
|
|
752
776
|
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
753
777
|
props[propName] = config[propName];
|
|
754
778
|
}
|
|
755
779
|
}
|
|
756
|
-
}
|
|
757
|
-
// the newly allocated props object.
|
|
758
|
-
|
|
780
|
+
}
|
|
759
781
|
|
|
782
|
+
// Children can be more than one argument, and those are transferred onto
|
|
783
|
+
// the newly allocated props object.
|
|
760
784
|
var childrenLength = arguments.length - 2;
|
|
761
|
-
|
|
762
785
|
if (childrenLength === 1) {
|
|
763
786
|
props.children = children;
|
|
764
787
|
} else if (childrenLength > 1) {
|
|
765
788
|
var childArray = Array(childrenLength);
|
|
766
|
-
|
|
767
789
|
for (var i = 0; i < childrenLength; i++) {
|
|
768
790
|
childArray[i] = arguments[i + 2];
|
|
769
791
|
}
|
|
770
|
-
|
|
771
792
|
{
|
|
772
793
|
if (Object.freeze) {
|
|
773
794
|
Object.freeze(childArray);
|
|
774
795
|
}
|
|
775
796
|
}
|
|
776
|
-
|
|
777
797
|
props.children = childArray;
|
|
778
|
-
}
|
|
779
|
-
|
|
798
|
+
}
|
|
780
799
|
|
|
800
|
+
// Resolve default props
|
|
781
801
|
if (type && type.defaultProps) {
|
|
782
802
|
var defaultProps = type.defaultProps;
|
|
783
|
-
|
|
784
803
|
for (propName in defaultProps) {
|
|
785
804
|
if (props[propName] === undefined) {
|
|
786
805
|
props[propName] = defaultProps[propName];
|
|
787
806
|
}
|
|
788
807
|
}
|
|
789
808
|
}
|
|
790
|
-
|
|
791
809
|
{
|
|
792
810
|
if (key || ref) {
|
|
793
811
|
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
794
|
-
|
|
795
812
|
if (key) {
|
|
796
813
|
defineKeyPropWarningGetter(props, displayName);
|
|
797
814
|
}
|
|
798
|
-
|
|
799
815
|
if (ref) {
|
|
800
816
|
defineRefPropWarningGetter(props, displayName);
|
|
801
817
|
}
|
|
802
818
|
}
|
|
803
819
|
}
|
|
804
|
-
|
|
805
820
|
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
806
821
|
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Return a function that produces ReactElements of a given type.
|
|
825
|
+
* See https://reactjs.org/docs/react-api.html#createfactory
|
|
826
|
+
*/
|
|
827
|
+
|
|
828
|
+
|
|
807
829
|
function cloneAndReplaceKey(oldElement, newKey) {
|
|
808
830
|
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
831
|
+
|
|
809
832
|
return newElement;
|
|
810
833
|
}
|
|
834
|
+
|
|
811
835
|
/**
|
|
812
836
|
* Clone and return a new ReactElement using element as the starting point.
|
|
813
837
|
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
814
838
|
*/
|
|
815
|
-
|
|
816
839
|
function cloneElement(element, config, children) {
|
|
817
|
-
|
|
818
|
-
{
|
|
819
|
-
throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
var propName; // Original props are copied
|
|
840
|
+
!!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
|
|
824
841
|
|
|
825
|
-
var
|
|
842
|
+
var propName = void 0;
|
|
826
843
|
|
|
844
|
+
// Original props are copied
|
|
845
|
+
var props = _assign({}, element.props);
|
|
827
846
|
|
|
847
|
+
// Reserved names are extracted
|
|
828
848
|
var key = element.key;
|
|
829
|
-
var ref = element.ref;
|
|
830
|
-
|
|
831
|
-
var self = element._self;
|
|
849
|
+
var ref = element.ref;
|
|
850
|
+
// Self is preserved since the owner is preserved.
|
|
851
|
+
var self = element._self;
|
|
852
|
+
// Source is preserved since cloneElement is unlikely to be targeted by a
|
|
832
853
|
// transpiler, and the original source is probably a better indicator of the
|
|
833
854
|
// true owner.
|
|
855
|
+
var source = element._source;
|
|
834
856
|
|
|
835
|
-
|
|
836
|
-
|
|
857
|
+
// Owner will be preserved, unless ref is overridden
|
|
837
858
|
var owner = element._owner;
|
|
838
859
|
|
|
839
860
|
if (config != null) {
|
|
@@ -842,18 +863,15 @@ function cloneElement(element, config, children) {
|
|
|
842
863
|
ref = config.ref;
|
|
843
864
|
owner = ReactCurrentOwner.current;
|
|
844
865
|
}
|
|
845
|
-
|
|
846
866
|
if (hasValidKey(config)) {
|
|
847
867
|
key = '' + config.key;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
var defaultProps;
|
|
868
|
+
}
|
|
852
869
|
|
|
870
|
+
// Remaining properties override existing props
|
|
871
|
+
var defaultProps = void 0;
|
|
853
872
|
if (element.type && element.type.defaultProps) {
|
|
854
873
|
defaultProps = element.type.defaultProps;
|
|
855
874
|
}
|
|
856
|
-
|
|
857
875
|
for (propName in config) {
|
|
858
876
|
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
859
877
|
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
@@ -864,26 +882,24 @@ function cloneElement(element, config, children) {
|
|
|
864
882
|
}
|
|
865
883
|
}
|
|
866
884
|
}
|
|
867
|
-
}
|
|
868
|
-
// the newly allocated props object.
|
|
869
|
-
|
|
885
|
+
}
|
|
870
886
|
|
|
887
|
+
// Children can be more than one argument, and those are transferred onto
|
|
888
|
+
// the newly allocated props object.
|
|
871
889
|
var childrenLength = arguments.length - 2;
|
|
872
|
-
|
|
873
890
|
if (childrenLength === 1) {
|
|
874
891
|
props.children = children;
|
|
875
892
|
} else if (childrenLength > 1) {
|
|
876
893
|
var childArray = Array(childrenLength);
|
|
877
|
-
|
|
878
894
|
for (var i = 0; i < childrenLength; i++) {
|
|
879
895
|
childArray[i] = arguments[i + 2];
|
|
880
896
|
}
|
|
881
|
-
|
|
882
897
|
props.children = childArray;
|
|
883
898
|
}
|
|
884
899
|
|
|
885
900
|
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
886
901
|
}
|
|
902
|
+
|
|
887
903
|
/**
|
|
888
904
|
* Verifies the object is a ReactElement.
|
|
889
905
|
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
@@ -891,65 +907,86 @@ function cloneElement(element, config, children) {
|
|
|
891
907
|
* @return {boolean} True if `object` is a ReactElement.
|
|
892
908
|
* @final
|
|
893
909
|
*/
|
|
894
|
-
|
|
895
910
|
function isValidElement(object) {
|
|
896
911
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
897
912
|
}
|
|
898
913
|
|
|
899
914
|
var SEPARATOR = '.';
|
|
900
915
|
var SUBSEPARATOR = ':';
|
|
916
|
+
|
|
901
917
|
/**
|
|
902
918
|
* Escape and wrap key so it is safe to use as a reactid
|
|
903
919
|
*
|
|
904
920
|
* @param {string} key to be escaped.
|
|
905
921
|
* @return {string} the escaped key.
|
|
906
922
|
*/
|
|
907
|
-
|
|
908
923
|
function escape(key) {
|
|
909
924
|
var escapeRegex = /[=:]/g;
|
|
910
925
|
var escaperLookup = {
|
|
911
926
|
'=': '=0',
|
|
912
927
|
':': '=2'
|
|
913
928
|
};
|
|
914
|
-
var escapedString = key.replace(escapeRegex, function (match) {
|
|
929
|
+
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
|
915
930
|
return escaperLookup[match];
|
|
916
931
|
});
|
|
932
|
+
|
|
917
933
|
return '$' + escapedString;
|
|
918
934
|
}
|
|
935
|
+
|
|
919
936
|
/**
|
|
920
937
|
* TODO: Test that a single child and an array with one item have the same key
|
|
921
938
|
* pattern.
|
|
922
939
|
*/
|
|
923
940
|
|
|
924
|
-
|
|
925
941
|
var didWarnAboutMaps = false;
|
|
926
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
927
942
|
|
|
943
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
928
944
|
function escapeUserProvidedKey(text) {
|
|
929
|
-
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
|
945
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
var POOL_SIZE = 10;
|
|
949
|
+
var traverseContextPool = [];
|
|
950
|
+
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
951
|
+
if (traverseContextPool.length) {
|
|
952
|
+
var traverseContext = traverseContextPool.pop();
|
|
953
|
+
traverseContext.result = mapResult;
|
|
954
|
+
traverseContext.keyPrefix = keyPrefix;
|
|
955
|
+
traverseContext.func = mapFunction;
|
|
956
|
+
traverseContext.context = mapContext;
|
|
957
|
+
traverseContext.count = 0;
|
|
958
|
+
return traverseContext;
|
|
959
|
+
} else {
|
|
960
|
+
return {
|
|
961
|
+
result: mapResult,
|
|
962
|
+
keyPrefix: keyPrefix,
|
|
963
|
+
func: mapFunction,
|
|
964
|
+
context: mapContext,
|
|
965
|
+
count: 0
|
|
966
|
+
};
|
|
967
|
+
}
|
|
930
968
|
}
|
|
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
|
-
|
|
940
|
-
function getElementKey(element, index) {
|
|
941
|
-
// Do some typechecking here since we call this blindly. We want to ensure
|
|
942
|
-
// that we don't block potential future ES APIs.
|
|
943
|
-
if (typeof element === 'object' && element !== null && element.key != null) {
|
|
944
|
-
// Explicit key
|
|
945
|
-
return escape('' + element.key);
|
|
946
|
-
} // Implicit key determined by the index in the set
|
|
947
|
-
|
|
948
969
|
|
|
949
|
-
|
|
970
|
+
function releaseTraverseContext(traverseContext) {
|
|
971
|
+
traverseContext.result = null;
|
|
972
|
+
traverseContext.keyPrefix = null;
|
|
973
|
+
traverseContext.func = null;
|
|
974
|
+
traverseContext.context = null;
|
|
975
|
+
traverseContext.count = 0;
|
|
976
|
+
if (traverseContextPool.length < POOL_SIZE) {
|
|
977
|
+
traverseContextPool.push(traverseContext);
|
|
978
|
+
}
|
|
950
979
|
}
|
|
951
980
|
|
|
952
|
-
|
|
981
|
+
/**
|
|
982
|
+
* @param {?*} children Children tree container.
|
|
983
|
+
* @param {!string} nameSoFar Name of the key path so far.
|
|
984
|
+
* @param {!function} callback Callback to invoke with each child found.
|
|
985
|
+
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
986
|
+
* process.
|
|
987
|
+
* @return {!number} The number of children in this subtree.
|
|
988
|
+
*/
|
|
989
|
+
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
953
990
|
var type = typeof children;
|
|
954
991
|
|
|
955
992
|
if (type === 'undefined' || type === 'boolean') {
|
|
@@ -967,107 +1004,175 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
|
967
1004
|
case 'number':
|
|
968
1005
|
invokeCallback = true;
|
|
969
1006
|
break;
|
|
970
|
-
|
|
971
1007
|
case 'object':
|
|
972
1008
|
switch (children.$$typeof) {
|
|
973
1009
|
case REACT_ELEMENT_TYPE:
|
|
974
1010
|
case REACT_PORTAL_TYPE:
|
|
975
1011
|
invokeCallback = true;
|
|
976
1012
|
}
|
|
977
|
-
|
|
978
1013
|
}
|
|
979
1014
|
}
|
|
980
1015
|
|
|
981
1016
|
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
|
-
|
|
1017
|
+
callback(traverseContext, children,
|
|
1018
|
+
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1019
|
+
// so that it's consistent if the number of children grows.
|
|
1020
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
1010
1021
|
return 1;
|
|
1011
1022
|
}
|
|
1012
1023
|
|
|
1013
|
-
var child;
|
|
1014
|
-
var nextName;
|
|
1024
|
+
var child = void 0;
|
|
1025
|
+
var nextName = void 0;
|
|
1015
1026
|
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1016
|
-
|
|
1017
1027
|
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1018
1028
|
|
|
1019
|
-
if (isArray(children)) {
|
|
1029
|
+
if (Array.isArray(children)) {
|
|
1020
1030
|
for (var i = 0; i < children.length; i++) {
|
|
1021
1031
|
child = children[i];
|
|
1022
|
-
nextName = nextNamePrefix +
|
|
1023
|
-
subtreeCount +=
|
|
1032
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
|
1033
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1024
1034
|
}
|
|
1025
1035
|
} else {
|
|
1026
1036
|
var iteratorFn = getIteratorFn(children);
|
|
1027
|
-
|
|
1028
1037
|
if (typeof iteratorFn === 'function') {
|
|
1029
|
-
var iterableChildren = children;
|
|
1030
|
-
|
|
1031
1038
|
{
|
|
1032
1039
|
// 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
|
-
|
|
1040
|
+
if (iteratorFn === children.entries) {
|
|
1041
|
+
!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
1042
|
didWarnAboutMaps = true;
|
|
1039
1043
|
}
|
|
1040
1044
|
}
|
|
1041
1045
|
|
|
1042
|
-
var iterator = iteratorFn.call(
|
|
1043
|
-
var step;
|
|
1046
|
+
var iterator = iteratorFn.call(children);
|
|
1047
|
+
var step = void 0;
|
|
1044
1048
|
var ii = 0;
|
|
1045
|
-
|
|
1046
1049
|
while (!(step = iterator.next()).done) {
|
|
1047
1050
|
child = step.value;
|
|
1048
|
-
nextName = nextNamePrefix +
|
|
1049
|
-
subtreeCount +=
|
|
1051
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
1052
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1050
1053
|
}
|
|
1051
1054
|
} else if (type === 'object') {
|
|
1052
|
-
var
|
|
1053
|
-
|
|
1055
|
+
var addendum = '';
|
|
1054
1056
|
{
|
|
1055
|
-
|
|
1056
|
-
throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." );
|
|
1057
|
-
}
|
|
1057
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1058
1058
|
}
|
|
1059
|
+
var childrenString = '' + children;
|
|
1060
|
+
invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
|
1059
1061
|
}
|
|
1060
1062
|
}
|
|
1061
1063
|
|
|
1062
1064
|
return subtreeCount;
|
|
1063
1065
|
}
|
|
1064
1066
|
|
|
1067
|
+
/**
|
|
1068
|
+
* Traverses children that are typically specified as `props.children`, but
|
|
1069
|
+
* might also be specified through attributes:
|
|
1070
|
+
*
|
|
1071
|
+
* - `traverseAllChildren(this.props.children, ...)`
|
|
1072
|
+
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
1073
|
+
*
|
|
1074
|
+
* The `traverseContext` is an optional argument that is passed through the
|
|
1075
|
+
* entire traversal. It can be used to store accumulations or anything else that
|
|
1076
|
+
* the callback might find relevant.
|
|
1077
|
+
*
|
|
1078
|
+
* @param {?*} children Children tree object.
|
|
1079
|
+
* @param {!function} callback To invoke upon traversing each child.
|
|
1080
|
+
* @param {?*} traverseContext Context for traversal.
|
|
1081
|
+
* @return {!number} The number of children in this subtree.
|
|
1082
|
+
*/
|
|
1083
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
|
1084
|
+
if (children == null) {
|
|
1085
|
+
return 0;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Generate a key string that identifies a component within a set.
|
|
1093
|
+
*
|
|
1094
|
+
* @param {*} component A component that could contain a manual key.
|
|
1095
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
1096
|
+
* @return {string}
|
|
1097
|
+
*/
|
|
1098
|
+
function getComponentKey(component, index) {
|
|
1099
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1100
|
+
// that we don't block potential future ES APIs.
|
|
1101
|
+
if (typeof component === 'object' && component !== null && component.key != null) {
|
|
1102
|
+
// Explicit key
|
|
1103
|
+
return escape(component.key);
|
|
1104
|
+
}
|
|
1105
|
+
// Implicit key determined by the index in the set
|
|
1106
|
+
return index.toString(36);
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
function forEachSingleChild(bookKeeping, child, name) {
|
|
1110
|
+
var func = bookKeeping.func,
|
|
1111
|
+
context = bookKeeping.context;
|
|
1112
|
+
|
|
1113
|
+
func.call(context, child, bookKeeping.count++);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* Iterates through children that are typically specified as `props.children`.
|
|
1118
|
+
*
|
|
1119
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1120
|
+
*
|
|
1121
|
+
* The provided forEachFunc(child, index) will be called for each
|
|
1122
|
+
* leaf child.
|
|
1123
|
+
*
|
|
1124
|
+
* @param {?*} children Children tree container.
|
|
1125
|
+
* @param {function(*, int)} forEachFunc
|
|
1126
|
+
* @param {*} forEachContext Context for forEachContext.
|
|
1127
|
+
*/
|
|
1128
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1129
|
+
if (children == null) {
|
|
1130
|
+
return children;
|
|
1131
|
+
}
|
|
1132
|
+
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
|
1133
|
+
traverseAllChildren(children, forEachSingleChild, traverseContext);
|
|
1134
|
+
releaseTraverseContext(traverseContext);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1138
|
+
var result = bookKeeping.result,
|
|
1139
|
+
keyPrefix = bookKeeping.keyPrefix,
|
|
1140
|
+
func = bookKeeping.func,
|
|
1141
|
+
context = bookKeeping.context;
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1145
|
+
if (Array.isArray(mappedChild)) {
|
|
1146
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
|
1147
|
+
return c;
|
|
1148
|
+
});
|
|
1149
|
+
} else if (mappedChild != null) {
|
|
1150
|
+
if (isValidElement(mappedChild)) {
|
|
1151
|
+
mappedChild = cloneAndReplaceKey(mappedChild,
|
|
1152
|
+
// Keep both the (mapped) and old keys if they differ, just as
|
|
1153
|
+
// traverseAllChildren used to do for objects as children
|
|
1154
|
+
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1155
|
+
}
|
|
1156
|
+
result.push(mappedChild);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1161
|
+
var escapedPrefix = '';
|
|
1162
|
+
if (prefix != null) {
|
|
1163
|
+
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1164
|
+
}
|
|
1165
|
+
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
|
1166
|
+
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
|
1167
|
+
releaseTraverseContext(traverseContext);
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1065
1170
|
/**
|
|
1066
1171
|
* Maps children that are typically specified as `props.children`.
|
|
1067
1172
|
*
|
|
1068
1173
|
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1069
1174
|
*
|
|
1070
|
-
* The provided mapFunction(child, index) will be called for each
|
|
1175
|
+
* The provided mapFunction(child, key, index) will be called for each
|
|
1071
1176
|
* leaf child.
|
|
1072
1177
|
*
|
|
1073
1178
|
* @param {?*} children Children tree container.
|
|
@@ -1079,14 +1184,11 @@ function mapChildren(children, func, context) {
|
|
|
1079
1184
|
if (children == null) {
|
|
1080
1185
|
return children;
|
|
1081
1186
|
}
|
|
1082
|
-
|
|
1083
1187
|
var result = [];
|
|
1084
|
-
|
|
1085
|
-
mapIntoArray(children, result, '', '', function (child) {
|
|
1086
|
-
return func.call(context, child, count++);
|
|
1087
|
-
});
|
|
1188
|
+
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1088
1189
|
return result;
|
|
1089
1190
|
}
|
|
1191
|
+
|
|
1090
1192
|
/**
|
|
1091
1193
|
* Count the number of children that are typically specified as
|
|
1092
1194
|
* `props.children`.
|
|
@@ -1096,46 +1198,26 @@ function mapChildren(children, func, context) {
|
|
|
1096
1198
|
* @param {?*} children Children tree container.
|
|
1097
1199
|
* @return {number} The number of children.
|
|
1098
1200
|
*/
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
1201
|
function countChildren(children) {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
});
|
|
1106
|
-
return n;
|
|
1202
|
+
return traverseAllChildren(children, function () {
|
|
1203
|
+
return null;
|
|
1204
|
+
}, null);
|
|
1107
1205
|
}
|
|
1108
1206
|
|
|
1109
|
-
/**
|
|
1110
|
-
* Iterates through children that are typically specified as `props.children`.
|
|
1111
|
-
*
|
|
1112
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1113
|
-
*
|
|
1114
|
-
* The provided forEachFunc(child, index) will be called for each
|
|
1115
|
-
* leaf child.
|
|
1116
|
-
*
|
|
1117
|
-
* @param {?*} children Children tree container.
|
|
1118
|
-
* @param {function(*, int)} forEachFunc
|
|
1119
|
-
* @param {*} forEachContext Context for forEachContext.
|
|
1120
|
-
*/
|
|
1121
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1122
|
-
mapChildren(children, function () {
|
|
1123
|
-
forEachFunc.apply(this, arguments); // Don't return anything.
|
|
1124
|
-
}, forEachContext);
|
|
1125
|
-
}
|
|
1126
1207
|
/**
|
|
1127
1208
|
* Flatten a children object (typically specified as `props.children`) and
|
|
1128
1209
|
* return an array with appropriately re-keyed children.
|
|
1129
1210
|
*
|
|
1130
1211
|
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1131
1212
|
*/
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
1213
|
function toArray(children) {
|
|
1135
|
-
|
|
1214
|
+
var result = [];
|
|
1215
|
+
mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
|
1136
1216
|
return child;
|
|
1137
|
-
})
|
|
1217
|
+
});
|
|
1218
|
+
return result;
|
|
1138
1219
|
}
|
|
1220
|
+
|
|
1139
1221
|
/**
|
|
1140
1222
|
* Returns the first child in a collection of children and verifies that there
|
|
1141
1223
|
* is only one child in the collection.
|
|
@@ -1150,23 +1232,23 @@ function toArray(children) {
|
|
|
1150
1232
|
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1151
1233
|
* structure.
|
|
1152
1234
|
*/
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
1235
|
function onlyChild(children) {
|
|
1156
|
-
|
|
1236
|
+
!isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
|
1237
|
+
return children;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
function createContext(defaultValue, calculateChangedBits) {
|
|
1241
|
+
if (calculateChangedBits === undefined) {
|
|
1242
|
+
calculateChangedBits = null;
|
|
1243
|
+
} else {
|
|
1157
1244
|
{
|
|
1158
|
-
|
|
1245
|
+
!(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
|
|
1159
1246
|
}
|
|
1160
1247
|
}
|
|
1161
1248
|
|
|
1162
|
-
return children;
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
function createContext(defaultValue) {
|
|
1166
|
-
// TODO: Second argument used to be an optional `calculateChangedBits`
|
|
1167
|
-
// function. Warn to reserve for future use?
|
|
1168
1249
|
var context = {
|
|
1169
1250
|
$$typeof: REACT_CONTEXT_TYPE,
|
|
1251
|
+
_calculateChangedBits: calculateChangedBits,
|
|
1170
1252
|
// As a workaround to support multiple concurrent renderers, we categorize
|
|
1171
1253
|
// some renderers as primary and others as secondary. We only expect
|
|
1172
1254
|
// there to be two concurrent renderers at most: React Native (primary) and
|
|
@@ -1181,13 +1263,14 @@ function createContext(defaultValue) {
|
|
|
1181
1263
|
Provider: null,
|
|
1182
1264
|
Consumer: null
|
|
1183
1265
|
};
|
|
1266
|
+
|
|
1184
1267
|
context.Provider = {
|
|
1185
1268
|
$$typeof: REACT_PROVIDER_TYPE,
|
|
1186
1269
|
_context: context
|
|
1187
1270
|
};
|
|
1271
|
+
|
|
1188
1272
|
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
1189
1273
|
var hasWarnedAboutUsingConsumerProvider = false;
|
|
1190
|
-
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
1191
1274
|
|
|
1192
1275
|
{
|
|
1193
1276
|
// A separate object, but proxies back to the original context object for
|
|
@@ -1195,18 +1278,17 @@ function createContext(defaultValue) {
|
|
|
1195
1278
|
// warn for the incorrect usage of Context as a Consumer.
|
|
1196
1279
|
var Consumer = {
|
|
1197
1280
|
$$typeof: REACT_CONTEXT_TYPE,
|
|
1198
|
-
_context: context
|
|
1199
|
-
|
|
1200
|
-
|
|
1281
|
+
_context: context,
|
|
1282
|
+
_calculateChangedBits: context._calculateChangedBits
|
|
1283
|
+
};
|
|
1284
|
+
// $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
1201
1285
|
Object.defineProperties(Consumer, {
|
|
1202
1286
|
Provider: {
|
|
1203
1287
|
get: function () {
|
|
1204
1288
|
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1205
1289
|
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?');
|
|
1290
|
+
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
1291
|
}
|
|
1209
|
-
|
|
1210
1292
|
return context.Provider;
|
|
1211
1293
|
},
|
|
1212
1294
|
set: function (_Provider) {
|
|
@@ -1241,27 +1323,13 @@ function createContext(defaultValue) {
|
|
|
1241
1323
|
get: function () {
|
|
1242
1324
|
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1243
1325
|
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?');
|
|
1326
|
+
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
1327
|
}
|
|
1247
|
-
|
|
1248
1328
|
return context.Consumer;
|
|
1249
1329
|
}
|
|
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
1330
|
}
|
|
1263
|
-
});
|
|
1264
|
-
|
|
1331
|
+
});
|
|
1332
|
+
// $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1265
1333
|
context.Consumer = Consumer;
|
|
1266
1334
|
}
|
|
1267
1335
|
|
|
@@ -1273,85 +1341,19 @@ function createContext(defaultValue) {
|
|
|
1273
1341
|
return context;
|
|
1274
1342
|
}
|
|
1275
1343
|
|
|
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
1344
|
function lazy(ctor) {
|
|
1339
|
-
var payload = {
|
|
1340
|
-
// We use these fields to store the result.
|
|
1341
|
-
_status: -1,
|
|
1342
|
-
_result: ctor
|
|
1343
|
-
};
|
|
1344
1345
|
var lazyType = {
|
|
1345
1346
|
$$typeof: REACT_LAZY_TYPE,
|
|
1346
|
-
|
|
1347
|
-
|
|
1347
|
+
_ctor: ctor,
|
|
1348
|
+
// React uses these fields to store the result.
|
|
1349
|
+
_status: -1,
|
|
1350
|
+
_result: null
|
|
1348
1351
|
};
|
|
1349
1352
|
|
|
1350
1353
|
{
|
|
1351
1354
|
// In production, this would just set it on the object.
|
|
1352
|
-
var defaultProps;
|
|
1353
|
-
var propTypes
|
|
1354
|
-
|
|
1355
|
+
var defaultProps = void 0;
|
|
1356
|
+
var propTypes = void 0;
|
|
1355
1357
|
Object.defineProperties(lazyType, {
|
|
1356
1358
|
defaultProps: {
|
|
1357
1359
|
configurable: true,
|
|
@@ -1359,11 +1361,9 @@ function lazy(ctor) {
|
|
|
1359
1361
|
return defaultProps;
|
|
1360
1362
|
},
|
|
1361
1363
|
set: function (newDefaultProps) {
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
// $FlowFixMe
|
|
1366
|
-
|
|
1364
|
+
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.');
|
|
1365
|
+
defaultProps = newDefaultProps;
|
|
1366
|
+
// Match production behavior more closely:
|
|
1367
1367
|
Object.defineProperty(lazyType, 'defaultProps', {
|
|
1368
1368
|
enumerable: true
|
|
1369
1369
|
});
|
|
@@ -1375,11 +1375,9 @@ function lazy(ctor) {
|
|
|
1375
1375
|
return propTypes;
|
|
1376
1376
|
},
|
|
1377
1377
|
set: function (newPropTypes) {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
// $FlowFixMe
|
|
1382
|
-
|
|
1378
|
+
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.');
|
|
1379
|
+
propTypes = newPropTypes;
|
|
1380
|
+
// Match production behavior more closely:
|
|
1383
1381
|
Object.defineProperty(lazyType, 'propTypes', {
|
|
1384
1382
|
enumerable: true
|
|
1385
1383
|
});
|
|
@@ -1394,635 +1392,126 @@ function lazy(ctor) {
|
|
|
1394
1392
|
function forwardRef(render) {
|
|
1395
1393
|
{
|
|
1396
1394
|
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1397
|
-
|
|
1395
|
+
warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1398
1396
|
} else if (typeof render !== 'function') {
|
|
1399
|
-
|
|
1397
|
+
warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1400
1398
|
} else {
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1399
|
+
!(
|
|
1400
|
+
// Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
|
|
1401
|
+
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
1402
|
}
|
|
1405
1403
|
|
|
1406
1404
|
if (render != null) {
|
|
1407
|
-
|
|
1408
|
-
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1409
|
-
}
|
|
1405
|
+
!(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
1406
|
}
|
|
1411
1407
|
}
|
|
1412
1408
|
|
|
1413
|
-
|
|
1409
|
+
return {
|
|
1414
1410
|
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1415
1411
|
render: render
|
|
1416
1412
|
};
|
|
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
1413
|
}
|
|
1454
1414
|
|
|
1455
1415
|
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;
|
|
1416
|
+
return typeof type === 'string' || typeof type === 'function' ||
|
|
1417
|
+
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1418
|
+
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);
|
|
1476
1419
|
}
|
|
1477
1420
|
|
|
1478
1421
|
function memo(type, compare) {
|
|
1479
1422
|
{
|
|
1480
1423
|
if (!isValidElementType(type)) {
|
|
1481
|
-
|
|
1424
|
+
warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1482
1425
|
}
|
|
1483
1426
|
}
|
|
1484
|
-
|
|
1485
|
-
var elementType = {
|
|
1427
|
+
return {
|
|
1486
1428
|
$$typeof: REACT_MEMO_TYPE,
|
|
1487
1429
|
type: type,
|
|
1488
1430
|
compare: compare === undefined ? null : compare
|
|
1489
1431
|
};
|
|
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
1432
|
}
|
|
1517
1433
|
|
|
1518
1434
|
function resolveDispatcher() {
|
|
1519
1435
|
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
|
-
|
|
1436
|
+
!(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
|
|
1530
1437
|
return dispatcher;
|
|
1531
1438
|
}
|
|
1532
1439
|
|
|
1533
|
-
function
|
|
1534
|
-
var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
|
|
1535
|
-
|
|
1536
|
-
return dispatcher.getCacheForType(resourceType);
|
|
1537
|
-
}
|
|
1538
|
-
function useContext(Context) {
|
|
1440
|
+
function useContext(Context, unstable_observedBits) {
|
|
1539
1441
|
var dispatcher = resolveDispatcher();
|
|
1540
|
-
|
|
1541
1442
|
{
|
|
1443
|
+
!(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;
|
|
1444
|
+
|
|
1542
1445
|
// TODO: add a more generic warning for invalid values.
|
|
1543
1446
|
if (Context._context !== undefined) {
|
|
1544
|
-
var realContext = Context._context;
|
|
1447
|
+
var realContext = Context._context;
|
|
1448
|
+
// Don't deduplicate because this legitimately causes bugs
|
|
1545
1449
|
// and nobody should be using this in existing code.
|
|
1546
|
-
|
|
1547
1450
|
if (realContext.Consumer === Context) {
|
|
1548
|
-
|
|
1451
|
+
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?');
|
|
1549
1452
|
} else if (realContext.Provider === Context) {
|
|
1550
|
-
|
|
1453
|
+
warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1551
1454
|
}
|
|
1552
1455
|
}
|
|
1553
1456
|
}
|
|
1554
|
-
|
|
1555
|
-
return dispatcher.useContext(Context);
|
|
1457
|
+
return dispatcher.useContext(Context, unstable_observedBits);
|
|
1556
1458
|
}
|
|
1459
|
+
|
|
1557
1460
|
function useState(initialState) {
|
|
1558
1461
|
var dispatcher = resolveDispatcher();
|
|
1559
1462
|
return dispatcher.useState(initialState);
|
|
1560
1463
|
}
|
|
1464
|
+
|
|
1561
1465
|
function useReducer(reducer, initialArg, init) {
|
|
1562
1466
|
var dispatcher = resolveDispatcher();
|
|
1563
1467
|
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1564
1468
|
}
|
|
1469
|
+
|
|
1565
1470
|
function useRef(initialValue) {
|
|
1566
1471
|
var dispatcher = resolveDispatcher();
|
|
1567
1472
|
return dispatcher.useRef(initialValue);
|
|
1568
1473
|
}
|
|
1569
|
-
|
|
1474
|
+
|
|
1475
|
+
function useEffect(create, inputs) {
|
|
1570
1476
|
var dispatcher = resolveDispatcher();
|
|
1571
|
-
return dispatcher.useEffect(create,
|
|
1477
|
+
return dispatcher.useEffect(create, inputs);
|
|
1572
1478
|
}
|
|
1573
|
-
|
|
1479
|
+
|
|
1480
|
+
function useLayoutEffect(create, inputs) {
|
|
1574
1481
|
var dispatcher = resolveDispatcher();
|
|
1575
|
-
return dispatcher.useLayoutEffect(create,
|
|
1482
|
+
return dispatcher.useLayoutEffect(create, inputs);
|
|
1576
1483
|
}
|
|
1577
|
-
|
|
1484
|
+
|
|
1485
|
+
function useCallback(callback, inputs) {
|
|
1578
1486
|
var dispatcher = resolveDispatcher();
|
|
1579
|
-
return dispatcher.useCallback(callback,
|
|
1487
|
+
return dispatcher.useCallback(callback, inputs);
|
|
1580
1488
|
}
|
|
1581
|
-
|
|
1489
|
+
|
|
1490
|
+
function useMemo(create, inputs) {
|
|
1582
1491
|
var dispatcher = resolveDispatcher();
|
|
1583
|
-
return dispatcher.useMemo(create,
|
|
1492
|
+
return dispatcher.useMemo(create, inputs);
|
|
1584
1493
|
}
|
|
1585
|
-
|
|
1494
|
+
|
|
1495
|
+
function useImperativeHandle(ref, create, inputs) {
|
|
1586
1496
|
var dispatcher = resolveDispatcher();
|
|
1587
|
-
return dispatcher.useImperativeHandle(ref, create,
|
|
1497
|
+
return dispatcher.useImperativeHandle(ref, create, inputs);
|
|
1588
1498
|
}
|
|
1499
|
+
|
|
1589
1500
|
function useDebugValue(value, formatterFn) {
|
|
1590
1501
|
{
|
|
1591
1502
|
var dispatcher = resolveDispatcher();
|
|
1592
1503
|
return dispatcher.useDebugValue(value, formatterFn);
|
|
1593
1504
|
}
|
|
1594
1505
|
}
|
|
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
|
-
}
|
|
1728
|
-
}
|
|
1729
|
-
var reentry = false;
|
|
1730
|
-
var componentFrameCache;
|
|
1731
|
-
|
|
1732
|
-
{
|
|
1733
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
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
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
|
-
return '';
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
|
-
var loggedTypeFailures = {};
|
|
1951
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1952
|
-
|
|
1953
|
-
function setCurrentlyValidatingElement(element) {
|
|
1954
|
-
{
|
|
1955
|
-
if (element) {
|
|
1956
|
-
var owner = element._owner;
|
|
1957
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1958
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1959
|
-
} else {
|
|
1960
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
|
|
1965
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
1966
|
-
{
|
|
1967
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
1968
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
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
|
-
}
|
|
1984
1506
|
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
setCurrentlyValidatingElement(element);
|
|
1992
|
-
|
|
1993
|
-
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
1994
|
-
|
|
1995
|
-
setCurrentlyValidatingElement(null);
|
|
1996
|
-
}
|
|
1997
|
-
|
|
1998
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
1999
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
2000
|
-
// same error.
|
|
2001
|
-
loggedTypeFailures[error$1.message] = true;
|
|
2002
|
-
setCurrentlyValidatingElement(element);
|
|
2003
|
-
|
|
2004
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
2005
|
-
|
|
2006
|
-
setCurrentlyValidatingElement(null);
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
}
|
|
2012
|
-
|
|
2013
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
2014
|
-
{
|
|
2015
|
-
if (element) {
|
|
2016
|
-
var owner = element._owner;
|
|
2017
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2018
|
-
setExtraStackFrame(stack);
|
|
2019
|
-
} else {
|
|
2020
|
-
setExtraStackFrame(null);
|
|
2021
|
-
}
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
1507
|
+
/**
|
|
1508
|
+
* ReactElementValidator provides a wrapper around a element factory
|
|
1509
|
+
* which validates the props passed to the element. This is intended to be
|
|
1510
|
+
* used only in DEV and could be replaced by a static type checker for languages
|
|
1511
|
+
* that support it.
|
|
1512
|
+
*/
|
|
2024
1513
|
|
|
2025
|
-
var propTypesMisspellWarningShown;
|
|
1514
|
+
var propTypesMisspellWarningShown = void 0;
|
|
2026
1515
|
|
|
2027
1516
|
{
|
|
2028
1517
|
propTypesMisspellWarningShown = false;
|
|
@@ -2030,40 +1519,29 @@ var propTypesMisspellWarningShown;
|
|
|
2030
1519
|
|
|
2031
1520
|
function getDeclarationErrorAddendum() {
|
|
2032
1521
|
if (ReactCurrentOwner.current) {
|
|
2033
|
-
var name =
|
|
2034
|
-
|
|
1522
|
+
var name = getComponentName(ReactCurrentOwner.current.type);
|
|
2035
1523
|
if (name) {
|
|
2036
1524
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
2037
1525
|
}
|
|
2038
1526
|
}
|
|
2039
|
-
|
|
2040
1527
|
return '';
|
|
2041
1528
|
}
|
|
2042
1529
|
|
|
2043
|
-
function getSourceInfoErrorAddendum(
|
|
2044
|
-
if (
|
|
1530
|
+
function getSourceInfoErrorAddendum(elementProps) {
|
|
1531
|
+
if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
|
|
1532
|
+
var source = elementProps.__source;
|
|
2045
1533
|
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
2046
1534
|
var lineNumber = source.lineNumber;
|
|
2047
1535
|
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
2048
1536
|
}
|
|
2049
|
-
|
|
2050
1537
|
return '';
|
|
2051
1538
|
}
|
|
2052
1539
|
|
|
2053
|
-
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
2054
|
-
if (elementProps !== null && elementProps !== undefined) {
|
|
2055
|
-
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
return '';
|
|
2059
|
-
}
|
|
2060
1540
|
/**
|
|
2061
1541
|
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
2062
1542
|
* object keys are not valid. This allows us to keep track of children between
|
|
2063
1543
|
* updates.
|
|
2064
1544
|
*/
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
1545
|
var ownerHasKeyUseWarning = {};
|
|
2068
1546
|
|
|
2069
1547
|
function getCurrentComponentErrorInfo(parentType) {
|
|
@@ -2071,14 +1549,13 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
|
2071
1549
|
|
|
2072
1550
|
if (!info) {
|
|
2073
1551
|
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
2074
|
-
|
|
2075
1552
|
if (parentName) {
|
|
2076
|
-
info =
|
|
1553
|
+
info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
|
2077
1554
|
}
|
|
2078
1555
|
}
|
|
2079
|
-
|
|
2080
1556
|
return info;
|
|
2081
1557
|
}
|
|
1558
|
+
|
|
2082
1559
|
/**
|
|
2083
1560
|
* Warn if the element doesn't have an explicit key assigned to it.
|
|
2084
1561
|
* This element is in an array. The array could grow and shrink or be
|
|
@@ -2090,39 +1567,34 @@ function getCurrentComponentErrorInfo(parentType) {
|
|
|
2090
1567
|
* @param {ReactElement} element Element that requires a key.
|
|
2091
1568
|
* @param {*} parentType element's parent's type.
|
|
2092
1569
|
*/
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
1570
|
function validateExplicitKey(element, parentType) {
|
|
2096
1571
|
if (!element._store || element._store.validated || element.key != null) {
|
|
2097
1572
|
return;
|
|
2098
1573
|
}
|
|
2099
|
-
|
|
2100
1574
|
element._store.validated = true;
|
|
2101
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2102
1575
|
|
|
1576
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2103
1577
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2104
1578
|
return;
|
|
2105
1579
|
}
|
|
1580
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
2106
1581
|
|
|
2107
|
-
|
|
1582
|
+
// Usually the current owner is the offender, but if it accepts children as a
|
|
2108
1583
|
// property, it may be the creator of the child that's responsible for
|
|
2109
1584
|
// assigning it a key.
|
|
2110
|
-
|
|
2111
1585
|
var childOwner = '';
|
|
2112
|
-
|
|
2113
1586
|
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
2114
1587
|
// Give the component that originally created this child.
|
|
2115
|
-
childOwner =
|
|
1588
|
+
childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
|
|
2116
1589
|
}
|
|
2117
1590
|
|
|
1591
|
+
setCurrentlyValidatingElement(element);
|
|
2118
1592
|
{
|
|
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);
|
|
1593
|
+
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
1594
|
}
|
|
1595
|
+
setCurrentlyValidatingElement(null);
|
|
2125
1596
|
}
|
|
1597
|
+
|
|
2126
1598
|
/**
|
|
2127
1599
|
* Ensure that every element either is passed in a static location, in an
|
|
2128
1600
|
* array with an explicit keys property defined, or in an object literal
|
|
@@ -2132,17 +1604,13 @@ function validateExplicitKey(element, parentType) {
|
|
|
2132
1604
|
* @param {ReactNode} node Statically passed child of any type.
|
|
2133
1605
|
* @param {*} parentType node's parent's type.
|
|
2134
1606
|
*/
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
1607
|
function validateChildKeys(node, parentType) {
|
|
2138
1608
|
if (typeof node !== 'object') {
|
|
2139
1609
|
return;
|
|
2140
1610
|
}
|
|
2141
|
-
|
|
2142
|
-
if (isArray(node)) {
|
|
1611
|
+
if (Array.isArray(node)) {
|
|
2143
1612
|
for (var i = 0; i < node.length; i++) {
|
|
2144
1613
|
var child = node[i];
|
|
2145
|
-
|
|
2146
1614
|
if (isValidElement(child)) {
|
|
2147
1615
|
validateExplicitKey(child, parentType);
|
|
2148
1616
|
}
|
|
@@ -2154,14 +1622,12 @@ function validateChildKeys(node, parentType) {
|
|
|
2154
1622
|
}
|
|
2155
1623
|
} else if (node) {
|
|
2156
1624
|
var iteratorFn = getIteratorFn(node);
|
|
2157
|
-
|
|
2158
1625
|
if (typeof iteratorFn === 'function') {
|
|
2159
1626
|
// Entry iterators used to provide implicit keys,
|
|
2160
1627
|
// but now we print a separate warning for them later.
|
|
2161
1628
|
if (iteratorFn !== node.entries) {
|
|
2162
1629
|
var iterator = iteratorFn.call(node);
|
|
2163
|
-
var step;
|
|
2164
|
-
|
|
1630
|
+
var step = void 0;
|
|
2165
1631
|
while (!(step = iterator.next()).done) {
|
|
2166
1632
|
if (isValidElement(step.value)) {
|
|
2167
1633
|
validateExplicitKey(step.value, parentType);
|
|
@@ -2171,139 +1637,119 @@ function validateChildKeys(node, parentType) {
|
|
|
2171
1637
|
}
|
|
2172
1638
|
}
|
|
2173
1639
|
}
|
|
1640
|
+
|
|
2174
1641
|
/**
|
|
2175
1642
|
* Given an element, validate that its props follow the propTypes definition,
|
|
2176
1643
|
* provided by the type.
|
|
2177
1644
|
*
|
|
2178
1645
|
* @param {ReactElement} element
|
|
2179
1646
|
*/
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
1647
|
function validatePropTypes(element) {
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
var _name = getComponentNameFromType(type);
|
|
2210
|
-
|
|
2211
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
2212
|
-
}
|
|
2213
|
-
|
|
2214
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2215
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2216
|
-
}
|
|
1648
|
+
var type = element.type;
|
|
1649
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
var name = getComponentName(type);
|
|
1653
|
+
var propTypes = void 0;
|
|
1654
|
+
if (typeof type === 'function') {
|
|
1655
|
+
propTypes = type.propTypes;
|
|
1656
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
1657
|
+
// Note: Memo only checks outer props here.
|
|
1658
|
+
// Inner props are checked in the reconciler.
|
|
1659
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1660
|
+
propTypes = type.propTypes;
|
|
1661
|
+
} else {
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
if (propTypes) {
|
|
1665
|
+
setCurrentlyValidatingElement(element);
|
|
1666
|
+
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
1667
|
+
setCurrentlyValidatingElement(null);
|
|
1668
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1669
|
+
propTypesMisspellWarningShown = true;
|
|
1670
|
+
warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1671
|
+
}
|
|
1672
|
+
if (typeof type.getDefaultProps === 'function') {
|
|
1673
|
+
!type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
|
2217
1674
|
}
|
|
2218
1675
|
}
|
|
1676
|
+
|
|
2219
1677
|
/**
|
|
2220
1678
|
* Given a fragment, validate that it can only be provided with fragment props
|
|
2221
1679
|
* @param {ReactElement} fragment
|
|
2222
1680
|
*/
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
1681
|
function validateFragmentProps(fragment) {
|
|
2226
|
-
|
|
2227
|
-
var keys = Object.keys(fragment.props);
|
|
1682
|
+
setCurrentlyValidatingElement(fragment);
|
|
2228
1683
|
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2236
|
-
|
|
2237
|
-
setCurrentlyValidatingElement$1(null);
|
|
2238
|
-
break;
|
|
2239
|
-
}
|
|
1684
|
+
var keys = Object.keys(fragment.props);
|
|
1685
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1686
|
+
var key = keys[i];
|
|
1687
|
+
if (key !== 'children' && key !== 'key') {
|
|
1688
|
+
warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1689
|
+
break;
|
|
2240
1690
|
}
|
|
1691
|
+
}
|
|
2241
1692
|
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2246
|
-
|
|
2247
|
-
setCurrentlyValidatingElement$1(null);
|
|
2248
|
-
}
|
|
1693
|
+
if (fragment.ref !== null) {
|
|
1694
|
+
warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2249
1695
|
}
|
|
1696
|
+
|
|
1697
|
+
setCurrentlyValidatingElement(null);
|
|
2250
1698
|
}
|
|
1699
|
+
|
|
2251
1700
|
function createElementWithValidation(type, props, children) {
|
|
2252
|
-
var validType = isValidElementType(type);
|
|
2253
|
-
// succeed and there will likely be errors in render.
|
|
1701
|
+
var validType = isValidElementType(type);
|
|
2254
1702
|
|
|
1703
|
+
// We warn in this case but don't throw. We expect the element creation to
|
|
1704
|
+
// succeed and there will likely be errors in render.
|
|
2255
1705
|
if (!validType) {
|
|
2256
1706
|
var info = '';
|
|
2257
|
-
|
|
2258
1707
|
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2259
1708
|
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
1709
|
}
|
|
2261
1710
|
|
|
2262
|
-
var sourceInfo =
|
|
2263
|
-
|
|
1711
|
+
var sourceInfo = getSourceInfoErrorAddendum(props);
|
|
2264
1712
|
if (sourceInfo) {
|
|
2265
1713
|
info += sourceInfo;
|
|
2266
1714
|
} else {
|
|
2267
1715
|
info += getDeclarationErrorAddendum();
|
|
2268
1716
|
}
|
|
2269
1717
|
|
|
2270
|
-
var typeString;
|
|
2271
|
-
|
|
1718
|
+
var typeString = void 0;
|
|
2272
1719
|
if (type === null) {
|
|
2273
1720
|
typeString = 'null';
|
|
2274
|
-
} else if (isArray(type)) {
|
|
1721
|
+
} else if (Array.isArray(type)) {
|
|
2275
1722
|
typeString = 'array';
|
|
2276
1723
|
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2277
|
-
typeString =
|
|
1724
|
+
typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
|
2278
1725
|
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2279
1726
|
} else {
|
|
2280
1727
|
typeString = typeof type;
|
|
2281
1728
|
}
|
|
2282
1729
|
|
|
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
|
-
}
|
|
1730
|
+
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
1731
|
}
|
|
2287
1732
|
|
|
2288
|
-
var element = createElement.apply(this, arguments);
|
|
2289
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1733
|
+
var element = createElement.apply(this, arguments);
|
|
2290
1734
|
|
|
1735
|
+
// The result can be nullish if a mock or a custom function is used.
|
|
1736
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2291
1737
|
if (element == null) {
|
|
2292
1738
|
return element;
|
|
2293
|
-
}
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
|
2294
1742
|
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2295
1743
|
// We don't want exception behavior to differ between dev and prod.
|
|
2296
1744
|
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2297
1745
|
// fixed, the key warnings will appear.)
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
1746
|
if (validType) {
|
|
2301
1747
|
for (var i = 2; i < arguments.length; i++) {
|
|
2302
1748
|
validateChildKeys(arguments[i], type);
|
|
2303
1749
|
}
|
|
2304
1750
|
}
|
|
2305
1751
|
|
|
2306
|
-
if (type ===
|
|
1752
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
2307
1753
|
validateFragmentProps(element);
|
|
2308
1754
|
} else {
|
|
2309
1755
|
validatePropTypes(element);
|
|
@@ -2311,24 +1757,16 @@ function createElementWithValidation(type, props, children) {
|
|
|
2311
1757
|
|
|
2312
1758
|
return element;
|
|
2313
1759
|
}
|
|
2314
|
-
|
|
1760
|
+
|
|
2315
1761
|
function createFactoryWithValidation(type) {
|
|
2316
1762
|
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2317
1763
|
validatedFactory.type = type;
|
|
2318
|
-
|
|
1764
|
+
// Legacy hook: remove it
|
|
2319
1765
|
{
|
|
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
1766
|
Object.defineProperty(validatedFactory, 'type', {
|
|
2328
1767
|
enumerable: false,
|
|
2329
1768
|
get: function () {
|
|
2330
|
-
|
|
2331
|
-
|
|
1769
|
+
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2332
1770
|
Object.defineProperty(this, 'type', {
|
|
2333
1771
|
value: type
|
|
2334
1772
|
});
|
|
@@ -2339,304 +1777,125 @@ function createFactoryWithValidation(type) {
|
|
|
2339
1777
|
|
|
2340
1778
|
return validatedFactory;
|
|
2341
1779
|
}
|
|
1780
|
+
|
|
2342
1781
|
function cloneElementWithValidation(element, props, children) {
|
|
2343
1782
|
var newElement = cloneElement.apply(this, arguments);
|
|
2344
|
-
|
|
2345
1783
|
for (var i = 2; i < arguments.length; i++) {
|
|
2346
1784
|
validateChildKeys(arguments[i], newElement.type);
|
|
2347
1785
|
}
|
|
2348
|
-
|
|
2349
1786
|
validatePropTypes(newElement);
|
|
2350
1787
|
return newElement;
|
|
2351
1788
|
}
|
|
2352
1789
|
|
|
2353
|
-
|
|
2354
|
-
var mutableSource = {
|
|
2355
|
-
_getVersion: getVersion,
|
|
2356
|
-
_source: source,
|
|
2357
|
-
_workInProgressVersionPrimary: null,
|
|
2358
|
-
_workInProgressVersionSecondary: null
|
|
2359
|
-
};
|
|
1790
|
+
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
2360
1791
|
|
|
2361
|
-
{
|
|
2362
|
-
mutableSource._currentPrimaryRenderer = null;
|
|
2363
|
-
mutableSource._currentSecondaryRenderer = null; // Used to detect side effects that update a mutable source during render.
|
|
2364
|
-
// See https://github.com/facebook/react/issues/19948
|
|
2365
1792
|
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
1793
|
+
// In some cases, StrictMode should also double-render lifecycles.
|
|
1794
|
+
// This can be confusing for tests though,
|
|
1795
|
+
// And it can be bad for performance in production.
|
|
1796
|
+
// This feature flag can be used to control the behavior:
|
|
2369
1797
|
|
|
2370
|
-
return mutableSource;
|
|
2371
|
-
}
|
|
2372
1798
|
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
ReactCurrentBatchConfig.transition = 1;
|
|
1799
|
+
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
1800
|
+
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
2376
1801
|
|
|
2377
|
-
try {
|
|
2378
|
-
scope();
|
|
2379
|
-
} finally {
|
|
2380
|
-
ReactCurrentBatchConfig.transition = prevTransition;
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2383
1802
|
|
|
2384
|
-
|
|
2385
|
-
var enqueueTaskImpl = null;
|
|
2386
|
-
function enqueueTask(task) {
|
|
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;
|
|
1803
|
+
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
2404
1804
|
|
|
2405
|
-
if (typeof MessageChannel === 'undefined') {
|
|
2406
|
-
error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
|
|
2407
|
-
}
|
|
2408
|
-
}
|
|
2409
|
-
}
|
|
2410
1805
|
|
|
2411
|
-
|
|
2412
|
-
channel.port1.onmessage = callback;
|
|
2413
|
-
channel.port2.postMessage(undefined);
|
|
2414
|
-
};
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
1806
|
+
// Gather advanced timing metrics for Profiler subtrees.
|
|
2417
1807
|
|
|
2418
|
-
return enqueueTaskImpl(task);
|
|
2419
|
-
}
|
|
2420
1808
|
|
|
2421
|
-
|
|
2422
|
-
var didWarnNoAwaitAct = false;
|
|
2423
|
-
function act(callback) {
|
|
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++;
|
|
2429
|
-
|
|
2430
|
-
if (ReactCurrentActQueue.current === null) {
|
|
2431
|
-
// This is the outermost `act` scope. Initialize the queue. The reconciler
|
|
2432
|
-
// will detect the queue and use it instead of Scheduler.
|
|
2433
|
-
ReactCurrentActQueue.current = [];
|
|
2434
|
-
}
|
|
1809
|
+
// Trace which interactions trigger each commit.
|
|
2435
1810
|
|
|
2436
|
-
var result;
|
|
2437
1811
|
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
} catch (error) {
|
|
2441
|
-
popActScope(prevActScopeDepth);
|
|
2442
|
-
throw error;
|
|
2443
|
-
}
|
|
1812
|
+
// Only used in www builds.
|
|
1813
|
+
// TODO: true? Here it might just be false.
|
|
2444
1814
|
|
|
2445
|
-
|
|
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
|
-
};
|
|
1815
|
+
// Only used in www builds.
|
|
2470
1816
|
|
|
2471
|
-
{
|
|
2472
|
-
if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
|
2473
|
-
// eslint-disable-next-line no-undef
|
|
2474
|
-
Promise.resolve().then(function () {}).then(function () {
|
|
2475
|
-
if (!wasAwaited) {
|
|
2476
|
-
didWarnNoAwaitAct = true;
|
|
2477
|
-
|
|
2478
|
-
error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);');
|
|
2479
|
-
}
|
|
2480
|
-
});
|
|
2481
|
-
}
|
|
2482
|
-
}
|
|
2483
1817
|
|
|
2484
|
-
|
|
2485
|
-
} else {
|
|
2486
|
-
var returnValue = result; // The callback is not an async function. Exit the current scope
|
|
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
|
-
}
|
|
2529
|
-
}
|
|
1818
|
+
// Only used in www builds.
|
|
2530
1819
|
|
|
2531
|
-
function popActScope(prevActScopeDepth) {
|
|
2532
|
-
{
|
|
2533
|
-
if (prevActScopeDepth !== actScopeDepth - 1) {
|
|
2534
|
-
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
|
2535
|
-
}
|
|
2536
1820
|
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
}
|
|
1821
|
+
// React Fire: prevent the value and checked attributes from syncing
|
|
1822
|
+
// with their related DOM properties
|
|
2540
1823
|
|
|
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
1824
|
|
|
2567
|
-
|
|
1825
|
+
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
1826
|
+
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
1827
|
+
var enableStableConcurrentModeAPIs = false;
|
|
2568
1828
|
|
|
2569
|
-
|
|
2570
|
-
{
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
for (; i < queue.length; i++) {
|
|
2578
|
-
var callback = queue[i];
|
|
2579
|
-
|
|
2580
|
-
do {
|
|
2581
|
-
callback = callback(true);
|
|
2582
|
-
} while (callback !== null);
|
|
2583
|
-
}
|
|
1829
|
+
var React = {
|
|
1830
|
+
Children: {
|
|
1831
|
+
map: mapChildren,
|
|
1832
|
+
forEach: forEachChildren,
|
|
1833
|
+
count: countChildren,
|
|
1834
|
+
toArray: toArray,
|
|
1835
|
+
only: onlyChild
|
|
1836
|
+
},
|
|
2584
1837
|
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
1838
|
+
createRef: createRef,
|
|
1839
|
+
Component: Component,
|
|
1840
|
+
PureComponent: PureComponent,
|
|
1841
|
+
|
|
1842
|
+
createContext: createContext,
|
|
1843
|
+
forwardRef: forwardRef,
|
|
1844
|
+
lazy: lazy,
|
|
1845
|
+
memo: memo,
|
|
1846
|
+
|
|
1847
|
+
useCallback: useCallback,
|
|
1848
|
+
useContext: useContext,
|
|
1849
|
+
useEffect: useEffect,
|
|
1850
|
+
useImperativeHandle: useImperativeHandle,
|
|
1851
|
+
useDebugValue: useDebugValue,
|
|
1852
|
+
useLayoutEffect: useLayoutEffect,
|
|
1853
|
+
useMemo: useMemo,
|
|
1854
|
+
useReducer: useReducer,
|
|
1855
|
+
useRef: useRef,
|
|
1856
|
+
useState: useState,
|
|
1857
|
+
|
|
1858
|
+
Fragment: REACT_FRAGMENT_TYPE,
|
|
1859
|
+
StrictMode: REACT_STRICT_MODE_TYPE,
|
|
1860
|
+
Suspense: REACT_SUSPENSE_TYPE,
|
|
1861
|
+
|
|
1862
|
+
createElement: createElementWithValidation,
|
|
1863
|
+
cloneElement: cloneElementWithValidation,
|
|
1864
|
+
createFactory: createFactoryWithValidation,
|
|
1865
|
+
isValidElement: isValidElement,
|
|
1866
|
+
|
|
1867
|
+
version: ReactVersion,
|
|
1868
|
+
|
|
1869
|
+
unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
|
|
1870
|
+
unstable_Profiler: REACT_PROFILER_TYPE,
|
|
1871
|
+
|
|
1872
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
1873
|
+
};
|
|
1874
|
+
|
|
1875
|
+
// Note: some APIs are added with feature flags.
|
|
1876
|
+
// Make sure that stable builds for open source
|
|
1877
|
+
// don't modify the React object to avoid deopts.
|
|
1878
|
+
// Also let's not expose their names in stable builds.
|
|
1879
|
+
|
|
1880
|
+
if (enableStableConcurrentModeAPIs) {
|
|
1881
|
+
React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
1882
|
+
React.Profiler = REACT_PROFILER_TYPE;
|
|
1883
|
+
React.unstable_ConcurrentMode = undefined;
|
|
1884
|
+
React.unstable_Profiler = undefined;
|
|
2595
1885
|
}
|
|
2596
1886
|
|
|
2597
|
-
var createElement$1 = createElementWithValidation ;
|
|
2598
|
-
var cloneElement$1 = cloneElementWithValidation ;
|
|
2599
|
-
var createFactory = createFactoryWithValidation ;
|
|
2600
|
-
var Children = {
|
|
2601
|
-
map: mapChildren,
|
|
2602
|
-
forEach: forEachChildren,
|
|
2603
|
-
count: countChildren,
|
|
2604
|
-
toArray: toArray,
|
|
2605
|
-
only: onlyChild
|
|
2606
|
-
};
|
|
2607
1887
|
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
exports
|
|
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;
|
|
1888
|
+
|
|
1889
|
+
var React$2 = Object.freeze({
|
|
1890
|
+
default: React
|
|
1891
|
+
});
|
|
1892
|
+
|
|
1893
|
+
var React$3 = ( React$2 && React ) || React$2;
|
|
1894
|
+
|
|
1895
|
+
// TODO: decide on the top-level export form.
|
|
1896
|
+
// This is hacky but makes it work with both Rollup and Jest.
|
|
1897
|
+
var react = React$3.default || React$3;
|
|
1898
|
+
|
|
1899
|
+
module.exports = react;
|
|
2641
1900
|
})();
|
|
2642
1901
|
}
|