react-dom 16.4.0-alpha.0911da3 → 16.4.1
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 +168 -116
- package/cjs/react-dom-server.browser.production.min.js +30 -30
- package/cjs/react-dom-server.node.development.js +169 -117
- 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 +11460 -10809
- package/cjs/react-dom.production.min.js +229 -240
- package/cjs/react-dom.profiling.min.js +242 -0
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +172 -120
- package/umd/react-dom-server.browser.production.min.js +29 -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 +11565 -10914
- package/umd/react-dom.production.min.js +188 -203
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.4.
|
|
1
|
+
/** @license React v16.4.1
|
|
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.0911da3';
|
|
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.1';
|
|
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.
|
|
@@ -584,6 +581,9 @@ function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)
|
|
|
584
581
|
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
|
585
582
|
return true;
|
|
586
583
|
}
|
|
584
|
+
if (isCustomComponentTag) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
587
|
if (propertyInfo !== null) {
|
|
588
588
|
switch (propertyInfo.type) {
|
|
589
589
|
case BOOLEAN:
|
|
@@ -626,15 +626,20 @@ var properties = {};
|
|
|
626
626
|
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
|
|
627
627
|
name, // attributeName
|
|
628
628
|
null);
|
|
629
|
-
}
|
|
629
|
+
} // attributeNamespace
|
|
630
|
+
);
|
|
630
631
|
|
|
631
632
|
// A few React string attributes have a different name.
|
|
632
633
|
// This is a mapping from React prop names to the attribute names.
|
|
633
|
-
|
|
634
|
+
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
|
635
|
+
var name = _ref[0],
|
|
636
|
+
attributeName = _ref[1];
|
|
637
|
+
|
|
634
638
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
635
639
|
attributeName, // attributeName
|
|
636
640
|
null);
|
|
637
|
-
}
|
|
641
|
+
} // attributeNamespace
|
|
642
|
+
);
|
|
638
643
|
|
|
639
644
|
// These are "enumerated" HTML attributes that accept "true" and "false".
|
|
640
645
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -643,7 +648,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
643
648
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
644
649
|
name.toLowerCase(), // attributeName
|
|
645
650
|
null);
|
|
646
|
-
}
|
|
651
|
+
} // attributeNamespace
|
|
652
|
+
);
|
|
647
653
|
|
|
648
654
|
// These are "enumerated" SVG attributes that accept "true" and "false".
|
|
649
655
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -653,7 +659,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
653
659
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
654
660
|
name, // attributeName
|
|
655
661
|
null);
|
|
656
|
-
}
|
|
662
|
+
} // attributeNamespace
|
|
663
|
+
);
|
|
657
664
|
|
|
658
665
|
// These are HTML boolean attributes.
|
|
659
666
|
['allowFullScreen', 'async',
|
|
@@ -665,7 +672,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
665
672
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
|
666
673
|
name.toLowerCase(), // attributeName
|
|
667
674
|
null);
|
|
668
|
-
}
|
|
675
|
+
} // attributeNamespace
|
|
676
|
+
);
|
|
669
677
|
|
|
670
678
|
// These are the few React props that we set as DOM properties
|
|
671
679
|
// rather than attributes. These are all booleans.
|
|
@@ -676,7 +684,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
676
684
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
|
677
685
|
name.toLowerCase(), // attributeName
|
|
678
686
|
null);
|
|
679
|
-
}
|
|
687
|
+
} // attributeNamespace
|
|
688
|
+
);
|
|
680
689
|
|
|
681
690
|
// These are HTML attributes that are "overloaded booleans": they behave like
|
|
682
691
|
// booleans, but can also accept a string value.
|
|
@@ -684,21 +693,24 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
684
693
|
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
|
|
685
694
|
name.toLowerCase(), // attributeName
|
|
686
695
|
null);
|
|
687
|
-
}
|
|
696
|
+
} // attributeNamespace
|
|
697
|
+
);
|
|
688
698
|
|
|
689
699
|
// These are HTML attributes that must be positive numbers.
|
|
690
700
|
['cols', 'rows', 'size', 'span'].forEach(function (name) {
|
|
691
701
|
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
|
|
692
702
|
name.toLowerCase(), // attributeName
|
|
693
703
|
null);
|
|
694
|
-
}
|
|
704
|
+
} // attributeNamespace
|
|
705
|
+
);
|
|
695
706
|
|
|
696
707
|
// These are HTML attributes that must be numbers.
|
|
697
708
|
['rowSpan', 'start'].forEach(function (name) {
|
|
698
709
|
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
|
|
699
710
|
name.toLowerCase(), // attributeName
|
|
700
711
|
null);
|
|
701
|
-
}
|
|
712
|
+
} // attributeNamespace
|
|
713
|
+
);
|
|
702
714
|
|
|
703
715
|
var CAMELIZE = /[\-\:]([a-z])/g;
|
|
704
716
|
var capitalize = function (token) {
|
|
@@ -714,7 +726,8 @@ var capitalize = function (token) {
|
|
|
714
726
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
715
727
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
716
728
|
attributeName, null);
|
|
717
|
-
}
|
|
729
|
+
} // attributeNamespace
|
|
730
|
+
);
|
|
718
731
|
|
|
719
732
|
// String SVG attributes with the xlink namespace.
|
|
720
733
|
['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
|
@@ -982,6 +995,7 @@ var omittedCloseTags = {
|
|
|
982
995
|
source: true,
|
|
983
996
|
track: true,
|
|
984
997
|
wbr: true
|
|
998
|
+
// NOTE: menuitem's close tag should be omitted, but that causes problems.
|
|
985
999
|
};
|
|
986
1000
|
|
|
987
1001
|
// For HTML, certain tags cannot have children. This has the same purpose as
|
|
@@ -1006,7 +1020,7 @@ function assertValidProps(tag, props, getStack) {
|
|
|
1006
1020
|
!(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
1021
|
}
|
|
1008
1022
|
{
|
|
1009
|
-
|
|
1023
|
+
!(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
1024
|
}
|
|
1011
1025
|
!(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
1026
|
}
|
|
@@ -1531,7 +1545,7 @@ var possibleStandardNames = {
|
|
|
1531
1545
|
checked: 'checked',
|
|
1532
1546
|
children: 'children',
|
|
1533
1547
|
cite: 'cite',
|
|
1534
|
-
|
|
1548
|
+
class: 'className',
|
|
1535
1549
|
classid: 'classID',
|
|
1536
1550
|
classname: 'className',
|
|
1537
1551
|
cols: 'cols',
|
|
@@ -1546,7 +1560,7 @@ var possibleStandardNames = {
|
|
|
1546
1560
|
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
|
1547
1561
|
data: 'data',
|
|
1548
1562
|
datetime: 'dateTime',
|
|
1549
|
-
|
|
1563
|
+
default: 'default',
|
|
1550
1564
|
defaultchecked: 'defaultChecked',
|
|
1551
1565
|
defaultvalue: 'defaultValue',
|
|
1552
1566
|
defer: 'defer',
|
|
@@ -1555,7 +1569,7 @@ var possibleStandardNames = {
|
|
|
1555
1569
|
download: 'download',
|
|
1556
1570
|
draggable: 'draggable',
|
|
1557
1571
|
enctype: 'encType',
|
|
1558
|
-
|
|
1572
|
+
for: 'htmlFor',
|
|
1559
1573
|
form: 'form',
|
|
1560
1574
|
formmethod: 'formMethod',
|
|
1561
1575
|
formaction: 'formAction',
|
|
@@ -1773,7 +1787,7 @@ var possibleStandardNames = {
|
|
|
1773
1787
|
imagerendering: 'imageRendering',
|
|
1774
1788
|
'image-rendering': 'imageRendering',
|
|
1775
1789
|
in2: 'in2',
|
|
1776
|
-
|
|
1790
|
+
in: 'in',
|
|
1777
1791
|
inlist: 'inlist',
|
|
1778
1792
|
intercept: 'intercept',
|
|
1779
1793
|
k1: 'k1',
|
|
@@ -1913,7 +1927,7 @@ var possibleStandardNames = {
|
|
|
1913
1927
|
'text-rendering': 'textRendering',
|
|
1914
1928
|
to: 'to',
|
|
1915
1929
|
transform: 'transform',
|
|
1916
|
-
|
|
1930
|
+
typeof: 'typeof',
|
|
1917
1931
|
u1: 'u1',
|
|
1918
1932
|
u2: 'u2',
|
|
1919
1933
|
underlineposition: 'underlinePosition',
|
|
@@ -2429,42 +2443,26 @@ function validateRenderResult(child, type) {
|
|
|
2429
2443
|
}
|
|
2430
2444
|
|
|
2431
2445
|
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
2446
|
while (React.isValidElement(child)) {
|
|
2454
2447
|
// Safe because we just checked it's an element.
|
|
2455
|
-
element = child;
|
|
2448
|
+
var element = child;
|
|
2449
|
+
var Component = element.type;
|
|
2456
2450
|
{
|
|
2457
2451
|
pushElementToDebugStack(element);
|
|
2458
2452
|
}
|
|
2459
|
-
Component = element.type;
|
|
2460
2453
|
if (typeof Component !== 'function') {
|
|
2461
2454
|
break;
|
|
2462
2455
|
}
|
|
2463
|
-
|
|
2456
|
+
processChild(element, Component);
|
|
2457
|
+
}
|
|
2464
2458
|
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2459
|
+
// Extra closure so queue and replace can be captured properly
|
|
2460
|
+
function processChild(element, Component) {
|
|
2461
|
+
var publicContext = processContext(Component, context);
|
|
2462
|
+
|
|
2463
|
+
var queue = [];
|
|
2464
|
+
var replace = false;
|
|
2465
|
+
var updater = {
|
|
2468
2466
|
isMounted: function (publicInstance) {
|
|
2469
2467
|
return false;
|
|
2470
2468
|
},
|
|
@@ -2487,6 +2485,7 @@ function resolve(child, context) {
|
|
|
2487
2485
|
}
|
|
2488
2486
|
};
|
|
2489
2487
|
|
|
2488
|
+
var inst = void 0;
|
|
2490
2489
|
if (shouldConstruct(Component)) {
|
|
2491
2490
|
inst = new Component(element.props, publicContext, updater);
|
|
2492
2491
|
|
|
@@ -2501,7 +2500,7 @@ function resolve(child, context) {
|
|
|
2501
2500
|
}
|
|
2502
2501
|
}
|
|
2503
2502
|
|
|
2504
|
-
partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
|
2503
|
+
var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
|
2505
2504
|
|
|
2506
2505
|
{
|
|
2507
2506
|
if (partialState === undefined) {
|
|
@@ -2532,7 +2531,7 @@ function resolve(child, context) {
|
|
|
2532
2531
|
if (inst == null || inst.render == null) {
|
|
2533
2532
|
child = inst;
|
|
2534
2533
|
validateRenderResult(child, Component);
|
|
2535
|
-
|
|
2534
|
+
return;
|
|
2536
2535
|
}
|
|
2537
2536
|
}
|
|
2538
2537
|
|
|
@@ -2540,7 +2539,7 @@ function resolve(child, context) {
|
|
|
2540
2539
|
inst.context = publicContext;
|
|
2541
2540
|
inst.updater = updater;
|
|
2542
2541
|
|
|
2543
|
-
initialState = inst.state;
|
|
2542
|
+
var initialState = inst.state;
|
|
2544
2543
|
if (initialState === undefined) {
|
|
2545
2544
|
inst.state = initialState = null;
|
|
2546
2545
|
}
|
|
@@ -2569,25 +2568,25 @@ function resolve(child, context) {
|
|
|
2569
2568
|
inst.UNSAFE_componentWillMount();
|
|
2570
2569
|
}
|
|
2571
2570
|
if (queue.length) {
|
|
2572
|
-
oldQueue = queue;
|
|
2573
|
-
oldReplace = replace;
|
|
2571
|
+
var oldQueue = queue;
|
|
2572
|
+
var oldReplace = replace;
|
|
2574
2573
|
queue = null;
|
|
2575
2574
|
replace = false;
|
|
2576
2575
|
|
|
2577
2576
|
if (oldReplace && oldQueue.length === 1) {
|
|
2578
2577
|
inst.state = oldQueue[0];
|
|
2579
2578
|
} else {
|
|
2580
|
-
nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
2581
|
-
dontMutate = true;
|
|
2579
|
+
var nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
2580
|
+
var dontMutate = true;
|
|
2582
2581
|
for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
|
|
2583
|
-
partial = oldQueue[i];
|
|
2584
|
-
|
|
2585
|
-
if (
|
|
2582
|
+
var partial = oldQueue[i];
|
|
2583
|
+
var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
|
|
2584
|
+
if (_partialState != null) {
|
|
2586
2585
|
if (dontMutate) {
|
|
2587
2586
|
dontMutate = false;
|
|
2588
|
-
nextState = _assign({}, nextState,
|
|
2587
|
+
nextState = _assign({}, nextState, _partialState);
|
|
2589
2588
|
} else {
|
|
2590
|
-
_assign(nextState,
|
|
2589
|
+
_assign(nextState, _partialState);
|
|
2591
2590
|
}
|
|
2592
2591
|
}
|
|
2593
2592
|
}
|
|
@@ -2608,11 +2607,12 @@ function resolve(child, context) {
|
|
|
2608
2607
|
}
|
|
2609
2608
|
validateRenderResult(child, Component);
|
|
2610
2609
|
|
|
2610
|
+
var childContext = void 0;
|
|
2611
2611
|
if (typeof inst.getChildContext === 'function') {
|
|
2612
|
-
childContextTypes = Component.childContextTypes;
|
|
2612
|
+
var childContextTypes = Component.childContextTypes;
|
|
2613
2613
|
if (typeof childContextTypes === 'object') {
|
|
2614
2614
|
childContext = inst.getChildContext();
|
|
2615
|
-
for (contextKey in childContext) {
|
|
2615
|
+
for (var contextKey in childContext) {
|
|
2616
2616
|
!(contextKey in childContextTypes) ? invariant_1(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
|
|
2617
2617
|
}
|
|
2618
2618
|
} else {
|
|
@@ -2627,6 +2627,8 @@ function resolve(child, context) {
|
|
|
2627
2627
|
}
|
|
2628
2628
|
|
|
2629
2629
|
var ReactDOMServerRenderer = function () {
|
|
2630
|
+
// DEV-only
|
|
2631
|
+
|
|
2630
2632
|
function ReactDOMServerRenderer(children, makeStaticMarkup) {
|
|
2631
2633
|
_classCallCheck(this, ReactDOMServerRenderer);
|
|
2632
2634
|
|
|
@@ -2652,33 +2654,65 @@ var ReactDOMServerRenderer = function () {
|
|
|
2652
2654
|
this.makeStaticMarkup = makeStaticMarkup;
|
|
2653
2655
|
|
|
2654
2656
|
// Context (new API)
|
|
2655
|
-
this.
|
|
2656
|
-
this.
|
|
2657
|
+
this.contextIndex = -1;
|
|
2658
|
+
this.contextStack = [];
|
|
2659
|
+
this.contextValueStack = [];
|
|
2660
|
+
{
|
|
2661
|
+
this.contextProviderStack = [];
|
|
2662
|
+
}
|
|
2657
2663
|
}
|
|
2664
|
+
|
|
2665
|
+
/**
|
|
2666
|
+
* Note: We use just two stacks regardless of how many context providers you have.
|
|
2667
|
+
* Providers are always popped in the reverse order to how they were pushed
|
|
2668
|
+
* so we always know on the way down which provider you'll encounter next on the way up.
|
|
2669
|
+
* On the way down, we push the current provider, and its context value *before*
|
|
2670
|
+
* we mutated it, onto the stacks. Therefore, on the way up, we always know which
|
|
2671
|
+
* provider needs to be "restored" to which value.
|
|
2672
|
+
* https://github.com/facebook/react/pull/12985#issuecomment-396301248
|
|
2673
|
+
*/
|
|
2674
|
+
|
|
2658
2675
|
// TODO: type this more strictly:
|
|
2659
2676
|
|
|
2660
2677
|
|
|
2661
2678
|
ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
|
|
2662
|
-
this.
|
|
2663
|
-
|
|
2664
|
-
var
|
|
2665
|
-
|
|
2679
|
+
var index = ++this.contextIndex;
|
|
2680
|
+
var context = provider.type._context;
|
|
2681
|
+
var previousValue = context._currentValue;
|
|
2682
|
+
|
|
2683
|
+
// Remember which value to restore this context to on our way up.
|
|
2684
|
+
this.contextStack[index] = context;
|
|
2685
|
+
this.contextValueStack[index] = previousValue;
|
|
2686
|
+
{
|
|
2687
|
+
// Only used for push/pop mismatch warnings.
|
|
2688
|
+
this.contextProviderStack[index] = provider;
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
// Mutate the current value.
|
|
2692
|
+
context._currentValue = provider.props.value;
|
|
2666
2693
|
};
|
|
2667
2694
|
|
|
2668
2695
|
ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
|
|
2696
|
+
var index = this.contextIndex;
|
|
2669
2697
|
{
|
|
2670
|
-
|
|
2698
|
+
!(index > -1 && provider === this.contextProviderStack[index]) ? warning_1(false, 'Unexpected pop.') : void 0;
|
|
2671
2699
|
}
|
|
2672
|
-
|
|
2673
|
-
this.
|
|
2674
|
-
var
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2700
|
+
|
|
2701
|
+
var context = this.contextStack[index];
|
|
2702
|
+
var previousValue = this.contextValueStack[index];
|
|
2703
|
+
|
|
2704
|
+
// "Hide" these null assignments from Flow by using `any`
|
|
2705
|
+
// because conceptually they are deletions--as long as we
|
|
2706
|
+
// promise to never access values beyond `this.contextIndex`.
|
|
2707
|
+
this.contextStack[index] = null;
|
|
2708
|
+
this.contextValueStack[index] = null;
|
|
2709
|
+
{
|
|
2710
|
+
this.contextProviderStack[index] = null;
|
|
2681
2711
|
}
|
|
2712
|
+
this.contextIndex--;
|
|
2713
|
+
|
|
2714
|
+
// Restore to the previous value we stored as we were walking down.
|
|
2715
|
+
context._currentValue = previousValue;
|
|
2682
2716
|
};
|
|
2683
2717
|
|
|
2684
2718
|
ReactDOMServerRenderer.prototype.read = function read(bytes) {
|
|
@@ -2779,6 +2813,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2779
2813
|
switch (elementType) {
|
|
2780
2814
|
case REACT_STRICT_MODE_TYPE:
|
|
2781
2815
|
case REACT_ASYNC_MODE_TYPE:
|
|
2816
|
+
case REACT_PROFILER_TYPE:
|
|
2782
2817
|
case REACT_FRAGMENT_TYPE:
|
|
2783
2818
|
{
|
|
2784
2819
|
var _nextChildren = toArray(nextChild.props.children);
|
|
@@ -2796,56 +2831,71 @@ var ReactDOMServerRenderer = function () {
|
|
|
2796
2831
|
this.stack.push(_frame);
|
|
2797
2832
|
return '';
|
|
2798
2833
|
}
|
|
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
2834
|
// eslint-disable-next-line-no-fallthrough
|
|
2803
2835
|
default:
|
|
2804
2836
|
break;
|
|
2805
2837
|
}
|
|
2806
2838
|
if (typeof elementType === 'object' && elementType !== null) {
|
|
2807
2839
|
switch (elementType.$$typeof) {
|
|
2840
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2841
|
+
{
|
|
2842
|
+
var element = nextChild;
|
|
2843
|
+
var _nextChildren2 = toArray(elementType.render(element.props, element.ref));
|
|
2844
|
+
var _frame2 = {
|
|
2845
|
+
type: null,
|
|
2846
|
+
domNamespace: parentNamespace,
|
|
2847
|
+
children: _nextChildren2,
|
|
2848
|
+
childIndex: 0,
|
|
2849
|
+
context: context,
|
|
2850
|
+
footer: ''
|
|
2851
|
+
};
|
|
2852
|
+
{
|
|
2853
|
+
_frame2.debugElementStack = [];
|
|
2854
|
+
}
|
|
2855
|
+
this.stack.push(_frame2);
|
|
2856
|
+
return '';
|
|
2857
|
+
}
|
|
2808
2858
|
case REACT_PROVIDER_TYPE:
|
|
2809
2859
|
{
|
|
2810
2860
|
var provider = nextChild;
|
|
2811
2861
|
var nextProps = provider.props;
|
|
2812
|
-
var
|
|
2813
|
-
var
|
|
2862
|
+
var _nextChildren3 = toArray(nextProps.children);
|
|
2863
|
+
var _frame3 = {
|
|
2814
2864
|
type: provider,
|
|
2815
2865
|
domNamespace: parentNamespace,
|
|
2816
|
-
children:
|
|
2866
|
+
children: _nextChildren3,
|
|
2817
2867
|
childIndex: 0,
|
|
2818
2868
|
context: context,
|
|
2819
2869
|
footer: ''
|
|
2820
2870
|
};
|
|
2821
2871
|
{
|
|
2822
|
-
|
|
2872
|
+
_frame3.debugElementStack = [];
|
|
2823
2873
|
}
|
|
2824
2874
|
|
|
2825
2875
|
this.pushProvider(provider);
|
|
2826
2876
|
|
|
2827
|
-
this.stack.push(
|
|
2877
|
+
this.stack.push(_frame3);
|
|
2828
2878
|
return '';
|
|
2829
2879
|
}
|
|
2830
2880
|
case REACT_CONTEXT_TYPE:
|
|
2831
2881
|
{
|
|
2832
2882
|
var consumer = nextChild;
|
|
2833
2883
|
var _nextProps = consumer.props;
|
|
2834
|
-
var nextValue = consumer.type.
|
|
2884
|
+
var nextValue = consumer.type._currentValue;
|
|
2835
2885
|
|
|
2836
|
-
var
|
|
2837
|
-
var
|
|
2886
|
+
var _nextChildren4 = toArray(_nextProps.children(nextValue));
|
|
2887
|
+
var _frame4 = {
|
|
2838
2888
|
type: nextChild,
|
|
2839
2889
|
domNamespace: parentNamespace,
|
|
2840
|
-
children:
|
|
2890
|
+
children: _nextChildren4,
|
|
2841
2891
|
childIndex: 0,
|
|
2842
2892
|
context: context,
|
|
2843
2893
|
footer: ''
|
|
2844
2894
|
};
|
|
2845
2895
|
{
|
|
2846
|
-
|
|
2896
|
+
_frame4.debugElementStack = [];
|
|
2847
2897
|
}
|
|
2848
|
-
this.stack.push(
|
|
2898
|
+
this.stack.push(_frame4);
|
|
2849
2899
|
return '';
|
|
2850
2900
|
}
|
|
2851
2901
|
default:
|
|
@@ -2880,7 +2930,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2880
2930
|
if (namespace === Namespaces.html) {
|
|
2881
2931
|
// Should this check be gated by parent namespace? Not sure we want to
|
|
2882
2932
|
// allow <SVG> or <mATH>.
|
|
2883
|
-
|
|
2933
|
+
!(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
2934
|
}
|
|
2885
2935
|
}
|
|
2886
2936
|
|
|
@@ -2956,9 +3006,11 @@ var ReactDOMServerRenderer = function () {
|
|
|
2956
3006
|
}
|
|
2957
3007
|
var isArray = Array.isArray(props[propName]);
|
|
2958
3008
|
if (props.multiple && !isArray) {
|
|
2959
|
-
warning_1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '')
|
|
3009
|
+
warning_1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '' // getDeclarationErrorAddendum(),
|
|
3010
|
+
);
|
|
2960
3011
|
} 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, '')
|
|
3012
|
+
warning_1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '' // getDeclarationErrorAddendum(),
|
|
3013
|
+
);
|
|
2962
3014
|
}
|
|
2963
3015
|
}
|
|
2964
3016
|
|
|
@@ -3106,7 +3158,7 @@ var ReactDOMServer = ( ReactDOMServerBrowser$1 && ReactDOMServerBrowser ) || Rea
|
|
|
3106
3158
|
|
|
3107
3159
|
// TODO: decide on the top-level export form.
|
|
3108
3160
|
// This is hacky but makes it work with both Rollup and Jest
|
|
3109
|
-
var server_browser = ReactDOMServer
|
|
3161
|
+
var server_browser = ReactDOMServer.default ? ReactDOMServer.default : ReactDOMServer;
|
|
3110
3162
|
|
|
3111
3163
|
return server_browser;
|
|
3112
3164
|
|