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