react-dom 16.4.0-alpha.3174632 → 16.4.2
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/cjs/react-dom-server.browser.development.js +177 -122
- package/cjs/react-dom-server.browser.production.min.js +30 -30
- package/cjs/react-dom-server.node.development.js +178 -123
- package/cjs/react-dom-server.node.production.min.js +32 -32
- package/cjs/react-dom-test-utils.development.js +145 -136
- package/cjs/react-dom-test-utils.production.min.js +25 -26
- package/cjs/react-dom-unstable-native-dependencies.development.js +81 -61
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +27 -28
- package/cjs/react-dom.development.js +11463 -10750
- package/cjs/react-dom.production.min.js +229 -239
- package/cjs/react-dom.profiling.min.js +242 -0
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +181 -126
- package/umd/react-dom-server.browser.production.min.js +30 -28
- package/umd/react-dom-test-utils.development.js +145 -136
- package/umd/react-dom-test-utils.production.min.js +20 -21
- package/umd/react-dom-unstable-native-dependencies.development.js +82 -62
- package/umd/react-dom-unstable-native-dependencies.production.min.js +23 -23
- package/umd/react-dom.development.js +11592 -10879
- package/umd/react-dom.production.min.js +188 -201
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.4.
|
|
1
|
+
/** @license React v16.4.2
|
|
2
2
|
* react-dom-server.browser.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -15,17 +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.3174632';
|
|
28
|
-
|
|
29
18
|
/**
|
|
30
19
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
31
20
|
*
|
|
@@ -80,6 +69,13 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
80
69
|
|
|
81
70
|
var invariant_1 = invariant;
|
|
82
71
|
|
|
72
|
+
// Relying on the `invariant()` implementation lets us
|
|
73
|
+
// have preserve the format and params in the www builds.
|
|
74
|
+
|
|
75
|
+
// TODO: this is special because it gets imported during build.
|
|
76
|
+
|
|
77
|
+
var ReactVersion = '16.4.2';
|
|
78
|
+
|
|
83
79
|
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
84
80
|
|
|
85
81
|
var _assign = ReactInternals.assign;
|
|
@@ -432,16 +428,11 @@ var ReactDebugCurrentFrame = ReactInternals$1.ReactDebugCurrentFrame;
|
|
|
432
428
|
// Exports ReactDOM.createRoot
|
|
433
429
|
|
|
434
430
|
|
|
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
431
|
// Experimental error-boundary API that can recover from errors within a single
|
|
443
432
|
// render phase
|
|
444
433
|
|
|
434
|
+
// Suspense
|
|
435
|
+
|
|
445
436
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
446
437
|
|
|
447
438
|
|
|
@@ -458,21 +449,27 @@ var ReactDebugCurrentFrame = ReactInternals$1.ReactDebugCurrentFrame;
|
|
|
458
449
|
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
459
450
|
var warnAboutDeprecatedLifecycles = false;
|
|
460
451
|
|
|
452
|
+
// Warn about legacy context API
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
// Gather advanced timing metrics for Profiler subtrees.
|
|
456
|
+
|
|
457
|
+
|
|
461
458
|
// Only used in www builds.
|
|
462
459
|
|
|
463
460
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
464
461
|
// nor polyfill, then a plain number is used for performance.
|
|
465
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol
|
|
462
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
466
463
|
|
|
467
464
|
|
|
468
|
-
var
|
|
469
|
-
var
|
|
470
|
-
var
|
|
471
|
-
var
|
|
472
|
-
var
|
|
473
|
-
var
|
|
474
|
-
var
|
|
475
|
-
var
|
|
465
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
466
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
467
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
468
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
469
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
470
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
471
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
472
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
476
473
|
|
|
477
474
|
// A reserved attribute.
|
|
478
475
|
// It is handled by React separately and shouldn't be written to the DOM.
|
|
@@ -516,14 +513,15 @@ var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u
|
|
|
516
513
|
var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
|
|
517
514
|
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
518
515
|
|
|
516
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
519
517
|
var illegalAttributeNameCache = {};
|
|
520
518
|
var validatedAttributeNameCache = {};
|
|
521
519
|
|
|
522
520
|
function isAttributeNameSafe(attributeName) {
|
|
523
|
-
if (
|
|
521
|
+
if (hasOwnProperty$1.call(validatedAttributeNameCache, attributeName)) {
|
|
524
522
|
return true;
|
|
525
523
|
}
|
|
526
|
-
if (
|
|
524
|
+
if (hasOwnProperty$1.call(illegalAttributeNameCache, attributeName)) {
|
|
527
525
|
return false;
|
|
528
526
|
}
|
|
529
527
|
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
|
@@ -584,6 +582,9 @@ function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)
|
|
|
584
582
|
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
|
585
583
|
return true;
|
|
586
584
|
}
|
|
585
|
+
if (isCustomComponentTag) {
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
587
588
|
if (propertyInfo !== null) {
|
|
588
589
|
switch (propertyInfo.type) {
|
|
589
590
|
case BOOLEAN:
|
|
@@ -626,15 +627,20 @@ var properties = {};
|
|
|
626
627
|
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
|
|
627
628
|
name, // attributeName
|
|
628
629
|
null);
|
|
629
|
-
}
|
|
630
|
+
} // attributeNamespace
|
|
631
|
+
);
|
|
630
632
|
|
|
631
633
|
// A few React string attributes have a different name.
|
|
632
634
|
// This is a mapping from React prop names to the attribute names.
|
|
633
|
-
|
|
635
|
+
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
|
636
|
+
var name = _ref[0],
|
|
637
|
+
attributeName = _ref[1];
|
|
638
|
+
|
|
634
639
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
635
640
|
attributeName, // attributeName
|
|
636
641
|
null);
|
|
637
|
-
}
|
|
642
|
+
} // attributeNamespace
|
|
643
|
+
);
|
|
638
644
|
|
|
639
645
|
// These are "enumerated" HTML attributes that accept "true" and "false".
|
|
640
646
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -643,7 +649,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
643
649
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
644
650
|
name.toLowerCase(), // attributeName
|
|
645
651
|
null);
|
|
646
|
-
}
|
|
652
|
+
} // attributeNamespace
|
|
653
|
+
);
|
|
647
654
|
|
|
648
655
|
// These are "enumerated" SVG attributes that accept "true" and "false".
|
|
649
656
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -653,7 +660,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
653
660
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
654
661
|
name, // attributeName
|
|
655
662
|
null);
|
|
656
|
-
}
|
|
663
|
+
} // attributeNamespace
|
|
664
|
+
);
|
|
657
665
|
|
|
658
666
|
// These are HTML boolean attributes.
|
|
659
667
|
['allowFullScreen', 'async',
|
|
@@ -665,7 +673,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
665
673
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
|
666
674
|
name.toLowerCase(), // attributeName
|
|
667
675
|
null);
|
|
668
|
-
}
|
|
676
|
+
} // attributeNamespace
|
|
677
|
+
);
|
|
669
678
|
|
|
670
679
|
// These are the few React props that we set as DOM properties
|
|
671
680
|
// rather than attributes. These are all booleans.
|
|
@@ -676,7 +685,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
676
685
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
|
677
686
|
name.toLowerCase(), // attributeName
|
|
678
687
|
null);
|
|
679
|
-
}
|
|
688
|
+
} // attributeNamespace
|
|
689
|
+
);
|
|
680
690
|
|
|
681
691
|
// These are HTML attributes that are "overloaded booleans": they behave like
|
|
682
692
|
// booleans, but can also accept a string value.
|
|
@@ -684,21 +694,24 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
684
694
|
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
|
|
685
695
|
name.toLowerCase(), // attributeName
|
|
686
696
|
null);
|
|
687
|
-
}
|
|
697
|
+
} // attributeNamespace
|
|
698
|
+
);
|
|
688
699
|
|
|
689
700
|
// These are HTML attributes that must be positive numbers.
|
|
690
701
|
['cols', 'rows', 'size', 'span'].forEach(function (name) {
|
|
691
702
|
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
|
|
692
703
|
name.toLowerCase(), // attributeName
|
|
693
704
|
null);
|
|
694
|
-
}
|
|
705
|
+
} // attributeNamespace
|
|
706
|
+
);
|
|
695
707
|
|
|
696
708
|
// These are HTML attributes that must be numbers.
|
|
697
709
|
['rowSpan', 'start'].forEach(function (name) {
|
|
698
710
|
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
|
|
699
711
|
name.toLowerCase(), // attributeName
|
|
700
712
|
null);
|
|
701
|
-
}
|
|
713
|
+
} // attributeNamespace
|
|
714
|
+
);
|
|
702
715
|
|
|
703
716
|
var CAMELIZE = /[\-\:]([a-z])/g;
|
|
704
717
|
var capitalize = function (token) {
|
|
@@ -714,7 +727,8 @@ var capitalize = function (token) {
|
|
|
714
727
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
715
728
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
716
729
|
attributeName, null);
|
|
717
|
-
}
|
|
730
|
+
} // attributeNamespace
|
|
731
|
+
);
|
|
718
732
|
|
|
719
733
|
// String SVG attributes with the xlink namespace.
|
|
720
734
|
['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
|
@@ -870,9 +884,10 @@ function createMarkupForProperty(name, value) {
|
|
|
870
884
|
} else {
|
|
871
885
|
return attributeName + '=' + quoteAttributeValueForBrowser(value);
|
|
872
886
|
}
|
|
873
|
-
} else {
|
|
887
|
+
} else if (isAttributeNameSafe(name)) {
|
|
874
888
|
return name + '=' + quoteAttributeValueForBrowser(value);
|
|
875
889
|
}
|
|
890
|
+
return '';
|
|
876
891
|
}
|
|
877
892
|
|
|
878
893
|
/**
|
|
@@ -982,6 +997,7 @@ var omittedCloseTags = {
|
|
|
982
997
|
source: true,
|
|
983
998
|
track: true,
|
|
984
999
|
wbr: true
|
|
1000
|
+
// NOTE: menuitem's close tag should be omitted, but that causes problems.
|
|
985
1001
|
};
|
|
986
1002
|
|
|
987
1003
|
// For HTML, certain tags cannot have children. This has the same purpose as
|
|
@@ -1006,7 +1022,7 @@ function assertValidProps(tag, props, getStack) {
|
|
|
1006
1022
|
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? invariant_1(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
1023
|
}
|
|
1008
1024
|
{
|
|
1009
|
-
|
|
1025
|
+
!(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.%s', getStack()) : void 0;
|
|
1010
1026
|
}
|
|
1011
1027
|
!(props.style == null || typeof props.style === 'object') ? invariant_1(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', getStack()) : void 0;
|
|
1012
1028
|
}
|
|
@@ -1344,7 +1360,7 @@ var warnedProperties = {};
|
|
|
1344
1360
|
var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
1345
1361
|
var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
1346
1362
|
|
|
1347
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1363
|
+
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1348
1364
|
|
|
1349
1365
|
function getStackAddendum$1() {
|
|
1350
1366
|
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
@@ -1352,7 +1368,7 @@ function getStackAddendum$1() {
|
|
|
1352
1368
|
}
|
|
1353
1369
|
|
|
1354
1370
|
function validateProperty(tagName, name) {
|
|
1355
|
-
if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
|
|
1371
|
+
if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
|
|
1356
1372
|
return true;
|
|
1357
1373
|
}
|
|
1358
1374
|
|
|
@@ -1531,7 +1547,7 @@ var possibleStandardNames = {
|
|
|
1531
1547
|
checked: 'checked',
|
|
1532
1548
|
children: 'children',
|
|
1533
1549
|
cite: 'cite',
|
|
1534
|
-
|
|
1550
|
+
class: 'className',
|
|
1535
1551
|
classid: 'classID',
|
|
1536
1552
|
classname: 'className',
|
|
1537
1553
|
cols: 'cols',
|
|
@@ -1546,7 +1562,7 @@ var possibleStandardNames = {
|
|
|
1546
1562
|
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
|
1547
1563
|
data: 'data',
|
|
1548
1564
|
datetime: 'dateTime',
|
|
1549
|
-
|
|
1565
|
+
default: 'default',
|
|
1550
1566
|
defaultchecked: 'defaultChecked',
|
|
1551
1567
|
defaultvalue: 'defaultValue',
|
|
1552
1568
|
defer: 'defer',
|
|
@@ -1555,7 +1571,7 @@ var possibleStandardNames = {
|
|
|
1555
1571
|
download: 'download',
|
|
1556
1572
|
draggable: 'draggable',
|
|
1557
1573
|
enctype: 'encType',
|
|
1558
|
-
|
|
1574
|
+
for: 'htmlFor',
|
|
1559
1575
|
form: 'form',
|
|
1560
1576
|
formmethod: 'formMethod',
|
|
1561
1577
|
formaction: 'formAction',
|
|
@@ -1773,7 +1789,7 @@ var possibleStandardNames = {
|
|
|
1773
1789
|
imagerendering: 'imageRendering',
|
|
1774
1790
|
'image-rendering': 'imageRendering',
|
|
1775
1791
|
in2: 'in2',
|
|
1776
|
-
|
|
1792
|
+
in: 'in',
|
|
1777
1793
|
inlist: 'inlist',
|
|
1778
1794
|
intercept: 'intercept',
|
|
1779
1795
|
k1: 'k1',
|
|
@@ -1913,7 +1929,7 @@ var possibleStandardNames = {
|
|
|
1913
1929
|
'text-rendering': 'textRendering',
|
|
1914
1930
|
to: 'to',
|
|
1915
1931
|
transform: 'transform',
|
|
1916
|
-
|
|
1932
|
+
typeof: 'typeof',
|
|
1917
1933
|
u1: 'u1',
|
|
1918
1934
|
u2: 'u2',
|
|
1919
1935
|
underlineposition: 'underlinePosition',
|
|
@@ -2375,6 +2391,7 @@ function processContext(type, context) {
|
|
|
2375
2391
|
return maskedContext;
|
|
2376
2392
|
}
|
|
2377
2393
|
|
|
2394
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2378
2395
|
var STYLE = 'style';
|
|
2379
2396
|
var RESERVED_PROPS = {
|
|
2380
2397
|
children: null,
|
|
@@ -2387,7 +2404,7 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
|
|
|
2387
2404
|
var ret = '<' + tagVerbatim;
|
|
2388
2405
|
|
|
2389
2406
|
for (var propKey in props) {
|
|
2390
|
-
if (!
|
|
2407
|
+
if (!hasOwnProperty.call(props, propKey)) {
|
|
2391
2408
|
continue;
|
|
2392
2409
|
}
|
|
2393
2410
|
var propValue = props[propKey];
|
|
@@ -2429,42 +2446,26 @@ function validateRenderResult(child, type) {
|
|
|
2429
2446
|
}
|
|
2430
2447
|
|
|
2431
2448
|
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
2449
|
while (React.isValidElement(child)) {
|
|
2454
2450
|
// Safe because we just checked it's an element.
|
|
2455
|
-
element = child;
|
|
2451
|
+
var element = child;
|
|
2452
|
+
var Component = element.type;
|
|
2456
2453
|
{
|
|
2457
2454
|
pushElementToDebugStack(element);
|
|
2458
2455
|
}
|
|
2459
|
-
Component = element.type;
|
|
2460
2456
|
if (typeof Component !== 'function') {
|
|
2461
2457
|
break;
|
|
2462
2458
|
}
|
|
2463
|
-
|
|
2459
|
+
processChild(element, Component);
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
// Extra closure so queue and replace can be captured properly
|
|
2463
|
+
function processChild(element, Component) {
|
|
2464
|
+
var publicContext = processContext(Component, context);
|
|
2464
2465
|
|
|
2465
|
-
queue = [];
|
|
2466
|
-
replace = false;
|
|
2467
|
-
updater = {
|
|
2466
|
+
var queue = [];
|
|
2467
|
+
var replace = false;
|
|
2468
|
+
var updater = {
|
|
2468
2469
|
isMounted: function (publicInstance) {
|
|
2469
2470
|
return false;
|
|
2470
2471
|
},
|
|
@@ -2487,6 +2488,7 @@ function resolve(child, context) {
|
|
|
2487
2488
|
}
|
|
2488
2489
|
};
|
|
2489
2490
|
|
|
2491
|
+
var inst = void 0;
|
|
2490
2492
|
if (shouldConstruct(Component)) {
|
|
2491
2493
|
inst = new Component(element.props, publicContext, updater);
|
|
2492
2494
|
|
|
@@ -2501,7 +2503,7 @@ function resolve(child, context) {
|
|
|
2501
2503
|
}
|
|
2502
2504
|
}
|
|
2503
2505
|
|
|
2504
|
-
partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
|
2506
|
+
var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
|
2505
2507
|
|
|
2506
2508
|
{
|
|
2507
2509
|
if (partialState === undefined) {
|
|
@@ -2532,7 +2534,7 @@ function resolve(child, context) {
|
|
|
2532
2534
|
if (inst == null || inst.render == null) {
|
|
2533
2535
|
child = inst;
|
|
2534
2536
|
validateRenderResult(child, Component);
|
|
2535
|
-
|
|
2537
|
+
return;
|
|
2536
2538
|
}
|
|
2537
2539
|
}
|
|
2538
2540
|
|
|
@@ -2540,7 +2542,7 @@ function resolve(child, context) {
|
|
|
2540
2542
|
inst.context = publicContext;
|
|
2541
2543
|
inst.updater = updater;
|
|
2542
2544
|
|
|
2543
|
-
initialState = inst.state;
|
|
2545
|
+
var initialState = inst.state;
|
|
2544
2546
|
if (initialState === undefined) {
|
|
2545
2547
|
inst.state = initialState = null;
|
|
2546
2548
|
}
|
|
@@ -2569,25 +2571,25 @@ function resolve(child, context) {
|
|
|
2569
2571
|
inst.UNSAFE_componentWillMount();
|
|
2570
2572
|
}
|
|
2571
2573
|
if (queue.length) {
|
|
2572
|
-
oldQueue = queue;
|
|
2573
|
-
oldReplace = replace;
|
|
2574
|
+
var oldQueue = queue;
|
|
2575
|
+
var oldReplace = replace;
|
|
2574
2576
|
queue = null;
|
|
2575
2577
|
replace = false;
|
|
2576
2578
|
|
|
2577
2579
|
if (oldReplace && oldQueue.length === 1) {
|
|
2578
2580
|
inst.state = oldQueue[0];
|
|
2579
2581
|
} else {
|
|
2580
|
-
nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
2581
|
-
dontMutate = true;
|
|
2582
|
+
var nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
2583
|
+
var dontMutate = true;
|
|
2582
2584
|
for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
|
|
2583
|
-
partial = oldQueue[i];
|
|
2584
|
-
|
|
2585
|
-
if (
|
|
2585
|
+
var partial = oldQueue[i];
|
|
2586
|
+
var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
|
|
2587
|
+
if (_partialState != null) {
|
|
2586
2588
|
if (dontMutate) {
|
|
2587
2589
|
dontMutate = false;
|
|
2588
|
-
nextState = _assign({}, nextState,
|
|
2590
|
+
nextState = _assign({}, nextState, _partialState);
|
|
2589
2591
|
} else {
|
|
2590
|
-
_assign(nextState,
|
|
2592
|
+
_assign(nextState, _partialState);
|
|
2591
2593
|
}
|
|
2592
2594
|
}
|
|
2593
2595
|
}
|
|
@@ -2608,11 +2610,12 @@ function resolve(child, context) {
|
|
|
2608
2610
|
}
|
|
2609
2611
|
validateRenderResult(child, Component);
|
|
2610
2612
|
|
|
2613
|
+
var childContext = void 0;
|
|
2611
2614
|
if (typeof inst.getChildContext === 'function') {
|
|
2612
|
-
childContextTypes = Component.childContextTypes;
|
|
2615
|
+
var childContextTypes = Component.childContextTypes;
|
|
2613
2616
|
if (typeof childContextTypes === 'object') {
|
|
2614
2617
|
childContext = inst.getChildContext();
|
|
2615
|
-
for (contextKey in childContext) {
|
|
2618
|
+
for (var contextKey in childContext) {
|
|
2616
2619
|
!(contextKey in childContextTypes) ? invariant_1(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
|
|
2617
2620
|
}
|
|
2618
2621
|
} else {
|
|
@@ -2627,6 +2630,8 @@ function resolve(child, context) {
|
|
|
2627
2630
|
}
|
|
2628
2631
|
|
|
2629
2632
|
var ReactDOMServerRenderer = function () {
|
|
2633
|
+
// DEV-only
|
|
2634
|
+
|
|
2630
2635
|
function ReactDOMServerRenderer(children, makeStaticMarkup) {
|
|
2631
2636
|
_classCallCheck(this, ReactDOMServerRenderer);
|
|
2632
2637
|
|
|
@@ -2652,33 +2657,65 @@ var ReactDOMServerRenderer = function () {
|
|
|
2652
2657
|
this.makeStaticMarkup = makeStaticMarkup;
|
|
2653
2658
|
|
|
2654
2659
|
// Context (new API)
|
|
2655
|
-
this.
|
|
2656
|
-
this.
|
|
2660
|
+
this.contextIndex = -1;
|
|
2661
|
+
this.contextStack = [];
|
|
2662
|
+
this.contextValueStack = [];
|
|
2663
|
+
{
|
|
2664
|
+
this.contextProviderStack = [];
|
|
2665
|
+
}
|
|
2657
2666
|
}
|
|
2667
|
+
|
|
2668
|
+
/**
|
|
2669
|
+
* Note: We use just two stacks regardless of how many context providers you have.
|
|
2670
|
+
* Providers are always popped in the reverse order to how they were pushed
|
|
2671
|
+
* so we always know on the way down which provider you'll encounter next on the way up.
|
|
2672
|
+
* On the way down, we push the current provider, and its context value *before*
|
|
2673
|
+
* we mutated it, onto the stacks. Therefore, on the way up, we always know which
|
|
2674
|
+
* provider needs to be "restored" to which value.
|
|
2675
|
+
* https://github.com/facebook/react/pull/12985#issuecomment-396301248
|
|
2676
|
+
*/
|
|
2677
|
+
|
|
2658
2678
|
// TODO: type this more strictly:
|
|
2659
2679
|
|
|
2660
2680
|
|
|
2661
2681
|
ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
|
|
2662
|
-
this.
|
|
2663
|
-
|
|
2664
|
-
var
|
|
2665
|
-
|
|
2682
|
+
var index = ++this.contextIndex;
|
|
2683
|
+
var context = provider.type._context;
|
|
2684
|
+
var previousValue = context._currentValue;
|
|
2685
|
+
|
|
2686
|
+
// Remember which value to restore this context to on our way up.
|
|
2687
|
+
this.contextStack[index] = context;
|
|
2688
|
+
this.contextValueStack[index] = previousValue;
|
|
2689
|
+
{
|
|
2690
|
+
// Only used for push/pop mismatch warnings.
|
|
2691
|
+
this.contextProviderStack[index] = provider;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
// Mutate the current value.
|
|
2695
|
+
context._currentValue = provider.props.value;
|
|
2666
2696
|
};
|
|
2667
2697
|
|
|
2668
2698
|
ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
|
|
2699
|
+
var index = this.contextIndex;
|
|
2669
2700
|
{
|
|
2670
|
-
|
|
2701
|
+
!(index > -1 && provider === this.contextProviderStack[index]) ? warning_1(false, 'Unexpected pop.') : void 0;
|
|
2671
2702
|
}
|
|
2672
|
-
|
|
2673
|
-
this.
|
|
2674
|
-
var
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2703
|
+
|
|
2704
|
+
var context = this.contextStack[index];
|
|
2705
|
+
var previousValue = this.contextValueStack[index];
|
|
2706
|
+
|
|
2707
|
+
// "Hide" these null assignments from Flow by using `any`
|
|
2708
|
+
// because conceptually they are deletions--as long as we
|
|
2709
|
+
// promise to never access values beyond `this.contextIndex`.
|
|
2710
|
+
this.contextStack[index] = null;
|
|
2711
|
+
this.contextValueStack[index] = null;
|
|
2712
|
+
{
|
|
2713
|
+
this.contextProviderStack[index] = null;
|
|
2681
2714
|
}
|
|
2715
|
+
this.contextIndex--;
|
|
2716
|
+
|
|
2717
|
+
// Restore to the previous value we stored as we were walking down.
|
|
2718
|
+
context._currentValue = previousValue;
|
|
2682
2719
|
};
|
|
2683
2720
|
|
|
2684
2721
|
ReactDOMServerRenderer.prototype.read = function read(bytes) {
|
|
@@ -2779,6 +2816,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2779
2816
|
switch (elementType) {
|
|
2780
2817
|
case REACT_STRICT_MODE_TYPE:
|
|
2781
2818
|
case REACT_ASYNC_MODE_TYPE:
|
|
2819
|
+
case REACT_PROFILER_TYPE:
|
|
2782
2820
|
case REACT_FRAGMENT_TYPE:
|
|
2783
2821
|
{
|
|
2784
2822
|
var _nextChildren = toArray(nextChild.props.children);
|
|
@@ -2796,56 +2834,71 @@ var ReactDOMServerRenderer = function () {
|
|
|
2796
2834
|
this.stack.push(_frame);
|
|
2797
2835
|
return '';
|
|
2798
2836
|
}
|
|
2799
|
-
case REACT_CALL_TYPE:
|
|
2800
|
-
case REACT_RETURN_TYPE:
|
|
2801
|
-
invariant_1(false, 'The experimental Call and Return types are not currently supported by the server renderer.');
|
|
2802
2837
|
// eslint-disable-next-line-no-fallthrough
|
|
2803
2838
|
default:
|
|
2804
2839
|
break;
|
|
2805
2840
|
}
|
|
2806
2841
|
if (typeof elementType === 'object' && elementType !== null) {
|
|
2807
2842
|
switch (elementType.$$typeof) {
|
|
2843
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2844
|
+
{
|
|
2845
|
+
var element = nextChild;
|
|
2846
|
+
var _nextChildren2 = toArray(elementType.render(element.props, element.ref));
|
|
2847
|
+
var _frame2 = {
|
|
2848
|
+
type: null,
|
|
2849
|
+
domNamespace: parentNamespace,
|
|
2850
|
+
children: _nextChildren2,
|
|
2851
|
+
childIndex: 0,
|
|
2852
|
+
context: context,
|
|
2853
|
+
footer: ''
|
|
2854
|
+
};
|
|
2855
|
+
{
|
|
2856
|
+
_frame2.debugElementStack = [];
|
|
2857
|
+
}
|
|
2858
|
+
this.stack.push(_frame2);
|
|
2859
|
+
return '';
|
|
2860
|
+
}
|
|
2808
2861
|
case REACT_PROVIDER_TYPE:
|
|
2809
2862
|
{
|
|
2810
2863
|
var provider = nextChild;
|
|
2811
2864
|
var nextProps = provider.props;
|
|
2812
|
-
var
|
|
2813
|
-
var
|
|
2865
|
+
var _nextChildren3 = toArray(nextProps.children);
|
|
2866
|
+
var _frame3 = {
|
|
2814
2867
|
type: provider,
|
|
2815
2868
|
domNamespace: parentNamespace,
|
|
2816
|
-
children:
|
|
2869
|
+
children: _nextChildren3,
|
|
2817
2870
|
childIndex: 0,
|
|
2818
2871
|
context: context,
|
|
2819
2872
|
footer: ''
|
|
2820
2873
|
};
|
|
2821
2874
|
{
|
|
2822
|
-
|
|
2875
|
+
_frame3.debugElementStack = [];
|
|
2823
2876
|
}
|
|
2824
2877
|
|
|
2825
2878
|
this.pushProvider(provider);
|
|
2826
2879
|
|
|
2827
|
-
this.stack.push(
|
|
2880
|
+
this.stack.push(_frame3);
|
|
2828
2881
|
return '';
|
|
2829
2882
|
}
|
|
2830
2883
|
case REACT_CONTEXT_TYPE:
|
|
2831
2884
|
{
|
|
2832
2885
|
var consumer = nextChild;
|
|
2833
2886
|
var _nextProps = consumer.props;
|
|
2834
|
-
var nextValue = consumer.type.
|
|
2887
|
+
var nextValue = consumer.type._currentValue;
|
|
2835
2888
|
|
|
2836
|
-
var
|
|
2837
|
-
var
|
|
2889
|
+
var _nextChildren4 = toArray(_nextProps.children(nextValue));
|
|
2890
|
+
var _frame4 = {
|
|
2838
2891
|
type: nextChild,
|
|
2839
2892
|
domNamespace: parentNamespace,
|
|
2840
|
-
children:
|
|
2893
|
+
children: _nextChildren4,
|
|
2841
2894
|
childIndex: 0,
|
|
2842
2895
|
context: context,
|
|
2843
2896
|
footer: ''
|
|
2844
2897
|
};
|
|
2845
2898
|
{
|
|
2846
|
-
|
|
2899
|
+
_frame4.debugElementStack = [];
|
|
2847
2900
|
}
|
|
2848
|
-
this.stack.push(
|
|
2901
|
+
this.stack.push(_frame4);
|
|
2849
2902
|
return '';
|
|
2850
2903
|
}
|
|
2851
2904
|
default:
|
|
@@ -2880,7 +2933,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2880
2933
|
if (namespace === Namespaces.html) {
|
|
2881
2934
|
// Should this check be gated by parent namespace? Not sure we want to
|
|
2882
2935
|
// allow <SVG> or <mATH>.
|
|
2883
|
-
|
|
2936
|
+
!(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
2937
|
}
|
|
2885
2938
|
}
|
|
2886
2939
|
|
|
@@ -2956,9 +3009,11 @@ var ReactDOMServerRenderer = function () {
|
|
|
2956
3009
|
}
|
|
2957
3010
|
var isArray = Array.isArray(props[propName]);
|
|
2958
3011
|
if (props.multiple && !isArray) {
|
|
2959
|
-
warning_1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '')
|
|
3012
|
+
warning_1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '' // getDeclarationErrorAddendum(),
|
|
3013
|
+
);
|
|
2960
3014
|
} else if (!props.multiple && isArray) {
|
|
2961
|
-
warning_1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '')
|
|
3015
|
+
warning_1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '' // getDeclarationErrorAddendum(),
|
|
3016
|
+
);
|
|
2962
3017
|
}
|
|
2963
3018
|
}
|
|
2964
3019
|
|
|
@@ -3106,7 +3161,7 @@ var ReactDOMServer = ( ReactDOMServerBrowser$1 && ReactDOMServerBrowser ) || Rea
|
|
|
3106
3161
|
|
|
3107
3162
|
// TODO: decide on the top-level export form.
|
|
3108
3163
|
// This is hacky but makes it work with both Rollup and Jest
|
|
3109
|
-
var server_browser = ReactDOMServer
|
|
3164
|
+
var server_browser = ReactDOMServer.default ? ReactDOMServer.default : ReactDOMServer;
|
|
3110
3165
|
|
|
3111
3166
|
return server_browser;
|
|
3112
3167
|
|