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