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