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.
|
|
@@ -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.
|
|
34
|
+
var ReactVersion = '16.4.2';
|
|
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,27 @@ 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
|
+
|
|
131
128
|
// Only used in www builds.
|
|
132
129
|
|
|
133
130
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
134
131
|
// nor polyfill, then a plain number is used for performance.
|
|
135
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol
|
|
132
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
136
133
|
|
|
137
134
|
|
|
138
|
-
var
|
|
139
|
-
var
|
|
140
|
-
var
|
|
141
|
-
var
|
|
142
|
-
var
|
|
143
|
-
var
|
|
144
|
-
var
|
|
145
|
-
var
|
|
135
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
136
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
137
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
138
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
139
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
140
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
141
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
142
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
146
143
|
|
|
147
144
|
// A reserved attribute.
|
|
148
145
|
// It is handled by React separately and shouldn't be written to the DOM.
|
|
@@ -186,14 +183,15 @@ var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u
|
|
|
186
183
|
var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
|
|
187
184
|
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
188
185
|
|
|
186
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
189
187
|
var illegalAttributeNameCache = {};
|
|
190
188
|
var validatedAttributeNameCache = {};
|
|
191
189
|
|
|
192
190
|
function isAttributeNameSafe(attributeName) {
|
|
193
|
-
if (
|
|
191
|
+
if (hasOwnProperty$1.call(validatedAttributeNameCache, attributeName)) {
|
|
194
192
|
return true;
|
|
195
193
|
}
|
|
196
|
-
if (
|
|
194
|
+
if (hasOwnProperty$1.call(illegalAttributeNameCache, attributeName)) {
|
|
197
195
|
return false;
|
|
198
196
|
}
|
|
199
197
|
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
|
@@ -254,6 +252,9 @@ function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)
|
|
|
254
252
|
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
|
255
253
|
return true;
|
|
256
254
|
}
|
|
255
|
+
if (isCustomComponentTag) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
257
258
|
if (propertyInfo !== null) {
|
|
258
259
|
switch (propertyInfo.type) {
|
|
259
260
|
case BOOLEAN:
|
|
@@ -296,15 +297,20 @@ var properties = {};
|
|
|
296
297
|
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
|
|
297
298
|
name, // attributeName
|
|
298
299
|
null);
|
|
299
|
-
}
|
|
300
|
+
} // attributeNamespace
|
|
301
|
+
);
|
|
300
302
|
|
|
301
303
|
// A few React string attributes have a different name.
|
|
302
304
|
// This is a mapping from React prop names to the attribute names.
|
|
303
|
-
|
|
305
|
+
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
|
306
|
+
var name = _ref[0],
|
|
307
|
+
attributeName = _ref[1];
|
|
308
|
+
|
|
304
309
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
305
310
|
attributeName, // attributeName
|
|
306
311
|
null);
|
|
307
|
-
}
|
|
312
|
+
} // attributeNamespace
|
|
313
|
+
);
|
|
308
314
|
|
|
309
315
|
// These are "enumerated" HTML attributes that accept "true" and "false".
|
|
310
316
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -313,7 +319,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
313
319
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
314
320
|
name.toLowerCase(), // attributeName
|
|
315
321
|
null);
|
|
316
|
-
}
|
|
322
|
+
} // attributeNamespace
|
|
323
|
+
);
|
|
317
324
|
|
|
318
325
|
// These are "enumerated" SVG attributes that accept "true" and "false".
|
|
319
326
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -323,7 +330,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
323
330
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
324
331
|
name, // attributeName
|
|
325
332
|
null);
|
|
326
|
-
}
|
|
333
|
+
} // attributeNamespace
|
|
334
|
+
);
|
|
327
335
|
|
|
328
336
|
// These are HTML boolean attributes.
|
|
329
337
|
['allowFullScreen', 'async',
|
|
@@ -335,7 +343,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
335
343
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
|
336
344
|
name.toLowerCase(), // attributeName
|
|
337
345
|
null);
|
|
338
|
-
}
|
|
346
|
+
} // attributeNamespace
|
|
347
|
+
);
|
|
339
348
|
|
|
340
349
|
// These are the few React props that we set as DOM properties
|
|
341
350
|
// rather than attributes. These are all booleans.
|
|
@@ -346,7 +355,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
346
355
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
|
347
356
|
name.toLowerCase(), // attributeName
|
|
348
357
|
null);
|
|
349
|
-
}
|
|
358
|
+
} // attributeNamespace
|
|
359
|
+
);
|
|
350
360
|
|
|
351
361
|
// These are HTML attributes that are "overloaded booleans": they behave like
|
|
352
362
|
// booleans, but can also accept a string value.
|
|
@@ -354,21 +364,24 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
354
364
|
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
|
|
355
365
|
name.toLowerCase(), // attributeName
|
|
356
366
|
null);
|
|
357
|
-
}
|
|
367
|
+
} // attributeNamespace
|
|
368
|
+
);
|
|
358
369
|
|
|
359
370
|
// These are HTML attributes that must be positive numbers.
|
|
360
371
|
['cols', 'rows', 'size', 'span'].forEach(function (name) {
|
|
361
372
|
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
|
|
362
373
|
name.toLowerCase(), // attributeName
|
|
363
374
|
null);
|
|
364
|
-
}
|
|
375
|
+
} // attributeNamespace
|
|
376
|
+
);
|
|
365
377
|
|
|
366
378
|
// These are HTML attributes that must be numbers.
|
|
367
379
|
['rowSpan', 'start'].forEach(function (name) {
|
|
368
380
|
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
|
|
369
381
|
name.toLowerCase(), // attributeName
|
|
370
382
|
null);
|
|
371
|
-
}
|
|
383
|
+
} // attributeNamespace
|
|
384
|
+
);
|
|
372
385
|
|
|
373
386
|
var CAMELIZE = /[\-\:]([a-z])/g;
|
|
374
387
|
var capitalize = function (token) {
|
|
@@ -384,7 +397,8 @@ var capitalize = function (token) {
|
|
|
384
397
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
385
398
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
386
399
|
attributeName, null);
|
|
387
|
-
}
|
|
400
|
+
} // attributeNamespace
|
|
401
|
+
);
|
|
388
402
|
|
|
389
403
|
// String SVG attributes with the xlink namespace.
|
|
390
404
|
['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
|
@@ -540,9 +554,10 @@ function createMarkupForProperty(name, value) {
|
|
|
540
554
|
} else {
|
|
541
555
|
return attributeName + '=' + quoteAttributeValueForBrowser(value);
|
|
542
556
|
}
|
|
543
|
-
} else {
|
|
557
|
+
} else if (isAttributeNameSafe(name)) {
|
|
544
558
|
return name + '=' + quoteAttributeValueForBrowser(value);
|
|
545
559
|
}
|
|
560
|
+
return '';
|
|
546
561
|
}
|
|
547
562
|
|
|
548
563
|
/**
|
|
@@ -652,6 +667,7 @@ var omittedCloseTags = {
|
|
|
652
667
|
source: true,
|
|
653
668
|
track: true,
|
|
654
669
|
wbr: true
|
|
670
|
+
// NOTE: menuitem's close tag should be omitted, but that causes problems.
|
|
655
671
|
};
|
|
656
672
|
|
|
657
673
|
// For HTML, certain tags cannot have children. This has the same purpose as
|
|
@@ -676,7 +692,7 @@ function assertValidProps(tag, props, getStack) {
|
|
|
676
692
|
!(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
693
|
}
|
|
678
694
|
{
|
|
679
|
-
|
|
695
|
+
!(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
696
|
}
|
|
681
697
|
!(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
698
|
}
|
|
@@ -948,7 +964,7 @@ var warnedProperties = {};
|
|
|
948
964
|
var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
949
965
|
var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
|
950
966
|
|
|
951
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
967
|
+
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
952
968
|
|
|
953
969
|
function getStackAddendum$1() {
|
|
954
970
|
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
@@ -956,7 +972,7 @@ function getStackAddendum$1() {
|
|
|
956
972
|
}
|
|
957
973
|
|
|
958
974
|
function validateProperty(tagName, name) {
|
|
959
|
-
if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
|
|
975
|
+
if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
|
|
960
976
|
return true;
|
|
961
977
|
}
|
|
962
978
|
|
|
@@ -1135,7 +1151,7 @@ var possibleStandardNames = {
|
|
|
1135
1151
|
checked: 'checked',
|
|
1136
1152
|
children: 'children',
|
|
1137
1153
|
cite: 'cite',
|
|
1138
|
-
|
|
1154
|
+
class: 'className',
|
|
1139
1155
|
classid: 'classID',
|
|
1140
1156
|
classname: 'className',
|
|
1141
1157
|
cols: 'cols',
|
|
@@ -1150,7 +1166,7 @@ var possibleStandardNames = {
|
|
|
1150
1166
|
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
|
1151
1167
|
data: 'data',
|
|
1152
1168
|
datetime: 'dateTime',
|
|
1153
|
-
|
|
1169
|
+
default: 'default',
|
|
1154
1170
|
defaultchecked: 'defaultChecked',
|
|
1155
1171
|
defaultvalue: 'defaultValue',
|
|
1156
1172
|
defer: 'defer',
|
|
@@ -1159,7 +1175,7 @@ var possibleStandardNames = {
|
|
|
1159
1175
|
download: 'download',
|
|
1160
1176
|
draggable: 'draggable',
|
|
1161
1177
|
enctype: 'encType',
|
|
1162
|
-
|
|
1178
|
+
for: 'htmlFor',
|
|
1163
1179
|
form: 'form',
|
|
1164
1180
|
formmethod: 'formMethod',
|
|
1165
1181
|
formaction: 'formAction',
|
|
@@ -1377,7 +1393,7 @@ var possibleStandardNames = {
|
|
|
1377
1393
|
imagerendering: 'imageRendering',
|
|
1378
1394
|
'image-rendering': 'imageRendering',
|
|
1379
1395
|
in2: 'in2',
|
|
1380
|
-
|
|
1396
|
+
in: 'in',
|
|
1381
1397
|
inlist: 'inlist',
|
|
1382
1398
|
intercept: 'intercept',
|
|
1383
1399
|
k1: 'k1',
|
|
@@ -1517,7 +1533,7 @@ var possibleStandardNames = {
|
|
|
1517
1533
|
'text-rendering': 'textRendering',
|
|
1518
1534
|
to: 'to',
|
|
1519
1535
|
transform: 'transform',
|
|
1520
|
-
|
|
1536
|
+
typeof: 'typeof',
|
|
1521
1537
|
u1: 'u1',
|
|
1522
1538
|
u2: 'u2',
|
|
1523
1539
|
underlineposition: 'underlinePosition',
|
|
@@ -1979,6 +1995,7 @@ function processContext(type, context) {
|
|
|
1979
1995
|
return maskedContext;
|
|
1980
1996
|
}
|
|
1981
1997
|
|
|
1998
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1982
1999
|
var STYLE = 'style';
|
|
1983
2000
|
var RESERVED_PROPS = {
|
|
1984
2001
|
children: null,
|
|
@@ -1991,7 +2008,7 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
|
|
|
1991
2008
|
var ret = '<' + tagVerbatim;
|
|
1992
2009
|
|
|
1993
2010
|
for (var propKey in props) {
|
|
1994
|
-
if (!
|
|
2011
|
+
if (!hasOwnProperty.call(props, propKey)) {
|
|
1995
2012
|
continue;
|
|
1996
2013
|
}
|
|
1997
2014
|
var propValue = props[propKey];
|
|
@@ -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
|
+
}
|
|
2065
|
+
|
|
2066
|
+
// Extra closure so queue and replace can be captured properly
|
|
2067
|
+
function processChild(element, Component) {
|
|
2068
|
+
var publicContext = processContext(Component, context);
|
|
2068
2069
|
|
|
2069
|
-
queue = [];
|
|
2070
|
-
replace = false;
|
|
2071
|
-
updater = {
|
|
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 {
|
|
@@ -2231,6 +2234,8 @@ function resolve(child, context) {
|
|
|
2231
2234
|
}
|
|
2232
2235
|
|
|
2233
2236
|
var ReactDOMServerRenderer = function () {
|
|
2237
|
+
// DEV-only
|
|
2238
|
+
|
|
2234
2239
|
function ReactDOMServerRenderer(children, makeStaticMarkup) {
|
|
2235
2240
|
_classCallCheck(this, ReactDOMServerRenderer);
|
|
2236
2241
|
|
|
@@ -2256,33 +2261,65 @@ var ReactDOMServerRenderer = function () {
|
|
|
2256
2261
|
this.makeStaticMarkup = makeStaticMarkup;
|
|
2257
2262
|
|
|
2258
2263
|
// Context (new API)
|
|
2259
|
-
this.
|
|
2260
|
-
this.
|
|
2264
|
+
this.contextIndex = -1;
|
|
2265
|
+
this.contextStack = [];
|
|
2266
|
+
this.contextValueStack = [];
|
|
2267
|
+
{
|
|
2268
|
+
this.contextProviderStack = [];
|
|
2269
|
+
}
|
|
2261
2270
|
}
|
|
2271
|
+
|
|
2272
|
+
/**
|
|
2273
|
+
* Note: We use just two stacks regardless of how many context providers you have.
|
|
2274
|
+
* Providers are always popped in the reverse order to how they were pushed
|
|
2275
|
+
* so we always know on the way down which provider you'll encounter next on the way up.
|
|
2276
|
+
* On the way down, we push the current provider, and its context value *before*
|
|
2277
|
+
* we mutated it, onto the stacks. Therefore, on the way up, we always know which
|
|
2278
|
+
* provider needs to be "restored" to which value.
|
|
2279
|
+
* https://github.com/facebook/react/pull/12985#issuecomment-396301248
|
|
2280
|
+
*/
|
|
2281
|
+
|
|
2262
2282
|
// TODO: type this more strictly:
|
|
2263
2283
|
|
|
2264
2284
|
|
|
2265
2285
|
ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
|
|
2266
|
-
this.
|
|
2267
|
-
|
|
2268
|
-
var
|
|
2269
|
-
|
|
2286
|
+
var index = ++this.contextIndex;
|
|
2287
|
+
var context = provider.type._context;
|
|
2288
|
+
var previousValue = context._currentValue;
|
|
2289
|
+
|
|
2290
|
+
// Remember which value to restore this context to on our way up.
|
|
2291
|
+
this.contextStack[index] = context;
|
|
2292
|
+
this.contextValueStack[index] = previousValue;
|
|
2293
|
+
{
|
|
2294
|
+
// Only used for push/pop mismatch warnings.
|
|
2295
|
+
this.contextProviderStack[index] = provider;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
// Mutate the current value.
|
|
2299
|
+
context._currentValue = provider.props.value;
|
|
2270
2300
|
};
|
|
2271
2301
|
|
|
2272
2302
|
ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
|
|
2303
|
+
var index = this.contextIndex;
|
|
2273
2304
|
{
|
|
2274
|
-
|
|
2305
|
+
!(index > -1 && provider === this.contextProviderStack[index]) ? warning(false, 'Unexpected pop.') : void 0;
|
|
2275
2306
|
}
|
|
2276
|
-
|
|
2277
|
-
this.
|
|
2278
|
-
var
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2307
|
+
|
|
2308
|
+
var context = this.contextStack[index];
|
|
2309
|
+
var previousValue = this.contextValueStack[index];
|
|
2310
|
+
|
|
2311
|
+
// "Hide" these null assignments from Flow by using `any`
|
|
2312
|
+
// because conceptually they are deletions--as long as we
|
|
2313
|
+
// promise to never access values beyond `this.contextIndex`.
|
|
2314
|
+
this.contextStack[index] = null;
|
|
2315
|
+
this.contextValueStack[index] = null;
|
|
2316
|
+
{
|
|
2317
|
+
this.contextProviderStack[index] = null;
|
|
2285
2318
|
}
|
|
2319
|
+
this.contextIndex--;
|
|
2320
|
+
|
|
2321
|
+
// Restore to the previous value we stored as we were walking down.
|
|
2322
|
+
context._currentValue = previousValue;
|
|
2286
2323
|
};
|
|
2287
2324
|
|
|
2288
2325
|
ReactDOMServerRenderer.prototype.read = function read(bytes) {
|
|
@@ -2383,6 +2420,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2383
2420
|
switch (elementType) {
|
|
2384
2421
|
case REACT_STRICT_MODE_TYPE:
|
|
2385
2422
|
case REACT_ASYNC_MODE_TYPE:
|
|
2423
|
+
case REACT_PROFILER_TYPE:
|
|
2386
2424
|
case REACT_FRAGMENT_TYPE:
|
|
2387
2425
|
{
|
|
2388
2426
|
var _nextChildren = toArray(nextChild.props.children);
|
|
@@ -2400,56 +2438,71 @@ var ReactDOMServerRenderer = function () {
|
|
|
2400
2438
|
this.stack.push(_frame);
|
|
2401
2439
|
return '';
|
|
2402
2440
|
}
|
|
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
2441
|
// eslint-disable-next-line-no-fallthrough
|
|
2407
2442
|
default:
|
|
2408
2443
|
break;
|
|
2409
2444
|
}
|
|
2410
2445
|
if (typeof elementType === 'object' && elementType !== null) {
|
|
2411
2446
|
switch (elementType.$$typeof) {
|
|
2447
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2448
|
+
{
|
|
2449
|
+
var element = nextChild;
|
|
2450
|
+
var _nextChildren2 = toArray(elementType.render(element.props, element.ref));
|
|
2451
|
+
var _frame2 = {
|
|
2452
|
+
type: null,
|
|
2453
|
+
domNamespace: parentNamespace,
|
|
2454
|
+
children: _nextChildren2,
|
|
2455
|
+
childIndex: 0,
|
|
2456
|
+
context: context,
|
|
2457
|
+
footer: ''
|
|
2458
|
+
};
|
|
2459
|
+
{
|
|
2460
|
+
_frame2.debugElementStack = [];
|
|
2461
|
+
}
|
|
2462
|
+
this.stack.push(_frame2);
|
|
2463
|
+
return '';
|
|
2464
|
+
}
|
|
2412
2465
|
case REACT_PROVIDER_TYPE:
|
|
2413
2466
|
{
|
|
2414
2467
|
var provider = nextChild;
|
|
2415
2468
|
var nextProps = provider.props;
|
|
2416
|
-
var
|
|
2417
|
-
var
|
|
2469
|
+
var _nextChildren3 = toArray(nextProps.children);
|
|
2470
|
+
var _frame3 = {
|
|
2418
2471
|
type: provider,
|
|
2419
2472
|
domNamespace: parentNamespace,
|
|
2420
|
-
children:
|
|
2473
|
+
children: _nextChildren3,
|
|
2421
2474
|
childIndex: 0,
|
|
2422
2475
|
context: context,
|
|
2423
2476
|
footer: ''
|
|
2424
2477
|
};
|
|
2425
2478
|
{
|
|
2426
|
-
|
|
2479
|
+
_frame3.debugElementStack = [];
|
|
2427
2480
|
}
|
|
2428
2481
|
|
|
2429
2482
|
this.pushProvider(provider);
|
|
2430
2483
|
|
|
2431
|
-
this.stack.push(
|
|
2484
|
+
this.stack.push(_frame3);
|
|
2432
2485
|
return '';
|
|
2433
2486
|
}
|
|
2434
2487
|
case REACT_CONTEXT_TYPE:
|
|
2435
2488
|
{
|
|
2436
2489
|
var consumer = nextChild;
|
|
2437
2490
|
var _nextProps = consumer.props;
|
|
2438
|
-
var nextValue = consumer.type.
|
|
2491
|
+
var nextValue = consumer.type._currentValue;
|
|
2439
2492
|
|
|
2440
|
-
var
|
|
2441
|
-
var
|
|
2493
|
+
var _nextChildren4 = toArray(_nextProps.children(nextValue));
|
|
2494
|
+
var _frame4 = {
|
|
2442
2495
|
type: nextChild,
|
|
2443
2496
|
domNamespace: parentNamespace,
|
|
2444
|
-
children:
|
|
2497
|
+
children: _nextChildren4,
|
|
2445
2498
|
childIndex: 0,
|
|
2446
2499
|
context: context,
|
|
2447
2500
|
footer: ''
|
|
2448
2501
|
};
|
|
2449
2502
|
{
|
|
2450
|
-
|
|
2503
|
+
_frame4.debugElementStack = [];
|
|
2451
2504
|
}
|
|
2452
|
-
this.stack.push(
|
|
2505
|
+
this.stack.push(_frame4);
|
|
2453
2506
|
return '';
|
|
2454
2507
|
}
|
|
2455
2508
|
default:
|
|
@@ -2484,7 +2537,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2484
2537
|
if (namespace === Namespaces.html) {
|
|
2485
2538
|
// Should this check be gated by parent namespace? Not sure we want to
|
|
2486
2539
|
// allow <SVG> or <mATH>.
|
|
2487
|
-
|
|
2540
|
+
!(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
2541
|
}
|
|
2489
2542
|
}
|
|
2490
2543
|
|
|
@@ -2560,9 +2613,11 @@ var ReactDOMServerRenderer = function () {
|
|
|
2560
2613
|
}
|
|
2561
2614
|
var isArray = Array.isArray(props[propName]);
|
|
2562
2615
|
if (props.multiple && !isArray) {
|
|
2563
|
-
warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '')
|
|
2616
|
+
warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '' // getDeclarationErrorAddendum(),
|
|
2617
|
+
);
|
|
2564
2618
|
} 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, '')
|
|
2619
|
+
warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '' // getDeclarationErrorAddendum(),
|
|
2620
|
+
);
|
|
2566
2621
|
}
|
|
2567
2622
|
}
|
|
2568
2623
|
|
|
@@ -2710,7 +2765,7 @@ var ReactDOMServer = ( ReactDOMServerBrowser$1 && ReactDOMServerBrowser ) || Rea
|
|
|
2710
2765
|
|
|
2711
2766
|
// TODO: decide on the top-level export form.
|
|
2712
2767
|
// This is hacky but makes it work with both Rollup and Jest
|
|
2713
|
-
var server_browser = ReactDOMServer
|
|
2768
|
+
var server_browser = ReactDOMServer.default ? ReactDOMServer.default : ReactDOMServer;
|
|
2714
2769
|
|
|
2715
2770
|
module.exports = server_browser;
|
|
2716
2771
|
})();
|