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