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