react-dom 16.4.0-alpha.7926752 → 16.4.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/cjs/react-dom-server.browser.development.js +127 -106
- package/cjs/react-dom-server.browser.production.min.js +30 -30
- package/cjs/react-dom-server.node.development.js +128 -107
- package/cjs/react-dom-server.node.production.min.js +32 -32
- package/cjs/react-dom-test-utils.development.js +145 -150
- 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 +11357 -11092
- package/cjs/react-dom.production.min.js +227 -245
- package/package.json +2 -2
- package/umd/react-dom-server.browser.development.js +131 -110
- package/umd/react-dom-server.browser.production.min.js +28 -28
- package/umd/react-dom-test-utils.development.js +145 -150
- 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 +11468 -11203
- package/umd/react-dom.production.min.js +186 -205
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.4.0
|
|
1
|
+
/** @license React v16.4.0
|
|
2
2
|
* react-dom-server.browser.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -26,16 +26,12 @@ var warning = require('fbjs/lib/warning');
|
|
|
26
26
|
var checkPropTypes = require('prop-types/checkPropTypes');
|
|
27
27
|
var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* This is a replacement for `invariant(...)` used by the error code system
|
|
32
|
-
* and will _only_ be required by the corresponding babel pass.
|
|
33
|
-
* It always throws.
|
|
34
|
-
*/
|
|
29
|
+
// Relying on the `invariant()` implementation lets us
|
|
30
|
+
// have preserve the format and params in the www builds.
|
|
35
31
|
|
|
36
32
|
// TODO: this is special because it gets imported during build.
|
|
37
33
|
|
|
38
|
-
var ReactVersion = '16.4.0
|
|
34
|
+
var ReactVersion = '16.4.0';
|
|
39
35
|
|
|
40
36
|
/**
|
|
41
37
|
* Forked from fbjs/warning:
|
|
@@ -102,16 +98,11 @@ var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
|
|
|
102
98
|
// Exports ReactDOM.createRoot
|
|
103
99
|
|
|
104
100
|
|
|
105
|
-
|
|
106
|
-
// Mutating mode (React DOM, React ART, React Native):
|
|
107
|
-
|
|
108
|
-
// Experimental noop mode (currently unused):
|
|
109
|
-
|
|
110
|
-
// Experimental persistent mode (Fabric):
|
|
111
|
-
|
|
112
101
|
// Experimental error-boundary API that can recover from errors within a single
|
|
113
102
|
// render phase
|
|
114
103
|
|
|
104
|
+
// Suspense
|
|
105
|
+
|
|
115
106
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
116
107
|
|
|
117
108
|
|
|
@@ -128,21 +119,30 @@ var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
|
|
|
128
119
|
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
129
120
|
var warnAboutDeprecatedLifecycles = false;
|
|
130
121
|
|
|
122
|
+
// Warn about legacy context API
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
// Gather advanced timing metrics for Profiler subtrees.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
// Fires getDerivedStateFromProps for state *or* props changes
|
|
129
|
+
|
|
130
|
+
|
|
131
131
|
// Only used in www builds.
|
|
132
132
|
|
|
133
133
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
134
134
|
// nor polyfill, then a plain number is used for performance.
|
|
135
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol
|
|
135
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
136
136
|
|
|
137
137
|
|
|
138
|
-
var
|
|
139
|
-
var
|
|
140
|
-
var
|
|
141
|
-
var
|
|
142
|
-
var
|
|
143
|
-
var
|
|
144
|
-
var
|
|
145
|
-
var
|
|
138
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
139
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
140
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
141
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
142
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
143
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
144
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
145
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
146
146
|
|
|
147
147
|
// A reserved attribute.
|
|
148
148
|
// It is handled by React separately and shouldn't be written to the DOM.
|
|
@@ -254,6 +254,9 @@ function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)
|
|
|
254
254
|
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
|
255
255
|
return true;
|
|
256
256
|
}
|
|
257
|
+
if (isCustomComponentTag) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
257
260
|
if (propertyInfo !== null) {
|
|
258
261
|
switch (propertyInfo.type) {
|
|
259
262
|
case BOOLEAN:
|
|
@@ -296,15 +299,20 @@ var properties = {};
|
|
|
296
299
|
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
|
|
297
300
|
name, // attributeName
|
|
298
301
|
null);
|
|
299
|
-
}
|
|
302
|
+
} // attributeNamespace
|
|
303
|
+
);
|
|
300
304
|
|
|
301
305
|
// A few React string attributes have a different name.
|
|
302
306
|
// This is a mapping from React prop names to the attribute names.
|
|
303
|
-
|
|
307
|
+
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
|
308
|
+
var name = _ref[0],
|
|
309
|
+
attributeName = _ref[1];
|
|
310
|
+
|
|
304
311
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
305
312
|
attributeName, // attributeName
|
|
306
313
|
null);
|
|
307
|
-
}
|
|
314
|
+
} // attributeNamespace
|
|
315
|
+
);
|
|
308
316
|
|
|
309
317
|
// These are "enumerated" HTML attributes that accept "true" and "false".
|
|
310
318
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -313,7 +321,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
313
321
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
314
322
|
name.toLowerCase(), // attributeName
|
|
315
323
|
null);
|
|
316
|
-
}
|
|
324
|
+
} // attributeNamespace
|
|
325
|
+
);
|
|
317
326
|
|
|
318
327
|
// These are "enumerated" SVG attributes that accept "true" and "false".
|
|
319
328
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -323,7 +332,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
323
332
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
324
333
|
name, // attributeName
|
|
325
334
|
null);
|
|
326
|
-
}
|
|
335
|
+
} // attributeNamespace
|
|
336
|
+
);
|
|
327
337
|
|
|
328
338
|
// These are HTML boolean attributes.
|
|
329
339
|
['allowFullScreen', 'async',
|
|
@@ -335,7 +345,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
335
345
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
|
336
346
|
name.toLowerCase(), // attributeName
|
|
337
347
|
null);
|
|
338
|
-
}
|
|
348
|
+
} // attributeNamespace
|
|
349
|
+
);
|
|
339
350
|
|
|
340
351
|
// These are the few React props that we set as DOM properties
|
|
341
352
|
// rather than attributes. These are all booleans.
|
|
@@ -346,7 +357,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
346
357
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
|
347
358
|
name.toLowerCase(), // attributeName
|
|
348
359
|
null);
|
|
349
|
-
}
|
|
360
|
+
} // attributeNamespace
|
|
361
|
+
);
|
|
350
362
|
|
|
351
363
|
// These are HTML attributes that are "overloaded booleans": they behave like
|
|
352
364
|
// booleans, but can also accept a string value.
|
|
@@ -354,21 +366,24 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
354
366
|
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
|
|
355
367
|
name.toLowerCase(), // attributeName
|
|
356
368
|
null);
|
|
357
|
-
}
|
|
369
|
+
} // attributeNamespace
|
|
370
|
+
);
|
|
358
371
|
|
|
359
372
|
// These are HTML attributes that must be positive numbers.
|
|
360
373
|
['cols', 'rows', 'size', 'span'].forEach(function (name) {
|
|
361
374
|
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
|
|
362
375
|
name.toLowerCase(), // attributeName
|
|
363
376
|
null);
|
|
364
|
-
}
|
|
377
|
+
} // attributeNamespace
|
|
378
|
+
);
|
|
365
379
|
|
|
366
380
|
// These are HTML attributes that must be numbers.
|
|
367
381
|
['rowSpan', 'start'].forEach(function (name) {
|
|
368
382
|
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
|
|
369
383
|
name.toLowerCase(), // attributeName
|
|
370
384
|
null);
|
|
371
|
-
}
|
|
385
|
+
} // attributeNamespace
|
|
386
|
+
);
|
|
372
387
|
|
|
373
388
|
var CAMELIZE = /[\-\:]([a-z])/g;
|
|
374
389
|
var capitalize = function (token) {
|
|
@@ -384,7 +399,8 @@ var capitalize = function (token) {
|
|
|
384
399
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
385
400
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
386
401
|
attributeName, null);
|
|
387
|
-
}
|
|
402
|
+
} // attributeNamespace
|
|
403
|
+
);
|
|
388
404
|
|
|
389
405
|
// String SVG attributes with the xlink namespace.
|
|
390
406
|
['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
|
@@ -652,6 +668,7 @@ var omittedCloseTags = {
|
|
|
652
668
|
source: true,
|
|
653
669
|
track: true,
|
|
654
670
|
wbr: true
|
|
671
|
+
// NOTE: menuitem's close tag should be omitted, but that causes problems.
|
|
655
672
|
};
|
|
656
673
|
|
|
657
674
|
// For HTML, certain tags cannot have children. This has the same purpose as
|
|
@@ -676,7 +693,7 @@ function assertValidProps(tag, props, getStack) {
|
|
|
676
693
|
!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
|
|
677
694
|
}
|
|
678
695
|
{
|
|
679
|
-
|
|
696
|
+
!(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning(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;
|
|
680
697
|
}
|
|
681
698
|
!(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getStack()) : void 0;
|
|
682
699
|
}
|
|
@@ -1135,7 +1152,7 @@ var possibleStandardNames = {
|
|
|
1135
1152
|
checked: 'checked',
|
|
1136
1153
|
children: 'children',
|
|
1137
1154
|
cite: 'cite',
|
|
1138
|
-
|
|
1155
|
+
class: 'className',
|
|
1139
1156
|
classid: 'classID',
|
|
1140
1157
|
classname: 'className',
|
|
1141
1158
|
cols: 'cols',
|
|
@@ -1150,7 +1167,7 @@ var possibleStandardNames = {
|
|
|
1150
1167
|
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
|
1151
1168
|
data: 'data',
|
|
1152
1169
|
datetime: 'dateTime',
|
|
1153
|
-
|
|
1170
|
+
default: 'default',
|
|
1154
1171
|
defaultchecked: 'defaultChecked',
|
|
1155
1172
|
defaultvalue: 'defaultValue',
|
|
1156
1173
|
defer: 'defer',
|
|
@@ -1159,7 +1176,7 @@ var possibleStandardNames = {
|
|
|
1159
1176
|
download: 'download',
|
|
1160
1177
|
draggable: 'draggable',
|
|
1161
1178
|
enctype: 'encType',
|
|
1162
|
-
|
|
1179
|
+
for: 'htmlFor',
|
|
1163
1180
|
form: 'form',
|
|
1164
1181
|
formmethod: 'formMethod',
|
|
1165
1182
|
formaction: 'formAction',
|
|
@@ -1377,7 +1394,7 @@ var possibleStandardNames = {
|
|
|
1377
1394
|
imagerendering: 'imageRendering',
|
|
1378
1395
|
'image-rendering': 'imageRendering',
|
|
1379
1396
|
in2: 'in2',
|
|
1380
|
-
|
|
1397
|
+
in: 'in',
|
|
1381
1398
|
inlist: 'inlist',
|
|
1382
1399
|
intercept: 'intercept',
|
|
1383
1400
|
k1: 'k1',
|
|
@@ -1517,7 +1534,7 @@ var possibleStandardNames = {
|
|
|
1517
1534
|
'text-rendering': 'textRendering',
|
|
1518
1535
|
to: 'to',
|
|
1519
1536
|
transform: 'transform',
|
|
1520
|
-
|
|
1537
|
+
typeof: 'typeof',
|
|
1521
1538
|
u1: 'u1',
|
|
1522
1539
|
u2: 'u2',
|
|
1523
1540
|
underlineposition: 'underlinePosition',
|
|
@@ -2033,42 +2050,26 @@ function validateRenderResult(child, type) {
|
|
|
2033
2050
|
}
|
|
2034
2051
|
|
|
2035
2052
|
function resolve(child, context) {
|
|
2036
|
-
var element = void 0;
|
|
2037
|
-
|
|
2038
|
-
var Component = void 0;
|
|
2039
|
-
var publicContext = void 0;
|
|
2040
|
-
var inst = void 0,
|
|
2041
|
-
queue = void 0,
|
|
2042
|
-
replace = void 0;
|
|
2043
|
-
var updater = void 0;
|
|
2044
|
-
|
|
2045
|
-
var initialState = void 0;
|
|
2046
|
-
var oldQueue = void 0,
|
|
2047
|
-
oldReplace = void 0;
|
|
2048
|
-
var nextState = void 0,
|
|
2049
|
-
dontMutate = void 0;
|
|
2050
|
-
var partial = void 0,
|
|
2051
|
-
partialState = void 0;
|
|
2052
|
-
|
|
2053
|
-
var childContext = void 0;
|
|
2054
|
-
var childContextTypes = void 0,
|
|
2055
|
-
contextKey = void 0;
|
|
2056
|
-
|
|
2057
2053
|
while (React.isValidElement(child)) {
|
|
2058
2054
|
// Safe because we just checked it's an element.
|
|
2059
|
-
element = child;
|
|
2055
|
+
var element = child;
|
|
2056
|
+
var Component = element.type;
|
|
2060
2057
|
{
|
|
2061
2058
|
pushElementToDebugStack(element);
|
|
2062
2059
|
}
|
|
2063
|
-
Component = element.type;
|
|
2064
2060
|
if (typeof Component !== 'function') {
|
|
2065
2061
|
break;
|
|
2066
2062
|
}
|
|
2067
|
-
|
|
2063
|
+
processChild(element, Component);
|
|
2064
|
+
}
|
|
2068
2065
|
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2066
|
+
// Extra closure so queue and replace can be captured properly
|
|
2067
|
+
function processChild(element, Component) {
|
|
2068
|
+
var publicContext = processContext(Component, context);
|
|
2069
|
+
|
|
2070
|
+
var queue = [];
|
|
2071
|
+
var replace = false;
|
|
2072
|
+
var updater = {
|
|
2072
2073
|
isMounted: function (publicInstance) {
|
|
2073
2074
|
return false;
|
|
2074
2075
|
},
|
|
@@ -2091,6 +2092,7 @@ function resolve(child, context) {
|
|
|
2091
2092
|
}
|
|
2092
2093
|
};
|
|
2093
2094
|
|
|
2095
|
+
var inst = void 0;
|
|
2094
2096
|
if (shouldConstruct(Component)) {
|
|
2095
2097
|
inst = new Component(element.props, publicContext, updater);
|
|
2096
2098
|
|
|
@@ -2105,7 +2107,7 @@ function resolve(child, context) {
|
|
|
2105
2107
|
}
|
|
2106
2108
|
}
|
|
2107
2109
|
|
|
2108
|
-
partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
|
2110
|
+
var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
|
2109
2111
|
|
|
2110
2112
|
{
|
|
2111
2113
|
if (partialState === undefined) {
|
|
@@ -2136,7 +2138,7 @@ function resolve(child, context) {
|
|
|
2136
2138
|
if (inst == null || inst.render == null) {
|
|
2137
2139
|
child = inst;
|
|
2138
2140
|
validateRenderResult(child, Component);
|
|
2139
|
-
|
|
2141
|
+
return;
|
|
2140
2142
|
}
|
|
2141
2143
|
}
|
|
2142
2144
|
|
|
@@ -2144,7 +2146,7 @@ function resolve(child, context) {
|
|
|
2144
2146
|
inst.context = publicContext;
|
|
2145
2147
|
inst.updater = updater;
|
|
2146
2148
|
|
|
2147
|
-
initialState = inst.state;
|
|
2149
|
+
var initialState = inst.state;
|
|
2148
2150
|
if (initialState === undefined) {
|
|
2149
2151
|
inst.state = initialState = null;
|
|
2150
2152
|
}
|
|
@@ -2173,25 +2175,25 @@ function resolve(child, context) {
|
|
|
2173
2175
|
inst.UNSAFE_componentWillMount();
|
|
2174
2176
|
}
|
|
2175
2177
|
if (queue.length) {
|
|
2176
|
-
oldQueue = queue;
|
|
2177
|
-
oldReplace = replace;
|
|
2178
|
+
var oldQueue = queue;
|
|
2179
|
+
var oldReplace = replace;
|
|
2178
2180
|
queue = null;
|
|
2179
2181
|
replace = false;
|
|
2180
2182
|
|
|
2181
2183
|
if (oldReplace && oldQueue.length === 1) {
|
|
2182
2184
|
inst.state = oldQueue[0];
|
|
2183
2185
|
} else {
|
|
2184
|
-
nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
2185
|
-
dontMutate = true;
|
|
2186
|
+
var nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
2187
|
+
var dontMutate = true;
|
|
2186
2188
|
for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
|
|
2187
|
-
partial = oldQueue[i];
|
|
2188
|
-
|
|
2189
|
-
if (
|
|
2189
|
+
var partial = oldQueue[i];
|
|
2190
|
+
var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
|
|
2191
|
+
if (_partialState != null) {
|
|
2190
2192
|
if (dontMutate) {
|
|
2191
2193
|
dontMutate = false;
|
|
2192
|
-
nextState = _assign({}, nextState,
|
|
2194
|
+
nextState = _assign({}, nextState, _partialState);
|
|
2193
2195
|
} else {
|
|
2194
|
-
_assign(nextState,
|
|
2196
|
+
_assign(nextState, _partialState);
|
|
2195
2197
|
}
|
|
2196
2198
|
}
|
|
2197
2199
|
}
|
|
@@ -2212,11 +2214,12 @@ function resolve(child, context) {
|
|
|
2212
2214
|
}
|
|
2213
2215
|
validateRenderResult(child, Component);
|
|
2214
2216
|
|
|
2217
|
+
var childContext = void 0;
|
|
2215
2218
|
if (typeof inst.getChildContext === 'function') {
|
|
2216
|
-
childContextTypes = Component.childContextTypes;
|
|
2219
|
+
var childContextTypes = Component.childContextTypes;
|
|
2217
2220
|
if (typeof childContextTypes === 'object') {
|
|
2218
2221
|
childContext = inst.getChildContext();
|
|
2219
|
-
for (contextKey in childContext) {
|
|
2222
|
+
for (var contextKey in childContext) {
|
|
2220
2223
|
!(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
|
|
2221
2224
|
}
|
|
2222
2225
|
} else {
|
|
@@ -2265,23 +2268,23 @@ var ReactDOMServerRenderer = function () {
|
|
|
2265
2268
|
ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
|
|
2266
2269
|
this.providerIndex += 1;
|
|
2267
2270
|
this.providerStack[this.providerIndex] = provider;
|
|
2268
|
-
var context = provider.type.
|
|
2269
|
-
context.
|
|
2271
|
+
var context = provider.type._context;
|
|
2272
|
+
context._currentValue = provider.props.value;
|
|
2270
2273
|
};
|
|
2271
2274
|
|
|
2272
2275
|
ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
|
|
2273
2276
|
{
|
|
2274
|
-
|
|
2277
|
+
!(this.providerIndex > -1 && provider === this.providerStack[this.providerIndex]) ? warning(false, 'Unexpected pop.') : void 0;
|
|
2275
2278
|
}
|
|
2276
2279
|
this.providerStack[this.providerIndex] = null;
|
|
2277
2280
|
this.providerIndex -= 1;
|
|
2278
|
-
var context = provider.type.
|
|
2281
|
+
var context = provider.type._context;
|
|
2279
2282
|
if (this.providerIndex < 0) {
|
|
2280
|
-
context.
|
|
2283
|
+
context._currentValue = context._defaultValue;
|
|
2281
2284
|
} else {
|
|
2282
2285
|
// We assume this type is correct because of the index check above.
|
|
2283
2286
|
var previousProvider = this.providerStack[this.providerIndex];
|
|
2284
|
-
context.
|
|
2287
|
+
context._currentValue = previousProvider.props.value;
|
|
2285
2288
|
}
|
|
2286
2289
|
};
|
|
2287
2290
|
|
|
@@ -2383,6 +2386,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2383
2386
|
switch (elementType) {
|
|
2384
2387
|
case REACT_STRICT_MODE_TYPE:
|
|
2385
2388
|
case REACT_ASYNC_MODE_TYPE:
|
|
2389
|
+
case REACT_PROFILER_TYPE:
|
|
2386
2390
|
case REACT_FRAGMENT_TYPE:
|
|
2387
2391
|
{
|
|
2388
2392
|
var _nextChildren = toArray(nextChild.props.children);
|
|
@@ -2400,56 +2404,71 @@ var ReactDOMServerRenderer = function () {
|
|
|
2400
2404
|
this.stack.push(_frame);
|
|
2401
2405
|
return '';
|
|
2402
2406
|
}
|
|
2403
|
-
case REACT_CALL_TYPE:
|
|
2404
|
-
case REACT_RETURN_TYPE:
|
|
2405
|
-
invariant(false, 'The experimental Call and Return types are not currently supported by the server renderer.');
|
|
2406
2407
|
// eslint-disable-next-line-no-fallthrough
|
|
2407
2408
|
default:
|
|
2408
2409
|
break;
|
|
2409
2410
|
}
|
|
2410
2411
|
if (typeof elementType === 'object' && elementType !== null) {
|
|
2411
2412
|
switch (elementType.$$typeof) {
|
|
2413
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2414
|
+
{
|
|
2415
|
+
var element = nextChild;
|
|
2416
|
+
var _nextChildren2 = toArray(elementType.render(element.props, element.ref));
|
|
2417
|
+
var _frame2 = {
|
|
2418
|
+
type: null,
|
|
2419
|
+
domNamespace: parentNamespace,
|
|
2420
|
+
children: _nextChildren2,
|
|
2421
|
+
childIndex: 0,
|
|
2422
|
+
context: context,
|
|
2423
|
+
footer: ''
|
|
2424
|
+
};
|
|
2425
|
+
{
|
|
2426
|
+
_frame2.debugElementStack = [];
|
|
2427
|
+
}
|
|
2428
|
+
this.stack.push(_frame2);
|
|
2429
|
+
return '';
|
|
2430
|
+
}
|
|
2412
2431
|
case REACT_PROVIDER_TYPE:
|
|
2413
2432
|
{
|
|
2414
2433
|
var provider = nextChild;
|
|
2415
2434
|
var nextProps = provider.props;
|
|
2416
|
-
var
|
|
2417
|
-
var
|
|
2435
|
+
var _nextChildren3 = toArray(nextProps.children);
|
|
2436
|
+
var _frame3 = {
|
|
2418
2437
|
type: provider,
|
|
2419
2438
|
domNamespace: parentNamespace,
|
|
2420
|
-
children:
|
|
2439
|
+
children: _nextChildren3,
|
|
2421
2440
|
childIndex: 0,
|
|
2422
2441
|
context: context,
|
|
2423
2442
|
footer: ''
|
|
2424
2443
|
};
|
|
2425
2444
|
{
|
|
2426
|
-
|
|
2445
|
+
_frame3.debugElementStack = [];
|
|
2427
2446
|
}
|
|
2428
2447
|
|
|
2429
2448
|
this.pushProvider(provider);
|
|
2430
2449
|
|
|
2431
|
-
this.stack.push(
|
|
2450
|
+
this.stack.push(_frame3);
|
|
2432
2451
|
return '';
|
|
2433
2452
|
}
|
|
2434
2453
|
case REACT_CONTEXT_TYPE:
|
|
2435
2454
|
{
|
|
2436
2455
|
var consumer = nextChild;
|
|
2437
2456
|
var _nextProps = consumer.props;
|
|
2438
|
-
var nextValue = consumer.type.
|
|
2457
|
+
var nextValue = consumer.type._currentValue;
|
|
2439
2458
|
|
|
2440
|
-
var
|
|
2441
|
-
var
|
|
2459
|
+
var _nextChildren4 = toArray(_nextProps.children(nextValue));
|
|
2460
|
+
var _frame4 = {
|
|
2442
2461
|
type: nextChild,
|
|
2443
2462
|
domNamespace: parentNamespace,
|
|
2444
|
-
children:
|
|
2463
|
+
children: _nextChildren4,
|
|
2445
2464
|
childIndex: 0,
|
|
2446
2465
|
context: context,
|
|
2447
2466
|
footer: ''
|
|
2448
2467
|
};
|
|
2449
2468
|
{
|
|
2450
|
-
|
|
2469
|
+
_frame4.debugElementStack = [];
|
|
2451
2470
|
}
|
|
2452
|
-
this.stack.push(
|
|
2471
|
+
this.stack.push(_frame4);
|
|
2453
2472
|
return '';
|
|
2454
2473
|
}
|
|
2455
2474
|
default:
|
|
@@ -2484,7 +2503,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2484
2503
|
if (namespace === Namespaces.html) {
|
|
2485
2504
|
// Should this check be gated by parent namespace? Not sure we want to
|
|
2486
2505
|
// allow <SVG> or <mATH>.
|
|
2487
|
-
|
|
2506
|
+
!(tag === element.type) ? warning(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type) : void 0;
|
|
2488
2507
|
}
|
|
2489
2508
|
}
|
|
2490
2509
|
|
|
@@ -2560,9 +2579,11 @@ var ReactDOMServerRenderer = function () {
|
|
|
2560
2579
|
}
|
|
2561
2580
|
var isArray = Array.isArray(props[propName]);
|
|
2562
2581
|
if (props.multiple && !isArray) {
|
|
2563
|
-
warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '')
|
|
2582
|
+
warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '' // getDeclarationErrorAddendum(),
|
|
2583
|
+
);
|
|
2564
2584
|
} else if (!props.multiple && isArray) {
|
|
2565
|
-
warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '')
|
|
2585
|
+
warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '' // getDeclarationErrorAddendum(),
|
|
2586
|
+
);
|
|
2566
2587
|
}
|
|
2567
2588
|
}
|
|
2568
2589
|
|
|
@@ -2710,7 +2731,7 @@ var ReactDOMServer = ( ReactDOMServerBrowser$1 && ReactDOMServerBrowser ) || Rea
|
|
|
2710
2731
|
|
|
2711
2732
|
// TODO: decide on the top-level export form.
|
|
2712
2733
|
// This is hacky but makes it work with both Rollup and Jest
|
|
2713
|
-
var server_browser = ReactDOMServer
|
|
2734
|
+
var server_browser = ReactDOMServer.default ? ReactDOMServer.default : ReactDOMServer;
|
|
2714
2735
|
|
|
2715
2736
|
module.exports = server_browser;
|
|
2716
2737
|
})();
|