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