react-dom 16.8.6 → 16.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +5 -5
- package/cjs/react-dom-server.browser.development.js +1192 -527
- package/cjs/react-dom-server.browser.production.min.js +46 -43
- package/cjs/react-dom-server.node.development.js +1188 -536
- package/cjs/react-dom-server.node.production.min.js +47 -45
- package/cjs/react-dom-test-utils.development.js +572 -201
- package/cjs/react-dom-test-utils.production.min.js +25 -23
- package/cjs/react-dom-unstable-fizz.browser.development.js +26 -15
- package/cjs/react-dom-unstable-fizz.browser.production.min.js +2 -2
- package/cjs/react-dom-unstable-fizz.node.development.js +26 -11
- package/cjs/react-dom-unstable-fizz.node.production.min.js +1 -1
- package/cjs/react-dom-unstable-native-dependencies.development.js +224 -136
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +27 -28
- package/cjs/react-dom.development.js +21711 -15060
- package/cjs/react-dom.production.min.js +282 -258
- package/cjs/react-dom.profiling.min.js +288 -267
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +1204 -529
- package/umd/react-dom-server.browser.production.min.js +38 -37
- package/umd/react-dom-test-utils.development.js +592 -202
- package/umd/react-dom-test-utils.production.min.js +23 -22
- package/umd/react-dom-unstable-fizz.browser.development.js +26 -15
- package/umd/react-dom-unstable-fizz.browser.production.min.js +2 -2
- package/umd/react-dom-unstable-native-dependencies.development.js +224 -137
- package/umd/react-dom-unstable-native-dependencies.production.min.js +22 -23
- package/umd/react-dom.development.js +21852 -15190
- package/umd/react-dom.production.min.js +234 -210
- package/umd/react-dom.profiling.min.js +241 -216
- package/cjs/react-dom-unstable-fire.development.js +0 -21287
- package/cjs/react-dom-unstable-fire.production.min.js +0 -269
- package/cjs/react-dom-unstable-fire.profiling.min.js +0 -278
- package/umd/react-dom-unstable-fire.development.js +0 -21422
- package/umd/react-dom-unstable-fire.production.min.js +0 -220
- package/umd/react-dom-unstable-fire.profiling.min.js +0 -226
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.10.0
|
|
2
2
|
* react-dom-server.browser.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -15,6 +15,22 @@
|
|
|
15
15
|
(global.ReactDOMServer = factory(global.React));
|
|
16
16
|
}(this, (function (React) { 'use strict';
|
|
17
17
|
|
|
18
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
19
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
20
|
+
// build, and in production they will be minified.
|
|
21
|
+
|
|
22
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
23
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
24
|
+
// build, and in production they will be minified.
|
|
25
|
+
function ReactError(error) {
|
|
26
|
+
error.name = 'Invariant Violation';
|
|
27
|
+
return error;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// TODO: this is special because it gets imported during build.
|
|
31
|
+
|
|
32
|
+
var ReactVersion = '16.10.0';
|
|
33
|
+
|
|
18
34
|
/**
|
|
19
35
|
* Use invariant() to assert state which your program assumes to be true.
|
|
20
36
|
*
|
|
@@ -26,46 +42,7 @@
|
|
|
26
42
|
* will remain to ensure logic does not differ in production.
|
|
27
43
|
*/
|
|
28
44
|
|
|
29
|
-
var validateFormat = function () {};
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
validateFormat = function (format) {
|
|
33
|
-
if (format === undefined) {
|
|
34
|
-
throw new Error('invariant requires an error message argument');
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
|
40
|
-
validateFormat(format);
|
|
41
|
-
|
|
42
|
-
if (!condition) {
|
|
43
|
-
var error = void 0;
|
|
44
|
-
if (format === undefined) {
|
|
45
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
46
|
-
} else {
|
|
47
|
-
var args = [a, b, c, d, e, f];
|
|
48
|
-
var argIndex = 0;
|
|
49
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
50
|
-
return args[argIndex++];
|
|
51
|
-
}));
|
|
52
|
-
error.name = 'Invariant Violation';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
56
|
-
throw error;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Relying on the `invariant()` implementation lets us
|
|
61
|
-
// preserve the format and params in the www builds.
|
|
62
|
-
|
|
63
|
-
// TODO: this is special because it gets imported during build.
|
|
64
|
-
|
|
65
|
-
var ReactVersion = '16.8.6';
|
|
66
|
-
|
|
67
45
|
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
68
|
-
|
|
69
46
|
var _assign = ReactInternals.assign;
|
|
70
47
|
|
|
71
48
|
/**
|
|
@@ -74,35 +51,37 @@ var _assign = ReactInternals.assign;
|
|
|
74
51
|
* paths. Removing the logging code for production environments will keep the
|
|
75
52
|
* same logic and follow the same code paths.
|
|
76
53
|
*/
|
|
77
|
-
|
|
78
54
|
var warningWithoutStack = function () {};
|
|
79
55
|
|
|
80
56
|
{
|
|
81
57
|
warningWithoutStack = function (condition, format) {
|
|
82
|
-
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
58
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
83
59
|
args[_key - 2] = arguments[_key];
|
|
84
60
|
}
|
|
85
61
|
|
|
86
62
|
if (format === undefined) {
|
|
87
63
|
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
88
64
|
}
|
|
65
|
+
|
|
89
66
|
if (args.length > 8) {
|
|
90
67
|
// Check before the condition to catch violations early.
|
|
91
68
|
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
|
92
69
|
}
|
|
70
|
+
|
|
93
71
|
if (condition) {
|
|
94
72
|
return;
|
|
95
73
|
}
|
|
74
|
+
|
|
96
75
|
if (typeof console !== 'undefined') {
|
|
97
76
|
var argsWithFormat = args.map(function (item) {
|
|
98
77
|
return '' + item;
|
|
99
78
|
});
|
|
100
|
-
argsWithFormat.unshift('Warning: ' + format);
|
|
101
|
-
|
|
102
|
-
// We intentionally don't use spread (or .apply) directly because it
|
|
79
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
103
80
|
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
81
|
+
|
|
104
82
|
Function.prototype.apply.call(console.error, console, argsWithFormat);
|
|
105
83
|
}
|
|
84
|
+
|
|
106
85
|
try {
|
|
107
86
|
// --- Welcome to debugging React ---
|
|
108
87
|
// This error was thrown as a convenience so that you can use this stack
|
|
@@ -122,30 +101,107 @@ var warningWithoutStack$1 = warningWithoutStack;
|
|
|
122
101
|
// nor polyfill, then a plain number is used for performance.
|
|
123
102
|
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
124
103
|
|
|
125
|
-
|
|
126
104
|
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
127
105
|
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
128
106
|
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
129
107
|
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
130
108
|
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
131
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
109
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
110
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
111
|
+
|
|
132
112
|
|
|
133
113
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
134
114
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
135
115
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
116
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
136
117
|
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
137
118
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
119
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
138
120
|
|
|
139
|
-
var
|
|
121
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
140
122
|
|
|
123
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
|
|
124
|
+
// Current owner and dispatcher used to share the same ref,
|
|
125
|
+
// but PR #14548 split them out to better support the react-debug-tools package.
|
|
141
126
|
|
|
127
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
|
128
|
+
ReactSharedInternals.ReactCurrentDispatcher = {
|
|
129
|
+
current: null
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
|
|
134
|
+
ReactSharedInternals.ReactCurrentBatchConfig = {
|
|
135
|
+
suspense: null
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
141
|
+
* This can be used to log issues in development environments in critical
|
|
142
|
+
* paths. Removing the logging code for production environments will keep the
|
|
143
|
+
* same logic and follow the same code paths.
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
var warning = warningWithoutStack$1;
|
|
147
|
+
|
|
148
|
+
{
|
|
149
|
+
warning = function (condition, format) {
|
|
150
|
+
if (condition) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
155
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
156
|
+
|
|
157
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
158
|
+
args[_key - 2] = arguments[_key];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
var warning$1 = warning;
|
|
166
|
+
|
|
167
|
+
var Uninitialized = -1;
|
|
168
|
+
var Pending = 0;
|
|
169
|
+
var Resolved = 1;
|
|
170
|
+
var Rejected = 2;
|
|
142
171
|
function refineResolvedLazyComponent(lazyComponent) {
|
|
143
172
|
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
144
173
|
}
|
|
174
|
+
function initializeLazyComponentType(lazyComponent) {
|
|
175
|
+
if (lazyComponent._status === Uninitialized) {
|
|
176
|
+
lazyComponent._status = Pending;
|
|
177
|
+
var ctor = lazyComponent._ctor;
|
|
178
|
+
var thenable = ctor();
|
|
179
|
+
lazyComponent._result = thenable;
|
|
180
|
+
thenable.then(function (moduleObject) {
|
|
181
|
+
if (lazyComponent._status === Pending) {
|
|
182
|
+
var defaultExport = moduleObject.default;
|
|
183
|
+
|
|
184
|
+
{
|
|
185
|
+
if (defaultExport === undefined) {
|
|
186
|
+
warning$1(false, 'lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
lazyComponent._status = Resolved;
|
|
191
|
+
lazyComponent._result = defaultExport;
|
|
192
|
+
}
|
|
193
|
+
}, function (error) {
|
|
194
|
+
if (lazyComponent._status === Pending) {
|
|
195
|
+
lazyComponent._status = Rejected;
|
|
196
|
+
lazyComponent._result = error;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
145
201
|
|
|
146
202
|
function getWrappedName(outerType, innerType, wrapperName) {
|
|
147
203
|
var functionName = innerType.displayName || innerType.name || '';
|
|
148
|
-
return outerType.displayName || (functionName !== '' ? wrapperName +
|
|
204
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
149
205
|
}
|
|
150
206
|
|
|
151
207
|
function getComponentName(type) {
|
|
@@ -153,51 +209,69 @@ function getComponentName(type) {
|
|
|
153
209
|
// Host root, text node or just invalid type.
|
|
154
210
|
return null;
|
|
155
211
|
}
|
|
212
|
+
|
|
156
213
|
{
|
|
157
214
|
if (typeof type.tag === 'number') {
|
|
158
215
|
warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
159
216
|
}
|
|
160
217
|
}
|
|
218
|
+
|
|
161
219
|
if (typeof type === 'function') {
|
|
162
220
|
return type.displayName || type.name || null;
|
|
163
221
|
}
|
|
222
|
+
|
|
164
223
|
if (typeof type === 'string') {
|
|
165
224
|
return type;
|
|
166
225
|
}
|
|
226
|
+
|
|
167
227
|
switch (type) {
|
|
168
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
169
|
-
return 'ConcurrentMode';
|
|
170
228
|
case REACT_FRAGMENT_TYPE:
|
|
171
229
|
return 'Fragment';
|
|
230
|
+
|
|
172
231
|
case REACT_PORTAL_TYPE:
|
|
173
232
|
return 'Portal';
|
|
233
|
+
|
|
174
234
|
case REACT_PROFILER_TYPE:
|
|
175
|
-
return
|
|
235
|
+
return "Profiler";
|
|
236
|
+
|
|
176
237
|
case REACT_STRICT_MODE_TYPE:
|
|
177
238
|
return 'StrictMode';
|
|
239
|
+
|
|
178
240
|
case REACT_SUSPENSE_TYPE:
|
|
179
241
|
return 'Suspense';
|
|
242
|
+
|
|
243
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
244
|
+
return 'SuspenseList';
|
|
180
245
|
}
|
|
246
|
+
|
|
181
247
|
if (typeof type === 'object') {
|
|
182
248
|
switch (type.$$typeof) {
|
|
183
249
|
case REACT_CONTEXT_TYPE:
|
|
184
250
|
return 'Context.Consumer';
|
|
251
|
+
|
|
185
252
|
case REACT_PROVIDER_TYPE:
|
|
186
253
|
return 'Context.Provider';
|
|
254
|
+
|
|
187
255
|
case REACT_FORWARD_REF_TYPE:
|
|
188
256
|
return getWrappedName(type, type.render, 'ForwardRef');
|
|
257
|
+
|
|
189
258
|
case REACT_MEMO_TYPE:
|
|
190
259
|
return getComponentName(type.type);
|
|
260
|
+
|
|
191
261
|
case REACT_LAZY_TYPE:
|
|
192
262
|
{
|
|
193
263
|
var thenable = type;
|
|
194
264
|
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
265
|
+
|
|
195
266
|
if (resolvedThenable) {
|
|
196
267
|
return getComponentName(resolvedThenable);
|
|
197
268
|
}
|
|
269
|
+
|
|
270
|
+
break;
|
|
198
271
|
}
|
|
199
272
|
}
|
|
200
273
|
}
|
|
274
|
+
|
|
201
275
|
return null;
|
|
202
276
|
}
|
|
203
277
|
|
|
@@ -214,12 +288,11 @@ function getComponentName(type) {
|
|
|
214
288
|
* paths. Removing the logging code for production environments will keep the
|
|
215
289
|
* same logic and follow the same code paths.
|
|
216
290
|
*/
|
|
217
|
-
|
|
218
|
-
var lowPriorityWarning = function () {};
|
|
291
|
+
var lowPriorityWarningWithoutStack = function () {};
|
|
219
292
|
|
|
220
293
|
{
|
|
221
294
|
var printWarning = function (format) {
|
|
222
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
295
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
223
296
|
args[_key - 1] = arguments[_key];
|
|
224
297
|
}
|
|
225
298
|
|
|
@@ -227,9 +300,11 @@ var lowPriorityWarning = function () {};
|
|
|
227
300
|
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
228
301
|
return args[argIndex++];
|
|
229
302
|
});
|
|
303
|
+
|
|
230
304
|
if (typeof console !== 'undefined') {
|
|
231
305
|
console.warn(message);
|
|
232
306
|
}
|
|
307
|
+
|
|
233
308
|
try {
|
|
234
309
|
// --- Welcome to debugging React ---
|
|
235
310
|
// This error was thrown as a convenience so that you can use this stack
|
|
@@ -238,75 +313,40 @@ var lowPriorityWarning = function () {};
|
|
|
238
313
|
} catch (x) {}
|
|
239
314
|
};
|
|
240
315
|
|
|
241
|
-
|
|
316
|
+
lowPriorityWarningWithoutStack = function (condition, format) {
|
|
242
317
|
if (format === undefined) {
|
|
243
|
-
throw new Error('`
|
|
318
|
+
throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
244
319
|
}
|
|
320
|
+
|
|
245
321
|
if (!condition) {
|
|
246
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
322
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
247
323
|
args[_key2 - 2] = arguments[_key2];
|
|
248
324
|
}
|
|
249
325
|
|
|
250
|
-
printWarning.apply(
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
256
|
-
|
|
257
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
258
|
-
|
|
259
|
-
// Prevent newer renderers from RTE when used with older react package versions.
|
|
260
|
-
// Current owner and dispatcher used to share the same ref,
|
|
261
|
-
// but PR #14548 split them out to better support the react-debug-tools package.
|
|
262
|
-
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
|
263
|
-
ReactSharedInternals.ReactCurrentDispatcher = {
|
|
264
|
-
current: null
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
270
|
-
* This can be used to log issues in development environments in critical
|
|
271
|
-
* paths. Removing the logging code for production environments will keep the
|
|
272
|
-
* same logic and follow the same code paths.
|
|
273
|
-
*/
|
|
274
|
-
|
|
275
|
-
var warning = warningWithoutStack$1;
|
|
276
|
-
|
|
277
|
-
{
|
|
278
|
-
warning = function (condition, format) {
|
|
279
|
-
if (condition) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
283
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
284
|
-
// eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
285
|
-
|
|
286
|
-
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
287
|
-
args[_key - 2] = arguments[_key];
|
|
326
|
+
printWarning.apply(void 0, [format].concat(args));
|
|
288
327
|
}
|
|
289
|
-
|
|
290
|
-
warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
|
291
328
|
};
|
|
292
329
|
}
|
|
293
330
|
|
|
294
|
-
var
|
|
331
|
+
var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
|
295
332
|
|
|
296
333
|
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
297
|
-
|
|
298
334
|
var describeComponentFrame = function (name, source, ownerName) {
|
|
299
335
|
var sourceInfo = '';
|
|
336
|
+
|
|
300
337
|
if (source) {
|
|
301
338
|
var path = source.fileName;
|
|
302
339
|
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
340
|
+
|
|
303
341
|
{
|
|
304
342
|
// In DEV, include code for a common special case:
|
|
305
343
|
// prefer "folder/index.js" instead of just "index.js".
|
|
306
344
|
if (/^index\./.test(fileName)) {
|
|
307
345
|
var match = path.match(BEFORE_SLASH_RE);
|
|
346
|
+
|
|
308
347
|
if (match) {
|
|
309
348
|
var pathBeforeSlash = match[1];
|
|
349
|
+
|
|
310
350
|
if (pathBeforeSlash) {
|
|
311
351
|
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
312
352
|
fileName = folderName + '/' + fileName;
|
|
@@ -314,50 +354,82 @@ var describeComponentFrame = function (name, source, ownerName) {
|
|
|
314
354
|
}
|
|
315
355
|
}
|
|
316
356
|
}
|
|
357
|
+
|
|
317
358
|
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
318
359
|
} else if (ownerName) {
|
|
319
360
|
sourceInfo = ' (created by ' + ownerName + ')';
|
|
320
361
|
}
|
|
362
|
+
|
|
321
363
|
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
322
364
|
};
|
|
323
365
|
|
|
324
366
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
325
367
|
|
|
326
|
-
|
|
327
|
-
// In some cases, StrictMode should also double-render lifecycles.
|
|
368
|
+
// In some cases, StrictMode should also double-render lifecycles.
|
|
328
369
|
// This can be confusing for tests though,
|
|
329
370
|
// And it can be bad for performance in production.
|
|
330
371
|
// This feature flag can be used to control the behavior:
|
|
331
372
|
|
|
332
|
-
|
|
333
|
-
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
373
|
+
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
334
374
|
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
335
375
|
|
|
376
|
+
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
336
377
|
|
|
337
|
-
|
|
338
|
-
var warnAboutDeprecatedLifecycles = false;
|
|
378
|
+
var warnAboutDeprecatedLifecycles = true; // Gather advanced timing metrics for Profiler subtrees.
|
|
339
379
|
|
|
340
|
-
//
|
|
380
|
+
// Trace which interactions trigger each commit.
|
|
341
381
|
|
|
382
|
+
// Only used in www builds.
|
|
342
383
|
|
|
343
|
-
//
|
|
384
|
+
var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
|
|
344
385
|
|
|
386
|
+
// Only used in www builds.
|
|
345
387
|
|
|
346
|
-
// Only used in www builds.
|
|
347
|
-
var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
|
|
388
|
+
// Only used in www builds.
|
|
348
389
|
|
|
349
|
-
//
|
|
390
|
+
// Disable javascript: URL strings in href for XSS protection.
|
|
350
391
|
|
|
392
|
+
var disableJavaScriptURLs = false; // React Fire: prevent the value and checked attributes from syncing
|
|
393
|
+
// with their related DOM properties
|
|
351
394
|
|
|
352
|
-
//
|
|
395
|
+
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
396
|
+
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
353
397
|
|
|
354
398
|
|
|
355
|
-
//
|
|
356
|
-
//
|
|
399
|
+
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
400
|
+
// This is a flag so we can fix warnings in RN core before turning it on
|
|
357
401
|
|
|
402
|
+
// Experimental React Flare event system and event components support.
|
|
358
403
|
|
|
359
|
-
|
|
360
|
-
|
|
404
|
+
var enableFlareAPI = false; // Experimental Host Component support.
|
|
405
|
+
|
|
406
|
+
var enableFundamentalAPI = false; // Experimental Scope support.
|
|
407
|
+
|
|
408
|
+
var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
409
|
+
|
|
410
|
+
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
411
|
+
// Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
|
|
412
|
+
|
|
413
|
+
// For tests, we flush suspense fallbacks in an act scope;
|
|
414
|
+
// *except* in some of our own tests, where we test incremental loading states.
|
|
415
|
+
|
|
416
|
+
// Changes priority of some events like mousemove to user-blocking priority,
|
|
417
|
+
// but without making them discrete. The flag exists in case it causes
|
|
418
|
+
// starvation problems.
|
|
419
|
+
|
|
420
|
+
// Add a callback property to suspense to notify which promises are currently
|
|
421
|
+
// in the update queue. This allows reporting and tracing of what is causing
|
|
422
|
+
// the user to see a loading state.
|
|
423
|
+
// Also allows hydration callbacks to fire when a dehydrated boundary gets
|
|
424
|
+
// hydrated or deleted.
|
|
425
|
+
|
|
426
|
+
// Part of the simplification of React.createElement so we can eventually move
|
|
427
|
+
// from React.createElement to React.jsx
|
|
428
|
+
// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
var disableLegacyContext = false;
|
|
361
433
|
|
|
362
434
|
/**
|
|
363
435
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -386,6 +458,7 @@ var printWarning$1 = function() {};
|
|
|
386
458
|
{
|
|
387
459
|
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
388
460
|
var loggedTypeFailures = {};
|
|
461
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
389
462
|
|
|
390
463
|
printWarning$1 = function(text) {
|
|
391
464
|
var message = 'Warning: ' + text;
|
|
@@ -415,7 +488,7 @@ var printWarning$1 = function() {};
|
|
|
415
488
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
416
489
|
{
|
|
417
490
|
for (var typeSpecName in typeSpecs) {
|
|
418
|
-
if (typeSpecs
|
|
491
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
419
492
|
var error;
|
|
420
493
|
// Prop type validation may throw. In case they do, we don't want to
|
|
421
494
|
// fail the render phase where it didn't fail before. So we log it.
|
|
@@ -444,7 +517,6 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
444
517
|
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
445
518
|
'shape all require an argument).'
|
|
446
519
|
);
|
|
447
|
-
|
|
448
520
|
}
|
|
449
521
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
450
522
|
// Only monitor this failure once because there tends to be a lot of the
|
|
@@ -462,29 +534,46 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
462
534
|
}
|
|
463
535
|
}
|
|
464
536
|
|
|
537
|
+
/**
|
|
538
|
+
* Resets warning cache when testing.
|
|
539
|
+
*
|
|
540
|
+
* @private
|
|
541
|
+
*/
|
|
542
|
+
checkPropTypes.resetWarningCache = function() {
|
|
543
|
+
{
|
|
544
|
+
loggedTypeFailures = {};
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
|
|
465
548
|
var checkPropTypes_1 = checkPropTypes;
|
|
466
549
|
|
|
467
|
-
var ReactDebugCurrentFrame$1
|
|
468
|
-
var didWarnAboutInvalidateContextType
|
|
550
|
+
var ReactDebugCurrentFrame$1;
|
|
551
|
+
var didWarnAboutInvalidateContextType;
|
|
552
|
+
|
|
469
553
|
{
|
|
470
554
|
ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
471
555
|
didWarnAboutInvalidateContextType = new Set();
|
|
472
556
|
}
|
|
473
557
|
|
|
474
558
|
var emptyObject = {};
|
|
559
|
+
|
|
475
560
|
{
|
|
476
561
|
Object.freeze(emptyObject);
|
|
477
562
|
}
|
|
478
563
|
|
|
479
564
|
function maskContext(type, context) {
|
|
480
565
|
var contextTypes = type.contextTypes;
|
|
566
|
+
|
|
481
567
|
if (!contextTypes) {
|
|
482
568
|
return emptyObject;
|
|
483
569
|
}
|
|
570
|
+
|
|
484
571
|
var maskedContext = {};
|
|
572
|
+
|
|
485
573
|
for (var contextName in contextTypes) {
|
|
486
574
|
maskedContext[contextName] = context[contextName];
|
|
487
575
|
}
|
|
576
|
+
|
|
488
577
|
return maskedContext;
|
|
489
578
|
}
|
|
490
579
|
|
|
@@ -507,84 +596,131 @@ function validateContextBounds(context, threadID) {
|
|
|
507
596
|
context._threadCount = i + 1;
|
|
508
597
|
}
|
|
509
598
|
}
|
|
599
|
+
function processContext(type, context, threadID, isClass) {
|
|
600
|
+
if (isClass) {
|
|
601
|
+
var contextType = type.contextType;
|
|
510
602
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
603
|
+
{
|
|
604
|
+
if ('contextType' in type) {
|
|
605
|
+
var isValid = // Allow null for conditional declaration
|
|
606
|
+
contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
|
|
607
|
+
|
|
608
|
+
if (!isValid && !didWarnAboutInvalidateContextType.has(type)) {
|
|
609
|
+
didWarnAboutInvalidateContextType.add(type);
|
|
610
|
+
var addendum = '';
|
|
611
|
+
|
|
612
|
+
if (contextType === undefined) {
|
|
613
|
+
addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
|
|
614
|
+
} else if (typeof contextType !== 'object') {
|
|
615
|
+
addendum = ' However, it is set to a ' + typeof contextType + '.';
|
|
616
|
+
} else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
|
|
617
|
+
addendum = ' Did you accidentally pass the Context.Provider instead?';
|
|
618
|
+
} else if (contextType._context !== undefined) {
|
|
619
|
+
// <Context.Consumer>
|
|
620
|
+
addendum = ' Did you accidentally pass the Context.Consumer instead?';
|
|
621
|
+
} else {
|
|
622
|
+
addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(type) || 'Component', addendum);
|
|
534
626
|
}
|
|
535
|
-
warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(type) || 'Component', addendum);
|
|
536
627
|
}
|
|
537
628
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
629
|
+
|
|
630
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
631
|
+
validateContextBounds(contextType, threadID);
|
|
632
|
+
return contextType[threadID];
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
if (disableLegacyContext) {
|
|
636
|
+
{
|
|
637
|
+
if (type.contextTypes) {
|
|
638
|
+
warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with static contextType instead.', getComponentName(type) || 'Unknown');
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
return emptyObject;
|
|
643
|
+
} else {
|
|
644
|
+
var maskedContext = maskContext(type, context);
|
|
645
|
+
|
|
646
|
+
{
|
|
647
|
+
if (type.contextTypes) {
|
|
648
|
+
checkContextTypes(type.contextTypes, maskedContext, 'context');
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
return maskedContext;
|
|
653
|
+
}
|
|
542
654
|
} else {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
655
|
+
if (disableLegacyContext) {
|
|
656
|
+
{
|
|
657
|
+
if (type.contextTypes) {
|
|
658
|
+
warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(type) || 'Unknown');
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
return undefined;
|
|
663
|
+
} else {
|
|
664
|
+
var _maskedContext = maskContext(type, context);
|
|
665
|
+
|
|
666
|
+
{
|
|
667
|
+
if (type.contextTypes) {
|
|
668
|
+
checkContextTypes(type.contextTypes, _maskedContext, 'context');
|
|
669
|
+
}
|
|
547
670
|
}
|
|
671
|
+
|
|
672
|
+
return _maskedContext;
|
|
548
673
|
}
|
|
549
|
-
return maskedContext;
|
|
550
674
|
}
|
|
551
675
|
}
|
|
552
676
|
|
|
553
677
|
// Allocates a new index for each request. Tries to stay as compact as possible so that these
|
|
554
|
-
// indices can be used to reference a tightly
|
|
678
|
+
// indices can be used to reference a tightly packed array. As opposed to being used in a Map.
|
|
555
679
|
// The first allocated index is 1.
|
|
556
|
-
|
|
557
680
|
var nextAvailableThreadIDs = new Uint16Array(16);
|
|
681
|
+
|
|
558
682
|
for (var i = 0; i < 15; i++) {
|
|
559
683
|
nextAvailableThreadIDs[i] = i + 1;
|
|
560
684
|
}
|
|
685
|
+
|
|
561
686
|
nextAvailableThreadIDs[15] = 0;
|
|
562
687
|
|
|
563
688
|
function growThreadCountAndReturnNextAvailable() {
|
|
564
689
|
var oldArray = nextAvailableThreadIDs;
|
|
565
690
|
var oldSize = oldArray.length;
|
|
566
691
|
var newSize = oldSize * 2;
|
|
567
|
-
|
|
692
|
+
|
|
693
|
+
(function () {
|
|
694
|
+
if (!(newSize <= 0x10000)) {
|
|
695
|
+
{
|
|
696
|
+
throw ReactError(Error("Maximum number of concurrent React renderers exceeded. This can happen if you are not properly destroying the Readable provided by React. Ensure that you call .destroy() on it if you no longer want to read from it, and did not read to the end. If you use .pipe() this should be automatic."));
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
})();
|
|
700
|
+
|
|
568
701
|
var newArray = new Uint16Array(newSize);
|
|
569
702
|
newArray.set(oldArray);
|
|
570
703
|
nextAvailableThreadIDs = newArray;
|
|
571
704
|
nextAvailableThreadIDs[0] = oldSize + 1;
|
|
705
|
+
|
|
572
706
|
for (var _i = oldSize; _i < newSize - 1; _i++) {
|
|
573
707
|
nextAvailableThreadIDs[_i] = _i + 1;
|
|
574
708
|
}
|
|
709
|
+
|
|
575
710
|
nextAvailableThreadIDs[newSize - 1] = 0;
|
|
576
711
|
return oldSize;
|
|
577
712
|
}
|
|
578
713
|
|
|
579
714
|
function allocThreadID() {
|
|
580
715
|
var nextID = nextAvailableThreadIDs[0];
|
|
716
|
+
|
|
581
717
|
if (nextID === 0) {
|
|
582
718
|
return growThreadCountAndReturnNextAvailable();
|
|
583
719
|
}
|
|
720
|
+
|
|
584
721
|
nextAvailableThreadIDs[0] = nextAvailableThreadIDs[nextID];
|
|
585
722
|
return nextID;
|
|
586
723
|
}
|
|
587
|
-
|
|
588
724
|
function freeThreadID(id) {
|
|
589
725
|
nextAvailableThreadIDs[id] = nextAvailableThreadIDs[0];
|
|
590
726
|
nextAvailableThreadIDs[0] = id;
|
|
@@ -592,96 +728,97 @@ function freeThreadID(id) {
|
|
|
592
728
|
|
|
593
729
|
// A reserved attribute.
|
|
594
730
|
// It is handled by React separately and shouldn't be written to the DOM.
|
|
595
|
-
var RESERVED = 0;
|
|
596
|
-
|
|
597
|
-
// A simple string attribute.
|
|
731
|
+
var RESERVED = 0; // A simple string attribute.
|
|
598
732
|
// Attributes that aren't in the whitelist are presumed to have this type.
|
|
599
|
-
var STRING = 1;
|
|
600
733
|
|
|
601
|
-
// A string attribute that accepts booleans in React. In HTML, these are called
|
|
734
|
+
var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
|
|
602
735
|
// "enumerated" attributes with "true" and "false" as possible values.
|
|
603
736
|
// When true, it should be set to a "true" string.
|
|
604
737
|
// When false, it should be set to a "false" string.
|
|
605
|
-
var BOOLEANISH_STRING = 2;
|
|
606
738
|
|
|
607
|
-
// A real boolean attribute.
|
|
739
|
+
var BOOLEANISH_STRING = 2; // A real boolean attribute.
|
|
608
740
|
// When true, it should be present (set either to an empty string or its name).
|
|
609
741
|
// When false, it should be omitted.
|
|
610
|
-
var BOOLEAN = 3;
|
|
611
742
|
|
|
612
|
-
// An attribute that can be used as a flag as well as with a value.
|
|
743
|
+
var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
|
|
613
744
|
// When true, it should be present (set either to an empty string or its name).
|
|
614
745
|
// When false, it should be omitted.
|
|
615
746
|
// For any other value, should be present with that value.
|
|
616
|
-
var OVERLOADED_BOOLEAN = 4;
|
|
617
747
|
|
|
618
|
-
// An attribute that must be numeric or parse as a numeric.
|
|
748
|
+
var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
|
|
619
749
|
// When falsy, it should be removed.
|
|
620
|
-
var NUMERIC = 5;
|
|
621
750
|
|
|
622
|
-
// An attribute that must be positive numeric or parse as a positive numeric.
|
|
751
|
+
var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
|
|
623
752
|
// When falsy, it should be removed.
|
|
753
|
+
|
|
624
754
|
var POSITIVE_NUMERIC = 6;
|
|
625
755
|
|
|
626
756
|
/* eslint-disable max-len */
|
|
627
|
-
var ATTRIBUTE_NAME_START_CHAR =
|
|
757
|
+
var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
628
758
|
/* eslint-enable max-len */
|
|
629
|
-
var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
|
|
630
759
|
|
|
760
|
+
var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
631
761
|
|
|
632
762
|
var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
|
|
633
763
|
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
634
|
-
|
|
635
764
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
636
765
|
var illegalAttributeNameCache = {};
|
|
637
766
|
var validatedAttributeNameCache = {};
|
|
638
|
-
|
|
639
767
|
function isAttributeNameSafe(attributeName) {
|
|
640
768
|
if (hasOwnProperty$1.call(validatedAttributeNameCache, attributeName)) {
|
|
641
769
|
return true;
|
|
642
770
|
}
|
|
771
|
+
|
|
643
772
|
if (hasOwnProperty$1.call(illegalAttributeNameCache, attributeName)) {
|
|
644
773
|
return false;
|
|
645
774
|
}
|
|
775
|
+
|
|
646
776
|
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
|
647
777
|
validatedAttributeNameCache[attributeName] = true;
|
|
648
778
|
return true;
|
|
649
779
|
}
|
|
780
|
+
|
|
650
781
|
illegalAttributeNameCache[attributeName] = true;
|
|
782
|
+
|
|
651
783
|
{
|
|
652
784
|
warning$1(false, 'Invalid attribute name: `%s`', attributeName);
|
|
653
785
|
}
|
|
786
|
+
|
|
654
787
|
return false;
|
|
655
788
|
}
|
|
656
|
-
|
|
657
789
|
function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
|
|
658
790
|
if (propertyInfo !== null) {
|
|
659
791
|
return propertyInfo.type === RESERVED;
|
|
660
792
|
}
|
|
793
|
+
|
|
661
794
|
if (isCustomComponentTag) {
|
|
662
795
|
return false;
|
|
663
796
|
}
|
|
797
|
+
|
|
664
798
|
if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
|
|
665
799
|
return true;
|
|
666
800
|
}
|
|
801
|
+
|
|
667
802
|
return false;
|
|
668
803
|
}
|
|
669
|
-
|
|
670
804
|
function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
|
|
671
805
|
if (propertyInfo !== null && propertyInfo.type === RESERVED) {
|
|
672
806
|
return false;
|
|
673
807
|
}
|
|
808
|
+
|
|
674
809
|
switch (typeof value) {
|
|
675
|
-
case 'function':
|
|
676
|
-
|
|
810
|
+
case 'function': // $FlowIssue symbol is perfectly valid here
|
|
811
|
+
|
|
677
812
|
case 'symbol':
|
|
678
813
|
// eslint-disable-line
|
|
679
814
|
return true;
|
|
815
|
+
|
|
680
816
|
case 'boolean':
|
|
681
817
|
{
|
|
682
818
|
if (isCustomComponentTag) {
|
|
683
819
|
return false;
|
|
684
820
|
}
|
|
821
|
+
|
|
685
822
|
if (propertyInfo !== null) {
|
|
686
823
|
return !propertyInfo.acceptsBooleans;
|
|
687
824
|
} else {
|
|
@@ -689,198 +826,232 @@ function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomCom
|
|
|
689
826
|
return prefix !== 'data-' && prefix !== 'aria-';
|
|
690
827
|
}
|
|
691
828
|
}
|
|
829
|
+
|
|
692
830
|
default:
|
|
693
831
|
return false;
|
|
694
832
|
}
|
|
695
833
|
}
|
|
696
|
-
|
|
697
834
|
function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
|
|
698
835
|
if (value === null || typeof value === 'undefined') {
|
|
699
836
|
return true;
|
|
700
837
|
}
|
|
838
|
+
|
|
701
839
|
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
|
702
840
|
return true;
|
|
703
841
|
}
|
|
842
|
+
|
|
704
843
|
if (isCustomComponentTag) {
|
|
705
844
|
return false;
|
|
706
845
|
}
|
|
846
|
+
|
|
707
847
|
if (propertyInfo !== null) {
|
|
708
848
|
switch (propertyInfo.type) {
|
|
709
849
|
case BOOLEAN:
|
|
710
850
|
return !value;
|
|
851
|
+
|
|
711
852
|
case OVERLOADED_BOOLEAN:
|
|
712
853
|
return value === false;
|
|
854
|
+
|
|
713
855
|
case NUMERIC:
|
|
714
856
|
return isNaN(value);
|
|
857
|
+
|
|
715
858
|
case POSITIVE_NUMERIC:
|
|
716
859
|
return isNaN(value) || value < 1;
|
|
717
860
|
}
|
|
718
861
|
}
|
|
862
|
+
|
|
719
863
|
return false;
|
|
720
864
|
}
|
|
721
|
-
|
|
722
865
|
function getPropertyInfo(name) {
|
|
723
866
|
return properties.hasOwnProperty(name) ? properties[name] : null;
|
|
724
867
|
}
|
|
725
868
|
|
|
726
|
-
function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) {
|
|
869
|
+
function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
|
|
727
870
|
this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
|
|
728
871
|
this.attributeName = attributeName;
|
|
729
872
|
this.attributeNamespace = attributeNamespace;
|
|
730
873
|
this.mustUseProperty = mustUseProperty;
|
|
731
874
|
this.propertyName = name;
|
|
732
875
|
this.type = type;
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
// When adding attributes to this list, be sure to also add them to
|
|
876
|
+
this.sanitizeURL = sanitizeURL;
|
|
877
|
+
} // When adding attributes to this list, be sure to also add them to
|
|
736
878
|
// the `possibleStandardNames` module to ensure casing and incorrect
|
|
737
879
|
// name warnings.
|
|
738
|
-
var properties = {};
|
|
739
880
|
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
881
|
+
|
|
882
|
+
var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
|
|
883
|
+
|
|
884
|
+
['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
|
|
743
885
|
// elements (not just inputs). Now that ReactDOMInput assigns to the
|
|
744
886
|
// defaultValue property -- do we need this?
|
|
745
887
|
'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
|
|
746
888
|
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
|
|
747
889
|
name, // attributeName
|
|
748
|
-
null
|
|
749
|
-
|
|
750
|
-
);
|
|
751
|
-
|
|
752
|
-
// A few React string attributes have a different name.
|
|
890
|
+
null, // attributeNamespace
|
|
891
|
+
false);
|
|
892
|
+
}); // A few React string attributes have a different name.
|
|
753
893
|
// This is a mapping from React prop names to the attribute names.
|
|
894
|
+
|
|
754
895
|
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
|
755
896
|
var name = _ref[0],
|
|
756
897
|
attributeName = _ref[1];
|
|
757
|
-
|
|
758
898
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
759
899
|
attributeName, // attributeName
|
|
760
|
-
null
|
|
761
|
-
|
|
762
|
-
);
|
|
763
|
-
|
|
764
|
-
// These are "enumerated" HTML attributes that accept "true" and "false".
|
|
900
|
+
null, // attributeNamespace
|
|
901
|
+
false);
|
|
902
|
+
}); // These are "enumerated" HTML attributes that accept "true" and "false".
|
|
765
903
|
// In React, we let users pass `true` and `false` even though technically
|
|
766
904
|
// these aren't boolean attributes (they are coerced to strings).
|
|
905
|
+
|
|
767
906
|
['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
|
|
768
907
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
769
908
|
name.toLowerCase(), // attributeName
|
|
770
|
-
null
|
|
771
|
-
|
|
772
|
-
);
|
|
773
|
-
|
|
774
|
-
// These are "enumerated" SVG attributes that accept "true" and "false".
|
|
909
|
+
null, // attributeNamespace
|
|
910
|
+
false);
|
|
911
|
+
}); // These are "enumerated" SVG attributes that accept "true" and "false".
|
|
775
912
|
// In React, we let users pass `true` and `false` even though technically
|
|
776
913
|
// these aren't boolean attributes (they are coerced to strings).
|
|
777
914
|
// Since these are SVG attributes, their attribute names are case-sensitive.
|
|
915
|
+
|
|
778
916
|
['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
|
|
779
917
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
780
918
|
name, // attributeName
|
|
781
|
-
null
|
|
782
|
-
|
|
783
|
-
);
|
|
919
|
+
null, // attributeNamespace
|
|
920
|
+
false);
|
|
921
|
+
}); // These are HTML boolean attributes.
|
|
784
922
|
|
|
785
|
-
//
|
|
786
|
-
['allowFullScreen', 'async',
|
|
787
|
-
// Note: there is a special case that prevents it from being written to the DOM
|
|
923
|
+
['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
|
|
788
924
|
// on the client side because the browsers are inconsistent. Instead we call focus().
|
|
789
|
-
'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
|
|
790
|
-
// Microdata
|
|
925
|
+
'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
|
|
791
926
|
'itemScope'].forEach(function (name) {
|
|
792
927
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
|
793
928
|
name.toLowerCase(), // attributeName
|
|
794
|
-
null
|
|
795
|
-
|
|
796
|
-
);
|
|
797
|
-
|
|
798
|
-
// These are the few React props that we set as DOM properties
|
|
929
|
+
null, // attributeNamespace
|
|
930
|
+
false);
|
|
931
|
+
}); // These are the few React props that we set as DOM properties
|
|
799
932
|
// rather than attributes. These are all booleans.
|
|
800
|
-
|
|
801
|
-
// Note: `option.selected` is not updated if `select.multiple` is
|
|
933
|
+
|
|
934
|
+
['checked', // Note: `option.selected` is not updated if `select.multiple` is
|
|
802
935
|
// disabled with `removeAttribute`. We have special logic for handling this.
|
|
803
936
|
'multiple', 'muted', 'selected'].forEach(function (name) {
|
|
804
937
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
|
805
938
|
name, // attributeName
|
|
806
|
-
null
|
|
807
|
-
|
|
808
|
-
);
|
|
809
|
-
|
|
810
|
-
// These are HTML attributes that are "overloaded booleans": they behave like
|
|
939
|
+
null, // attributeNamespace
|
|
940
|
+
false);
|
|
941
|
+
}); // These are HTML attributes that are "overloaded booleans": they behave like
|
|
811
942
|
// booleans, but can also accept a string value.
|
|
943
|
+
|
|
812
944
|
['capture', 'download'].forEach(function (name) {
|
|
813
945
|
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
|
|
814
946
|
name, // attributeName
|
|
815
|
-
null
|
|
816
|
-
|
|
817
|
-
);
|
|
947
|
+
null, // attributeNamespace
|
|
948
|
+
false);
|
|
949
|
+
}); // These are HTML attributes that must be positive numbers.
|
|
818
950
|
|
|
819
|
-
// These are HTML attributes that must be positive numbers.
|
|
820
951
|
['cols', 'rows', 'size', 'span'].forEach(function (name) {
|
|
821
952
|
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
|
|
822
953
|
name, // attributeName
|
|
823
|
-
null
|
|
824
|
-
|
|
825
|
-
);
|
|
954
|
+
null, // attributeNamespace
|
|
955
|
+
false);
|
|
956
|
+
}); // These are HTML attributes that must be numbers.
|
|
826
957
|
|
|
827
|
-
// These are HTML attributes that must be numbers.
|
|
828
958
|
['rowSpan', 'start'].forEach(function (name) {
|
|
829
959
|
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
|
|
830
960
|
name.toLowerCase(), // attributeName
|
|
831
|
-
null
|
|
832
|
-
|
|
833
|
-
);
|
|
834
|
-
|
|
961
|
+
null, // attributeNamespace
|
|
962
|
+
false);
|
|
963
|
+
});
|
|
835
964
|
var CAMELIZE = /[\-\:]([a-z])/g;
|
|
965
|
+
|
|
836
966
|
var capitalize = function (token) {
|
|
837
967
|
return token[1].toUpperCase();
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
// This is a list of all SVG attributes that need special casing, namespacing,
|
|
968
|
+
}; // This is a list of all SVG attributes that need special casing, namespacing,
|
|
841
969
|
// or boolean value assignment. Regular attributes that just accept strings
|
|
842
970
|
// and have the same names are omitted, just like in the HTML whitelist.
|
|
843
971
|
// Some of these attributes can be hard to find. This list was created by
|
|
844
972
|
// scrapping the MDN documentation.
|
|
973
|
+
|
|
974
|
+
|
|
845
975
|
['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
|
|
846
976
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
847
977
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
848
|
-
attributeName, null
|
|
849
|
-
|
|
850
|
-
);
|
|
978
|
+
attributeName, null, // attributeNamespace
|
|
979
|
+
false);
|
|
980
|
+
}); // String SVG attributes with the xlink namespace.
|
|
851
981
|
|
|
852
|
-
|
|
853
|
-
['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
|
982
|
+
['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
|
854
983
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
855
984
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
856
|
-
attributeName, 'http://www.w3.org/1999/xlink');
|
|
857
|
-
});
|
|
985
|
+
attributeName, 'http://www.w3.org/1999/xlink', false);
|
|
986
|
+
}); // String SVG attributes with the xml namespace.
|
|
858
987
|
|
|
859
|
-
// String SVG attributes with the xml namespace.
|
|
860
988
|
['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
|
|
861
989
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
862
990
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
863
|
-
attributeName, 'http://www.w3.org/XML/1998/namespace');
|
|
864
|
-
});
|
|
865
|
-
|
|
866
|
-
// These attribute exists both in HTML and SVG.
|
|
991
|
+
attributeName, 'http://www.w3.org/XML/1998/namespace', false);
|
|
992
|
+
}); // These attribute exists both in HTML and SVG.
|
|
867
993
|
// The attribute name is case-sensitive in SVG so we can't just use
|
|
868
994
|
// the React name like we do for attributes that exist only in HTML.
|
|
995
|
+
|
|
869
996
|
['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
|
|
870
997
|
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
|
871
998
|
attributeName.toLowerCase(), // attributeName
|
|
872
|
-
null
|
|
873
|
-
|
|
874
|
-
);
|
|
999
|
+
null, // attributeNamespace
|
|
1000
|
+
false);
|
|
1001
|
+
}); // These attributes accept URLs. These must not allow javascript: URLS.
|
|
1002
|
+
// These will also need to accept Trusted Types object in the future.
|
|
1003
|
+
|
|
1004
|
+
var xlinkHref = 'xlinkHref';
|
|
1005
|
+
properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
|
|
1006
|
+
'xlink:href', 'http://www.w3.org/1999/xlink', true);
|
|
1007
|
+
['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
|
|
1008
|
+
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
|
1009
|
+
attributeName.toLowerCase(), // attributeName
|
|
1010
|
+
null, // attributeNamespace
|
|
1011
|
+
true);
|
|
1012
|
+
});
|
|
1013
|
+
|
|
1014
|
+
var ReactDebugCurrentFrame$2 = null;
|
|
1015
|
+
|
|
1016
|
+
{
|
|
1017
|
+
ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1018
|
+
} // A javascript: URL can contain leading C0 control or \u0020 SPACE,
|
|
1019
|
+
// and any newline or tab are filtered out as if they're not part of the URL.
|
|
1020
|
+
// https://url.spec.whatwg.org/#url-parsing
|
|
1021
|
+
// Tab or newline are defined as \r\n\t:
|
|
1022
|
+
// https://infra.spec.whatwg.org/#ascii-tab-or-newline
|
|
1023
|
+
// A C0 control is a code point in the range \u0000 NULL to \u001F
|
|
1024
|
+
// INFORMATION SEPARATOR ONE, inclusive:
|
|
1025
|
+
// https://infra.spec.whatwg.org/#c0-control-or-space
|
|
1026
|
+
|
|
1027
|
+
/* eslint-disable max-len */
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
|
|
1031
|
+
var didWarn = false;
|
|
1032
|
+
|
|
1033
|
+
function sanitizeURL(url) {
|
|
1034
|
+
if (disableJavaScriptURLs) {
|
|
1035
|
+
(function () {
|
|
1036
|
+
if (!!isJavaScriptProtocol.test(url)) {
|
|
1037
|
+
{
|
|
1038
|
+
throw ReactError(Error("React has blocked a javascript: URL as a security precaution." + (ReactDebugCurrentFrame$2.getStackAddendum())));
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
})();
|
|
1042
|
+
} else if (true && !didWarn && isJavaScriptProtocol.test(url)) {
|
|
1043
|
+
didWarn = true;
|
|
1044
|
+
warning$1(false, 'A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
875
1047
|
|
|
876
1048
|
// code copied and modified from escape-html
|
|
1049
|
+
|
|
877
1050
|
/**
|
|
878
1051
|
* Module variables.
|
|
879
1052
|
* @private
|
|
880
1053
|
*/
|
|
881
|
-
|
|
882
1054
|
var matchHtmlRegExp = /["'&<>]/;
|
|
883
|
-
|
|
884
1055
|
/**
|
|
885
1056
|
* Escapes special characters and HTML entities in a given html string.
|
|
886
1057
|
*
|
|
@@ -897,9 +1068,9 @@ function escapeHtml(string) {
|
|
|
897
1068
|
return str;
|
|
898
1069
|
}
|
|
899
1070
|
|
|
900
|
-
var escape
|
|
1071
|
+
var escape;
|
|
901
1072
|
var html = '';
|
|
902
|
-
var index
|
|
1073
|
+
var index;
|
|
903
1074
|
var lastIndex = 0;
|
|
904
1075
|
|
|
905
1076
|
for (index = match.index; index < str.length; index++) {
|
|
@@ -908,22 +1079,28 @@ function escapeHtml(string) {
|
|
|
908
1079
|
// "
|
|
909
1080
|
escape = '"';
|
|
910
1081
|
break;
|
|
1082
|
+
|
|
911
1083
|
case 38:
|
|
912
1084
|
// &
|
|
913
1085
|
escape = '&';
|
|
914
1086
|
break;
|
|
1087
|
+
|
|
915
1088
|
case 39:
|
|
916
1089
|
// '
|
|
917
1090
|
escape = '''; // modified from escape-html; used to be '''
|
|
1091
|
+
|
|
918
1092
|
break;
|
|
1093
|
+
|
|
919
1094
|
case 60:
|
|
920
1095
|
// <
|
|
921
1096
|
escape = '<';
|
|
922
1097
|
break;
|
|
1098
|
+
|
|
923
1099
|
case 62:
|
|
924
1100
|
// >
|
|
925
1101
|
escape = '>';
|
|
926
1102
|
break;
|
|
1103
|
+
|
|
927
1104
|
default:
|
|
928
1105
|
continue;
|
|
929
1106
|
}
|
|
@@ -937,8 +1114,7 @@ function escapeHtml(string) {
|
|
|
937
1114
|
}
|
|
938
1115
|
|
|
939
1116
|
return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
|
940
|
-
}
|
|
941
|
-
// end code copied and modified from escape-html
|
|
1117
|
+
} // end code copied and modified from escape-html
|
|
942
1118
|
|
|
943
1119
|
/**
|
|
944
1120
|
* Escapes text to prevent scripting attacks.
|
|
@@ -946,6 +1122,8 @@ function escapeHtml(string) {
|
|
|
946
1122
|
* @param {*} text Text value to escape.
|
|
947
1123
|
* @return {string} An escaped string.
|
|
948
1124
|
*/
|
|
1125
|
+
|
|
1126
|
+
|
|
949
1127
|
function escapeTextForBrowser(text) {
|
|
950
1128
|
if (typeof text === 'boolean' || typeof text === 'number') {
|
|
951
1129
|
// this shortcircuit helps perf for types that we know will never have
|
|
@@ -953,6 +1131,7 @@ function escapeTextForBrowser(text) {
|
|
|
953
1131
|
// for numeric dom ids.
|
|
954
1132
|
return '' + text;
|
|
955
1133
|
}
|
|
1134
|
+
|
|
956
1135
|
return escapeHtml(text);
|
|
957
1136
|
}
|
|
958
1137
|
|
|
@@ -962,6 +1141,7 @@ function escapeTextForBrowser(text) {
|
|
|
962
1141
|
* @param {*} value Value to escape.
|
|
963
1142
|
* @return {string} An escaped string.
|
|
964
1143
|
*/
|
|
1144
|
+
|
|
965
1145
|
function quoteAttributeValueForBrowser(value) {
|
|
966
1146
|
return '"' + escapeTextForBrowser(value) + '"';
|
|
967
1147
|
}
|
|
@@ -981,7 +1161,6 @@ function quoteAttributeValueForBrowser(value) {
|
|
|
981
1161
|
function createMarkupForRoot() {
|
|
982
1162
|
return ROOT_ATTRIBUTE_NAME + '=""';
|
|
983
1163
|
}
|
|
984
|
-
|
|
985
1164
|
/**
|
|
986
1165
|
* Creates markup for a property.
|
|
987
1166
|
*
|
|
@@ -989,14 +1168,18 @@ function createMarkupForRoot() {
|
|
|
989
1168
|
* @param {*} value
|
|
990
1169
|
* @return {?string} Markup string, or null if the property was invalid.
|
|
991
1170
|
*/
|
|
1171
|
+
|
|
992
1172
|
function createMarkupForProperty(name, value) {
|
|
993
1173
|
var propertyInfo = getPropertyInfo(name);
|
|
1174
|
+
|
|
994
1175
|
if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
|
|
995
1176
|
return '';
|
|
996
1177
|
}
|
|
1178
|
+
|
|
997
1179
|
if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
|
|
998
1180
|
return '';
|
|
999
1181
|
}
|
|
1182
|
+
|
|
1000
1183
|
if (propertyInfo !== null) {
|
|
1001
1184
|
var attributeName = propertyInfo.attributeName;
|
|
1002
1185
|
var type = propertyInfo.type;
|
|
@@ -1004,14 +1187,19 @@ function createMarkupForProperty(name, value) {
|
|
|
1004
1187
|
if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
|
|
1005
1188
|
return attributeName + '=""';
|
|
1006
1189
|
} else {
|
|
1190
|
+
if (propertyInfo.sanitizeURL) {
|
|
1191
|
+
value = '' + value;
|
|
1192
|
+
sanitizeURL(value);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1007
1195
|
return attributeName + '=' + quoteAttributeValueForBrowser(value);
|
|
1008
1196
|
}
|
|
1009
1197
|
} else if (isAttributeNameSafe(name)) {
|
|
1010
1198
|
return name + '=' + quoteAttributeValueForBrowser(value);
|
|
1011
1199
|
}
|
|
1200
|
+
|
|
1012
1201
|
return '';
|
|
1013
1202
|
}
|
|
1014
|
-
|
|
1015
1203
|
/**
|
|
1016
1204
|
* Creates markup for a custom property.
|
|
1017
1205
|
*
|
|
@@ -1019,10 +1207,12 @@ function createMarkupForProperty(name, value) {
|
|
|
1019
1207
|
* @param {*} value
|
|
1020
1208
|
* @return {string} Markup string, or empty string if the property was invalid.
|
|
1021
1209
|
*/
|
|
1210
|
+
|
|
1022
1211
|
function createMarkupForCustomAttribute(name, value) {
|
|
1023
1212
|
if (!isAttributeNameSafe(name) || value == null) {
|
|
1024
1213
|
return '';
|
|
1025
1214
|
}
|
|
1215
|
+
|
|
1026
1216
|
return name + '=' + quoteAttributeValueForBrowser(value);
|
|
1027
1217
|
}
|
|
1028
1218
|
|
|
@@ -1035,29 +1225,37 @@ function is(x, y) {
|
|
|
1035
1225
|
;
|
|
1036
1226
|
}
|
|
1037
1227
|
|
|
1228
|
+
var is$1 = typeof Object.is === 'function' ? Object.is : is;
|
|
1229
|
+
|
|
1038
1230
|
var currentlyRenderingComponent = null;
|
|
1039
1231
|
var firstWorkInProgressHook = null;
|
|
1040
|
-
var workInProgressHook = null;
|
|
1041
|
-
|
|
1042
|
-
var isReRender = false;
|
|
1043
|
-
|
|
1044
|
-
var didScheduleRenderPhaseUpdate = false;
|
|
1045
|
-
|
|
1046
|
-
var renderPhaseUpdates = null;
|
|
1047
|
-
|
|
1232
|
+
var workInProgressHook = null; // Whether the work-in-progress hook is a re-rendered hook
|
|
1233
|
+
|
|
1234
|
+
var isReRender = false; // Whether an update was scheduled during the currently executing render pass.
|
|
1235
|
+
|
|
1236
|
+
var didScheduleRenderPhaseUpdate = false; // Lazily created map of render-phase updates
|
|
1237
|
+
|
|
1238
|
+
var renderPhaseUpdates = null; // Counter to prevent infinite loops.
|
|
1239
|
+
|
|
1048
1240
|
var numberOfReRenders = 0;
|
|
1049
1241
|
var RE_RENDER_LIMIT = 25;
|
|
1242
|
+
var isInHookUserCodeInDev = false; // In DEV, this is the name of the currently executing primitive hook
|
|
1050
1243
|
|
|
1051
|
-
var
|
|
1052
|
-
|
|
1053
|
-
// In DEV, this is the name of the currently executing primitive hook
|
|
1054
|
-
var currentHookNameInDev = void 0;
|
|
1244
|
+
var currentHookNameInDev;
|
|
1055
1245
|
|
|
1056
1246
|
function resolveCurrentlyRenderingComponent() {
|
|
1057
|
-
|
|
1247
|
+
(function () {
|
|
1248
|
+
if (!(currentlyRenderingComponent !== null)) {
|
|
1249
|
+
{
|
|
1250
|
+
throw ReactError(Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."));
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
})();
|
|
1254
|
+
|
|
1058
1255
|
{
|
|
1059
1256
|
!!isInHookUserCodeInDev ? warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks') : void 0;
|
|
1060
1257
|
}
|
|
1258
|
+
|
|
1061
1259
|
return currentlyRenderingComponent;
|
|
1062
1260
|
}
|
|
1063
1261
|
|
|
@@ -1066,6 +1264,7 @@ function areHookInputsEqual(nextDeps, prevDeps) {
|
|
|
1066
1264
|
{
|
|
1067
1265
|
warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
|
|
1068
1266
|
}
|
|
1267
|
+
|
|
1069
1268
|
return false;
|
|
1070
1269
|
}
|
|
1071
1270
|
|
|
@@ -1073,22 +1272,32 @@ function areHookInputsEqual(nextDeps, prevDeps) {
|
|
|
1073
1272
|
// Don't bother comparing lengths in prod because these arrays should be
|
|
1074
1273
|
// passed inline.
|
|
1075
1274
|
if (nextDeps.length !== prevDeps.length) {
|
|
1076
|
-
warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev,
|
|
1275
|
+
warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + nextDeps.join(', ') + "]", "[" + prevDeps.join(', ') + "]");
|
|
1077
1276
|
}
|
|
1078
1277
|
}
|
|
1278
|
+
|
|
1079
1279
|
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
|
|
1080
|
-
if (is(nextDeps[i], prevDeps[i])) {
|
|
1280
|
+
if (is$1(nextDeps[i], prevDeps[i])) {
|
|
1081
1281
|
continue;
|
|
1082
1282
|
}
|
|
1283
|
+
|
|
1083
1284
|
return false;
|
|
1084
1285
|
}
|
|
1286
|
+
|
|
1085
1287
|
return true;
|
|
1086
1288
|
}
|
|
1087
1289
|
|
|
1088
1290
|
function createHook() {
|
|
1089
1291
|
if (numberOfReRenders > 0) {
|
|
1090
|
-
|
|
1292
|
+
(function () {
|
|
1293
|
+
{
|
|
1294
|
+
{
|
|
1295
|
+
throw ReactError(Error("Rendered more hooks than during the previous render"));
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
})();
|
|
1091
1299
|
}
|
|
1300
|
+
|
|
1092
1301
|
return {
|
|
1093
1302
|
memoizedState: null,
|
|
1094
1303
|
queue: null,
|
|
@@ -1109,8 +1318,8 @@ function createWorkInProgressHook() {
|
|
|
1109
1318
|
}
|
|
1110
1319
|
} else {
|
|
1111
1320
|
if (workInProgressHook.next === null) {
|
|
1112
|
-
isReRender = false;
|
|
1113
|
-
|
|
1321
|
+
isReRender = false; // Append to the end of the list
|
|
1322
|
+
|
|
1114
1323
|
workInProgressHook = workInProgressHook.next = createHook();
|
|
1115
1324
|
} else {
|
|
1116
1325
|
// There's already a work-in-progress. Reuse it.
|
|
@@ -1118,50 +1327,47 @@ function createWorkInProgressHook() {
|
|
|
1118
1327
|
workInProgressHook = workInProgressHook.next;
|
|
1119
1328
|
}
|
|
1120
1329
|
}
|
|
1330
|
+
|
|
1121
1331
|
return workInProgressHook;
|
|
1122
1332
|
}
|
|
1123
1333
|
|
|
1124
1334
|
function prepareToUseHooks(componentIdentity) {
|
|
1125
1335
|
currentlyRenderingComponent = componentIdentity;
|
|
1336
|
+
|
|
1126
1337
|
{
|
|
1127
1338
|
isInHookUserCodeInDev = false;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
// The following should have already been reset
|
|
1339
|
+
} // The following should have already been reset
|
|
1131
1340
|
// didScheduleRenderPhaseUpdate = false;
|
|
1132
1341
|
// firstWorkInProgressHook = null;
|
|
1133
1342
|
// numberOfReRenders = 0;
|
|
1134
1343
|
// renderPhaseUpdates = null;
|
|
1135
1344
|
// workInProgressHook = null;
|
|
1136
|
-
}
|
|
1137
1345
|
|
|
1346
|
+
}
|
|
1138
1347
|
function finishHooks(Component, props, children, refOrContext) {
|
|
1139
1348
|
// This must be called after every function component to prevent hooks from
|
|
1140
1349
|
// being used in classes.
|
|
1141
|
-
|
|
1142
1350
|
while (didScheduleRenderPhaseUpdate) {
|
|
1143
1351
|
// Updates were scheduled during the render phase. They are stored in
|
|
1144
1352
|
// the `renderPhaseUpdates` map. Call the component again, reusing the
|
|
1145
1353
|
// work-in-progress hooks and applying the additional updates on top. Keep
|
|
1146
1354
|
// restarting until no more updates are scheduled.
|
|
1147
1355
|
didScheduleRenderPhaseUpdate = false;
|
|
1148
|
-
numberOfReRenders += 1;
|
|
1356
|
+
numberOfReRenders += 1; // Start over from the beginning of the list
|
|
1149
1357
|
|
|
1150
|
-
// Start over from the beginning of the list
|
|
1151
1358
|
workInProgressHook = null;
|
|
1152
|
-
|
|
1153
1359
|
children = Component(props, refOrContext);
|
|
1154
1360
|
}
|
|
1361
|
+
|
|
1155
1362
|
currentlyRenderingComponent = null;
|
|
1156
1363
|
firstWorkInProgressHook = null;
|
|
1157
1364
|
numberOfReRenders = 0;
|
|
1158
1365
|
renderPhaseUpdates = null;
|
|
1159
1366
|
workInProgressHook = null;
|
|
1367
|
+
|
|
1160
1368
|
{
|
|
1161
1369
|
isInHookUserCodeInDev = false;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
// These were reset above
|
|
1370
|
+
} // These were reset above
|
|
1165
1371
|
// currentlyRenderingComponent = null;
|
|
1166
1372
|
// didScheduleRenderPhaseUpdate = false;
|
|
1167
1373
|
// firstWorkInProgressHook = null;
|
|
@@ -1169,15 +1375,18 @@ function finishHooks(Component, props, children, refOrContext) {
|
|
|
1169
1375
|
// renderPhaseUpdates = null;
|
|
1170
1376
|
// workInProgressHook = null;
|
|
1171
1377
|
|
|
1378
|
+
|
|
1172
1379
|
return children;
|
|
1173
1380
|
}
|
|
1174
1381
|
|
|
1175
1382
|
function readContext(context, observedBits) {
|
|
1176
1383
|
var threadID = currentThreadID;
|
|
1177
1384
|
validateContextBounds(context, threadID);
|
|
1385
|
+
|
|
1178
1386
|
{
|
|
1179
1387
|
!!isInHookUserCodeInDev ? warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().') : void 0;
|
|
1180
1388
|
}
|
|
1389
|
+
|
|
1181
1390
|
return context[threadID];
|
|
1182
1391
|
}
|
|
1183
1392
|
|
|
@@ -1185,6 +1394,7 @@ function useContext(context, observedBits) {
|
|
|
1185
1394
|
{
|
|
1186
1395
|
currentHookNameInDev = 'useContext';
|
|
1187
1396
|
}
|
|
1397
|
+
|
|
1188
1398
|
resolveCurrentlyRenderingComponent();
|
|
1189
1399
|
var threadID = currentThreadID;
|
|
1190
1400
|
validateContextBounds(context, threadID);
|
|
@@ -1199,86 +1409,103 @@ function useState(initialState) {
|
|
|
1199
1409
|
{
|
|
1200
1410
|
currentHookNameInDev = 'useState';
|
|
1201
1411
|
}
|
|
1202
|
-
|
|
1203
|
-
// useReducer has a special case to support lazy useState initializers
|
|
1412
|
+
|
|
1413
|
+
return useReducer(basicStateReducer, // useReducer has a special case to support lazy useState initializers
|
|
1204
1414
|
initialState);
|
|
1205
1415
|
}
|
|
1206
|
-
|
|
1207
1416
|
function useReducer(reducer, initialArg, init) {
|
|
1208
1417
|
{
|
|
1209
1418
|
if (reducer !== basicStateReducer) {
|
|
1210
1419
|
currentHookNameInDev = 'useReducer';
|
|
1211
1420
|
}
|
|
1212
1421
|
}
|
|
1422
|
+
|
|
1213
1423
|
currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
|
1214
1424
|
workInProgressHook = createWorkInProgressHook();
|
|
1425
|
+
|
|
1215
1426
|
if (isReRender) {
|
|
1216
1427
|
// This is a re-render. Apply the new render phase updates to the previous
|
|
1217
|
-
|
|
1218
|
-
var
|
|
1428
|
+
// current hook.
|
|
1429
|
+
var queue = workInProgressHook.queue;
|
|
1430
|
+
var dispatch = queue.dispatch;
|
|
1431
|
+
|
|
1219
1432
|
if (renderPhaseUpdates !== null) {
|
|
1220
1433
|
// Render phase updates are stored in a map of queue -> linked list
|
|
1221
|
-
var firstRenderPhaseUpdate = renderPhaseUpdates.get(
|
|
1434
|
+
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
|
1435
|
+
|
|
1222
1436
|
if (firstRenderPhaseUpdate !== undefined) {
|
|
1223
|
-
renderPhaseUpdates.delete(
|
|
1437
|
+
renderPhaseUpdates.delete(queue);
|
|
1224
1438
|
var newState = workInProgressHook.memoizedState;
|
|
1225
1439
|
var update = firstRenderPhaseUpdate;
|
|
1440
|
+
|
|
1226
1441
|
do {
|
|
1227
1442
|
// Process this render phase update. We don't have to check the
|
|
1228
1443
|
// priority because it will always be the same as the current
|
|
1229
1444
|
// render's.
|
|
1230
|
-
var
|
|
1445
|
+
var action = update.action;
|
|
1446
|
+
|
|
1231
1447
|
{
|
|
1232
1448
|
isInHookUserCodeInDev = true;
|
|
1233
1449
|
}
|
|
1234
|
-
|
|
1450
|
+
|
|
1451
|
+
newState = reducer(newState, action);
|
|
1452
|
+
|
|
1235
1453
|
{
|
|
1236
1454
|
isInHookUserCodeInDev = false;
|
|
1237
1455
|
}
|
|
1456
|
+
|
|
1238
1457
|
update = update.next;
|
|
1239
1458
|
} while (update !== null);
|
|
1240
1459
|
|
|
1241
1460
|
workInProgressHook.memoizedState = newState;
|
|
1242
|
-
|
|
1243
|
-
return [newState, _dispatch];
|
|
1461
|
+
return [newState, dispatch];
|
|
1244
1462
|
}
|
|
1245
1463
|
}
|
|
1246
|
-
|
|
1464
|
+
|
|
1465
|
+
return [workInProgressHook.memoizedState, dispatch];
|
|
1247
1466
|
} else {
|
|
1248
1467
|
{
|
|
1249
1468
|
isInHookUserCodeInDev = true;
|
|
1250
1469
|
}
|
|
1251
|
-
|
|
1470
|
+
|
|
1471
|
+
var initialState;
|
|
1472
|
+
|
|
1252
1473
|
if (reducer === basicStateReducer) {
|
|
1253
1474
|
// Special case for `useState`.
|
|
1254
1475
|
initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
|
|
1255
1476
|
} else {
|
|
1256
1477
|
initialState = init !== undefined ? init(initialArg) : initialArg;
|
|
1257
1478
|
}
|
|
1479
|
+
|
|
1258
1480
|
{
|
|
1259
1481
|
isInHookUserCodeInDev = false;
|
|
1260
1482
|
}
|
|
1483
|
+
|
|
1261
1484
|
workInProgressHook.memoizedState = initialState;
|
|
1262
|
-
|
|
1485
|
+
|
|
1486
|
+
var _queue = workInProgressHook.queue = {
|
|
1263
1487
|
last: null,
|
|
1264
1488
|
dispatch: null
|
|
1265
1489
|
};
|
|
1266
|
-
|
|
1267
|
-
|
|
1490
|
+
|
|
1491
|
+
var _dispatch = _queue.dispatch = dispatchAction.bind(null, currentlyRenderingComponent, _queue);
|
|
1492
|
+
|
|
1493
|
+
return [workInProgressHook.memoizedState, _dispatch];
|
|
1268
1494
|
}
|
|
1269
1495
|
}
|
|
1270
1496
|
|
|
1271
1497
|
function useMemo(nextCreate, deps) {
|
|
1272
1498
|
currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
|
1273
1499
|
workInProgressHook = createWorkInProgressHook();
|
|
1274
|
-
|
|
1275
1500
|
var nextDeps = deps === undefined ? null : deps;
|
|
1276
1501
|
|
|
1277
1502
|
if (workInProgressHook !== null) {
|
|
1278
1503
|
var prevState = workInProgressHook.memoizedState;
|
|
1504
|
+
|
|
1279
1505
|
if (prevState !== null) {
|
|
1280
1506
|
if (nextDeps !== null) {
|
|
1281
1507
|
var prevDeps = prevState[1];
|
|
1508
|
+
|
|
1282
1509
|
if (areHookInputsEqual(nextDeps, prevDeps)) {
|
|
1283
1510
|
return prevState[0];
|
|
1284
1511
|
}
|
|
@@ -1289,10 +1516,13 @@ function useMemo(nextCreate, deps) {
|
|
|
1289
1516
|
{
|
|
1290
1517
|
isInHookUserCodeInDev = true;
|
|
1291
1518
|
}
|
|
1519
|
+
|
|
1292
1520
|
var nextValue = nextCreate();
|
|
1521
|
+
|
|
1293
1522
|
{
|
|
1294
1523
|
isInHookUserCodeInDev = false;
|
|
1295
1524
|
}
|
|
1525
|
+
|
|
1296
1526
|
workInProgressHook.memoizedState = [nextValue, nextDeps];
|
|
1297
1527
|
return nextValue;
|
|
1298
1528
|
}
|
|
@@ -1301,11 +1531,16 @@ function useRef(initialValue) {
|
|
|
1301
1531
|
currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
|
1302
1532
|
workInProgressHook = createWorkInProgressHook();
|
|
1303
1533
|
var previousRef = workInProgressHook.memoizedState;
|
|
1534
|
+
|
|
1304
1535
|
if (previousRef === null) {
|
|
1305
|
-
var ref = {
|
|
1536
|
+
var ref = {
|
|
1537
|
+
current: initialValue
|
|
1538
|
+
};
|
|
1539
|
+
|
|
1306
1540
|
{
|
|
1307
1541
|
Object.seal(ref);
|
|
1308
1542
|
}
|
|
1543
|
+
|
|
1309
1544
|
workInProgressHook.memoizedState = ref;
|
|
1310
1545
|
return ref;
|
|
1311
1546
|
} else {
|
|
@@ -1317,11 +1552,18 @@ function useLayoutEffect(create, inputs) {
|
|
|
1317
1552
|
{
|
|
1318
1553
|
currentHookNameInDev = 'useLayoutEffect';
|
|
1319
1554
|
}
|
|
1555
|
+
|
|
1320
1556
|
warning$1(false, 'useLayoutEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useLayoutEffect should only be used in ' + 'components that render exclusively on the client. ' + 'See https://fb.me/react-uselayouteffect-ssr for common fixes.');
|
|
1321
1557
|
}
|
|
1322
1558
|
|
|
1323
1559
|
function dispatchAction(componentIdentity, queue, action) {
|
|
1324
|
-
|
|
1560
|
+
(function () {
|
|
1561
|
+
if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
|
|
1562
|
+
{
|
|
1563
|
+
throw ReactError(Error("Too many re-renders. React limits the number of renders to prevent an infinite loop."));
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
})();
|
|
1325
1567
|
|
|
1326
1568
|
if (componentIdentity === currentlyRenderingComponent) {
|
|
1327
1569
|
// This is a render phase update. Stash it in a lazily-created map of
|
|
@@ -1332,22 +1574,26 @@ function dispatchAction(componentIdentity, queue, action) {
|
|
|
1332
1574
|
action: action,
|
|
1333
1575
|
next: null
|
|
1334
1576
|
};
|
|
1577
|
+
|
|
1335
1578
|
if (renderPhaseUpdates === null) {
|
|
1336
1579
|
renderPhaseUpdates = new Map();
|
|
1337
1580
|
}
|
|
1581
|
+
|
|
1338
1582
|
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
|
1583
|
+
|
|
1339
1584
|
if (firstRenderPhaseUpdate === undefined) {
|
|
1340
1585
|
renderPhaseUpdates.set(queue, update);
|
|
1341
1586
|
} else {
|
|
1342
1587
|
// Append the update to the end of the list.
|
|
1343
1588
|
var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
|
|
1589
|
+
|
|
1344
1590
|
while (lastRenderPhaseUpdate.next !== null) {
|
|
1345
1591
|
lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
|
|
1346
1592
|
}
|
|
1593
|
+
|
|
1347
1594
|
lastRenderPhaseUpdate.next = update;
|
|
1348
1595
|
}
|
|
1349
|
-
} else {
|
|
1350
|
-
// This means an update has happened after the function component has
|
|
1596
|
+
} else {// This means an update has happened after the function component has
|
|
1351
1597
|
// returned. On the server this is a no-op. In React Fiber, the update
|
|
1352
1598
|
// would be scheduled for a future render.
|
|
1353
1599
|
}
|
|
@@ -1358,14 +1604,19 @@ function useCallback(callback, deps) {
|
|
|
1358
1604
|
return callback;
|
|
1359
1605
|
}
|
|
1360
1606
|
|
|
1607
|
+
function useResponder(responder, props) {
|
|
1608
|
+
return {
|
|
1609
|
+
props: props,
|
|
1610
|
+
responder: responder
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1361
1614
|
function noop() {}
|
|
1362
1615
|
|
|
1363
1616
|
var currentThreadID = 0;
|
|
1364
|
-
|
|
1365
1617
|
function setCurrentThreadID(threadID) {
|
|
1366
1618
|
currentThreadID = threadID;
|
|
1367
1619
|
}
|
|
1368
|
-
|
|
1369
1620
|
var Dispatcher = {
|
|
1370
1621
|
readContext: readContext,
|
|
1371
1622
|
useContext: useContext,
|
|
@@ -1380,53 +1631,53 @@ var Dispatcher = {
|
|
|
1380
1631
|
// Effects are not run in the server environment.
|
|
1381
1632
|
useEffect: noop,
|
|
1382
1633
|
// Debugging effect
|
|
1383
|
-
useDebugValue: noop
|
|
1634
|
+
useDebugValue: noop,
|
|
1635
|
+
useResponder: useResponder
|
|
1384
1636
|
};
|
|
1385
1637
|
|
|
1386
1638
|
var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
1387
1639
|
var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
|
1388
1640
|
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
1389
|
-
|
|
1390
1641
|
var Namespaces = {
|
|
1391
1642
|
html: HTML_NAMESPACE,
|
|
1392
1643
|
mathml: MATH_NAMESPACE,
|
|
1393
1644
|
svg: SVG_NAMESPACE
|
|
1394
|
-
};
|
|
1645
|
+
}; // Assumes there is no parent namespace.
|
|
1395
1646
|
|
|
1396
|
-
// Assumes there is no parent namespace.
|
|
1397
1647
|
function getIntrinsicNamespace(type) {
|
|
1398
1648
|
switch (type) {
|
|
1399
1649
|
case 'svg':
|
|
1400
1650
|
return SVG_NAMESPACE;
|
|
1651
|
+
|
|
1401
1652
|
case 'math':
|
|
1402
1653
|
return MATH_NAMESPACE;
|
|
1654
|
+
|
|
1403
1655
|
default:
|
|
1404
1656
|
return HTML_NAMESPACE;
|
|
1405
1657
|
}
|
|
1406
1658
|
}
|
|
1407
|
-
|
|
1408
1659
|
function getChildNamespace(parentNamespace, type) {
|
|
1409
1660
|
if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
|
|
1410
1661
|
// No (or default) parent namespace: potential entry point.
|
|
1411
1662
|
return getIntrinsicNamespace(type);
|
|
1412
1663
|
}
|
|
1664
|
+
|
|
1413
1665
|
if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
|
|
1414
1666
|
// We're leaving SVG.
|
|
1415
1667
|
return HTML_NAMESPACE;
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1668
|
+
} // By default, pass namespace below.
|
|
1669
|
+
|
|
1670
|
+
|
|
1418
1671
|
return parentNamespace;
|
|
1419
1672
|
}
|
|
1420
1673
|
|
|
1421
|
-
var ReactDebugCurrentFrame$
|
|
1422
|
-
|
|
1674
|
+
var ReactDebugCurrentFrame$3 = null;
|
|
1423
1675
|
var ReactControlledValuePropTypes = {
|
|
1424
1676
|
checkPropTypes: null
|
|
1425
1677
|
};
|
|
1426
1678
|
|
|
1427
1679
|
{
|
|
1428
|
-
ReactDebugCurrentFrame$
|
|
1429
|
-
|
|
1680
|
+
ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1430
1681
|
var hasReadOnlyValue = {
|
|
1431
1682
|
button: true,
|
|
1432
1683
|
checkbox: true,
|
|
@@ -1436,34 +1687,34 @@ var ReactControlledValuePropTypes = {
|
|
|
1436
1687
|
reset: true,
|
|
1437
1688
|
submit: true
|
|
1438
1689
|
};
|
|
1439
|
-
|
|
1440
1690
|
var propTypes = {
|
|
1441
1691
|
value: function (props, propName, componentName) {
|
|
1442
|
-
if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) {
|
|
1692
|
+
if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
|
|
1443
1693
|
return null;
|
|
1444
1694
|
}
|
|
1695
|
+
|
|
1445
1696
|
return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
|
1446
1697
|
},
|
|
1447
1698
|
checked: function (props, propName, componentName) {
|
|
1448
|
-
if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
|
|
1699
|
+
if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
|
|
1449
1700
|
return null;
|
|
1450
1701
|
}
|
|
1702
|
+
|
|
1451
1703
|
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
|
1452
1704
|
}
|
|
1453
1705
|
};
|
|
1454
|
-
|
|
1455
1706
|
/**
|
|
1456
1707
|
* Provide a linked `value` attribute for controlled forms. You should not use
|
|
1457
1708
|
* this outside of the ReactDOM controlled form components.
|
|
1458
1709
|
*/
|
|
1710
|
+
|
|
1459
1711
|
ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
|
|
1460
|
-
checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$
|
|
1712
|
+
checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$3.getStackAddendum);
|
|
1461
1713
|
};
|
|
1462
1714
|
}
|
|
1463
1715
|
|
|
1464
1716
|
// For HTML, certain tags should omit their close tag. We keep a whitelist for
|
|
1465
1717
|
// those special-case tags.
|
|
1466
|
-
|
|
1467
1718
|
var omittedCloseTags = {
|
|
1468
1719
|
area: true,
|
|
1469
1720
|
base: true,
|
|
@@ -1479,42 +1730,70 @@ var omittedCloseTags = {
|
|
|
1479
1730
|
param: true,
|
|
1480
1731
|
source: true,
|
|
1481
1732
|
track: true,
|
|
1482
|
-
wbr: true
|
|
1483
|
-
|
|
1733
|
+
wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems.
|
|
1734
|
+
|
|
1484
1735
|
};
|
|
1485
1736
|
|
|
1486
|
-
// For HTML, certain tags cannot have children. This has the same purpose as
|
|
1487
1737
|
// `omittedCloseTags` except that `menuitem` should still have its closing tag.
|
|
1488
1738
|
|
|
1489
1739
|
var voidElementTags = _assign({
|
|
1490
1740
|
menuitem: true
|
|
1491
1741
|
}, omittedCloseTags);
|
|
1492
1742
|
|
|
1493
|
-
// TODO: We can remove this if we add invariantWithStack()
|
|
1494
1743
|
// or add stack by default to invariants where possible.
|
|
1744
|
+
|
|
1495
1745
|
var HTML = '__html';
|
|
1746
|
+
var ReactDebugCurrentFrame$4 = null;
|
|
1496
1747
|
|
|
1497
|
-
var ReactDebugCurrentFrame$3 = null;
|
|
1498
1748
|
{
|
|
1499
|
-
ReactDebugCurrentFrame$
|
|
1749
|
+
ReactDebugCurrentFrame$4 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1500
1750
|
}
|
|
1501
1751
|
|
|
1502
1752
|
function assertValidProps(tag, props) {
|
|
1503
1753
|
if (!props) {
|
|
1504
1754
|
return;
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1755
|
+
} // Note the use of `==` which checks for null or undefined.
|
|
1756
|
+
|
|
1757
|
+
|
|
1507
1758
|
if (voidElementTags[tag]) {
|
|
1508
|
-
|
|
1759
|
+
(function () {
|
|
1760
|
+
if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
|
|
1761
|
+
{
|
|
1762
|
+
throw ReactError(Error(tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." + (ReactDebugCurrentFrame$4.getStackAddendum())));
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
})();
|
|
1509
1766
|
}
|
|
1767
|
+
|
|
1510
1768
|
if (props.dangerouslySetInnerHTML != null) {
|
|
1511
|
-
|
|
1512
|
-
|
|
1769
|
+
(function () {
|
|
1770
|
+
if (!(props.children == null)) {
|
|
1771
|
+
{
|
|
1772
|
+
throw ReactError(Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`."));
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
})();
|
|
1776
|
+
|
|
1777
|
+
(function () {
|
|
1778
|
+
if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) {
|
|
1779
|
+
{
|
|
1780
|
+
throw ReactError(Error("`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information."));
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
})();
|
|
1513
1784
|
}
|
|
1785
|
+
|
|
1514
1786
|
{
|
|
1515
1787
|
!(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
|
|
1516
1788
|
}
|
|
1517
|
-
|
|
1789
|
+
|
|
1790
|
+
(function () {
|
|
1791
|
+
if (!(props.style == null || typeof props.style === 'object')) {
|
|
1792
|
+
{
|
|
1793
|
+
throw ReactError(Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + (ReactDebugCurrentFrame$4.getStackAddendum())));
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
})();
|
|
1518
1797
|
}
|
|
1519
1798
|
|
|
1520
1799
|
/**
|
|
@@ -1555,7 +1834,6 @@ var isUnitlessNumber = {
|
|
|
1555
1834
|
widows: true,
|
|
1556
1835
|
zIndex: true,
|
|
1557
1836
|
zoom: true,
|
|
1558
|
-
|
|
1559
1837
|
// SVG-related properties
|
|
1560
1838
|
fillOpacity: true,
|
|
1561
1839
|
floodOpacity: true,
|
|
@@ -1566,25 +1844,25 @@ var isUnitlessNumber = {
|
|
|
1566
1844
|
strokeOpacity: true,
|
|
1567
1845
|
strokeWidth: true
|
|
1568
1846
|
};
|
|
1569
|
-
|
|
1570
1847
|
/**
|
|
1571
1848
|
* @param {string} prefix vendor-specific prefix, eg: Webkit
|
|
1572
1849
|
* @param {string} key style name, eg: transitionDuration
|
|
1573
1850
|
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
|
|
1574
1851
|
* WebkitTransitionDuration
|
|
1575
1852
|
*/
|
|
1853
|
+
|
|
1576
1854
|
function prefixKey(prefix, key) {
|
|
1577
1855
|
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
|
1578
1856
|
}
|
|
1579
|
-
|
|
1580
1857
|
/**
|
|
1581
1858
|
* Support style names that may come passed in prefixed by adding permutations
|
|
1582
1859
|
* of vendor prefixes.
|
|
1583
1860
|
*/
|
|
1584
|
-
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
|
1585
1861
|
|
|
1586
|
-
|
|
1862
|
+
|
|
1863
|
+
var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
|
|
1587
1864
|
// infinite loop, because it iterates over the newly added props too.
|
|
1865
|
+
|
|
1588
1866
|
Object.keys(isUnitlessNumber).forEach(function (prop) {
|
|
1589
1867
|
prefixes.forEach(function (prefix) {
|
|
1590
1868
|
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
|
|
@@ -1600,6 +1878,7 @@ Object.keys(isUnitlessNumber).forEach(function (prop) {
|
|
|
1600
1878
|
* @param {*} value CSS property value such as `10px`.
|
|
1601
1879
|
* @return {string} Normalized style value with dimensions applied.
|
|
1602
1880
|
*/
|
|
1881
|
+
|
|
1603
1882
|
function dangerousStyleValue(name, value, isCustomProperty) {
|
|
1604
1883
|
// Note that we've removed escapeTextForBrowser() calls here since the
|
|
1605
1884
|
// whole string will be escaped when the attribute is injected into
|
|
@@ -1610,8 +1889,8 @@ function dangerousStyleValue(name, value, isCustomProperty) {
|
|
|
1610
1889
|
// This is not an XSS hole but instead a potential CSS injection issue
|
|
1611
1890
|
// which has lead to a greater discussion about how we're going to
|
|
1612
1891
|
// trust URLs moving forward. See #2115901
|
|
1613
|
-
|
|
1614
1892
|
var isEmpty = value == null || typeof value === 'boolean' || value === '';
|
|
1893
|
+
|
|
1615
1894
|
if (isEmpty) {
|
|
1616
1895
|
return '';
|
|
1617
1896
|
}
|
|
@@ -1625,7 +1904,6 @@ function dangerousStyleValue(name, value, isCustomProperty) {
|
|
|
1625
1904
|
|
|
1626
1905
|
var uppercasePattern = /([A-Z])/g;
|
|
1627
1906
|
var msPattern = /^ms-/;
|
|
1628
|
-
|
|
1629
1907
|
/**
|
|
1630
1908
|
* Hyphenates a camelcased CSS property name, for example:
|
|
1631
1909
|
*
|
|
@@ -1639,6 +1917,7 @@ var msPattern = /^ms-/;
|
|
|
1639
1917
|
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
|
|
1640
1918
|
* is converted to `-ms-`.
|
|
1641
1919
|
*/
|
|
1920
|
+
|
|
1642
1921
|
function hyphenateStyleName(name) {
|
|
1643
1922
|
return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
|
|
1644
1923
|
}
|
|
@@ -1647,6 +1926,7 @@ function isCustomComponent(tagName, props) {
|
|
|
1647
1926
|
if (tagName.indexOf('-') === -1) {
|
|
1648
1927
|
return typeof props.is === 'string';
|
|
1649
1928
|
}
|
|
1929
|
+
|
|
1650
1930
|
switch (tagName) {
|
|
1651
1931
|
// These are reserved SVG and MathML elements.
|
|
1652
1932
|
// We don't mind this whitelist too much because we expect it to never grow.
|
|
@@ -1661,6 +1941,7 @@ function isCustomComponent(tagName, props) {
|
|
|
1661
1941
|
case 'font-face-name':
|
|
1662
1942
|
case 'missing-glyph':
|
|
1663
1943
|
return false;
|
|
1944
|
+
|
|
1664
1945
|
default:
|
|
1665
1946
|
return true;
|
|
1666
1947
|
}
|
|
@@ -1672,11 +1953,9 @@ var warnValidStyle = function () {};
|
|
|
1672
1953
|
// 'msTransform' is correct, but the other prefixes should be capitalized
|
|
1673
1954
|
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
|
|
1674
1955
|
var msPattern$1 = /^-ms-/;
|
|
1675
|
-
var hyphenPattern = /-(.)/g;
|
|
1956
|
+
var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon
|
|
1676
1957
|
|
|
1677
|
-
// style values shouldn't contain a semicolon
|
|
1678
1958
|
var badStyleValueWithSemicolonPattern = /;\s*$/;
|
|
1679
|
-
|
|
1680
1959
|
var warnedStyleNames = {};
|
|
1681
1960
|
var warnedStyleValues = {};
|
|
1682
1961
|
var warnedForNaNValue = false;
|
|
@@ -1694,8 +1973,7 @@ var warnValidStyle = function () {};
|
|
|
1694
1973
|
}
|
|
1695
1974
|
|
|
1696
1975
|
warnedStyleNames[name] = true;
|
|
1697
|
-
warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
|
|
1698
|
-
// As Andi Smith suggests
|
|
1976
|
+
warning$1(false, 'Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests
|
|
1699
1977
|
// (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
|
|
1700
1978
|
// is converted to lowercase `ms`.
|
|
1701
1979
|
camelize(name.replace(msPattern$1, 'ms-')));
|
|
@@ -1759,11 +2037,15 @@ var warnValidStyle = function () {};
|
|
|
1759
2037
|
var warnValidStyle$1 = warnValidStyle;
|
|
1760
2038
|
|
|
1761
2039
|
var ariaProperties = {
|
|
1762
|
-
'aria-current': 0,
|
|
2040
|
+
'aria-current': 0,
|
|
2041
|
+
// state
|
|
1763
2042
|
'aria-details': 0,
|
|
1764
|
-
'aria-disabled': 0,
|
|
1765
|
-
|
|
1766
|
-
'aria-
|
|
2043
|
+
'aria-disabled': 0,
|
|
2044
|
+
// state
|
|
2045
|
+
'aria-hidden': 0,
|
|
2046
|
+
// state
|
|
2047
|
+
'aria-invalid': 0,
|
|
2048
|
+
// state
|
|
1767
2049
|
'aria-keyshortcuts': 0,
|
|
1768
2050
|
'aria-label': 0,
|
|
1769
2051
|
'aria-roledescription': 0,
|
|
@@ -1816,7 +2098,6 @@ var ariaProperties = {
|
|
|
1816
2098
|
var warnedProperties = {};
|
|
1817
2099
|
var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
1818
2100
|
var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
1819
|
-
|
|
1820
2101
|
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1821
2102
|
|
|
1822
2103
|
function validateProperty(tagName, name) {
|
|
@@ -1826,16 +2107,16 @@ function validateProperty(tagName, name) {
|
|
|
1826
2107
|
|
|
1827
2108
|
if (rARIACamel.test(name)) {
|
|
1828
2109
|
var ariaName = 'aria-' + name.slice(4).toLowerCase();
|
|
1829
|
-
var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
|
|
1830
|
-
|
|
1831
|
-
// If this is an aria-* attribute, but is not listed in the known DOM
|
|
2110
|
+
var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM
|
|
1832
2111
|
// DOM properties, then it is an invalid aria-* attribute.
|
|
2112
|
+
|
|
1833
2113
|
if (correctName == null) {
|
|
1834
2114
|
warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
|
|
1835
2115
|
warnedProperties[name] = true;
|
|
1836
2116
|
return true;
|
|
1837
|
-
}
|
|
1838
|
-
|
|
2117
|
+
} // aria-* attributes should be lowercase; suggest the lowercase version.
|
|
2118
|
+
|
|
2119
|
+
|
|
1839
2120
|
if (name !== correctName) {
|
|
1840
2121
|
warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
|
|
1841
2122
|
warnedProperties[name] = true;
|
|
@@ -1845,15 +2126,15 @@ function validateProperty(tagName, name) {
|
|
|
1845
2126
|
|
|
1846
2127
|
if (rARIA.test(name)) {
|
|
1847
2128
|
var lowerCasedName = name.toLowerCase();
|
|
1848
|
-
var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
|
|
1849
|
-
|
|
1850
|
-
// If this is an aria-* attribute, but is not listed in the known DOM
|
|
2129
|
+
var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM
|
|
1851
2130
|
// DOM properties, then it is an invalid aria-* attribute.
|
|
2131
|
+
|
|
1852
2132
|
if (standardName == null) {
|
|
1853
2133
|
warnedProperties[name] = true;
|
|
1854
2134
|
return false;
|
|
1855
|
-
}
|
|
1856
|
-
|
|
2135
|
+
} // aria-* attributes should be lowercase; suggest the lowercase version.
|
|
2136
|
+
|
|
2137
|
+
|
|
1857
2138
|
if (name !== standardName) {
|
|
1858
2139
|
warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
|
|
1859
2140
|
warnedProperties[name] = true;
|
|
@@ -1869,6 +2150,7 @@ function warnInvalidARIAProps(type, props) {
|
|
|
1869
2150
|
|
|
1870
2151
|
for (var key in props) {
|
|
1871
2152
|
var isValid = validateProperty(type, key);
|
|
2153
|
+
|
|
1872
2154
|
if (!isValid) {
|
|
1873
2155
|
invalidProps.push(key);
|
|
1874
2156
|
}
|
|
@@ -1889,11 +2171,11 @@ function validateProperties(type, props) {
|
|
|
1889
2171
|
if (isCustomComponent(type, props)) {
|
|
1890
2172
|
return;
|
|
1891
2173
|
}
|
|
2174
|
+
|
|
1892
2175
|
warnInvalidARIAProps(type, props);
|
|
1893
2176
|
}
|
|
1894
2177
|
|
|
1895
2178
|
var didWarnValueNull = false;
|
|
1896
|
-
|
|
1897
2179
|
function validateProperties$1(type, props) {
|
|
1898
2180
|
if (type !== 'input' && type !== 'textarea' && type !== 'select') {
|
|
1899
2181
|
return;
|
|
@@ -1901,6 +2183,7 @@ function validateProperties$1(type, props) {
|
|
|
1901
2183
|
|
|
1902
2184
|
if (props != null && props.value === null && !didWarnValueNull) {
|
|
1903
2185
|
didWarnValueNull = true;
|
|
2186
|
+
|
|
1904
2187
|
if (type === 'select' && props.multiple) {
|
|
1905
2188
|
warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
|
|
1906
2189
|
} else {
|
|
@@ -1920,6 +2203,7 @@ function validateProperties$1(type, props) {
|
|
|
1920
2203
|
*/
|
|
1921
2204
|
|
|
1922
2205
|
|
|
2206
|
+
|
|
1923
2207
|
/**
|
|
1924
2208
|
* Mapping from event name to dispatch config
|
|
1925
2209
|
*/
|
|
@@ -1928,8 +2212,8 @@ function validateProperties$1(type, props) {
|
|
|
1928
2212
|
/**
|
|
1929
2213
|
* Mapping from registration name to plugin module
|
|
1930
2214
|
*/
|
|
1931
|
-
var registrationNameModules = {};
|
|
1932
2215
|
|
|
2216
|
+
var registrationNameModules = {};
|
|
1933
2217
|
/**
|
|
1934
2218
|
* Mapping from registration name to event name
|
|
1935
2219
|
*/
|
|
@@ -1941,8 +2225,8 @@ var registrationNameModules = {};
|
|
|
1941
2225
|
* only in true.
|
|
1942
2226
|
* @type {Object}
|
|
1943
2227
|
*/
|
|
1944
|
-
|
|
1945
|
-
// Trust the developer to only use possibleRegistrationNames in true
|
|
2228
|
+
|
|
2229
|
+
var possibleRegistrationNames = {}; // Trust the developer to only use possibleRegistrationNames in true
|
|
1946
2230
|
|
|
1947
2231
|
/**
|
|
1948
2232
|
* Injects an ordering of plugins (by plugin name). This allows the ordering
|
|
@@ -2015,6 +2299,7 @@ var possibleStandardNames = {
|
|
|
2015
2299
|
defer: 'defer',
|
|
2016
2300
|
dir: 'dir',
|
|
2017
2301
|
disabled: 'disabled',
|
|
2302
|
+
disablepictureinpicture: 'disablePictureInPicture',
|
|
2018
2303
|
download: 'download',
|
|
2019
2304
|
draggable: 'draggable',
|
|
2020
2305
|
enctype: 'encType',
|
|
@@ -2115,7 +2400,6 @@ var possibleStandardNames = {
|
|
|
2115
2400
|
width: 'width',
|
|
2116
2401
|
wmode: 'wmode',
|
|
2117
2402
|
wrap: 'wrap',
|
|
2118
|
-
|
|
2119
2403
|
// SVG
|
|
2120
2404
|
about: 'about',
|
|
2121
2405
|
accentheight: 'accentHeight',
|
|
@@ -2471,23 +2755,27 @@ var validateProperty$1 = function () {};
|
|
|
2471
2755
|
}
|
|
2472
2756
|
|
|
2473
2757
|
var lowerCasedName = name.toLowerCase();
|
|
2758
|
+
|
|
2474
2759
|
if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
|
|
2475
2760
|
warning$1(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
|
|
2476
2761
|
warnedProperties$1[name] = true;
|
|
2477
2762
|
return true;
|
|
2478
|
-
}
|
|
2763
|
+
} // We can't rely on the event system being injected on the server.
|
|
2764
|
+
|
|
2479
2765
|
|
|
2480
|
-
// We can't rely on the event system being injected on the server.
|
|
2481
2766
|
if (canUseEventSystem) {
|
|
2482
2767
|
if (registrationNameModules.hasOwnProperty(name)) {
|
|
2483
2768
|
return true;
|
|
2484
2769
|
}
|
|
2770
|
+
|
|
2485
2771
|
var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
|
|
2772
|
+
|
|
2486
2773
|
if (registrationName != null) {
|
|
2487
2774
|
warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
|
|
2488
2775
|
warnedProperties$1[name] = true;
|
|
2489
2776
|
return true;
|
|
2490
2777
|
}
|
|
2778
|
+
|
|
2491
2779
|
if (EVENT_NAME_REGEX.test(name)) {
|
|
2492
2780
|
warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
|
|
2493
2781
|
warnedProperties$1[name] = true;
|
|
@@ -2500,11 +2788,12 @@ var validateProperty$1 = function () {};
|
|
|
2500
2788
|
if (INVALID_EVENT_NAME_REGEX.test(name)) {
|
|
2501
2789
|
warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
|
|
2502
2790
|
}
|
|
2791
|
+
|
|
2503
2792
|
warnedProperties$1[name] = true;
|
|
2504
2793
|
return true;
|
|
2505
|
-
}
|
|
2794
|
+
} // Let the ARIA attribute hook validate ARIA attributes
|
|
2795
|
+
|
|
2506
2796
|
|
|
2507
|
-
// Let the ARIA attribute hook validate ARIA attributes
|
|
2508
2797
|
if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
|
|
2509
2798
|
return true;
|
|
2510
2799
|
}
|
|
@@ -2534,11 +2823,11 @@ var validateProperty$1 = function () {};
|
|
|
2534
2823
|
}
|
|
2535
2824
|
|
|
2536
2825
|
var propertyInfo = getPropertyInfo(name);
|
|
2537
|
-
var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
|
|
2826
|
+
var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config.
|
|
2538
2827
|
|
|
2539
|
-
// Known attributes should match the casing specified in the property config.
|
|
2540
2828
|
if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
|
|
2541
2829
|
var standardName = possibleStandardNames[lowerCasedName];
|
|
2830
|
+
|
|
2542
2831
|
if (standardName !== name) {
|
|
2543
2832
|
warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
|
|
2544
2833
|
warnedProperties$1[name] = true;
|
|
@@ -2558,23 +2847,24 @@ var validateProperty$1 = function () {};
|
|
|
2558
2847
|
} else {
|
|
2559
2848
|
warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
|
|
2560
2849
|
}
|
|
2850
|
+
|
|
2561
2851
|
warnedProperties$1[name] = true;
|
|
2562
2852
|
return true;
|
|
2563
|
-
}
|
|
2564
|
-
|
|
2565
|
-
// Now that we've validated casing, do not validate
|
|
2853
|
+
} // Now that we've validated casing, do not validate
|
|
2566
2854
|
// data types for reserved props
|
|
2855
|
+
|
|
2856
|
+
|
|
2567
2857
|
if (isReserved) {
|
|
2568
2858
|
return true;
|
|
2569
|
-
}
|
|
2859
|
+
} // Warn when a known attribute is a bad type
|
|
2860
|
+
|
|
2570
2861
|
|
|
2571
|
-
// Warn when a known attribute is a bad type
|
|
2572
2862
|
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
|
2573
2863
|
warnedProperties$1[name] = true;
|
|
2574
2864
|
return false;
|
|
2575
|
-
}
|
|
2865
|
+
} // Warn when passing the strings 'false' or 'true' into a boolean prop
|
|
2866
|
+
|
|
2576
2867
|
|
|
2577
|
-
// Warn when passing the strings 'false' or 'true' into a boolean prop
|
|
2578
2868
|
if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
|
|
2579
2869
|
warning$1(false, 'Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
|
|
2580
2870
|
warnedProperties$1[name] = true;
|
|
@@ -2587,8 +2877,10 @@ var validateProperty$1 = function () {};
|
|
|
2587
2877
|
|
|
2588
2878
|
var warnUnknownProperties = function (type, props, canUseEventSystem) {
|
|
2589
2879
|
var unknownProps = [];
|
|
2880
|
+
|
|
2590
2881
|
for (var key in props) {
|
|
2591
2882
|
var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
|
|
2883
|
+
|
|
2592
2884
|
if (!isValid) {
|
|
2593
2885
|
unknownProps.push(key);
|
|
2594
2886
|
}
|
|
@@ -2597,6 +2889,7 @@ var warnUnknownProperties = function (type, props, canUseEventSystem) {
|
|
|
2597
2889
|
var unknownPropString = unknownProps.map(function (prop) {
|
|
2598
2890
|
return '`' + prop + '`';
|
|
2599
2891
|
}).join(', ');
|
|
2892
|
+
|
|
2600
2893
|
if (unknownProps.length === 1) {
|
|
2601
2894
|
warning$1(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
|
|
2602
2895
|
} else if (unknownProps.length > 1) {
|
|
@@ -2608,35 +2901,36 @@ function validateProperties$2(type, props, canUseEventSystem) {
|
|
|
2608
2901
|
if (isCustomComponent(type, props)) {
|
|
2609
2902
|
return;
|
|
2610
2903
|
}
|
|
2904
|
+
|
|
2611
2905
|
warnUnknownProperties(type, props, canUseEventSystem);
|
|
2612
2906
|
}
|
|
2613
2907
|
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
// Based on reading the React.Children implementation. TODO: type this somewhere?
|
|
2617
|
-
|
|
2618
|
-
var toArray = React.Children.toArray;
|
|
2619
|
-
|
|
2620
|
-
// This is only used in DEV.
|
|
2908
|
+
var toArray = React.Children.toArray; // This is only used in DEV.
|
|
2621
2909
|
// Each entry is `this.stack` from a currently executing renderer instance.
|
|
2622
2910
|
// (There may be more than one because ReactDOMServer is reentrant).
|
|
2623
2911
|
// Each stack is an array of frames which may contain nested stacks of elements.
|
|
2624
|
-
var currentDebugStacks = [];
|
|
2625
2912
|
|
|
2913
|
+
var currentDebugStacks = [];
|
|
2626
2914
|
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
2627
|
-
var ReactDebugCurrentFrame
|
|
2915
|
+
var ReactDebugCurrentFrame;
|
|
2628
2916
|
var prevGetCurrentStackImpl = null;
|
|
2917
|
+
|
|
2629
2918
|
var getCurrentServerStackImpl = function () {
|
|
2630
2919
|
return '';
|
|
2631
2920
|
};
|
|
2921
|
+
|
|
2632
2922
|
var describeStackFrame = function (element) {
|
|
2633
2923
|
return '';
|
|
2634
2924
|
};
|
|
2635
2925
|
|
|
2636
2926
|
var validatePropertiesInDevelopment = function (type, props) {};
|
|
2927
|
+
|
|
2637
2928
|
var pushCurrentDebugStack = function (stack) {};
|
|
2929
|
+
|
|
2638
2930
|
var pushElementToDebugStack = function (element) {};
|
|
2931
|
+
|
|
2639
2932
|
var popCurrentDebugStack = function () {};
|
|
2933
|
+
|
|
2640
2934
|
var hasWarnedAboutUsingContextAsConsumer = false;
|
|
2641
2935
|
|
|
2642
2936
|
{
|
|
@@ -2645,7 +2939,9 @@ var hasWarnedAboutUsingContextAsConsumer = false;
|
|
|
2645
2939
|
validatePropertiesInDevelopment = function (type, props) {
|
|
2646
2940
|
validateProperties(type, props);
|
|
2647
2941
|
validateProperties$1(type, props);
|
|
2648
|
-
validateProperties$2(type, props,
|
|
2942
|
+
validateProperties$2(type, props,
|
|
2943
|
+
/* canUseEventSystem */
|
|
2944
|
+
false);
|
|
2649
2945
|
};
|
|
2650
2946
|
|
|
2651
2947
|
describeStackFrame = function (element) {
|
|
@@ -2669,12 +2965,11 @@ var hasWarnedAboutUsingContextAsConsumer = false;
|
|
|
2669
2965
|
|
|
2670
2966
|
pushElementToDebugStack = function (element) {
|
|
2671
2967
|
// For the innermost executing ReactDOMServer call,
|
|
2672
|
-
var stack = currentDebugStacks[currentDebugStacks.length - 1];
|
|
2673
|
-
|
|
2674
|
-
var frame = stack[stack.length - 1];
|
|
2675
|
-
|
|
2676
|
-
frame.debugElementStack.push(element);
|
|
2677
|
-
// We only need this because we tail-optimize single-element
|
|
2968
|
+
var stack = currentDebugStacks[currentDebugStacks.length - 1]; // Take the innermost executing frame (e.g. <Foo>),
|
|
2969
|
+
|
|
2970
|
+
var frame = stack[stack.length - 1]; // and record that it has one more element associated with it.
|
|
2971
|
+
|
|
2972
|
+
frame.debugElementStack.push(element); // We only need this because we tail-optimize single-element
|
|
2678
2973
|
// children and directly handle them in an inner loop instead of
|
|
2679
2974
|
// creating separate frames for them.
|
|
2680
2975
|
};
|
|
@@ -2694,22 +2989,25 @@ var hasWarnedAboutUsingContextAsConsumer = false;
|
|
|
2694
2989
|
if (currentDebugStacks.length === 0) {
|
|
2695
2990
|
// Nothing is currently rendering.
|
|
2696
2991
|
return '';
|
|
2697
|
-
}
|
|
2698
|
-
// ReactDOMServer is reentrant so there may be multiple calls at the same time.
|
|
2992
|
+
} // ReactDOMServer is reentrant so there may be multiple calls at the same time.
|
|
2699
2993
|
// Take the frames from the innermost call which is the last in the array.
|
|
2994
|
+
|
|
2995
|
+
|
|
2700
2996
|
var frames = currentDebugStacks[currentDebugStacks.length - 1];
|
|
2701
|
-
var stack = '';
|
|
2702
|
-
|
|
2997
|
+
var stack = ''; // Go through every frame in the stack from the innermost one.
|
|
2998
|
+
|
|
2703
2999
|
for (var i = frames.length - 1; i >= 0; i--) {
|
|
2704
|
-
var frame = frames[i];
|
|
2705
|
-
// Every frame might have more than one debug element stack entry associated with it.
|
|
3000
|
+
var frame = frames[i]; // Every frame might have more than one debug element stack entry associated with it.
|
|
2706
3001
|
// This is because single-child nesting doesn't create materialized frames.
|
|
2707
3002
|
// Instead it would push them through `pushElementToDebugStack()`.
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
3003
|
+
|
|
3004
|
+
var debugElementStack = frame.debugElementStack;
|
|
3005
|
+
|
|
3006
|
+
for (var ii = debugElementStack.length - 1; ii >= 0; ii--) {
|
|
3007
|
+
stack += describeStackFrame(debugElementStack[ii]);
|
|
2711
3008
|
}
|
|
2712
3009
|
}
|
|
3010
|
+
|
|
2713
3011
|
return stack;
|
|
2714
3012
|
};
|
|
2715
3013
|
}
|
|
@@ -2721,6 +3019,7 @@ var didWarnDefaultTextareaValue = false;
|
|
|
2721
3019
|
var didWarnInvalidOptionChildren = false;
|
|
2722
3020
|
var didWarnAboutNoopUpdateForComponent = {};
|
|
2723
3021
|
var didWarnAboutBadClass = {};
|
|
3022
|
+
var didWarnAboutModulePatternComponent = {};
|
|
2724
3023
|
var didWarnAboutDeprecatedWillMount = {};
|
|
2725
3024
|
var didWarnAboutUndefinedDerivedState = {};
|
|
2726
3025
|
var didWarnAboutUninitializedState = {};
|
|
@@ -2729,25 +3028,35 @@ var newlineEatingTags = {
|
|
|
2729
3028
|
listing: true,
|
|
2730
3029
|
pre: true,
|
|
2731
3030
|
textarea: true
|
|
2732
|
-
};
|
|
2733
|
-
|
|
2734
|
-
// We accept any tag to be rendered but since this gets injected into arbitrary
|
|
3031
|
+
}; // We accept any tag to be rendered but since this gets injected into arbitrary
|
|
2735
3032
|
// HTML, we want to make sure that it's a safe tag.
|
|
2736
3033
|
// http://www.w3.org/TR/REC-xml/#NT-Name
|
|
3034
|
+
|
|
2737
3035
|
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
|
|
3036
|
+
|
|
2738
3037
|
var validatedTagCache = {};
|
|
3038
|
+
|
|
2739
3039
|
function validateDangerousTag(tag) {
|
|
2740
3040
|
if (!validatedTagCache.hasOwnProperty(tag)) {
|
|
2741
|
-
|
|
3041
|
+
(function () {
|
|
3042
|
+
if (!VALID_TAG_REGEX.test(tag)) {
|
|
3043
|
+
{
|
|
3044
|
+
throw ReactError(Error("Invalid tag: " + tag));
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
})();
|
|
3048
|
+
|
|
2742
3049
|
validatedTagCache[tag] = true;
|
|
2743
3050
|
}
|
|
2744
3051
|
}
|
|
2745
3052
|
|
|
2746
3053
|
var styleNameCache = {};
|
|
3054
|
+
|
|
2747
3055
|
var processStyleName = function (styleName) {
|
|
2748
3056
|
if (styleNameCache.hasOwnProperty(styleName)) {
|
|
2749
3057
|
return styleNameCache[styleName];
|
|
2750
3058
|
}
|
|
3059
|
+
|
|
2751
3060
|
var result = hyphenateStyleName(styleName);
|
|
2752
3061
|
styleNameCache[styleName] = result;
|
|
2753
3062
|
return result;
|
|
@@ -2756,24 +3065,28 @@ var processStyleName = function (styleName) {
|
|
|
2756
3065
|
function createMarkupForStyles(styles) {
|
|
2757
3066
|
var serialized = '';
|
|
2758
3067
|
var delimiter = '';
|
|
3068
|
+
|
|
2759
3069
|
for (var styleName in styles) {
|
|
2760
3070
|
if (!styles.hasOwnProperty(styleName)) {
|
|
2761
3071
|
continue;
|
|
2762
3072
|
}
|
|
3073
|
+
|
|
2763
3074
|
var isCustomProperty = styleName.indexOf('--') === 0;
|
|
2764
3075
|
var styleValue = styles[styleName];
|
|
3076
|
+
|
|
2765
3077
|
{
|
|
2766
3078
|
if (!isCustomProperty) {
|
|
2767
3079
|
warnValidStyle$1(styleName, styleValue);
|
|
2768
3080
|
}
|
|
2769
3081
|
}
|
|
3082
|
+
|
|
2770
3083
|
if (styleValue != null) {
|
|
2771
|
-
serialized += delimiter + processStyleName(styleName) + ':';
|
|
3084
|
+
serialized += delimiter + (isCustomProperty ? styleName : processStyleName(styleName)) + ':';
|
|
2772
3085
|
serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
|
|
2773
|
-
|
|
2774
3086
|
delimiter = ';';
|
|
2775
3087
|
}
|
|
2776
3088
|
}
|
|
3089
|
+
|
|
2777
3090
|
return serialized || null;
|
|
2778
3091
|
}
|
|
2779
3092
|
|
|
@@ -2782,6 +3095,7 @@ function warnNoop(publicInstance, callerName) {
|
|
|
2782
3095
|
var _constructor = publicInstance.constructor;
|
|
2783
3096
|
var componentName = _constructor && getComponentName(_constructor) || 'ReactClass';
|
|
2784
3097
|
var warningKey = componentName + '.' + callerName;
|
|
3098
|
+
|
|
2785
3099
|
if (didWarnAboutNoopUpdateForComponent[warningKey]) {
|
|
2786
3100
|
return;
|
|
2787
3101
|
}
|
|
@@ -2797,16 +3111,19 @@ function shouldConstruct(Component) {
|
|
|
2797
3111
|
|
|
2798
3112
|
function getNonChildrenInnerMarkup(props) {
|
|
2799
3113
|
var innerHTML = props.dangerouslySetInnerHTML;
|
|
3114
|
+
|
|
2800
3115
|
if (innerHTML != null) {
|
|
2801
3116
|
if (innerHTML.__html != null) {
|
|
2802
3117
|
return innerHTML.__html;
|
|
2803
3118
|
}
|
|
2804
3119
|
} else {
|
|
2805
3120
|
var content = props.children;
|
|
3121
|
+
|
|
2806
3122
|
if (typeof content === 'string' || typeof content === 'number') {
|
|
2807
3123
|
return escapeTextForBrowser(content);
|
|
2808
3124
|
}
|
|
2809
3125
|
}
|
|
3126
|
+
|
|
2810
3127
|
return null;
|
|
2811
3128
|
}
|
|
2812
3129
|
|
|
@@ -2814,14 +3131,19 @@ function flattenTopLevelChildren(children) {
|
|
|
2814
3131
|
if (!React.isValidElement(children)) {
|
|
2815
3132
|
return toArray(children);
|
|
2816
3133
|
}
|
|
3134
|
+
|
|
2817
3135
|
var element = children;
|
|
3136
|
+
|
|
2818
3137
|
if (element.type !== REACT_FRAGMENT_TYPE) {
|
|
2819
3138
|
return [element];
|
|
2820
3139
|
}
|
|
3140
|
+
|
|
2821
3141
|
var fragmentChildren = element.props.children;
|
|
3142
|
+
|
|
2822
3143
|
if (!React.isValidElement(fragmentChildren)) {
|
|
2823
3144
|
return toArray(fragmentChildren);
|
|
2824
3145
|
}
|
|
3146
|
+
|
|
2825
3147
|
var fragmentChildElement = fragmentChildren;
|
|
2826
3148
|
return [fragmentChildElement];
|
|
2827
3149
|
}
|
|
@@ -2830,14 +3152,17 @@ function flattenOptionChildren(children) {
|
|
|
2830
3152
|
if (children === undefined || children === null) {
|
|
2831
3153
|
return children;
|
|
2832
3154
|
}
|
|
2833
|
-
|
|
2834
|
-
// Flatten children and warn if they aren't strings or numbers;
|
|
3155
|
+
|
|
3156
|
+
var content = ''; // Flatten children and warn if they aren't strings or numbers;
|
|
2835
3157
|
// invalid types are ignored.
|
|
3158
|
+
|
|
2836
3159
|
React.Children.forEach(children, function (child) {
|
|
2837
3160
|
if (child == null) {
|
|
2838
3161
|
return;
|
|
2839
3162
|
}
|
|
3163
|
+
|
|
2840
3164
|
content += child;
|
|
3165
|
+
|
|
2841
3166
|
{
|
|
2842
3167
|
if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
|
|
2843
3168
|
didWarnInvalidOptionChildren = true;
|
|
@@ -2864,14 +3189,23 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
|
|
|
2864
3189
|
if (!hasOwnProperty.call(props, propKey)) {
|
|
2865
3190
|
continue;
|
|
2866
3191
|
}
|
|
3192
|
+
|
|
3193
|
+
if (enableFlareAPI && propKey === 'listeners') {
|
|
3194
|
+
continue;
|
|
3195
|
+
}
|
|
3196
|
+
|
|
2867
3197
|
var propValue = props[propKey];
|
|
3198
|
+
|
|
2868
3199
|
if (propValue == null) {
|
|
2869
3200
|
continue;
|
|
2870
3201
|
}
|
|
3202
|
+
|
|
2871
3203
|
if (propKey === STYLE) {
|
|
2872
3204
|
propValue = createMarkupForStyles(propValue);
|
|
2873
3205
|
}
|
|
3206
|
+
|
|
2874
3207
|
var markup = null;
|
|
3208
|
+
|
|
2875
3209
|
if (isCustomComponent(tagLowercase, props)) {
|
|
2876
3210
|
if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
|
|
2877
3211
|
markup = createMarkupForCustomAttribute(propKey, propValue);
|
|
@@ -2879,13 +3213,14 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
|
|
|
2879
3213
|
} else {
|
|
2880
3214
|
markup = createMarkupForProperty(propKey, propValue);
|
|
2881
3215
|
}
|
|
3216
|
+
|
|
2882
3217
|
if (markup) {
|
|
2883
3218
|
ret += ' ' + markup;
|
|
2884
3219
|
}
|
|
2885
|
-
}
|
|
2886
|
-
|
|
2887
|
-
// For static pages, no need to put React ID and checksum. Saves lots of
|
|
3220
|
+
} // For static pages, no need to put React ID and checksum. Saves lots of
|
|
2888
3221
|
// bytes.
|
|
3222
|
+
|
|
3223
|
+
|
|
2889
3224
|
if (makeStaticMarkup) {
|
|
2890
3225
|
return ret;
|
|
2891
3226
|
}
|
|
@@ -2893,12 +3228,19 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
|
|
|
2893
3228
|
if (isRootElement) {
|
|
2894
3229
|
ret += ' ' + createMarkupForRoot();
|
|
2895
3230
|
}
|
|
3231
|
+
|
|
2896
3232
|
return ret;
|
|
2897
3233
|
}
|
|
2898
3234
|
|
|
2899
3235
|
function validateRenderResult(child, type) {
|
|
2900
3236
|
if (child === undefined) {
|
|
2901
|
-
|
|
3237
|
+
(function () {
|
|
3238
|
+
{
|
|
3239
|
+
{
|
|
3240
|
+
throw ReactError(Error((getComponentName(type) || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null."));
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
})();
|
|
2902
3244
|
}
|
|
2903
3245
|
}
|
|
2904
3246
|
|
|
@@ -2907,19 +3249,22 @@ function resolve(child, context, threadID) {
|
|
|
2907
3249
|
// Safe because we just checked it's an element.
|
|
2908
3250
|
var element = child;
|
|
2909
3251
|
var Component = element.type;
|
|
3252
|
+
|
|
2910
3253
|
{
|
|
2911
3254
|
pushElementToDebugStack(element);
|
|
2912
3255
|
}
|
|
3256
|
+
|
|
2913
3257
|
if (typeof Component !== 'function') {
|
|
2914
3258
|
break;
|
|
2915
3259
|
}
|
|
3260
|
+
|
|
2916
3261
|
processChild(element, Component);
|
|
2917
|
-
}
|
|
3262
|
+
} // Extra closure so queue and replace can be captured properly
|
|
2918
3263
|
|
|
2919
|
-
// Extra closure so queue and replace can be captured properly
|
|
2920
|
-
function processChild(element, Component) {
|
|
2921
|
-
var publicContext = processContext(Component, context, threadID);
|
|
2922
3264
|
|
|
3265
|
+
function processChild(element, Component) {
|
|
3266
|
+
var isClass = shouldConstruct(Component);
|
|
3267
|
+
var publicContext = processContext(Component, context, threadID, isClass);
|
|
2923
3268
|
var queue = [];
|
|
2924
3269
|
var replace = false;
|
|
2925
3270
|
var updater = {
|
|
@@ -2941,18 +3286,20 @@ function resolve(child, context, threadID) {
|
|
|
2941
3286
|
warnNoop(publicInstance, 'setState');
|
|
2942
3287
|
return null;
|
|
2943
3288
|
}
|
|
3289
|
+
|
|
2944
3290
|
queue.push(currentPartialState);
|
|
2945
3291
|
}
|
|
2946
3292
|
};
|
|
3293
|
+
var inst;
|
|
2947
3294
|
|
|
2948
|
-
|
|
2949
|
-
if (shouldConstruct(Component)) {
|
|
3295
|
+
if (isClass) {
|
|
2950
3296
|
inst = new Component(element.props, publicContext, updater);
|
|
2951
3297
|
|
|
2952
3298
|
if (typeof Component.getDerivedStateFromProps === 'function') {
|
|
2953
3299
|
{
|
|
2954
3300
|
if (inst.state === null || inst.state === undefined) {
|
|
2955
3301
|
var componentName = getComponentName(Component) || 'Unknown';
|
|
3302
|
+
|
|
2956
3303
|
if (!didWarnAboutUninitializedState[componentName]) {
|
|
2957
3304
|
warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, inst.state === null ? 'null' : 'undefined', componentName);
|
|
2958
3305
|
didWarnAboutUninitializedState[componentName] = true;
|
|
@@ -2965,6 +3312,7 @@ function resolve(child, context, threadID) {
|
|
|
2965
3312
|
{
|
|
2966
3313
|
if (partialState === undefined) {
|
|
2967
3314
|
var _componentName = getComponentName(Component) || 'Unknown';
|
|
3315
|
+
|
|
2968
3316
|
if (!didWarnAboutUndefinedDerivedState[_componentName]) {
|
|
2969
3317
|
warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
|
|
2970
3318
|
didWarnAboutUndefinedDerivedState[_componentName] = true;
|
|
@@ -2987,6 +3335,7 @@ function resolve(child, context, threadID) {
|
|
|
2987
3335
|
}
|
|
2988
3336
|
}
|
|
2989
3337
|
}
|
|
3338
|
+
|
|
2990
3339
|
var componentIdentity = {};
|
|
2991
3340
|
prepareToUseHooks(componentIdentity);
|
|
2992
3341
|
inst = Component(element.props, publicContext, updater);
|
|
@@ -2997,40 +3346,53 @@ function resolve(child, context, threadID) {
|
|
|
2997
3346
|
validateRenderResult(child, Component);
|
|
2998
3347
|
return;
|
|
2999
3348
|
}
|
|
3349
|
+
|
|
3350
|
+
{
|
|
3351
|
+
var _componentName3 = getComponentName(Component) || 'Unknown';
|
|
3352
|
+
|
|
3353
|
+
if (!didWarnAboutModulePatternComponent[_componentName3]) {
|
|
3354
|
+
warningWithoutStack$1(false, 'The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName3, _componentName3, _componentName3);
|
|
3355
|
+
didWarnAboutModulePatternComponent[_componentName3] = true;
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3000
3358
|
}
|
|
3001
3359
|
|
|
3002
3360
|
inst.props = element.props;
|
|
3003
3361
|
inst.context = publicContext;
|
|
3004
3362
|
inst.updater = updater;
|
|
3005
|
-
|
|
3006
3363
|
var initialState = inst.state;
|
|
3364
|
+
|
|
3007
3365
|
if (initialState === undefined) {
|
|
3008
3366
|
inst.state = initialState = null;
|
|
3009
3367
|
}
|
|
3368
|
+
|
|
3010
3369
|
if (typeof inst.UNSAFE_componentWillMount === 'function' || typeof inst.componentWillMount === 'function') {
|
|
3011
3370
|
if (typeof inst.componentWillMount === 'function') {
|
|
3012
3371
|
{
|
|
3013
3372
|
if (warnAboutDeprecatedLifecycles && inst.componentWillMount.__suppressDeprecationWarning !== true) {
|
|
3014
|
-
var
|
|
3373
|
+
var _componentName4 = getComponentName(Component) || 'Unknown';
|
|
3015
3374
|
|
|
3016
|
-
if (!didWarnAboutDeprecatedWillMount[
|
|
3017
|
-
|
|
3018
|
-
|
|
3375
|
+
if (!didWarnAboutDeprecatedWillMount[_componentName4]) {
|
|
3376
|
+
lowPriorityWarningWithoutStack$1(false, // keep this warning in sync with ReactStrictModeWarning.js
|
|
3377
|
+
'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code from componentWillMount to componentDidMount (preferred in most cases) ' + 'or the constructor.\n' + '\nPlease update the following components: %s', _componentName4);
|
|
3378
|
+
didWarnAboutDeprecatedWillMount[_componentName4] = true;
|
|
3019
3379
|
}
|
|
3020
3380
|
}
|
|
3021
|
-
}
|
|
3022
|
-
|
|
3023
|
-
// In order to support react-lifecycles-compat polyfilled components,
|
|
3381
|
+
} // In order to support react-lifecycles-compat polyfilled components,
|
|
3024
3382
|
// Unsafe lifecycles should not be invoked for any component with the new gDSFP.
|
|
3383
|
+
|
|
3384
|
+
|
|
3025
3385
|
if (typeof Component.getDerivedStateFromProps !== 'function') {
|
|
3026
3386
|
inst.componentWillMount();
|
|
3027
3387
|
}
|
|
3028
3388
|
}
|
|
3389
|
+
|
|
3029
3390
|
if (typeof inst.UNSAFE_componentWillMount === 'function' && typeof Component.getDerivedStateFromProps !== 'function') {
|
|
3030
3391
|
// In order to support react-lifecycles-compat polyfilled components,
|
|
3031
3392
|
// Unsafe lifecycles should not be invoked for any component with the new gDSFP.
|
|
3032
3393
|
inst.UNSAFE_componentWillMount();
|
|
3033
3394
|
}
|
|
3395
|
+
|
|
3034
3396
|
if (queue.length) {
|
|
3035
3397
|
var oldQueue = queue;
|
|
3036
3398
|
var oldReplace = replace;
|
|
@@ -3042,9 +3404,12 @@ function resolve(child, context, threadID) {
|
|
|
3042
3404
|
} else {
|
|
3043
3405
|
var nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
3044
3406
|
var dontMutate = true;
|
|
3407
|
+
|
|
3045
3408
|
for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
|
|
3046
3409
|
var partial = oldQueue[i];
|
|
3410
|
+
|
|
3047
3411
|
var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
|
|
3412
|
+
|
|
3048
3413
|
if (_partialState != null) {
|
|
3049
3414
|
if (dontMutate) {
|
|
3050
3415
|
dontMutate = false;
|
|
@@ -3054,12 +3419,14 @@ function resolve(child, context, threadID) {
|
|
|
3054
3419
|
}
|
|
3055
3420
|
}
|
|
3056
3421
|
}
|
|
3422
|
+
|
|
3057
3423
|
inst.state = nextState;
|
|
3058
3424
|
}
|
|
3059
3425
|
} else {
|
|
3060
3426
|
queue = null;
|
|
3061
3427
|
}
|
|
3062
3428
|
}
|
|
3429
|
+
|
|
3063
3430
|
child = inst.render();
|
|
3064
3431
|
|
|
3065
3432
|
{
|
|
@@ -3069,36 +3436,58 @@ function resolve(child, context, threadID) {
|
|
|
3069
3436
|
child = null;
|
|
3070
3437
|
}
|
|
3071
3438
|
}
|
|
3439
|
+
|
|
3072
3440
|
validateRenderResult(child, Component);
|
|
3441
|
+
var childContext;
|
|
3442
|
+
|
|
3443
|
+
if (disableLegacyContext) {
|
|
3444
|
+
{
|
|
3445
|
+
var childContextTypes = Component.childContextTypes;
|
|
3073
3446
|
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
var childContextTypes = Component.childContextTypes;
|
|
3077
|
-
if (typeof childContextTypes === 'object') {
|
|
3078
|
-
childContext = inst.getChildContext();
|
|
3079
|
-
for (var contextKey in childContext) {
|
|
3080
|
-
!(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
|
|
3447
|
+
if (childContextTypes !== undefined) {
|
|
3448
|
+
warningWithoutStack$1(false, '%s uses the legacy childContextTypes API which is no longer supported. ' + 'Use React.createContext() instead.', getComponentName(Component) || 'Unknown');
|
|
3081
3449
|
}
|
|
3082
|
-
} else {
|
|
3083
|
-
warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
|
|
3084
3450
|
}
|
|
3085
|
-
}
|
|
3086
|
-
|
|
3087
|
-
|
|
3451
|
+
} else {
|
|
3452
|
+
if (typeof inst.getChildContext === 'function') {
|
|
3453
|
+
var _childContextTypes = Component.childContextTypes;
|
|
3454
|
+
|
|
3455
|
+
if (typeof _childContextTypes === 'object') {
|
|
3456
|
+
childContext = inst.getChildContext();
|
|
3457
|
+
|
|
3458
|
+
for (var contextKey in childContext) {
|
|
3459
|
+
(function () {
|
|
3460
|
+
if (!(contextKey in _childContextTypes)) {
|
|
3461
|
+
{
|
|
3462
|
+
throw ReactError(Error((getComponentName(Component) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."));
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
})();
|
|
3466
|
+
}
|
|
3467
|
+
} else {
|
|
3468
|
+
warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
if (childContext) {
|
|
3473
|
+
context = _assign({}, context, childContext);
|
|
3474
|
+
}
|
|
3088
3475
|
}
|
|
3089
3476
|
}
|
|
3090
|
-
return { child: child, context: context };
|
|
3091
|
-
}
|
|
3092
3477
|
|
|
3093
|
-
|
|
3094
|
-
|
|
3478
|
+
return {
|
|
3479
|
+
child: child,
|
|
3480
|
+
context: context
|
|
3481
|
+
};
|
|
3482
|
+
}
|
|
3095
3483
|
|
|
3484
|
+
var ReactDOMServerRenderer =
|
|
3485
|
+
/*#__PURE__*/
|
|
3486
|
+
function () {
|
|
3096
3487
|
// TODO: type this more strictly:
|
|
3488
|
+
// DEV-only
|
|
3097
3489
|
function ReactDOMServerRenderer(children, makeStaticMarkup) {
|
|
3098
|
-
_classCallCheck(this, ReactDOMServerRenderer);
|
|
3099
|
-
|
|
3100
3490
|
var flatChildren = flattenTopLevelChildren(children);
|
|
3101
|
-
|
|
3102
3491
|
var topFrame = {
|
|
3103
3492
|
type: null,
|
|
3104
3493
|
// Assume all trees start in the HTML namespace (not totally true, but
|
|
@@ -3109,34 +3498,37 @@ var ReactDOMServerRenderer = function () {
|
|
|
3109
3498
|
context: emptyObject,
|
|
3110
3499
|
footer: ''
|
|
3111
3500
|
};
|
|
3501
|
+
|
|
3112
3502
|
{
|
|
3113
3503
|
topFrame.debugElementStack = [];
|
|
3114
3504
|
}
|
|
3505
|
+
|
|
3115
3506
|
this.threadID = allocThreadID();
|
|
3116
3507
|
this.stack = [topFrame];
|
|
3117
3508
|
this.exhausted = false;
|
|
3118
3509
|
this.currentSelectValue = null;
|
|
3119
3510
|
this.previousWasTextNode = false;
|
|
3120
3511
|
this.makeStaticMarkup = makeStaticMarkup;
|
|
3121
|
-
this.suspenseDepth = 0;
|
|
3512
|
+
this.suspenseDepth = 0; // Context (new API)
|
|
3122
3513
|
|
|
3123
|
-
// Context (new API)
|
|
3124
3514
|
this.contextIndex = -1;
|
|
3125
3515
|
this.contextStack = [];
|
|
3126
3516
|
this.contextValueStack = [];
|
|
3517
|
+
|
|
3127
3518
|
{
|
|
3128
3519
|
this.contextProviderStack = [];
|
|
3129
3520
|
}
|
|
3130
3521
|
}
|
|
3131
3522
|
|
|
3132
|
-
ReactDOMServerRenderer.prototype
|
|
3523
|
+
var _proto = ReactDOMServerRenderer.prototype;
|
|
3524
|
+
|
|
3525
|
+
_proto.destroy = function destroy() {
|
|
3133
3526
|
if (!this.exhausted) {
|
|
3134
3527
|
this.exhausted = true;
|
|
3135
3528
|
this.clearProviders();
|
|
3136
3529
|
freeThreadID(this.threadID);
|
|
3137
3530
|
}
|
|
3138
|
-
}
|
|
3139
|
-
|
|
3531
|
+
}
|
|
3140
3532
|
/**
|
|
3141
3533
|
* Note: We use just two stacks regardless of how many context providers you have.
|
|
3142
3534
|
* Providers are always popped in the reverse order to how they were pushed
|
|
@@ -3146,61 +3538,65 @@ var ReactDOMServerRenderer = function () {
|
|
|
3146
3538
|
* provider needs to be "restored" to which value.
|
|
3147
3539
|
* https://github.com/facebook/react/pull/12985#issuecomment-396301248
|
|
3148
3540
|
*/
|
|
3541
|
+
;
|
|
3149
3542
|
|
|
3150
|
-
|
|
3543
|
+
_proto.pushProvider = function pushProvider(provider) {
|
|
3151
3544
|
var index = ++this.contextIndex;
|
|
3152
3545
|
var context = provider.type._context;
|
|
3153
3546
|
var threadID = this.threadID;
|
|
3154
3547
|
validateContextBounds(context, threadID);
|
|
3155
|
-
var previousValue = context[threadID];
|
|
3548
|
+
var previousValue = context[threadID]; // Remember which value to restore this context to on our way up.
|
|
3156
3549
|
|
|
3157
|
-
// Remember which value to restore this context to on our way up.
|
|
3158
3550
|
this.contextStack[index] = context;
|
|
3159
3551
|
this.contextValueStack[index] = previousValue;
|
|
3552
|
+
|
|
3160
3553
|
{
|
|
3161
3554
|
// Only used for push/pop mismatch warnings.
|
|
3162
3555
|
this.contextProviderStack[index] = provider;
|
|
3163
|
-
}
|
|
3556
|
+
} // Mutate the current value.
|
|
3557
|
+
|
|
3164
3558
|
|
|
3165
|
-
// Mutate the current value.
|
|
3166
3559
|
context[threadID] = provider.props.value;
|
|
3167
3560
|
};
|
|
3168
3561
|
|
|
3169
|
-
|
|
3562
|
+
_proto.popProvider = function popProvider(provider) {
|
|
3170
3563
|
var index = this.contextIndex;
|
|
3564
|
+
|
|
3171
3565
|
{
|
|
3172
3566
|
!(index > -1 && provider === this.contextProviderStack[index]) ? warningWithoutStack$1(false, 'Unexpected pop.') : void 0;
|
|
3173
3567
|
}
|
|
3174
3568
|
|
|
3175
3569
|
var context = this.contextStack[index];
|
|
3176
|
-
var previousValue = this.contextValueStack[index];
|
|
3177
|
-
|
|
3178
|
-
// "Hide" these null assignments from Flow by using `any`
|
|
3570
|
+
var previousValue = this.contextValueStack[index]; // "Hide" these null assignments from Flow by using `any`
|
|
3179
3571
|
// because conceptually they are deletions--as long as we
|
|
3180
3572
|
// promise to never access values beyond `this.contextIndex`.
|
|
3573
|
+
|
|
3181
3574
|
this.contextStack[index] = null;
|
|
3182
3575
|
this.contextValueStack[index] = null;
|
|
3576
|
+
|
|
3183
3577
|
{
|
|
3184
3578
|
this.contextProviderStack[index] = null;
|
|
3185
3579
|
}
|
|
3186
|
-
this.contextIndex--;
|
|
3187
3580
|
|
|
3188
|
-
// Restore to the previous value we stored as we were walking down.
|
|
3581
|
+
this.contextIndex--; // Restore to the previous value we stored as we were walking down.
|
|
3189
3582
|
// We've already verified that this context has been expanded to accommodate
|
|
3190
3583
|
// this thread id, so we don't need to do it again.
|
|
3584
|
+
|
|
3191
3585
|
context[this.threadID] = previousValue;
|
|
3192
3586
|
};
|
|
3193
3587
|
|
|
3194
|
-
|
|
3588
|
+
_proto.clearProviders = function clearProviders() {
|
|
3195
3589
|
// Restore any remaining providers on the stack to previous values
|
|
3196
3590
|
for (var index = this.contextIndex; index >= 0; index--) {
|
|
3197
|
-
var
|
|
3591
|
+
var context = this.contextStack[index];
|
|
3198
3592
|
var previousValue = this.contextValueStack[index];
|
|
3199
|
-
|
|
3593
|
+
context[this.threadID] = previousValue;
|
|
3200
3594
|
}
|
|
3201
3595
|
};
|
|
3202
3596
|
|
|
3203
|
-
|
|
3597
|
+
_proto.read = function read(bytes) {
|
|
3598
|
+
var _this = this;
|
|
3599
|
+
|
|
3204
3600
|
if (this.exhausted) {
|
|
3205
3601
|
return null;
|
|
3206
3602
|
}
|
|
@@ -3209,24 +3605,31 @@ var ReactDOMServerRenderer = function () {
|
|
|
3209
3605
|
setCurrentThreadID(this.threadID);
|
|
3210
3606
|
var prevDispatcher = ReactCurrentDispatcher.current;
|
|
3211
3607
|
ReactCurrentDispatcher.current = Dispatcher;
|
|
3608
|
+
|
|
3212
3609
|
try {
|
|
3213
3610
|
// Markup generated within <Suspense> ends up buffered until we know
|
|
3214
3611
|
// nothing in that boundary suspended
|
|
3215
3612
|
var out = [''];
|
|
3216
3613
|
var suspended = false;
|
|
3614
|
+
|
|
3217
3615
|
while (out[0].length < bytes) {
|
|
3218
3616
|
if (this.stack.length === 0) {
|
|
3219
3617
|
this.exhausted = true;
|
|
3220
3618
|
freeThreadID(this.threadID);
|
|
3221
3619
|
break;
|
|
3222
3620
|
}
|
|
3621
|
+
|
|
3223
3622
|
var frame = this.stack[this.stack.length - 1];
|
|
3623
|
+
|
|
3224
3624
|
if (suspended || frame.childIndex >= frame.children.length) {
|
|
3225
|
-
var
|
|
3226
|
-
|
|
3625
|
+
var footer = frame.footer;
|
|
3626
|
+
|
|
3627
|
+
if (footer !== '') {
|
|
3227
3628
|
this.previousWasTextNode = false;
|
|
3228
3629
|
}
|
|
3630
|
+
|
|
3229
3631
|
this.stack.pop();
|
|
3632
|
+
|
|
3230
3633
|
if (frame.type === 'select') {
|
|
3231
3634
|
this.currentSelectValue = null;
|
|
3232
3635
|
} else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
|
|
@@ -3237,35 +3640,64 @@ var ReactDOMServerRenderer = function () {
|
|
|
3237
3640
|
var buffered = out.pop();
|
|
3238
3641
|
|
|
3239
3642
|
if (suspended) {
|
|
3240
|
-
suspended = false;
|
|
3241
|
-
|
|
3242
|
-
var
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3643
|
+
suspended = false; // If rendering was suspended at this boundary, render the fallbackFrame
|
|
3644
|
+
|
|
3645
|
+
var fallbackFrame = frame.fallbackFrame;
|
|
3646
|
+
|
|
3647
|
+
(function () {
|
|
3648
|
+
if (!fallbackFrame) {
|
|
3649
|
+
{
|
|
3650
|
+
throw ReactError(Error("ReactDOMServer did not find an internal fallback frame for Suspense. This is a bug in React. Please file an issue."));
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
})();
|
|
3654
|
+
|
|
3655
|
+
this.stack.push(fallbackFrame);
|
|
3656
|
+
out[this.suspenseDepth] += '<!--$!-->'; // Skip flushing output since we're switching to the fallback
|
|
3657
|
+
|
|
3246
3658
|
continue;
|
|
3247
3659
|
} else {
|
|
3248
3660
|
out[this.suspenseDepth] += buffered;
|
|
3249
3661
|
}
|
|
3250
|
-
}
|
|
3662
|
+
} // Flush output
|
|
3251
3663
|
|
|
3252
|
-
|
|
3253
|
-
out[this.suspenseDepth] +=
|
|
3664
|
+
|
|
3665
|
+
out[this.suspenseDepth] += footer;
|
|
3254
3666
|
continue;
|
|
3255
3667
|
}
|
|
3256
|
-
var child = frame.children[frame.childIndex++];
|
|
3257
3668
|
|
|
3669
|
+
var child = frame.children[frame.childIndex++];
|
|
3258
3670
|
var outBuffer = '';
|
|
3671
|
+
|
|
3259
3672
|
{
|
|
3260
|
-
pushCurrentDebugStack(this.stack);
|
|
3261
|
-
|
|
3673
|
+
pushCurrentDebugStack(this.stack); // We're starting work on this frame, so reset its inner stack.
|
|
3674
|
+
|
|
3262
3675
|
frame.debugElementStack.length = 0;
|
|
3263
3676
|
}
|
|
3677
|
+
|
|
3264
3678
|
try {
|
|
3265
3679
|
outBuffer += this.render(child, frame.context, frame.domNamespace);
|
|
3266
3680
|
} catch (err) {
|
|
3267
|
-
if (
|
|
3268
|
-
|
|
3681
|
+
if (err != null && typeof err.then === 'function') {
|
|
3682
|
+
if (enableSuspenseServerRenderer) {
|
|
3683
|
+
(function () {
|
|
3684
|
+
if (!(_this.suspenseDepth > 0)) {
|
|
3685
|
+
{
|
|
3686
|
+
throw ReactError(Error("A React component suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."));
|
|
3687
|
+
}
|
|
3688
|
+
}
|
|
3689
|
+
})();
|
|
3690
|
+
|
|
3691
|
+
suspended = true;
|
|
3692
|
+
} else {
|
|
3693
|
+
(function () {
|
|
3694
|
+
{
|
|
3695
|
+
{
|
|
3696
|
+
throw ReactError(Error("ReactDOMServer does not yet support Suspense."));
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
})();
|
|
3700
|
+
}
|
|
3269
3701
|
} else {
|
|
3270
3702
|
throw err;
|
|
3271
3703
|
}
|
|
@@ -3274,11 +3706,14 @@ var ReactDOMServerRenderer = function () {
|
|
|
3274
3706
|
popCurrentDebugStack();
|
|
3275
3707
|
}
|
|
3276
3708
|
}
|
|
3709
|
+
|
|
3277
3710
|
if (out.length <= this.suspenseDepth) {
|
|
3278
3711
|
out.push('');
|
|
3279
3712
|
}
|
|
3713
|
+
|
|
3280
3714
|
out[this.suspenseDepth] += outBuffer;
|
|
3281
3715
|
}
|
|
3716
|
+
|
|
3282
3717
|
return out[0];
|
|
3283
3718
|
} finally {
|
|
3284
3719
|
ReactCurrentDispatcher.current = prevDispatcher;
|
|
@@ -3286,22 +3721,26 @@ var ReactDOMServerRenderer = function () {
|
|
|
3286
3721
|
}
|
|
3287
3722
|
};
|
|
3288
3723
|
|
|
3289
|
-
|
|
3724
|
+
_proto.render = function render(child, context, parentNamespace) {
|
|
3290
3725
|
if (typeof child === 'string' || typeof child === 'number') {
|
|
3291
3726
|
var text = '' + child;
|
|
3727
|
+
|
|
3292
3728
|
if (text === '') {
|
|
3293
3729
|
return '';
|
|
3294
3730
|
}
|
|
3731
|
+
|
|
3295
3732
|
if (this.makeStaticMarkup) {
|
|
3296
3733
|
return escapeTextForBrowser(text);
|
|
3297
3734
|
}
|
|
3735
|
+
|
|
3298
3736
|
if (this.previousWasTextNode) {
|
|
3299
3737
|
return '<!-- -->' + escapeTextForBrowser(text);
|
|
3300
3738
|
}
|
|
3739
|
+
|
|
3301
3740
|
this.previousWasTextNode = true;
|
|
3302
3741
|
return escapeTextForBrowser(text);
|
|
3303
3742
|
} else {
|
|
3304
|
-
var nextChild
|
|
3743
|
+
var nextChild;
|
|
3305
3744
|
|
|
3306
3745
|
var _resolve = resolve(child, context, this.threadID);
|
|
3307
3746
|
|
|
@@ -3314,10 +3753,25 @@ var ReactDOMServerRenderer = function () {
|
|
|
3314
3753
|
if (nextChild != null && nextChild.$$typeof != null) {
|
|
3315
3754
|
// Catch unexpected special types early.
|
|
3316
3755
|
var $$typeof = nextChild.$$typeof;
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3756
|
+
|
|
3757
|
+
(function () {
|
|
3758
|
+
if (!($$typeof !== REACT_PORTAL_TYPE)) {
|
|
3759
|
+
{
|
|
3760
|
+
throw ReactError(Error("Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render."));
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
})(); // Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
|
|
3764
|
+
|
|
3765
|
+
|
|
3766
|
+
(function () {
|
|
3767
|
+
{
|
|
3768
|
+
{
|
|
3769
|
+
throw ReactError(Error("Unknown element-like object type: " + $$typeof.toString() + ". This is likely a bug in React. Please file an issue."));
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
})();
|
|
3320
3773
|
}
|
|
3774
|
+
|
|
3321
3775
|
var nextChildren = toArray(nextChild);
|
|
3322
3776
|
var frame = {
|
|
3323
3777
|
type: null,
|
|
@@ -3327,13 +3781,16 @@ var ReactDOMServerRenderer = function () {
|
|
|
3327
3781
|
context: context,
|
|
3328
3782
|
footer: ''
|
|
3329
3783
|
};
|
|
3784
|
+
|
|
3330
3785
|
{
|
|
3331
3786
|
frame.debugElementStack = [];
|
|
3332
3787
|
}
|
|
3788
|
+
|
|
3333
3789
|
this.stack.push(frame);
|
|
3334
3790
|
return '';
|
|
3335
|
-
}
|
|
3336
|
-
|
|
3791
|
+
} // Safe because we just checked it's an element.
|
|
3792
|
+
|
|
3793
|
+
|
|
3337
3794
|
var nextElement = nextChild;
|
|
3338
3795
|
var elementType = nextElement.type;
|
|
3339
3796
|
|
|
@@ -3345,9 +3802,11 @@ var ReactDOMServerRenderer = function () {
|
|
|
3345
3802
|
case REACT_STRICT_MODE_TYPE:
|
|
3346
3803
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
3347
3804
|
case REACT_PROFILER_TYPE:
|
|
3805
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
3348
3806
|
case REACT_FRAGMENT_TYPE:
|
|
3349
3807
|
{
|
|
3350
3808
|
var _nextChildren = toArray(nextChild.props.children);
|
|
3809
|
+
|
|
3351
3810
|
var _frame = {
|
|
3352
3811
|
type: null,
|
|
3353
3812
|
domNamespace: parentNamespace,
|
|
@@ -3356,19 +3815,24 @@ var ReactDOMServerRenderer = function () {
|
|
|
3356
3815
|
context: context,
|
|
3357
3816
|
footer: ''
|
|
3358
3817
|
};
|
|
3818
|
+
|
|
3359
3819
|
{
|
|
3360
3820
|
_frame.debugElementStack = [];
|
|
3361
3821
|
}
|
|
3822
|
+
|
|
3362
3823
|
this.stack.push(_frame);
|
|
3363
3824
|
return '';
|
|
3364
3825
|
}
|
|
3826
|
+
|
|
3365
3827
|
case REACT_SUSPENSE_TYPE:
|
|
3366
3828
|
{
|
|
3367
3829
|
if (enableSuspenseServerRenderer) {
|
|
3368
3830
|
var fallback = nextChild.props.fallback;
|
|
3831
|
+
|
|
3369
3832
|
if (fallback === undefined) {
|
|
3370
3833
|
// If there is no fallback, then this just behaves as a fragment.
|
|
3371
3834
|
var _nextChildren3 = toArray(nextChild.props.children);
|
|
3835
|
+
|
|
3372
3836
|
var _frame3 = {
|
|
3373
3837
|
type: null,
|
|
3374
3838
|
domNamespace: parentNamespace,
|
|
@@ -3377,25 +3841,29 @@ var ReactDOMServerRenderer = function () {
|
|
|
3377
3841
|
context: context,
|
|
3378
3842
|
footer: ''
|
|
3379
3843
|
};
|
|
3844
|
+
|
|
3380
3845
|
{
|
|
3381
3846
|
_frame3.debugElementStack = [];
|
|
3382
3847
|
}
|
|
3848
|
+
|
|
3383
3849
|
this.stack.push(_frame3);
|
|
3384
3850
|
return '';
|
|
3385
3851
|
}
|
|
3852
|
+
|
|
3386
3853
|
var fallbackChildren = toArray(fallback);
|
|
3854
|
+
|
|
3387
3855
|
var _nextChildren2 = toArray(nextChild.props.children);
|
|
3388
|
-
|
|
3856
|
+
|
|
3857
|
+
var fallbackFrame = {
|
|
3389
3858
|
type: null,
|
|
3390
3859
|
domNamespace: parentNamespace,
|
|
3391
3860
|
children: fallbackChildren,
|
|
3392
3861
|
childIndex: 0,
|
|
3393
3862
|
context: context,
|
|
3394
|
-
footer: ''
|
|
3395
|
-
out: ''
|
|
3863
|
+
footer: '<!--/$-->'
|
|
3396
3864
|
};
|
|
3397
3865
|
var _frame2 = {
|
|
3398
|
-
fallbackFrame:
|
|
3866
|
+
fallbackFrame: fallbackFrame,
|
|
3399
3867
|
type: REACT_SUSPENSE_TYPE,
|
|
3400
3868
|
domNamespace: parentNamespace,
|
|
3401
3869
|
children: _nextChildren2,
|
|
@@ -3403,27 +3871,39 @@ var ReactDOMServerRenderer = function () {
|
|
|
3403
3871
|
context: context,
|
|
3404
3872
|
footer: '<!--/$-->'
|
|
3405
3873
|
};
|
|
3874
|
+
|
|
3406
3875
|
{
|
|
3407
3876
|
_frame2.debugElementStack = [];
|
|
3408
|
-
|
|
3877
|
+
fallbackFrame.debugElementStack = [];
|
|
3409
3878
|
}
|
|
3879
|
+
|
|
3410
3880
|
this.stack.push(_frame2);
|
|
3411
3881
|
this.suspenseDepth++;
|
|
3412
3882
|
return '<!--$-->';
|
|
3413
3883
|
} else {
|
|
3414
|
-
|
|
3884
|
+
(function () {
|
|
3885
|
+
{
|
|
3886
|
+
{
|
|
3887
|
+
throw ReactError(Error("ReactDOMServer does not yet support Suspense."));
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
})();
|
|
3415
3891
|
}
|
|
3416
3892
|
}
|
|
3417
3893
|
// eslint-disable-next-line-no-fallthrough
|
|
3894
|
+
|
|
3418
3895
|
default:
|
|
3419
3896
|
break;
|
|
3420
3897
|
}
|
|
3898
|
+
|
|
3421
3899
|
if (typeof elementType === 'object' && elementType !== null) {
|
|
3422
3900
|
switch (elementType.$$typeof) {
|
|
3423
3901
|
case REACT_FORWARD_REF_TYPE:
|
|
3424
3902
|
{
|
|
3425
3903
|
var element = nextChild;
|
|
3426
|
-
|
|
3904
|
+
|
|
3905
|
+
var _nextChildren4;
|
|
3906
|
+
|
|
3427
3907
|
var componentIdentity = {};
|
|
3428
3908
|
prepareToUseHooks(componentIdentity);
|
|
3429
3909
|
_nextChildren4 = elementType.render(element.props, element.ref);
|
|
@@ -3437,16 +3917,21 @@ var ReactDOMServerRenderer = function () {
|
|
|
3437
3917
|
context: context,
|
|
3438
3918
|
footer: ''
|
|
3439
3919
|
};
|
|
3920
|
+
|
|
3440
3921
|
{
|
|
3441
3922
|
_frame4.debugElementStack = [];
|
|
3442
3923
|
}
|
|
3924
|
+
|
|
3443
3925
|
this.stack.push(_frame4);
|
|
3444
3926
|
return '';
|
|
3445
3927
|
}
|
|
3928
|
+
|
|
3446
3929
|
case REACT_MEMO_TYPE:
|
|
3447
3930
|
{
|
|
3448
3931
|
var _element = nextChild;
|
|
3449
|
-
var _nextChildren5 = [React.createElement(elementType.type, _assign({
|
|
3932
|
+
var _nextChildren5 = [React.createElement(elementType.type, _assign({
|
|
3933
|
+
ref: _element.ref
|
|
3934
|
+
}, _element.props))];
|
|
3450
3935
|
var _frame5 = {
|
|
3451
3936
|
type: null,
|
|
3452
3937
|
domNamespace: parentNamespace,
|
|
@@ -3455,17 +3940,22 @@ var ReactDOMServerRenderer = function () {
|
|
|
3455
3940
|
context: context,
|
|
3456
3941
|
footer: ''
|
|
3457
3942
|
};
|
|
3943
|
+
|
|
3458
3944
|
{
|
|
3459
3945
|
_frame5.debugElementStack = [];
|
|
3460
3946
|
}
|
|
3947
|
+
|
|
3461
3948
|
this.stack.push(_frame5);
|
|
3462
3949
|
return '';
|
|
3463
3950
|
}
|
|
3951
|
+
|
|
3464
3952
|
case REACT_PROVIDER_TYPE:
|
|
3465
3953
|
{
|
|
3466
3954
|
var provider = nextChild;
|
|
3467
3955
|
var nextProps = provider.props;
|
|
3956
|
+
|
|
3468
3957
|
var _nextChildren6 = toArray(nextProps.children);
|
|
3958
|
+
|
|
3469
3959
|
var _frame6 = {
|
|
3470
3960
|
type: provider,
|
|
3471
3961
|
domNamespace: parentNamespace,
|
|
@@ -3474,25 +3964,26 @@ var ReactDOMServerRenderer = function () {
|
|
|
3474
3964
|
context: context,
|
|
3475
3965
|
footer: ''
|
|
3476
3966
|
};
|
|
3967
|
+
|
|
3477
3968
|
{
|
|
3478
3969
|
_frame6.debugElementStack = [];
|
|
3479
3970
|
}
|
|
3480
3971
|
|
|
3481
3972
|
this.pushProvider(provider);
|
|
3482
|
-
|
|
3483
3973
|
this.stack.push(_frame6);
|
|
3484
3974
|
return '';
|
|
3485
3975
|
}
|
|
3976
|
+
|
|
3486
3977
|
case REACT_CONTEXT_TYPE:
|
|
3487
3978
|
{
|
|
3488
|
-
var reactContext = nextChild.type;
|
|
3489
|
-
// The logic below for Context differs depending on PROD or DEV mode. In
|
|
3979
|
+
var reactContext = nextChild.type; // The logic below for Context differs depending on PROD or DEV mode. In
|
|
3490
3980
|
// DEV mode, we create a separate object for Context.Consumer that acts
|
|
3491
3981
|
// like a proxy to Context. This proxy object adds unnecessary code in PROD
|
|
3492
3982
|
// so we use the old behaviour (Context.Consumer references Context) to
|
|
3493
3983
|
// reduce size and overhead. The separate object references context via
|
|
3494
3984
|
// a property called "_context", which also gives us the ability to check
|
|
3495
3985
|
// in DEV mode if this property exists or not and warn if it does not.
|
|
3986
|
+
|
|
3496
3987
|
{
|
|
3497
3988
|
if (reactContext._context === undefined) {
|
|
3498
3989
|
// This may be because it's a Context (rather than a Consumer).
|
|
@@ -3508,12 +3999,14 @@ var ReactDOMServerRenderer = function () {
|
|
|
3508
3999
|
reactContext = reactContext._context;
|
|
3509
4000
|
}
|
|
3510
4001
|
}
|
|
4002
|
+
|
|
3511
4003
|
var _nextProps = nextChild.props;
|
|
3512
4004
|
var threadID = this.threadID;
|
|
3513
4005
|
validateContextBounds(reactContext, threadID);
|
|
3514
4006
|
var nextValue = reactContext[threadID];
|
|
3515
4007
|
|
|
3516
4008
|
var _nextChildren7 = toArray(_nextProps.children(nextValue));
|
|
4009
|
+
|
|
3517
4010
|
var _frame7 = {
|
|
3518
4011
|
type: nextChild,
|
|
3519
4012
|
domNamespace: parentNamespace,
|
|
@@ -3522,36 +4015,165 @@ var ReactDOMServerRenderer = function () {
|
|
|
3522
4015
|
context: context,
|
|
3523
4016
|
footer: ''
|
|
3524
4017
|
};
|
|
4018
|
+
|
|
3525
4019
|
{
|
|
3526
4020
|
_frame7.debugElementStack = [];
|
|
3527
4021
|
}
|
|
4022
|
+
|
|
3528
4023
|
this.stack.push(_frame7);
|
|
3529
4024
|
return '';
|
|
3530
4025
|
}
|
|
4026
|
+
// eslint-disable-next-line-no-fallthrough
|
|
4027
|
+
|
|
4028
|
+
case REACT_FUNDAMENTAL_TYPE:
|
|
4029
|
+
{
|
|
4030
|
+
if (enableFundamentalAPI) {
|
|
4031
|
+
var fundamentalImpl = elementType.impl;
|
|
4032
|
+
var open = fundamentalImpl.getServerSideString(null, nextElement.props);
|
|
4033
|
+
var getServerSideStringClose = fundamentalImpl.getServerSideStringClose;
|
|
4034
|
+
var close = getServerSideStringClose !== undefined ? getServerSideStringClose(null, nextElement.props) : '';
|
|
4035
|
+
|
|
4036
|
+
var _nextChildren8 = fundamentalImpl.reconcileChildren !== false ? toArray(nextChild.props.children) : [];
|
|
4037
|
+
|
|
4038
|
+
var _frame8 = {
|
|
4039
|
+
type: null,
|
|
4040
|
+
domNamespace: parentNamespace,
|
|
4041
|
+
children: _nextChildren8,
|
|
4042
|
+
childIndex: 0,
|
|
4043
|
+
context: context,
|
|
4044
|
+
footer: close
|
|
4045
|
+
};
|
|
4046
|
+
|
|
4047
|
+
{
|
|
4048
|
+
_frame8.debugElementStack = [];
|
|
4049
|
+
}
|
|
4050
|
+
|
|
4051
|
+
this.stack.push(_frame8);
|
|
4052
|
+
return open;
|
|
4053
|
+
}
|
|
4054
|
+
|
|
4055
|
+
(function () {
|
|
4056
|
+
{
|
|
4057
|
+
{
|
|
4058
|
+
throw ReactError(Error("ReactDOMServer does not yet support the fundamental API."));
|
|
4059
|
+
}
|
|
4060
|
+
}
|
|
4061
|
+
})();
|
|
4062
|
+
}
|
|
4063
|
+
// eslint-disable-next-line-no-fallthrough
|
|
4064
|
+
|
|
3531
4065
|
case REACT_LAZY_TYPE:
|
|
3532
|
-
|
|
4066
|
+
{
|
|
4067
|
+
var _element2 = nextChild;
|
|
4068
|
+
var lazyComponent = nextChild.type; // Attempt to initialize lazy component regardless of whether the
|
|
4069
|
+
// suspense server-side renderer is enabled so synchronously
|
|
4070
|
+
// resolved constructors are supported.
|
|
4071
|
+
|
|
4072
|
+
initializeLazyComponentType(lazyComponent);
|
|
4073
|
+
|
|
4074
|
+
switch (lazyComponent._status) {
|
|
4075
|
+
case Resolved:
|
|
4076
|
+
{
|
|
4077
|
+
var _nextChildren9 = [React.createElement(lazyComponent._result, _assign({
|
|
4078
|
+
ref: _element2.ref
|
|
4079
|
+
}, _element2.props))];
|
|
4080
|
+
var _frame9 = {
|
|
4081
|
+
type: null,
|
|
4082
|
+
domNamespace: parentNamespace,
|
|
4083
|
+
children: _nextChildren9,
|
|
4084
|
+
childIndex: 0,
|
|
4085
|
+
context: context,
|
|
4086
|
+
footer: ''
|
|
4087
|
+
};
|
|
4088
|
+
|
|
4089
|
+
{
|
|
4090
|
+
_frame9.debugElementStack = [];
|
|
4091
|
+
}
|
|
4092
|
+
|
|
4093
|
+
this.stack.push(_frame9);
|
|
4094
|
+
return '';
|
|
4095
|
+
}
|
|
4096
|
+
|
|
4097
|
+
case Rejected:
|
|
4098
|
+
throw lazyComponent._result;
|
|
4099
|
+
|
|
4100
|
+
case Pending:
|
|
4101
|
+
default:
|
|
4102
|
+
(function () {
|
|
4103
|
+
{
|
|
4104
|
+
{
|
|
4105
|
+
throw ReactError(Error("ReactDOMServer does not yet support lazy-loaded components."));
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
})();
|
|
4109
|
+
|
|
4110
|
+
}
|
|
4111
|
+
}
|
|
4112
|
+
// eslint-disable-next-line-no-fallthrough
|
|
4113
|
+
|
|
4114
|
+
case REACT_SCOPE_TYPE:
|
|
4115
|
+
{
|
|
4116
|
+
if (enableScopeAPI) {
|
|
4117
|
+
var _nextChildren10 = toArray(nextChild.props.children);
|
|
4118
|
+
|
|
4119
|
+
var _frame10 = {
|
|
4120
|
+
type: null,
|
|
4121
|
+
domNamespace: parentNamespace,
|
|
4122
|
+
children: _nextChildren10,
|
|
4123
|
+
childIndex: 0,
|
|
4124
|
+
context: context,
|
|
4125
|
+
footer: ''
|
|
4126
|
+
};
|
|
4127
|
+
|
|
4128
|
+
{
|
|
4129
|
+
_frame10.debugElementStack = [];
|
|
4130
|
+
}
|
|
4131
|
+
|
|
4132
|
+
this.stack.push(_frame10);
|
|
4133
|
+
return '';
|
|
4134
|
+
}
|
|
4135
|
+
|
|
4136
|
+
(function () {
|
|
4137
|
+
{
|
|
4138
|
+
{
|
|
4139
|
+
throw ReactError(Error("ReactDOMServer does not yet support scope components."));
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
})();
|
|
4143
|
+
}
|
|
3533
4144
|
}
|
|
3534
4145
|
}
|
|
3535
4146
|
|
|
3536
4147
|
var info = '';
|
|
4148
|
+
|
|
3537
4149
|
{
|
|
3538
4150
|
var owner = nextElement._owner;
|
|
4151
|
+
|
|
3539
4152
|
if (elementType === undefined || typeof elementType === 'object' && elementType !== null && Object.keys(elementType).length === 0) {
|
|
3540
4153
|
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.';
|
|
3541
4154
|
}
|
|
4155
|
+
|
|
3542
4156
|
var ownerName = owner ? getComponentName(owner) : null;
|
|
4157
|
+
|
|
3543
4158
|
if (ownerName) {
|
|
3544
4159
|
info += '\n\nCheck the render method of `' + ownerName + '`.';
|
|
3545
4160
|
}
|
|
3546
4161
|
}
|
|
3547
|
-
|
|
4162
|
+
|
|
4163
|
+
(function () {
|
|
4164
|
+
{
|
|
4165
|
+
{
|
|
4166
|
+
throw ReactError(Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (elementType == null ? elementType : typeof elementType) + "." + info));
|
|
4167
|
+
}
|
|
4168
|
+
}
|
|
4169
|
+
})();
|
|
3548
4170
|
}
|
|
3549
4171
|
};
|
|
3550
4172
|
|
|
3551
|
-
|
|
4173
|
+
_proto.renderDOM = function renderDOM(element, context, parentNamespace) {
|
|
3552
4174
|
var tag = element.type.toLowerCase();
|
|
3553
|
-
|
|
3554
4175
|
var namespace = parentNamespace;
|
|
4176
|
+
|
|
3555
4177
|
if (parentNamespace === Namespaces.html) {
|
|
3556
4178
|
namespace = getIntrinsicNamespace(tag);
|
|
3557
4179
|
}
|
|
@@ -3565,8 +4187,8 @@ var ReactDOMServerRenderer = function () {
|
|
|
3565
4187
|
}
|
|
3566
4188
|
|
|
3567
4189
|
validateDangerousTag(tag);
|
|
3568
|
-
|
|
3569
4190
|
var props = element.props;
|
|
4191
|
+
|
|
3570
4192
|
if (tag === 'input') {
|
|
3571
4193
|
{
|
|
3572
4194
|
ReactControlledValuePropTypes.checkPropTypes('input', props);
|
|
@@ -3575,6 +4197,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
3575
4197
|
warning$1(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
|
|
3576
4198
|
didWarnDefaultChecked = true;
|
|
3577
4199
|
}
|
|
4200
|
+
|
|
3578
4201
|
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
|
|
3579
4202
|
warning$1(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
|
|
3580
4203
|
didWarnDefaultInputValue = true;
|
|
@@ -3592,6 +4215,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
3592
4215
|
} else if (tag === 'textarea') {
|
|
3593
4216
|
{
|
|
3594
4217
|
ReactControlledValuePropTypes.checkPropTypes('textarea', props);
|
|
4218
|
+
|
|
3595
4219
|
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
|
|
3596
4220
|
warning$1(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
|
|
3597
4221
|
didWarnDefaultTextareaValue = true;
|
|
@@ -3599,25 +4223,44 @@ var ReactDOMServerRenderer = function () {
|
|
|
3599
4223
|
}
|
|
3600
4224
|
|
|
3601
4225
|
var initialValue = props.value;
|
|
4226
|
+
|
|
3602
4227
|
if (initialValue == null) {
|
|
3603
|
-
var defaultValue = props.defaultValue;
|
|
3604
|
-
|
|
4228
|
+
var defaultValue = props.defaultValue; // TODO (yungsters): Remove support for children content in <textarea>.
|
|
4229
|
+
|
|
3605
4230
|
var textareaChildren = props.children;
|
|
4231
|
+
|
|
3606
4232
|
if (textareaChildren != null) {
|
|
3607
4233
|
{
|
|
3608
4234
|
warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
|
|
3609
4235
|
}
|
|
3610
|
-
|
|
4236
|
+
|
|
4237
|
+
(function () {
|
|
4238
|
+
if (!(defaultValue == null)) {
|
|
4239
|
+
{
|
|
4240
|
+
throw ReactError(Error("If you supply `defaultValue` on a <textarea>, do not pass children."));
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
})();
|
|
4244
|
+
|
|
3611
4245
|
if (Array.isArray(textareaChildren)) {
|
|
3612
|
-
|
|
4246
|
+
(function () {
|
|
4247
|
+
if (!(textareaChildren.length <= 1)) {
|
|
4248
|
+
{
|
|
4249
|
+
throw ReactError(Error("<textarea> can only have at most one child."));
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
})();
|
|
4253
|
+
|
|
3613
4254
|
textareaChildren = textareaChildren[0];
|
|
3614
4255
|
}
|
|
3615
4256
|
|
|
3616
4257
|
defaultValue = '' + textareaChildren;
|
|
3617
4258
|
}
|
|
4259
|
+
|
|
3618
4260
|
if (defaultValue == null) {
|
|
3619
4261
|
defaultValue = '';
|
|
3620
4262
|
}
|
|
4263
|
+
|
|
3621
4264
|
initialValue = defaultValue;
|
|
3622
4265
|
}
|
|
3623
4266
|
|
|
@@ -3631,10 +4274,13 @@ var ReactDOMServerRenderer = function () {
|
|
|
3631
4274
|
|
|
3632
4275
|
for (var i = 0; i < valuePropNames.length; i++) {
|
|
3633
4276
|
var propName = valuePropNames[i];
|
|
4277
|
+
|
|
3634
4278
|
if (props[propName] == null) {
|
|
3635
4279
|
continue;
|
|
3636
4280
|
}
|
|
4281
|
+
|
|
3637
4282
|
var isArray = Array.isArray(props[propName]);
|
|
4283
|
+
|
|
3638
4284
|
if (props.multiple && !isArray) {
|
|
3639
4285
|
warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
|
|
3640
4286
|
} else if (!props.multiple && isArray) {
|
|
@@ -3647,6 +4293,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
3647
4293
|
didWarnDefaultSelectValue = true;
|
|
3648
4294
|
}
|
|
3649
4295
|
}
|
|
4296
|
+
|
|
3650
4297
|
this.currentSelectValue = props.value != null ? props.value : props.defaultValue;
|
|
3651
4298
|
props = _assign({}, props, {
|
|
3652
4299
|
value: undefined
|
|
@@ -3655,14 +4302,18 @@ var ReactDOMServerRenderer = function () {
|
|
|
3655
4302
|
var selected = null;
|
|
3656
4303
|
var selectValue = this.currentSelectValue;
|
|
3657
4304
|
var optionChildren = flattenOptionChildren(props.children);
|
|
4305
|
+
|
|
3658
4306
|
if (selectValue != null) {
|
|
3659
|
-
var value
|
|
4307
|
+
var value;
|
|
4308
|
+
|
|
3660
4309
|
if (props.value != null) {
|
|
3661
4310
|
value = props.value + '';
|
|
3662
4311
|
} else {
|
|
3663
4312
|
value = optionChildren;
|
|
3664
4313
|
}
|
|
4314
|
+
|
|
3665
4315
|
selected = false;
|
|
4316
|
+
|
|
3666
4317
|
if (Array.isArray(selectValue)) {
|
|
3667
4318
|
// multiple
|
|
3668
4319
|
for (var j = 0; j < selectValue.length; j++) {
|
|
@@ -3690,19 +4341,22 @@ var ReactDOMServerRenderer = function () {
|
|
|
3690
4341
|
}
|
|
3691
4342
|
|
|
3692
4343
|
assertValidProps(tag, props);
|
|
3693
|
-
|
|
3694
4344
|
var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
|
|
3695
4345
|
var footer = '';
|
|
4346
|
+
|
|
3696
4347
|
if (omittedCloseTags.hasOwnProperty(tag)) {
|
|
3697
4348
|
out += '/>';
|
|
3698
4349
|
} else {
|
|
3699
4350
|
out += '>';
|
|
3700
4351
|
footer = '</' + element.type + '>';
|
|
3701
4352
|
}
|
|
3702
|
-
|
|
4353
|
+
|
|
4354
|
+
var children;
|
|
3703
4355
|
var innerMarkup = getNonChildrenInnerMarkup(props);
|
|
4356
|
+
|
|
3704
4357
|
if (innerMarkup != null) {
|
|
3705
4358
|
children = [];
|
|
4359
|
+
|
|
3706
4360
|
if (newlineEatingTags[tag] && innerMarkup.charAt(0) === '\n') {
|
|
3707
4361
|
// text/html ignores the first character in these tags if it's a newline
|
|
3708
4362
|
// Prefer to break application/xml over text/html (for now) by adding
|
|
@@ -3716,10 +4370,12 @@ var ReactDOMServerRenderer = function () {
|
|
|
3716
4370
|
// from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
|
|
3717
4371
|
out += '\n';
|
|
3718
4372
|
}
|
|
4373
|
+
|
|
3719
4374
|
out += innerMarkup;
|
|
3720
4375
|
} else {
|
|
3721
4376
|
children = toArray(props.children);
|
|
3722
4377
|
}
|
|
4378
|
+
|
|
3723
4379
|
var frame = {
|
|
3724
4380
|
domNamespace: getChildNamespace(parentNamespace, element.type),
|
|
3725
4381
|
type: tag,
|
|
@@ -3728,9 +4384,11 @@ var ReactDOMServerRenderer = function () {
|
|
|
3728
4384
|
context: context,
|
|
3729
4385
|
footer: footer
|
|
3730
4386
|
};
|
|
4387
|
+
|
|
3731
4388
|
{
|
|
3732
4389
|
frame.debugElementStack = [];
|
|
3733
4390
|
}
|
|
4391
|
+
|
|
3734
4392
|
this.stack.push(frame);
|
|
3735
4393
|
this.previousWasTextNode = false;
|
|
3736
4394
|
return out;
|
|
@@ -3744,8 +4402,10 @@ var ReactDOMServerRenderer = function () {
|
|
|
3744
4402
|
* server.
|
|
3745
4403
|
* See https://reactjs.org/docs/react-dom-server.html#rendertostring
|
|
3746
4404
|
*/
|
|
4405
|
+
|
|
3747
4406
|
function renderToString(element) {
|
|
3748
4407
|
var renderer = new ReactDOMServerRenderer(element, false);
|
|
4408
|
+
|
|
3749
4409
|
try {
|
|
3750
4410
|
var markup = renderer.read(Infinity);
|
|
3751
4411
|
return markup;
|
|
@@ -3753,14 +4413,15 @@ function renderToString(element) {
|
|
|
3753
4413
|
renderer.destroy();
|
|
3754
4414
|
}
|
|
3755
4415
|
}
|
|
3756
|
-
|
|
3757
4416
|
/**
|
|
3758
4417
|
* Similar to renderToString, except this doesn't create extra DOM attributes
|
|
3759
4418
|
* such as data-react-id that React uses internally.
|
|
3760
4419
|
* See https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup
|
|
3761
4420
|
*/
|
|
4421
|
+
|
|
3762
4422
|
function renderToStaticMarkup(element) {
|
|
3763
4423
|
var renderer = new ReactDOMServerRenderer(element, true);
|
|
4424
|
+
|
|
3764
4425
|
try {
|
|
3765
4426
|
var markup = renderer.read(Infinity);
|
|
3766
4427
|
return markup;
|
|
@@ -3770,14 +4431,26 @@ function renderToStaticMarkup(element) {
|
|
|
3770
4431
|
}
|
|
3771
4432
|
|
|
3772
4433
|
function renderToNodeStream() {
|
|
3773
|
-
|
|
4434
|
+
(function () {
|
|
4435
|
+
{
|
|
4436
|
+
{
|
|
4437
|
+
throw ReactError(Error("ReactDOMServer.renderToNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead."));
|
|
4438
|
+
}
|
|
4439
|
+
}
|
|
4440
|
+
})();
|
|
3774
4441
|
}
|
|
3775
4442
|
|
|
3776
4443
|
function renderToStaticNodeStream() {
|
|
3777
|
-
|
|
3778
|
-
|
|
4444
|
+
(function () {
|
|
4445
|
+
{
|
|
4446
|
+
{
|
|
4447
|
+
throw ReactError(Error("ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead."));
|
|
4448
|
+
}
|
|
4449
|
+
}
|
|
4450
|
+
})();
|
|
4451
|
+
} // Note: when changing this, also consider https://github.com/facebook/react/issues/11526
|
|
4452
|
+
|
|
3779
4453
|
|
|
3780
|
-
// Note: when changing this, also consider https://github.com/facebook/react/issues/11526
|
|
3781
4454
|
var ReactDOMServerBrowser = {
|
|
3782
4455
|
renderToString: renderToString,
|
|
3783
4456
|
renderToStaticMarkup: renderToStaticMarkup,
|
|
@@ -3794,6 +4467,8 @@ var ReactDOMServer = ( ReactDOMServerBrowser$1 && ReactDOMServerBrowser ) || Rea
|
|
|
3794
4467
|
|
|
3795
4468
|
// TODO: decide on the top-level export form.
|
|
3796
4469
|
// This is hacky but makes it work with both Rollup and Jest
|
|
4470
|
+
|
|
4471
|
+
|
|
3797
4472
|
var server_browser = ReactDOMServer.default || ReactDOMServer;
|
|
3798
4473
|
|
|
3799
4474
|
return server_browser;
|