react-dom 16.4.0-alpha.7926752 → 16.5.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.
@@ -1,4 +1,4 @@
1
- /** @license React v16.4.0-alpha.7926752
1
+ /** @license React v16.5.0
2
2
  * react-dom-server.node.development.js
3
3
  *
4
4
  * Copyright (c) 2013-present, Facebook, Inc.
@@ -17,27 +17,178 @@ if (process.env.NODE_ENV !== "production") {
17
17
 
18
18
  var _assign = require('object-assign');
19
19
  var React = require('react');
20
- var emptyFunction = require('fbjs/lib/emptyFunction');
21
- var emptyObject = require('fbjs/lib/emptyObject');
22
- var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
23
- var invariant = require('fbjs/lib/invariant');
24
- var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
25
- var warning = require('fbjs/lib/warning');
26
20
  var checkPropTypes = require('prop-types/checkPropTypes');
27
- var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
28
21
  var stream = require('stream');
29
22
 
30
23
  // TODO: this is special because it gets imported during build.
31
24
 
32
- var ReactVersion = '16.4.0-alpha.7926752';
25
+ var ReactVersion = '16.5.0';
33
26
 
34
27
  /**
35
- * WARNING: DO NOT manually require this module.
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.
28
+ * Use invariant() to assert state which your program assumes to be true.
29
+ *
30
+ * Provide sprintf-style format (only %s is supported) and arguments
31
+ * to provide information about what broke and what you were
32
+ * expecting.
33
+ *
34
+ * The invariant message will be stripped in production, but the invariant
35
+ * will remain to ensure logic does not differ in production.
39
36
  */
40
37
 
38
+ var validateFormat = function () {};
39
+
40
+ {
41
+ validateFormat = function (format) {
42
+ if (format === undefined) {
43
+ throw new Error('invariant requires an error message argument');
44
+ }
45
+ };
46
+ }
47
+
48
+ function invariant(condition, format, a, b, c, d, e, f) {
49
+ validateFormat(format);
50
+
51
+ if (!condition) {
52
+ var error = void 0;
53
+ if (format === undefined) {
54
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
55
+ } else {
56
+ var args = [a, b, c, d, e, f];
57
+ var argIndex = 0;
58
+ error = new Error(format.replace(/%s/g, function () {
59
+ return args[argIndex++];
60
+ }));
61
+ error.name = 'Invariant Violation';
62
+ }
63
+
64
+ error.framesToPop = 1; // we don't care about invariant's own frame
65
+ throw error;
66
+ }
67
+ }
68
+
69
+ // Relying on the `invariant()` implementation lets us
70
+ // preserve the format and params in the www builds.
71
+
72
+ /**
73
+ * Similar to invariant but only logs a warning if the condition is not met.
74
+ * This can be used to log issues in development environments in critical
75
+ * paths. Removing the logging code for production environments will keep the
76
+ * same logic and follow the same code paths.
77
+ */
78
+
79
+ var warningWithoutStack = function () {};
80
+
81
+ {
82
+ warningWithoutStack = function (condition, format) {
83
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
84
+ args[_key - 2] = arguments[_key];
85
+ }
86
+
87
+ if (format === undefined) {
88
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
89
+ }
90
+ if (condition) {
91
+ return;
92
+ }
93
+ if (typeof console !== 'undefined') {
94
+ var _console;
95
+
96
+ var stringArgs = args.map(function (item) {
97
+ return '' + item;
98
+ });
99
+ (_console = console).error.apply(_console, ['Warning: ' + format].concat(stringArgs));
100
+ }
101
+ try {
102
+ // --- Welcome to debugging React ---
103
+ // This error was thrown as a convenience so that you can use this stack
104
+ // to find the callsite that caused this warning to fire.
105
+ var argIndex = 0;
106
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
107
+ return args[argIndex++];
108
+ });
109
+ throw new Error(message);
110
+ } catch (x) {}
111
+ };
112
+ }
113
+
114
+ var warningWithoutStack$1 = warningWithoutStack;
115
+
116
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
117
+ // nor polyfill, then a plain number is used for performance.
118
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
119
+
120
+
121
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
122
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
123
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
124
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
125
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
126
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
127
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
128
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
129
+ var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
130
+
131
+ var Resolved = 1;
132
+
133
+
134
+
135
+
136
+ function refineResolvedThenable(thenable) {
137
+ return thenable._reactStatus === Resolved ? thenable._reactResult : null;
138
+ }
139
+
140
+ function getComponentName(type) {
141
+ if (type == null) {
142
+ // Host root, text node or just invalid type.
143
+ return null;
144
+ }
145
+ {
146
+ if (typeof type.tag === 'number') {
147
+ warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
148
+ }
149
+ }
150
+ if (typeof type === 'function') {
151
+ return type.displayName || type.name || null;
152
+ }
153
+ if (typeof type === 'string') {
154
+ return type;
155
+ }
156
+ switch (type) {
157
+ case REACT_ASYNC_MODE_TYPE:
158
+ return 'AsyncMode';
159
+ case REACT_FRAGMENT_TYPE:
160
+ return 'Fragment';
161
+ case REACT_PORTAL_TYPE:
162
+ return 'Portal';
163
+ case REACT_PROFILER_TYPE:
164
+ return 'Profiler';
165
+ case REACT_STRICT_MODE_TYPE:
166
+ return 'StrictMode';
167
+ case REACT_PLACEHOLDER_TYPE:
168
+ return 'Placeholder';
169
+ }
170
+ if (typeof type === 'object') {
171
+ switch (type.$$typeof) {
172
+ case REACT_CONTEXT_TYPE:
173
+ return 'Context.Consumer';
174
+ case REACT_PROVIDER_TYPE:
175
+ return 'Context.Provider';
176
+ case REACT_FORWARD_REF_TYPE:
177
+ var renderFn = type.render;
178
+ var functionName = renderFn.displayName || renderFn.name || '';
179
+ return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
180
+ }
181
+ if (typeof type.then === 'function') {
182
+ var thenable = type;
183
+ var resolvedThenable = refineResolvedThenable(thenable);
184
+ if (resolvedThenable) {
185
+ return getComponentName(resolvedThenable);
186
+ }
187
+ }
188
+ }
189
+ return null;
190
+ }
191
+
41
192
  /**
42
193
  * Forked from fbjs/warning:
43
194
  * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
@@ -77,7 +228,7 @@ var lowPriorityWarning = function () {};
77
228
 
78
229
  lowPriorityWarning = function (condition, format) {
79
230
  if (format === undefined) {
80
- throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
231
+ throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
81
232
  }
82
233
  if (!condition) {
83
234
  for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
@@ -91,28 +242,72 @@ var lowPriorityWarning = function () {};
91
242
 
92
243
  var lowPriorityWarning$1 = lowPriorityWarning;
93
244
 
94
- var describeComponentFrame = function (name, source, ownerName) {
95
- return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
96
- };
245
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
97
246
 
98
- var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
247
+ /**
248
+ * Similar to invariant but only logs a warning if the condition is not met.
249
+ * This can be used to log issues in development environments in critical
250
+ * paths. Removing the logging code for production environments will keep the
251
+ * same logic and follow the same code paths.
252
+ */
99
253
 
100
- var ReactCurrentOwner = ReactInternals.ReactCurrentOwner;
101
- var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
254
+ var warning = warningWithoutStack$1;
102
255
 
103
- // Exports ReactDOM.createRoot
256
+ {
257
+ warning = function (condition, format) {
258
+ if (condition) {
259
+ return;
260
+ }
261
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
262
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
263
+ // eslint-disable-next-line react-internal/warning-and-invariant-args
104
264
 
265
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
266
+ args[_key - 2] = arguments[_key];
267
+ }
105
268
 
269
+ warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
270
+ };
271
+ }
106
272
 
107
- // Mutating mode (React DOM, React ART, React Native):
273
+ var warning$1 = warning;
108
274
 
109
- // Experimental noop mode (currently unused):
275
+ var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
276
+
277
+ var describeComponentFrame = function (name, source, ownerName) {
278
+ var sourceInfo = '';
279
+ if (source) {
280
+ var path = source.fileName;
281
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
282
+ {
283
+ // In DEV, include code for a common special case:
284
+ // prefer "folder/index.js" instead of just "index.js".
285
+ if (/^index\./.test(fileName)) {
286
+ var match = path.match(BEFORE_SLASH_RE);
287
+ if (match) {
288
+ var pathBeforeSlash = match[1];
289
+ if (pathBeforeSlash) {
290
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
291
+ fileName = folderName + '/' + fileName;
292
+ }
293
+ }
294
+ }
295
+ }
296
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
297
+ } else if (ownerName) {
298
+ sourceInfo = ' (created by ' + ownerName + ')';
299
+ }
300
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
301
+ };
302
+
303
+ // Exports ReactDOM.createRoot
110
304
 
111
- // Experimental persistent mode (Fabric):
112
305
 
113
306
  // Experimental error-boundary API that can recover from errors within a single
114
307
  // render phase
115
308
 
309
+ // Suspense
310
+
116
311
  // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
117
312
 
118
313
 
@@ -129,21 +324,19 @@ var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
129
324
  // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
130
325
  var warnAboutDeprecatedLifecycles = false;
131
326
 
132
- // Only used in www builds.
327
+ // Warn about legacy context API
328
+
329
+
330
+ // Gather advanced timing metrics for Profiler subtrees.
331
+
332
+
333
+ // Track which interactions trigger each commit.
133
334
 
134
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
135
- // nor polyfill, then a plain number is used for performance.
136
- var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
137
335
 
336
+ // Only used in www builds.
337
+ var enableSuspenseServerRenderer = false;
138
338
 
139
- var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8;
140
- var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
141
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
142
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
143
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc;
144
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd;
145
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace;
146
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf;
339
+ // Only used in www builds.
147
340
 
148
341
  // A reserved attribute.
149
342
  // It is handled by React separately and shouldn't be written to the DOM.
@@ -187,14 +380,15 @@ var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u
187
380
  var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
188
381
  var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
189
382
 
383
+ var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
190
384
  var illegalAttributeNameCache = {};
191
385
  var validatedAttributeNameCache = {};
192
386
 
193
387
  function isAttributeNameSafe(attributeName) {
194
- if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
388
+ if (hasOwnProperty$1.call(validatedAttributeNameCache, attributeName)) {
195
389
  return true;
196
390
  }
197
- if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
391
+ if (hasOwnProperty$1.call(illegalAttributeNameCache, attributeName)) {
198
392
  return false;
199
393
  }
200
394
  if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
@@ -203,7 +397,7 @@ function isAttributeNameSafe(attributeName) {
203
397
  }
204
398
  illegalAttributeNameCache[attributeName] = true;
205
399
  {
206
- warning(false, 'Invalid attribute name: `%s`', attributeName);
400
+ warning$1(false, 'Invalid attribute name: `%s`', attributeName);
207
401
  }
208
402
  return false;
209
403
  }
@@ -255,6 +449,9 @@ function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)
255
449
  if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
256
450
  return true;
257
451
  }
452
+ if (isCustomComponentTag) {
453
+ return false;
454
+ }
258
455
  if (propertyInfo !== null) {
259
456
  switch (propertyInfo.type) {
260
457
  case BOOLEAN:
@@ -297,15 +494,20 @@ var properties = {};
297
494
  properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
298
495
  name, // attributeName
299
496
  null);
300
- });
497
+ } // attributeNamespace
498
+ );
301
499
 
302
500
  // A few React string attributes have a different name.
303
501
  // This is a mapping from React prop names to the attribute names.
304
- new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']]).forEach(function (attributeName, name) {
502
+ [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
503
+ var name = _ref[0],
504
+ attributeName = _ref[1];
505
+
305
506
  properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
306
507
  attributeName, // attributeName
307
508
  null);
308
- });
509
+ } // attributeNamespace
510
+ );
309
511
 
310
512
  // These are "enumerated" HTML attributes that accept "true" and "false".
311
513
  // In React, we let users pass `true` and `false` even though technically
@@ -314,17 +516,19 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
314
516
  properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
315
517
  name.toLowerCase(), // attributeName
316
518
  null);
317
- });
519
+ } // attributeNamespace
520
+ );
318
521
 
319
522
  // These are "enumerated" SVG attributes that accept "true" and "false".
320
523
  // In React, we let users pass `true` and `false` even though technically
321
524
  // these aren't boolean attributes (they are coerced to strings).
322
525
  // Since these are SVG attributes, their attribute names are case-sensitive.
323
- ['autoReverse', 'externalResourcesRequired', 'preserveAlpha'].forEach(function (name) {
526
+ ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
324
527
  properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
325
528
  name, // attributeName
326
529
  null);
327
- });
530
+ } // attributeNamespace
531
+ );
328
532
 
329
533
  // These are HTML boolean attributes.
330
534
  ['allowFullScreen', 'async',
@@ -336,7 +540,8 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
336
540
  properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
337
541
  name.toLowerCase(), // attributeName
338
542
  null);
339
- });
543
+ } // attributeNamespace
544
+ );
340
545
 
341
546
  // These are the few React props that we set as DOM properties
342
547
  // rather than attributes. These are all booleans.
@@ -345,31 +550,35 @@ new Map([['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor'
345
550
  // disabled with `removeAttribute`. We have special logic for handling this.
346
551
  'multiple', 'muted', 'selected'].forEach(function (name) {
347
552
  properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
348
- name.toLowerCase(), // attributeName
553
+ name, // attributeName
349
554
  null);
350
- });
555
+ } // attributeNamespace
556
+ );
351
557
 
352
558
  // These are HTML attributes that are "overloaded booleans": they behave like
353
559
  // booleans, but can also accept a string value.
354
560
  ['capture', 'download'].forEach(function (name) {
355
561
  properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
356
- name.toLowerCase(), // attributeName
562
+ name, // attributeName
357
563
  null);
358
- });
564
+ } // attributeNamespace
565
+ );
359
566
 
360
567
  // These are HTML attributes that must be positive numbers.
361
568
  ['cols', 'rows', 'size', 'span'].forEach(function (name) {
362
569
  properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
363
- name.toLowerCase(), // attributeName
570
+ name, // attributeName
364
571
  null);
365
- });
572
+ } // attributeNamespace
573
+ );
366
574
 
367
575
  // These are HTML attributes that must be numbers.
368
576
  ['rowSpan', 'start'].forEach(function (name) {
369
577
  properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
370
578
  name.toLowerCase(), // attributeName
371
579
  null);
372
- });
580
+ } // attributeNamespace
581
+ );
373
582
 
374
583
  var CAMELIZE = /[\-\:]([a-z])/g;
375
584
  var capitalize = function (token) {
@@ -385,7 +594,8 @@ var capitalize = function (token) {
385
594
  var name = attributeName.replace(CAMELIZE, capitalize);
386
595
  properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
387
596
  attributeName, null);
388
- });
597
+ } // attributeNamespace
598
+ );
389
599
 
390
600
  // String SVG attributes with the xlink namespace.
391
601
  ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
@@ -541,9 +751,10 @@ function createMarkupForProperty(name, value) {
541
751
  } else {
542
752
  return attributeName + '=' + quoteAttributeValueForBrowser(value);
543
753
  }
544
- } else {
754
+ } else if (isAttributeNameSafe(name)) {
545
755
  return name + '=' + quoteAttributeValueForBrowser(value);
546
756
  }
757
+ return '';
547
758
  }
548
759
 
549
760
  /**
@@ -595,11 +806,15 @@ function getChildNamespace(parentNamespace, type) {
595
806
  return parentNamespace;
596
807
  }
597
808
 
809
+ var ReactDebugCurrentFrame$1 = null;
810
+
598
811
  var ReactControlledValuePropTypes = {
599
812
  checkPropTypes: null
600
813
  };
601
814
 
602
815
  {
816
+ ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
817
+
603
818
  var hasReadOnlyValue = {
604
819
  button: true,
605
820
  checkbox: true,
@@ -612,13 +827,13 @@ var ReactControlledValuePropTypes = {
612
827
 
613
828
  var propTypes = {
614
829
  value: function (props, propName, componentName) {
615
- if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
830
+ if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) {
616
831
  return null;
617
832
  }
618
833
  return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
619
834
  },
620
835
  checked: function (props, propName, componentName) {
621
- if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
836
+ if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
622
837
  return null;
623
838
  }
624
839
  return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
@@ -629,8 +844,8 @@ var ReactControlledValuePropTypes = {
629
844
  * Provide a linked `value` attribute for controlled forms. You should not use
630
845
  * this outside of the ReactDOM controlled form components.
631
846
  */
632
- ReactControlledValuePropTypes.checkPropTypes = function (tagName, props, getStack) {
633
- checkPropTypes(propTypes, props, 'prop', tagName, getStack);
847
+ ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
848
+ checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum);
634
849
  };
635
850
  }
636
851
 
@@ -653,6 +868,7 @@ var omittedCloseTags = {
653
868
  source: true,
654
869
  track: true,
655
870
  wbr: true
871
+ // NOTE: menuitem's close tag should be omitted, but that causes problems.
656
872
  };
657
873
 
658
874
  // For HTML, certain tags cannot have children. This has the same purpose as
@@ -662,24 +878,31 @@ var voidElementTags = _assign({
662
878
  menuitem: true
663
879
  }, omittedCloseTags);
664
880
 
881
+ // TODO: We can remove this if we add invariantWithStack()
882
+ // or add stack by default to invariants where possible.
665
883
  var HTML = '__html';
666
884
 
667
- function assertValidProps(tag, props, getStack) {
885
+ var ReactDebugCurrentFrame$2 = null;
886
+ {
887
+ ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
888
+ }
889
+
890
+ function assertValidProps(tag, props) {
668
891
  if (!props) {
669
892
  return;
670
893
  }
671
894
  // Note the use of `==` which checks for null or undefined.
672
895
  if (voidElementTags[tag]) {
673
- !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, getStack()) : void 0;
896
+ !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
674
897
  }
675
898
  if (props.dangerouslySetInnerHTML != null) {
676
899
  !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
677
900
  !(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
901
  }
679
902
  {
680
- warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, '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());
903
+ !(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.') : void 0;
681
904
  }
682
- !(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;
905
+ !(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', ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
683
906
  }
684
907
 
685
908
  /**
@@ -701,6 +924,7 @@ var isUnitlessNumber = {
701
924
  flexShrink: true,
702
925
  flexNegative: true,
703
926
  flexOrder: true,
927
+ gridArea: true,
704
928
  gridRow: true,
705
929
  gridRowEnd: true,
706
930
  gridRowSpan: true,
@@ -787,6 +1011,26 @@ function dangerousStyleValue(name, value, isCustomProperty) {
787
1011
  return ('' + value).trim();
788
1012
  }
789
1013
 
1014
+ var uppercasePattern = /([A-Z])/g;
1015
+ var msPattern = /^ms-/;
1016
+
1017
+ /**
1018
+ * Hyphenates a camelcased CSS property name, for example:
1019
+ *
1020
+ * > hyphenateStyleName('backgroundColor')
1021
+ * < "background-color"
1022
+ * > hyphenateStyleName('MozTransition')
1023
+ * < "-moz-transition"
1024
+ * > hyphenateStyleName('msTransition')
1025
+ * < "-ms-transition"
1026
+ *
1027
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
1028
+ * is converted to `-ms-`.
1029
+ */
1030
+ function hyphenateStyleName(name) {
1031
+ return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
1032
+ }
1033
+
790
1034
  function isCustomComponent(tagName, props) {
791
1035
  if (tagName.indexOf('-') === -1) {
792
1036
  return typeof props.is === 'string';
@@ -810,11 +1054,13 @@ function isCustomComponent(tagName, props) {
810
1054
  }
811
1055
  }
812
1056
 
813
- var warnValidStyle = emptyFunction;
1057
+ var warnValidStyle = function () {};
814
1058
 
815
1059
  {
816
1060
  // 'msTransform' is correct, but the other prefixes should be capitalized
817
1061
  var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
1062
+ var msPattern$1 = /^-ms-/;
1063
+ var hyphenPattern = /-(.)/g;
818
1064
 
819
1065
  // style values shouldn't contain a semicolon
820
1066
  var badStyleValueWithSemicolonPattern = /;\s*$/;
@@ -824,65 +1070,75 @@ var warnValidStyle = emptyFunction;
824
1070
  var warnedForNaNValue = false;
825
1071
  var warnedForInfinityValue = false;
826
1072
 
827
- var warnHyphenatedStyleName = function (name, getStack) {
1073
+ var camelize = function (string) {
1074
+ return string.replace(hyphenPattern, function (_, character) {
1075
+ return character.toUpperCase();
1076
+ });
1077
+ };
1078
+
1079
+ var warnHyphenatedStyleName = function (name) {
828
1080
  if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
829
1081
  return;
830
1082
  }
831
1083
 
832
1084
  warnedStyleNames[name] = true;
833
- warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), getStack());
1085
+ warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
1086
+ // As Andi Smith suggests
1087
+ // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
1088
+ // is converted to lowercase `ms`.
1089
+ camelize(name.replace(msPattern$1, 'ms-')));
834
1090
  };
835
1091
 
836
- var warnBadVendoredStyleName = function (name, getStack) {
1092
+ var warnBadVendoredStyleName = function (name) {
837
1093
  if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
838
1094
  return;
839
1095
  }
840
1096
 
841
1097
  warnedStyleNames[name] = true;
842
- warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), getStack());
1098
+ warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
843
1099
  };
844
1100
 
845
- var warnStyleValueWithSemicolon = function (name, value, getStack) {
1101
+ var warnStyleValueWithSemicolon = function (name, value) {
846
1102
  if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
847
1103
  return;
848
1104
  }
849
1105
 
850
1106
  warnedStyleValues[value] = true;
851
- warning(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.%s', name, value.replace(badStyleValueWithSemicolonPattern, ''), getStack());
1107
+ warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
852
1108
  };
853
1109
 
854
- var warnStyleValueIsNaN = function (name, value, getStack) {
1110
+ var warnStyleValueIsNaN = function (name, value) {
855
1111
  if (warnedForNaNValue) {
856
1112
  return;
857
1113
  }
858
1114
 
859
1115
  warnedForNaNValue = true;
860
- warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, getStack());
1116
+ warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
861
1117
  };
862
1118
 
863
- var warnStyleValueIsInfinity = function (name, value, getStack) {
1119
+ var warnStyleValueIsInfinity = function (name, value) {
864
1120
  if (warnedForInfinityValue) {
865
1121
  return;
866
1122
  }
867
1123
 
868
1124
  warnedForInfinityValue = true;
869
- warning(false, '`Infinity` is an invalid value for the `%s` css style property.%s', name, getStack());
1125
+ warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
870
1126
  };
871
1127
 
872
- warnValidStyle = function (name, value, getStack) {
1128
+ warnValidStyle = function (name, value) {
873
1129
  if (name.indexOf('-') > -1) {
874
- warnHyphenatedStyleName(name, getStack);
1130
+ warnHyphenatedStyleName(name);
875
1131
  } else if (badVendoredStyleNamePattern.test(name)) {
876
- warnBadVendoredStyleName(name, getStack);
1132
+ warnBadVendoredStyleName(name);
877
1133
  } else if (badStyleValueWithSemicolonPattern.test(value)) {
878
- warnStyleValueWithSemicolon(name, value, getStack);
1134
+ warnStyleValueWithSemicolon(name, value);
879
1135
  }
880
1136
 
881
1137
  if (typeof value === 'number') {
882
1138
  if (isNaN(value)) {
883
- warnStyleValueIsNaN(name, value, getStack);
1139
+ warnStyleValueIsNaN(name, value);
884
1140
  } else if (!isFinite(value)) {
885
- warnStyleValueIsInfinity(name, value, getStack);
1141
+ warnStyleValueIsInfinity(name, value);
886
1142
  }
887
1143
  }
888
1144
  };
@@ -949,15 +1205,10 @@ var warnedProperties = {};
949
1205
  var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
950
1206
  var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
951
1207
 
952
- var hasOwnProperty = Object.prototype.hasOwnProperty;
953
-
954
- function getStackAddendum$1() {
955
- var stack = ReactDebugCurrentFrame.getStackAddendum();
956
- return stack != null ? stack : '';
957
- }
1208
+ var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
958
1209
 
959
1210
  function validateProperty(tagName, name) {
960
- if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
1211
+ if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
961
1212
  return true;
962
1213
  }
963
1214
 
@@ -968,13 +1219,13 @@ function validateProperty(tagName, name) {
968
1219
  // If this is an aria-* attribute, but is not listed in the known DOM
969
1220
  // DOM properties, then it is an invalid aria-* attribute.
970
1221
  if (correctName == null) {
971
- warning(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s', name, getStackAddendum$1());
1222
+ warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
972
1223
  warnedProperties[name] = true;
973
1224
  return true;
974
1225
  }
975
1226
  // aria-* attributes should be lowercase; suggest the lowercase version.
976
1227
  if (name !== correctName) {
977
- warning(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s', name, correctName, getStackAddendum$1());
1228
+ warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
978
1229
  warnedProperties[name] = true;
979
1230
  return true;
980
1231
  }
@@ -992,7 +1243,7 @@ function validateProperty(tagName, name) {
992
1243
  }
993
1244
  // aria-* attributes should be lowercase; suggest the lowercase version.
994
1245
  if (name !== standardName) {
995
- warning(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$1());
1246
+ warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
996
1247
  warnedProperties[name] = true;
997
1248
  return true;
998
1249
  }
@@ -1016,9 +1267,9 @@ function warnInvalidARIAProps(type, props) {
1016
1267
  }).join(', ');
1017
1268
 
1018
1269
  if (invalidProps.length === 1) {
1019
- warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1());
1270
+ warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
1020
1271
  } else if (invalidProps.length > 1) {
1021
- warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1());
1272
+ warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
1022
1273
  }
1023
1274
  }
1024
1275
 
@@ -1031,11 +1282,6 @@ function validateProperties(type, props) {
1031
1282
 
1032
1283
  var didWarnValueNull = false;
1033
1284
 
1034
- function getStackAddendum$2() {
1035
- var stack = ReactDebugCurrentFrame.getStackAddendum();
1036
- return stack != null ? stack : '';
1037
- }
1038
-
1039
1285
  function validateProperties$1(type, props) {
1040
1286
  if (type !== 'input' && type !== 'textarea' && type !== 'select') {
1041
1287
  return;
@@ -1044,9 +1290,9 @@ function validateProperties$1(type, props) {
1044
1290
  if (props != null && props.value === null && !didWarnValueNull) {
1045
1291
  didWarnValueNull = true;
1046
1292
  if (type === 'select' && props.multiple) {
1047
- warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.%s', type, getStackAddendum$2());
1293
+ warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
1048
1294
  } else {
1049
- warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', type, getStackAddendum$2());
1295
+ warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
1050
1296
  }
1051
1297
  }
1052
1298
  }
@@ -1136,7 +1382,7 @@ var possibleStandardNames = {
1136
1382
  checked: 'checked',
1137
1383
  children: 'children',
1138
1384
  cite: 'cite',
1139
- 'class': 'className',
1385
+ class: 'className',
1140
1386
  classid: 'classID',
1141
1387
  classname: 'className',
1142
1388
  cols: 'cols',
@@ -1151,7 +1397,7 @@ var possibleStandardNames = {
1151
1397
  dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
1152
1398
  data: 'data',
1153
1399
  datetime: 'dateTime',
1154
- 'default': 'default',
1400
+ default: 'default',
1155
1401
  defaultchecked: 'defaultChecked',
1156
1402
  defaultvalue: 'defaultValue',
1157
1403
  defer: 'defer',
@@ -1160,7 +1406,7 @@ var possibleStandardNames = {
1160
1406
  download: 'download',
1161
1407
  draggable: 'draggable',
1162
1408
  enctype: 'encType',
1163
- 'for': 'htmlFor',
1409
+ for: 'htmlFor',
1164
1410
  form: 'form',
1165
1411
  formmethod: 'formMethod',
1166
1412
  formaction: 'formAction',
@@ -1378,7 +1624,7 @@ var possibleStandardNames = {
1378
1624
  imagerendering: 'imageRendering',
1379
1625
  'image-rendering': 'imageRendering',
1380
1626
  in2: 'in2',
1381
- 'in': 'in',
1627
+ in: 'in',
1382
1628
  inlist: 'inlist',
1383
1629
  intercept: 'intercept',
1384
1630
  k1: 'k1',
@@ -1518,7 +1764,7 @@ var possibleStandardNames = {
1518
1764
  'text-rendering': 'textRendering',
1519
1765
  to: 'to',
1520
1766
  transform: 'transform',
1521
- 'typeof': 'typeof',
1767
+ typeof: 'typeof',
1522
1768
  u1: 'u1',
1523
1769
  u2: 'u2',
1524
1770
  underlineposition: 'underlinePosition',
@@ -1597,11 +1843,6 @@ var possibleStandardNames = {
1597
1843
  zoomandpan: 'zoomAndPan'
1598
1844
  };
1599
1845
 
1600
- function getStackAddendum$3() {
1601
- var stack = ReactDebugCurrentFrame.getStackAddendum();
1602
- return stack != null ? stack : '';
1603
- }
1604
-
1605
1846
  var validateProperty$1 = function () {};
1606
1847
 
1607
1848
  {
@@ -1619,7 +1860,7 @@ var validateProperty$1 = function () {};
1619
1860
 
1620
1861
  var lowerCasedName = name.toLowerCase();
1621
1862
  if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
1622
- warning(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
1863
+ warning$1(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
1623
1864
  warnedProperties$1[name] = true;
1624
1865
  return true;
1625
1866
  }
@@ -1631,12 +1872,12 @@ var validateProperty$1 = function () {};
1631
1872
  }
1632
1873
  var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
1633
1874
  if (registrationName != null) {
1634
- warning(false, 'Invalid event handler property `%s`. Did you mean `%s`?%s', name, registrationName, getStackAddendum$3());
1875
+ warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
1635
1876
  warnedProperties$1[name] = true;
1636
1877
  return true;
1637
1878
  }
1638
1879
  if (EVENT_NAME_REGEX.test(name)) {
1639
- warning(false, 'Unknown event handler property `%s`. It will be ignored.%s', name, getStackAddendum$3());
1880
+ warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
1640
1881
  warnedProperties$1[name] = true;
1641
1882
  return true;
1642
1883
  }
@@ -1645,7 +1886,7 @@ var validateProperty$1 = function () {};
1645
1886
  // So we can't tell if the event name is correct for sure, but we can filter
1646
1887
  // out known bad ones like `onclick`. We can't suggest a specific replacement though.
1647
1888
  if (INVALID_EVENT_NAME_REGEX.test(name)) {
1648
- warning(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.%s', name, getStackAddendum$3());
1889
+ warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
1649
1890
  }
1650
1891
  warnedProperties$1[name] = true;
1651
1892
  return true;
@@ -1657,25 +1898,25 @@ var validateProperty$1 = function () {};
1657
1898
  }
1658
1899
 
1659
1900
  if (lowerCasedName === 'innerhtml') {
1660
- warning(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
1901
+ warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
1661
1902
  warnedProperties$1[name] = true;
1662
1903
  return true;
1663
1904
  }
1664
1905
 
1665
1906
  if (lowerCasedName === 'aria') {
1666
- warning(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
1907
+ warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
1667
1908
  warnedProperties$1[name] = true;
1668
1909
  return true;
1669
1910
  }
1670
1911
 
1671
1912
  if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
1672
- warning(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.%s', typeof value, getStackAddendum$3());
1913
+ warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
1673
1914
  warnedProperties$1[name] = true;
1674
1915
  return true;
1675
1916
  }
1676
1917
 
1677
1918
  if (typeof value === 'number' && isNaN(value)) {
1678
- warning(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.%s', name, getStackAddendum$3());
1919
+ warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
1679
1920
  warnedProperties$1[name] = true;
1680
1921
  return true;
1681
1922
  }
@@ -1687,23 +1928,23 @@ var validateProperty$1 = function () {};
1687
1928
  if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
1688
1929
  var standardName = possibleStandardNames[lowerCasedName];
1689
1930
  if (standardName !== name) {
1690
- warning(false, 'Invalid DOM property `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$3());
1931
+ warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
1691
1932
  warnedProperties$1[name] = true;
1692
1933
  return true;
1693
1934
  }
1694
1935
  } else if (!isReserved && name !== lowerCasedName) {
1695
1936
  // Unknown attributes should have lowercase casing since that's how they
1696
1937
  // will be cased anyway with server rendering.
1697
- warning(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.%s', name, lowerCasedName, getStackAddendum$3());
1938
+ warning$1(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
1698
1939
  warnedProperties$1[name] = true;
1699
1940
  return true;
1700
1941
  }
1701
1942
 
1702
1943
  if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
1703
1944
  if (value) {
1704
- warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.%s', value, name, name, value, name, getStackAddendum$3());
1945
+ warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
1705
1946
  } else {
1706
- warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.%s', value, name, name, value, name, name, name, getStackAddendum$3());
1947
+ warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
1707
1948
  }
1708
1949
  warnedProperties$1[name] = true;
1709
1950
  return true;
@@ -1721,6 +1962,13 @@ var validateProperty$1 = function () {};
1721
1962
  return false;
1722
1963
  }
1723
1964
 
1965
+ // Warn when passing the strings 'false' or 'true' into a boolean prop
1966
+ if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
1967
+ warning$1(false, 'Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
1968
+ warnedProperties$1[name] = true;
1969
+ return true;
1970
+ }
1971
+
1724
1972
  return true;
1725
1973
  };
1726
1974
  }
@@ -1738,9 +1986,9 @@ var warnUnknownProperties = function (type, props, canUseEventSystem) {
1738
1986
  return '`' + prop + '`';
1739
1987
  }).join(', ');
1740
1988
  if (unknownProps.length === 1) {
1741
- warning(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3());
1989
+ warning$1(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
1742
1990
  } else if (unknownProps.length > 1) {
1743
- warning(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3());
1991
+ warning$1(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
1744
1992
  }
1745
1993
  };
1746
1994
 
@@ -1757,18 +2005,29 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
1757
2005
 
1758
2006
  var toArray = React.Children.toArray;
1759
2007
 
1760
- var currentDebugStack = void 0;
1761
- var currentDebugElementStack = void 0;
2008
+ // This is only used in DEV.
2009
+ // Each entry is `this.stack` from a currently executing renderer instance.
2010
+ // (There may be more than one because ReactDOMServer is reentrant).
2011
+ // Each stack is an array of frames which may contain nested stacks of elements.
2012
+ var currentDebugStacks = [];
1762
2013
 
1763
- var getStackAddendum = emptyFunction.thatReturns('');
1764
- var describeStackFrame = emptyFunction.thatReturns('');
2014
+ var ReactDebugCurrentFrame = void 0;
2015
+ var prevGetCurrentStackImpl = null;
2016
+ var getCurrentServerStackImpl = function () {
2017
+ return '';
2018
+ };
2019
+ var describeStackFrame = function (element) {
2020
+ return '';
2021
+ };
1765
2022
 
1766
2023
  var validatePropertiesInDevelopment = function (type, props) {};
1767
- var setCurrentDebugStack = function (stack) {};
2024
+ var pushCurrentDebugStack = function (stack) {};
1768
2025
  var pushElementToDebugStack = function (element) {};
1769
- var resetCurrentDebugStack = function () {};
2026
+ var popCurrentDebugStack = function () {};
1770
2027
 
1771
2028
  {
2029
+ ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2030
+
1772
2031
  validatePropertiesInDevelopment = function (type, props) {
1773
2032
  validateProperties(type, props);
1774
2033
  validateProperties$1(type, props);
@@ -1783,34 +2042,55 @@ var resetCurrentDebugStack = function () {};
1783
2042
  return describeComponentFrame(name, source, ownerName);
1784
2043
  };
1785
2044
 
1786
- currentDebugStack = null;
1787
- currentDebugElementStack = null;
1788
- setCurrentDebugStack = function (stack) {
1789
- var frame = stack[stack.length - 1];
1790
- currentDebugElementStack = frame.debugElementStack;
1791
- // We are about to enter a new composite stack, reset the array.
1792
- currentDebugElementStack.length = 0;
1793
- currentDebugStack = stack;
1794
- ReactDebugCurrentFrame.getCurrentStack = getStackAddendum;
2045
+ pushCurrentDebugStack = function (stack) {
2046
+ currentDebugStacks.push(stack);
2047
+
2048
+ if (currentDebugStacks.length === 1) {
2049
+ // We are entering a server renderer.
2050
+ // Remember the previous (e.g. client) global stack implementation.
2051
+ prevGetCurrentStackImpl = ReactDebugCurrentFrame.getCurrentStack;
2052
+ ReactDebugCurrentFrame.getCurrentStack = getCurrentServerStackImpl;
2053
+ }
1795
2054
  };
2055
+
1796
2056
  pushElementToDebugStack = function (element) {
1797
- if (currentDebugElementStack !== null) {
1798
- currentDebugElementStack.push(element);
1799
- }
2057
+ // For the innermost executing ReactDOMServer call,
2058
+ var stack = currentDebugStacks[currentDebugStacks.length - 1];
2059
+ // Take the innermost executing frame (e.g. <Foo>),
2060
+ var frame = stack[stack.length - 1];
2061
+ // and record that it has one more element associated with it.
2062
+ frame.debugElementStack.push(element);
2063
+ // We only need this because we tail-optimize single-element
2064
+ // children and directly handle them in an inner loop instead of
2065
+ // creating separate frames for them.
1800
2066
  };
1801
- resetCurrentDebugStack = function () {
1802
- currentDebugElementStack = null;
1803
- currentDebugStack = null;
1804
- ReactDebugCurrentFrame.getCurrentStack = null;
2067
+
2068
+ popCurrentDebugStack = function () {
2069
+ currentDebugStacks.pop();
2070
+
2071
+ if (currentDebugStacks.length === 0) {
2072
+ // We are exiting the server renderer.
2073
+ // Restore the previous (e.g. client) global stack implementation.
2074
+ ReactDebugCurrentFrame.getCurrentStack = prevGetCurrentStackImpl;
2075
+ prevGetCurrentStackImpl = null;
2076
+ }
1805
2077
  };
1806
- getStackAddendum = function () {
1807
- if (currentDebugStack === null) {
2078
+
2079
+ getCurrentServerStackImpl = function () {
2080
+ if (currentDebugStacks.length === 0) {
2081
+ // Nothing is currently rendering.
1808
2082
  return '';
1809
2083
  }
2084
+ // ReactDOMServer is reentrant so there may be multiple calls at the same time.
2085
+ // Take the frames from the innermost call which is the last in the array.
2086
+ var frames = currentDebugStacks[currentDebugStacks.length - 1];
1810
2087
  var stack = '';
1811
- var debugStack = currentDebugStack;
1812
- for (var i = debugStack.length - 1; i >= 0; i--) {
1813
- var frame = debugStack[i];
2088
+ // Go through every frame in the stack from the innermost one.
2089
+ for (var i = frames.length - 1; i >= 0; i--) {
2090
+ var frame = frames[i];
2091
+ // Every frame might have more than one debug element stack entry associated with it.
2092
+ // This is because single-child nesting doesn't create materialized frames.
2093
+ // Instead it would push them through `pushElementToDebugStack()`.
1814
2094
  var _debugElementStack = frame.debugElementStack;
1815
2095
  for (var ii = _debugElementStack.length - 1; ii >= 0; ii--) {
1816
2096
  stack += describeStackFrame(_debugElementStack[ii]);
@@ -1837,10 +2117,6 @@ var newlineEatingTags = {
1837
2117
  textarea: true
1838
2118
  };
1839
2119
 
1840
- function getComponentName(type) {
1841
- return typeof type === 'string' ? type : typeof type === 'function' ? type.displayName || type.name : null;
1842
- }
1843
-
1844
2120
  // We accept any tag to be rendered but since this gets injected into arbitrary
1845
2121
  // HTML, we want to make sure that it's a safe tag.
1846
2122
  // http://www.w3.org/TR/REC-xml/#NT-Name
@@ -1853,9 +2129,15 @@ function validateDangerousTag(tag) {
1853
2129
  }
1854
2130
  }
1855
2131
 
1856
- var processStyleName = memoizeStringOnly(function (styleName) {
1857
- return hyphenateStyleName(styleName);
1858
- });
2132
+ var styleNameCache = {};
2133
+ var processStyleName = function (styleName) {
2134
+ if (styleNameCache.hasOwnProperty(styleName)) {
2135
+ return styleNameCache[styleName];
2136
+ }
2137
+ var result = hyphenateStyleName(styleName);
2138
+ styleNameCache[styleName] = result;
2139
+ return result;
2140
+ };
1859
2141
 
1860
2142
  function createMarkupForStyles(styles) {
1861
2143
  var serialized = '';
@@ -1868,7 +2150,7 @@ function createMarkupForStyles(styles) {
1868
2150
  var styleValue = styles[styleName];
1869
2151
  {
1870
2152
  if (!isCustomProperty) {
1871
- warnValidStyle$1(styleName, styleValue, getStackAddendum);
2153
+ warnValidStyle$1(styleName, styleValue);
1872
2154
  }
1873
2155
  }
1874
2156
  if (styleValue != null) {
@@ -1890,7 +2172,7 @@ function warnNoop(publicInstance, callerName) {
1890
2172
  return;
1891
2173
  }
1892
2174
 
1893
- warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
2175
+ warningWithoutStack$1(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
1894
2176
  didWarnAboutNoopUpdateForComponent[warningKey] = true;
1895
2177
  }
1896
2178
  }
@@ -1931,6 +2213,9 @@ function flattenTopLevelChildren(children) {
1931
2213
  }
1932
2214
 
1933
2215
  function flattenOptionChildren(children) {
2216
+ if (children === undefined || children === null) {
2217
+ return children;
2218
+ }
1934
2219
  var content = '';
1935
2220
  // Flatten children and warn if they aren't strings or numbers;
1936
2221
  // invalid types are ignored.
@@ -1938,20 +2223,22 @@ function flattenOptionChildren(children) {
1938
2223
  if (child == null) {
1939
2224
  return;
1940
2225
  }
1941
- if (typeof child === 'string' || typeof child === 'number') {
1942
- content += child;
1943
- } else {
1944
- {
1945
- if (!didWarnInvalidOptionChildren) {
1946
- didWarnInvalidOptionChildren = true;
1947
- warning(false, 'Only strings and numbers are supported as <option> children.');
1948
- }
2226
+ content += child;
2227
+ {
2228
+ if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
2229
+ didWarnInvalidOptionChildren = true;
2230
+ warning$1(false, 'Only strings and numbers are supported as <option> children.');
1949
2231
  }
1950
2232
  }
1951
2233
  });
1952
2234
  return content;
1953
2235
  }
1954
2236
 
2237
+ var emptyObject = {};
2238
+ {
2239
+ Object.freeze(emptyObject);
2240
+ }
2241
+
1955
2242
  function maskContext(type, context) {
1956
2243
  var contextTypes = type.contextTypes;
1957
2244
  if (!contextTypes) {
@@ -1966,7 +2253,7 @@ function maskContext(type, context) {
1966
2253
 
1967
2254
  function checkContextTypes(typeSpecs, values, location) {
1968
2255
  {
1969
- checkPropTypes(typeSpecs, values, location, 'Component', getStackAddendum);
2256
+ checkPropTypes(typeSpecs, values, location, 'Component', getCurrentServerStackImpl);
1970
2257
  }
1971
2258
  }
1972
2259
 
@@ -1980,6 +2267,7 @@ function processContext(type, context) {
1980
2267
  return maskedContext;
1981
2268
  }
1982
2269
 
2270
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1983
2271
  var STYLE = 'style';
1984
2272
  var RESERVED_PROPS = {
1985
2273
  children: null,
@@ -1992,7 +2280,7 @@ function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeSt
1992
2280
  var ret = '<' + tagVerbatim;
1993
2281
 
1994
2282
  for (var propKey in props) {
1995
- if (!props.hasOwnProperty(propKey)) {
2283
+ if (!hasOwnProperty.call(props, propKey)) {
1996
2284
  continue;
1997
2285
  }
1998
2286
  var propValue = props[propKey];
@@ -2034,42 +2322,26 @@ function validateRenderResult(child, type) {
2034
2322
  }
2035
2323
 
2036
2324
  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
2325
  while (React.isValidElement(child)) {
2059
2326
  // Safe because we just checked it's an element.
2060
- element = child;
2327
+ var element = child;
2328
+ var Component = element.type;
2061
2329
  {
2062
2330
  pushElementToDebugStack(element);
2063
2331
  }
2064
- Component = element.type;
2065
2332
  if (typeof Component !== 'function') {
2066
2333
  break;
2067
2334
  }
2068
- publicContext = processContext(Component, context);
2335
+ processChild(element, Component);
2336
+ }
2337
+
2338
+ // Extra closure so queue and replace can be captured properly
2339
+ function processChild(element, Component) {
2340
+ var publicContext = processContext(Component, context);
2069
2341
 
2070
- queue = [];
2071
- replace = false;
2072
- updater = {
2342
+ var queue = [];
2343
+ var replace = false;
2344
+ var updater = {
2073
2345
  isMounted: function (publicInstance) {
2074
2346
  return false;
2075
2347
  },
@@ -2092,6 +2364,7 @@ function resolve(child, context) {
2092
2364
  }
2093
2365
  };
2094
2366
 
2367
+ var inst = void 0;
2095
2368
  if (shouldConstruct(Component)) {
2096
2369
  inst = new Component(element.props, publicContext, updater);
2097
2370
 
@@ -2100,19 +2373,19 @@ function resolve(child, context) {
2100
2373
  if (inst.state === null || inst.state === undefined) {
2101
2374
  var componentName = getComponentName(Component) || 'Unknown';
2102
2375
  if (!didWarnAboutUninitializedState[componentName]) {
2103
- warning(false, '%s: Did not properly initialize state during construction. ' + 'Expected state to be an object, but it was %s.', componentName, inst.state === null ? 'null' : 'undefined');
2376
+ warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, inst.state === null ? 'null' : 'undefined', componentName);
2104
2377
  didWarnAboutUninitializedState[componentName] = true;
2105
2378
  }
2106
2379
  }
2107
2380
  }
2108
2381
 
2109
- partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
2382
+ var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
2110
2383
 
2111
2384
  {
2112
2385
  if (partialState === undefined) {
2113
2386
  var _componentName = getComponentName(Component) || 'Unknown';
2114
2387
  if (!didWarnAboutUndefinedDerivedState[_componentName]) {
2115
- warning(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
2388
+ warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
2116
2389
  didWarnAboutUndefinedDerivedState[_componentName] = true;
2117
2390
  }
2118
2391
  }
@@ -2128,7 +2401,7 @@ function resolve(child, context) {
2128
2401
  var _componentName2 = getComponentName(Component) || 'Unknown';
2129
2402
 
2130
2403
  if (!didWarnAboutBadClass[_componentName2]) {
2131
- warning(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', _componentName2, _componentName2);
2404
+ warningWithoutStack$1(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', _componentName2, _componentName2);
2132
2405
  didWarnAboutBadClass[_componentName2] = true;
2133
2406
  }
2134
2407
  }
@@ -2137,7 +2410,7 @@ function resolve(child, context) {
2137
2410
  if (inst == null || inst.render == null) {
2138
2411
  child = inst;
2139
2412
  validateRenderResult(child, Component);
2140
- continue;
2413
+ return;
2141
2414
  }
2142
2415
  }
2143
2416
 
@@ -2145,7 +2418,7 @@ function resolve(child, context) {
2145
2418
  inst.context = publicContext;
2146
2419
  inst.updater = updater;
2147
2420
 
2148
- initialState = inst.state;
2421
+ var initialState = inst.state;
2149
2422
  if (initialState === undefined) {
2150
2423
  inst.state = initialState = null;
2151
2424
  }
@@ -2174,25 +2447,25 @@ function resolve(child, context) {
2174
2447
  inst.UNSAFE_componentWillMount();
2175
2448
  }
2176
2449
  if (queue.length) {
2177
- oldQueue = queue;
2178
- oldReplace = replace;
2450
+ var oldQueue = queue;
2451
+ var oldReplace = replace;
2179
2452
  queue = null;
2180
2453
  replace = false;
2181
2454
 
2182
2455
  if (oldReplace && oldQueue.length === 1) {
2183
2456
  inst.state = oldQueue[0];
2184
2457
  } else {
2185
- nextState = oldReplace ? oldQueue[0] : inst.state;
2186
- dontMutate = true;
2458
+ var nextState = oldReplace ? oldQueue[0] : inst.state;
2459
+ var dontMutate = true;
2187
2460
  for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
2188
- partial = oldQueue[i];
2189
- partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
2190
- if (partialState != null) {
2461
+ var partial = oldQueue[i];
2462
+ var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
2463
+ if (_partialState != null) {
2191
2464
  if (dontMutate) {
2192
2465
  dontMutate = false;
2193
- nextState = _assign({}, nextState, partialState);
2466
+ nextState = _assign({}, nextState, _partialState);
2194
2467
  } else {
2195
- _assign(nextState, partialState);
2468
+ _assign(nextState, _partialState);
2196
2469
  }
2197
2470
  }
2198
2471
  }
@@ -2213,15 +2486,16 @@ function resolve(child, context) {
2213
2486
  }
2214
2487
  validateRenderResult(child, Component);
2215
2488
 
2489
+ var childContext = void 0;
2216
2490
  if (typeof inst.getChildContext === 'function') {
2217
- childContextTypes = Component.childContextTypes;
2491
+ var childContextTypes = Component.childContextTypes;
2218
2492
  if (typeof childContextTypes === 'object') {
2219
2493
  childContext = inst.getChildContext();
2220
- for (contextKey in childContext) {
2494
+ for (var contextKey in childContext) {
2221
2495
  !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
2222
2496
  }
2223
2497
  } else {
2224
- warning(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
2498
+ warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
2225
2499
  }
2226
2500
  }
2227
2501
  if (childContext) {
@@ -2232,6 +2506,8 @@ function resolve(child, context) {
2232
2506
  }
2233
2507
 
2234
2508
  var ReactDOMServerRenderer = function () {
2509
+ // DEV-only
2510
+
2235
2511
  function ReactDOMServerRenderer(children, makeStaticMarkup) {
2236
2512
  _classCallCheck(this, ReactDOMServerRenderer);
2237
2513
 
@@ -2257,33 +2533,65 @@ var ReactDOMServerRenderer = function () {
2257
2533
  this.makeStaticMarkup = makeStaticMarkup;
2258
2534
 
2259
2535
  // Context (new API)
2260
- this.providerStack = []; // Stack of provider objects
2261
- this.providerIndex = -1;
2536
+ this.contextIndex = -1;
2537
+ this.contextStack = [];
2538
+ this.contextValueStack = [];
2539
+ {
2540
+ this.contextProviderStack = [];
2541
+ }
2262
2542
  }
2543
+
2544
+ /**
2545
+ * Note: We use just two stacks regardless of how many context providers you have.
2546
+ * Providers are always popped in the reverse order to how they were pushed
2547
+ * so we always know on the way down which provider you'll encounter next on the way up.
2548
+ * On the way down, we push the current provider, and its context value *before*
2549
+ * we mutated it, onto the stacks. Therefore, on the way up, we always know which
2550
+ * provider needs to be "restored" to which value.
2551
+ * https://github.com/facebook/react/pull/12985#issuecomment-396301248
2552
+ */
2553
+
2263
2554
  // TODO: type this more strictly:
2264
2555
 
2265
2556
 
2266
2557
  ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
2267
- this.providerIndex += 1;
2268
- this.providerStack[this.providerIndex] = provider;
2269
- var context = provider.type.context;
2270
- context.currentValue = provider.props.value;
2558
+ var index = ++this.contextIndex;
2559
+ var context = provider.type._context;
2560
+ var previousValue = context._currentValue;
2561
+
2562
+ // Remember which value to restore this context to on our way up.
2563
+ this.contextStack[index] = context;
2564
+ this.contextValueStack[index] = previousValue;
2565
+ {
2566
+ // Only used for push/pop mismatch warnings.
2567
+ this.contextProviderStack[index] = provider;
2568
+ }
2569
+
2570
+ // Mutate the current value.
2571
+ context._currentValue = provider.props.value;
2271
2572
  };
2272
2573
 
2273
2574
  ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
2575
+ var index = this.contextIndex;
2274
2576
  {
2275
- warning(this.providerIndex > -1 && provider === this.providerStack[this.providerIndex], 'Unexpected pop.');
2577
+ !(index > -1 && provider === this.contextProviderStack[index]) ? warningWithoutStack$1(false, 'Unexpected pop.') : void 0;
2276
2578
  }
2277
- this.providerStack[this.providerIndex] = null;
2278
- this.providerIndex -= 1;
2279
- var context = provider.type.context;
2280
- if (this.providerIndex < 0) {
2281
- context.currentValue = context.defaultValue;
2282
- } else {
2283
- // We assume this type is correct because of the index check above.
2284
- var previousProvider = this.providerStack[this.providerIndex];
2285
- context.currentValue = previousProvider.props.value;
2579
+
2580
+ var context = this.contextStack[index];
2581
+ var previousValue = this.contextValueStack[index];
2582
+
2583
+ // "Hide" these null assignments from Flow by using `any`
2584
+ // because conceptually they are deletions--as long as we
2585
+ // promise to never access values beyond `this.contextIndex`.
2586
+ this.contextStack[index] = null;
2587
+ this.contextValueStack[index] = null;
2588
+ {
2589
+ this.contextProviderStack[index] = null;
2286
2590
  }
2591
+ this.contextIndex--;
2592
+
2593
+ // Restore to the previous value we stored as we were walking down.
2594
+ context._currentValue = previousValue;
2287
2595
  };
2288
2596
 
2289
2597
  ReactDOMServerRenderer.prototype.read = function read(bytes) {
@@ -2315,12 +2623,15 @@ var ReactDOMServerRenderer = function () {
2315
2623
  }
2316
2624
  var child = frame.children[frame.childIndex++];
2317
2625
  {
2318
- setCurrentDebugStack(this.stack);
2319
- }
2320
- out += this.render(child, frame.context, frame.domNamespace);
2321
- {
2322
- // TODO: Handle reentrant server render calls. This doesn't.
2323
- resetCurrentDebugStack();
2626
+ pushCurrentDebugStack(this.stack);
2627
+ // We're starting work on this frame, so reset its inner stack.
2628
+ frame.debugElementStack.length = 0;
2629
+ try {
2630
+ // Be careful! Make sure this matches the PROD path below.
2631
+ out += this.render(child, frame.context, frame.domNamespace);
2632
+ } finally {
2633
+ popCurrentDebugStack();
2634
+ }
2324
2635
  }
2325
2636
  }
2326
2637
  return out;
@@ -2384,6 +2695,7 @@ var ReactDOMServerRenderer = function () {
2384
2695
  switch (elementType) {
2385
2696
  case REACT_STRICT_MODE_TYPE:
2386
2697
  case REACT_ASYNC_MODE_TYPE:
2698
+ case REACT_PROFILER_TYPE:
2387
2699
  case REACT_FRAGMENT_TYPE:
2388
2700
  {
2389
2701
  var _nextChildren = toArray(nextChild.props.children);
@@ -2401,56 +2713,92 @@ var ReactDOMServerRenderer = function () {
2401
2713
  this.stack.push(_frame);
2402
2714
  return '';
2403
2715
  }
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.');
2716
+ case REACT_PLACEHOLDER_TYPE:
2717
+ {
2718
+ if (enableSuspenseServerRenderer) {
2719
+ var _nextChildren2 = toArray(
2720
+ // Always use the fallback when synchronously rendering to string.
2721
+ nextChild.props.fallback);
2722
+ var _frame2 = {
2723
+ type: null,
2724
+ domNamespace: parentNamespace,
2725
+ children: _nextChildren2,
2726
+ childIndex: 0,
2727
+ context: context,
2728
+ footer: ''
2729
+ };
2730
+ {
2731
+ _frame2.debugElementStack = [];
2732
+ }
2733
+ this.stack.push(_frame2);
2734
+ return '';
2735
+ }
2736
+ }
2407
2737
  // eslint-disable-next-line-no-fallthrough
2408
2738
  default:
2409
2739
  break;
2410
2740
  }
2411
2741
  if (typeof elementType === 'object' && elementType !== null) {
2412
2742
  switch (elementType.$$typeof) {
2743
+ case REACT_FORWARD_REF_TYPE:
2744
+ {
2745
+ var element = nextChild;
2746
+ var _nextChildren3 = toArray(elementType.render(element.props, element.ref));
2747
+ var _frame3 = {
2748
+ type: null,
2749
+ domNamespace: parentNamespace,
2750
+ children: _nextChildren3,
2751
+ childIndex: 0,
2752
+ context: context,
2753
+ footer: ''
2754
+ };
2755
+ {
2756
+ _frame3.debugElementStack = [];
2757
+ }
2758
+ this.stack.push(_frame3);
2759
+ return '';
2760
+ }
2413
2761
  case REACT_PROVIDER_TYPE:
2414
2762
  {
2415
2763
  var provider = nextChild;
2416
2764
  var nextProps = provider.props;
2417
- var _nextChildren2 = toArray(nextProps.children);
2418
- var _frame2 = {
2765
+ var _nextChildren4 = toArray(nextProps.children);
2766
+ var _frame4 = {
2419
2767
  type: provider,
2420
2768
  domNamespace: parentNamespace,
2421
- children: _nextChildren2,
2769
+ children: _nextChildren4,
2422
2770
  childIndex: 0,
2423
2771
  context: context,
2424
2772
  footer: ''
2425
2773
  };
2426
2774
  {
2427
- _frame2.debugElementStack = [];
2775
+ _frame4.debugElementStack = [];
2428
2776
  }
2429
2777
 
2430
2778
  this.pushProvider(provider);
2431
2779
 
2432
- this.stack.push(_frame2);
2780
+ this.stack.push(_frame4);
2433
2781
  return '';
2434
2782
  }
2435
2783
  case REACT_CONTEXT_TYPE:
2436
2784
  {
2437
2785
  var consumer = nextChild;
2438
2786
  var _nextProps = consumer.props;
2439
- var nextValue = consumer.type.currentValue;
2787
+ var nextValue = consumer.type._currentValue;
2440
2788
 
2441
- var _nextChildren3 = toArray(_nextProps.children(nextValue));
2442
- var _frame3 = {
2789
+ var _nextChildren5 = toArray(_nextProps.children(nextValue));
2790
+ var _frame5 = {
2443
2791
  type: nextChild,
2444
2792
  domNamespace: parentNamespace,
2445
- children: _nextChildren3,
2793
+ children: _nextChildren5,
2446
2794
  childIndex: 0,
2447
2795
  context: context,
2448
2796
  footer: ''
2449
2797
  };
2450
2798
  {
2451
- _frame3.debugElementStack = [];
2799
+ _frame5.debugElementStack = [];
2452
2800
  }
2453
- this.stack.push(_frame3);
2801
+ this.stack.push(_frame5);
2454
2802
  return '';
2455
2803
  }
2456
2804
  default:
@@ -2485,7 +2833,7 @@ var ReactDOMServerRenderer = function () {
2485
2833
  if (namespace === Namespaces.html) {
2486
2834
  // Should this check be gated by parent namespace? Not sure we want to
2487
2835
  // allow <SVG> or <mATH>.
2488
- warning(tag === element.type, '<%s /> is using uppercase HTML. Always use lowercase HTML tags ' + 'in React.', element.type);
2836
+ !(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;
2489
2837
  }
2490
2838
  }
2491
2839
 
@@ -2494,14 +2842,14 @@ var ReactDOMServerRenderer = function () {
2494
2842
  var props = element.props;
2495
2843
  if (tag === 'input') {
2496
2844
  {
2497
- ReactControlledValuePropTypes.checkPropTypes('input', props, getStackAddendum);
2845
+ ReactControlledValuePropTypes.checkPropTypes('input', props);
2498
2846
 
2499
2847
  if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
2500
- warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
2848
+ warning$1(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
2501
2849
  didWarnDefaultChecked = true;
2502
2850
  }
2503
2851
  if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
2504
- warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
2852
+ warning$1(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
2505
2853
  didWarnDefaultInputValue = true;
2506
2854
  }
2507
2855
  }
@@ -2516,9 +2864,9 @@ var ReactDOMServerRenderer = function () {
2516
2864
  });
2517
2865
  } else if (tag === 'textarea') {
2518
2866
  {
2519
- ReactControlledValuePropTypes.checkPropTypes('textarea', props, getStackAddendum);
2867
+ ReactControlledValuePropTypes.checkPropTypes('textarea', props);
2520
2868
  if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
2521
- warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
2869
+ warning$1(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
2522
2870
  didWarnDefaultTextareaValue = true;
2523
2871
  }
2524
2872
  }
@@ -2530,7 +2878,7 @@ var ReactDOMServerRenderer = function () {
2530
2878
  var textareaChildren = props.children;
2531
2879
  if (textareaChildren != null) {
2532
2880
  {
2533
- warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
2881
+ warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
2534
2882
  }
2535
2883
  !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
2536
2884
  if (Array.isArray(textareaChildren)) {
@@ -2552,7 +2900,7 @@ var ReactDOMServerRenderer = function () {
2552
2900
  });
2553
2901
  } else if (tag === 'select') {
2554
2902
  {
2555
- ReactControlledValuePropTypes.checkPropTypes('select', props, getStackAddendum);
2903
+ ReactControlledValuePropTypes.checkPropTypes('select', props);
2556
2904
 
2557
2905
  for (var i = 0; i < valuePropNames.length; i++) {
2558
2906
  var propName = valuePropNames[i];
@@ -2561,14 +2909,14 @@ var ReactDOMServerRenderer = function () {
2561
2909
  }
2562
2910
  var isArray = Array.isArray(props[propName]);
2563
2911
  if (props.multiple && !isArray) {
2564
- warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '');
2912
+ warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
2565
2913
  } 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, '');
2914
+ warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
2567
2915
  }
2568
2916
  }
2569
2917
 
2570
2918
  if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
2571
- warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
2919
+ warning$1(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
2572
2920
  didWarnDefaultSelectValue = true;
2573
2921
  }
2574
2922
  }
@@ -2614,7 +2962,7 @@ var ReactDOMServerRenderer = function () {
2614
2962
  validatePropertiesInDevelopment(tag, props);
2615
2963
  }
2616
2964
 
2617
- assertValidProps(tag, props, getStackAddendum);
2965
+ assertValidProps(tag, props);
2618
2966
 
2619
2967
  var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
2620
2968
  var footer = '';
@@ -2756,7 +3104,7 @@ var ReactDOMServer = ( ReactDOMServerNode$1 && ReactDOMServerNode ) || ReactDOMS
2756
3104
 
2757
3105
  // TODO: decide on the top-level export form.
2758
3106
  // This is hacky but makes it work with both Rollup and Jest
2759
- var server_node = ReactDOMServer['default'] ? ReactDOMServer['default'] : ReactDOMServer;
3107
+ var server_node = ReactDOMServer.default || ReactDOMServer;
2760
3108
 
2761
3109
  module.exports = server_node;
2762
3110
  })();