react-dom 16.4.0-alpha.7926752 → 16.5.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/README.md +1 -1
- package/cjs/react-dom-server.browser.development.js +611 -263
- package/cjs/react-dom-server.browser.production.min.js +35 -33
- package/cjs/react-dom-server.node.development.js +611 -263
- package/cjs/react-dom-server.node.production.min.js +37 -35
- package/cjs/react-dom-test-utils.development.js +394 -241
- package/cjs/react-dom-test-utils.production.min.js +25 -26
- package/cjs/react-dom-unstable-native-dependencies.development.js +247 -129
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +28 -28
- package/cjs/react-dom.development.js +12644 -11597
- package/cjs/react-dom.production.min.js +225 -245
- package/cjs/react-dom.profiling.min.js +245 -0
- package/package.json +5 -4
- package/profiling.js +38 -0
- package/umd/react-dom-server.browser.development.js +594 -537
- package/umd/react-dom-server.browser.production.min.js +29 -28
- package/umd/react-dom-test-utils.development.js +329 -358
- package/umd/react-dom-test-utils.production.min.js +21 -22
- package/umd/react-dom-unstable-native-dependencies.development.js +183 -214
- package/umd/react-dom-unstable-native-dependencies.production.min.js +23 -23
- package/umd/react-dom.development.js +12566 -11974
- package/umd/react-dom.production.min.js +184 -205
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.5.0
|
|
2
2
|
* react-dom-server.browser.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -15,27 +15,6 @@
|
|
|
15
15
|
(global.ReactDOMServer = factory(global.React));
|
|
16
16
|
}(this, (function (React) { 'use strict';
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* WARNING: DO NOT manually require this module.
|
|
20
|
-
* This is a replacement for `invariant(...)` used by the error code system
|
|
21
|
-
* and will _only_ be required by the corresponding babel pass.
|
|
22
|
-
* It always throws.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
// TODO: this is special because it gets imported during build.
|
|
26
|
-
|
|
27
|
-
var ReactVersion = '16.4.0-alpha.7926752';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the MIT license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
18
|
/**
|
|
40
19
|
* Use invariant() to assert state which your program assumes to be true.
|
|
41
20
|
*
|
|
@@ -47,10 +26,10 @@ var ReactVersion = '16.4.0-alpha.7926752';
|
|
|
47
26
|
* will remain to ensure logic does not differ in production.
|
|
48
27
|
*/
|
|
49
28
|
|
|
50
|
-
var validateFormat = function
|
|
29
|
+
var validateFormat = function () {};
|
|
51
30
|
|
|
52
31
|
{
|
|
53
|
-
validateFormat = function
|
|
32
|
+
validateFormat = function (format) {
|
|
54
33
|
if (format === undefined) {
|
|
55
34
|
throw new Error('invariant requires an error message argument');
|
|
56
35
|
}
|
|
@@ -61,7 +40,7 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
61
40
|
validateFormat(format);
|
|
62
41
|
|
|
63
42
|
if (!condition) {
|
|
64
|
-
var error;
|
|
43
|
+
var error = void 0;
|
|
65
44
|
if (format === undefined) {
|
|
66
45
|
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
67
46
|
} else {
|
|
@@ -78,130 +57,136 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
78
57
|
}
|
|
79
58
|
}
|
|
80
59
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
84
|
-
|
|
85
|
-
var _assign = ReactInternals.assign;
|
|
60
|
+
// Relying on the `invariant()` implementation lets us
|
|
61
|
+
// preserve the format and params in the www builds.
|
|
86
62
|
|
|
87
|
-
|
|
88
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
89
|
-
*
|
|
90
|
-
* This source code is licensed under the MIT license found in the
|
|
91
|
-
* LICENSE file in the root directory of this source tree.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*/
|
|
63
|
+
// TODO: this is special because it gets imported during build.
|
|
95
64
|
|
|
96
|
-
|
|
97
|
-
return function () {
|
|
98
|
-
return arg;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
65
|
+
var ReactVersion = '16.5.0';
|
|
101
66
|
|
|
102
|
-
|
|
103
|
-
* This function accepts and discards inputs; it has no side effects. This is
|
|
104
|
-
* primarily useful idiomatically for overridable function endpoints which
|
|
105
|
-
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
|
106
|
-
*/
|
|
107
|
-
var emptyFunction = function emptyFunction() {};
|
|
108
|
-
|
|
109
|
-
emptyFunction.thatReturns = makeEmptyFunction;
|
|
110
|
-
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
|
111
|
-
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
|
112
|
-
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
|
113
|
-
emptyFunction.thatReturnsThis = function () {
|
|
114
|
-
return this;
|
|
115
|
-
};
|
|
116
|
-
emptyFunction.thatReturnsArgument = function (arg) {
|
|
117
|
-
return arg;
|
|
118
|
-
};
|
|
67
|
+
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
119
68
|
|
|
120
|
-
var
|
|
69
|
+
var _assign = ReactInternals.assign;
|
|
121
70
|
|
|
122
71
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
72
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
73
|
+
* This can be used to log issues in development environments in critical
|
|
74
|
+
* paths. Removing the logging code for production environments will keep the
|
|
75
|
+
* same logic and follow the same code paths.
|
|
128
76
|
*/
|
|
129
77
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var emptyObject = {};
|
|
78
|
+
var warningWithoutStack = function () {};
|
|
133
79
|
|
|
134
80
|
{
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the MIT license found in the
|
|
144
|
-
* LICENSE file in the root directory of this source tree.
|
|
145
|
-
*
|
|
146
|
-
* @typechecks
|
|
147
|
-
*/
|
|
81
|
+
warningWithoutStack = function (condition, format) {
|
|
82
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
83
|
+
args[_key - 2] = arguments[_key];
|
|
84
|
+
}
|
|
148
85
|
|
|
149
|
-
|
|
86
|
+
if (format === undefined) {
|
|
87
|
+
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
88
|
+
}
|
|
89
|
+
if (condition) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (typeof console !== 'undefined') {
|
|
93
|
+
var _console;
|
|
150
94
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
95
|
+
var stringArgs = args.map(function (item) {
|
|
96
|
+
return '' + item;
|
|
97
|
+
});
|
|
98
|
+
(_console = console).error.apply(_console, ['Warning: ' + format].concat(stringArgs));
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
// --- Welcome to debugging React ---
|
|
102
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
103
|
+
// to find the callsite that caused this warning to fire.
|
|
104
|
+
var argIndex = 0;
|
|
105
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
106
|
+
return args[argIndex++];
|
|
107
|
+
});
|
|
108
|
+
throw new Error(message);
|
|
109
|
+
} catch (x) {}
|
|
110
|
+
};
|
|
165
111
|
}
|
|
166
112
|
|
|
167
|
-
var
|
|
113
|
+
var warningWithoutStack$1 = warningWithoutStack;
|
|
168
114
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
* This source code is licensed under the MIT license found in the
|
|
173
|
-
* LICENSE file in the root directory of this source tree.
|
|
174
|
-
*
|
|
175
|
-
* @typechecks
|
|
176
|
-
*/
|
|
115
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
116
|
+
// nor polyfill, then a plain number is used for performance.
|
|
117
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
177
118
|
|
|
178
119
|
|
|
120
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
121
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
122
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
123
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
124
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
125
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
126
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
127
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
128
|
+
var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
|
|
179
129
|
|
|
130
|
+
var Resolved = 1;
|
|
180
131
|
|
|
181
132
|
|
|
182
|
-
var msPattern = /^ms-/;
|
|
183
133
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
* > hyphenateStyleName('backgroundColor')
|
|
188
|
-
* < "background-color"
|
|
189
|
-
* > hyphenateStyleName('MozTransition')
|
|
190
|
-
* < "-moz-transition"
|
|
191
|
-
* > hyphenateStyleName('msTransition')
|
|
192
|
-
* < "-ms-transition"
|
|
193
|
-
*
|
|
194
|
-
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
|
|
195
|
-
* is converted to `-ms-`.
|
|
196
|
-
*
|
|
197
|
-
* @param {string} string
|
|
198
|
-
* @return {string}
|
|
199
|
-
*/
|
|
200
|
-
function hyphenateStyleName(string) {
|
|
201
|
-
return hyphenate_1(string).replace(msPattern, '-ms-');
|
|
134
|
+
|
|
135
|
+
function refineResolvedThenable(thenable) {
|
|
136
|
+
return thenable._reactStatus === Resolved ? thenable._reactResult : null;
|
|
202
137
|
}
|
|
203
138
|
|
|
204
|
-
|
|
139
|
+
function getComponentName(type) {
|
|
140
|
+
if (type == null) {
|
|
141
|
+
// Host root, text node or just invalid type.
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
{
|
|
145
|
+
if (typeof type.tag === 'number') {
|
|
146
|
+
warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (typeof type === 'function') {
|
|
150
|
+
return type.displayName || type.name || null;
|
|
151
|
+
}
|
|
152
|
+
if (typeof type === 'string') {
|
|
153
|
+
return type;
|
|
154
|
+
}
|
|
155
|
+
switch (type) {
|
|
156
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
157
|
+
return 'AsyncMode';
|
|
158
|
+
case REACT_FRAGMENT_TYPE:
|
|
159
|
+
return 'Fragment';
|
|
160
|
+
case REACT_PORTAL_TYPE:
|
|
161
|
+
return 'Portal';
|
|
162
|
+
case REACT_PROFILER_TYPE:
|
|
163
|
+
return 'Profiler';
|
|
164
|
+
case REACT_STRICT_MODE_TYPE:
|
|
165
|
+
return 'StrictMode';
|
|
166
|
+
case REACT_PLACEHOLDER_TYPE:
|
|
167
|
+
return 'Placeholder';
|
|
168
|
+
}
|
|
169
|
+
if (typeof type === 'object') {
|
|
170
|
+
switch (type.$$typeof) {
|
|
171
|
+
case REACT_CONTEXT_TYPE:
|
|
172
|
+
return 'Context.Consumer';
|
|
173
|
+
case REACT_PROVIDER_TYPE:
|
|
174
|
+
return 'Context.Provider';
|
|
175
|
+
case REACT_FORWARD_REF_TYPE:
|
|
176
|
+
var renderFn = type.render;
|
|
177
|
+
var functionName = renderFn.displayName || renderFn.name || '';
|
|
178
|
+
return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
|
|
179
|
+
}
|
|
180
|
+
if (typeof type.then === 'function') {
|
|
181
|
+
var thenable = type;
|
|
182
|
+
var resolvedThenable = refineResolvedThenable(thenable);
|
|
183
|
+
if (resolvedThenable) {
|
|
184
|
+
return getComponentName(resolvedThenable);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
205
190
|
|
|
206
191
|
/**
|
|
207
192
|
* Forked from fbjs/warning:
|
|
@@ -242,7 +227,7 @@ var lowPriorityWarning = function () {};
|
|
|
242
227
|
|
|
243
228
|
lowPriorityWarning = function (condition, format) {
|
|
244
229
|
if (format === undefined) {
|
|
245
|
-
throw new Error('`
|
|
230
|
+
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
246
231
|
}
|
|
247
232
|
if (!condition) {
|
|
248
233
|
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
@@ -256,45 +241,7 @@ var lowPriorityWarning = function () {};
|
|
|
256
241
|
|
|
257
242
|
var lowPriorityWarning$1 = lowPriorityWarning;
|
|
258
243
|
|
|
259
|
-
|
|
260
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
261
|
-
*
|
|
262
|
-
* This source code is licensed under the MIT license found in the
|
|
263
|
-
* LICENSE file in the root directory of this source tree.
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
* @typechecks static-only
|
|
267
|
-
*/
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Memoizes the return value of a function that accepts one string argument.
|
|
273
|
-
*/
|
|
274
|
-
|
|
275
|
-
function memoizeStringOnly(callback) {
|
|
276
|
-
var cache = {};
|
|
277
|
-
return function (string) {
|
|
278
|
-
if (!cache.hasOwnProperty(string)) {
|
|
279
|
-
cache[string] = callback.call(this, string);
|
|
280
|
-
}
|
|
281
|
-
return cache[string];
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
var memoizeStringOnly_1 = memoizeStringOnly;
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
289
|
-
*
|
|
290
|
-
* This source code is licensed under the MIT license found in the
|
|
291
|
-
* LICENSE file in the root directory of this source tree.
|
|
292
|
-
*
|
|
293
|
-
*/
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
244
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
298
245
|
|
|
299
246
|
/**
|
|
300
247
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
@@ -303,49 +250,26 @@ var memoizeStringOnly_1 = memoizeStringOnly;
|
|
|
303
250
|
* same logic and follow the same code paths.
|
|
304
251
|
*/
|
|
305
252
|
|
|
306
|
-
var warning =
|
|
253
|
+
var warning = warningWithoutStack$1;
|
|
307
254
|
|
|
308
255
|
{
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
var argIndex = 0;
|
|
315
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
316
|
-
return args[argIndex++];
|
|
317
|
-
});
|
|
318
|
-
if (typeof console !== 'undefined') {
|
|
319
|
-
console.error(message);
|
|
320
|
-
}
|
|
321
|
-
try {
|
|
322
|
-
// --- Welcome to debugging React ---
|
|
323
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
324
|
-
// to find the callsite that caused this warning to fire.
|
|
325
|
-
throw new Error(message);
|
|
326
|
-
} catch (x) {}
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
warning = function warning(condition, format) {
|
|
330
|
-
if (format === undefined) {
|
|
331
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
256
|
+
warning = function (condition, format) {
|
|
257
|
+
if (condition) {
|
|
258
|
+
return;
|
|
332
259
|
}
|
|
260
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
261
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
262
|
+
// eslint-disable-next-line react-internal/warning-and-invariant-args
|
|
333
263
|
|
|
334
|
-
|
|
335
|
-
|
|
264
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
265
|
+
args[_key - 2] = arguments[_key];
|
|
336
266
|
}
|
|
337
267
|
|
|
338
|
-
|
|
339
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
340
|
-
args[_key2 - 2] = arguments[_key2];
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
printWarning$1.apply(undefined, [format].concat(args));
|
|
344
|
-
}
|
|
268
|
+
warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
|
345
269
|
};
|
|
346
270
|
}
|
|
347
271
|
|
|
348
|
-
var
|
|
272
|
+
var warning$1 = warning;
|
|
349
273
|
|
|
350
274
|
/**
|
|
351
275
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -369,11 +293,24 @@ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
|
369
293
|
|
|
370
294
|
|
|
371
295
|
|
|
296
|
+
var printWarning$1 = function() {};
|
|
297
|
+
|
|
372
298
|
{
|
|
373
|
-
var invariant$2 = invariant_1;
|
|
374
|
-
var warning$2 = warning_1;
|
|
375
299
|
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
376
300
|
var loggedTypeFailures = {};
|
|
301
|
+
|
|
302
|
+
printWarning$1 = function(text) {
|
|
303
|
+
var message = 'Warning: ' + text;
|
|
304
|
+
if (typeof console !== 'undefined') {
|
|
305
|
+
console.error(message);
|
|
306
|
+
}
|
|
307
|
+
try {
|
|
308
|
+
// --- Welcome to debugging React ---
|
|
309
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
310
|
+
// to find the callsite that caused this warning to fire.
|
|
311
|
+
throw new Error(message);
|
|
312
|
+
} catch (x) {}
|
|
313
|
+
};
|
|
377
314
|
}
|
|
378
315
|
|
|
379
316
|
/**
|
|
@@ -398,12 +335,29 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
398
335
|
try {
|
|
399
336
|
// This is intentionally an invariant that gets caught. It's the same
|
|
400
337
|
// behavior as without this statement except with a better message.
|
|
401
|
-
|
|
338
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
339
|
+
var err = Error(
|
|
340
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
341
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
342
|
+
);
|
|
343
|
+
err.name = 'Invariant Violation';
|
|
344
|
+
throw err;
|
|
345
|
+
}
|
|
402
346
|
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
403
347
|
} catch (ex) {
|
|
404
348
|
error = ex;
|
|
405
349
|
}
|
|
406
|
-
|
|
350
|
+
if (error && !(error instanceof Error)) {
|
|
351
|
+
printWarning$1(
|
|
352
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
353
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
354
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
355
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
356
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
357
|
+
'shape all require an argument).'
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
}
|
|
407
361
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
408
362
|
// Only monitor this failure once because there tends to be a lot of the
|
|
409
363
|
// same error.
|
|
@@ -411,7 +365,9 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
411
365
|
|
|
412
366
|
var stack = getStack ? getStack() : '';
|
|
413
367
|
|
|
414
|
-
|
|
368
|
+
printWarning$1(
|
|
369
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
370
|
+
);
|
|
415
371
|
}
|
|
416
372
|
}
|
|
417
373
|
}
|
|
@@ -420,28 +376,42 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
420
376
|
|
|
421
377
|
var checkPropTypes_1 = checkPropTypes;
|
|
422
378
|
|
|
379
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
380
|
+
|
|
423
381
|
var describeComponentFrame = function (name, source, ownerName) {
|
|
424
|
-
|
|
382
|
+
var sourceInfo = '';
|
|
383
|
+
if (source) {
|
|
384
|
+
var path = source.fileName;
|
|
385
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
386
|
+
{
|
|
387
|
+
// In DEV, include code for a common special case:
|
|
388
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
389
|
+
if (/^index\./.test(fileName)) {
|
|
390
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
391
|
+
if (match) {
|
|
392
|
+
var pathBeforeSlash = match[1];
|
|
393
|
+
if (pathBeforeSlash) {
|
|
394
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
395
|
+
fileName = folderName + '/' + fileName;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
401
|
+
} else if (ownerName) {
|
|
402
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
403
|
+
}
|
|
404
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
425
405
|
};
|
|
426
406
|
|
|
427
|
-
var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
428
|
-
|
|
429
|
-
var ReactCurrentOwner = ReactInternals$1.ReactCurrentOwner;
|
|
430
|
-
var ReactDebugCurrentFrame = ReactInternals$1.ReactDebugCurrentFrame;
|
|
431
|
-
|
|
432
407
|
// Exports ReactDOM.createRoot
|
|
433
408
|
|
|
434
409
|
|
|
435
|
-
|
|
436
|
-
// Mutating mode (React DOM, React ART, React Native):
|
|
437
|
-
|
|
438
|
-
// Experimental noop mode (currently unused):
|
|
439
|
-
|
|
440
|
-
// Experimental persistent mode (Fabric):
|
|
441
|
-
|
|
442
410
|
// Experimental error-boundary API that can recover from errors within a single
|
|
443
411
|
// render phase
|
|
444
412
|
|
|
413
|
+
// Suspense
|
|
414
|
+
|
|
445
415
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
446
416
|
|
|
447
417
|
|
|
@@ -458,21 +428,19 @@ var ReactDebugCurrentFrame = ReactInternals$1.ReactDebugCurrentFrame;
|
|
|
458
428
|
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
459
429
|
var warnAboutDeprecatedLifecycles = false;
|
|
460
430
|
|
|
461
|
-
//
|
|
431
|
+
// Warn about legacy context API
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
// Gather advanced timing metrics for Profiler subtrees.
|
|
462
435
|
|
|
463
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
464
|
-
// nor polyfill, then a plain number is used for performance.
|
|
465
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
|
|
466
436
|
|
|
437
|
+
// Track which interactions trigger each commit.
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
// Only used in www builds.
|
|
441
|
+
var enableSuspenseServerRenderer = false;
|
|
467
442
|
|
|
468
|
-
|
|
469
|
-
var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
|
|
470
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
|
|
471
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
|
|
472
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc;
|
|
473
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd;
|
|
474
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace;
|
|
475
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf;
|
|
443
|
+
// Only used in www builds.
|
|
476
444
|
|
|
477
445
|
// A reserved attribute.
|
|
478
446
|
// It is handled by React separately and shouldn't be written to the DOM.
|
|
@@ -516,14 +484,15 @@ var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u
|
|
|
516
484
|
var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
|
|
517
485
|
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
518
486
|
|
|
487
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
519
488
|
var illegalAttributeNameCache = {};
|
|
520
489
|
var validatedAttributeNameCache = {};
|
|
521
490
|
|
|
522
491
|
function isAttributeNameSafe(attributeName) {
|
|
523
|
-
if (
|
|
492
|
+
if (hasOwnProperty$1.call(validatedAttributeNameCache, attributeName)) {
|
|
524
493
|
return true;
|
|
525
494
|
}
|
|
526
|
-
if (
|
|
495
|
+
if (hasOwnProperty$1.call(illegalAttributeNameCache, attributeName)) {
|
|
527
496
|
return false;
|
|
528
497
|
}
|
|
529
498
|
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
|
@@ -532,7 +501,7 @@ function isAttributeNameSafe(attributeName) {
|
|
|
532
501
|
}
|
|
533
502
|
illegalAttributeNameCache[attributeName] = true;
|
|
534
503
|
{
|
|
535
|
-
|
|
504
|
+
warning$1(false, 'Invalid attribute name: `%s`', attributeName);
|
|
536
505
|
}
|
|
537
506
|
return false;
|
|
538
507
|
}
|
|
@@ -584,6 +553,9 @@ function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)
|
|
|
584
553
|
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
|
585
554
|
return true;
|
|
586
555
|
}
|
|
556
|
+
if (isCustomComponentTag) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
587
559
|
if (propertyInfo !== null) {
|
|
588
560
|
switch (propertyInfo.type) {
|
|
589
561
|
case BOOLEAN:
|
|
@@ -626,15 +598,20 @@ var properties = {};
|
|
|
626
598
|
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
|
|
627
599
|
name, // attributeName
|
|
628
600
|
null);
|
|
629
|
-
}
|
|
601
|
+
} // attributeNamespace
|
|
602
|
+
);
|
|
630
603
|
|
|
631
604
|
// A few React string attributes have a different name.
|
|
632
605
|
// This is a mapping from React prop names to the attribute names.
|
|
633
|
-
|
|
606
|
+
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
|
607
|
+
var name = _ref[0],
|
|
608
|
+
attributeName = _ref[1];
|
|
609
|
+
|
|
634
610
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
635
611
|
attributeName, // attributeName
|
|
636
612
|
null);
|
|
637
|
-
}
|
|
613
|
+
} // attributeNamespace
|
|
614
|
+
);
|
|
638
615
|
|
|
639
616
|
// These are "enumerated" HTML attributes that accept "true" and "false".
|
|
640
617
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -643,17 +620,19 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
643
620
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
644
621
|
name.toLowerCase(), // attributeName
|
|
645
622
|
null);
|
|
646
|
-
}
|
|
623
|
+
} // attributeNamespace
|
|
624
|
+
);
|
|
647
625
|
|
|
648
626
|
// These are "enumerated" SVG attributes that accept "true" and "false".
|
|
649
627
|
// In React, we let users pass `true` and `false` even though technically
|
|
650
628
|
// these aren't boolean attributes (they are coerced to strings).
|
|
651
629
|
// Since these are SVG attributes, their attribute names are case-sensitive.
|
|
652
|
-
['autoReverse', 'externalResourcesRequired', 'preserveAlpha'].forEach(function (name) {
|
|
630
|
+
['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
|
|
653
631
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
654
632
|
name, // attributeName
|
|
655
633
|
null);
|
|
656
|
-
}
|
|
634
|
+
} // attributeNamespace
|
|
635
|
+
);
|
|
657
636
|
|
|
658
637
|
// These are HTML boolean attributes.
|
|
659
638
|
['allowFullScreen', 'async',
|
|
@@ -665,7 +644,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
665
644
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
|
666
645
|
name.toLowerCase(), // attributeName
|
|
667
646
|
null);
|
|
668
|
-
}
|
|
647
|
+
} // attributeNamespace
|
|
648
|
+
);
|
|
669
649
|
|
|
670
650
|
// These are the few React props that we set as DOM properties
|
|
671
651
|
// rather than attributes. These are all booleans.
|
|
@@ -674,31 +654,35 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
674
654
|
// disabled with `removeAttribute`. We have special logic for handling this.
|
|
675
655
|
'multiple', 'muted', 'selected'].forEach(function (name) {
|
|
676
656
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
|
677
|
-
name
|
|
657
|
+
name, // attributeName
|
|
678
658
|
null);
|
|
679
|
-
}
|
|
659
|
+
} // attributeNamespace
|
|
660
|
+
);
|
|
680
661
|
|
|
681
662
|
// These are HTML attributes that are "overloaded booleans": they behave like
|
|
682
663
|
// booleans, but can also accept a string value.
|
|
683
664
|
['capture', 'download'].forEach(function (name) {
|
|
684
665
|
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
|
|
685
|
-
name
|
|
666
|
+
name, // attributeName
|
|
686
667
|
null);
|
|
687
|
-
}
|
|
668
|
+
} // attributeNamespace
|
|
669
|
+
);
|
|
688
670
|
|
|
689
671
|
// These are HTML attributes that must be positive numbers.
|
|
690
672
|
['cols', 'rows', 'size', 'span'].forEach(function (name) {
|
|
691
673
|
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
|
|
692
|
-
name
|
|
674
|
+
name, // attributeName
|
|
693
675
|
null);
|
|
694
|
-
}
|
|
676
|
+
} // attributeNamespace
|
|
677
|
+
);
|
|
695
678
|
|
|
696
679
|
// These are HTML attributes that must be numbers.
|
|
697
680
|
['rowSpan', 'start'].forEach(function (name) {
|
|
698
681
|
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
|
|
699
682
|
name.toLowerCase(), // attributeName
|
|
700
683
|
null);
|
|
701
|
-
}
|
|
684
|
+
} // attributeNamespace
|
|
685
|
+
);
|
|
702
686
|
|
|
703
687
|
var CAMELIZE = /[\-\:]([a-z])/g;
|
|
704
688
|
var capitalize = function (token) {
|
|
@@ -714,7 +698,8 @@ var capitalize = function (token) {
|
|
|
714
698
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
715
699
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
716
700
|
attributeName, null);
|
|
717
|
-
}
|
|
701
|
+
} // attributeNamespace
|
|
702
|
+
);
|
|
718
703
|
|
|
719
704
|
// String SVG attributes with the xlink namespace.
|
|
720
705
|
['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
|
@@ -870,9 +855,10 @@ function createMarkupForProperty(name, value) {
|
|
|
870
855
|
} else {
|
|
871
856
|
return attributeName + '=' + quoteAttributeValueForBrowser(value);
|
|
872
857
|
}
|
|
873
|
-
} else {
|
|
858
|
+
} else if (isAttributeNameSafe(name)) {
|
|
874
859
|
return name + '=' + quoteAttributeValueForBrowser(value);
|
|
875
860
|
}
|
|
861
|
+
return '';
|
|
876
862
|
}
|
|
877
863
|
|
|
878
864
|
/**
|
|
@@ -924,11 +910,15 @@ function getChildNamespace(parentNamespace, type) {
|
|
|
924
910
|
return parentNamespace;
|
|
925
911
|
}
|
|
926
912
|
|
|
913
|
+
var ReactDebugCurrentFrame$1 = null;
|
|
914
|
+
|
|
927
915
|
var ReactControlledValuePropTypes = {
|
|
928
916
|
checkPropTypes: null
|
|
929
917
|
};
|
|
930
918
|
|
|
931
919
|
{
|
|
920
|
+
ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
921
|
+
|
|
932
922
|
var hasReadOnlyValue = {
|
|
933
923
|
button: true,
|
|
934
924
|
checkbox: true,
|
|
@@ -941,13 +931,13 @@ var ReactControlledValuePropTypes = {
|
|
|
941
931
|
|
|
942
932
|
var propTypes = {
|
|
943
933
|
value: function (props, propName, componentName) {
|
|
944
|
-
if (
|
|
934
|
+
if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) {
|
|
945
935
|
return null;
|
|
946
936
|
}
|
|
947
937
|
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`.');
|
|
948
938
|
},
|
|
949
939
|
checked: function (props, propName, componentName) {
|
|
950
|
-
if (
|
|
940
|
+
if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
|
|
951
941
|
return null;
|
|
952
942
|
}
|
|
953
943
|
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`.');
|
|
@@ -958,8 +948,8 @@ var ReactControlledValuePropTypes = {
|
|
|
958
948
|
* Provide a linked `value` attribute for controlled forms. You should not use
|
|
959
949
|
* this outside of the ReactDOM controlled form components.
|
|
960
950
|
*/
|
|
961
|
-
ReactControlledValuePropTypes.checkPropTypes = function (tagName, props
|
|
962
|
-
checkPropTypes_1(propTypes, props, 'prop', tagName,
|
|
951
|
+
ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
|
|
952
|
+
checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum);
|
|
963
953
|
};
|
|
964
954
|
}
|
|
965
955
|
|
|
@@ -982,6 +972,7 @@ var omittedCloseTags = {
|
|
|
982
972
|
source: true,
|
|
983
973
|
track: true,
|
|
984
974
|
wbr: true
|
|
975
|
+
// NOTE: menuitem's close tag should be omitted, but that causes problems.
|
|
985
976
|
};
|
|
986
977
|
|
|
987
978
|
// For HTML, certain tags cannot have children. This has the same purpose as
|
|
@@ -991,24 +982,31 @@ var voidElementTags = _assign({
|
|
|
991
982
|
menuitem: true
|
|
992
983
|
}, omittedCloseTags);
|
|
993
984
|
|
|
985
|
+
// TODO: We can remove this if we add invariantWithStack()
|
|
986
|
+
// or add stack by default to invariants where possible.
|
|
994
987
|
var HTML = '__html';
|
|
995
988
|
|
|
996
|
-
|
|
989
|
+
var ReactDebugCurrentFrame$2 = null;
|
|
990
|
+
{
|
|
991
|
+
ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
function assertValidProps(tag, props) {
|
|
997
995
|
if (!props) {
|
|
998
996
|
return;
|
|
999
997
|
}
|
|
1000
998
|
// Note the use of `==` which checks for null or undefined.
|
|
1001
999
|
if (voidElementTags[tag]) {
|
|
1002
|
-
!(props.children == null && props.dangerouslySetInnerHTML == null) ?
|
|
1000
|
+
!(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
|
|
1003
1001
|
}
|
|
1004
1002
|
if (props.dangerouslySetInnerHTML != null) {
|
|
1005
|
-
!(props.children == null) ?
|
|
1006
|
-
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ?
|
|
1003
|
+
!(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
|
|
1004
|
+
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
|
|
1007
1005
|
}
|
|
1008
1006
|
{
|
|
1009
|
-
|
|
1007
|
+
!(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;
|
|
1010
1008
|
}
|
|
1011
|
-
!(props.style == null || typeof props.style === 'object') ?
|
|
1009
|
+
!(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
|
|
1012
1010
|
}
|
|
1013
1011
|
|
|
1014
1012
|
/**
|
|
@@ -1030,6 +1028,7 @@ var isUnitlessNumber = {
|
|
|
1030
1028
|
flexShrink: true,
|
|
1031
1029
|
flexNegative: true,
|
|
1032
1030
|
flexOrder: true,
|
|
1031
|
+
gridArea: true,
|
|
1033
1032
|
gridRow: true,
|
|
1034
1033
|
gridRowEnd: true,
|
|
1035
1034
|
gridRowSpan: true,
|
|
@@ -1116,6 +1115,26 @@ function dangerousStyleValue(name, value, isCustomProperty) {
|
|
|
1116
1115
|
return ('' + value).trim();
|
|
1117
1116
|
}
|
|
1118
1117
|
|
|
1118
|
+
var uppercasePattern = /([A-Z])/g;
|
|
1119
|
+
var msPattern = /^ms-/;
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* Hyphenates a camelcased CSS property name, for example:
|
|
1123
|
+
*
|
|
1124
|
+
* > hyphenateStyleName('backgroundColor')
|
|
1125
|
+
* < "background-color"
|
|
1126
|
+
* > hyphenateStyleName('MozTransition')
|
|
1127
|
+
* < "-moz-transition"
|
|
1128
|
+
* > hyphenateStyleName('msTransition')
|
|
1129
|
+
* < "-ms-transition"
|
|
1130
|
+
*
|
|
1131
|
+
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
|
|
1132
|
+
* is converted to `-ms-`.
|
|
1133
|
+
*/
|
|
1134
|
+
function hyphenateStyleName(name) {
|
|
1135
|
+
return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1119
1138
|
function isCustomComponent(tagName, props) {
|
|
1120
1139
|
if (tagName.indexOf('-') === -1) {
|
|
1121
1140
|
return typeof props.is === 'string';
|
|
@@ -1139,77 +1158,13 @@ function isCustomComponent(tagName, props) {
|
|
|
1139
1158
|
}
|
|
1140
1159
|
}
|
|
1141
1160
|
|
|
1142
|
-
|
|
1143
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1144
|
-
*
|
|
1145
|
-
* This source code is licensed under the MIT license found in the
|
|
1146
|
-
* LICENSE file in the root directory of this source tree.
|
|
1147
|
-
*
|
|
1148
|
-
* @typechecks
|
|
1149
|
-
*/
|
|
1150
|
-
|
|
1151
|
-
var _hyphenPattern = /-(.)/g;
|
|
1152
|
-
|
|
1153
|
-
/**
|
|
1154
|
-
* Camelcases a hyphenated string, for example:
|
|
1155
|
-
*
|
|
1156
|
-
* > camelize('background-color')
|
|
1157
|
-
* < "backgroundColor"
|
|
1158
|
-
*
|
|
1159
|
-
* @param {string} string
|
|
1160
|
-
* @return {string}
|
|
1161
|
-
*/
|
|
1162
|
-
function camelize(string) {
|
|
1163
|
-
return string.replace(_hyphenPattern, function (_, character) {
|
|
1164
|
-
return character.toUpperCase();
|
|
1165
|
-
});
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
var camelize_1 = camelize;
|
|
1169
|
-
|
|
1170
|
-
/**
|
|
1171
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1172
|
-
*
|
|
1173
|
-
* This source code is licensed under the MIT license found in the
|
|
1174
|
-
* LICENSE file in the root directory of this source tree.
|
|
1175
|
-
*
|
|
1176
|
-
* @typechecks
|
|
1177
|
-
*/
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
var msPattern$1 = /^-ms-/;
|
|
1184
|
-
|
|
1185
|
-
/**
|
|
1186
|
-
* Camelcases a hyphenated CSS property name, for example:
|
|
1187
|
-
*
|
|
1188
|
-
* > camelizeStyleName('background-color')
|
|
1189
|
-
* < "backgroundColor"
|
|
1190
|
-
* > camelizeStyleName('-moz-transition')
|
|
1191
|
-
* < "MozTransition"
|
|
1192
|
-
* > camelizeStyleName('-ms-transition')
|
|
1193
|
-
* < "msTransition"
|
|
1194
|
-
*
|
|
1195
|
-
* As Andi Smith suggests
|
|
1196
|
-
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
|
|
1197
|
-
* is converted to lowercase `ms`.
|
|
1198
|
-
*
|
|
1199
|
-
* @param {string} string
|
|
1200
|
-
* @return {string}
|
|
1201
|
-
*/
|
|
1202
|
-
function camelizeStyleName(string) {
|
|
1203
|
-
return camelize_1(string.replace(msPattern$1, 'ms-'));
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
var camelizeStyleName_1 = camelizeStyleName;
|
|
1207
|
-
|
|
1208
|
-
var warnValidStyle = emptyFunction_1;
|
|
1161
|
+
var warnValidStyle = function () {};
|
|
1209
1162
|
|
|
1210
1163
|
{
|
|
1211
1164
|
// 'msTransform' is correct, but the other prefixes should be capitalized
|
|
1212
1165
|
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
|
|
1166
|
+
var msPattern$1 = /^-ms-/;
|
|
1167
|
+
var hyphenPattern = /-(.)/g;
|
|
1213
1168
|
|
|
1214
1169
|
// style values shouldn't contain a semicolon
|
|
1215
1170
|
var badStyleValueWithSemicolonPattern = /;\s*$/;
|
|
@@ -1219,65 +1174,75 @@ var warnValidStyle = emptyFunction_1;
|
|
|
1219
1174
|
var warnedForNaNValue = false;
|
|
1220
1175
|
var warnedForInfinityValue = false;
|
|
1221
1176
|
|
|
1222
|
-
var
|
|
1177
|
+
var camelize = function (string) {
|
|
1178
|
+
return string.replace(hyphenPattern, function (_, character) {
|
|
1179
|
+
return character.toUpperCase();
|
|
1180
|
+
});
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1183
|
+
var warnHyphenatedStyleName = function (name) {
|
|
1223
1184
|
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
|
1224
1185
|
return;
|
|
1225
1186
|
}
|
|
1226
1187
|
|
|
1227
1188
|
warnedStyleNames[name] = true;
|
|
1228
|
-
|
|
1189
|
+
warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
|
|
1190
|
+
// As Andi Smith suggests
|
|
1191
|
+
// (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
|
|
1192
|
+
// is converted to lowercase `ms`.
|
|
1193
|
+
camelize(name.replace(msPattern$1, 'ms-')));
|
|
1229
1194
|
};
|
|
1230
1195
|
|
|
1231
|
-
var warnBadVendoredStyleName = function (name
|
|
1196
|
+
var warnBadVendoredStyleName = function (name) {
|
|
1232
1197
|
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
|
1233
1198
|
return;
|
|
1234
1199
|
}
|
|
1235
1200
|
|
|
1236
1201
|
warnedStyleNames[name] = true;
|
|
1237
|
-
|
|
1202
|
+
warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
|
|
1238
1203
|
};
|
|
1239
1204
|
|
|
1240
|
-
var warnStyleValueWithSemicolon = function (name, value
|
|
1205
|
+
var warnStyleValueWithSemicolon = function (name, value) {
|
|
1241
1206
|
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
|
|
1242
1207
|
return;
|
|
1243
1208
|
}
|
|
1244
1209
|
|
|
1245
1210
|
warnedStyleValues[value] = true;
|
|
1246
|
-
|
|
1211
|
+
warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
|
|
1247
1212
|
};
|
|
1248
1213
|
|
|
1249
|
-
var warnStyleValueIsNaN = function (name, value
|
|
1214
|
+
var warnStyleValueIsNaN = function (name, value) {
|
|
1250
1215
|
if (warnedForNaNValue) {
|
|
1251
1216
|
return;
|
|
1252
1217
|
}
|
|
1253
1218
|
|
|
1254
1219
|
warnedForNaNValue = true;
|
|
1255
|
-
|
|
1220
|
+
warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
|
|
1256
1221
|
};
|
|
1257
1222
|
|
|
1258
|
-
var warnStyleValueIsInfinity = function (name, value
|
|
1223
|
+
var warnStyleValueIsInfinity = function (name, value) {
|
|
1259
1224
|
if (warnedForInfinityValue) {
|
|
1260
1225
|
return;
|
|
1261
1226
|
}
|
|
1262
1227
|
|
|
1263
1228
|
warnedForInfinityValue = true;
|
|
1264
|
-
|
|
1229
|
+
warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
|
|
1265
1230
|
};
|
|
1266
1231
|
|
|
1267
|
-
warnValidStyle = function (name, value
|
|
1232
|
+
warnValidStyle = function (name, value) {
|
|
1268
1233
|
if (name.indexOf('-') > -1) {
|
|
1269
|
-
warnHyphenatedStyleName(name
|
|
1234
|
+
warnHyphenatedStyleName(name);
|
|
1270
1235
|
} else if (badVendoredStyleNamePattern.test(name)) {
|
|
1271
|
-
warnBadVendoredStyleName(name
|
|
1236
|
+
warnBadVendoredStyleName(name);
|
|
1272
1237
|
} else if (badStyleValueWithSemicolonPattern.test(value)) {
|
|
1273
|
-
warnStyleValueWithSemicolon(name, value
|
|
1238
|
+
warnStyleValueWithSemicolon(name, value);
|
|
1274
1239
|
}
|
|
1275
1240
|
|
|
1276
1241
|
if (typeof value === 'number') {
|
|
1277
1242
|
if (isNaN(value)) {
|
|
1278
|
-
warnStyleValueIsNaN(name, value
|
|
1243
|
+
warnStyleValueIsNaN(name, value);
|
|
1279
1244
|
} else if (!isFinite(value)) {
|
|
1280
|
-
warnStyleValueIsInfinity(name, value
|
|
1245
|
+
warnStyleValueIsInfinity(name, value);
|
|
1281
1246
|
}
|
|
1282
1247
|
}
|
|
1283
1248
|
};
|
|
@@ -1344,15 +1309,10 @@ var warnedProperties = {};
|
|
|
1344
1309
|
var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
1345
1310
|
var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
1346
1311
|
|
|
1347
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1348
|
-
|
|
1349
|
-
function getStackAddendum$1() {
|
|
1350
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
1351
|
-
return stack != null ? stack : '';
|
|
1352
|
-
}
|
|
1312
|
+
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1353
1313
|
|
|
1354
1314
|
function validateProperty(tagName, name) {
|
|
1355
|
-
if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
|
|
1315
|
+
if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
|
|
1356
1316
|
return true;
|
|
1357
1317
|
}
|
|
1358
1318
|
|
|
@@ -1363,13 +1323,13 @@ function validateProperty(tagName, name) {
|
|
|
1363
1323
|
// If this is an aria-* attribute, but is not listed in the known DOM
|
|
1364
1324
|
// DOM properties, then it is an invalid aria-* attribute.
|
|
1365
1325
|
if (correctName == null) {
|
|
1366
|
-
|
|
1326
|
+
warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
|
|
1367
1327
|
warnedProperties[name] = true;
|
|
1368
1328
|
return true;
|
|
1369
1329
|
}
|
|
1370
1330
|
// aria-* attributes should be lowercase; suggest the lowercase version.
|
|
1371
1331
|
if (name !== correctName) {
|
|
1372
|
-
|
|
1332
|
+
warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
|
|
1373
1333
|
warnedProperties[name] = true;
|
|
1374
1334
|
return true;
|
|
1375
1335
|
}
|
|
@@ -1387,7 +1347,7 @@ function validateProperty(tagName, name) {
|
|
|
1387
1347
|
}
|
|
1388
1348
|
// aria-* attributes should be lowercase; suggest the lowercase version.
|
|
1389
1349
|
if (name !== standardName) {
|
|
1390
|
-
|
|
1350
|
+
warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
|
|
1391
1351
|
warnedProperties[name] = true;
|
|
1392
1352
|
return true;
|
|
1393
1353
|
}
|
|
@@ -1411,9 +1371,9 @@ function warnInvalidARIAProps(type, props) {
|
|
|
1411
1371
|
}).join(', ');
|
|
1412
1372
|
|
|
1413
1373
|
if (invalidProps.length === 1) {
|
|
1414
|
-
|
|
1374
|
+
warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
|
|
1415
1375
|
} else if (invalidProps.length > 1) {
|
|
1416
|
-
|
|
1376
|
+
warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
|
|
1417
1377
|
}
|
|
1418
1378
|
}
|
|
1419
1379
|
|
|
@@ -1426,11 +1386,6 @@ function validateProperties(type, props) {
|
|
|
1426
1386
|
|
|
1427
1387
|
var didWarnValueNull = false;
|
|
1428
1388
|
|
|
1429
|
-
function getStackAddendum$2() {
|
|
1430
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
1431
|
-
return stack != null ? stack : '';
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
1389
|
function validateProperties$1(type, props) {
|
|
1435
1390
|
if (type !== 'input' && type !== 'textarea' && type !== 'select') {
|
|
1436
1391
|
return;
|
|
@@ -1439,9 +1394,9 @@ function validateProperties$1(type, props) {
|
|
|
1439
1394
|
if (props != null && props.value === null && !didWarnValueNull) {
|
|
1440
1395
|
didWarnValueNull = true;
|
|
1441
1396
|
if (type === 'select' && props.multiple) {
|
|
1442
|
-
|
|
1397
|
+
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);
|
|
1443
1398
|
} else {
|
|
1444
|
-
|
|
1399
|
+
warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
|
|
1445
1400
|
}
|
|
1446
1401
|
}
|
|
1447
1402
|
}
|
|
@@ -1531,7 +1486,7 @@ var possibleStandardNames = {
|
|
|
1531
1486
|
checked: 'checked',
|
|
1532
1487
|
children: 'children',
|
|
1533
1488
|
cite: 'cite',
|
|
1534
|
-
|
|
1489
|
+
class: 'className',
|
|
1535
1490
|
classid: 'classID',
|
|
1536
1491
|
classname: 'className',
|
|
1537
1492
|
cols: 'cols',
|
|
@@ -1546,7 +1501,7 @@ var possibleStandardNames = {
|
|
|
1546
1501
|
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
|
1547
1502
|
data: 'data',
|
|
1548
1503
|
datetime: 'dateTime',
|
|
1549
|
-
|
|
1504
|
+
default: 'default',
|
|
1550
1505
|
defaultchecked: 'defaultChecked',
|
|
1551
1506
|
defaultvalue: 'defaultValue',
|
|
1552
1507
|
defer: 'defer',
|
|
@@ -1555,7 +1510,7 @@ var possibleStandardNames = {
|
|
|
1555
1510
|
download: 'download',
|
|
1556
1511
|
draggable: 'draggable',
|
|
1557
1512
|
enctype: 'encType',
|
|
1558
|
-
|
|
1513
|
+
for: 'htmlFor',
|
|
1559
1514
|
form: 'form',
|
|
1560
1515
|
formmethod: 'formMethod',
|
|
1561
1516
|
formaction: 'formAction',
|
|
@@ -1773,7 +1728,7 @@ var possibleStandardNames = {
|
|
|
1773
1728
|
imagerendering: 'imageRendering',
|
|
1774
1729
|
'image-rendering': 'imageRendering',
|
|
1775
1730
|
in2: 'in2',
|
|
1776
|
-
|
|
1731
|
+
in: 'in',
|
|
1777
1732
|
inlist: 'inlist',
|
|
1778
1733
|
intercept: 'intercept',
|
|
1779
1734
|
k1: 'k1',
|
|
@@ -1913,7 +1868,7 @@ var possibleStandardNames = {
|
|
|
1913
1868
|
'text-rendering': 'textRendering',
|
|
1914
1869
|
to: 'to',
|
|
1915
1870
|
transform: 'transform',
|
|
1916
|
-
|
|
1871
|
+
typeof: 'typeof',
|
|
1917
1872
|
u1: 'u1',
|
|
1918
1873
|
u2: 'u2',
|
|
1919
1874
|
underlineposition: 'underlinePosition',
|
|
@@ -1992,11 +1947,6 @@ var possibleStandardNames = {
|
|
|
1992
1947
|
zoomandpan: 'zoomAndPan'
|
|
1993
1948
|
};
|
|
1994
1949
|
|
|
1995
|
-
function getStackAddendum$3() {
|
|
1996
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
1997
|
-
return stack != null ? stack : '';
|
|
1998
|
-
}
|
|
1999
|
-
|
|
2000
1950
|
var validateProperty$1 = function () {};
|
|
2001
1951
|
|
|
2002
1952
|
{
|
|
@@ -2014,7 +1964,7 @@ var validateProperty$1 = function () {};
|
|
|
2014
1964
|
|
|
2015
1965
|
var lowerCasedName = name.toLowerCase();
|
|
2016
1966
|
if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
|
|
2017
|
-
|
|
1967
|
+
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.');
|
|
2018
1968
|
warnedProperties$1[name] = true;
|
|
2019
1969
|
return true;
|
|
2020
1970
|
}
|
|
@@ -2026,12 +1976,12 @@ var validateProperty$1 = function () {};
|
|
|
2026
1976
|
}
|
|
2027
1977
|
var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
|
|
2028
1978
|
if (registrationName != null) {
|
|
2029
|
-
|
|
1979
|
+
warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
|
|
2030
1980
|
warnedProperties$1[name] = true;
|
|
2031
1981
|
return true;
|
|
2032
1982
|
}
|
|
2033
1983
|
if (EVENT_NAME_REGEX.test(name)) {
|
|
2034
|
-
|
|
1984
|
+
warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
|
|
2035
1985
|
warnedProperties$1[name] = true;
|
|
2036
1986
|
return true;
|
|
2037
1987
|
}
|
|
@@ -2040,7 +1990,7 @@ var validateProperty$1 = function () {};
|
|
|
2040
1990
|
// So we can't tell if the event name is correct for sure, but we can filter
|
|
2041
1991
|
// out known bad ones like `onclick`. We can't suggest a specific replacement though.
|
|
2042
1992
|
if (INVALID_EVENT_NAME_REGEX.test(name)) {
|
|
2043
|
-
|
|
1993
|
+
warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
|
|
2044
1994
|
}
|
|
2045
1995
|
warnedProperties$1[name] = true;
|
|
2046
1996
|
return true;
|
|
@@ -2052,25 +2002,25 @@ var validateProperty$1 = function () {};
|
|
|
2052
2002
|
}
|
|
2053
2003
|
|
|
2054
2004
|
if (lowerCasedName === 'innerhtml') {
|
|
2055
|
-
|
|
2005
|
+
warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
|
|
2056
2006
|
warnedProperties$1[name] = true;
|
|
2057
2007
|
return true;
|
|
2058
2008
|
}
|
|
2059
2009
|
|
|
2060
2010
|
if (lowerCasedName === 'aria') {
|
|
2061
|
-
|
|
2011
|
+
warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
|
|
2062
2012
|
warnedProperties$1[name] = true;
|
|
2063
2013
|
return true;
|
|
2064
2014
|
}
|
|
2065
2015
|
|
|
2066
2016
|
if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
|
|
2067
|
-
|
|
2017
|
+
warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
|
|
2068
2018
|
warnedProperties$1[name] = true;
|
|
2069
2019
|
return true;
|
|
2070
2020
|
}
|
|
2071
2021
|
|
|
2072
2022
|
if (typeof value === 'number' && isNaN(value)) {
|
|
2073
|
-
|
|
2023
|
+
warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
|
|
2074
2024
|
warnedProperties$1[name] = true;
|
|
2075
2025
|
return true;
|
|
2076
2026
|
}
|
|
@@ -2082,23 +2032,23 @@ var validateProperty$1 = function () {};
|
|
|
2082
2032
|
if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
|
|
2083
2033
|
var standardName = possibleStandardNames[lowerCasedName];
|
|
2084
2034
|
if (standardName !== name) {
|
|
2085
|
-
|
|
2035
|
+
warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
|
|
2086
2036
|
warnedProperties$1[name] = true;
|
|
2087
2037
|
return true;
|
|
2088
2038
|
}
|
|
2089
2039
|
} else if (!isReserved && name !== lowerCasedName) {
|
|
2090
2040
|
// Unknown attributes should have lowercase casing since that's how they
|
|
2091
2041
|
// will be cased anyway with server rendering.
|
|
2092
|
-
|
|
2042
|
+
warning$1(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
|
|
2093
2043
|
warnedProperties$1[name] = true;
|
|
2094
2044
|
return true;
|
|
2095
2045
|
}
|
|
2096
2046
|
|
|
2097
2047
|
if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
|
2098
2048
|
if (value) {
|
|
2099
|
-
|
|
2049
|
+
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()}.', value, name, name, value, name);
|
|
2100
2050
|
} else {
|
|
2101
|
-
|
|
2051
|
+
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);
|
|
2102
2052
|
}
|
|
2103
2053
|
warnedProperties$1[name] = true;
|
|
2104
2054
|
return true;
|
|
@@ -2116,6 +2066,13 @@ var validateProperty$1 = function () {};
|
|
|
2116
2066
|
return false;
|
|
2117
2067
|
}
|
|
2118
2068
|
|
|
2069
|
+
// Warn when passing the strings 'false' or 'true' into a boolean prop
|
|
2070
|
+
if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
|
|
2071
|
+
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);
|
|
2072
|
+
warnedProperties$1[name] = true;
|
|
2073
|
+
return true;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2119
2076
|
return true;
|
|
2120
2077
|
};
|
|
2121
2078
|
}
|
|
@@ -2133,9 +2090,9 @@ var warnUnknownProperties = function (type, props, canUseEventSystem) {
|
|
|
2133
2090
|
return '`' + prop + '`';
|
|
2134
2091
|
}).join(', ');
|
|
2135
2092
|
if (unknownProps.length === 1) {
|
|
2136
|
-
|
|
2093
|
+
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);
|
|
2137
2094
|
} else if (unknownProps.length > 1) {
|
|
2138
|
-
|
|
2095
|
+
warning$1(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
|
|
2139
2096
|
}
|
|
2140
2097
|
};
|
|
2141
2098
|
|
|
@@ -2152,18 +2109,29 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
2152
2109
|
|
|
2153
2110
|
var toArray = React.Children.toArray;
|
|
2154
2111
|
|
|
2155
|
-
|
|
2156
|
-
|
|
2112
|
+
// This is only used in DEV.
|
|
2113
|
+
// Each entry is `this.stack` from a currently executing renderer instance.
|
|
2114
|
+
// (There may be more than one because ReactDOMServer is reentrant).
|
|
2115
|
+
// Each stack is an array of frames which may contain nested stacks of elements.
|
|
2116
|
+
var currentDebugStacks = [];
|
|
2157
2117
|
|
|
2158
|
-
var
|
|
2159
|
-
var
|
|
2118
|
+
var ReactDebugCurrentFrame = void 0;
|
|
2119
|
+
var prevGetCurrentStackImpl = null;
|
|
2120
|
+
var getCurrentServerStackImpl = function () {
|
|
2121
|
+
return '';
|
|
2122
|
+
};
|
|
2123
|
+
var describeStackFrame = function (element) {
|
|
2124
|
+
return '';
|
|
2125
|
+
};
|
|
2160
2126
|
|
|
2161
2127
|
var validatePropertiesInDevelopment = function (type, props) {};
|
|
2162
|
-
var
|
|
2128
|
+
var pushCurrentDebugStack = function (stack) {};
|
|
2163
2129
|
var pushElementToDebugStack = function (element) {};
|
|
2164
|
-
var
|
|
2130
|
+
var popCurrentDebugStack = function () {};
|
|
2165
2131
|
|
|
2166
2132
|
{
|
|
2133
|
+
ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
2134
|
+
|
|
2167
2135
|
validatePropertiesInDevelopment = function (type, props) {
|
|
2168
2136
|
validateProperties(type, props);
|
|
2169
2137
|
validateProperties$1(type, props);
|
|
@@ -2178,34 +2146,55 @@ var resetCurrentDebugStack = function () {};
|
|
|
2178
2146
|
return describeComponentFrame(name, source, ownerName);
|
|
2179
2147
|
};
|
|
2180
2148
|
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2149
|
+
pushCurrentDebugStack = function (stack) {
|
|
2150
|
+
currentDebugStacks.push(stack);
|
|
2151
|
+
|
|
2152
|
+
if (currentDebugStacks.length === 1) {
|
|
2153
|
+
// We are entering a server renderer.
|
|
2154
|
+
// Remember the previous (e.g. client) global stack implementation.
|
|
2155
|
+
prevGetCurrentStackImpl = ReactDebugCurrentFrame.getCurrentStack;
|
|
2156
|
+
ReactDebugCurrentFrame.getCurrentStack = getCurrentServerStackImpl;
|
|
2157
|
+
}
|
|
2190
2158
|
};
|
|
2159
|
+
|
|
2191
2160
|
pushElementToDebugStack = function (element) {
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2161
|
+
// For the innermost executing ReactDOMServer call,
|
|
2162
|
+
var stack = currentDebugStacks[currentDebugStacks.length - 1];
|
|
2163
|
+
// Take the innermost executing frame (e.g. <Foo>),
|
|
2164
|
+
var frame = stack[stack.length - 1];
|
|
2165
|
+
// and record that it has one more element associated with it.
|
|
2166
|
+
frame.debugElementStack.push(element);
|
|
2167
|
+
// We only need this because we tail-optimize single-element
|
|
2168
|
+
// children and directly handle them in an inner loop instead of
|
|
2169
|
+
// creating separate frames for them.
|
|
2195
2170
|
};
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2171
|
+
|
|
2172
|
+
popCurrentDebugStack = function () {
|
|
2173
|
+
currentDebugStacks.pop();
|
|
2174
|
+
|
|
2175
|
+
if (currentDebugStacks.length === 0) {
|
|
2176
|
+
// We are exiting the server renderer.
|
|
2177
|
+
// Restore the previous (e.g. client) global stack implementation.
|
|
2178
|
+
ReactDebugCurrentFrame.getCurrentStack = prevGetCurrentStackImpl;
|
|
2179
|
+
prevGetCurrentStackImpl = null;
|
|
2180
|
+
}
|
|
2200
2181
|
};
|
|
2201
|
-
|
|
2202
|
-
|
|
2182
|
+
|
|
2183
|
+
getCurrentServerStackImpl = function () {
|
|
2184
|
+
if (currentDebugStacks.length === 0) {
|
|
2185
|
+
// Nothing is currently rendering.
|
|
2203
2186
|
return '';
|
|
2204
2187
|
}
|
|
2188
|
+
// ReactDOMServer is reentrant so there may be multiple calls at the same time.
|
|
2189
|
+
// Take the frames from the innermost call which is the last in the array.
|
|
2190
|
+
var frames = currentDebugStacks[currentDebugStacks.length - 1];
|
|
2205
2191
|
var stack = '';
|
|
2206
|
-
|
|
2207
|
-
for (var i =
|
|
2208
|
-
var frame =
|
|
2192
|
+
// Go through every frame in the stack from the innermost one.
|
|
2193
|
+
for (var i = frames.length - 1; i >= 0; i--) {
|
|
2194
|
+
var frame = frames[i];
|
|
2195
|
+
// Every frame might have more than one debug element stack entry associated with it.
|
|
2196
|
+
// This is because single-child nesting doesn't create materialized frames.
|
|
2197
|
+
// Instead it would push them through `pushElementToDebugStack()`.
|
|
2209
2198
|
var _debugElementStack = frame.debugElementStack;
|
|
2210
2199
|
for (var ii = _debugElementStack.length - 1; ii >= 0; ii--) {
|
|
2211
2200
|
stack += describeStackFrame(_debugElementStack[ii]);
|
|
@@ -2232,10 +2221,6 @@ var newlineEatingTags = {
|
|
|
2232
2221
|
textarea: true
|
|
2233
2222
|
};
|
|
2234
2223
|
|
|
2235
|
-
function getComponentName(type) {
|
|
2236
|
-
return typeof type === 'string' ? type : typeof type === 'function' ? type.displayName || type.name : null;
|
|
2237
|
-
}
|
|
2238
|
-
|
|
2239
2224
|
// We accept any tag to be rendered but since this gets injected into arbitrary
|
|
2240
2225
|
// HTML, we want to make sure that it's a safe tag.
|
|
2241
2226
|
// http://www.w3.org/TR/REC-xml/#NT-Name
|
|
@@ -2243,14 +2228,20 @@ var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
|
|
|
2243
2228
|
var validatedTagCache = {};
|
|
2244
2229
|
function validateDangerousTag(tag) {
|
|
2245
2230
|
if (!validatedTagCache.hasOwnProperty(tag)) {
|
|
2246
|
-
!VALID_TAG_REGEX.test(tag) ?
|
|
2231
|
+
!VALID_TAG_REGEX.test(tag) ? invariant(false, 'Invalid tag: %s', tag) : void 0;
|
|
2247
2232
|
validatedTagCache[tag] = true;
|
|
2248
2233
|
}
|
|
2249
2234
|
}
|
|
2250
2235
|
|
|
2251
|
-
var
|
|
2252
|
-
|
|
2253
|
-
|
|
2236
|
+
var styleNameCache = {};
|
|
2237
|
+
var processStyleName = function (styleName) {
|
|
2238
|
+
if (styleNameCache.hasOwnProperty(styleName)) {
|
|
2239
|
+
return styleNameCache[styleName];
|
|
2240
|
+
}
|
|
2241
|
+
var result = hyphenateStyleName(styleName);
|
|
2242
|
+
styleNameCache[styleName] = result;
|
|
2243
|
+
return result;
|
|
2244
|
+
};
|
|
2254
2245
|
|
|
2255
2246
|
function createMarkupForStyles(styles) {
|
|
2256
2247
|
var serialized = '';
|
|
@@ -2263,7 +2254,7 @@ function createMarkupForStyles(styles) {
|
|
|
2263
2254
|
var styleValue = styles[styleName];
|
|
2264
2255
|
{
|
|
2265
2256
|
if (!isCustomProperty) {
|
|
2266
|
-
warnValidStyle$1(styleName, styleValue
|
|
2257
|
+
warnValidStyle$1(styleName, styleValue);
|
|
2267
2258
|
}
|
|
2268
2259
|
}
|
|
2269
2260
|
if (styleValue != null) {
|
|
@@ -2285,7 +2276,7 @@ function warnNoop(publicInstance, callerName) {
|
|
|
2285
2276
|
return;
|
|
2286
2277
|
}
|
|
2287
2278
|
|
|
2288
|
-
|
|
2279
|
+
warningWithoutStack$1(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
|
|
2289
2280
|
didWarnAboutNoopUpdateForComponent[warningKey] = true;
|
|
2290
2281
|
}
|
|
2291
2282
|
}
|
|
@@ -2326,6 +2317,9 @@ function flattenTopLevelChildren(children) {
|
|
|
2326
2317
|
}
|
|
2327
2318
|
|
|
2328
2319
|
function flattenOptionChildren(children) {
|
|
2320
|
+
if (children === undefined || children === null) {
|
|
2321
|
+
return children;
|
|
2322
|
+
}
|
|
2329
2323
|
var content = '';
|
|
2330
2324
|
// Flatten children and warn if they aren't strings or numbers;
|
|
2331
2325
|
// invalid types are ignored.
|
|
@@ -2333,24 +2327,26 @@ function flattenOptionChildren(children) {
|
|
|
2333
2327
|
if (child == null) {
|
|
2334
2328
|
return;
|
|
2335
2329
|
}
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
didWarnInvalidOptionChildren = true;
|
|
2342
|
-
warning_1(false, 'Only strings and numbers are supported as <option> children.');
|
|
2343
|
-
}
|
|
2330
|
+
content += child;
|
|
2331
|
+
{
|
|
2332
|
+
if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
|
|
2333
|
+
didWarnInvalidOptionChildren = true;
|
|
2334
|
+
warning$1(false, 'Only strings and numbers are supported as <option> children.');
|
|
2344
2335
|
}
|
|
2345
2336
|
}
|
|
2346
2337
|
});
|
|
2347
2338
|
return content;
|
|
2348
2339
|
}
|
|
2349
2340
|
|
|
2341
|
+
var emptyObject = {};
|
|
2342
|
+
{
|
|
2343
|
+
Object.freeze(emptyObject);
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2350
2346
|
function maskContext(type, context) {
|
|
2351
2347
|
var contextTypes = type.contextTypes;
|
|
2352
2348
|
if (!contextTypes) {
|
|
2353
|
-
return
|
|
2349
|
+
return emptyObject;
|
|
2354
2350
|
}
|
|
2355
2351
|
var maskedContext = {};
|
|
2356
2352
|
for (var contextName in contextTypes) {
|
|
@@ -2361,7 +2357,7 @@ function maskContext(type, context) {
|
|
|
2361
2357
|
|
|
2362
2358
|
function checkContextTypes(typeSpecs, values, location) {
|
|
2363
2359
|
{
|
|
2364
|
-
checkPropTypes_1(typeSpecs, values, location, 'Component',
|
|
2360
|
+
checkPropTypes_1(typeSpecs, values, location, 'Component', getCurrentServerStackImpl);
|
|
2365
2361
|
}
|
|
2366
2362
|
}
|
|
2367
2363
|
|
|
@@ -2375,6 +2371,7 @@ function processContext(type, context) {
|
|
|
2375
2371
|
return maskedContext;
|
|
2376
2372
|
}
|
|
2377
2373
|
|
|
2374
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2378
2375
|
var STYLE = 'style';
|
|
2379
2376
|
var RESERVED_PROPS = {
|
|
2380
2377
|
children: null,
|
|
@@ -2387,7 +2384,7 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
|
|
|
2387
2384
|
var ret = '<' + tagVerbatim;
|
|
2388
2385
|
|
|
2389
2386
|
for (var propKey in props) {
|
|
2390
|
-
if (!
|
|
2387
|
+
if (!hasOwnProperty.call(props, propKey)) {
|
|
2391
2388
|
continue;
|
|
2392
2389
|
}
|
|
2393
2390
|
var propValue = props[propKey];
|
|
@@ -2424,47 +2421,31 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
|
|
|
2424
2421
|
|
|
2425
2422
|
function validateRenderResult(child, type) {
|
|
2426
2423
|
if (child === undefined) {
|
|
2427
|
-
|
|
2424
|
+
invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', getComponentName(type) || 'Component');
|
|
2428
2425
|
}
|
|
2429
2426
|
}
|
|
2430
2427
|
|
|
2431
2428
|
function resolve(child, context) {
|
|
2432
|
-
var element = void 0;
|
|
2433
|
-
|
|
2434
|
-
var Component = void 0;
|
|
2435
|
-
var publicContext = void 0;
|
|
2436
|
-
var inst = void 0,
|
|
2437
|
-
queue = void 0,
|
|
2438
|
-
replace = void 0;
|
|
2439
|
-
var updater = void 0;
|
|
2440
|
-
|
|
2441
|
-
var initialState = void 0;
|
|
2442
|
-
var oldQueue = void 0,
|
|
2443
|
-
oldReplace = void 0;
|
|
2444
|
-
var nextState = void 0,
|
|
2445
|
-
dontMutate = void 0;
|
|
2446
|
-
var partial = void 0,
|
|
2447
|
-
partialState = void 0;
|
|
2448
|
-
|
|
2449
|
-
var childContext = void 0;
|
|
2450
|
-
var childContextTypes = void 0,
|
|
2451
|
-
contextKey = void 0;
|
|
2452
|
-
|
|
2453
2429
|
while (React.isValidElement(child)) {
|
|
2454
2430
|
// Safe because we just checked it's an element.
|
|
2455
|
-
element = child;
|
|
2431
|
+
var element = child;
|
|
2432
|
+
var Component = element.type;
|
|
2456
2433
|
{
|
|
2457
2434
|
pushElementToDebugStack(element);
|
|
2458
2435
|
}
|
|
2459
|
-
Component = element.type;
|
|
2460
2436
|
if (typeof Component !== 'function') {
|
|
2461
2437
|
break;
|
|
2462
2438
|
}
|
|
2463
|
-
|
|
2439
|
+
processChild(element, Component);
|
|
2440
|
+
}
|
|
2464
2441
|
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2442
|
+
// Extra closure so queue and replace can be captured properly
|
|
2443
|
+
function processChild(element, Component) {
|
|
2444
|
+
var publicContext = processContext(Component, context);
|
|
2445
|
+
|
|
2446
|
+
var queue = [];
|
|
2447
|
+
var replace = false;
|
|
2448
|
+
var updater = {
|
|
2468
2449
|
isMounted: function (publicInstance) {
|
|
2469
2450
|
return false;
|
|
2470
2451
|
},
|
|
@@ -2487,6 +2468,7 @@ function resolve(child, context) {
|
|
|
2487
2468
|
}
|
|
2488
2469
|
};
|
|
2489
2470
|
|
|
2471
|
+
var inst = void 0;
|
|
2490
2472
|
if (shouldConstruct(Component)) {
|
|
2491
2473
|
inst = new Component(element.props, publicContext, updater);
|
|
2492
2474
|
|
|
@@ -2495,19 +2477,19 @@ function resolve(child, context) {
|
|
|
2495
2477
|
if (inst.state === null || inst.state === undefined) {
|
|
2496
2478
|
var componentName = getComponentName(Component) || 'Unknown';
|
|
2497
2479
|
if (!didWarnAboutUninitializedState[componentName]) {
|
|
2498
|
-
|
|
2480
|
+
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);
|
|
2499
2481
|
didWarnAboutUninitializedState[componentName] = true;
|
|
2500
2482
|
}
|
|
2501
2483
|
}
|
|
2502
2484
|
}
|
|
2503
2485
|
|
|
2504
|
-
partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
|
2486
|
+
var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
|
2505
2487
|
|
|
2506
2488
|
{
|
|
2507
2489
|
if (partialState === undefined) {
|
|
2508
2490
|
var _componentName = getComponentName(Component) || 'Unknown';
|
|
2509
2491
|
if (!didWarnAboutUndefinedDerivedState[_componentName]) {
|
|
2510
|
-
|
|
2492
|
+
warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
|
|
2511
2493
|
didWarnAboutUndefinedDerivedState[_componentName] = true;
|
|
2512
2494
|
}
|
|
2513
2495
|
}
|
|
@@ -2523,7 +2505,7 @@ function resolve(child, context) {
|
|
|
2523
2505
|
var _componentName2 = getComponentName(Component) || 'Unknown';
|
|
2524
2506
|
|
|
2525
2507
|
if (!didWarnAboutBadClass[_componentName2]) {
|
|
2526
|
-
|
|
2508
|
+
warningWithoutStack$1(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', _componentName2, _componentName2);
|
|
2527
2509
|
didWarnAboutBadClass[_componentName2] = true;
|
|
2528
2510
|
}
|
|
2529
2511
|
}
|
|
@@ -2532,7 +2514,7 @@ function resolve(child, context) {
|
|
|
2532
2514
|
if (inst == null || inst.render == null) {
|
|
2533
2515
|
child = inst;
|
|
2534
2516
|
validateRenderResult(child, Component);
|
|
2535
|
-
|
|
2517
|
+
return;
|
|
2536
2518
|
}
|
|
2537
2519
|
}
|
|
2538
2520
|
|
|
@@ -2540,7 +2522,7 @@ function resolve(child, context) {
|
|
|
2540
2522
|
inst.context = publicContext;
|
|
2541
2523
|
inst.updater = updater;
|
|
2542
2524
|
|
|
2543
|
-
initialState = inst.state;
|
|
2525
|
+
var initialState = inst.state;
|
|
2544
2526
|
if (initialState === undefined) {
|
|
2545
2527
|
inst.state = initialState = null;
|
|
2546
2528
|
}
|
|
@@ -2569,25 +2551,25 @@ function resolve(child, context) {
|
|
|
2569
2551
|
inst.UNSAFE_componentWillMount();
|
|
2570
2552
|
}
|
|
2571
2553
|
if (queue.length) {
|
|
2572
|
-
oldQueue = queue;
|
|
2573
|
-
oldReplace = replace;
|
|
2554
|
+
var oldQueue = queue;
|
|
2555
|
+
var oldReplace = replace;
|
|
2574
2556
|
queue = null;
|
|
2575
2557
|
replace = false;
|
|
2576
2558
|
|
|
2577
2559
|
if (oldReplace && oldQueue.length === 1) {
|
|
2578
2560
|
inst.state = oldQueue[0];
|
|
2579
2561
|
} else {
|
|
2580
|
-
nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
2581
|
-
dontMutate = true;
|
|
2562
|
+
var nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
2563
|
+
var dontMutate = true;
|
|
2582
2564
|
for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
|
|
2583
|
-
partial = oldQueue[i];
|
|
2584
|
-
|
|
2585
|
-
if (
|
|
2565
|
+
var partial = oldQueue[i];
|
|
2566
|
+
var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
|
|
2567
|
+
if (_partialState != null) {
|
|
2586
2568
|
if (dontMutate) {
|
|
2587
2569
|
dontMutate = false;
|
|
2588
|
-
nextState = _assign({}, nextState,
|
|
2570
|
+
nextState = _assign({}, nextState, _partialState);
|
|
2589
2571
|
} else {
|
|
2590
|
-
_assign(nextState,
|
|
2572
|
+
_assign(nextState, _partialState);
|
|
2591
2573
|
}
|
|
2592
2574
|
}
|
|
2593
2575
|
}
|
|
@@ -2608,15 +2590,16 @@ function resolve(child, context) {
|
|
|
2608
2590
|
}
|
|
2609
2591
|
validateRenderResult(child, Component);
|
|
2610
2592
|
|
|
2593
|
+
var childContext = void 0;
|
|
2611
2594
|
if (typeof inst.getChildContext === 'function') {
|
|
2612
|
-
childContextTypes = Component.childContextTypes;
|
|
2595
|
+
var childContextTypes = Component.childContextTypes;
|
|
2613
2596
|
if (typeof childContextTypes === 'object') {
|
|
2614
2597
|
childContext = inst.getChildContext();
|
|
2615
|
-
for (contextKey in childContext) {
|
|
2616
|
-
!(contextKey in childContextTypes) ?
|
|
2598
|
+
for (var contextKey in childContext) {
|
|
2599
|
+
!(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
|
|
2617
2600
|
}
|
|
2618
2601
|
} else {
|
|
2619
|
-
|
|
2602
|
+
warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
|
|
2620
2603
|
}
|
|
2621
2604
|
}
|
|
2622
2605
|
if (childContext) {
|
|
@@ -2627,6 +2610,8 @@ function resolve(child, context) {
|
|
|
2627
2610
|
}
|
|
2628
2611
|
|
|
2629
2612
|
var ReactDOMServerRenderer = function () {
|
|
2613
|
+
// DEV-only
|
|
2614
|
+
|
|
2630
2615
|
function ReactDOMServerRenderer(children, makeStaticMarkup) {
|
|
2631
2616
|
_classCallCheck(this, ReactDOMServerRenderer);
|
|
2632
2617
|
|
|
@@ -2639,7 +2624,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2639
2624
|
domNamespace: Namespaces.html,
|
|
2640
2625
|
children: flatChildren,
|
|
2641
2626
|
childIndex: 0,
|
|
2642
|
-
context:
|
|
2627
|
+
context: emptyObject,
|
|
2643
2628
|
footer: ''
|
|
2644
2629
|
};
|
|
2645
2630
|
{
|
|
@@ -2652,33 +2637,65 @@ var ReactDOMServerRenderer = function () {
|
|
|
2652
2637
|
this.makeStaticMarkup = makeStaticMarkup;
|
|
2653
2638
|
|
|
2654
2639
|
// Context (new API)
|
|
2655
|
-
this.
|
|
2656
|
-
this.
|
|
2640
|
+
this.contextIndex = -1;
|
|
2641
|
+
this.contextStack = [];
|
|
2642
|
+
this.contextValueStack = [];
|
|
2643
|
+
{
|
|
2644
|
+
this.contextProviderStack = [];
|
|
2645
|
+
}
|
|
2657
2646
|
}
|
|
2647
|
+
|
|
2648
|
+
/**
|
|
2649
|
+
* Note: We use just two stacks regardless of how many context providers you have.
|
|
2650
|
+
* Providers are always popped in the reverse order to how they were pushed
|
|
2651
|
+
* so we always know on the way down which provider you'll encounter next on the way up.
|
|
2652
|
+
* On the way down, we push the current provider, and its context value *before*
|
|
2653
|
+
* we mutated it, onto the stacks. Therefore, on the way up, we always know which
|
|
2654
|
+
* provider needs to be "restored" to which value.
|
|
2655
|
+
* https://github.com/facebook/react/pull/12985#issuecomment-396301248
|
|
2656
|
+
*/
|
|
2657
|
+
|
|
2658
2658
|
// TODO: type this more strictly:
|
|
2659
2659
|
|
|
2660
2660
|
|
|
2661
2661
|
ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
|
|
2662
|
-
this.
|
|
2663
|
-
|
|
2664
|
-
var
|
|
2665
|
-
|
|
2662
|
+
var index = ++this.contextIndex;
|
|
2663
|
+
var context = provider.type._context;
|
|
2664
|
+
var previousValue = context._currentValue;
|
|
2665
|
+
|
|
2666
|
+
// Remember which value to restore this context to on our way up.
|
|
2667
|
+
this.contextStack[index] = context;
|
|
2668
|
+
this.contextValueStack[index] = previousValue;
|
|
2669
|
+
{
|
|
2670
|
+
// Only used for push/pop mismatch warnings.
|
|
2671
|
+
this.contextProviderStack[index] = provider;
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
// Mutate the current value.
|
|
2675
|
+
context._currentValue = provider.props.value;
|
|
2666
2676
|
};
|
|
2667
2677
|
|
|
2668
2678
|
ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
|
|
2679
|
+
var index = this.contextIndex;
|
|
2669
2680
|
{
|
|
2670
|
-
|
|
2681
|
+
!(index > -1 && provider === this.contextProviderStack[index]) ? warningWithoutStack$1(false, 'Unexpected pop.') : void 0;
|
|
2671
2682
|
}
|
|
2672
|
-
|
|
2673
|
-
this.
|
|
2674
|
-
var
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2683
|
+
|
|
2684
|
+
var context = this.contextStack[index];
|
|
2685
|
+
var previousValue = this.contextValueStack[index];
|
|
2686
|
+
|
|
2687
|
+
// "Hide" these null assignments from Flow by using `any`
|
|
2688
|
+
// because conceptually they are deletions--as long as we
|
|
2689
|
+
// promise to never access values beyond `this.contextIndex`.
|
|
2690
|
+
this.contextStack[index] = null;
|
|
2691
|
+
this.contextValueStack[index] = null;
|
|
2692
|
+
{
|
|
2693
|
+
this.contextProviderStack[index] = null;
|
|
2681
2694
|
}
|
|
2695
|
+
this.contextIndex--;
|
|
2696
|
+
|
|
2697
|
+
// Restore to the previous value we stored as we were walking down.
|
|
2698
|
+
context._currentValue = previousValue;
|
|
2682
2699
|
};
|
|
2683
2700
|
|
|
2684
2701
|
ReactDOMServerRenderer.prototype.read = function read(bytes) {
|
|
@@ -2710,12 +2727,15 @@ var ReactDOMServerRenderer = function () {
|
|
|
2710
2727
|
}
|
|
2711
2728
|
var child = frame.children[frame.childIndex++];
|
|
2712
2729
|
{
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2730
|
+
pushCurrentDebugStack(this.stack);
|
|
2731
|
+
// We're starting work on this frame, so reset its inner stack.
|
|
2732
|
+
frame.debugElementStack.length = 0;
|
|
2733
|
+
try {
|
|
2734
|
+
// Be careful! Make sure this matches the PROD path below.
|
|
2735
|
+
out += this.render(child, frame.context, frame.domNamespace);
|
|
2736
|
+
} finally {
|
|
2737
|
+
popCurrentDebugStack();
|
|
2738
|
+
}
|
|
2719
2739
|
}
|
|
2720
2740
|
}
|
|
2721
2741
|
return out;
|
|
@@ -2749,9 +2769,9 @@ var ReactDOMServerRenderer = function () {
|
|
|
2749
2769
|
if (nextChild != null && nextChild.$$typeof != null) {
|
|
2750
2770
|
// Catch unexpected special types early.
|
|
2751
2771
|
var $$typeof = nextChild.$$typeof;
|
|
2752
|
-
!($$typeof !== REACT_PORTAL_TYPE) ?
|
|
2772
|
+
!($$typeof !== REACT_PORTAL_TYPE) ? invariant(false, 'Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render.') : void 0;
|
|
2753
2773
|
// Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
|
|
2754
|
-
|
|
2774
|
+
invariant(false, 'Unknown element-like object type: %s. This is likely a bug in React. Please file an issue.', $$typeof.toString());
|
|
2755
2775
|
}
|
|
2756
2776
|
var nextChildren = toArray(nextChild);
|
|
2757
2777
|
var frame = {
|
|
@@ -2779,6 +2799,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2779
2799
|
switch (elementType) {
|
|
2780
2800
|
case REACT_STRICT_MODE_TYPE:
|
|
2781
2801
|
case REACT_ASYNC_MODE_TYPE:
|
|
2802
|
+
case REACT_PROFILER_TYPE:
|
|
2782
2803
|
case REACT_FRAGMENT_TYPE:
|
|
2783
2804
|
{
|
|
2784
2805
|
var _nextChildren = toArray(nextChild.props.children);
|
|
@@ -2796,56 +2817,92 @@ var ReactDOMServerRenderer = function () {
|
|
|
2796
2817
|
this.stack.push(_frame);
|
|
2797
2818
|
return '';
|
|
2798
2819
|
}
|
|
2799
|
-
case
|
|
2800
|
-
|
|
2801
|
-
|
|
2820
|
+
case REACT_PLACEHOLDER_TYPE:
|
|
2821
|
+
{
|
|
2822
|
+
if (enableSuspenseServerRenderer) {
|
|
2823
|
+
var _nextChildren2 = toArray(
|
|
2824
|
+
// Always use the fallback when synchronously rendering to string.
|
|
2825
|
+
nextChild.props.fallback);
|
|
2826
|
+
var _frame2 = {
|
|
2827
|
+
type: null,
|
|
2828
|
+
domNamespace: parentNamespace,
|
|
2829
|
+
children: _nextChildren2,
|
|
2830
|
+
childIndex: 0,
|
|
2831
|
+
context: context,
|
|
2832
|
+
footer: ''
|
|
2833
|
+
};
|
|
2834
|
+
{
|
|
2835
|
+
_frame2.debugElementStack = [];
|
|
2836
|
+
}
|
|
2837
|
+
this.stack.push(_frame2);
|
|
2838
|
+
return '';
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2802
2841
|
// eslint-disable-next-line-no-fallthrough
|
|
2803
2842
|
default:
|
|
2804
2843
|
break;
|
|
2805
2844
|
}
|
|
2806
2845
|
if (typeof elementType === 'object' && elementType !== null) {
|
|
2807
2846
|
switch (elementType.$$typeof) {
|
|
2847
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2848
|
+
{
|
|
2849
|
+
var element = nextChild;
|
|
2850
|
+
var _nextChildren3 = toArray(elementType.render(element.props, element.ref));
|
|
2851
|
+
var _frame3 = {
|
|
2852
|
+
type: null,
|
|
2853
|
+
domNamespace: parentNamespace,
|
|
2854
|
+
children: _nextChildren3,
|
|
2855
|
+
childIndex: 0,
|
|
2856
|
+
context: context,
|
|
2857
|
+
footer: ''
|
|
2858
|
+
};
|
|
2859
|
+
{
|
|
2860
|
+
_frame3.debugElementStack = [];
|
|
2861
|
+
}
|
|
2862
|
+
this.stack.push(_frame3);
|
|
2863
|
+
return '';
|
|
2864
|
+
}
|
|
2808
2865
|
case REACT_PROVIDER_TYPE:
|
|
2809
2866
|
{
|
|
2810
2867
|
var provider = nextChild;
|
|
2811
2868
|
var nextProps = provider.props;
|
|
2812
|
-
var
|
|
2813
|
-
var
|
|
2869
|
+
var _nextChildren4 = toArray(nextProps.children);
|
|
2870
|
+
var _frame4 = {
|
|
2814
2871
|
type: provider,
|
|
2815
2872
|
domNamespace: parentNamespace,
|
|
2816
|
-
children:
|
|
2873
|
+
children: _nextChildren4,
|
|
2817
2874
|
childIndex: 0,
|
|
2818
2875
|
context: context,
|
|
2819
2876
|
footer: ''
|
|
2820
2877
|
};
|
|
2821
2878
|
{
|
|
2822
|
-
|
|
2879
|
+
_frame4.debugElementStack = [];
|
|
2823
2880
|
}
|
|
2824
2881
|
|
|
2825
2882
|
this.pushProvider(provider);
|
|
2826
2883
|
|
|
2827
|
-
this.stack.push(
|
|
2884
|
+
this.stack.push(_frame4);
|
|
2828
2885
|
return '';
|
|
2829
2886
|
}
|
|
2830
2887
|
case REACT_CONTEXT_TYPE:
|
|
2831
2888
|
{
|
|
2832
2889
|
var consumer = nextChild;
|
|
2833
2890
|
var _nextProps = consumer.props;
|
|
2834
|
-
var nextValue = consumer.type.
|
|
2891
|
+
var nextValue = consumer.type._currentValue;
|
|
2835
2892
|
|
|
2836
|
-
var
|
|
2837
|
-
var
|
|
2893
|
+
var _nextChildren5 = toArray(_nextProps.children(nextValue));
|
|
2894
|
+
var _frame5 = {
|
|
2838
2895
|
type: nextChild,
|
|
2839
2896
|
domNamespace: parentNamespace,
|
|
2840
|
-
children:
|
|
2897
|
+
children: _nextChildren5,
|
|
2841
2898
|
childIndex: 0,
|
|
2842
2899
|
context: context,
|
|
2843
2900
|
footer: ''
|
|
2844
2901
|
};
|
|
2845
2902
|
{
|
|
2846
|
-
|
|
2903
|
+
_frame5.debugElementStack = [];
|
|
2847
2904
|
}
|
|
2848
|
-
this.stack.push(
|
|
2905
|
+
this.stack.push(_frame5);
|
|
2849
2906
|
return '';
|
|
2850
2907
|
}
|
|
2851
2908
|
default:
|
|
@@ -2864,7 +2921,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2864
2921
|
info += '\n\nCheck the render method of `' + ownerName + '`.';
|
|
2865
2922
|
}
|
|
2866
2923
|
}
|
|
2867
|
-
|
|
2924
|
+
invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', elementType == null ? elementType : typeof elementType, info);
|
|
2868
2925
|
}
|
|
2869
2926
|
};
|
|
2870
2927
|
|
|
@@ -2880,7 +2937,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2880
2937
|
if (namespace === Namespaces.html) {
|
|
2881
2938
|
// Should this check be gated by parent namespace? Not sure we want to
|
|
2882
2939
|
// allow <SVG> or <mATH>.
|
|
2883
|
-
|
|
2940
|
+
!(tag === element.type) ? warning$1(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type) : void 0;
|
|
2884
2941
|
}
|
|
2885
2942
|
}
|
|
2886
2943
|
|
|
@@ -2889,14 +2946,14 @@ var ReactDOMServerRenderer = function () {
|
|
|
2889
2946
|
var props = element.props;
|
|
2890
2947
|
if (tag === 'input') {
|
|
2891
2948
|
{
|
|
2892
|
-
ReactControlledValuePropTypes.checkPropTypes('input', props
|
|
2949
|
+
ReactControlledValuePropTypes.checkPropTypes('input', props);
|
|
2893
2950
|
|
|
2894
2951
|
if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
|
|
2895
|
-
|
|
2952
|
+
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);
|
|
2896
2953
|
didWarnDefaultChecked = true;
|
|
2897
2954
|
}
|
|
2898
2955
|
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
|
|
2899
|
-
|
|
2956
|
+
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);
|
|
2900
2957
|
didWarnDefaultInputValue = true;
|
|
2901
2958
|
}
|
|
2902
2959
|
}
|
|
@@ -2911,9 +2968,9 @@ var ReactDOMServerRenderer = function () {
|
|
|
2911
2968
|
});
|
|
2912
2969
|
} else if (tag === 'textarea') {
|
|
2913
2970
|
{
|
|
2914
|
-
ReactControlledValuePropTypes.checkPropTypes('textarea', props
|
|
2971
|
+
ReactControlledValuePropTypes.checkPropTypes('textarea', props);
|
|
2915
2972
|
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
|
|
2916
|
-
|
|
2973
|
+
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');
|
|
2917
2974
|
didWarnDefaultTextareaValue = true;
|
|
2918
2975
|
}
|
|
2919
2976
|
}
|
|
@@ -2925,11 +2982,11 @@ var ReactDOMServerRenderer = function () {
|
|
|
2925
2982
|
var textareaChildren = props.children;
|
|
2926
2983
|
if (textareaChildren != null) {
|
|
2927
2984
|
{
|
|
2928
|
-
|
|
2985
|
+
warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
|
|
2929
2986
|
}
|
|
2930
|
-
!(defaultValue == null) ?
|
|
2987
|
+
!(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
|
|
2931
2988
|
if (Array.isArray(textareaChildren)) {
|
|
2932
|
-
!(textareaChildren.length <= 1) ?
|
|
2989
|
+
!(textareaChildren.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
|
|
2933
2990
|
textareaChildren = textareaChildren[0];
|
|
2934
2991
|
}
|
|
2935
2992
|
|
|
@@ -2947,7 +3004,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2947
3004
|
});
|
|
2948
3005
|
} else if (tag === 'select') {
|
|
2949
3006
|
{
|
|
2950
|
-
ReactControlledValuePropTypes.checkPropTypes('select', props
|
|
3007
|
+
ReactControlledValuePropTypes.checkPropTypes('select', props);
|
|
2951
3008
|
|
|
2952
3009
|
for (var i = 0; i < valuePropNames.length; i++) {
|
|
2953
3010
|
var propName = valuePropNames[i];
|
|
@@ -2956,14 +3013,14 @@ var ReactDOMServerRenderer = function () {
|
|
|
2956
3013
|
}
|
|
2957
3014
|
var isArray = Array.isArray(props[propName]);
|
|
2958
3015
|
if (props.multiple && !isArray) {
|
|
2959
|
-
|
|
3016
|
+
warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
|
|
2960
3017
|
} else if (!props.multiple && isArray) {
|
|
2961
|
-
|
|
3018
|
+
warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
|
|
2962
3019
|
}
|
|
2963
3020
|
}
|
|
2964
3021
|
|
|
2965
3022
|
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
|
|
2966
|
-
|
|
3023
|
+
warning$1(false, 'Select 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 select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
|
|
2967
3024
|
didWarnDefaultSelectValue = true;
|
|
2968
3025
|
}
|
|
2969
3026
|
}
|
|
@@ -3009,7 +3066,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
3009
3066
|
validatePropertiesInDevelopment(tag, props);
|
|
3010
3067
|
}
|
|
3011
3068
|
|
|
3012
|
-
assertValidProps(tag, props
|
|
3069
|
+
assertValidProps(tag, props);
|
|
3013
3070
|
|
|
3014
3071
|
var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
|
|
3015
3072
|
var footer = '';
|
|
@@ -3082,11 +3139,11 @@ function renderToStaticMarkup(element) {
|
|
|
3082
3139
|
}
|
|
3083
3140
|
|
|
3084
3141
|
function renderToNodeStream() {
|
|
3085
|
-
|
|
3142
|
+
invariant(false, 'ReactDOMServer.renderToNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead.');
|
|
3086
3143
|
}
|
|
3087
3144
|
|
|
3088
3145
|
function renderToStaticNodeStream() {
|
|
3089
|
-
|
|
3146
|
+
invariant(false, 'ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead.');
|
|
3090
3147
|
}
|
|
3091
3148
|
|
|
3092
3149
|
// Note: when changing this, also consider https://github.com/facebook/react/issues/11526
|
|
@@ -3106,7 +3163,7 @@ var ReactDOMServer = ( ReactDOMServerBrowser$1 && ReactDOMServerBrowser ) || Rea
|
|
|
3106
3163
|
|
|
3107
3164
|
// TODO: decide on the top-level export form.
|
|
3108
3165
|
// This is hacky but makes it work with both Rollup and Jest
|
|
3109
|
-
var server_browser = ReactDOMServer
|
|
3166
|
+
var server_browser = ReactDOMServer.default || ReactDOMServer;
|
|
3110
3167
|
|
|
3111
3168
|
return server_browser;
|
|
3112
3169
|
|