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