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