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.node.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -16,11 +16,11 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
18
|
var _assign = require('object-assign');
|
|
19
|
+
var invariant = require('fbjs/lib/invariant');
|
|
19
20
|
var React = require('react');
|
|
20
21
|
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
21
22
|
var emptyObject = require('fbjs/lib/emptyObject');
|
|
22
23
|
var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
|
|
23
|
-
var invariant = require('fbjs/lib/invariant');
|
|
24
24
|
var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
|
|
25
25
|
var warning = require('fbjs/lib/warning');
|
|
26
26
|
var checkPropTypes = require('prop-types/checkPropTypes');
|
|
@@ -29,14 +29,10 @@ var stream = require('stream');
|
|
|
29
29
|
|
|
30
30
|
// TODO: this is special because it gets imported during build.
|
|
31
31
|
|
|
32
|
-
var ReactVersion = '16.4.
|
|
32
|
+
var ReactVersion = '16.4.1';
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* This is a replacement for `invariant(...)` used by the error code system
|
|
37
|
-
* and will _only_ be required by the corresponding babel pass.
|
|
38
|
-
* It always throws.
|
|
39
|
-
*/
|
|
34
|
+
// Relying on the `invariant()` implementation lets us
|
|
35
|
+
// have preserve the format and params in the www builds.
|
|
40
36
|
|
|
41
37
|
/**
|
|
42
38
|
* Forked from fbjs/warning:
|
|
@@ -103,16 +99,11 @@ var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
|
|
|
103
99
|
// Exports ReactDOM.createRoot
|
|
104
100
|
|
|
105
101
|
|
|
106
|
-
|
|
107
|
-
// Mutating mode (React DOM, React ART, React Native):
|
|
108
|
-
|
|
109
|
-
// Experimental noop mode (currently unused):
|
|
110
|
-
|
|
111
|
-
// Experimental persistent mode (Fabric):
|
|
112
|
-
|
|
113
102
|
// Experimental error-boundary API that can recover from errors within a single
|
|
114
103
|
// render phase
|
|
115
104
|
|
|
105
|
+
// Suspense
|
|
106
|
+
|
|
116
107
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
117
108
|
|
|
118
109
|
|
|
@@ -129,21 +120,27 @@ var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
|
|
|
129
120
|
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
130
121
|
var warnAboutDeprecatedLifecycles = false;
|
|
131
122
|
|
|
123
|
+
// Warn about legacy context API
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
// Gather advanced timing metrics for Profiler subtrees.
|
|
127
|
+
|
|
128
|
+
|
|
132
129
|
// Only used in www builds.
|
|
133
130
|
|
|
134
131
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
135
132
|
// nor polyfill, then a plain number is used for performance.
|
|
136
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol
|
|
133
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
137
134
|
|
|
138
135
|
|
|
139
|
-
var
|
|
140
|
-
var
|
|
141
|
-
var
|
|
142
|
-
var
|
|
143
|
-
var
|
|
144
|
-
var
|
|
145
|
-
var
|
|
146
|
-
var
|
|
136
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
137
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
138
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
139
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
140
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
141
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
142
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
143
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
147
144
|
|
|
148
145
|
// A reserved attribute.
|
|
149
146
|
// It is handled by React separately and shouldn't be written to the DOM.
|
|
@@ -255,6 +252,9 @@ function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)
|
|
|
255
252
|
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
|
256
253
|
return true;
|
|
257
254
|
}
|
|
255
|
+
if (isCustomComponentTag) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
258
|
if (propertyInfo !== null) {
|
|
259
259
|
switch (propertyInfo.type) {
|
|
260
260
|
case BOOLEAN:
|
|
@@ -297,15 +297,20 @@ var properties = {};
|
|
|
297
297
|
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
|
|
298
298
|
name, // attributeName
|
|
299
299
|
null);
|
|
300
|
-
}
|
|
300
|
+
} // attributeNamespace
|
|
301
|
+
);
|
|
301
302
|
|
|
302
303
|
// A few React string attributes have a different name.
|
|
303
304
|
// This is a mapping from React prop names to the attribute names.
|
|
304
|
-
|
|
305
|
+
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
|
306
|
+
var name = _ref[0],
|
|
307
|
+
attributeName = _ref[1];
|
|
308
|
+
|
|
305
309
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
306
310
|
attributeName, // attributeName
|
|
307
311
|
null);
|
|
308
|
-
}
|
|
312
|
+
} // attributeNamespace
|
|
313
|
+
);
|
|
309
314
|
|
|
310
315
|
// These are "enumerated" HTML attributes that accept "true" and "false".
|
|
311
316
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -314,7 +319,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
314
319
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
315
320
|
name.toLowerCase(), // attributeName
|
|
316
321
|
null);
|
|
317
|
-
}
|
|
322
|
+
} // attributeNamespace
|
|
323
|
+
);
|
|
318
324
|
|
|
319
325
|
// These are "enumerated" SVG attributes that accept "true" and "false".
|
|
320
326
|
// In React, we let users pass `true` and `false` even though technically
|
|
@@ -324,7 +330,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
324
330
|
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
|
325
331
|
name, // attributeName
|
|
326
332
|
null);
|
|
327
|
-
}
|
|
333
|
+
} // attributeNamespace
|
|
334
|
+
);
|
|
328
335
|
|
|
329
336
|
// These are HTML boolean attributes.
|
|
330
337
|
['allowFullScreen', 'async',
|
|
@@ -336,7 +343,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
336
343
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
|
337
344
|
name.toLowerCase(), // attributeName
|
|
338
345
|
null);
|
|
339
|
-
}
|
|
346
|
+
} // attributeNamespace
|
|
347
|
+
);
|
|
340
348
|
|
|
341
349
|
// These are the few React props that we set as DOM properties
|
|
342
350
|
// rather than attributes. These are all booleans.
|
|
@@ -347,7 +355,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
347
355
|
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
|
348
356
|
name.toLowerCase(), // attributeName
|
|
349
357
|
null);
|
|
350
|
-
}
|
|
358
|
+
} // attributeNamespace
|
|
359
|
+
);
|
|
351
360
|
|
|
352
361
|
// These are HTML attributes that are "overloaded booleans": they behave like
|
|
353
362
|
// booleans, but can also accept a string value.
|
|
@@ -355,21 +364,24 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
|
|
|
355
364
|
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
|
|
356
365
|
name.toLowerCase(), // attributeName
|
|
357
366
|
null);
|
|
358
|
-
}
|
|
367
|
+
} // attributeNamespace
|
|
368
|
+
);
|
|
359
369
|
|
|
360
370
|
// These are HTML attributes that must be positive numbers.
|
|
361
371
|
['cols', 'rows', 'size', 'span'].forEach(function (name) {
|
|
362
372
|
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
|
|
363
373
|
name.toLowerCase(), // attributeName
|
|
364
374
|
null);
|
|
365
|
-
}
|
|
375
|
+
} // attributeNamespace
|
|
376
|
+
);
|
|
366
377
|
|
|
367
378
|
// These are HTML attributes that must be numbers.
|
|
368
379
|
['rowSpan', 'start'].forEach(function (name) {
|
|
369
380
|
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
|
|
370
381
|
name.toLowerCase(), // attributeName
|
|
371
382
|
null);
|
|
372
|
-
}
|
|
383
|
+
} // attributeNamespace
|
|
384
|
+
);
|
|
373
385
|
|
|
374
386
|
var CAMELIZE = /[\-\:]([a-z])/g;
|
|
375
387
|
var capitalize = function (token) {
|
|
@@ -385,7 +397,8 @@ var capitalize = function (token) {
|
|
|
385
397
|
var name = attributeName.replace(CAMELIZE, capitalize);
|
|
386
398
|
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
|
387
399
|
attributeName, null);
|
|
388
|
-
}
|
|
400
|
+
} // attributeNamespace
|
|
401
|
+
);
|
|
389
402
|
|
|
390
403
|
// String SVG attributes with the xlink namespace.
|
|
391
404
|
['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
|
@@ -653,6 +666,7 @@ var omittedCloseTags = {
|
|
|
653
666
|
source: true,
|
|
654
667
|
track: true,
|
|
655
668
|
wbr: true
|
|
669
|
+
// NOTE: menuitem's close tag should be omitted, but that causes problems.
|
|
656
670
|
};
|
|
657
671
|
|
|
658
672
|
// For HTML, certain tags cannot have children. This has the same purpose as
|
|
@@ -677,7 +691,7 @@ function assertValidProps(tag, props, getStack) {
|
|
|
677
691
|
!(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;
|
|
678
692
|
}
|
|
679
693
|
{
|
|
680
|
-
|
|
694
|
+
!(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;
|
|
681
695
|
}
|
|
682
696
|
!(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;
|
|
683
697
|
}
|
|
@@ -1136,7 +1150,7 @@ var possibleStandardNames = {
|
|
|
1136
1150
|
checked: 'checked',
|
|
1137
1151
|
children: 'children',
|
|
1138
1152
|
cite: 'cite',
|
|
1139
|
-
|
|
1153
|
+
class: 'className',
|
|
1140
1154
|
classid: 'classID',
|
|
1141
1155
|
classname: 'className',
|
|
1142
1156
|
cols: 'cols',
|
|
@@ -1151,7 +1165,7 @@ var possibleStandardNames = {
|
|
|
1151
1165
|
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
|
1152
1166
|
data: 'data',
|
|
1153
1167
|
datetime: 'dateTime',
|
|
1154
|
-
|
|
1168
|
+
default: 'default',
|
|
1155
1169
|
defaultchecked: 'defaultChecked',
|
|
1156
1170
|
defaultvalue: 'defaultValue',
|
|
1157
1171
|
defer: 'defer',
|
|
@@ -1160,7 +1174,7 @@ var possibleStandardNames = {
|
|
|
1160
1174
|
download: 'download',
|
|
1161
1175
|
draggable: 'draggable',
|
|
1162
1176
|
enctype: 'encType',
|
|
1163
|
-
|
|
1177
|
+
for: 'htmlFor',
|
|
1164
1178
|
form: 'form',
|
|
1165
1179
|
formmethod: 'formMethod',
|
|
1166
1180
|
formaction: 'formAction',
|
|
@@ -1378,7 +1392,7 @@ var possibleStandardNames = {
|
|
|
1378
1392
|
imagerendering: 'imageRendering',
|
|
1379
1393
|
'image-rendering': 'imageRendering',
|
|
1380
1394
|
in2: 'in2',
|
|
1381
|
-
|
|
1395
|
+
in: 'in',
|
|
1382
1396
|
inlist: 'inlist',
|
|
1383
1397
|
intercept: 'intercept',
|
|
1384
1398
|
k1: 'k1',
|
|
@@ -1518,7 +1532,7 @@ var possibleStandardNames = {
|
|
|
1518
1532
|
'text-rendering': 'textRendering',
|
|
1519
1533
|
to: 'to',
|
|
1520
1534
|
transform: 'transform',
|
|
1521
|
-
|
|
1535
|
+
typeof: 'typeof',
|
|
1522
1536
|
u1: 'u1',
|
|
1523
1537
|
u2: 'u2',
|
|
1524
1538
|
underlineposition: 'underlinePosition',
|
|
@@ -2034,42 +2048,26 @@ function validateRenderResult(child, type) {
|
|
|
2034
2048
|
}
|
|
2035
2049
|
|
|
2036
2050
|
function resolve(child, context) {
|
|
2037
|
-
var element = void 0;
|
|
2038
|
-
|
|
2039
|
-
var Component = void 0;
|
|
2040
|
-
var publicContext = void 0;
|
|
2041
|
-
var inst = void 0,
|
|
2042
|
-
queue = void 0,
|
|
2043
|
-
replace = void 0;
|
|
2044
|
-
var updater = void 0;
|
|
2045
|
-
|
|
2046
|
-
var initialState = void 0;
|
|
2047
|
-
var oldQueue = void 0,
|
|
2048
|
-
oldReplace = void 0;
|
|
2049
|
-
var nextState = void 0,
|
|
2050
|
-
dontMutate = void 0;
|
|
2051
|
-
var partial = void 0,
|
|
2052
|
-
partialState = void 0;
|
|
2053
|
-
|
|
2054
|
-
var childContext = void 0;
|
|
2055
|
-
var childContextTypes = void 0,
|
|
2056
|
-
contextKey = void 0;
|
|
2057
|
-
|
|
2058
2051
|
while (React.isValidElement(child)) {
|
|
2059
2052
|
// Safe because we just checked it's an element.
|
|
2060
|
-
element = child;
|
|
2053
|
+
var element = child;
|
|
2054
|
+
var Component = element.type;
|
|
2061
2055
|
{
|
|
2062
2056
|
pushElementToDebugStack(element);
|
|
2063
2057
|
}
|
|
2064
|
-
Component = element.type;
|
|
2065
2058
|
if (typeof Component !== 'function') {
|
|
2066
2059
|
break;
|
|
2067
2060
|
}
|
|
2068
|
-
|
|
2061
|
+
processChild(element, Component);
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
// Extra closure so queue and replace can be captured properly
|
|
2065
|
+
function processChild(element, Component) {
|
|
2066
|
+
var publicContext = processContext(Component, context);
|
|
2069
2067
|
|
|
2070
|
-
queue = [];
|
|
2071
|
-
replace = false;
|
|
2072
|
-
updater = {
|
|
2068
|
+
var queue = [];
|
|
2069
|
+
var replace = false;
|
|
2070
|
+
var updater = {
|
|
2073
2071
|
isMounted: function (publicInstance) {
|
|
2074
2072
|
return false;
|
|
2075
2073
|
},
|
|
@@ -2092,6 +2090,7 @@ function resolve(child, context) {
|
|
|
2092
2090
|
}
|
|
2093
2091
|
};
|
|
2094
2092
|
|
|
2093
|
+
var inst = void 0;
|
|
2095
2094
|
if (shouldConstruct(Component)) {
|
|
2096
2095
|
inst = new Component(element.props, publicContext, updater);
|
|
2097
2096
|
|
|
@@ -2106,7 +2105,7 @@ function resolve(child, context) {
|
|
|
2106
2105
|
}
|
|
2107
2106
|
}
|
|
2108
2107
|
|
|
2109
|
-
partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
|
2108
|
+
var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
|
2110
2109
|
|
|
2111
2110
|
{
|
|
2112
2111
|
if (partialState === undefined) {
|
|
@@ -2137,7 +2136,7 @@ function resolve(child, context) {
|
|
|
2137
2136
|
if (inst == null || inst.render == null) {
|
|
2138
2137
|
child = inst;
|
|
2139
2138
|
validateRenderResult(child, Component);
|
|
2140
|
-
|
|
2139
|
+
return;
|
|
2141
2140
|
}
|
|
2142
2141
|
}
|
|
2143
2142
|
|
|
@@ -2145,7 +2144,7 @@ function resolve(child, context) {
|
|
|
2145
2144
|
inst.context = publicContext;
|
|
2146
2145
|
inst.updater = updater;
|
|
2147
2146
|
|
|
2148
|
-
initialState = inst.state;
|
|
2147
|
+
var initialState = inst.state;
|
|
2149
2148
|
if (initialState === undefined) {
|
|
2150
2149
|
inst.state = initialState = null;
|
|
2151
2150
|
}
|
|
@@ -2174,25 +2173,25 @@ function resolve(child, context) {
|
|
|
2174
2173
|
inst.UNSAFE_componentWillMount();
|
|
2175
2174
|
}
|
|
2176
2175
|
if (queue.length) {
|
|
2177
|
-
oldQueue = queue;
|
|
2178
|
-
oldReplace = replace;
|
|
2176
|
+
var oldQueue = queue;
|
|
2177
|
+
var oldReplace = replace;
|
|
2179
2178
|
queue = null;
|
|
2180
2179
|
replace = false;
|
|
2181
2180
|
|
|
2182
2181
|
if (oldReplace && oldQueue.length === 1) {
|
|
2183
2182
|
inst.state = oldQueue[0];
|
|
2184
2183
|
} else {
|
|
2185
|
-
nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
2186
|
-
dontMutate = true;
|
|
2184
|
+
var nextState = oldReplace ? oldQueue[0] : inst.state;
|
|
2185
|
+
var dontMutate = true;
|
|
2187
2186
|
for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
|
|
2188
|
-
partial = oldQueue[i];
|
|
2189
|
-
|
|
2190
|
-
if (
|
|
2187
|
+
var partial = oldQueue[i];
|
|
2188
|
+
var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
|
|
2189
|
+
if (_partialState != null) {
|
|
2191
2190
|
if (dontMutate) {
|
|
2192
2191
|
dontMutate = false;
|
|
2193
|
-
nextState = _assign({}, nextState,
|
|
2192
|
+
nextState = _assign({}, nextState, _partialState);
|
|
2194
2193
|
} else {
|
|
2195
|
-
_assign(nextState,
|
|
2194
|
+
_assign(nextState, _partialState);
|
|
2196
2195
|
}
|
|
2197
2196
|
}
|
|
2198
2197
|
}
|
|
@@ -2213,11 +2212,12 @@ function resolve(child, context) {
|
|
|
2213
2212
|
}
|
|
2214
2213
|
validateRenderResult(child, Component);
|
|
2215
2214
|
|
|
2215
|
+
var childContext = void 0;
|
|
2216
2216
|
if (typeof inst.getChildContext === 'function') {
|
|
2217
|
-
childContextTypes = Component.childContextTypes;
|
|
2217
|
+
var childContextTypes = Component.childContextTypes;
|
|
2218
2218
|
if (typeof childContextTypes === 'object') {
|
|
2219
2219
|
childContext = inst.getChildContext();
|
|
2220
|
-
for (contextKey in childContext) {
|
|
2220
|
+
for (var contextKey in childContext) {
|
|
2221
2221
|
!(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
|
|
2222
2222
|
}
|
|
2223
2223
|
} else {
|
|
@@ -2232,6 +2232,8 @@ function resolve(child, context) {
|
|
|
2232
2232
|
}
|
|
2233
2233
|
|
|
2234
2234
|
var ReactDOMServerRenderer = function () {
|
|
2235
|
+
// DEV-only
|
|
2236
|
+
|
|
2235
2237
|
function ReactDOMServerRenderer(children, makeStaticMarkup) {
|
|
2236
2238
|
_classCallCheck(this, ReactDOMServerRenderer);
|
|
2237
2239
|
|
|
@@ -2257,33 +2259,65 @@ var ReactDOMServerRenderer = function () {
|
|
|
2257
2259
|
this.makeStaticMarkup = makeStaticMarkup;
|
|
2258
2260
|
|
|
2259
2261
|
// Context (new API)
|
|
2260
|
-
this.
|
|
2261
|
-
this.
|
|
2262
|
+
this.contextIndex = -1;
|
|
2263
|
+
this.contextStack = [];
|
|
2264
|
+
this.contextValueStack = [];
|
|
2265
|
+
{
|
|
2266
|
+
this.contextProviderStack = [];
|
|
2267
|
+
}
|
|
2262
2268
|
}
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* Note: We use just two stacks regardless of how many context providers you have.
|
|
2272
|
+
* Providers are always popped in the reverse order to how they were pushed
|
|
2273
|
+
* so we always know on the way down which provider you'll encounter next on the way up.
|
|
2274
|
+
* On the way down, we push the current provider, and its context value *before*
|
|
2275
|
+
* we mutated it, onto the stacks. Therefore, on the way up, we always know which
|
|
2276
|
+
* provider needs to be "restored" to which value.
|
|
2277
|
+
* https://github.com/facebook/react/pull/12985#issuecomment-396301248
|
|
2278
|
+
*/
|
|
2279
|
+
|
|
2263
2280
|
// TODO: type this more strictly:
|
|
2264
2281
|
|
|
2265
2282
|
|
|
2266
2283
|
ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
|
|
2267
|
-
this.
|
|
2268
|
-
|
|
2269
|
-
var
|
|
2270
|
-
|
|
2284
|
+
var index = ++this.contextIndex;
|
|
2285
|
+
var context = provider.type._context;
|
|
2286
|
+
var previousValue = context._currentValue;
|
|
2287
|
+
|
|
2288
|
+
// Remember which value to restore this context to on our way up.
|
|
2289
|
+
this.contextStack[index] = context;
|
|
2290
|
+
this.contextValueStack[index] = previousValue;
|
|
2291
|
+
{
|
|
2292
|
+
// Only used for push/pop mismatch warnings.
|
|
2293
|
+
this.contextProviderStack[index] = provider;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
// Mutate the current value.
|
|
2297
|
+
context._currentValue = provider.props.value;
|
|
2271
2298
|
};
|
|
2272
2299
|
|
|
2273
2300
|
ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
|
|
2301
|
+
var index = this.contextIndex;
|
|
2274
2302
|
{
|
|
2275
|
-
|
|
2303
|
+
!(index > -1 && provider === this.contextProviderStack[index]) ? warning(false, 'Unexpected pop.') : void 0;
|
|
2276
2304
|
}
|
|
2277
|
-
|
|
2278
|
-
this.
|
|
2279
|
-
var
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2305
|
+
|
|
2306
|
+
var context = this.contextStack[index];
|
|
2307
|
+
var previousValue = this.contextValueStack[index];
|
|
2308
|
+
|
|
2309
|
+
// "Hide" these null assignments from Flow by using `any`
|
|
2310
|
+
// because conceptually they are deletions--as long as we
|
|
2311
|
+
// promise to never access values beyond `this.contextIndex`.
|
|
2312
|
+
this.contextStack[index] = null;
|
|
2313
|
+
this.contextValueStack[index] = null;
|
|
2314
|
+
{
|
|
2315
|
+
this.contextProviderStack[index] = null;
|
|
2286
2316
|
}
|
|
2317
|
+
this.contextIndex--;
|
|
2318
|
+
|
|
2319
|
+
// Restore to the previous value we stored as we were walking down.
|
|
2320
|
+
context._currentValue = previousValue;
|
|
2287
2321
|
};
|
|
2288
2322
|
|
|
2289
2323
|
ReactDOMServerRenderer.prototype.read = function read(bytes) {
|
|
@@ -2384,6 +2418,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2384
2418
|
switch (elementType) {
|
|
2385
2419
|
case REACT_STRICT_MODE_TYPE:
|
|
2386
2420
|
case REACT_ASYNC_MODE_TYPE:
|
|
2421
|
+
case REACT_PROFILER_TYPE:
|
|
2387
2422
|
case REACT_FRAGMENT_TYPE:
|
|
2388
2423
|
{
|
|
2389
2424
|
var _nextChildren = toArray(nextChild.props.children);
|
|
@@ -2401,56 +2436,71 @@ var ReactDOMServerRenderer = function () {
|
|
|
2401
2436
|
this.stack.push(_frame);
|
|
2402
2437
|
return '';
|
|
2403
2438
|
}
|
|
2404
|
-
case REACT_CALL_TYPE:
|
|
2405
|
-
case REACT_RETURN_TYPE:
|
|
2406
|
-
invariant(false, 'The experimental Call and Return types are not currently supported by the server renderer.');
|
|
2407
2439
|
// eslint-disable-next-line-no-fallthrough
|
|
2408
2440
|
default:
|
|
2409
2441
|
break;
|
|
2410
2442
|
}
|
|
2411
2443
|
if (typeof elementType === 'object' && elementType !== null) {
|
|
2412
2444
|
switch (elementType.$$typeof) {
|
|
2445
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2446
|
+
{
|
|
2447
|
+
var element = nextChild;
|
|
2448
|
+
var _nextChildren2 = toArray(elementType.render(element.props, element.ref));
|
|
2449
|
+
var _frame2 = {
|
|
2450
|
+
type: null,
|
|
2451
|
+
domNamespace: parentNamespace,
|
|
2452
|
+
children: _nextChildren2,
|
|
2453
|
+
childIndex: 0,
|
|
2454
|
+
context: context,
|
|
2455
|
+
footer: ''
|
|
2456
|
+
};
|
|
2457
|
+
{
|
|
2458
|
+
_frame2.debugElementStack = [];
|
|
2459
|
+
}
|
|
2460
|
+
this.stack.push(_frame2);
|
|
2461
|
+
return '';
|
|
2462
|
+
}
|
|
2413
2463
|
case REACT_PROVIDER_TYPE:
|
|
2414
2464
|
{
|
|
2415
2465
|
var provider = nextChild;
|
|
2416
2466
|
var nextProps = provider.props;
|
|
2417
|
-
var
|
|
2418
|
-
var
|
|
2467
|
+
var _nextChildren3 = toArray(nextProps.children);
|
|
2468
|
+
var _frame3 = {
|
|
2419
2469
|
type: provider,
|
|
2420
2470
|
domNamespace: parentNamespace,
|
|
2421
|
-
children:
|
|
2471
|
+
children: _nextChildren3,
|
|
2422
2472
|
childIndex: 0,
|
|
2423
2473
|
context: context,
|
|
2424
2474
|
footer: ''
|
|
2425
2475
|
};
|
|
2426
2476
|
{
|
|
2427
|
-
|
|
2477
|
+
_frame3.debugElementStack = [];
|
|
2428
2478
|
}
|
|
2429
2479
|
|
|
2430
2480
|
this.pushProvider(provider);
|
|
2431
2481
|
|
|
2432
|
-
this.stack.push(
|
|
2482
|
+
this.stack.push(_frame3);
|
|
2433
2483
|
return '';
|
|
2434
2484
|
}
|
|
2435
2485
|
case REACT_CONTEXT_TYPE:
|
|
2436
2486
|
{
|
|
2437
2487
|
var consumer = nextChild;
|
|
2438
2488
|
var _nextProps = consumer.props;
|
|
2439
|
-
var nextValue = consumer.type.
|
|
2489
|
+
var nextValue = consumer.type._currentValue;
|
|
2440
2490
|
|
|
2441
|
-
var
|
|
2442
|
-
var
|
|
2491
|
+
var _nextChildren4 = toArray(_nextProps.children(nextValue));
|
|
2492
|
+
var _frame4 = {
|
|
2443
2493
|
type: nextChild,
|
|
2444
2494
|
domNamespace: parentNamespace,
|
|
2445
|
-
children:
|
|
2495
|
+
children: _nextChildren4,
|
|
2446
2496
|
childIndex: 0,
|
|
2447
2497
|
context: context,
|
|
2448
2498
|
footer: ''
|
|
2449
2499
|
};
|
|
2450
2500
|
{
|
|
2451
|
-
|
|
2501
|
+
_frame4.debugElementStack = [];
|
|
2452
2502
|
}
|
|
2453
|
-
this.stack.push(
|
|
2503
|
+
this.stack.push(_frame4);
|
|
2454
2504
|
return '';
|
|
2455
2505
|
}
|
|
2456
2506
|
default:
|
|
@@ -2485,7 +2535,7 @@ var ReactDOMServerRenderer = function () {
|
|
|
2485
2535
|
if (namespace === Namespaces.html) {
|
|
2486
2536
|
// Should this check be gated by parent namespace? Not sure we want to
|
|
2487
2537
|
// allow <SVG> or <mATH>.
|
|
2488
|
-
|
|
2538
|
+
!(tag === element.type) ? warning(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type) : void 0;
|
|
2489
2539
|
}
|
|
2490
2540
|
}
|
|
2491
2541
|
|
|
@@ -2561,9 +2611,11 @@ var ReactDOMServerRenderer = function () {
|
|
|
2561
2611
|
}
|
|
2562
2612
|
var isArray = Array.isArray(props[propName]);
|
|
2563
2613
|
if (props.multiple && !isArray) {
|
|
2564
|
-
warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '')
|
|
2614
|
+
warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '' // getDeclarationErrorAddendum(),
|
|
2615
|
+
);
|
|
2565
2616
|
} else if (!props.multiple && isArray) {
|
|
2566
|
-
warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '')
|
|
2617
|
+
warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '' // getDeclarationErrorAddendum(),
|
|
2618
|
+
);
|
|
2567
2619
|
}
|
|
2568
2620
|
}
|
|
2569
2621
|
|
|
@@ -2756,7 +2808,7 @@ var ReactDOMServer = ( ReactDOMServerNode$1 && ReactDOMServerNode ) || ReactDOMS
|
|
|
2756
2808
|
|
|
2757
2809
|
// TODO: decide on the top-level export form.
|
|
2758
2810
|
// This is hacky but makes it work with both Rollup and Jest
|
|
2759
|
-
var server_node = ReactDOMServer
|
|
2811
|
+
var server_node = ReactDOMServer.default ? ReactDOMServer.default : ReactDOMServer;
|
|
2760
2812
|
|
|
2761
2813
|
module.exports = server_node;
|
|
2762
2814
|
})();
|