react-dom 16.8.5 → 16.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +5 -5
- package/cjs/react-dom-server.browser.development.js +473 -136
- package/cjs/react-dom-server.browser.production.min.js +45 -42
- package/cjs/react-dom-server.node.development.js +456 -131
- package/cjs/react-dom-server.node.production.min.js +46 -44
- package/cjs/react-dom-test-utils.development.js +328 -82
- package/cjs/react-dom-test-utils.production.min.js +26 -23
- package/cjs/react-dom-unstable-fizz.browser.development.js +9 -1
- package/cjs/react-dom-unstable-fizz.browser.production.min.js +1 -1
- package/cjs/react-dom-unstable-fizz.node.development.js +9 -1
- package/cjs/react-dom-unstable-fizz.node.production.min.js +1 -1
- package/cjs/react-dom-unstable-native-dependencies.development.js +67 -44
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +20 -21
- package/cjs/react-dom.development.js +15465 -11493
- package/cjs/react-dom.production.min.js +266 -257
- package/cjs/react-dom.profiling.min.js +272 -263
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +473 -136
- package/umd/react-dom-server.browser.production.min.js +38 -37
- package/umd/react-dom-test-utils.development.js +349 -82
- package/umd/react-dom-test-utils.production.min.js +23 -22
- package/umd/react-dom-unstable-fizz.browser.development.js +9 -1
- package/umd/react-dom-unstable-fizz.browser.production.min.js +1 -1
- package/umd/react-dom-unstable-native-dependencies.development.js +67 -44
- package/umd/react-dom-unstable-native-dependencies.production.min.js +21 -22
- package/umd/react-dom.development.js +12006 -8031
- package/umd/react-dom.production.min.js +220 -209
- package/umd/react-dom.profiling.min.js +227 -214
- package/cjs/react-dom-unstable-fire.development.js +0 -21252
- package/cjs/react-dom-unstable-fire.production.min.js +0 -269
- package/cjs/react-dom-unstable-fire.profiling.min.js +0 -278
- package/umd/react-dom-unstable-fire.development.js +0 -21387
- package/umd/react-dom-unstable-fire.production.min.js +0 -220
- package/umd/react-dom-unstable-fire.profiling.min.js +0 -225
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.9.0
|
|
2
2
|
* react-dom-server.node.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -22,7 +22,20 @@ var stream = require('stream');
|
|
|
22
22
|
|
|
23
23
|
// TODO: this is special because it gets imported during build.
|
|
24
24
|
|
|
25
|
-
var ReactVersion = '16.
|
|
25
|
+
var ReactVersion = '16.9.0';
|
|
26
|
+
|
|
27
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
28
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
29
|
+
// build, and in production they will be minified.
|
|
30
|
+
|
|
31
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
32
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
33
|
+
// build, and in production they will be minified.
|
|
34
|
+
|
|
35
|
+
function ReactError(error) {
|
|
36
|
+
error.name = 'Invariant Violation';
|
|
37
|
+
return error;
|
|
38
|
+
}
|
|
26
39
|
|
|
27
40
|
/**
|
|
28
41
|
* Use invariant() to assert state which your program assumes to be true.
|
|
@@ -35,40 +48,6 @@ var ReactVersion = '16.8.5';
|
|
|
35
48
|
* will remain to ensure logic does not differ in production.
|
|
36
49
|
*/
|
|
37
50
|
|
|
38
|
-
var validateFormat = function () {};
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
validateFormat = function (format) {
|
|
42
|
-
if (format === undefined) {
|
|
43
|
-
throw new Error('invariant requires an error message argument');
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
|
49
|
-
validateFormat(format);
|
|
50
|
-
|
|
51
|
-
if (!condition) {
|
|
52
|
-
var error = void 0;
|
|
53
|
-
if (format === undefined) {
|
|
54
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
55
|
-
} else {
|
|
56
|
-
var args = [a, b, c, d, e, f];
|
|
57
|
-
var argIndex = 0;
|
|
58
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
59
|
-
return args[argIndex++];
|
|
60
|
-
}));
|
|
61
|
-
error.name = 'Invariant Violation';
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
65
|
-
throw error;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Relying on the `invariant()` implementation lets us
|
|
70
|
-
// preserve the format and params in the www builds.
|
|
71
|
-
|
|
72
51
|
/**
|
|
73
52
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
74
53
|
* This can be used to log issues in development environments in critical
|
|
@@ -130,12 +109,16 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac
|
|
|
130
109
|
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
131
110
|
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
132
111
|
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
112
|
+
// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
113
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
133
114
|
|
|
134
115
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
135
116
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
136
117
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
118
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
137
119
|
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
138
120
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
121
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
139
122
|
|
|
140
123
|
var Resolved = 1;
|
|
141
124
|
|
|
@@ -166,8 +149,6 @@ function getComponentName(type) {
|
|
|
166
149
|
return type;
|
|
167
150
|
}
|
|
168
151
|
switch (type) {
|
|
169
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
170
|
-
return 'ConcurrentMode';
|
|
171
152
|
case REACT_FRAGMENT_TYPE:
|
|
172
153
|
return 'Fragment';
|
|
173
154
|
case REACT_PORTAL_TYPE:
|
|
@@ -178,6 +159,8 @@ function getComponentName(type) {
|
|
|
178
159
|
return 'StrictMode';
|
|
179
160
|
case REACT_SUSPENSE_TYPE:
|
|
180
161
|
return 'Suspense';
|
|
162
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
163
|
+
return 'SuspenseList';
|
|
181
164
|
}
|
|
182
165
|
if (typeof type === 'object') {
|
|
183
166
|
switch (type.$$typeof) {
|
|
@@ -196,6 +179,7 @@ function getComponentName(type) {
|
|
|
196
179
|
if (resolvedThenable) {
|
|
197
180
|
return getComponentName(resolvedThenable);
|
|
198
181
|
}
|
|
182
|
+
break;
|
|
199
183
|
}
|
|
200
184
|
}
|
|
201
185
|
}
|
|
@@ -265,6 +249,11 @@ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
|
|
265
249
|
current: null
|
|
266
250
|
};
|
|
267
251
|
}
|
|
252
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
|
|
253
|
+
ReactSharedInternals.ReactCurrentBatchConfig = {
|
|
254
|
+
suspense: null
|
|
255
|
+
};
|
|
256
|
+
}
|
|
268
257
|
|
|
269
258
|
/**
|
|
270
259
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
@@ -336,7 +325,7 @@ var describeComponentFrame = function (name, source, ownerName) {
|
|
|
336
325
|
|
|
337
326
|
|
|
338
327
|
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
339
|
-
var warnAboutDeprecatedLifecycles =
|
|
328
|
+
var warnAboutDeprecatedLifecycles = true;
|
|
340
329
|
|
|
341
330
|
// Gather advanced timing metrics for Profiler subtrees.
|
|
342
331
|
|
|
@@ -353,6 +342,9 @@ var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be f
|
|
|
353
342
|
// Only used in www builds.
|
|
354
343
|
|
|
355
344
|
|
|
345
|
+
// Disable javascript: URL strings in href for XSS protection.
|
|
346
|
+
var disableJavaScriptURLs = false;
|
|
347
|
+
|
|
356
348
|
// React Fire: prevent the value and checked attributes from syncing
|
|
357
349
|
// with their related DOM properties
|
|
358
350
|
|
|
@@ -360,13 +352,56 @@ var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be f
|
|
|
360
352
|
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
361
353
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
362
354
|
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
359
|
+
// This is a flag so we can fix warnings in RN core before turning it on
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
// Experimental React Flare event system and event components support.
|
|
363
|
+
var enableFlareAPI = false;
|
|
364
|
+
|
|
365
|
+
// Experimental Host Component support.
|
|
366
|
+
var enableFundamentalAPI = false;
|
|
367
|
+
|
|
368
|
+
// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
372
|
+
// Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
|
|
373
|
+
|
|
374
|
+
// Temporary flag to revert the fix in #15650
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
// For tests, we flush suspense fallbacks in an act scope;
|
|
378
|
+
// *except* in some of our own tests, where we test incremental loading states.
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
// Changes priority of some events like mousemove to user-blocking priority,
|
|
382
|
+
// but without making them discrete. The flag exists in case it causes
|
|
383
|
+
// starvation problems.
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
// Add a callback property to suspense to notify which promises are currently
|
|
387
|
+
// in the update queue. This allows reporting and tracing of what is causing
|
|
388
|
+
// the user to see a loading state.
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
// Part of the simplification of React.createElement so we can eventually move
|
|
392
|
+
// from React.createElement to React.jsx
|
|
393
|
+
// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
var disableLegacyContext = false;
|
|
397
|
+
|
|
363
398
|
var ReactDebugCurrentFrame$1 = void 0;
|
|
399
|
+
var didWarnAboutInvalidateContextType = void 0;
|
|
364
400
|
{
|
|
365
401
|
ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
402
|
+
didWarnAboutInvalidateContextType = new Set();
|
|
366
403
|
}
|
|
367
404
|
|
|
368
|
-
var didWarnAboutInvalidateContextType = {};
|
|
369
|
-
|
|
370
405
|
var emptyObject = {};
|
|
371
406
|
{
|
|
372
407
|
Object.freeze(emptyObject);
|
|
@@ -404,28 +439,72 @@ function validateContextBounds(context, threadID) {
|
|
|
404
439
|
}
|
|
405
440
|
}
|
|
406
441
|
|
|
407
|
-
function processContext(type, context, threadID) {
|
|
408
|
-
|
|
409
|
-
|
|
442
|
+
function processContext(type, context, threadID, isClass) {
|
|
443
|
+
if (isClass) {
|
|
444
|
+
var contextType = type.contextType;
|
|
410
445
|
{
|
|
411
|
-
if (contextType
|
|
412
|
-
var
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
446
|
+
if ('contextType' in type) {
|
|
447
|
+
var isValid =
|
|
448
|
+
// Allow null for conditional declaration
|
|
449
|
+
contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
|
|
450
|
+
|
|
451
|
+
if (!isValid && !didWarnAboutInvalidateContextType.has(type)) {
|
|
452
|
+
didWarnAboutInvalidateContextType.add(type);
|
|
453
|
+
|
|
454
|
+
var addendum = '';
|
|
455
|
+
if (contextType === undefined) {
|
|
456
|
+
addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
|
|
457
|
+
} else if (typeof contextType !== 'object') {
|
|
458
|
+
addendum = ' However, it is set to a ' + typeof contextType + '.';
|
|
459
|
+
} else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
|
|
460
|
+
addendum = ' Did you accidentally pass the Context.Provider instead?';
|
|
461
|
+
} else if (contextType._context !== undefined) {
|
|
462
|
+
// <Context.Consumer>
|
|
463
|
+
addendum = ' Did you accidentally pass the Context.Consumer instead?';
|
|
464
|
+
} else {
|
|
465
|
+
addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
|
|
466
|
+
}
|
|
467
|
+
warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(type) || 'Component', addendum);
|
|
416
468
|
}
|
|
417
469
|
}
|
|
418
470
|
}
|
|
419
|
-
|
|
420
|
-
|
|
471
|
+
if (typeof contextType === 'object' && contextType !== null) {
|
|
472
|
+
validateContextBounds(contextType, threadID);
|
|
473
|
+
return contextType[threadID];
|
|
474
|
+
}
|
|
475
|
+
if (disableLegacyContext) {
|
|
476
|
+
{
|
|
477
|
+
if (type.contextTypes) {
|
|
478
|
+
warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with static contextType instead.', getComponentName(type) || 'Unknown');
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return emptyObject;
|
|
482
|
+
} else {
|
|
483
|
+
var maskedContext = maskContext(type, context);
|
|
484
|
+
{
|
|
485
|
+
if (type.contextTypes) {
|
|
486
|
+
checkContextTypes(type.contextTypes, maskedContext, 'context');
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return maskedContext;
|
|
490
|
+
}
|
|
421
491
|
} else {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
492
|
+
if (disableLegacyContext) {
|
|
493
|
+
{
|
|
494
|
+
if (type.contextTypes) {
|
|
495
|
+
warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(type) || 'Unknown');
|
|
496
|
+
}
|
|
426
497
|
}
|
|
498
|
+
return undefined;
|
|
499
|
+
} else {
|
|
500
|
+
var _maskedContext = maskContext(type, context);
|
|
501
|
+
{
|
|
502
|
+
if (type.contextTypes) {
|
|
503
|
+
checkContextTypes(type.contextTypes, _maskedContext, 'context');
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return _maskedContext;
|
|
427
507
|
}
|
|
428
|
-
return maskedContext;
|
|
429
508
|
}
|
|
430
509
|
}
|
|
431
510
|
|
|
@@ -443,7 +522,13 @@ function growThreadCountAndReturnNextAvailable() {
|
|
|
443
522
|
var oldArray = nextAvailableThreadIDs;
|
|
444
523
|
var oldSize = oldArray.length;
|
|
445
524
|
var newSize = oldSize * 2;
|
|
446
|
-
|
|
525
|
+
(function () {
|
|
526
|
+
if (!(newSize <= 0x10000)) {
|
|
527
|
+
{
|
|
528
|
+
throw ReactError(Error('Maximum number of concurrent React renderers exceeded. This can happen if you are not properly destroying the Readable provided by React. Ensure that you call .destroy() on it if you no longer want to read from it, and did not read to the end. If you use .pipe() this should be automatic.'));
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
})();
|
|
447
532
|
var newArray = new Uint16Array(newSize);
|
|
448
533
|
newArray.set(oldArray);
|
|
449
534
|
nextAvailableThreadIDs = newArray;
|
|
@@ -602,13 +687,14 @@ function getPropertyInfo(name) {
|
|
|
602
687
|
return properties.hasOwnProperty(name) ? properties[name] : null;
|
|
603
688
|
}
|
|
604
689
|
|
|
605
|
-
function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) {
|
|
690
|
+
function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
|
|
606
691
|
this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
|
|
607
692
|
this.attributeName = attributeName;
|
|
608
693
|
this.attributeNamespace = attributeNamespace;
|
|
609
694
|
this.mustUseProperty = mustUseProperty;
|
|
610
695
|
this.propertyName = name;
|
|
611
696
|
this.type = type;
|
|
697
|
+
this.sanitizeURL = sanitizeURL;
|
|
612
698
|
}
|
|
613
699
|
|
|
614
700
|
// When adding attributes to this list, be sure to also add them to
|
|
@@ -624,8 +710,9 @@ var properties = {};
|
|
|
624
710
|
'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
|
|
625
711
|
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
|
|
626
712
|
name, // attributeName
|
|
627
|
-
null
|
|
628
|
-
|
|
713
|
+
null, // attributeNamespace
|
|
714
|
+
false);
|
|
715
|
+
} // sanitizeURL
|
|
629
716
|
);
|
|
630
717
|
|
|
631
718
|
// A few React string attributes have a different name.
|
|
@@ -636,8 +723,9 @@ var properties = {};
|
|
|
636
723
|
|
|
637
724
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
638
725
|
attributeName, // attributeName
|
|
639
|
-
null
|
|
640
|
-
|
|
726
|
+
null, // attributeNamespace
|
|
727
|
+
false);
|
|
728
|
+
} // sanitizeURL
|
|
641
729
|
);
|
|
642
730
|
|
|
643
731
|
// These are "enumerated" HTML attributes that accept "true" and "false".
|
|
@@ -646,8 +734,9 @@ var properties = {};
|
|
|
646
734
|
['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
|
|
647
735
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
648
736
|
name.toLowerCase(), // attributeName
|
|
649
|
-
null
|
|
650
|
-
|
|
737
|
+
null, // attributeNamespace
|
|
738
|
+
false);
|
|
739
|
+
} // sanitizeURL
|
|
651
740
|
);
|
|
652
741
|
|
|
653
742
|
// These are "enumerated" SVG attributes that accept "true" and "false".
|
|
@@ -657,21 +746,23 @@ var properties = {};
|
|
|
657
746
|
['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
|
|
658
747
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
659
748
|
name, // attributeName
|
|
660
|
-
null
|
|
661
|
-
|
|
749
|
+
null, // attributeNamespace
|
|
750
|
+
false);
|
|
751
|
+
} // sanitizeURL
|
|
662
752
|
);
|
|
663
753
|
|
|
664
754
|
// These are HTML boolean attributes.
|
|
665
755
|
['allowFullScreen', 'async',
|
|
666
756
|
// Note: there is a special case that prevents it from being written to the DOM
|
|
667
757
|
// on the client side because the browsers are inconsistent. Instead we call focus().
|
|
668
|
-
'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
|
|
758
|
+
'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
|
|
669
759
|
// Microdata
|
|
670
760
|
'itemScope'].forEach(function (name) {
|
|
671
761
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
|
672
762
|
name.toLowerCase(), // attributeName
|
|
673
|
-
null
|
|
674
|
-
|
|
763
|
+
null, // attributeNamespace
|
|
764
|
+
false);
|
|
765
|
+
} // sanitizeURL
|
|
675
766
|
);
|
|
676
767
|
|
|
677
768
|
// These are the few React props that we set as DOM properties
|
|
@@ -682,8 +773,9 @@ var properties = {};
|
|
|
682
773
|
'multiple', 'muted', 'selected'].forEach(function (name) {
|
|
683
774
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
|
684
775
|
name, // attributeName
|
|
685
|
-
null
|
|
686
|
-
|
|
776
|
+
null, // attributeNamespace
|
|
777
|
+
false);
|
|
778
|
+
} // sanitizeURL
|
|
687
779
|
);
|
|
688
780
|
|
|
689
781
|
// These are HTML attributes that are "overloaded booleans": they behave like
|
|
@@ -691,24 +783,27 @@ var properties = {};
|
|
|
691
783
|
['capture', 'download'].forEach(function (name) {
|
|
692
784
|
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
|
|
693
785
|
name, // attributeName
|
|
694
|
-
null
|
|
695
|
-
|
|
786
|
+
null, // attributeNamespace
|
|
787
|
+
false);
|
|
788
|
+
} // sanitizeURL
|
|
696
789
|
);
|
|
697
790
|
|
|
698
791
|
// These are HTML attributes that must be positive numbers.
|
|
699
792
|
['cols', 'rows', 'size', 'span'].forEach(function (name) {
|
|
700
793
|
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
|
|
701
794
|
name, // attributeName
|
|
702
|
-
null
|
|
703
|
-
|
|
795
|
+
null, // attributeNamespace
|
|
796
|
+
false);
|
|
797
|
+
} // sanitizeURL
|
|
704
798
|
);
|
|
705
799
|
|
|
706
800
|
// These are HTML attributes that must be numbers.
|
|
707
801
|
['rowSpan', 'start'].forEach(function (name) {
|
|
708
802
|
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
|
|
709
803
|
name.toLowerCase(), // attributeName
|
|
710
|
-
null
|
|
711
|
-
|
|
804
|
+
null, // attributeNamespace
|
|
805
|
+
false);
|
|
806
|
+
} // sanitizeURL
|
|
712
807
|
);
|
|
713
808
|
|
|
714
809
|
var CAMELIZE = /[\-\:]([a-z])/g;
|
|
@@ -724,23 +819,26 @@ var capitalize = function (token) {
|
|
|
724
819
|
['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
|
|
725
820
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
726
821
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
727
|
-
attributeName, null
|
|
728
|
-
|
|
822
|
+
attributeName, null, // attributeNamespace
|
|
823
|
+
false);
|
|
824
|
+
} // sanitizeURL
|
|
729
825
|
);
|
|
730
826
|
|
|
731
827
|
// String SVG attributes with the xlink namespace.
|
|
732
|
-
['xlink:actuate', 'xlink:arcrole', 'xlink:
|
|
828
|
+
['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
|
733
829
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
734
830
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
735
|
-
attributeName, 'http://www.w3.org/1999/xlink');
|
|
736
|
-
}
|
|
831
|
+
attributeName, 'http://www.w3.org/1999/xlink', false);
|
|
832
|
+
} // sanitizeURL
|
|
833
|
+
);
|
|
737
834
|
|
|
738
835
|
// String SVG attributes with the xml namespace.
|
|
739
836
|
['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
|
|
740
837
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
741
838
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
742
|
-
attributeName, 'http://www.w3.org/XML/1998/namespace');
|
|
743
|
-
}
|
|
839
|
+
attributeName, 'http://www.w3.org/XML/1998/namespace', false);
|
|
840
|
+
} // sanitizeURL
|
|
841
|
+
);
|
|
744
842
|
|
|
745
843
|
// These attribute exists both in HTML and SVG.
|
|
746
844
|
// The attribute name is case-sensitive in SVG so we can't just use
|
|
@@ -748,10 +846,59 @@ var capitalize = function (token) {
|
|
|
748
846
|
['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
|
|
749
847
|
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
|
750
848
|
attributeName.toLowerCase(), // attributeName
|
|
751
|
-
null
|
|
752
|
-
|
|
849
|
+
null, // attributeNamespace
|
|
850
|
+
false);
|
|
851
|
+
} // sanitizeURL
|
|
753
852
|
);
|
|
754
853
|
|
|
854
|
+
// These attributes accept URLs. These must not allow javascript: URLS.
|
|
855
|
+
// These will also need to accept Trusted Types object in the future.
|
|
856
|
+
var xlinkHref = 'xlinkHref';
|
|
857
|
+
properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
|
|
858
|
+
'xlink:href', 'http://www.w3.org/1999/xlink', true);
|
|
859
|
+
|
|
860
|
+
['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
|
|
861
|
+
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
|
862
|
+
attributeName.toLowerCase(), // attributeName
|
|
863
|
+
null, // attributeNamespace
|
|
864
|
+
true);
|
|
865
|
+
} // sanitizeURL
|
|
866
|
+
);
|
|
867
|
+
|
|
868
|
+
var ReactDebugCurrentFrame$2 = null;
|
|
869
|
+
{
|
|
870
|
+
ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
// A javascript: URL can contain leading C0 control or \u0020 SPACE,
|
|
874
|
+
// and any newline or tab are filtered out as if they're not part of the URL.
|
|
875
|
+
// https://url.spec.whatwg.org/#url-parsing
|
|
876
|
+
// Tab or newline are defined as \r\n\t:
|
|
877
|
+
// https://infra.spec.whatwg.org/#ascii-tab-or-newline
|
|
878
|
+
// A C0 control is a code point in the range \u0000 NULL to \u001F
|
|
879
|
+
// INFORMATION SEPARATOR ONE, inclusive:
|
|
880
|
+
// https://infra.spec.whatwg.org/#c0-control-or-space
|
|
881
|
+
|
|
882
|
+
/* eslint-disable max-len */
|
|
883
|
+
var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
|
|
884
|
+
|
|
885
|
+
var didWarn = false;
|
|
886
|
+
|
|
887
|
+
function sanitizeURL(url) {
|
|
888
|
+
if (disableJavaScriptURLs) {
|
|
889
|
+
(function () {
|
|
890
|
+
if (!!isJavaScriptProtocol.test(url)) {
|
|
891
|
+
{
|
|
892
|
+
throw ReactError(Error('React has blocked a javascript: URL as a security precaution.' + (ReactDebugCurrentFrame$2.getStackAddendum())));
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
})();
|
|
896
|
+
} else if (true && !didWarn && isJavaScriptProtocol.test(url)) {
|
|
897
|
+
didWarn = true;
|
|
898
|
+
warning$1(false, 'A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
|
|
755
902
|
// code copied and modified from escape-html
|
|
756
903
|
/**
|
|
757
904
|
* Module variables.
|
|
@@ -883,6 +1030,10 @@ function createMarkupForProperty(name, value) {
|
|
|
883
1030
|
if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
|
|
884
1031
|
return attributeName + '=""';
|
|
885
1032
|
} else {
|
|
1033
|
+
if (propertyInfo.sanitizeURL) {
|
|
1034
|
+
value = '' + value;
|
|
1035
|
+
sanitizeURL(value);
|
|
1036
|
+
}
|
|
886
1037
|
return attributeName + '=' + quoteAttributeValueForBrowser(value);
|
|
887
1038
|
}
|
|
888
1039
|
} else if (isAttributeNameSafe(name)) {
|
|
@@ -933,7 +1084,13 @@ var isInHookUserCodeInDev = false;
|
|
|
933
1084
|
var currentHookNameInDev = void 0;
|
|
934
1085
|
|
|
935
1086
|
function resolveCurrentlyRenderingComponent() {
|
|
936
|
-
|
|
1087
|
+
(function () {
|
|
1088
|
+
if (!(currentlyRenderingComponent !== null)) {
|
|
1089
|
+
{
|
|
1090
|
+
throw ReactError(Error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.'));
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
})();
|
|
937
1094
|
{
|
|
938
1095
|
!!isInHookUserCodeInDev ? warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks') : void 0;
|
|
939
1096
|
}
|
|
@@ -966,7 +1123,13 @@ function areHookInputsEqual(nextDeps, prevDeps) {
|
|
|
966
1123
|
|
|
967
1124
|
function createHook() {
|
|
968
1125
|
if (numberOfReRenders > 0) {
|
|
969
|
-
|
|
1126
|
+
(function () {
|
|
1127
|
+
{
|
|
1128
|
+
{
|
|
1129
|
+
throw ReactError(Error('Rendered more hooks than during the previous render'));
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
})();
|
|
970
1133
|
}
|
|
971
1134
|
return {
|
|
972
1135
|
memoizedState: null,
|
|
@@ -1200,7 +1363,13 @@ function useLayoutEffect(create, inputs) {
|
|
|
1200
1363
|
}
|
|
1201
1364
|
|
|
1202
1365
|
function dispatchAction(componentIdentity, queue, action) {
|
|
1203
|
-
|
|
1366
|
+
(function () {
|
|
1367
|
+
if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
|
|
1368
|
+
{
|
|
1369
|
+
throw ReactError(Error('Too many re-renders. React limits the number of renders to prevent an infinite loop.'));
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
})();
|
|
1204
1373
|
|
|
1205
1374
|
if (componentIdentity === currentlyRenderingComponent) {
|
|
1206
1375
|
// This is a render phase update. Stash it in a lazily-created map of
|
|
@@ -1237,6 +1406,13 @@ function useCallback(callback, deps) {
|
|
|
1237
1406
|
return callback;
|
|
1238
1407
|
}
|
|
1239
1408
|
|
|
1409
|
+
function useResponder(responder, props) {
|
|
1410
|
+
return {
|
|
1411
|
+
props: props,
|
|
1412
|
+
responder: responder
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1240
1416
|
function noop() {}
|
|
1241
1417
|
|
|
1242
1418
|
var currentThreadID = 0;
|
|
@@ -1259,7 +1435,8 @@ var Dispatcher = {
|
|
|
1259
1435
|
// Effects are not run in the server environment.
|
|
1260
1436
|
useEffect: noop,
|
|
1261
1437
|
// Debugging effect
|
|
1262
|
-
useDebugValue: noop
|
|
1438
|
+
useDebugValue: noop,
|
|
1439
|
+
useResponder: useResponder
|
|
1263
1440
|
};
|
|
1264
1441
|
|
|
1265
1442
|
var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
@@ -1297,14 +1474,14 @@ function getChildNamespace(parentNamespace, type) {
|
|
|
1297
1474
|
return parentNamespace;
|
|
1298
1475
|
}
|
|
1299
1476
|
|
|
1300
|
-
var ReactDebugCurrentFrame$
|
|
1477
|
+
var ReactDebugCurrentFrame$3 = null;
|
|
1301
1478
|
|
|
1302
1479
|
var ReactControlledValuePropTypes = {
|
|
1303
1480
|
checkPropTypes: null
|
|
1304
1481
|
};
|
|
1305
1482
|
|
|
1306
1483
|
{
|
|
1307
|
-
ReactDebugCurrentFrame$
|
|
1484
|
+
ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1308
1485
|
|
|
1309
1486
|
var hasReadOnlyValue = {
|
|
1310
1487
|
button: true,
|
|
@@ -1318,13 +1495,13 @@ var ReactControlledValuePropTypes = {
|
|
|
1318
1495
|
|
|
1319
1496
|
var propTypes = {
|
|
1320
1497
|
value: function (props, propName, componentName) {
|
|
1321
|
-
if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) {
|
|
1498
|
+
if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
|
|
1322
1499
|
return null;
|
|
1323
1500
|
}
|
|
1324
1501
|
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`.');
|
|
1325
1502
|
},
|
|
1326
1503
|
checked: function (props, propName, componentName) {
|
|
1327
|
-
if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
|
|
1504
|
+
if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
|
|
1328
1505
|
return null;
|
|
1329
1506
|
}
|
|
1330
1507
|
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`.');
|
|
@@ -1336,7 +1513,7 @@ var ReactControlledValuePropTypes = {
|
|
|
1336
1513
|
* this outside of the ReactDOM controlled form components.
|
|
1337
1514
|
*/
|
|
1338
1515
|
ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
|
|
1339
|
-
checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$
|
|
1516
|
+
checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$3.getStackAddendum);
|
|
1340
1517
|
};
|
|
1341
1518
|
}
|
|
1342
1519
|
|
|
@@ -1373,9 +1550,9 @@ var voidElementTags = _assign({
|
|
|
1373
1550
|
// or add stack by default to invariants where possible.
|
|
1374
1551
|
var HTML = '__html';
|
|
1375
1552
|
|
|
1376
|
-
var ReactDebugCurrentFrame$
|
|
1553
|
+
var ReactDebugCurrentFrame$4 = null;
|
|
1377
1554
|
{
|
|
1378
|
-
ReactDebugCurrentFrame$
|
|
1555
|
+
ReactDebugCurrentFrame$4 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1379
1556
|
}
|
|
1380
1557
|
|
|
1381
1558
|
function assertValidProps(tag, props) {
|
|
@@ -1384,16 +1561,40 @@ function assertValidProps(tag, props) {
|
|
|
1384
1561
|
}
|
|
1385
1562
|
// Note the use of `==` which checks for null or undefined.
|
|
1386
1563
|
if (voidElementTags[tag]) {
|
|
1387
|
-
|
|
1564
|
+
(function () {
|
|
1565
|
+
if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
|
|
1566
|
+
{
|
|
1567
|
+
throw ReactError(Error(tag + ' is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.' + (ReactDebugCurrentFrame$4.getStackAddendum())));
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
})();
|
|
1388
1571
|
}
|
|
1389
1572
|
if (props.dangerouslySetInnerHTML != null) {
|
|
1390
|
-
|
|
1391
|
-
|
|
1573
|
+
(function () {
|
|
1574
|
+
if (!(props.children == null)) {
|
|
1575
|
+
{
|
|
1576
|
+
throw ReactError(Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.'));
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
})();
|
|
1580
|
+
(function () {
|
|
1581
|
+
if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) {
|
|
1582
|
+
{
|
|
1583
|
+
throw ReactError(Error('`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.'));
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
})();
|
|
1392
1587
|
}
|
|
1393
1588
|
{
|
|
1394
1589
|
!(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;
|
|
1395
1590
|
}
|
|
1396
|
-
|
|
1591
|
+
(function () {
|
|
1592
|
+
if (!(props.style == null || typeof props.style === 'object')) {
|
|
1593
|
+
{
|
|
1594
|
+
throw ReactError(Error('The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.' + (ReactDebugCurrentFrame$4.getStackAddendum())));
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
})();
|
|
1397
1598
|
}
|
|
1398
1599
|
|
|
1399
1600
|
/**
|
|
@@ -1894,6 +2095,7 @@ var possibleStandardNames = {
|
|
|
1894
2095
|
defer: 'defer',
|
|
1895
2096
|
dir: 'dir',
|
|
1896
2097
|
disabled: 'disabled',
|
|
2098
|
+
disablepictureinpicture: 'disablePictureInPicture',
|
|
1897
2099
|
download: 'download',
|
|
1898
2100
|
draggable: 'draggable',
|
|
1899
2101
|
enctype: 'encType',
|
|
@@ -2600,6 +2802,7 @@ var didWarnDefaultTextareaValue = false;
|
|
|
2600
2802
|
var didWarnInvalidOptionChildren = false;
|
|
2601
2803
|
var didWarnAboutNoopUpdateForComponent = {};
|
|
2602
2804
|
var didWarnAboutBadClass = {};
|
|
2805
|
+
var didWarnAboutModulePatternComponent = {};
|
|
2603
2806
|
var didWarnAboutDeprecatedWillMount = {};
|
|
2604
2807
|
var didWarnAboutUndefinedDerivedState = {};
|
|
2605
2808
|
var didWarnAboutUninitializedState = {};
|
|
@@ -2617,7 +2820,13 @@ var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
|
|
|
2617
2820
|
var validatedTagCache = {};
|
|
2618
2821
|
function validateDangerousTag(tag) {
|
|
2619
2822
|
if (!validatedTagCache.hasOwnProperty(tag)) {
|
|
2620
|
-
|
|
2823
|
+
(function () {
|
|
2824
|
+
if (!VALID_TAG_REGEX.test(tag)) {
|
|
2825
|
+
{
|
|
2826
|
+
throw ReactError(Error('Invalid tag: ' + tag));
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
})();
|
|
2621
2830
|
validatedTagCache[tag] = true;
|
|
2622
2831
|
}
|
|
2623
2832
|
}
|
|
@@ -2647,7 +2856,7 @@ function createMarkupForStyles(styles) {
|
|
|
2647
2856
|
}
|
|
2648
2857
|
}
|
|
2649
2858
|
if (styleValue != null) {
|
|
2650
|
-
serialized += delimiter + processStyleName(styleName) + ':';
|
|
2859
|
+
serialized += delimiter + (isCustomProperty ? styleName : processStyleName(styleName)) + ':';
|
|
2651
2860
|
serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
|
|
2652
2861
|
|
|
2653
2862
|
delimiter = ';';
|
|
@@ -2743,6 +2952,9 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
|
|
|
2743
2952
|
if (!hasOwnProperty.call(props, propKey)) {
|
|
2744
2953
|
continue;
|
|
2745
2954
|
}
|
|
2955
|
+
if (enableFlareAPI && propKey === 'listeners') {
|
|
2956
|
+
continue;
|
|
2957
|
+
}
|
|
2746
2958
|
var propValue = props[propKey];
|
|
2747
2959
|
if (propValue == null) {
|
|
2748
2960
|
continue;
|
|
@@ -2777,7 +2989,13 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
|
|
|
2777
2989
|
|
|
2778
2990
|
function validateRenderResult(child, type) {
|
|
2779
2991
|
if (child === undefined) {
|
|
2780
|
-
|
|
2992
|
+
(function () {
|
|
2993
|
+
{
|
|
2994
|
+
{
|
|
2995
|
+
throw ReactError(Error((getComponentName(type) || 'Component') + '(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.'));
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
})();
|
|
2781
2999
|
}
|
|
2782
3000
|
}
|
|
2783
3001
|
|
|
@@ -2797,7 +3015,8 @@ function resolve(child, context, threadID) {
|
|
|
2797
3015
|
|
|
2798
3016
|
// Extra closure so queue and replace can be captured properly
|
|
2799
3017
|
function processChild(element, Component) {
|
|
2800
|
-
var
|
|
3018
|
+
var isClass = shouldConstruct(Component);
|
|
3019
|
+
var publicContext = processContext(Component, context, threadID, isClass);
|
|
2801
3020
|
|
|
2802
3021
|
var queue = [];
|
|
2803
3022
|
var replace = false;
|
|
@@ -2825,7 +3044,7 @@ function resolve(child, context, threadID) {
|
|
|
2825
3044
|
};
|
|
2826
3045
|
|
|
2827
3046
|
var inst = void 0;
|
|
2828
|
-
if (
|
|
3047
|
+
if (isClass) {
|
|
2829
3048
|
inst = new Component(element.props, publicContext, updater);
|
|
2830
3049
|
|
|
2831
3050
|
if (typeof Component.getDerivedStateFromProps === 'function') {
|
|
@@ -2876,6 +3095,14 @@ function resolve(child, context, threadID) {
|
|
|
2876
3095
|
validateRenderResult(child, Component);
|
|
2877
3096
|
return;
|
|
2878
3097
|
}
|
|
3098
|
+
|
|
3099
|
+
{
|
|
3100
|
+
var _componentName3 = getComponentName(Component) || 'Unknown';
|
|
3101
|
+
if (!didWarnAboutModulePatternComponent[_componentName3]) {
|
|
3102
|
+
warningWithoutStack$1(false, 'The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName3, _componentName3, _componentName3);
|
|
3103
|
+
didWarnAboutModulePatternComponent[_componentName3] = true;
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
2879
3106
|
}
|
|
2880
3107
|
|
|
2881
3108
|
inst.props = element.props;
|
|
@@ -2890,11 +3117,13 @@ function resolve(child, context, threadID) {
|
|
|
2890
3117
|
if (typeof inst.componentWillMount === 'function') {
|
|
2891
3118
|
{
|
|
2892
3119
|
if (warnAboutDeprecatedLifecycles && inst.componentWillMount.__suppressDeprecationWarning !== true) {
|
|
2893
|
-
var
|
|
3120
|
+
var _componentName4 = getComponentName(Component) || 'Unknown';
|
|
2894
3121
|
|
|
2895
|
-
if (!didWarnAboutDeprecatedWillMount[
|
|
2896
|
-
lowPriorityWarning$1(false,
|
|
2897
|
-
|
|
3122
|
+
if (!didWarnAboutDeprecatedWillMount[_componentName4]) {
|
|
3123
|
+
lowPriorityWarning$1(false,
|
|
3124
|
+
// keep this warning in sync with ReactStrictModeWarning.js
|
|
3125
|
+
'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move code from componentWillMount to componentDidMount (preferred in most cases) ' + 'or the constructor.\n' + '\nPlease update the following components: %s', _componentName4);
|
|
3126
|
+
didWarnAboutDeprecatedWillMount[_componentName4] = true;
|
|
2898
3127
|
}
|
|
2899
3128
|
}
|
|
2900
3129
|
}
|
|
@@ -2951,19 +3180,34 @@ function resolve(child, context, threadID) {
|
|
|
2951
3180
|
validateRenderResult(child, Component);
|
|
2952
3181
|
|
|
2953
3182
|
var childContext = void 0;
|
|
2954
|
-
if (
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
!(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
|
|
3183
|
+
if (disableLegacyContext) {
|
|
3184
|
+
{
|
|
3185
|
+
var childContextTypes = Component.childContextTypes;
|
|
3186
|
+
if (childContextTypes !== undefined) {
|
|
3187
|
+
warningWithoutStack$1(false, '%s uses the legacy childContextTypes API which is no longer supported. ' + 'Use React.createContext() instead.', getComponentName(Component) || 'Unknown');
|
|
2960
3188
|
}
|
|
2961
|
-
} else {
|
|
2962
|
-
warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
|
|
2963
3189
|
}
|
|
2964
|
-
}
|
|
2965
|
-
|
|
2966
|
-
|
|
3190
|
+
} else {
|
|
3191
|
+
if (typeof inst.getChildContext === 'function') {
|
|
3192
|
+
var _childContextTypes = Component.childContextTypes;
|
|
3193
|
+
if (typeof _childContextTypes === 'object') {
|
|
3194
|
+
childContext = inst.getChildContext();
|
|
3195
|
+
for (var contextKey in childContext) {
|
|
3196
|
+
(function () {
|
|
3197
|
+
if (!(contextKey in _childContextTypes)) {
|
|
3198
|
+
{
|
|
3199
|
+
throw ReactError(Error((getComponentName(Component) || 'Unknown') + '.getChildContext(): key "' + contextKey + '" is not defined in childContextTypes.'));
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
})();
|
|
3203
|
+
}
|
|
3204
|
+
} else {
|
|
3205
|
+
warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
if (childContext) {
|
|
3209
|
+
context = _assign({}, context, childContext);
|
|
3210
|
+
}
|
|
2967
3211
|
}
|
|
2968
3212
|
}
|
|
2969
3213
|
return { child: child, context: context };
|
|
@@ -3119,8 +3363,15 @@ var ReactDOMServerRenderer = function () {
|
|
|
3119
3363
|
suspended = false;
|
|
3120
3364
|
// If rendering was suspended at this boundary, render the fallbackFrame
|
|
3121
3365
|
var _fallbackFrame = frame.fallbackFrame;
|
|
3122
|
-
|
|
3366
|
+
(function () {
|
|
3367
|
+
if (!_fallbackFrame) {
|
|
3368
|
+
{
|
|
3369
|
+
throw ReactError(Error('suspense fallback not found, something is broken'));
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
})();
|
|
3123
3373
|
this.stack.push(_fallbackFrame);
|
|
3374
|
+
out[this.suspenseDepth] += '<!--$!-->';
|
|
3124
3375
|
// Skip flushing output since we're switching to the fallback
|
|
3125
3376
|
continue;
|
|
3126
3377
|
} else {
|
|
@@ -3193,9 +3444,21 @@ var ReactDOMServerRenderer = function () {
|
|
|
3193
3444
|
if (nextChild != null && nextChild.$$typeof != null) {
|
|
3194
3445
|
// Catch unexpected special types early.
|
|
3195
3446
|
var $$typeof = nextChild.$$typeof;
|
|
3196
|
-
|
|
3447
|
+
(function () {
|
|
3448
|
+
if (!($$typeof !== REACT_PORTAL_TYPE)) {
|
|
3449
|
+
{
|
|
3450
|
+
throw ReactError(Error('Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render.'));
|
|
3451
|
+
}
|
|
3452
|
+
}
|
|
3453
|
+
})();
|
|
3197
3454
|
// Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
|
|
3198
|
-
|
|
3455
|
+
(function () {
|
|
3456
|
+
{
|
|
3457
|
+
{
|
|
3458
|
+
throw ReactError(Error('Unknown element-like object type: ' + $$typeof.toString() + '. This is likely a bug in React. Please file an issue.'));
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3461
|
+
})();
|
|
3199
3462
|
}
|
|
3200
3463
|
var nextChildren = toArray(nextChild);
|
|
3201
3464
|
var frame = {
|
|
@@ -3224,6 +3487,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
3224
3487
|
case REACT_STRICT_MODE_TYPE:
|
|
3225
3488
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
3226
3489
|
case REACT_PROFILER_TYPE:
|
|
3490
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
3227
3491
|
case REACT_FRAGMENT_TYPE:
|
|
3228
3492
|
{
|
|
3229
3493
|
var _nextChildren = toArray(nextChild.props.children);
|
|
@@ -3270,8 +3534,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
3270
3534
|
children: fallbackChildren,
|
|
3271
3535
|
childIndex: 0,
|
|
3272
3536
|
context: context,
|
|
3273
|
-
footer: ''
|
|
3274
|
-
out: ''
|
|
3537
|
+
footer: '<!--/$-->'
|
|
3275
3538
|
};
|
|
3276
3539
|
var _frame2 = {
|
|
3277
3540
|
fallbackFrame: _fallbackFrame2,
|
|
@@ -3290,7 +3553,13 @@ var ReactDOMServerRenderer = function () {
|
|
|
3290
3553
|
this.suspenseDepth++;
|
|
3291
3554
|
return '<!--$-->';
|
|
3292
3555
|
} else {
|
|
3293
|
-
|
|
3556
|
+
(function () {
|
|
3557
|
+
{
|
|
3558
|
+
{
|
|
3559
|
+
throw ReactError(Error('ReactDOMServer does not yet support Suspense.'));
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
})();
|
|
3294
3563
|
}
|
|
3295
3564
|
}
|
|
3296
3565
|
// eslint-disable-next-line-no-fallthrough
|
|
@@ -3407,8 +3676,46 @@ var ReactDOMServerRenderer = function () {
|
|
|
3407
3676
|
this.stack.push(_frame7);
|
|
3408
3677
|
return '';
|
|
3409
3678
|
}
|
|
3679
|
+
// eslint-disable-next-line-no-fallthrough
|
|
3680
|
+
case REACT_FUNDAMENTAL_TYPE:
|
|
3681
|
+
{
|
|
3682
|
+
if (enableFundamentalAPI) {
|
|
3683
|
+
var fundamentalImpl = elementType.impl;
|
|
3684
|
+
var open = fundamentalImpl.getServerSideString(null, nextElement.props);
|
|
3685
|
+
var getServerSideStringClose = fundamentalImpl.getServerSideStringClose;
|
|
3686
|
+
var close = getServerSideStringClose !== undefined ? getServerSideStringClose(null, nextElement.props) : '';
|
|
3687
|
+
var _nextChildren8 = fundamentalImpl.reconcileChildren !== false ? toArray(nextChild.props.children) : [];
|
|
3688
|
+
var _frame8 = {
|
|
3689
|
+
type: null,
|
|
3690
|
+
domNamespace: parentNamespace,
|
|
3691
|
+
children: _nextChildren8,
|
|
3692
|
+
childIndex: 0,
|
|
3693
|
+
context: context,
|
|
3694
|
+
footer: close
|
|
3695
|
+
};
|
|
3696
|
+
{
|
|
3697
|
+
_frame8.debugElementStack = [];
|
|
3698
|
+
}
|
|
3699
|
+
this.stack.push(_frame8);
|
|
3700
|
+
return open;
|
|
3701
|
+
}
|
|
3702
|
+
(function () {
|
|
3703
|
+
{
|
|
3704
|
+
{
|
|
3705
|
+
throw ReactError(Error('ReactDOMServer does not yet support the fundamental API.'));
|
|
3706
|
+
}
|
|
3707
|
+
}
|
|
3708
|
+
})();
|
|
3709
|
+
}
|
|
3710
|
+
// eslint-disable-next-line-no-fallthrough
|
|
3410
3711
|
case REACT_LAZY_TYPE:
|
|
3411
|
-
|
|
3712
|
+
(function () {
|
|
3713
|
+
{
|
|
3714
|
+
{
|
|
3715
|
+
throw ReactError(Error('ReactDOMServer does not yet support lazy-loaded components.'));
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
})();
|
|
3412
3719
|
}
|
|
3413
3720
|
}
|
|
3414
3721
|
|
|
@@ -3423,7 +3730,13 @@ var ReactDOMServerRenderer = function () {
|
|
|
3423
3730
|
info += '\n\nCheck the render method of `' + ownerName + '`.';
|
|
3424
3731
|
}
|
|
3425
3732
|
}
|
|
3426
|
-
|
|
3733
|
+
(function () {
|
|
3734
|
+
{
|
|
3735
|
+
{
|
|
3736
|
+
throw ReactError(Error('Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ' + (elementType == null ? elementType : typeof elementType) + '.' + info));
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
})();
|
|
3427
3740
|
}
|
|
3428
3741
|
};
|
|
3429
3742
|
|
|
@@ -3486,9 +3799,21 @@ var ReactDOMServerRenderer = function () {
|
|
|
3486
3799
|
{
|
|
3487
3800
|
warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
|
|
3488
3801
|
}
|
|
3489
|
-
|
|
3802
|
+
(function () {
|
|
3803
|
+
if (!(defaultValue == null)) {
|
|
3804
|
+
{
|
|
3805
|
+
throw ReactError(Error('If you supply `defaultValue` on a <textarea>, do not pass children.'));
|
|
3806
|
+
}
|
|
3807
|
+
}
|
|
3808
|
+
})();
|
|
3490
3809
|
if (Array.isArray(textareaChildren)) {
|
|
3491
|
-
|
|
3810
|
+
(function () {
|
|
3811
|
+
if (!(textareaChildren.length <= 1)) {
|
|
3812
|
+
{
|
|
3813
|
+
throw ReactError(Error('<textarea> can only have at most one child.'));
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
})();
|
|
3492
3817
|
textareaChildren = textareaChildren[0];
|
|
3493
3818
|
}
|
|
3494
3819
|
|