react-dom 16.4.2 → 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.2
1
+ /** @license React v16.5.0
2
2
  * react-dom-server.node.development.js
3
3
  *
4
4
  * Copyright (c) 2013-present, Facebook, Inc.
@@ -16,23 +16,178 @@ 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');
20
19
  var React = require('react');
21
- var emptyFunction = require('fbjs/lib/emptyFunction');
22
- var emptyObject = require('fbjs/lib/emptyObject');
23
- var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
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.2';
25
+ var ReactVersion = '16.5.0';
26
+
27
+ /**
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.
36
+ */
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
+ }
33
68
 
34
69
  // Relying on the `invariant()` implementation lets us
35
- // have preserve the format and params in the www builds.
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
+ }
36
191
 
37
192
  /**
38
193
  * Forked from fbjs/warning:
@@ -73,7 +228,7 @@ var lowPriorityWarning = function () {};
73
228
 
74
229
  lowPriorityWarning = function (condition, format) {
75
230
  if (format === undefined) {
76
- 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');
77
232
  }
78
233
  if (!condition) {
79
234
  for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
@@ -87,14 +242,63 @@ var lowPriorityWarning = function () {};
87
242
 
88
243
  var lowPriorityWarning$1 = lowPriorityWarning;
89
244
 
90
- var describeComponentFrame = function (name, source, ownerName) {
91
- return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
92
- };
245
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
246
+
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
+ */
253
+
254
+ var warning = warningWithoutStack$1;
255
+
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
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
+ }
268
+
269
+ warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
270
+ };
271
+ }
93
272
 
94
- var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
273
+ var warning$1 = warning;
95
274
 
96
- var ReactCurrentOwner = ReactInternals.ReactCurrentOwner;
97
- var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
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
+ };
98
302
 
99
303
  // Exports ReactDOM.createRoot
100
304
 
@@ -126,21 +330,13 @@ var warnAboutDeprecatedLifecycles = false;
126
330
  // Gather advanced timing metrics for Profiler subtrees.
127
331
 
128
332
 
129
- // Only used in www builds.
333
+ // Track which interactions trigger each commit.
130
334
 
131
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
132
- // nor polyfill, then a plain number is used for performance.
133
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
134
335
 
336
+ // Only used in www builds.
337
+ var enableSuspenseServerRenderer = false;
135
338
 
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;
339
+ // Only used in www builds.
144
340
 
145
341
  // A reserved attribute.
146
342
  // It is handled by React separately and shouldn't be written to the DOM.
@@ -201,7 +397,7 @@ function isAttributeNameSafe(attributeName) {
201
397
  }
202
398
  illegalAttributeNameCache[attributeName] = true;
203
399
  {
204
- warning(false, 'Invalid attribute name: `%s`', attributeName);
400
+ warning$1(false, 'Invalid attribute name: `%s`', attributeName);
205
401
  }
206
402
  return false;
207
403
  }
@@ -327,7 +523,7 @@ var properties = {};
327
523
  // In React, we let users pass `true` and `false` even though technically
328
524
  // these aren't boolean attributes (they are coerced to strings).
329
525
  // Since these are SVG attributes, their attribute names are case-sensitive.
330
- ['autoReverse', 'externalResourcesRequired', 'preserveAlpha'].forEach(function (name) {
526
+ ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
331
527
  properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
332
528
  name, // attributeName
333
529
  null);
@@ -354,7 +550,7 @@ var properties = {};
354
550
  // disabled with `removeAttribute`. We have special logic for handling this.
355
551
  'multiple', 'muted', 'selected'].forEach(function (name) {
356
552
  properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
357
- name.toLowerCase(), // attributeName
553
+ name, // attributeName
358
554
  null);
359
555
  } // attributeNamespace
360
556
  );
@@ -363,7 +559,7 @@ var properties = {};
363
559
  // booleans, but can also accept a string value.
364
560
  ['capture', 'download'].forEach(function (name) {
365
561
  properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
366
- name.toLowerCase(), // attributeName
562
+ name, // attributeName
367
563
  null);
368
564
  } // attributeNamespace
369
565
  );
@@ -371,7 +567,7 @@ var properties = {};
371
567
  // These are HTML attributes that must be positive numbers.
372
568
  ['cols', 'rows', 'size', 'span'].forEach(function (name) {
373
569
  properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
374
- name.toLowerCase(), // attributeName
570
+ name, // attributeName
375
571
  null);
376
572
  } // attributeNamespace
377
573
  );
@@ -610,11 +806,15 @@ function getChildNamespace(parentNamespace, type) {
610
806
  return parentNamespace;
611
807
  }
612
808
 
809
+ var ReactDebugCurrentFrame$1 = null;
810
+
613
811
  var ReactControlledValuePropTypes = {
614
812
  checkPropTypes: null
615
813
  };
616
814
 
617
815
  {
816
+ ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
817
+
618
818
  var hasReadOnlyValue = {
619
819
  button: true,
620
820
  checkbox: true,
@@ -627,13 +827,13 @@ var ReactControlledValuePropTypes = {
627
827
 
628
828
  var propTypes = {
629
829
  value: function (props, propName, componentName) {
630
- 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) {
631
831
  return null;
632
832
  }
633
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`.');
634
834
  },
635
835
  checked: function (props, propName, componentName) {
636
- if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
836
+ if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
637
837
  return null;
638
838
  }
639
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`.');
@@ -644,8 +844,8 @@ var ReactControlledValuePropTypes = {
644
844
  * Provide a linked `value` attribute for controlled forms. You should not use
645
845
  * this outside of the ReactDOM controlled form components.
646
846
  */
647
- ReactControlledValuePropTypes.checkPropTypes = function (tagName, props, getStack) {
648
- checkPropTypes(propTypes, props, 'prop', tagName, getStack);
847
+ ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
848
+ checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum);
649
849
  };
650
850
  }
651
851
 
@@ -678,24 +878,31 @@ var voidElementTags = _assign({
678
878
  menuitem: true
679
879
  }, omittedCloseTags);
680
880
 
881
+ // TODO: We can remove this if we add invariantWithStack()
882
+ // or add stack by default to invariants where possible.
681
883
  var HTML = '__html';
682
884
 
683
- function assertValidProps(tag, props, getStack) {
885
+ var ReactDebugCurrentFrame$2 = null;
886
+ {
887
+ ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
888
+ }
889
+
890
+ function assertValidProps(tag, props) {
684
891
  if (!props) {
685
892
  return;
686
893
  }
687
894
  // Note the use of `==` which checks for null or undefined.
688
895
  if (voidElementTags[tag]) {
689
- !(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;
690
897
  }
691
898
  if (props.dangerouslySetInnerHTML != null) {
692
899
  !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
693
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;
694
901
  }
695
902
  {
696
- !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.%s', getStack()) : void 0;
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;
697
904
  }
698
- !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getStack()) : void 0;
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;
699
906
  }
700
907
 
701
908
  /**
@@ -717,6 +924,7 @@ var isUnitlessNumber = {
717
924
  flexShrink: true,
718
925
  flexNegative: true,
719
926
  flexOrder: true,
927
+ gridArea: true,
720
928
  gridRow: true,
721
929
  gridRowEnd: true,
722
930
  gridRowSpan: true,
@@ -803,6 +1011,26 @@ function dangerousStyleValue(name, value, isCustomProperty) {
803
1011
  return ('' + value).trim();
804
1012
  }
805
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
+
806
1034
  function isCustomComponent(tagName, props) {
807
1035
  if (tagName.indexOf('-') === -1) {
808
1036
  return typeof props.is === 'string';
@@ -826,11 +1054,13 @@ function isCustomComponent(tagName, props) {
826
1054
  }
827
1055
  }
828
1056
 
829
- var warnValidStyle = emptyFunction;
1057
+ var warnValidStyle = function () {};
830
1058
 
831
1059
  {
832
1060
  // 'msTransform' is correct, but the other prefixes should be capitalized
833
1061
  var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
1062
+ var msPattern$1 = /^-ms-/;
1063
+ var hyphenPattern = /-(.)/g;
834
1064
 
835
1065
  // style values shouldn't contain a semicolon
836
1066
  var badStyleValueWithSemicolonPattern = /;\s*$/;
@@ -840,65 +1070,75 @@ var warnValidStyle = emptyFunction;
840
1070
  var warnedForNaNValue = false;
841
1071
  var warnedForInfinityValue = false;
842
1072
 
843
- 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) {
844
1080
  if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
845
1081
  return;
846
1082
  }
847
1083
 
848
1084
  warnedStyleNames[name] = true;
849
- 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-')));
850
1090
  };
851
1091
 
852
- var warnBadVendoredStyleName = function (name, getStack) {
1092
+ var warnBadVendoredStyleName = function (name) {
853
1093
  if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
854
1094
  return;
855
1095
  }
856
1096
 
857
1097
  warnedStyleNames[name] = true;
858
- 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));
859
1099
  };
860
1100
 
861
- var warnStyleValueWithSemicolon = function (name, value, getStack) {
1101
+ var warnStyleValueWithSemicolon = function (name, value) {
862
1102
  if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
863
1103
  return;
864
1104
  }
865
1105
 
866
1106
  warnedStyleValues[value] = true;
867
- 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, ''));
868
1108
  };
869
1109
 
870
- var warnStyleValueIsNaN = function (name, value, getStack) {
1110
+ var warnStyleValueIsNaN = function (name, value) {
871
1111
  if (warnedForNaNValue) {
872
1112
  return;
873
1113
  }
874
1114
 
875
1115
  warnedForNaNValue = true;
876
- 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);
877
1117
  };
878
1118
 
879
- var warnStyleValueIsInfinity = function (name, value, getStack) {
1119
+ var warnStyleValueIsInfinity = function (name, value) {
880
1120
  if (warnedForInfinityValue) {
881
1121
  return;
882
1122
  }
883
1123
 
884
1124
  warnedForInfinityValue = true;
885
- 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);
886
1126
  };
887
1127
 
888
- warnValidStyle = function (name, value, getStack) {
1128
+ warnValidStyle = function (name, value) {
889
1129
  if (name.indexOf('-') > -1) {
890
- warnHyphenatedStyleName(name, getStack);
1130
+ warnHyphenatedStyleName(name);
891
1131
  } else if (badVendoredStyleNamePattern.test(name)) {
892
- warnBadVendoredStyleName(name, getStack);
1132
+ warnBadVendoredStyleName(name);
893
1133
  } else if (badStyleValueWithSemicolonPattern.test(value)) {
894
- warnStyleValueWithSemicolon(name, value, getStack);
1134
+ warnStyleValueWithSemicolon(name, value);
895
1135
  }
896
1136
 
897
1137
  if (typeof value === 'number') {
898
1138
  if (isNaN(value)) {
899
- warnStyleValueIsNaN(name, value, getStack);
1139
+ warnStyleValueIsNaN(name, value);
900
1140
  } else if (!isFinite(value)) {
901
- warnStyleValueIsInfinity(name, value, getStack);
1141
+ warnStyleValueIsInfinity(name, value);
902
1142
  }
903
1143
  }
904
1144
  };
@@ -967,11 +1207,6 @@ var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
967
1207
 
968
1208
  var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
969
1209
 
970
- function getStackAddendum$1() {
971
- var stack = ReactDebugCurrentFrame.getStackAddendum();
972
- return stack != null ? stack : '';
973
- }
974
-
975
1210
  function validateProperty(tagName, name) {
976
1211
  if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
977
1212
  return true;
@@ -984,13 +1219,13 @@ function validateProperty(tagName, name) {
984
1219
  // If this is an aria-* attribute, but is not listed in the known DOM
985
1220
  // DOM properties, then it is an invalid aria-* attribute.
986
1221
  if (correctName == null) {
987
- 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);
988
1223
  warnedProperties[name] = true;
989
1224
  return true;
990
1225
  }
991
1226
  // aria-* attributes should be lowercase; suggest the lowercase version.
992
1227
  if (name !== correctName) {
993
- 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);
994
1229
  warnedProperties[name] = true;
995
1230
  return true;
996
1231
  }
@@ -1008,7 +1243,7 @@ function validateProperty(tagName, name) {
1008
1243
  }
1009
1244
  // aria-* attributes should be lowercase; suggest the lowercase version.
1010
1245
  if (name !== standardName) {
1011
- 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);
1012
1247
  warnedProperties[name] = true;
1013
1248
  return true;
1014
1249
  }
@@ -1032,9 +1267,9 @@ function warnInvalidARIAProps(type, props) {
1032
1267
  }).join(', ');
1033
1268
 
1034
1269
  if (invalidProps.length === 1) {
1035
- 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);
1036
1271
  } else if (invalidProps.length > 1) {
1037
- 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);
1038
1273
  }
1039
1274
  }
1040
1275
 
@@ -1047,11 +1282,6 @@ function validateProperties(type, props) {
1047
1282
 
1048
1283
  var didWarnValueNull = false;
1049
1284
 
1050
- function getStackAddendum$2() {
1051
- var stack = ReactDebugCurrentFrame.getStackAddendum();
1052
- return stack != null ? stack : '';
1053
- }
1054
-
1055
1285
  function validateProperties$1(type, props) {
1056
1286
  if (type !== 'input' && type !== 'textarea' && type !== 'select') {
1057
1287
  return;
@@ -1060,9 +1290,9 @@ function validateProperties$1(type, props) {
1060
1290
  if (props != null && props.value === null && !didWarnValueNull) {
1061
1291
  didWarnValueNull = true;
1062
1292
  if (type === 'select' && props.multiple) {
1063
- 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);
1064
1294
  } else {
1065
- 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);
1066
1296
  }
1067
1297
  }
1068
1298
  }
@@ -1613,11 +1843,6 @@ var possibleStandardNames = {
1613
1843
  zoomandpan: 'zoomAndPan'
1614
1844
  };
1615
1845
 
1616
- function getStackAddendum$3() {
1617
- var stack = ReactDebugCurrentFrame.getStackAddendum();
1618
- return stack != null ? stack : '';
1619
- }
1620
-
1621
1846
  var validateProperty$1 = function () {};
1622
1847
 
1623
1848
  {
@@ -1635,7 +1860,7 @@ var validateProperty$1 = function () {};
1635
1860
 
1636
1861
  var lowerCasedName = name.toLowerCase();
1637
1862
  if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
1638
- 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.');
1639
1864
  warnedProperties$1[name] = true;
1640
1865
  return true;
1641
1866
  }
@@ -1647,12 +1872,12 @@ var validateProperty$1 = function () {};
1647
1872
  }
1648
1873
  var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
1649
1874
  if (registrationName != null) {
1650
- 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);
1651
1876
  warnedProperties$1[name] = true;
1652
1877
  return true;
1653
1878
  }
1654
1879
  if (EVENT_NAME_REGEX.test(name)) {
1655
- 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);
1656
1881
  warnedProperties$1[name] = true;
1657
1882
  return true;
1658
1883
  }
@@ -1661,7 +1886,7 @@ var validateProperty$1 = function () {};
1661
1886
  // So we can't tell if the event name is correct for sure, but we can filter
1662
1887
  // out known bad ones like `onclick`. We can't suggest a specific replacement though.
1663
1888
  if (INVALID_EVENT_NAME_REGEX.test(name)) {
1664
- 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);
1665
1890
  }
1666
1891
  warnedProperties$1[name] = true;
1667
1892
  return true;
@@ -1673,25 +1898,25 @@ var validateProperty$1 = function () {};
1673
1898
  }
1674
1899
 
1675
1900
  if (lowerCasedName === 'innerhtml') {
1676
- 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`.');
1677
1902
  warnedProperties$1[name] = true;
1678
1903
  return true;
1679
1904
  }
1680
1905
 
1681
1906
  if (lowerCasedName === 'aria') {
1682
- 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.');
1683
1908
  warnedProperties$1[name] = true;
1684
1909
  return true;
1685
1910
  }
1686
1911
 
1687
1912
  if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
1688
- 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);
1689
1914
  warnedProperties$1[name] = true;
1690
1915
  return true;
1691
1916
  }
1692
1917
 
1693
1918
  if (typeof value === 'number' && isNaN(value)) {
1694
- 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);
1695
1920
  warnedProperties$1[name] = true;
1696
1921
  return true;
1697
1922
  }
@@ -1703,23 +1928,23 @@ var validateProperty$1 = function () {};
1703
1928
  if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
1704
1929
  var standardName = possibleStandardNames[lowerCasedName];
1705
1930
  if (standardName !== name) {
1706
- 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);
1707
1932
  warnedProperties$1[name] = true;
1708
1933
  return true;
1709
1934
  }
1710
1935
  } else if (!isReserved && name !== lowerCasedName) {
1711
1936
  // Unknown attributes should have lowercase casing since that's how they
1712
1937
  // will be cased anyway with server rendering.
1713
- 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);
1714
1939
  warnedProperties$1[name] = true;
1715
1940
  return true;
1716
1941
  }
1717
1942
 
1718
1943
  if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
1719
1944
  if (value) {
1720
- 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);
1721
1946
  } else {
1722
- 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);
1723
1948
  }
1724
1949
  warnedProperties$1[name] = true;
1725
1950
  return true;
@@ -1737,6 +1962,13 @@ var validateProperty$1 = function () {};
1737
1962
  return false;
1738
1963
  }
1739
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
+
1740
1972
  return true;
1741
1973
  };
1742
1974
  }
@@ -1754,9 +1986,9 @@ var warnUnknownProperties = function (type, props, canUseEventSystem) {
1754
1986
  return '`' + prop + '`';
1755
1987
  }).join(', ');
1756
1988
  if (unknownProps.length === 1) {
1757
- 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);
1758
1990
  } else if (unknownProps.length > 1) {
1759
- 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);
1760
1992
  }
1761
1993
  };
1762
1994
 
@@ -1773,18 +2005,29 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
1773
2005
 
1774
2006
  var toArray = React.Children.toArray;
1775
2007
 
1776
- var currentDebugStack = void 0;
1777
- 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 = [];
1778
2013
 
1779
- var getStackAddendum = emptyFunction.thatReturns('');
1780
- 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
+ };
1781
2022
 
1782
2023
  var validatePropertiesInDevelopment = function (type, props) {};
1783
- var setCurrentDebugStack = function (stack) {};
2024
+ var pushCurrentDebugStack = function (stack) {};
1784
2025
  var pushElementToDebugStack = function (element) {};
1785
- var resetCurrentDebugStack = function () {};
2026
+ var popCurrentDebugStack = function () {};
1786
2027
 
1787
2028
  {
2029
+ ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2030
+
1788
2031
  validatePropertiesInDevelopment = function (type, props) {
1789
2032
  validateProperties(type, props);
1790
2033
  validateProperties$1(type, props);
@@ -1799,34 +2042,55 @@ var resetCurrentDebugStack = function () {};
1799
2042
  return describeComponentFrame(name, source, ownerName);
1800
2043
  };
1801
2044
 
1802
- currentDebugStack = null;
1803
- currentDebugElementStack = null;
1804
- setCurrentDebugStack = function (stack) {
1805
- var frame = stack[stack.length - 1];
1806
- currentDebugElementStack = frame.debugElementStack;
1807
- // We are about to enter a new composite stack, reset the array.
1808
- currentDebugElementStack.length = 0;
1809
- currentDebugStack = stack;
1810
- 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
+ }
1811
2054
  };
2055
+
1812
2056
  pushElementToDebugStack = function (element) {
1813
- if (currentDebugElementStack !== null) {
1814
- currentDebugElementStack.push(element);
1815
- }
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.
1816
2066
  };
1817
- resetCurrentDebugStack = function () {
1818
- currentDebugElementStack = null;
1819
- currentDebugStack = null;
1820
- 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
+ }
1821
2077
  };
1822
- getStackAddendum = function () {
1823
- if (currentDebugStack === null) {
2078
+
2079
+ getCurrentServerStackImpl = function () {
2080
+ if (currentDebugStacks.length === 0) {
2081
+ // Nothing is currently rendering.
1824
2082
  return '';
1825
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];
1826
2087
  var stack = '';
1827
- var debugStack = currentDebugStack;
1828
- for (var i = debugStack.length - 1; i >= 0; i--) {
1829
- 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()`.
1830
2094
  var _debugElementStack = frame.debugElementStack;
1831
2095
  for (var ii = _debugElementStack.length - 1; ii >= 0; ii--) {
1832
2096
  stack += describeStackFrame(_debugElementStack[ii]);
@@ -1853,10 +2117,6 @@ var newlineEatingTags = {
1853
2117
  textarea: true
1854
2118
  };
1855
2119
 
1856
- function getComponentName(type) {
1857
- return typeof type === 'string' ? type : typeof type === 'function' ? type.displayName || type.name : null;
1858
- }
1859
-
1860
2120
  // We accept any tag to be rendered but since this gets injected into arbitrary
1861
2121
  // HTML, we want to make sure that it's a safe tag.
1862
2122
  // http://www.w3.org/TR/REC-xml/#NT-Name
@@ -1869,9 +2129,15 @@ function validateDangerousTag(tag) {
1869
2129
  }
1870
2130
  }
1871
2131
 
1872
- var processStyleName = memoizeStringOnly(function (styleName) {
1873
- return hyphenateStyleName(styleName);
1874
- });
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
+ };
1875
2141
 
1876
2142
  function createMarkupForStyles(styles) {
1877
2143
  var serialized = '';
@@ -1884,7 +2150,7 @@ function createMarkupForStyles(styles) {
1884
2150
  var styleValue = styles[styleName];
1885
2151
  {
1886
2152
  if (!isCustomProperty) {
1887
- warnValidStyle$1(styleName, styleValue, getStackAddendum);
2153
+ warnValidStyle$1(styleName, styleValue);
1888
2154
  }
1889
2155
  }
1890
2156
  if (styleValue != null) {
@@ -1906,7 +2172,7 @@ function warnNoop(publicInstance, callerName) {
1906
2172
  return;
1907
2173
  }
1908
2174
 
1909
- 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);
1910
2176
  didWarnAboutNoopUpdateForComponent[warningKey] = true;
1911
2177
  }
1912
2178
  }
@@ -1947,6 +2213,9 @@ function flattenTopLevelChildren(children) {
1947
2213
  }
1948
2214
 
1949
2215
  function flattenOptionChildren(children) {
2216
+ if (children === undefined || children === null) {
2217
+ return children;
2218
+ }
1950
2219
  var content = '';
1951
2220
  // Flatten children and warn if they aren't strings or numbers;
1952
2221
  // invalid types are ignored.
@@ -1954,20 +2223,22 @@ function flattenOptionChildren(children) {
1954
2223
  if (child == null) {
1955
2224
  return;
1956
2225
  }
1957
- if (typeof child === 'string' || typeof child === 'number') {
1958
- content += child;
1959
- } else {
1960
- {
1961
- if (!didWarnInvalidOptionChildren) {
1962
- didWarnInvalidOptionChildren = true;
1963
- warning(false, 'Only strings and numbers are supported as <option> children.');
1964
- }
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.');
1965
2231
  }
1966
2232
  }
1967
2233
  });
1968
2234
  return content;
1969
2235
  }
1970
2236
 
2237
+ var emptyObject = {};
2238
+ {
2239
+ Object.freeze(emptyObject);
2240
+ }
2241
+
1971
2242
  function maskContext(type, context) {
1972
2243
  var contextTypes = type.contextTypes;
1973
2244
  if (!contextTypes) {
@@ -1982,7 +2253,7 @@ function maskContext(type, context) {
1982
2253
 
1983
2254
  function checkContextTypes(typeSpecs, values, location) {
1984
2255
  {
1985
- checkPropTypes(typeSpecs, values, location, 'Component', getStackAddendum);
2256
+ checkPropTypes(typeSpecs, values, location, 'Component', getCurrentServerStackImpl);
1986
2257
  }
1987
2258
  }
1988
2259
 
@@ -2102,7 +2373,7 @@ function resolve(child, context) {
2102
2373
  if (inst.state === null || inst.state === undefined) {
2103
2374
  var componentName = getComponentName(Component) || 'Unknown';
2104
2375
  if (!didWarnAboutUninitializedState[componentName]) {
2105
- 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);
2106
2377
  didWarnAboutUninitializedState[componentName] = true;
2107
2378
  }
2108
2379
  }
@@ -2114,7 +2385,7 @@ function resolve(child, context) {
2114
2385
  if (partialState === undefined) {
2115
2386
  var _componentName = getComponentName(Component) || 'Unknown';
2116
2387
  if (!didWarnAboutUndefinedDerivedState[_componentName]) {
2117
- 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);
2118
2389
  didWarnAboutUndefinedDerivedState[_componentName] = true;
2119
2390
  }
2120
2391
  }
@@ -2130,7 +2401,7 @@ function resolve(child, context) {
2130
2401
  var _componentName2 = getComponentName(Component) || 'Unknown';
2131
2402
 
2132
2403
  if (!didWarnAboutBadClass[_componentName2]) {
2133
- 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);
2134
2405
  didWarnAboutBadClass[_componentName2] = true;
2135
2406
  }
2136
2407
  }
@@ -2224,7 +2495,7 @@ function resolve(child, context) {
2224
2495
  !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
2225
2496
  }
2226
2497
  } else {
2227
- 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');
2228
2499
  }
2229
2500
  }
2230
2501
  if (childContext) {
@@ -2303,7 +2574,7 @@ var ReactDOMServerRenderer = function () {
2303
2574
  ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
2304
2575
  var index = this.contextIndex;
2305
2576
  {
2306
- !(index > -1 && provider === this.contextProviderStack[index]) ? warning(false, 'Unexpected pop.') : void 0;
2577
+ !(index > -1 && provider === this.contextProviderStack[index]) ? warningWithoutStack$1(false, 'Unexpected pop.') : void 0;
2307
2578
  }
2308
2579
 
2309
2580
  var context = this.contextStack[index];
@@ -2352,12 +2623,15 @@ var ReactDOMServerRenderer = function () {
2352
2623
  }
2353
2624
  var child = frame.children[frame.childIndex++];
2354
2625
  {
2355
- setCurrentDebugStack(this.stack);
2356
- }
2357
- out += this.render(child, frame.context, frame.domNamespace);
2358
- {
2359
- // TODO: Handle reentrant server render calls. This doesn't.
2360
- 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
+ }
2361
2635
  }
2362
2636
  }
2363
2637
  return out;
@@ -2439,6 +2713,27 @@ var ReactDOMServerRenderer = function () {
2439
2713
  this.stack.push(_frame);
2440
2714
  return '';
2441
2715
  }
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
+ }
2442
2737
  // eslint-disable-next-line-no-fallthrough
2443
2738
  default:
2444
2739
  break;
@@ -2448,41 +2743,41 @@ var ReactDOMServerRenderer = function () {
2448
2743
  case REACT_FORWARD_REF_TYPE:
2449
2744
  {
2450
2745
  var element = nextChild;
2451
- var _nextChildren2 = toArray(elementType.render(element.props, element.ref));
2452
- var _frame2 = {
2746
+ var _nextChildren3 = toArray(elementType.render(element.props, element.ref));
2747
+ var _frame3 = {
2453
2748
  type: null,
2454
2749
  domNamespace: parentNamespace,
2455
- children: _nextChildren2,
2750
+ children: _nextChildren3,
2456
2751
  childIndex: 0,
2457
2752
  context: context,
2458
2753
  footer: ''
2459
2754
  };
2460
2755
  {
2461
- _frame2.debugElementStack = [];
2756
+ _frame3.debugElementStack = [];
2462
2757
  }
2463
- this.stack.push(_frame2);
2758
+ this.stack.push(_frame3);
2464
2759
  return '';
2465
2760
  }
2466
2761
  case REACT_PROVIDER_TYPE:
2467
2762
  {
2468
2763
  var provider = nextChild;
2469
2764
  var nextProps = provider.props;
2470
- var _nextChildren3 = toArray(nextProps.children);
2471
- var _frame3 = {
2765
+ var _nextChildren4 = toArray(nextProps.children);
2766
+ var _frame4 = {
2472
2767
  type: provider,
2473
2768
  domNamespace: parentNamespace,
2474
- children: _nextChildren3,
2769
+ children: _nextChildren4,
2475
2770
  childIndex: 0,
2476
2771
  context: context,
2477
2772
  footer: ''
2478
2773
  };
2479
2774
  {
2480
- _frame3.debugElementStack = [];
2775
+ _frame4.debugElementStack = [];
2481
2776
  }
2482
2777
 
2483
2778
  this.pushProvider(provider);
2484
2779
 
2485
- this.stack.push(_frame3);
2780
+ this.stack.push(_frame4);
2486
2781
  return '';
2487
2782
  }
2488
2783
  case REACT_CONTEXT_TYPE:
@@ -2491,19 +2786,19 @@ var ReactDOMServerRenderer = function () {
2491
2786
  var _nextProps = consumer.props;
2492
2787
  var nextValue = consumer.type._currentValue;
2493
2788
 
2494
- var _nextChildren4 = toArray(_nextProps.children(nextValue));
2495
- var _frame4 = {
2789
+ var _nextChildren5 = toArray(_nextProps.children(nextValue));
2790
+ var _frame5 = {
2496
2791
  type: nextChild,
2497
2792
  domNamespace: parentNamespace,
2498
- children: _nextChildren4,
2793
+ children: _nextChildren5,
2499
2794
  childIndex: 0,
2500
2795
  context: context,
2501
2796
  footer: ''
2502
2797
  };
2503
2798
  {
2504
- _frame4.debugElementStack = [];
2799
+ _frame5.debugElementStack = [];
2505
2800
  }
2506
- this.stack.push(_frame4);
2801
+ this.stack.push(_frame5);
2507
2802
  return '';
2508
2803
  }
2509
2804
  default:
@@ -2538,7 +2833,7 @@ var ReactDOMServerRenderer = function () {
2538
2833
  if (namespace === Namespaces.html) {
2539
2834
  // Should this check be gated by parent namespace? Not sure we want to
2540
2835
  // allow <SVG> or <mATH>.
2541
- !(tag === element.type) ? warning(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type) : void 0;
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;
2542
2837
  }
2543
2838
  }
2544
2839
 
@@ -2547,14 +2842,14 @@ var ReactDOMServerRenderer = function () {
2547
2842
  var props = element.props;
2548
2843
  if (tag === 'input') {
2549
2844
  {
2550
- ReactControlledValuePropTypes.checkPropTypes('input', props, getStackAddendum);
2845
+ ReactControlledValuePropTypes.checkPropTypes('input', props);
2551
2846
 
2552
2847
  if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
2553
- 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);
2554
2849
  didWarnDefaultChecked = true;
2555
2850
  }
2556
2851
  if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
2557
- 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);
2558
2853
  didWarnDefaultInputValue = true;
2559
2854
  }
2560
2855
  }
@@ -2569,9 +2864,9 @@ var ReactDOMServerRenderer = function () {
2569
2864
  });
2570
2865
  } else if (tag === 'textarea') {
2571
2866
  {
2572
- ReactControlledValuePropTypes.checkPropTypes('textarea', props, getStackAddendum);
2867
+ ReactControlledValuePropTypes.checkPropTypes('textarea', props);
2573
2868
  if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
2574
- 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');
2575
2870
  didWarnDefaultTextareaValue = true;
2576
2871
  }
2577
2872
  }
@@ -2583,7 +2878,7 @@ var ReactDOMServerRenderer = function () {
2583
2878
  var textareaChildren = props.children;
2584
2879
  if (textareaChildren != null) {
2585
2880
  {
2586
- 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>.');
2587
2882
  }
2588
2883
  !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
2589
2884
  if (Array.isArray(textareaChildren)) {
@@ -2605,7 +2900,7 @@ var ReactDOMServerRenderer = function () {
2605
2900
  });
2606
2901
  } else if (tag === 'select') {
2607
2902
  {
2608
- ReactControlledValuePropTypes.checkPropTypes('select', props, getStackAddendum);
2903
+ ReactControlledValuePropTypes.checkPropTypes('select', props);
2609
2904
 
2610
2905
  for (var i = 0; i < valuePropNames.length; i++) {
2611
2906
  var propName = valuePropNames[i];
@@ -2614,16 +2909,14 @@ var ReactDOMServerRenderer = function () {
2614
2909
  }
2615
2910
  var isArray = Array.isArray(props[propName]);
2616
2911
  if (props.multiple && !isArray) {
2617
- warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, '' // getDeclarationErrorAddendum(),
2618
- );
2912
+ warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
2619
2913
  } else if (!props.multiple && isArray) {
2620
- warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, '' // getDeclarationErrorAddendum(),
2621
- );
2914
+ warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
2622
2915
  }
2623
2916
  }
2624
2917
 
2625
2918
  if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
2626
- 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');
2627
2920
  didWarnDefaultSelectValue = true;
2628
2921
  }
2629
2922
  }
@@ -2669,7 +2962,7 @@ var ReactDOMServerRenderer = function () {
2669
2962
  validatePropertiesInDevelopment(tag, props);
2670
2963
  }
2671
2964
 
2672
- assertValidProps(tag, props, getStackAddendum);
2965
+ assertValidProps(tag, props);
2673
2966
 
2674
2967
  var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
2675
2968
  var footer = '';
@@ -2811,7 +3104,7 @@ var ReactDOMServer = ( ReactDOMServerNode$1 && ReactDOMServerNode ) || ReactDOMS
2811
3104
 
2812
3105
  // TODO: decide on the top-level export form.
2813
3106
  // This is hacky but makes it work with both Rollup and Jest
2814
- var server_node = ReactDOMServer.default ? ReactDOMServer.default : ReactDOMServer;
3107
+ var server_node = ReactDOMServer.default || ReactDOMServer;
2815
3108
 
2816
3109
  module.exports = server_node;
2817
3110
  })();